On Mon, 9 Dec 2024 at 20:21, Michael Riedl wrote:
I found your m2meter tool useful and did some modifications (including a
sample of use).
https://codeberg.org/hzlb0l/Modula-2_Tools/src/branch/main/Werkzeuge/m2meter
Thank you for reaching out.
M2Meter is a library, not a utility. It is supposed to be imported into a program that wants to use the metrics measured by the m2meter library. If you want to have a standalone utility that prints the metrics, you can write a simple driver program that imports the library, calls the library measure function on an input file and then write the measured metrics to the console. The library itself should not be modified into a standalone utility.
Granted, the name m2meter is perhaps more suitable for a utility and the library should better have been called m2metrics. I can change that.
The library should not need any modifications for use with ISO Modula-2, unless there is an ISO related bug. The library uses the basic IO library from the m2pp project which supports both PIM and ISO dialects. There are separate versions of the Infile module for PIM and ISO:
There should also be no need for any modifications to compile the library with GM2, again unless there is a GM2 related bug in it. Any compiler specific code is in the lower layer of the aforementioned basic IO library
and there are separate versions for different compilers in lower modules where this is required. The modules that are GM2 specific are:
BTW, you can easily spot which dialect the a source file is intended for by the dialect tag in the first line
(*!m2iso*)
I would encourage you to use these dialect tags in your own code as well. Many years ago I made a patch for vim to use these tags to select the correct dialect for syntax colouring and this has now been incorporated in the official vim tree. Also I seem to remember, Gaius had done the same for Emacs.
The Pygments syntax highlighting framework for Python also recognises the tags and this is used by a number of content management systems and thus many websites that display source code.
Finally, as for cosmetics, all my code is written to our coding standard
If you find any code that does not conform to this coding standard, that code should then be modified to conform with it, otherwise no style changes are desirable because it would make the code inconsistent.
I apologise for not having all that info in the readme page of the m2meter library. I usually put this into the repo's readme or wiki but this one was very low priority as it is not an essential library so I left detailed library documentation for later.
regards
benjamin
I will update the repository soon with a GNU M2 makefile and some code
clean-ups after final checks.
Please check if licence and reference are OK with you.
Gruß
Michael