source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Even though the constant ASCII_ESC is only used in the roff
Date: Tue, 16 Aug 2022 12:30:41 -0500 (EST)	[thread overview]
Message-ID: <336a354e935f5d92@mandoc.bsd.lv> (raw)

Log Message:
-----------
Even though the constant ASCII_ESC is only used in the roff pre-parser roff.c,
move it to the top level include file mandoc.h to reduce the risk of causing 
clashes when introducing new ASCII_* constants in the future.

Modified Files:
--------------
    mandoc:
        mandoc.h
        roff.c

Revision Data
-------------
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mandoc.h,v
retrieving revision 1.280
retrieving revision 1.281
diff -Lmandoc.h -Lmandoc.h -u -p -r1.280 -r1.281
--- mandoc.h
+++ mandoc.h
@@ -23,6 +23,8 @@
 #define ASCII_NBRZW	 30  /* non-breaking zero-width space */
 #define ASCII_BREAK	 29  /* breakable zero-width space */
 #define ASCII_HYPH	 28  /* breakable hyphen */
+#define ASCII_ESC	 27  /* escape sequence from copy-in processing */
+#define ASCII_TABREF	 26  /* reset tab reference position */
 
 /*
  * Status level.  This refers to both internal status (i.e., whilst
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
retrieving revision 1.394
retrieving revision 1.395
diff -Lroff.c -Lroff.c -u -p -r1.394 -r1.395
--- roff.c
+++ roff.c
@@ -40,14 +40,6 @@
 #include "tbl_parse.h"
 #include "eqn_parse.h"
 
-/*
- * ASCII_ESC is used to signal from roff_getarg() to roff_expand()
- * that an escape sequence resulted from copy-in processing and
- * needs to be checked or interpolated.  As it is used nowhere
- * else, it is defined here rather than in a header file.
- */
-#define	ASCII_ESC	27
-
 /* Maximum number of string expansions per line, to break infinite loops. */
 #define	EXPAND_LIMIT	1000
 
@@ -1640,8 +1632,13 @@ roff_getarg(struct roff *r, char **cpp, 
 				cp++;
 				break;
 			case '\\':
-				newesc = 1;
+				/*
+				 * Signal to roff_expand() that an escape
+				 * sequence resulted from copy-in processing
+				 * and needs to be checked or interpolated.
+				 */
 				cp[-pairs] = ASCII_ESC;
+				newesc = 1;
 				pairs++;
 				cp++;
 				break;
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


                 reply	other threads:[~2022-08-16 17:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=336a354e935f5d92@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).