ioccc-src / mkiocccentry

Form an IOCCC entry as a compressed tarball file
Other
28 stars 5 forks source link

Move parse_verbosity(3) to dbg facility #813

Closed xexyl closed 9 months ago

xexyl commented 9 months ago

Since the debug facility is the one that uses a verbosity_level that I added here I have moved the function from jparse/util.c to dbg/dbg.c.

The dbg.3 man page has been updated with this and also some other improvements. There is a recursive reference to the man page for parse_verbosity(3) in the man page just for fun.

The dbg related changes have already been added to the dbg(3) repo as a pull request.

The dbg_example.c file that I wrote for this repo and the dbg(3) repo has also been updated with a comment change, referring to not strtol(3) but rather the parse_verbosity(3) function.

The dyn_array/dyn_test.c no longer has the parse_verbosity() function as this is in the dbg(3) facility which the dyn_array facility uses.

xexyl commented 9 months ago

Next for the dyn_array(3) repo to do this as it requires the dbg(3) repo anyway... at least: the code here does. If it does not include it in the dyn_array repo then something else will have to be done. I'll see and if it is a problem I'll reply to this comment. Else I'll open a new pull request: either way after that it'll be time for a rest.

I hope to work on the man pages of the three tools and add one for print_test later on.

xexyl commented 9 months ago

Next for the dyn_array(3) repo to do this as it requires the dbg(3) repo anyway... at least: the code here does. If it does not include it in the dyn_array repo then something else will have to be done. I'll see and if it is a problem I'll reply to this comment. Else I'll open a new pull request: either way after that it'll be time for a rest.

I hope to work on the man pages of the three tools and add one for print_test later on.

Strange ... there is a problem but not one I'm sure about at this time. The dyn_test.c includes dyn_test.h which includes dyn_array.h which includes ../dbg/dbg.h which declares parse_verbosity() but:

cc -std=gnu11 -O3 -g3 -pedantic -Wall -Wextra  dyn_test.c -c
dyn_test.c:105:24: error: call to undeclared function 'parse_verbosity'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            verbosity_level = parse_verbosity(program, optarg);
                              ^
1 error generated.
make: *** [Makefile:356: dyn_test.o] Error 1

Not sure why this is but I do think this function belongs in the dbg repo as it's the code that uses it and it seems better to have a utility function in the repo that uses it rather than another repo: since the jparse api also uses the dbg api.

I'll have to look at this later unless you have some ideas of what I'm missing? Time to rest ... I hope.

xexyl commented 9 months ago

The above problem is solved in another pull request and synchronised to the dyn_array facility in an open pull request in that repo too.

Should the macro be DBG_USE or something else ? I see an argument for both ...