Forums : Ohloh General Discussion

Dear Open Hub Users,

We’re excited to announce that we will be moving the Open Hub Forum to https://community.synopsys.com/s/black-duck-open-hub. Beginning immediately, users can head over, register, get technical help and discuss issue pertinent to the Open Hub. Registered users can also subscribe to Open Hub announcements here.


On May 1, 2020, we will be freezing https://www.openhub.net/forums and users will not be able to create new discussions. If you have any questions and concerns, please email us at [email protected]

Making Ohloh recognise Modula-2

I have registered several Modula-2 projects with Ohloh today and I am surprised that Ohloh didn't recognise the language.

It does recognise Pascal. Modula-2 uses the same comment syntax as Pascal (* comment *), so this shouldn't be difficult to add.

Who do I need to contact to go about this?

trijezdci about 14 years ago
 

Hi trijezdci,

I agree on both counts. I'm surprised that we don't already recognize Modula-2, and I also agree that it should be simple to add.

There is already an old open ticket requesting this feature, but as you may have guessed we have been slow about getting it done.

If you would like to attempt adding a Modula-2 line counter, the source code for our line counter Ohcount is available at SourceForge and at Github. Simply cutting and pasting the existing Pascal parser will probably get you most of the way there. If you manage to get it working, I'll be happy to deploy the patch here at Ohloh.

Thanks,
Robin

Robin Luckey about 14 years ago
 

Hi, thanks for your reply. I will give that a try and get back to you.

trijezdci about 14 years ago
 

Ok, I did the modifications for Modula-2, Modula-3 and Oberon.

Robin, could you pull the sources and commit them?

http://bitbucket.org/trijezdci/wirthianohcountsupport/src

thanks in advance

trijezdci about 14 years ago
 

Hi trijezci,

I'd like to apply these changes, but there are a few more things we need.

Can you supply some (small) sample source code files to use for testing purposes? They should include all the cases required by the parser. Also make sure that the code you choose for the test is not encumbered by a license.

Even better than that, could you please implement the tests to verify the parsers? To do this, you should only need to add your sample source code to the test/src_dir directory, and put the expected parser output into the test/expected_dir directory with the same filename. You can look at the other files in the directories for examples on what this looks like.

Once you supply files in test/src_dir and test/expected_dir, the test suite should automatically pick up your new files and run a parser test against them.

I'm happy to pull your files individually and create a git patch, but in the future it would be handy to receive changes in the form of a patch file or Git repository URL. If that's a pain, don't worry about it this time around.

Thanks,
Robin

Robin Luckey about 14 years ago
 

I have added sample files for all the different file endings to the repo:

http://bitbucket.org/trijezdci/wirthianohcountsupport/src/tip/samples/

the files have comments (on a single line and spanning more than one line) and strings (single and double quoted), blank lines and ANY code lines. There are no other entities defined, so this should suffice.

However, if you want to try a file that is more than just a handful of lines, you could use:

http://bitbucket.org/trijezdci/m2collections/src/tip/LIFO.def
http://bitbucket.org/trijezdci/m2collections/src/tip/LIFO.mod

I do not have any longer files for Oberon and Modula-3 though.

I am not sure what you mean by license encumbered, but I added a document that states that the seven files in the sample directory are released into the public domain.

If you don't mind creating the patches, I would appreciate it.

thanks a lot

trijezdci about 14 years ago
 

Hi trijezci,

This code does not compile.

For example, in modula2.rl, modula2_string_entity is undefined because modula3_string_entity is defined instead. It looks like a simple cut-and-paste error.

Please make sure that your code compiles, and please submit an entire working code tree.

Thanks,
Robin

Robin Luckey about 14 years ago
 

I fixed the typo. Sorry about that.

http://bitbucket.org/trijezdci/wirthianohcountsupport/changeset/1df05eec0cd3/

As far as the rest is concerned, I do not know ruby nor ragel nor the Ohcount build system nor do I have the time right now to learn any of that. I have already invested an entire working day into doing what I have done so far and thereby paid my dues. I believe that a developer who is working on the Ohcount project on an ongoing basis should have no problem to take what I have prepared so far and apply it to the code base within a matter of minutes.

