/* @(#)r1.c 1.2 (Berkeley) 12/15/82 */
#define wasbreak brkused[brkptr]==1 || brkused[brkptr]==3
#define wasnext brkused[brkptr]==2 || brkused[brkptr]==3
int transfer
= 0; /* 1 if just finished retrun, break, next */
int brkstk
[10]; /* break label */
int typestk
[10]; /* type of loop construct */
int brkused
[10]; /* loop contains BREAK or NEXT */
brkstk
[++brkptr
] = yyval
+1;
typestk
[brkptr
] = REPEAT
;
untils(p1
,un
) int p1
,un
; {
outgoto(yyval
=genlab(2));
brkstk
[++brkptr
] = yyval
= genlab(2);
while ((c
=gtok(scrat
)) == ' ' || c
== '\t')
error("missing left paren");
if (c
==';' || c
=='{' || c
=='}' || c
==EOF
) {
while ((c
= gtok(scrat
)) == ' ' || c
=='\t' || c
=='\n')
else if (c
== '=' && scrat
[1] == '\0')
error("assigment inside conditional");
error("missing parenthesis");
if ((t
= gtok(scrat
)) == ';' || t
== '\n')
if (t
== '{' || t
== '}' || t
== EOF
) {
if (t
== ',' || t
== '+' || t
== '-' || t
== '*' || t
== '('
|| t
== '&' || t
== '|' || t
== '=') {
while (gtok(temp
) == '\n')
error("missing left paren");
error("missing right paren");
brkstk
[++brkptr
] = yyval
+1;
forstk
[forptr
++] = malloc(1);
if ((t
= gnbtok(scrat
)) != '(') {
error("missing left paren in FOR");
if (gnbtok(scrat
) != ';') { /* real init clause */
error("illegal FOR clause");
if (gnbtok(scrat
) == ';') /* empty condition */
else { /* non-empty condition */
for (lpar
=0; lpar
>= 0;) {
if ((t
= gnbtok(scrat
)) == ';')
error("missing left paren in FOR clause");
error("invalid FOR clause");
for (lpar
=0; lpar
>= 0;) {
if ((t
= gtok(ps
)) == '(')
if (lpar
>= 0 && t
!= '\n')
qs
= forstk
[forptr
-1] = malloc((unsigned)(ps
-scrat
+1));
if ((c
= gnbtok(scrat
)) != '\n' && c
!= ';' && c
!= '}') {
brkstk
[++brkptr
] = yyval
;
#define atoi(s) (*s-'0') /* crude!!! */
if ((t
=gnbtok(scrat
)) == DIG
)
outgoto(brkstk
[brkptr
-level
]+1);
brkused
[brkptr
-level
] |= 1;
if ((t
=gnbtok(scrat
)) == DIG
)
outgoto(brkstk
[brkptr
-level
]);
brkused
[brkptr
-level
] |= 2;
if (c
!=' ' && c
!='\t' && c
!='\n')
fprintf(stderr
, "ratfor:");
fprintf(stderr
, "error at line %d, file %s: ",linect
[infptr
],curfile
[infptr
]);
fprintf(stderr
, "******\n");
fprintf(stderr
, "*****F ratfor:");
fprintf(stderr
, "syntax error, line %d, file %s\n", linect
[infptr
], curfile
[infptr
]);
while ((c
=getchr())!=';' && c
!='}' && c
!='\n' && c
!=EOF
&& c
!='\0')
if (c
== EOF
|| c
== '\0')