summaryrefslogtreecommitdiff
path: root/dviware/quicspool/libqmsquery/qmspag.y
blob: ce3e25235a10647fe4225eb42e22cdc8792f18df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
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);
}