bin/adb/adb
bin/adb/instrs.adb
bin/ar
+bin/as/as
+bin/as/instrs.as
bin/cat
bin/cc
bin/chgrp
-../as/asnumber.h assert.h
+../as/instrs.h vax/mtpr.h
access.c sys/map.h
command.c sys/map.h
head.h sys/map.h
* @(#)as.h 5.3 (Berkeley) 7/6/85
*/
-#define reg register
-
#include <sys/types.h>
#include <a.out.h>
#include <stab.h>
-#define readonly
#define NINST 300
#define NEXP 20 /* max number of expr. terms per instruction */
# undef NCPName
# define NCPName 4096
#endif not NCPS
-/*
- * Check sizes, and compiler error if sizes botch
- */
-#if STRPOOLDALLOP < NCPName
- $$$botch with definition sizes
-#endif test botches
+
+/* note: STRPOOLDALLOP has to be at least as large as NCPName */
+
/*
* Symbol types
*/
#define STR_BOTH 0x3
struct strdesc *savestr();
+/*
+ * Assertions
+ */
+/* only used by bignum stuff, moved to here to avoid a circular dependency */
+#if 1
+#define assert(x, str) if (!(x)) panic("%s%s\n", "x", str)
+#else
+#define assert(x, str)
+#endif
\f
/*
* Global variables
* we have a bunch of buffers allocated internally that
* contain the relocation information.
*/
- struct relbufdesc *rusefile[NLOC + NLOC];
- struct relbufdesc *relfil;
+ extern struct relbufdesc *rusefile[NLOC + NLOC];
+ extern struct relbufdesc *relfil;
#define ERROR(string) yyerror(string); goto errorfix
-#define peekahead (*tokptr)
-
-#define shift val = yylex()
-#define advance shift
+#define peekahead (*(char *)tokptr)
#define shiftover(token) if (val != token) { \
shiftoerror(token); \
goto errorfix; \
} \
- shift
-
-#define advanceover shiftover
+ val = yylex()
/*
* To speed up the expression processing, we class the input tokens
#ifdef lint
*to = *to;
#endif lint
+#ifdef __STDC__ /* this is a bit non-ideal, revisit later */
+ memcpy(to, p, put);
+#else
asm("movc3 r8,(r11),(r7)");
+#endif
bp->b_ptr += put;
p += put;
cnt -= put;
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
+#include <varargs.h>
#include "as.h"
#include "assyms.h"
int argc;
char **argv;
{
- char *sbrk();
+ void *sbrk();
tokfilename[0] = 0;
strfilename[0] = 0;
register char *ub;
register char *cp;
register char *pat;
- char *sbrk();
+ void *sbrk();
for (cp = (char *)&environ, ub = sbrk(0); cp < ub; cp++){
if (cp[0] != '@') continue;
sawabort()
{
+#if 0 /* I don't see why this is necessary... and fillinbuffer() is now void */
char *fillinbuffer();
while (fillinbuffer() != (char *)0)
continue;
+#endif
delete();
exit(1); /*although the previous pass will also exit non zero*/
}
-panic(fmt, a1, a2, a3, a4)
+panic(fmt, va_alist)
char *fmt;
- /*VARARGS 1*/
+ va_dcl
{
+ va_list argp;
+
yyerror("Assembler panic: bad internal data structure.");
- yyerror(fmt, a1, a2, a3, a4);
+ va_start(argp);
+ vyyerror(fmt, argp);
+ va_end(argp);
delete();
abort();
}
-#ifndef ____AS_ASNUMBER_H_
-#define ____AS_ASNUMBER_H_
-
-#include <sys/types.h>
-
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
#define MAXINT_1 ((unsigned)(1<<(CH_BITS - 1)))
#define MAXINT_10 ((unsigned)((MAXINT_1/(unsigned)10)))
#define MAXINT_5 ((unsigned)((MAXINT_1/(unsigned)5)))
-#else
+#else not 0
/*
* These values were computed using dc, so are exact.
* Only MAXINT_10 and MAXINT_5 are used in the programs.
#define MAXINT_1 2147483648
#define MAXINT_10 214748364
#define MAXINT_5 429496729
-#endif
-
-/*Bignum as_atoi();*/ /* converts string to integer */
-/*Bignum as_atof();*/ /* converts string to float */
-/*Bignum bigatof();*/ /* converts string to float */
-/*Bignum floatconvert();*/ /* converts amongst float #s */
-/*Bignum intconvert();*/ /* converts amongst float #s */
-/*Bignum bignumconvert();*/ /* converts amongst float #s */
-/*Bignum bignumpack();*/ /* converts UNPACKED bignum to bignum */
-/*Bignum bignumunpack();*/ /* converts bignum to UNPACKED bignum */
+#endif not 0
+
+Bignum as_atoi(); /* converts string to integer */
+Bignum as_atof(); /* converts string to float */
+Bignum bigatof(); /* converts string to float */
+Bignum floatconvert(); /* converts amongst float #s */
+Bignum intconvert(); /* converts amongst float #s */
+Bignum bignumconvert(); /* converts amongst float #s */
+Bignum bignumpack(); /* converts UNPACKED bignum to bignum */
+Bignum bignumunpack(); /* converts bignum to UNPACKED bignum */
\f
/*
* Definitions for overflows.
#define OVF_OVERFLOW (1<<9) /* overflow in conversion */
#define OVF_UNDERFLOW (1<<10) /* underflow in conversion */
-/*Ovf posovf();*/
-/*Ovf numclear();*/
-/*Ovf numshift();*/
-/*Ovf numaddv();*/
-/*Ovf numaddd();*/
-/*Ovf num1comp();*/
-/*Ovf numnegate();*/
+Ovf posovf();
+Ovf numclear();
+Ovf numshift();
+Ovf numaddv();
+Ovf numaddd();
+Ovf num1comp();
+Ovf numnegate();
\f
/*
* Definitions to unpack big numbers numbers into
* Bit manipulations
*/
#define ONES(n) ((1 << (n)) - 1)
-/*
- * Assertions
- */
-#if 1
-#define assert(x, str) if (!(x)) panic("%s%s\n", "x", str)
-#else
-#define assert(x, str)
-#endif
-
-#endif
#endif not lint
#include <stdio.h>
+#include <varargs.h>
#include "as.h"
#include "asscan.h"
#include "assyms.h"
break;
case PARSEEOF:
- tokptr -= sizeof(bytetoktype);
- *tokptr++ = VOID;
- tokptr[1] = VOID;
- tokptr[2] = PARSEEOF;
+ /* better check this -- is tokptr[-1] supposed to be a word or byte? */
+ /* why is a gap left at tokptr[0]? why is this code necessary at all? */
+ ((bytetoktype *)tokptr)[-1] = VOID;
+ ((bytetoktype *)tokptr)[1] = VOID;
+ ((bytetoktype *)tokptr)[2] = PARSEEOF;
break;
case IFILE:
if (passno == 2) goto errorfix;
stpt = (struct symtab *)yylval;
stabstart = tokptr;
- (bytetoktype *)stabstart -= sizeof(struct symtab *);
- (bytetoktype *)stabstart -= sizeof(bytetoktype);
+ *(bytetoktype **)&stabstart -= sizeof(struct symtab *);
+ *(bytetoktype **)&stabstart -= sizeof(bytetoktype);
shift;
if (auxval == ISTABSTR){
stringp = (struct strdesc *)yylval;
yyerror("%s expected", tok_to_name(token));
}
-/*VARARGS1*/
-yyerror(s, a1, a2,a3,a4,a5)
+vyyerror(s, argp)
char *s;
+ va_list argp;
{
-
-#define sink stdout
-
if (anyerrs == 0 && anywarnings == 0 && ! silent)
- fprintf(sink, "Assembler:\n");
+ printf("Assembler:\n");
anyerrs++;
if (silent)
return;
- fprintf(sink, "\"%s\", line %d: ", dotsname, lineno);
- fprintf(sink, s, a1, a2,a3,a4,a5);
- fprintf(sink, "\n");
-#undef sink
+ printf("\"%s\", line %d: ", dotsname, lineno);
+ vprintf(s, argp);
+ printf("\n");
+}
+
+yyerror(s, va_alist)
+ char *s;
+ va_dcl
+{
+ va_list argp;
+
+ va_start(argp);
+ vyyerror(s, argp);
+ va_end(argp);
}
-/*VARARGS1*/
-yywarning(s, a1, a2,a3,a4,a5)
+yywarning(s, va_alist)
char *s;
+ va_dcl
{
-#define sink stdout
+ va_list argp;
+
if (anyerrs == 0 && anywarnings == 0 && ! silent)
- fprintf(sink, "Assembler:\n");
+ printf("Assembler:\n");
anywarnings++;
if (silent)
return;
- fprintf(sink, "\"%s\", line %d: WARNING: ", dotsname, lineno);
- fprintf(sink, s, a1, a2,a3,a4,a5);
- fprintf(sink, "\n");
-#undef sink
+ printf("\"%s\", line %d: WARNING: ", dotsname, lineno);
+ va_start(argp);
+ vprintf(s, argp);
+ va_end(argp);
+ printf("\n");
}
typedef int inttoktype;
typedef char bytetoktype;
-
-typedef char *ptrall; /*all uses will be type cast*/
typedef u_short lgtype; /*for storing length of strings or skiping*/
/*
* defintions for putting various typed values
* ptr will ALWAYS be of type ptrall
*/
-#define pchar(ptr,val) *ptr++ = val
-#define puchar(ptr,val) *ptr++ = val
+#define pchar(ptr,val) (*(*(char **)&(ptr))++ = (val))
+#define puchar(ptr,val) (*(*(char **)&(ptr))++ = (val))
-#define pshort(ptr,val) *(short *)ptr=val, ptr += sizeof(short)
-#define plgtype(ptr,val) *(lgtype *)ptr=val, ptr += sizeof(lgtype)
-#define pushort(ptr,val) *(u_short *)ptr=val, ptr += sizeof(short)
-#define pint(ptr,val) *(int *)ptr = val, ptr += sizeof(int)
-#define puint(ptr,val) *(u_int int *)ptr=val, ptr += sizeof(int)
-#define plong(ptr,val) *(long *)ptr = val, ptr += sizeof(long)
-#define pulong(ptr,val) *(u_int long *)ptr=val, ptr += sizeof(long)
-#define pnumber(ptr,val) *(Bignum*)ptr=val, ptr += sizeof(Bignum)
-#define popcode(ptr,val) *(struct Opcode*)ptr=val, ptr += sizeof(struct Opcode)
+#define pshort(ptr,val) (*(*(short **)&(ptr))++ = (val))
+#define plgtype(ptr,val) (*(*(lgtype **)&(ptr))++ = (val))
+#define pushort(ptr,val) (*(*(u_short **)&(ptr))++ = (val))
+#define pint(ptr,val) (*(*(int **)&(ptr))++ = (val))
+#define puint(ptr,val) (*(*(u_int **)&(ptr))++ = (val))
+#define plong(ptr,val) (*(*(long **)&(ptr))++ = (val))
+#define pulong(ptr,val) (*(*(u_long **)&(ptr))++ = (val))
+#define pnumber(ptr,val) (*(*(Bignum **)&(ptr))++ = (val))
+#define popcode(ptr,val) (*(*(struct Opcode **)&(ptr))++ = (val))
-#define pptr(ptr,val) *(int *)ptr = (val), ptr += sizeof(ptrall)
-#define ptoken(ptr,val) *ptr++ = val
-#define pskiplg(ptr,val) *(lgtype *)ptr = val, ptr += sizeof(short)
+#define pptr(ptr,val) (*(*(int **)&(ptr))++ = (val))
+#define ptoken(ptr,val) (*(*(char **)&(ptr))++ = (val))
+#define pskiplg(ptr,val) (*(*(lgtype **)&(ptr))++ = (val))
-#define gchar(val, ptr) val = *ptr++
-#define guchar(val, ptr) val = *ptr++
+#define gchar(val, ptr) ((val) = *(*(char **)&(ptr))++)
+#define guchar(val, ptr) ((val) = *(*(u_char **)&(ptr))++)
-#define gshort(val, ptr) val = *(short *)ptr , ptr += sizeof (short)
-#define glgtype(val, ptr) val = *(lgtype *)ptr , ptr += sizeof (lgtype)
-#define gushort(val, ptr) val = *(u_short *)ptr , ptr += sizeof (short)
-#define gint(val, ptr) val = *(int *)ptr, ptr += sizeof (int)
-#define guint(val, ptr) val = *(u_int *)ptr, ptr += sizeof (int)
-#define glong(val, ptr) val = *(long *)ptr, ptr += sizeof (long)
-#define gulong(val, ptr) val = *(u_int *)ptr, ptr += sizeof (long)
-#define gnumber(val, ptr) val = *(Bignum *)ptr, ptr += sizeof(Bignum)
-#define gopcode(val, ptr) val = *(struct Opcode *)ptr, ptr += sizeof(struct Opcode)
+#define gshort(val, ptr) ((val) = *(*(short **)&(ptr))++ )
+#define glgtype(val, ptr) ((val) = *(*(lgtype **)&(ptr))++ )
+#define gushort(val, ptr) ((val) = *(*(u_short **)&(ptr))++ )
+#define gint(val, ptr) ((val) = *(*(int **)&(ptr))++)
+#define guint(val, ptr) ((val) = *(*(u_int **)&(ptr))++)
+#define glong(val, ptr) ((val) = *(*(long **)&(ptr))++)
+#define gulong(val, ptr) ((val) = *(*(u_int **)&(ptr))++)
+#define gnumber(val, ptr) ((val) = *(*(Bignum **)&(ptr))++)
+#define gopcode(val, ptr) ((val) = *(*(struct Opcode **)&(ptr))++)
-#define gptr(val, ptr) val = *(int *)ptr, ptr += sizeof (ptrall)
-#define gtoken(val, ptr) val = *ptr++
-#define gskiplg(val, ptr) val = *(lgtype *)ptr, ptr += sizeof (short)
+#define gptr(val, ptr) ((val) = *(*(int **)&(ptr))++)
+#define gtoken(val, ptr) ((val) = *(*(char **)&(ptr))++)
+#define gskiplg(val, ptr) ((val) = *(*(lgtype **)&(ptr))++)
extern ptrall tokptr; /*the next token to consume, call by copy*/
extern ptrall tokub; /*current upper bound in the current buffer*/
#include "asscanl.h"
+/* moved here from asscanl.h: */
+struct tokbufdesc *bufstart; /*where the buffer list begins*/
+struct tokbufdesc *buftail; /*last one on the list*/
+struct tokbufdesc *emptybuf; /*the one being filled*/
+
+struct tokbufdesc *tok_free; /* free pool */
+struct tokbufdesc *tok_temp; /* temporary for doing list manipulation */
+
+int bufno; /*which buffer number: 0,1 for tmp file*/
+struct tokbufdesc tokbuf[2]; /*our initial increment of buffers*/
+ptrall tokptr; /*where the current token comes from*/
+ptrall tokub; /*the last token in the current token buffer*/
+
+#ifdef DEBUG
+ptrall firsttoken;
+#endif DEBUG
+
+int yylval; /* normal semantic value */
+Bignum yybignum; /* a big number */
+struct Opcode yyopcode; /* a structure opcode */
+
+int newfflag;
+char *newfname;
+int scanlineno; /*the scanner's linenumber*/
+
inittokfile()
{
if (passno == 1){
}
buftail->tok_next = 0;
} /*end of need to get more buffers*/
- (bytetoktype *)bufptr = &(emptybuf->toks[0]);
+ *(bytetoktype **)&bufptr = &(emptybuf->toks[0]);
if (passno == 1)
scan_dot_s(emptybuf);
} else { /*don't use VM*/
bufno ^= 1;
emptybuf = &tokbuf[bufno];
- ((bytetoktype *)bufptr) = &(emptybuf->toks[0]);
+ *(bytetoktype **)&bufptr = &(emptybuf->toks[0]);
if (passno == 1){
/*
* First check if there are things to write
}
}
} /*end of using a real live file*/
- (char *)tokub = (char *)bufptr + emptybuf->tok_count;
+ *(char **)&tokub = (char *)bufptr + emptybuf->tok_count;
#ifdef DEBUG
firsttoken = bufptr;
if (debug)
/*
* Now, force from to be in the same buffer as to
*/
- (bytetoktype *)from = (bytetoktype *)&(emptybuf->toks[0]);
+ *(bytetoktype **)&from = (bytetoktype *)&(emptybuf->toks[0]);
}
/*
* Now, to and from are in the same buffer
}
}
-movestr(to, from, lg)
- char *to; /* 4(ap) */
- char *from; /* 8(ap) */
- int lg; /* 12(ap) */
-{
- if (lg <= 0)
- return;
- ;
- asm("movc3 12(ap),*8(ap),*4(ap)");
- ;
-}
-
new_dot_s(namep)
char *namep;
{
struct Opcode opstruct;
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]);
MEMTOREGBUF;
if (newfflag){
#include "asscanl.h"
-#define reg register
#define NUMSIZE 128 /* how many characters long a number can be */
#define FLTCHAR(x) (INCHARSET((x),(DIGIT|SIGN|FLOATEXP|POINT)))
* for errors encountered in the scanner and in the parser.
*/
#define TOKDALLOP 8
-struct tokbufdesc *bufstart; /*where the buffer list begins*/
-struct tokbufdesc *buftail; /*last one on the list*/
-struct tokbufdesc *emptybuf; /*the one being filled*/
+extern struct tokbufdesc *bufstart; /*where the buffer list begins*/
+extern struct tokbufdesc *buftail; /*last one on the list*/
+extern struct tokbufdesc *emptybuf; /*the one being filled*/
/*
* If we are using VM, during the second pass we reclaim the used
* token buffers for saving the relocation information
*/
-struct tokbufdesc *tok_free; /* free pool */
-struct tokbufdesc *tok_temp; /* temporary for doing list manipulation */
+extern struct tokbufdesc *tok_free; /* free pool */
+extern struct tokbufdesc *tok_temp; /* temporary for doing list manipulation */
/*
* Other token buffer managers
*/
-int bufno; /*which buffer number: 0,1 for tmp file*/
-struct tokbufdesc tokbuf[2]; /*our initial increment of buffers*/
-ptrall tokptr; /*where the current token comes from*/
-ptrall tokub; /*the last token in the current token buffer*/
+extern int bufno; /*which buffer number: 0,1 for tmp file*/
+extern struct tokbufdesc tokbuf[2]; /*our initial increment of buffers*/
+extern ptrall tokptr; /*where the current token comes from*/
+extern ptrall tokub; /*the last token in the current token buffer*/
/*
* as does not use fread and fwrite for the token buffering.
* The token buffers are integrals of BUFSIZ
#define bskiplg(from, length) \
*(lgtype *)from = length; \
- (bytetoktype *)from += sizeof(lgtype) + length
+ *(bytetoktype **)&from += sizeof(lgtype) + length
#define bskipfromto(from, to) \
*(lgtype *)from = (bytetoktype *)to - (bytetoktype *)from - sizeof(lgtype); \
- (bytetoktype *)from += sizeof (lgtype) + (bytetoktype *)to - (bytetoktype *)from
+ *(bytetoktype **)&from += sizeof (lgtype) + (bytetoktype *)to - (bytetoktype *)from
#define eatskiplg(from) \
- (bytetoktype *)from += sizeof(lgtype) + *(lgtype *)from
+ *(bytetoktype **)&from += sizeof(lgtype) + *(lgtype *)from
#ifdef DEBUG
- ptrall firsttoken;
+extern ptrall firsttoken;
#endif DEBUG
/*
* They are the semantic values associated with a particular token.
* The token itself is the return value from yylex()
*/
-int yylval; /* normal semantic value */
-Bignum yybignum; /* a big number */
-struct Opcode yyopcode; /* a structure opcode */
+extern int yylval; /* normal semantic value */
+extern Bignum yybignum; /* a big number */
+extern struct Opcode yyopcode; /* a structure opcode */
-int newfflag;
-char *newfname;
-int scanlineno; /*the scanner's linenumber*/
+extern int newfflag;
+extern char *newfname;
+extern int scanlineno; /*the scanner's linenumber*/
/*
* Definitions for sets of characters
*/
-readonly short charsets[];
-readonly short type[];
+extern readonly short charsets[];
+extern readonly short type[];
int number, size;
{
register char *newstuff;
- char *sbrk();
+ void *sbrk();
newstuff = sbrk(number*size);
- if ((int)newstuff == -1){
+ if (newstuff == (char *)-1){
yyerror("Ran out of Memory");
delexit();
}
length = length;
#endif length
newstuff = Calloc(number, size);
+#ifdef __STDC__ /* this is a bit non-ideal, revisit later */
+ bzero(newstuff, length);
+#else
asm("movc5 $0, (r0), $0, r10, (r11)");
+#endif
return(newstuff);
}
switch(CONV(number.num_tag, convto)){
+#ifdef __STDC__ /* this is not ideal, revisit later */
+ case CONV(TYPF, TYPD): *(double *)bp = *(float *)bp; break;
+#else
case CONV(TYPF, TYPD): asm("cvtfd (r11), (r11)"); break;
+#endif
case CONV(TYPF, TYPG): mixs++; break;
case CONV(TYPF, TYPH): mixs++; break;
+#ifdef __STDC__ /* this is not ideal, revisit later */
+ case CONV(TYPD, TYPF): *(float *)bp = *(double *)bp; break;
+#else
case CONV(TYPD, TYPF): asm("cvtdf (r11), (r11)"); break;
+#endif
case CONV(TYPD, TYPG): mixs++; break;
case CONV(TYPD, TYPH): mixs++; break;
--- /dev/null
+as.h assert.h
+as.h instrs.h
+ascode.c vax/mtpr.h
+asexpr.c sys/inode.h
+asexpr.c sys/ioctl.h
+asexpr.c vax/reg.h
+asexpr.h arpa/ftp.h
+asexpr.h arpa/tftp.h
+asparse.c arpa/ftp.h
+asparse.c arpa/tftp.h
+asparse.c sys/inode.h
+asscan.h instrs.h
+asscan2.c vax/reg.h
+asscan3.c sys/ioctl.h
+asscan3.c vax/reg.h
+astoks.h sys/inode.h
+astoks.h sys/ioctl.h
+astoks.h vax/reg.h
+bignum1.c assert.h
+bignum2.c assert.h
+instrs.h vax/mtpr.h
+natof.c assert.h
--- /dev/null
+ascode.c as.h
+asexpr.c asexpr.h
+asio.c as.h
+asjxxx.c as.h
+asmain.c as.h
+asparse.c asexpr.h
+aspseudo.c as.h
+asscan1.c asscan.h
+asscan2.c asscan.h
+asscan3.c asscan.h
+asscan4.c asscan.h
+assizetab.c as.h
+assyms.c as.h
+bignum1.c asnumber.h
+bignum2.c asnumber.h
+floattab.c as.h
+natof.c asnumber.h
-#ifndef ____AS_INSTRS_H_
-#define ____AS_INSTRS_H_
-
-#include <sys/types.h>
-#include <vax/mtpr.h>
-
/*
* Copyright (c) 1982 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
#define NEW 1
#define ESCD 0xfd
#define ESCF 0xff
-
-#endif
--- /dev/null
+s/@/ATSIGN/g
+s/^/@/
+s/$/@/
+s/[^A-Za-z0-9_]\+/@&@/g
+
+s/@movestr@/@memcpy@/g
+s/@readonly@[ ]*/@/g
+s/@reg@/@register@/g
+s/@register@[ ]*@ptrall@/@ptrall@/g
+s/@ptrall@/@void *CHECKME@/g
+s/@shift@;/val = yylex()@;/g
+
+s/@//g
+s/ATSIGN/@/g
+
+s/\[\]CHECKME\([ ]*[A-Za-z_][0-9A-Za-z_]*\)\([ ]*;\)/\1[]\2/g
+s/\*CHECKME\([ ]*\)\([A-Za-z_][0-9A-Za-z_]*[ ]*;\)/\1*\2/g
+s/CHECKME[ ]*)/)/g
+s/CHECKME[ ]*$//g
+
+# specific to this file because I'm lazy and don't want a 2 step process:
+s/\*CHECKME from, to;/ *from, *to;/
put_string(stdout, cur_file_name());
put_string(stdout, " */\n");
}
+ /*extern int yydebug; yydebug = 1;*/
+ extern int yy_flex_debug; yy_flex_debug = 0;
if (yyparse())
fprintf(stderr, "warning: yyparse() aborted\n");
free_symbol_table(define_names);
#if OPT_LINTLIBRARY
if (!in_cpp)
copy_typedef(yytext);
-#endif
+#endif
+#ifdef NICK
+ for (int i = 0; yytext[i]; ++i) {
+ if (yytext[i] == '\n')
+ fprintf(stderr, "@%s:%d", cur_file->file_name, cur_file->line_num);
+ fputc(yytext[i], stderr);
+ }
+#endif
if (cur_file->convert) {
fputs(yytext, cur_file->tmp_file);
}
(void)strcpy(yylval.text.text, yytext);
#if OPT_LINTLIBRARY
copy_typedef(yytext);
+#endif
+#ifdef NICK
+ for (int i = 0; yytext[i]; ++i) {
+ if (yytext[i] == '\n')
+ fprintf(stderr, "@%s:%d", cur_file->file_name, cur_file->line_num);
+ fputc(yytext[i], stderr);
+ }
#endif
if (cur_file->convert) {
yylval.text.begin = ftell(cur_file->tmp_file);
# if OPT_LINTLIBRARY
if (!in_cpp)
copy_typedef(temp);
-# endif
+# endif
+#ifdef NICK
+ for (int i = 0; temp[i]; ++i) {
+ if (temp[i] == '\n')
+ fprintf(stderr, "@%s:%d", cur_file->file_name, cur_file->line_num);
+ fputc(temp[i], stderr);
+ }
+#endif
if (cur_file->convert) {
fputs(temp, cur_file->tmp_file);
}
#endif
while ((c = input()) != 0) {
+#ifdef NICK
+ if (c == '\n')
+ fprintf(stderr, "@%s:%d", cur_file->file_name, cur_file->line_num);
+ fputc(c, stderr);
+#endif
if (cur_file->convert)
fputc(c, cur_file->tmp_file);
*dest = '\0';
while ((c = input()) != 0) {
+#ifdef NICK
+ if (c == '\n')
+ fprintf(stderr, "@%s:%d", cur_file->file_name, cur_file->line_num);
+ fputc(c, stderr);
+#endif
if (cur_file->convert)
fputc(c, cur_file->tmp_file);
FILE *fdopen __P((int fd, register char *mode));
/* stdio/fgetc.c */
-/*int fgetc __P((FILE *fp));*/
+int fgetc __P((FILE *fp));
/* stdio/fgets.c */
char *fgets __P((char *s, int n, register FILE *iop));
int fprintf __P((register FILE *iop, char *fmt, ...));
/* stdio/fputc.c */
-/*int fputc __P((int c, register FILE *fp));*/
+int fputc __P((int c, register FILE *fp));
/* stdio/fputs.c */
int fputs __P((register char *s, register FILE *iop));
ROOT=../..
ROOT=`cd $ROOT && pwd`
INCLUDE=$ROOT/cross/usr/include
+SCRIPTS=$ROOT/scripts
#all_c=`echo *.c`
#if test "$all_c" = "*.c"
git checkout $ROOT/include $ROOT/sys $all_c
rm -rf $INCLUDE/g
mkdir -p $INCLUDE/g
- (cd $ROOT/include && ../scripts/make.sh SHARED=copies install)
+ (cd $ROOT/include && $SCRIPTS/make.sh SHARED=copies install)
fi
fi
all_c_protos_nocomm=
for i in $all_c
do
- $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+ $SCRIPTS/nocomment <$i |$SCRIPTS/nostring >$i.nocomm
all_c_nocomm="$all_c_nocomm $i.nocomm"
if test -f $i.protos
then
- $ROOT/scripts/nocomment <$i.protos |$ROOT/scripts/nostring >$i.protos.nocomm
+ $SCRIPTS/nocomment <$i.protos |$SCRIPTS/nostring >$i.protos.nocomm
all_c_protos_nocomm="$all_c_protos_nocomm $i.protos.nocomm"
fi
done
all_h_protos_nocomm=
for i in $all_h
do
- $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+ $SCRIPTS/nocomment <$i |$SCRIPTS/nostring >$i.nocomm
all_h_nocomm="$all_h_nocomm $i.nocomm"
if test -f $i.protos
then
- $ROOT/scripts/nocomment <$i.protos |$ROOT/scripts/nostring >$i.protos.nocomm
+ $SCRIPTS/nocomment <$i.protos |$SCRIPTS/nostring >$i.protos.nocomm
all_h_protos_nocomm="$all_h_protos_nocomm $i.protos.nocomm"
fi
done
for i in $std_h
do
- $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+ $SCRIPTS/nocomment <$i |$SCRIPTS/nostring >$i.nocomm
done
if test -f conflicts.txt
echo "i=$i"
rm -f xx*
csplit -b '%05d' -q $i '/^#/' '{*}'
- if test -f xx00001 && ! $ROOT/scripts/nocomment <xx00000 |grep -q '[^ ]'
+ if test -f xx00001 && ! $SCRIPTS/nocomment <xx00000 |grep -q '[^ ]'
then
for j in xx*
do
echo "j=$j"
define="`sed -ne 's/^#[ ]*ifndef[ ]\+\([A-Za-z_][0-9A-Za-z_]*\).*/\1/p' xx00001`"
echo "define=$define"
- if test -n "$define" && grep -q '^#[ ]*endif$' $j && ! grep -v "^#" $j |$ROOT/scripts/nocomment |grep -q '[^ ]'
+ if test -n "$define" && grep -q '^#[ ]*endif$' $j && ! grep -v "^#" $j |$SCRIPTS/nocomment |grep -q '[^ ]'
then
sed -e "s/^#[ ]*ifndef[ ]\\+$define/\\/\\*&\\*\\//" -i xx00001
sed -e "s/^\\(#[ ]*define[ ]\\+$define\\)[ ]*$/\\/\\*\1\\*\\//" -i xx00002
for j in xx*
do
sed -e 's/^#[ ]*include[ ]*\(<[^>]*>\|"[^"]*"\)/\/\*&\*\//' -i $j
- if grep -v "^#[ ]*include[^0-9A-Za-z_]" $j |sed -e '/^#[ ]*if.*SCCS\|lint/,/^#[ ]*endif/s/.*//' |$ROOT/scripts/nocomment |grep -q '[^ ]'
+ if grep -v "^#[ ]*include[^0-9A-Za-z_]" $j |sed -e '/^#[ ]*if.*SCCS\|lint/,/^#[ ]*endif/s/.*//' |$SCRIPTS/nocomment |grep -q '[^ ]'
then
break
fi
echo
fi
sed -e 's/\([^0-9A-Za-z_]\)va_start(argp);/\1_va_start(argp, fmt);/' $i
- ) |$ROOT/scripts/newline >b
+ ) |$SCRIPTS/newline >b
mv b $i
done
#endif
EOF
- ) |$ROOT/scripts/newline >b
+ ) |$SCRIPTS/newline >b
mv b $i
done
fi
# checking header loops
if test -n "$all_h"
then
+ #grep -H '^#include \(<[^>]*>\|"[^"]*"\)' $all_h |\
+ #sed -e 's:^\(.*\)\:#include \(<\([^>]*\)>\|"\([^"]*\)"\):\1 \3\4:' |\
+ #tsort >a
grep -H '^#include <[^>]*>' $all_h |\
- sed -e "s:^\(.*\)\:#include <\(.*\)>:\1 \2:" |\
+ sed -e "s:^$INCLUDE/::; s:^\\(.*\\)\\:#include <\\([^>]*\\)>:\1 \2:" |\
tsort >a
fi
echo "pattern=$pattern"
if test -n "$pattern"
then
- #sed -e "s:^#include \\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\)$:/\\*& $h\\*/:" -i `grep -H "^#include \\(<$h>\\|\"$h\"\\)$" $all_c $all_h |sed -e 's/:.*//'`
- sed -e "s:^#include <\\($pattern\\)>$:/\\*& $h\\*/:" -i `grep -H "^#include <$h>$" $all_c $all_h |sed -e 's/:.*//'`
+ grep -H "^#include \\(<$h>\\|\"$h\"\\)$" $all_c $all_h >b
+ if test -s b
+ then
+ #sed -e "s:^#include \\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\)$:/\\*& $h\\*/:" -i `sed -e 's/:.*//' b`
+ sed -e "s:^#include <\\($pattern\\)>$:/\\*& $h\\*/:" -i `sed -e 's/:.*//' b`
+ fi
fi
done
rm -f $INCLUDE/g/stdarg.h temp.c
#
# Machine dependent routines for the VAX are located here
#
-COMPAT= compat-4.1
+COMPAT= compat-4.1 compat-sys5
ALL= gen net stdio sys ${COMPAT}
TAGSFILE=tags
--- /dev/null
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ * @(#)DEFS.h 5.1 (Berkeley) 5/30/85
+ */
+
+#ifdef PROF
+#define ENTRY(x) .globl _/**/x; .align 2; _/**/x: .word 0; \
+ .data; 1:; .long 0; .text; moval 1b,r0; jsb mcount
+#define ASENTRY(x) .globl x; .align 2; x: .word 0; \
+ .data; 1:; .long 0; .text; moval 1b,r0; jsb mcount
+#else
+#define ENTRY(x) .globl _/**/x; .align 2; _/**/x: .word 0
+#define ASENTRY(x) .globl x; .align 2; x: .word 0
+#endif
--- /dev/null
+LD=ld
+#
+# Copyright (c) 1980 Regents of the University of California.
+# All rights reserved. The Berkeley software License Agreement
+# specifies the terms and conditions for redistribution.
+#
+# @(#)Makefile 5.5 (Berkeley) 9/6/85
+#
+SRCS= memcmp.s memcpy.s memset.s
+OBJS= memcmp.o memcpy.o memset.o
+CFLAGS= ${DEFS}
+TAGSFILE=tags
+
+.c.o:
+ /lib/cpp -E ${CFLAGS} -DPROF $*.c | ${AS} -o $*.o
+ -${LD} -X -r $*.o
+ mv a.out profiled/$*.o
+ /lib/cpp -E ${CFLAGS} $*.c | ${AS} -o $*.o
+ -${LD} -x -r $*.o
+ mv a.out $*.o
+
+compat-sys5lib compat-sys5lib_p: ${OBJS}
+ @echo "building profiled compat-sys5"
+ @cd profiled; ar cru ../compat-sys5lib_p ${OBJS}
+ @echo "building normal compat-sys5"
+ @ar cru compat-sys5lib ${OBJS}
+
+tags:
+
+clean:
+ rm -f *.o profiled/*.o errs a.out core \
+ compat-sys5lib compat-sys5lib_p tags
+
+depend:
+ for i in ${SRCS}; do \
+ ${CC} -M ${CFLAGS} $$i | awk ' { if ($$1 != prev) \
+ { if (rec != "") print rec; rec = $$0; prev = $$1; } \
+ else { if (length(rec $$2) > 78) { print rec; rec = $$0; } \
+ else rec = rec " " $$2 } } \
+ END { print rec } ' >> makedep; done
+ echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
+ echo '$$r makedep' >>eddep
+ echo 'w' >>eddep
+ cp Makefile Makefile.bak
+ ed - Makefile < eddep
+ rm eddep makedep
+ echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile
+ echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile
+ echo '# see make depend above' >> Makefile
+
+# DO NOT DELETE THIS LINE -- make depend uses it
+
--- /dev/null
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifdef LIBC_SCCS
+ .asciz "@(#)memcmp.s 5.3 (Berkeley) 3/9/86"
+#endif LIBC_SCCS
+
+/* memcmp(s1, s2, n) */
+
+#include "DEFS.h"
+
+ENTRY(memcmp, 0)
+ movl 4(ap),r1
+ movl 8(ap),r3
+ movl 12(ap),r4
+1:
+ movzwl $65535,r0
+ cmpl r4,r0
+ jleq 3f
+ subl2 r0,r4
+ cmpc3 r0,(r1),(r3)
+ jeql 1b
+2:
+ subb3 (r1),(r3),r0 # r0 = *s1 - *s2
+ cvtbl r0,r0
+ ret
+3:
+ cmpc3 r4,(r1),(r3)
+ jneq 2b
+ ret
--- /dev/null
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifdef LIBC_SCCS
+ .asciz "@(#)memcpy.s 5.3 (Berkeley) 3/9/86"
+#endif LIBC_SCCS
+
+/* memcpy(to, from, size) */
+
+#include "DEFS.h"
+
+ENTRY(memcpy, R6)
+ movl 4(ap),r3
+ movl 8(ap),r1
+ movl 12(ap),r6
+ jbr 2f
+1:
+ subl2 r0,r6
+ movc3 r0,(r1),(r3)
+2:
+ movzwl $65535,r0
+ cmpl r6,r0
+ jgtr 1b
+ movc3 r6,(r1),(r3)
+ ret
--- /dev/null
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifdef LIBC_SCCS
+ .asciz "@(#)memset.s 5.3 (Berkeley) 3/9/86"
+#endif LIBC_SCCS
+
+/* memset(base, fill, length) */
+
+#include "DEFS.h"
+
+ENTRY(memset, 0)
+ movl 4(ap),r3
+ jbr 2f
+1:
+ subl2 r0,12(ap)
+ movc5 $0,(r3),8(ap),r0,(r3)
+2:
+ movzwl $65535,r0
+ cmpl 12(ap),r0
+ jgtr 1b
+ movc5 $0,(r3),8(ap),12(ap),(r3)
+ ret
#ROOT=../..
ROOT=`cd $ROOT && pwd`
INCLUDE=$ROOT/cross/usr/include
+SCRIPTS=$ROOT/scripts
all_c=`echo *.c`
if test "$all_c" = "*.c"
#git checkout $ROOT/include $ROOT/sys $all_c
#rm -rf $INCLUDE
#mkdir -p $INCLUDE
- #(cd $ROOT/include && ../scripts/make.sh SHARED=copies install)
+ #(cd $ROOT/include && $SCRIPTS/make.sh SHARED=copies install)
fi
fi
if test -z "$1" || test $1 -eq 1
then
echo "===stage 1==="
-
+
+ if test -f uniqify.sed
+ then
+ sed -f uniqify.sed -i $all_c $all_h
+ fi
+
for i in $all_c $all_h
do
echo "i=$i"
if test -s a
then
mv a $i.oldprotos
- grep -v "^$group:" $i.oldprotos
+ grep -v "^$group:" $i.oldprotos >&2
fi
fi
done
all_c_protos_nocomm=
for i in $all_c
do
- $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+ $SCRIPTS/nocomment <$i |$SCRIPTS/nostring >$i.nocomm
all_c_nocomm="$all_c_nocomm $i.nocomm"
if test -f $i.protos
then
- $ROOT/scripts/nocomment <$i.protos |$ROOT/scripts/nostring >$i.protos.nocomm
+ $SCRIPTS/nocomment <$i.protos |$SCRIPTS/nostring >$i.protos.nocomm
all_c_protos_nocomm="$all_c_protos_nocomm $i.protos.nocomm"
fi
done
all_h_protos_nocomm=
for i in $all_h
do
- $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+ $SCRIPTS/nocomment <$i |$SCRIPTS/nostring >$i.nocomm
all_h_nocomm="$all_h_nocomm $i.nocomm"
if test -f $i.protos
then
- $ROOT/scripts/nocomment <$i.protos |$ROOT/scripts/nostring >$i.protos.nocomm
+ $SCRIPTS/nocomment <$i.protos |$SCRIPTS/nostring >$i.protos.nocomm
all_h_protos_nocomm="$all_h_protos_nocomm $i.protos.nocomm"
fi
done
for i in $std_h
do
- $ROOT/scripts/nocomment <$i |$ROOT/scripts/nostring >$i.nocomm
+ $SCRIPTS/nocomment <$i |$SCRIPTS/nostring >$i.nocomm
done
if test -f conflicts.txt
echo "i=$i"
rm -f xx*
csplit -b '%05d' -q $i '/^#/' '{*}'
- if test -f xx00001 && ! $ROOT/scripts/nocomment <xx00000 |grep -q '[^ ]'
+ if test -f xx00001 && ! $SCRIPTS/nocomment <xx00000 |grep -q '[^ ]'
then
for j in xx*
do
echo "j=$j"
define="`sed -ne 's/^#[ ]*ifndef[ ]\+\([A-Za-z_][0-9A-Za-z_]*\).*/\1/p' xx00001`"
echo "define=$define"
- if test -n "$define" && grep -q '^#[ ]*endif$' $j && ! grep -v "^#" $j |$ROOT/scripts/nocomment |grep -q '[^ ]'
+ if test -n "$define" && grep -q '^#[ ]*endif$' $j && ! grep -v "^#" $j |$SCRIPTS/nocomment |grep -q '[^ ]'
then
sed -e "s/^#[ ]*ifndef[ ]\\+$define/\\/\\*&\\*\\//" -i xx00001
sed -e "s/^\\(#[ ]*define[ ]\\+$define\\)[ ]*$/\\/\\*\1\\*\\//" -i xx00002
for j in xx*
do
sed -e 's/^#[ ]*include[ ]*\(<[^>]*>\|"[^"]*"\)/\/\*&\*\//' -i $j
- if grep -v "^#[ ]*include[^0-9A-Za-z_]" $j |sed -e '/^#[ ]*if.*SCCS\|lint/,/^#[ ]*endif/s/.*//' |$ROOT/scripts/nocomment |grep -q '[^ ]'
+ if grep -v "^#[ ]*include[^0-9A-Za-z_]" $j |sed -e '/^#[ ]*if.*SCCS\|lint/,/^#[ ]*endif/s/.*//' |$SCRIPTS/nocomment |grep -q '[^ ]'
then
break
fi
echo
fi
sed -e 's/\([^0-9A-Za-z_]\)va_start(argp);/\1_va_start(argp, fmt);/' $i
- ) |$ROOT/scripts/newline >b
+ ) |$SCRIPTS/newline >b
mv b $i
done
#endif
EOF
- ) |$ROOT/scripts/newline >b
+ ) |$SCRIPTS/newline >b
mv b $i
done
fi
# checking header loops
if test -n "$all_h"
then
- grep -H '^#include <[^>]*>' $all_h |\
- sed -e "s:^\(.*\)\:#include <\(.*\)>:\1 \2:" |\
+ grep -H '^#include \(<[^>]*>\|"[^"]*"\)' $all_h |\
+ sed -e 's:^\(.*\)\:#include \(<\([^>]*\)>\|"\([^"]*\)"\):\1 \3\4:' |\
tsort >a
+ #grep -H '^#include <[^>]*>' $all_h |\
+ #sed -e "s:^$INCLUDE/::; s:^\\(.*\\)\\:#include <\\([^>]*\\)>:\1 \2:" |\
+ #tsort >a
fi
# removing useless extra header inclusions that are pulled in anyway
echo "pattern=$pattern"
if test -n "$pattern"
then
- sed -e "s:^#include \\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\)$:/\\*& $h\\*/:" -i `grep -H "^#include \\(<$h>\\|\"$h\"\\)$" $all_c $all_h |sed -e 's/:.*//'`
- #sed -e "s:^#include <\\($pattern\\)>$:/\\*& $h\\*/:" -i `grep -H "^#include <$h>$" $all_c $all_h |sed -e 's/:.*//'`
+ grep -H "^#include \\(<$h>\\|\"$h\"\\)$" $all_c $all_h >b
+ if test -s b
+ then
+ sed -e "s:^#include \\(<\\($pattern\\)>\\|\"\\($pattern\\)\"\\)$:/\\*& $h\\*/:" -i `sed -e 's/:.*//' b`
+ #sed -e "s:^#include <\\($pattern\\)>$:/\\*& $h\\*/:" -i `sed -e 's/:.*//' b`
+ fi
fi
done
rm -f $INCLUDE/stdarg.h temp.c
#endif
EOF
- "`dirname "$0"`/xifyfilt" <$1 2>$3 |sed -e 's/\(extern\|register\|static\) x_int\([ ]\+x_\)\(Bignum\|bool\|caddr_t\|datum\|off_t\|time_t\|u_char\|u_int\|u_short\|u_long\)/\1\2\3/g; s/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'
+ "`dirname "$0"`/xifyfilt" <$1 2>$3 |sed -e 's/\(extern\|register\|static\) x_int\([ ]\+x_\)\(Bignum\|Iptr\|bytetoktype\|bool\|caddr_t\|chptr\|datum\|inttoktype\|lgtype\|off_t\|time_t\|u_char\|u_int\|u_short\|u_long\)/\1\2\3/g; s/va_arg(x_argp, x_\(unsigned_\)\?\(short\|int\|long\))/_va_arg_\1\2(x_argp)/g'
) >$2