projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
date and time created 83/08/05 13:34:56 by sam
[unix-history]
/
usr
/
src
/
old
/
as.vax
/
asscan2.c
diff --git
a/usr/src/old/as.vax/asscan2.c
b/usr/src/old/as.vax/asscan2.c
index
a6a3386
..
11fe47e
100644
(file)
--- a/
usr/src/old/as.vax/asscan2.c
+++ b/
usr/src/old/as.vax/asscan2.c
@@
-2,37
+2,39
@@
* Copyright (c) 1982 Regents of the University of California
*/
#ifndef lint
* Copyright (c) 1982 Regents of the University of California
*/
#ifndef lint
-static char sccsid[] = "@(#)asscan2.c 4.1
1
%G%";
+static char sccsid[] = "@(#)asscan2.c 4.1
4
%G%";
#endif not lint
#include "asscanl.h"
static inttoktype oval = NL;
#endif not lint
#include "asscanl.h"
static inttoktype oval = NL;
-
+#define ASINBUFSIZ 4096
char inbufunget[8];
char inbuffer[ASINBUFSIZ];
char *Ginbufptr = inbuffer;
int Ginbufcnt = 0;
char inbufunget[8];
char inbuffer[ASINBUFSIZ];
char *Ginbufptr = inbuffer;
int Ginbufcnt = 0;
+int scannerhadeof;
fillinbuffer()
{
int nread;
fillinbuffer()
{
int nread;
- static int hadeof;
int goal;
int got;
nread = 0;
int goal;
int got;
nread = 0;
- if (hadeof == 0){
+ if (
scanner
hadeof == 0){
goal = sizeof(inbuffer);
do {
got = read(stdin->_file, inbuffer + nread, goal);
if (got == 0)
goal = sizeof(inbuffer);
do {
got = read(stdin->_file, inbuffer + nread, goal);
if (got == 0)
- hadeof = 1;
+
scanner
hadeof = 1;
if (got <= 0)
break;
nread += got;
goal -= got;
} while (goal);
if (got <= 0)
break;
nread += got;
goal -= got;
} while (goal);
+ } else {
+ scannerhadeof = 0;
}
/*
* getchar assumes that Ginbufcnt and Ginbufptr
}
/*
* getchar assumes that Ginbufcnt and Ginbufptr
@@
-47,12
+49,6
@@
fillinbuffer()
Ginbufptr = inbuffer + 1;
}
Ginbufptr = inbuffer + 1;
}
-#if NCPName < NCPString
-char strtext[NCPString + 1];
-#else
-# define strtext yytext
-#endif
-
scan_dot_s(bufferbox)
struct tokbufdesc *bufferbox;
{
scan_dot_s(bufferbox)
struct tokbufdesc *bufferbox;
{
@@
-69,11
+65,10
@@
scan_dot_s(bufferbox)
ptrall lgbackpatch; /* where to stuff a string length */
reg ptrall bufptr; /* where to stuff tokens */
ptrall bufub; /* where not to stuff tokens */
ptrall lgbackpatch; /* where to stuff a string length */
reg ptrall bufptr; /* where to stuff tokens */
ptrall bufub; /* where not to stuff tokens */
- reg int strlg; /* the length of a string */
long intval; /* value of int */
int linescrossed; /* when doing strings and comments */
struct Opcode opstruct;
long intval; /* value of int */
int linescrossed; /* when doing strings and comments */
struct Opcode opstruct;
-
struct strdesc strd; /* for building DQ strings
*/
+
reg int strlg; /* the length of a string
*/
(bytetoktype *)bufptr = (bytetoktype *) & (bufferbox->toks[0]);
(bytetoktype *)bufub = &(bufferbox->toks[AVAILTOKS]);
(bytetoktype *)bufptr = (bytetoktype *) & (bufferbox->toks[0]);
(bytetoktype *)bufub = &(bufferbox->toks[AVAILTOKS]);
@@
-81,13
+76,7
@@
scan_dot_s(bufferbox)
MEMTOREGBUF;
if (newfflag){
newfflag = 0;
MEMTOREGBUF;
if (newfflag){
newfflag = 0;
- strd.sd_stroff = strfilepos;
- strd.sd_place = STR_BOTH;
- strd.sd_strlen = strlen(newfname) + 1;
- fputs(newfname, strfile);
- putc(0, strfile);
- strfilepos += strd.sd_strlen;
- ryylval = (int)savestr(newfname, &strd);
+ ryylval = (int)savestr(newfname, strlen(newfname)+1, STR_BOTH);
ptoken(bufptr, IFILE);
ptoken(bufptr, STRING);
ptoken(bufptr, IFILE);
ptoken(bufptr, STRING);
@@
-319,9
+308,7
@@
scan_dot_s(bufferbox)
case DQ:
eatstr:
linescrossed = 0;
case DQ:
eatstr:
linescrossed = 0;
- strd.sd_stroff = strfilepos;
- strd.sd_place = STR_FILE;
- for (strd.sd_strlen = 0; /*VOID*/; strd.sd_strlen++){
+ for (strlg = 0; /*VOID*/; strlg++){
switch(ch = getchar()){
case '"':
goto tailDQ;
switch(ch = getchar()){
case '"':
goto tailDQ;
@@
-381,18
+368,14
@@
scan_dot_s(bufferbox)
pint(bufptr, linescrossed);
}
/*
pint(bufptr, linescrossed);
}
/*
- * put the string in strtext into the string pool
- *
* Cheat: append a trailing null to the string
* and then adjust the string length to ignore
* the trailing null. If any STRING client requires
* the trailing null, the client can just change STRLEN
*/
* Cheat: append a trailing null to the string
* and then adjust the string length to ignore
* the trailing null. If any STRING client requires
* the trailing null, the client can just change STRLEN
*/
- val = STRING;
putc(0, strfile);
putc(0, strfile);
- strd.sd_strlen += 1;
- strfilepos += strd.sd_strlen;
- ryylval = (int)savestr(strtext, &strd);
+ ryylval = (int)savestr((char *)0, strlg + 1, STR_FILE);
+ val = STRING;
((struct strdesc *)ryylval)->sd_strlen -= 1;
goto ret;
((struct strdesc *)ryylval)->sd_strlen -= 1;
goto ret;