Bell 32V development
authorTom London <tbl@research.uucp>
Mon, 6 Nov 1978 04:30:52 +0000 (23:30 -0500)
committerTom London <tbl@research.uucp>
Mon, 6 Nov 1978 04:30:52 +0000 (23:30 -0500)
Work on file usr/src/libln/allprint.c
Work on file usr/src/cmd/lex/lib/allprint.c
Work on file usr/src/cmd/lex/lib/main.c
Work on file usr/src/libln/main.c
Work on file usr/src/cmd/lex/lib/reject.c
Work on file usr/src/cmd/lex/lib/yywrap.c
Work on file usr/src/libln/yywrap.c
Work on file usr/src/cmd/lex/lib/yyless.c
Work on file usr/src/libln/yyless.c
Work on file usr/src/libln/reject.c

Co-Authored-By: John Reiser <jfr@research.uucp>
Synthesized-from: 32v

usr/src/cmd/lex/lib/allprint.c [new file with mode: 0644]
usr/src/cmd/lex/lib/main.c [new file with mode: 0644]
usr/src/cmd/lex/lib/reject.c [new file with mode: 0644]
usr/src/cmd/lex/lib/yyless.c [new file with mode: 0644]
usr/src/cmd/lex/lib/yywrap.c [new file with mode: 0644]
usr/src/libln/allprint.c [new file with mode: 0644]
usr/src/libln/main.c [new file with mode: 0644]
usr/src/libln/reject.c [new file with mode: 0644]
usr/src/libln/yyless.c [new file with mode: 0644]
usr/src/libln/yywrap.c [new file with mode: 0644]

