date and time created 80/08/27 19:57:16 by peter
authorPeter B. Kessler <peter@ucbvax.Berkeley.EDU>
Thu, 28 Aug 1980 10:57:16 +0000 (02:57 -0800)
committerPeter B. Kessler <peter@ucbvax.Berkeley.EDU>
Thu, 28 Aug 1980 10:57:16 +0000 (02:57 -0800)
SCCS-vsn: usr.bin/pascal/src/yyoptions.c 1.1

usr/src/usr.bin/pascal/src/yyoptions.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/pascal/src/yyoptions.c b/usr/src/usr.bin/pascal/src/yyoptions.c
new file mode 100644 (file)
index 0000000..877dafa
--- /dev/null
@@ -0,0 +1,74 @@
+/* Copyright (c) 1979 Regents of the University of California */
+
+static char sccsid[] = "@(#)yyoptions.c 1.1 %G%";
+
+#include "whoami.h"
+#include "0.h"
+#include "yy.h"
+
+/*
+ * Options processes the option
+ * strings which can appear in
+ * comments and returns the next character.
+ */
+options()
+{
+       register c, ch;
+       register char *optp;
+       int ok;
+
+       c = readch();
+       if (c != '$')
+               return (c);
+       do {
+               ch = c = readch();
+               switch (c) {
+                       case 'b':
+                               optp = &opt( 'b' );
+                               c = readch();
+                               if (!digit(c))
+                                       return (c);
+                               *optp = c - '0';
+                               c = readch();
+                               break;
+#                  ifdef PC
+                       case 'C':
+                                   /*
+                                    *  C is a replacement for t, fake it.
+                                    */
+                               c = 't';
+                               /* and fall through */
+                       case 'g':
+#                  endif PC
+                       case 'k':
+                       case 'l':
+                       case 'n':
+                       case 'p':
+                       case 's':
+                       case 't':
+                       case 'u':
+                       case 'w':
+                       case 'z':
+                               optp = &opt( c );
+                               c = readch();
+                               if (c == '+') {
+                                       *optp = 1;
+                                       c = readch();
+                               } else if (c == '-') {
+                                       *optp = 0;
+                                       c = readch();
+                               } else {
+                                       return (c);
+                               }
+                               break;
+                       default:
+                                   return (c);
+                       }
+#ifdef PI0
+               send(ROSET, ch, *optp);
+#endif
+       } while (c == ',');
+       if ( opt( 'u' ) )
+               setuflg();
+       return (c);
+}