[tex-k] Some issues with CWEB

Igor Liferenko igor.liferenko at gmail.com
Tue Jun 16 07:15:28 CEST 2020


Hi, list

This problem has been reported 3 years ago, but I decided to report it
again together
with other minor problems which could be addressed before 1 November deadline.

-------- Issue in ctangle.w -----------

Run these commands on attached test.w:

    ctangle test
    gcc -g -Og test.c
    gdb a.out

Inside GDB run:

    b main
    run

gdb should stop at line "a = 5;", but gdb writes:

    Breakpoint 1, main () at test.w:14

Run "cat -n test.w" and you'll see that there is no line 14 at all.
The moral is that if one wants to comment out a section,
gdb is screwed.

I propose a fix. The idea is to issue a new #line directive which resets the
counter after _each_ #endif
See attached ctang-pp.ch

------- Issue in common.w ----------

Don't compare address of character with offset from the beginning of buffer:
@x
Trailing blanks are ignored. The value of |limit| must be strictly less
than |buf_size|, so that |buffer[buf_size-1]| is never filled.
@y
Trailing blanks are ignored. The value of |limit| must be less or equal
to |buffer_end|, so that |buffer[buf_size-1]| is never filled.
@z

------- Issue in cweave.w ----------

Use |limit| instead of |buffer_end|.
@x
while (loc<=buffer_end-7 && xisspace(*loc)) loc++;
if (loc<=buffer_end-6 && strncmp(loc,"include",7)==0) sharp_include_line=1;
@y
while (loc<=limit-7 && xisspace(*loc)) loc++;
if (loc<=limit-6 && strncmp(loc,"include",7)==0) sharp_include_line=1;
@z


Regards,
Igor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.w
Type: application/octet-stream
Size: 117 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-k/attachments/20200616/9e49b5f7/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ctang-pp.ch
Type: application/octet-stream
Size: 761 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-k/attachments/20200616/9e49b5f7/attachment-0001.obj>


More information about the tex-k mailing list.