Modula-2, Modula-3 and Oberon developers will be grateful to you if you could take it from here. Thank you very much in advance.

trijezdci about 14 years ago
 

Hi trijezdci,

Even with the typo correction, this code does not properly recognize the new languages.

Without a completed, working patch, I can't steal any more time from my work calendar for this. Of course I can complete the work myself, but how I spend my time at work isn't totally up to me. The work will have to wait in my backlog until I can schedule more time for it. We will get it done, but it can't be today.

I'm sorry that the time invested so far will not pay off immediately, and I do appreciate the effort you've made, but the point of accepting patches from the community is to save time, not to add unscheduled work items onto our calendars.

Robin Luckey about 14 years ago
 

As I understand it, the lack of support for Modula-2 had been an outstanding issue already for quite some time. Also, the files I prepared are for three languages, not just one. I believe that for these two reasons alone this request deserves an above average level of priority.

Nevertheless, gaius has asked for help on the GM2 mailing list. With a bit of luck we might find somebody who has the required skills who can do this without having to invest much time.

thanks again for your consideration

trijezdci about 14 years ago
 

I'll take a crack at this. I have plenty of Modula-3 source to test it against and should have no problem finding Oberon source too.

ttmrichter about 14 years ago
 

ttmricher, thank you for volunteering to help on this.

Robin said that the sample files in the sample directory do not get properly recognised, it is probably a good idea to start with those samples.

Also, since Ohcount is really a counter not a parser, there are only four test cases:

1) does it recognise the file extensions, eg. .mod and .def for Modula-2

2) does it recognise blank lines

3) does it recognise strings

4) does it recognise comments

anything recognised as #2 is counted as code and anything that isn't recognised as #3 or #4 is counted as code

The sample files cover these 4 cases.

trijezdci about 14 years ago
 

Robin, could you remove the 5 spam messages posted by yzsun9, please. thanks in advance.

trijezdci about 14 years ago
 

I have completed the work for the line counters for Modula-2, Modula-3, and Oberon.

You can see the resulting patch here.

This code should be deployed to our production servers sometime in the next day or two, at which point I'll schedule clean recounts for the affected projects.

Thanks,
Robin

Robin Luckey about 14 years ago
 

There's also .mg and .ig for Modula-3 file extensions. They're used in generics, module and interface respectively.

ttmrichter about 14 years ago
 

Robin, great news, thank you very much.

trijezdci about 14 years ago
 

Robin,

regarding ticket #30 ...

I have sent an email to Leo Kuznetsov and asked him if he could rename all the *.d and *.m filenames in the Kronos repository to *.def and *.mod filenames.

I personally feel that this would be a much better solution. Not only would it be far easier to do for him to rename the files than it would be for you to write code to disambiguate, but also, there is not a single Modula-2 compiler today that uses .d and .m filenames.

It is extremely unlikely that any Modula-2 project will ever use .d and .m filenames again. The Kronos Modula-2 compiler eventually became XDS Modula-2 which uses .def and .mod filenames.

In fact, we probably shouldn't encourage anybody to name their files incorrectly.

Anyway, I will let you know if and when I hear anything back from Leo.

thanks again

trijezdci about 14 years ago
 

Robin, I have received a reply from Leo. He says he will consider renaming the files to use standard file extensions. I think he just needs to work out how to hide the historic branch from Ohloh so that Ohloh only sees the renamed files in a new branch or repo.

trijezdci about 14 years ago
 

Hi Robin,

many thanks for adding Modula-2 to the supported languages. Just wondering if I need to do anything to the project GNU Modula-2 in order for ohloh to provide new stats.

gaiusmulley about 14 years ago
 

Gaius,

all you need to do is wait until Ohloh revisits the GM2 repository, that shouldn't take more than a couple of days.

trijezdci about 14 years ago
 

As a fan of these languages, I appreciate the effort that everyone has put forth.

qnr about 14 years ago
 

I've scheduled a clean recount of the GNU Modula-2 project to pick up all of the Modula-2 code.

If there are any other projects that you need recounted, let me know, because we'll need to schedule full recounts to pick up all of the code in the new languages.

Otherwise, Ohloh only performs incremental updates, and only the new code found in new commits will be recognized in the new languages.

Robin

Robin Luckey about 14 years ago