Lines of code in modules -- without comments and with conditional compile applied

Hello,

Is here an existing / simple way to get at the lines of code per module and if conditionals are taking into account.

thanks,

Dan

thanks

Is there a way to pipe this into something that can count lines.

Ideally, i would write a little program that given a list of modules will generate a total line count

Looks like there is a way by redirecting standard output

But, i guess if this can be done in a streaming way – i.e. line by line.

Alternatively, i will just have to work with files and process them for example, one at a time.

This seems like an interesting approach, using the pio library.

Need to think how this can be turned into a line-by-line count

And the ultimate one for reading lines

If you are not too bothered that the listing is going to be read to a string, you could do something like this:

with_output_to(string(X), listing(lists:_)),
aggregate_all(count, sub_string(X, _, _, _, "\n"), Count)

Careful, the toplevel will print out the full output of listing/1 as a string. The sub_string/5 as used here counts empty lines as well, maybe you don’t want this.