Annotation of 43BSDReno/contrib/isode-beta/pepsy/ptabs.c, revision 1.1

1.1     ! root        1: /* ptabs.c */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/pepsy/RCS/ptabs.c,v 7.2 90/07/27 08:49:29 mrose Exp $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/pepsy/RCS/ptabs.c,v 7.2 90/07/27 08:49:29 mrose Exp $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       ptabs.c,v $
        !            12:  * Revision 7.2  90/07/27  08:49:29  mrose
        !            13:  * update
        !            14:  * 
        !            15:  * Revision 7.1  90/07/09  14:53:16  mrose
        !            16:  * sync
        !            17:  * 
        !            18:  */
        !            19: 
        !            20: /*
        !            21:  *                               NOTICE
        !            22:  *
        !            23:  *    Acquisition, use, and distribution of this module and related
        !            24:  *    materials are subject to the restrictions of a license agreement.
        !            25:  *    Consult the Preface in the User's Manual for the full terms of
        !            26:  *    this agreement.
        !            27:  *
        !            28:  */
        !            29: 
        !            30: 
        !            31: #include <stdio.h>
        !            32: #include "pepsydefs.h"
        !            33: #include "pass2.h"
        !            34: #include "mine.h"
        !            35: 
        !            36: extern FILE *fptab;
        !            37: extern char *c_tag(), *c_class();
        !            38: extern char *ec_tag(), *ec_class(), *pec_class();
        !            39: extern char *strip_last();
        !            40: extern char *str_yp_code[];
        !            41: extern char *get_val(), *get_comp(), *strp2name();
        !            42: extern s_table *lookup_list(), *get_offset();
        !            43: extern YP tprnt_loop();
        !            44: 
        !            45: extern char *concat();
        !            46: extern char *my_strcat();
        !            47: 
        !            48: /*
        !            49: extern int explicit;
        !            50: */
        !            51: 
        !            52: static int cons_type = 0;
        !            53: 
        !            54: s_table *ptr;
        !            55: s_table *save_ptr;
        !            56: 
        !            57: #define WORDSIZE       20
        !            58: 
        !            59: /*
        !            60:  * Marshall's three extra conditions for changing the printing output
        !            61:  */
        !            62: static int     mrose1; /* if NamedType */
        !            63: static int     mrose2; /* !mrose1 && -h && DefinedType */
        !            64: static int     mrose3; /* (mrose1 || !mrose2) && TAG && (OPTIONAL|DEFAULT) */
        !            65: 
        !            66: /*
        !            67:  * table printe a type. generate tables for the printing of a type
        !            68:  */
        !            69: tprnt_typ(yp, id, type)
        !            70: YP      yp;
        !            71: char   *id;
        !            72: char   *type;
        !            73: {
        !            74:     char   *t, *f;
        !            75:     char   *p1;
        !            76:     char   *s1, *s2, *s3;
        !            77:     char   *s;
        !            78:     s_table *ptr1, *ptr2;
        !            79:     YP      y;
        !            80: 
        !            81:     if (yp->yp_code < 0 || yp->yp_code > YP_REAL)
        !            82:        ferrd(1, "tdec_typ: unimplemented type %d\n", yp->yp_code);
        !            83: 
        !            84:     if (yp == NULL) {
        !            85:        ferr(0, "tprnt_typ:NULL arguement\n");
        !            86:        return;
        !            87:     }
        !            88: 
        !            89:     if (yp->yp_flags & YP_ID)
        !            90:        mrose1 = 1;
        !            91:     else
        !            92:        mrose1 = 0;
        !            93: 
        !            94:     if (!mrose1 && hflag && yp->yp_code == YP_IDEFINED)
        !            95:        mrose2 = 1;
        !            96:     else
        !            97:        mrose2 = 0;
        !            98: 
        !            99:     if ((mrose1 || !mrose2) && yp->yp_flags & YP_TAG
        !           100:        && yp->yp_flags & (YP_OPTIONAL|YP_DEFAULT))
        !           101:         mrose3 = 1;
        !           102:     else
        !           103:        mrose3 = 0;
        !           104: 
        !           105:     if (yp->yp_flags & YP_TAG && !(yp->yp_flags & YP_IMPLICIT)) {
        !           106:        prte_enoff("ETAG", yp);
        !           107:     }
        !           108:     if (type)
        !           109:        t = type;
        !           110:     else
        !           111:        t = my_strcat("struct ", modsym(mymodule, id, "type"));
        !           112:     f = yp->yp_varexp;
        !           113:     switch (yp->yp_code) {
        !           114: 
        !           115:     case YP_UNDF:
        !           116:        ferr(1, "tprnt_typ:Undefined type\n");
        !           117: 
        !           118:     case YP_BOOL:
        !           119:        p1 = "BOOLEAN";
        !           120:        if (yp->yp_varexp) {
        !           121:        } else
        !           122:            t = NULL;
        !           123:        break;
        !           124: 
        !           125:        /* This needs to be fixed up in the action generating area */
        !           126:     case YP_INTLIST:
        !           127: 
        !           128:     case YP_INT:
        !           129: 
        !           130:     case YP_ENUMLIST:
        !           131:        p1 = "INTEGER";
        !           132:        if (yp->yp_varexp) {
        !           133:        } else
        !           134:            t = NULL;
        !           135:        break;
        !           136: 
        !           137:     case YP_REAL:
        !           138:        p1 = "REALTYPE";
        !           139:        if (yp->yp_varexp) {
        !           140:        } else
        !           141:            t = NULL;
        !           142:        break;
        !           143: 
        !           144: 
        !           145:     case YP_BIT:
        !           146:     case YP_BITLIST:
        !           147:        if (yp->yp_varexp) {
        !           148:            p1 = "BITSTRING";
        !           149:            break;
        !           150:        }
        !           151:        t = NULL;
        !           152:        p1 = NULL;
        !           153:        (void) fprintf(fptab, "\t{ SBITSTRING, 0, %s, %s, NULL },\n",
        !           154:                c_tag(yp), c_class(yp));
        !           155:        break;
        !           156: 
        !           157:     case YP_OCT:
        !           158:        if (yp->yp_varexp) {
        !           159:            p1 = "OCTETSTRING";
        !           160:            break;
        !           161:        }
        !           162:        t = NULL;
        !           163:        p1 = NULL;
        !           164:        prte_noff("SOCTETSTRING", yp);
        !           165:        break;
        !           166: 
        !           167:     case YP_OID:
        !           168:        if (yp->yp_varexp) {
        !           169:            p1 = "OBJID";
        !           170:            break;
        !           171:        }
        !           172:        t = NULL;
        !           173:        p1 = NULL;
        !           174:        prte_noff("SOBJID", yp);
        !           175:        break;
        !           176: 
        !           177:     case YP_SEQ:
        !           178:     case YP_SET:
        !           179:     case YP_ANY:
        !           180:        /*
        !           181:         * if (cons_type) p1 = "CONS_ANY"; else
        !           182:         */
        !           183:        if (yp->yp_varexp) {
        !           184:            p1 = "ANY";
        !           185:            break;
        !           186:        }
        !           187:        t = NULL;
        !           188:        p1 = NULL;
        !           189:        prte_noff("SANY", yp);
        !           190:        break;
        !           191: 
        !           192:     case YP_NULL:
        !           193:        p1 = "T_NULL";
        !           194:        t = NULL;
        !           195:        break;
        !           196: 
        !           197:     case YP_IDEFINED:
        !           198:        p1 = NULL;
        !           199:        pr_deftyp(yp, t, f);
        !           200:        if (yp->yp_flags & YP_DEFAULT)
        !           201:            gdflt(yp, G_DEC);
        !           202:        break;
        !           203: 
        !           204:     case YP_SEQLIST:
        !           205:        p1 = NULL;
        !           206:        /* support for -h flag */
        !           207:        cons_type++;
        !           208:        save_ptr = ptr;
        !           209:        if (yp->yp_varexp == NULL && type != NULL)
        !           210:            ferr(1, "tprnt_typ:YP_SEQLIST:NULL varexp pointer\n");
        !           211:        if (type != NULL)
        !           212:            prte_off("SEQ_START", yp, t, f);
        !           213:        else 
        !           214:            prte_noff("SEQ_START", yp);
        !           215: 
        !           216:        if (yp->yp_flags & YP_DEFAULT)
        !           217:            gdflt(yp, G_DEC);
        !           218:        if (y = yp->yp_type) {
        !           219:            if (type) {
        !           220:                if (yp->yp_declexp == NULL)
        !           221:                    ferr(1, "tprnt_typ:YP_SEQLIST:no declexp\n");
        !           222:                yp->yp_structname = my_strcat("struct ", yp->yp_declexp);
        !           223:            } else
        !           224:                yp->yp_structname = t;
        !           225:            if (optfield(y)) {
        !           226:                (void) fprintf(fptab,
        !           227:                "\t{ OPTL, OFFSET(%s, optionals), 0, 0, NULL },\n",
        !           228:                                    yp->yp_structname);
        !           229:            }
        !           230:            tprnt_loop(y, id, yp->yp_structname);
        !           231:        }
        !           232:        (void) fprintf(fptab, "\t{ PE_END, 0, 0, 0, NULL },\n");
        !           233:        ptr = save_ptr;
        !           234:        cons_type--;
        !           235:        break;
        !           236: 
        !           237:     case YP_SETLIST:
        !           238:        p1 = NULL;
        !           239:        /* support for -h flag */
        !           240:        cons_type++;
        !           241:        if (yp->yp_varexp == NULL && type != NULL)
        !           242:            ferr(1, "tprnt_typ:YP_SETLIST:NULL varexp pointer\n");
        !           243:        if (type != NULL)
        !           244:            prte_off("SET_START", yp, t, f);
        !           245:        else 
        !           246:            prte_noff("SET_START", yp);
        !           247: 
        !           248:        if (yp->yp_flags & YP_DEFAULT)
        !           249:            ddflt(yp);
        !           250:        if (y = yp->yp_type) {
        !           251:            if (type) {
        !           252:                if (yp->yp_declexp == NULL)
        !           253:                    ferr(1, "tprnt_typ:YP_SETLIST:no declexp\n");
        !           254:                yp->yp_structname = my_strcat("struct ", yp->yp_declexp);
        !           255:            } else
        !           256:                yp->yp_structname = t;
        !           257:            if (optfield(y)) {
        !           258:                (void) fprintf(fptab,
        !           259:                    "\t{ OPTL, OFFSET(%s, optionals), 0, 0, NULL },\n",
        !           260:                                        yp->yp_structname);
        !           261:            }
        !           262:            tprnt_loop(y, id, yp->yp_structname);
        !           263:        }
        !           264:        (void) fprintf(fptab, "\t{ PE_END, 0, 0, 0, NULL },\n");
        !           265:        ptr = save_ptr;
        !           266:        cons_type--;
        !           267:        break;
        !           268: 
        !           269:     case YP_SEQTYPE:           /* What is the difference ?? */
        !           270:        p1 = NULL;
        !           271:        cons_type++;
        !           272:        save_ptr = ptr;
        !           273:        if (type != NULL)
        !           274:            prte_off("SEQOF_START", yp, t, f);
        !           275:        else
        !           276:            prte_noff("SEQOF_START", yp);
        !           277:        if (yp->yp_flags & YP_DEFAULT)
        !           278:            gdflt(yp, G_DEC);
        !           279: 
        !           280:        if (y = yp->yp_type) {
        !           281:            if (type) {
        !           282:                if (yp->yp_declexp == NULL)
        !           283:                    ferr(1, "tprnt_typ:YP_SEQTYPE:no declexp\n");
        !           284:                yp->yp_structname = my_strcat("struct ", yp->yp_declexp);
        !           285:            } else
        !           286:                yp->yp_structname = t;
        !           287:            tprnt_loop(y, id, yp->yp_structname);
        !           288:        }
        !           289:        if (yp->yp_structname != NULL)
        !           290:            (void) fprintf(fptab,
        !           291:                "\t{ PE_END, OFFSET(%s, next), 0, 0, NULL },\n",
        !           292:                    yp->yp_structname);
        !           293:        else
        !           294:            (void) fprintf(fptab, "\t{ PE_END, 0, 0, 0, NULL },\n");
        !           295:        ptr = save_ptr;
        !           296:        cons_type--;
        !           297:        break;
        !           298: 
        !           299:     case YP_SETTYPE:
        !           300:        p1 = NULL;
        !           301:        cons_type++;
        !           302:        save_ptr = ptr;
        !           303:        if (type != NULL)
        !           304:            prte_off("SETOF_START", yp, t, f);
        !           305:        else
        !           306:            prte_noff("SETOF_START", yp);
        !           307: 
        !           308:        if (yp->yp_flags & YP_DEFAULT)
        !           309:            gdflt(yp, G_DEC);
        !           310: 
        !           311:        if (y = yp->yp_type) {
        !           312:            if (type) {
        !           313:                if (yp->yp_declexp == NULL)
        !           314:                    ferr(1, "tprnt_typ:YP_SETTYPE:no declexp\n");
        !           315:                yp->yp_structname = my_strcat("struct ", yp->yp_declexp);
        !           316:            } else
        !           317:                yp->yp_structname = t;
        !           318:            tprnt_loop(y, id, yp->yp_structname);
        !           319:        }
        !           320:        if (yp->yp_structname != NULL)
        !           321:            (void) fprintf(fptab,
        !           322:                "\t{ PE_END, OFFSET(%s, next), 0, 0, NULL },\n",
        !           323:                    yp->yp_structname);
        !           324:        else
        !           325:            (void) fprintf(fptab, "\t{ PE_END, 0, 0, 0, NULL },\n");
        !           326:        ptr = save_ptr;
        !           327:        cons_type--;
        !           328:        break;
        !           329: 
        !           330:     case YP_CHOICE:
        !           331:        p1 = NULL;
        !           332:        /* support for -h flag */
        !           333:        if (hflag && (y = yp->yp_type) && !y->yp_next) {
        !           334:            tprnt_typ(y, id, yp->yp_structname);
        !           335:            break;
        !           336:        }
        !           337:        cons_type++;
        !           338:        save_ptr = ptr;
        !           339:        /* Generates an unused tags field - so beware */
        !           340:        if (type != NULL)
        !           341:            prte_off("CHOICE_START", yp, t, f);
        !           342:        else
        !           343:            prte_noff("CHOICE_START", yp);
        !           344: 
        !           345:        if (yp->yp_flags & YP_DEFAULT)
        !           346:            gdflt(yp, G_DEC);
        !           347:        if (y = yp->yp_type) {
        !           348:            if ((yp->yp_flags & YP_ID) && yp->yp_id)
        !           349:                (void) fprintf(fptab,
        !           350:                    "\t{ SCTRL, OFFSET(%s, offset), 0, 0, \"%s\" },\n",
        !           351:                    yp->yp_structname, yp->yp_id);
        !           352:            else
        !           353:                (void) fprintf(fptab,
        !           354:                    "\t{ SCTRL, OFFSET(%s, offset), 0, 0, NULL },\n",
        !           355:                    yp->yp_structname);
        !           356:            if (type) {
        !           357:                if (yp->yp_declexp == NULL)
        !           358:                    ferr(1, "tprnt_typ:YP_CHOICE:no declexp\n");
        !           359:                yp->yp_structname = my_strcat("struct ", yp->yp_declexp);
        !           360:            } else
        !           361:                yp->yp_structname = t;
        !           362:            tprnt_loop(y, id, yp->yp_structname);
        !           363:        }
        !           364:        (void) fprintf(fptab, "\t{ PE_END, 0, 0, 0, NULL },\n");
        !           365:        ptr = save_ptr;
        !           366:        cons_type--;
        !           367:        break;
        !           368: 
        !           369:     default:
        !           370:        ferrd(1, "tprnt_typ: yp_code = %d  not implemented\n", yp->yp_code);
        !           371:     }
        !           372: 
        !           373:     if (p1 != NULL) {
        !           374:        if (t != NULL)
        !           375:            prte_off(p1, yp, t, f);
        !           376:        else
        !           377:            prte_noff(p1, yp);
        !           378: 
        !           379:        if (yp->yp_flags & YP_DEFAULT)
        !           380:            gdflt(yp, G_DEC);
        !           381:     }
        !           382: 
        !           383: 
        !           384: }
        !           385: 
        !           386: static int fflags[] = {
        !           387:     0, 1, 2, 2, 3, 3, 4, 5, 16, 16, 16, 17, 17, 17,
        !           388: 0, -1, 7,};
        !           389: 
        !           390: /*
        !           391:  * generate tables for printing a contructed type
        !           392:  */
        !           393: YP 
        !           394: tprnt_loop(yp, id, type)
        !           395: YP      yp;
        !           396: char   *id;
        !           397: char   *type;
        !           398: {
        !           399:     for (; yp != NULL; yp = yp->yp_next) {
        !           400:        tprnt_typ(yp, id, type);
        !           401:     }
        !           402: }
        !           403: 
        !           404: 
        !           405: ddflt(yp)
        !           406: YP      yp;
        !           407: {
        !           408:     switch (yp->yp_code) {
        !           409:     case YP_BOOL:
        !           410:     case YP_INT:
        !           411:     case YP_INTLIST:
        !           412:        (void) fprintf(fptab, "\t{DFLT_B,      %d,     0,      0 },\n",
        !           413:                yp->yp_default->yv_number);
        !           414:        break;
        !           415:     case YP_BIT:
        !           416:     case YP_BITLIST:
        !           417:     case YP_OCT:
        !           418:     case YP_NULL:
        !           419:     case YP_SEQ:
        !           420:     case YP_SEQTYPE:
        !           421:     case YP_SEQLIST:
        !           422:     case YP_SET:
        !           423:     case YP_SETTYPE:
        !           424:     case YP_SETLIST:
        !           425:     case YP_CHOICE:
        !           426:     case YP_ANY:
        !           427:     case YP_OID:
        !           428:     case YP_IDEFINED:
        !           429:     case YP_ENUMLIST:
        !           430:     case YP_REAL:
        !           431:        (void) fprintf(fptab, "\t{DFLT_B,      0,      0,      0 },\n");
        !           432:        break;
        !           433: 
        !           434:     default:
        !           435:        ferr(1, "ddflt:unknown type %d\n", yp->yp_code);
        !           436:     }
        !           437: 
        !           438: }
        !           439: 
        !           440: /*
        !           441:  * print a Non offset table entry
        !           442:  */
        !           443: prte_noff(type, yp)
        !           444: char   *type;
        !           445: YP     yp;
        !           446: {
        !           447:     char       *tag;
        !           448:     char       *flags;
        !           449:     char       *typename;
        !           450:     char       buf1[BUFSIZ];
        !           451: 
        !           452:     tag = c_tag(yp);
        !           453:     flags = c_class(yp);
        !           454:     if (mrose3) {              /* need to append FL_PRTAG flag */
        !           455:        strncpy(buf1, flags, BUFSIZ);
        !           456:        strncat(buf1, "|FL_PRTAG", BUFSIZ);
        !           457:        flags = buf1;
        !           458:     }
        !           459:     if (mrose1)
        !           460:        typename = yp->yp_id;
        !           461:     else if (mrose2)
        !           462:        typename = yp->yp_identifier;
        !           463:     else
        !           464:        typename = (char *)0;
        !           465:     if (typename)
        !           466:        (void) fprintf(fptab, "\t{ %s, 0, %s, %s, \"%s\" },\n",
        !           467:                                    type, tag, flags, typename);
        !           468:     else
        !           469:        (void) fprintf(fptab, "\t{ %s, 0, %s, %s, NULL},\n",
        !           470:                                    type, tag, flags);
        !           471: }
        !           472: 
        !           473: /*
        !           474:  * print a Non offset table entry for an ETAG - special case
        !           475:  */
        !           476: prte_enoff(type, yp)
        !           477: char   *type;
        !           478: YP     yp;
        !           479: {
        !           480:     char       *tag;
        !           481:     char       *flags;
        !           482:     char       *typename;
        !           483:     char       buf1[BUFSIZ];
        !           484: 
        !           485:     tag = ec_tag(yp);
        !           486:     flags = ec_class(yp);
        !           487:     if (mrose3) {              /* need to append FL_PRTAG flag */
        !           488:        strncpy(buf1, flags, BUFSIZ);
        !           489:        strncat(buf1, "|FL_PRTAG", BUFSIZ);
        !           490:        flags = buf1;
        !           491:        mrose3 = 0;     /* don't want the next tag */
        !           492:     }
        !           493:     if (mrose1) {
        !           494:        typename = yp->yp_id;
        !           495:        mrose1 = 0;
        !           496:     } else if (mrose2) {
        !           497:        typename = yp->yp_identifier;
        !           498:        mrose2 = 0;
        !           499:     } else
        !           500:        typename = NULL;
        !           501:     if (typename)
        !           502:        (void) fprintf(fptab, "\t{ %s, 0, %s, %s, \"%s\" },\n",
        !           503:                                    type, tag, flags, typename);
        !           504:     else
        !           505:        (void) fprintf(fptab, "\t{ %s, 0, %s, %s, NULL },\n",
        !           506:                                    type, tag, flags);
        !           507: }
        !           508: 
        !           509: /*
        !           510:  * print an offset table entry
        !           511:  */
        !           512: prte_off(type, yp, t, f)
        !           513: char   *type;
        !           514: YP     yp;
        !           515: char   *t, *f;
        !           516: {
        !           517:     char       *tag;
        !           518:     char       *flags;
        !           519:     char       *typename;
        !           520:     char       buf1[BUFSIZ];
        !           521: 
        !           522:     tag = c_tag(yp);
        !           523:     flags = c_class(yp);
        !           524:     if (mrose3) {              /* need to append FL_PRTAG flag */
        !           525:        strncpy(buf1, flags, BUFSIZ);
        !           526:        strncat(buf1, "|FL_PRTAG", BUFSIZ);
        !           527:        flags = buf1;
        !           528:     }
        !           529:     if (mrose1)
        !           530:        typename = yp->yp_id;
        !           531:     else if (mrose2)
        !           532:        typename = yp->yp_identifier;
        !           533:     else
        !           534:        typename = (char *)0;
        !           535:     if (typename)
        !           536:        (void) fprintf(fptab, "\t{ %s, OFFSET(%s, %s), %s, %s, \"%s\" },\n",
        !           537:                                    type,       t, f,   tag, flags, typename);
        !           538:     else
        !           539:        (void) fprintf(fptab, "\t{ %s, OFFSET(%s, %s), %s, %s, NULL},\n",
        !           540:                                    type,       t, f,    tag, flags);
        !           541: }
        !           542: 
        !           543: /*
        !           544:  * handle the very complex task of defined types.
        !           545:  * Basically generating object calls
        !           546:  */
        !           547: pr_deftyp(yp, t, f)
        !           548: YP     yp;
        !           549: char   *t;
        !           550: char   *f;
        !           551: {
        !           552:     /* Predefined Universal Type */
        !           553:     struct univ_typ *p, *univtyp();
        !           554: 
        !           555:     if ((p = univtyp(yp->yp_identifier))) {
        !           556:        if (p->univ_flags & UNF_EXTMOD) {
        !           557:            yp->yp_module = p->univ_mod;
        !           558:            goto do_obj;
        !           559:        }
        !           560:        prte_univt(p, yp, t, f);
        !           561:        return;
        !           562:     }
        !           563: 
        !           564: do_obj:
        !           565:     if (yp->yp_flags & YP_TAG && yp->yp_flags & YP_IMPLICIT)
        !           566:        prte_noff("IMP_OBJ", yp);
        !           567:     if (yp->yp_parm) {
        !           568:        ferr(1, "tenc_typ:YP_IDEFINED:yp_parm found\n");
        !           569:     }
        !           570:        prte_obj(yp, t, f);
        !           571: }
        !           572: 
        !           573: /*
        !           574:  * print an offset table entry for an OBJECT type entry
        !           575:  */
        !           576: prte_obj(yp, t, f)
        !           577: YP     yp;
        !           578: char   *t, *f;
        !           579: {
        !           580:     char       *type;
        !           581:     char       *obj;
        !           582:     char       *flags;
        !           583:     char       *typename;
        !           584:     char       *off;
        !           585:     char       buf1[BUFSIZ];
        !           586:     char       buf2[BUFSIZ];
        !           587:     int                extflag;
        !           588: 
        !           589: #if 1
        !           590:     if (yp->yp_module == NULL || strcmp(yp->yp_module, mymodule) == 0) {
        !           591:        if (f)
        !           592:            type = "OBJECT";
        !           593:        else
        !           594:            type = "SOBJECT";
        !           595:        obj = proc_name(yp->yp_identifier, 0);
        !           596:        extflag = 0;
        !           597:     } else {
        !           598:        if (f)
        !           599:            type = "EXTOBJ";
        !           600:        else
        !           601:            type = "SEXTOBJ";
        !           602:        obj = strp2name(yp->yp_identifier, yp->yp_module);
        !           603:        extflag = 1;
        !           604:     }
        !           605: #else
        !           606:     if (f)
        !           607:        type = "OBJECT";
        !           608:     else
        !           609:        type = "SOBJECT";
        !           610:     obj = proc_name(yp->yp_identifier, 0);
        !           611: #endif
        !           612:     flags = c_class(yp);
        !           613:     if (mrose3) {              /* need to append FL_PRTAG flag */
        !           614:        strncpy(buf1, flags, BUFSIZ);
        !           615:        strncat(buf1, "|FL_PRTAG", BUFSIZ);
        !           616:        flags = buf1;
        !           617:     }
        !           618:     if (mrose1)
        !           619:        typename = yp->yp_id;
        !           620:     else if (mrose2)
        !           621:        typename = yp->yp_identifier;
        !           622:     else
        !           623:        typename = (char *)0;
        !           624:     if (f) {
        !           625:        sprintf(buf2, "OFFSET(%s, %s)", t, f);
        !           626:        off = buf2;
        !           627:     } else
        !           628:         off = "0";
        !           629:     if (typename)
        !           630:        (void) fprintf(fptab, "\t{ %s, %s, _Z%s, %s, \"%s\" },\n",
        !           631:                                    type, off, obj, flags, typename);
        !           632:     else
        !           633:        (void) fprintf(fptab, "\t{ %s, %s, _Z%s, %s, NULL},\n",
        !           634:                                    type, off, obj, flags);
        !           635:     if (extflag)
        !           636:        (void) fprintf(fptab, "\t{ EXTMOD, %d, 0, 0, NULL },\n",
        !           637:                gen_modref(yp->yp_module));
        !           638: }
        !           639: 
        !           640: /*
        !           641:  * print an table entry for Universal type with the given entry
        !           642:  */
        !           643: prte_univt(p, yp, t, f)
        !           644: struct univ_typ *p;
        !           645: YP     yp;
        !           646: char   *t, *f;
        !           647: {
        !           648:     char       *type;
        !           649:     int                tag;
        !           650:     int                class;
        !           651:     char       *flags;
        !           652:     char       *typename;
        !           653:     char       *off;
        !           654:     char       buf1[BUFSIZ];
        !           655:     char       buf2[BUFSIZ];
        !           656:     char       buf3[BUFSIZ];
        !           657: 
        !           658:     if (f == NULL)  {
        !           659:        sprintf(buf3, "S%s", p->univ_tab);
        !           660:        type = buf3;
        !           661:     } else
        !           662:        type = p->univ_tab;
        !           663: 
        !           664:     if (yp->yp_flags & YP_TAG && yp->yp_flags & YP_IMPLICIT) {
        !           665:        tag = yp->yp_tag->yt_value->yv_number;
        !           666:        class = yp->yp_tag->yt_class;
        !           667:     } else {
        !           668:        tag = p->univ_id;
        !           669:        class = p->univ_class;
        !           670:     }
        !           671:     
        !           672:     strncpy(buf1, c_flags(yp, class), BUFSIZ);
        !           673: #if 0
        !           674:     sprintf(buf1, "%d", class);
        !           675: #endif
        !           676:     flags = buf1;
        !           677:     if (mrose3) {              /* need to append FL_PRTAG flag */
        !           678:        strncat(buf1, "|FL_PRTAG", BUFSIZ);
        !           679:     }
        !           680:     if (mrose1)
        !           681:        typename = yp->yp_id;
        !           682:     else if (mrose2)
        !           683:        typename = yp->yp_identifier;
        !           684:     else
        !           685:        typename = (char *)0;
        !           686:     if (f) {
        !           687:        sprintf(buf2, "OFFSET(%s, %s)", t, f);
        !           688:        off = buf2;
        !           689:     } else
        !           690:         off = "0";
        !           691:     if (typename)
        !           692:        (void) fprintf(fptab, "\t{ %s, %s, %d, %s, \"%s\" },\n",
        !           693:                                    type, off, tag, flags, typename);
        !           694:     else
        !           695:        (void) fprintf(fptab, "\t{ %s, %s, %d, %s, NULL},\n",
        !           696:                                    type, off, tag, flags);
        !           697: }

unix.superglobalmegacorp.com

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