diff --git a/usr/src/cmd/lex/lib/allprint.c b/usr/src/cmd/lex/lib/allprint.c
new file mode 100644 (file)
index 0000000..238cade
--- /dev/null
@@ -0,0 +1,37 @@
+# include <stdio.h>
+allprint(c)
+  char c; {
+       extern FILE *yyout;
+       switch(c){
+               case '\n':
+                       fprintf(yyout,"\\n");
+                       break;
+               case '\t':
+                       fprintf(yyout,"\\t");
+                       break;
+               case '\b':
+                       fprintf(yyout,"\\b");
+                       break;
+               case ' ':
+                       fprintf(yyout,"\\\bb");
+                       break;
+               default:
+                       if(!printable(c))
+                               fprintf(yyout,"\\%-3o",c);
+                       else 
+                               putc(c,yyout);
+                       break;
+               }
+       return;
+       }
+sprint(s)
+  char *s; {
+       while(*s)
+               allprint(*s++);
+       return;
+       }
+printable(c)
+  int c;
+       {
+       return(040 < c && c < 0177);
+       }
diff --git a/usr/src/cmd/lex/lib/main.c b/usr/src/cmd/lex/lib/main.c
new file mode 100644 (file)
index 0000000..123b665
--- /dev/null
@@ -0,0 +1,5 @@
+# include "stdio.h"
+main(){
+yylex();
+exit(0);
+}
diff --git a/usr/src/cmd/lex/lib/reject.c b/usr/src/cmd/lex/lib/reject.c
new file mode 100644 (file)
index 0000000..7fa9282
--- /dev/null
@@ -0,0 +1,41 @@
+# include <stdio.h>
+extern struct {int *yyaa, *yybb; int *yystops;} *yylstate [], **yylsp, **yyolsp;
+yyreject ()
+{
+extern FILE *yyout, *yyin;
+extern int yyprevious , *yyfnd;
+extern char yyextra[];
+extern char yytext[];
+extern int yyleng;
+for( ; yylsp < yyolsp; yylsp++)
+       yytext[yyleng++] = yyinput();
+if (*yyfnd > 0)
+       return(yyracc(*yyfnd++));
+while (yylsp-- > yylstate)
+       {
+       yyunput(yytext[yyleng-1]);
+       yytext[--yyleng] = 0;
+       if (*yylsp != 0 && (yyfnd= (*yylsp)->yystops) && *yyfnd > 0)
+               return(yyracc(*yyfnd++));
+       }
+if (yytext[0] == 0)
+       return(0);
+yyoutput(yyprevious = yyinput());
+yyleng=0;
+return(-1);
+}
+yyracc(m)
+{
+yyolsp = yylsp;
+if (yyextra[m])
+       {
+       while (yyback((*yylsp)->yystops, -m) != 1 && yylsp>yylstate)
+               {
+               yylsp--;
+               yyunput(yytext[--yyleng]);
+               }
+       }
+yyprevious = yytext[yyleng-1];
+yytext[yyleng] = 0;
+return(m);
+}
diff --git a/usr/src/cmd/lex/lib/yyless.c b/usr/src/cmd/lex/lib/yyless.c
new file mode 100644 (file)
index 0000000..5914bd9
--- /dev/null
@@ -0,0 +1,18 @@
+yyless(x)
+{
+extern char yytext[];
+register char *lastch, *ptr;
+extern int yyleng;
+extern int yyprevious;
+lastch = yytext+yyleng;
+if (x>=0 && x <= yyleng)
+       ptr = x + yytext;
+else
+       ptr = x;
+while (lastch > ptr)
+       yyunput(*--lastch);
+*lastch = 0;
+if (ptr >yytext)
+       yyprevious = *--lastch;
+yyleng = ptr-yytext;
+}
diff --git a/usr/src/cmd/lex/lib/yywrap.c b/usr/src/cmd/lex/lib/yywrap.c
new file mode 100644 (file)
index 0000000..0866993
--- /dev/null
@@ -0,0 +1,4 @@
+yywrap()
+{
+       return(1);
+}
diff --git a/usr/src/libln/allprint.c b/usr/src/libln/allprint.c
new file mode 100644 (file)
index 0000000..238cade
--- /dev/null
@@ -0,0 +1,37 @@
+# include <stdio.h>
+allprint(c)
+  char c; {
+       extern FILE *yyout;
+       switch(c){
+               case '\n':
+                       fprintf(yyout,"\\n");
+                       break;
+               case '\t':
+                       fprintf(yyout,"\\t");
+                       break;
+               case '\b':
+                       fprintf(yyout,"\\b");
+                       break;
+               case ' ':
+                       fprintf(yyout,"\\\bb");
+                       break;
+               default:
+                       if(!printable(c))
+                               fprintf(yyout,"\\%-3o",c);
+                       else 
+                               putc(c,yyout);
+                       break;
+               }
+       return;
+       }
+sprint(s)
+  char *s; {
+       while(*s)
+               allprint(*s++);
+       return;
+       }
+printable(c)
+  int c;
+       {
+       return(040 < c && c < 0177);
+       }
diff --git a/usr/src/libln/main.c b/usr/src/libln/main.c
new file mode 100644 (file)
index 0000000..123b665
--- /dev/null
@@ -0,0 +1,5 @@
+# include "stdio.h"
+main(){
+yylex();
+exit(0);
+}
diff --git a/usr/src/libln/reject.c b/usr/src/libln/reject.c
new file mode 100644 (file)
index 0000000..7fa9282
--- /dev/null
@@ -0,0 +1,41 @@
+# include <stdio.h>
+extern struct {int *yyaa, *yybb; int *yystops;} *yylstate [], **yylsp, **yyolsp;
+yyreject ()
+{
+extern FILE *yyout, *yyin;
+extern int yyprevious , *yyfnd;
+extern char yyextra[];
+extern char yytext[];
+extern int yyleng;
+for( ; yylsp < yyolsp; yylsp++)
+       yytext[yyleng++] = yyinput();
+if (*yyfnd > 0)
+       return(yyracc(*yyfnd++));
+while (yylsp-- > yylstate)
+       {
+       yyunput(yytext[yyleng-1]);
+       yytext[--yyleng] = 0;
+       if (*yylsp != 0 && (yyfnd= (*yylsp)->yystops) && *yyfnd > 0)
+               return(yyracc(*yyfnd++));
+       }
+if (yytext[0] == 0)
+       return(0);
+yyoutput(yyprevious = yyinput());
+yyleng=0;
+return(-1);
+}
+yyracc(m)
+{
+yyolsp = yylsp;
+if (yyextra[m])
+       {
+       while (yyback((*yylsp)->yystops, -m) != 1 && yylsp>yylstate)
+               {
+               yylsp--;
+               yyunput(yytext[--yyleng]);
+               }
+       }
+yyprevious = yytext[yyleng-1];
+yytext[yyleng] = 0;
+return(m);
+}
diff --git a/usr/src/libln/yyless.c b/usr/src/libln/yyless.c
new file mode 100644 (file)
index 0000000..5914bd9
--- /dev/null
@@ -0,0 +1,18 @@
+yyless(x)
+{
+extern char yytext[];
+register char *lastch, *ptr;
+extern int yyleng;
+extern int yyprevious;
+lastch = yytext+yyleng;
+if (x>=0 && x <= yyleng)
+       ptr = x + yytext;
+else
+       ptr = x;
+while (lastch > ptr)
+       yyunput(*--lastch);
+*lastch = 0;
+if (ptr >yytext)
+       yyprevious = *--lastch;
+yyleng = ptr-yytext;
+}
diff --git a/usr/src/libln/yywrap.c b/usr/src/libln/yywrap.c
new file mode 100644 (file)
index 0000000..0866993
--- /dev/null
@@ -0,0 +1,4 @@
+yywrap()
+{
+       return(1);
+}