Annotation of researchv10no/cmd/PDP11/11c/henry, revision 1.1

1.1     ! root        1: From att!zoo.toronto.edu!henry Mon Apr  9 15:34:40 EDT 1990
        !             2: Received: by att-in; Mon Apr  9 15:32:52 1990
        !             3: Received: by inet.att.com; Mon Apr  9 15:34 EDT 1990
        !             4: From: [email protected]
        !             5: Date: Mon, 9 Apr 90 15:34:40 EDT
        !             6: To: research.att.com!dmr
        !             7: Subject: 11 cross-compiler changes for host-byte-order portability
        !             8: 
        !             9: Here's context diffs for the stuff I did, with some irrelevant localisms
        !            10: (location of include files and such) edited out.
        !            11: 
        !            12: One or two things are probably slightly overkill; I haven't made a
        !            13: determined effort to minimize the changes.  I think the result should
        !            14: work regardless of host byte order.
        !            15: 
        !            16: I made one change to semantics after hitting an old problem in our pdp11
        !            17: kernel build:  11ld now does not consider lingering undefined externals to
        !            18: be grounds for returning status 1 when -r is used.  This seemed sensible;
        !            19: -r normally means that another 11ld will be done later, so treating
        !            20: undefined externals as a sign of trouble is inappropriate -- it messes
        !            21: up Makefiles.
        !            22: 
        !            23: I fixed a bug in 11cc.c:  the creation of tmp0 should not be conditional,
        !            24: since the construction of later filenames depends on it.
        !            25: 
        !            26: There is an "#ifndef sun" in c00.c that perhaps should be changed to
        !            27: something like "#ifndef cpp_sometimes_puts_funny_third_field_in_#_lines".
        !            28: 
        !            29: As I mentioned in earlier mail, chkleaf() now fills in the tr2 field to
        !            30: avoid trouble later.
        !            31: 
        !            32: Emission of floating-point constants assumes host and target share a
        !            33: common representation for them, and I have not tried to fix this.
        !            34: 
        !            35: Lingering problems with long constants are possible; the code I'm mostly
        !            36: concerned with does not use them much.
        !            37: 
        !            38:                                     Henry Spencer at U of Toronto Zoology
        !            39:                                 uunet!attcan!utzoo!henry [email protected]
        !            40: 
        !            41: *** /tmp/11ld.c.old    Mon Apr  9 14:34:37 1990
        !            42: --- 11ld.c     Mon Apr  2 16:05:05 1990
        !            43: ***************
        !            44: *** 74,80 ****
        !            45:   char goodnm[] = "__.SYMDEF";
        !            46:   
        !            47:   /* table of contents stuff */
        !            48: ! #define TABSZ        900
        !            49:   struct tab
        !            50:   {    char cname[8];
        !            51:        long cloc;
        !            52: --- 73,79 ----
        !            53:   char goodnm[] = "__.SYMDEF";
        !            54:   
        !            55:   /* table of contents stuff */
        !            56: ! #define TABSZ        2000            /* match 11ranlib */
        !            57:   struct tab
        !            58:   {    char cname[8];
        !            59:        long cloc;
        !            60: ***************
        !            61: *** 119,125 ****
        !            62:   
        !            63:   struct       ar_hdr archdr;
        !            64:   
        !            65: ! struct {
        !            66:        short   fmagic;
        !            67:        ushort tsize;
        !            68:        ushort dsize;
        !            69: --- 118,124 ----
        !            70:   
        !            71:   struct       ar_hdr archdr;
        !            72:   
        !            73: ! struct filhdr_t {
        !            74:        short   fmagic;
        !            75:        ushort tsize;
        !            76:        ushort dsize;
        !            77: ***************
        !            78: *** 145,151 ****
        !            79:   /* symbol management */
        !            80:   struct symbol {
        !            81:        char    sname[8];
        !            82: !      char    stype;
        !            83:        char    spare;
        !            84:        ushort svalue;
        !            85:   };
        !            86: --- 144,150 ----
        !            87:   /* symbol management */
        !            88:   struct symbol {
        !            89:        char    sname[8];
        !            90: !      char    stype;          /* obscene -- should be ushort -- but works */
        !            91:        char    spare;
        !            92:        ushort svalue;
        !            93:   };
        !            94: ***************
        !            95: *** 507,512 ****
        !            96: --- 506,512 ----
        !            97:                }
        !            98:                lseek(infil, (long)(SARMAG+sizeof(archdr)), 0);
        !            99:                read(infil, (char *)tab, tnum * sizeof(struct tab));
        !           100: +              /* ldrand looks after byte-order issues in tab */
        !           101:                while (ldrand())
        !           102:                        ;
        !           103:                libp->loc = -1;
        !           104: ***************
        !           105: *** 545,556 ****
        !           106:        register short i;
        !           107:        register struct symbol *sp;
        !           108:        register struct liblist *oldp = libp;
        !           109:        for(i = 0; i<tnum; i++) {
        !           110:                if ((sp = *slookup(tab[i].cname)) == 0)
        !           111:                        continue;
        !           112:                if (sp->stype != EXTERN+UNDEF)
        !           113:                        continue;
        !           114: !              step(tab[i].cloc >> 1);
        !           115:        }
        !           116:        return(oldp != libp);
        !           117:   }
        !           118: --- 545,566 ----
        !           119:        register short i;
        !           120:        register struct symbol *sp;
        !           121:        register struct liblist *oldp = libp;
        !           122: +      register long cloc;
        !           123: +      register char *cp;
        !           124: + 
        !           125:        for(i = 0; i<tnum; i++) {
        !           126:                if ((sp = *slookup(tab[i].cname)) == 0)
        !           127:                        continue;
        !           128:                if (sp->stype != EXTERN+UNDEF)
        !           129:                        continue;
        !           130: !              cp = (char *)&tab[i].cloc;
        !           131: !              /* strange pdp11 byte order in longs */
        !           132: !              cloc = 0;
        !           133: !              cloc |= (*cp++ & 0377) << 16;
        !           134: !              cloc |= (*cp++ & 0377) << 24;
        !           135: !              cloc |= (*cp++ & 0377);
        !           136: !              cloc |= (*cp++ & 0377) << 8;
        !           137: !              step(cloc >> 1);
        !           138:        }
        !           139:        return(oldp != libp);
        !           140:   }
        !           141: ***************
        !           142: *** 593,598 ****
        !           143: --- 603,609 ----
        !           144:        dseek(&text, loc, filhdr.ssize);
        !           145:        while (text.size > 0) {
        !           146:                mget((short *)&cursym, sizeof cursym);
        !           147: +              usin(&cursym.svalue);
        !           148:                type = cursym.stype;
        !           149:                if (Sflag) {
        !           150:                        mtype = type&037;
        !           151: ***************
        !           152: *** 716,722 ****
        !           153:        nund = 0;
        !           154:        for (sp = symtab; sp<symp; sp++) switch (sp->stype) {
        !           155:        case EXTERN+UNDEF:
        !           156: !              errlev |= 01;
        !           157:                if (arflag==0 && sp->svalue==0) {
        !           158:                        if (nund==0)
        !           159:                                printf("Undefined:\n");
        !           160: --- 727,734 ----
        !           161:        nund = 0;
        !           162:        for (sp = symtab; sp<symp; sp++) switch (sp->stype) {
        !           163:        case EXTERN+UNDEF:
        !           164: !              if (arflag==0)
        !           165: !                      errlev |= 01;
        !           166:                if (arflag==0 && sp->svalue==0) {
        !           167:                        if (nund==0)
        !           168:                                printf("Undefined:\n");
        !           169: ***************
        !           170: *** 771,776 ****
        !           171: --- 783,790 ----
        !           172:   
        !           173:   setupout()
        !           174:   {
        !           175: +      struct filhdr_t fhbuf;
        !           176: + 
        !           177:        tcreat(&toutb, 0);
        !           178:        mktemp(tfname);
        !           179:        tcreat(&doutb, 1);
        !           180: ***************
        !           181: *** 794,800 ****
        !           182:                filhdr.entry=0;
        !           183:        filhdr.pad = 0;
        !           184:        filhdr.relflg = (rflag==0);
        !           185: !      mput(&toutb, (short *)&filhdr, sizeof filhdr);
        !           186:   }
        !           187:   
        !           188:   tcreat(buf, tempflg)
        !           189: --- 808,823 ----
        !           190:                filhdr.entry=0;
        !           191:        filhdr.pad = 0;
        !           192:        filhdr.relflg = (rflag==0);
        !           193: !      fhbuf = filhdr;
        !           194: !      usout(&fhbuf.fmagic);
        !           195: !      usout(&fhbuf.tsize);
        !           196: !      usout(&fhbuf.dsize);
        !           197: !      usout(&fhbuf.bsize);
        !           198: !      usout(&fhbuf.ssize);
        !           199: !      usout(&fhbuf.entry);
        !           200: !      usout(&fhbuf.pad);
        !           201: !      usout(&fhbuf.relflg);
        !           202: !      mput(&toutb, (short *)&fhbuf, sizeof fhbuf);
        !           203:   }
        !           204:   
        !           205:   tcreat(buf, tempflg)
        !           206: ***************
        !           207: *** 861,866 ****
        !           208: --- 884,890 ----
        !           209:        while (text.size > 0) {
        !           210:                symno++;
        !           211:                mget((short *)&cursym, sizeof cursym);
        !           212: +              usin(&cursym.svalue);
        !           213:                symreloc();
        !           214:                type = cursym.stype;
        !           215:                if (Sflag) {
        !           216: ***************
        !           217: *** 868,875 ****
        !           218:                        if (mtype==1 || mtype>4) continue;
        !           219:                }
        !           220:                if ((type&EXTERN) == 0) {
        !           221: !                      if (!sflag&&!xflag&&(!Xflag||cursym.sname[0]!='L'))
        !           222: !                              mput(&soutb, (short *)&cursym, sizeof cursym);
        !           223:                        continue;
        !           224:                }
        !           225:                if ((sp = *lookup()) == 0)
        !           226: --- 892,903 ----
        !           227:                        if (mtype==1 || mtype>4) continue;
        !           228:                }
        !           229:                if ((type&EXTERN) == 0) {
        !           230: !                      if (!sflag&&!xflag&&(!Xflag||cursym.sname[0]!='L')) {
        !           231: !                              struct symbol st;
        !           232: !                              st = cursym;
        !           233: !                              usout(&st.svalue);
        !           234: !                              mput(&soutb, (short *)&st, sizeof st);
        !           235: !                      }
        !           236:                        continue;
        !           237:                }
        !           238:                if ((sp = *lookup()) == 0)
        !           239: ***************
        !           240: *** 904,909 ****
        !           241: --- 932,938 ----
        !           242:   {
        !           243:        register r, t;
        !           244:        register struct symbol *sp;
        !           245: +      short stmp;
        !           246:   
        !           247:        for (;;) {
        !           248:                /*
        !           249: ***************
        !           250: *** 922,927 ****
        !           251: --- 951,957 ----
        !           252:                        t = get(&text);
        !           253:                } else
        !           254:                        t = *text.ptr++;
        !           255: +              stmp = t; usin(&stmp); t = stmp;
        !           256:   
        !           257:                /* next relocation word */
        !           258:                if (--reloc.size <= 0) {
        !           259: ***************
        !           260: *** 935,940 ****
        !           261: --- 965,971 ----
        !           262:                        r = get(&reloc);
        !           263:                } else
        !           264:                        r = *reloc.ptr++;
        !           265: +              stmp = r; usin(&stmp); r = stmp;
        !           266:   
        !           267:                switch (r&016) {
        !           268:   
        !           269: ***************
        !           270: *** 970,976 ****
        !           271:   
        !           272:   finishout()
        !           273:   {
        !           274: !      register short n, *p;
        !           275:   
        !           276:        if (nflag||iflag) {
        !           277:                n = torigin;
        !           278: --- 1001,1008 ----
        !           279:   
        !           280:   finishout()
        !           281:   {
        !           282: !      register short n;
        !           283: !      register struct symbol *sp;
        !           284:   
        !           285:        if (nflag||iflag) {
        !           286:                n = torigin;
        !           287: ***************
        !           288: *** 989,996 ****
        !           289:        if (sflag==0) {
        !           290:                if (xflag==0)
        !           291:                        copy(&soutb);
        !           292: !              for (p = (short *)symtab; p < (short *)&symtab[symindex];)
        !           293: !                      putw(*p++, &toutb);
        !           294:        }
        !           295:        flush(&toutb);
        !           296:        close(toutb.fildes);
        !           297: --- 1021,1032 ----
        !           298:        if (sflag==0) {
        !           299:                if (xflag==0)
        !           300:                        copy(&soutb);
        !           301: !              for (sp = symtab; sp < &symtab[symindex]; sp++) {
        !           302: !                      register ushort u = sp->svalue;
        !           303: !                      usout(&sp->svalue);
        !           304: !                      mput(&toutb, (short *)sp, sizeof(*sp));
        !           305: !                      sp->svalue = u;         /* just in case */
        !           306: !              }
        !           307:        }
        !           308:        flush(&toutb);
        !           309:        close(toutb.fildes);
        !           310: ***************
        !           311: *** 1018,1024 ****
        !           312:                n >>= 1;
        !           313:                p = (short *)doutb.iobuf;
        !           314:                do
        !           315: !                      putw(*p++, &toutb);
        !           316:                while (--n);
        !           317:        }
        !           318:        close(f);
        !           319: --- 1054,1060 ----
        !           320:                n >>= 1;
        !           321:                p = (short *)doutb.iobuf;
        !           322:                do
        !           323: !                      rputw(*p++, &toutb);
        !           324:                while (--n);
        !           325:        }
        !           326:        close(f);
        !           327: ***************
        !           328: *** 1027,1032 ****
        !           329: --- 1063,1069 ----
        !           330:   mkfsym(s)
        !           331:   char *s;
        !           332:   {
        !           333: +      struct symbol st;
        !           334:   
        !           335:        if (sflag || xflag)
        !           336:                return;
        !           337: ***************
        !           338: *** 1033,1039 ****
        !           339:        cp8c(s, cursym.sname);
        !           340:        cursym.stype = 037;
        !           341:        cursym.svalue = torigin;
        !           342: !      mput(&soutb, (short *)&cursym, sizeof cursym);
        !           343:   }
        !           344:   
        !           345:   mget(aloc, an)
        !           346: --- 1070,1078 ----
        !           347:        cp8c(s, cursym.sname);
        !           348:        cursym.stype = 037;
        !           349:        cursym.svalue = torigin;
        !           350: !      st = cursym;
        !           351: !      usout(&st.svalue);
        !           352: !      mput(&soutb, (short *)&st, sizeof st);
        !           353:   }
        !           354:   
        !           355:   mget(aloc, an)
        !           356: ***************
        !           357: *** 1073,1079 ****
        !           358:        loc = aloc;
        !           359:        n = an>>1;
        !           360:        do {
        !           361: !              putw(*loc++, buf);
        !           362:        } 
        !           363:        while (--n);
        !           364:   }
        !           365: --- 1112,1118 ----
        !           366:        loc = aloc;
        !           367:        n = an>>1;
        !           368:        do {
        !           369: !              rputw(*loc++, buf);
        !           370:        } 
        !           371:        while (--n);
        !           372:   }
        !           373: ***************
        !           374: *** 1327,1332 ****
        !           375: --- 1366,1379 ----
        !           376:   
        !           377:        dseek(&text, loc, sizeof filhdr);
        !           378:        mget((short *)&filhdr, sizeof filhdr);
        !           379: +      usin(&filhdr.fmagic);
        !           380: +      usin(&filhdr.tsize);
        !           381: +      usin(&filhdr.dsize);
        !           382: +      usin(&filhdr.bsize);
        !           383: +      usin(&filhdr.ssize);
        !           384: +      usin(&filhdr.entry);
        !           385: +      usin(&filhdr.pad);
        !           386: +      usin(&filhdr.relflg);
        !           387:        if (filhdr.fmagic != FMAGIC)
        !           388:                error(2, "Bad format");
        !           389:        st = (filhdr.tsize+01) & ~01;
        !           390: ***************
        !           391: *** 1363,1368 ****
        !           392: --- 1410,1425 ----
        !           393:   putw(w, b)
        !           394:   register struct buf *b;
        !           395:   {
        !           396: +      *b->xnext = w;
        !           397: +      usout(b->xnext);
        !           398: +      b->xnext++;
        !           399: +      if (--b->nleft <= 0)
        !           400: +              flush(b);
        !           401: + }
        !           402: + 
        !           403: + rputw(w, b)
        !           404: + register struct buf *b;
        !           405: + {
        !           406:        *(b->xnext)++ = w;
        !           407:        if (--b->nleft <= 0)
        !           408:                flush(b);
        !           409: ***************
        !           410: *** 1400,1403 ****
        !           411: --- 1457,1482 ----
        !           412:        while(*p >= '0' && *p <= '9')
        !           413:                n = n*10 + *p++ - '0';
        !           414:        return(n);
        !           415: + }
        !           416: + 
        !           417: + usin(usp)
        !           418: + ushort *usp;
        !           419: + {
        !           420: +      register ushort u;
        !           421: +      register char *p = (char *)usp;
        !           422: + 
        !           423: +      u = *p++ & 0377;
        !           424: +      u |= (*p++ & 0377) << 8;
        !           425: +      *usp = u;
        !           426: + }
        !           427: + 
        !           428: + usout(usp)
        !           429: + ushort *usp;
        !           430: + {
        !           431: +      register ushort u;
        !           432: +      register char *p = (char *)usp;
        !           433: + 
        !           434: +      u = *usp;
        !           435: +      *p++ = u & 0377;
        !           436: +      *p++ = (u >> 8) & 0377;
        !           437:   }
        !           438: *** /tmp/11nm.c.old    Mon Apr  9 14:34:55 1990
        !           439: --- 11nm.c     Mon Mar 19 16:04:09 1990
        !           440: ***************
        !           441: *** 22,27 ****
        !           442: --- 22,28 ----
        !           443:   int  globl_flg;
        !           444:   int  nosort_flg;
        !           445:   int  arch_flg;
        !           446: + int  swab_flg;
        !           447:   int  prep_flg;
        !           448:   struct       ar_hdr  arp;
        !           449:   long arsize;
        !           450: ***************
        !           451: *** 35,40 ****
        !           452: --- 36,43 ----
        !           453:   
        !           454:   char *progname;      /*god: for error messages, hold name here*/
        !           455:   
        !           456: + short        swab();
        !           457: + 
        !           458:   main(argc, argv)
        !           459:   char **argv;
        !           460:   {
        !           461: ***************
        !           462: *** 100,105 ****
        !           463: --- 103,110 ----
        !           464:                fread((char *)&magbuf, 1, sizeof(magbuf), fi);  /* get magic no. */
        !           465:                if (strncmp(magbuf.a, ARMAG, SARMAG)==0)
        !           466:                        arch_flg++;
        !           467: +              else if (BADMAG(magbuf.i) && !BADMAG(swab(magbuf.i)))
        !           468: +                      swab_flg++;
        !           469:                else if (BADMAG(magbuf.i)) {
        !           470:                        fprintf(stderr, "%s: %s-- bad format\n",
        !           471:                                        progname, *argv);
        !           472: ***************
        !           473: *** 118,123 ****
        !           474: --- 123,138 ----
        !           475:                        struct nlist sym;
        !           476:   
        !           477:                        fread((char *)&exp, 1, sizeof(struct exec), fi);
        !           478: +                      if (swab_flg) {
        !           479: +                              exp.a_magic = swab(exp.a_magic);
        !           480: +                              exp.a_text = swab(exp.a_text);
        !           481: +                              exp.a_data = swab(exp.a_data);
        !           482: +                              exp.a_bss  = swab(exp.a_bss );
        !           483: +                              exp.a_syms = swab(exp.a_syms);
        !           484: +                              exp.a_entry = swab(exp.a_entry);
        !           485: +                              exp.a_unused = swab(exp.a_unused);
        !           486: +                              exp.a_flag = swab(exp.a_flag);
        !           487: +                      }
        !           488:                        if (BADMAG(exp.a_magic)) {              /* archive element not in  */
        !           489:                                continue;       /* proper format - skip it */
        !           490:                        }
        !           491: ***************
        !           492: *** 134,139 ****
        !           493: --- 149,158 ----
        !           494:                        i = 0;
        !           495:                        while (--n >= 0) {
        !           496:                                fread((char *)&sym, 1, sizeof(sym), fi);
        !           497: +                              if (swab_flg) {
        !           498: +                                      sym.n_type = swab(sym.n_type);
        !           499: +                                      sym.n_value = swab(sym.n_value);
        !           500: +                              }
        !           501:                                if (globl_flg && (sym.n_type&N_EXT)==0)
        !           502:                                        continue;
        !           503:                                switch (sym.n_type&N_TYPE) {
        !           504: ***************
        !           505: *** 255,258 ****
        !           506: --- 274,284 ----
        !           507:                ++arsize;
        !           508:        off = ftell(af) + arsize;       /* offset to next element */
        !           509:        return(1);
        !           510: + }
        !           511: + 
        !           512: + short
        !           513: + swab(s)
        !           514: + short s;
        !           515: + {
        !           516: +      return(((s&0377)<<8) | ((s>>8)&0377));
        !           517:   }
        !           518: *** /tmp/11ranlib.c.old        Mon Apr  9 14:34:58 1990
        !           519: --- 11ranlib.c Wed Mar 21 17:38:20 1990
        !           520: ***************
        !           521: *** 35,40 ****
        !           522: --- 35,42 ----
        !           523:   {
        !           524:        char buf[256];
        !           525:        char magbuf[SARMAG+1];
        !           526: +      register long temp;
        !           527: +      register int i;
        !           528:   
        !           529:        progname = argv[0];     /*god: for error messages */
        !           530:        --argc;
        !           531: ***************
        !           532: *** 61,68 ****
        !           533:                        long o;
        !           534:                        register n;
        !           535:                        struct nlist sym;
        !           536:   
        !           537: !                      fread((char *)&exp, 1, sizeof(struct exec), fi);
        !           538:                        if (BADMAG)             /* archive element not in  */
        !           539:                                continue;       /* proper format - skip it */
        !           540:                        o = (long)exp.a_text + exp.a_data;
        !           541: --- 63,81 ----
        !           542:                        long o;
        !           543:                        register n;
        !           544:                        struct nlist sym;
        !           545: +                      char ebuf[sizeof(exp)];
        !           546: +                      register char *ep;
        !           547:   
        !           548: !                      fread(ebuf, 1, sizeof(ebuf), fi);
        !           549: !                      ep = ebuf;
        !           550: !                      exp.a_magic = *ep++ & 0377; exp.a_magic |= (*ep++ & 0377) << 8;
        !           551: !                      exp.a_text = *ep++ & 0377; exp.a_text |= (*ep++ & 0377) << 8;
        !           552: !                      exp.a_data = *ep++ & 0377; exp.a_data |= (*ep++ & 0377) << 8;
        !           553: !                      exp.a_bss = *ep++ & 0377; exp.a_bss |= (*ep++ & 0377) << 8;
        !           554: !                      exp.a_syms = *ep++ & 0377; exp.a_syms |= (*ep++ & 0377) << 8;
        !           555: !                      exp.a_entry = *ep++ & 0377; exp.a_entry |= (*ep++ & 0377) << 8;
        !           556: !                      exp.a_unused = *ep++ & 0377; exp.a_unused |= (*ep++ & 0377) << 8;
        !           557: !                      exp.a_flag = *ep++ & 0377; exp.a_flag |= (*ep++ & 0377) << 8;
        !           558:                        if (BADMAG)             /* archive element not in  */
        !           559:                                continue;       /* proper format - skip it */
        !           560:                        o = (long)exp.a_text + exp.a_data;
        !           561: ***************
        !           562: *** 77,82 ****
        !           563: --- 90,102 ----
        !           564:                        }
        !           565:                        while (--n >= 0) {
        !           566:                                fread((char *)&sym, 1, sizeof(sym), fi);
        !           567: +                              ep = (char *)&sym.n_type;
        !           568: +                              temp = *ep++ & 0377;
        !           569: +                              temp |= (*ep++ & 0377) >> 8;
        !           570: +                              sym.n_type = temp;
        !           571: +                              temp = *ep++ & 0377;
        !           572: +                              temp |= (*ep++ & 0377) >> 8;
        !           573: +                              sym.n_value = temp;
        !           574:                                if ((sym.n_type&N_EXT)==0)
        !           575:                                        continue;
        !           576:                                switch (sym.n_type&N_TYPE) {
        !           577: ***************
        !           578: *** 98,103 ****
        !           579: --- 118,133 ----
        !           580:                if(fo == NULL)
        !           581:                {       fprintf(stderr, "can't create temporary\n");
        !           582:                        exit(1);
        !           583: +              }
        !           584: +              for (i = 0; i < TABSZ; i++) {
        !           585: +                      register char *p;
        !           586: + 
        !           587: +                      p = (char *)&tab[i].cloc;
        !           588: +                      temp = tab[i].cloc;
        !           589: +                      *p++ = (temp >> 16) & 0377;     /* funny long order */
        !           590: +                      *p++ = (temp >> 24) & 0377;
        !           591: +                      *p++ = (temp) & 0377;
        !           592: +                      *p++ = (temp >> 8) & 0377;
        !           593:                }
        !           594:                fwrite((char *)tab, tnum, sizeof(struct tab), fo);
        !           595:                fclose(fo);
        !           596: *** /tmp/11size.c.old  Mon Apr  9 14:35:01 1990
        !           597: --- 11size.c   Wed Mar 21 17:20:35 1990
        !           598: ***************
        !           599: *** 8,21 ****
        !           600:   
        !           601:   int a_magic[] = {A_MAGIC1,A_MAGIC2,A_MAGIC3,A_MAGIC4,0};
        !           602:   
        !           603:   main(argc, argv)
        !           604:   char **argv;
        !           605:   {
        !           606: !      struct exec buf;
        !           607:        long sum;
        !           608:        int gorp,i;
        !           609:        FILE *f;
        !           610:   
        !           611:        if (argc==1) {
        !           612:                *argv = A_DOT_OUT;      /*god*/
        !           613:                argc++;
        !           614: --- 12,31 ----
        !           615:   
        !           616:   int a_magic[] = {A_MAGIC1,A_MAGIC2,A_MAGIC3,A_MAGIC4,0};
        !           617:   
        !           618: + char *progname;
        !           619: + 
        !           620:   main(argc, argv)
        !           621:   char **argv;
        !           622:   {
        !           623: !      struct exec h;
        !           624: !      char buf[sizeof(struct exec)];
        !           625: !      register char *bp;
        !           626:        long sum;
        !           627:        int gorp,i;
        !           628:        FILE *f;
        !           629:   
        !           630: +      progname = argv[0];
        !           631: + 
        !           632:        if (argc==1) {
        !           633:                *argv = A_DOT_OUT;      /*god*/
        !           634:                argc++;
        !           635: ***************
        !           636: *** 25,45 ****
        !           637:        while(--argc) {
        !           638:                ++argv;
        !           639:                if ((f = fopen(*argv, "r"))==NULL) {
        !           640: !                      printf("11size: %s not found\n", *argv);
        !           641:                        continue;
        !           642:                }
        !           643: !              fread((char *)&buf, sizeof(buf), 1, f);
        !           644:                for(i=0;a_magic[i];i++)
        !           645: !                      if(a_magic[i] == buf.a_magic) break;
        !           646:                if(a_magic[i] == 0) {
        !           647: !                      printf("11size: %s not an object file\n", *argv);
        !           648: !                      fclose(f);
        !           649:                        continue;
        !           650:                }
        !           651:                if (gorp>2)
        !           652:                        printf("%s: ", *argv);
        !           653: !              printf("%u+%u+%u = ", buf.a_text,buf.a_data,buf.a_bss);
        !           654: !              sum = (long) buf.a_text + (long) buf.a_data + (long) buf.a_bss;
        !           655:                printf("%ldb = %#lob\n", sum, sum);
        !           656:                fclose(f);
        !           657:        }
        !           658: --- 35,68 ----
        !           659:        while(--argc) {
        !           660:                ++argv;
        !           661:                if ((f = fopen(*argv, "r"))==NULL) {
        !           662: !                      fprintf(stderr, "11size: `%s' not found\n", *argv);
        !           663:                        continue;
        !           664:                }
        !           665: !              if (fread(buf, sizeof(buf), 1, f) != 1) {
        !           666: !                      fprintf(stderr, "11size: read error in `%s'\n", *argv);
        !           667: !                      (void) fclose(f);
        !           668: !                      continue;
        !           669: !              }
        !           670: !              bp = buf;
        !           671: !              h.a_magic = *bp++ & 0377; h.a_magic |= (*bp++&0377) << 8;
        !           672: !              h.a_text = *bp++ & 0377; h.a_text |= (*bp++&0377) << 8;
        !           673: !              h.a_data = *bp++ & 0377; h.a_data |= (*bp++&0377) << 8;
        !           674: !              h.a_bss = *bp++ & 0377; h.a_bss |= (*bp++&0377) << 8;
        !           675: !              h.a_syms = *bp++ & 0377; h.a_syms |= (*bp++&0377) << 8;
        !           676: !              h.a_entry = *bp++ & 0377; h.a_entry |= (*bp++&0377) << 8;
        !           677: !              h.a_unused = *bp++ & 0377; h.a_unused |= (*bp++&0377) << 8;
        !           678: !              h.a_flag = *bp++ & 0377; h.a_flag |= (*bp++&0377) << 8;
        !           679:                for(i=0;a_magic[i];i++)
        !           680: !                      if(a_magic[i] == h.a_magic) break;
        !           681:                if(a_magic[i] == 0) {
        !           682: !                      printf("11size: `%s' not an object file\n", *argv);
        !           683: !                      (void) fclose(f);
        !           684:                        continue;
        !           685:                }
        !           686:                if (gorp>2)
        !           687:                        printf("%s: ", *argv);
        !           688: !              printf("%u+%u+%u = ", h.a_text,h.a_data,h.a_bss);
        !           689: !              sum = (long) h.a_text + (long) h.a_data + (long) h.a_bss;
        !           690:                printf("%ldb = %#lob\n", sum, sum);
        !           691:                fclose(f);
        !           692:        }
        !           693: *** /tmp/11strip.c.old Mon Apr  9 14:35:04 1990
        !           694: --- 11strip.c  Wed Mar 21 17:08:18 1990
        !           695: ***************
        !           696: *** 47,52 ****
        !           697: --- 51,58 ----
        !           698:        int i;
        !           699:        time_t tm[2];
        !           700:        struct stat stbuf;
        !           701: +      char buf[sizeof(head)];
        !           702: +      register char *bp;
        !           703:   
        !           704:        tm[0] = 0;
        !           705:        f = open(name, 0);
        !           706: ***************
        !           707: *** 58,64 ****
        !           708:        fstat(f, &stbuf);
        !           709:        tm[0] = stbuf.st_atime;
        !           710:        tm[1] = stbuf.st_mtime;
        !           711: !      read(f, (char *)&head, sizeof(head));
        !           712:        for(i=0;a_magic[i];i++)
        !           713:                if(a_magic[i] == head.a_magic) break;
        !           714:        if(a_magic[i] == 0) {
        !           715: --- 64,79 ----
        !           716:        fstat(f, &stbuf);
        !           717:        tm[0] = stbuf.st_atime;
        !           718:        tm[1] = stbuf.st_mtime;
        !           719: !      read(f, buf, sizeof(buf));
        !           720: !      bp = buf;
        !           721: !      head.a_magic = *bp++ & 0377; head.a_magic |= (*bp++ & 0377) << 8;
        !           722: !      head.a_text = *bp++ & 0377; head.a_text |= (*bp++ & 0377) << 8;
        !           723: !      head.a_data = *bp++ & 0377; head.a_data |= (*bp++ & 0377) << 8;
        !           724: !      head.a_bss = *bp++ & 0377; head.a_bss |= (*bp++ & 0377) << 8;
        !           725: !      head.a_syms = *bp++ & 0377; head.a_syms |= (*bp++ & 0377) << 8;
        !           726: !      head.a_entry = *bp++ & 0377; head.a_entry |= (*bp++ & 0377) << 8;
        !           727: !      head.a_unused = *bp++ & 0377; head.a_unused |= (*bp++ & 0377) << 8;
        !           728: !      head.a_flag = *bp++ & 0377; head.a_flag |= (*bp++ & 0377) << 8;
        !           729:        for(i=0;a_magic[i];i++)
        !           730:                if(a_magic[i] == head.a_magic) break;
        !           731:        if(a_magic[i] == 0) {
        !           732: ***************
        !           733: *** 73,81 ****
        !           734:        size = (long)head.a_text + head.a_data;
        !           735:        head.a_syms = 0;
        !           736:        head.a_flag |= 1;
        !           737:   
        !           738:        lseek(tf, (long)0, 0);
        !           739: !      write(tf, (char *)&head, sizeof(head));
        !           740:        if(copy(name, f, tf, size)) {
        !           741:                status = 1;
        !           742:                goto out;
        !           743: --- 88,105 ----
        !           744:        size = (long)head.a_text + head.a_data;
        !           745:        head.a_syms = 0;
        !           746:        head.a_flag |= 1;
        !           747: +      bp = buf;
        !           748: +      *bp++ = head.a_magic&0377; *bp++ = (head.a_magic>>8)&0377;
        !           749: +      *bp++ = head.a_text&0377; *bp++ = (head.a_text>>8)&0377;
        !           750: +      *bp++ = head.a_data&0377; *bp++ = (head.a_data>>8)&0377;
        !           751: +      *bp++ = head.a_bss&0377; *bp++ = (head.a_bss>>8)&0377;
        !           752: +      *bp++ = head.a_syms&0377; *bp++ = (head.a_syms>>8)&0377;
        !           753: +      *bp++ = head.a_entry&0377; *bp++ = (head.a_entry>>8)&0377;
        !           754: +      *bp++ = head.a_unused&0377; *bp++ = (head.a_unused>>8)&0377;
        !           755: +      *bp++ = head.a_flag&0377; *bp++ = (head.a_flag>>8)&0377;
        !           756:   
        !           757:        lseek(tf, (long)0, 0);
        !           758: !      write(tf, buf, sizeof(buf));
        !           759:        if(copy(name, f, tf, size)) {
        !           760:                status = 1;
        !           761:                goto out;
        !           762: *** /tmp/didnotexistbefore     Mon Apr  9 14:52:59 1990
        !           763: --- as/README.tmpf     Mon Mar 19 15:57:38 1990
        !           764: ***************
        !           765: *** 0 ****
        !           766: --- 1,23 ----
        !           767: + The assembler uses three temporary files to pass info from pass 1 to pass 2.
        !           768: + All are binary format.  Code dealing with them had to be beat on a bit to
        !           769: + make it run on the Sun; the VAX had the same byte ordering as the pdp11,
        !           770: + which preserved some unportable code.  (Not just wrong byte order in
        !           771: + shorts, but also writing out the first half of a long and assuming
        !           772: + that was the low-order half.)
        !           773: + 
        !           774: + The first file, pof in pass 1 and stdin/intfil in pass 2, is shorts in
        !           775: + pdp11 byte order (low byte first).  (A bit curious, but pass 1 wrote them
        !           776: + as words and pass 2 read them as pairs of chars [barf], and the choice of
        !           777: + which to fix was arbitrary.)  They are restored to host byte order for
        !           778: + pass-2 processing, and flipped to pdp11 order again for final output.
        !           779: + 
        !           780: + The second, fbfil in both, is information on temporary labels.  It is
        !           781: + binary records of type "struct expr", in host format.  (For some bizarre
        !           782: + reason, pass 1 used to define its own structure with the type field of
        !           783: + the struct broken down into two chars, while pass 2 extracted the pieces
        !           784: + with shifts and masks on a short!)
        !           785: + 
        !           786: + The third, t in pass 1 and symf in pass 2, is the symbol table.  It is
        !           787: + binary records of type "struct symtab", in host format.  The shorts in
        !           788: + these are transmogrified into pdp11 byte order before they are written
        !           789: + out to the final output.
        !           790: *** /tmp/Makefile.old  Mon Apr  9 14:54:12 1990
        !           791: --- as/Makefile        Thu Mar 29 16:10:22 1990
        !           792: ***************
        !           793: *** 4,21 ****
        !           794:   #
        !           795:   #    BINDIR and LIBDIR must be defined.
        !           796:   #
        !           797: ! BINDIR = /usr/bin
        !           798:   LIBDIR = /usr/lib
        !           799:   
        !           800:   AS1 = 11as
        !           801:   AS2 = 11as2
        !           802: ! A_DOT_OUT = a.out
        !           803:   
        !           804:   CC = cc
        !           805:   CFLAGS = -O "-DPASS2PGM=\"${LIBDIR}/${AS2}\"" "-DA_DOT_OUT=\"${A_DOT_OUT}\""
        !           806:   
        !           807: ! AS1O = as11.o as12.o as13.o as14.o as15.o as16.o as17.o as18.o as19.o
        !           808: ! AS2O = as21.o as22.o as23.o as24.o as25.o as26.o as27.o as28.o as29.o
        !           809:   
        !           810:   all: ${AS1} ${AS2}
        !           811:   
        !           812: --- 4,21 ----
        !           813:   #
        !           814:   #    BINDIR and LIBDIR must be defined.
        !           815:   #
        !           816: ! BINDIR = /usr/bin
        !           817:   LIBDIR = /usr/lib
        !           818:   
        !           819:   AS1 = 11as
        !           820:   AS2 = 11as2
        !           821: ! A_DOT_OUT = a.out
        !           822:   
        !           823:   CC = cc
        !           824:   CFLAGS = -O "-DPASS2PGM=\"${LIBDIR}/${AS2}\"" "-DA_DOT_OUT=\"${A_DOT_OUT}\""
        !           825:   
        !           826: ! AS1O = as11.o as12.o as13.o as14.o as15.o as16.o as17.o as18.o as19.o heap.o
        !           827: ! AS2O = as21.o as22.o as23.o as24.o as25.o as26.o as27.o as28.o as29.o heap.o
        !           828:   
        !           829:   all: ${AS1} ${AS2}
        !           830:   
        !           831: *** /tmp/as1.h.old     Mon Apr  9 14:54:13 1990
        !           832: --- as/as1.h   Thu Mar 29 16:09:31 1990
        !           833: ***************
        !           834: *** 107,109 ****
        !           835: --- 107,110 ----
        !           836:   extern       int nargs;
        !           837:   extern       char **curarg;
        !           838:   extern       int numval;
        !           839: + #define      sbrk    hbrk
        !           840: *** /tmp/as11.c.old    Mon Apr  9 14:54:14 1990
        !           841: --- as/as11.c  Mon Mar 19 16:08:05 1990
        !           842: ***************
        !           843: *** 22,27 ****
        !           844: --- 22,28 ----
        !           845:        extern aexit();
        !           846:        FILE *t;
        !           847:        char *buf1,*buf2;
        !           848: +      extern char *sbrk();
        !           849:   
        !           850:        if (signal(SIGINT,SIG_IGN)!=SIG_IGN) signal(SIGINT,aexit);
        !           851:        while (--argc>=0 && (++argv)[0][0]=='-') {
        !           852: *** /tmp/as12.c.old    Mon Apr  9 14:54:15 1990
        !           853: --- as/as12.c  Mon Mar 19 16:08:06 1990
        !           854: ***************
        !           855: *** 11,16 ****
        !           856:   putw(t)
        !           857:   OP t;
        !           858:   {
        !           859: !      if (ifflg==0 || (t.v=='\n'))
        !           860: !              if (EOF==fwrite(&t,2,1,pof)) wrterr();
        !           861:   }
        !           862: --- 11,21 ----
        !           863:   putw(t)
        !           864:   OP t;
        !           865:   {
        !           866: !      char buf[2];
        !           867: ! 
        !           868: !      if (ifflg==0 || (t.v=='\n')) {
        !           869: !              buf[0] = t.uv&0377;
        !           870: !              buf[1] = (t.uv>>8)&0377;
        !           871: !              if (EOF==fwrite(buf,2,1,pof)) wrterr();
        !           872: !      }
        !           873:   }
        !           874: *** /tmp/as13.c.old    Mon Apr  9 14:54:15 1990
        !           875: --- as/as13.c  Mon Mar 19 16:08:06 1990
        !           876: ***************
        !           877: *** 5,10 ****
        !           878: --- 5,11 ----
        !           879:   assem()
        !           880:   {
        !           881:        OP op1,op2;
        !           882: +      struct expr buf;
        !           883:   
        !           884:        for (;;) {
        !           885:        op1=readop();
        !           886: ***************
        !           887: *** 34,41 ****
        !           888:                                if (op1.v!=T_ABS) {error('x'); continue;}
        !           889:                                t=fbcheck(numval);
        !           890:                                curfbr[t]= *dotrel; curfb[t]= *dot;
        !           891: !                              nxtfb.c0= *dotrel; nxtfb.c1=t; nxtfb.val= *dot;
        !           892: !                              if (1!=fwrite(&nxtfb,sizeof(nxtfb),1,fbfil)) wrterr();
        !           893:                        } else {
        !           894:                                if (op1.xp->typ&037) error('m');
        !           895:                                op1.xp->typ |= *dotrel; op1.xp->val = *dot;
        !           896: --- 35,43 ----
        !           897:                                if (op1.v!=T_ABS) {error('x'); continue;}
        !           898:                                t=fbcheck(numval);
        !           899:                                curfbr[t]= *dotrel; curfb[t]= *dot;
        !           900: !                              buf.typ = ((t&0377)<<8)|(*dotrel&0377);
        !           901: !                              buf.val = *dot;
        !           902: !                              if (1!=fwrite(&buf,sizeof(buf),1,fbfil)) wrterr();
        !           903:                        } else {
        !           904:                                if (op1.xp->typ&037) error('m');
        !           905:                                op1.xp->typ |= *dotrel; op1.xp->val = *dot;
        !           906: *** /tmp/as14.c.old    Mon Apr  9 14:54:16 1990
        !           907: --- as/as14.c  Thu Mar 29 16:23:41 1990
        !           908: ***************
        !           909: *** 1,5 ****
        !           910: --- 1,6 ----
        !           911:   /* a4 -- pdp-11 assembler pass1 */
        !           912:   #include "as1.h"
        !           913: + #define      end     heap
        !           914:   extern char end[];
        !           915:   char *brkend = end;
        !           916:   extern struct symtab *hshtab[HSHSIZ];
        !           917: ***************
        !           918: *** 14,19 ****
        !           919: --- 15,21 ----
        !           920:        struct symtab *sp,**hp;
        !           921:        int around;
        !           922:        int h=0,flags=0;
        !           923: +      extern char *sbrk();
        !           924:   
        !           925:        for (cp1=symbol+NCPS,i=NCPS; --i>=0; ) *--cp1=0;
        !           926:        i=NCPS;
        !           927: *** /tmp/as2.h.old     Mon Apr  9 14:54:17 1990
        !           928: --- as/as2.h   Thu Mar 29 16:09:58 1990
        !           929: ***************
        !           930: *** 94,96 ****
        !           931: --- 94,97 ----
        !           932:   extern       int ifflg;
        !           933:   extern       int numval;
        !           934:   extern       int brdelt;
        !           935: + #define      sbrk    hbrk
        !           936: *** /tmp/as21.c.old    Mon Apr  9 14:54:17 1990
        !           937: --- as/as21.c  Thu Mar 29 16:51:24 1990
        !           938: ***************
        !           939: *** 37,42 ****
        !           940: --- 37,46 ----
        !           941:        int datbase,bssbase;
        !           942:        int nsym;
        !           943:        int defund = 0;
        !           944: +      extern char *sbrk();
        !           945: +      char hbuf[sizeof(hdr)];
        !           946: +      char buf[2];
        !           947: +      register char *hbp;
        !           948:   
        !           949:        if (signal(SIGINT,SIG_IGN)!=SIG_IGN) signal(SIGINT,saexit);
        !           950:        while (--argc>=0 && (++argv)[0][0]=='-') {
        !           951: ***************
        !           952: *** 62,68 ****
        !           953:   
        !           954:                fstat(fileno(symf),&statbuf); hdr.symsiz=statbuf.st_size;
        !           955:                nsym=n=statbuf.st_size/sizeof(dsksym);
        !           956: !              if (-1==(usymtab=sp=sbrk(n*sizeof(*sp)))) saexit();
        !           957:                while (--n>=0) {
        !           958:                        if (1!=fread(&dsksym,sizeof(dsksym),1,symf)) wrterr();
        !           959:                        if ((t=dsksym.dtyp&037)==T_TEXT || t==T_DATA) {
        !           960: --- 66,72 ----
        !           961:   
        !           962:                fstat(fileno(symf),&statbuf); hdr.symsiz=statbuf.st_size;
        !           963:                nsym=n=statbuf.st_size/sizeof(dsksym);
        !           964: !              if ((struct expr *)-1==(usymtab=sp=(struct expr *)sbrk(n*sizeof(*sp)))) saexit();
        !           965:                while (--n>=0) {
        !           966:                        if (1!=fread(&dsksym,sizeof(dsksym),1,symf)) wrterr();
        !           967:                        if ((t=dsksym.dtyp&037)==T_TEXT || t==T_DATA) {
        !           968: ***************
        !           969: *** 79,85 ****
        !           970:   
        !           971:                fstat(fileno(fbfil),&statbuf);
        !           972:                nfb=statbuf.st_size/sizeof(*fbp);
        !           973: !              if (-1==(fbbuf=fbp=sbrk((nfb+1)*sizeof(*fbp)))) saexit();
        !           974:                if (nfb!=fread(fbp,sizeof(*fbp),nfb,fbfil)) wrterr();
        !           975:                while (--nfb>=0) fbp++->typ+=T_ESTTXT-T_TEXT;   /* mark "estimated" */
        !           976:                usymend=fbp; fbp->typ=0100000;
        !           977: --- 83,89 ----
        !           978:   
        !           979:                fstat(fileno(fbfil),&statbuf);
        !           980:                nfb=statbuf.st_size/sizeof(*fbp);
        !           981: !              if ((struct expr *)-1==(fbbuf=fbp=(struct expr *)sbrk((nfb+1)*sizeof(*fbp)))) saexit();
        !           982:                if (nfb!=fread(fbp,sizeof(*fbp),nfb,fbfil)) wrterr();
        !           983:                while (--nfb>=0) fbp++->typ+=T_ESTTXT-T_TEXT;   /* mark "estimated" */
        !           984:                usymend=fbp; fbp->typ=0100000;
        !           985: ***************
        !           986: *** 119,125 ****
        !           987:                }
        !           988:        }
        !           989:   
        !           990: !      if (1!=fwrite(&hdr,sizeof(hdr),1,txtf)) wrterr();
        !           991:        fseek(txtf,tseek[T_TEXT-T_TEXT],0);
        !           992:        fseek(relf,rseek[T_TEXT-T_TEXT],0);
        !           993:        assem();
        !           994: --- 123,138 ----
        !           995:                }
        !           996:        }
        !           997:   
        !           998: !      hbp = hbuf;
        !           999: !      *hbp++ = hdr.magic&0377; *hbp++ = (hdr.magic>>8)&0377;
        !          1000: !      *hbp++ = hdr.txtsiz&0377; *hbp++ = (hdr.txtsiz>>8)&0377;
        !          1001: !      *hbp++ = hdr.datsiz&0377; *hbp++ = (hdr.datsiz>>8)&0377;
        !          1002: !      *hbp++ = hdr.bsssiz&0377; *hbp++ = (hdr.bsssiz>>8)&0377;
        !          1003: !      *hbp++ = hdr.symsiz&0377; *hbp++ = (hdr.symsiz>>8)&0377;
        !          1004: !      *hbp++ = hdr.entry&0377; *hbp++ = (hdr.entry>>8)&0377;
        !          1005: !      *hbp++ = hdr.flag&0377; *hbp++ = (hdr.flag>>8)&0377;
        !          1006: !      *hbp++ = hdr.dummy&0377; *hbp++ = (hdr.dummy>>8)&0377;
        !          1007: !      if (1!=fwrite(hbuf,sizeof(hbuf),1,txtf)) wrterr();
        !          1008:        fseek(txtf,tseek[T_TEXT-T_TEXT],0);
        !          1009:        fseek(relf,rseek[T_TEXT-T_TEXT],0);
        !          1010:        assem();
        !          1011: ***************
        !          1012: *** 132,138 ****
        !          1013:                while (--n>=0) {
        !          1014:                        if (1!=fread(&dsksym,sizeof(dsksym),1,symf)) wrterr();
        !          1015:                        dsksym.dtyp=sp->typ; dsksym.dval=sp->val;
        !          1016: !                      if (1!=fwrite(&dsksym,sizeof(dsksym),1,relf)) wrterr();
        !          1017:                        sp++;
        !          1018:                }
        !          1019:        }
        !          1020: --- 145,157 ----
        !          1021:                while (--n>=0) {
        !          1022:                        if (1!=fread(&dsksym,sizeof(dsksym),1,symf)) wrterr();
        !          1023:                        dsksym.dtyp=sp->typ; dsksym.dval=sp->val;
        !          1024: !                      if (1!=fwrite(dsksym.name,sizeof(dsksym.name),1,relf)) wrterr();
        !          1025: !                      buf[0] = dsksym.dtyp&0377;
        !          1026: !                      buf[1] = (dsksym.dtyp>>8)&0377;
        !          1027: !                      if (1!=fwrite(buf,2,1,relf)) wrterr();
        !          1028: !                      buf[0] = dsksym.dval&0377;
        !          1029: !                      buf[1] = (dsksym.dval>>8)&0377;
        !          1030: !                      if (1!=fwrite(buf,2,1,relf)) wrterr();
        !          1031:                        sp++;
        !          1032:                }
        !          1033:        }
        !          1034: *** /tmp/as22.c.old    Mon Apr  9 14:54:18 1990
        !          1035: --- as/as22.c  Mon Mar 19 16:08:08 1990
        !          1036: ***************
        !          1037: *** 34,46 ****
        !          1038:   
        !          1039:   outb(typ,val)
        !          1040:   {
        !          1041:        if (*dotrel==T_BSS) {error('x'); return;}
        !          1042:        if ((unsigned)typ>T_ABS) error('r');
        !          1043:        if (passno!=0) {
        !          1044: !              if (1!=fwrite(&val,1,1,txtf)) wrterr();
        !          1045:                tseek[*dotrel-T_TEXT]++;
        !          1046:                if (!(*dot&1)) {/* relocate immediately, so we don't forget */
        !          1047: !                      val=0; if (1!=fwrite(&val,2,1,relf)) wrterr();
        !          1048:                        rseek[*dotrel-T_TEXT]+=2;
        !          1049:                }
        !          1050:        }
        !          1051: --- 34,49 ----
        !          1052:   
        !          1053:   outb(typ,val)
        !          1054:   {
        !          1055: +      char buf[2];
        !          1056: + 
        !          1057:        if (*dotrel==T_BSS) {error('x'); return;}
        !          1058:        if ((unsigned)typ>T_ABS) error('r');
        !          1059:        if (passno!=0) {
        !          1060: !              buf[0] = val;
        !          1061: !              if (1!=fwrite(buf,1,1,txtf)) wrterr();
        !          1062:                tseek[*dotrel-T_TEXT]++;
        !          1063:                if (!(*dot&1)) {/* relocate immediately, so we don't forget */
        !          1064: !                      if (2!=fwrite("\0\0",1,2,relf)) wrterr();
        !          1065:                        rseek[*dotrel-T_TEXT]+=2;
        !          1066:                }
        !          1067:        }
        !          1068: *** /tmp/as24.c.old    Mon Apr  9 14:54:19 1990
        !          1069: --- as/as24.c  Mon Mar 19 16:08:08 1990
        !          1070: ***************
        !          1071: *** 4,10 ****
        !          1072:   putw(w,fp)
        !          1073:   FILE *fp;
        !          1074:   {
        !          1075: !      if (1!=fwrite(&w,2,1,fp)) wrterr();
        !          1076:   }
        !          1077:   
        !          1078:   wrterr()
        !          1079: --- 4,14 ----
        !          1080:   putw(w,fp)
        !          1081:   FILE *fp;
        !          1082:   {
        !          1083: !      char buf[2];
        !          1084: ! 
        !          1085: !      buf[0] = w&0377;
        !          1086: !      buf[1] = (w>>8)&0377;
        !          1087: !      if (1!=fwrite(buf,2,1,fp)) wrterr();
        !          1088:   }
        !          1089:   
        !          1090:   wrterr()
        !          1091: *** /tmp/didnotexistbefore     Mon Apr  9 14:52:59 1990
        !          1092: --- heap.c     Thu Mar 29 16:50:08 1990
        !          1093: ***************
        !          1094: *** 0 ****
        !          1095: --- 1,21 ----
        !          1096: + /*
        !          1097: +  * fake heap and fake sbrk() for ugly old code
        !          1098: +  */
        !          1099: + #include <stdio.h>
        !          1100: + #ifndef HEAPSIZ
        !          1101: + #define      HEAPSIZ 100000
        !          1102: + #endif
        !          1103: + char heap[HEAPSIZ];
        !          1104: + static char *hbreak = &heap[0];
        !          1105: + 
        !          1106: + char *
        !          1107: + hbrk(amount)
        !          1108: + int amount;
        !          1109: + {
        !          1110: +      register char *old = hbreak;
        !          1111: + 
        !          1112: +      hbreak += amount;
        !          1113: +      if (hbreak > &heap[HEAPSIZ])
        !          1114: +              return((char *)-1);
        !          1115: +      return(old);
        !          1116: + }
        !          1117: *** /tmp/11cc.c.old    Mon Apr  9 15:00:44 1990
        !          1118: --- 11cc.c     Thu Mar 29 15:20:43 1990
        !          1119: ***************
        !          1120: *** 246,253 ****
        !          1121:                pref = "/lib/mcrt0.o";*/        /*god*/
        !          1122:        if(nc==0)
        !          1123:                goto nocom;
        !          1124:        if (pflag==0 || Fflag) {        /* mjm: added Fflag */
        !          1125: -              tmp0 = copy("/tmp/ctm0a");
        !          1126:                while (access(tmp0, 0)==0)
        !          1127:                        tmp0[9]++;
        !          1128:                while((creat(tmp0, 0400))<0) {
        !          1129: --- 244,251 ----
        !          1130:                pref = "/lib/mcrt0.o";*/        /*god*/
        !          1131:        if(nc==0)
        !          1132:                goto nocom;
        !          1133: +      tmp0 = copy("/tmp/ctm0a");
        !          1134:        if (pflag==0 || Fflag) {        /* mjm: added Fflag */
        !          1135:                while (access(tmp0, 0)==0)
        !          1136:                        tmp0[9]++;
        !          1137:                while((creat(tmp0, 0400))<0) {
        !          1138: *** /tmp/Makefile.old  Mon Apr  9 15:05:10 1990
        !          1139: --- cc/Makefile        Thu Mar 29 15:25:23 1990
        !          1140: ***************
        !          1141: *** 9,19 ****
        !          1142:   
        !          1143:   CFLAGS = -O
        !          1144:   
        !          1145: ! C0FILES = c00.o c01.o c02.o c03.o c04.o c05.o
        !          1146: ! C1FILES = c10.o c11.o c12.o c13.o
        !          1147: ! C2FILES = c20.o c21.o
        !          1148:   
        !          1149: ! all: ${C0} ${C1} ${C2}
        !          1150:        @echo \`all\' is up to date: $?
        !          1151:   
        !          1152:   ${C0}: ${C0FILES}
        !          1153: --- 10,20 ----
        !          1154:   
        !          1155:   CFLAGS = -O
        !          1156:   
        !          1157: ! C0FILES = c00.o c01.o c02.o c03.o c04.o c05.o heap.o
        !          1158: ! C1FILES = c10.o c11.o c12.o c13.o heap.o
        !          1159: ! C2FILES = c20.o c21.o heap.o
        !          1160:   
        !          1161: ! all: ${C0} ${C1} ${C2}
        !          1162:        @echo \`all\' is up to date: $?
        !          1163:   
        !          1164:   ${C0}: ${C0FILES}
        !          1165: *** /tmp/c0.h.old      Mon Apr  9 15:05:12 1990
        !          1166: --- cc/c0.h    Thu Mar 29 14:37:05 1990
        !          1167: ***************
        !          1168: *** 75,81 ****
        !          1169:    * Structure of tree nodes for operators
        !          1170:    */
        !          1171:   struct tnode {
        !          1172: !      int     op;             /* operator */
        !          1173:        int     type;           /* data type */
        !          1174:        int     *subsp;         /* subscript list (for arrays) */
        !          1175:        union   str *strp;      /* structure description for structs */
        !          1176: --- 75,81 ----
        !          1177:    * Structure of tree nodes for operators
        !          1178:    */
        !          1179:   struct tnode {
        !          1180: !      short   op;             /* operator */
        !          1181:        int     type;           /* data type */
        !          1182:        int     *subsp;         /* subscript list (for arrays) */
        !          1183:        union   str *strp;      /* structure description for structs */
        !          1184: ***************
        !          1185: *** 87,93 ****
        !          1186:    * Tree node for constants
        !          1187:    */
        !          1188:   struct       cnode {
        !          1189: !      int     op;
        !          1190:        int     type;
        !          1191:        int     *subsp;
        !          1192:        union   str *strp;
        !          1193: --- 87,93 ----
        !          1194:    * Tree node for constants
        !          1195:    */
        !          1196:   struct       cnode {
        !          1197: !      short   op;
        !          1198:        int     type;
        !          1199:        int     *subsp;
        !          1200:        union   str *strp;
        !          1201: ***************
        !          1202: *** 98,104 ****
        !          1203:    * Tree node for long constants
        !          1204:    */
        !          1205:   struct lnode {
        !          1206: !      int     op;
        !          1207:        int     type;
        !          1208:        int     *subsp;
        !          1209:        union   str *strp;
        !          1210: --- 98,104 ----
        !          1211:    * Tree node for long constants
        !          1212:    */
        !          1213:   struct lnode {
        !          1214: !      short   op;
        !          1215:        int     type;
        !          1216:        int     *subsp;
        !          1217:        union   str *strp;
        !          1218: ***************
        !          1219: *** 110,116 ****
        !          1220:    * constants
        !          1221:    */
        !          1222:   struct       fnode {
        !          1223: !      int     op;
        !          1224:        int     type;
        !          1225:        int     *subsp;
        !          1226:        union   str *strp;
        !          1227: --- 110,116 ----
        !          1228:    * constants
        !          1229:    */
        !          1230:   struct       fnode {
        !          1231: !      short   op;
        !          1232:        int     type;
        !          1233:        int     *subsp;
        !          1234:        union   str *strp;
        !          1235: ***************
        !          1236: *** 453,459 ****
        !          1237:   /*
        !          1238:    * functions
        !          1239:    */
        !          1240: ! char *sbrk();
        !          1241:   union        tree *tree();
        !          1242:   char *copnum();
        !          1243:   union        tree *convert();
        !          1244: --- 453,460 ----
        !          1245:   /*
        !          1246:    * functions
        !          1247:    */
        !          1248: ! char *hbrk();
        !          1249: ! #define      sbrk(n) hbrk(n)
        !          1250:   union        tree *tree();
        !          1251:   char *copnum();
        !          1252:   union        tree *convert();
        !          1253: *** /tmp/c00.c.old     Mon Apr  9 15:05:16 1990
        !          1254: --- cc/c00.c   Thu Mar 29 14:38:22 1990
        !          1255: ***************
        !          1256: *** 223,229 ****
        !          1257:                        peekc = getchar();
        !          1258:                }
        !          1259:                if (peekc != '\n') {
        !          1260: !                      error("Illegal #");
        !          1261:                        while (getchar()!='\n' && eof==0)
        !          1262:                                ;
        !          1263:                }
        !          1264: --- 223,231 ----
        !          1265:                        peekc = getchar();
        !          1266:                }
        !          1267:                if (peekc != '\n') {
        !          1268: ! #ifndef sun                  /* Sun cpp adds level indicator on end */
        !          1269: !                      error("Illegal # suffix");
        !          1270: ! #endif
        !          1271:                        while (getchar()!='\n' && eof==0)
        !          1272:                                ;
        !          1273:                }
        !          1274: ***************
        !          1275: *** 465,485 ****
        !          1276:   
        !          1277:   /*
        !          1278:    * read a single-quoted character constant.
        !          1279: -  * The routine is sensitive to the layout of
        !          1280: -  * characters in a word.
        !          1281:    */
        !          1282:   getcc()
        !          1283:   {
        !          1284:        register int c, cc;
        !          1285: -      register char *ccp;
        !          1286:        char realc;
        !          1287:   
        !          1288:        cval = 0;
        !          1289: -      ccp = (char *)&cval;
        !          1290:        cc = 0;
        !          1291: !      while((c=mapch('\'')) >= 0)
        !          1292: !              if(cc++ < LNCPW)
        !          1293: !                      *ccp++ = c;
        !          1294:        if (cc>LNCPW)
        !          1295:                error("Long character constant");
        !          1296:        if (cc==1) {
        !          1297: --- 467,485 ----
        !          1298:   
        !          1299:   /*
        !          1300:    * read a single-quoted character constant.
        !          1301:    */
        !          1302:   getcc()
        !          1303:   {
        !          1304:        register int c, cc;
        !          1305:        char realc;
        !          1306:   
        !          1307:        cval = 0;
        !          1308:        cc = 0;
        !          1309: !      while((c=mapch('\'')) >= 0) {
        !          1310: !              if(cc < LNCPW)
        !          1311: !                      cval = cval | ((c&0377) << (cc*8));
        !          1312: !              cc++;
        !          1313: !      }
        !          1314:        if (cc>LNCPW)
        !          1315:                error("Long character constant");
        !          1316:        if (cc==1) {
        !          1317: *** /tmp/c04.c.old     Mon Apr  9 15:05:20 1990
        !          1318: --- cc/c04.c   Thu Mar 29 14:38:49 1990
        !          1319: ***************
        !          1320: *** 375,387 ****
        !          1321:        ap = &a;
        !          1322:        for (;;) switch(*s++) {
        !          1323:        case 'B':
        !          1324: !              putc(*ap++, bufp);
        !          1325:                putc(0376, bufp);
        !          1326:                continue;
        !          1327:   
        !          1328:        case 'N':
        !          1329: !              putc(*ap, bufp);
        !          1330: !              putc(*ap++>>8, bufp);
        !          1331:                continue;
        !          1332:   
        !          1333:        case 'F':
        !          1334: --- 375,387 ----
        !          1335:        ap = &a;
        !          1336:        for (;;) switch(*s++) {
        !          1337:        case 'B':
        !          1338: !              putc(*ap++&0377, bufp);
        !          1339:                putc(0376, bufp);
        !          1340:                continue;
        !          1341:   
        !          1342:        case 'N':
        !          1343: !              putc(*ap&0377, bufp);
        !          1344: !              putc((*ap++>>8)&0377, bufp);
        !          1345:                continue;
        !          1346:   
        !          1347:        case 'F':
        !          1348: *** /tmp/c1.h.old      Mon Apr  9 15:05:21 1990
        !          1349: --- cc/c1.h    Thu Mar 29 14:37:22 1990
        !          1350: ***************
        !          1351: *** 147,153 ****
        !          1352:   int  panicposs;              /* set when there might be a need for regpanic */
        !          1353:   jmp_buf      jmpbuf;
        !          1354:   long ftell();
        !          1355: ! char *sbrk();
        !          1356:   struct       optab *match();
        !          1357:   union        tree *optim();
        !          1358:   union        tree *unoptim();
        !          1359: --- 147,154 ----
        !          1360:   int  panicposs;              /* set when there might be a need for regpanic */
        !          1361:   jmp_buf      jmpbuf;
        !          1362:   long ftell();
        !          1363: ! char *hbrk();
        !          1364: ! #define      sbrk(n) hbrk(n)
        !          1365:   struct       optab *match();
        !          1366:   union        tree *optim();
        !          1367:   union        tree *unoptim();
        !          1368: *** /tmp/c10.c.old     Mon Apr  9 15:05:24 1990
        !          1369: --- cc/c10.c   Thu Mar 29 14:39:14 1990
        !          1370: ***************
        !          1371: *** 1090,1095 ****
        !          1372: --- 1090,1096 ----
        !          1373:        lbuf.type = tree->t.type;
        !          1374:        lbuf.degree = tree->t.degree;
        !          1375:        lbuf.tr1 = tree;
        !          1376: +      lbuf.tr2 = TNULL;
        !          1377:        return(rcexpr((union tree *)&lbuf, table, reg));
        !          1378:   }
        !          1379:   
        !          1380: *** /tmp/c2.h.old      Mon Apr  9 15:05:34 1990
        !          1381: --- cc/c2.h    Thu Mar 29 14:37:22 1990
        !          1382: ***************
        !          1383: *** 130,136 ****
        !          1384:   struct optab *ophash[OPHS];
        !          1385:   struct       node *nonlab();
        !          1386:   char *copy();
        !          1387: ! char *sbrk();
        !          1388:   char *findcon();
        !          1389:   struct       node *insertl();
        !          1390:   struct       node *codemove();
        !          1391: --- 130,137 ----
        !          1392:   struct optab *ophash[OPHS];
        !          1393:   struct       node *nonlab();
        !          1394:   char *copy();
        !          1395: ! char *hbrk();
        !          1396: ! #define      sbrk(n) hbrk(n)
        !          1397:   char *findcon();
        !          1398:   struct       node *insertl();
        !          1399:   struct       node *codemove();
        !          1400: *** /tmp/didnotexistbefore     Mon Apr  9 14:52:59 1990
        !          1401: --- cc/heap.c  Thu Mar 29 16:53:11 1990
        !          1402: ***************
        !          1403: *** 0 ****
        !          1404: --- 1,20 ----
        !          1405: + /*
        !          1406: +  * fake heap and fake sbrk() for ugly old code
        !          1407: +  */
        !          1408: + #ifndef HEAPSIZ
        !          1409: + #define      HEAPSIZ 100000
        !          1410: + #endif
        !          1411: + static char heap[HEAPSIZ];
        !          1412: + static char *hbreak = &heap[0];
        !          1413: + 
        !          1414: + char *
        !          1415: + hbrk(amount)
        !          1416: + int amount;
        !          1417: + {
        !          1418: +      register char *old = hbreak;
        !          1419: + 
        !          1420: +      hbreak += amount;
        !          1421: +      if (hbreak > &heap[HEAPSIZ])
        !          1422: +              return((char *)-1);
        !          1423: +      return(old);
        !          1424: + }
        !          1425: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.