From 0b7885c804ec25f34fda3850dc3eb5c2ad4a77ef Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Sat, 19 Feb 2022 14:47:45 +0000 Subject: [CWEB] Permit indentation of preprocessing directives. The C processor allows whitespace before and after the '#' of preprocessing directives, e.g., some MetaPost code uses this feature. In order to permit more liberal code layout, we only expect the '#' to be the first character in the buffer, followed by some optional whitespace. CWEB takes care that 'id_first' is the first non-whitespace character in the 'buffer' (and 'id_loc' is the first character _after_ the directive name). git-svn-id: svn://tug.org/texlive/trunk@62084 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/ctangleboot.cin | 2 +- Build/source/texk/web2c/cwebdir/ctangle.c | 2 +- Build/source/texk/web2c/cwebdir/ctangle.w | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin index c835052d64a..5d0b10ec927 100644 --- a/Build/source/texk/web2c/ctangleboot.cin +++ b/Build/source/texk/web2c/ctangleboot.cin @@ -1599,7 +1599,7 @@ while(true)switch(a= get_next()){ #line 1244 "cwebdir/ctangle.w" case identifier:store_id(a); -if(*buffer=='#'&&id_first==buffer+1&&( +if(*buffer=='#'&&( (id_loc-id_first==5&&strncmp("endif",id_first,5)==0)|| (id_loc-id_first==4&&strncmp("else",id_first,4)==0)|| (id_loc-id_first==4&&strncmp("elif",id_first,4)==0))) diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c index 7677ce1f323..b6037a87dd9 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.c +++ b/Build/source/texk/web2c/cwebdir/ctangle.c @@ -1282,7 +1282,7 @@ while(true)switch(a= get_next()){ #line 1244 "ctangle.w" case identifier:store_id(a); -if(*buffer=='#'&&id_first==buffer+1&&( +if(*buffer=='#'&&( (id_loc-id_first==5&&strncmp("endif",id_first,5)==0)|| (id_loc-id_first==4&&strncmp("else",id_first,4)==0)|| (id_loc-id_first==4&&strncmp("elif",id_first,4)==0))) diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w index 62d12290ff8..c2fc88af747 100644 --- a/Build/source/texk/web2c/cwebdir/ctangle.w +++ b/Build/source/texk/web2c/cwebdir/ctangle.w @@ -1243,7 +1243,7 @@ file name. @ @=@t\1\quad@> case identifier: store_id(a); - if (*buffer=='#' && id_first==buffer+1 && @| ( + if (*buffer=='#' && @| ( ( id_loc-id_first==5 && strncmp("endif",id_first,5)==0 ) || @| ( id_loc-id_first==4 && strncmp("else",id_first,4)==0 ) || @| ( id_loc-id_first==4 && strncmp("elif",id_first,4)==0 ) ) ) -- cgit v1.2.3