[CWB] MAX_LINE_LENGTH

Stefan Evert stefanML at collocations.de
Wed Mar 2 09:06:34 CET 2011


Hi everyone!

Nutshell answer: These values should be MAX_LINE_LENGTH.  They were probably changed manually (perhaps even by me) at a time when MAX_LINE_LENGTH was still only 1024 ...  So don't hesitate to make these changes.  We've had cases before where we needed to make custom builds with increased MAX_LINE_LENGTH.

> I have spotted this before and came to the conclusion it is a workaround to avoid #including cl/globals.h in cwb-align-* . This is both right and wrong -- programs built against the CL are not supposed to use its internal header files like globals.h (so this is correct) but using literal integers is dirty (so this is incorrect).

My official line is that external tools are only allowed to use the exported API (and that's all they get to see because header files like globals.h aren't part of a CWB installation), but CQP and the other CWB tools are allowed to peek behind the curtain and use internal headers.

> The Right Thing is probably to change MAX_LINE_LENGTH to CL_MAX_LINE_LENGTH everywhere, move its definition to cl.h, and use it in cwb-align-* as everywhere else. In principle, I can't see any harm in exposing a default-char-buffer-size constant in the API.... especially as it is now needed in order to use the new (public) function cl_strcpy()... and of course this would meet your needs too, Alberto.

Ah, I hadn't been aware of that -- thanks for poking me to update my SVN sandbox. :)   Yes, in this case MAX_LINE_LENGTH should become CL_MAX_LINE_LENGTH and be exported through the API.

Actually, this makes a lot of sense in other respects as well.  For instance, client tools should be able to check whether a string fits into the internal buffers before they pass it through the CL API.


Best wishes,
Stefan




More information about the CWB mailing list