BSD 4 release
[unix-history] / usr / src / cmd / pi / const.c
index 34414b2..e18b0b2 100644 (file)
@@ -1,13 +1,8 @@
 /* Copyright (c) 1979 Regents of the University of California */
 /* Copyright (c) 1979 Regents of the University of California */
-#
-/*
- * pi - Pascal interpreter code translator
- *
- * Charles Haley, Bill Joy UCB
- * Version 1.2 November 1978
- */
 
 
-#include "whoami"
+static char sccsid[] = "@(#)const.c 1.4 9/4/80";
+
+#include "whoami.h"
 #include "0.h"
 #include "tree.h"
 
 #include "0.h"
 #include "tree.h"
 
 constbeg()
 {
 
 constbeg()
 {
 
-       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");
-       parts |= CPRT;
+/*
+ * this allows for multiple declaration
+ * parts, unless the "standard" option
+ * has been specified.
+ * If a routine segment is being compiled,
+ * do level one processing.
+ */
+
+       if (!progseen)
+               level1();
+       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;
 }
 }
-#endif
+#endif PI1
 
 const(cline, cid, cdecl)
        int cline;
 
 const(cline, cid, cdecl)
        int cline;
@@ -44,6 +61,13 @@ const(cline, cid, cdecl)
 #ifndef PI0
        np->nl_flags |= NMOD;
 #endif
 #ifndef PI0
        np->nl_flags |= NMOD;
 #endif
+
+#ifdef PC
+       if (cbn == 1) {
+           stabgconst( cid , line );
+       }
+#endif PC
+
 #      ifdef PTREE
            {
                pPointer        Const = ConstDecl( cid , cdecl );
 #      ifdef PTREE
            {
                pPointer        Const = ConstDecl( cid , cdecl );
@@ -180,10 +204,6 @@ restcon:
                        if (negd)
                                con.crval = -con.crval;
                        ci = con.crval;
                        if (negd)
                                con.crval = -con.crval;
                        ci = con.crval;
-#ifndef PI0
-                       if (bytes(ci, ci) <= 2)
-                               con.ctype = nl+T2INT;
-#endif
                }
        }
 }
                }
        }
 }