From 28219de3253bd08a3e81e2706d21a5563523d0aa Mon Sep 17 00:00:00 2001 From: "Robert R. Henry" Date: Fri, 1 Jul 1983 02:20:22 -0800 Subject: [PATCH] bye bye fixed names (eg, FLEXNAMES is not set) SCCS-vsn: old/as.vax/asmain.c 4.13 SCCS-vsn: old/as.vax/asparse.c 4.16 SCCS-vsn: old/as.vax/assyms.c 4.12 SCCS-vsn: old/as.vax/as.h 4.17 SCCS-vsn: old/as.vax/asscan2.c 4.11 --- usr/src/old/as.vax/as.h | 39 +++++----------------- usr/src/old/as.vax/asmain.c | 7 ++-- usr/src/old/as.vax/asparse.c | 63 ++---------------------------------- usr/src/old/as.vax/asscan2.c | 14 +++----- usr/src/old/as.vax/assyms.c | 58 ++------------------------------- 5 files changed, 21 insertions(+), 160 deletions(-) diff --git a/usr/src/old/as.vax/as.h b/usr/src/old/as.vax/as.h index b2e8a2d0ed..1d3a2fa60b 100644 --- a/usr/src/old/as.vax/as.h +++ b/usr/src/old/as.vax/as.h @@ -1,18 +1,12 @@ /* * Copyright (c) 1982 Regents of the University of California - * @(#)as.h 4.16 %G% + * @(#)as.h 4.17 %G% */ #define reg register #include -#ifdef FLEXNAMES -# include -# include -#else not FLEXNAMES -# define ONLIST -# include "a.out.h" -# include -#endif FLEXNAMES +#include +#include #define readonly #define NINST 300 @@ -28,7 +22,7 @@ * * source file reads ASINBUFSIZ integral of BUFSIZ * string assembly NCPString large for .stabs - * name assembly NCPName depends on FLEXNAMES + * name assembly NCPName * string save STRPOOLDALLOP * * @@ -46,17 +40,10 @@ #endif not NCPString #define NCPName NCPS -# ifndef FLEXNAMES -# ifndef NCPS -# undef NCPName -# define NCPName 8 -# endif not NCPS -# else FLEXNAMES -# ifndef NCPS -# undef NCPName -# define NCPName 4096 -# endif not NCPS -# endif FLEXNAMES +#ifndef NCPS +# undef NCPName +# define NCPName 4096 +#endif not NCPS /* * Check sizes, and compiler error if sizes botch */ @@ -219,18 +206,12 @@ struct symtab{ * one saves typing, and so that they conform * with the old naming conventions. */ -#ifdef FLEXNAMES #define s_name s_nm.n_un.n_name #define i_name s_name #define FETCHNAME(sp) (((struct strdesc *)(sp)->s_name)->sd_string) #define STRLEN(sp) (((struct strdesc *)(sp)->s_name)->sd_strlen) #define STROFF(sp) (((struct strdesc *)(sp)->s_name)->sd_stroff) #define s_nmx s_nm.n_un.n_strx /* string table index */ -#else not FLEXNAMES -#define s_name s_nm.n_name -#define i_name s_name -#define FETCHNAME(sp) ((sp)->s_name) -#endif #define s_type s_nm.n_type /* type of the symbol */ #define s_other s_nm.n_other /* other information for sdb */ #define s_desc s_nm.n_desc /* type descriptor */ @@ -300,11 +281,7 @@ struct Opcode{ #define ITABFETCH(o) itab[o.Op_eopcode][o.Op_popcode] struct Instab{ -#ifdef FLEXNAMES char *I_name; -#else not FLEXNAMES - char I_name[NCPName]; -#endif u_char I_popcode; /* basic op code */ char I_nargs; char I_args[6]; diff --git a/usr/src/old/as.vax/asmain.c b/usr/src/old/as.vax/asmain.c index c4b281e5f8..53f692e399 100644 --- a/usr/src/old/as.vax/asmain.c +++ b/usr/src/old/as.vax/asmain.c @@ -2,7 +2,7 @@ * Copyright (c) 1982 Regents of the University of California */ #ifndef lint -static char sccsid[] = "@(#)asmain.c 4.12 %G%"; +static char sccsid[] = "@(#)asmain.c 4.13 %G%"; #endif not lint #include @@ -14,7 +14,7 @@ static char sccsid[] = "@(#)asmain.c 4.12 %G%"; #include "asscan.h" #include "asexpr.h" -#define unix_lang_name "VAX/UNIX Assembler V%G% 4.12" +#define unix_lang_name "VAX/UNIX Assembler V%G% 4.13" /* * variables to manage reading the assembly source files */ @@ -631,8 +631,7 @@ reloc_syms() hdr.a_drsize = 0; } /* - * Output the symbol table - * and if FLEXNAMES is set, the string pool + * Output the symbol table and the string pool * * We must first rewind the string pool file to its beginning, * in case it was seek'ed into for fetching ascii and asciz diff --git a/usr/src/old/as.vax/asparse.c b/usr/src/old/as.vax/asparse.c index b61c55b59b..a9d57ef8b9 100644 --- a/usr/src/old/as.vax/asparse.c +++ b/usr/src/old/as.vax/asparse.c @@ -2,7 +2,7 @@ * Copyright (c) 1982 Regents of the University of California */ #ifndef lint -static char sccsid[] = "@(#)asparse.c 4.15 %G%"; +static char sccsid[] = "@(#)asparse.c 4.16 %G%"; #endif not lint #include @@ -131,12 +131,7 @@ yyparse() np = (struct symtab *)yylval; shiftover(NAME); if (val != COLON) { -#ifdef FLEXNAMES yyerror("\"%s\" is not followed by a ':' for a label definition", -#else not FLEXNAMES - yyerror("\"%.*s\" is not followed by a ':' for a label definition", - NCPName, -#endif not FLEXNAMES FETCHNAME(np)); goto errorfix; } @@ -155,20 +150,10 @@ restlab: #endif not DEBUG { if (passno == 1) -#ifdef FLEXNAMES yyerror("%s redefined", -#else not FLEXNAMES - yyerror("%.*s redefined", - NCPName, -#endif not FLEXNAMES FETCHNAME(np)); else -#ifdef FLEXNAMES yyerror("%s redefined: PHASE ERROR, 1st: %d, 2nd: %d", -#else not FLEXNAMES - yyerror("%.*s redefined: PHASE ERROR, 1st: %d, 2nd: %d", - NCPName, -#endif not FLEXNAMES FETCHNAME(np), np->s_value, dotp->e_xvalue); @@ -257,11 +242,7 @@ restlab: */ if (passno == 1){ stpt = (struct symtab *)symalloc(); -#ifdef FLEXNAMES stpt->s_name = np->s_name; -#else - movestr(FETCHNAME(stpt), FETCHNAME(np), NCPName); -#endif np->s_tag = OBSOLETE; /*invalidate original */ nforgotten++; np = stpt; @@ -538,30 +519,8 @@ restlab: * .stabd , , # . */ case ISTAB: -#ifndef FLEXNAMES - stabname = ".stab"; - if (passno == 2) goto errorfix; - stpt = (struct symtab *)yylval; - /* - * Make a pointer to the .stab slot. - * There is a pointer in the way (stpt), and - * tokptr points to the next token. - */ - stabstart = tokptr; - (char *)stabstart -= sizeof(struct symtab *); - (char *)stabstart -= sizeof(bytetoktype); - shift; - for (argcnt = 0; argcnt < NCPName; argcnt++){ - expr(locxp, val); - FETCHNAME(stpt)[argcnt] = locxp->e_xvalue; - xp = explist; - shiftover(CM); - } - goto tailstab; -#else FLEXNAMES - yyerror(".stab directive not supported in; report this compiler bug to system administrator"); + yyerror(".stab directive no longer supported"); goto errorfix; -#endif FLEXNAMES tailstab: expr(locxp, val); @@ -698,10 +657,6 @@ restlab: if (auxval == ISTABSTR){ stringp = (struct strdesc *)yylval; shiftover(STRING); -#ifndef FLEXNAMES - movestr(FETCHNAME(stpt), stringp, - min(stringp->sd_strlen, NCPName)); -#else stpt->s_name = (char *)stringp; /* * We want the trailing null included in this string. @@ -709,20 +664,14 @@ restlab: * and merely increment the string length */ stringp->sd_strlen += 1; -#endif shiftover(CM); } else { -#ifndef FLEXNAMES - static char nullstr[NCPName]; - movestr(FETCHNAME(stpt), nullstr, NCPName); -#else static char nullstr[1]; static struct strdesc strdp; strdp.sd_stroff = strfilepos; strdp.sd_strlen = 0; strdp.sd_place = STR_BOTH; stpt->s_name = (char *)savestr(nullstr, &strdp); -#endif } goto tailstab; break; @@ -739,13 +688,7 @@ restlab: if ( (locxp->e_xtype & XTYPE) != XABS) /* tekmdp */ yyerror("comm size not absolute"); if (passno == 1 && (np->s_type&XTYPE) != XUNDEF) -#ifdef FLEXNAMES - yyerror("Redefinition of %s", -#else not FLEXNAMES - yyerror("Redefinition of %.*s", - NCPName, -#endif not FLEXNAMES - FETCHNAME(np)); + yyerror("Redefinition of %s", FETCHNAME(np)); if (passno==1) { np->s_value = locxp->e_xvalue; if (auxval == ICOMM) diff --git a/usr/src/old/as.vax/asscan2.c b/usr/src/old/as.vax/asscan2.c index 3ad6369231..a6a3386a6c 100644 --- a/usr/src/old/as.vax/asscan2.c +++ b/usr/src/old/as.vax/asscan2.c @@ -2,7 +2,7 @@ * Copyright (c) 1982 Regents of the University of California */ #ifndef lint -static char sccsid[] = "@(#)asscan2.c 4.10 %G%"; +static char sccsid[] = "@(#)asscan2.c 4.11 %G%"; #endif not lint #include "asscanl.h" @@ -47,15 +47,11 @@ fillinbuffer() Ginbufptr = inbuffer + 1; } -#ifndef FLEXNAMES +#if NCPName < NCPString char strtext[NCPString + 1]; -#else FLEXNAMES -# if NCPName < NCPString -char strtext[NCPString + 1]; -# else -#define strtext yytext -# endif -#endif FLEXNAMES +#else +# define strtext yytext +#endif scan_dot_s(bufferbox) struct tokbufdesc *bufferbox; diff --git a/usr/src/old/as.vax/assyms.c b/usr/src/old/as.vax/assyms.c index 5c18d8d87d..b4db31907b 100644 --- a/usr/src/old/as.vax/assyms.c +++ b/usr/src/old/as.vax/assyms.c @@ -2,7 +2,7 @@ * Copyright (c) 1982 Regents of the University of California */ #ifndef lint -static char sccsid[] = "@(#)assyms.c 4.11 %G%"; +static char sccsid[] = "@(#)assyms.c 4.12 %G%"; #endif not lint #include @@ -318,17 +318,10 @@ dumpsymtab() for (segno = 0; segno < NLOC + NLOC; segno++){ printf("Segment number: %d\n", segno); SEGITERATE(segno, 0, 0, cosp, sp, ub, ++){ -#ifdef FLEXNAMES printf("\tSeg: %d \"%s\" value: %d index: %d tag %s\n", segno, FETCHNAME(sp), sp->s_value, sp->s_index, tagstring(sp->s_tag)); -#else not FLEXNAMES - printf("\tSeg: %d \"%*.*s\" value: %d index: %d tag %s\n", - segno, NCPName, NCPName, FETCHNAME(sp), - sp->s_value, sp->s_index, - tagstring(sp->s_tag)); -#endif not FLEXNAMES printf("\t\ttype: %d jxbump %d jxfear: %d\n", sp->s_type, sp->s_jxbump, sp->s_jxfear); } @@ -424,23 +417,12 @@ struct symtab **lookup(instflg) { from = yytext; to = FETCHNAME(*hp); -#ifndef FLEXNAMES - for (len = 0; (len= NCPName) /*both are maximal length*/ - return(hp); - if (*to == 0) /*assert *from == 0*/ - return(hp); -#else FLEXNAMES while (*from && *to) if (*from++ != *to++) goto nextprobe; if (*to == *from) /*assert both are == 0*/ return(hp); -#endif FLEXNAMES - - nextprobe: ; + nextprobe: ; } if (*hp == 0 && emptyslot == 0 && hdallop->h_nused < HASHCLOGGED) { @@ -459,9 +441,6 @@ struct symtab **lookup(instflg) if (instflg) { *hp = symalloc(); hdallop->h_nused++; -#ifndef FLEXNAMES - strncpy(FETCHNAME(*hp), yytext, NCPName); -#else FLEXNAMES for (from = yytext, len = 0; *from++; len++) continue; /* @@ -475,7 +454,6 @@ struct symtab **lookup(instflg) putc(0, strfile); /* null */ strfilepos += strdp.sd_strlen; (*hp)->s_name = (char *)savestr(yytext, &strdp); -#endif FLEXNAMES } return(hp); } /*end of lookup*/ @@ -650,35 +628,17 @@ int sizesymtab() { return (sizeof (struct nlist) * NOUTSYMS); } - -#ifdef FLEXNAMES -/* - * We write out the flexible length character strings for names - * in two stages. - * 1) We always! maintain a fixed sized name list entry; - * the string is indexed by a four byte quantity from the beginning - * of the string pool area. Index 0 is reserved, and indicates - * that there is no associated string. The first valid index is 4. - * 2) We concatenate together and write all of the strings - * in the string pool at the end of the name list. The first - * four bytes in the string pool are indexed only by 0 (see above); - * they contain the total number of bytes in the string pool. - */ -#endif FLEXNAMES - /* * Write out n symbols to file f, beginning at p * ignoring symbols that are obsolete, jxxx instructions, and * possibly, labels */ - int symwrite(symfile) BFILE *symfile; { int symsout; /*those actually written*/ int symsdesired = NOUTSYMS; reg struct symtab *sp, *ub; -#ifdef FLEXNAMES char *name; /* temp to save the name */ int nread; char rbuf[2048]; @@ -687,8 +647,6 @@ int symwrite(symfile) * We use sp->s_index to hold the length of the * name; it isn't used for anything else */ -#endif FLEXNAMES - register struct allocbox *allocwalk; symsout = 0; @@ -700,7 +658,6 @@ int symwrite(symfile) continue; symsout++; -#ifdef FLEXNAMES name = sp->s_name; /* save pointer */ /* * the length of the symbol table string @@ -711,22 +668,15 @@ int symwrite(symfile) } else { sp->s_nmx = 0; } -#ifdef DEBUG - printf("symbol %d: nmx == %d\n", symsout, sp->s_nmx); -#endif DEBUG -#endif FLEXNAMES sp->s_type = (sp->s_ptype != 0) ? sp->s_ptype : (sp->s_type & (~XFORW)); if (readonlydata && (sp->s_type&~N_EXT) == N_DATA) sp->s_type = N_TEXT | (sp->s_type & N_EXT); bwrite((char *)&sp->s_nm, sizeof (struct nlist), symfile); -#ifdef FLEXNAMES sp->s_name = name; /* restore pointer */ -#endif FLEXNAMES } if (symsout != symsdesired) yyerror("INTERNAL ERROR: Wrote %d symbols, wanted to write %d symbols\n", symsout, symsdesired); -#ifdef FLEXNAMES /* * Copy the string temporary file to the symbol file, * copying all the strings and symbols we ever saw, @@ -736,13 +686,9 @@ int symwrite(symfile) i = 0; while((nread = read(strfile->_file, rbuf, sizeof(rbuf))) > 0){ if (i == 0){ -#ifdef DEBUG - printf("%d bytes of strings\n", strfilepos); -#endif DEBUG ((int *)rbuf)[0] = strfilepos; } bwrite(rbuf, nread, symfile); i++; } -#endif FLEXNAMES } -- 2.20.1