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, 15:22

Wetitpig0's gravatar image

Wetitpig0
2032921
accept rate: 12%

edited 14 Mar, 15:56

(14 Mar, 20:32) aseerel4c26 ♦

How to contribute to osmconvert?

(15 Mar, 05:00) Wetitpig0
2

@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 :/

(15 Mar, 10:51) Vincent de P... ♦

@Vincent de P: oh, I missed that one on the wiki page of osmconvert. It was quite well hidden under "downloads".

(15 Mar, 18:35) aseerel4c26 ♦

meta @Wetitpig0: please could you ask your second (side)question in a new question entry (and delete that part here)? Thanks!

(15 Mar, 21:23) aseerel4c26 ♦
showing 5 of 6 show 1 more comments

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.

permanent link

answered 15 Mar, 04:05

mbethke's gravatar image

mbethke
131114
accept rate: 0%

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, 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, 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, 09:45) Marqqs
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×26
×26
×18
×11
×3

question asked: 14 Mar, 15:22

question was seen: 203 times

last updated: 25 Mar, 09:40

powered by OSQA