diff options
author | etheisen <etheisen@cvs.openbsd.org> | 1996-09-14 21:41:20 +0000 |
---|---|---|
committer | etheisen <etheisen@cvs.openbsd.org> | 1996-09-14 21:41:20 +0000 |
commit | 961932670a2145334f6799e8faad1459e9f5ddad (patch) | |
tree | 6e9062fbf6c891ba36b24f47e1bbea23f09f349d /gnu | |
parent | 9fa32e4a0de3f01fefc84289fa4f912316b143ed (diff) |
Fix prefix and remove intermediate files.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/groff/Makefile.bsd-wrapper | 4 | ||||
-rw-r--r-- | gnu/usr.bin/groff/eqn/eqn.cc | 1277 | ||||
-rw-r--r-- | gnu/usr.bin/groff/eqn/eqn.tab.h | 67 | ||||
-rw-r--r-- | gnu/usr.bin/groff/pic/pic.tab.h | 129 | ||||
-rw-r--r-- | gnu/usr.bin/groff/refer/label.cc | 1712 |
5 files changed, 2 insertions, 3187 deletions
diff --git a/gnu/usr.bin/groff/Makefile.bsd-wrapper b/gnu/usr.bin/groff/Makefile.bsd-wrapper index 925c6f6e07c..23d79d4e552 100644 --- a/gnu/usr.bin/groff/Makefile.bsd-wrapper +++ b/gnu/usr.bin/groff/Makefile.bsd-wrapper @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.1 1996/09/14 20:20:39 etheisen Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.2 1996/09/14 21:41:16 etheisen Exp $ # # groff config # -PREFIX= /usr/ +PREFIX= /usr DATASUBDIR= /usr/share FONTDIR= /usr/share/groff_font INDEXDIR= /usr/share/dict/papers diff --git a/gnu/usr.bin/groff/eqn/eqn.cc b/gnu/usr.bin/groff/eqn/eqn.cc deleted file mode 100644 index 1fdda611201..00000000000 --- a/gnu/usr.bin/groff/eqn/eqn.cc +++ /dev/null @@ -1,1277 +0,0 @@ -#if defined(__STDC__) || defined(__cplusplus) -#define YYCONST const -#define YYPARAMS(x) x -#define YYDEFUN(name, arglist, args) name(args) -#define YYAND , -#define YYPTR void * -#else -#define YYCONST -#define YYPARAMS(x) () -#define YYDEFUN(name, arglist, args) name arglist args; -#define YYAND ; -#define YYPTR char * -#endif -#ifndef lint -YYCONST static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley +Cygnus.28) 01/20/91"; -#endif -#define YYBYACC 1 -#ifndef YYDONT_INCLUDE_STDIO -#include <stdio.h> -#endif -#ifdef __cplusplus -#include <stdlib.h> /* for malloc/realloc/free */ -#endif -#line 20 "eqn.y" -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include "lib.h" -#include "box.h" -extern int non_empty_flag; -char *strsave(const char *); -int yylex(); -void yyerror(const char *); -#line 32 "eqn.y" -typedef union { - char *str; - box *b; - pile_box *pb; - matrix_box *mb; - int n; - column *col; -} YYSTYPE; -#line 45 "y.tab.c" -#define OVER 257 -#define SMALLOVER 258 -#define SQRT 259 -#define SUB 260 -#define SUP 261 -#define LPILE 262 -#define RPILE 263 -#define CPILE 264 -#define PILE 265 -#define LEFT 266 -#define RIGHT 267 -#define TO 268 -#define FROM 269 -#define SIZE 270 -#define FONT 271 -#define ROMAN 272 -#define BOLD 273 -#define ITALIC 274 -#define FAT 275 -#define ACCENT 276 -#define BAR 277 -#define UNDER 278 -#define ABOVE 279 -#define TEXT 280 -#define QUOTED_TEXT 281 -#define FWD 282 -#define BACK 283 -#define DOWN 284 -#define UP 285 -#define MATRIX 286 -#define COL 287 -#define LCOL 288 -#define RCOL 289 -#define CCOL 290 -#define MARK 291 -#define LINEUP 292 -#define TYPE 293 -#define VCENTER 294 -#define PRIME 295 -#define SPLIT 296 -#define NOSPLIT 297 -#define UACCENT 298 -#define SPECIAL 299 -#define SPACE 300 -#define GFONT 301 -#define GSIZE 302 -#define DEFINE 303 -#define NDEFINE 304 -#define TDEFINE 305 -#define SDEFINE 306 -#define UNDEF 307 -#define IFDEF 308 -#define INCLUDE 309 -#define DELIM 310 -#define CHARTYPE 311 -#define SET 312 -#define GRFONT 313 -#define GBFONT 314 -#define YYERRCODE 256 -static YYCONST short yylhs[] = { -1, - 0, 0, 6, 6, 1, 1, 1, 2, 2, 2, - 2, 2, 3, 3, 3, 3, 4, 4, 7, 7, - 7, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 8, 11, 11, 12, 12, 13, - 13, 16, 16, 15, 15, 14, 14, 14, 14, 9, - 9, 10, 10, 10, -}; -static YYCONST short yylen[] = { 2, - 0, 1, 1, 2, 1, 2, 2, 1, 3, 3, - 5, 5, 1, 2, 3, 3, 1, 3, 1, 3, - 5, 1, 1, 2, 2, 1, 1, 1, 3, 2, - 2, 2, 2, 4, 5, 3, 2, 2, 2, 3, - 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, - 3, 3, 2, 3, 1, 1, 3, 3, 4, 1, - 2, 1, 3, 3, 4, 2, 2, 2, 2, 1, - 1, 1, 1, 1, -}; -static YYCONST short yydefred[] = { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 22, 23, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 26, 27, 28, 0, - 0, 3, 5, 0, 13, 0, 0, 17, 14, 70, - 71, 0, 0, 55, 31, 32, 33, 30, 73, 74, - 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 6, 7, 0, 0, 24, 25, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 37, 38, - 39, 0, 4, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 60, 0, - 0, 29, 15, 16, 9, 0, 0, 20, 18, 40, - 41, 0, 58, 0, 0, 0, 0, 66, 67, 68, - 69, 34, 61, 0, 0, 0, 0, 59, 35, 0, - 0, 0, 11, 12, 21, 0, 64, 0, 0, 65, -}; -static YYCONST short yydgoto[] = { 31, - 32, 33, 34, 35, 36, 84, 38, 43, 44, 52, - 85, 45, 98, 99, 118, 131, -}; -static YYCONST short yysindex[] = { 1488, - 1527, -120, -120, -120, -120, -123, -249, -249, 1566, 1566, - 1566, 1566, 0, 0, -249, -249, -249, -249, -115, 1488, - 1488, -249, 1566, -256, -251, -249, 0, 0, 0, 1488, - 0, 0, 0, -221, 0, -233, 1488, 0, 0, 0, - 0, 1488, -85, 0, 0, 0, 0, 0, 0, 0, - 0, 1488, 1566, 1566, -195, -195, -195, -195, 1566, 1566, - 1566, 1566, -272, 0, 0, 1566, -195, 0, 0, 1566, - 1402, 1527, 1527, 1527, 1527, 1566, 1566, 1566, 0, 0, - 0, 1566, 0, 1488, -113, 1488, 1444, -195, -195, -195, - -195, -195, -195, -117, -117, -117, -117, -118, 0, -195, - -195, 0, 0, 0, 0, -167, -189, 0, 0, 0, - 0, 1488, 0, -106, -123, 1488, -83, 0, 0, 0, - 0, 0, 0, 1527, 1527, 1566, 1488, 0, 0, 1488, - -105, 1488, 0, 0, 0, 1488, 0, -104, 1488, 0, -}; -static YYCONST short yyrindex[] = { 41, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 1220, 46, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 85, 128, 363, 406, 0, 0, - 0, 0, 0, 0, 0, 0, 449, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, -103, 0, 0, 185, 492, 727, 770, - 813, 856, 1091, 0, 0, 0, 0, 0, 0, 1134, - 1177, 0, 0, 0, 0, 42, 1220, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -102, 0, 0, -101, - 0, 0, 0, 0, 0, 0, 0, 0, -99, 0, -}; -static YYCONST short yygindex[] = { 0, - -7, -69, 3, -66, 458, 9, -26, 52, 27, -63, - -32, 54, 0, -35, 2, -59, -}; -#define YYTABLESIZE 1865 -static YYCONST short yytable[] = { 49, - 8, 50, 42, 39, 105, 116, 122, 63, 37, 8, - 109, 113, 64, 65, 94, 95, 96, 97, 128, 137, - 140, 56, 57, 62, 68, 63, 76, 77, 69, 83, - 40, 41, 51, 53, 54, 72, 73, 86, 71, 132, - 1, 10, 78, 79, 80, 2, 74, 75, 66, 108, - 10, 129, 70, 114, 133, 134, 46, 47, 48, 135, - 87, 81, 123, 83, 82, 0, 59, 60, 61, 62, - 76, 126, 138, 0, 103, 104, 83, 106, 0, 83, - 78, 79, 80, 0, 42, 0, 78, 79, 80, 72, - 73, 0, 0, 42, 8, 0, 119, 120, 121, 81, - 124, 125, 82, 0, 0, 81, 0, 0, 82, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, - 127, 0, 83, 8, 130, 8, 8, 43, 0, 0, - 0, 83, 0, 0, 0, 10, 43, 0, 0, 0, - 130, 51, 0, 0, 139, 117, 117, 117, 117, 0, - 0, 0, 0, 0, 0, 0, 40, 41, 0, 40, - 41, 0, 40, 41, 10, 112, 10, 10, 94, 95, - 96, 97, 112, 136, 136, 56, 57, 62, 42, 63, - 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 42, 0, 42, - 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 43, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 43, 0, 43, 43, 0, 0, 0, 0, 0, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 0, 0, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 0, 0, 0, - 0, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 36, - 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 0, 0, - 0, 0, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 0, 0, 44, 42, 42, 42, 42, 42, 42, 42, - 42, 44, 0, 0, 0, 42, 42, 42, 42, 0, - 42, 42, 0, 42, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 0, 0, 45, 43, 43, 43, 43, - 43, 43, 43, 43, 45, 0, 0, 0, 43, 43, - 43, 43, 0, 43, 43, 0, 43, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 36, 36, 0, 36, 36, 0, 0, 53, 0, - 0, 0, 36, 36, 0, 0, 44, 53, 0, 0, - 36, 36, 36, 36, 0, 0, 55, 56, 57, 58, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, - 67, 0, 36, 0, 0, 44, 0, 44, 44, 0, - 0, 47, 0, 0, 0, 0, 0, 0, 0, 45, - 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 88, 89, 0, 0, 0, 0, 90, 91, 92, 93, - 0, 0, 0, 100, 0, 0, 0, 101, 45, 0, - 45, 45, 0, 107, 0, 110, 0, 0, 0, 111, - 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 53, 0, 53, 53, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 47, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 47, 0, 47, 47, 0, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 0, 0, - 0, 44, 44, 44, 44, 44, 44, 44, 44, 0, - 0, 0, 0, 44, 44, 44, 44, 0, 44, 44, - 0, 44, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 0, 0, 0, 45, 45, 45, 45, 45, 45, - 45, 45, 0, 0, 0, 0, 45, 45, 45, 45, - 0, 45, 45, 0, 45, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 0, 0, 46, 53, 53, 53, - 53, 53, 53, 53, 53, 46, 0, 0, 0, 53, - 53, 53, 53, 0, 53, 53, 0, 53, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 0, 0, 48, - 47, 47, 47, 47, 47, 47, 47, 47, 48, 0, - 0, 0, 47, 47, 47, 47, 0, 47, 47, 0, - 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 49, 0, 0, 0, 0, 0, 0, 0, - 46, 49, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, - 0, 46, 46, 0, 0, 51, 0, 0, 0, 0, - 0, 0, 0, 48, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 48, 0, 48, 48, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 49, 0, 49, 49, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, - 51, 51, 0, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 0, 0, 0, 46, 46, 46, 46, 46, - 46, 46, 46, 0, 0, 0, 0, 46, 46, 46, - 46, 0, 46, 46, 0, 46, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 0, 0, 0, 48, 48, - 48, 48, 48, 48, 48, 48, 0, 0, 0, 0, - 48, 48, 48, 48, 0, 48, 48, 0, 48, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 0, 0, - 50, 49, 49, 49, 49, 49, 49, 49, 49, 50, - 0, 0, 0, 49, 49, 49, 49, 0, 49, 49, - 0, 49, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, - 51, 0, 0, 52, 51, 51, 51, 51, 51, 51, - 51, 51, 52, 0, 0, 0, 51, 51, 51, 51, - 0, 51, 51, 0, 51, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, - 0, 0, 0, 0, 50, 54, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 50, 0, 50, 50, 0, 0, 19, - 0, 0, 0, 0, 0, 0, 0, 52, 19, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 52, 0, 52, 52, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 54, - 0, 54, 54, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 19, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 19, 0, 19, 19, 0, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 0, 0, 0, 50, - 50, 50, 50, 50, 50, 50, 50, 0, 0, 0, - 0, 50, 50, 50, 50, 0, 50, 50, 0, 50, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 0, - 29, 0, 52, 52, 52, 52, 52, 52, 52, 52, - 0, 0, 0, 0, 52, 52, 52, 52, 0, 52, - 52, 0, 52, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 29, 0, 0, 54, 54, 54, 54, 54, - 54, 54, 54, 0, 0, 0, 0, 54, 54, 54, - 54, 0, 54, 54, 0, 54, 19, 19, 19, 0, - 0, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 27, 29, 0, 19, 19, - 19, 19, 19, 19, 19, 19, 0, 0, 0, 0, - 19, 19, 19, 19, 0, 19, 19, 0, 19, 0, - 0, 0, 0, 0, 30, 0, 102, 28, 0, 0, - 0, 0, 0, 0, 0, 29, 0, 27, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 30, 0, 0, 28, - 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, - 0, 27, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 30, 0, 0, 28, 0, 0, 0, 0, 0, 0, - 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, - 0, 0, 28, 0, 0, 0, 0, 0, 0, 27, - 1, 0, 0, 2, 3, 4, 5, 6, 0, 0, - 0, 7, 8, 9, 10, 11, 12, 0, 0, 0, - 0, 13, 14, 15, 16, 17, 18, 19, 30, 0, - 0, 28, 20, 21, 22, 23, 0, 24, 25, 0, - 26, 0, 1, 0, 0, 2, 3, 4, 5, 6, - 115, 0, 0, 7, 8, 9, 10, 11, 12, 0, - 0, 0, 0, 13, 14, 15, 16, 17, 18, 19, - 0, 0, 0, 0, 20, 21, 22, 23, 0, 24, - 25, 0, 26, 0, 0, 0, 1, 0, 0, 2, - 3, 4, 5, 6, 0, 0, 0, 7, 8, 9, - 10, 11, 12, 0, 0, 0, 0, 13, 14, 15, - 16, 17, 18, 19, 0, 0, 0, 0, 20, 21, - 22, 23, 0, 24, 25, 1, 26, 0, 2, 3, - 4, 5, 6, 0, 0, 0, 7, 8, 9, 10, - 11, 12, 0, 0, 0, 0, 13, 14, 15, 16, - 17, 18, 19, 0, 0, 0, 0, 0, 0, 22, - 23, 0, 24, 25, 0, 26, 0, 2, 3, 4, - 5, 6, 0, 0, 0, 7, 8, 9, 10, 11, - 12, 0, 0, 0, 0, 13, 14, 15, 16, 17, - 18, 19, 0, 0, 0, 0, 0, 0, 22, 23, - 0, 24, 25, 0, 26, -}; -static YYCONST short yycheck[] = { 123, - 0, 125, 123, 1, 74, 123, 125, 123, 0, 9, - 77, 125, 20, 21, 287, 288, 289, 290, 125, 125, - 125, 125, 125, 125, 281, 125, 260, 261, 280, 37, - 280, 281, 6, 7, 8, 257, 258, 123, 30, 123, - 0, 0, 276, 277, 278, 0, 268, 269, 22, 76, - 9, 115, 26, 86, 124, 125, 3, 4, 5, 126, - 52, 295, 98, 71, 298, -1, 15, 16, 17, 18, - 260, 261, 132, -1, 72, 73, 84, 75, -1, 87, - 276, 277, 278, -1, 0, -1, 276, 277, 278, 257, - 258, -1, -1, 9, 94, -1, 95, 96, 97, 295, - 268, 269, 298, -1, -1, 295, -1, -1, 298, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, - 112, -1, 130, 123, 116, 125, 126, 0, -1, -1, - -1, 139, -1, -1, -1, 94, 9, -1, -1, -1, - 132, 115, -1, -1, 136, 94, 95, 96, 97, -1, - -1, -1, -1, -1, -1, -1, 280, 281, -1, 280, - 281, -1, 280, 281, 123, 279, 125, 126, 287, 288, - 289, 290, 279, 279, 279, 279, 279, 279, 94, 279, - -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 123, -1, 125, - 126, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 94, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 123, -1, 125, 126, -1, -1, -1, -1, -1, 259, - 260, 261, 262, 263, 264, 265, 266, 267, -1, -1, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, -1, -1, -1, - -1, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 125, - -1, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, -1, -1, - -1, -1, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 257, 258, 259, 260, 261, 262, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - -1, -1, 0, 279, 280, 281, 282, 283, 284, 285, - 286, 9, -1, -1, -1, 291, 292, 293, 294, -1, - 296, 297, -1, 299, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, -1, -1, 0, 279, 280, 281, 282, - 283, 284, 285, 286, 9, -1, -1, -1, 291, 292, - 293, 294, -1, 296, 297, -1, 299, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 257, 258, -1, 260, 261, -1, -1, 0, -1, - -1, -1, 268, 269, -1, -1, 94, 9, -1, -1, - 276, 277, 278, 279, -1, -1, 9, 10, 11, 12, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 295, - 23, -1, 298, -1, -1, 123, -1, 125, 126, -1, - -1, 0, -1, -1, -1, -1, -1, -1, -1, 94, - 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 53, 54, -1, -1, -1, -1, 59, 60, 61, 62, - -1, -1, -1, 66, -1, -1, -1, 70, 123, -1, - 125, 126, -1, 76, -1, 78, -1, -1, -1, 82, - -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 123, -1, 125, 126, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 94, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 123, -1, 125, 126, -1, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, -1, -1, - -1, 279, 280, 281, 282, 283, 284, 285, 286, -1, - -1, -1, -1, 291, 292, 293, 294, -1, 296, 297, - -1, 299, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, -1, -1, -1, 279, 280, 281, 282, 283, 284, - 285, 286, -1, -1, -1, -1, 291, 292, 293, 294, - -1, 296, 297, -1, 299, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, -1, -1, 0, 279, 280, 281, - 282, 283, 284, 285, 286, 9, -1, -1, -1, 291, - 292, 293, 294, -1, 296, 297, -1, 299, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, -1, -1, 0, - 279, 280, 281, 282, 283, 284, 285, 286, 9, -1, - -1, -1, 291, 292, 293, 294, -1, 296, 297, -1, - 299, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, - 94, 9, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, - -1, 125, 126, -1, -1, 0, -1, -1, -1, -1, - -1, -1, -1, 94, 9, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 123, -1, 125, 126, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 94, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 123, -1, 125, 126, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 94, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 123, -1, - 125, 126, -1, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, -1, -1, -1, 279, 280, 281, 282, 283, - 284, 285, 286, -1, -1, -1, -1, 291, 292, 293, - 294, -1, 296, 297, -1, 299, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, -1, -1, -1, 279, 280, - 281, 282, 283, 284, 285, 286, -1, -1, -1, -1, - 291, 292, 293, 294, -1, 296, 297, -1, 299, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, -1, -1, - 0, 279, 280, 281, 282, 283, 284, 285, 286, 9, - -1, -1, -1, 291, 292, 293, 294, -1, 296, 297, - -1, 299, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, -1, -1, 0, 279, 280, 281, 282, 283, 284, - 285, 286, 9, -1, -1, -1, 291, 292, 293, 294, - -1, 296, 297, -1, 299, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, - -1, -1, -1, -1, 94, 9, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 123, -1, 125, 126, -1, -1, 0, - -1, -1, -1, -1, -1, -1, -1, 94, 9, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 123, -1, 125, 126, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, - -1, 125, 126, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 123, -1, 125, 126, -1, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, -1, -1, -1, 279, - 280, 281, 282, 283, 284, 285, 286, -1, -1, -1, - -1, 291, 292, 293, 294, -1, 296, 297, -1, 299, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, -1, - 9, -1, 279, 280, 281, 282, 283, 284, 285, 286, - -1, -1, -1, -1, 291, 292, 293, 294, -1, 296, - 297, -1, 299, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 9, -1, -1, 279, 280, 281, 282, 283, - 284, 285, 286, -1, -1, -1, -1, 291, 292, 293, - 294, -1, 296, 297, -1, 299, 257, 258, 259, -1, - -1, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 94, 9, -1, 279, 280, - 281, 282, 283, 284, 285, 286, -1, -1, -1, -1, - 291, 292, 293, 294, -1, 296, 297, -1, 299, -1, - -1, -1, -1, -1, 123, -1, 125, 126, -1, -1, - -1, -1, -1, -1, -1, 9, -1, 94, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 123, -1, -1, 126, - -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, - -1, 94, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 123, -1, -1, 126, -1, -1, -1, -1, -1, -1, - 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, - -1, -1, 126, -1, -1, -1, -1, -1, -1, 94, - 259, -1, -1, 262, 263, 264, 265, 266, -1, -1, - -1, 270, 271, 272, 273, 274, 275, -1, -1, -1, - -1, 280, 281, 282, 283, 284, 285, 286, 123, -1, - -1, 126, 291, 292, 293, 294, -1, 296, 297, -1, - 299, -1, 259, -1, -1, 262, 263, 264, 265, 266, - 267, -1, -1, 270, 271, 272, 273, 274, 275, -1, - -1, -1, -1, 280, 281, 282, 283, 284, 285, 286, - -1, -1, -1, -1, 291, 292, 293, 294, -1, 296, - 297, -1, 299, -1, -1, -1, 259, -1, -1, 262, - 263, 264, 265, 266, -1, -1, -1, 270, 271, 272, - 273, 274, 275, -1, -1, -1, -1, 280, 281, 282, - 283, 284, 285, 286, -1, -1, -1, -1, 291, 292, - 293, 294, -1, 296, 297, 259, 299, -1, 262, 263, - 264, 265, 266, -1, -1, -1, 270, 271, 272, 273, - 274, 275, -1, -1, -1, -1, 280, 281, 282, 283, - 284, 285, 286, -1, -1, -1, -1, -1, -1, 293, - 294, -1, 296, 297, -1, 299, -1, 262, 263, 264, - 265, 266, -1, -1, -1, 270, 271, 272, 273, 274, - 275, -1, -1, -1, -1, 280, 281, 282, 283, 284, - 285, 286, -1, -1, -1, -1, -1, -1, 293, 294, - -1, 296, 297, -1, 299, -}; -#define YYFINAL 31 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 314 -#if YYDEBUG -static YYCONST char *YYCONST yyname[] = { -"end-of-file",0,0,0,0,0,0,0,0,"'\\t'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'","'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"OVER", -"SMALLOVER","SQRT","SUB","SUP","LPILE","RPILE","CPILE","PILE","LEFT","RIGHT", -"TO","FROM","SIZE","FONT","ROMAN","BOLD","ITALIC","FAT","ACCENT","BAR","UNDER", -"ABOVE","TEXT","QUOTED_TEXT","FWD","BACK","DOWN","UP","MATRIX","COL","LCOL", -"RCOL","CCOL","MARK","LINEUP","TYPE","VCENTER","PRIME","SPLIT","NOSPLIT", -"UACCENT","SPECIAL","SPACE","GFONT","GSIZE","DEFINE","NDEFINE","TDEFINE", -"SDEFINE","UNDEF","IFDEF","INCLUDE","DELIM","CHARTYPE","SET","GRFONT","GBFONT", -}; -static YYCONST char *YYCONST yyrule[] = { -"$accept : top", -"top :", -"top : equation", -"equation : mark", -"equation : equation mark", -"mark : from_to", -"mark : MARK mark", -"mark : LINEUP mark", -"from_to : sqrt_over", -"from_to : sqrt_over TO from_to", -"from_to : sqrt_over FROM sqrt_over", -"from_to : sqrt_over FROM sqrt_over TO from_to", -"from_to : sqrt_over FROM sqrt_over FROM from_to", -"sqrt_over : script", -"sqrt_over : SQRT sqrt_over", -"sqrt_over : sqrt_over OVER sqrt_over", -"sqrt_over : sqrt_over SMALLOVER sqrt_over", -"script : nonsup", -"script : simple SUP script", -"nonsup : simple", -"nonsup : simple SUB nonsup", -"nonsup : simple SUB simple SUP script", -"simple : TEXT", -"simple : QUOTED_TEXT", -"simple : SPLIT QUOTED_TEXT", -"simple : NOSPLIT TEXT", -"simple : '^'", -"simple : '~'", -"simple : '\\t'", -"simple : '{' equation '}'", -"simple : PILE pile_arg", -"simple : LPILE pile_arg", -"simple : RPILE pile_arg", -"simple : CPILE pile_arg", -"simple : MATRIX '{' column_list '}'", -"simple : LEFT delim equation RIGHT delim", -"simple : LEFT delim equation", -"simple : simple BAR", -"simple : simple UNDER", -"simple : simple PRIME", -"simple : simple ACCENT simple", -"simple : simple UACCENT simple", -"simple : ROMAN simple", -"simple : BOLD simple", -"simple : ITALIC simple", -"simple : FAT simple", -"simple : FONT text simple", -"simple : SIZE text simple", -"simple : FWD number simple", -"simple : BACK number simple", -"simple : UP number simple", -"simple : DOWN number simple", -"simple : TYPE text simple", -"simple : VCENTER simple", -"simple : SPECIAL text simple", -"number : text", -"pile_element_list : equation", -"pile_element_list : pile_element_list ABOVE equation", -"pile_arg : '{' pile_element_list '}'", -"pile_arg : number '{' pile_element_list '}'", -"column_list : column", -"column_list : column_list column", -"column_element_list : equation", -"column_element_list : column_element_list ABOVE equation", -"column_arg : '{' column_element_list '}'", -"column_arg : number '{' column_element_list '}'", -"column : COL column_arg", -"column : LCOL column_arg", -"column : RCOL column_arg", -"column : CCOL column_arg", -"text : TEXT", -"text : QUOTED_TEXT", -"delim : text", -"delim : '{'", -"delim : '}'", -}; -#endif -#define YYLEX yylex() -#define YYEMPTY -1 -#define yyclearin (yychar=(YYEMPTY)) -#define yyerrok (yyerrflag=0) -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 10000 -#define YYMAXDEPTH 10000 -#endif -#endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -YYSTYPE yyval; -YYSTYPE yylval; -static short *yyss; -static YYSTYPE *yyvs; -static int yystacksize; -static int yygrow (); -static YYPTR yymalloc YYPARAMS((unsigned)); -static YYPTR yyrealloc YYPARAMS((YYPTR, unsigned)); -#define yyfree(x) free(x) -#define YYABORT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab - -#if YYDEBUG -#ifdef __cplusplus -extern "C" char *getenv(); -#else -extern char *getenv(); -#endif -#endif - -int -yyparse() -{ - register int yym, yyn, yystate; - register YYSTYPE *yyvsp; - register short *yyssp; - short *yysse; -#if YYDEBUG - register YYCONST char *yys; - - if (yys = getenv("YYDEBUG")) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); - - if (yyss == 0) - { - yyss = (short *) yymalloc (YYINITDEPTH * sizeof (short)); - if (yyss == 0) - goto yyabort; - yyvs = (YYSTYPE *) yymalloc (YYINITDEPTH * sizeof (YYSTYPE)); - if (yyvs == 0) - { - yyfree (yyss); - goto yyabort; - } - yystacksize = YYINITDEPTH; - } - yysse = yyss + yystacksize - 1; - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; - -yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", yystate, - yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, shifting to state %d\n", - yystate, yytable[yyn]); -#endif - if (yyssp >= yysse) - { - /* FIXME: Rework so there's only one of these. */ - int depth = yyssp - yyss; - if (yygrow () != 0) - goto yyoverflow; - yysse = yyss + yystacksize - 1; - yyssp = yyss + depth; - yyvsp = yyvs + depth; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; -#endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, error recovery shifting\ - to state %d\n", *yyssp, yytable[yyn]); -#endif - if (yyssp >= yysse) - { - int depth = yyssp - yyss; - if (yygrow () != 0) - goto yyoverflow; - yysse = yyss + yystacksize - 1; - yyssp = yyss + depth; - yyvsp = yyvs + depth; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("yydebug: error recovery discarding state %d\n", - *yyssp); -#endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, error recovery discards token %d (%s)\n", - yystate, yychar, yys); - } -#endif - yychar = (-1); - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, reducing by rule %d (%s)\n", - yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 2: -#line 126 "eqn.y" -{ yyvsp[0].b->top_level(); non_empty_flag = 1; } -break; -case 3: -#line 131 "eqn.y" -{ yyval.b = yyvsp[0].b; } -break; -case 4: -#line 133 "eqn.y" -{ - list_box *lb = yyvsp[-1].b->to_list_box(); - if (!lb) - lb = new list_box(yyvsp[-1].b); - lb->append(yyvsp[0].b); - yyval.b = lb; - } -break; -case 5: -#line 144 "eqn.y" -{ yyval.b = yyvsp[0].b; } -break; -case 6: -#line 146 "eqn.y" -{ yyval.b = make_mark_box(yyvsp[0].b); } -break; -case 7: -#line 148 "eqn.y" -{ yyval.b = make_lineup_box(yyvsp[0].b); } -break; -case 8: -#line 153 "eqn.y" -{ yyval.b = yyvsp[0].b; } -break; -case 9: -#line 155 "eqn.y" -{ yyval.b = make_limit_box(yyvsp[-2].b, 0, yyvsp[0].b); } -break; -case 10: -#line 157 "eqn.y" -{ yyval.b = make_limit_box(yyvsp[-2].b, yyvsp[0].b, 0); } -break; -case 11: -#line 159 "eqn.y" -{ yyval.b = make_limit_box(yyvsp[-4].b, yyvsp[-2].b, yyvsp[0].b); } -break; -case 12: -#line 161 "eqn.y" -{ yyval.b = make_limit_box(yyvsp[-4].b, make_limit_box(yyvsp[-2].b, yyvsp[0].b, 0), 0); } -break; -case 13: -#line 166 "eqn.y" -{ yyval.b = yyvsp[0].b; } -break; -case 14: -#line 168 "eqn.y" -{ yyval.b = make_sqrt_box(yyvsp[0].b); } -break; -case 15: -#line 170 "eqn.y" -{ yyval.b = make_over_box(yyvsp[-2].b, yyvsp[0].b); } -break; -case 16: -#line 172 "eqn.y" -{ yyval.b = make_small_over_box(yyvsp[-2].b, yyvsp[0].b); } -break; -case 17: -#line 177 "eqn.y" -{ yyval.b = yyvsp[0].b; } -break; -case 18: -#line 179 "eqn.y" -{ yyval.b = make_script_box(yyvsp[-2].b, 0, yyvsp[0].b); } -break; -case 19: -#line 184 "eqn.y" -{ yyval.b = yyvsp[0].b; } -break; -case 20: -#line 186 "eqn.y" -{ yyval.b = make_script_box(yyvsp[-2].b, yyvsp[0].b, 0); } -break; -case 21: -#line 188 "eqn.y" -{ yyval.b = make_script_box(yyvsp[-4].b, yyvsp[-2].b, yyvsp[0].b); } -break; -case 22: -#line 193 "eqn.y" -{ yyval.b = split_text(yyvsp[0].str); } -break; -case 23: -#line 195 "eqn.y" -{ yyval.b = new quoted_text_box(yyvsp[0].str); } -break; -case 24: -#line 197 "eqn.y" -{ yyval.b = split_text(yyvsp[0].str); } -break; -case 25: -#line 199 "eqn.y" -{ yyval.b = new quoted_text_box(yyvsp[0].str); } -break; -case 26: -#line 201 "eqn.y" -{ yyval.b = new half_space_box; } -break; -case 27: -#line 203 "eqn.y" -{ yyval.b = new space_box; } -break; -case 28: -#line 205 "eqn.y" -{ yyval.b = new tab_box; } -break; -case 29: -#line 207 "eqn.y" -{ yyval.b = yyvsp[-1].b; } -break; -case 30: -#line 209 "eqn.y" -{ yyvsp[0].pb->set_alignment(CENTER_ALIGN); yyval.b = yyvsp[0].pb; } -break; -case 31: -#line 211 "eqn.y" -{ yyvsp[0].pb->set_alignment(LEFT_ALIGN); yyval.b = yyvsp[0].pb; } -break; -case 32: -#line 213 "eqn.y" -{ yyvsp[0].pb->set_alignment(RIGHT_ALIGN); yyval.b = yyvsp[0].pb; } -break; -case 33: -#line 215 "eqn.y" -{ yyvsp[0].pb->set_alignment(CENTER_ALIGN); yyval.b = yyvsp[0].pb; } -break; -case 34: -#line 217 "eqn.y" -{ yyval.b = yyvsp[-1].mb; } -break; -case 35: -#line 219 "eqn.y" -{ yyval.b = make_delim_box(yyvsp[-3].str, yyvsp[-2].b, yyvsp[0].str); } -break; -case 36: -#line 221 "eqn.y" -{ yyval.b = make_delim_box(yyvsp[-1].str, yyvsp[0].b, 0); } -break; -case 37: -#line 223 "eqn.y" -{ yyval.b = make_overline_box(yyvsp[-1].b); } -break; -case 38: -#line 225 "eqn.y" -{ yyval.b = make_underline_box(yyvsp[-1].b); } -break; -case 39: -#line 227 "eqn.y" -{ yyval.b = make_prime_box(yyvsp[-1].b); } -break; -case 40: -#line 229 "eqn.y" -{ yyval.b = make_accent_box(yyvsp[-2].b, yyvsp[0].b); } -break; -case 41: -#line 231 "eqn.y" -{ yyval.b = make_uaccent_box(yyvsp[-2].b, yyvsp[0].b); } -break; -case 42: -#line 233 "eqn.y" -{ yyval.b = new font_box(strsave(get_grfont()), yyvsp[0].b); } -break; -case 43: -#line 235 "eqn.y" -{ yyval.b = new font_box(strsave(get_gbfont()), yyvsp[0].b); } -break; -case 44: -#line 237 "eqn.y" -{ yyval.b = new font_box(strsave(get_gfont()), yyvsp[0].b); } -break; -case 45: -#line 239 "eqn.y" -{ yyval.b = new fat_box(yyvsp[0].b); } -break; -case 46: -#line 241 "eqn.y" -{ yyval.b = new font_box(yyvsp[-1].str, yyvsp[0].b); } -break; -case 47: -#line 243 "eqn.y" -{ yyval.b = new size_box(yyvsp[-1].str, yyvsp[0].b); } -break; -case 48: -#line 245 "eqn.y" -{ yyval.b = new hmotion_box(yyvsp[-1].n, yyvsp[0].b); } -break; -case 49: -#line 247 "eqn.y" -{ yyval.b = new hmotion_box(-yyvsp[-1].n, yyvsp[0].b); } -break; -case 50: -#line 249 "eqn.y" -{ yyval.b = new vmotion_box(yyvsp[-1].n, yyvsp[0].b); } -break; -case 51: -#line 251 "eqn.y" -{ yyval.b = new vmotion_box(-yyvsp[-1].n, yyvsp[0].b); } -break; -case 52: -#line 253 "eqn.y" -{ yyvsp[0].b->set_spacing_type(yyvsp[-1].str); yyval.b = yyvsp[0].b; } -break; -case 53: -#line 255 "eqn.y" -{ yyval.b = new vcenter_box(yyvsp[0].b); } -break; -case 54: -#line 257 "eqn.y" -{ yyval.b = make_special_box(yyvsp[-1].str, yyvsp[0].b); } -break; -case 55: -#line 262 "eqn.y" -{ - int n; - if (sscanf(yyvsp[0].str, "%d", &n) == 1) - yyval.n = n; - a_delete yyvsp[0].str; - } -break; -case 56: -#line 272 "eqn.y" -{ yyval.pb = new pile_box(yyvsp[0].b); } -break; -case 57: -#line 274 "eqn.y" -{ yyvsp[-2].pb->append(yyvsp[0].b); yyval.pb = yyvsp[-2].pb; } -break; -case 58: -#line 279 "eqn.y" -{ yyval.pb = yyvsp[-1].pb; } -break; -case 59: -#line 281 "eqn.y" -{ yyvsp[-1].pb->set_space(yyvsp[-3].n); yyval.pb = yyvsp[-1].pb; } -break; -case 60: -#line 286 "eqn.y" -{ yyval.mb = new matrix_box(yyvsp[0].col); } -break; -case 61: -#line 288 "eqn.y" -{ yyvsp[-1].mb->append(yyvsp[0].col); yyval.mb = yyvsp[-1].mb; } -break; -case 62: -#line 293 "eqn.y" -{ yyval.col = new column(yyvsp[0].b); } -break; -case 63: -#line 295 "eqn.y" -{ yyvsp[-2].col->append(yyvsp[0].b); yyval.col = yyvsp[-2].col; } -break; -case 64: -#line 300 "eqn.y" -{ yyval.col = yyvsp[-1].col; } -break; -case 65: -#line 302 "eqn.y" -{ yyvsp[-1].col->set_space(yyvsp[-3].n); yyval.col = yyvsp[-1].col; } -break; -case 66: -#line 307 "eqn.y" -{ yyvsp[0].col->set_alignment(CENTER_ALIGN); yyval.col = yyvsp[0].col; } -break; -case 67: -#line 309 "eqn.y" -{ yyvsp[0].col->set_alignment(LEFT_ALIGN); yyval.col = yyvsp[0].col; } -break; -case 68: -#line 311 "eqn.y" -{ yyvsp[0].col->set_alignment(RIGHT_ALIGN); yyval.col = yyvsp[0].col; } -break; -case 69: -#line 313 "eqn.y" -{ yyvsp[0].col->set_alignment(CENTER_ALIGN); yyval.col = yyvsp[0].col; } -break; -case 70: -#line 317 "eqn.y" -{ yyval.str = yyvsp[0].str; } -break; -case 71: -#line 319 "eqn.y" -{ yyval.str = yyvsp[0].str; } -break; -case 72: -#line 324 "eqn.y" -{ yyval.str = yyvsp[0].str; } -break; -case 73: -#line 326 "eqn.y" -{ yyval.str = strsave("{"); } -break; -case 74: -#line 328 "eqn.y" -{ yyval.str = strsave("}"); } -break; -#line 1168 "y.tab.c" - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: after reduction, shifting from state 0 to\ - state %d\n", YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", - YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("yydebug: after reduction, shifting from state %d \ -to state %d\n", *yyssp, yystate); -#endif - if (yyssp >= yysse) - { - int depth = yyssp - yyss; - if (yygrow () != 0) - goto yyoverflow; - yysse = yyss + yystacksize - 1; - yyssp = yyss + depth; - yyvsp = yyvs + depth; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); -} - -static int -yygrow () -{ - int old_stacksize = yystacksize; - short *new_yyss; - YYSTYPE *new_yyvs; - - if (yystacksize >= YYMAXDEPTH) - return (1); - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#if YYDEBUG - if (yydebug) - printf("yydebug: growing stack size from %d to %d\n", - old_stacksize, yystacksize); -#endif - new_yyss = (short *) yyrealloc (yyss, yystacksize * sizeof (short)); - if (new_yyss == 0) - return (1); - new_yyvs = (YYSTYPE *) yyrealloc (yyvs, yystacksize * sizeof (YYSTYPE)); - if (new_yyvs == 0) - { - yyfree (new_yyss); - return (1); - } - yyss = new_yyss; - yyvs = new_yyvs; - return (0); -} - -static YYPTR -YYDEFUN (yymalloc, (bytes), unsigned bytes) -{ - YYPTR ptr = (YYPTR) malloc (bytes); - if (ptr != 0) return (ptr); - yyerror ("yyparse: memory exhausted"); - return (0); -} - -static YYPTR -YYDEFUN (yyrealloc, (old, bytes), YYPTR old YYAND unsigned bytes) -{ - YYPTR ptr = (YYPTR) realloc (old, bytes); - if (ptr != 0) return (ptr); - yyerror ("yyparse: memory exhausted"); - return (0); -} diff --git a/gnu/usr.bin/groff/eqn/eqn.tab.h b/gnu/usr.bin/groff/eqn/eqn.tab.h deleted file mode 100644 index 9a8b3cb2259..00000000000 --- a/gnu/usr.bin/groff/eqn/eqn.tab.h +++ /dev/null @@ -1,67 +0,0 @@ -#define OVER 257 -#define SMALLOVER 258 -#define SQRT 259 -#define SUB 260 -#define SUP 261 -#define LPILE 262 -#define RPILE 263 -#define CPILE 264 -#define PILE 265 -#define LEFT 266 -#define RIGHT 267 -#define TO 268 -#define FROM 269 -#define SIZE 270 -#define FONT 271 -#define ROMAN 272 -#define BOLD 273 -#define ITALIC 274 -#define FAT 275 -#define ACCENT 276 -#define BAR 277 -#define UNDER 278 -#define ABOVE 279 -#define TEXT 280 -#define QUOTED_TEXT 281 -#define FWD 282 -#define BACK 283 -#define DOWN 284 -#define UP 285 -#define MATRIX 286 -#define COL 287 -#define LCOL 288 -#define RCOL 289 -#define CCOL 290 -#define MARK 291 -#define LINEUP 292 -#define TYPE 293 -#define VCENTER 294 -#define PRIME 295 -#define SPLIT 296 -#define NOSPLIT 297 -#define UACCENT 298 -#define SPECIAL 299 -#define SPACE 300 -#define GFONT 301 -#define GSIZE 302 -#define DEFINE 303 -#define NDEFINE 304 -#define TDEFINE 305 -#define SDEFINE 306 -#define UNDEF 307 -#define IFDEF 308 -#define INCLUDE 309 -#define DELIM 310 -#define CHARTYPE 311 -#define SET 312 -#define GRFONT 313 -#define GBFONT 314 -typedef union { - char *str; - box *b; - pile_box *pb; - matrix_box *mb; - int n; - column *col; -} YYSTYPE; -extern YYSTYPE yylval; diff --git a/gnu/usr.bin/groff/pic/pic.tab.h b/gnu/usr.bin/groff/pic/pic.tab.h deleted file mode 100644 index c71bdfd2cd3..00000000000 --- a/gnu/usr.bin/groff/pic/pic.tab.h +++ /dev/null @@ -1,129 +0,0 @@ -#define LABEL 257 -#define VARIABLE 258 -#define NUMBER 259 -#define TEXT 260 -#define COMMAND_LINE 261 -#define DELIMITED 262 -#define ORDINAL 263 -#define TH 264 -#define LEFT_ARROW_HEAD 265 -#define RIGHT_ARROW_HEAD 266 -#define DOUBLE_ARROW_HEAD 267 -#define LAST 268 -#define UP 269 -#define DOWN 270 -#define LEFT 271 -#define RIGHT 272 -#define BOX 273 -#define CIRCLE 274 -#define ELLIPSE 275 -#define ARC 276 -#define LINE 277 -#define ARROW 278 -#define MOVE 279 -#define SPLINE 280 -#define HEIGHT 281 -#define RADIUS 282 -#define WIDTH 283 -#define DIAMETER 284 -#define FROM 285 -#define TO 286 -#define AT 287 -#define WITH 288 -#define BY 289 -#define THEN 290 -#define DOTTED 291 -#define DASHED 292 -#define CHOP 293 -#define SAME 294 -#define INVISIBLE 295 -#define LJUST 296 -#define RJUST 297 -#define ABOVE 298 -#define BELOW 299 -#define OF 300 -#define THE 301 -#define WAY 302 -#define BETWEEN 303 -#define AND 304 -#define HERE 305 -#define DOT_N 306 -#define DOT_E 307 -#define DOT_W 308 -#define DOT_S 309 -#define DOT_NE 310 -#define DOT_SE 311 -#define DOT_NW 312 -#define DOT_SW 313 -#define DOT_C 314 -#define DOT_START 315 -#define DOT_END 316 -#define DOT_X 317 -#define DOT_Y 318 -#define DOT_HT 319 -#define DOT_WID 320 -#define DOT_RAD 321 -#define SIN 322 -#define COS 323 -#define ATAN2 324 -#define LOG 325 -#define EXP 326 -#define SQRT 327 -#define K_MAX 328 -#define K_MIN 329 -#define INT 330 -#define RAND 331 -#define COPY 332 -#define THRU 333 -#define TOP 334 -#define BOTTOM 335 -#define UPPER 336 -#define LOWER 337 -#define SH 338 -#define PRINT 339 -#define CW 340 -#define CCW 341 -#define FOR 342 -#define DO 343 -#define IF 344 -#define ELSE 345 -#define ANDAND 346 -#define OROR 347 -#define NOTEQUAL 348 -#define EQUALEQUAL 349 -#define LESSEQUAL 350 -#define GREATEREQUAL 351 -#define LEFT_CORNER 352 -#define RIGHT_CORNER 353 -#define CENTER 354 -#define END 355 -#define START 356 -#define RESET 357 -#define UNTIL 358 -#define PLOT 359 -#define THICKNESS 360 -#define FILL 361 -#define ALIGNED 362 -#define SPRINTF 363 -#define COMMAND 364 -#define DEFINE 365 -#define UNDEF 366 -typedef union { - char *str; - int n; - double x; - struct { double x, y; } pair; - struct { double x; char *body; } if_data; - struct { char *str; const char *filename; int lineno; } lstr; - struct { double *v; int nv; int maxv; } dv; - struct { double val; int is_multiplicative; } by; - place pl; - object *obj; - corner crn; - path *pth; - object_spec *spec; - saved_state *pstate; - graphics_state state; - object_type obtype; -} YYSTYPE; -extern YYSTYPE yylval; diff --git a/gnu/usr.bin/groff/refer/label.cc b/gnu/usr.bin/groff/refer/label.cc deleted file mode 100644 index 5d1ae90bbd5..00000000000 --- a/gnu/usr.bin/groff/refer/label.cc +++ /dev/null @@ -1,1712 +0,0 @@ -#if defined(__STDC__) || defined(__cplusplus) -#define YYCONST const -#define YYPARAMS(x) x -#define YYDEFUN(name, arglist, args) name(args) -#define YYAND , -#define YYPTR void * -#else -#define YYCONST -#define YYPARAMS(x) () -#define YYDEFUN(name, arglist, args) name arglist args; -#define YYAND ; -#define YYPTR char * -#endif -#ifndef lint -YYCONST static char yysccsid[] = "@(#)yaccpar 1.8 (Berkeley +Cygnus.28) 01/20/91"; -#endif -#define YYBYACC 1 -#ifndef YYDONT_INCLUDE_STDIO -#include <stdio.h> -#endif -#ifdef __cplusplus -#include <stdlib.h> /* for malloc/realloc/free */ -#endif -#line 22 "label.y" - -#include "refer.h" -#include "refid.h" -#include "ref.h" -#include "token.h" - -int yylex(); -void yyerror(const char *); -int yyparse(); - -static const char *format_serial(char c, int n); - -struct label_info { - int start; - int length; - int count; - int total; - label_info(const string &); -}; - -label_info *lookup_label(const string &label); - -struct expression { - enum { - /* Does the tentative label depend on the reference?*/ - CONTAINS_VARIABLE = 01, - CONTAINS_STAR = 02, - CONTAINS_FORMAT = 04, - CONTAINS_AT = 010 - }; - virtual ~expression() { } - virtual void evaluate(int, const reference &, string &, - substring_position &) = 0; - virtual unsigned analyze() { return 0; } -}; - -class at_expr : public expression { -public: - at_expr() { } - void evaluate(int, const reference &, string &, substring_position &); - unsigned analyze() { return CONTAINS_VARIABLE|CONTAINS_AT; } -}; - -class format_expr : public expression { - char type; - int width; - int first_number; -public: - format_expr(char c, int w = 0, int f = 1) - : type(c), width(w), first_number(f) { } - void evaluate(int, const reference &, string &, substring_position &); - unsigned analyze() { return CONTAINS_FORMAT; } -}; - -class field_expr : public expression { - int number; - char name; -public: - field_expr(char nm, int num) : name(nm), number(num) { } - void evaluate(int, const reference &, string &, substring_position &); - unsigned analyze() { return CONTAINS_VARIABLE; } -}; - -class literal_expr : public expression { - string s; -public: - literal_expr(const char *ptr, int len) : s(ptr, len) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -class unary_expr : public expression { -protected: - expression *expr; -public: - unary_expr(expression *e) : expr(e) { } - ~unary_expr() { delete expr; } - void evaluate(int, const reference &, string &, substring_position &) = 0; - unsigned analyze() { return expr ? expr->analyze() : 0; } -}; - -/* This caches the analysis of an expression.*/ - -class analyzed_expr : public unary_expr { - unsigned flags; -public: - analyzed_expr(expression *); - void evaluate(int, const reference &, string &, substring_position &); - unsigned analyze() { return flags; } -}; - -class star_expr : public unary_expr { -public: - star_expr(expression *e) : unary_expr(e) { } - void evaluate(int, const reference &, string &, substring_position &); - unsigned analyze() { - return ((expr ? (expr->analyze() & ~CONTAINS_VARIABLE) : 0) - | CONTAINS_STAR); - } -}; - -typedef void map_func(const char *, const char *, string &); - -class map_expr : public unary_expr { - map_func *func; -public: - map_expr(expression *e, map_func *f) : unary_expr(e), func(f) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -typedef const char *extractor_func(const char *, const char *, const char **); - -class extractor_expr : public unary_expr { - int part; - extractor_func *func; -public: - enum { BEFORE = +1, MATCH = 0, AFTER = -1 }; - extractor_expr(expression *e, extractor_func *f, int pt) - : unary_expr(e), func(f), part(pt) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -class truncate_expr : public unary_expr { - int n; -public: - truncate_expr(expression *e, int i) : n(i), unary_expr(e) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -class separator_expr : public unary_expr { -public: - separator_expr(expression *e) : unary_expr(e) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -class binary_expr : public expression { -protected: - expression *expr1; - expression *expr2; -public: - binary_expr(expression *e1, expression *e2) : expr1(e1), expr2(e2) { } - ~binary_expr() { delete expr1; delete expr2; } - void evaluate(int, const reference &, string &, substring_position &) = 0; - unsigned analyze() { - return (expr1 ? expr1->analyze() : 0) | (expr2 ? expr2->analyze() : 0); - } -}; - -class alternative_expr : public binary_expr { -public: - alternative_expr(expression *e1, expression *e2) : binary_expr(e1, e2) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -class list_expr : public binary_expr { -public: - list_expr(expression *e1, expression *e2) : binary_expr(e1, e2) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -class substitute_expr : public binary_expr { -public: - substitute_expr(expression *e1, expression *e2) : binary_expr(e1, e2) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -class ternary_expr : public expression { -protected: - expression *expr1; - expression *expr2; - expression *expr3; -public: - ternary_expr(expression *e1, expression *e2, expression *e3) - : expr1(e1), expr2(e2), expr3(e3) { } - ~ternary_expr() { delete expr1; delete expr2; delete expr3; } - void evaluate(int, const reference &, string &, substring_position &) = 0; - unsigned analyze() { - return ((expr1 ? expr1->analyze() : 0) - | (expr2 ? expr2->analyze() : 0) - | (expr3 ? expr3->analyze() : 0)); - } -}; - -class conditional_expr : public ternary_expr { -public: - conditional_expr(expression *e1, expression *e2, expression *e3) - : ternary_expr(e1, e2, e3) { } - void evaluate(int, const reference &, string &, substring_position &); -}; - -static expression *parsed_label = 0; -static expression *parsed_date_label = 0; -static expression *parsed_short_label = 0; - -static expression *parse_result; - -string literals; - -#line 221 "label.y" -typedef union { - int num; - expression *expr; - struct { int ndigits; int val; } dig; - struct { int start; int len; } str; -} YYSTYPE; -#line 230 "y.tab.c" -#define TOKEN_LETTER 257 -#define TOKEN_LITERAL 258 -#define TOKEN_DIGIT 259 -#define YYERRCODE 256 -static YYCONST short yylhs[] = { -1, - 0, 1, 1, 6, 6, 2, 2, 2, 3, 3, - 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 9, 9, 7, 7, 8, 8, - 10, 10, 10, -}; -static YYCONST short yylen[] = { 2, - 1, 1, 5, 0, 1, 1, 3, 3, 1, 2, - 1, 3, 1, 1, 1, 2, 2, 2, 5, 3, - 3, 2, 3, 3, 0, 1, 1, 2, 1, 2, - 0, 1, 1, -}; -static YYCONST short yydefred[] = { 0, - 0, 14, 13, 0, 0, 0, 0, 5, 0, 0, - 0, 0, 1, 27, 0, 17, 29, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 22, 0, 28, - 30, 23, 24, 0, 0, 0, 32, 33, 0, 0, - 0, 0, 0, 0, 3, 0, 19, -}; -static YYCONST short yydgoto[] = { 7, - 8, 9, 10, 11, 12, 13, 15, 18, 47, 39, -}; -static YYCONST short yysindex[] = { -32, - -257, 0, 0, -240, -32, -32, 0, 0, -18, -32, - -36, -114, 0, 0, -246, 0, 0, -241, -14, -39, - -32, -32, -32, -114, -21, -257, -257, 0, -32, 0, - 0, 0, 0, -25, -32, -32, 0, 0, -223, -246, - -246, -36, -32, -257, 0, -246, 0, -}; -static YYCONST short yyrindex[] = { 35, - 1, 0, 0, 0, -5, -4, 0, 0, 14, 208, - 159, 224, 0, 0, 11, 0, 0, 40, 0, 0, - 2, 0, 0, 253, -220, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 263, 281, 0, 0, 0, 50, - 105, 214, 0, 115, 0, 149, 0, -}; -static YYCONST short yygindex[] = { 0, - 19, 0, 7, 37, -10, 10, -23, 0, 0, 0, -}; -#define YYTABLESIZE 511 -static YYCONST short yytable[] = { 24, - 15, 14, 40, 41, 4, 28, 26, 5, 27, 25, - 16, 29, 30, 2, 19, 20, 16, 31, 17, 23, - 46, 37, 33, 38, 24, 24, 32, 6, 35, 36, - 34, 3, 43, 44, 4, 4, 31, 15, 15, 18, - 15, 15, 15, 15, 21, 15, 15, 16, 16, 20, - 16, 16, 16, 16, 2, 16, 16, 4, 15, 4, - 15, 45, 15, 15, 15, 42, 0, 0, 16, 0, - 16, 2, 16, 16, 16, 2, 18, 18, 0, 18, - 18, 18, 18, 0, 18, 18, 20, 20, 0, 20, - 20, 20, 20, 0, 20, 20, 0, 18, 0, 18, - 0, 18, 18, 18, 21, 22, 0, 20, 0, 20, - 0, 20, 20, 20, 25, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 15, 0, 15, 0, 0, 0, - 0, 0, 0, 0, 16, 0, 16, 0, 0, 0, - 0, 21, 21, 0, 21, 21, 21, 21, 26, 21, - 21, 25, 25, 0, 25, 25, 25, 25, 11, 25, - 25, 0, 21, 18, 21, 18, 21, 21, 21, 0, - 0, 0, 25, 20, 25, 20, 25, 25, 25, 0, - 0, 0, 0, 0, 0, 26, 26, 0, 26, 26, - 26, 26, 0, 26, 26, 11, 11, 0, 11, 11, - 0, 0, 0, 0, 0, 0, 26, 6, 26, 0, - 26, 26, 26, 12, 0, 0, 11, 0, 11, 0, - 11, 11, 11, 9, 1, 2, 0, 0, 21, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 25, 0, - 25, 0, 0, 0, 0, 6, 0, 0, 6, 0, - 12, 12, 10, 12, 12, 0, 0, 15, 15, 0, - 9, 9, 7, 9, 9, 6, 0, 16, 16, 6, - 6, 12, 26, 12, 26, 12, 12, 12, 0, 0, - 8, 9, 11, 9, 11, 9, 9, 9, 0, 10, - 10, 0, 10, 10, 0, 0, 18, 18, 0, 0, - 7, 0, 0, 7, 0, 0, 20, 20, 0, 0, - 10, 0, 10, 0, 10, 10, 10, 0, 8, 0, - 7, 8, 0, 0, 7, 7, 0, 0, 0, 0, - 0, 6, 0, 0, 0, 0, 0, 12, 8, 12, - 0, 0, 8, 8, 0, 0, 0, 9, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 21, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 25, 25, 0, 0, 0, 10, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 8, 26, 26, 0, 0, 0, - 0, 0, 0, 0, 0, 11, 11, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 12, 12, 0, 0, 0, 0, 0, 0, 0, 0, - 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, - 10, -}; -static YYCONST short yycheck[] = { 10, - 0, 259, 26, 27, 37, 42, 43, 40, 45, 46, - 0, 126, 259, 0, 5, 6, 257, 259, 259, 38, - 44, 43, 62, 45, 35, 36, 41, 60, 22, 23, - 21, 64, 58, 257, 0, 41, 257, 37, 38, 0, - 40, 41, 42, 43, 63, 45, 46, 37, 38, 0, - 40, 41, 42, 43, 41, 45, 46, 62, 58, 58, - 60, 43, 62, 63, 64, 29, -1, -1, 58, -1, - 60, 58, 62, 63, 64, 62, 37, 38, -1, 40, - 41, 42, 43, -1, 45, 46, 37, 38, -1, 40, - 41, 42, 43, -1, 45, 46, -1, 58, -1, 60, - -1, 62, 63, 64, 0, 124, -1, 58, -1, 60, - -1, 62, 63, 64, 0, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 124, -1, 126, -1, -1, -1, - -1, -1, -1, -1, 124, -1, 126, -1, -1, -1, - -1, 37, 38, -1, 40, 41, 42, 43, 0, 45, - 46, 37, 38, -1, 40, 41, 42, 43, 0, 45, - 46, -1, 58, 124, 60, 126, 62, 63, 64, -1, - -1, -1, 58, 124, 60, 126, 62, 63, 64, -1, - -1, -1, -1, -1, -1, 37, 38, -1, 40, 41, - 42, 43, -1, 45, 46, 37, 38, -1, 40, 41, - -1, -1, -1, -1, -1, -1, 58, 0, 60, -1, - 62, 63, 64, 0, -1, -1, 58, -1, 60, -1, - 62, 63, 64, 0, 257, 258, -1, -1, 124, -1, - 126, -1, -1, -1, -1, -1, -1, -1, 124, -1, - 126, -1, -1, -1, -1, 38, -1, -1, 41, -1, - 37, 38, 0, 40, 41, -1, -1, 257, 258, -1, - 37, 38, 0, 40, 41, 58, -1, 257, 258, 62, - 63, 58, 124, 60, 126, 62, 63, 64, -1, -1, - 0, 58, 124, 60, 126, 62, 63, 64, -1, 37, - 38, -1, 40, 41, -1, -1, 257, 258, -1, -1, - 38, -1, -1, 41, -1, -1, 257, 258, -1, -1, - 58, -1, 60, -1, 62, 63, 64, -1, 38, -1, - 58, 41, -1, -1, 62, 63, -1, -1, -1, -1, - -1, 124, -1, -1, -1, -1, -1, 124, 58, 126, - -1, -1, 62, 63, -1, -1, -1, 124, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 257, 258, -1, -1, -1, -1, -1, -1, -1, - -1, 257, 258, -1, -1, -1, 124, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 124, 257, 258, -1, -1, -1, - -1, -1, -1, -1, -1, 257, 258, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 257, 258, -1, -1, -1, -1, -1, -1, -1, -1, - 257, 258, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 257, - 258, -}; -#define YYFINAL 7 -#ifndef YYDEBUG -#define YYDEBUG 0 -#endif -#define YYMAXTOKEN 259 -#if YYDEBUG -static YYCONST char *YYCONST yyname[] = { -"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'","'.'",0,0,0,0,0,0,0,0,0,0,0, -"':'",0,"'<'",0,"'>'","'?'","'@'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0, -"'~'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,"TOKEN_LETTER","TOKEN_LITERAL","TOKEN_DIGIT", -}; -static YYCONST char *YYCONST yyrule[] = { -"$accept : expr", -"expr : optional_conditional", -"conditional : alternative", -"conditional : alternative '?' optional_conditional ':' conditional", -"optional_conditional :", -"optional_conditional : conditional", -"alternative : list", -"alternative : alternative '|' list", -"alternative : alternative '&' list", -"list : substitute", -"list : list substitute", -"substitute : string", -"substitute : substitute '~' string", -"string : '@'", -"string : TOKEN_LITERAL", -"string : TOKEN_LETTER", -"string : TOKEN_LETTER number", -"string : '%' TOKEN_LETTER", -"string : '%' digits", -"string : string '.' flag TOKEN_LETTER optional_number", -"string : string '+' number", -"string : string '-' number", -"string : string '*'", -"string : '(' optional_conditional ')'", -"string : '<' optional_conditional '>'", -"optional_number :", -"optional_number : number", -"number : TOKEN_DIGIT", -"number : number TOKEN_DIGIT", -"digits : TOKEN_DIGIT", -"digits : digits TOKEN_DIGIT", -"flag :", -"flag : '+'", -"flag : '-'", -}; -#endif -#define YYLEX yylex() -#define YYEMPTY -1 -#define yyclearin (yychar=(YYEMPTY)) -#define yyerrok (yyerrflag=0) -#ifndef YYINITDEPTH -#define YYINITDEPTH 200 -#endif -#ifdef YYSTACKSIZE -#undef YYMAXDEPTH -#define YYMAXDEPTH YYSTACKSIZE -#else -#ifdef YYMAXDEPTH -#define YYSTACKSIZE YYMAXDEPTH -#else -#define YYSTACKSIZE 10000 -#define YYMAXDEPTH 10000 -#endif -#endif -int yydebug; -int yynerrs; -int yyerrflag; -int yychar; -YYSTYPE yyval; -YYSTYPE yylval; -static short *yyss; -static YYSTYPE *yyvs; -static int yystacksize; -static int yygrow (); -static YYPTR yymalloc YYPARAMS((unsigned)); -static YYPTR yyrealloc YYPARAMS((YYPTR, unsigned)); -#define yyfree(x) free(x) -#line 397 "label.y" - -/* bison defines const to be empty unless __STDC__ is defined, which it -isn't under cfront */ - -#ifdef const -#undef const -#endif - -const char *spec_ptr; -const char *spec_end; -const char *spec_cur; - -int yylex() -{ - while (spec_ptr < spec_end && csspace(*spec_ptr)) - spec_ptr++; - spec_cur = spec_ptr; - if (spec_ptr >= spec_end) - return 0; - unsigned char c = *spec_ptr++; - if (csalpha(c)) { - yylval.num = c; - return TOKEN_LETTER; - } - if (csdigit(c)) { - yylval.num = c - '0'; - return TOKEN_DIGIT; - } - if (c == '\'') { - yylval.str.start = literals.length(); - for (; spec_ptr < spec_end; spec_ptr++) { - if (*spec_ptr == '\'') { - if (++spec_ptr < spec_end && *spec_ptr == '\'') - literals += '\''; - else { - yylval.str.len = literals.length() - yylval.str.start; - return TOKEN_LITERAL; - } - } - else - literals += *spec_ptr; - } - yylval.str.len = literals.length() - yylval.str.start; - return TOKEN_LITERAL; - } - return c; -} - -int set_label_spec(const char *label_spec) -{ - spec_cur = spec_ptr = label_spec; - spec_end = strchr(label_spec, '\0'); - literals.clear(); - if (yyparse()) - return 0; - delete parsed_label; - parsed_label = parse_result; - return 1; -} - -int set_date_label_spec(const char *label_spec) -{ - spec_cur = spec_ptr = label_spec; - spec_end = strchr(label_spec, '\0'); - literals.clear(); - if (yyparse()) - return 0; - delete parsed_date_label; - parsed_date_label = parse_result; - return 1; -} - -int set_short_label_spec(const char *label_spec) -{ - spec_cur = spec_ptr = label_spec; - spec_end = strchr(label_spec, '\0'); - literals.clear(); - if (yyparse()) - return 0; - delete parsed_short_label; - parsed_short_label = parse_result; - return 1; -} - -void yyerror(const char *message) -{ - if (spec_cur < spec_end) - command_error("label specification %1 before `%2'", message, spec_cur); - else - command_error("label specification %1 at end of string", - message, spec_cur); -} - -void at_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &) -{ - if (tentative) - ref.canonicalize_authors(result); - else { - const char *end, *start = ref.get_authors(&end); - if (start) - result.append(start, end - start); - } -} - -void format_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &) -{ - if (tentative) - return; - const label_info *lp = ref.get_label_ptr(); - int num = lp == 0 ? ref.get_number() : lp->count; - if (type != '0') - result += format_serial(type, num + 1); - else { - const char *ptr = itoa(num + first_number); - int pad = width - strlen(ptr); - while (--pad >= 0) - result += '0'; - result += ptr; - } -} - -static const char *format_serial(char c, int n) -{ - assert(n > 0); - static char buf[128]; // more than enough. - switch (c) { - case 'i': - case 'I': - { - char *p = buf; - // troff uses z and w to represent 10000 and 5000 in Roman - // numerals; I can find no historical basis for this usage - const char *s = c == 'i' ? "zwmdclxvi" : "ZWMDCLXVI"; - if (n >= 40000) - return itoa(n); - while (n >= 10000) { - *p++ = s[0]; - n -= 10000; - } - for (int i = 1000; i > 0; i /= 10, s += 2) { - int m = n/i; - n -= m*i; - switch (m) { - case 3: - *p++ = s[2]; - /* falls through */ - case 2: - *p++ = s[2]; - /* falls through */ - case 1: - *p++ = s[2]; - break; - case 4: - *p++ = s[2]; - *p++ = s[1]; - break; - case 8: - *p++ = s[1]; - *p++ = s[2]; - *p++ = s[2]; - *p++ = s[2]; - break; - case 7: - *p++ = s[1]; - *p++ = s[2]; - *p++ = s[2]; - break; - case 6: - *p++ = s[1]; - *p++ = s[2]; - break; - case 5: - *p++ = s[1]; - break; - case 9: - *p++ = s[2]; - *p++ = s[0]; - } - } - *p = 0; - break; - } - case 'a': - case 'A': - { - char *p = buf; - // this is derived from troff/reg.c - while (n > 0) { - int d = n % 26; - if (d == 0) - d = 26; - n -= d; - n /= 26; - *p++ = c + d - 1; // ASCII dependent - } - *p-- = 0; - // Reverse it. - char *q = buf; - while (q < p) { - char temp = *q; - *q = *p; - *p = temp; - --p; - ++q; - } - break; - } - default: - assert(0); - } - return buf; -} - -void field_expr::evaluate(int, const reference &ref, - string &result, substring_position &) -{ - const char *end; - const char *start = ref.get_field(name, &end); - if (start) { - start = nth_field(number, start, &end); - if (start) - result.append(start, end - start); - } -} - -void literal_expr::evaluate(int, const reference &, - string &result, substring_position &) -{ - result += s; -} - -analyzed_expr::analyzed_expr(expression *e) -: unary_expr(e), flags(e ? e->analyze() : 0) -{ -} - -void analyzed_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &pos) -{ - if (expr) - expr->evaluate(tentative, ref, result, pos); -} - -void star_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &pos) -{ - const label_info *lp = ref.get_label_ptr(); - if (!tentative - && (lp == 0 || lp->total > 1) - && expr) - expr->evaluate(tentative, ref, result, pos); -} - -void separator_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &pos) -{ - int start_length = result.length(); - int is_first = pos.start < 0; - if (expr) - expr->evaluate(tentative, ref, result, pos); - if (is_first) { - pos.start = start_length; - pos.length = result.length() - start_length; - } -} - -void map_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &) -{ - if (expr) { - string temp; - substring_position temp_pos; - expr->evaluate(tentative, ref, temp, temp_pos); - (*func)(temp.contents(), temp.contents() + temp.length(), result); - } -} - -void extractor_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &) -{ - if (expr) { - string temp; - substring_position temp_pos; - expr->evaluate(tentative, ref, temp, temp_pos); - const char *end, *start = (*func)(temp.contents(), - temp.contents() + temp.length(), - &end); - switch (part) { - case BEFORE: - if (start) - result.append(temp.contents(), start - temp.contents()); - else - result += temp; - break; - case MATCH: - if (start) - result.append(start, end - start); - break; - case AFTER: - if (start) - result.append(end, temp.contents() + temp.length() - end); - break; - default: - assert(0); - } - } -} - -static void first_part(int len, const char *ptr, const char *end, - string &result) -{ - for (;;) { - const char *token_start = ptr; - if (!get_token(&ptr, end)) - break; - const token_info *ti = lookup_token(token_start, ptr); - int counts = ti->sortify_non_empty(token_start, ptr); - if (counts && --len < 0) - break; - if (counts || ti->is_accent()) - result.append(token_start, ptr - token_start); - } -} - -static void last_part(int len, const char *ptr, const char *end, - string &result) -{ - const char *start = ptr; - int count = 0; - for (;;) { - const char *token_start = ptr; - if (!get_token(&ptr, end)) - break; - const token_info *ti = lookup_token(token_start, ptr); - if (ti->sortify_non_empty(token_start, ptr)) - count++; - } - ptr = start; - int skip = count - len; - if (skip > 0) { - for (;;) { - const char *token_start = ptr; - if (!get_token(&ptr, end)) - assert(0); - const token_info *ti = lookup_token(token_start, ptr); - if (ti->sortify_non_empty(token_start, ptr) && --skip < 0) { - ptr = token_start; - break; - } - } - } - first_part(len, ptr, end, result); -} - -void truncate_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &) -{ - if (expr) { - string temp; - substring_position temp_pos; - expr->evaluate(tentative, ref, temp, temp_pos); - const char *start = temp.contents(); - const char *end = start + temp.length(); - if (n > 0) - first_part(n, start, end, result); - else if (n < 0) - last_part(-n, start, end, result); - } -} - -void alternative_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &pos) -{ - int start_length = result.length(); - if (expr1) - expr1->evaluate(tentative, ref, result, pos); - if (result.length() == start_length && expr2) - expr2->evaluate(tentative, ref, result, pos); -} - -void list_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &pos) -{ - if (expr1) - expr1->evaluate(tentative, ref, result, pos); - if (expr2) - expr2->evaluate(tentative, ref, result, pos); -} - -void substitute_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &pos) -{ - int start_length = result.length(); - if (expr1) - expr1->evaluate(tentative, ref, result, pos); - if (result.length() > start_length && result[result.length() - 1] == '-') { - // ought to see if pos covers the - - result.set_length(result.length() - 1); - if (expr2) - expr2->evaluate(tentative, ref, result, pos); - } -} - -void conditional_expr::evaluate(int tentative, const reference &ref, - string &result, substring_position &pos) -{ - string temp; - substring_position temp_pos; - if (expr1) - expr1->evaluate(tentative, ref, temp, temp_pos); - if (temp.length() > 0) { - if (expr2) - expr2->evaluate(tentative, ref, result, pos); - } - else { - if (expr3) - expr3->evaluate(tentative, ref, result, pos); - } -} - -void reference::pre_compute_label() -{ - if (parsed_label != 0 - && (parsed_label->analyze() & expression::CONTAINS_VARIABLE)) { - label.clear(); - substring_position temp_pos; - parsed_label->evaluate(1, *this, label, temp_pos); - label_ptr = lookup_label(label); - } -} - -void reference::compute_label() -{ - label.clear(); - if (parsed_label) - parsed_label->evaluate(0, *this, label, separator_pos); - if (short_label_flag && parsed_short_label) - parsed_short_label->evaluate(0, *this, short_label, short_separator_pos); - if (date_as_label) { - string new_date; - if (parsed_date_label) { - substring_position temp_pos; - parsed_date_label->evaluate(0, *this, new_date, temp_pos); - } - set_date(new_date); - } - if (label_ptr) - label_ptr->count += 1; -} - -void reference::immediate_compute_label() -{ - if (label_ptr) - label_ptr->total = 2; // force use of disambiguator - compute_label(); -} - -int reference::merge_labels(reference **v, int n, label_type type, - string &result) -{ - if (abbreviate_label_ranges) - return merge_labels_by_number(v, n, type, result); - else - return merge_labels_by_parts(v, n, type, result); -} - -int reference::merge_labels_by_number(reference **v, int n, label_type type, - string &result) -{ - if (n <= 1) - return 0; - int num = get_number(); - // Only merge three or more labels. - if (v[0]->get_number() != num + 1 - || v[1]->get_number() != num + 2) - return 0; - int i; - for (i = 2; i < n; i++) - if (v[i]->get_number() != num + i + 1) - break; - result = get_label(type); - result += label_range_indicator; - result += v[i - 1]->get_label(type); - return i; -} - -const substring_position &reference::get_separator_pos(label_type type) const -{ - if (type == SHORT_LABEL && short_label_flag) - return short_separator_pos; - else - return separator_pos; -} - -const string &reference::get_label(label_type type) const -{ - if (type == SHORT_LABEL && short_label_flag) - return short_label; - else - return label; -} - -int reference::merge_labels_by_parts(reference **v, int n, label_type type, - string &result) -{ - if (n <= 0) - return 0; - const string &lb = get_label(type); - const substring_position &sp = get_separator_pos(type); - if (sp.start < 0 - || sp.start != v[0]->get_separator_pos(type).start - || memcmp(lb.contents(), v[0]->get_label(type).contents(), - sp.start) != 0) - return 0; - result = lb; - int i = 0; - do { - result += separate_label_second_parts; - const substring_position &s = v[i]->get_separator_pos(type); - int sep_end_pos = s.start + s.length; - result.append(v[i]->get_label(type).contents() + sep_end_pos, - v[i]->get_label(type).length() - sep_end_pos); - } while (++i < n - && sp.start == v[i]->get_separator_pos(type).start - && memcmp(lb.contents(), v[i]->get_label(type).contents(), - sp.start) == 0); - return i; -} - -string label_pool; - -label_info::label_info(const string &s) -: count(0), total(1), length(s.length()), start(label_pool.length()) -{ - label_pool += s; -} - -static label_info **label_table = 0; -static int label_table_size = 0; -static int label_table_used = 0; - -label_info *lookup_label(const string &label) -{ - if (label_table == 0) { - label_table = new label_info *[17]; - label_table_size = 17; - for (int i = 0; i < 17; i++) - label_table[i] = 0; - } - unsigned h = hash_string(label.contents(), label.length()) % label_table_size; - label_info **ptr; - for (ptr = label_table + h; - *ptr != 0; - (ptr == label_table) - ? (ptr = label_table + label_table_size - 1) - : ptr--) - if ((*ptr)->length == label.length() - && memcmp(label_pool.contents() + (*ptr)->start, label.contents(), - label.length()) == 0) { - (*ptr)->total += 1; - return *ptr; - } - label_info *result = *ptr = new label_info(label); - if (++label_table_used * 2 > label_table_size) { - // Rehash the table. - label_info **old_table = label_table; - int old_size = label_table_size; - label_table_size = next_size(label_table_size); - label_table = new label_info *[label_table_size]; - int i; - for (i = 0; i < label_table_size; i++) - label_table[i] = 0; - for (i = 0; i < old_size; i++) - if (old_table[i]) { - unsigned h = hash_string(label_pool.contents() + old_table[i]->start, - old_table[i]->length); - label_info **p; - for (p = label_table + (h % label_table_size); - *p != 0; - (p == label_table) - ? (p = label_table + label_table_size - 1) - : --p) - ; - *p = old_table[i]; - } - a_delete old_table; - } - return result; -} - -void clear_labels() -{ - for (int i = 0; i < label_table_size; i++) { - delete label_table[i]; - label_table[i] = 0; - } - label_table_used = 0; - label_pool.clear(); -} - -static void consider_authors(reference **start, reference **end, int i); - -void compute_labels(reference **v, int n) -{ - if (parsed_label - && (parsed_label->analyze() & expression::CONTAINS_AT) - && sort_fields.length() >= 2 - && sort_fields[0] == 'A' - && sort_fields[1] == '+') - consider_authors(v, v + n, 0); - for (int i = 0; i < n; i++) - v[i]->compute_label(); -} - - -/* A reference with a list of authors <A0,A1,...,AN> _needs_ author i -where 0 <= i <= N if there exists a reference with a list of authors -<B0,B1,...,BM> such that <A0,A1,...,AN> != <B0,B1,...,BM> and M >= i -and Aj = Bj for 0 <= j < i. In this case if we can't say ``A0, -A1,...,A(i-1) et al'' because this would match both <A0,A1,...,AN> and -<B0,B1,...,BM>. If a reference needs author i we only have to call -need_author(j) for some j >= i such that the reference also needs -author j. */ - -/* This function handles 2 tasks: -determine which authors are needed (cannot be elided with et al.); -determine which authors can have only last names in the labels. - -References >= start and < end have the same first i author names. -Also they're sorted by A+. */ - -static void consider_authors(reference **start, reference **end, int i) -{ - if (start >= end) - return; - reference **p = start; - if (i >= (*p)->get_nauthors()) { - for (++p; p < end && i >= (*p)->get_nauthors(); p++) - ; - if (p < end && i > 0) { - // If we have an author list <A B C> and an author list <A B C D>, - // then both lists need C. - for (reference **q = start; q < end; q++) - (*q)->need_author(i - 1); - } - start = p; - } - while (p < end) { - reference **last_name_start = p; - reference **name_start = p; - for (++p; - p < end && i < (*p)->get_nauthors() - && same_author_last_name(**last_name_start, **p, i); - p++) { - if (!same_author_name(**name_start, **p, i)) { - consider_authors(name_start, p, i + 1); - name_start = p; - } - } - consider_authors(name_start, p, i + 1); - if (last_name_start == name_start) { - for (reference **q = last_name_start; q < p; q++) - (*q)->set_last_name_unambiguous(i); - } - // If we have an author list <A B C D> and <A B C E>, then the lists - // need author D and E respectively. - if (name_start > start || p < end) { - for (reference **q = last_name_start; q < p; q++) - (*q)->need_author(i); - } - } -} - -int same_author_last_name(const reference &r1, const reference &r2, int n) -{ - const char *ae1; - const char *as1 = r1.get_sort_field(0, n, 0, &ae1); - assert(as1 != 0); - const char *ae2; - const char *as2 = r2.get_sort_field(0, n, 0, &ae2); - assert(as2 != 0); - return ae1 - as1 == ae2 - as2 && memcmp(as1, as2, ae1 - as1) == 0; -} - -int same_author_name(const reference &r1, const reference &r2, int n) -{ - const char *ae1; - const char *as1 = r1.get_sort_field(0, n, -1, &ae1); - assert(as1 != 0); - const char *ae2; - const char *as2 = r2.get_sort_field(0, n, -1, &ae2); - assert(as2 != 0); - return ae1 - as1 == ae2 - as2 && memcmp(as1, as2, ae1 - as1) == 0; -} - - -void int_set::set(int i) -{ - assert(i >= 0); - int bytei = i >> 3; - if (bytei >= v.length()) { - int old_length = v.length(); - v.set_length(bytei + 1); - for (int j = old_length; j <= bytei; j++) - v[j] = 0; - } - v[bytei] |= 1 << (i & 7); -} - -int int_set::get(int i) const -{ - assert(i >= 0); - int bytei = i >> 3; - return bytei >= v.length() ? 0 : (v[bytei] & (1 << (i & 7))) != 0; -} - -void reference::set_last_name_unambiguous(int i) -{ - last_name_unambiguous.set(i); -} - -void reference::need_author(int n) -{ - if (n > last_needed_author) - last_needed_author = n; -} - -const char *reference::get_authors(const char **end) const -{ - if (!computed_authors) { - ((reference *)this)->computed_authors = 1; - string &result = ((reference *)this)->authors; - int na = get_nauthors(); - result.clear(); - for (int i = 0; i < na; i++) { - if (last_name_unambiguous.get(i)) { - const char *e, *start = get_author_last_name(i, &e); - assert(start != 0); - result.append(start, e - start); - } - else { - const char *e, *start = get_author(i, &e); - assert(start != 0); - result.append(start, e - start); - } - if (i == last_needed_author - && et_al.length() > 0 - && et_al_min_elide > 0 - && last_needed_author + et_al_min_elide < na - && na >= et_al_min_total) { - result += et_al; - break; - } - if (i < na - 1) { - if (na == 2) - result += join_authors_exactly_two; - else if (i < na - 2) - result += join_authors_default; - else - result += join_authors_last_two; - } - } - } - const char *start = authors.contents(); - *end = start + authors.length(); - return start; -} - -int reference::get_nauthors() const -{ - if (nauthors < 0) { - const char *dummy; - int na; - for (na = 0; get_author(na, &dummy) != 0; na++) - ; - ((reference *)this)->nauthors = na; - } - return nauthors; -} -#line 1249 "y.tab.c" -#define YYABORT goto yyabort -#define YYACCEPT goto yyaccept -#define YYERROR goto yyerrlab - -#if YYDEBUG -#ifdef __cplusplus -extern "C" char *getenv(); -#else -extern char *getenv(); -#endif -#endif - -int -yyparse() -{ - register int yym, yyn, yystate; - register YYSTYPE *yyvsp; - register short *yyssp; - short *yysse; -#if YYDEBUG - register YYCONST char *yys; - - if (yys = getenv("YYDEBUG")) - { - yyn = *yys; - if (yyn >= '0' && yyn <= '9') - yydebug = yyn - '0'; - } -#endif - - yynerrs = 0; - yyerrflag = 0; - yychar = (-1); - - if (yyss == 0) - { - yyss = (short *) yymalloc (YYINITDEPTH * sizeof (short)); - if (yyss == 0) - goto yyabort; - yyvs = (YYSTYPE *) yymalloc (YYINITDEPTH * sizeof (YYSTYPE)); - if (yyvs == 0) - { - yyfree (yyss); - goto yyabort; - } - yystacksize = YYINITDEPTH; - } - yysse = yyss + yystacksize - 1; - yyssp = yyss; - yyvsp = yyvs; - *yyssp = yystate = 0; - -yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", yystate, - yychar, yys); - } -#endif - } - if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, shifting to state %d\n", - yystate, yytable[yyn]); -#endif - if (yyssp >= yysse) - { - /* FIXME: Rework so there's only one of these. */ - int depth = yyssp - yyss; - if (yygrow () != 0) - goto yyoverflow; - yysse = yyss + yystacksize - 1; - yyssp = yyss + depth; - yyvsp = yyvs + depth; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - yychar = (-1); - if (yyerrflag > 0) --yyerrflag; - goto yyloop; - } - if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yychar) - { - yyn = yytable[yyn]; - goto yyreduce; - } - if (yyerrflag) goto yyinrecovery; -#ifdef lint - goto yynewerror; -#endif -yynewerror: - yyerror("syntax error"); -#ifdef lint - goto yyerrlab; -#endif -yyerrlab: - ++yynerrs; -yyinrecovery: - if (yyerrflag < 3) - { - yyerrflag = 3; - for (;;) - { - if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, error recovery shifting\ - to state %d\n", *yyssp, yytable[yyn]); -#endif - if (yyssp >= yysse) - { - int depth = yyssp - yyss; - if (yygrow () != 0) - goto yyoverflow; - yysse = yyss + yystacksize - 1; - yyssp = yyss + depth; - yyvsp = yyvs + depth; - } - *++yyssp = yystate = yytable[yyn]; - *++yyvsp = yylval; - goto yyloop; - } - else - { -#if YYDEBUG - if (yydebug) - printf("yydebug: error recovery discarding state %d\n", - *yyssp); -#endif - if (yyssp <= yyss) goto yyabort; - --yyssp; - --yyvsp; - } - } - } - else - { - if (yychar == 0) goto yyabort; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, error recovery discards token %d (%s)\n", - yystate, yychar, yys); - } -#endif - yychar = (-1); - goto yyloop; - } -yyreduce: -#if YYDEBUG - if (yydebug) - printf("yydebug: state %d, reducing by rule %d (%s)\n", - yystate, yyn, yyrule[yyn]); -#endif - yym = yylen[yyn]; - yyval = yyvsp[1-yym]; - switch (yyn) - { -case 1: -#line 250 "label.y" -{ parse_result = (yyvsp[0].expr ? new analyzed_expr(yyvsp[0].expr) : 0); } -break; -case 2: -#line 255 "label.y" -{ yyval.expr = yyvsp[0].expr; } -break; -case 3: -#line 257 "label.y" -{ yyval.expr = new conditional_expr(yyvsp[-4].expr, yyvsp[-2].expr, yyvsp[0].expr); } -break; -case 4: -#line 262 "label.y" -{ yyval.expr = 0; } -break; -case 5: -#line 264 "label.y" -{ yyval.expr = yyvsp[0].expr; } -break; -case 6: -#line 269 "label.y" -{ yyval.expr = yyvsp[0].expr; } -break; -case 7: -#line 271 "label.y" -{ yyval.expr = new alternative_expr(yyvsp[-2].expr, yyvsp[0].expr); } -break; -case 8: -#line 273 "label.y" -{ yyval.expr = new conditional_expr(yyvsp[-2].expr, yyvsp[0].expr, 0); } -break; -case 9: -#line 278 "label.y" -{ yyval.expr = yyvsp[0].expr; } -break; -case 10: -#line 280 "label.y" -{ yyval.expr = new list_expr(yyvsp[-1].expr, yyvsp[0].expr); } -break; -case 11: -#line 285 "label.y" -{ yyval.expr = yyvsp[0].expr; } -break; -case 12: -#line 287 "label.y" -{ yyval.expr = new substitute_expr(yyvsp[-2].expr, yyvsp[0].expr); } -break; -case 13: -#line 292 "label.y" -{ yyval.expr = new at_expr; } -break; -case 14: -#line 294 "label.y" -{ - yyval.expr = new literal_expr(literals.contents() + yyvsp[0].str.start, - yyvsp[0].str.len); - } -break; -case 15: -#line 299 "label.y" -{ yyval.expr = new field_expr(yyvsp[0].num, 0); } -break; -case 16: -#line 301 "label.y" -{ yyval.expr = new field_expr(yyvsp[-1].num, yyvsp[0].num - 1); } -break; -case 17: -#line 303 "label.y" -{ - switch (yyvsp[0].num) { - case 'I': - case 'i': - case 'A': - case 'a': - yyval.expr = new format_expr(yyvsp[0].num); - break; - default: - command_error("unrecognized format `%1'", char(yyvsp[0].num)); - yyval.expr = new format_expr('a'); - break; - } - } -break; -case 18: -#line 319 "label.y" -{ - yyval.expr = new format_expr('0', yyvsp[0].dig.ndigits, yyvsp[0].dig.val); - } -break; -case 19: -#line 323 "label.y" -{ - switch (yyvsp[-1].num) { - case 'l': - yyval.expr = new map_expr(yyvsp[-4].expr, lowercase); - break; - case 'u': - yyval.expr = new map_expr(yyvsp[-4].expr, uppercase); - break; - case 'c': - yyval.expr = new map_expr(yyvsp[-4].expr, capitalize); - break; - case 'r': - yyval.expr = new map_expr(yyvsp[-4].expr, reverse_name); - break; - case 'a': - yyval.expr = new map_expr(yyvsp[-4].expr, abbreviate_name); - break; - case 'y': - yyval.expr = new extractor_expr(yyvsp[-4].expr, find_year, yyvsp[-2].num); - break; - case 'n': - yyval.expr = new extractor_expr(yyvsp[-4].expr, find_last_name, yyvsp[-2].num); - break; - default: - yyval.expr = yyvsp[-4].expr; - command_error("unknown function `%1'", char(yyvsp[-1].num)); - break; - } - } -break; -case 20: -#line 354 "label.y" -{ yyval.expr = new truncate_expr(yyvsp[-2].expr, yyvsp[0].num); } -break; -case 21: -#line 356 "label.y" -{ yyval.expr = new truncate_expr(yyvsp[-2].expr, -yyvsp[0].num); } -break; -case 22: -#line 358 "label.y" -{ yyval.expr = new star_expr(yyvsp[-1].expr); } -break; -case 23: -#line 360 "label.y" -{ yyval.expr = yyvsp[-1].expr; } -break; -case 24: -#line 362 "label.y" -{ yyval.expr = new separator_expr(yyvsp[-1].expr); } -break; -case 25: -#line 367 "label.y" -{ yyval.num = -1; } -break; -case 26: -#line 369 "label.y" -{ yyval.num = yyvsp[0].num; } -break; -case 27: -#line 374 "label.y" -{ yyval.num = yyvsp[0].num; } -break; -case 28: -#line 376 "label.y" -{ yyval.num = yyvsp[-1].num*10 + yyvsp[0].num; } -break; -case 29: -#line 381 "label.y" -{ yyval.dig.ndigits = 1; yyval.dig.val = yyvsp[0].num; } -break; -case 30: -#line 383 "label.y" -{ yyval.dig.ndigits = yyvsp[-1].dig.ndigits + 1; yyval.dig.val = yyvsp[-1].dig.val*10 + yyvsp[0].num; } -break; -case 31: -#line 389 "label.y" -{ yyval.num = 0; } -break; -case 32: -#line 391 "label.y" -{ yyval.num = 1; } -break; -case 33: -#line 393 "label.y" -{ yyval.num = -1; } -break; -#line 1603 "y.tab.c" - } - yyssp -= yym; - yystate = *yyssp; - yyvsp -= yym; - yym = yylhs[yyn]; - if (yystate == 0 && yym == 0) - { -#if YYDEBUG - if (yydebug) - printf("yydebug: after reduction, shifting from state 0 to\ - state %d\n", YYFINAL); -#endif - yystate = YYFINAL; - *++yyssp = YYFINAL; - *++yyvsp = yyval; - if (yychar < 0) - { - if ((yychar = yylex()) < 0) yychar = 0; -#if YYDEBUG - if (yydebug) - { - yys = 0; - if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; - if (!yys) yys = "illegal-symbol"; - printf("yydebug: state %d, reading %d (%s)\n", - YYFINAL, yychar, yys); - } -#endif - } - if (yychar == 0) goto yyaccept; - goto yyloop; - } - if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && - yyn <= YYTABLESIZE && yycheck[yyn] == yystate) - yystate = yytable[yyn]; - else - yystate = yydgoto[yym]; -#if YYDEBUG - if (yydebug) - printf("yydebug: after reduction, shifting from state %d \ -to state %d\n", *yyssp, yystate); -#endif - if (yyssp >= yysse) - { - int depth = yyssp - yyss; - if (yygrow () != 0) - goto yyoverflow; - yysse = yyss + yystacksize - 1; - yyssp = yyss + depth; - yyvsp = yyvs + depth; - } - *++yyssp = yystate; - *++yyvsp = yyval; - goto yyloop; -yyoverflow: - yyerror("yacc stack overflow"); -yyabort: - return (1); -yyaccept: - return (0); -} - -static int -yygrow () -{ - int old_stacksize = yystacksize; - short *new_yyss; - YYSTYPE *new_yyvs; - - if (yystacksize >= YYMAXDEPTH) - return (1); - yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#if YYDEBUG - if (yydebug) - printf("yydebug: growing stack size from %d to %d\n", - old_stacksize, yystacksize); -#endif - new_yyss = (short *) yyrealloc (yyss, yystacksize * sizeof (short)); - if (new_yyss == 0) - return (1); - new_yyvs = (YYSTYPE *) yyrealloc (yyvs, yystacksize * sizeof (YYSTYPE)); - if (new_yyvs == 0) - { - yyfree (new_yyss); - return (1); - } - yyss = new_yyss; - yyvs = new_yyvs; - return (0); -} - -static YYPTR -YYDEFUN (yymalloc, (bytes), unsigned bytes) -{ - YYPTR ptr = (YYPTR) malloc (bytes); - if (ptr != 0) return (ptr); - yyerror ("yyparse: memory exhausted"); - return (0); -} - -static YYPTR -YYDEFUN (yyrealloc, (old, bytes), YYPTR old YYAND unsigned bytes) -{ - YYPTR ptr = (YYPTR) realloc (old, bytes); - if (ptr != 0) return (ptr); - yyerror ("yyparse: memory exhausted"); - return (0); -} |