Hi! I found the source code of osmconvert in the following page: http://m.m.i24.cc/osmconvert.c However, there seems to be something special about this script. Normally, C is written in separate files while linked with headers. It is very difficult to find a C script with over 10000 lines. What is more peculiar is that the term 'module' is used, which is a Python concept. There is nothing called 'module' in C. Therefore, I am suggesting that it is originally written in Python, and then translated to C. If that is the case, can the developer please open the Python source code and the way to translate Python to C? Thanks. P.S. The new version of osmconvert does not write object visibility. Is that a bug? asked 14 Mar '17, 15:22 Wetitpig0
showing 5 of 6
show 1 more comments
|
The question has been closed for the following reason "The question is answered, right answer was accepted" by Wetitpig0 29 Dec '17, 04:29
Yes, this is pure C and definitely not something translated from Python. Like pretty much any programming language from the last 50 years, C supports modularization, it just doesn't have a keyword called "module". Being the huge monolithic source that it is, osmconvert (or rather its author) doesn't seem to be all that fond of this module concept which makes it hard to understand and change indeed. By modularizing it and using the standard library plus some external XML library, it culd probably be cut down by a large amount. I'm afraid I have no idea about the visibility issue, it looks like that's simply not yet supported. answered 15 Mar '17, 04:05 mbethke 3
Thanks to mbethke! I'd like to confirm that the program is written in plain C. You can split the source file into pieces, of course, I just failed to see the advantage in having the modules moved to separate files. The modules will stay modules, no matter if they are in the same file or not.
(15 Mar '17, 19:52)
Marqqs
1
Actually, generally, it is a good idea to break a C (or C++) program in "modules." Actually, this is true of any language that creates linkable object files. (Even, Assembler, COBOL and FORTRAN (A half century in the field and having used all five of the mentioned languages.).) A good reason is to keep private values and routines private by not declaring them public or external.
(15 Mar '17, 23:37)
OverThere
1
Also agreed. That is why osmconvert in fact uses modules with private variables, private functions, etc. The only specialty here is that these modules have been placed into a single source file – like C++ classes, for example.
(16 Mar '17, 09:45)
Marqqs
Btw, Marqqs can u include a directory listing for m.m.i24.cc so that we can look for the programs more easily?
(31 Dec '17, 16:33)
Wetitpig0
|
I have written a mail to https://www.openstreetmap.org/user/Marqqs
How to contribute to osmconvert?
@Wetitpig0: I just found e.g. https://wiki.openstreetmap.org/wiki/User_talk:Marqqs#Small_error_in_Osmconvert :-)
@Wetipig0 I guess clone https://gitlab.com/osm-c-tools/osmctools and send a merge request ? Given the look of the code, I'm not surprised that it's basically a one-man-show: https://gitlab.com/osm-c-tools/osmctools/graphs/master :/
@Vincent de P: oh, I missed that one on the wiki page of osmconvert. It was quite well hidden under "downloads".
meta @Wetitpig0: please could you ask your second (side)question in a new question entry (and delete that part here)? Thanks!