SCCS-vsn: usr.bin/pascal/src/0.h 1.2
SCCS-vsn: usr.bin/pascal/src/const.c 1.3
SCCS-vsn: usr.bin/pascal/src/fdec.c 1.3
SCCS-vsn: usr.bin/pascal/src/lab.c 1.3
SCCS-vsn: usr.bin/pascal/src/type.c 1.3
SCCS-vsn: usr.bin/pascal/src/var.c 1.3
SCCS-vsn: usr.bin/pascal/src/pas.y 1.3
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-/* static char sccsid[] = "@(#)0.h 1.1 %G%"; */
+/* static char sccsid[] = "@(#)0.h 1.2 %G%"; */
#define DEBUG
#define CHAR
#define DEBUG
#define CHAR
/*
* Parts records which declaration parts have been seen.
/*
* Parts records which declaration parts have been seen.
- * The grammar allows the "const" "type" and "var"
+ * The grammar allows the "label" "const" "type" "var" and routine
* parts to be repeated and to be in any order, so that
* they can be detected semantically to give better
* error diagnostics.
*/
* parts to be repeated and to be in any order, so that
* they can be detected semantically to give better
* error diagnostics.
*/
-#define LPRT 01
-#define CPRT 02
-#define TPRT 04
-#define VPRT 08
+#define LPRT 1
+#define CPRT 2
+#define TPRT 4
+#define VPRT 8
+#define RPRT 16
/*
* Flags for the "you used / instead of div" diagnostic
/*
* Flags for the "you used / instead of div" diagnostic
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)const.c 1.2 %G%";
+static char sccsid[] = "@(#)const.c 1.3 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
- * PC allows for multiple declaration
+ * this allows for multiple declaration
* parts, unless the "standard" option
* has been specified.
* If a routine segment is being compiled,
* parts, unless the "standard" option
* has been specified.
* If a routine segment is being compiled,
-# ifdef PC
- if (opt('s')) {
- if (parts & (TPRT|VPRT)) {
- standard();
- error("Constant declarations must precede type and variable declarations");
- }
- if (parts & CPRT) {
- standard();
- error("All constants must be declared in one const part");
- }
- }
-# endif PC
-# ifdef OBJ
- if (parts & (TPRT|VPRT))
- error("Constant declarations must precede type and variable declarations");
- if (parts & CPRT)
- error("All constants must be declared in one const part");
-# endif OBJ
- parts |= CPRT;
+ if (parts[ cbn ] & (TPRT|VPRT|RPRT)) {
+ if ( opt( 's' ) ) {
+ standard();
+ } else {
+ warning();
+ }
+ error("Constant declarations should precede type, var and routine declarations");
+ }
+ if (parts[ cbn ] & CPRT) {
+ if ( opt( 's' ) ) {
+ standard();
+ } else {
+ warning();
+ }
+ error("All constants should be declared in one const part");
+ }
+ parts[ cbn ] |= CPRT;
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)fdec.c 1.2 %G%";
+static char sccsid[] = "@(#)fdec.c 1.3 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
yyretrieve(); /* kludge */
}
pfcnt++;
yyretrieve(); /* kludge */
}
pfcnt++;
line = r[1];
if (r[3] == NIL && (p=lookup1(r[2])) != NIL && bn == cbn) {
/*
line = r[1];
if (r[3] == NIL && (p=lookup1(r[2])) != NIL && bn == cbn) {
/*
sizes[cbn].om_max = sizes[cbn].om_off = -DPOFF1;
gotos[cbn] = NIL;
errcnt[cbn] = syneflg;
sizes[cbn].om_max = sizes[cbn].om_off = -DPOFF1;
gotos[cbn] = NIL;
errcnt[cbn] = syneflg;
dfiles[ cbn ] = FALSE;
if (fp == NIL)
return (NIL);
dfiles[ cbn ] = FALSE;
if (fp == NIL)
return (NIL);
cbn++;
sizes[cbn].om_max = sizes[cbn].om_off = -DPOFF1;
cbn++;
sizes[cbn].om_max = sizes[cbn].om_off = -DPOFF1;
+ gotos[cbn] = NIL;
+ errcnt[cbn] = syneflg;
+ parts[ cbn ] = NIL;
+ dfiles[ cbn ] = FALSE;
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)lab.c 1.2 %G%";
+static char sccsid[] = "@(#)lab.c 1.3 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
-#ifdef PC
- if (opt('s')) {
- if (parts & (CPRT|TPRT|VPRT)){
+ if (parts[ cbn ] & (CPRT|TPRT|VPRT|RPRT)){
+ if ( opt( 's' ) ) {
- error("Label declarations must precede const, type and var declarations");
+ } else {
+ warning();
+ }
+ error("Label declarations should precede const, type, var and routine declarations");
+ if (parts[ cbn ] & LPRT) {
+ if ( opt( 's' ) ) {
- error("All labels must be declared in one label part");
+ } else {
+ warning();
+ }
+ error("All labels should be declared in one label part");
- }
-#endif PC
-#ifdef OBJ
- if (parts & (CPRT|TPRT|VPRT))
- error("Label declarations must precede const, type and var declarations");
- if (parts & LPRT)
- error("All labels must be declared in one label part");
-#endif OBJ
- parts |= LPRT;
#endif
#ifndef PI0
for (ll = r; ll != NIL; ll = ll[2]) {
#endif
#ifndef PI0
for (ll = r; ll != NIL; ll = ll[2]) {
YSET YSTRING YTHEN YDOWNTO
YTYPE YUNTIL YVAR YWHILE
YWITH YBINT YOCT YHEX
YSET YSTRING YTHEN YDOWNTO
YTYPE YUNTIL YVAR YWHILE
YWITH YBINT YOCT YHEX
- YASSERT YCASELAB YILLCH YLAST
- YEXTERN
+ YASSERT YCASELAB YILLCH YEXTERN
+ YLAST
/*
* PRECEDENCE DECLARATIONS
/*
* PRECEDENCE DECLARATIONS
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-/* static char sccsid[] = "@(#)pas.y 1.2 %G%"; */
+/* static char sccsid[] = "@(#)pas.y 1.3 %G%"; */
/*
* The following line marks the end of the yacc
/*
* The following line marks the end of the yacc
##
/* Copyright (c) 1979 Regents of the University of California */
##
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)pas.y 1.2 %G%";
+static char sccsid[] = "@(#)pas.y 1.3 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
- prog_hedr decls procs block '.'
- = funcend($1, $4, lineof($5));
+ prog_hedr decls block '.'
+ = funcend($1, $3, lineof($4));
* PROCEDURE AND FUNCTION DECLARATION PART
*/
* PROCEDURE AND FUNCTION DECLARATION PART
*/
-procs:
- /* lambda */
- |
- procs proc
- = trfree();
- ;
-proc:
phead YFORWARD ';'
= funcfwd($1);
|
phead YEXTERN ';'
= funcext($1);
|
phead YFORWARD ';'
= funcfwd($1);
|
phead YEXTERN ';'
= funcext($1);
|
- pheadres decls procs block ';'
- = funcend($1, $4, lineof($5));
+ pheadres decls block ';'
+ = funcend($1, $3, lineof($4));
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)type.c 1.2 %G%";
+static char sccsid[] = "@(#)type.c 1.3 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
- * PC allows for multiple
+ * this allows for multiple
* declaration parts unless
* standard option has been
* specified.
* declaration parts unless
* standard option has been
* specified.
-if (!progseen)
- level1();
-#ifdef PC
- if (opt('s')) {
- if (parts & VPRT) {
+ if (!progseen)
+ level1();
+ if ( parts[ cbn ] & ( VPRT | RPRT ) ) {
+ if ( opt( 's' ) ) {
- error("Type declarations must precede var declarations");
+ } else {
+ warning();
+ }
+ error("Type declarations should precede var and routine declarations");
+ if (parts[ cbn ] & TPRT) {
+ if ( opt( 's' ) ) {
- error("All types must be declared in one type part");
+ } else {
+ warning();
+ }
+ error("All types should be declared in one type part");
- }
-#endif PC
-#ifdef OBJ
- if (parts & VPRT)
- error("Type declarations must precede var declarations");
- if (parts & TPRT)
- error("All types must be declared in one type part");
-#endif OBJ
- parts |= TPRT;
#endif
/*
* Forechain is the head of a list of types that
#endif
/*
* Forechain is the head of a list of types that
/* Copyright (c) 1979 Regents of the University of California */
/* Copyright (c) 1979 Regents of the University of California */
-static char sccsid[] = "@(#)var.c 1.2 %G%";
+static char sccsid[] = "@(#)var.c 1.3 %G%";
#include "whoami.h"
#include "0.h"
#include "whoami.h"
#include "0.h"
-/* PC allows for multiple declaration
+/* this allows for multiple declaration
* parts except when the "standard"
* option has been specified.
* If routine segment is being compiled,
* parts except when the "standard"
* option has been specified.
* If routine segment is being compiled,
-if (!progseen)
- level1();
-#ifdef PC
- if (opt('s')) {
- if (parts & VPRT){
+ if (!progseen)
+ level1();
+ if ( parts[ cbn ] & RPRT ) {
+ if ( opt( 's' ) ) {
- error("All variables must be declared in one var part");
+ } else {
+ warning();
+ }
+ error("Variable declarations should precede routine declarations");
- }
-#else
- if (parts & VPRT)
- error("All variables must be declared in one var part");
-#endif PC
-
- parts |= VPRT;
+ if ( parts[ cbn ] & VPRT ) {
+ if ( opt( 's' ) ) {
+ standard();
+ } else {
+ warning();
+ }
+ error("All variables should be declared in one var part");
+ }
+ parts[ cbn ] |= VPRT;