ref: 78c8c41519032385bda232d10bf1043600de98ed
parent: 25b8563eb195ab2cff3e0ee24e3b947fab2ae323
author: Ali Gholami Rudi <ali@rudi.ir>
date: Thu Feb 6 13:08:36 EST 2014
roff.h: describe the meaning of function prefixes
--- a/adj.c
+++ b/adj.c
@@ -1,3 +1,4 @@
+/* adjustment buffer for putting words into lines */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--- a/char.c
+++ b/char.c
@@ -1,3 +1,4 @@
+/* reading characters and escapes */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
--- a/clr.c
+++ b/clr.c
@@ -1,3 +1,4 @@
+/* color management */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
--- a/cp.c
+++ b/cp.c
@@ -1,3 +1,4 @@
+/* copy-mode character interpretation */
#include <stdio.h>
#include <stdlib.h>
#include "roff.h"
--- a/dev.c
+++ b/dev.c
@@ -1,3 +1,4 @@
+/* output device */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
--- a/draw.c
+++ b/draw.c
@@ -1,3 +1,4 @@
+/* helper for drawing commands in ren.c */
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
--- a/eval.c
+++ b/eval.c
@@ -1,3 +1,4 @@
+/* evaluation of integer expressions */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
--- a/font.c
+++ b/font.c
@@ -1,3 +1,4 @@
+/* font handling */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--- a/hyph.c
+++ b/hyph.c
@@ -1,3 +1,4 @@
+/* hyphenation */
#include <ctype.h>
#include <string.h>
#include <stdio.h>
--- a/in.c
+++ b/in.c
@@ -1,3 +1,4 @@
+/* input stream management */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--- a/map.c
+++ b/map.c
@@ -1,3 +1,4 @@
+/* mapping register/macro names to indices */
#include <stdio.h>
#include <string.h>
#include "roff.h"
--- a/out.c
+++ b/out.c
@@ -1,3 +1,4 @@
+/* generating troff output */
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
--- a/reg.c
+++ b/reg.c
@@ -1,3 +1,4 @@
+/* registers and environments */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
--- a/ren.c
+++ b/ren.c
@@ -1,3 +1,4 @@
+/* rendering lines and managing traps */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
--- a/roff.h
+++ b/roff.h
@@ -1,3 +1,26 @@
+/*
+ * Most functions and variables in neatroff are prefixed with tokens
+ * that indicate their purpose, such as:
+ *
+ * + tr_xyz: the implementation of troff request .xyz (mostly tr.c)
+ * + in_xyz: input layer (in.c)
+ * + cp_xyz: copy-mode interpretation layer (cp.c)
+ * + ren_xyz: rendering characters into lines (ren.c)
+ * + out_xyz: output layer for generating troff output (out.c)
+ * + dev_xyz: output devices (dev.c)
+ * + num_xyz: number registers (reg.c)
+ * + str_xyz: string registers (reg.c)
+ * + env_xyz: environments (reg.c)
+ * + eval_xyz: integer expression evaluation (eval.c)
+ * + font_xyz: fonts (font.c)
+ * + sbuf_xyz: variable length string buffers (sbuf.c)
+ * + wb_xyz: word buffers (wb.c)
+ * + adj_xyz: line adjustment buffers (adj.c)
+ * + n_xyz: builtin number register xyz
+ * + c_xyz: characters for requests like hc and mc
+ *
+ */
+
/* predefined array limits */
#define PATHLEN 1024 /* path length */
#define NFILES 16 /* number of input files */
@@ -43,7 +66,7 @@
extern int c_ec; /* escape character (\) */
extern int c_cc; /* basic control character (.) */
extern int c_c2; /* no-break control character (') */
-#define c_ni 4 /* non-interpreted copy mode escape */
+#define c_ni 4 /* non-interpreted copy-mode escape */
#define c_hc env_hc()/* hyphenation character */
#define c_mc env_mc()/* margin character (.mc) */
#define c_tc env_tc()
@@ -168,9 +191,9 @@
void in_pushnl(char *s, char **args);
void in_so(char *path); /* .so request */
void in_nx(char *path); /* .nx request */
-void in_ex(void); /* .nx request */
+void in_ex(void); /* .ex request */
void in_lf(char *path, int ln); /* .lf request */
-void in_queue(char *path); /* .ex request */
+void in_queue(char *path); /* queue the given input file */
char *in_arg(int i); /* look up argument */
int in_nargs(void); /* number of arguments */
void in_back(int c); /* push back input character */
--- a/sbuf.c
+++ b/sbuf.c
@@ -1,3 +1,4 @@
+/* variable length string buffer */
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
--- a/tr.c
+++ b/tr.c
@@ -1,3 +1,4 @@
+/* built-in troff requests */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
--- a/wb.c
+++ b/wb.c
@@ -1,3 +1,4 @@
+/* word buffer */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>