diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/quicspool/libqmsquery |
Initial commit
Diffstat (limited to 'dviware/quicspool/libqmsquery')
22 files changed, 1718 insertions, 0 deletions
diff --git a/dviware/quicspool/libqmsquery/lexsed b/dviware/quicspool/libqmsquery/lexsed new file mode 100644 index 0000000000..f480aae584 --- /dev/null +++ b/dviware/quicspool/libqmsquery/lexsed @@ -0,0 +1,17 @@ +s/^yylex()/static &/ +s/^FILE \*yyin/static &/ +s/^int yyvstop\[\]/static &/ +s/^struct.*yycrank\[\] =/static &/ +s/^struct.*yysvec\[\] =/static &/ +s/^struct yywork \*yytop/static &/ +s/^struct yysvf \*yybgin/static &/ +s/^char yymatch\[\]/static &/ +s/^char yyextra\[\]/static &/ +s/^int yylineno/static &/ +s/^char \*yysptr/static &/ +s/^int yyprevious/static &/ +s/^yylook()/static &/ +s/^yyback(p, m)/static &/ +s/^yyinput(){/static &/ +s/^yyoutput(c)/static &/ +s/^yyunput(c)/static &/ diff --git a/dviware/quicspool/libqmsquery/makefile b/dviware/quicspool/libqmsquery/makefile new file mode 100644 index 0000000000..2e628be509 --- /dev/null +++ b/dviware/quicspool/libqmsquery/makefile @@ -0,0 +1,136 @@ +# $Header: Makefile,v 1.1 88/01/15 12:18:46 simpson Rel $ +# $Log: Makefile,v $ +#Revision 1.1 88/01/15 12:18:46 simpson +#initial release +# +#Revision 0.1 87/12/11 17:22:31 simpson +#beta test +# +INCLUDE=/usr/include/local +LIB=/usr/local/lib + +all: libqmsquery.a + +# This system include file is need right away +configure: + install -c -m 644 qms.h $(INCLUDE) + +libqmsquery.a: qmsquery.o qmsmap.o qmspag.o qmsovl.o qmspfp.o qmsopc.o \ + qmsram.o qmsfnt.o qmsver.o + ar rc $@ qmsquery.o qmsmap.o qmspag.o qmsovl.o qmspfp.o qmsopc.o \ + qmsram.o qmsfnt.o qmsver.o + ranlib $@ + +qmsquery.o: qms.h + +qmsmap.o: qms.h qmsmaplex.c + +qmsmap.c: qmsmap.y + $(YACC) $(YFLAGS) qmsmap.y + sed -f yaccsed < y.tab.c > qmsmap.c + rm y.tab.c + +qmsmaplex.c: qmsmaplex.l + $(LEX) $(LFLAGS) qmsmaplex.l + sed -f lexsed < lex.yy.c > qmsmaplex.c + rm lex.yy.c + +qmspag.o: qms.h qmspaglex.c + +qmspag.c: qmspag.y + $(YACC) $(YFLAGS) qmspag.y + sed -f yaccsed < y.tab.c > qmspag.c + rm y.tab.c + +qmspaglex.c: qmspaglex.l + $(LEX) $(LFLAGS) qmspaglex.l + sed -f lexsed < lex.yy.c > qmspaglex.c + rm lex.yy.c + +qmsovl.o: qms.h qmsovllex.c + +qmsovl.c: qmsovl.y + $(YACC) $(YFLAGS) qmsovl.y + sed -f yaccsed < y.tab.c > qmsovl.c + rm y.tab.c + +qmsovllex.c: qmsovllex.l + $(LEX) $(LFLAGS) qmsovllex.l + sed -f lexsed < lex.yy.c > qmsovllex.c + rm lex.yy.c + +qmspfp.o: qms.h qmspfplex.c + +qmspfp.c: qmspfp.y + $(YACC) $(YFLAGS) qmspfp.y + sed -f yaccsed < y.tab.c > qmspfp.c + rm y.tab.c + +qmspfplex.c: qmspfplex.l + $(LEX) $(LFLAGS) qmspfplex.l + sed -f lexsed < lex.yy.c > qmspfplex.c + rm lex.yy.c + +qmsopc.o: qms.h qmsopclex.c + +qmsopc.c: qmsopc.y + $(YACC) $(YFLAGS) qmsopc.y + sed -f yaccsed < y.tab.c > qmsopc.c + rm y.tab.c + +qmsopclex.c: qmsopclex.l + $(LEX) $(LFLAGS) qmsopclex.l + sed -f lexsed < lex.yy.c > qmsopclex.c + rm lex.yy.c + +qmsram.o: qms.h qmsramlex.c + +qmsram.c: qmsram.y + $(YACC) $(YFLAGS) qmsram.y + sed -f yaccsed < y.tab.c > qmsram.c + rm y.tab.c + +qmsramlex.c: qmsramlex.l + $(LEX) $(LFLAGS) qmsramlex.l + sed -f lexsed < lex.yy.c > qmsramlex.c + rm lex.yy.c + +qmsfnt.o: qms.h qmsfntlex.c + +qmsfnt.c: qmsfnt.y + $(YACC) $(YFLAGS) qmsfnt.y + sed -f yaccsed < y.tab.c > qmsfnt.c + rm y.tab.c + +qmsfntlex.c: qmsfntlex.l + $(LEX) $(LFLAGS) qmsfntlex.l + sed -f lexsed < lex.yy.c > qmsfntlex.c + rm lex.yy.c + +qmsver.o: qms.h qmsverlex.c + +qmsver.c: qmsver.y + $(YACC) $(YFLAGS) qmsver.y + sed -f yaccsed < y.tab.c > qmsver.c + rm y.tab.c + +qmsverlex.c: qmsverlex.l + $(LEX) $(LFLAGS) qmsverlex.l + sed -f lexsed < lex.yy.c > qmsverlex.c + rm lex.yy.c + +install: + install -c -m 644 qms.h $(INCLUDE) + install -m 644 libqmsquery.a $(LIB) + +clean: + -rm -f *.o y.tab.c lex.yy.c libqmsquery.a \ + qmsmap.c qmsmaplex.c \ + qmspag.c qmspaglex.c \ + qmsovl.c qmsovllex.c \ + qmspfp.c qmspfplex.c \ + qmsopc.c qmsopclex.c \ + qmsram.c qmsramlex.c \ + qmsfnt.c qmsfntlex.c \ + qmsver.c qmsverlex.c + diff --git a/dviware/quicspool/libqmsquery/makefile.trw b/dviware/quicspool/libqmsquery/makefile.trw new file mode 100644 index 0000000000..f0ea4485a8 --- /dev/null +++ b/dviware/quicspool/libqmsquery/makefile.trw @@ -0,0 +1,136 @@ +# $Header: Makefile.TRW,v 1.1 88/01/15 12:18:50 simpson Rel $ +# $Log: Makefile.TRW,v $ +#Revision 1.1 88/01/15 12:18:50 simpson +#initial release +# +#Revision 0.1 87/12/11 17:22:32 simpson +#beta test +# +INCLUDE=/usr/include/local +LIB=/usr/local/lib + +all: libqmsquery.a + +# This system include file is need right away +configure: + install -c -m 644 qms.h $(INCLUDE) + +libqmsquery.a: qmsquery.o qmsmap.o qmspag.o qmsovl.o qmspfp.o qmsopc.o \ + qmsram.o qmsfnt.o qmsver.o + ar rc $@ qmsquery.o qmsmap.o qmspag.o qmsovl.o qmspfp.o qmsopc.o \ + qmsram.o qmsfnt.o qmsver.o + ranlib $@ + +qmsquery.o: qms.h + +qmsmap.o: qms.h qmsmaplex.c + +qmsmap.c: qmsmap.y + $(YACC) $(YFLAGS) qmsmap.y + sed -f yaccsed < y.tab.c > qmsmap.c + rm y.tab.c + +qmsmaplex.c: qmsmaplex.l + $(LEX) $(LFLAGS) qmsmaplex.l + sed -f lexsed < lex.yy.c > qmsmaplex.c + rm lex.yy.c + +qmspag.o: qms.h qmspaglex.c + +qmspag.c: qmspag.y + $(YACC) $(YFLAGS) qmspag.y + sed -f yaccsed < y.tab.c > qmspag.c + rm y.tab.c + +qmspaglex.c: qmspaglex.l + $(LEX) $(LFLAGS) qmspaglex.l + sed -f lexsed < lex.yy.c > qmspaglex.c + rm lex.yy.c + +qmsovl.o: qms.h qmsovllex.c + +qmsovl.c: qmsovl.y + $(YACC) $(YFLAGS) qmsovl.y + sed -f yaccsed < y.tab.c > qmsovl.c + rm y.tab.c + +qmsovllex.c: qmsovllex.l + $(LEX) $(LFLAGS) qmsovllex.l + sed -f lexsed < lex.yy.c > qmsovllex.c + rm lex.yy.c + +qmspfp.o: qms.h qmspfplex.c + +qmspfp.c: qmspfp.y + $(YACC) $(YFLAGS) qmspfp.y + sed -f yaccsed < y.tab.c > qmspfp.c + rm y.tab.c + +qmspfplex.c: qmspfplex.l + $(LEX) $(LFLAGS) qmspfplex.l + sed -f lexsed < lex.yy.c > qmspfplex.c + rm lex.yy.c + +qmsopc.o: qms.h qmsopclex.c + +qmsopc.c: qmsopc.y + $(YACC) $(YFLAGS) qmsopc.y + sed -f yaccsed < y.tab.c > qmsopc.c + rm y.tab.c + +qmsopclex.c: qmsopclex.l + $(LEX) $(LFLAGS) qmsopclex.l + sed -f lexsed < lex.yy.c > qmsopclex.c + rm lex.yy.c + +qmsram.o: qms.h qmsramlex.c + +qmsram.c: qmsram.y + $(YACC) $(YFLAGS) qmsram.y + sed -f yaccsed < y.tab.c > qmsram.c + rm y.tab.c + +qmsramlex.c: qmsramlex.l + $(LEX) $(LFLAGS) qmsramlex.l + sed -f lexsed < lex.yy.c > qmsramlex.c + rm lex.yy.c + +qmsfnt.o: qms.h qmsfntlex.c + +qmsfnt.c: qmsfnt.y + $(YACC) $(YFLAGS) qmsfnt.y + sed -f yaccsed < y.tab.c > qmsfnt.c + rm y.tab.c + +qmsfntlex.c: qmsfntlex.l + $(LEX) $(LFLAGS) qmsfntlex.l + sed -f lexsed < lex.yy.c > qmsfntlex.c + rm lex.yy.c + +qmsver.o: qms.h qmsverlex.c + +qmsver.c: qmsver.y + $(YACC) $(YFLAGS) qmsver.y + sed -f yaccsed < y.tab.c > qmsver.c + rm y.tab.c + +qmsverlex.c: qmsverlex.l + $(LEX) $(LFLAGS) qmsverlex.l + sed -f lexsed < lex.yy.c > qmsverlex.c + rm lex.yy.c + +install: + install -c -m 644 qms.h $(INCLUDE) + install -m 644 libqmsquery.a $(LIB) + +clean: + -rm -f *.o y.tab.c lex.yy.c libqmsquery.a \ + qmsmap.c qmsmaplex.c \ + qmspag.c qmspaglex.c \ + qmsovl.c qmsovllex.c \ + qmspfp.c qmspfplex.c \ + qmsopc.c qmsopclex.c \ + qmsram.c qmsramlex.c \ + qmsfnt.c qmsfntlex.c \ + qmsver.c qmsverlex.c + diff --git a/dviware/quicspool/libqmsquery/qms.h b/dviware/quicspool/libqmsquery/qms.h new file mode 100644 index 0000000000..7f28db646f --- /dev/null +++ b/dviware/quicspool/libqmsquery/qms.h @@ -0,0 +1,186 @@ +/* $Header: qms.h,v 1.1 88/01/15 12:18:55 simpson Rel $ */ +/* +$Log: qms.h,v $ + * Revision 1.1 88/01/15 12:18:55 simpson + * initial release + * + * Revision 0.1 87/12/11 17:11:57 simpson + * beta test + * +*/ +#define QUICON "\r^PY^-\r" /* QUIC Conversion On */ +#define QUICOFF "\r^-^PN^-\r" /* QUIC Conversion Off */ +#define PORTRAIT "^IOP" /* Portrait mode */ +#define LANDSCAPE "^IOL" /* Landscape mode */ +#define COMMAND "^N" /* Change command character */ +#define SYNTAX "^ISYNTAX" /* Set syntax of numeric parameters */ +#define FREEFORM "^F" /* Begin free-form input */ +#define FREEOFF "^O" /* End free-form input */ +#define IGNOREDATA "^X" /* Ignore subsequent input */ +#define ENDIGNORE "^A" /* Stop ignoring data */ +#define INITIALIZE "^IF" /* Select tray, offset page length */ +#define STATUS "^ISTATUS" /* Print status page */ +#define SPECIAL "^$" /* Enter special characters */ +#define INITJUST "^IJ" /* Default top page margin */ +#define INITBOTTOM "^IB" /* Default bottom page margin */ +#define INITTAB "^IT" /* Default left page margin */ +#define JUSTIFY "^J" /* Vertical positioning */ +#define JUSTIFYMARGIN "^JM" /* Vertical positioning from margin */ +#define JUSTIFYRELATIVE "^JR" /* Relative vertical positioning */ +#define JUSTIFYDOTS "^JD" /* Relative vertical in dots */ +#define TAB "^T" /* Horizontal positioning */ +#define TABRELATIVE "^TR" /* Relative horizontal positioning */ +#define TABDOTS "^TD" /* Relative horizontal in dots */ +#define INITMARGVERT "^IMV" /* Default vertical margins */ +#define INITMARGHORZ "^IMH" /* Default horizontal margins */ +#define DEFFONT "^IS" /* Default font select */ +#define FONT "^S" /* Select font */ +#define CHARSPACING "^IC" /* Character spacing */ +#define LINESPACING "^IL" /* Line spacing */ +#define DOWNLOAD "^DF" /* Download font */ +#define ADOWNLOAD "^DFA" /* Advanced download font */ +#define QUICCHAR "^M" /* Quic characters */ +#define VERTQUIC "^V" /* Vertical Quic characters */ +#define LEFTVERTQUIC "^E" /* Left vertical Quic characters */ +#define INVERTQUIC "^U" /* Upside down Quic characters */ +#define DESCENDER "^DL" /* Lower case descenders on */ +#define HALFTONE "^KH" /* Half tone */ +#define HALFTONESELECT "^KL" /* Select a half tone */ +#define REVERSE "^R" /* Reverse image */ +#define LINE "^LS" /* Line drawing */ +#define DASHEDLINE "^LD" /* Dashed lines */ +#define HORLINEPLOT "^LP" /* Horizontal line plotting */ +#define VERTLINEPLOT "^LQ" /* Vertical line plotting */ +#define ARC "^LA" /* Arc drawing */ +#define DECIMALARC "^LAD" /* Decimal arc drawing */ +#define BOX "^LB" /* Box drawing */ +#define FORM "^LF" /* Form drawing */ +#define HORFORM "^LE" /* Horizontal form drawing */ +#define PLOT "^P" /* Plotting */ +#define PATTVEC "^PV" /* Pattern vector */ +#define PLOTEXPAND "^IP" /* Plot expansion */ +#define PENWIDTH "^PW" /* Pen width */ +#define PENUP "^U" /* Pen up */ +#define PENDOWN "^D" /* Pen down */ +#define PENERASE "^E" /* Pen erase */ +#define VECTORON "^IGV" /* Vector graphics on */ +#define VECTOROFF "^IGE" /* Vector graphics off */ +#define BARCHART "^BAR" /* Bar chart drawing */ +#define PIECHART "^LAP" /* Pie chart drawing */ +#define AREAFILL "^LAF" /* Area fill */ +#define REPEAT "^DR" /* Repeat command */ +#define AUTOINCDEC "^Y" /* Automatic increment/decrement */ +#define INFO "^INFO" /* Get information from printer */ +#define COPIES "^DC" /* Number of page copies */ +#define STOREOVERLAY "^DOS" /* Store an overlay sequence */ +#define RECALLOVERLAY "^DOR" /* Recall an overlay sequence */ +#define CLEAROVERLAY "^DOC" /* Clear an overlay sequence */ +#define AUTOOVERLAY "^DAOS" /* Define an automatic overlay */ +#define CLEARAOVERLAY "^DAOC" /* Clear an automatic overlay */ +#define HORBARCODE "^B" /* Horizontal barcodes */ +#define VERTBARCODE "^C" /* Vertical barcodes */ +#define DIABLO "^IWD" /* Enable diablo simulation */ +#define QUME "^IWQ" /* Enable QUME simulation */ +#define EXITSIMULATE "^IWE" /* Exit simulation mode */ +#define PCONFIG "^ICFG" /* Printer configuration */ +#define TEXTPROC "^ISTF" /* Text processing command */ +#define EIGHTBITON "^(" /* Turn on eight bit format */ +#define EIGHTBITOFF "^)" /* Turn off eight bit format */ + +#define ENDPASS "^-" /* End pass */ +#define NEWLINE "^*" /* End pass, new line */ +#define FORMFEED "^," /* End pass, form feed */ +#define ENDCMD "^G" /* Command terminator */ +#define HEIGHT "^H" /* Quic character height */ +#define WIDTH "^W" /* Quic character width */ + +/* Structure returned when requesting MAP info */ +struct qmsmap { + int count; /* Byte count */ + int checksum; + char *data; /* "count" bytes of data terminated by NULL */ + struct qmsmap *next; +}; + +/* Structure returned when requesting PAG info */ +struct qmspag { + char PO; /* Orientation. 'P' or 'L' */ + float TM; /* Top margin */ + float BM; /* Bottom margin */ + float LM; /* Left margin */ + float RM; /* Right margin */ + float LPI; /* Lines per inch */ + float CPI; /* Characters per inch. 0 == Proportional */ + short PT; /* Paper Tray. 0 == Top tray. 1 == Bottom Tray */ + short PS; /* Page Size. 0 == Short. 1 == Long. 2 == European A-4 */ + char SO; /* Stacker Offset. 'Y' or 'N' */ + short CC; /* Copy Count */ +}; + +/* Structure returned when requesting OVL info */ +struct qmsovl { + enum { regular, automatic } ovltype; + /* The number and size are only valid for regular overlays */ + int ovlnumber; /* Overlay number */ + int ovlsize; /* Overlay size in bytes */ + struct qmsovl *next; +}; + +/* Structure returned when requesting PFP info */ +struct qmspfp { + char *module; /* Name of installed module */ + struct qmspfp *next; +}; + +/* Structure returned when requesting OPC info */ +struct qmsopc { + struct optnode *OC1, *OC2, *OC3, *OC4, *OC5; +}; + +struct optnode { + short option; /* Number of option */ + struct optnode *next; +}; + +/* Structure returned when requesting RAM info */ +struct qmsram { + short TR; /* Total Ram memory in printer */ + short AR; /* Current Available Ram memory */ + short FR; /* Font Ram memory used */ + short OR; /* Overlay Ram memory used */ +}; + +/* Structure returned when requesting FNTB info */ +struct qmsfnt { + struct fontnode *rom; /* List of rom fonts */ + struct fontnode *ram; /* List of ram fonts */ +}; + +struct fontnode { + char orientation; /* 'P' or 'L' */ + short number; /* Font number */ + long bytes; /* Number of bytes in printer */ + char version; + char class; /* '1' or '2' */ + struct fontnode *next; +}; + +/* Structure returned when requesting version information */ +struct qmsver { + float version; /* Version of QUIC */ + float firmware; /* Version of the firmware */ + struct date { /* Date of the firmware */ + short month; + short day; + short year; /* Without the 1900 */ + } date; +}; + +struct qmsmap *qmsmap(); +struct qmspag *qmspag(); +struct qmsovl *qmsovl(); +struct qmspfp *qmspfp(); +struct qmsopc *qmsopc(); +struct qmsram *qmsram(); +struct qmsfnt *qmsfnt(); +struct qmsver *qmsver(); diff --git a/dviware/quicspool/libqmsquery/qmsfnt.y b/dviware/quicspool/libqmsquery/qmsfnt.y new file mode 100644 index 0000000000..b670c24d08 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsfnt.y @@ -0,0 +1,94 @@ +%{ +#ifndef lint +static char *rcs = "$Header: qmsfnt.y,v 1.1 88/01/15 12:18:57 simpson Rel $"; +#endif +/* +$Log: qmsfnt.y,v $ + * Revision 1.1 88/01/15 12:18:57 simpson + * initial release + * + * Revision 0.1 87/12/11 17:11:59 simpson + * beta test + * +*/ +#include <stdio.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +extern FILE *_Ifp, *_Ofp; +extern Boolean _FirstChar; +static jmp_buf Env; +char *malloc(); +static struct qmsfnt Fnt; +static struct fontnode *P; +%} +%token FRO FDL INTEGER CHAR NONE ENDLINE +%% +fntlines : fntlines fntline | /* epsilon */ ; + +fntline : + fonttype NONE ENDLINE + { + if ($1 == FRO) + Fnt.rom = NULL; + else + Fnt.ram = NULL; + } + | + fonttype orientation INTEGER 'S' INTEGER 'V' anychar 'C' anychar ENDLINE + { + P = (struct fontnode *)malloc((unsigned)sizeof(struct fontnode)); + if ($1 == FRO) { + P->next = Fnt.rom, Fnt.rom = P; + } else { + P->next = Fnt.ram, Fnt.ram = P; + } + P->orientation = $2; + P->number = $3; + P->bytes = $5; + P->version = $7; + P->class = $9; + } + ; + +fonttype : FRO | FDL ; + +orientation : 'P' | 'L' ; + +anychar : + 'P' | 'L' | 'S' | 'V' | 'C' | CHAR + | + INTEGER + { + $$ = '0' + $1; + } + ; +%% +#include "qmsfntlex.c" + +struct qmsfnt *qmsfnt() +{ + _FirstChar = TRUE; + Fnt.rom = Fnt.ram = NULL; + fputs(QUICON, _Ofp); + fprintf(_Ofp, "%s00000", SYNTAX); + fprintf(_Ofp, "%sFNTB%s", INFO, ENDCMD); + fputs(QUICOFF, _Ofp); + (void)fflush(_Ofp); + if (setjmp(Env)) { + while (timedgetc(_Ifp) != EOF) /* Discard remaining input */ + ; + return NULL; + } + if (yyparse() != 0) + return NULL; + yysptr = yysbuf; /* Resets lex lookahead buffer */ + return &Fnt; +} + +static yyerror(s) +char *s; +{ + longjmp(Env, TRUE); +} diff --git a/dviware/quicspool/libqmsquery/qmsfntlex.l b/dviware/quicspool/libqmsquery/qmsfntlex.l new file mode 100644 index 0000000000..ea94910f97 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsfntlex.l @@ -0,0 +1,43 @@ +/* $Header: qmsfntlex.l,v 1.1 88/01/15 12:19:00 simpson Rel $ */ +%{ +/* +$Log: qmsfntlex.l,v $ + * Revision 1.1 88/01/15 12:19:00 simpson + * initial release + * + * Revision 0.1 87/12/11 21:34:44 simpson + * beta test + * +*/ +#undef input +#define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):timedgetc(_Ifp)) \ + ==10?(yylineno++, yytchar):yytchar)==EOF?0:yytchar) +%} +integer [0-9]+ +%% +FRO: { + yylval = FRO; + return FRO; + } +FDL: { + yylval = FDL; + return FDL; + } +{integer} { + yylval = atoi(yytext); + return INTEGER; + } +P | +L | +S | +V | +C { + yylval = yytext[0]; + return yytext[0]; + } +. { + yylval = yytext[0]; + return CHAR; + } +NONE return NONE; +\r\n return ENDLINE; diff --git a/dviware/quicspool/libqmsquery/qmsmap.y b/dviware/quicspool/libqmsquery/qmsmap.y new file mode 100644 index 0000000000..e535e91bd9 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsmap.y @@ -0,0 +1,108 @@ +%{ +#ifndef lint +static char *rcs = "$Header: qmsmap.y,v 1.1 88/01/15 12:19:03 simpson Rel $"; +#endif +/* +$Log: qmsmap.y,v $ + * Revision 1.1 88/01/15 12:19:03 simpson + * initial release + * + * Revision 0.1 87/12/11 17:12:01 simpson + * beta test + * +*/ +#include <stdio.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +extern FILE *_Ifp, *_Ofp; +extern Boolean _FirstChar; +static jmp_buf Env; +char *malloc(); +static struct qmsmap *MapList, *P; +static int ByteCount, CheckSum; +char S[77]; +%} +%union { + char s[77]; +} +%token <s> MAP MAPEND BYTECOUNT DATA ENDLINE +%% +mapdata : + MAP ENDLINE + datalines + MAPEND ENDLINE + ; + +datalines : + datalines + dataline + { + if (MapList == NULL) { + MapList = (struct qmsmap *)malloc((unsigned) + sizeof(struct qmsmap)); + MapList->count = ByteCount; + MapList->checksum = CheckSum; + (void)strcpy(MapList->data = malloc((unsigned)(strlen(S) + + 1)), S); + MapList->next = NULL; + } else { + for (P = MapList; P->next; P = P->next) + ; + P->next = (struct qmsmap *)malloc((unsigned) + sizeof(struct qmsmap)); + P = P->next; + P->count = ByteCount; + P->checksum = CheckSum; + (void)strcpy(P->data = malloc((unsigned)(strlen(S) + 1)), S); + P->next = NULL; + } + } + | + /* epsilon */ + ; + +dataline : + BYTECOUNT + { + (void)sscanf(&$1[1], "%X", &ByteCount); + } + DATA + { + (void)sscanf(&$3[strlen($3) - 4], "%X", &CheckSum); + $3[strlen($3) - 4] = '\0'; + (void)strcpy(S, $3); + } + ENDLINE + ; +%% +#include "qmsmaplex.c" + +struct qmsmap *qmsmap(north, south, west, east) +double north, south, west, east; +{ + _FirstChar = TRUE; + MapList = NULL; + fputs(QUICON, _Ofp); + fprintf(_Ofp, "%s00000", SYNTAX); + fprintf(_Ofp, "%sMAP%05d%05d%05d%05d%s", INFO, (int)(north * 1000), + (int)(south * 1000), (int)(west * 1000), (int)(east * 1000), ENDCMD); + fputs(QUICOFF, _Ofp); + (void)fflush(_Ofp); + if (setjmp(Env)) { + while (timedgetc(_Ifp) != EOF) /* Discard remaining input */ + ; + return NULL; + } + if (yyparse() != 0) + return NULL; + yysptr = yysbuf; /* Resets lex lookahead buffer */ + return MapList; +} + +static yyerror(s) +char *s; +{ + longjmp(Env, TRUE); +} diff --git a/dviware/quicspool/libqmsquery/qmsmaplex.l b/dviware/quicspool/libqmsquery/qmsmaplex.l new file mode 100644 index 0000000000..3ef469a91f --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsmaplex.l @@ -0,0 +1,28 @@ +/* $Header: qmsmaplex.l,v 1.1 88/01/15 12:19:06 simpson Rel $ */ +%{ +/* +$Log: qmsmaplex.l,v $ + * Revision 1.1 88/01/15 12:19:06 simpson + * initial release + * + * Revision 0.1 87/12/11 21:34:45 simpson + * beta test + * +*/ +#undef input +#define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):timedgetc(_Ifp)) \ + ==10?(yylineno++, yytchar):yytchar)==EOF?0:yytchar) +%} +hex [0-9A-F] +%% +MAP: return MAP; +MAPEND return MAPEND; +^Q{hex}{hex}{hex}{hex} { + (void)strcpy(yylval.s, yytext); + return BYTECOUNT; + } +{hex}+ { + (void)strcpy(yylval.s, yytext); + return DATA; + } +\r\n return ENDLINE; diff --git a/dviware/quicspool/libqmsquery/qmsopc.y b/dviware/quicspool/libqmsquery/qmsopc.y new file mode 100644 index 0000000000..c72ebe9800 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsopc.y @@ -0,0 +1,133 @@ +%{ +#ifndef lint +static char *rcs = "$Header: qmsopc.y,v 1.1 88/01/15 12:19:09 simpson Rel $"; +#endif +/* +$Log: qmsopc.y,v $ + * Revision 1.1 88/01/15 12:19:09 simpson + * initial release + * + * Revision 0.1 87/12/11 17:12:03 simpson + * beta test + * +*/ +#include <stdio.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +extern FILE *_Ifp, *_Ofp; +extern Boolean _FirstChar; +static jmp_buf Env; +char *malloc(); +static struct qmsopc Opc; +static struct optnode *P; +%} +%token NONE ENDLINE +%token <i> OC INTEGER +%type <p> numlist +%union { + int i; + struct optnode *p; +} +%% +opclines : opclines opcline | opcline ; + +opcline : + OC NONE ENDLINE + { + switch ($1) { + case 1: + Opc.OC1 = NULL; + break; + case 2: + Opc.OC2 = NULL; + break; + case 3: + Opc.OC3 = NULL; + break; + case 4: + Opc.OC4 = NULL; + break; + case 5: + Opc.OC5 = NULL; + break; + } + } + | + OC numlist ENDLINE + { + switch ($1) { + case 1: + Opc.OC1 = $2; + break; + case 2: + Opc.OC2 = $2; + break; + case 3: + Opc.OC3 = $2; + break; + case 4: + Opc.OC4 = $2; + break; + case 5: + Opc.OC5 = $2; + break; + } + } + ; + +numlist : + numlist INTEGER optcomma + { + if ($1 == NULL) { + $1 = (struct optnode *)malloc((unsigned) + sizeof(struct optnode)); + $1->option = $2; + $1->next = NULL; + } else { + for (P = $1; P->next; P = P->next) + ; + P->next = (struct optnode *)malloc((unsigned) + sizeof(struct optnode)); + P = P->next; + P->option = $2; + P->next = NULL; + } + $$ = $1; + } + | + { + /* epsilon */ + $$ = NULL; + } + ; + +optcomma : ',' | /* epsilon */ ; +%% +#include "qmsopclex.c" + +struct qmsopc *qmsopc() +{ + _FirstChar = TRUE; + fputs(QUICON, _Ofp); + fprintf(_Ofp, "%s00000", SYNTAX); + fprintf(_Ofp, "%sOPC%s", INFO, ENDCMD); + fputs(QUICOFF, _Ofp); + (void)fflush(_Ofp); + if (setjmp(Env)) { + while (timedgetc(_Ifp) != EOF) /* Discard remaining input */ + ; + return NULL; + } + if (yyparse() != 0) + return NULL; + yysptr = yysbuf; /* Resets lex lookahead buffer */ + return &Opc; +} + +static yyerror(s) +char *s; +{ + longjmp(Env, TRUE); +} diff --git a/dviware/quicspool/libqmsquery/qmsopclex.l b/dviware/quicspool/libqmsquery/qmsopclex.l new file mode 100644 index 0000000000..e35f4b137c --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsopclex.l @@ -0,0 +1,28 @@ +/* $Header: qmsopclex.l,v 1.1 88/01/15 12:19:11 simpson Rel $ +%{ +/* +$Log: qmsopclex.l,v $ + * Revision 1.1 88/01/15 12:19:11 simpson + * initial release + * + * Revision 0.1 87/12/11 21:34:46 simpson + * beta test + * +*/ +#undef input +#define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):timedgetc(_Ifp)) \ + ==10?(yylineno++, yytchar):yytchar)==EOF?0:yytchar) +%} +integer [0-9]+ +%% +OC[1-5]: { + yylval.i = yytext[2] - '0'; + return OC; + } +{integer} { + yylval.i = atoi(yytext); + return INTEGER; + } +\, return yytext[0]; +NONE return NONE; +\r\n return ENDLINE; diff --git a/dviware/quicspool/libqmsquery/qmsovl.y b/dviware/quicspool/libqmsquery/qmsovl.y new file mode 100644 index 0000000000..6c96de10d3 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsovl.y @@ -0,0 +1,80 @@ +%{ +#ifndef lint +static char *rcs = "$Header: qmsovl.y,v 1.1 88/01/15 12:19:13 simpson Rel $"; +#endif +/* +$Log: qmsovl.y,v $ + * Revision 1.1 88/01/15 12:19:13 simpson + * initial release + * + * Revision 0.1 87/12/11 17:12:05 simpson + * beta test + * +*/ +#include <stdio.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +extern FILE *_Ifp, *_Ofp; +extern Boolean _FirstChar; +static jmp_buf Env; +char *malloc(); +static struct qmsovl *OvlList, *P; +%} +%token OVL INTEGER SPACE AUTOPAGE NONE ENDLINE +%% +ovllines : ovllines ovlline | ovlline ; + +ovlline : OVL overlay ENDLINE ; + +overlay : + NONE + { + OvlList = NULL; + } + | + INTEGER SPACE + { + P = (struct qmsovl *)malloc((unsigned)sizeof(struct qmsovl)); + P->next = OvlList, OvlList = P; + P->ovltype = regular; + P->ovlnumber = $1; + P->ovlsize = $2; + } + | + AUTOPAGE + { + P = (struct qmsovl *)malloc((unsigned)sizeof(struct qmsovl)); + P->next = OvlList, OvlList = P; + P->ovltype = automatic; + } + ; +%% +#include "qmsovllex.c" + +struct qmsovl *qmsovl() +{ + _FirstChar = TRUE; + OvlList = NULL; + fputs(QUICON, _Ofp); + fprintf(_Ofp, "%s00000", SYNTAX); + fprintf(_Ofp, "%sOVL%s", INFO, ENDCMD); + fputs(QUICOFF, _Ofp); + (void)fflush(_Ofp); + if (setjmp(Env)) { + while (timedgetc(_Ifp) != EOF) /* Discard remaining input */ + ; + return NULL; + } + if (yyparse() != 0) + return NULL; + yysptr = yysbuf; /* Resets lex lookahead buffer */ + return OvlList; +} + +static yyerror(s) +char *s; +{ + longjmp(Env, TRUE); +} diff --git a/dviware/quicspool/libqmsquery/qmsovllex.l b/dviware/quicspool/libqmsquery/qmsovllex.l new file mode 100644 index 0000000000..ab485be5de --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsovllex.l @@ -0,0 +1,29 @@ +/* $Header: qmsovllex.l,v 1.1 88/01/15 12:19:16 simpson Rel $ +%{ +/* +$Log: qmsovllex.l,v $ + * Revision 1.1 88/01/15 12:19:16 simpson + * initial release + * + * Revision 0.1 87/12/11 21:34:47 simpson + * beta test + * +*/ +#undef input +#define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):timedgetc(_Ifp)) \ + ==10?(yylineno++, yytchar):yytchar)==EOF?0:yytchar) +%} +integer [0-9]+ +%% +OVL: return OVL; +S{integer} { + yylval = atoi(&yytext[1]); + return SPACE; + } +{integer} { + yylval = atoi(yytext); + return INTEGER; + } +"Automatic Page" return AUTOPAGE; +NONE return NONE; +\r\n return ENDLINE; diff --git a/dviware/quicspool/libqmsquery/qmspag.y b/dviware/quicspool/libqmsquery/qmspag.y new file mode 100644 index 0000000000..ce3e25235a --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmspag.y @@ -0,0 +1,162 @@ +%{ +#ifndef lint +static char *rcs = "$Header: qmspag.y,v 1.1 88/01/15 12:19:19 simpson Rel $"; +#endif +/* +$Log: qmspag.y,v $ + * Revision 1.1 88/01/15 12:19:19 simpson + * initial release + * + * Revision 0.1 87/12/11 17:12:07 simpson + * beta test + * +*/ +#include <stdio.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +extern FILE *_Ifp, *_Ofp; +extern Boolean _FirstChar; +static jmp_buf Env; +static struct qmspag Result; +%} +%union { + float r; + int i; +} +%token PAG POT TMT BMT LMT RMT LPIT CPIT PROP PTT PST SOT CCT ENDLINE +%token <r> REAL +%token <i> INTEGER +%type <i> orientation yesorno 'P' 'L' 'Y' 'N' +%% +paglines : paglines pagline | pagline ; + +pagline : PAG settings ENDLINE ; + +settings : settings setting optcomma | /* epsilon */ ; + +setting : + POT '=' orientation + { + Result.PO = $3; + } + | + TMT '=' INTEGER + { + Result.TM = $3; + } + | + TMT '=' REAL + { + Result.TM = $3; + } + | + BMT '=' INTEGER + { + Result.BM = $3; + } + | + BMT '=' REAL + { + Result.BM = $3; + } + | + LMT '=' INTEGER + { + Result.LM = $3; + } + | + LMT '=' REAL + { + Result.LM = $3; + } + | + RMT '=' INTEGER + { + Result.RM = $3; + } + | + RMT '=' REAL + { + Result.RM = $3; + } + | + LPIT '=' INTEGER + { + Result.LPI = $3; + } + | + LPIT '=' REAL + { + Result.LPI = $3; + } + | + CPIT '=' INTEGER + { + Result.CPI = $3; + } + | + CPIT '=' REAL + { + Result.CPI = $3; + } + | + CPIT '=' PROP + { + Result.CPI = 0; + } + | + PTT '=' INTEGER + { + Result.PT = $3; + } + | + PST '=' INTEGER + { + Result.PS = $3; + } + | + SOT '=' yesorno + { + Result.SO = $3; + } + | + CCT '=' INTEGER + { + Result.CC = $3; + } + ; + +orientation : 'P' | 'L' ; + +yesorno : 'Y' | 'N' ; + +optcomma : ',' | /* epsilon */ ; +%% +#include "qmspaglex.c" + +struct qmspag *qmspag() +{ + _FirstChar = TRUE; + fputs(QUICON, _Ofp); + fprintf(_Ofp, "%s00000", SYNTAX); + fprintf(_Ofp, "%sPAG%s", INFO, ENDCMD); + fputs(QUICOFF, _Ofp); + (void)fflush(_Ofp); + if (setjmp(Env)) { + while (timedgetc(_Ifp) != EOF) /* Discard remaining input */ + ; + return NULL; + } + if (yyparse() != 0) + return NULL; + yysptr = yysbuf; /* Resets lex lookahead buffer */ + return &Result; +} + +static yyerror(s) +char *s; +{ + longjmp(Env, TRUE); +} diff --git a/dviware/quicspool/libqmsquery/qmspaglex.l b/dviware/quicspool/libqmsquery/qmspaglex.l new file mode 100644 index 0000000000..bb4c903b02 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmspaglex.l @@ -0,0 +1,50 @@ +/* $Header: qmspaglex.l,v 1.1 88/01/15 12:19:22 simpson Rel $ +%{ +/* +$Log: qmspaglex.l,v $ + * Revision 1.1 88/01/15 12:19:22 simpson + * initial release + * + * Revision 0.1 87/12/11 21:34:48 simpson + * beta test + * +*/ +#undef input +#define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):timedgetc(_Ifp)) \ + ==10?(yylineno++, yytchar):yytchar)==EOF?0:yytchar) +double atof(); +%} +real ([0-9]*\.[0-9]+)|([0-9]+\.[0-9]*) +integer [0-9]+ +%% +PAG: return PAG; +PO return POT; +TM return TMT; +BM return BMT; +LM return LMT; +RM return RMT; +LPI return LPIT; +CPI return CPIT; +PROP return PROP; +PT return PTT; +PS return PST; +SO return SOT; +CC return CCT; += | +\, | +P | +L | +Y | +N { + yylval.i = yytext[0]; + return yytext[0]; + } +{real} { + yylval.r = atof(yytext); + return REAL; + } +{integer} { + yylval.i = atoi(yytext); + return INTEGER; + } +\r\n return ENDLINE; diff --git a/dviware/quicspool/libqmsquery/qmspfp.y b/dviware/quicspool/libqmsquery/qmspfp.y new file mode 100644 index 0000000000..7deba078e2 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmspfp.y @@ -0,0 +1,75 @@ +%{ +#ifndef lint +static char *rcs = "$Header: qmspfp.y,v 1.1 88/01/15 12:19:26 simpson Rel $"; +#endif +/* +$Log: qmspfp.y,v $ + * Revision 1.1 88/01/15 12:19:26 simpson + * initial release + * + * Revision 0.1 87/12/11 17:12:09 simpson + * beta test + * +*/ +#include <stdio.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +extern FILE *_Ifp, *_Ofp; +extern Boolean _FirstChar; +static jmp_buf Env; +char *malloc(); +static struct qmspfp *PfpList, *P; +%} +%token PFP NONE ENDLINE +%token <s> STRING +%union { + char s[81]; +} +%% +pfplines : pfplines pfpline | pfpline ; + +pfpline : PFP module ENDLINE ; + +module : + NONE + { + PfpList = NULL; + } + | + STRING + { + P = (struct qmspfp *)malloc((unsigned)sizeof(struct qmspfp)); + P->next = PfpList, PfpList = P; + (void)strcpy(P->module = malloc((unsigned)(strlen($1) + 1)), $1); + } + ; +%% +#include "qmspfplex.c" + +struct qmspfp *qmspfp() +{ + _FirstChar = TRUE; + PfpList = NULL; + fputs(QUICON, _Ofp); + fprintf(_Ofp, "%s00000", SYNTAX); + fprintf(_Ofp, "%sPFP%s", INFO, ENDCMD); + fputs(QUICOFF, _Ofp); + (void)fflush(_Ofp); + if (setjmp(Env)) { + while (timedgetc(_Ifp) != EOF) /* Discard remaining input */ + ; + return NULL; + } + if (yyparse() != 0) + return NULL; + yysptr = yysbuf; /* Resets lex lookahead buffer */ + return PfpList; +} + +static yyerror(s) +char *s; +{ + longjmp(Env, TRUE); +} diff --git a/dviware/quicspool/libqmsquery/qmspfplex.l b/dviware/quicspool/libqmsquery/qmspfplex.l new file mode 100644 index 0000000000..7b3899a692 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmspfplex.l @@ -0,0 +1,32 @@ +/* $Header: qmspfplex.l,v 1.1 88/01/15 12:19:28 simpson Rel $ +%{ +/* +$Log: qmspfplex.l,v $ + * Revision 1.1 88/01/15 12:19:28 simpson + * initial release + * + * Revision 0.1 87/12/11 21:34:49 simpson + * beta test + * +*/ +#undef input +#define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):timedgetc(_Ifp)) \ + ==10?(yylineno++, yytchar):yytchar)==EOF?0:yytchar) +#ifdef TRW +#include <local/standard.h> +#else +#define EQN(s, t, n) (!strncmp(s, t, n)) +#endif +%} +%% +[^\r\n]+ { + if (EQN("PFP:", yytext, 4)) + REJECT; + if (EQN("NONE", yytext, 4)) + REJECT; + (void)strcpy(yylval.s, yytext); + return STRING; + } +PFP: return PFP; +NONE return NONE; +\r\n return ENDLINE; diff --git a/dviware/quicspool/libqmsquery/qmsquery.c b/dviware/quicspool/libqmsquery/qmsquery.c new file mode 100644 index 0000000000..be3730eb66 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsquery.c @@ -0,0 +1,152 @@ +#ifndef lint +static char *rcs = "$Header: qmsquery.c,v 1.1 88/01/15 12:19:30 simpson Rel $"; +#endif +#include <stdio.h> +#include <signal.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +FILE *_Ifp, *_Ofp; /* Input and output file pointer */ +Boolean _FirstChar; +static int (*OldAlarm)(); /* Saves the old SIGALRM value */ +static jmp_buf Env; + +int qmsopen(writefd, readfd) +int writefd, readfd; +{ + int timeout(); + + if (!(_Ofp = fdopen(writefd, "w"))) + return FALSE; + if (!(_Ifp = fdopen(readfd, "r"))) + return FALSE; + setbuffer(_Ifp, (char *)NULL, 0); /* Turn off buffering on input */ + OldAlarm = signal(SIGALRM, timeout); + return TRUE; +} + +int qmsclose() +{ + (void)signal(SIGALRM, OldAlarm); + (void)fclose(_Ofp), (void)fclose(_Ifp); + return TRUE; +} + +int timedgetc(f) +FILE *f; +{ + int c; + + /* The amount of time to wait until we have decided it is EOF is + * hard to select. The printer does not always send the status + * information out of the debugger port upon immediately receiving the + * ^INFO command. It will accept the ^INFO command, put it in its + * buffer, and send the status information when it finally interprets + * the ^INFO command. I have seen it take as long as 11 seconds + * between the time the ^INFO command was sent and the time the status + * information is sent out the debugger port. We don't want to wait 11 + * or 15 seconds each time we wish to read data. We observe that each + * ^INFO command returns at least one character and that when the ^INFO + * command is finally interpreted, all the information is sent out to + * the debugger port very quickly. Consequently, we can wait a long + * time before reading the first character, but after reading the + * subsequent characters we wait a short time. + */ + if (_FirstChar) + (void)alarm(300); /* Wait 5 minutes maximum */ + else + (void)alarm(3); + if (setjmp(Env)) { + (void)alarm(0); + return EOF; + } + c = getc(f); + (void)alarm(0); + _FirstChar = FALSE; + return c; +} + +static timeout() +{ + longjmp(Env, TRUE); +} + +void qmsmapfree(mapinfo) +struct qmsmap *mapinfo; +{ + struct qmsmap *p; + + for (; mapinfo; mapinfo = p) { + if (mapinfo->data) + free(mapinfo->data); + p = mapinfo->next; + free((char *)mapinfo); + } +} + +void qmsovlfree(ovlinfo) +struct qmsovl *ovlinfo; +{ + struct qmsovl *p; + + for (; ovlinfo; ovlinfo = p) { + p = ovlinfo->next; + free((char *)ovlinfo); + } +} + +void qmspfpfree(pfpinfo) +struct qmspfp *pfpinfo; +{ + struct qmspfp *p; + + for (; pfpinfo; pfpinfo = p) { + if (pfpinfo->module) + free(pfpinfo->module); + p = pfpinfo->next; + free((char *)pfpinfo); + } +} + +void qmsopcfree(opcinfo) +struct qmsopc *opcinfo; +{ + struct optnode *p1, *p2; + + for (p1 = opcinfo->OC1; p1; p1 = p2) { + p2 = p1->next; + free((char *)p1); + } + for (p1 = opcinfo->OC2; p1; p1 = p2) { + p2 = p1->next; + free((char *)p1); + } + for (p1 = opcinfo->OC3; p1; p1 = p2) { + p2 = p1->next; + free((char *)p1); + } + for (p1 = opcinfo->OC4; p1; p1 = p2) { + p2 = p1->next; + free((char *)p1); + } + for (p1 = opcinfo->OC5; p1; p1 = p2) { + p2 = p1->next; + free((char *)p1); + } +} + +void qmsfntfree(fntinfo) +struct qmsfnt *fntinfo; +{ + struct fontnode *p1, *p2; + + for (p1 = fntinfo->rom; p1; p1 = p2) { + p2 = p1->next; + free((char *)p1); + } + for (p1 = fntinfo->ram; p1; p1 = p2) { + p2 = p1->next; + free((char *)p1); + } +} diff --git a/dviware/quicspool/libqmsquery/qmsram.y b/dviware/quicspool/libqmsquery/qmsram.y new file mode 100644 index 0000000000..a7cccbae27 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsram.y @@ -0,0 +1,79 @@ +%{ +#ifndef lint +static char *rcs = "$Header: qmsram.y,v 1.1 88/01/15 12:19:35 simpson Rel $"; +#endif +/* +$Log: qmsram.y,v $ + * Revision 1.1 88/01/15 12:19:35 simpson + * initial release + * + * Revision 0.1 87/12/11 17:12:12 simpson + * beta test + * +*/ +#include <stdio.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +extern FILE *_Ifp, *_Ofp; +extern Boolean _FirstChar; +static jmp_buf Env; +static struct qmsram Result; +%} +%token RAM TRT ART FRT ORT INTEGER ENDLINE +%% +ramline : RAM valuelist ENDLINE ; + +valuelist : valuelist value optcomma | /* epsilon */ ; + +value : + TRT '=' INTEGER + { + Result.TR = $3; + } + | + ART '=' INTEGER + { + Result.AR = $3; + } + | + FRT '=' INTEGER + { + Result.FR = $3; + } + | + ORT '=' INTEGER + { + Result.OR = $3; + } + ; + +optcomma : ',' | /* epsilon */ ; +%% +#include "qmsramlex.c" + +struct qmsram *qmsram() +{ + _FirstChar = TRUE; + fputs(QUICON, _Ofp); + fprintf(_Ofp, "%s00000", SYNTAX); + fprintf(_Ofp, "%sRAM%s", INFO, ENDCMD); + fputs(QUICOFF, _Ofp); + (void)fflush(_Ofp); + if (setjmp(Env)) { + while (timedgetc(_Ifp) != EOF) /* Discard remaining input */ + ; + return NULL; + } + if (yyparse() != 0) + return NULL; + yysptr = yysbuf; /* Resets lex lookahead buffer */ + return &Result; +} + +static yyerror(s) +char *s; +{ + longjmp(Env, TRUE); +} diff --git a/dviware/quicspool/libqmsquery/qmsramlex.l b/dviware/quicspool/libqmsquery/qmsramlex.l new file mode 100644 index 0000000000..69bf6e9ad2 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsramlex.l @@ -0,0 +1,29 @@ +/* $Header: qmsramlex.l,v 1.1 88/01/15 12:19:37 simpson Rel $ */ +%{ +/* +$Log: qmsramlex.l,v $ + * Revision 1.1 88/01/15 12:19:37 simpson + * initial release + * + * Revision 0.1 87/12/11 21:34:49 simpson + * beta test + * +*/ +#undef input +#define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):timedgetc(_Ifp)) \ + ==10?(yylineno++, yytchar):yytchar)==EOF?0:yytchar) +%} +integer [0-9]+ +%% +RAM: return RAM; +TR return TRT; +AR return ART; +FR return FRT; +OR return ORT; +{integer} { + yylval = atoi(yytext); + return INTEGER; + } += | +\, return yytext[0]; +\r\n return ENDLINE; diff --git a/dviware/quicspool/libqmsquery/qmsver.y b/dviware/quicspool/libqmsquery/qmsver.y new file mode 100644 index 0000000000..a12a33edb7 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsver.y @@ -0,0 +1,68 @@ +%{ +#ifndef lint +static char *rcs = "$Header: qmsver.y,v 1.1 88/01/15 12:19:41 simpson Rel $"; +#endif +/* +$Log: qmsver.y,v $ + * Revision 1.1 88/01/15 12:19:41 simpson + * initial release + * + * Revision 0.1 87/12/11 17:12:14 simpson + * beta test + * +*/ +#include <stdio.h> +#include <setjmp.h> +#include <local/standard.h> +#include "qms.h" + +extern FILE *_Ifp, *_Ofp; +extern Boolean _FirstChar; +static jmp_buf Env; +static struct qmsver Result; +%} +%token DATE FIRMWARE VERSION ENDLINE QUIC +%token <i> INTEGER +%token <r> REAL +%union { + int i; + float r; +} +%% +version : VERSION '=' QUIC ':' REAL FIRMWARE ':' REAL DATE INTEGER '/' + INTEGER '/' INTEGER ENDLINE + { + Result.version = $5; + Result.firmware = $8; + Result.date.month = $10; + Result.date.day = $12; + Result.date.year = $14; + } + ; +%% +#include "qmsverlex.c" + +struct qmsver *qmsver() +{ + _FirstChar = TRUE; + fputs(QUICON, _Ofp); + fprintf(_Ofp, "%s00000", SYNTAX); + fprintf(_Ofp, "%sVER%s", INFO, ENDCMD); + fputs(QUICOFF, _Ofp); + (void)fflush(_Ofp); + if (setjmp(Env)) { + while (timedgetc(_Ifp) != EOF) /* Discard remaining input */ + ; + return NULL; + } + if (yyparse() != 0) + return NULL; + yysptr = yysbuf; /* Resets lex lookahead buffer */ + return &Result; +} + +static yyerror(s) +char *s; +{ + longjmp(Env, TRUE); +} diff --git a/dviware/quicspool/libqmsquery/qmsverlex.l b/dviware/quicspool/libqmsquery/qmsverlex.l new file mode 100644 index 0000000000..be5dba8982 --- /dev/null +++ b/dviware/quicspool/libqmsquery/qmsverlex.l @@ -0,0 +1,41 @@ +/* $Header: qmsverlex.l,v 1.1 88/01/15 12:19:49 simpson Rel $ */ +%{ +/* +$Log: qmsverlex.l,v $ + * Revision 1.1 88/01/15 12:19:49 simpson + * initial release + * + * Revision 0.1 87/12/11 21:34:50 simpson + * beta test + * +*/ +#ifdef TRW +#include <local/standard.h> +#else +#define EQN(s, t, n) (!strncmp(s, t, n)) +#endif +#undef input +#define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):timedgetc(_Ifp)) \ + ==10?(yylineno++, yytchar):yytchar)==EOF?0:yytchar) +double atof(); +%} +real ([0-9]*\.[0-9]+)|([0-9]+\.[0-9]*) +integer [0-9]+ +%% +QUIC return QUIC; +Date return DATE; +Firmware return FIRMWARE; +Version return VERSION; += | +: | +\/ return yytext[0]; +{integer} { + yylval.i = atoi(yytext); + return INTEGER; + } +{real} { + yylval.r = atof(yytext); + return REAL; + } +\r\n return ENDLINE; +[ \t]+ ; diff --git a/dviware/quicspool/libqmsquery/yaccsed b/dviware/quicspool/libqmsquery/yaccsed new file mode 100644 index 0000000000..16c307ed6c --- /dev/null +++ b/dviware/quicspool/libqmsquery/yaccsed @@ -0,0 +1,12 @@ +s/^short yyexca\[\]/static &/ +s/^short yyact\[\]/static &/ +s/^short yypact\[\]/static &/ +s/^short yypgo\[\]/static &/ +s/^short yyr1\[\]/static &/ +s/^short yyr2\[\]/static &/ +s/^short yychk\[\]/static &/ +s/^short yydef\[\]/static &/ +s/^int yychar/static &/ +s/^int yynerrs/static &/ +s/^short yyerrflag/static &/ +s/^yyparse()/static &/ |