Initial import of nuweb-1.62
This is just the following tarball expanded: https://sourceforge.net/projects/nuweb/files/nuweb-1.62.tar.gz/download
This commit is contained in:
94
Makefile
Executable file
94
Makefile
Executable file
@@ -0,0 +1,94 @@
|
||||
CC = cc
|
||||
|
||||
CFLAGS = -g
|
||||
|
||||
TARGET = nuweb
|
||||
VERSION = 1.62
|
||||
|
||||
OBJS = main.o pass1.o latex.o html.o output.o input.o scraps.o names.o \
|
||||
arena.o global.o
|
||||
|
||||
SRCS = main.c pass1.c latex.c html.c output.c input.c scraps.c names.c \
|
||||
arena.c global.c
|
||||
|
||||
HDRS = global.h
|
||||
|
||||
BIBS = litprog.bib master.bib misc.bib
|
||||
|
||||
STYS = bibnames.sty html.sty
|
||||
|
||||
DIST = Makefile README nuweb.w nuwebsty.w test htdocs nuweb.el \
|
||||
$(TARGET)doc.tex $(SRCS) $(HDRS) $(BIBS) $(STYS)
|
||||
|
||||
%.tex: %.w
|
||||
./nuweb -r $<
|
||||
latex $(basename $<)
|
||||
./nuweb -r $<
|
||||
|
||||
%: %.tex
|
||||
latex2html -split 0 $(basename $<)
|
||||
|
||||
%.hw: %.w
|
||||
cp $< $@
|
||||
|
||||
%.dvi: %.tex
|
||||
latex $(basename $<)
|
||||
bibtex $(basename $<)
|
||||
latex $(basename $<)
|
||||
latex $(basename $<)
|
||||
|
||||
%.pdf: %.tex
|
||||
pdflatex $(basename $<)
|
||||
bibtex $(basename $<)
|
||||
pdflatex $(basename $<)
|
||||
pdflatex $(basename $<)
|
||||
|
||||
all:
|
||||
$(MAKE) $(TARGET).tex
|
||||
$(MAKE) $(TARGET)
|
||||
|
||||
tar: $(TARGET)doc.tex
|
||||
mkdir $(TARGET)-$(VERSION)
|
||||
cp -R $(DIST) $(TARGET)-$(VERSION)
|
||||
tar -zcf $(TARGET)-$(VERSION).tar.gz $(TARGET)-$(VERSION)
|
||||
rm -rf $(TARGET)-$(VERSION)
|
||||
|
||||
distribution: all tar nuweb.pdf nuwebdoc.pdf
|
||||
|
||||
$(TARGET)doc.tex: $(TARGET).tex
|
||||
sed -e '/^\\ifshowcode$$/,/^\\fi$$/d' $< > $@
|
||||
|
||||
check: nuweb
|
||||
@declare -i n=0; \
|
||||
declare -i f=0; \
|
||||
for i in test/*/*.sh ; do \
|
||||
echo "Testing $$i"; \
|
||||
sh $$i; \
|
||||
if test $$? -ne 0; \
|
||||
then echo " $$i failed" ; \
|
||||
f+=1; \
|
||||
fi; \
|
||||
n+=1; \
|
||||
done; \
|
||||
echo "$$n done"; \
|
||||
echo "$$f failed"
|
||||
|
||||
clean:
|
||||
-rm -f *.o *.tex *.log *.dvi *.pdf *~ *.blg *.lint *.bbl *.aux *.brf *.out *.toc
|
||||
|
||||
veryclean: clean
|
||||
-rm -f *.c *.h
|
||||
|
||||
view: $(TARGET).dvi
|
||||
xdvi $(TARGET).dvi
|
||||
|
||||
print: $(TARGET).dvi
|
||||
lpr -d $(TARGET).dvi
|
||||
|
||||
lint:
|
||||
lint $(SRCS) > nuweb.lint
|
||||
|
||||
$(OBJS): global.h
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(CC) -o $(TARGET) $(OBJS)
|
70
README
Executable file
70
README
Executable file
@@ -0,0 +1,70 @@
|
||||
We've bundled up the web source (nuweb.w), the generated .c files and
|
||||
the assorted auxiliary files for latex'ing with a Makefile.
|
||||
|
||||
Note that it's still not completely portable to every system without
|
||||
change. In particular, it expects file-names to use '/' to delimit
|
||||
directories which is OK unless you are on Windows (where it's '\') or
|
||||
VMS (which uses ':' and ']') and it thinks tab stops are set every
|
||||
eight spaces.
|
||||
|
||||
To print the documentation, you must first run LaTeX on the file
|
||||
nuwebdoc.tex. To fix up all the citations, you'll need several runs.
|
||||
|
||||
latex nuwebdoc
|
||||
bibtex nuwebdoc
|
||||
latex nuwebdoc
|
||||
latex nuwebdoc
|
||||
|
||||
Note that the distributed nuwebdoc.tex is basically Chapter 1 of the
|
||||
complete nuweb.tex generated by running nuweb against itself.
|
||||
|
||||
To actually build the nuweb executable, type "make nuweb" which should
|
||||
build an executable file called "nuweb". After that, you should be
|
||||
able to use the makefile to control everything very nicely.
|
||||
|
||||
To view the nuweb sources using an HTML viewer, copy nuweb.w to
|
||||
nuweb.hw, and then add the html document-style option to nuweb.hw.
|
||||
After producing the LaTeX source file nuweb.tex, convert it to HTML
|
||||
using LaTeX2HTML.
|
||||
|
||||
For the latest version check the SourceForge page:
|
||||
http://nuweb.sourceforge.net/
|
||||
|
||||
Changes in Version 1.62:
|
||||
Worked round issue with large number of scraps, cause obscure;
|
||||
see bug #29.
|
||||
|
||||
Changes in Version 1.61:
|
||||
Moved versioning system to git.
|
||||
Corrected link failure with latest GCC, and clang on some systems.
|
||||
|
||||
Changes in Version 1.60:
|
||||
Made version number consistent between nuweb.w and tag.
|
||||
Corrected link to Z in htdocs/index.html.
|
||||
Makefile runs bibtex pass when creating .dvi, .pdf.
|
||||
master.bib no longer calls up nonexistent file.
|
||||
|
||||
Changes in Version 1.59:
|
||||
Fixed compiler warnings in both gcc and clang.
|
||||
|
||||
Changes in Version 1.58:
|
||||
Suppress indentation for one fragment or argument
|
||||
Allow fragment expansion in tex.
|
||||
|
||||
Changes in Version 1.57:
|
||||
Fixed SF3416213, \it deprecated in LaTeX2e, use \itshape
|
||||
Fixed SF3431294, Fragment page number refs don't work in memoir class
|
||||
Fixed SF3432035, -d output file flag doesn't work
|
||||
Removed use of hyperref parameter dvipdfm (-> error in TeX Live 2011)
|
||||
|
||||
Changes in Version 1.56:
|
||||
Added minor command @t to include fragment title in output files.
|
||||
Fragment use embedded in fragment argument is no longer commented.
|
||||
Make tar now produces top level versioned directory.
|
||||
|
||||
Changes in Version 1.55:
|
||||
Fixed bug 3168635 (doesn't handle inability to create output files).
|
||||
|
||||
Changes in Version 1.54:
|
||||
Fixed bug 3158592 (SEGV) by reworking sentinel-based scrap processing.
|
||||
Fixed bug 3160408 by defining MAX_NAME_LEN (to 1024) in global.h.
|
50
arena.c
Normal file
50
arena.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "global.h"
|
||||
typedef struct chunk {
|
||||
struct chunk *next;
|
||||
char *limit;
|
||||
char *avail;
|
||||
} Chunk;
|
||||
static Chunk first = { NULL, NULL, NULL };
|
||||
static Chunk *arena = &first;
|
||||
void *arena_getmem(n)
|
||||
size_t n;
|
||||
{
|
||||
char *q;
|
||||
char *p = arena->avail;
|
||||
n = (n + 7) & ~7; /* ensuring alignment to 8 bytes */
|
||||
q = p + n;
|
||||
if (q <= arena->limit) {
|
||||
arena->avail = q;
|
||||
return p;
|
||||
}
|
||||
/* Find a new chunk of memory */
|
||||
{
|
||||
Chunk *ap = arena;
|
||||
Chunk *np = ap->next;
|
||||
while (np) {
|
||||
char *v = sizeof(Chunk) + (char *) np;
|
||||
if (v + n <= np->limit) {
|
||||
np->avail = v + n;
|
||||
arena = np;
|
||||
return v;
|
||||
}
|
||||
ap = np;
|
||||
np = ap->next;
|
||||
}
|
||||
/* Allocate a new chunk of memory */
|
||||
{
|
||||
size_t m = n + 10000;
|
||||
np = (Chunk *) malloc(m);
|
||||
np->limit = m + (char *) np;
|
||||
np->avail = n + sizeof(Chunk) + (char *) np;
|
||||
np->next = NULL;
|
||||
ap->next = np;
|
||||
arena = np;
|
||||
return sizeof(Chunk) + (char *) np;
|
||||
}
|
||||
}
|
||||
}
|
||||
void arena_free()
|
||||
{
|
||||
arena = &first;
|
||||
}
|
11
bibnames.sty
Normal file
11
bibnames.sty
Normal file
@@ -0,0 +1,11 @@
|
||||
%
|
||||
% These don't seem to get defined anywhere else, so...
|
||||
%
|
||||
|
||||
\def\noopsort#1{#1}
|
||||
\def\emdash{\-}
|
||||
|
||||
\def\tex#1{$T_{E}X$}
|
||||
\def\WEB#1{WEB}
|
||||
\def\mf#1{\sc metafont}
|
||||
\def\TUB#1{TUB}
|
56
global.c
Normal file
56
global.c
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "global.h"
|
||||
/* Operating System Dependencies */
|
||||
|
||||
#if defined(VMS)
|
||||
#define PATH_SEP(c) (c==']'||c==':')
|
||||
#define PATH_SEP_CHAR ""
|
||||
#define DEFAULT_PATH ""
|
||||
#elif defined(MSDOS)
|
||||
#define PATH_SEP(c) (c=='\\')
|
||||
#define PATH_SEP_CHAR "\\"
|
||||
#define DEFAULT_PATH "."
|
||||
#else
|
||||
#define PATH_SEP(c) (c=='/')
|
||||
#define PATH_SEP_CHAR "/"
|
||||
#define DEFAULT_PATH "."
|
||||
#endif
|
||||
|
||||
/* Global variable definitions */
|
||||
int tex_flag = TRUE;
|
||||
int html_flag = FALSE;
|
||||
int output_flag = TRUE;
|
||||
int compare_flag = TRUE;
|
||||
int verbose_flag = FALSE;
|
||||
int number_flag = FALSE;
|
||||
int scrap_flag = TRUE;
|
||||
int dangling_flag = FALSE;
|
||||
int xref_flag = FALSE;
|
||||
int prepend_flag = FALSE;
|
||||
char * dirpath = DEFAULT_PATH; /* Default directory path */
|
||||
char * path_sep = PATH_SEP_CHAR;
|
||||
int listings_flag = FALSE;
|
||||
int version_info_flag = FALSE;
|
||||
char default_version_string[] = "no version";
|
||||
char * version_string = default_version_string;
|
||||
int hyperref_flag = FALSE;
|
||||
int hyperopt_flag = FALSE;
|
||||
char * hyperoptions = "";
|
||||
int includepath_flag = FALSE; /* Do we have an include path? */
|
||||
struct incl * include_list = NULL;
|
||||
/* The list of include paths */
|
||||
int nw_char='@';
|
||||
char *command_name = NULL;
|
||||
unsigned char current_sector = 1;
|
||||
unsigned char prev_sector = 1;
|
||||
char blockBuff[6400];
|
||||
int extra_scraps = 0;
|
||||
char *source_name = NULL;
|
||||
int source_line = 0;
|
||||
int already_warned = 0;
|
||||
Name *file_names = NULL;
|
||||
Name *macro_names = NULL;
|
||||
Name *user_names = NULL;
|
||||
int scrap_name_has_parameters;
|
||||
int scrap_ended_with;
|
||||
|
||||
label_node * label_tab = NULL;
|
158
global.h
Normal file
158
global.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/* Include files */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
#include <locale.h>
|
||||
|
||||
/* Type declarations */
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#define MAX_INDENT 500
|
||||
typedef struct scrap_node {
|
||||
struct scrap_node *next;
|
||||
int scrap;
|
||||
char quoted;
|
||||
} Scrap_Node;
|
||||
typedef struct name {
|
||||
char *spelling;
|
||||
struct name *llink;
|
||||
struct name *rlink;
|
||||
Scrap_Node *defs;
|
||||
Scrap_Node *uses;
|
||||
char * arg[9];
|
||||
int mark;
|
||||
char tab_flag;
|
||||
char indent_flag;
|
||||
char debug_flag;
|
||||
unsigned char comment_flag;
|
||||
unsigned char sector;
|
||||
} Name;
|
||||
#define ARG_CHR '\001'
|
||||
typedef struct arglist
|
||||
{Name * name;
|
||||
struct arglist * args;
|
||||
struct arglist * next;
|
||||
} Arglist;
|
||||
typedef struct embed {
|
||||
Scrap_Node * defs;
|
||||
Arglist * args;
|
||||
} Embed_Node;
|
||||
typedef struct uses {
|
||||
struct uses *next;
|
||||
Name *defn;
|
||||
} Uses;
|
||||
typedef struct l_node
|
||||
{
|
||||
struct l_node * left, * right;
|
||||
int scrap, seq;
|
||||
char name[1];
|
||||
} label_node;
|
||||
|
||||
/* Limits */
|
||||
|
||||
#ifndef MAX_NAME_LEN
|
||||
#define MAX_NAME_LEN 1024
|
||||
#endif
|
||||
|
||||
/* Global variable declarations */
|
||||
extern int tex_flag; /* if FALSE, don't emit the documentation file */
|
||||
extern int html_flag; /* if TRUE, emit HTML instead of LaTeX scraps. */
|
||||
extern int output_flag; /* if FALSE, don't emit the output files */
|
||||
extern int compare_flag; /* if FALSE, overwrite without comparison */
|
||||
extern int verbose_flag; /* if TRUE, write progress information */
|
||||
extern int number_flag; /* if TRUE, use a sequential numbering scheme */
|
||||
extern int scrap_flag; /* if FALSE, don't print list of scraps */
|
||||
extern int dangling_flag; /* if FALSE, don't print dangling identifiers */
|
||||
extern int xref_flag; /* If TRUE, print cross-references in scrap comments */
|
||||
extern int prepend_flag; /* If TRUE, prepend a path to the output file names */
|
||||
extern char * dirpath; /* The prepended directory path */
|
||||
extern char * path_sep; /* How to join path to filename */
|
||||
extern int listings_flag; /* if TRUE, use listings package for scrap formatting */
|
||||
extern int version_info_flag; /* If TRUE, set up version string */
|
||||
extern char * version_string; /* What to print for @v */
|
||||
extern int hyperref_flag; /* Are we preparing for hyperref
|
||||
package. */
|
||||
extern int hyperopt_flag; /* Are we preparing for hyperref options */
|
||||
extern char * hyperoptions; /* The options to pass to the
|
||||
hyperref package */
|
||||
extern int includepath_flag; /* Do we have an include path? */
|
||||
extern struct incl{char * name; struct incl * next;} * include_list;
|
||||
/* The list of include paths */
|
||||
extern int nw_char;
|
||||
extern char *command_name;
|
||||
extern unsigned char current_sector;
|
||||
extern unsigned char prev_sector;
|
||||
extern char blockBuff[6400];
|
||||
extern int extra_scraps;
|
||||
extern char *source_name; /* name of the current file */
|
||||
extern int source_line; /* current line in the source file */
|
||||
extern int already_warned;
|
||||
extern Name *file_names;
|
||||
extern Name *macro_names;
|
||||
extern Name *user_names;
|
||||
extern int scrap_name_has_parameters;
|
||||
extern int scrap_ended_with;
|
||||
extern label_node * label_tab;
|
||||
|
||||
/* Function prototypes */
|
||||
extern void pass1();
|
||||
extern void write_tex();
|
||||
void initialise_delimit_scrap_array(void);
|
||||
void update_delimit_scrap();
|
||||
extern int has_sector(Name *, unsigned char);
|
||||
extern void write_html();
|
||||
extern void write_files();
|
||||
extern void source_open(); /* pass in the name of the source file */
|
||||
extern int source_get(); /* no args; returns the next char or EOF */
|
||||
extern int source_last; /* what last source_get() returned. */
|
||||
extern int source_peek; /* The next character to get */
|
||||
extern void source_ungetc(int*);
|
||||
extern void init_scraps();
|
||||
extern int collect_scrap();
|
||||
extern int write_scraps();
|
||||
extern void write_scrap_ref();
|
||||
extern void write_single_scrap_ref();
|
||||
extern int num_scraps();
|
||||
extern void add_to_use(Name * name, int current_scrap);
|
||||
Arglist * instance();
|
||||
extern void collect_numbers();
|
||||
extern Name *collect_file_name();
|
||||
extern Name *collect_macro_name();
|
||||
extern Arglist *collect_scrap_name();
|
||||
extern Name *name_add();
|
||||
extern Name *prefix_add();
|
||||
extern char *save_string();
|
||||
extern void reverse_lists();
|
||||
extern int robs_strcmp(char*, char*);
|
||||
extern Name *install_args();
|
||||
extern void search();
|
||||
extern void format_uses_refs(FILE *, int);
|
||||
extern void format_defs_refs(FILE *, int);
|
||||
void write_label(char label_name[], FILE * file);
|
||||
extern void *arena_getmem();
|
||||
extern void arena_free();
|
||||
|
||||
/* Operating System Dependencies */
|
||||
|
||||
#if defined(VMS)
|
||||
#define PATH_SEP(c) (c==']'||c==':')
|
||||
#define PATH_SEP_CHAR ""
|
||||
#define DEFAULT_PATH ""
|
||||
#elif defined(MSDOS)
|
||||
#define PATH_SEP(c) (c=='\\')
|
||||
#define PATH_SEP_CHAR "\\"
|
||||
#define DEFAULT_PATH "."
|
||||
#else
|
||||
#define PATH_SEP(c) (c=='/')
|
||||
#define PATH_SEP_CHAR "/"
|
||||
#define DEFAULT_PATH "."
|
||||
#endif
|
||||
typedef int *Parameters;
|
75
htdocs/index.html
Normal file
75
htdocs/index.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>The nuweb system for Literate Programming</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>The <tt>nuweb</tt> system for Literate Programming</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<A href="https://sourceforge.net"> <IMG
|
||||
src="https://sourceforge.net/sflogo.php?group_id=7449" width="210" height="62"
|
||||
border="0" alt="SourceForge Logo"></A>
|
||||
<td>
|
||||
<a href="https://sourceforge.net/projects/nuweb/">project</a>
|
||||
<td>
|
||||
<a href="https://sourceforge.net/bugs/?group_id=7449">bug-tracker</a>
|
||||
<td>
|
||||
<a href="https://sourceforge.net/mail/?group_id=7449">mailing-lists</a>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>History</h2>
|
||||
|
||||
The <tt>nuweb</tt> system for Literate Programming was initially
|
||||
developed several years ago by Preston Briggs, and was later
|
||||
extended as part of Marc Mengel's Master's Thesis to help work with both
|
||||
specifications in <a href="https://en.wikipedia.org/wiki/Z_notation">Z</a>
|
||||
(in effect, LaTeX source in a LaTeX/nuweb document) and the code that
|
||||
implements the specification in a common document.
|
||||
|
||||
<p>
|
||||
At that time Preston wasn't interested in making new <tt>nuweb</tt>
|
||||
releases, so Marc took over maintenance of it, with his permission.
|
||||
|
||||
<p>
|
||||
Keith added new-style fragment parameters and a set of tests.
|
||||
|
||||
<p>
|
||||
At present, Simon Wright is the only maintainer.
|
||||
|
||||
<h2>Downloads</h2>
|
||||
|
||||
Folks interested in starting to use <tt>nuweb</tt> should download
|
||||
<a href="https://sourceforge.net/projects/nuweb/files/">
|
||||
the latest tar archive</a> with sources already unpacked from
|
||||
the <tt>nuweb.w</tt> file, a Makefile, etc.
|
||||
|
||||
<p>
|
||||
Those who already have <tt>nuweb</tt> running can simply download
|
||||
<a href="https://sourceforge.net/projects/nuweb/files/">the latest tar
|
||||
archive</a> , or checkout the module from
|
||||
the <a href="https://sourceforge.net/p/nuweb/code/ci/master/tree/">GIT
|
||||
Repository</a>.
|
||||
|
||||
<h2>Browsing</h2>
|
||||
|
||||
You can browse the <a href="nuweb.pdf"><tt>nuweb</tt>
|
||||
source/document</a> [PDF, about 2 MB] , or just
|
||||
the <a href="nuwebdoc.pdf">User's Guide</a> [PDF] portion.
|
||||
|
||||
<h2>Feedback</h2>
|
||||
|
||||
Please post bug reports at the
|
||||
Sourceforge <a href="https://sourceforge.net/p/nuweb/bugs/">Bugs</a>
|
||||
tracker, and feature requests at
|
||||
the <a href="https://sourceforge.net/p/nuweb/feature-requests/">Feature
|
||||
Requests</a> tracker.
|
||||
|
||||
Send comments, questions, etc to
|
||||
the <a href="mailto:nuweb-users@lists.sourceforge.net">nuweb-users</a>
|
||||
mailing list.
|
||||
|
||||
</body>
|
||||
</html>
|
442
html.c
Normal file
442
html.c
Normal file
@@ -0,0 +1,442 @@
|
||||
#include "global.h"
|
||||
static int scraps = 1;
|
||||
static void copy_scrap(); /* formats the body of a scrap */
|
||||
static void display_scrap_ref(); /* formats a scrap reference */
|
||||
static void display_scrap_numbers(); /* formats a list of scrap numbers */
|
||||
static void print_scrap_numbers(); /* pluralizes scrap formats list */
|
||||
static void format_entry(); /* formats an index entry */
|
||||
static void format_user_entry();
|
||||
void write_html(file_name, html_name)
|
||||
char *file_name;
|
||||
char *html_name;
|
||||
{
|
||||
FILE *html_file = fopen(html_name, "w");
|
||||
FILE *tex_file = html_file;
|
||||
if (hyperref_flag) {
|
||||
fputs("\\newcommand{\\NWtarget}[2]{\\hypertarget{#1}{#2}}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWlink}[2]{\\hyperlink{#1}{#2}}\n", tex_file);
|
||||
} else {
|
||||
fputs("\\newcommand{\\NWtarget}[2]{#2}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWlink}[2]{#2}\n", tex_file);
|
||||
}
|
||||
fputs("\\newcommand{\\NWtxtMacroDefBy}{Fragment defined by}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtMacroRefIn}{Fragment referenced in}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtMacroNoRef}{Fragment never referenced}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtDefBy}{Defined by}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtRefIn}{Referenced in}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtNoRef}{Not referenced}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtFileDefBy}{File defined by}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtIdentsUsed}{Uses:}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtIdentsNotUsed}{Never used}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWtxtIdentsDefed}{Defines:}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWsep}{${\\diamond}$}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWnotglobal}{(not defined globally)}\n", tex_file);
|
||||
fputs("\\newcommand{\\NWuseHyperlinks}{", tex_file);
|
||||
if (hyperoptions[0] != '\0')
|
||||
{
|
||||
fprintf(tex_file, "\\usepackage[%s]{hyperref}", hyperoptions);
|
||||
}
|
||||
fputs("}\n", tex_file);
|
||||
|
||||
if (html_file) {
|
||||
if (verbose_flag)
|
||||
fprintf(stderr, "writing %s\n", html_name);
|
||||
source_open(file_name);
|
||||
{
|
||||
int c = source_get();
|
||||
while (c != EOF) {
|
||||
if (c == nw_char)
|
||||
{
|
||||
c = source_get();
|
||||
switch (c) {
|
||||
case 'r':
|
||||
c = source_get();
|
||||
nw_char = c;
|
||||
update_delimit_scrap();
|
||||
break;
|
||||
case 'O':
|
||||
case 'o': {
|
||||
Name *name = collect_file_name();
|
||||
{
|
||||
fputs("\\begin{rawhtml}\n", html_file);
|
||||
fputs("<pre>\n", html_file);
|
||||
}
|
||||
fputs("<a name=\"nuweb", html_file);
|
||||
write_single_scrap_ref(html_file, scraps);
|
||||
fprintf(html_file, "\"><code>\"%s\"</code> ", name->spelling);
|
||||
write_single_scrap_ref(html_file, scraps);
|
||||
fputs("</a> =\n", html_file);
|
||||
|
||||
scraps++;
|
||||
{
|
||||
copy_scrap(html_file, TRUE);
|
||||
fputs("<></pre>\n", html_file);
|
||||
}
|
||||
{
|
||||
if (name->defs->next) {
|
||||
fputs("\\end{rawhtml}\\NWtxtFileDefBy\\begin{rawhtml} ", html_file);
|
||||
print_scrap_numbers(html_file, name->defs);
|
||||
fputs("<br>\n", html_file);
|
||||
}
|
||||
}
|
||||
{
|
||||
fputs("\\end{rawhtml}\n", html_file);
|
||||
c = source_get(); /* Get rid of current at command. */
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'Q':
|
||||
case 'q':
|
||||
case 'D':
|
||||
case 'd': {
|
||||
Name *name = collect_macro_name();
|
||||
{
|
||||
fputs("\\begin{rawhtml}\n", html_file);
|
||||
fputs("<pre>\n", html_file);
|
||||
}
|
||||
fputs("<a name=\"nuweb", html_file);
|
||||
write_single_scrap_ref(html_file, scraps);
|
||||
fputs("\"><\\end{rawhtml}", html_file);
|
||||
fputs(name->spelling, html_file);
|
||||
fputs("\\begin{rawhtml} ", html_file);
|
||||
write_single_scrap_ref(html_file, scraps);
|
||||
fputs("></a> =\n", html_file);
|
||||
|
||||
scraps++;
|
||||
{
|
||||
copy_scrap(html_file, TRUE);
|
||||
fputs("<></pre>\n", html_file);
|
||||
}
|
||||
{
|
||||
if (name->defs->next) {
|
||||
fputs("\\end{rawhtml}\\NWtxtMacroDefBy\\begin{rawhtml} ", html_file);
|
||||
print_scrap_numbers(html_file, name->defs);
|
||||
fputs("<br>\n", html_file);
|
||||
}
|
||||
}
|
||||
{
|
||||
if (name->uses) {
|
||||
fputs("\\end{rawhtml}\\NWtxtMacroRefIn\\begin{rawhtml} ", html_file);
|
||||
print_scrap_numbers(html_file, name->uses);
|
||||
}
|
||||
else {
|
||||
fputs("\\end{rawhtml}{\\NWtxtMacroNoRef}.\\begin{rawhtml}", html_file);
|
||||
fprintf(stderr, "%s: <%s> never referenced.\n",
|
||||
command_name, name->spelling);
|
||||
}
|
||||
fputs("<br>\n", html_file);
|
||||
}
|
||||
{
|
||||
fputs("\\end{rawhtml}\n", html_file);
|
||||
c = source_get(); /* Get rid of current at command. */
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'f': {
|
||||
if (file_names) {
|
||||
fputs("\\begin{rawhtml}\n", html_file);
|
||||
fputs("<dl compact>\n", html_file);
|
||||
format_entry(file_names, html_file, TRUE);
|
||||
fputs("</dl>\n", html_file);
|
||||
fputs("\\end{rawhtml}\n", html_file);
|
||||
}
|
||||
c = source_get();
|
||||
}
|
||||
break;
|
||||
case 'm': {
|
||||
if (macro_names) {
|
||||
fputs("\\begin{rawhtml}\n", html_file);
|
||||
fputs("<dl compact>\n", html_file);
|
||||
format_entry(macro_names, html_file, FALSE);
|
||||
fputs("</dl>\n", html_file);
|
||||
fputs("\\end{rawhtml}\n", html_file);
|
||||
}
|
||||
c = source_get();
|
||||
}
|
||||
break;
|
||||
case 'u': {
|
||||
if (user_names) {
|
||||
fputs("\\begin{rawhtml}\n", html_file);
|
||||
fputs("<dl compact>\n", html_file);
|
||||
format_user_entry(user_names, html_file, 0/* Dummy */);
|
||||
fputs("</dl>\n", html_file);
|
||||
fputs("\\end{rawhtml}\n", html_file);
|
||||
}
|
||||
c = source_get();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (c==nw_char)
|
||||
putc(c, html_file);
|
||||
c = source_get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
putc(c, html_file);
|
||||
c = source_get();
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(html_file);
|
||||
}
|
||||
else
|
||||
fprintf(stderr, "%s: can't open %s\n", command_name, html_name);
|
||||
}
|
||||
static void display_scrap_ref(html_file, num)
|
||||
FILE *html_file;
|
||||
int num;
|
||||
{
|
||||
fputs("<a href=\"#nuweb", html_file);
|
||||
write_single_scrap_ref(html_file, num);
|
||||
fputs("\">", html_file);
|
||||
write_single_scrap_ref(html_file, num);
|
||||
fputs("</a>", html_file);
|
||||
}
|
||||
static void display_scrap_numbers(html_file, scraps)
|
||||
FILE *html_file;
|
||||
Scrap_Node *scraps;
|
||||
{
|
||||
display_scrap_ref(html_file, scraps->scrap);
|
||||
scraps = scraps->next;
|
||||
while (scraps) {
|
||||
fputs(", ", html_file);
|
||||
display_scrap_ref(html_file, scraps->scrap);
|
||||
scraps = scraps->next;
|
||||
}
|
||||
}
|
||||
static void print_scrap_numbers(html_file, scraps)
|
||||
FILE *html_file;
|
||||
Scrap_Node *scraps;
|
||||
{
|
||||
display_scrap_numbers(html_file, scraps);
|
||||
fputs(".\n", html_file);
|
||||
}
|
||||
static void copy_scrap(file, prefix)
|
||||
FILE *file;
|
||||
int prefix;
|
||||
{
|
||||
int indent = 0;
|
||||
int c = source_get();
|
||||
while (1) {
|
||||
switch (c) {
|
||||
case '<' : fputs("<", file);
|
||||
indent++;
|
||||
break;
|
||||
case '>' : fputs(">", file);
|
||||
indent++;
|
||||
break;
|
||||
case '&' : fputs("&", file);
|
||||
indent++;
|
||||
break;
|
||||
case '\n': fputc(c, file);
|
||||
indent = 0;
|
||||
break;
|
||||
case '\t': {
|
||||
int delta = 8 - (indent % 8);
|
||||
indent += delta;
|
||||
while (delta > 0) {
|
||||
putc(' ', file);
|
||||
delta--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (c==nw_char)
|
||||
{
|
||||
{
|
||||
c = source_get();
|
||||
switch (c) {
|
||||
case '+':
|
||||
case '-':
|
||||
case '*':
|
||||
case '|': {
|
||||
do {
|
||||
do
|
||||
c = source_get();
|
||||
while (c != nw_char);
|
||||
c = source_get();
|
||||
} while (c != '}' && c != ']' && c != ')' );
|
||||
}
|
||||
case ',':
|
||||
case '}':
|
||||
case ']':
|
||||
case ')': return;
|
||||
case '_': {
|
||||
static int toggle;
|
||||
toggle = ~toggle;
|
||||
if( toggle ) {
|
||||
fputs( "<b>", file );
|
||||
} else {
|
||||
fputs( "</b>", file );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '1': case '2': case '3':
|
||||
case '4': case '5': case '6':
|
||||
case '7': case '8': case '9':
|
||||
fputc(nw_char, file);
|
||||
fputc(c, file);
|
||||
break;
|
||||
case '<': {
|
||||
Arglist * args = collect_scrap_name(-1);
|
||||
Name *name = args->name;
|
||||
fputs("<\\end{rawhtml}", file);
|
||||
fputs(name->spelling, file);
|
||||
if (scrap_name_has_parameters) {
|
||||
|
||||
char sep;
|
||||
|
||||
sep = '(';
|
||||
fputs("\\begin{rawhtml}", file);
|
||||
do {
|
||||
|
||||
fputc(sep,file);
|
||||
|
||||
fprintf(file, "%d <A NAME=\"#nuweb%d\"></A>", scraps, scraps);
|
||||
|
||||
source_last = '{';
|
||||
copy_scrap(file, TRUE);
|
||||
|
||||
++scraps;
|
||||
sep = ',';
|
||||
|
||||
} while ( source_last != ')' && source_last != EOF );
|
||||
fputs(" ) ",file);
|
||||
do
|
||||
c = source_get();
|
||||
while(c != nw_char && c != EOF);
|
||||
if (c == nw_char) {
|
||||
c = source_get();
|
||||
}
|
||||
fputs("\\end{rawhtml}", file);
|
||||
|
||||
}
|
||||
fputs("\\begin{rawhtml} ", file);
|
||||
if (name->defs)
|
||||
{
|
||||
Scrap_Node *p = name->defs;
|
||||
display_scrap_ref(file, p->scrap);
|
||||
if (p->next)
|
||||
fputs(", ... ", file);
|
||||
}
|
||||
else {
|
||||
putc('?', file);
|
||||
fprintf(stderr, "%s: never defined <%s>\n",
|
||||
command_name, name->spelling);
|
||||
}
|
||||
fputs(">", file);
|
||||
}
|
||||
break;
|
||||
case '%': {
|
||||
do
|
||||
c = source_get();
|
||||
while (c != '\n');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (c==nw_char)
|
||||
{
|
||||
fputc(c, file);
|
||||
break;
|
||||
}
|
||||
/* ignore these since pass1 will have warned about them */
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
putc(c, file);
|
||||
indent++;
|
||||
break;
|
||||
}
|
||||
c = source_get();
|
||||
}
|
||||
}
|
||||
static void format_entry(name, html_file, file_flag)
|
||||
Name *name;
|
||||
FILE *html_file;
|
||||
int file_flag;
|
||||
{
|
||||
while (name) {
|
||||
format_entry(name->llink, html_file, file_flag);
|
||||
{
|
||||
fputs("<dt> ", html_file);
|
||||
if (file_flag) {
|
||||
fprintf(html_file, "<code>\"%s\"</code>\n<dd> ", name->spelling);
|
||||
{
|
||||
fputs("\\end{rawhtml}\\NWtxtDefBy\\begin{rawhtml} ", html_file);
|
||||
print_scrap_numbers(html_file, name->defs);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fputs("<\\end{rawhtml}", html_file);
|
||||
fputs(name->spelling, html_file);
|
||||
fputs("\\begin{rawhtml} ", html_file);
|
||||
{
|
||||
if (name->defs)
|
||||
display_scrap_numbers(html_file, name->defs);
|
||||
else
|
||||
putc('?', html_file);
|
||||
}
|
||||
fputs(">\n<dd> ", html_file);
|
||||
{
|
||||
Scrap_Node *p = name->uses;
|
||||
if (p) {
|
||||
fputs("\\end{rawhtml}\\NWtxtRefIn\\begin{rawhtml} ", html_file);
|
||||
print_scrap_numbers(html_file, p);
|
||||
}
|
||||
else
|
||||
fputs("\\end{rawhtml}{\\NWtxtNoRef}.\\begin{rawhtml}", html_file);
|
||||
}
|
||||
}
|
||||
putc('\n', html_file);
|
||||
}
|
||||
name = name->rlink;
|
||||
}
|
||||
}
|
||||
static void format_user_entry(name, html_file, sector)
|
||||
Name *name;
|
||||
FILE *html_file;
|
||||
int sector;
|
||||
{
|
||||
while (name) {
|
||||
format_user_entry(name->llink, html_file, sector);
|
||||
{
|
||||
Scrap_Node *uses = name->uses;
|
||||
if (uses) {
|
||||
Scrap_Node *defs = name->defs;
|
||||
fprintf(html_file, "<dt><code>%s</code>:\n<dd> ", name->spelling);
|
||||
if (uses->scrap < defs->scrap) {
|
||||
display_scrap_ref(html_file, uses->scrap);
|
||||
uses = uses->next;
|
||||
}
|
||||
else {
|
||||
if (defs->scrap == uses->scrap)
|
||||
uses = uses->next;
|
||||
fputs("<strong>", html_file);
|
||||
display_scrap_ref(html_file, defs->scrap);
|
||||
fputs("</strong>", html_file);
|
||||
defs = defs->next;
|
||||
}
|
||||
while (uses || defs) {
|
||||
fputs(", ", html_file);
|
||||
if (uses && (!defs || uses->scrap < defs->scrap)) {
|
||||
display_scrap_ref(html_file, uses->scrap);
|
||||
uses = uses->next;
|
||||
}
|
||||
else {
|
||||
if (uses && defs->scrap == uses->scrap)
|
||||
uses = uses->next;
|
||||
fputs("<strong>", html_file);
|
||||
display_scrap_ref(html_file, defs->scrap);
|
||||
fputs("</strong>", html_file);
|
||||
defs = defs->next;
|
||||
}
|
||||
}
|
||||
fputs(".\n", html_file);
|
||||
}
|
||||
}
|
||||
name = name->rlink;
|
||||
}
|
||||
}
|
155
input.c
Normal file
155
input.c
Normal file
@@ -0,0 +1,155 @@
|
||||
#include "global.h"
|
||||
static FILE *source_file; /* the current input file */
|
||||
static int double_at;
|
||||
static int include_depth;
|
||||
static struct {
|
||||
FILE *file;
|
||||
char *name;
|
||||
int line;
|
||||
} stack[10];
|
||||
|
||||
int source_peek;
|
||||
int source_last;
|
||||
int source_get()
|
||||
{
|
||||
int c;
|
||||
source_last = c = source_peek;
|
||||
switch (c) {
|
||||
case EOF: {
|
||||
fclose(source_file);
|
||||
if (include_depth) {
|
||||
include_depth--;
|
||||
source_file = stack[include_depth].file;
|
||||
source_line = stack[include_depth].line;
|
||||
source_name = stack[include_depth].name;
|
||||
source_peek = getc(source_file);
|
||||
c = source_get();
|
||||
}
|
||||
}
|
||||
return c;
|
||||
case '\n': source_line++;
|
||||
default:
|
||||
if (c==nw_char)
|
||||
{
|
||||
/* Handle an ``at'' character */
|
||||
{
|
||||
c = getc(source_file);
|
||||
if (double_at) {
|
||||
source_peek = c;
|
||||
double_at = FALSE;
|
||||
c = nw_char;
|
||||
}
|
||||
else
|
||||
switch (c) {
|
||||
case 'i': {
|
||||
char name[FILENAME_MAX];
|
||||
char fullname[FILENAME_MAX];
|
||||
struct incl * p = include_list;
|
||||
|
||||
if (include_depth >= 10) {
|
||||
fprintf(stderr, "%s: include nesting too deep (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
/* Collect include-file name */
|
||||
{
|
||||
char *p = name;
|
||||
do
|
||||
c = getc(source_file);
|
||||
while (c == ' ' || c == '\t');
|
||||
while (isgraph(c)) {
|
||||
*p++ = c;
|
||||
c = getc(source_file);
|
||||
}
|
||||
*p = '\0';
|
||||
if (c != '\n') {
|
||||
fprintf(stderr, "%s: unexpected characters after file name (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
stack[include_depth].file = source_file;
|
||||
fullname[0] = '\0';
|
||||
for (;;) {
|
||||
strcat(fullname, name);
|
||||
source_file = fopen(fullname, "r");
|
||||
if (source_file || !p)
|
||||
break;
|
||||
strcpy(fullname, p->name);
|
||||
strcat(fullname, "/");
|
||||
p = p->next;
|
||||
}
|
||||
if (!source_file) {
|
||||
fprintf(stderr, "%s: can't open include file %s\n",
|
||||
command_name, name);
|
||||
source_file = stack[include_depth].file;
|
||||
}
|
||||
else
|
||||
{
|
||||
stack[include_depth].name = source_name;
|
||||
stack[include_depth].line = source_line + 1;
|
||||
include_depth++;
|
||||
source_line = 1;
|
||||
source_name = save_string(fullname);
|
||||
}
|
||||
source_peek = getc(source_file);
|
||||
c = source_get();
|
||||
}
|
||||
break;
|
||||
case '#': case 'f': case 'm': case 'u': case 'v':
|
||||
case 'd': case 'o': case 'D': case 'O': case 's':
|
||||
case 'q': case 'Q': case 'S': case 't':
|
||||
case '+':
|
||||
case '-':
|
||||
case '*':
|
||||
case '\'':
|
||||
case '{': case '}': case '<': case '>': case '|':
|
||||
case '(': case ')': case '[': case ']':
|
||||
case '%': case '_':
|
||||
case ':': case ',': case 'x': case 'c':
|
||||
case '1': case '2': case '3': case '4': case '5':
|
||||
case '6': case '7': case '8': case '9':
|
||||
case 'r':
|
||||
source_peek = c;
|
||||
c = nw_char;
|
||||
break;
|
||||
default:
|
||||
if (c==nw_char)
|
||||
{
|
||||
source_peek = c;
|
||||
double_at = TRUE;
|
||||
break;
|
||||
}
|
||||
fprintf(stderr, "%s: bad %c sequence %c[%d] (%s, line %d)\n",
|
||||
command_name, nw_char, c, c, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
source_peek = getc(source_file);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
void source_ungetc(int *c)
|
||||
{
|
||||
ungetc(source_peek, source_file);
|
||||
if(*c == '\n')
|
||||
source_line--;
|
||||
source_peek=*c;
|
||||
}
|
||||
void source_open(name)
|
||||
char *name;
|
||||
{
|
||||
source_file = fopen(name, "r");
|
||||
if (!source_file) {
|
||||
fprintf(stderr, "%s: couldn't open %s\n", command_name, name);
|
||||
exit(-1);
|
||||
}
|
||||
nw_char = '@';
|
||||
source_name = name;
|
||||
source_line = 1;
|
||||
source_peek = getc(source_file);
|
||||
double_at = FALSE;
|
||||
include_depth = 0;
|
||||
}
|
1090
litprog.bib
Normal file
1090
litprog.bib
Normal file
File diff suppressed because it is too large
Load Diff
211
main.c
Normal file
211
main.c
Normal file
@@ -0,0 +1,211 @@
|
||||
#include "global.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
int arg = 1;
|
||||
/* Interpret command-line arguments */
|
||||
command_name = argv[0];
|
||||
while (arg < argc) {
|
||||
char *s = argv[arg];
|
||||
if (*s++ == '-') {
|
||||
/* Interpret the argument string \verb|s| */
|
||||
{
|
||||
char c = *s++;
|
||||
while (c) {
|
||||
switch (c) {
|
||||
case 'c': compare_flag = FALSE;
|
||||
break;
|
||||
case 'd': dangling_flag = TRUE;
|
||||
break;
|
||||
case 'h': hyperopt_flag = TRUE;
|
||||
goto HasValue;
|
||||
case 'I': includepath_flag = TRUE;
|
||||
goto HasValue;
|
||||
case 'l': listings_flag = TRUE;
|
||||
break;
|
||||
case 'n': number_flag = TRUE;
|
||||
break;
|
||||
case 'o': output_flag = FALSE;
|
||||
break;
|
||||
case 'p': prepend_flag = TRUE;
|
||||
goto HasValue;
|
||||
case 'r': hyperref_flag = TRUE;
|
||||
break;
|
||||
case 's': scrap_flag = FALSE;
|
||||
break;
|
||||
case 't': tex_flag = FALSE;
|
||||
break;
|
||||
case 'v': verbose_flag = TRUE;
|
||||
break;
|
||||
case 'V': version_info_flag = TRUE;
|
||||
goto HasValue;
|
||||
case 'x': xref_flag = TRUE;
|
||||
break;
|
||||
default: fprintf(stderr, "%s: unexpected argument ignored. ",
|
||||
command_name);
|
||||
fprintf(stderr, "Usage is: %s [-cdnostvx] "
|
||||
"[-I path] [-V version] "
|
||||
"[-h options] [-p path] file...\n",
|
||||
command_name);
|
||||
break;
|
||||
}
|
||||
c = *s++;
|
||||
}
|
||||
HasValue:;
|
||||
}
|
||||
arg++;
|
||||
/* Perhaps get the prepend path */
|
||||
if (prepend_flag)
|
||||
{
|
||||
if (*s == '\0')
|
||||
s = argv[arg++];
|
||||
dirpath = s;
|
||||
prepend_flag = FALSE;
|
||||
}
|
||||
|
||||
/* Perhaps get the version info string */
|
||||
if (version_info_flag)
|
||||
{
|
||||
if (*s == '\0')
|
||||
s = argv[arg++];
|
||||
version_string = s;
|
||||
version_info_flag = FALSE;
|
||||
}
|
||||
|
||||
/* Perhaps get the hyperref options */
|
||||
if (hyperopt_flag)
|
||||
{
|
||||
if (*s == '\0')
|
||||
s = argv[arg++];
|
||||
hyperoptions = s;
|
||||
hyperopt_flag = FALSE;
|
||||
hyperref_flag = TRUE;
|
||||
}
|
||||
|
||||
/* Perhaps add an include path */
|
||||
if (includepath_flag)
|
||||
{
|
||||
struct incl * le
|
||||
= (struct incl *)arena_getmem(sizeof(struct incl));
|
||||
struct incl ** p = &include_list;
|
||||
|
||||
if (*s == '\0')
|
||||
s = argv[arg++];
|
||||
le->name = save_string(s);
|
||||
le->next = NULL;
|
||||
while (*p != NULL)
|
||||
p = &((*p)->next);
|
||||
*p = le;
|
||||
includepath_flag = FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
else break;
|
||||
}
|
||||
/* Set locale information */
|
||||
|
||||
{
|
||||
/* try to get locale information */
|
||||
char *s=getenv("LC_CTYPE");
|
||||
if (s==NULL) s=getenv("LC_ALL");
|
||||
|
||||
/* set it */
|
||||
if (s!=NULL)
|
||||
if(setlocale(LC_CTYPE, s)==NULL)
|
||||
fprintf(stderr, "Setting locale failed\n");
|
||||
}
|
||||
|
||||
initialise_delimit_scrap_array();
|
||||
/* Process the remaining arguments (file names) */
|
||||
{
|
||||
if (arg >= argc) {
|
||||
fprintf(stderr, "%s: expected a file name. ", command_name);
|
||||
fprintf(stderr, "Usage is: %s [-cnotv] [-p path] file-name...\n", command_name);
|
||||
exit(-1);
|
||||
}
|
||||
do {
|
||||
/* Handle the file name in \verb|argv[arg]| */
|
||||
{
|
||||
char source_name[FILENAME_MAX];
|
||||
char tex_name[FILENAME_MAX];
|
||||
char aux_name[FILENAME_MAX];
|
||||
/* Build \verb|source_name| and \verb|tex_name| */
|
||||
{
|
||||
char *p = argv[arg];
|
||||
char *q = source_name;
|
||||
char *trim = q;
|
||||
char *dot = NULL;
|
||||
char c = *p++;
|
||||
while (c) {
|
||||
*q++ = c;
|
||||
if (PATH_SEP(c)) {
|
||||
trim = q;
|
||||
dot = NULL;
|
||||
}
|
||||
else if (c == '.')
|
||||
dot = q - 1;
|
||||
c = *p++;
|
||||
}
|
||||
/* Add the source path to the include path list */
|
||||
if (trim != source_name) {
|
||||
struct incl * le
|
||||
= (struct incl *)arena_getmem(sizeof(struct incl));
|
||||
struct incl ** p = &include_list;
|
||||
char sv = *trim;
|
||||
|
||||
*trim = '\0';
|
||||
le->name = save_string(source_name);
|
||||
le->next = NULL;
|
||||
while (*p != NULL)
|
||||
p = &((*p)->next);
|
||||
*p = le;
|
||||
*trim = sv;
|
||||
}
|
||||
|
||||
*q = '\0';
|
||||
if (dot) {
|
||||
*dot = '\0'; /* produce HTML when the file extension is ".hw" */
|
||||
html_flag = dot[1] == 'h' && dot[2] == 'w' && dot[3] == '\0';
|
||||
sprintf(tex_name, "%s%s%s.tex", dirpath, path_sep, trim);
|
||||
sprintf(aux_name, "%s%s%s.aux", dirpath, path_sep, trim);
|
||||
*dot = '.';
|
||||
}
|
||||
else {
|
||||
sprintf(tex_name, "%s%s%s.tex", dirpath, path_sep, trim);
|
||||
sprintf(aux_name, "%s%s%s.aux", dirpath, path_sep, trim);
|
||||
*q++ = '.';
|
||||
*q++ = 'w';
|
||||
*q = '\0';
|
||||
}
|
||||
}
|
||||
/* Process a file */
|
||||
{
|
||||
pass1(source_name);
|
||||
current_sector = 1;
|
||||
prev_sector = 1;
|
||||
if (tex_flag) {
|
||||
if (html_flag) {
|
||||
int saved_number_flag = number_flag;
|
||||
number_flag = TRUE;
|
||||
collect_numbers(aux_name);
|
||||
write_html(source_name, tex_name, 0/*Dummy */);
|
||||
number_flag = saved_number_flag;
|
||||
}
|
||||
else {
|
||||
collect_numbers(aux_name);
|
||||
write_tex(source_name, tex_name);
|
||||
}
|
||||
}
|
||||
if (output_flag)
|
||||
write_files(file_names);
|
||||
arena_free();
|
||||
}
|
||||
}
|
||||
arg++;
|
||||
} while (arg < argc);
|
||||
}
|
||||
exit(0);
|
||||
}
|
10010
master.bib
Normal file
10010
master.bib
Normal file
File diff suppressed because it is too large
Load Diff
31
misc.bib
Normal file
31
misc.bib
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
@ARTICLE{aho:75,
|
||||
author = {A[lfred] V. Aho and M[argaret] J. Corasick},
|
||||
title = {Efficient String Matching: An Aid to Bibliographic Search.},
|
||||
journal = {CACM},
|
||||
year = 1975,
|
||||
volume = 18,
|
||||
number = 6,
|
||||
pages = "333-340",
|
||||
month = "June",
|
||||
}
|
||||
|
||||
@ARTICLE{hanson:90,
|
||||
author = {C[hris] Hanson},
|
||||
title = {Efficient Stack Allocation for Tail-Recursive Languages.},
|
||||
series = {Proceedings of the Conference on LISP and Functional Programming},
|
||||
year = 1990,
|
||||
address = "Nice, France",
|
||||
publisher = "ACM Press",
|
||||
organization = ACM,
|
||||
}
|
||||
|
||||
@ARTICLE{drakos:94,
|
||||
author = {Nikos Drakos},
|
||||
title = {From Text to Hypertext: A Post-Hoc Rationalisation of LaTeX2HTML},
|
||||
journal = {Computer Networks and ISDN Systems},
|
||||
volume = 27,
|
||||
pages = "215-224",
|
||||
year = 1994,
|
||||
publisher = "Elsevier",
|
||||
}
|
628
names.c
Normal file
628
names.c
Normal file
@@ -0,0 +1,628 @@
|
||||
#include "global.h"
|
||||
enum { LESS, GREATER, EQUAL, PREFIX, EXTENSION };
|
||||
|
||||
static int compare(x, y)
|
||||
char *x;
|
||||
char *y;
|
||||
{
|
||||
int len, result;
|
||||
int xl = strlen(x);
|
||||
int yl = strlen(y);
|
||||
int xp = x[xl - 1] == ' ';
|
||||
int yp = y[yl - 1] == ' ';
|
||||
if (xp) xl--;
|
||||
if (yp) yl--;
|
||||
len = xl < yl ? xl : yl;
|
||||
result = strncmp(x, y, len);
|
||||
if (result < 0) return GREATER;
|
||||
else if (result > 0) return LESS;
|
||||
else if (xl < yl) {
|
||||
if (xp) return EXTENSION;
|
||||
else return LESS;
|
||||
}
|
||||
else if (xl > yl) {
|
||||
if (yp) return PREFIX;
|
||||
else return GREATER;
|
||||
}
|
||||
else return EQUAL;
|
||||
}
|
||||
char *save_string(s)
|
||||
char *s;
|
||||
{
|
||||
char *new = (char *) arena_getmem((strlen(s) + 1) * sizeof(char));
|
||||
strcpy(new, s);
|
||||
return new;
|
||||
}
|
||||
static int ambiguous_prefix();
|
||||
|
||||
static char * found_name = NULL;
|
||||
|
||||
Name *prefix_add(rt, spelling, sector)
|
||||
Name **rt;
|
||||
char *spelling;
|
||||
unsigned char sector;
|
||||
{
|
||||
Name *node = *rt;
|
||||
int cmp;
|
||||
|
||||
while (node) {
|
||||
switch ((cmp = compare(node->spelling, spelling))) {
|
||||
case GREATER: rt = &node->rlink;
|
||||
break;
|
||||
case LESS: rt = &node->llink;
|
||||
break;
|
||||
case EQUAL:
|
||||
found_name = node->spelling;
|
||||
case EXTENSION: if (node->sector > sector) {
|
||||
rt = &node->rlink;
|
||||
break;
|
||||
}
|
||||
else if (node->sector < sector) {
|
||||
rt = &node->llink;
|
||||
break;
|
||||
}
|
||||
if (cmp == EXTENSION)
|
||||
node->spelling = save_string(spelling);
|
||||
return node;
|
||||
case PREFIX: {
|
||||
if (ambiguous_prefix(node->llink, spelling, sector) ||
|
||||
ambiguous_prefix(node->rlink, spelling, sector))
|
||||
fprintf(stderr,
|
||||
"%s: ambiguous prefix %c<%s...%c> (%s, line %d)\n",
|
||||
command_name, nw_char, spelling, nw_char, source_name, source_line);
|
||||
}
|
||||
return node;
|
||||
}
|
||||
node = *rt;
|
||||
}
|
||||
/* Create new name entry */
|
||||
{
|
||||
node = (Name *) arena_getmem(sizeof(Name));
|
||||
if (found_name && robs_strcmp(found_name, spelling) == 0)
|
||||
node->spelling = found_name;
|
||||
else
|
||||
node->spelling = save_string(spelling);
|
||||
node->mark = FALSE;
|
||||
node->llink = NULL;
|
||||
node->rlink = NULL;
|
||||
node->uses = NULL;
|
||||
node->defs = NULL;
|
||||
node->arg[0] =
|
||||
node->arg[1] =
|
||||
node->arg[2] =
|
||||
node->arg[3] =
|
||||
node->arg[4] =
|
||||
node->arg[5] =
|
||||
node->arg[6] =
|
||||
node->arg[7] =
|
||||
node->arg[8] = NULL;
|
||||
node->tab_flag = TRUE;
|
||||
node->indent_flag = TRUE;
|
||||
node->debug_flag = FALSE;
|
||||
node->comment_flag = 0;
|
||||
node->sector = sector;
|
||||
*rt = node;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
static int ambiguous_prefix(node, spelling, sector)
|
||||
Name *node;
|
||||
char *spelling;
|
||||
unsigned char sector;
|
||||
{
|
||||
while (node) {
|
||||
switch (compare(node->spelling, spelling)) {
|
||||
case GREATER: node = node->rlink;
|
||||
break;
|
||||
case LESS: node = node->llink;
|
||||
break;
|
||||
case EXTENSION:
|
||||
case PREFIX:
|
||||
case EQUAL: if (node->sector > sector) {
|
||||
node = node->rlink;
|
||||
break;
|
||||
}
|
||||
else if (node->sector < sector) {
|
||||
node = node->llink;
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
int robs_strcmp(char* x, char* y)
|
||||
{
|
||||
int cmp = 0;
|
||||
|
||||
for (; *x && *y; x++, y++)
|
||||
{
|
||||
/* Skip invisibles on 'x' */
|
||||
if (*x == '|')
|
||||
x++;
|
||||
|
||||
/* Skip invisibles on 'y' */
|
||||
if (*y == '|')
|
||||
y++;
|
||||
|
||||
if (*x == *y)
|
||||
continue;
|
||||
if (islower(*x) && toupper(*x) == *y)
|
||||
{
|
||||
if (!cmp) cmp = 1;
|
||||
continue;
|
||||
}
|
||||
if (islower(*y) && *x == toupper(*y))
|
||||
{
|
||||
if (!cmp) cmp = -1;
|
||||
continue;
|
||||
}
|
||||
return 2*(toupper(*x) - toupper(*y));
|
||||
}
|
||||
if (*x)
|
||||
return 2;
|
||||
if (*y)
|
||||
return -2;
|
||||
return cmp;
|
||||
}
|
||||
Name *name_add(rt, spelling, sector)
|
||||
Name **rt;
|
||||
char *spelling;
|
||||
unsigned char sector;
|
||||
{
|
||||
Name *node = *rt;
|
||||
while (node) {
|
||||
int result = robs_strcmp(node->spelling, spelling);
|
||||
if (result > 0)
|
||||
rt = &node->llink;
|
||||
else if (result < 0)
|
||||
rt = &node->rlink;
|
||||
else
|
||||
{
|
||||
found_name = node->spelling;
|
||||
if (node->sector > sector)
|
||||
rt = &node->llink;
|
||||
else if (node->sector < sector)
|
||||
rt = &node->rlink;
|
||||
else
|
||||
return node;
|
||||
}
|
||||
node = *rt;
|
||||
}
|
||||
/* Create new name entry */
|
||||
{
|
||||
node = (Name *) arena_getmem(sizeof(Name));
|
||||
if (found_name && robs_strcmp(found_name, spelling) == 0)
|
||||
node->spelling = found_name;
|
||||
else
|
||||
node->spelling = save_string(spelling);
|
||||
node->mark = FALSE;
|
||||
node->llink = NULL;
|
||||
node->rlink = NULL;
|
||||
node->uses = NULL;
|
||||
node->defs = NULL;
|
||||
node->arg[0] =
|
||||
node->arg[1] =
|
||||
node->arg[2] =
|
||||
node->arg[3] =
|
||||
node->arg[4] =
|
||||
node->arg[5] =
|
||||
node->arg[6] =
|
||||
node->arg[7] =
|
||||
node->arg[8] = NULL;
|
||||
node->tab_flag = TRUE;
|
||||
node->indent_flag = TRUE;
|
||||
node->debug_flag = FALSE;
|
||||
node->comment_flag = 0;
|
||||
node->sector = sector;
|
||||
*rt = node;
|
||||
return node;
|
||||
}
|
||||
}
|
||||
Name *collect_file_name()
|
||||
{
|
||||
Name *new_name;
|
||||
char name[MAX_NAME_LEN];
|
||||
char *p = name;
|
||||
int start_line = source_line;
|
||||
int c = source_get(), c2;
|
||||
while (isspace(c))
|
||||
c = source_get();
|
||||
while (isgraph(c)) {
|
||||
*p++ = c;
|
||||
c = source_get();
|
||||
}
|
||||
if (p == name) {
|
||||
fprintf(stderr, "%s: expected file name (%s, %d)\n",
|
||||
command_name, source_name, start_line);
|
||||
exit(-1);
|
||||
}
|
||||
*p = '\0';
|
||||
/* File names are always global. */
|
||||
new_name = name_add(&file_names, name, 0);
|
||||
/* Handle optional per-file flags */
|
||||
{
|
||||
while (1) {
|
||||
while (isspace(c))
|
||||
c = source_get();
|
||||
if (c == '-') {
|
||||
c = source_get();
|
||||
do {
|
||||
switch (c) {
|
||||
case 't': new_name->tab_flag = FALSE;
|
||||
break;
|
||||
case 'd': new_name->debug_flag = TRUE;
|
||||
break;
|
||||
case 'i': new_name->indent_flag = FALSE;
|
||||
break;
|
||||
case 'c': c = source_get();
|
||||
if (c == 'c')
|
||||
new_name->comment_flag = 1;
|
||||
else if (c == '+')
|
||||
new_name->comment_flag = 2;
|
||||
else if (c == 'p')
|
||||
new_name->comment_flag = 3;
|
||||
else
|
||||
fprintf(stderr, "%s: Unrecognised comment flag (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
|
||||
break;
|
||||
default : fprintf(stderr, "%s: unexpected per-file flag (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
break;
|
||||
}
|
||||
c = source_get();
|
||||
} while (!isspace(c));
|
||||
}
|
||||
else break;
|
||||
}
|
||||
}
|
||||
c2 = source_get();
|
||||
if (c != nw_char || (c2 != '{' && c2 != '(' && c2 != '[')) {
|
||||
fprintf(stderr, "%s: expected %c{, %c[, or %c( after file name (%s, %d)\n",
|
||||
command_name, nw_char, nw_char, nw_char, source_name, start_line);
|
||||
exit(-1);
|
||||
}
|
||||
return new_name;
|
||||
}
|
||||
Name *collect_macro_name()
|
||||
{
|
||||
char name[MAX_NAME_LEN];
|
||||
char args[1000];
|
||||
char * arg[9];
|
||||
char * argp = args;
|
||||
int argc = 0;
|
||||
char *p = name;
|
||||
int start_line = source_line;
|
||||
int c = source_get(), c2;
|
||||
unsigned char sector = current_sector;
|
||||
|
||||
if (c == '+') {
|
||||
sector = 0;
|
||||
c = source_get();
|
||||
}
|
||||
while (isspace(c))
|
||||
c = source_get();
|
||||
while (c != EOF) {
|
||||
Name * node;
|
||||
switch (c) {
|
||||
case '\t':
|
||||
case ' ': *p++ = ' ';
|
||||
do
|
||||
c = source_get();
|
||||
while (c == ' ' || c == '\t');
|
||||
break;
|
||||
case '\n': {
|
||||
do
|
||||
c = source_get();
|
||||
while (isspace(c));
|
||||
c2 = source_get();
|
||||
if (c != nw_char || (c2 != '{' && c2 != '(' && c2 != '[')) {
|
||||
fprintf(stderr, "%s: expected %c{ after fragment name (%s, %d)\n",
|
||||
command_name, nw_char, source_name, start_line);
|
||||
exit(-1);
|
||||
}
|
||||
/* Cleanup and install name */
|
||||
{
|
||||
if (p > name && p[-1] == ' ')
|
||||
p--;
|
||||
if (p - name > 3 && p[-1] == '.' && p[-2] == '.' && p[-3] == '.') {
|
||||
p[-3] = ' ';
|
||||
p -= 2;
|
||||
}
|
||||
if (p == name || name[0] == ' ') {
|
||||
fprintf(stderr, "%s: empty name (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
*p = '\0';
|
||||
node = prefix_add(¯o_names, name, sector);
|
||||
}
|
||||
return install_args(node, argc, arg);
|
||||
}
|
||||
default:
|
||||
if (c==nw_char)
|
||||
{
|
||||
/* Check for terminating at-sequence and return name */
|
||||
{
|
||||
c = source_get();
|
||||
switch (c) {
|
||||
case '(':
|
||||
case '[':
|
||||
case '{': {
|
||||
if (p > name && p[-1] == ' ')
|
||||
p--;
|
||||
if (p - name > 3 && p[-1] == '.' && p[-2] == '.' && p[-3] == '.') {
|
||||
p[-3] = ' ';
|
||||
p -= 2;
|
||||
}
|
||||
if (p == name || name[0] == ' ') {
|
||||
fprintf(stderr, "%s: empty name (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
*p = '\0';
|
||||
node = prefix_add(¯o_names, name, sector);
|
||||
}
|
||||
return install_args(node, argc, arg);
|
||||
case '\'': arg[argc] = argp;
|
||||
while ((c = source_get()) != EOF) {
|
||||
if (c==nw_char) {
|
||||
c2 = source_get();
|
||||
if (c2=='\'') {
|
||||
/* Make this argument */
|
||||
if (argc < 9) {
|
||||
*argp++ = '\000';
|
||||
argc += 1;
|
||||
}
|
||||
|
||||
c = source_get();
|
||||
break;
|
||||
}
|
||||
else
|
||||
*argp++ = c2;
|
||||
}
|
||||
else
|
||||
*argp++ = c;
|
||||
}
|
||||
*p++ = ARG_CHR;
|
||||
|
||||
break;
|
||||
default:
|
||||
if (c==nw_char)
|
||||
{
|
||||
*p++ = c;
|
||||
break;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"%s: unexpected %c%c in fragment definition name (%s, %d)\n",
|
||||
command_name, nw_char, c, source_name, start_line);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
*p++ = c;
|
||||
c = source_get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "%s: expected fragment name (%s, %d)\n",
|
||||
command_name, source_name, start_line);
|
||||
exit(-1);
|
||||
return NULL; /* unreachable return to avoid warnings on some compilers */
|
||||
}
|
||||
Name *install_args(Name * name, int argc, char *arg[9])
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (name->arg[i] == NULL)
|
||||
name->arg[i] = save_string(arg[i]);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
Arglist * buildArglist(Name * name, Arglist * a)
|
||||
{
|
||||
Arglist * args = (Arglist *)arena_getmem(sizeof(Arglist));
|
||||
|
||||
args->args = a;
|
||||
args->next = NULL;
|
||||
args->name = name;
|
||||
return args;
|
||||
}
|
||||
Arglist * collect_scrap_name(int current_scrap)
|
||||
{
|
||||
char name[MAX_NAME_LEN];
|
||||
char *p = name;
|
||||
int c = source_get();
|
||||
unsigned char sector = current_sector;
|
||||
Arglist * head = NULL;
|
||||
Arglist ** tail = &head;
|
||||
|
||||
if (c == '+')
|
||||
{
|
||||
sector = 0;
|
||||
c = source_get();
|
||||
}
|
||||
while (c == ' ' || c == '\t')
|
||||
c = source_get();
|
||||
while (c != EOF) {
|
||||
switch (c) {
|
||||
case '\t':
|
||||
case ' ': *p++ = ' ';
|
||||
do
|
||||
c = source_get();
|
||||
while (c == ' ' || c == '\t');
|
||||
break;
|
||||
default:
|
||||
if (c==nw_char)
|
||||
{
|
||||
/* Look for end of scrap name and return */
|
||||
{
|
||||
Name * node;
|
||||
|
||||
c = source_get();
|
||||
switch (c) {
|
||||
|
||||
case '\'': {
|
||||
/* Add plain string argument */
|
||||
char buff[MAX_NAME_LEN];
|
||||
char * s = buff;
|
||||
int c, c2;
|
||||
|
||||
while ((c = source_get()) != EOF) {
|
||||
if (c==nw_char) {
|
||||
c2 = source_get();
|
||||
if (c2=='\'')
|
||||
break;
|
||||
*s++ = c2;
|
||||
}
|
||||
else
|
||||
*s++ = c;
|
||||
}
|
||||
*s = '\000';
|
||||
/* Add buff to current arg list */
|
||||
*tail = buildArglist(NULL, (Arglist *)save_string(buff));
|
||||
tail = &(*tail)->next;
|
||||
|
||||
}
|
||||
*p++ = ARG_CHR;
|
||||
c = source_get();
|
||||
break;
|
||||
case '1': case '2': case '3':
|
||||
case '4': case '5': case '6':
|
||||
case '7': case '8': case '9': {
|
||||
/* Add a propagated argument */
|
||||
char buff[3];
|
||||
buff[0] = ARG_CHR;
|
||||
buff[1] = c;
|
||||
buff[2] = '\000';
|
||||
/* Add buff to current arg list */
|
||||
*tail = buildArglist(NULL, (Arglist *)save_string(buff));
|
||||
tail = &(*tail)->next;
|
||||
|
||||
}
|
||||
*p++ = ARG_CHR;
|
||||
c = source_get();
|
||||
break;
|
||||
case '{': {
|
||||
/* Add an inline scrap argument */
|
||||
int s = collect_scrap();
|
||||
Scrap_Node * d = (Scrap_Node *)arena_getmem(sizeof(Scrap_Node));
|
||||
d->scrap = s;
|
||||
d->quoted = 0;
|
||||
d->next = NULL;
|
||||
*tail = buildArglist((Name *)1, (Arglist *)d);
|
||||
tail = &(*tail)->next;
|
||||
}
|
||||
*p++ = ARG_CHR;
|
||||
c = source_get();
|
||||
break;
|
||||
case '<':
|
||||
/* Add macro call argument */
|
||||
*tail = collect_scrap_name(current_scrap);
|
||||
if (current_scrap >= 0)
|
||||
add_to_use((*tail)->name, current_scrap);
|
||||
tail = &(*tail)->next;
|
||||
|
||||
*p++ = ARG_CHR;
|
||||
c = source_get();
|
||||
break;
|
||||
case '(':
|
||||
scrap_name_has_parameters = 1;
|
||||
/* Cleanup and install name */
|
||||
{
|
||||
if (p > name && p[-1] == ' ')
|
||||
p--;
|
||||
if (p - name > 3 && p[-1] == '.' && p[-2] == '.' && p[-3] == '.') {
|
||||
p[-3] = ' ';
|
||||
p -= 2;
|
||||
}
|
||||
if (p == name || name[0] == ' ') {
|
||||
fprintf(stderr, "%s: empty name (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
*p = '\0';
|
||||
node = prefix_add(¯o_names, name, sector);
|
||||
}
|
||||
return buildArglist(node, head);
|
||||
case '>':
|
||||
scrap_name_has_parameters = 0;
|
||||
/* Cleanup and install name */
|
||||
{
|
||||
if (p > name && p[-1] == ' ')
|
||||
p--;
|
||||
if (p - name > 3 && p[-1] == '.' && p[-2] == '.' && p[-3] == '.') {
|
||||
p[-3] = ' ';
|
||||
p -= 2;
|
||||
}
|
||||
if (p == name || name[0] == ' ') {
|
||||
fprintf(stderr, "%s: empty name (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
*p = '\0';
|
||||
node = prefix_add(¯o_names, name, sector);
|
||||
}
|
||||
return buildArglist(node, head);
|
||||
|
||||
default:
|
||||
if (c==nw_char)
|
||||
{
|
||||
*p++ = c;
|
||||
c = source_get();
|
||||
break;
|
||||
}
|
||||
fprintf(stderr,
|
||||
"%s: unexpected %c%c in fragment invocation name (%s, %d)\n",
|
||||
command_name, nw_char, c, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!isgraph(c)) {
|
||||
fprintf(stderr,
|
||||
"%s: unexpected character in fragment name (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
*p++ = c;
|
||||
c = source_get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "%s: unexpected end of file (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
return NULL; /* unreachable return to avoid warnings on some compilers */
|
||||
}
|
||||
static Scrap_Node *reverse(); /* a forward declaration */
|
||||
|
||||
void reverse_lists(names)
|
||||
Name *names;
|
||||
{
|
||||
while (names) {
|
||||
reverse_lists(names->llink);
|
||||
names->defs = reverse(names->defs);
|
||||
names->uses = reverse(names->uses);
|
||||
names = names->rlink;
|
||||
}
|
||||
}
|
||||
static Scrap_Node *reverse(a)
|
||||
Scrap_Node *a;
|
||||
{
|
||||
if (a) {
|
||||
Scrap_Node *b = a->next;
|
||||
a->next = NULL;
|
||||
while (b) {
|
||||
Scrap_Node *c = b->next;
|
||||
b->next = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
809
nuweb.el
Normal file
809
nuweb.el
Normal file
@@ -0,0 +1,809 @@
|
||||
;;; nuweb.el --- major mode to edit nuweb files with AucTex or TeX.
|
||||
;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;; Original header
|
||||
;;;
|
||||
;;; $ Id: nuweb.el 184 2010-04-12 18:42:08Z ddw $
|
||||
;;;
|
||||
;;;
|
||||
;; Author: Dominique de Waleffe <ddewaleffe@gmail.com>
|
||||
;; Maintainer: Dominique de Waleffe <ddewaleffe@gmail.com>
|
||||
;; Version: $ Revision: 184 $
|
||||
;; Keywords: nuweb programming tex tools languages
|
||||
;;
|
||||
;;
|
||||
;; DISCLAIMER: I do not guarantee anything about this
|
||||
;; package, nor does my employer. You get it as is and not much else.
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; This nuweb support package is free software, just as GNU Emacs; you
|
||||
;; can redistribute it and/or modify it under the terms of the GNU
|
||||
;; General Public License as published by ;the Free Software Foundation;
|
||||
;; either version 2, or (at your option) any later version.
|
||||
;; GNU Emacs is distributed in the hope that it will be useful, but
|
||||
;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;; General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with GNU Emacs; see the file COPYING. If not, write to
|
||||
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
;;
|
||||
|
||||
;;;
|
||||
;;; Bug reports , suggestions are welcome at http://
|
||||
|
||||
;;; DOCUMENTATION (short) there is no long version yet:-)
|
||||
;;; To install:
|
||||
;;; ; if your version of nuweb does not know about @% comments
|
||||
;;; (setq nuweb-comment-leader "")
|
||||
;;; ; if you want to activate the mode for .w files
|
||||
;;; (push '( "\\.w" . nuweb-mode) auto-mode-alist)
|
||||
;;; ; To load it
|
||||
;;; (require 'nuweb)
|
||||
;;;
|
||||
;;; When called, nuweb-mode calls latex-mode and adds the following
|
||||
;;; bindings:
|
||||
;;;
|
||||
;;; A) Help for editing scraps in language dependent mode
|
||||
;;;
|
||||
;;; C-c C-z nuweb-edit-this scrap
|
||||
;;; Edit the scrap point is on in its own buffer *Source*
|
||||
;;; put into the mode specified as follows:
|
||||
;;; a) if the first line contains -*-mode-name-*- that is
|
||||
;;; used,
|
||||
;;; b) otherwise, for @o <filename> scraps, the mode is
|
||||
;;; derived from the value of auto-mode-alist
|
||||
;;; c) otherwise it is taken from the (buffer local) variable
|
||||
;;; nuweb-source-mode (which defaults to "emacs-lisp")
|
||||
;;;
|
||||
;;; The *Source* buffer is then put into Nuweb minor mode
|
||||
;;; which adds two bindings:
|
||||
;;; C-c C-z nuweb-install-this-scrap
|
||||
;;; Which takes the *Source* buffer contents and puts
|
||||
;;; it back into the web buffer in place of the old
|
||||
;;; version of the scrap.
|
||||
;;; C-c M-k nuweb-kill-this-scrap
|
||||
;;; Which restores the old scrap, ignoring changes
|
||||
;;; made.
|
||||
;;; The original buffer is put in read-only mode until you
|
||||
;;; call one of the two above functions or kill the
|
||||
;;; *Source* buffer.
|
||||
;;; C-c @ nuweb-insert-scrap
|
||||
;;; With no argument: inserts an empty scrap template at
|
||||
;;; point.
|
||||
;;; With an argument: prompt for scrap type (oDdD), scrap
|
||||
;;; name and language mode. A new scrap is inserted and
|
||||
;;; edited as if nuweb-edit-this-scrap had been called.
|
||||
;;;
|
||||
;;; B) Help for navigation on definitions and uses
|
||||
;;; (not normally allowed by the guidelones for elisp modes, I
|
||||
;;; could not think of any other other than C-c C-d [rpsn] but
|
||||
;;; auctex now uses C-c C-d....)
|
||||
;;;
|
||||
;;; C-c d r nuweb-compute-d-u
|
||||
;;; Recompute all defs and uses in current buffer.
|
||||
;;; C-c d p
|
||||
;;; Pop back to previous def/use
|
||||
;;; C-c d s
|
||||
;;; Find first definition for scrap name at point
|
||||
;;; C-c d n
|
||||
;;; Find next definition of same scrap name
|
||||
;;; C-c u s
|
||||
;;; Find first use of scrap name at point
|
||||
;;; C-c u n
|
||||
;;; Find next use of smae scrap name
|
||||
;;; M-mouse3
|
||||
;;; Find first def or first use (if on a def -> use, if on a
|
||||
;;; use -> def)
|
||||
;;; C-M-S-mouse1
|
||||
;;; Make an imenu for symbols (@|) , scrap names (@d) and
|
||||
;;; files (@o). (imenu.el comes with 19.25, and should be on archive
|
||||
;;; sites).
|
||||
;;;
|
||||
;;; C) The commands to run nuweb and latex on the file are known as
|
||||
;;; Tangle: generate output files only
|
||||
;;; Weave: generate tex file then run latex on it
|
||||
;;; Web: does it all.
|
||||
;;; Provided your version of nuweb does output !name(f.w) and
|
||||
;;; !offset(<num>) in the generated tex file Auctex will take you
|
||||
;;; right back to Tex errors but at the correct stop in the web file.
|
||||
;;;
|
||||
;;; CUSTOMISATION:
|
||||
;;;
|
||||
;;; Change language mode for scraps
|
||||
;;; (setq-default nuweb-source-mode "mode-name-function(without -mode)")
|
||||
;;; (setq-default nuweb-source-mode "prolog") ;default for all buffers
|
||||
;;; or (setq nuweb-source-mode "emacs-lisp") ; current one only
|
||||
;;;
|
||||
;;; Support for nuweb comments @% (I have patches to nuweb for that)
|
||||
;;; (setq nuweb-comment-leader "@%")
|
||||
;;;
|
||||
;;;
|
||||
;;;
|
||||
;;; PROBLEMS: SOLUTION:
|
||||
;;;
|
||||
;;; -) Relies on FSF Emacs 19 Upgrade or make the package
|
||||
;;; back-compatible
|
||||
;;; -) Functions are not well I should have used nuweb for this
|
||||
;;; documented
|
||||
;;; -) Bindings may not suit Change as you like
|
||||
;;; every one
|
||||
;;; -) Does not yet support the
|
||||
;;; standard TeX mode of Emacs
|
||||
|
||||
;;; WISH LIST:
|
||||
;;; -) Menus active on scrap def/use point providing navigation
|
||||
;;; functions (I'm thinking of looking at imenu.el for this
|
||||
;;; (Experimental support for this at the end) Bound to C-M-mouse-1.
|
||||
;;; -) Better support for standard tex mode (or that GNU adopts AucTeX..)
|
||||
;;;
|
||||
;;; CONTRIBUTIONS:
|
||||
;;; Thorbj{\o}rn Andersen <ravn@imada.ou.dk> suggested the use of C-c C-z
|
||||
;;; I used it to get into the *source* and as normal exit key.
|
||||
;;; Also suggested the simple (no prompts) insertion of a scrap
|
||||
;;; template, and other things.
|
||||
;;;
|
||||
;;; AVAILABILITY:
|
||||
;;;
|
||||
;;; elisp-archive directory: elisp-archive/modes/nuweb.el.Z
|
||||
;;; from main site and mirrors
|
||||
;;; or from by email from me
|
||||
;;;
|
||||
(require 'cl)
|
||||
|
||||
(if (locate-library "auctex")
|
||||
(progn
|
||||
(require 'tex-site)
|
||||
(require 'latex))
|
||||
(require 'tex-mode)
|
||||
(setq TeX-command-list nil)
|
||||
(setq LaTeX-mode-map tex-mode-map)
|
||||
)
|
||||
|
||||
;;; Extend the list of commands
|
||||
;;; Web generates both tex and sources
|
||||
(push
|
||||
(list "Web"
|
||||
"sh -c \"nuweb %s && pdflatex '\\nonstopmode\\input{%s}'\""
|
||||
'TeX-run-LaTeX nil
|
||||
t)
|
||||
TeX-command-list)
|
||||
;;; Weave generates Tex output then runs LaTeX
|
||||
(push
|
||||
(list "Weave"
|
||||
"sh -c \"nuweb -o %s && pdflatex '\\nonstopmode\\input{%s}'\""
|
||||
'TeX-run-LaTeX nil
|
||||
t)
|
||||
TeX-command-list)
|
||||
;;; Tangle generates only the source file compile not done.
|
||||
(push
|
||||
(list "Tangle"
|
||||
"sh -c \"nuweb -t %s && echo 'Sources updated'\""
|
||||
'TeX-run-LaTeX nil
|
||||
t)
|
||||
TeX-command-list)
|
||||
|
||||
;;; allow .w as extension
|
||||
(if (boundp 'TeX-file-extensions)
|
||||
(push "w" TeX-file-extensions)
|
||||
(setq TeX-file-extensions '("tex" "sty" "w")))
|
||||
|
||||
(defvar nuweb-mode-map nil)
|
||||
(defvar nuweb-source-mode "emacs-lisp")
|
||||
|
||||
(defvar nuweb-defs nil
|
||||
"List of defs found and where")
|
||||
(defvar nuweb-uses nil
|
||||
"List of uses found and where")
|
||||
(defvar nuweb-names nil
|
||||
"List of canonical names of scraps")
|
||||
(defvar *def-list* nil)
|
||||
(defvar *use-list* nil)
|
||||
(defvar nuweb-def-use-stack nil
|
||||
"Record locations we have visited so far")
|
||||
|
||||
; only one of those in effect....
|
||||
(defvar *nuweb-last-scrap-pos* nil)
|
||||
(defvar *nuweb-last-scrap-begin* nil)
|
||||
(defvar *nuweb-last-scrap-end* nil)
|
||||
|
||||
(defun ins-@()(interactive)(insert "@@") )
|
||||
(defun ins-@<()(interactive)(insert "@< @>\n")(forward-char -4) )
|
||||
(defun ins-@d()(interactive)(insert "@d @{@%\n@|@}\n") (forward-char -11))
|
||||
(defun ins-@D()(interactive)(insert "@D @{@%\n@|@}\n")(forward-char -11) )
|
||||
(defun ins-@o()(interactive)(insert "@o @{@%\n@|@}\n") (forward-char -11))
|
||||
(defun ins-@O()(interactive)(insert "@O @{@%\n@|@}\n") (forward-char -11))
|
||||
(defun ins-@|()(interactive)(insert "@|") )
|
||||
(defun ins-@{()(interactive)(insert "@{") )
|
||||
(defun ins-@}()(interactive)(insert "@}") )
|
||||
(defun ins-@m()(interactive)(insert "@m") )
|
||||
(defun ins-@u()(interactive)(insert "@u") )
|
||||
(defun ins-@f()(interactive)(insert "@f") )
|
||||
(defun ins-@%()(interactive)(insert "@%") )
|
||||
|
||||
|
||||
(defun nuweb-mode ()
|
||||
"Major mode to edit nuweb source files.
|
||||
Adds the following bindings to the normal LaTeX ones.
|
||||
Commands:
|
||||
\{nuweb-mode-map}"
|
||||
(interactive)
|
||||
(latex-mode)
|
||||
(setq mode-name "nuweb")
|
||||
;; Make sure the nuweb map exist
|
||||
(cond ((or (not (boundp 'nuweb-mode-map))
|
||||
(null nuweb-mode-map))
|
||||
;; this keymap inherit the current local bindings
|
||||
(setq nuweb-mode-map (cons 'keymap LaTeX-mode-map))
|
||||
(define-key nuweb-mode-map
|
||||
"\C-c\C-z" 'nuweb-edit-this-scrap)
|
||||
(define-key nuweb-mode-map
|
||||
"\C-c@" 'nuweb-insert-scrap)
|
||||
(define-key nuweb-mode-map "@@" 'ins-@)
|
||||
(define-key nuweb-mode-map "@<" 'ins-@<)
|
||||
(define-key nuweb-mode-map "@|" 'ins-@|)
|
||||
(define-key nuweb-mode-map "@}" 'ins-@})
|
||||
(define-key nuweb-mode-map "@{" 'ins-@{)
|
||||
(define-key nuweb-mode-map "@d" 'ins-@d)
|
||||
(define-key nuweb-mode-map "@D" 'ins-@D)
|
||||
(define-key nuweb-mode-map "@o" 'ins-@o)
|
||||
(define-key nuweb-mode-map "@O" 'ins-@O)
|
||||
(define-key nuweb-mode-map "@%" 'ins-@%)
|
||||
(define-key nuweb-mode-map "@m" 'ins-@m)
|
||||
(define-key nuweb-mode-map "@u" 'ins-@u)
|
||||
(define-key nuweb-mode-map "@f" 'ins-@f)
|
||||
(define-key nuweb-mode-map "\C-cds" 'nuweb-find-def)
|
||||
(define-key nuweb-mode-map "\C-cus" 'nuweb-find-use)
|
||||
(define-key nuweb-mode-map "\C-cdn" 'nuweb-find-next-def)
|
||||
(define-key nuweb-mode-map "\C-cun" 'nuweb-find-next-use)
|
||||
(define-key nuweb-mode-map "\C-cdr" 'nuweb-compute-d-u)
|
||||
(define-key nuweb-mode-map "\C-cdp" 'nuweb-pop-d-u)
|
||||
(define-key nuweb-mode-map [M-mouse-3] 'nuweb-find-def-or-use)))
|
||||
;; make sure we have our own keymap
|
||||
;; we use a copy for in buffer so that outline mode is
|
||||
;; properly initialized
|
||||
(use-local-map (copy-keymap nuweb-mode-map))
|
||||
(make-local-variable 'nuweb-source-mode)
|
||||
(make-local-variable 'nuweb-defs)
|
||||
(make-local-variable 'nuweb-uses)
|
||||
(make-local-variable 'nuweb-names)
|
||||
(make-local-variable '*def-list*)
|
||||
(make-local-variable '*use-list*)
|
||||
(make-local-variable 'nuweb-def-use-stack)
|
||||
(make-local-variable '*nuweb-last-scrap-pos*)
|
||||
(make-local-variable '*nuweb-last-scrap-begin*)
|
||||
(make-local-variable '*nuweb-last-scrap-end*)
|
||||
(setq TeX-default-extension "w")
|
||||
(setq TeX-auto-untabify nil)
|
||||
(setq TeX-command-default "Web")
|
||||
(run-hooks 'nuweb-mode-hook))
|
||||
|
||||
;; set this to "" if you dont have comments in nuweb
|
||||
;; (I have patches to support @%)
|
||||
(defvar nuweb-comment-leader "")
|
||||
|
||||
(defvar nuweb-scrap-name-hist nil
|
||||
"History list for scrap names used")
|
||||
|
||||
(defun nuweb-insert-scrap(arg)
|
||||
"Insert a scrap at current cursor location. With an argument,
|
||||
prompts for the type, name and editing mode then directly enter
|
||||
the *Source* buffer. If no argument given, simply inserts a template
|
||||
for a scrap"
|
||||
(interactive "P")
|
||||
(if arg
|
||||
(apply 'nuweb-insert-scrap-intern
|
||||
(list
|
||||
(concat (read-from-minibuffer "Type of scrap: " "d")" ")
|
||||
(concat (read-from-minibuffer
|
||||
"Scrap title:"
|
||||
(car nuweb-scrap-name-hist)
|
||||
nil ;no keymap
|
||||
nil ;dont use read
|
||||
(cons 'nuweb-scrap-name-hist 0))
|
||||
" ")
|
||||
(read-from-minibuffer "Mode name:" nuweb-source-mode)
|
||||
;; edit if interactive
|
||||
t))
|
||||
(save-excursion
|
||||
(nuweb-insert-scrap-intern "" "\n" nuweb-source-mode nil))
|
||||
(forward-char 1)))
|
||||
|
||||
(defun nuweb-insert-scrap-intern(type title modename editp)
|
||||
(save-excursion
|
||||
(insert (format "@%s%s@\{%s%s\n@| @\}\n"
|
||||
type title
|
||||
nuweb-comment-leader
|
||||
(if (or (equal modename "")
|
||||
(equal modename nuweb-source-mode))
|
||||
""
|
||||
(concat " -*-" modename "-*-")))))
|
||||
(cond ( editp
|
||||
(forward-line 1)
|
||||
(nuweb-edit-this-scrap))))
|
||||
|
||||
;;;
|
||||
;;; !!! The file re does not check for nuweb options that may follow
|
||||
(defun nuweb-edit-this-scrap()
|
||||
(interactive)
|
||||
(barf-if-buffer-read-only)
|
||||
(cond ((or (null *nuweb-last-scrap-pos*)
|
||||
(y-or-n-p
|
||||
"You did not finish editing the previous scrap. Continue"))
|
||||
(setq *nuweb-last-scrap-pos* (point-marker))
|
||||
(let* ((s-begin (and (re-search-backward "@[dDoO]" nil t)
|
||||
;; (search-forward "@\{" nil t)
|
||||
(point)))
|
||||
(file (if (looking-at "@[oO][ \t]*\\([^ \t]+\\)[ \t]*")
|
||||
(buffer-substring (match-beginning 1)
|
||||
(match-end 1))
|
||||
nil))
|
||||
(b-begin
|
||||
(and (re-search-forward
|
||||
(concat "@\{[ \t]*\\("
|
||||
nuweb-comment-leader
|
||||
"\\)?[ \t]*\\(-\\*-[ \t]*\\([^ \t]+\\)[ \t]*-\\*-\\)?") nil t)
|
||||
(prog2 (if (and (match-beginning 1)(match-end 1))
|
||||
(skip-chars-forward "[^\n]"))
|
||||
(point))))
|
||||
(mode-spec (if (and b-begin (match-beginning 3) (match-end 3))
|
||||
(buffer-substring (match-beginning 3)
|
||||
(match-end 3))
|
||||
nil))
|
||||
(offset (- (marker-position *nuweb-last-scrap-pos*)
|
||||
b-begin))
|
||||
;; fool nuweb-mode using concat
|
||||
(b-end (and (re-search-forward "@[|}]" nil t)
|
||||
(prog1 t (forward-char -2))
|
||||
(>= (point) (marker-position *nuweb-last-scrap-pos*))
|
||||
(point)))
|
||||
(text "")
|
||||
(nuweb-source-mode-orig nuweb-source-mode)
|
||||
(saved-return-location *nuweb-last-scrap-pos*)
|
||||
source-mode)
|
||||
(cond ( (and b-begin b-end)
|
||||
(setq *nuweb-last-scrap-begin* b-begin)
|
||||
(setq *nuweb-last-scrap-end* b-end)
|
||||
(setq text (buffer-substring b-begin b-end))
|
||||
(setq buffer-read-only t)
|
||||
(setq *nuweb-win-config*
|
||||
(current-window-configuration))
|
||||
(pop-to-buffer "*Source*")
|
||||
(erase-buffer)
|
||||
(insert text)
|
||||
(setq source-mode nil)
|
||||
(if (and (not source-mode)
|
||||
mode-spec)
|
||||
(setq source-mode
|
||||
(intern (concat (downcase mode-spec) "-mode"))))
|
||||
|
||||
(if file
|
||||
(let* ((case-fold-search nil)
|
||||
(mode (cdr (find file auto-mode-alist
|
||||
:key 'car
|
||||
:test (function
|
||||
(lambda(a b)
|
||||
(string-match b a)))))))
|
||||
(if mode (setq source-mode mode))))
|
||||
|
||||
(if (not source-mode)
|
||||
(setq source-mode
|
||||
(if (stringp nuweb-source-mode-orig)
|
||||
(intern (concat
|
||||
(downcase nuweb-source-mode-orig)
|
||||
"-mode"))
|
||||
source-mode)))
|
||||
|
||||
(funcall source-mode)
|
||||
|
||||
;; go to same relative position
|
||||
(goto-char (+ (point-min) (max offset 0)))
|
||||
;; clean up when killing the *source* buffer
|
||||
(make-local-variable 'kill-buffer-hook)
|
||||
|
||||
(make-local-variable 'nuweb-minor-mode)
|
||||
(make-local-variable 'nuweb-return-location)
|
||||
(setq nuweb-return-location saved-return-location)
|
||||
(add-hook 'kill-buffer-hook
|
||||
(function (lambda()
|
||||
(save-excursion
|
||||
(nuweb-kill-this-scrap)))))
|
||||
(nuweb-minor-mode 1)
|
||||
(message "C-c C-z to use source, C-c M-k to abort"))
|
||||
(t (goto-char (marker-position *nuweb-last-scrap-pos*))
|
||||
(setq *nuweb-last-scrap-pos* nil)
|
||||
(error "Could not identify scrap")))
|
||||
)
|
||||
)
|
||||
(t (message "Use C-x b and select buffer *Source* to finish"))))
|
||||
|
||||
(defvar nuweb-minor-mode-map nil)
|
||||
(cond ((or (not (boundp 'nuweb-minor-mode-map))
|
||||
(null nuweb-minor-mode-map))
|
||||
(setq nuweb-minor-mode-map (make-sparse-keymap))
|
||||
(define-key nuweb-minor-mode-map "\C-c\C-z" 'nuweb-install-this-scrap)
|
||||
(define-key nuweb-minor-mode-map "\C-c\M-k" 'nuweb-kill-this-scrap)
|
||||
))
|
||||
|
||||
(defvar nuweb-minor-mode nil)
|
||||
|
||||
(make-variable-buffer-local 'nuweb-minor-mode)
|
||||
|
||||
(or (assq 'nuweb-minor-mode minor-mode-alist)
|
||||
(setq minor-mode-alist (cons '(nuweb-minor-mode " Nuweb")
|
||||
minor-mode-alist)))
|
||||
(or (assq 'nuweb-minor-mode minor-mode-map-alist)
|
||||
(setq minor-mode-map-alist (cons (cons 'nuweb-minor-mode
|
||||
nuweb-minor-mode-map)
|
||||
minor-mode-map-alist)))
|
||||
|
||||
;;; The function is there but has nothing to do (thanks to Emacs 19
|
||||
;;; function for minor mode bindings
|
||||
;;; It is here if anyone cares to make it Emacs 18 compatible.
|
||||
(defun nuweb-minor-mode (arg)
|
||||
"This minor mode provides two additional bindings to the current
|
||||
language mode. The bindings allow to install the contents of the
|
||||
*Source* buffer as current scrap body or to kill the buffer and
|
||||
re-install the old scrap body.
|
||||
|
||||
The bindings installed by this minor mode are
|
||||
\\{nuweb-minor-mode-map}"
|
||||
(interactive "P")
|
||||
(setq nuweb-minor-mode
|
||||
(if (null arg) (not nuweb-minor-mode)
|
||||
(> (prefix-numeric-value arg) 0)))
|
||||
(cond (nuweb-minor-mode
|
||||
;; turn it on
|
||||
;; Nothin to do yet...
|
||||
t
|
||||
)
|
||||
(t
|
||||
;; turn it off
|
||||
;; Nothin to do yet...
|
||||
nil
|
||||
)))
|
||||
|
||||
(defun nuweb-install-this-scrap()
|
||||
(interactive)
|
||||
(let ((offset (point)))
|
||||
(setq kill-buffer-hook nil)
|
||||
;; use *Source* local variable to return to correct buffer
|
||||
(switch-to-buffer (marker-buffer nuweb-return-location))
|
||||
(setq buffer-read-only nil) ;it was writable
|
||||
(set-window-configuration *nuweb-win-config*)
|
||||
;; now we can use the last-scrap-pos variable
|
||||
(goto-char (marker-position *nuweb-last-scrap-pos* ))
|
||||
(set-marker *nuweb-last-scrap-pos* nil)
|
||||
(recenter)
|
||||
(goto-char *nuweb-last-scrap-begin*)
|
||||
(delete-region *nuweb-last-scrap-begin* *nuweb-last-scrap-end*)
|
||||
(insert-buffer "*Source*")
|
||||
(forward-char (- offset 1))
|
||||
(setq *nuweb-last-scrap-pos* nil)))
|
||||
|
||||
(defun nuweb-kill-this-scrap()
|
||||
(interactive)
|
||||
(nuweb-back-to-pos)
|
||||
(setq *nuweb-last-scrap-pos* nil))
|
||||
|
||||
(defun nuweb-back-to-pos()
|
||||
(setq kill-buffer-hook nil)
|
||||
(switch-to-buffer (marker-buffer nuweb-return-location))
|
||||
(setq buffer-read-only nil)
|
||||
(delete-other-windows)
|
||||
(goto-char (marker-position *nuweb-last-scrap-pos*))
|
||||
(recenter))
|
||||
|
||||
|
||||
;;; Below is code to support movements based on scrap uses and
|
||||
;;; definitions.
|
||||
;;;
|
||||
;; structure to hold the scrap def descriptors
|
||||
;; The name field
|
||||
;; contains the name as found in buffer, then will hold the cononical
|
||||
;; name (after second pass). While text will contain the whole text
|
||||
;; matched when the def or use is found.
|
||||
|
||||
(defstruct scrap-def name text type loc)
|
||||
;; structure to hold the scrap def descriptors (see above)
|
||||
|
||||
(defstruct scrap-use name text loc)
|
||||
|
||||
(defvar nuweb-scrap-def-re "@\\([oOdD]\\)[ \t]*\\(.*[^ \t\n]\\)[ \t]*\n?@{"
|
||||
"Way to match a scrap definition")
|
||||
|
||||
(defun nuweb-make-scrap-def-list()
|
||||
"Collect a list of all the scrap definitions"
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(loop
|
||||
while (re-search-forward nuweb-scrap-def-re nil t)
|
||||
collect (make-scrap-def :name (buffer-substring (match-beginning 2)
|
||||
(match-end 2))
|
||||
:type (buffer-substring (match-beginning 1)
|
||||
(match-end 1))
|
||||
:text (buffer-substring (match-beginning 0)
|
||||
(match-end 0))
|
||||
:loc (match-beginning 0)))))
|
||||
|
||||
(defvar nuweb-scrap-use-re "@<[ \t]*\\(.*[^ \t\n]\\)[ \t]*@>"
|
||||
"How to recognize a usage")
|
||||
|
||||
(defun nuweb-make-scrap-use-list()
|
||||
"Collect list of scrap usages"
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(loop
|
||||
while (re-search-forward nuweb-scrap-use-re nil t)
|
||||
collect (make-scrap-use :name (buffer-substring (match-beginning 1)
|
||||
(match-end 1))
|
||||
:text (buffer-substring (match-beginning 0)
|
||||
(match-end 0))
|
||||
:loc (match-beginning 0)))))
|
||||
|
||||
|
||||
(defun nuweb-merge-names ( defs uses)
|
||||
"Builds a list of full names use as scrap names"
|
||||
(remove-duplicates
|
||||
(sort*
|
||||
(append
|
||||
(loop for x in defs
|
||||
when (not (string-match ".*\\.\\.\\." (scrap-def-name x)))
|
||||
collect (scrap-def-name x))
|
||||
(loop for x in uses
|
||||
when (not (string-match ".*\\.\\.\\." (scrap-use-name x)))
|
||||
collect (scrap-use-name x)))
|
||||
'string-lessp)
|
||||
:test 'equal))
|
||||
|
||||
|
||||
|
||||
(defun nuweb-canonic-name(name)
|
||||
"Returns the full name corresponding to the one given"
|
||||
(if (string-match "\\(.*\\)\\.\\.\\." name)
|
||||
(let ((prefix (substring name 0 -3)))
|
||||
;; then finds it in name list
|
||||
(find (regexp-quote prefix) nuweb-names :test 'string-match))
|
||||
name))
|
||||
|
||||
(defun nuweb-compute-d-u()
|
||||
"Recompute all the defs and uses point in the current file"
|
||||
(interactive)
|
||||
(message "Looking for defs")
|
||||
; gets defs,
|
||||
(setq nuweb-defs (nuweb-make-scrap-def-list))
|
||||
(message "Looking for uses")
|
||||
; gets uses
|
||||
(setq nuweb-uses (nuweb-make-scrap-use-list))
|
||||
;; compute list of names
|
||||
(message "Fixing names")
|
||||
(setq nuweb-names (nuweb-merge-names nuweb-defs nuweb-uses))
|
||||
;; Now change all name fields back to their canonical names
|
||||
;; in both lists
|
||||
(loop for def in nuweb-defs
|
||||
when (string-match "\\(.*\\)\\.\\.\\." (scrap-def-name def))
|
||||
do (setf (scrap-def-name def)
|
||||
(nuweb-canonic-name (scrap-def-name def))))
|
||||
(loop for use in nuweb-uses
|
||||
when (string-match "\\(.*\\)\\.\\.\\." (scrap-use-name use))
|
||||
do (setf (scrap-use-name use)
|
||||
(nuweb-canonic-name (scrap-use-name use))))
|
||||
(setq nuweb-def-use-stack nil)
|
||||
(message "Done."))
|
||||
|
||||
(defun nuweb-scrap-name-at-point()
|
||||
"Gathers the scrap name under the cursor. Returns a pair whose car
|
||||
is the scrap name found and whose cdr is either 'def or 'use"
|
||||
(interactive)
|
||||
(save-excursion
|
||||
;; God this code is not the nicest I've written...
|
||||
;; Comprenne qui pourras
|
||||
(let* ((here (point))
|
||||
(beg (if (re-search-backward "@[oOdD<]" nil t)
|
||||
(match-end 0)
|
||||
nil))
|
||||
(to-match (if beg
|
||||
(if (equal (char-after (+ (match-beginning 0) 1))
|
||||
?<)
|
||||
"@>"
|
||||
"@{")
|
||||
nil))
|
||||
(context (if (equal to-match "@{") 'def 'use))
|
||||
(end (if (search-forward to-match nil t)
|
||||
(match-beginning 0)
|
||||
nil)))
|
||||
(cond ((and beg end
|
||||
(<= beg here)
|
||||
(>= end here))
|
||||
(cons (buffer-substring
|
||||
(progn
|
||||
(goto-char beg)
|
||||
(skip-chars-forward " \t\n")
|
||||
(point))
|
||||
(progn
|
||||
(goto-char end)
|
||||
(skip-chars-backward" \t\n")
|
||||
(point)))
|
||||
context))
|
||||
(t (error "Not on a possible scrap name"))))))
|
||||
|
||||
(defun nuweb-find-next-use()
|
||||
(interactive)
|
||||
(nuweb-find-use t))
|
||||
|
||||
(defun nuweb-find-use(arg)
|
||||
"Find use of scrap name at point. With argument, find next use"
|
||||
(interactive "P")
|
||||
(if (not arg)
|
||||
(nuweb-find-use-internal
|
||||
(nuweb-canonic-name (car(nuweb-scrap-name-at-point)))
|
||||
t)
|
||||
(nuweb-find-use-internal *nuweb-prev-use* nil)))
|
||||
|
||||
(defun nuweb-find-use-internal (name first)
|
||||
(if first
|
||||
(setq *use-list*
|
||||
(remove* name nuweb-uses :test-not 'equal :key 'scrap-use-name)
|
||||
;; list of use points for scrap name at point
|
||||
*nuweb-prev-use* name))
|
||||
(if (not *use-list*)
|
||||
(error "Nor more uses for of <%s>" name)
|
||||
(push (point) nuweb-def-use-stack)
|
||||
(nuweb-position-search (scrap-use-loc (car *use-list*))
|
||||
(scrap-use-text (pop *use-list*)))))
|
||||
|
||||
|
||||
(defun nuweb-find-next-def()
|
||||
(interactive)
|
||||
(nuweb-find-def t))
|
||||
|
||||
(defun nuweb-find-def(arg)
|
||||
"Find def of scrap name at point. With argument, find next def"
|
||||
(interactive "P")
|
||||
(if (not arg)
|
||||
(nuweb-find-def-internal
|
||||
(nuweb-canonic-name (car (nuweb-scrap-name-at-point)))
|
||||
t)
|
||||
(nuweb-find-def-internal *nuweb-prev-def* nil)))
|
||||
|
||||
(defun nuweb-find-def-internal (name first)
|
||||
(if first
|
||||
(setq *def-list*
|
||||
(remove* name nuweb-defs :test-not 'equal :key 'scrap-def-name)
|
||||
;; list of def points for scrap name at point
|
||||
*nuweb-prev-def* name))
|
||||
(if (not *def-list*)
|
||||
(error "Nor more defs for <%s>" name)
|
||||
(push (point) nuweb-def-use-stack)
|
||||
(nuweb-position-search (scrap-def-loc (car *def-list*))
|
||||
(scrap-def-text (pop *def-list*)))))
|
||||
|
||||
|
||||
(defun nuweb-position-search( loc expected-text)
|
||||
(goto-char loc)
|
||||
|
||||
(let ((offset 250)
|
||||
(found (looking-at expected-text))
|
||||
up down)
|
||||
(while (and (not found)
|
||||
(not (equal up (point-min)))
|
||||
(not (equal down (point-max))))
|
||||
(setq up (max (- loc offset) (point-min)))
|
||||
(setq down (min (+ loc offset) (point-max)))
|
||||
(setq offset (* 2 offset))
|
||||
(goto-char up)
|
||||
(setq found (search-forward expected-text down t)))
|
||||
(if (not found)
|
||||
(error "Time to resynchronize defs and uses")
|
||||
(goto-char (+ 2 (match-beginning 0)))
|
||||
(recenter))))
|
||||
|
||||
|
||||
(defun nuweb-find-def-or-use(arg)
|
||||
(interactive "e")
|
||||
(mouse-set-point arg)
|
||||
(let ((scrap (nuweb-scrap-name-at-point)))
|
||||
(message "Looking for: %S" scrap)
|
||||
(cond ((eq (cdr scrap) 'def)
|
||||
(nuweb-find-use-internal (nuweb-canonic-name (car scrap)) t))
|
||||
((eq (cdr scrap) 'use)
|
||||
(nuweb-find-def-internal (nuweb-canonic-name (car scrap)) t))
|
||||
(t (error "nuweb mode: should never get here")))))
|
||||
|
||||
|
||||
(defun nuweb-pop-d-u()
|
||||
(interactive)
|
||||
(goto-char (pop nuweb-def-use-stack)))
|
||||
|
||||
;;;
|
||||
;;; Some support for use of imenu. Experimental.
|
||||
;;; Provides a menu of scrap definitions (one for files, one for
|
||||
;;; macros).
|
||||
|
||||
|
||||
(eval-when (compile )
|
||||
(require 'imenu))
|
||||
|
||||
(defvar imenu-wanted t
|
||||
"Specifies whether imenu functions are useable in nuweb mode")
|
||||
|
||||
(if imenu-wanted
|
||||
(progn
|
||||
(require 'imenu)
|
||||
(add-hook 'nuweb-mode-hook 'nuweb-imenu-setup)))
|
||||
|
||||
(defun nuweb-imenu-setup ()
|
||||
(make-local-variable 'imenu-create-index-function)
|
||||
(setq imenu-create-index-function 'nuweb-create-imenu-index)
|
||||
(local-set-key [C-M-S-mouse-1] 'imenu)
|
||||
(imenu-add-menubar-index))
|
||||
|
||||
(defvar imenu-nuweb-scrap-regexp
|
||||
"\\(@|[ \t]*\\([^@]*\\)@}\\)\\|\\(@[dDoO][ \t]*\\(.*[^ \t\n]\\)[ \t\n]*@{\\)"
|
||||
"How do we match a scrap def point or a index defining entry")
|
||||
|
||||
(defun imenu-nuweb-name-and-position-scrap()
|
||||
(if (and (match-beginning 4) (match-end 4))
|
||||
(cons (buffer-substring (match-beginning 4) (match-end 4))
|
||||
(match-beginning 0))
|
||||
nil))
|
||||
|
||||
;;; The symbol information is not used as is...
|
||||
(defun imenu-nuweb-name-and-position-symbol()
|
||||
(if (and (match-beginning 2) (match-end 2))
|
||||
(cons (buffer-substring (match-beginning 2) (match-end 2))
|
||||
(match-beginning 0))
|
||||
nil))
|
||||
(defmacro imenu-create-submenu-name(name) name)
|
||||
(defun nuweb-create-imenu-index(&optional regexp)
|
||||
(let ((index-macros-alist '())
|
||||
(index-files-alist '())
|
||||
(index-symbols-alist '())
|
||||
(char))
|
||||
(goto-char (point-min))
|
||||
;; (imenu-progress-message 0)
|
||||
;; Search for the function
|
||||
(save-match-data
|
||||
(while (re-search-forward
|
||||
(or regexp imenu-nuweb-scrap-regexp)
|
||||
nil t)
|
||||
;; (imenu-progress-message)
|
||||
(let ((scrap-name-pos (imenu-nuweb-name-and-position-scrap))
|
||||
(symbol-name-pos (imenu-nuweb-name-and-position-symbol)))
|
||||
(save-excursion
|
||||
(goto-char (match-beginning 0))
|
||||
(cond ((looking-at "@[oO]")
|
||||
(push scrap-name-pos index-files-alist))
|
||||
( (looking-at "@|")
|
||||
(if (looking-at "@|[ \t]*@}")
|
||||
t ; do nothing
|
||||
(forward-char 2)
|
||||
(let ((pos (point))
|
||||
(ref-pos (cdr symbol-name-pos)))
|
||||
(while (not (looking-at "[\t\n ]*@}"))
|
||||
(if (re-search-forward "[\t\n ]*\\([^@ \t\n]+\\)"
|
||||
nil t)
|
||||
(push (cons (buffer-substring
|
||||
(match-beginning 1)
|
||||
(match-end 1))
|
||||
ref-pos)
|
||||
index-symbols-alist))))))
|
||||
(t (push scrap-name-pos index-macros-alist)))))))
|
||||
;; (imenu-progress-message 100)
|
||||
(list
|
||||
;; the list of symbols is sorted as it is easier to search in an
|
||||
;; alpha sorted list
|
||||
(cons (imenu-create-submenu-name "Symbols")
|
||||
(sort (nreverse index-symbols-alist)
|
||||
(function(lambda(pair1 pair2)
|
||||
(string< (car pair1) (car pair2))))))
|
||||
;; the scrap and file def point are left in their order of
|
||||
;; appearance in the file.
|
||||
(cons (imenu-create-submenu-name "Macros")
|
||||
(nreverse index-macros-alist))
|
||||
(cons (imenu-create-submenu-name "Files")
|
||||
(nreverse index-files-alist)))))
|
||||
|
||||
(provide 'nuweb)
|
||||
;;; nuweb.el ends here
|
822
nuwebdoc.tex
Normal file
822
nuwebdoc.tex
Normal file
@@ -0,0 +1,822 @@
|
||||
\newcommand{\NWtarget}[2]{\hypertarget{#1}{#2}}
|
||||
\newcommand{\NWlink}[2]{\hyperlink{#1}{#2}}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
%
|
||||
% Copyright (c) 1996, Preston Briggs
|
||||
% All rights reserved.
|
||||
%
|
||||
% Redistribution and use in source and binary forms, with or without
|
||||
% modification, are permitted provided that the following conditions
|
||||
% are met:
|
||||
%
|
||||
% Redistributions of source code must retain the above copyright notice,
|
||||
% this list of conditions and the following disclaimer.
|
||||
%
|
||||
% Redistributions in binary form must reproduce the above copyright notice,
|
||||
% this list of conditions and the following disclaimer in the documentation
|
||||
% and/or other materials provided with the distribution.
|
||||
%
|
||||
% Neither name of the product nor the names of its contributors may
|
||||
% be used to endorse or promote products derived from this software without
|
||||
% specific prior written permission.
|
||||
%
|
||||
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
% ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
% LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
% FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS
|
||||
% OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
% EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
% PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
% PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
% OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
% SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
%
|
||||
|
||||
% Notes:
|
||||
% Update on 2011-12-16 from Keith Harwood.
|
||||
% -- @s in scrap supresses indent of following fragment expansion
|
||||
% -- @<Name@> in text is expanded
|
||||
% Update on 2011-04-20 from Keith Harwood.
|
||||
% -- @t provide fragment title in output
|
||||
% Changes from 2010-03-11 in the Sourceforge revision history. -- sjw
|
||||
% Updates on 2004-02-23 from Gregor Goldbach
|
||||
% <glauschwuffel@users.sourceforge.net>
|
||||
% -- new command line option -r which will make nuweb typeset each
|
||||
% NWtarget and NWlink instance with \LaTeX-commands from the hyperref
|
||||
% package. This gives clickable scrap numbers which is very useful
|
||||
% when viewing the document on-line.
|
||||
|
||||
% Updates on 2004-02-13 from Gregor Goldbach
|
||||
% <glauschwuffel@users.sourceforge.net>
|
||||
% -- new command line option -l which will make nuweb typeset scraps
|
||||
% with the help of LaTeX's listings packages instead or pure
|
||||
% verbatim.
|
||||
% -- man page corrections and additions.
|
||||
|
||||
% Updates on 2003-04-24 from Keith Harwood <Keith.Harwood@vitalmis.com>
|
||||
% -- sectioning commands (@s and global-plus-sign in scrap names)
|
||||
% -- @x..@x labelling
|
||||
% -- @f current file
|
||||
% -- @\# suppress indent
|
||||
|
||||
% This file has been changed by Javier Goizueta <jgoizueta@jazzfree.es>
|
||||
% on 2001-02-15.
|
||||
% These are the changes:
|
||||
% LANG -- Introduction of \NW macros to substitue language dependent text
|
||||
% DIAM -- Introduction of \NWsep instead of the \diamond separator
|
||||
% HYPER -- Introduction of hyper-references
|
||||
% NAME -- LaTeX formatting of macro names in HTML output
|
||||
% ADJ -- Adjust of the spacing between < and a fragment name
|
||||
% TEMPN -- Fix of the use of tempnam
|
||||
% LINE -- Synchronizing #lines when @% is used
|
||||
% MAC -- definition of the macros used by LANG,DIAM,HYPER
|
||||
% CHAR -- Introduce @r to change the nuweb meta character (@)
|
||||
% TIE -- Replacement of ~ by "\nobreak\ "
|
||||
% SCRAPs-- Elimination of s
|
||||
% DNGL -- Correction: option -d was not working and was misdocumented
|
||||
% --after the CHAR modifications, to be able to specify non-ascii characters
|
||||
% for the scape character, the program must be compiled with the -K
|
||||
% option in Borland compilers or the -funsigned-char in GNU's gcc
|
||||
% to treat char as an unsigned value when converted to int.
|
||||
% To make the program independent of those options, either char
|
||||
% should be changed to unsigned char (bad solution, since unsigned
|
||||
% char should be used for numerical purposes) or attention should
|
||||
% be payed to all char-int conversions. (including comparisons)
|
||||
|
||||
% --2002-01-15: the TILDE modificiation is necessary because some ties
|
||||
% have been introduced in version 0.93 in troublesome places when
|
||||
% the babel package is used with the spanish.ldf option (which makes
|
||||
% ~ an active character).
|
||||
|
||||
% --2002-01-15: an ``s'' was being added to the NWtxtDefBy and
|
||||
% NWtxtDefBy messages when followed by more than one reference.
|
||||
|
||||
\documentclass[a4paper]{report}
|
||||
\newif\ifshowcode
|
||||
\showcodetrue
|
||||
|
||||
\usepackage{latexsym}
|
||||
%\usepackage{html}
|
||||
|
||||
\usepackage{listings}
|
||||
|
||||
\usepackage{color}
|
||||
\definecolor{linkcolor}{rgb}{0, 0, 0.7}
|
||||
|
||||
\usepackage[%
|
||||
backref,%
|
||||
raiselinks,%
|
||||
pdfhighlight=/O,%
|
||||
pagebackref,%
|
||||
hyperfigures,%
|
||||
breaklinks,%
|
||||
colorlinks,%
|
||||
pdfpagemode=None,%
|
||||
pdfstartview=FitBH,%
|
||||
linkcolor={linkcolor},%
|
||||
anchorcolor={linkcolor},%
|
||||
citecolor={linkcolor},%
|
||||
filecolor={linkcolor},%
|
||||
menucolor={linkcolor},%
|
||||
pagecolor={linkcolor},%
|
||||
urlcolor={linkcolor}%
|
||||
]{hyperref}
|
||||
|
||||
\setlength{\oddsidemargin}{0in}
|
||||
\setlength{\evensidemargin}{0in}
|
||||
\setlength{\topmargin}{0in}
|
||||
\addtolength{\topmargin}{-\headheight}
|
||||
\addtolength{\topmargin}{-\headsep}
|
||||
\setlength{\textheight}{8.9in}
|
||||
\setlength{\textwidth}{6.5in}
|
||||
\setlength{\marginparwidth}{0.5in}
|
||||
|
||||
\title{Nuweb Version 1.62 \\ A Simple Literate Programming Tool}
|
||||
\date{}
|
||||
\author{Preston Briggs\thanks{This work has been supported by ARPA,
|
||||
through ONR grant N00014-91-J-1989.}
|
||||
\\ {\sl preston@tera.com}
|
||||
\\ HTML scrap generator by John D. Ramsdell
|
||||
\\ {\sl ramsdell@mitre.org}
|
||||
\\ Scrap formatting by Marc W. Mengel
|
||||
\\ {\sl mengel@fnal.gov}
|
||||
\\ Continuing maintenance by Simon Wright
|
||||
\\ {\sl simon@pushface.org}
|
||||
\\ and Keith Harwood
|
||||
\\ {\sl Keith.Harwood@vitalmis.com}}
|
||||
|
||||
\begin{document}
|
||||
\pagenumbering{roman}
|
||||
\maketitle
|
||||
\tableofcontents
|
||||
|
||||
\chapter{Introduction}
|
||||
\pagenumbering{arabic}
|
||||
|
||||
In 1984, Knuth introduced the idea of {\em literate programming\/} and
|
||||
described a pair of tools to support the practise~\cite{Knuth:CJ-27-2-97}.
|
||||
His approach was to combine Pascal code with \TeX\ documentation to
|
||||
produce a new language, \verb|WEB|, that offered programmers a superior
|
||||
approach to programming. He wrote several programs in \verb|WEB|,
|
||||
including \verb|weave| and \verb|tangle|, the programs used to support
|
||||
literate programming.
|
||||
The idea was that a programmer wrote one document, the web file, that
|
||||
combined documentation (written in \TeX~\cite{Knuth:ct-a}) with code
|
||||
(written in Pascal).
|
||||
|
||||
Running \verb|tangle| on the web file would produce a complete
|
||||
Pascal program, ready for compilation by an ordinary Pascal compiler.
|
||||
The primary function of \verb|tangle| is to allow the programmer to
|
||||
present elements of the program in any desired order, regardless of
|
||||
the restrictions imposed by the programming language. Thus, the
|
||||
programmer is free to present his program in a top-down fashion,
|
||||
bottom-up fashion, or whatever seems best in terms of promoting
|
||||
understanding and maintenance.
|
||||
|
||||
Running \verb|weave| on the web file would produce a \TeX\ file, ready
|
||||
to be processed by \TeX\@. The resulting document included a variety of
|
||||
automatically generated indices and cross-references that made it much
|
||||
easier to navigate the code. Additionally, all of the code sections
|
||||
were automatically prettyprinted, resulting in a quite impressive
|
||||
document.
|
||||
|
||||
Knuth also wrote the programs for \TeX\ and {\small\sf METAFONT}
|
||||
entirely in \verb|WEB|, eventually publishing them in book
|
||||
form~\cite{Knuth:ct-b,Knuth:ct-d}. These are probably the
|
||||
largest programs ever published in a readable form.
|
||||
|
||||
Inspired by Knuth's example, many people have experimented with
|
||||
\verb|WEB|\@. Some people have even built web-like tools for their
|
||||
own favorite combinations of programming language and typesetting
|
||||
language. For example, \verb|CWEB|, Knuth's current system of choice,
|
||||
works with a combination of C (or C++) and \TeX~\cite{Levy:TB8-1-12}.
|
||||
Another system, FunnelWeb, is independent of any programming language
|
||||
and only mildly dependent on \TeX~\cite{Williams:FUM92}. Inspired by the
|
||||
versatility of FunnelWeb and by the daunting size of its
|
||||
documentation, I decided to write my own, very simple, tool for
|
||||
literate programming.%
|
||||
\footnote{There is another system similar to
|
||||
mine, written by Norman Ramsey, called {\em noweb}~\cite{Ramsey:LPT92}. It
|
||||
perhaps suffers from being overly Unix-dependent and requiring several
|
||||
programs to use. On the other hand, its command syntax is very nice.
|
||||
In any case, nuweb certainly owes its name and a number of features to
|
||||
his inspiration.}
|
||||
|
||||
|
||||
\section{Nuweb}
|
||||
|
||||
Nuweb works with any programming language and \LaTeX~\cite{Lamport:LDP85}. I
|
||||
wanted to use \LaTeX\ because it supports a multi-level sectioning
|
||||
scheme and has facilities for drawing figures. I wanted to be able to
|
||||
work with arbitrary programming languages because my friends and I
|
||||
write programs in many languages (and sometimes combinations of
|
||||
several languages), {\em e.g.,} C, Fortran, C++, yacc, lex, Scheme,
|
||||
assembly, Postscript, and so forth. The need to support arbitrary
|
||||
programming languages has many consequences:
|
||||
\begin{description}
|
||||
\item[No prettyprinting] Both \verb|WEB| and \verb|CWEB| are able to
|
||||
prettyprint the code sections of their documents because they
|
||||
understand the language well enough to parse it. Since we want to use
|
||||
{\em any\/} language, we've got to abandon this feature.
|
||||
However, we do allow particular individual formulas or fragments
|
||||
of \LaTeX\ code to be formatted and still be parts of output files.
|
||||
Also, keywords in scraps can be surrounded by \verb|@_| to
|
||||
have them be bold in the output.
|
||||
\item[No index of identifiers] Because \verb|WEB| knows about Pascal,
|
||||
it is able to construct an index of all the identifiers occurring in
|
||||
the code sections (filtering out keywords and the standard type
|
||||
identifiers). Unfortunately, this isn't as easy in our case. We don't
|
||||
know what an identifier looks like in each language and we certainly
|
||||
don't know all the keywords. (On the other hand, see the end of
|
||||
Section~\ref{minorcommands})
|
||||
\end{description}
|
||||
Of course, we've got to have some compensation for our losses or the
|
||||
whole idea would be a waste. Here are the advantages I can see:
|
||||
\begin{description}
|
||||
\item[Simplicity] The majority of the commands in \verb|WEB| are
|
||||
concerned with control of the automatic prettyprinting. Since we
|
||||
don't prettyprint, many commands are eliminated. A further set of
|
||||
commands is subsumed by \LaTeX\ and may also be eliminated. As a
|
||||
result, our set of commands is reduced to only four members (explained
|
||||
in the next section). This simplicity is also reflected in
|
||||
the size of this tool, which is quite a bit smaller than the tools
|
||||
used with other approaches.
|
||||
\item[No prettyprinting] Everyone disagrees about how their code
|
||||
should look, so automatic formatting annoys many people. One approach
|
||||
is to provide ways to control the formatting. Our approach is
|
||||
simpler---we perform no automatic formatting and therefore allow the
|
||||
programmer complete control of code layout.
|
||||
We do allow individual scraps to be presented in either verbatim,
|
||||
math, or paragraph mode in the \TeX\ output.
|
||||
\item[Control] We also offer the programmer complete control of the
|
||||
layout of his output files (the files generated during tangling). Of
|
||||
course, this is essential for languages that are sensitive to layout;
|
||||
but it is also important in many practical situations, {\em e.g.,}
|
||||
debugging.
|
||||
\item[Speed] Since nuweb doesn't do too much, the nuweb tool runs
|
||||
quickly. I combine the functions of \verb|tangle| and \verb|weave| into
|
||||
a single program that performs both functions at once.
|
||||
\item[Page numbers] Inspired by the example of noweb, nuweb refers to
|
||||
all scraps by page number to simplify navigation. If there are
|
||||
multiple scraps on a page (say, page~17), they are distinguished by
|
||||
lower-case letters ({\em e.g.,} 17a, 17b, and so forth).
|
||||
\item[Multiple file output] The programmer may specify more than one
|
||||
output file in a single nuweb file. This is required when constructing
|
||||
programs in a combination of languages (say, Fortran and C)\@. It's also
|
||||
an advantage when constructing very large programs that would require
|
||||
a lot of compile time.
|
||||
\end{description}
|
||||
This last point is very important. By allowing the creation of
|
||||
multiple output files, we avoid the need for monolithic programs.
|
||||
Thus we support the creation of very large programs by groups of
|
||||
people.
|
||||
|
||||
A further reduction in compilation time is achieved by first
|
||||
writing each output file to a temporary location, then comparing the
|
||||
temporary file with the old version of the file. If there is no
|
||||
difference, the temporary file can be deleted. If the files differ,
|
||||
the old version is deleted and the temporary file renamed. This
|
||||
approach works well in combination with \verb|make| (or similar tools),
|
||||
since \verb|make| will avoid recompiling untouched output files.
|
||||
|
||||
\subsection{Nuweb and HTML}
|
||||
|
||||
In addition to producing {\LaTeX} source, nuweb can be used to
|
||||
generate HyperText Markup Language (HTML), the markup language used by
|
||||
the World Wide Web. HTML provides hypertext links. When an HTML
|
||||
document is viewed online, a user can navigate within the document by
|
||||
activating the links. The tools which generate HTML automatically
|
||||
produce hypertext links from a nuweb source.
|
||||
|
||||
(Note that hyperlinks can be included in \LaTeX\ using the
|
||||
\verb|hyperref| package. This is now the preferred way of doing
|
||||
this and the HTML processing is not up to date.)
|
||||
|
||||
\section{Writing Nuweb}
|
||||
|
||||
The bulk of a nuweb file will be ordinary \LaTeX\@. In fact, any
|
||||
{\LaTeX} file can serve as input to nuweb and will be simply copied
|
||||
through, unchanged, to the documentation file---unless a nuweb command
|
||||
is discovered. All nuweb commands begin with an ``at-sign''
|
||||
(\verb|@|). Therefore, a file without at-signs will be copied
|
||||
unchanged. Nuweb commands are used to specify {\em output files,}
|
||||
define {\em fragments,} and delimit {\em scraps}. These are the basic
|
||||
features of interest to the nuweb tool---all else is simply text to be
|
||||
copied to the documentation file.
|
||||
|
||||
\subsection{The Major Commands}
|
||||
|
||||
Files and fragments are defined with the following commands:
|
||||
\begin{description}
|
||||
\item[{\tt @o} {\em file-name flags scrap\/}] Output a file. The file
|
||||
name is terminated by whitespace.
|
||||
\item[{\tt @d} {\em fragment-name scrap\/}] Define a fragment. The
|
||||
fragment name is terminated by a return or the beginning of a scrap.
|
||||
\item[{\tt @q} {\em fragment-name scrap\/}] Define a fragment. The
|
||||
fragment name is terminated by a return or the beginning of a scrap.
|
||||
This a quoted fragment.
|
||||
\end{description}
|
||||
A specific file may be specified several times, with each definition
|
||||
being written out, one after the other, in the order they appear.
|
||||
The definitions of fragments may be similarly specified piecemeal.
|
||||
|
||||
A fragment name may have embedded parameters. The parameters are
|
||||
denoted by the sequence \texttt{@'value@'} where \texttt{value} is
|
||||
an uninterpreted string of characters (although the sequence
|
||||
\texttt{@@} denotes a single \texttt{@} character). When a fragment
|
||||
name is used inside a scrap the parameters may be replaced by an
|
||||
argument which may be a different literal string, a fragment use, an
|
||||
embedded fragment or by a parameter use.
|
||||
|
||||
The difference between a quoted fragment (\texttt{@q}) and an
|
||||
ordinary one (\texttt{@d}) is that inside a quoted fragment fragments
|
||||
are not expanded on output. Rather, they are formatted as uses of
|
||||
fragments so that the output file can itself be \texttt{nuweb}
|
||||
source. This allows you to create files containing fragments which can
|
||||
undergo further processing before the fragments are expanded, while
|
||||
also describing and documenting them in one place.
|
||||
|
||||
You can have both quoted and unquoted fragments with the same
|
||||
name. They are written out in order as usual, with those introduced by
|
||||
\texttt{@q} being quoted and those with \texttt{@d} expanded as
|
||||
normal.
|
||||
|
||||
In quoted fragments, the \texttt{@f} filename is quoted as well, so that
|
||||
when it is expanded it refers to the finally produced file, not
|
||||
any of the intermediate ones.
|
||||
|
||||
\subsubsection{Scraps}
|
||||
|
||||
Scraps have specific begin markers and end markers to allow precise
|
||||
control over the contents and layout. Note that any amount of
|
||||
whitespace (including carriage returns) may appear between a name and
|
||||
the beginning of a scrap. Scraps may also appear in the running text
|
||||
where they are formatted (almost) identically to their use in definitions,
|
||||
but don't appear in any code output.
|
||||
\begin{description}
|
||||
\item[\tt @\{{\em anything\/}@\}] where the scrap body includes every
|
||||
character in {\em anything\/}---all the blanks, all the tabs, all the
|
||||
carriage returns. This scrap will be typeset in verbatim mode. Using
|
||||
the \texttt{-l} option will cause the program to typeset the scrap with
|
||||
the help of \LaTeX's \texttt{listings} package.
|
||||
\item[\tt @[{\em anything\/}@]] where the scrap body includes every
|
||||
character in {\em anything\/}---all the blanks, all the tabs, all the
|
||||
carriage returns. This scrap will be typeset in paragraph mode, allowing
|
||||
sections of \TeX\ documents to be scraps, but still be prettyprinted
|
||||
in the document.
|
||||
\item[\tt @({\em anything\/}@)] where the scrap body includes every
|
||||
character in {\em anything\/}---all the blanks, all the tabs, all the
|
||||
carriage returns. This scrap will be typeset in math mode. This allows
|
||||
this scrap to contain a formula which will be typeset nicely.
|
||||
\end{description}
|
||||
Inside a scrap, we may invoke a fragment.
|
||||
\begin{description}
|
||||
\item[\tt @<{\em fragment-name\/}@>]
|
||||
This is a fragment use. It causes the fragment
|
||||
{\em fragment-name\/} to be expanded inline as the code is written out
|
||||
to a file. It is an error to specify recursive fragment invocations.
|
||||
\item[\tt @<{\em fragment-name\/}@( {\em a1} @, {\em a2} @) @>] This
|
||||
is the old form of parameterising a fragment. It causes the fragment
|
||||
{\em fragment-name\/} to be expanded inline with the arguments {\em a1},
|
||||
{\em a2}, etc. Up to 9 arguments may be given.
|
||||
\item[\tt @1, @2, ..., @9] In a fragment causes the n'th fragment
|
||||
argument to be substituted into the scrap. If the argument
|
||||
is not passed, a null string is substituted.
|
||||
Arguments can be passed in two ways, either embedded in the
|
||||
fragment
|
||||
name or as the old form given above.
|
||||
|
||||
An embedded argument may specified in four ways.
|
||||
\begin{description}
|
||||
\item[\tt @'string@']
|
||||
The string will be copied literally into the called fragment.
|
||||
It will not be interpreted (except for \texttt{@@} converted
|
||||
to \texttt{@}).
|
||||
\item[\tt @<{\em fragment-name\/}@>]
|
||||
The fragment will be expanded in the usual fashion and the results
|
||||
passed to the called fragment.
|
||||
\item[\tt @\{text@\}]
|
||||
The text will be expanded as normal and the results passed to
|
||||
the called fragment. This behaves like an anonymous fragment which has
|
||||
the same arguments as the calling fragment. Its principle use is
|
||||
to combine text and arguments into one argument.
|
||||
\item[\tt @1, @2, ..., @9]
|
||||
The argument of the calling fragment will be passed to the called
|
||||
fragment and expanded in there.
|
||||
\end{description}
|
||||
|
||||
If an argument is used but there is no corresponding parameter
|
||||
in the fragment name, the null string is substituted. But what
|
||||
happens if there is a parameter in the full name of a fragment,
|
||||
but a particular application of the fragment is abbreviated
|
||||
(using the \verb|. . .| notation) and the argument is missed? In
|
||||
that case the argument is replaced by the string given in the
|
||||
definition of the fragment.
|
||||
|
||||
In the old form the parameter may contain any text and will be
|
||||
expanded as a normal scrap. The two forms of parameter passing
|
||||
don't play nicely together. If a scrap passes both embedded and
|
||||
old form arguments the old form arguments are ignored.
|
||||
\item[\tt @x{\em label}@x] Marks a place inside a scrap and
|
||||
associates it to the label (which can be any text not containing
|
||||
a @). Expands to the reference number of the scrap followed by a
|
||||
numeric value. Outside scraps it expands to the same value. It is
|
||||
used so that text outside scraps can refer to particular places
|
||||
within scraps.
|
||||
\item[\tt @f] Inside a scrap this is replaced by the name of the
|
||||
current output file.
|
||||
\item[\tt @t] Inside a scrap this is replaced by the title of the
|
||||
fragment as it is at the point it is used, with all parameters
|
||||
replaced by actual arguments.
|
||||
\item[\tt @\#] At the beginning of a line in a scrap this will
|
||||
suppress the normal indentation for that line. Use this, for
|
||||
example, when you have a \verb|#ifdef| inside a nested scrap.
|
||||
Writing \verb|@##ifdef| will cause it to be lined up on the left
|
||||
rather than indented with the rest of its code.
|
||||
\item[\tt @s] Inside a scrap supresses indentation for the following
|
||||
fragment expansion.
|
||||
\end{description}
|
||||
Note that fragment names may be abbreviated, either during invocation or
|
||||
definition. For example, it would be very tedious to have to
|
||||
type, repeatedly, the fragment name
|
||||
\begin{quote}
|
||||
\verb|@d Check for terminating at-sequence and return name if found|
|
||||
\end{quote}
|
||||
Therefore, we provide a mechanism (stolen from Knuth) of indicating
|
||||
abbreviated names.
|
||||
\begin{quote}
|
||||
\verb|@d Check for terminating...|
|
||||
\end{quote}
|
||||
Basically, the programmer need only type enough characters to
|
||||
identify the fragment name uniquely, followed by three periods. An abbreviation
|
||||
may even occur before the full version; nuweb simply preserves the
|
||||
longest version of a fragment name. Note also that blanks and tabs are
|
||||
insignificant within a fragment name; each string of them is replaced by a
|
||||
single blank.
|
||||
|
||||
Sometimes, for instance during program testing, it is convenient to comment
|
||||
out a few lines of code. In C or Fortran placing \verb|/* ... */| around the relevant
|
||||
code is not a robust solution, as the code itself may contain
|
||||
comments. Nuweb provides the command
|
||||
\begin{quote}
|
||||
\verb|@%|
|
||||
\end{quote}only to be used inside scraps. It behaves exactly the same
|
||||
as \verb|%| in the normal {\LaTeX} text body.
|
||||
|
||||
When scraps are written to a program file or a documentation file, tabs are
|
||||
expanded into spaces by default. Currently, I assume tab stops are set
|
||||
every eight characters. Furthermore, when a fragment is expanded in a scrap,
|
||||
the body of the fragment is indented to match the indentation of the
|
||||
fragment invocation. Therefore, care must be taken with languages
|
||||
({\em e.g.,} Fortran) that are sensitive to indentation.
|
||||
These default behaviors may be changed for each output file (see
|
||||
below).
|
||||
|
||||
\subsubsection{Flags}
|
||||
|
||||
When defining an output file, the programmer has the option of using
|
||||
flags to control output of a particular file. The flags are intended
|
||||
to make life a little easier for programmers using certain languages.
|
||||
They introduce little language dependences; however, they do so only
|
||||
for a particular file. Thus it is still easy to mix languages within a
|
||||
single document. There are four ``per-file'' flags:
|
||||
\begin{description}
|
||||
\item[\tt -d] Forces the creation of \verb|#line| directives in the
|
||||
output file. These are useful with C (and sometimes C++ and Fortran) on
|
||||
many Unix systems since they cause the compiler's error messages to
|
||||
refer to the web file rather than to the output file. Similarly, they
|
||||
allow source debugging in terms of the web file.
|
||||
\item[\tt -i] Suppresses the indentation of fragments. That is, when a
|
||||
fragment is expanded within a scrap, it will {\em not\/} be indented to
|
||||
match the indentation of the fragment invocation. This flag would seem
|
||||
most useful for Fortran programmers.
|
||||
\item[\tt -t] Suppresses expansion of tabs in the output file. This
|
||||
feature seems important when generating \verb|make| files.
|
||||
\item[\tt -c{\it x}] Puts comments in generated code documenting the
|
||||
fragment that generated that code. The {\it x} selects the comment style
|
||||
for the language in use. So far the only valid values are \verb|c| to get
|
||||
\verb|C| comment style, \verb|+| for \verb|C++| and \verb|p| for
|
||||
\verb|Perl|. (\verb|Perl| commenting can be used for several languages
|
||||
including \verb|sh| and, mostly, \verb|tcl|.)
|
||||
If the global \verb|-x| cross-reference flag is
|
||||
set the comment includes the page reference for the first scrap that
|
||||
generated the code.
|
||||
\end{description}
|
||||
|
||||
|
||||
\subsection{The Minor Commands\label{minorcommands}}
|
||||
|
||||
We have some very low-level utility commands that may appear anywhere
|
||||
in the web file.
|
||||
\begin{description}
|
||||
\item[\tt @@] Causes a single ``at sign'' to be copied into the output.
|
||||
\item[\tt @\_] Causes the text between it and the next {\tt @\_}
|
||||
to be made bold (for keywords, etc.)
|
||||
\item[\tt @i {\em file-name\/}] Includes a file. Includes may be
|
||||
nested, though there is currently a limit of 10~levels. The file name
|
||||
should be complete (no extension will be appended) and should be
|
||||
terminated by a carriage return. Normally the current directory is
|
||||
searched for the file to be included, but this can be varied using
|
||||
the \verb|-I| flag on the command line. Each such flag adds one
|
||||
directory tothe search path and they are searched in the order
|
||||
given.
|
||||
\item[{\tt @r}$x$] Changes the escape character `@' to `$x$'.
|
||||
This must appear before any scrap definitions.
|
||||
\item[\tt @v] Always replaced by the string established by
|
||||
the \texttt{-V} flag, or a default string if the flag isn't
|
||||
given. This is intended to mark versions of the generated
|
||||
files.
|
||||
\end{description}
|
||||
|
||||
In the text of the document, that is outside scraps, you may include
|
||||
scrap-like material.
|
||||
|
||||
\begin{description}
|
||||
\item[\tt @\{\textit{Anything}@\}]
|
||||
The included material, the \textit{Anything},
|
||||
is typeset as if it appeared inside a scrap. This is useful for
|
||||
referring to fragments in the text and for
|
||||
describing the literate programming process itself.
|
||||
\item[\tt @<\textit{Fragment name}@>]
|
||||
The fragment named is expanded in place in the text.
|
||||
The expansion is presented verbatim, it is not interpretted for
|
||||
typesetting, so any special environment must be set up before and
|
||||
after this is used.
|
||||
\end{description}
|
||||
|
||||
Finally, there are three commands used to create indices to the
|
||||
fragment
|
||||
names, file definitions, and user-specified identifiers.
|
||||
\begin{description}
|
||||
\item[\tt @f] Create an index of file names.
|
||||
\item[\tt @m] Create an index of fragment names.
|
||||
\item[\tt @u] Create an index of user-specified identifiers.
|
||||
\end{description}
|
||||
I usually put these in their own section
|
||||
in the \LaTeX\ document; for example, see Chapter~\ref{indices}.
|
||||
|
||||
Identifiers must be explicitly specified for inclusion in the
|
||||
\verb|@u| index. By convention, each identifier is marked at the
|
||||
point of its definition; all references to each identifier (inside
|
||||
scraps) will be discovered automatically. To ``mark'' an identifier
|
||||
for inclusion in the index, we must mention it at the end of a scrap.
|
||||
For example,
|
||||
\begin{quote}
|
||||
\begin{verbatim}
|
||||
@d a scrap @{
|
||||
Let's pretend we're declaring the variables FOO and BAR
|
||||
inside this scrap.
|
||||
@| FOO BAR @}
|
||||
\end{verbatim}
|
||||
\end{quote}
|
||||
I've used alphabetic identifiers in this example, but any string of
|
||||
characters (not including whitespace or \verb|@| characters) will do.
|
||||
Therefore, it's possible to add index entries for things like
|
||||
\verb|<<=| if desired. An identifier may be declared in more than one
|
||||
scrap.
|
||||
|
||||
In the generated index, each identifier appears with a list of all the
|
||||
scraps using and defining it, where the defining scraps are
|
||||
distinguished by underlining. Note that the identifier doesn't
|
||||
actually have to appear in the defining scrap; it just has to be in
|
||||
the list of definitions at the end of a scrap.
|
||||
|
||||
\section{Sectioning commands}
|
||||
For larger documents the indexes and usage lists get rather
|
||||
unwieldy and problems arise in naming things so that different
|
||||
things in different parts of the document don't get confused. We
|
||||
have a sectioning command which keeps the fragment names and user
|
||||
identifiers separate. Thus, you can give a fragment in one section
|
||||
the same name as a fragment in another and the two won't be confused
|
||||
or connected in any way. Nor will user identifiers
|
||||
defined in one section be referenced in another. Except for the
|
||||
fact that scraps in successive sections can go into the same
|
||||
output file, this is the same as if the sections came from
|
||||
separate input files.
|
||||
|
||||
However, occasionally you may really want fragments from one section
|
||||
to be used in another. More often, you will want to identify a
|
||||
user identifier in one section with the same identifier in
|
||||
another (as, for example, a header file defined in one section is
|
||||
included in code in another). Extra commands allow a fragment
|
||||
defined in one section to be accessible from all other sections.
|
||||
Similarly, you can have scraps which define user identifiers and
|
||||
export them so that they can be used in other sections.
|
||||
|
||||
\begin{description}
|
||||
\item[{\tt @s}] Start a new section.
|
||||
\item[{\tt @S}] Close the current section and don't start another.
|
||||
\item[{\tt @d+} fragment-name scrap] Define a fragment which is
|
||||
accessible in all sections, a global fragment.
|
||||
\item[{\tt @D+}] Likewise
|
||||
\item[{\tt @q+}] Likewise
|
||||
\item[{\tt @Q+}] Likewise
|
||||
\item[{\tt @m+}] Create an index of all such fragments.
|
||||
\item[{\tt @u+}] Create an index of globally accessible
|
||||
user identifiers.
|
||||
\end{description}
|
||||
|
||||
There are two kinds of section, the base section which is where
|
||||
normally everything goes, and local sections which are introduced with
|
||||
the {\tt @s} command. A local section comprises everything from the
|
||||
command which starts it to the one which ends it. A {\tt @s} command
|
||||
will start a new local section. A {\tt @S} command closes the current
|
||||
local section, but doesn't open another, so what follows goes into the
|
||||
base section. Note that fragments defined in the base section aren't
|
||||
global; they are accessible only in the base section, but they are
|
||||
accessible regardless of any local sections between their definition
|
||||
and their use.
|
||||
|
||||
Within a scrap:
|
||||
\begin{description}
|
||||
\item[\tt @<+{\em fragment-name\/}@>]
|
||||
Expand the globally accessible fragment with that name, rather than
|
||||
any local fragment.
|
||||
\item[{\tt @+}] Like \verb"@|" except that the identifiers
|
||||
defined are exported to the global realm and are not directly
|
||||
referenced in any scrap in any section (not even the one where
|
||||
they are defined).
|
||||
\item[{\tt @-}] Like \verb"@|" except that the identifiers
|
||||
are imported to the local realm. The cross-references show where
|
||||
the global variables are defined and defines the same names as
|
||||
locally accesible. Uses of the names within the section will
|
||||
point to this scrap.
|
||||
\end{description}
|
||||
|
||||
Note that the \verb"+" signs above are part of the commands. They
|
||||
are not part of the fragment names. If you want a fragment whose name
|
||||
begins with a plus sign, leave a space between the command and the
|
||||
name.
|
||||
|
||||
\section{Running Nuweb}
|
||||
|
||||
Nuweb is invoked using the following command:
|
||||
\begin{quote}
|
||||
{\tt nuweb} {\em flags file-name}\ldots
|
||||
\end{quote}
|
||||
One or more files may be processed at a time. If a file name has no
|
||||
extension, \verb|.w| will be appended. {\LaTeX} suitable for
|
||||
translation into HTML by {\LaTeX}2HTML will be produced from
|
||||
files whose name ends with \verb|.hw|, otherwise, ordinary {\LaTeX} will be
|
||||
produced. While a file name may specify a file in another directory,
|
||||
the resulting documentation file will always be created in the current
|
||||
directory. For example,
|
||||
\begin{quote}
|
||||
{\tt nuweb /foo/bar/quux}
|
||||
\end{quote}
|
||||
will take as input the file \verb|/foo/bar/quux.w| and will create the
|
||||
file \verb|quux.tex| in the current directory.
|
||||
|
||||
By default, nuweb performs both tangling and weaving at the same time.
|
||||
Normally, this is not a bottleneck in the compilation process;
|
||||
however, it's possible to achieve slightly faster throughput by
|
||||
avoiding one or another of the default functions using command-line
|
||||
flags. There are currently three possible flags:
|
||||
\begin{description}
|
||||
\item[\tt -t] Suppress generation of the documentation file.
|
||||
\item[\tt -o] Suppress generation of the output files.
|
||||
\item[\tt -c] Avoid testing output files for change before updating them.
|
||||
\end{description}
|
||||
Thus, the command
|
||||
\begin{quote}
|
||||
\verb|nuweb -to /foo/bar/quux|
|
||||
\end{quote}
|
||||
would simply scan the input and produce no output at all.
|
||||
|
||||
There are several additional command-line flags:
|
||||
\begin{description}
|
||||
\item[\tt -v] For ``verbose'', causes nuweb to write information about
|
||||
its progress to \verb|stderr|.
|
||||
\item[\tt -n] Forces scraps to be numbered sequentially from~1
|
||||
(instead of using page numbers). This form is perhaps more desirable
|
||||
for small webs.
|
||||
\item[\tt -s] Doesn't print list of scraps making up each file
|
||||
following each scrap.
|
||||
\item[\tt -d] Print ``dangling'' identifiers -- user identifiers which
|
||||
are never referenced, in indices, etc.
|
||||
\item[\tt -p {\it path}] Prepend \textit{path} to the filenames for
|
||||
all the output files.
|
||||
\item[\tt -l] \label{sec:pretty-print} Use the \texttt{listings}
|
||||
package for formatting scraps. Use this if you want to have a
|
||||
pretty-printer for your scraps. In order to e.g. have pretty Perl
|
||||
scraps, include the following \LaTeX\ commands in your document:
|
||||
\lstset{language=[LaTeX]TeX}
|
||||
|
||||
\begin{lstlisting}{language={[LaTeX]TeX}}
|
||||
\usepackage{listings}
|
||||
...
|
||||
\lstset{extendedchars=true,keepspaces=true,language=perl}
|
||||
\end{lstlisting}
|
||||
|
||||
See the \texttt{listings} documentation for a list of formatting
|
||||
options. Be sure to include a \texttt{\char92
|
||||
usepackage\{listings\}}
|
||||
in your document.
|
||||
|
||||
\item[\tt -V \it string] Provide \textit{string} as the
|
||||
replacement for the @v operation.
|
||||
\end{description}
|
||||
|
||||
\section{Generating HTML}
|
||||
|
||||
Nikos Drakos' {\LaTeX}2HTML Version 0.5.3~\cite{drakos:94} can be used
|
||||
to translate {\LaTeX} with embedded HTML scraps into HTML\@. Be sure
|
||||
to include the document-style option \verb|html| so that {\LaTeX} will
|
||||
understand the hypertext commands. When translating into HTML, do not
|
||||
allow a document to be split by specifying ``\verb|-split 0|''.
|
||||
You need not generate navigation links, so also specify
|
||||
``\verb|-no_navigation|''.
|
||||
|
||||
While preparing a web, you may want to view the program's scraps without
|
||||
taking the time to run {\LaTeX}2HTML\@. Simply rename the generated
|
||||
{\LaTeX} source so that its file name ends with \verb|.html|, and view
|
||||
that file. The documentations section will be jumbled, but the
|
||||
scraps will be clear.
|
||||
|
||||
(Note that the HTML generation is not currently maintained. If the
|
||||
only reason you want HTML is ti get hyperlinks, use the {\LaTeX}
|
||||
\verb|hyperref| package and produce your document as PDF via
|
||||
\verb|pdflatex|.)
|
||||
|
||||
\section{Restrictions}
|
||||
|
||||
Because nuweb is intended to be a simple tool, I've established a few
|
||||
restrictions. Over time, some of these may be eliminated; others seem
|
||||
fundamental.
|
||||
\begin{itemize}
|
||||
\item The handling of errors is not completely ideal. In some cases, I
|
||||
simply warn of a problem and continue; in other cases I halt
|
||||
immediately. This behavior should be regularized.
|
||||
\item I warn about references to fragments that haven't been defined, but
|
||||
don't halt. The name of the fragment is included in the output file
|
||||
surrounded by \verb|<>| signs.
|
||||
This seems most convenient for development, but may change
|
||||
in the future.
|
||||
\item File names and index entries should not contain any \verb|@|
|
||||
signs.
|
||||
\item Fragment names may be (almost) any well-formed \TeX\ string.
|
||||
It makes sense to change fonts or use math mode; however, care should
|
||||
be taken to ensure matching braces, brackets, and dollar signs.
|
||||
When producing HTML, fragments are displayed in a preformatted element
|
||||
(PRE), so fragments may contain one or more A, B, I, U, or P elements
|
||||
or data characters.
|
||||
\item Anything is allowed in the body of a scrap; however, very
|
||||
long scraps (horizontally or vertically) may not typeset well.
|
||||
\item Temporary files (created for comparison to the eventual
|
||||
output files) are placed in the current directory. Since they may be
|
||||
renamed to an output file name, all the output files should be on the
|
||||
same file system as the current directory. Alternatively, you can
|
||||
use the \verb|-p| flag to specify where the files go.
|
||||
\item Because page numbers cannot be determined until the document has
|
||||
been typeset, we have to rerun nuweb after \LaTeX\ to obtain a clean
|
||||
version of the document (very similar to the way we sometimes have
|
||||
to rerun \LaTeX\ to obtain an up-to-date table of contents after
|
||||
significant edits). Nuweb will warn (in most cases) when this needs
|
||||
to be done; in the remaining cases, \LaTeX\ will warn that labels
|
||||
may have changed.
|
||||
\end{itemize}
|
||||
Very long scraps may be allowed to break across a page if declared
|
||||
with \verb|@O| or \verb|@D| (instead of \verb|@o| and \verb|@d|).
|
||||
This doesn't work very well as a default, since far too many short
|
||||
scraps will be broken across pages; however, as a user-controlled
|
||||
option, it seems very useful. No distinction is made between the
|
||||
upper case and lower case forms of these commands when generating
|
||||
HTML\@.
|
||||
|
||||
\section{Acknowledgements}
|
||||
|
||||
Several people have contributed their times, ideas, and debugging
|
||||
skills. In particular, I'd like to acknowledge the contributions of
|
||||
Osman Buyukisik, Manuel Carriba, Adrian Clarke, Tim Harvey, Michael
|
||||
Lewis, Walter Ravenek, Rob Shillingsburg, Kayvan Sylvan, Dominique
|
||||
de~Waleffe, and Scott Warren. Of course, most of these people would
|
||||
never have heard or nuweb (or many other tools) without the efforts of
|
||||
George Greenwade.
|
||||
|
||||
Since maintenance has been taken over by Marc Mengel, Simon Wright and
|
||||
Keith Harwood online contributions have been made by:
|
||||
\begin{itemize}
|
||||
\item Walter Brown \verb|<wb@fnal.gov>|
|
||||
\item Nicky van Foreest \verb|<n.d.vanforeest@math.utwente.nl>|
|
||||
\item Javier Goizueta \verb|<jgoizueta@jazzfree.com>|
|
||||
\item Alan Karp \verb|<karp@hp.com>|
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\bibliographystyle{amsplain}
|
||||
\bibliography{litprog,master,misc}
|
||||
|
||||
\end{document}
|
92
nuwebsty.w
Normal file
92
nuwebsty.w
Normal file
@@ -0,0 +1,92 @@
|
||||
% nuwebsty.w -- styles for use with nuweb
|
||||
% (c) 2001 Javier Goizueta
|
||||
|
||||
\documentclass{report}
|
||||
|
||||
%\usepackage{html}
|
||||
|
||||
\title{Nuweb Redefinitions}
|
||||
\date{}
|
||||
\author{Javier Goizueta}
|
||||
|
||||
\begin{document}
|
||||
|
||||
I've changed \verb|nuweb| to use macros instead of
|
||||
some fixed strings. The modified \verb|nuweb| inserts
|
||||
default values of those macros at the beginning of
|
||||
the produced \LaTeX\ file.
|
||||
The macros I've introduced and their default values are as follows.
|
||||
\begin{itemize}
|
||||
\item
|
||||
\verb|\NWtarget| has two arguments just like \verb|hyperref|'s
|
||||
\verb|\hypertarget| and by default simply places the second argument
|
||||
in the output. It's used as a placeholder to introduce hyperlinks.
|
||||
\item
|
||||
\verb|\NWlink| has two arguments just like \verb|hyperref|'s
|
||||
\verb|\hyperlink| and by default simply places the second argument in
|
||||
the output. It's used as a placeholder to introduce hyper links.
|
||||
\item
|
||||
\verb|\NWtxtMacroDefBy| its default value is the string ``Macro defined by''
|
||||
and it's used to replace that string in other languages.
|
||||
\item
|
||||
\verb|\NWtxtMacroRefIn| its default value is the string ``Macro referenced in''
|
||||
and it's used to replace that string in other languages.
|
||||
\item
|
||||
\verb|\NWtxtMacroNoRef| its default value is the string ``Macro never referenced''
|
||||
and it's used to replace that string in other languages.
|
||||
\item
|
||||
\verb|\NWtxtDefBy| its default value is the string ``Defined by''
|
||||
and it's used to replace that string in other languages.
|
||||
\item
|
||||
\verb|\NWtxtRefIn| its default value is the string ``Referenced in''
|
||||
and it's used to replace that string in other languages.
|
||||
\item
|
||||
\verb|\NWtxtNoRef| its default value is the string ``Not referenced''
|
||||
and it's used to replace that string in other languages.
|
||||
\item
|
||||
\verb|\NWtxtFileDefBy| its default value is the string ``File defined by''
|
||||
and it's used to replace that string in other languages.
|
||||
\item
|
||||
\verb|\NWsep| is used as an end marker for scraps; its default value is
|
||||
\verb|$\Diamond $|.
|
||||
\end{itemize}
|
||||
|
||||
These macros can be redefined in the \LaTeX\ file to adapt
|
||||
the output to the taste of the user. I define here two files
|
||||
to redefine the macros to include hyper-links from the
|
||||
\verb|hyper-ref| package in the documentation (which works for
|
||||
example in pdf output) in english and spanish.
|
||||
These files can be included with \verb|\usepackage| in the
|
||||
documentation part.
|
||||
|
||||
Here's the english hyper-ref version:
|
||||
|
||||
@o nwhren.sty
|
||||
@{% nwhren.sty -- nuweb macros for hyperref in english
|
||||
@<Hyper-ref macros@>
|
||||
@}
|
||||
|
||||
@d Hyper-ref macros
|
||||
@{@%
|
||||
\renewcommand{\NWtarget}[2]{\hypertarget{#1}{#2}}
|
||||
\renewcommand{\NWlink}[2]{\hyperlink{#1}{#2}}
|
||||
@}
|
||||
|
||||
For the spanish version I'm using the spanish \emph{fragmento} ---whose meaning
|
||||
is close to ``scrap''--- for the term ``macro''.
|
||||
I like this but many spanish people involved with computer science use \emph{macro}
|
||||
itself in spanish.
|
||||
|
||||
@o nwhres.sty
|
||||
@{% nwhres.sty -- nuweb macros for hyperref in spanish
|
||||
@<Hyper-ref macros@>
|
||||
\renewcommand{\NWtxtMacroDefBy}{Fragmento definido en} % Macro defined by
|
||||
\renewcommand{\NWtxtMacroRefIn}{Fragmento usado en} % Macro referenced in
|
||||
\renewcommand{\NWtxtMacroNoRef}{Fragmento no usado} % Macro never referenced
|
||||
\renewcommand{\NWtxtDefBy}{Definido en} % Defined by
|
||||
\renewcommand{\NWtxtRefIn}{Usado en} % Referenced in
|
||||
\renewcommand{\NWtxtNoRef}{No usado} % Not referenced
|
||||
\renewcommand{\NWtxtFileDefBy}{Archivo definido en} % File defined by
|
||||
@}
|
||||
|
||||
\end{document}
|
101
output.c
Normal file
101
output.c
Normal file
@@ -0,0 +1,101 @@
|
||||
#include "global.h"
|
||||
void write_files(files)
|
||||
Name *files;
|
||||
{
|
||||
while (files) {
|
||||
write_files(files->llink);
|
||||
/* Write out \verb|files->spelling| */
|
||||
{
|
||||
static char temp_name[FILENAME_MAX];
|
||||
static char real_name[FILENAME_MAX];
|
||||
static int temp_name_count = 0;
|
||||
char indent_chars[MAX_INDENT];
|
||||
FILE *temp_file;
|
||||
|
||||
/* Find a free temporary file */
|
||||
|
||||
for( temp_name_count = 0; temp_name_count < 10000; temp_name_count++) {
|
||||
sprintf(temp_name,"%s%snw%06d", dirpath, path_sep, temp_name_count);
|
||||
#ifdef O_EXCL
|
||||
if (-1 != (temp_file_fd = open(temp_name, O_CREAT|O_WRONLY|O_EXCL))) {
|
||||
temp_file = fdopen(temp_file_fd, "w");
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (0 != (temp_file = fopen(temp_name, "a"))) {
|
||||
if ( 0L == ftell(temp_file)) {
|
||||
break;
|
||||
} else {
|
||||
fclose(temp_file);
|
||||
temp_file = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!temp_file) {
|
||||
fprintf(stderr, "%s: can't create %s for a temporary file\n",
|
||||
command_name, temp_name);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
||||
sprintf(real_name, "%s%s%s", dirpath, path_sep, files->spelling);
|
||||
if (verbose_flag)
|
||||
fprintf(stderr, "writing %s [%s]\n", files->spelling, temp_name);
|
||||
write_scraps(temp_file, files->spelling, files->defs, 0, indent_chars,
|
||||
files->debug_flag, files->tab_flag, files->indent_flag,
|
||||
files->comment_flag, NULL, NULL, 0, files->spelling);
|
||||
fclose(temp_file);
|
||||
|
||||
/* Move the temporary file to the target, if required */
|
||||
|
||||
if (compare_flag)
|
||||
/* Compare the temp file and the old file */
|
||||
{
|
||||
FILE *old_file = fopen(real_name, "r");
|
||||
if (old_file) {
|
||||
int x, y;
|
||||
temp_file = fopen(temp_name, "r");
|
||||
do {
|
||||
x = getc(old_file);
|
||||
y = getc(temp_file);
|
||||
} while (x == y && x != EOF);
|
||||
fclose(old_file);
|
||||
fclose(temp_file);
|
||||
if (x == y)
|
||||
remove(temp_name);
|
||||
else {
|
||||
remove(real_name);
|
||||
/* Rename the temporary file to the target */
|
||||
|
||||
if (0 != rename(temp_name, real_name)) {
|
||||
fprintf(stderr, "%s: can't rename output file to %s\n",
|
||||
command_name, real_name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
/* Rename the temporary file to the target */
|
||||
|
||||
if (0 != rename(temp_name, real_name)) {
|
||||
fprintf(stderr, "%s: can't rename output file to %s\n",
|
||||
command_name, real_name);
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
remove(real_name);
|
||||
/* Rename the temporary file to the target */
|
||||
|
||||
if (0 != rename(temp_name, real_name)) {
|
||||
fprintf(stderr, "%s: can't rename output file to %s\n",
|
||||
command_name, real_name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
files = files->rlink;
|
||||
}
|
||||
}
|
234
pass1.c
Normal file
234
pass1.c
Normal file
@@ -0,0 +1,234 @@
|
||||
#include "global.h"
|
||||
void pass1(file_name)
|
||||
char *file_name;
|
||||
{
|
||||
if (verbose_flag)
|
||||
fprintf(stderr, "reading %s\n", file_name);
|
||||
source_open(file_name);
|
||||
init_scraps();
|
||||
macro_names = NULL;
|
||||
file_names = NULL;
|
||||
user_names = NULL;
|
||||
/* Scan the source file, looking for at-sequences */
|
||||
{
|
||||
int c = source_get();
|
||||
while (c != EOF) {
|
||||
if (c == nw_char)
|
||||
/* Scan at-sequence */
|
||||
{
|
||||
char quoted = 0;
|
||||
|
||||
c = source_get();
|
||||
switch (c) {
|
||||
case 'r':
|
||||
c = source_get();
|
||||
nw_char = c;
|
||||
update_delimit_scrap();
|
||||
break;
|
||||
case 'O':
|
||||
case 'o': {
|
||||
Name *name = collect_file_name(); /* returns a pointer to the name entry */
|
||||
int scrap = collect_scrap(); /* returns an index to the scrap */
|
||||
/* Add \verb|scrap| to \verb|name|'s definition list */
|
||||
{
|
||||
Scrap_Node *def = (Scrap_Node *) arena_getmem(sizeof(Scrap_Node));
|
||||
def->scrap = scrap;
|
||||
def->quoted = quoted;
|
||||
def->next = name->defs;
|
||||
name->defs = def;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'Q':
|
||||
case 'q': quoted = 1;
|
||||
case 'D':
|
||||
case 'd': {
|
||||
Name *name = collect_macro_name();
|
||||
int scrap = collect_scrap();
|
||||
/* Add \verb|scrap| to \verb|name|'s definition list */
|
||||
{
|
||||
Scrap_Node *def = (Scrap_Node *) arena_getmem(sizeof(Scrap_Node));
|
||||
def->scrap = scrap;
|
||||
def->quoted = quoted;
|
||||
def->next = name->defs;
|
||||
name->defs = def;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
/* Step to next sector */
|
||||
|
||||
prev_sector += 1;
|
||||
current_sector = prev_sector;
|
||||
c = source_get();
|
||||
|
||||
break;
|
||||
case 'S':
|
||||
/* Close the current sector */
|
||||
current_sector = 1;
|
||||
c = source_get();
|
||||
|
||||
break;
|
||||
case '<':
|
||||
case '(':
|
||||
case '[':
|
||||
case '{':
|
||||
{
|
||||
int c;
|
||||
int depth = 1;
|
||||
while ((c = source_get()) != EOF) {
|
||||
if (c == nw_char)
|
||||
/* Skip over at-sign or go to skipped */
|
||||
|
||||
{
|
||||
c = source_get();
|
||||
switch (c) {
|
||||
case '{': case '[': case '(': case '<':
|
||||
depth += 1;
|
||||
break;
|
||||
case '}': case ']': case ')': case '>':
|
||||
if (--depth == 0)
|
||||
goto skipped;
|
||||
case 'x': case '|': case ',':
|
||||
case '%': case '1': case '2':
|
||||
case '3': case '4': case '5': case '6':
|
||||
case '7': case '8': case '9': case '_':
|
||||
case 'f': case '#': case '+': case '-':
|
||||
case 'v': case '*': case 'c': case '\'':
|
||||
case 's':
|
||||
break;
|
||||
default:
|
||||
if (c != nw_char) {
|
||||
fprintf(stderr, "%s: unexpected %c%c in text at (%s, %d)\n",
|
||||
command_name, nw_char, c, source_name, source_line);
|
||||
exit(-1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
fprintf(stderr, "%s: unexpected EOF in text at (%s, %d)\n",
|
||||
command_name, source_name, source_line);
|
||||
exit(-1);
|
||||
|
||||
skipped: ;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'c': {
|
||||
char * p = blockBuff;
|
||||
char * e = blockBuff + (sizeof(blockBuff)/sizeof(blockBuff[0])) - 1;
|
||||
|
||||
/* Skip whitespace */
|
||||
while (source_peek == ' '
|
||||
|| source_peek == '\t'
|
||||
|| source_peek == '\n')
|
||||
(void)source_get();
|
||||
|
||||
while (p < e)
|
||||
{
|
||||
/* Add one char to the block buffer */
|
||||
int c = source_get();
|
||||
|
||||
if (c == nw_char)
|
||||
{
|
||||
/* Add an at character to the block or break */
|
||||
int cc = source_peek;
|
||||
|
||||
if (cc == 'c')
|
||||
{
|
||||
do
|
||||
c = source_get();
|
||||
while (c <= ' ');
|
||||
|
||||
break;
|
||||
}
|
||||
else if (cc == 'd'
|
||||
|| cc == 'D'
|
||||
|| cc == 'q'
|
||||
|| cc == 'Q'
|
||||
|| cc == 'o'
|
||||
|| cc == 'O'
|
||||
|| cc == EOF)
|
||||
{
|
||||
source_ungetc(&c);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p++ = c;
|
||||
*p++ = source_get();
|
||||
}
|
||||
|
||||
}
|
||||
else if (c == EOF)
|
||||
{
|
||||
source_ungetc(&c);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Add any other character to the block */
|
||||
|
||||
/* Perhaps skip white-space */
|
||||
if (c == ' ')
|
||||
{
|
||||
while (source_peek == ' ')
|
||||
c = source_get();
|
||||
}
|
||||
if (c == '\n')
|
||||
{
|
||||
if (source_peek == '\n')
|
||||
{
|
||||
do
|
||||
c = source_get();
|
||||
while (source_peek == '\n');
|
||||
}
|
||||
else
|
||||
c = ' ';
|
||||
}
|
||||
|
||||
*p++ = c;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (p == e)
|
||||
{
|
||||
/* Skip to the next nw-char */
|
||||
int c;
|
||||
|
||||
while ((c = source_get()), c != nw_char && c != EOF)/* Skip */
|
||||
source_ungetc(&c);
|
||||
}
|
||||
*p = '\000';
|
||||
}
|
||||
|
||||
break;
|
||||
case 'x':
|
||||
case 'v':
|
||||
case 'u':
|
||||
case 'm':
|
||||
case 'f': /* ignore during this pass */
|
||||
break;
|
||||
default: if (c==nw_char) /* ignore during this pass */
|
||||
break;
|
||||
fprintf(stderr,
|
||||
"%s: unexpected %c sequence ignored (%s, line %d)\n",
|
||||
command_name, nw_char, source_name, source_line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
c = source_get();
|
||||
}
|
||||
}
|
||||
if (tex_flag)
|
||||
search();
|
||||
/* Reverse cross-reference lists */
|
||||
{
|
||||
reverse_lists(file_names);
|
||||
reverse_lists(macro_names);
|
||||
reverse_lists(user_names);
|
||||
}
|
||||
}
|
113
test/00/t0001a.sh
Normal file
113
test/00/t0001a.sh
Normal file
@@ -0,0 +1,113 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0001a.sh,v $ -- Test test/00/t0001a.sh
|
||||
#
|
||||
#
|
||||
# Test of formating bare parameter uses
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of formating bare parameter uses" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of formating bare parameter uses" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test formating bare parameter uses
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
@d Test with parameter
|
||||
@{Try @1 parameter.
|
||||
@}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Test with parameter}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Try @{\tt @}\verb@1 parameter.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item {\NWtxtMacroNoRef}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
119
test/00/t0002a.sh
Normal file
119
test/00/t0002a.sh
Normal file
@@ -0,0 +1,119 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0002a.sh,v $-- Test test/00/t0002a.sh
|
||||
#
|
||||
#
|
||||
# Test of formatting parameters in index
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of formatting parameters in index" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of formatting parameters in index" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test formatting parameters in index
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
@d Test @'param@' in index
|
||||
@{Param @1 here
|
||||
@}
|
||||
|
||||
@m
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Test \hbox{\slshape\sffamily param\/} in index}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Param @\hbox{\slshape\sffamily param\/}\verb@ here@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item {\NWtxtMacroNoRef}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Test \hbox{\slshape\sffamily param\/} in index\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtNoRef}.}
|
||||
\end{list}}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
122
test/00/t0003a.sh
Normal file
122
test/00/t0003a.sh
Normal file
@@ -0,0 +1,122 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0003a.sh,v $-- Test test/00/t0003a.sh
|
||||
#
|
||||
#
|
||||
# Test of more vspace in file entry
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of more vspace in file entry" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of more vspace in file entry" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test more vspace in file entry
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c
|
||||
@{File defining fred and jim.
|
||||
|
||||
See?
|
||||
@| fred jim @}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@File defining fred and jim.@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@See? @\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtIdentsDefed\nobreak\ \verb@fred@\nobreak\ \NWtxtIdentsNotUsed, \verb@jim@\nobreak\ \NWtxtIdentsNotUsed.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
179
test/00/t0004a.sh
Normal file
179
test/00/t0004a.sh
Normal file
@@ -0,0 +1,179 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0004a.sh,v $-- Test test/00/t0004a.sh
|
||||
#
|
||||
#
|
||||
# Test of indent before parameter
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of indent before parameter" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of indent before parameter" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test indent before parameter
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c
|
||||
@{Start
|
||||
@<Here is the first call@>
|
||||
End
|
||||
@}
|
||||
|
||||
@d Here is the first call
|
||||
@{@<Use @'xxx@' as parameter@>
|
||||
@<Use @'ZZZ@' as parameter@>
|
||||
@}
|
||||
|
||||
@d Use @'yyy@' as...
|
||||
@{@1 is here.
|
||||
@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Start@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Here is the first call}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@End@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Here is the first call}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Use \verb@xxx@ as parameter}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Use \verb@ZZZ@ as parameter}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Use \hbox{\slshape\sffamily yyy\/} as parameter}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\hbox{\slshape\sffamily yyy\/}\verb@ is here.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Start
|
||||
xxx is here.
|
||||
|
||||
ZZZ is here.
|
||||
|
||||
|
||||
End
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
224
test/00/t0005a.sh
Normal file
224
test/00/t0005a.sh
Normal file
@@ -0,0 +1,224 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0005a.sh,v $-- Test test/00/t0005a.sh
|
||||
#
|
||||
#
|
||||
# Test of Commenting macroes as argument uses
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Commenting macroes as argument uses" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Commenting macroes as argument uses" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Commenting macroes as argument uses
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c -cc
|
||||
@{Call the macro
|
||||
@<Fragment with @<A macro argument@> as parameter@>
|
||||
@<Second frag with @<A macro argument@> as parameter@>
|
||||
@<Third frag with @<A macro argument@> as parameter@>
|
||||
@}
|
||||
|
||||
@d Fragment with @'Begin macro@'...
|
||||
@{@1<<<Here 'tis.
|
||||
That argument was at the beginning of the fragment@}
|
||||
|
||||
@d Second frag with @'Begin line@'...
|
||||
@{Here is the beginning of the second macro
|
||||
@1<<<That is the argument
|
||||
And this is the end of the second frag@}
|
||||
|
||||
@d Third frag with @'Embedded@'...
|
||||
@{Here is the argument>>>@1<<<That was it.@}
|
||||
|
||||
@d A macro argument
|
||||
@{Hello folks@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Call the macro@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Fragment with $\langle\,${\itshape A macro argument}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ as parameter}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Second frag with $\langle\,${\itshape A macro argument}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ as parameter}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Third frag with $\langle\,${\itshape A macro argument}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ as parameter}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Fragment with \hbox{\slshape\sffamily Begin macro\/} as parameter}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\hbox{\slshape\sffamily Begin macro\/}\verb@<<<Here 'tis.@\\
|
||||
\mbox{}\verb@That argument was at the beginning of the fragment@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Second frag with \hbox{\slshape\sffamily Begin line\/} as parameter}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here is the beginning of the second macro@\\
|
||||
\mbox{}\verb@@\hbox{\slshape\sffamily Begin line\/}\verb@<<<That is the argument@\\
|
||||
\mbox{}\verb@And this is the end of the second frag@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap4}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Third frag with \hbox{\slshape\sffamily Embedded\/} as parameter}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here is the argument>>>@\hbox{\slshape\sffamily Embedded\/}\verb@<<<That was it.@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap5}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape A macro argument}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Hello folks@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Call the macro
|
||||
/* Fragment with <A macro argument> as parameter */
|
||||
/* A macro argument */
|
||||
Hello folks<<<Here 'tis.
|
||||
That argument was at the beginning of the fragment
|
||||
/* Second frag with <A macro argument> as parameter */
|
||||
Here is the beginning of the second macro
|
||||
/* A macro argument */
|
||||
Hello folks<<<That is the argument
|
||||
And this is the end of the second frag
|
||||
/* Third frag with <A macro argument> as parameter */
|
||||
Here is the argument>>>Hello folks<<<That was it.
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
119
test/00/t0006a.sh
Normal file
119
test/00/t0006a.sh
Normal file
@@ -0,0 +1,119 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0006a.sh,v $-- Test test/00/t0006a.sh
|
||||
#
|
||||
#
|
||||
# Test of cross-reference flag
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of cross-reference flag" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of cross-reference flag" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test cross-reference flag
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c -cc
|
||||
@{Call the macro
|
||||
@<Fragment with @<A macro argument@> as parameter@>
|
||||
@<Second frag with @<A macro argument@> as parameter@>
|
||||
@<Third frag with @<A macro argument@> as parameter@>
|
||||
@}
|
||||
|
||||
@d Fragment with @'Begin macro@'...
|
||||
@{@1<<<Here 'tis.
|
||||
That argument was at the beginning of the fragment@}
|
||||
|
||||
@d Second frag with @'Begin line@'...
|
||||
@{Here is the beginning of the second macro
|
||||
@1<<<That is the argument
|
||||
And this is the end of the second frag@}
|
||||
|
||||
@d Third frag with @'Embedded@'...
|
||||
@{Here is the argument>>>@1<<<That was it.@}
|
||||
|
||||
@d A macro argument
|
||||
@{Hello folks@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Call the macro
|
||||
/* Fragment with <A macro argument> as parameter 1b */
|
||||
/* A macro argument 1e */
|
||||
Hello folks<<<Here 'tis.
|
||||
That argument was at the beginning of the fragment
|
||||
/* Second frag with <A macro argument> as parameter 1c */
|
||||
Here is the beginning of the second macro
|
||||
/* A macro argument 1e */
|
||||
Hello folks<<<That is the argument
|
||||
And this is the end of the second frag
|
||||
/* Third frag with <A macro argument> as parameter 1d */
|
||||
Here is the argument>>>Hello folks<<<That was it.
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb -x test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
|
||||
$bin/nuweb -x test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
192
test/00/t0007a.sh
Normal file
192
test/00/t0007a.sh
Normal file
@@ -0,0 +1,192 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0007a.sh,v $-- Test test/00/t0007a.sh
|
||||
#
|
||||
#
|
||||
# Test of ???
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of ???" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of ???" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test ???
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here is a macro that defines something.
|
||||
@d Define something
|
||||
@{something anything
|
||||
@| something anything @}
|
||||
|
||||
Here is a macro that uses an argument
|
||||
@d Use the @'thing@'
|
||||
@{Use @1
|
||||
Use anything
|
||||
@}
|
||||
|
||||
Now use the something in an argument
|
||||
@o test.c -cc
|
||||
@{
|
||||
@<Define something@>
|
||||
@<Use the @'something@'@>
|
||||
@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here is a macro that defines something.
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} $\langle\,${\itshape Define something}\nobreak\ {\footnotesize {1a}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@something anything@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1c}{1c}.
|
||||
\item \NWtxtIdentsDefed\nobreak\ \verb@anything@\nobreak\ \NWlink{nuweb1b}{1b}, \verb@something@\nobreak\ \NWlink{nuweb1c}{1c}.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
Here is a macro that uses an argument
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Use the \hbox{\slshape\sffamily thing\/}}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Use @\hbox{\slshape\sffamily thing\/}\verb@@\\
|
||||
\mbox{}\verb@Use anything@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1c}{1c}.
|
||||
\item \NWtxtIdentsUsed\nobreak\ \verb@anything@\nobreak\ \NWlink{nuweb1a}{1a}.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
Now use the something in an argument
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
|
||||
\NWtarget{nuweb1c}{} \verb@"test.c"@\nobreak\ {\footnotesize {1c}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Define something}\nobreak\ {\footnotesize \NWlink{nuweb1a}{1a}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Use the \verb@something@}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtIdentsUsed\nobreak\ \verb@something@\nobreak\ \NWlink{nuweb1a}{1a}.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
|
||||
/* Define something */
|
||||
something anything
|
||||
|
||||
/* Use the 'something' */
|
||||
Use something
|
||||
Use anything
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
179
test/00/t0008a.sh
Normal file
179
test/00/t0008a.sh
Normal file
@@ -0,0 +1,179 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0008a.sh,v $-- Test test/00/t0008a.sh
|
||||
#
|
||||
#
|
||||
# Test of Version flag
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Version flag" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Version flag" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Version flag
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here >>@v<< is the version information.
|
||||
@o test.c -cc
|
||||
@{Here >>@v<< is the version information in code.
|
||||
@}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.with.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here >>3.14159<< is the version information.
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here >>3.14159<< is the version information in code.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.with.c <<"EOF"
|
||||
Here >>3.14159<< is the version information in code.
|
||||
EOF
|
||||
|
||||
cat > test.expected.without.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here >>no version<< is the version information.
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here >>no version<< is the version information in code.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.without.c <<"EOF"
|
||||
Here >>no version<< is the version information in code.
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb -V 3.14159 test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.with.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.with.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.without.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.without.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
145
test/00/t0009a.sh
Normal file
145
test/00/t0009a.sh
Normal file
@@ -0,0 +1,145 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0009a.sh,v $-- Test test/00/t0009a.sh
|
||||
#
|
||||
#
|
||||
# Test of user specified use of identifiers
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of user specified use of identifiers" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of user specified use of identifiers" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test user specified use of identifiers
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Define a thing.
|
||||
@o test.c -cc
|
||||
@{This defines ident.
|
||||
@<Use the thing defined@>
|
||||
@| ident @}
|
||||
|
||||
Now use it without it actually appearing in the text.
|
||||
|
||||
@d Use the thing defined
|
||||
@{Pretend that we use it here.
|
||||
@* ident @}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Define a thing.
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This defines ident.@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Use the thing defined}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtIdentsDefed\nobreak\ \verb@ident@\nobreak\ \NWlink{nuweb1b}{1b}.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
Now use it without it actually appearing in the text.
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Use the thing defined}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Pretend that we use it here.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
\item \NWtxtIdentsUsed\nobreak\ \verb@ident@\nobreak\ \NWlink{nuweb1a}{1a}.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
latex test
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
135
test/00/t0010a.sh
Normal file
135
test/00/t0010a.sh
Normal file
@@ -0,0 +1,135 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0010a.sh,v $-- Test test/00/t0010a.sh
|
||||
#
|
||||
#
|
||||
# Test cross-reference isn't followed by 'x'
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test cross-reference isn't followed by 'x'" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test cross-reference isn't followed by 'x'" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test ???
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here is a cross-reference: @xref@x
|
||||
|
||||
@o test.c
|
||||
@{This (@xref@x) is where it is referencing.
|
||||
@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here is a cross-reference: 1-01
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1}{} \verb@"test.c"@\nobreak\ {\footnotesize {1}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This (1-01) is where it is referencing.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
This (1-01) is where it is referencing.
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
97
test/00/t0011a.sh
Normal file
97
test/00/t0011a.sh
Normal file
@@ -0,0 +1,97 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0011a.sh,v $-- Test test/00/t0011a.sh
|
||||
#
|
||||
#
|
||||
# Test that unimpemented fragments are indented
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test that unimpemented fragments are indented" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test that unimpemented fragments are indented" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test ???
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c
|
||||
@{Begin
|
||||
@<Implemented fragment@>
|
||||
End
|
||||
@}
|
||||
|
||||
@d Impl...
|
||||
@{@<Unimplemented fragment A@>
|
||||
@<Unimplemented fragment B@>
|
||||
@<Unimplemented fragment C@>@}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Begin
|
||||
@<Unimplemented fragment A@>
|
||||
@<Unimplemented fragment B@>
|
||||
@<Unimplemented fragment C@>
|
||||
End
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
204
test/00/t0012a.sh
Normal file
204
test/00/t0012a.sh
Normal file
@@ -0,0 +1,204 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0012a.sh,v $-- Test test/00/t0012a.sh
|
||||
#
|
||||
#
|
||||
# Test of block comments
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of block comments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of block comments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test block comments
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@c Here is a block comment which is long enough to need line
|
||||
breaking. (And a bit extra.)
|
||||
Here is a block comment which is long enough to need line
|
||||
breaking.
|
||||
Here is a block comment which is long enough to need line
|
||||
breaking. (Some more extra.)
|
||||
Here is a block comment which is long enough to need line
|
||||
breaking.
|
||||
|
||||
Here is more of the block comment. It is also long enough to
|
||||
need line-breaking.
|
||||
|
||||
@o test.c -cc
|
||||
@{Here is some stuff.
|
||||
@c
|
||||
Here is the end of the stuff.
|
||||
Here (@c) is a block comment in code.
|
||||
@}
|
||||
|
||||
@c This is another block comment that shouldn't end in a
|
||||
newline. (So long as its length is right.
|
||||
@o test.c -cc
|
||||
@{This --@c-- is where it is used.
|
||||
@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} Here is a block comment which is long enough to need line
|
||||
breaking. (And a bit extra.)
|
||||
Here is a block comment which is long enough to need line
|
||||
breaking.
|
||||
Here is a block comment which is long enough to need line
|
||||
breaking. (Some more extra.)
|
||||
Here is a block comment which is long enough to need line
|
||||
breaking.
|
||||
|
||||
Here is more of the block comment. It is also long enough to
|
||||
need line-breaking.
|
||||
|
||||
\par\vspace{\baselineskip}
|
||||
\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here is some stuff.@\\
|
||||
\mbox{}\verb@ @\hbox{\sffamily\slshape (Comment)}\verb@@\\
|
||||
\mbox{}\verb@Here is the end of the stuff.@\\
|
||||
\mbox{}\verb@Here (@\hbox{\sffamily\slshape (Comment)}\verb@) is a block comment in code.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb?}{?}\NWlink{nuweb?}{, ?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} This is another block comment that shouldn't end in a
|
||||
newline. (So long as its length is right.
|
||||
\par\vspace{\baselineskip}
|
||||
\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This --@\hbox{\sffamily\slshape (Comment)}\verb@-- is where it is used.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb?}{?}\NWlink{nuweb?}{, ?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Here is some stuff.
|
||||
/* Here is a block comment which is long enough to need line
|
||||
* breaking. (And a bit extra.) Here is a block comment which
|
||||
* is long enough to need line breaking. Here is a block comment
|
||||
* which is long enough to need line breaking. (Some more extra.)
|
||||
* Here is a block comment which is long enough to need line
|
||||
* breaking.
|
||||
* Here is more of the block comment. It is also long enough
|
||||
* to need line-breaking.
|
||||
*/
|
||||
Here is the end of the stuff.
|
||||
Here (/* Here is a block comment which is long enough to need
|
||||
* line breaking. (And a bit extra.) Here is a block comment
|
||||
* which is long enough to need line breaking. Here is a
|
||||
* block comment which is long enough to need line breaking.
|
||||
* (Some more extra.) Here is a block comment which is long
|
||||
* enough to need line breaking.
|
||||
* Here is more of the block comment. It is also long enough
|
||||
* to need line-breaking.
|
||||
*/) is a block comment in code.
|
||||
This --/* This is another block comment that shouldn't end in
|
||||
* a newline. (So long as its length is right. */-- is where it is used.
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
158
test/00/t0013a.sh
Normal file
158
test/00/t0013a.sh
Normal file
@@ -0,0 +1,158 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0013a.sh,v $-- Test test/00/t0013a.sh
|
||||
#
|
||||
#
|
||||
# Test block comments aren't indexed
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test block comments aren't indexed" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test block comments aren't indexed" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test ???
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@c
|
||||
Here is a block comment which contains the word 'target'.
|
||||
@o test.c -cc
|
||||
@{Here is a fragment which contains the block comment
|
||||
@c
|
||||
That was the block comment.
|
||||
Here we use another fragment.
|
||||
@<Define...@>
|
||||
@}
|
||||
|
||||
@d Define our target
|
||||
@{This fragment defines 'target'.
|
||||
@| target @}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}
|
||||
Here is a block comment which contains the word 'target'.
|
||||
\par\vspace{\baselineskip}
|
||||
\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here is a fragment which contains the block comment@\\
|
||||
\mbox{}\verb@@\hbox{\sffamily\slshape (Comment)}\verb@@\\
|
||||
\mbox{}\verb@That was the block comment.@\\
|
||||
\mbox{}\verb@Here we use another fragment.@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Define our target}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Define our target}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This fragment defines 'target'.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
\item \NWtxtIdentsDefed\nobreak\ \verb@target@\nobreak\ \NWtxtIdentsNotUsed.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
125
test/00/t0014a.sh
Normal file
125
test/00/t0014a.sh
Normal file
@@ -0,0 +1,125 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0014a.sh,v $-- Test test/00/t0014a.sh
|
||||
#
|
||||
#
|
||||
# Test of @@ in scraps
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of @@ in scraps" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of @@ in scraps" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test @@ in scraps
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c -cc
|
||||
@{This scrap contains @@<.
|
||||
@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This scrap contains @{\tt @}\verb@<.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
This scrap contains @<.
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
152
test/00/t0015a.sh
Normal file
152
test/00/t0015a.sh
Normal file
@@ -0,0 +1,152 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0015a.sh,v $-- Test test/00/t0015a.sh
|
||||
#
|
||||
#
|
||||
# Test of ???
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of ???" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of ???" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test ???
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@d Sort @'key@' of size @'n@' for @'ordering@'
|
||||
@{for (int j = 1; j < @2; j++)
|
||||
{
|
||||
int i = j - 1;
|
||||
int kj = @1[j];
|
||||
|
||||
do
|
||||
{
|
||||
int ki = @1[i];
|
||||
|
||||
if (@3)
|
||||
break;
|
||||
@1[i + 1] = ki;
|
||||
i -= 1;
|
||||
} while (i >= 0);
|
||||
@1[i + 1] = kj;
|
||||
}
|
||||
@}
|
||||
|
||||
Test in-text @{@<Sort @'key@'...@>@} usage.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Sort \hbox{\slshape\sffamily key\/} of size \hbox{\slshape\sffamily n\/} for \hbox{\slshape\sffamily ordering\/}}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@for (int j = 1; j < @\hbox{\slshape\sffamily n\/}\verb@; j++)@\\
|
||||
\mbox{}\verb@{@\\
|
||||
\mbox{}\verb@ int i = j - 1;@\\
|
||||
\mbox{}\verb@ int kj = @\hbox{\slshape\sffamily key\/}\verb@[j];@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@ do@\\
|
||||
\mbox{}\verb@ {@\\
|
||||
\mbox{}\verb@ int ki = @\hbox{\slshape\sffamily key\/}\verb@[i];@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@ if (@\hbox{\slshape\sffamily ordering\/}\verb@)@\\
|
||||
\mbox{}\verb@ break;@\\
|
||||
\mbox{}\verb@ @\hbox{\slshape\sffamily key\/}\verb@[i + 1] = ki;@\\
|
||||
\mbox{}\verb@ i -= 1;@\\
|
||||
\mbox{}\verb@ } while (i >= 0);@\\
|
||||
\mbox{}\verb@ @\hbox{\slshape\sffamily key\/}\verb@[i + 1] = kj;@\\
|
||||
\mbox{}\verb@}@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item {\NWtxtMacroNoRef}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
Test in-text \verb@@$\langle\,${\itshape Sort \verb@key@ of size \verb@n@ for \verb@ordering@}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$\verb@@ usage.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
259
test/00/t0016a.sh
Normal file
259
test/00/t0016a.sh
Normal file
@@ -0,0 +1,259 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0016a.sh,v $-- Test test/00/t0016a.sh
|
||||
#
|
||||
#
|
||||
# Test no pagebreak before scraps
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test no pagebreak before scraps" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test no pagebreak before scraps" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test ???
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
@c Here comes a block comment just before a scrap and we don't
|
||||
want this separated from it. (Thinks:
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:)
|
||||
|
||||
@d Here is a scrap.
|
||||
@{This is the contents of the scrap.
|
||||
|
||||
More stuff, not related to songs without ends.
|
||||
|
||||
"This is a song that will get on your nerves,
|
||||
Get on your nerves,
|
||||
Get on your nerves,"
|
||||
|
||||
Ad infinitum.
|
||||
@}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth} Here comes a block comment just before a scrap and we don't
|
||||
want this separated from it. (Thinks:
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:
|
||||
This is a song without and end. It goes on and on my friend. Some
|
||||
people started singing it, not knowing what it was, and they'll
|
||||
go on forever just because:)
|
||||
|
||||
\par\vspace{\baselineskip}
|
||||
\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Here is a scrap.}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This is the contents of the scrap.@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@More stuff, not related to songs without ends.@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@"This is a song that will get on your nerves,@\\
|
||||
\mbox{}\verb@ Get on your nerves,@\\
|
||||
\mbox{}\verb@ Get on your nerves,"@\\
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@Ad infinitum.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item {\NWtxtMacroNoRef}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
318
test/00/t0017a.sh
Normal file
318
test/00/t0017a.sh
Normal file
@@ -0,0 +1,318 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0017a.sh,v $-- Test test/00/t0017a.sh
|
||||
#
|
||||
#
|
||||
# Test of quoted scraps
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of quoted scraps" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of quoted scraps" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test quoted scraps
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c -cc
|
||||
@{Test of quoted fragments.
|
||||
@<Insert first fragment@>
|
||||
@<Insert second fragment@>
|
||||
@<Insert third fragment@>
|
||||
@<Insert parameter @'whatsit@'...@>
|
||||
End of test.
|
||||
@}
|
||||
|
||||
@d Insert first fragment
|
||||
@{This fragment is not quoted.
|
||||
@<Insert unquoted fragment@>
|
||||
@<Insert quoted fragment@>
|
||||
@<Insert parameter @'1@'...@>
|
||||
@<Insert param...@>
|
||||
End of first fragment.@}
|
||||
|
||||
@q Insert second fragment
|
||||
@{This fragment is quoted.
|
||||
@<Insert unquoted fragment@>
|
||||
@<Insert quoted fragment@>
|
||||
@<Insert parameter @'2@'...@>
|
||||
@<Insert param...@>
|
||||
End of second fragment.@}
|
||||
|
||||
@d Insert third fragment
|
||||
@{This fragment is not quoted.
|
||||
@<Insert unquoted fragment@>
|
||||
@<Insert quoted fragment@>
|
||||
@<Insert parameter @'3@'...@>
|
||||
@<Insert param...@>
|
||||
End of third fragment.@}
|
||||
|
||||
@d Insert unquoted fragment
|
||||
@{This fragment in file @f is not quoted@}
|
||||
|
||||
@q Insert quoted fragment
|
||||
@{This fragment in file @f is quoted@}
|
||||
|
||||
@d Insert parameter @'thing@' fragment
|
||||
@{Here >>@1<< is the parameter@}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Test of quoted fragments.@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert first fragment}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert second fragment}\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert third fragment}\nobreak\ {\footnotesize \NWlink{nuweb1d}{1d}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert parameter \verb@whatsit@ fragment}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@End of test.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Insert first fragment}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This fragment is not quoted.@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert unquoted fragment}\nobreak\ {\footnotesize \NWlink{nuweb1e}{1e}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert quoted fragment}\nobreak\ {\footnotesize \NWlink{nuweb2a}{2a}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert parameter \verb@1@ fragment}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert parameter \verb@thing@ fragment}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@End of first fragment.@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
|
||||
\NWtarget{nuweb1c}{} $\langle\,${\itshape Insert second fragment}\nobreak\ {\footnotesize {1c}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This fragment is quoted.@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert unquoted fragment}\nobreak\ {\footnotesize \NWlink{nuweb1e}{1e}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert quoted fragment}\nobreak\ {\footnotesize \NWlink{nuweb2a}{2a}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert parameter \verb@2@ fragment}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert parameter \verb@thing@ fragment}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@End of second fragment.@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap4}\raggedright\small
|
||||
\NWtarget{nuweb1d}{} $\langle\,${\itshape Insert third fragment}\nobreak\ {\footnotesize {1d}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This fragment is not quoted.@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert unquoted fragment}\nobreak\ {\footnotesize \NWlink{nuweb1e}{1e}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert quoted fragment}\nobreak\ {\footnotesize \NWlink{nuweb2a}{2a}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert parameter \verb@3@ fragment}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@ @\hbox{$\langle\,${\itshape Insert parameter \verb@thing@ fragment}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@End of third fragment.@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap5}\raggedright\small
|
||||
\NWtarget{nuweb1e}{} $\langle\,${\itshape Insert unquoted fragment}\nobreak\ {\footnotesize {1e}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This fragment in file @\hbox{\sffamily\slshape file name}\verb@ is not quoted@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1b}{1b}\NWlink{nuweb1c}{c}\NWlink{nuweb1d}{d}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap6}\raggedright\small
|
||||
\NWtarget{nuweb2a}{} $\langle\,${\itshape Insert quoted fragment}\nobreak\ {\footnotesize {2a}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@This fragment in file @\hbox{\sffamily\slshape file name}\verb@ is quoted@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1b}{1b}\NWlink{nuweb1c}{c}\NWlink{nuweb1d}{d}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap7}\raggedright\small
|
||||
\NWtarget{nuweb2b}{} $\langle\,${\itshape Insert parameter \hbox{\slshape\sffamily thing\/} fragment}\nobreak\ {\footnotesize {2b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here >>@\hbox{\slshape\sffamily thing\/}\verb@<< is the parameter@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1b}{b}\NWlink{nuweb1c}{c}\NWlink{nuweb1d}{d}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Test of quoted fragments.
|
||||
/* Insert first fragment */
|
||||
This fragment is not quoted.
|
||||
/* Insert unquoted fragment */
|
||||
This fragment in file test.c is not quoted
|
||||
/* Insert quoted fragment */
|
||||
This fragment in file @f is quoted
|
||||
/* Insert parameter '1' fragment */
|
||||
Here >>1<< is the parameter
|
||||
/* Insert parameter 'thing' fragment */
|
||||
Here >>thing<< is the parameter
|
||||
End of first fragment.
|
||||
/* Insert second fragment */
|
||||
This fragment is quoted.
|
||||
@<Insert unquoted fragment@>
|
||||
@<Insert quoted fragment@>
|
||||
@<Insert parameter @'2@' fragment@>
|
||||
@<Insert parameter @'thing@' fragment@>
|
||||
End of second fragment.
|
||||
/* Insert third fragment */
|
||||
This fragment is not quoted.
|
||||
/* Insert unquoted fragment */
|
||||
This fragment in file test.c is not quoted
|
||||
/* Insert quoted fragment */
|
||||
This fragment in file @f is quoted
|
||||
/* Insert parameter '3' fragment */
|
||||
Here >>3<< is the parameter
|
||||
/* Insert parameter 'thing' fragment */
|
||||
Here >>thing<< is the parameter
|
||||
End of third fragment.
|
||||
/* Insert parameter 'whatsit' fragment */
|
||||
Here >>whatsit<< is the parameter
|
||||
End of test.
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
150
test/00/t0018a.sh
Normal file
150
test/00/t0018a.sh
Normal file
@@ -0,0 +1,150 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0018a.sh,v $-- Test test/00/t0018a.sh
|
||||
#
|
||||
#
|
||||
# Test of using hyperlinks
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of using hyperlinks" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of using hyperlinks" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test using hyperlinks
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\NWuseHyperlinks
|
||||
\begin{document}
|
||||
@o test.c -cc
|
||||
@{@<Use a fragment@>
|
||||
@}
|
||||
@d Use...
|
||||
@{Here is a fragment.
|
||||
Make sure it is referenced properly.@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{\hypertarget{#1}{#2}}
|
||||
\newcommand{\NWlink}[2]{\hyperlink{#1}{#2}}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{\usepackage[pdftex,colorlinks=true]{hyperref}}
|
||||
\documentclass{article}
|
||||
\NWuseHyperlinks
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Use a fragment}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Use a fragment}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here is a fragment.@\\
|
||||
\mbox{}\verb@ Make sure it is referenced properly.@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after nuweb has run. If nuweb fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb -h "pdftex,colorlinks=true" test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
pdflatex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
$bin/nuweb -h "pdftex,colorlinks=true" test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
pdflatex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
158
test/00/t0019a.sh
Normal file
158
test/00/t0019a.sh
Normal file
@@ -0,0 +1,158 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0019a.sh,v $-- Test test/00/t0019a.sh
|
||||
#
|
||||
#
|
||||
# Test of C++ comments
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of C++ comments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of C++ comments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test C++ comments
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
This tests C++ style comments.
|
||||
@o test.cpp -c+
|
||||
@{@<File header@>
|
||||
@<More stuff@>
|
||||
@<A little more stuff@>
|
||||
@}
|
||||
|
||||
@d File header
|
||||
@{// The comments here are explicit.
|
||||
// @f
|
||||
@}
|
||||
|
||||
@c
|
||||
Here we have a lot of stuff that is going to go into a block
|
||||
comment which we make long enough to spread over several lines.
|
||||
Here we have a lot of stuff that is going to go into a block
|
||||
comment which we make long enough to spread over several lines.
|
||||
Here we have a lot of stuff that is going to go into a block
|
||||
comment which we make long enough to spread over several lines.
|
||||
Here we have a lot of stuff that is going to go into a block
|
||||
comment which we make long enough to spread over several lines.
|
||||
Here we have a lot of stuff that is going to go into a block
|
||||
comment which we make long enough to spread over several lines.
|
||||
Here we have a lot of stuff that is going to go into a block
|
||||
comment which we make long enough to spread over several lines.
|
||||
@d More stuff
|
||||
@{@c
|
||||
This is the body of more stuff.
|
||||
@}
|
||||
|
||||
@d A little more stuff
|
||||
@{Another check on a single-line comment.
|
||||
And another check on block comments.
|
||||
@<More stuff@>
|
||||
That is the end of a little more stuff.
|
||||
@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.cpp <<"EOF"
|
||||
// File header
|
||||
// The comments here are explicit.
|
||||
// test.cpp
|
||||
|
||||
// More stuff
|
||||
// Here we have a lot of stuff that is going to go into a block
|
||||
// comment which we make long enough to spread over several lines.
|
||||
// Here we have a lot of stuff that is going to go into a block
|
||||
// comment which we make long enough to spread over several lines.
|
||||
// Here we have a lot of stuff that is going to go into a block
|
||||
// comment which we make long enough to spread over several lines.
|
||||
// Here we have a lot of stuff that is going to go into a block
|
||||
// comment which we make long enough to spread over several lines.
|
||||
// Here we have a lot of stuff that is going to go into a block
|
||||
// comment which we make long enough to spread over several lines.
|
||||
// Here we have a lot of stuff that is going to go into a block
|
||||
// comment which we make long enough to spread over several lines.
|
||||
|
||||
This is the body of more stuff.
|
||||
|
||||
// A little more stuff
|
||||
Another check on a single-line comment.
|
||||
And another check on block comments.
|
||||
// More stuff
|
||||
// Here we have a lot of stuff that is going to go into a block
|
||||
// comment which we make long enough to spread over several
|
||||
// lines. Here we have a lot of stuff that is going to go into
|
||||
// a block comment which we make long enough to spread over
|
||||
// several lines. Here we have a lot of stuff that is going
|
||||
// to go into a block comment which we make long enough to
|
||||
// spread over several lines. Here we have a lot of stuff that
|
||||
// is going to go into a block comment which we make long enough
|
||||
// to spread over several lines. Here we have a lot of stuff
|
||||
// that is going to go into a block comment which we make long
|
||||
// enough to spread over several lines. Here we have a lot
|
||||
// of stuff that is going to go into a block comment which
|
||||
// we make long enough to spread over several lines.
|
||||
This is the body of more stuff.
|
||||
|
||||
That is the end of a little more stuff.
|
||||
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.cpp test.cpp
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
126
test/00/t0020a.sh
Normal file
126
test/00/t0020a.sh
Normal file
@@ -0,0 +1,126 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0020a.sh,v $-- Test test/00/t0020a.sh
|
||||
#
|
||||
#
|
||||
# Test of include paths
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of include paths" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of include paths" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test include paths
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here is the main.
|
||||
@i testincl.w
|
||||
Still in main
|
||||
@i incltest.w
|
||||
End in main.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat >testincl.w <<"EOF"
|
||||
Here is top level include file.
|
||||
EOF
|
||||
|
||||
cat >incltest.w <<"EOF"
|
||||
Here is include file that must be searched for.
|
||||
EOF
|
||||
|
||||
mkdir lvl1
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
mkdir lvl1/lvl2
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
mv incltest.w lvl1/lvl2
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here is the main.
|
||||
Here is top level include file.
|
||||
Still in main
|
||||
Here is include file that must be searched for.
|
||||
End in main.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb -I lvl1 -I lvl1/lvl2 test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
126
test/00/t0021a.sh
Normal file
126
test/00/t0021a.sh
Normal file
@@ -0,0 +1,126 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0021a.sh,v $-- Test test/00/t0020a.sh
|
||||
#
|
||||
#
|
||||
# Test of include paths
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of include paths" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of include paths" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test include paths
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here is the main.
|
||||
@i testincl.w
|
||||
Still in main
|
||||
@i incltest.w
|
||||
End in main.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat >testincl.w <<"EOF"
|
||||
Here is top level include file.
|
||||
EOF
|
||||
|
||||
cat >incltest.w <<"EOF"
|
||||
Here is include file that must be searched for.
|
||||
EOF
|
||||
|
||||
mkdir lvl1
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
mkdir lvl1/lvl2
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
mv incltest.w lvl1/lvl2
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here is the main.
|
||||
Here is top level include file.
|
||||
Still in main
|
||||
Here is include file that must be searched for.
|
||||
End in main.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb -Ilvl1 -Ilvl1/lvl2 test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
111
test/00/t0022a.sh
Normal file
111
test/00/t0022a.sh
Normal file
@@ -0,0 +1,111 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0022a.sh,v $-- Test test/00/t0022a.sh
|
||||
#
|
||||
#
|
||||
# Test that missing includes don't bomb
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test that missing includes don't bomb" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test that missing includes don't bomb" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test ???
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here follows a file that exists.
|
||||
@i exist.w
|
||||
Here follows a file that doesn't exist.
|
||||
@i non-exist.w
|
||||
No more files.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat >exist.w <<"EOF"
|
||||
Here is the existing file.
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Here follows a file that exists.
|
||||
Here is the existing file.
|
||||
Here follows a file that doesn't exist.
|
||||
No more files.
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
110
test/00/t0023a.sh
Normal file
110
test/00/t0023a.sh
Normal file
@@ -0,0 +1,110 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0023a.sh,v $-- Test test/00/t0023a.sh
|
||||
#
|
||||
#
|
||||
# Test Perl comments
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test Perl comments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test Perl comments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@c
|
||||
Here is a block comment that takes many lines.
|
||||
Here is a block comment that takes many lines.
|
||||
Here is a block comment that takes many lines.
|
||||
Here is a block comment that takes many lines.
|
||||
@o test -cp
|
||||
@{@<First stuff@>
|
||||
Now a block comment.
|
||||
@c
|
||||
@<Second stuff@>
|
||||
End
|
||||
@}
|
||||
|
||||
@d First...
|
||||
@{This is the body of first stuff.
|
||||
@}
|
||||
|
||||
@d Second...
|
||||
@{Yes, it's the second stuff.
|
||||
@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected <<"EOF"
|
||||
# First stuff
|
||||
This is the body of first stuff.
|
||||
|
||||
Now a block comment.
|
||||
# Here is a block comment that takes many lines. Here is a block
|
||||
# comment that takes many lines. Here is a block comment that
|
||||
# takes many lines. Here is a block comment that takes many lines.
|
||||
|
||||
# Second stuff
|
||||
Yes, it's the second stuff.
|
||||
|
||||
End
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
397
test/00/t0024a.sh
Normal file
397
test/00/t0024a.sh
Normal file
@@ -0,0 +1,397 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0024a.sh,v $-- Test test/00/t0024a.sh
|
||||
#
|
||||
#
|
||||
# Test of Local and global sectors
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Local and global sectors" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Local and global sectors" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Local and global sectors
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.actual.c
|
||||
@{ First use in global
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@d Frag 1
|
||||
@{Global sector line one.
|
||||
@}
|
||||
@s
|
||||
@d Frag 1
|
||||
@{First sector line one.
|
||||
@}
|
||||
@o test.actual.c
|
||||
@{Use first local
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@m
|
||||
@s
|
||||
@o test.actual.c
|
||||
@{Use second local
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@d Frag 1
|
||||
@{Second sector line one.
|
||||
@}
|
||||
@m
|
||||
@S
|
||||
@d Frag 1
|
||||
@{Global sector line two.
|
||||
@}
|
||||
@s
|
||||
@d Frag 1
|
||||
@{Third sector line one.
|
||||
@}
|
||||
@o test.actual.c
|
||||
@{Use second local
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@m
|
||||
@S
|
||||
@d Frag 1
|
||||
@{Global sector line three.
|
||||
@}
|
||||
@o test.actual.c
|
||||
@{ Last use in global
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@m
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@ First use in global@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}, \ldots\ }$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Global sector line one.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroDefBy\ \NWlink{nuweb1b}{1b}\NWlink{nuweb2a}{, 2a}\NWlink{nuweb2d}{d}.
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}\NWlink{nuweb2e}{, 2e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
|
||||
\NWtarget{nuweb1c}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {1c}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@First sector line one.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1d}{1d}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap4}\raggedright\small
|
||||
\NWtarget{nuweb1d}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {1d}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Use first local@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 1\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1d}{1d}.}
|
||||
\end{list}}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap5}\raggedright\small
|
||||
\NWtarget{nuweb1e}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {1e}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Use second local@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb1f}{1f}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap6}\raggedright\small
|
||||
\NWtarget{nuweb1f}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {1f}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Second sector line one.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1e}{1e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 1\nobreak\ {\footnotesize \NWlink{nuweb1f}{1f}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1e}{1e}.}
|
||||
\end{list}}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap7}\raggedright\small
|
||||
\NWtarget{nuweb2a}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {2a}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Global sector line two.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroDefBy\ \NWlink{nuweb1b}{1b}\NWlink{nuweb2a}{, 2a}\NWlink{nuweb2d}{d}.
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}\NWlink{nuweb2e}{, 2e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap8}\raggedright\small
|
||||
\NWtarget{nuweb2b}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {2b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Third sector line one.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb2c}{2c}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap9}\raggedright\small
|
||||
\NWtarget{nuweb2c}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {2c}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Use second local@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 1\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb2c}{2c}.}
|
||||
\end{list}}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap10}\raggedright\small
|
||||
\NWtarget{nuweb2d}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {2d}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Global sector line three.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroDefBy\ \NWlink{nuweb1b}{1b}\NWlink{nuweb2a}{, 2a}\NWlink{nuweb2d}{d}.
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}\NWlink{nuweb2e}{, 2e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap11}\raggedright\small
|
||||
\NWtarget{nuweb2e}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {2e}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@ Last use in global@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}, \ldots\ }$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 1\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}\NWlink{nuweb2a}{, 2a}\NWlink{nuweb2d}{d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1a}{1a}\NWlink{nuweb2e}{, 2e}.
|
||||
}
|
||||
\end{list}}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
First use in global
|
||||
Global sector line one.
|
||||
Global sector line two.
|
||||
Global sector line three.
|
||||
|
||||
Use first local
|
||||
First sector line one.
|
||||
|
||||
Use second local
|
||||
Second sector line one.
|
||||
|
||||
Use second local
|
||||
Third sector line one.
|
||||
|
||||
Last use in global
|
||||
Global sector line one.
|
||||
Global sector line two.
|
||||
Global sector line three.
|
||||
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.actual.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
426
test/00/t0025a.sh
Normal file
426
test/00/t0025a.sh
Normal file
@@ -0,0 +1,426 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0025a.sh,v $-- Test test/00/t0024a.sh
|
||||
#
|
||||
#
|
||||
# Test of Local and global sectors
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Local and global sectors" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Local and global sectors" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Local and global sectors
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.actual.c
|
||||
@{ First use in global
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@d Frag 1
|
||||
@{Base sector line one.
|
||||
@}
|
||||
@s
|
||||
@d Frag 1
|
||||
@{First sector line one.
|
||||
@}
|
||||
@o test.actual.c
|
||||
@{Use first local
|
||||
@<Frag 1@>
|
||||
@<+ Frag 2@>
|
||||
@}
|
||||
@m
|
||||
@s
|
||||
@o test.actual.c
|
||||
@{Use second local
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@d Frag 1
|
||||
@{Second sector line one.
|
||||
@}
|
||||
@m
|
||||
@S
|
||||
@d Frag 1
|
||||
@{Base sector line two.
|
||||
@}
|
||||
@s
|
||||
@d Frag 1
|
||||
@{Third sector line one.
|
||||
@}
|
||||
@o test.actual.c
|
||||
@{Use second local
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@m
|
||||
@S
|
||||
@d Frag 1
|
||||
@{Base sector line three.
|
||||
@}
|
||||
@o test.actual.c
|
||||
@{ Last use in global
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@d+ Frag 2
|
||||
@{Here is frag 2
|
||||
@}
|
||||
@m
|
||||
@m+
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@ First use in global@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}, \ldots\ }$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Base sector line one.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroDefBy\ \NWlink{nuweb1b}{1b}\NWlink{nuweb2a}{, 2a}\NWlink{nuweb2d}{d}.
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}\NWlink{nuweb2e}{, 2e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
|
||||
\NWtarget{nuweb1c}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {1c}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@First sector line one.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1d}{1d}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap4}\raggedright\small
|
||||
\NWtarget{nuweb1d}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {1d}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Use first local@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 2}\nobreak\ {\footnotesize \NWlink{nuweb2f}{2f}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 1\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1d}{1d}.}
|
||||
\end{list}}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap5}\raggedright\small
|
||||
\NWtarget{nuweb1e}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {1e}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Use second local@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb1f}{1f}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap6}\raggedright\small
|
||||
\NWtarget{nuweb1f}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {1f}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Second sector line one.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1e}{1e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 1\nobreak\ {\footnotesize \NWlink{nuweb1f}{1f}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1e}{1e}.}
|
||||
\end{list}}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap7}\raggedright\small
|
||||
\NWtarget{nuweb2a}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {2a}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Base sector line two.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroDefBy\ \NWlink{nuweb1b}{1b}\NWlink{nuweb2a}{, 2a}\NWlink{nuweb2d}{d}.
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}\NWlink{nuweb2e}{, 2e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap8}\raggedright\small
|
||||
\NWtarget{nuweb2b}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {2b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Third sector line one.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb2c}{2c}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap9}\raggedright\small
|
||||
\NWtarget{nuweb2c}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {2c}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Use second local@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 1\nobreak\ {\footnotesize \NWlink{nuweb2b}{2b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb2c}{2c}.}
|
||||
\end{list}}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap10}\raggedright\small
|
||||
\NWtarget{nuweb2d}{} $\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize {2d}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Base sector line three.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroDefBy\ \NWlink{nuweb1b}{1b}\NWlink{nuweb2a}{, 2a}\NWlink{nuweb2d}{d}.
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}\NWlink{nuweb2e}{, 2e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap11}\raggedright\small
|
||||
\NWtarget{nuweb2e}{} \verb@"test.actual.c"@\nobreak\ {\footnotesize {2e}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@ Last use in global@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag 1}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}, \ldots\ }$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}\NWlink{nuweb1e}{e}\NWlink{nuweb2c}{, 2c}\NWlink{nuweb2e}{e}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap12}\raggedright\small
|
||||
\NWtarget{nuweb2f}{} $\langle\,${\itshape Frag 2}\nobreak\ {\footnotesize {2f}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here is frag 2@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1d}{1d}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 1\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}\NWlink{nuweb2a}{, 2a}\NWlink{nuweb2d}{d}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1a}{1a}\NWlink{nuweb2e}{, 2e}.
|
||||
}
|
||||
\end{list}}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Frag 2\nobreak\ {\footnotesize \NWlink{nuweb2f}{2f}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1d}{1d}.}
|
||||
\end{list}}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
First use in global
|
||||
Base sector line one.
|
||||
Base sector line two.
|
||||
Base sector line three.
|
||||
|
||||
Use first local
|
||||
First sector line one.
|
||||
|
||||
Here is frag 2
|
||||
|
||||
Use second local
|
||||
Second sector line one.
|
||||
|
||||
Use second local
|
||||
Third sector line one.
|
||||
|
||||
Last use in global
|
||||
Base sector line one.
|
||||
Base sector line two.
|
||||
Base sector line three.
|
||||
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.actual.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
118
test/00/t0026a.sh
Normal file
118
test/00/t0026a.sh
Normal file
@@ -0,0 +1,118 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0026a.sh,v $-- Test test/00/t0026a.sh
|
||||
#
|
||||
#
|
||||
# Test of ???
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of ???" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of ???" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test ???
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.actual.c
|
||||
@{ First use in global
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@d Frag 1
|
||||
@{Base sector line one.
|
||||
@}
|
||||
@s
|
||||
@d Frag 1
|
||||
@{First sector line one.
|
||||
@}
|
||||
@o test.actual.c
|
||||
@{@<Frag 3@>
|
||||
@}
|
||||
@q Frag 3
|
||||
@{Use first local
|
||||
@<Frag 1@>
|
||||
@<+ Frag 2@>
|
||||
@}
|
||||
@m
|
||||
@S
|
||||
@d Frag 1
|
||||
@{Base sector line two.
|
||||
@}
|
||||
@d+ Frag 2
|
||||
@{Here is frag 2
|
||||
@}
|
||||
@m
|
||||
@m+
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
First use in global
|
||||
Base sector line one.
|
||||
Base sector line two.
|
||||
|
||||
Use first local
|
||||
@<Frag 1@>
|
||||
@<+Frag 2@>
|
||||
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.actual.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
127
test/00/t0027a.sh
Normal file
127
test/00/t0027a.sh
Normal file
@@ -0,0 +1,127 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0027a.sh,v $-- Test test/00/t0027a.sh
|
||||
#
|
||||
#
|
||||
# Test of nested global macros
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of nested global macros" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of nested global macros" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test nested global macros
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.actual.c
|
||||
@{ First use in global
|
||||
@<Frag 1@>
|
||||
@}
|
||||
@d Frag 1
|
||||
@{Base sector line one.
|
||||
@}
|
||||
@d Frag 4 uses @'thing@'
|
||||
@{Access @1
|
||||
@}
|
||||
@q Frag 5
|
||||
@{@<Frag 4 uses @<+Frag 2@>@>
|
||||
@}
|
||||
@s
|
||||
@d Frag 1
|
||||
@{First sector line one.
|
||||
@}
|
||||
@o test.actual.c
|
||||
@{@<Frag 3@>
|
||||
@}
|
||||
@q Frag 3
|
||||
@{Use first local
|
||||
@<Frag 1@>
|
||||
@<+ Frag 2@>
|
||||
@}
|
||||
@m
|
||||
@S
|
||||
@d Frag 1
|
||||
@{Base sector line two.
|
||||
@<Frag 5@>
|
||||
@}
|
||||
@d+ Frag 2
|
||||
@{Here is frag 2
|
||||
@}
|
||||
@m
|
||||
@m+
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
First use in global
|
||||
Base sector line one.
|
||||
Base sector line two.
|
||||
@<Frag 4 uses @<+Frag 2@>@>
|
||||
|
||||
|
||||
Use first local
|
||||
@<Frag 1@>
|
||||
@<+Frag 2@>
|
||||
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.actual.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
157
test/00/t0028a.sh
Normal file
157
test/00/t0028a.sh
Normal file
@@ -0,0 +1,157 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0028a.sh,v $-- Test test/00/t0028a.sh
|
||||
#
|
||||
#
|
||||
# Test of Maths in arguments
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Maths in arguments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Maths in arguments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Maths in arguments
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@d Frag with @'arg1@' and @'$arg2@'
|
||||
@{Here is the first arg:@1.
|
||||
Here is the second arg:@2.
|
||||
@}
|
||||
|
||||
@o test.c -cc
|
||||
@{Front
|
||||
@<Frag with @'$tuff@' and @'Non_sense@'@>
|
||||
Back
|
||||
@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Frag with \hbox{\slshape\sffamily arg1\/} and \hbox{\slshape\sffamily \$arg2\/}}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here is the first arg:@\hbox{\slshape\sffamily arg1\/}\verb@.@\\
|
||||
\mbox{}\verb@Here is the second arg:@\hbox{\slshape\sffamily \$arg2\/}\verb@.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Front@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Frag with \verb@$tuff@ and \verb@Non_sense@}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@Back@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Front
|
||||
/* Frag with '$tuff' and 'Non_sense' */
|
||||
Here is the first arg:$tuff.
|
||||
Here is the second arg:Non_sense.
|
||||
|
||||
Back
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
301
test/00/t0029a.sh
Normal file
301
test/00/t0029a.sh
Normal file
@@ -0,0 +1,301 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0029a.sh,v $-- Test test/00/t0029a.sh
|
||||
#
|
||||
#
|
||||
# Test of Bar in fragment names is invisible
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Bar in fragment names is invisible" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Bar in fragment names is invisible" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Bar in fragment names is invisible
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@d Atom
|
||||
@{@}
|
||||
|
||||
@d atom
|
||||
@{@}
|
||||
|
||||
@d Atomic
|
||||
@{@}
|
||||
|
||||
@d atomi...
|
||||
@{
|
||||
@}
|
||||
|
||||
@d Save |file| abc
|
||||
@{@}
|
||||
|
||||
@d Save file uvw
|
||||
@{@}
|
||||
|
||||
@d Adam
|
||||
@{@}
|
||||
|
||||
@d atoms
|
||||
@{@}
|
||||
|
||||
@o test.c
|
||||
@{@<Atom@>
|
||||
@<atom@>
|
||||
@<Save |file| abc@>
|
||||
@<Save file uvw@>
|
||||
@<Adam@>
|
||||
@<atomic@>
|
||||
@<atoms@>
|
||||
@<Atomic@>
|
||||
@}
|
||||
|
||||
@m
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Atom}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape atom}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Atomic}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap4}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape atomic}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap5}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Save |file| abc}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap6}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Save file uvw}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap7}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Adam}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap8}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape atoms}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap9}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Atom}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape atom}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Save |file| abc}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Save file uvw}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Adam}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape atomic}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape atoms}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Atomic}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Adam\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb?}{?}.}
|
||||
\item $\langle\,$Atom\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb?}{?}.}
|
||||
\item $\langle\,$atom\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb?}{?}.}
|
||||
\item $\langle\,$Atomic\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb?}{?}.}
|
||||
\item $\langle\,$atomic\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb?}{?}.}
|
||||
\item $\langle\,$atoms\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb?}{?}.}
|
||||
\item $\langle\,$Save |file| abc\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb?}{?}.}
|
||||
\item $\langle\,$Save file uvw\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb?}{?}.}
|
||||
\end{list}}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
194
test/00/t0032a.sh
Normal file
194
test/00/t0032a.sh
Normal file
@@ -0,0 +1,194 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0032a.sh,v $-- Test test/00/t0032a.sh
|
||||
#
|
||||
#
|
||||
# Test of Embedded fragments as arguments
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Embedded fragments as arguments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Embedded fragments as arguments" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Embedded fragments as arguments
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c -cc
|
||||
@{Begin
|
||||
@<Outer @'abc@' and @'def@' retuO@>
|
||||
@<Outer @'cba@' and @'fed@' retuO@>
|
||||
End
|
||||
@}
|
||||
|
||||
@d Outer @'Arg1@' and @'Arg2@' retuO
|
||||
@{Start
|
||||
@<Inner @{x@1y@2z@} rennI@>
|
||||
Finish
|
||||
@}
|
||||
|
||||
@d Inner @'Stuff@' rennI
|
||||
@{XX>>@1<<YY@}
|
||||
|
||||
@m
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Begin@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Outer \verb@abc@ and \verb@def@ retuO}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Outer \verb@cba@ and \verb@fed@ retuO}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@End@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Outer \hbox{\slshape\sffamily Arg1\/} and \hbox{\slshape\sffamily Arg2\/} retuO}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Start@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Inner \verb@xArg1yArg2z@ rennI}\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@Finish@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap4}\raggedright\small
|
||||
\NWtarget{nuweb1c}{} $\langle\,${\itshape Inner \hbox{\slshape\sffamily Stuff\/} rennI}\nobreak\ {\footnotesize {1c}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@XX>>@\hbox{\slshape\sffamily Stuff\/}\verb@<<YY@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1b}{1b}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Inner \hbox{\slshape\sffamily Stuff\/} rennI\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1b}{1b}.}
|
||||
\item $\langle\,$Outer \hbox{\slshape\sffamily Arg1\/} and \hbox{\slshape\sffamily Arg2\/} retuO\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1a}{1a}.}
|
||||
\end{list}}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Begin
|
||||
/* Outer 'abc' and 'def' retuO */
|
||||
Start
|
||||
/* Inner {xabcydefz} rennI */
|
||||
XX>>xabcydefz<<YY
|
||||
Finish
|
||||
|
||||
/* Outer 'cba' and 'fed' retuO */
|
||||
Start
|
||||
/* Inner {xcbayfedz} rennI */
|
||||
XX>>xcbayfedz<<YY
|
||||
Finish
|
||||
|
||||
End
|
||||
EOF
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
257
test/00/t0033a.sh
Normal file
257
test/00/t0033a.sh
Normal file
@@ -0,0 +1,257 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0033a.sh,v $-- Test test/00/t0032a.sh
|
||||
#
|
||||
#
|
||||
# Test of Cross-reference environment
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Cross-reference environment" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Cross-reference environment" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Cross-reference environment
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@o test.c -cc
|
||||
@{Begin
|
||||
Define abc cba
|
||||
@<Outer @'abc@' and @'def@' retuO@>
|
||||
@<Outer @'cba@' and @'fed@' retuO@>
|
||||
End
|
||||
@| abc cba @}
|
||||
|
||||
@d Outer @'Arg1@' and @'Arg2@' retuO
|
||||
@{Start
|
||||
Define def fed
|
||||
Use abc cba
|
||||
@<Inner @{x@1y@2z@} rennI@>
|
||||
Finish
|
||||
@| def fed@}
|
||||
|
||||
@d Inner @'Stuff@' rennI
|
||||
@{XX>>@1<<YY@}
|
||||
|
||||
@o test.c -cc
|
||||
@{More stuff
|
||||
@}
|
||||
|
||||
@d Outer...
|
||||
@{Added stuff to force fragment defined
|
||||
cross-reference entry.
|
||||
@}
|
||||
|
||||
@m
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Begin@\\
|
||||
\mbox{}\verb@Define abc cba@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Outer \verb@abc@ and \verb@def@ retuO}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}, \ldots\ }$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Outer \verb@cba@ and \verb@fed@ retuO}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}, \ldots\ }$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@End@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}.
|
||||
\item \NWtxtIdentsDefed\nobreak\ \verb@abc@\nobreak\ \NWlink{nuweb1b}{1b}, \verb@cba@\nobreak\ \NWlink{nuweb1b}{1b}.\item \NWtxtIdentsUsed\nobreak\ \verb@def@\nobreak\ \NWlink{nuweb1b}{1b}, \verb@fed@\nobreak\ \NWlink{nuweb1b}{1b}.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Outer \hbox{\slshape\sffamily Arg1\/} and \hbox{\slshape\sffamily Arg2\/} retuO}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Start@\\
|
||||
\mbox{}\verb@Define def fed@\\
|
||||
\mbox{}\verb@Use abc cba@\\
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Inner \verb@xArg1yArg2z@ rennI}\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@Finish@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroDefBy\ \NWlink{nuweb1b}{1b}\NWlink{nuweb1e}{e}.
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
\item \NWtxtIdentsDefed\nobreak\ \verb@def@\nobreak\ \NWlink{nuweb1a}{1a}, \verb@fed@\nobreak\ \NWlink{nuweb1a}{1a}.\item \NWtxtIdentsUsed\nobreak\ \verb@abc@\nobreak\ \NWlink{nuweb1a}{1a}, \verb@cba@\nobreak\ \NWlink{nuweb1a}{1a}.
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap4}\raggedright\small
|
||||
\NWtarget{nuweb1c}{} $\langle\,${\itshape Inner \hbox{\slshape\sffamily Stuff\/} rennI}\nobreak\ {\footnotesize {1c}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@XX>>@\hbox{\slshape\sffamily Stuff\/}\verb@<<YY@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1b}{1b}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap5}\raggedright\small
|
||||
\NWtarget{nuweb1d}{} \verb@"test.c"@\nobreak\ {\footnotesize {1d}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@More stuff@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtFileDefBy\ \NWlink{nuweb1a}{1a}\NWlink{nuweb1d}{d}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap6}\raggedright\small
|
||||
\NWtarget{nuweb1e}{} $\langle\,${\itshape Outer \hbox{\slshape\sffamily Arg1\/} and \hbox{\slshape\sffamily Arg2\/} retuO}\nobreak\ {\footnotesize {1e}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Added stuff to force fragment defined@\\
|
||||
\mbox{}\verb@cross-reference entry.@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroDefBy\ \NWlink{nuweb1b}{1b}\NWlink{nuweb1e}{e}.
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Inner \hbox{\slshape\sffamily Stuff\/} rennI\nobreak\ {\footnotesize \NWlink{nuweb1c}{1c}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1b}{1b}.}
|
||||
\item $\langle\,$Outer \hbox{\slshape\sffamily Arg1\/} and \hbox{\slshape\sffamily Arg2\/} retuO\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}\NWlink{nuweb1e}{e}}$\,\rangle$ {\footnotesize {\NWtxtRefIn} \NWlink{nuweb1a}{1a}.}
|
||||
\end{list}}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Begin
|
||||
Define abc cba
|
||||
/* Outer 'abc' and 'def' retuO 1b */
|
||||
Start
|
||||
Define def fed
|
||||
Use abc cba
|
||||
/* Inner {xabcydefz} rennI 1c */
|
||||
XX>>xabcydefz<<YY
|
||||
Finish
|
||||
Added stuff to force fragment defined
|
||||
cross-reference entry.
|
||||
|
||||
/* Outer 'cba' and 'fed' retuO 1b */
|
||||
Start
|
||||
Define def fed
|
||||
Use abc cba
|
||||
/* Inner {xcbayfedz} rennI 1c */
|
||||
XX>>xcbayfedz<<YY
|
||||
Finish
|
||||
Added stuff to force fragment defined
|
||||
cross-reference entry.
|
||||
|
||||
End
|
||||
More stuff
|
||||
EOF
|
||||
|
||||
$bin/nuweb -x test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
|
||||
$bin/nuweb -x test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
195
test/00/t0034a.sh
Normal file
195
test/00/t0034a.sh
Normal file
@@ -0,0 +1,195 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0034a.sh,v $-- Test test/00/t0034a.sh
|
||||
#
|
||||
#
|
||||
# Test of Listing package
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Listing package" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Listing package" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Listing package
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\usepackage{listings}
|
||||
\begin{document}
|
||||
|
||||
\lstset{extendedchars=true,keepspaces=true,language=C}
|
||||
|
||||
@o test.c -cc
|
||||
@{int
|
||||
main(int argc, char ** argv)
|
||||
{
|
||||
@<Body of main@>
|
||||
}
|
||||
@}
|
||||
|
||||
@d Body...
|
||||
@{int in;
|
||||
unsigned char out[20];
|
||||
|
||||
while (scanf("%x", &in) == 1)
|
||||
{
|
||||
@<Do one item@>
|
||||
}
|
||||
return 0;@}
|
||||
|
||||
@d Do...
|
||||
@{int n = mangle(in, out);
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
printf("%02x", out[i]);
|
||||
printf("\n");@}
|
||||
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\usepackage{listings}
|
||||
\begin{document}
|
||||
|
||||
\lstset{extendedchars=true,keepspaces=true,language=C}
|
||||
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} \verb@"test.c"@\nobreak\ {\footnotesize {?}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\lstinline@int@\\
|
||||
\mbox{}\lstinline@main(int argc, char ** argv)@\\
|
||||
\mbox{}\lstinline@{@\\
|
||||
\mbox{}\lstinline@ @\hbox{$\langle\,${\itshape Body of main}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\lstinline@@\\
|
||||
\mbox{}\lstinline@}@\\
|
||||
\mbox{}\lstinline@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Body of main}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\lstinline@int in;@\\
|
||||
\mbox{}\lstinline@unsigned char out[20];@\\
|
||||
\mbox{}\lstinline@@\\
|
||||
\mbox{}\lstinline@while (scanf("%x", &in) == 1)@\\
|
||||
\mbox{}\lstinline@{@\\
|
||||
\mbox{}\lstinline@ @\hbox{$\langle\,${\itshape Do one item}\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$}\lstinline@@\\
|
||||
\mbox{}\lstinline@}@\\
|
||||
\mbox{}\lstinline@return 0;@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap3}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Do one item}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\lstinline@int n = mangle(in, out);@\\
|
||||
\mbox{}\lstinline@@\\
|
||||
\mbox{}\lstinline@for (int i = 0; i < n; i++)@\\
|
||||
\mbox{}\lstinline@ printf("%02x", out[i]);@\\
|
||||
\mbox{}\lstinline@printf("\n");@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb?}{?}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb -l test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
150
test/00/t0035a.sh
Normal file
150
test/00/t0035a.sh
Normal file
@@ -0,0 +1,150 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0035a.sh,v $-- Test test/00/t0018a.sh
|
||||
#
|
||||
#
|
||||
# Test of hyperlinks using -r
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of hyperlinks using -r" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of hyperlinks using -r" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test hyperlinks using -r
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\usepackage[pdftex,colorlinks=true]{hyperref}
|
||||
\begin{document}
|
||||
@o test.c -cc
|
||||
@{@<Use a fragment@>
|
||||
@}
|
||||
@d Use...
|
||||
@{Here is a fragment.
|
||||
Make sure it is referenced properly.@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{\hypertarget{#1}{#2}}
|
||||
\newcommand{\NWlink}[2]{\hyperlink{#1}{#2}}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\usepackage[pdftex,colorlinks=true]{hyperref}
|
||||
\begin{document}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb1a}{} \verb@"test.c"@\nobreak\ {\footnotesize {1a}}$\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@@\hbox{$\langle\,${\itshape Use a fragment}\nobreak\ {\footnotesize \NWlink{nuweb1b}{1b}}$\,\rangle$}\verb@@\\
|
||||
\mbox{}\verb@@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap2}\raggedright\small
|
||||
\NWtarget{nuweb1b}{} $\langle\,${\itshape Use a fragment}\nobreak\ {\footnotesize {1b}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Here is a fragment.@\\
|
||||
\mbox{}\verb@ Make sure it is referenced properly.@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item \NWtxtMacroRefIn\ \NWlink{nuweb1a}{1a}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after nuweb has run. If nuweb fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb -r test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
pdflatex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
$bin/nuweb -r test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
pdflatex test
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
129
test/00/t0036a.sh
Normal file
129
test/00/t0036a.sh
Normal file
@@ -0,0 +1,129 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0036a.sh,v $-- Test test/00/t0036a.sh
|
||||
#
|
||||
#
|
||||
# Test of Empty macro index
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of Empty macro index" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of Empty macro index" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test Empty macro index
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Test text.
|
||||
@d Fragment one
|
||||
@{Stuff 1@}
|
||||
|
||||
@s
|
||||
No fragments here.
|
||||
@m
|
||||
@S
|
||||
@m
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.tex <<"EOF"
|
||||
\newcommand{\NWtarget}[2]{#2}
|
||||
\newcommand{\NWlink}[2]{#2}
|
||||
\newcommand{\NWtxtMacroDefBy}{Fragment defined by}
|
||||
\newcommand{\NWtxtMacroRefIn}{Fragment referenced in}
|
||||
\newcommand{\NWtxtMacroNoRef}{Fragment never referenced}
|
||||
\newcommand{\NWtxtDefBy}{Defined by}
|
||||
\newcommand{\NWtxtRefIn}{Referenced in}
|
||||
\newcommand{\NWtxtNoRef}{Not referenced}
|
||||
\newcommand{\NWtxtFileDefBy}{File defined by}
|
||||
\newcommand{\NWtxtIdentsUsed}{Uses:}
|
||||
\newcommand{\NWtxtIdentsNotUsed}{Never used}
|
||||
\newcommand{\NWtxtIdentsDefed}{Defines:}
|
||||
\newcommand{\NWsep}{${\diamond}$}
|
||||
\newcommand{\NWnotglobal}{(not defined globally)}
|
||||
\newcommand{\NWuseHyperlinks}{}
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
Test text.
|
||||
\begin{flushleft} \small
|
||||
\begin{minipage}{\linewidth}\label{scrap1}\raggedright\small
|
||||
\NWtarget{nuweb?}{} $\langle\,${\itshape Fragment one}\nobreak\ {\footnotesize {?}}$\,\rangle\equiv$
|
||||
\vspace{-1ex}
|
||||
\begin{list}{}{} \item
|
||||
\mbox{}\verb@Stuff 1@{\NWsep}
|
||||
\end{list}
|
||||
\vspace{-1.5ex}
|
||||
\footnotesize
|
||||
\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item {\NWtxtMacroNoRef}.
|
||||
|
||||
\item{}
|
||||
\end{list}
|
||||
\end{minipage}\vspace{4ex}
|
||||
\end{flushleft}
|
||||
|
||||
No fragments here.
|
||||
None.
|
||||
|
||||
|
||||
|
||||
{\small\begin{list}{}{\setlength{\itemsep}{-\parsep}\setlength{\itemindent}{-\leftmargin}}
|
||||
\item $\langle\,$Fragment one\nobreak\ {\footnotesize \NWlink{nuweb?}{?}}$\,\rangle$ {\footnotesize {\NWtxtNoRef}.}
|
||||
\end{list}}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.tex test.tex
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
119
test/00/t0037a.sh
Normal file
119
test/00/t0037a.sh
Normal file
@@ -0,0 +1,119 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $RCSfile: t0037a.sh,v $-- Test test/00/t0006a.sh
|
||||
#
|
||||
#
|
||||
# Test of big definitions
|
||||
#
|
||||
work=${TMPDIR:-/tmp}/$$
|
||||
PAGER=cat
|
||||
export PAGER
|
||||
umask 022
|
||||
here=`pwd`
|
||||
if test $? -ne 0 ; then exit 2; fi
|
||||
SHELL=/bin/sh
|
||||
export SHELL
|
||||
|
||||
bin="$here/${1-.}"
|
||||
|
||||
pass()
|
||||
{
|
||||
set +x
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 0
|
||||
}
|
||||
fail()
|
||||
{
|
||||
set +x
|
||||
echo "FAILED test of big definitions" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 1
|
||||
}
|
||||
no_result()
|
||||
{
|
||||
set +x
|
||||
echo "NO RESULT for test of big definitions" 1>&2
|
||||
cd $here
|
||||
rm -rf $work
|
||||
exit 2
|
||||
}
|
||||
trap \"no_result\" 1 2 3 15
|
||||
|
||||
mkdir $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
cd $work
|
||||
if test $? -ne 0 ; then no_result; fi
|
||||
|
||||
#
|
||||
# test big definitions
|
||||
#
|
||||
|
||||
cat > test.w <<"EOF"
|
||||
\documentclass{article}
|
||||
\begin{document}
|
||||
@O test.c -cc
|
||||
@{Call the macro
|
||||
@<Fragment with @<A macro argument@> as parameter@>
|
||||
@<Second frag with @<A macro argument@> as parameter@>
|
||||
@<Third frag with @<A macro argument@> as parameter@>
|
||||
@}
|
||||
|
||||
@D Fragment with @'Begin macro@'...
|
||||
@{@1<<<Here 'tis.
|
||||
That argument was at the beginning of the fragment@}
|
||||
|
||||
@D Second frag with @'Begin line@'...
|
||||
@{Here is the beginning of the second macro
|
||||
@1<<<That is the argument
|
||||
And this is the end of the second frag@}
|
||||
|
||||
@D Third frag with @'Embedded@'...
|
||||
@{Here is the argument>>>@1<<<That was it.@}
|
||||
|
||||
@D A macro argument
|
||||
@{Hello folks@}
|
||||
\end{document}
|
||||
EOF
|
||||
|
||||
cat > test.expected.c <<"EOF"
|
||||
Call the macro
|
||||
/* Fragment with <A macro argument> as parameter 1b */
|
||||
/* A macro argument 1e */
|
||||
Hello folks<<<Here 'tis.
|
||||
That argument was at the beginning of the fragment
|
||||
/* Second frag with <A macro argument> as parameter 1c */
|
||||
Here is the beginning of the second macro
|
||||
/* A macro argument 1e */
|
||||
Hello folks<<<That is the argument
|
||||
And this is the end of the second frag
|
||||
/* Third frag with <A macro argument> as parameter 1d */
|
||||
Here is the argument>>>Hello folks<<<That was it.
|
||||
EOF
|
||||
|
||||
# [Add other files here. Avoid any extra processing such as
|
||||
# decompression until after demo has run. If demo fails this script
|
||||
# can save time by not decompressing. ]
|
||||
|
||||
$bin/nuweb -x test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
latex test
|
||||
|
||||
$bin/nuweb -x test.w
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
diff -a --context test.expected.c test.c
|
||||
if test $? -ne 0 ; then fail; fi
|
||||
|
||||
# [Add other sub-tests that might be failed here. If they need files
|
||||
# created above to be decompressed, decompress them here ; this saves
|
||||
# time if demo fails or the text-based sub-test fails.]
|
||||
|
||||
#
|
||||
# Only definite negatives are possible.
|
||||
# The functionality exercised by this test appears to work,
|
||||
# no other guarantees are made.
|
||||
#
|
||||
pass
|
Reference in New Issue
Block a user