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

1.1     ! root        1: /* main.c */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/pepsy/RCS/main.c,v 7.0 90/07/01 19:54:21 mrose Exp $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/pepsy/RCS/main.c,v 7.0 90/07/01 19:54:21 mrose Exp $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       main.c,v $
        !            12:  * Revision 7.0  90/07/01  19:54:21  mrose
        !            13:  * *** empty log message ***
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: #include       <stdio.h>
        !            29: #include       <ctype.h>
        !            30: #include "config.h"
        !            31: #ifdef PEPSY_REALS
        !            32: #include       <math.h>
        !            33: #define F_SMALL        (1.0e-10)       /* How accurate should reals agree */
        !            34: #endif
        !            35: #include       "psap.h"
        !            36: #include       "T1-types.h"
        !            37: #include       "T2-types.h"
        !            38: 
        !            39: 
        !            40: 
        !            41: #include "test_table.h"
        !            42:        /* compactly generate the new item of data */
        !            43: #define new(x) ((x *)calloc(1, sizeof (x)))
        !            44: 
        !            45: #define NULLQB (struct qbuf *)0
        !            46: char   *fill();
        !            47: static char   *idname();
        !            48: static char   *clname();
        !            49: static int prntbits();
        !            50: static int pclen();
        !            51: static int prntos();
        !            52: static int prntstr();
        !            53: 
        !            54: extern int print_pe();
        !            55: extern modtyp  _ZBIT_1;
        !            56: extern char    *bitstr2strb();
        !            57: extern PE mkpelist(), mkpe();
        !            58: extern OID     mkoid();
        !            59: extern struct type_UNIV_EXTERNAL *mkext();
        !            60: 
        !            61: static int     t_test = 1;     /* Iteration of the test */
        !            62: 
        !            63: #define NullParm       ((char  *) 0)
        !            64: /*ARGSUSED*/
        !            65: main(argc, argv)
        !            66: int    argc;
        !            67: char   **argv;
        !            68: {
        !            69:     int        i;
        !            70:     int succ, fail;
        !            71: 
        !            72:     succ = fail = 0;
        !            73:     for (i = MAXTCASE - 1; i >= 0; i--) {
        !            74:        if (t_case[i].tst_entry < 0)
        !            75:            continue;
        !            76:        for (t_test = t_case[i].tst_tests; t_test > 0; t_test--) {
        !            77:            if (ed_tst(i) < 0) {
        !            78:                (void) printf("Failed\n");
        !            79:                fail++;
        !            80:            } else
        !            81:                succ++;
        !            82:        }
        !            83:     }
        !            84:     if (fail > 0)
        !            85:        (void) printf("Failed\n");
        !            86:     (void) printf("Total %d  = %d successes %d failures\n", fail + succ, succ, fail);
        !            87: 
        !            88: }
        !            89: 
        !            90: /*
        !            91:  * Perform a test of encoding/decoding on type number tynum
        !            92:  */
        !            93: ed_tst(tynum)
        !            94: int    tynum;
        !            95: {
        !            96:     PE pe;
        !            97:     char *parm1, *parm2;
        !            98: 
        !            99:     if (tynum < 0 || tynum >= MAXTCASE)
        !           100:            ferrd(1, "ed_tst illegal type %d\n", tynum);
        !           101:     
        !           102: 
        !           103:     if ((parm1 = fill(tynum)) == NULL) {
        !           104:        ferr(1, "calloc did not work\n");
        !           105:     }
        !           106: 
        !           107: #define encode(tynum, x, parm) \
        !           108:        enc_f(t_case[tynum].tst_entry, &_ZT1_mod, (x), 1, 0, NULLCP, (parm))
        !           109: 
        !           110:     if (encode(tynum, &pe, parm1) == NOTOK) {
        !           111:        (void) printf("encode:failed on %s: %s\n", t_case[tynum].tst_name,
        !           112:             PY_pepy);
        !           113:        return(-1);
        !           114:     }
        !           115:        
        !           116: 
        !           117: #define decode(tynum, x, parm) \
        !           118:        dec_f(t_case[tynum].tst_entry, &_ZT1_mod, (x), 1, (int *) 0, (char **)NULL, (parm))
        !           119: 
        !           120:     if (decode(tynum, pe, &parm2) == NOTOK) {
        !           121:            (void) printf("decode:failed on %s: %s\n", t_case[tynum].tst_name,
        !           122:                 PY_pepy);
        !           123:            return (-2);
        !           124:     }
        !           125:        
        !           126:     if (tcmp(tynum, parm1, parm2)) {
        !           127:        (void) printf("%s: not transfered properly\n", t_case[tynum].tst_name);
        !           128:        return (-1);
        !           129:     }
        !           130: 
        !           131: #if PRNT
        !           132: #define print(tynum, x)        \
        !           133:     prnt_f(t_case[tynum].tst_entry, &_ZT1_mod, (x), 1, (int *) 0, (char **)0)
        !           134: 
        !           135:     if (print(tynum, pe) == NOTOK) {
        !           136:            (void) printf("Print:failed on %s: %s\n", t_case[tynum].tst_name,
        !           137:                 PY_pepy);
        !           138:            exit(2);
        !           139:     }
        !           140: #endif
        !           141:        
        !           142: 
        !           143: 
        !           144: #define fre_space(tynum, parm) \
        !           145:        fre_obj(parm, _ZT1_mod.md_dtab[t_case[tynum].tst_entry], &_ZT1_mod)
        !           146: 
        !           147:     fre_space(tynum, parm1);
        !           148:     fre_space(tynum, parm2);
        !           149: 
        !           150:     pe_free(pe);
        !           151: 
        !           152:     return (0);
        !           153: }
        !           154: 
        !           155:     /*SUPPRESS 218*/
        !           156: /*
        !           157:  * fill in some test data for the given type
        !           158:  */
        !           159: char   *
        !           160: fill(tynum)
        !           161: int    tynum;
        !           162: {
        !           163:     char       *parm;
        !           164:     static int count;
        !           165:     int                i;
        !           166: 
        !           167:     if ((parm = calloc(1, t_case[tynum].tst_size)) == NULL) {
        !           168:        ferr(1, "calloc did not work\n");
        !           169:     }
        !           170: 
        !           171:     switch (tynum) {
        !           172:     case TY_MPDU:
        !           173: #define Xparm ((struct type_T1_MPDU *)parm)
        !           174:        if ((Xparm->a__seq = new(struct element_T1_1)) == NULL) {
        !           175:                (void) printf("calloc did not work\n");
        !           176:                return NULL;
        !           177:        }
        !           178:        Xparm->a__seq->fred = 10;
        !           179:        Xparm->a__seq->george = 1;
        !           180:        break;
        !           181: #undef Xparm
        !           182:     
        !           183:     case TY_EMBEDDED:
        !           184: #define Xparm ((struct type_T1_Embedded *)parm)
        !           185:        Xparm->anMPDU = (struct type_T1_MPDU *)fill(TY_MPDU);
        !           186:        Xparm->ei = 6966;
        !           187:        break;
        !           188: #undef Xparm
        !           189: 
        !           190:     case TY_STRINGS:
        !           191: #define Xparm  ((struct type_T1_Strings *)parm)
        !           192:        Xparm->ostring = str2qb("12\376\0\377a6", 7, 1);
        !           193:        Xparm->bstring = strb2bitstr("\270\017\010\020\040\100", 50, 0, 0);
        !           194:        Xparm->nstring = str2qb("123456", 6, 1);
        !           195:        Xparm->pstring = str2qb("hello, world", 12, 1);
        !           196:        Xparm->tstring = str2qb("teletex", 7, 1);
        !           197:        Xparm->t61string = str2qb("T.61", 4, 1);
        !           198:        Xparm->vstring = str2qb("visible", 7, 1);
        !           199:        Xparm->vis__string = str2qb("visible again", 13, 1);
        !           200:        Xparm->i646string = str2qb("who knows what this is", 22, 1);
        !           201:        Xparm->ia5string = str2qb("This is ASCII\n\r", 15, 1);
        !           202:        Xparm->graphstring = str2qb("This is a graphic string", 24, 1);
        !           203:        Xparm->genstring = str2qb("This is a general string", 24, 1);
        !           204:        break;
        !           205: #undef Xparm
        !           206: 
        !           207:     case TY_EMB_STRINGS:
        !           208: #define Xparm  ((struct type_T1_Emb__Strings *)parm)
        !           209:        Xparm->atest = 2001;
        !           210:        Xparm->ctest = strb2bitstr("\03\010\252\125", 24, 0, 0);
        !           211:        Xparm->btest = str2qb("Good bye", 8, 1);
        !           212:        Xparm->big__test = (struct type_T1_Strings *)fill(TY_STRINGS);
        !           213:        if ((Xparm->emb__test = new(struct element_T1_0)) == NULL) {
        !           214:                (void) printf("calloc did not work\n");
        !           215:                return NULL;
        !           216:        }
        !           217:        Xparm->emb__test->em__int = -101;
        !           218:        Xparm->emb__test->em__oct = str2qb("Embedded octet string", 21, 1);
        !           219:        Xparm->emb__test->em__bit = strb2bitstr("\377\252\125\370\01", 40, 0,0);
        !           220:        break;
        !           221: #undef Xparm
        !           222: 
        !           223:     case TY_IMPLICIT:
        !           224: #define Xparm  ((struct type_T1_Impl__Tags *)parm)
        !           225:        Xparm->i__impl = -1;
        !           226:        Xparm->o__impl = str2qb("I'm an implicit tagged octet string", 36, 1);
        !           227:        Xparm->b__impl = strb2bitstr("\0\0\01\230\01", 40, 0, 0);
        !           228:        Xparm->f__impl = 0xff; /* True */
        !           229:        Xparm->obj__impl = (struct type_T1_Emb__Strings *)fill(TY_EMB_STRINGS);
        !           230:        if ((Xparm->i__emb__test = new(struct element_T1_2)) == NULL) {
        !           231:                (void) printf("calloc did not work\n");
        !           232:                return NULL;
        !           233:        }
        !           234:        Xparm->i__emb__test->i__em__int = -101;
        !           235:        Xparm->i__emb__test->i__em__oct = str2qb("Implicit Embedded", 18, 1);
        !           236:        Xparm->i__emb__test->i__em__bit = strb2bitstr("\200\200\200\200", 32, 0, 0);
        !           237: #undef Xparm
        !           238:        break;
        !           239: 
        !           240:     case TY_EXPLICIT:
        !           241: #define Xparm  ((struct type_T1_Expl__Tags *)parm)
        !           242:        Xparm->i__expl = 35051;
        !           243:        Xparm->o__expl = str2qb("explicit tagged octet string", 28, 1);
        !           244:        Xparm->b__expl = strb2bitstr("\070\070\070\077", 32, 0, 0);
        !           245:        Xparm->f__expl = 0xf0; /* True */
        !           246:        Xparm->obj__expl = (struct type_T1_Emb__Strings *)fill(TY_EMB_STRINGS);
        !           247:        if ((Xparm->i__exp__test = new(struct element_T1_3)) == NULL) {
        !           248:                (void) printf("calloc did not work\n");
        !           249:                return NULL;
        !           250:        }
        !           251:        Xparm->i__exp__test->i__ex__int = -9;
        !           252:        Xparm->i__exp__test->i__ex__oct = str2qb("Explicit Embedded", 18, 1);
        !           253:        Xparm->i__exp__test->i__ex__bit = strb2bitstr("\03\03\03\03\277", 40, 0, 0);
        !           254: #undef Xparm
        !           255:        break;
        !           256:        
        !           257:     case TY_SEQOF:
        !           258: #define Xparm  ((struct type_T1_Seqof__Test *)parm)
        !           259:     count = 2;
        !           260:     Xparm->sqof__test1 = (struct element_T1_4 *) fill(TY_ELEMENT4);
        !           261:     count = 2;
        !           262:     Xparm->stof__test1 = (struct member_T1_2 *) fill(TY_MEMBER2);
        !           263:     Xparm->i__test1 = 33;
        !           264:     count = 2;
        !           265:     Xparm->sqof__test2 = (struct element_T1_6 *) fill(TY_ELEMENT6);
        !           266:     count = 2;
        !           267:     Xparm->stof__test2 = (struct member_T1_4 *) fill(TY_MEMBER4);
        !           268:     Xparm->i__test2 = 99;
        !           269:     break;
        !           270: #undef Xparm
        !           271:        
        !           272:     case TY_ELEMENT4:
        !           273: #define Xparm  ((struct element_T1_4 *)parm)
        !           274:     Xparm->element_T1_5 = (struct type_T1_Expl__Tags *)fill(TY_EXPLICIT);
        !           275:     if (count-- > 0)
        !           276:        Xparm->next = (struct element_T1_4 *) fill(TY_ELEMENT4);
        !           277:     else
        !           278:        Xparm->next = NULL;
        !           279:     break;
        !           280: #undef Xparm
        !           281:        
        !           282:     case TY_MEMBER2:
        !           283: #define Xparm  ((struct member_T1_2 *)parm)
        !           284:     Xparm->member_T1_3 = (struct type_T1_Expl__Tags *)fill(TY_EXPLICIT);
        !           285:     if (count-- > 0)
        !           286:        Xparm->next = (struct member_T1_2 *) fill(TY_MEMBER2);
        !           287:     else
        !           288:        Xparm->next = NULL;
        !           289:     break;
        !           290: #undef Xparm
        !           291: 
        !           292:     case TY_ELEMENT6:
        !           293: #define Xparm  ((struct element_T1_6 *)parm)
        !           294:     Xparm->element_T1_7 = (struct element_T1_8 *)fill(TY_ELEMENT8);
        !           295:     if (count-- > 0)
        !           296:        Xparm->next = (struct element_T1_6 *) fill(TY_ELEMENT6);
        !           297:     else
        !           298:        Xparm->next = NULL;
        !           299:     break;
        !           300: #undef Xparm
        !           301: 
        !           302:     case TY_ELEMENT8:
        !           303: #define Xparm  ((struct element_T1_8 *)parm)
        !           304:     Xparm->sqof__in = (struct type_T1_Expl__Tags *)fill(TY_EXPLICIT);
        !           305:     Xparm->sqof__i = 212121;
        !           306:     Xparm->sqof__o = str2qb("Element8 Embedded", 18, 1);
        !           307:     break;
        !           308: #undef Xparm
        !           309: 
        !           310:     case TY_MEMBER4:
        !           311: #define Xparm  ((struct member_T1_4 *)parm)
        !           312:     Xparm->member_T1_5 = (struct element_T1_9 *)fill(TY_ELEMENT9);
        !           313:     if (count-- > 0)
        !           314:        Xparm->next = (struct member_T1_4 *) fill(TY_MEMBER4);
        !           315:     else
        !           316:        Xparm->next = NULL;
        !           317:     break;
        !           318: #undef Xparm
        !           319: 
        !           320:     case TY_ELEMENT9:
        !           321: #define Xparm  ((struct element_T1_9 *)parm)
        !           322:        Xparm->stof__in = (struct type_T1_Expl__Tags *)fill(TY_EXPLICIT);
        !           323:        Xparm->stof__i = -12345;
        !           324:        Xparm->stof__o = str2qb("XYZabcde Embedded", 18, 1);
        !           325:     break;
        !           326: #undef Xparm
        !           327: 
        !           328:     case TY_CHOICE:
        !           329: #define Xparm  ((struct type_T1_Choice__Test *)parm)
        !           330:        Xparm->c1 = (struct choice_T1_0 *) fill(TY_CHOICE0);
        !           331:        Xparm->c2 = (struct choice_T1_1 *) fill(TY_CHOICE1);
        !           332:        Xparm->c3 = (struct choice_T1_2 *) fill(TY_CHOICE2);
        !           333:        Xparm->c4 = (struct element_T1_11 *) fill(TY_ELEMENT11);
        !           334:        break;
        !           335: #undef Xparm
        !           336: 
        !           337:     case TY_CHOICE0:
        !           338: #define Xparm  ((struct choice_T1_0 *)parm)
        !           339:        
        !           340:        switch (Xparm->offset = (t_test + 10)%choice_T1_0_obj__c1 + 1) {
        !           341:        case choice_T1_0_i__c1:
        !           342:            Xparm->un.i__c1 = 10101;
        !           343:            break;
        !           344:        
        !           345:        case choice_T1_0_o__c1:
        !           346:            Xparm->un.o__c1 = str2qb("Andrew Worsley!!!", 18, 1);
        !           347:            break;
        !           348:        
        !           349:        case choice_T1_0_b__c1:
        !           350:            Xparm->un.b__c1 = strb2bitstr("\02\02\02\07\077", 40, 0, 0);
        !           351:            break;
        !           352:        
        !           353:        case choice_T1_0_f__c1:
        !           354:            Xparm->un.f__c1 = 0x11;
        !           355:            break;
        !           356:        
        !           357:        case choice_T1_0_obj__c1:
        !           358:            Xparm->un.obj__c1 = (struct type_T1_Emb__Strings *) fill(TY_EMB_STRINGS);
        !           359:            break;
        !           360:        
        !           361:        default:
        !           362:            ferrd(1, "TY_CHOICE0:illegal offset %d\n", Xparm->offset);
        !           363:        }
        !           364:        break;
        !           365: #undef Xparm
        !           366: 
        !           367:     case TY_CHOICE1:
        !           368: #define Xparm  ((struct choice_T1_1 *)parm)
        !           369:        
        !           370:        switch (Xparm->offset = (t_test + 11)%choice_T1_1_obj__c2 + 1) {
        !           371:        case choice_T1_1_i__c2:
        !           372:            Xparm->un.i__c2 = 1212;
        !           373:            break;
        !           374:        
        !           375:        case choice_T1_1_o__c2:
        !           376:            Xparm->un.o__c2 = str2qb("Richard Worsley!!", 18, 1);
        !           377:            break;
        !           378:        
        !           379:        case choice_T1_1_b__c2:
        !           380:            Xparm->un.b__c2 = strb2bitstr("\02\01\01\07\077", 40, 0, 0);
        !           381:            break;
        !           382:        
        !           383:        case choice_T1_1_f__c2:
        !           384:            Xparm->un.f__c2 = 0x12;
        !           385:            break;
        !           386:        
        !           387:        case choice_T1_1_obj__c2:
        !           388:            Xparm->un.obj__c2 = (struct type_T1_Emb__Strings *) fill(TY_EMB_STRINGS);
        !           389:            break;
        !           390:        
        !           391:        default:
        !           392:            ferrd(1, "TY_CHOICE1:illegal offset %d\n", Xparm->offset);
        !           393:        }
        !           394:        break;
        !           395: #undef Xparm
        !           396: 
        !           397:     case TY_CHOICE2:
        !           398: #define Xparm  ((struct choice_T1_2 *)parm)
        !           399:        
        !           400:        switch (Xparm->offset = (t_test + 12)%choice_T1_2_i__c3 + 1) {
        !           401:        case choice_T1_2_i__c3:
        !           402:            Xparm->un.i__c3 = 689364;
        !           403:            break;
        !           404:        
        !           405:        case choice_T1_2_seq__c3:
        !           406:            Xparm->un.seq__c3 = (struct element_T1_10 *) fill(TY_ELEMENT10);
        !           407:            break;
        !           408:        
        !           409:        case choice_T1_2_set__c3:
        !           410:            Xparm->un.set__c3 = (struct member_T1_6 *) fill(TY_MEMBER6);
        !           411:            break;
        !           412:        
        !           413:        default:
        !           414:            ferrd(1, "TY_CHOICE2:illegal offset %d\n", Xparm->offset);
        !           415:        }
        !           416:        break;
        !           417: #undef Xparm
        !           418: 
        !           419:     case TY_CHOICE3:
        !           420: #define Xparm  ((struct choice_T1_3 *)parm)
        !           421:        
        !           422:        switch (Xparm->offset = (t_test + 13)%choice_T1_3_sc__b__i + 1) {
        !           423:        case choice_T1_3_sc__a__i:
        !           424:            Xparm->un.sc__a__i = 16891;
        !           425:            break;
        !           426:        
        !           427:        case choice_T1_3_sc__b__i:
        !           428:            Xparm->un.sc__b__i = 13151;
        !           429:            break;
        !           430:        
        !           431:        case choice_T1_3_c4__i:
        !           432:            Xparm->un.c4__i = 10938;
        !           433:            break;
        !           434:        
        !           435:        case choice_T1_3_c4__obj:
        !           436:            Xparm->un.c4__obj = (struct type_T1_Expl__Tags *) fill(TY_EXPLICIT);
        !           437:            break;
        !           438:        
        !           439:        default:
        !           440:            ferrd(1, "TY_CHOICE3:illegal offset %d\n", Xparm->offset);
        !           441:        }
        !           442:        break;
        !           443: #undef Xparm
        !           444: 
        !           445:     case TY_ELEMENT10:
        !           446: #define Xparm  ((struct element_T1_10 *)parm)
        !           447:        Xparm->seq__c3__in = (struct type_T1_Expl__Tags *) fill(TY_EXPLICIT);
        !           448:        Xparm->seq__c3__i = 40938;
        !           449:        Xparm->seq__c3__o = str2qb("James Worsley!!!!", 18, 1);
        !           450:        break;
        !           451: #undef Xparm
        !           452: 
        !           453:     case TY_MEMBER6:
        !           454: #define Xparm  ((struct member_T1_6 *)parm)
        !           455:        Xparm->set__c3__in = (struct type_T1_Expl__Tags *) fill(TY_EXPLICIT);
        !           456:        Xparm->set__c3__i = 0x40938;
        !           457:        Xparm->set__c3__o = str2qb("Patrick Worsley!!", 18, 1);
        !           458:        break;
        !           459: #undef Xparm
        !           460: 
        !           461:     case TY_ELEMENT11:
        !           462: #define Xparm  ((struct element_T1_11 *)parm)
        !           463:        Xparm->c4__choice = (struct choice_T1_3 *) fill(TY_CHOICE3);
        !           464:        break;
        !           465: #undef Xparm
        !           466: 
        !           467:     case TY_OPTIONAL:
        !           468: #define Xparm  ((struct type_T1_Opt__Strings *)parm)
        !           469:         if (t_test & opt_T1_Opt__Strings_a__opt) {
        !           470:            Xparm->optionals |= opt_T1_Opt__Strings_a__opt;
        !           471:            Xparm->a__opt = 192837;
        !           472:        }
        !           473:         if (t_test & opt_T1_Opt__Strings_d__opt) {
        !           474:            Xparm->optionals |= opt_T1_Opt__Strings_d__opt;
        !           475:            Xparm->d__opt = 1;
        !           476:        }
        !           477:        Xparm->b__opt = str2qb("Susan Hannah Sibel", 19, 1);
        !           478:         if (t_test*(t_test + 1) & opt_T1_Opt__Strings_d__opt) {
        !           479:            Xparm->c__opt = strb2bitstr("\012\017\02\07\077", 40, 0, 0);
        !           480:        }
        !           481:         if (t_test & opt_T1_Opt__Strings_e__opt) {
        !           482:            Xparm->optionals |= opt_T1_Opt__Strings_e__opt;
        !           483:            Xparm->e__opt = 0;
        !           484:        }
        !           485:         if ((t_test + 12)*t_test & opt_T1_Opt__Strings_a__opt) {
        !           486:            Xparm->big__opt = (struct type_T1_Strings *) fill(TY_STRINGS);
        !           487:        }
        !           488:         if ((t_test + 2)*t_test & opt_T1_Opt__Strings_a__opt) {
        !           489:            Xparm->emb__opt = (struct element_T1_12 *) fill(TY_ELEMENT12);
        !           490:        }
        !           491:         if ((t_test + 4)*t_test & opt_T1_Opt__Strings_a__opt) {
        !           492:            Xparm->st__opt = (struct member_T1_7 *) fill(TY_MEMBER7);
        !           493:        }
        !           494:         if ((t_test + 8)*t_test & opt_T1_Opt__Strings_a__opt) {
        !           495:            Xparm->obj__opt = (struct type_T1_MPDU *) fill(TY_MPDU);
        !           496:        }
        !           497:         if (t_test & opt_T1_Opt__Strings_etag__opt) {
        !           498:            Xparm->optionals |= opt_T1_Opt__Strings_etag__opt;
        !           499:            Xparm->etag__opt = 2983461;
        !           500:        }
        !           501:         if ((t_test + 6)*t_test & opt_T1_Opt__Strings_a__opt) {
        !           502:            Xparm->ch__opt = (struct choice_T1_4 *) fill(TY_CHOICE4);
        !           503:        }
        !           504:        break;
        !           505: #undef Xparm
        !           506: 
        !           507:      case TY_ELEMENT12:
        !           508: #define Xparm  ((struct element_T1_12 *)parm)
        !           509:         if ((t_test + 10)*t_test & opt_T1_element_T1_12_oem__int) {
        !           510:            Xparm->optionals |= opt_T1_element_T1_12_oem__int;
        !           511:            Xparm->oem__int = 197336;
        !           512:        }
        !           513:         if (t_test*(t_test + 22) & opt_T1_Opt__Strings_a__opt) {
        !           514:            Xparm->oem__oct = str2qb("Ling Worsley", 13, 1);
        !           515:        }
        !           516:         if (t_test*(t_test + 16) & opt_T1_Opt__Strings_d__opt) {
        !           517:            Xparm->oem__bit = strb2bitstr("\0142\0117\02\017\07", 40, 0, 0);
        !           518:        }
        !           519:         break;
        !           520: #undef Xparm
        !           521: 
        !           522:      case TY_MEMBER7:
        !           523: #define Xparm  ((struct member_T1_7 *)parm)
        !           524:         if ((t_test + 12)*t_test & opt_T1_member_T1_7_st__int0) {
        !           525:            Xparm->optionals |= opt_T1_member_T1_7_st__int0;
        !           526:            Xparm->st__int0 = 85659;
        !           527:        }
        !           528:         if ((t_test + 12)*t_test & opt_T1_member_T1_7_st__int1) {
        !           529:            Xparm->optionals |= opt_T1_member_T1_7_st__int1;
        !           530:            Xparm->st__int1 = 664388;
        !           531:        }
        !           532:         if ((t_test + 12)*t_test & opt_T1_member_T1_7_st__int2) {
        !           533:            Xparm->optionals |= opt_T1_member_T1_7_st__int2;
        !           534:            Xparm->st__int2 = 967768;
        !           535:        }
        !           536:         break;
        !           537: #undef Xparm
        !           538: 
        !           539:     case TY_CHOICE4:
        !           540: #define Xparm  ((struct choice_T1_4 *)parm)
        !           541:        
        !           542:        switch (Xparm->offset = (t_test + 14)%choice_T1_4_ch__2 + 1) {
        !           543:        case choice_T1_4_ch__1:
        !           544:            Xparm->un.ch__1 = 74576;
        !           545:            break;
        !           546:        
        !           547:        case choice_T1_4_ch__2:
        !           548:            Xparm->un.ch__2 = 28828;
        !           549:            break;
        !           550:        
        !           551:        default:
        !           552:            ferrd(1, "TY_CHOICE4:illegal offset %d\n", Xparm->offset);
        !           553:        }
        !           554:        break;
        !           555: #undef Xparm
        !           556: 
        !           557:      case TY_EXTREF:
        !           558: #define Xparm  ((struct type_T1_E__ref *)parm)
        !           559:        Xparm->a__ref = (struct type_T2_Info *) fill(TY_T2_INFO);
        !           560:        Xparm->b__ref = (struct type_T2_Info *) fill(TY_T2_INFO);
        !           561:        Xparm->c__ref = (struct type_T1_Choice__Test *) fill(TY_CHOICE);
        !           562:         if ((t_test + 20)*t_test & 0x2) {
        !           563:            Xparm->d__ref = (struct type_T2_Info *) fill(TY_T2_INFO);
        !           564:        }
        !           565:         if ((t_test + 20)*t_test & 0x1) {
        !           566:            Xparm->e__ref = (struct type_T2_Info *) fill(TY_T2_INFO);
        !           567:        }
        !           568:         break;
        !           569: #undef Xparm
        !           570: 
        !           571:      case TY_T2_INFO:
        !           572: #define Xparm  ((struct type_T2_Info *)parm)
        !           573:        Xparm->a1 = 101910;
        !           574:        Xparm->a2 = -304985;
        !           575:        Xparm->a3 = 13;
        !           576:        Xparm->a4 = (struct type_T2_MPDU *) fill(TY_T2_MPDU);
        !           577:         break;
        !           578: #undef Xparm
        !           579: 
        !           580:      case TY_T2_MPDU:
        !           581: #define Xparm  ((struct type_T2_MPDU *)parm)
        !           582:        Xparm->a__seq = (struct element_T2_0 *) fill(TY_T2_ELEM0);
        !           583:         break;
        !           584: #undef Xparm
        !           585: 
        !           586:      case TY_T2_ELEM0:
        !           587: #define Xparm  ((struct element_T2_0 *)parm)
        !           588:        Xparm->fred = 998877;
        !           589:         break;
        !           590: #undef Xparm
        !           591: 
        !           592:      case TY_OPTIMISED:
        !           593: #define Xparm  ((struct type_T1_Optimised *)parm)
        !           594:        Xparm->o1 = strb2bitstr("\0241\0227\032\011\0237", 40, 0, 0);
        !           595:        Xparm->o2 = str2qb("Peckling Worsley!!!!", 20, 1);
        !           596:        Xparm->o3 = (struct type_T1_MPDU *) fill(TY_MPDU);
        !           597:        Xparm->o4 = (PE ) mkpelist(t_test);
        !           598:        Xparm->element_T1_14  = (struct member_T1_9 *) fill(TY_MEMBER9);
        !           599:        break;
        !           600: #undef Xparm
        !           601: 
        !           602:      case TY_MEMBER9:
        !           603: #define Xparm  ((struct member_T1_9 *)parm)
        !           604:        Xparm->o5 = mkpelist(t_test);
        !           605:        Xparm->o6 = mkpelist(t_test);
        !           606:        Xparm->o7 = mkoid(t_test);
        !           607:        break;
        !           608: #undef Xparm
        !           609: 
        !           610:     case TY_EXTERNAL:
        !           611: #define Xparm  ((struct type_T1_Ext__typ *)parm)
        !           612:         Xparm->ext = mkext(t_test*8 + 1);
        !           613:         Xparm->a__ny = mkpe(t_test*8 + 1);
        !           614:         Xparm->ext__impl = mkext(t_test*6 + 1);
        !           615:         Xparm->any__impl = mkpe(t_test*8 + 3);
        !           616:         Xparm->ext__expl = mkext(t_test*4 + 1);
        !           617:         Xparm->any__expl = mkpe(t_test*8 + 5);
        !           618:        break;
        !           619: #undef Xparm
        !           620: 
        !           621:     case TY_SEXTERNAL:
        !           622: #define Xparm  ((struct type_T1_SExt *)parm)
        !           623:        free(parm);     /* don't need it */
        !           624:        Xparm = mkext(21);
        !           625:        break;
        !           626: #undef Xparm
        !           627: 
        !           628:     case TY_ETAGOBJ:
        !           629: #define Xparm  ((struct type_T1_Etags *)parm)
        !           630:        switch (Xparm->offset = (t_test + 4)%type_T1_Etags_bE + 1) {
        !           631:        case type_T1_Etags_aE:
        !           632:            Xparm->un.aE = 10283;
        !           633:            break;
        !           634:        
        !           635:        case type_T1_Etags_bE:
        !           636:            Xparm->un.bE = 40986;
        !           637:            break;
        !           638:        
        !           639:        default:
        !           640:            ferrd(1, "TY_ETAGOBJ:illegal offset %d\n", Xparm->offset);
        !           641:        }
        !           642:        break;
        !           643: #undef Xparm
        !           644: 
        !           645: /* This has to be changed when posy is upgraded to handle DEFAULTS properly */
        !           646:     case TY_DEFAULT:
        !           647: #define Xparm  ((struct type_T1_Def__Strings *)parm)
        !           648:        if (t_test*t_test & 2)
        !           649:            Xparm->a__def = int_T1_a__def_a__def__0;
        !           650:        else
        !           651:            Xparm->a__def = int_T1_a__def_a__def__1;
        !           652:        if (t_test*t_test & 4)
        !           653:            Xparm->b__def = str2qb("Susan Sibel !!!!", 17, 1);
        !           654:        else if (t_test*t_test & 8)
        !           655:            Xparm->b__def = str2qb("hello, world", 12, 1);
        !           656:        else
        !           657:            Xparm->b__def = NULLQB;
        !           658:        if (t_test*t_test & 8)
        !           659:            Xparm->c__def = strb2bitstr(int2strb(bit_T1_c__def_c__def__two, 9),
        !           660:                9, 0, 0);
        !           661:        else
        !           662:            Xparm->c__def = NULLPE;
        !           663:        if (t_test*t_test & 0x10)
        !           664:            Xparm->okay = 0;
        !           665:        else
        !           666:            Xparm->okay = 1;
        !           667:        if (t_test*t_test & 0x20)
        !           668:            Xparm->e__def = 0;
        !           669:        else
        !           670:            Xparm->e__def = 1;
        !           671:        Xparm->big__def = (struct type_T1_Strings *) fill(TY_STRINGS);
        !           672:        if (t_test*t_test*t_test & 0x10)
        !           673:            Xparm->emb__def = NULL;
        !           674:        else
        !           675:            Xparm->emb__def = (struct element_T1_13 *) fill(TY_ELEMENT13);
        !           676:        if (t_test*t_test*t_test & 0x20)
        !           677:            Xparm->st__def = NULL;
        !           678:        else
        !           679:            Xparm->st__def = (struct member_T1_8 *) fill(TY_MEMBER8);
        !           680:        break;
        !           681: #undef Xparm
        !           682: 
        !           683:     case TY_ELEMENT13:
        !           684: #define Xparm ((struct element_T1_13 *)parm)
        !           685:        if (t_test*t_test*t_test & 1)
        !           686:            Xparm->colour = int_T1_colour_green;
        !           687:        else
        !           688:            Xparm->colour = int_T1_colour_red;
        !           689:        if (t_test*t_test & 040)
        !           690:            Xparm->oem__oct = str2qb("Julia Dzuikas !!!!", 19, 1);
        !           691:        else
        !           692:            Xparm->oem__oct = NULLQB;
        !           693:        if (t_test*t_test*t_test & 2)
        !           694:            Xparm->version = strb2bitstr(int2strb((1 << bit_T1_version_basic)
        !           695:                                             |(1 << bit_T1_version_patch1), 3),
        !           696:                                             3, 0, 0);
        !           697:        else
        !           698:            Xparm->version = strb2bitstr(int2strb((1 << bit_T1_version_basic),
        !           699:                                                    3), 3, 0, 0);
        !           700:        break;
        !           701: #undef Xparm
        !           702: 
        !           703:     case TY_MEMBER8:
        !           704: #define Xparm ((struct member_T1_8 *)parm)
        !           705:        if (t_test*t_test*t_test & 4)
        !           706:            Xparm->wine = int_T1_wine_burgundy;
        !           707:        else
        !           708:            Xparm->wine = int_T1_wine_claret;
        !           709:        if (t_test*t_test*t_test & 010)
        !           710:            Xparm->beer = int_T1_beer_vb;
        !           711:        else
        !           712:            Xparm->beer = int_T1_beer_hieneken;
        !           713:        if (t_test*t_test*t_test & 020)
        !           714:            Xparm->spirit = int_T1_spirit_vodka;
        !           715:        else
        !           716:            Xparm->spirit = int_T1_spirit_brandy;
        !           717:        break;
        !           718: #undef Xparm
        !           719: 
        !           720:     case TY_STEST:
        !           721: #define Xparm ((struct type_T1_Stest *)parm)
        !           722:        if (t_test*(t_test + 2)*t_test & 4)
        !           723:            Xparm->st1 = (struct type_T1_Sint *)fill(TY_SINT);
        !           724:        else
        !           725:            Xparm->st1 = (struct type_T1_Sint *)NULL;
        !           726:        if (t_test*(t_test + 2)*t_test & 010)
        !           727:            Xparm->st2 = str2qb("goodbye, world", 14, 1);
        !           728:        else
        !           729:            Xparm->st2 = str2qb("xxxxxxx, world", 14, 1);
        !           730:        break;
        !           731: #undef Xparm
        !           732: 
        !           733:     case TY_SINT:
        !           734: #define Xparm ((struct type_T1_Sint *)parm)
        !           735:        if (t_test*(t_test + 4)*t_test & 4)
        !           736:            Xparm->parm = 33;
        !           737:        else
        !           738:            Xparm->parm = 44;
        !           739:        break;
        !           740: #undef Xparm
        !           741: 
        !           742:     case TY_ETYPE:
        !           743: #define Xparm ((struct type_T1_Enum__type *)parm)
        !           744:        switch (t_test & 3) {
        !           745:        case 0:
        !           746:            Xparm->parm = int_T1_Enum__type_pork;
        !           747:            break;
        !           748: 
        !           749:        case 1:
        !           750:            Xparm->parm = int_T1_Enum__type_beef;
        !           751:            break;
        !           752: 
        !           753: 
        !           754:        case 2:
        !           755:            Xparm->parm = int_T1_Enum__type_chicken;
        !           756:            break;
        !           757: 
        !           758: 
        !           759:        case 3:
        !           760:            Xparm->parm = int_T1_Enum__type_lamb;
        !           761:            break;
        !           762: 
        !           763:        default:
        !           764:            ferrd(1, "fill:ETYPE: Self consistency failure\n", t_test);
        !           765:        }
        !           766:        break;
        !           767: #undef Xparm
        !           768: 
        !           769:     case TY_ENUM_TEST:
        !           770: #define Xparm ((struct type_T1_T__enum *)parm)
        !           771:        i = t_test;
        !           772:        Xparm->ae1 = (struct type_T1_Enum__type *)fill(TY_ETYPE);
        !           773:        t_test++;
        !           774:        Xparm->ae2 = (struct type_T1_Enum__type *)fill(TY_ETYPE);
        !           775:        t_test++;
        !           776:        Xparm->ae3 = (struct type_T1_Enum__type *)fill(TY_ETYPE);
        !           777:        t_test++;
        !           778:        if (t_test & 1)
        !           779:            Xparm->ae5 = (struct type_T1_Enum__type *)fill(TY_ETYPE);
        !           780:        Xparm->ae4 = (struct type_T1_Enum__type *)fill(TY_ETYPE);
        !           781:        t_test++;
        !           782:        if (t_test & 2)
        !           783:            Xparm->ae4->parm = int_T1_Enum__type_chicken; /* Default */
        !           784:        t_test = i;
        !           785:        break;
        !           786: #undef Xparm
        !           787: 
        !           788: #ifdef PEPSY_REALS
        !           789:     case TY_REAL:
        !           790: #define Xparm  ((struct type_T1_Real *)parm)
        !           791:        switch (t_test % 3) {
        !           792:        case 0:
        !           793:            Xparm->parm = -2.28789;
        !           794:            break;
        !           795:        
        !           796:        case 1:
        !           797:            Xparm->parm = 927639.98009;
        !           798:            break;
        !           799: 
        !           800:        case 2:
        !           801:            Xparm->parm = 0.0;
        !           802:            break;
        !           803: 
        !           804:        default:
        !           805:        ferrd(1, "fill:TY_REAL:Internal error %d\n", t_test);
        !           806:         }
        !           807:         break;
        !           808: #undef Xparm
        !           809: 
        !           810:     case TY_REAL_TEST:
        !           811: #define Xparm  ((struct type_T1_T__real *)parm)
        !           812:        i = t_test;
        !           813:         Xparm->r1 = (struct type_T1_Real *) fill(TY_REAL);
        !           814:        t_test++;
        !           815:         Xparm->r2 = (struct type_T1_Real *) fill(TY_REAL);
        !           816:        t_test++;
        !           817:         Xparm->r3 = (struct type_T1_Real *) fill(TY_REAL);
        !           818:        t_test++;
        !           819: 
        !           820:        Xparm->r4 = (struct type_T1_Real *) fill(TY_REAL);
        !           821:        t_test++;
        !           822:        if (i & 1)      /* Default */
        !           823:            Xparm->r4->parm = 3.1415962;
        !           824: 
        !           825:        if (i & 2) {    /* Optional */
        !           826:            Xparm->r4 = (struct type_T1_Real *) fill(TY_REAL);
        !           827:        }
        !           828:        t_test = i;
        !           829:        break;
        !           830: #undef Xparm
        !           831: 
        !           832: #endif
        !           833: 
        !           834:     default:
        !           835:        ferrd(1, "fill:unknown type %d\n", tynum);
        !           836:     }
        !           837: 
        !           838:     return (parm);
        !           839: }
        !           840: 
        !           841: #if 0
        !           842: /*
        !           843:  * encode each given type
        !           844:  */
        !           845: encode(tynum, ppe, parm)
        !           846: int    tynum;
        !           847: PE     *ppe;
        !           848: char   *parm;
        !           849: {
        !           850:     int        d;
        !           851: 
        !           852:     switch (tynum) {
        !           853:     case TY_MPDU:
        !           854:        d = encode_T1_MPDU(ppe, 1, NULLVP, NULLCP, parm);
        !           855:        break;
        !           856:     
        !           857:     case TY_EMBEDDED:
        !           858:        d = encode_T1_Embedded(ppe, 1, NULLVP, NULLCP, parm);
        !           859:        break;
        !           860:     
        !           861:     case TY_STRINGS:
        !           862:        d = encode_T1_Strings(ppe, 1, NULLVP, NULLCP, parm);
        !           863:        break;
        !           864: 
        !           865:     case TY_EMB_STRINGS:
        !           866:        d = encode_T1_Emb__Strings(ppe, 1, NULLVP, NULLCP, parm);
        !           867:        break;
        !           868:    
        !           869:     case TY_IMPLICIT:
        !           870:        d = encode_T1_Impl__Tags(ppe, 1, NULLVP, NULLCP, parm);
        !           871:        break;
        !           872:    
        !           873:     case TY_EXPLICIT:
        !           874:        d = encode_T1_Expl__Tags(ppe, 1, NULLVP, NULLCP, parm);
        !           875:        break;
        !           876: 
        !           877:     case TY_EXTERNAL:
        !           878:        d = encode_T1_E__ref(ppe, 1, NULLVP, NULLCP, parm);
        !           879:        break;
        !           880: 
        !           881:     default:
        !           882:        ferrd(1, "encode:unknown type\n", tynum);
        !           883:     }
        !           884:     if (d == NOTOK) {
        !           885:            (void) printf("encode:failed on %s\n", t_case[tynum].tst_name);
        !           886:            exit(1);
        !           887:     }
        !           888: }
        !           889: 
        !           890: /*
        !           891:  * decode each given type
        !           892:  */
        !           893: decode(tynum, pe, parm)
        !           894: int    tynum;
        !           895: PE     pe;
        !           896: char   **parm;
        !           897: {
        !           898:     int        d;
        !           899: 
        !           900:     switch (tynum) {
        !           901:     case TY_MPDU:
        !           902:        d = decode_T1_MPDU(pe, 1, NULLVP, NULLCP, parm);
        !           903:        break;
        !           904: 
        !           905:     case TY_EMBEDDED:
        !           906:        d = decode_T1_Embedded(pe, 1, NULLVP, NULLCP, parm);
        !           907:        break;
        !           908: 
        !           909:     case TY_STRINGS:
        !           910:        d = decode_T1_Strings(pe, 1, NULLVP, NULLCP, parm);
        !           911:        break;
        !           912: 
        !           913:     case TY_EMB_STRINGS:
        !           914:        d = decode_T1_Emb__Strings(pe, 1, NULLVP, NULLCP, parm);
        !           915:        break;
        !           916: 
        !           917:     case TY_IMPLICIT:
        !           918:        d = decode_T1_Impl__Tags(pe, 1, NULLVP, NULLCP, parm);
        !           919:        break;
        !           920: 
        !           921:     case TY_EXPLICIT:
        !           922:        d = decode_T1_Expl__Tags(pe, 1, NULLVP, NULLCP, parm);
        !           923:        break;
        !           924: 
        !           925:     case TY_EXTERNAL:
        !           926:        d = decode_T1_E__ref(pe, 1, NULLVP, NULLCP, parm);
        !           927:        break;
        !           928:     default:
        !           929:        ferrd(1, "decode:unknown type\n", tynum);
        !           930:     }
        !           931:     if (d == NOTOK) {
        !           932:            (void) printf("decode:failed on %s\n", t_case[tynum].tst_name);
        !           933:            exit(2);
        !           934:     }
        !           935: }
        !           936: #endif
        !           937: 
        !           938: /*
        !           939:  * compare two structures for differences of fields indicating an
        !           940:  * error
        !           941:  */
        !           942: tcmp(tynum, parm1, parm2)
        !           943: int    tynum;
        !           944: char   *parm1, *parm2;
        !           945: {
        !           946:     int        d;
        !           947:     d = 0;
        !           948: 
        !           949:     switch (tynum) {
        !           950:     case TY_MPDU:
        !           951: #define Xparm1 ((struct type_T1_MPDU *)parm1)
        !           952: #define Xparm2 ((struct type_T1_MPDU *)parm2)
        !           953:        if (Xparm1->a__seq && !Xparm2->a__seq
        !           954:          || !Xparm1->a__seq && Xparm2->a__seq) {
        !           955:            (void) printf("a__seq missing/present\n");
        !           956:            d++;
        !           957:        }
        !           958:        if (Xparm1->a__seq && Xparm2->a__seq) {
        !           959:            if (Xparm1->a__seq->fred != Xparm2->a__seq->fred) {
        !           960:                (void) printf("%s->a__seq->fred %d != %d\n",  
        !           961:                    Xparm1->a__seq->fred, Xparm2->a__seq->fred);
        !           962:                d++;
        !           963:            }
        !           964:            if (Xparm1->a__seq->george != Xparm2->a__seq->george) {
        !           965:                (void) printf("%s a__seq->george %d != %d\n", t_case[tynum].tst_name,
        !           966:                    Xparm1->a__seq->george, Xparm2->a__seq->george);
        !           967:                d++;
        !           968:            }
        !           969:        }
        !           970:        break;
        !           971: #undef Xparm1
        !           972: #undef Xparm2
        !           973: 
        !           974:     case TY_EMBEDDED:
        !           975: #define Xparm1 ((struct type_T1_Embedded *)parm1)
        !           976: #define Xparm2 ((struct type_T1_Embedded *)parm2)
        !           977:        if (Xparm1->anMPDU && !Xparm2->anMPDU ||!Xparm1->anMPDU && Xparm2->anMPDU) {
        !           978:            (void) printf("anMPDU missing/present\n");
        !           979:            d++;
        !           980:        }
        !           981:        if (Xparm1->anMPDU && Xparm2->anMPDU) {
        !           982:                d += tcmp(TY_MPDU, (char *)Xparm1->anMPDU, (char *)Xparm2->anMPDU);
        !           983:        }
        !           984:        if (Xparm1->ei != Xparm2->ei) {
        !           985:            (void) printf("%s ei %d != %d\n",  
        !           986:                t_case[tynum].tst_name, Xparm1->ei, Xparm2->ei);
        !           987:            d++;
        !           988:        }
        !           989:        break;
        !           990: #undef Xparm1
        !           991: #undef Xparm2
        !           992: 
        !           993:     case TY_STRINGS:
        !           994: #define Xparm1 ((struct type_T1_Strings *)parm1)
        !           995: #define Xparm2 ((struct type_T1_Strings *)parm2)
        !           996:        if (qb_cmp(Xparm1->ostring, Xparm2->ostring)) {
        !           997:                (void) printf("ostring octet string different\n");
        !           998:                d++;
        !           999:        }
        !          1000:        if (bit_cmp(Xparm1->bstring, Xparm2->bstring)) {
        !          1001:            (void) printf("bstring bitstring different\n");
        !          1002:            d++;
        !          1003:        }
        !          1004:        if (qb_cmp(Xparm1->nstring, Xparm2->nstring)) {
        !          1005:                (void) printf("nstring octet string different\n");
        !          1006:                d++;
        !          1007:        }
        !          1008:        if (qb_cmp(Xparm1->pstring, Xparm2->pstring)) {
        !          1009:                (void) printf("pstring octet string different\n");
        !          1010:                d++;
        !          1011:        }
        !          1012:        if (qb_cmp(Xparm1->tstring, Xparm2->tstring)) {
        !          1013:                (void) printf("tstring octet string different\n");
        !          1014:                d++;
        !          1015:        }
        !          1016:        if (qb_cmp(Xparm1->t61string, Xparm2->t61string)) {
        !          1017:                (void) printf("t61string octet string different\n");
        !          1018:                d++;
        !          1019:        }
        !          1020:        if (qb_cmp(Xparm1->vstring, Xparm2->vstring)) {
        !          1021:                (void) printf("vstring octet string different\n");
        !          1022:                d++;
        !          1023:        }
        !          1024:        if (qb_cmp(Xparm1->vis__string, Xparm2->vis__string)) {
        !          1025:                (void) printf("vis__string octet string different\n");
        !          1026:                d++;
        !          1027:        }
        !          1028:        if (qb_cmp(Xparm1->i646string, Xparm2->i646string)) {
        !          1029:                (void) printf("i646string octet string different\n");
        !          1030:                d++;
        !          1031:        }
        !          1032:        if (qb_cmp(Xparm1->ia5string, Xparm2->ia5string)) {
        !          1033:                (void) printf("ia5string octet string different\n");
        !          1034:                d++;
        !          1035:        }
        !          1036:        if (qb_cmp(Xparm1->graphstring, Xparm2->graphstring)) {
        !          1037:                (void) printf("graphstring octet string different\n");
        !          1038:                d++;
        !          1039:        }
        !          1040:        if (qb_cmp(Xparm1->genstring, Xparm2->genstring)) {
        !          1041:                (void) printf("genstring octet string different\n");
        !          1042:                d++;
        !          1043:        }
        !          1044:        break;
        !          1045: #undef Xparm1
        !          1046: #undef Xparm2
        !          1047: 
        !          1048:     case TY_EMB_STRINGS:
        !          1049: #define Xparm1 ((struct type_T1_Emb__Strings *)parm1)
        !          1050: #define Xparm2 ((struct type_T1_Emb__Strings *)parm2)
        !          1051:        if (qb_cmp(Xparm1->btest, Xparm2->btest)) {
        !          1052:                (void) printf("btest octet string different\n");
        !          1053:                d++;
        !          1054:        }
        !          1055:        if (bit_cmp(Xparm1->ctest, Xparm2->ctest)) {
        !          1056:            (void) printf("ctest bitstring different\n");
        !          1057:            d++;
        !          1058:        }
        !          1059:        if (Xparm1->atest != Xparm2->atest) {
        !          1060:                (void) printf("atest integers different\n");
        !          1061:                d++;
        !          1062:        }
        !          1063:        if (Xparm1->big__test && Xparm2->big__test) {
        !          1064:                d += tcmp(TY_STRINGS, (char *)Xparm1->big__test, (char *)Xparm2->big__test);
        !          1065:        } else if (Xparm1->big__test || Xparm2->big__test) {
        !          1066:                (void) printf("big__test one Strings missing!\n");
        !          1067:                d++;
        !          1068:        }
        !          1069:        if (qb_cmp(Xparm1->emb__test->em__oct, Xparm2->emb__test->em__oct)) {
        !          1070:                (void) printf("emb__test->em__oct octet string different\n");
        !          1071:                d++;
        !          1072:        }
        !          1073:        if (bit_cmp(Xparm1->emb__test->em__bit, Xparm2->emb__test->em__bit)) {
        !          1074:            (void) printf("emb__test->em__bit bitstring different\n");
        !          1075:            d++;
        !          1076:        }
        !          1077:        if (Xparm1->emb__test->em__int != Xparm2->emb__test->em__int) {
        !          1078:                (void) printf("emb__test->em__int integers different\n");
        !          1079:                d++;
        !          1080:        }
        !          1081:        break;
        !          1082: #undef Xparm1
        !          1083: #undef Xparm2
        !          1084: 
        !          1085:     case TY_IMPLICIT:
        !          1086: #define Xparm1 ((struct type_T1_Impl__Tags *)parm1)
        !          1087: #define Xparm2 ((struct type_T1_Impl__Tags *)parm2)
        !          1088:        if (qb_cmp(Xparm1->o__impl, Xparm2->o__impl)) {
        !          1089:                (void) printf("o__impl octet string different\n");
        !          1090:                d++;
        !          1091:        }
        !          1092:        if (bit_cmp(Xparm1->b__impl, Xparm2->b__impl)) {
        !          1093:            (void) printf("b__impl bitstring different\n");
        !          1094:            d++;
        !          1095:        }
        !          1096:        if (Xparm1->i__impl != Xparm2->i__impl) {
        !          1097:                (void) printf("i__impl integers different\n");
        !          1098:                d++;
        !          1099:        }
        !          1100:        if (Xparm1->obj__impl && Xparm2->obj__impl) {
        !          1101:                d += tcmp(TY_EMB_STRINGS, (char *)Xparm1->obj__impl, (char *)Xparm2->obj__impl);
        !          1102:        } else if (Xparm1->obj__impl || Xparm2->obj__impl) {
        !          1103:                (void) printf("obj__impl one Embedded Strings missing!\n");
        !          1104:                d++;
        !          1105:        }
        !          1106:        if (qb_cmp(Xparm1->i__emb__test->i__em__oct, Xparm2->i__emb__test->i__em__oct)) {
        !          1107:                (void) printf("i__emb__test->i__em__oct octet string different\n");
        !          1108:                d++;
        !          1109:        }
        !          1110:        if (bit_cmp(Xparm1->i__emb__test->i__em__bit, Xparm2->i__emb__test->i__em__bit)) {
        !          1111:            (void) printf("i__emb__test->i__em__bit bitstring different\n");
        !          1112:            d++;
        !          1113:        }
        !          1114:        if (Xparm1->i__emb__test->i__em__int != Xparm2->i__emb__test->i__em__int) {
        !          1115:                (void) printf("i__emb__test->i__em__int integers different\n");
        !          1116:                d++;
        !          1117:        }
        !          1118: #undef Xparm1
        !          1119: #undef Xparm2
        !          1120:        break;
        !          1121:        
        !          1122:     case TY_EXPLICIT:
        !          1123: #define Xparm1 ((struct type_T1_Expl__Tags *)parm1)
        !          1124: #define Xparm2 ((struct type_T1_Expl__Tags *)parm2)
        !          1125:        if (qb_cmp(Xparm1->o__expl, Xparm2->o__expl)) {
        !          1126:                (void) printf("o__expl octet string different\n");
        !          1127:                d++;
        !          1128:        }
        !          1129:        if (bit_cmp(Xparm1->b__expl, Xparm2->b__expl)) {
        !          1130:            (void) printf("b__expl bitstring different\n");
        !          1131:            d++;
        !          1132:        }
        !          1133:        if (Xparm1->i__expl != Xparm2->i__expl) {
        !          1134:                (void) printf("i__expl integers different\n");
        !          1135:                d++;
        !          1136:        }
        !          1137:        if (Xparm1->obj__expl && Xparm2->obj__expl) {
        !          1138:                d += tcmp(TY_EMB_STRINGS, (char *)Xparm1->obj__expl, (char *)Xparm2->obj__expl);
        !          1139:        } else if (Xparm1->obj__expl || Xparm2->obj__expl) {
        !          1140:                (void) printf("obj__expl one Embedded Strings missing!\n");
        !          1141:                d++;
        !          1142:        }
        !          1143:        if (qb_cmp(Xparm1->i__exp__test->i__ex__oct, Xparm2->i__exp__test->i__ex__oct)) {
        !          1144:                (void) printf("i__exp__test->i__ex__oct octet string different\n");
        !          1145:                d++;
        !          1146:        }
        !          1147:        if (bit_cmp(Xparm1->i__exp__test->i__ex__bit, Xparm2->i__exp__test->i__ex__bit)) {
        !          1148:            (void) printf("i__exp__test->i__ex__bit bitstring different\n");
        !          1149:            d++;
        !          1150:        }
        !          1151:        if (Xparm1->i__exp__test->i__ex__int != Xparm2->i__exp__test->i__ex__int) {
        !          1152:                (void) printf("i__exp__test->i__ex__int integers different\n");
        !          1153:                d++;
        !          1154:        }
        !          1155: #undef Xparm1
        !          1156: #undef Xparm2
        !          1157:        break;
        !          1158:        
        !          1159: 
        !          1160:     case TY_SEQOF:
        !          1161: #define Xparm1 ((struct type_T1_Seqof__Test *)parm1)
        !          1162: #define Xparm2 ((struct type_T1_Seqof__Test *)parm2)
        !          1163:     if (Xparm1->sqof__test1 && Xparm2->sqof__test1) {
        !          1164:        d += tcmp(TY_ELEMENT4, (char *)Xparm1->sqof__test1, (char *)Xparm2->sqof__test1);
        !          1165:     } else if (Xparm1->sqof__test1 || Xparm2->sqof__test1) {
        !          1166:        (void) printf("sqof__test1 one missing");
        !          1167:        d++;
        !          1168:     }
        !          1169:     if (Xparm1->stof__test1 && Xparm2->stof__test1) {
        !          1170:        d += tcmp(TY_MEMBER2, (char *)Xparm1->stof__test1, (char *)Xparm2->stof__test1);
        !          1171:     } else if (Xparm1->stof__test1 || Xparm2->stof__test1) {
        !          1172:        (void) printf("stof__test1 one missing");
        !          1173:        d++;
        !          1174:     }
        !          1175:     if (Xparm1->i__test1 != Xparm2->i__test1) {
        !          1176:        (void) printf("i__test1 integers different\n");
        !          1177:        d++;
        !          1178:     }
        !          1179:     if (Xparm1->sqof__test2 && Xparm2->sqof__test2) {
        !          1180:        d += tcmp(TY_ELEMENT6, (char *)Xparm1->sqof__test2, (char *)Xparm2->sqof__test2);
        !          1181:     } else if (Xparm1->sqof__test2 || Xparm2->sqof__test2) {
        !          1182:        (void) printf("sqof__test2 one missing");
        !          1183:        d++;
        !          1184:     }
        !          1185:     if (Xparm1->stof__test2 && Xparm2->stof__test2) {
        !          1186:        d += tcmp(TY_MEMBER4, (char *)Xparm1->stof__test2, (char *)Xparm2->stof__test2);
        !          1187:     } else if (Xparm1->stof__test2 || Xparm2->stof__test2) {
        !          1188:        (void) printf("stof__test2 one missing");
        !          1189:        d++;
        !          1190:     }
        !          1191:     if (Xparm1->i__test2 != Xparm2->i__test2) {
        !          1192:        (void) printf("i__test2 integers different\n");
        !          1193:        d++;
        !          1194:     }
        !          1195:     break;
        !          1196: #undef Xparm1
        !          1197: #undef Xparm2
        !          1198:        
        !          1199:     case TY_ELEMENT4:
        !          1200: #define Xparm1 ((struct element_T1_4 *)parm1)
        !          1201: #define Xparm2 ((struct element_T1_4 *)parm2)
        !          1202:     if (Xparm1->element_T1_5 && Xparm2->element_T1_5) {
        !          1203:        d += tcmp(TY_EXPLICIT, (char *)Xparm1->element_T1_5, (char *)Xparm2->element_T1_5);
        !          1204:     } else if (Xparm1->element_T1_5 || Xparm2->element_T1_5) {
        !          1205:        (void) printf("element_T1_5 one missing");
        !          1206:        d++;
        !          1207:     }
        !          1208:     if (Xparm1->next && Xparm2->next) {
        !          1209:        d += tcmp(TY_ELEMENT4, (char *)Xparm1->next, (char *)Xparm2->next);
        !          1210:     } else if (Xparm1->next || Xparm2->next) {
        !          1211:        (void) printf("%s: next one missing", t_case[tynum].tst_name);
        !          1212:        d++;
        !          1213:     }
        !          1214:     break;
        !          1215: #undef Xparm1
        !          1216: #undef Xparm2
        !          1217:        
        !          1218:     case TY_MEMBER2:
        !          1219: #define Xparm1 ((struct member_T1_2 *)parm1)
        !          1220: #define Xparm2 ((struct member_T1_2 *)parm2)
        !          1221:     if (Xparm1->member_T1_3 && Xparm2->member_T1_3) {
        !          1222:        d += tcmp(TY_EXPLICIT, (char *)Xparm1->member_T1_3, (char *)Xparm2->member_T1_3);
        !          1223:     } else if (Xparm1->member_T1_3 || Xparm2->member_T1_3) {
        !          1224:        (void) printf("%s: member_T1_3 one missing", t_case[tynum].tst_name);
        !          1225:        d++;
        !          1226:     }
        !          1227:     if (Xparm1->next && Xparm2->next) {
        !          1228:        d += tcmp(TY_MEMBER2, (char *)Xparm1->next, (char *)Xparm2->next);
        !          1229:     } else if (Xparm1->next || Xparm2->next) {
        !          1230:        (void) printf("%s: next one missing", t_case[tynum].tst_name);
        !          1231:        d++;
        !          1232:     }
        !          1233:     break;
        !          1234: #undef Xparm1
        !          1235: #undef Xparm2
        !          1236: 
        !          1237:     case TY_ELEMENT6:
        !          1238: #define Xparm1 ((struct element_T1_6 *)parm1)
        !          1239: #define Xparm2 ((struct element_T1_6 *)parm2)
        !          1240:     if (Xparm1->element_T1_7 && Xparm2->element_T1_7) {
        !          1241:        d += tcmp(TY_ELEMENT8, (char *)Xparm1->element_T1_7, (char *)Xparm2->element_T1_7);
        !          1242:     } else if (Xparm1->element_T1_7 || Xparm2->element_T1_7) {
        !          1243:        (void) printf("%s: element_T1_7 one missing", t_case[tynum].tst_name);
        !          1244:        d++;
        !          1245:     }
        !          1246:     if (Xparm1->next && Xparm2->next) {
        !          1247:        d += tcmp(TY_ELEMENT6, (char *)Xparm1->next, (char *)Xparm2->next);
        !          1248:     } else if (Xparm1->next || Xparm2->next) {
        !          1249:        (void) printf("%s: next one missing", t_case[tynum].tst_name);
        !          1250:        d++;
        !          1251:     }
        !          1252:     break;
        !          1253: #undef Xparm1
        !          1254: #undef Xparm2
        !          1255: 
        !          1256:     case TY_ELEMENT8:
        !          1257: #define Xparm1 ((struct element_T1_8 *)parm1)
        !          1258: #define Xparm2 ((struct element_T1_8 *)parm2)
        !          1259:     if (Xparm1->sqof__in && Xparm2->sqof__in) {
        !          1260:        d += tcmp(TY_EXPLICIT, (char *)Xparm1->sqof__in, (char *)Xparm2->sqof__in);
        !          1261:     } else if (Xparm1->sqof__in || Xparm2->sqof__in) {
        !          1262:        (void) printf("%s: sqof__in one missing", t_case[tynum].tst_name);
        !          1263:        d++;
        !          1264:     }
        !          1265:     if (Xparm1->sqof__i != Xparm2->sqof__i) {
        !          1266:        (void) printf("sqof__i integers different\n");
        !          1267:        d++;
        !          1268:     }
        !          1269:     if (qb_cmp(Xparm1->sqof__o, Xparm2->sqof__o)) {
        !          1270:        (void) printf("sqof__o octet string different\n");
        !          1271:        d++;
        !          1272:     }
        !          1273:     break;
        !          1274: #undef Xparm1
        !          1275: #undef Xparm2
        !          1276: 
        !          1277:     case TY_MEMBER4:
        !          1278: #define Xparm1 ((struct member_T1_4 *)parm1)
        !          1279: #define Xparm2 ((struct member_T1_4 *)parm2)
        !          1280:     if (Xparm1->member_T1_5 && Xparm2->member_T1_5) {
        !          1281:        d += tcmp(TY_ELEMENT9, (char *)Xparm1->member_T1_5, (char *)Xparm2->member_T1_5);
        !          1282:     } else if (Xparm1->member_T1_5 || Xparm2->member_T1_5) {
        !          1283:        (void) printf("%s: member_T1_5 one missing", t_case[tynum].tst_name);
        !          1284:        d++;
        !          1285:     }
        !          1286:     if (Xparm1->next && Xparm2->next) {
        !          1287:        d += tcmp(TY_MEMBER4, (char *)Xparm1->next, (char *)Xparm2->next);
        !          1288:     } else if (Xparm1->next || Xparm2->next) {
        !          1289:        (void) printf("%s: next one missing", t_case[tynum].tst_name);
        !          1290:        d++;
        !          1291:     }
        !          1292:     break;
        !          1293: #undef Xparm1
        !          1294: #undef Xparm2
        !          1295: 
        !          1296:     case TY_ELEMENT9:
        !          1297: #define Xparm1 ((struct element_T1_9 *)parm1)
        !          1298: #define Xparm2 ((struct element_T1_9 *)parm2)
        !          1299:     if (Xparm1->stof__in && Xparm2->stof__in) {
        !          1300:        d += tcmp(TY_EXPLICIT, (char *)Xparm1->stof__in, (char *)Xparm2->stof__in);
        !          1301:     } else if (Xparm1->stof__in || Xparm2->stof__in) {
        !          1302:        (void) printf("%s: stof__in one missing", t_case[tynum].tst_name);
        !          1303:        d++;
        !          1304:     }
        !          1305:     if (Xparm1->stof__i != Xparm2->stof__i) {
        !          1306:        (void) printf("stof__i integers different\n");
        !          1307:        d++;
        !          1308:     }
        !          1309:     if (qb_cmp(Xparm1->stof__o, Xparm2->stof__o)) {
        !          1310:        (void) printf("stof__o octet string different\n");
        !          1311:        d++;
        !          1312:     }
        !          1313:     break;
        !          1314: #undef Xparm1
        !          1315: #undef Xparm2
        !          1316: 
        !          1317:     case TY_CHOICE:
        !          1318: #define Xparm1 ((struct type_T1_Choice__Test *)parm1)
        !          1319: #define Xparm2 ((struct type_T1_Choice__Test *)parm2)
        !          1320:     if (Xparm1->c1 && Xparm2->c1) {
        !          1321:        d += tcmp(TY_CHOICE0, (char *)Xparm1->c1, (char *)Xparm2->c1);
        !          1322:     } else if (Xparm1->c1 || Xparm2->c1) {
        !          1323:        (void) printf("%s: c1 one missing", t_case[tynum].tst_name);
        !          1324:        d++;
        !          1325:     }
        !          1326:     if (Xparm1->c2 && Xparm2->c2) {
        !          1327:        d += tcmp(TY_CHOICE1, (char *)Xparm1->c2, (char *)Xparm2->c2);
        !          1328:     } else if (Xparm1->c2 || Xparm2->c2) {
        !          1329:        (void) printf("%s: c2 one missing", t_case[tynum].tst_name);
        !          1330:        d++;
        !          1331:     }
        !          1332:     if (Xparm1->c3 && Xparm2->c3) {
        !          1333:        d += tcmp(TY_CHOICE2, (char *)Xparm1->c3, (char *)Xparm2->c3);
        !          1334:     } else if (Xparm1->c3 || Xparm2->c3) {
        !          1335:        (void) printf("%s: c3 one missing", t_case[tynum].tst_name);
        !          1336:        d++;
        !          1337:     }
        !          1338:     if (Xparm1->c4 && Xparm2->c4) {
        !          1339:        d += tcmp(TY_ELEMENT11, (char *)Xparm1->c4, (char *)Xparm2->c4);
        !          1340:     } else if (Xparm1->c4 || Xparm2->c4) {
        !          1341:        (void) printf("%s: c4 one missing", t_case[tynum].tst_name);
        !          1342:        d++;
        !          1343:     }
        !          1344:     break;
        !          1345: #undef Xparm1
        !          1346: #undef Xparm2
        !          1347: 
        !          1348:     case TY_CHOICE0:
        !          1349: #define Xparm1 ((struct choice_T1_0 *)parm1)
        !          1350: #define Xparm2 ((struct choice_T1_0 *)parm2)
        !          1351:        if (Xparm1->offset != Xparm2->offset) {
        !          1352:            d++;
        !          1353:            (void) printf("%s: offset mismatch %d != %d\n", t_case[tynum].tst_name,
        !          1354:                Xparm1->offset, Xparm2->offset);
        !          1355:            break;
        !          1356:        }
        !          1357:        switch (Xparm1->offset) {
        !          1358:        case choice_T1_0_i__c1:
        !          1359:            if (Xparm1->un.i__c1 != Xparm2->un.i__c1) {
        !          1360:                d++;
        !          1361:                (void) printf("%s: i__c1 mismatch %d != %d", t_case[tynum].tst_name,
        !          1362:                    Xparm1->un.i__c1, Xparm2->un.i__c1);
        !          1363:            }
        !          1364:            break;
        !          1365:        
        !          1366:        case choice_T1_0_o__c1:
        !          1367:            if (qb_cmp(Xparm1->un.o__c1, Xparm2->un.o__c1)) {
        !          1368:                (void) printf("o__c1 octet string different\n");
        !          1369:                d++;
        !          1370:            }
        !          1371:            break;
        !          1372:        
        !          1373:        case choice_T1_0_b__c1:
        !          1374:            if (bit_cmp(Xparm1->un.b__c1, Xparm2->un.b__c1)) {
        !          1375:                (void) printf("un.b__c1 bitstring different\n");
        !          1376:                d++;
        !          1377:            }
        !          1378:            break;
        !          1379:        
        !          1380:        case choice_T1_0_f__c1:
        !          1381:            if (Xparm1->un.f__c1 && !Xparm2->un.f__c1
        !          1382:              || !Xparm1->un.f__c1 && Xparm2->un.f__c1) {
        !          1383:                (void) printf("f__c1 Boolean different\n");
        !          1384:                d++;
        !          1385:            }
        !          1386:            break;
        !          1387:        
        !          1388:        case choice_T1_0_obj__c1:
        !          1389:            if (Xparm1->un.obj__c1 && Xparm2->un.obj__c1) {
        !          1390:                d += tcmp(TY_EMB_STRINGS, (char *)Xparm1->un.obj__c1,
        !          1391:                  (char *)Xparm2->un.obj__c1);
        !          1392:            } else if (Xparm1->un.obj__c1 || Xparm2->un.obj__c1) {
        !          1393:                (void) printf("%s: un.obj__c1 one missing", t_case[tynum].tst_name);
        !          1394:                d++;
        !          1395:            }
        !          1396:            break;
        !          1397:        
        !          1398:        default:
        !          1399:            ferrd(1, "TY_CHOICE0:illegal offset %d\n", Xparm1->offset);
        !          1400:        }
        !          1401:        break;
        !          1402: #undef Xparm1
        !          1403: #undef Xparm2
        !          1404: 
        !          1405:     case TY_CHOICE1:
        !          1406: #define Xparm1 ((struct choice_T1_1 *)parm1)
        !          1407: #define Xparm2 ((struct choice_T1_1 *)parm2)
        !          1408:        
        !          1409:        if (Xparm1->offset != Xparm2->offset) {
        !          1410:            d++;
        !          1411:            (void) printf("%s: offset mismatch %d != %d\n", t_case[tynum].tst_name,
        !          1412:                Xparm1->offset, Xparm2->offset);
        !          1413:            break;
        !          1414:        }
        !          1415:        switch (Xparm1->offset) {
        !          1416:        case choice_T1_1_i__c2:
        !          1417:            if (Xparm1->un.i__c2 != Xparm2->un.i__c2) {
        !          1418:                d++;
        !          1419:                (void) printf("%s: i__c2 mismatch %d != %d", t_case[tynum].tst_name,
        !          1420:                    Xparm1->un.i__c2, Xparm2->un.i__c2);
        !          1421:            }
        !          1422:            break;
        !          1423:        
        !          1424:        case choice_T1_1_o__c2:
        !          1425:            if (qb_cmp(Xparm1->un.o__c2, Xparm2->un.o__c2)) {
        !          1426:                (void) printf("o__c2 octet string different\n");
        !          1427:                d++;
        !          1428:            }
        !          1429:            break;
        !          1430:        
        !          1431:        case choice_T1_1_b__c2:
        !          1432:            if (bit_cmp(Xparm1->un.b__c2, Xparm2->un.b__c2)) {
        !          1433:                (void) printf("un.b__c2 bitstring different\n");
        !          1434:                d++;
        !          1435:            }
        !          1436:            break;
        !          1437:        
        !          1438:        case choice_T1_1_f__c2:
        !          1439:            if (Xparm1->un.f__c2 && !Xparm2->un.f__c2
        !          1440:              || !Xparm1->un.f__c2 && Xparm2->un.f__c2) {
        !          1441:                d++;
        !          1442:                (void) printf("%s: f__c2 mismatch %d != %d", t_case[tynum].tst_name,
        !          1443:                    Xparm1->un.f__c2, Xparm2->un.f__c2);
        !          1444:            }
        !          1445:            break;
        !          1446:        
        !          1447:        case choice_T1_1_obj__c2:
        !          1448:            if (Xparm1->un.obj__c2 && Xparm2->un.obj__c2) {
        !          1449:                d += tcmp(TY_EMB_STRINGS, (char *)Xparm1->un.obj__c2,
        !          1450:                  (char *)Xparm2->un.obj__c2);
        !          1451:            } else if (Xparm1->un.obj__c2 || Xparm2->un.obj__c2) {
        !          1452:                (void) printf("%s: un.obj__c2 one missing", t_case[tynum].tst_name);
        !          1453:                d++;
        !          1454:            }
        !          1455:            break;
        !          1456:        
        !          1457:        default:
        !          1458:            ferrd(1, "TY_CHOICE1:illegal offset %d\n", Xparm1->offset);
        !          1459:        }
        !          1460:        break;
        !          1461: #undef Xparm1
        !          1462: #undef Xparm2
        !          1463: 
        !          1464:     case TY_CHOICE2:
        !          1465: #define Xparm1 ((struct choice_T1_2 *)parm1)
        !          1466: #define Xparm2 ((struct choice_T1_2 *)parm2)
        !          1467:        
        !          1468:        switch (Xparm1->offset) {
        !          1469:        case choice_T1_2_i__c3:
        !          1470:            if (Xparm1->un.i__c3 != Xparm2->un.i__c3) {
        !          1471:                d++;
        !          1472:                (void) printf("%s: i__c3 mismatch %d != %d", t_case[tynum].tst_name,
        !          1473:                    Xparm1->un.i__c3, Xparm2->un.i__c3);
        !          1474:            }
        !          1475:            break;
        !          1476:        
        !          1477:        case choice_T1_2_seq__c3:
        !          1478:            if (Xparm1->un.seq__c3 && Xparm2->un.seq__c3) {
        !          1479:                d += tcmp(TY_ELEMENT10, (char *)Xparm1->un.seq__c3, (char *)Xparm2->un.seq__c3);
        !          1480:            } else if (Xparm1->un.seq__c3 || Xparm2->un.seq__c3) {
        !          1481:                (void) printf("%s: un.seq__c3 one missing", t_case[tynum].tst_name);
        !          1482:                d++;
        !          1483:            }
        !          1484:            break;
        !          1485:        
        !          1486:        case choice_T1_2_set__c3:
        !          1487:            if (Xparm1->un.set__c3 && Xparm2->un.set__c3) {
        !          1488:                d += tcmp(TY_MEMBER6, (char *)Xparm1->un.set__c3, (char *)Xparm2->un.set__c3);
        !          1489:            } else if (Xparm1->un.set__c3 || Xparm2->un.set__c3) {
        !          1490:                (void) printf("%s: un.set__c3 one missing", t_case[tynum].tst_name);
        !          1491:                d++;
        !          1492:            }
        !          1493:            break;
        !          1494:        
        !          1495:        default:
        !          1496:            ferrd(1, "TY_CHOICE2:illegal offset %d\n", Xparm1->offset);
        !          1497:        }
        !          1498:        break;
        !          1499: #undef Xparm1
        !          1500: #undef Xparm2
        !          1501: 
        !          1502:     case TY_CHOICE3:
        !          1503: #define Xparm1 ((struct choice_T1_3 *)parm1)
        !          1504: #define Xparm2 ((struct choice_T1_3 *)parm2)
        !          1505:        
        !          1506:        switch (Xparm1->offset) {
        !          1507:        case choice_T1_3_sc__a__i:
        !          1508:            if (Xparm1->un.sc__a__i != Xparm2->un.sc__a__i) {
        !          1509:                d++;
        !          1510:                (void) printf("%s: sc__a__i mismatch %d != %d", t_case[tynum].tst_name,
        !          1511:                    Xparm1->un.sc__a__i, Xparm2->un.sc__a__i);
        !          1512:            }
        !          1513:            break;
        !          1514:        
        !          1515:        case choice_T1_3_sc__b__i:
        !          1516:            if (Xparm1->un.sc__b__i != Xparm2->un.sc__b__i) {
        !          1517:                d++;
        !          1518:                (void) printf("%s: sc__b__i mismatch %d != %d", t_case[tynum].tst_name,
        !          1519:                    Xparm1->un.sc__b__i, Xparm2->un.sc__b__i);
        !          1520:            }
        !          1521:            break;
        !          1522:        
        !          1523:        case choice_T1_3_c4__i:
        !          1524:            if (Xparm1->un.c4__i != Xparm2->un.c4__i) {
        !          1525:                d++;
        !          1526:                (void) printf("%s: c4__i mismatch %d != %d", t_case[tynum].tst_name,
        !          1527:                    Xparm1->un.c4__i, Xparm2->un.c4__i);
        !          1528:            }
        !          1529:            break;
        !          1530:        
        !          1531:        case choice_T1_3_c4__obj:
        !          1532:            if (Xparm1->un.c4__obj && Xparm2->un.c4__obj) {
        !          1533:                d += tcmp(TY_EXPLICIT, (char *)Xparm1->un.c4__obj, (char *)Xparm2->un.c4__obj);
        !          1534:            } else if (Xparm1->un.c4__obj || Xparm2->un.c4__obj) {
        !          1535:                (void) printf("%s: un.c4__obj one missing", t_case[tynum].tst_name);
        !          1536:                d++;
        !          1537:            }
        !          1538:            break;
        !          1539:        
        !          1540:        default:
        !          1541:            ferrd(1, "TY_CHOICE3:illegal offset %d\n", Xparm1->offset);
        !          1542:        }
        !          1543:        break;
        !          1544: #undef Xparm1
        !          1545: #undef Xparm2
        !          1546: 
        !          1547:     case TY_ELEMENT10:
        !          1548: #define Xparm1 ((struct element_T1_10 *)parm1)
        !          1549: #define Xparm2 ((struct element_T1_10 *)parm2)
        !          1550:        if (Xparm1->seq__c3__in && Xparm2->seq__c3__in) {
        !          1551:            d += tcmp(TY_EXPLICIT, (char *)Xparm1->seq__c3__in, (char *)Xparm2->seq__c3__in);
        !          1552:        } else if (Xparm1->seq__c3__in || Xparm2->seq__c3__in) {
        !          1553:            (void) printf("%s: seq__c3__in one missing", t_case[tynum].tst_name);
        !          1554:            d++;
        !          1555:        }
        !          1556:        if (Xparm1->seq__c3__i != Xparm2->seq__c3__i) {
        !          1557:            d++;
        !          1558:            (void) printf("%s: seq__c3__i mismatch %d != %d", t_case[tynum].tst_name,
        !          1559:                Xparm1->seq__c3__i, Xparm2->seq__c3__i);
        !          1560:        }
        !          1561:        if (qb_cmp(Xparm1->seq__c3__o, Xparm2->seq__c3__o)) {
        !          1562:            (void) printf("seq__c3__o octet string different\n");
        !          1563:            d++;
        !          1564:        }
        !          1565:        break;
        !          1566: #undef Xparm1
        !          1567: #undef Xparm2
        !          1568: 
        !          1569:     case TY_MEMBER6:
        !          1570: #define Xparm1 ((struct member_T1_6 *)parm1)
        !          1571: #define Xparm2 ((struct member_T1_6 *)parm2)
        !          1572:        if (Xparm1->set__c3__in && Xparm2->set__c3__in) {
        !          1573:            d += tcmp(TY_EXPLICIT, (char *)Xparm1->set__c3__in, (char *)Xparm2->set__c3__in);
        !          1574:        } else if (Xparm1->set__c3__in || Xparm2->set__c3__in) {
        !          1575:            (void) printf("%s: set__c3__in one missing", t_case[tynum].tst_name);
        !          1576:            d++;
        !          1577:        }
        !          1578:        if (Xparm1->set__c3__i != Xparm2->set__c3__i) {
        !          1579:            d++;
        !          1580:            (void) printf("%s: set__c3__i mismatch %d != %d", t_case[tynum].tst_name,
        !          1581:                Xparm1->set__c3__i, Xparm2->set__c3__i);
        !          1582:        }
        !          1583:        if (qb_cmp(Xparm1->set__c3__o, Xparm2->set__c3__o)) {
        !          1584:            (void) printf("set__c3__o octet string different\n");
        !          1585:            d++;
        !          1586:        }
        !          1587:        break;
        !          1588: #undef Xparm1
        !          1589: #undef Xparm2
        !          1590: 
        !          1591:     case TY_ELEMENT11:
        !          1592: #define Xparm1 ((struct element_T1_11 *)parm1)
        !          1593: #define Xparm2 ((struct element_T1_11 *)parm2)
        !          1594:        if (Xparm1->c4__choice && Xparm2->c4__choice) {
        !          1595:            d += tcmp(TY_CHOICE3, (char *)Xparm1->c4__choice, (char *)Xparm2->c4__choice);
        !          1596:        } else if (Xparm1->c4__choice || Xparm2->c4__choice) {
        !          1597:            (void) printf("%s: c4__choice one missing", t_case[tynum].tst_name);
        !          1598:            d++;
        !          1599:        }
        !          1600:        break;
        !          1601: #undef Xparm1
        !          1602: #undef Xparm2
        !          1603: 
        !          1604:     case TY_OPTIONAL:
        !          1605: #define Xparm1 ((struct type_T1_Opt__Strings *)parm1)
        !          1606: #define Xparm2 ((struct type_T1_Opt__Strings *)parm2)
        !          1607:         if (Xparm1->optionals & opt_T1_Opt__Strings_a__opt) {
        !          1608:            if (Xparm1->a__opt != Xparm2->a__opt) {
        !          1609:                d++;
        !          1610:                (void) printf("%s: a__opt mismatch %d != %d", t_case[tynum].tst_name,
        !          1611:                    Xparm1->a__opt, Xparm2->a__opt);
        !          1612:            }
        !          1613:        }
        !          1614:         if (Xparm1->optionals & opt_T1_Opt__Strings_d__opt) {
        !          1615:            if (Xparm1->d__opt && !Xparm2->d__opt
        !          1616:              || !Xparm1->d__opt && Xparm2->d__opt) {
        !          1617:                d++;
        !          1618:                (void) printf("%s: d__opt mismatch %d != %d", t_case[tynum].tst_name,
        !          1619:                    Xparm1->d__opt, Xparm2->d__opt);
        !          1620:            }
        !          1621:        }
        !          1622:        if (Xparm1->b__opt != NULLQB && Xparm2->b__opt != NULLQB) {
        !          1623:            if (qb_cmp(Xparm1->b__opt, Xparm2->b__opt)) {
        !          1624:                (void) printf("b__opt octet string different\n");
        !          1625:                d++;
        !          1626:            }
        !          1627:        }
        !          1628:        if (Xparm1->b__opt != NULLQB && Xparm2->b__opt == NULLQB
        !          1629:         || Xparm1->b__opt == NULLQB && Xparm2->b__opt != NULLQB) {
        !          1630:            (void) printf("%s: b__opt one missing\n", t_case[tynum].tst_name);
        !          1631:            d++;
        !          1632:        }
        !          1633:        if (Xparm1->c__opt != NULLPE && Xparm2->c__opt != NULLPE) {
        !          1634:            if (bit_cmp(Xparm1->c__opt, Xparm2->c__opt)) {
        !          1635:                (void) printf("%s:c__opt bitstring different\n",
        !          1636:                    t_case[tynum].tst_name);
        !          1637:                d++;
        !          1638:            }
        !          1639:        }
        !          1640:         if (Xparm1->optionals & opt_T1_Opt__Strings_e__opt) {
        !          1641:            if (Xparm1->e__opt && !Xparm2->e__opt
        !          1642:            || !Xparm1->e__opt && Xparm2->e__opt) {
        !          1643:                d++;
        !          1644:                (void) printf("%s: e__opt mismatch %d != %d", t_case[tynum].tst_name,
        !          1645:                    Xparm1->e__opt, Xparm2->e__opt);
        !          1646:            }
        !          1647:        }
        !          1648:        if (Xparm1->big__opt && Xparm2->big__opt) {
        !          1649:            d += tcmp(TY_STRINGS, (char *)Xparm1->big__opt,
        !          1650:               (char *)Xparm2->big__opt);
        !          1651:        } else if (Xparm1->big__opt && !Xparm2->big__opt
        !          1652:               || !Xparm1->big__opt && Xparm2->big__opt) {
        !          1653:            (void) printf("%s: big__opt one missing", t_case[tynum].tst_name);
        !          1654:            d++;
        !          1655:        }
        !          1656:        if (Xparm1->emb__opt && Xparm2->emb__opt) {
        !          1657:            d += tcmp(TY_ELEMENT12, (char *)Xparm1->emb__opt,
        !          1658:               (char *)Xparm2->emb__opt);
        !          1659:        } else if (Xparm1->emb__opt && !Xparm2->emb__opt
        !          1660:               || !Xparm1->emb__opt && Xparm2->emb__opt) {
        !          1661:            (void) printf("%s: emb__opt one missing", t_case[tynum].tst_name);
        !          1662:            d++;
        !          1663:        }
        !          1664:        if (Xparm1->st__opt && Xparm2->st__opt) {
        !          1665:            d += tcmp(TY_MEMBER7, (char *)Xparm1->st__opt,
        !          1666:               (char *)Xparm2->st__opt);
        !          1667:        } else if (Xparm1->st__opt && !Xparm2->st__opt
        !          1668:               || !Xparm1->st__opt && Xparm2->st__opt) {
        !          1669:            (void) printf("%s: st__opt one missing", t_case[tynum].tst_name);
        !          1670:            d++;
        !          1671:        }
        !          1672:        if (Xparm1->obj__opt && Xparm2->obj__opt) {
        !          1673:            d += tcmp(TY_MPDU, (char *)Xparm1->obj__opt,
        !          1674:               (char *)Xparm2->obj__opt);
        !          1675:        } else if (Xparm1->obj__opt && !Xparm2->obj__opt
        !          1676:               || !Xparm1->obj__opt && Xparm2->obj__opt) {
        !          1677:            (void) printf("%s: obj__opt one missing", t_case[tynum].tst_name);
        !          1678:            d++;
        !          1679:        }
        !          1680:         if (Xparm1->optionals & opt_T1_Opt__Strings_etag__opt) {
        !          1681:            if (Xparm1->etag__opt != Xparm2->etag__opt) {
        !          1682:                d++;
        !          1683:                (void) printf("%s: etag__opt mismatch %d != %d", t_case[tynum].tst_name,
        !          1684:                    Xparm1->etag__opt, Xparm2->etag__opt);
        !          1685:            }
        !          1686:        }
        !          1687:        if (Xparm1->ch__opt && Xparm2->ch__opt) {
        !          1688:            d += tcmp(TY_CHOICE4, (char *)Xparm1->ch__opt,
        !          1689:               (char *)Xparm2->ch__opt);
        !          1690:        } else if (Xparm1->ch__opt && !Xparm2->ch__opt
        !          1691:               || !Xparm1->ch__opt && Xparm2->ch__opt) {
        !          1692:            (void) printf("%s: ch__opt one missing", t_case[tynum].tst_name);
        !          1693:            d++;
        !          1694:        }
        !          1695:        break;
        !          1696: #undef Xparm1
        !          1697: #undef Xparm2
        !          1698: 
        !          1699:      case TY_ELEMENT12:
        !          1700: #define Xparm1 ((struct element_T1_12 *)parm1)
        !          1701: #define Xparm2 ((struct element_T1_12 *)parm2)
        !          1702:         if (Xparm1->optionals & opt_T1_element_T1_12_oem__int) {
        !          1703:            if (Xparm1->oem__int != Xparm2->oem__int) {
        !          1704:                d++;
        !          1705:                (void) printf("%s: oem__int mismatch %d != %d", t_case[tynum].tst_name,
        !          1706:                    Xparm1->oem__int, Xparm2->oem__int);
        !          1707:            }
        !          1708:        }
        !          1709:        if (Xparm1->oem__oct != NULLQB && Xparm2->oem__oct != NULLQB) {
        !          1710:            if (qb_cmp(Xparm1->oem__oct, Xparm2->oem__oct)) {
        !          1711:                (void) printf("oem__oct octet string different\n");
        !          1712:                d++;
        !          1713:            }
        !          1714:        }
        !          1715:        if (Xparm1->oem__oct != NULLQB && Xparm2->oem__oct == NULLQB
        !          1716:         || Xparm1->oem__oct == NULLQB && Xparm2->oem__oct != NULLQB) {
        !          1717:            (void) printf("%s: oem__oct one missing\n", t_case[tynum].tst_name);
        !          1718:            d++;
        !          1719:        }
        !          1720:        if (Xparm1->oem__bit != NULLPE && Xparm2->oem__bit != NULLPE) {
        !          1721:            if (bit_cmp(Xparm1->oem__bit, Xparm2->oem__bit)) {
        !          1722:                (void) printf("%s:oem__bit bitstring different\n",
        !          1723:                    t_case[tynum].tst_name);
        !          1724:                d++;
        !          1725:            }
        !          1726:        }
        !          1727:        break;
        !          1728: #undef Xparm1
        !          1729: #undef Xparm2
        !          1730: 
        !          1731:      case TY_MEMBER7:
        !          1732: #define Xparm1 ((struct member_T1_7 *)parm1)
        !          1733: #define Xparm2 ((struct member_T1_7 *)parm2)
        !          1734:         if (Xparm1->optionals & opt_T1_member_T1_7_st__int0) {
        !          1735:            if (Xparm1->st__int0 != Xparm2->st__int0) {
        !          1736:                d++;
        !          1737:                (void) printf("%s: st__int0 mismatch %d != %d", t_case[tynum].tst_name,
        !          1738:                    Xparm1->st__int0, Xparm2->st__int0);
        !          1739:            }
        !          1740:        }
        !          1741:         if (Xparm1->optionals & opt_T1_member_T1_7_st__int1) {
        !          1742:            if (Xparm1->st__int1 != Xparm2->st__int1) {
        !          1743:                d++;
        !          1744:                (void) printf("%s: st__int1 mismatch %d != %d", t_case[tynum].tst_name,
        !          1745:                    Xparm1->st__int1, Xparm2->st__int1);
        !          1746:            }
        !          1747:        }
        !          1748:         if (Xparm1->optionals & opt_T1_member_T1_7_st__int2) {
        !          1749:            if (Xparm1->st__int2 != Xparm2->st__int2) {
        !          1750:                d++;
        !          1751:                (void) printf("%s: st__int2 mismatch %d != %d", t_case[tynum].tst_name,
        !          1752:                    Xparm1->st__int2, Xparm2->st__int2);
        !          1753:            }
        !          1754:        }
        !          1755:        break;
        !          1756: #undef Xparm1
        !          1757: #undef Xparm2
        !          1758: 
        !          1759:     case TY_CHOICE4:
        !          1760: #define Xparm1 ((struct choice_T1_4 *)parm1)
        !          1761: #define Xparm2 ((struct choice_T1_4 *)parm2)
        !          1762:        if (Xparm1->offset != Xparm2->offset) {
        !          1763:            d++;
        !          1764:            (void) printf("%s: offset mismatch %d != %d", t_case[tynum].tst_name,
        !          1765:                Xparm1->offset, Xparm2->offset);
        !          1766:            break;
        !          1767:        }
        !          1768:        switch (Xparm1->offset) {
        !          1769:        case choice_T1_4_ch__1:
        !          1770:            if (Xparm1->un.ch__1 != Xparm2->un.ch__1) {
        !          1771:                d++;
        !          1772:                (void) printf("%s: ch__1 mismatch %d != %d", t_case[tynum].tst_name,
        !          1773:                    Xparm1->un.ch__1, Xparm2->un.ch__1);
        !          1774:            }
        !          1775:            break;
        !          1776:        
        !          1777:        case choice_T1_4_ch__2:
        !          1778:            if (Xparm1->un.ch__2 != Xparm2->un.ch__2) {
        !          1779:                d++;
        !          1780:                (void) printf("%s: ch__2 mismatch %d != %d", t_case[tynum].tst_name,
        !          1781:                    Xparm1->un.ch__2, Xparm2->un.ch__2);
        !          1782:            }
        !          1783:            break;
        !          1784:        
        !          1785:        default:
        !          1786:            ferrd(1, "tcmp:TY_CHOICE4:illegal offset %d\n", Xparm1->offset);
        !          1787:        }
        !          1788:        break;
        !          1789: #undef Xparm1
        !          1790: #undef Xparm2
        !          1791: 
        !          1792:      case TY_EXTREF:
        !          1793: #define Xparm1 ((struct type_T1_E__ref *)parm1)
        !          1794: #define Xparm2 ((struct type_T1_E__ref *)parm2)
        !          1795:        if (Xparm1->a__ref && Xparm2->a__ref) {
        !          1796:            d += tcmp(TY_T2_INFO, (char *)Xparm1->a__ref,
        !          1797:               (char *)Xparm2->a__ref);
        !          1798:        } else if (Xparm1->a__ref == NULL || Xparm2->a__ref == NULL) {
        !          1799:            (void) printf("%s: a__ref one missing", t_case[tynum].tst_name);
        !          1800:            d++;
        !          1801:        }
        !          1802:        if (Xparm1->b__ref && Xparm2->b__ref) {
        !          1803:            d += tcmp(TY_T2_INFO, (char *)Xparm1->b__ref,
        !          1804:               (char *)Xparm2->b__ref);
        !          1805:        } else if (Xparm1->b__ref == NULL || Xparm2->b__ref == NULL) {
        !          1806:            (void) printf("%s: b__ref one missing", t_case[tynum].tst_name);
        !          1807:            d++;
        !          1808:        }
        !          1809:        if (Xparm1->c__ref && Xparm2->c__ref) {
        !          1810:            d += tcmp(TY_CHOICE, (char *)Xparm1->c__ref,
        !          1811:               (char *)Xparm2->c__ref);
        !          1812:        } else if (Xparm1->c__ref == NULL || Xparm2->c__ref == NULL) {
        !          1813:            (void) printf("%s: c__ref one missing", t_case[tynum].tst_name);
        !          1814:            d++;
        !          1815:        }
        !          1816:        if (Xparm1->d__ref && Xparm2->d__ref) {
        !          1817:            d += tcmp(TY_T2_INFO, (char *)Xparm1->d__ref,
        !          1818:               (char *)Xparm2->d__ref);
        !          1819:        } else if (Xparm1->d__ref && !Xparm2->d__ref
        !          1820:               || !Xparm1->d__ref && Xparm2->d__ref) {
        !          1821:            (void) printf("%s: d__ref one missing", t_case[tynum].tst_name);
        !          1822:            d++;
        !          1823:        }
        !          1824:        if (Xparm1->e__ref && Xparm2->e__ref) {
        !          1825:            d += tcmp(TY_T2_INFO, (char *)Xparm1->e__ref,
        !          1826:               (char *)Xparm2->e__ref);
        !          1827:        } else if (Xparm1->e__ref && !Xparm2->e__ref
        !          1828:               || !Xparm1->e__ref && Xparm2->e__ref) {
        !          1829:            (void) printf("%s: e__ref one missing", t_case[tynum].tst_name);
        !          1830:            d++;
        !          1831:        }
        !          1832:         break;
        !          1833: #undef Xparm1
        !          1834: #undef Xparm2
        !          1835: 
        !          1836:      case TY_T2_INFO:
        !          1837: #define Xparm1 ((struct type_T2_Info *)parm1)
        !          1838: #define Xparm2 ((struct type_T2_Info *)parm2)
        !          1839:        if (Xparm1->a1 != Xparm2->a1) {
        !          1840:            d++;
        !          1841:            (void) printf("%s: a1 mismatch %d != %d", t_case[tynum].tst_name,
        !          1842:                Xparm1->a1, Xparm2->a1);
        !          1843:        }
        !          1844:        if (Xparm1->a2 != Xparm2->a2) {
        !          1845:            d++;
        !          1846:            (void) printf("%s: a2 mismatch %d != %d", t_case[tynum].tst_name,
        !          1847:                Xparm1->a2, Xparm2->a2);
        !          1848:        }
        !          1849:        if (Xparm1->a3 != Xparm2->a3) {
        !          1850:            d++;
        !          1851:            (void) printf("%s: a3 mismatch %d != %d", t_case[tynum].tst_name,
        !          1852:                Xparm1->a3, Xparm2->a3);
        !          1853:        }
        !          1854:        if (Xparm1->a4 && Xparm2->a4) {
        !          1855:            d += tcmp(TY_T2_MPDU, (char *)Xparm1->a4, (char *)Xparm2->a4);
        !          1856:        } else if (Xparm1->a4 == NULL || Xparm2->a4 == NULL) {
        !          1857:            (void) printf("%s: a4 one missing", t_case[tynum].tst_name);
        !          1858:            d++;
        !          1859:        }
        !          1860:         break;
        !          1861: #undef Xparm1
        !          1862: #undef Xparm2
        !          1863: 
        !          1864:      case TY_T2_MPDU:
        !          1865: #define Xparm1 ((struct type_T2_MPDU *)parm1)
        !          1866: #define Xparm2 ((struct type_T2_MPDU *)parm2)
        !          1867:        if (Xparm1->a__seq && Xparm2->a__seq) {
        !          1868:            d += tcmp(TY_T2_ELEM0, (char *)Xparm1->a__seq,
        !          1869:               (char *)Xparm2->a__seq);
        !          1870:        } else if (Xparm1->a__seq == NULL || Xparm2->a__seq == NULL) {
        !          1871:            (void) printf("%s: a__seq one missing", t_case[tynum].tst_name);
        !          1872:            d++;
        !          1873:        }
        !          1874:         break;
        !          1875: #undef Xparm1
        !          1876: #undef Xparm2
        !          1877: 
        !          1878:      case TY_T2_ELEM0:
        !          1879: #define Xparm1 ((struct element_T2_0 *)parm1)
        !          1880: #define Xparm2 ((struct element_T2_0 *)parm2)
        !          1881:        if (Xparm1->fred != Xparm2->fred) {
        !          1882:            d++;
        !          1883:            (void) printf("%s: fred mismatch %d != %d", t_case[tynum].tst_name,
        !          1884:                Xparm1->fred, Xparm2->fred);
        !          1885:        }
        !          1886:         break;
        !          1887: #undef Xparm1
        !          1888: #undef Xparm2
        !          1889: 
        !          1890:      case TY_OPTIMISED:
        !          1891: #define Xparm1 ((struct type_T1_Optimised *)parm1)
        !          1892: #define Xparm2 ((struct type_T1_Optimised *)parm2)
        !          1893:        if (Xparm1->o1 == NULLPE || Xparm2->o1 == NULLPE) {
        !          1894:            (void) printf("%s: o1 one missing\n", t_case[tynum].tst_name);
        !          1895:            d++;
        !          1896:        } else if (bit_cmp(Xparm1->o1, Xparm2->o1)) {
        !          1897:                (void) printf("%s:o1 bitstring different\n",
        !          1898:                    t_case[tynum].tst_name);
        !          1899:                d++;
        !          1900:        }
        !          1901:        if (Xparm1->o2 != NULLQB && Xparm2->o2 != NULLQB) {
        !          1902:            if (qb_cmp(Xparm1->o2, Xparm2->o2)) {
        !          1903:                (void) printf("o2 octet string different\n");
        !          1904:                d++;
        !          1905:            }
        !          1906:        } else {
        !          1907:            (void) printf("%s: o2 one missing\n", t_case[tynum].tst_name);
        !          1908:            d++;
        !          1909:        }
        !          1910:        if (Xparm1->o3 && Xparm2->o3) {
        !          1911:            d += tcmp(TY_MPDU, (char *)Xparm1->o3, (char *)Xparm2->o3);
        !          1912:        } else if (Xparm1->o3 == NULL || Xparm2->o3 == NULL) {
        !          1913:            (void) printf("%s: o3 one missing", t_case[tynum].tst_name);
        !          1914:            d++;
        !          1915:        }
        !          1916:        if (Xparm1->o4 != NULLPE && Xparm2->o4 == NULLPE
        !          1917:         || Xparm1->o4 == NULLPE && Xparm2->o4 != NULLPE) {
        !          1918:            (void) printf("%s: o4 one missing\n", t_case[tynum].tst_name);
        !          1919:            d++;
        !          1920:        }
        !          1921:        if (Xparm1->o4 != NULLPE && Xparm2->o4 != NULLPE) {
        !          1922:            if (pe_cmp(Xparm1->o4, Xparm2->o4)) {
        !          1923:                (void) printf("%s:o4 SET of ANY different\n",
        !          1924:                    t_case[tynum].tst_name);
        !          1925:                d++;
        !          1926:            }
        !          1927:        }
        !          1928:        if (Xparm1->element_T1_14 && Xparm2->element_T1_14) {
        !          1929:            d += tcmp(TY_MEMBER9, (char *)Xparm1->element_T1_14,
        !          1930:            (char *)Xparm2->element_T1_14);
        !          1931:        } else if (Xparm1->element_T1_14 == NULL
        !          1932:                 || Xparm2->element_T1_14 == NULL) {
        !          1933:            (void) printf("%s: element_T1_14 one missing", t_case[tynum].tst_name);
        !          1934:            d++;
        !          1935:        }
        !          1936:        break;
        !          1937: #undef Xparm1
        !          1938: #undef Xparm2
        !          1939: 
        !          1940:      case TY_MEMBER9:
        !          1941: #define Xparm1 ((struct member_T1_9 *)parm1)
        !          1942: #define Xparm2 ((struct member_T1_9 *)parm2)
        !          1943:        if (Xparm1->o5 != NULLPE && Xparm2->o5 != NULLPE) {
        !          1944:            if (pe_cmp(Xparm1->o5, Xparm2->o5)) {
        !          1945:                (void) printf("%s:o5 SET of ANY different\n",
        !          1946:                    t_case[tynum].tst_name);
        !          1947:                d++;
        !          1948:            }
        !          1949:        } else {
        !          1950:            (void) printf("%s: o5 one missing\n", t_case[tynum].tst_name);
        !          1951:            d++;
        !          1952:        }
        !          1953:        if (Xparm1->o6 != NULLPE && Xparm2->o6 != NULLPE) {
        !          1954:            if (pe_cmp(Xparm1->o6, Xparm2->o6)) {
        !          1955:                (void) printf("%s:o6 SET of ANY different\n",
        !          1956:                    t_case[tynum].tst_name);
        !          1957:                d++;
        !          1958:            }
        !          1959:        } else {
        !          1960:            (void) printf("%s: o6 one missing\n", t_case[tynum].tst_name);
        !          1961:            d++;
        !          1962:        }
        !          1963:        if (Xparm1->o7 != NULLOID && Xparm2->o7 != NULLOID) {
        !          1964:            if (oid_cmp(Xparm1->o7, Xparm2->o7)) {
        !          1965:                (void) printf("%s:o7 OID different\n",
        !          1966:                    t_case[tynum].tst_name);
        !          1967:                d++;
        !          1968:            }
        !          1969:        } else {
        !          1970:            (void) printf("%s: o7 one missing\n", t_case[tynum].tst_name);
        !          1971:            d++;
        !          1972:        }
        !          1973:        break;
        !          1974: #undef Xparm1
        !          1975: #undef Xparm2
        !          1976: 
        !          1977:     case TY_EXTERNAL:
        !          1978: #define Xparm1 ((struct type_T1_Ext__typ *)parm1)
        !          1979: #define Xparm2 ((struct type_T1_Ext__typ *)parm2)
        !          1980:        if (Xparm1->ext != NULL && Xparm2->ext != NULL) {
        !          1981:            if (ext_cmp(Xparm1->ext, Xparm2->ext)) {
        !          1982:                (void) printf("%s:ext EXTERNAL different\n",
        !          1983:                    t_case[tynum].tst_name);
        !          1984:                d++;
        !          1985:            }
        !          1986:        } else {
        !          1987:            (void) printf("%s: ext one missing\n", t_case[tynum].tst_name);
        !          1988:            d++;
        !          1989:        }
        !          1990:        if (Xparm1->a__ny != NULLPE && Xparm2->a__ny != NULLPE) {
        !          1991:            if (pe_cmp(Xparm1->a__ny, Xparm2->a__ny)) {
        !          1992:                (void) printf("%s:a__ny ANY different\n",
        !          1993:                    t_case[tynum].tst_name);
        !          1994:                d++;
        !          1995:            }
        !          1996:        } else {
        !          1997:            (void) printf("%s: a__ny one missing\n", t_case[tynum].tst_name);
        !          1998:            d++;
        !          1999:        }
        !          2000:        if (Xparm1->ext__impl != NULL && Xparm2->ext__impl != NULL) {
        !          2001:            if (ext_cmp(Xparm1->ext__impl, Xparm2->ext__impl)) {
        !          2002:                (void) printf("%s:ext__impl EXTERNAL different\n",
        !          2003:                    t_case[tynum].tst_name);
        !          2004:                d++;
        !          2005:            }
        !          2006:        } else {
        !          2007:            (void) printf("%s: ext__impl one missing\n", t_case[tynum].tst_name);
        !          2008:            d++;
        !          2009:        }
        !          2010:        if (Xparm1->any__impl != NULLPE && Xparm2->any__impl != NULLPE) {
        !          2011:            if (pe_cmp(Xparm1->any__impl, Xparm2->any__impl)) {
        !          2012:                (void) printf("%s:any__impl ANY different\n",
        !          2013:                    t_case[tynum].tst_name);
        !          2014:                d++;
        !          2015:            }
        !          2016:        } else {
        !          2017:            (void) printf("%s: any__impl one missing\n", t_case[tynum].tst_name);
        !          2018:            d++;
        !          2019:        }
        !          2020:        if (Xparm1->ext__expl != NULL && Xparm2->ext__expl != NULL) {
        !          2021:            if (ext_cmp(Xparm1->ext__expl, Xparm2->ext__expl)) {
        !          2022:                (void) printf("%s:ext__expl EXTERNAL different\n",
        !          2023:                    t_case[tynum].tst_name);
        !          2024:                d++;
        !          2025:            }
        !          2026:        } else {
        !          2027:            (void) printf("%s: ext__expl one missing\n", t_case[tynum].tst_name);
        !          2028:            d++;
        !          2029:        }
        !          2030:        if (Xparm1->any__expl != NULLPE && Xparm2->any__expl != NULLPE) {
        !          2031:            if (pe_cmp(Xparm1->any__expl, Xparm2->any__expl)) {
        !          2032:                (void) printf("%s:any__expl ANY different\n",
        !          2033:                    t_case[tynum].tst_name);
        !          2034:                d++;
        !          2035:            }
        !          2036:        } else {
        !          2037:            (void) printf("%s: any__expl one missing\n", t_case[tynum].tst_name);
        !          2038:            d++;
        !          2039:        }
        !          2040:        break;
        !          2041: #undef Xparm1
        !          2042: #undef Xparm2
        !          2043: 
        !          2044:     case TY_SEXTERNAL:
        !          2045: #define Xparm1 ((struct type_T1_SExt *)parm1)
        !          2046: #define Xparm2 ((struct type_T1_SExt *)parm2)
        !          2047:        if (Xparm1 != NULL && Xparm2 != NULL) {
        !          2048:            if (ext_cmp(Xparm1, Xparm2)) {
        !          2049:                (void) printf("%s:ext EXTERNAL different\n",
        !          2050:                    t_case[tynum].tst_name);
        !          2051:                d++;
        !          2052:            }
        !          2053:        } else {
        !          2054:            (void) printf("%s: ext one missing\n", t_case[tynum].tst_name);
        !          2055:            d++;
        !          2056:        }
        !          2057:        break;
        !          2058: #undef Xparm1
        !          2059: #undef Xparm2
        !          2060: 
        !          2061: 
        !          2062:     case TY_ETAGOBJ:
        !          2063: #define Xparm1 ((struct type_T1_Etags *)parm1)
        !          2064: #define Xparm2 ((struct type_T1_Etags *)parm2)
        !          2065:        if (Xparm1->offset != Xparm2->offset) {
        !          2066:            d++;
        !          2067:            (void) printf("%s: offset mismatch %d != %d", t_case[tynum].tst_name,
        !          2068:                Xparm1->offset, Xparm2->offset);
        !          2069:            break;
        !          2070:        }
        !          2071:        switch (Xparm1->offset) {
        !          2072:        case type_T1_Etags_aE:
        !          2073:            if (Xparm1->un.aE != Xparm2->un.aE) {
        !          2074:                d++;
        !          2075:                (void) printf("%s: un.aE mismatch %d != %d", t_case[tynum].tst_name,
        !          2076:                    Xparm1->un.aE, Xparm2->un.aE);
        !          2077:            }
        !          2078:            break;
        !          2079:        
        !          2080:        case type_T1_Etags_bE:
        !          2081:            if (Xparm1->un.bE != Xparm2->un.bE) {
        !          2082:                d++;
        !          2083:                (void) printf("%s: un.bE mismatch %d != %d", t_case[tynum].tst_name,
        !          2084:                    Xparm1->un.bE, Xparm2->un.bE);
        !          2085:            }
        !          2086:            break;
        !          2087:        
        !          2088:        default:
        !          2089:            ferrd(1, "TY_ETAGOBJ:illegal offset %d\n", Xparm1->offset);
        !          2090:        }
        !          2091:        break;
        !          2092: #undef Xparm1
        !          2093: #undef Xparm2
        !          2094: 
        !          2095: /* This has to be changed when posy is upgraded to handle DEFAULTS properly */
        !          2096:     case TY_DEFAULT:
        !          2097: #define Xparm1 ((struct type_T1_Def__Strings *)parm1)
        !          2098: #define Xparm2 ((struct type_T1_Def__Strings *)parm2)
        !          2099:        if (Xparm1->a__def != Xparm2->a__def) {
        !          2100:            d++;
        !          2101:            (void) printf("%s: a__def mismatch %d != %d", t_case[tynum].tst_name,
        !          2102:                Xparm1->a__def, Xparm2->a__def);
        !          2103:        }
        !          2104:        if (Xparm1->b__def != NULLQB && Xparm2->b__def != NULLQB) {
        !          2105:            if (qb_cmp(Xparm1->b__def, Xparm2->b__def)) {
        !          2106:                (void) printf("b__def octet string different\n");
        !          2107:                d++;
        !          2108:            }
        !          2109:        } else if (Xparm2->b__def == NULLQB) {
        !          2110:            (void) printf("%s: b__def one missing\n", t_case[tynum].tst_name);
        !          2111:            d++;
        !          2112:        }
        !          2113:        if (Xparm1->c__def != NULLPE && Xparm2->c__def != NULLPE) {
        !          2114:            if (bit_cmp(Xparm1->c__def, Xparm2->c__def)) {
        !          2115:                    (void) printf("%s:c__def bitstring different\n",
        !          2116:                        t_case[tynum].tst_name);
        !          2117:                    d++;
        !          2118:            }
        !          2119:        } else if (Xparm2->c__def == NULLPE) {
        !          2120:            (void) printf("%s: c__def restored version missing\n", t_case[tynum].tst_name);
        !          2121:            d++;
        !          2122:        }
        !          2123:        if (Xparm1->okay != Xparm2->okay) {
        !          2124:            d++;
        !          2125:            (void) printf("%s: okay mismatch %d != %d", t_case[tynum].tst_name,
        !          2126:                Xparm1->okay, Xparm2->okay);
        !          2127:        }
        !          2128:        /* Can't test NULL ....
        !          2129:        if (Xparm1->e__opt != Xparm2->e__opt) {
        !          2130:            d++;
        !          2131:            (void) printf("%s: e__opt mismatch %d != %d", t_case[tynum].tst_name,
        !          2132:                Xparm1->e__opt, Xparm2->e__opt);
        !          2133:        }
        !          2134:        */
        !          2135:        if (Xparm1->big__def && Xparm2->big__def) {
        !          2136:            d += tcmp(TY_STRINGS, (char *)Xparm1->big__def,
        !          2137:            (char *)Xparm2->big__def);
        !          2138:        } else {
        !          2139:            (void) printf("%s: big__def one missing", t_case[tynum].tst_name);
        !          2140:            d++;
        !          2141:        }
        !          2142:        if (Xparm1->emb__def && Xparm2->emb__def) {
        !          2143:            d += tcmp(TY_ELEMENT13, (char *)Xparm1->emb__def,
        !          2144:            (char *)Xparm2->emb__def);
        !          2145:        } else if (Xparm1->emb__def != NULL || Xparm2->emb__def != NULL) {
        !          2146:            (void) printf("%s: emb__def one missing", t_case[tynum].tst_name);
        !          2147:            d++;
        !          2148:        }
        !          2149:        if (Xparm1->st__def && Xparm2->st__def) {
        !          2150:            d += tcmp(TY_MEMBER8, (char *)Xparm1->st__def,
        !          2151:            (char *)Xparm2->st__def);
        !          2152:        } else if (Xparm1->st__def != NULL || Xparm2->st__def != NULL) {
        !          2153:            (void) printf("%s: st__def one missing", t_case[tynum].tst_name);
        !          2154:            d++;
        !          2155:        }
        !          2156:        break;
        !          2157: #undef Xparm1
        !          2158: #undef Xparm2
        !          2159: 
        !          2160:     case TY_ELEMENT13:
        !          2161: #define Xparm1 ((struct element_T1_13 *)parm1)
        !          2162: #define Xparm2 ((struct element_T1_13 *)parm2)
        !          2163:        if (Xparm1->colour != Xparm2->colour) {
        !          2164:            d++;
        !          2165:            (void) printf("%s: colour mismatch %d != %d", t_case[tynum].tst_name,
        !          2166:                Xparm1->colour, Xparm2->colour);
        !          2167:        }
        !          2168:        if (Xparm1->oem__oct != NULLQB && Xparm2->oem__oct != NULLQB) {
        !          2169:            if (qb_cmp(Xparm1->oem__oct, Xparm2->oem__oct)) {
        !          2170:                (void) printf("oem__oct octet string different\n");
        !          2171:                d++;
        !          2172:            }
        !          2173:        } else if (Xparm1->oem__oct != NULLQB || Xparm2->oem__oct != NULLQB) {
        !          2174:            (void) printf("oem__oct: one missing 0x%x, 0x%x\n", Xparm1->oem__oct,
        !          2175:            Xparm1->oem__oct);
        !          2176:            d++;
        !          2177:        }
        !          2178:        if (Xparm1->version != NULLPE && Xparm2->version != NULLPE) {
        !          2179:            if (bit_cmp(Xparm1->version, Xparm2->version)) {
        !          2180:                    (void) printf("%s:version bitstring different\n",
        !          2181:                        t_case[tynum].tst_name);
        !          2182:                    d++;
        !          2183:            }
        !          2184:        } else if (Xparm2->version == NULLPE) {
        !          2185:            (void) printf("%s: version decoded version missing\n",
        !          2186:                t_case[tynum].tst_name);
        !          2187:            d++;
        !          2188:        }
        !          2189:        break;
        !          2190: #undef Xparm1
        !          2191: #undef Xparm2
        !          2192: 
        !          2193:     case TY_MEMBER8:
        !          2194: #define Xparm1 ((struct member_T1_8 *)parm1)
        !          2195: #define Xparm2 ((struct member_T1_8 *)parm2)
        !          2196:        if (Xparm1->wine != Xparm2->wine) {
        !          2197:            d++;
        !          2198:            (void) printf("%s: wine mismatch %d != %d", t_case[tynum].tst_name,
        !          2199:                Xparm1->wine, Xparm2->wine);
        !          2200:        }
        !          2201:        if (Xparm1->beer != Xparm2->beer) {
        !          2202:            d++;
        !          2203:            (void) printf("%s: beer mismatch %d != %d", t_case[tynum].tst_name,
        !          2204:                Xparm1->beer, Xparm2->beer);
        !          2205:        }
        !          2206:        if (Xparm1->spirit != Xparm2->spirit) {
        !          2207:            d++;
        !          2208:            (void) printf("%s: spirit mismatch %d != %d", t_case[tynum].tst_name,
        !          2209:                Xparm1->spirit, Xparm2->spirit);
        !          2210:        }
        !          2211:        break;
        !          2212: #undef Xparm1
        !          2213: #undef Xparm2
        !          2214: 
        !          2215:     case TY_STEST:
        !          2216: #define Xparm1 ((struct type_T1_Stest *)parm1)
        !          2217: #define Xparm2 ((struct type_T1_Stest *)parm2)
        !          2218:        if (Xparm1->st1 != NULL && Xparm2->st1 != NULL) {
        !          2219:            d += tcmp(TY_SINT, (char *)Xparm1->st1, (char *)Xparm2->st1);
        !          2220:        } else if (Xparm2->st1 == NULL) {
        !          2221:            d++;
        !          2222:            (void) printf("%s: missing", t_case[tynum].tst_name);
        !          2223:        }
        !          2224:        if (Xparm1->st2 != NULL && Xparm2->st2 != NULL) {
        !          2225:            if (qb_cmp(Xparm1->st2, Xparm2->st2)) {
        !          2226:                (void) printf("%s:st2 octet string different\n",
        !          2227:                    t_case[tynum].tst_name);
        !          2228:                d++;
        !          2229:            }
        !          2230:        } else if (Xparm2->st2 == NULL) {
        !          2231:            d++;
        !          2232:            (void) printf("%s: missing", t_case[tynum].tst_name);
        !          2233:        }
        !          2234:        break;
        !          2235: #undef Xparm1
        !          2236: #undef Xparm2
        !          2237: 
        !          2238:     case TY_SINT:
        !          2239: #define Xparm1 ((struct type_T1_Sint *)parm1)
        !          2240: #define Xparm2 ((struct type_T1_Sint *)parm2)
        !          2241:        if (Xparm1->parm != Xparm2->parm) {
        !          2242:            (void) printf("%s:parm %d != %d\n", t_case[tynum].tst_name, Xparm1->parm,
        !          2243:                Xparm2->parm);
        !          2244:            d++;
        !          2245:        }
        !          2246:        break;
        !          2247: #undef Xparm1
        !          2248: #undef Xparm2
        !          2249: 
        !          2250:     case TY_ETYPE:
        !          2251: #define Xparm1 ((struct type_T1_Enum__type *)parm1)
        !          2252: #define Xparm2 ((struct type_T1_Enum__type *)parm2)
        !          2253:        if (Xparm1->parm != Xparm2->parm) {
        !          2254:            (void) printf("%s:parm %d != %d\n", t_case[tynum].tst_name, Xparm1->parm,
        !          2255:                Xparm2->parm);
        !          2256:            d++;
        !          2257:        }
        !          2258:        break;
        !          2259: #undef Xparm1
        !          2260: #undef Xparm2
        !          2261: 
        !          2262:     case TY_ENUM_TEST:
        !          2263: #define Xparm1 ((struct type_T1_T__enum *)parm1)
        !          2264: #define Xparm2 ((struct type_T1_T__enum *)parm2)
        !          2265:        if (Xparm1->ae1 && Xparm2->ae1 ) {
        !          2266:            d += tcmp(TY_ETYPE, (char *)Xparm1->ae1, (char *)Xparm2->ae1);
        !          2267:        } else {
        !          2268:            d++;
        !          2269:            (void) printf("%s:ae1 missing\n", t_case[tynum].tst_name);
        !          2270:        }
        !          2271:        if (Xparm1->ae2 && Xparm2->ae2 ) {
        !          2272:            d += tcmp(TY_ETYPE, (char *)Xparm1->ae2, (char *)Xparm2->ae2);
        !          2273:        } else {
        !          2274:            d++;
        !          2275:            (void) printf("%s:ae2 missing\n", t_case[tynum].tst_name);
        !          2276:        }
        !          2277:        if (Xparm1->ae3 && Xparm2->ae3 ) {
        !          2278:            d += tcmp(TY_ETYPE, (char *)Xparm1->ae3, (char *)Xparm2->ae3);
        !          2279:        } else {
        !          2280:            d++;
        !          2281:            (void) printf("%s:ae3 missing\n", t_case[tynum].tst_name);
        !          2282:        }
        !          2283:        /* Default */
        !          2284:        if (Xparm1->ae4 && Xparm2->ae4 ) {
        !          2285:            d += tcmp(TY_ETYPE, (char *)Xparm1->ae4, (char *)Xparm2->ae4);
        !          2286:        } else {
        !          2287:            d++;
        !          2288:            (void) printf("%s:ae4 missing\n", t_case[tynum].tst_name);
        !          2289:        }
        !          2290:        /* Optional */
        !          2291:        if (Xparm1->ae5 && Xparm2->ae5 ) {
        !          2292:            d += tcmp(TY_ETYPE, (char *)Xparm1->ae5, (char *)Xparm2->ae5);
        !          2293:        } else if (Xparm1->ae5 || Xparm2->ae5) {
        !          2294:            d++;
        !          2295:            (void) printf("%s:ae5 missing\n", t_case[tynum].tst_name);
        !          2296:        }
        !          2297:        break;
        !          2298: #undef Xparm1
        !          2299: #undef Xparm2
        !          2300: 
        !          2301: #ifdef PEPSY_REALS
        !          2302:     case TY_REAL:
        !          2303: #define Xparm1 ((struct type_T1_Real *)parm1)
        !          2304: #define Xparm2 ((struct type_T1_Real *)parm2)
        !          2305:        /* Horrible floating point test for roughly equal */
        !          2306:        if (fabs(Xparm1->parm) < F_SMALL/2) {
        !          2307:             if (fabs(Xparm1->parm - Xparm2->parm) > F_SMALL) {
        !          2308:                (void) printf("%s:parm %f != %f\n", t_case[tynum].tst_name,
        !          2309:                    Xparm1->parm, Xparm2->parm);
        !          2310:                d++;
        !          2311:            }
        !          2312:        } else if (fabs((Xparm1->parm - Xparm2->parm)/Xparm1->parm) > F_SMALL) {
        !          2313:            (void) printf("%s:parm %f != %f\n", t_case[tynum].tst_name, Xparm1->parm,
        !          2314:                Xparm2->parm);
        !          2315:            d++;
        !          2316:        }
        !          2317:        break;
        !          2318: #undef Xparm1
        !          2319: #undef Xparm2
        !          2320: 
        !          2321:     case TY_REAL_TEST:
        !          2322: #define Xparm1 ((struct type_T1_T__real *)parm1)
        !          2323: #define Xparm2 ((struct type_T1_T__real *)parm2)
        !          2324:        if (Xparm1->r1 && Xparm2->r1 ) {
        !          2325:            d += tcmp(TY_REAL, (char *)Xparm1->r1, (char *)Xparm2->r1);
        !          2326:        } else {
        !          2327:            d++;
        !          2328:            (void) printf("%s:r1 missing\n", t_case[tynum].tst_name);
        !          2329:        }
        !          2330:        if (Xparm1->r2 && Xparm2->r2 ) {
        !          2331:            d += tcmp(TY_REAL, (char *)Xparm1->r2, (char *)Xparm2->r2);
        !          2332:        } else {
        !          2333:            d++;
        !          2334:            (void) printf("%s:r2 missing\n", t_case[tynum].tst_name);
        !          2335:        }
        !          2336:        if (Xparm1->r3 && Xparm2->r3 ) {
        !          2337:            d += tcmp(TY_REAL, (char *)Xparm1->r3, (char *)Xparm2->r3);
        !          2338:        } else {
        !          2339:            d++;
        !          2340:            (void) printf("%s:r3 missing\n", t_case[tynum].tst_name);
        !          2341:        }
        !          2342:        /* Default */
        !          2343:        if (Xparm1->r4 && Xparm2->r4 ) {
        !          2344:            d += tcmp(TY_REAL, (char *)Xparm1->r4, (char *)Xparm2->r4);
        !          2345:        } else {
        !          2346:            d++;
        !          2347:            (void) printf("%s:r4 missing\n", t_case[tynum].tst_name);
        !          2348:        }
        !          2349:        /* Optional */
        !          2350:        if (Xparm1->r5 && Xparm2->r5 ) {
        !          2351:            d += tcmp(TY_REAL, (char *)Xparm1->r5, (char *)Xparm2->r5);
        !          2352:        } else if (Xparm1->r5 || Xparm2->r5) {
        !          2353:            d++;
        !          2354:            (void) printf("%s:r5 missing\n", t_case[tynum].tst_name);
        !          2355:        }
        !          2356:        break;
        !          2357: #undef Xparm1
        !          2358: #undef Xparm2
        !          2359: #endif
        !          2360: 
        !          2361:     default:
        !          2362:        ferrd(1, "tcmp:unknown type %d\n", tynum);
        !          2363:     }
        !          2364:     if (d) {
        !          2365:            (void) printf("tcmp:failed on %s\n", t_case[tynum].tst_name);
        !          2366:     }
        !          2367:     return (d);
        !          2368: }
        !          2369: 
        !          2370: /*
        !          2371:  * Compare two possible null qbuf lists and return non zero if they are
        !          2372:  * different
        !          2373:  * Pretty complex to allow for all sorts of weird cases
        !          2374:  * Doesn't work for a qbuf which doesn't have a head ! Don't really know what
        !          2375:  * is the proper form of a queue buf. MArshall's doco doesn't say
        !          2376:  */
        !          2377: qb_cmp(qb1, qb2)
        !          2378: struct qbuf    *qb1, *qb2;
        !          2379: {
        !          2380:     struct     qbuf    *qp1, *qp2;
        !          2381:     char       *po1, *po2;
        !          2382:     int        len1, len2;
        !          2383: 
        !          2384:     if (qb1 == NULL && qb2 == NULL)
        !          2385:        return (0);
        !          2386:     
        !          2387:     if (qb1 == NULL || qb2 == NULL)
        !          2388:        return (1);
        !          2389: 
        !          2390:     qp1 = qb1->qb_forw;
        !          2391:     qp2 = qb2->qb_forw;
        !          2392:     po1 = qp1->qb_data;
        !          2393:     po2 = qp2->qb_data;
        !          2394:     len1 = qp1->qb_len;
        !          2395:     len2 = qp2->qb_len;
        !          2396: 
        !          2397:     while (qp1 != qb1 && qp2 != qb2) {
        !          2398:        if (len1 < len2) {
        !          2399:            if (bcmp(po1, po2, len1))
        !          2400:                    return (1);
        !          2401:            len2 -= len1;
        !          2402:            po2 += len1;
        !          2403:            qp1 = qp1->qb_forw;
        !          2404:            po1 = qp1->qb_data;
        !          2405:            len1 = qp1->qb_len;
        !          2406:        } else {
        !          2407:            if (bcmp(po1, po2, len1))
        !          2408:                    return (1);
        !          2409:            len1 -= len2;
        !          2410:            po1 += len2;
        !          2411:            qp2 = qp2->qb_forw;
        !          2412:            po2 = qp2->qb_data;
        !          2413:            len2 = qp2->qb_len;
        !          2414:        }
        !          2415:     }
        !          2416: 
        !          2417:     if (len1 == 0)
        !          2418:            qp1 = qp1->qb_forw;
        !          2419:     if (len2 == 0)
        !          2420:            qp2 = qp2->qb_forw;
        !          2421:     while (qp1 != qb1 && qp1->qb_len == 0)
        !          2422:            qp1 = qp1->qb_forw;
        !          2423:     while (qp2 != qb2 && qp2->qb_len == 0)
        !          2424:            qp2 = qp2->qb_forw;
        !          2425:     if (qp1 == qb1 && qp2 == qb2)
        !          2426:        return (0);     /* perfect match */
        !          2427: 
        !          2428:     return (1);
        !          2429: }
        !          2430: 
        !          2431: /*
        !          2432:  * compare two bitstrings. Including the little bits left at the end but
        !          2433:  * not the bits not in the strings
        !          2434:  */
        !          2435: bit_cmp(b1, b2)
        !          2436: PE     b1, b2;
        !          2437: {
        !          2438:        int     len1, len2;
        !          2439:        register char   *cp1, *cp2;
        !          2440: 
        !          2441:        if (b1 == NULLPE && b2 == NULLPE)
        !          2442:            return (0);
        !          2443:        if (b1 == NULLPE || b2 == NULLPE)
        !          2444:            goto fail;
        !          2445: 
        !          2446:        if ((cp1 = bitstr2strb(b1, &len1)) == NULL)
        !          2447:            goto fail;
        !          2448:        if ((cp2 = bitstr2strb(b2, &len2)) == NULL) {
        !          2449:            free(cp1);
        !          2450:            goto fail;
        !          2451:        }
        !          2452: 
        !          2453:        if (len1 != len2 || bcmp(cp1, cp2, len1/8)) {
        !          2454:            free(cp1);
        !          2455:            free(cp2);
        !          2456:            goto fail;
        !          2457:        }
        !          2458: 
        !          2459:        if (len1 % 8) {
        !          2460:                int i;
        !          2461:                int     mask;
        !          2462: 
        !          2463:                /* Check those last few bits */
        !          2464:                i = len1/8;
        !          2465:                mask = (0xff00 >> len1 % 8) & 0xff;
        !          2466:                if ((cp1[i] & mask) != (cp2[i] & mask)) {
        !          2467:                    free(cp1);
        !          2468:                    free(cp2);
        !          2469:                    goto fail;
        !          2470:                }
        !          2471:        }
        !          2472: 
        !          2473:        free(cp1);
        !          2474:        free(cp2);
        !          2475:        return (0);
        !          2476: 
        !          2477:     fail:
        !          2478:        return (1);
        !          2479: }
        !          2480: 
        !          2481: #define MKMASK 0x7
        !          2482: #define MKSHIFT 6
        !          2483: /*
        !          2484:  * Generate a randomish list of PElement s for use as ANY or SET  OF ANY ....
        !          2485:  */
        !          2486: PE
        !          2487: mkpelist(i)
        !          2488: {
        !          2489:     PE pe, fpe = NULL;
        !          2490: 
        !          2491:     fpe = pe_alloc(PE_CLASS_PRIV, PE_FORM_CONS, (PElementID ) i);
        !          2492:     while (i > 0) {
        !          2493:        pe = mkpe(i);
        !          2494:        pe->pe_next = fpe->pe_cons;
        !          2495:        fpe->pe_cons = pe;
        !          2496:        i--;
        !          2497:     }
        !          2498:     return (fpe);
        !          2499: }
        !          2500: 
        !          2501: /*
        !          2502:  * generate a randomish PElement
        !          2503:  */
        !          2504: PE
        !          2505: mkpe(i)
        !          2506: {
        !          2507:     int        id, class;
        !          2508:     PE         pe;
        !          2509: 
        !          2510:     id = i * i + 1;
        !          2511:     class = PE_CLASS_PRIV;
        !          2512:     switch ((i*i >> MKSHIFT) & MKMASK) {
        !          2513:     case 5:
        !          2514:     case 0:
        !          2515:        pe = flag2prim(i & 0x1, (PElementClass ) class, (PElementID ) id);
        !          2516:        break;
        !          2517:     
        !          2518:     case 6:
        !          2519:     case 1:
        !          2520:        pe = num2prim(i, (PElementClass ) class, (PElementID ) id);
        !          2521:        break;
        !          2522: 
        !          2523:     case 7:
        !          2524:     case 2:
        !          2525:        pe = str2prim("mkpelist:testdata", 17, (PElementClass ) class,
        !          2526:        (PElementID ) id);
        !          2527:        break;
        !          2528: 
        !          2529:     case 3:
        !          2530:        pe = strb2bitstr("\021\0245\375\0124", 4,
        !          2531:            (PElementClass ) class, (PElementID ) id);
        !          2532:        break;
        !          2533:     
        !          2534:     case 4:
        !          2535:        pe = mkpelist(i - 1);
        !          2536:        break;
        !          2537: 
        !          2538:     default:
        !          2539:        ferrd(1, "mkpelist:internal error %d case not handled\n",
        !          2540:            (i*i >> MKSHIFT) & MKMASK);
        !          2541:     }
        !          2542: 
        !          2543:     return (pe);
        !          2544: }
        !          2545: 
        !          2546: #define OID_SIZE       6
        !          2547: /*
        !          2548:  * make an OID for testing
        !          2549:  */
        !          2550: OID
        !          2551: mkoid(i)
        !          2552: int    i;
        !          2553: {
        !          2554:     OID        oid;
        !          2555:     int        oid_cnt = i % OID_SIZE;
        !          2556: 
        !          2557:     if ((oid = new(struct OIDentifier)) == NULL) {
        !          2558:        (void) printf("mkoid:calloc did not work\n");
        !          2559:        return NULL;
        !          2560:     }
        !          2561:     if (oid_cnt < 2)
        !          2562:        oid_cnt = 2;    /* At least two integers long */
        !          2563:     oid->oid_nelem = oid_cnt;
        !          2564:     if ((oid->oid_elements =
        !          2565:         (unsigned int *)calloc((unsigned ) oid_cnt, sizeof (int))) == NULL) {
        !          2566:        (void) printf("mkoid:calloc 2 did not work\n");
        !          2567:        return NULL;
        !          2568:     }
        !          2569:     while (oid_cnt > 2) {
        !          2570:        oid->oid_elements[oid_cnt - 1] = oid_cnt*i + 33;
        !          2571:         oid_cnt--;
        !          2572:     }
        !          2573: 
        !          2574:     oid->oid_elements[0] = 1;
        !          2575:     oid->oid_elements[1] = 17;
        !          2576: 
        !          2577: 
        !          2578:     return (oid);
        !          2579: }
        !          2580: 
        !          2581: /*
        !          2582:  * Produce an External structure initialised to test values
        !          2583:  * for testing EXTERNAL encoding routines
        !          2584:  */
        !          2585: struct type_UNIV_EXTERNAL *
        !          2586: mkext(i)
        !          2587: int    i;
        !          2588: {
        !          2589:     int        k;
        !          2590:     struct type_UNIV_EXTERNAL *p;
        !          2591: 
        !          2592:     k = i + 2;
        !          2593:     k *= k;    /* generate a more random looking number */
        !          2594:     k %= 51; /* Keep it in a reasonable bounds to avoid overflow */
        !          2595:     if ((p = new(struct type_UNIV_EXTERNAL)) == NULL
        !          2596:     || (p->encoding = new(struct choice_UNIV_0)) == NULL)
        !          2597:        ferr(1, "mkext:malloc:out of memory\n");
        !          2598:     
        !          2599:     if (i & 0x1)
        !          2600:        p->direct__reference = mkoid(i*3);
        !          2601:     
        !          2602:     p->indirect__reference = k & 0x7c;
        !          2603: 
        !          2604:     p->data__value__descriptor = str2qb("A very wild type of data", 25, 1);
        !          2605: 
        !          2606:     switch (p->encoding->offset = (k % choice_UNIV_0_arbitrary) + 1) {
        !          2607: 
        !          2608:     case choice_UNIV_0_arbitrary:
        !          2609:        p->encoding->un.single__ASN1__type = mkpe(k % 7);
        !          2610:        break;
        !          2611: 
        !          2612:     case choice_UNIV_0_single__ASN1__type:
        !          2613:        p->encoding->un.single__ASN1__type = mkpe(k % 5);
        !          2614:        break;
        !          2615: 
        !          2616:     case choice_UNIV_0_octet__aligned:
        !          2617:        p->encoding->un.octet__aligned = str2qb("Some test data", 15, 1);
        !          2618:        break;
        !          2619: 
        !          2620:     default:
        !          2621:        ferrd(1, "mkext:internal error: bad offset %d\n", p->encoding->offset);
        !          2622: 
        !          2623:     }
        !          2624: 
        !          2625:     return (p);
        !          2626: }
        !          2627: 
        !          2628: /*
        !          2629:  * compare two external types to see if they are identical - return zero if
        !          2630:  * they are and non zero if they are different
        !          2631:  */
        !          2632: ext_cmp(e1, e2)
        !          2633: register struct      type_UNIV_EXTERNAL *e1, *e2;
        !          2634: {
        !          2635:      if (e1->direct__reference != NULLOID && e2->direct__reference != NULLOID) {
        !          2636:         if (oid_cmp(e1->direct__reference, e2->direct__reference))
        !          2637:                return (1);
        !          2638:     } else {
        !          2639:        if (e1->direct__reference != NULLOID || e2->direct__reference != NULLOID)
        !          2640:            return (1);
        !          2641:        if (e1->indirect__reference != e2->indirect__reference)
        !          2642:            return (1);
        !          2643:     }
        !          2644:      if (e1->data__value__descriptor != NULLQB
        !          2645:      && e2->data__value__descriptor != NULLQB) {
        !          2646:         if (qb_cmp(e1->data__value__descriptor, e2->data__value__descriptor))
        !          2647:                return (1);
        !          2648:     } else if (e1->data__value__descriptor != NULLQB
        !          2649:        || e2->data__value__descriptor != NULLQB)
        !          2650:            return (1);
        !          2651:     if (e1->encoding == NULL || e2->encoding == NULL)
        !          2652:        return (1);
        !          2653:     if (e1->encoding->offset != e2->encoding->offset)
        !          2654:        return (1);
        !          2655:     switch (e1->encoding->offset) {
        !          2656:     case choice_UNIV_0_single__ASN1__type:
        !          2657:         if (e1->encoding->un.single__ASN1__type == NULLPE
        !          2658:         || e2->encoding->un.single__ASN1__type == NULLPE)
        !          2659:             return (1);
        !          2660:         if (pe_cmp(e1->encoding->un.single__ASN1__type,
        !          2661:             e2->encoding->un.single__ASN1__type))
        !          2662:            return (1);
        !          2663:        break;
        !          2664: 
        !          2665:     case choice_UNIV_0_octet__aligned:
        !          2666:         if (e1->encoding->un.octet__aligned == NULLQB
        !          2667:         || e2->encoding->un.octet__aligned == NULLQB)
        !          2668:             return (1);
        !          2669:         if (qb_cmp(e1->encoding->un.octet__aligned,
        !          2670:             e2->encoding->un.octet__aligned))
        !          2671:            return (1);
        !          2672:        break;
        !          2673: 
        !          2674:     case choice_UNIV_0_arbitrary:
        !          2675:         if (e1->encoding->un.arbitrary == NULLPE
        !          2676:         || e2->encoding->un.arbitrary == NULLPE)
        !          2677:             return (1);
        !          2678:         if (pe_cmp(e1->encoding->un.arbitrary,
        !          2679:             e2->encoding->un.arbitrary))
        !          2680:            return (1);
        !          2681:        break;
        !          2682: 
        !          2683:     default:
        !          2684:        ferrd(1, "ext_cmp:illegal offset value %d\n", e1->encoding->offset);
        !          2685:     }
        !          2686: 
        !          2687:     return (0);
        !          2688: }
        !          2689: /*
        !          2690:  * print the PE structure pointed to by pe
        !          2691:  */
        !          2692: print_pe(pe, n)
        !          2693: PE      pe;
        !          2694: int     n;
        !          2695: {
        !          2696: 
        !          2697:     if (pe == NULL)
        !          2698:        return;
        !          2699:     (void) printf("%*s", 4 * n, "");
        !          2700: #if 0
        !          2701:     (void) printf("error = %d, context = %x, class = %x, form = %x, id = %x\n",
        !          2702:           pe->pe_errno, pe->pe_context, pe->pe_class, pe->pe_form, pe->pe_id);
        !          2703: #endif
        !          2704:     if (pe->pe_errno)
        !          2705:        (void) printf(" errno = %d", pe->pe_errno);
        !          2706:     if (pe->pe_class == PE_CLASS_UNIV)
        !          2707:        (void) printf(" %s", idname( (int )pe->pe_id));
        !          2708:     else if (pe->pe_class == PE_CLASS_CONT)
        !          2709:        (void) printf("[%d]", pe->pe_id);
        !          2710:     else
        !          2711:        (void) printf("[%s %d]", clname( (int )pe->pe_class), pe->pe_id);
        !          2712: 
        !          2713:     (void) printf("\n");
        !          2714: 
        !          2715: #if 0
        !          2716:     (void) printf("%*s", 4 * n, "");
        !          2717:     (void) printf("cardinality = %d offset = %d\n", pe->pe_cardinal, pe->pe_offset);
        !          2718: #endif
        !          2719:     if (pe->pe_form != 0x0) {
        !          2720:        if (pe->pe_cons != NULLPE)
        !          2721:            print_pe(pe->pe_cons, n + 1);
        !          2722:     } else {
        !          2723:        (void) printf("%*s", 4 * n, "");
        !          2724:        switch (pe->pe_id) {
        !          2725:        case PE_PRIM_BOOL:
        !          2726:            (void) printf("%d", prim2flag(pe));
        !          2727:            break;
        !          2728: 
        !          2729:        case PE_PRIM_INT:
        !          2730:            (void) printf(" %d", prim2num(pe));
        !          2731:            break;
        !          2732:        case PE_PRIM_BITS:
        !          2733:            prntbits(pe);
        !          2734:            break;
        !          2735: 
        !          2736:        case PE_PRIM_OCTS:
        !          2737:            (void) prntos(pe);
        !          2738:            break;
        !          2739: 
        !          2740:        case PE_PRIM_NULL:
        !          2741:            break;
        !          2742: 
        !          2743: 
        !          2744:        case PE_DEFN_NUMS:
        !          2745:        case PE_DEFN_PRTS:
        !          2746:        case PE_DEFN_T61S:
        !          2747:        case PE_DEFN_VTXS:
        !          2748:        case PE_DEFN_IA5S:
        !          2749:        case PE_DEFN_GFXS:
        !          2750:        case PE_DEFN_VISS:
        !          2751:        case PE_DEFN_GENS:
        !          2752:        case PE_DEFN_CHRS:
        !          2753:            (void) prntstr(pe);
        !          2754:            break;
        !          2755: 
        !          2756: 
        !          2757:        case PE_PRIM_OID:
        !          2758:        case PE_CONS_EXTN:
        !          2759:        case PE_PRIM_REAL:
        !          2760:        case PE_PRIM_ENUM:
        !          2761:        case PE_PRIM_ENCR:
        !          2762: 
        !          2763:        case PE_CONS_SEQ:
        !          2764:        case PE_CONS_SET:
        !          2765: 
        !          2766:        case PE_DEFN_UTCT:
        !          2767:        case PE_DEFN_GENT:
        !          2768:        default:
        !          2769:            (void) printf("Unimplemented %d ", pe->pe_id);
        !          2770:            break;
        !          2771:        }
        !          2772:        (void) printf("\n");
        !          2773:     }
        !          2774:     if (pe->pe_next != NULLPE) {
        !          2775:        (void) printf("%*s", 4 * n, "pe_next:\n");
        !          2776:        print_pe(pe->pe_next, n);
        !          2777:     }
        !          2778: }
        !          2779: 
        !          2780: /*
        !          2781:  * return the string describing that class
        !          2782:  */
        !          2783: static char   *
        !          2784: clname(cl)
        !          2785: int     cl;
        !          2786: {
        !          2787:     char   *p;
        !          2788:     static char buf[30];
        !          2789: 
        !          2790:     switch (cl) {
        !          2791:     case PE_CLASS_UNIV:
        !          2792:        p = "Universal";
        !          2793:        break;
        !          2794: 
        !          2795:     case PE_CLASS_APPL:
        !          2796:        p = "Application";
        !          2797:        break;
        !          2798: 
        !          2799:     case PE_CLASS_CONT:
        !          2800:        p = "Context";
        !          2801:        break;
        !          2802: 
        !          2803:     case PE_CLASS_PRIV:
        !          2804:        p = "Private";
        !          2805:        break;
        !          2806: 
        !          2807:     default:
        !          2808:        (void) sprintf(buf, "Unknown Class %d", cl);
        !          2809:        p = buf;
        !          2810:        break;
        !          2811:     }
        !          2812:     return (p);
        !          2813: }
        !          2814: 
        !          2815: 
        !          2816: /*
        !          2817:  * return the string describing that identity or the number itself
        !          2818:  * Assuming a Universal class
        !          2819:  */
        !          2820: static char   *
        !          2821: idname(id)
        !          2822: int     id;
        !          2823: {
        !          2824:     char   *p;
        !          2825:     static char buf[40];
        !          2826: 
        !          2827:     switch (id) {
        !          2828:     case PE_PRIM_BOOL:
        !          2829:        p = "Boolean";
        !          2830:        break;
        !          2831: 
        !          2832:     case PE_PRIM_INT:
        !          2833:        p = "Integer";
        !          2834:        break;
        !          2835: 
        !          2836:     case PE_PRIM_BITS:
        !          2837:        p = "Bit String";
        !          2838:        break;
        !          2839: 
        !          2840:     case PE_PRIM_OCTS:
        !          2841:        p = "Octet String";
        !          2842:        break;
        !          2843: 
        !          2844:     case PE_PRIM_NULL:
        !          2845:        p = "Null";
        !          2846:        break;
        !          2847: 
        !          2848:     case PE_PRIM_OID:
        !          2849:        p = "Object Descriptor";
        !          2850:        break;
        !          2851: 
        !          2852:     case PE_CONS_EXTN:
        !          2853:        p = "External";
        !          2854:        break;
        !          2855: 
        !          2856:     case PE_PRIM_REAL:
        !          2857:        p = "Real";
        !          2858:        break;
        !          2859: 
        !          2860:     case PE_PRIM_ENUM:
        !          2861:        p = "Enumerated Type";
        !          2862:        break;
        !          2863: 
        !          2864:     case PE_PRIM_ENCR:
        !          2865:        p = "Encrypted Type";
        !          2866:        break;
        !          2867: 
        !          2868:     case PE_CONS_SEQ:
        !          2869:        p = "Sequence";
        !          2870:        break;
        !          2871: 
        !          2872:     case PE_CONS_SET:
        !          2873:        p = "Set";
        !          2874:        break;
        !          2875: 
        !          2876:     case PE_DEFN_NUMS:
        !          2877:        p = "Numeric String";
        !          2878:        break;
        !          2879: 
        !          2880:     case PE_DEFN_PRTS:
        !          2881:        p = "Printable String";
        !          2882:        break;
        !          2883: 
        !          2884:     case PE_DEFN_T61S:
        !          2885:        p = "T.61 String";
        !          2886:        break;
        !          2887: 
        !          2888:     case PE_DEFN_VTXS:
        !          2889:        p = "Videotex String";
        !          2890:        break;
        !          2891: 
        !          2892:     case PE_DEFN_IA5S:
        !          2893:        p = "IA5 String";
        !          2894:        break;
        !          2895: 
        !          2896:     case PE_DEFN_UTCT:
        !          2897:        p = "UTC Time";
        !          2898:        break;
        !          2899: 
        !          2900:     case PE_DEFN_GENT:
        !          2901:        p = "Generalised Time";
        !          2902:        break;
        !          2903: 
        !          2904:     case PE_DEFN_GFXS:
        !          2905:        p = "Graphics String";
        !          2906:        break;
        !          2907: 
        !          2908:     case PE_DEFN_VISS:
        !          2909:        p = "Visable String";
        !          2910:        break;
        !          2911: 
        !          2912:     case PE_DEFN_GENS:
        !          2913:        p = "General String";
        !          2914:        break;
        !          2915: 
        !          2916:     case PE_DEFN_CHRS:
        !          2917:        p = "Character String";
        !          2918:        break;
        !          2919: 
        !          2920:     default:
        !          2921:        (void) sprintf(buf, "Unknown Universal %d", id);
        !          2922:        p = buf;
        !          2923:        break;
        !          2924:     }
        !          2925:     return (p);
        !          2926: }
        !          2927: /*
        !          2928:  * Print out the value of a bits string
        !          2929:  */
        !          2930: static prntbits(pe)
        !          2931: PE      pe;
        !          2932: {
        !          2933:     int     len, i;
        !          2934: 
        !          2935:     if ((len = pe->pe_nbits) < 0) {
        !          2936:        (void) printf("prntbits:Bad bistring\n");
        !          2937:        return;
        !          2938:     }
        !          2939:     (void) printf("Bits:");
        !          2940:     for (i = 0; i < len; i++)
        !          2941:        if (bit_test(pe, i))
        !          2942:            (void) printf(" %d", i);
        !          2943: 
        !          2944:     (void) putchar('\n');
        !          2945: }
        !          2946: 
        !          2947: /*
        !          2948:  * Dump a bunch of hex digits printing out those that are printable
        !          2949:  * Print out a given length of octets as hex (with the ASCII
        !          2950:  * characters given if they have any
        !          2951:  */
        !          2952: static pclen(s, len)
        !          2953: register char *s;
        !          2954: register int len;
        !          2955: {
        !          2956:     register int cnt = 0;
        !          2957: 
        !          2958:     while (len-- > 0) {
        !          2959:        if (cnt % 8 == 0)
        !          2960:            (void) printf("\n%d:", cnt / 8 + 1);
        !          2961:        if (isprint(*s & 0x7f))
        !          2962:            (void) printf("\t%02x(%c)", *s & 0xff, *s & 0x7f);
        !          2963:        else
        !          2964:            (void) printf("\t%02x", *s & 0xff);
        !          2965:        s++;
        !          2966:        cnt++;
        !          2967:     }
        !          2968:     (void) putchar('\n');
        !          2969: }
        !          2970: 
        !          2971: /*
        !          2972:  * print out an octet string
        !          2973:  */
        !          2974: static prntos(pe)
        !          2975: PE      pe;
        !          2976: {
        !          2977:     struct qbuf *qb;
        !          2978: 
        !          2979:     if ((qb = prim2qb(pe)) == NULL) {
        !          2980: bad:
        !          2981:        (void) printf("prntos:bad octet string\n");
        !          2982:        return (NOTOK);
        !          2983:     }
        !          2984:     if (qb_pullup(qb) == NOTOK)
        !          2985:        goto bad;
        !          2986: 
        !          2987:     if (qb->qb_forw->qb_data == NULL || qb->qb_forw->qb_len < 0)
        !          2988:        goto bad;
        !          2989: 
        !          2990:     pclen(qb->qb_forw->qb_data, qb->qb_forw->qb_len);
        !          2991:     return (OK);
        !          2992: }
        !          2993: 
        !          2994: /*
        !          2995:  * print out a string which should be printable
        !          2996:  */
        !          2997: static prntstr(pe)
        !          2998: PE      pe;
        !          2999: {
        !          3000:     struct qbuf *qb;
        !          3001: 
        !          3002:     if ((qb = prim2qb(pe)) == NULL) {
        !          3003: bad:
        !          3004:        (void) printf("prntstr:bad string\n");
        !          3005:        return (NOTOK);
        !          3006:     }
        !          3007:     if (qb_pullup(qb) == NOTOK)
        !          3008:        goto bad;
        !          3009: 
        !          3010:     if (qb->qb_forw->qb_data == NULL || qb->qb_forw->qb_len < 0)
        !          3011:        goto bad;
        !          3012: 
        !          3013:     (void) printf("\"%s\"", qb->qb_forw->qb_data);
        !          3014:     return (OK);
        !          3015: }

unix.superglobalmegacorp.com

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