diff options
author | Philip Hazel <ph10@hermes.cam.ac.uk> | 2007-09-21 09:32:19 +0000 |
---|---|---|
committer | Nigel Metheringham <nigel@exim.org> | 2010-06-09 12:42:07 +0000 |
commit | 254529d36aa7bc1877c028082ebc18dd112bc3dd (patch) | |
tree | afb9092c16ac410f805da9d7e6cb4839662b82bf | |
parent | abaf3d3690fae7bdc89335a5cf47d2e3a26c2da7 (diff) | |
download | exim4-254529d36aa7bc1877c028082ebc18dd112bc3dd.tar.gz |
Imported from /Users/nigel/Work/x/xfpt-0.05.tar.bz2.
-rw-r--r-- | share/stdmacs | 1 | ||||
-rw-r--r-- | src/dot.c | 9 | ||||
-rw-r--r-- | src/globals.c | 3 | ||||
-rw-r--r-- | src/globals.h | 3 | ||||
-rw-r--r-- | src/para.c | 2 | ||||
-rw-r--r-- | src/read.c | 12 | ||||
-rw-r--r-- | testing/infiles/01 | 15 | ||||
-rw-r--r-- | testing/infiles/02 | 2 | ||||
-rw-r--r-- | testing/outfiles/01 | 14 | ||||
-rw-r--r-- | testing/outfiles/02 | 2 | ||||
-rw-r--r-- | testing/outfiles/02.err | 5 |
11 files changed, 54 insertions, 14 deletions
diff --git a/share/stdmacs b/share/stdmacs index 6808f7d99..351d23fd7 100644 --- a/share/stdmacs +++ b/share/stdmacs @@ -142,6 +142,7 @@ .arg 1 &<title>&$1&</title>& .endarg +.literal off .endmacro .macro vitem @@ -540,7 +540,8 @@ else error(26, p); * Handle .nonl * *************************************************/ -/* Output the argument as normal text, but without a newline on the end. +/* The argument is handled as a line without a terminating newline by putting +it into a buffer and pointing next_line at it. Argument: the rest of the line Returns: nothing @@ -549,7 +550,11 @@ Returns: nothing static void do_nonl(uschar *p) { -para_process(p); +static uschar nonlbuffer[INBUFFSIZE]; +int len = Ustrlen(p) + 1; +if (len > INBUFFSIZE) len = INBUFFSIZE; +Ustrncpy(nonlbuffer, p, len); +next_line = nonlbuffer; } diff --git a/src/globals.c b/src/globals.c index 9aadfbf7a..2c664db62 100644 --- a/src/globals.c +++ b/src/globals.c @@ -11,7 +11,7 @@ uschar *xfpt_share = US DATADIR; -uschar *xfpt_version = US "0.04 13-September-2007"; +uschar *xfpt_version = US "0.05 21-September-2007"; tree_node *entities = NULL; @@ -24,6 +24,7 @@ int literal_state = LITERAL_OFF; int nest_level = 0; int nest_literal_stack[MAXNEST+1]; +uschar *next_line = NULL; macroexe *macrocurrent = NULL; macrodef *macrolist = NULL; diff --git a/src/globals.h b/src/globals.h index ce779b32b..45bd5ee98 100644 --- a/src/globals.h +++ b/src/globals.h @@ -2,7 +2,7 @@ * xfpt - Simple ASCII->Docbook processor * *************************************************/ -/* Copyright (c) University of Cambridge, 2006 */ +/* Copyright (c) University of Cambridge, 2007 */ /* Written by Philip Hazel. */ /* Header file for all the global variables */ @@ -26,6 +26,7 @@ extern int literal_state; extern int nest_level; extern int nest_literal_stack[]; +extern uschar *next_line; extern macroexe *macrocurrent; extern macrodef *macrolist; diff --git a/src/para.c b/src/para.c index 9de7f88bc..93eef3ef8 100644 --- a/src/para.c +++ b/src/para.c @@ -16,7 +16,7 @@ characters and also dealing with literals that must be escaped. */ *************************************************/ /* This function is called when we encounter & followed by a name and an -opening parenthesis. This significies an inline macro call. +opening parenthesis. This signifies an inline macro call. Arguments: p points to the start of the macro name diff --git a/src/read.c b/src/read.c index 73b4fffc0..8d7c56e41 100644 --- a/src/read.c +++ b/src/read.c @@ -11,13 +11,6 @@ -/************************************************* -* Static variables * -*************************************************/ - -static uschar *next_line = NULL; - - /************************************************* * Process macro line * @@ -201,7 +194,8 @@ return buffer; *************************************************/ /* There may be a saved line already in the buffer, following the reading of a -paragraph. Otherwise, take the next line from one of three sources, in order: +paragraph or a .nonl directive. Otherwise, take the next line from one of three +sources, in order: (1) If popto is not negative, get an appropropriate line off the stack. (2) If we are in a macro, get the next macro line. @@ -217,7 +211,7 @@ read_nextline(void) int len; uschar *p, *q; -/* Handle a dot line that terminated a paragraph */ +/* Handle a dot line that terminated a paragraph, or a .nonl line */ if (next_line != NULL) { diff --git a/testing/infiles/01 b/testing/infiles/01 index 9c1b059a5..afa804f2d 100644 --- a/testing/infiles/01 +++ b/testing/infiles/01 @@ -413,4 +413,19 @@ But in a literal block that is `not monospaced' ... &`Check it's ok`& when `in the same line'. .endd +Extra checks on the use of .nonl. +.nonl ABCD +EFGH should be joined on +.nonl NONL + +At the end of a paragraph? It just puts </para> on the same line. + +.nonl "At the start of a para" +graph should work too. +.display +What about in a display? +.nonl "Use NONL" +WITH more stuff +.endd + .makeindex diff --git a/testing/infiles/02 b/testing/infiles/02 index b256fafc1..421294cc3 100644 --- a/testing/infiles/02 +++ b/testing/infiles/02 @@ -39,3 +39,5 @@ Try &&abcd without semicolon: &abcd and at EOL &abcd .endmacro .x + +.nonl more than one argument diff --git a/testing/outfiles/01 b/testing/outfiles/01 index b30e1fcc7..bb32e12d0 100644 --- a/testing/outfiles/01 +++ b/testing/outfiles/01 @@ -456,6 +456,20 @@ Check `quoted' in literal monospaced block. But in a literal block that is ‘not monospaced’ ... <literal>Check it's ok</literal> when ‘in the same line’. </literallayout> +<para> +Extra checks on the use of .nonl. +ABCDEFGH should be joined on +NONL</para> +<para> +At the end of a paragraph? It just puts </para> on the same line. +</para> +<para> +At the start of a paragraph should work too. +</para> +<literallayout> +What about in a display? +Use NONLWITH more stuff +</literallayout> </chapter> <index> diff --git a/testing/outfiles/02 b/testing/outfiles/02 index ca864bfc3..a2ea745ee 100644 --- a/testing/outfiles/02 +++ b/testing/outfiles/02 @@ -4,3 +4,5 @@ Non defined &rhubarb is &rhubarb; Try &abcd without semicolon: &abcd and at EOL &abcd </para> <abcd> +<para> +more</para> diff --git a/testing/outfiles/02.err b/testing/outfiles/02.err index 17746cb7b..bc5e33c3a 100644 --- a/testing/outfiles/02.err +++ b/testing/outfiles/02.err @@ -86,3 +86,8 @@ Processing macro x Detected near line 41 of infiles/02 +** Warning: extra characters at end of directive + .nonl more than one argument + ^^^^^^^^^^^^^^^^^ + Detected near line 43 of infiles/02 + |