Annotation of researchv10no/cmd/lcc/ph/bug.c, revision 1.1.1.1

1.1       root        1: /* The Plum Hall Validation Suite for C
                      2:  * Unpublished copyright (c) 1986-1990, Chiron Systems Inc and Plum Hall Inc.
                      3:  * VERSION: 2.00
                      4:  * DATE: 90/04/05
                      5:  * The "ANSI" mode of the Suite corresponds to the official ANSI C, X3.159-1989.
                      6:  * As per your license agreement, your distribution is not to be moved or copied outside the Designated Site
                      7:  * without specific permission from Plum Hall Inc.
                      8:  */
                      9: 
                     10: #define ANSI 1  /* This file follows ANSI arithmetic rules, which may not work in non-ANSI modes */
                     11: #include "types.h"
                     12: int main()
                     13:        {
                     14:        extern char *Filename;
                     15:        auto struct {
                     16:                CHAR c;
                     17:                SHORT s;
                     18:                INT i;
                     19:                UCHAR uc;
                     20:                USHORT us;
                     21:                UINT ui;
                     22:                LONG l;
                     23:                ULONG ul;
                     24:                FLOAT f;
                     25:                DOUBLE d;
                     26: #if ANSI
                     27:                SCHAR sc;
                     28:                LDOUBLE ld;
                     29: #endif
                     30:                } G, *pG = &G;
                     31:        pG->c = 7;
                     32: #if ANSI
                     33:        pG->sc = 8;
                     34: #endif
                     35:        pG->s = 9;
                     36:        pG->i = 10;
                     37:        pG->uc = 11;
                     38:        pG->us = 12;
                     39:        pG->ui = 13;
                     40:        pG->l = 14;
                     41:        pG->ul = 15;
                     42:        pG->f = 16;
                     43:        pG->d = 17;
                     44: #if ANSI
                     45:        pG->ld = 18;
                     46: #endif
                     47:        {
                     48:        auto CHAR Jc[12][12];
                     49:        int x_0 = 0;
                     50:        int y_0 = 0;
                     51: #if ANSI
                     52:        auto SCHAR Jsc[12][12];
                     53:        int x_1 = 1;
                     54:        int y_1 = 1;
                     55: #endif
                     56:        auto SHORT Js[12][12];
                     57:        int x_2 = 2;
                     58:        int y_2 = 2;
                     59:        auto INT Ji[12][12];
                     60:        int x_3 = 3;
                     61:        int y_3 = 3;
                     62:        auto UCHAR Juc[12][12];
                     63:        int x_4 = 4;
                     64:        int y_4 = 4;
                     65:        auto USHORT Jus[12][12];
                     66:        int x_5 = 5;
                     67:        int y_5 = 5;
                     68:        auto UINT Jui[12][12];
                     69:        int x_6 = 6;
                     70:        int y_6 = 6;
                     71:        auto LONG Jl[12][12];
                     72:        int x_7 = 7;
                     73:        int y_7 = 7;
                     74:        auto ULONG Jul[12][12];
                     75:        int x_8 = 8;
                     76:        int y_8 = 8;
                     77:        auto FLOAT Jf[12][12];
                     78:        int x_9 = 9;
                     79:        int y_9 = 9;
                     80:        auto DOUBLE Jd[12][12];
                     81:        int x_10 = 10;
                     82:        int y_10 = 10;
                     83: #if ANSI
                     84:        auto LDOUBLE Jld[12][12];
                     85:        int x_11 = 11;
                     86:        int y_11 = 11;
                     87: #endif
                     88:        Jc[x_0][y_0] = 7;
                     89: #if ANSI
                     90:        Jsc[x_1][y_1] = 8;
                     91: #endif
                     92:        Js[x_2][y_2] = 9;
                     93:        Ji[x_3][y_3] = 10;
                     94:        Juc[x_4][y_4] = 11;
                     95:        Jus[x_5][y_5] = 12;
                     96:        Jui[x_6][y_6] = 13;
                     97:        Jl[x_7][y_7] = 14;
                     98:        Jul[x_8][y_8] = 15;
                     99:        Jf[x_9][y_9] = 16;
                    100:        Jd[x_10][y_10] = 17;
                    101: #if ANSI
                    102:        Jld[x_11][y_11] = 18;
                    103: #endif
                    104:        {
                    105:        int true = 1, false = 0;
                    106:        Filename =  " auto pstruct1 auto array2 plus ";
                    107:        iequals(__LINE__, pG->c + Jc[x_0][y_0], 14);
                    108:        iequals(__LINE__, Jc[x_0][y_0] + pG->c, 14);
                    109: #if ANSI
                    110:        iequals(__LINE__, pG->c + Jsc[x_1][y_1], 15);
                    111:        iequals(__LINE__, Jsc[x_1][y_1] + pG->c, 15);
                    112: #endif
                    113:        iequals(__LINE__, pG->c + Js[x_2][y_2], 16);
                    114:        iequals(__LINE__, Js[x_2][y_2] + pG->c, 16);
                    115:        iequals(__LINE__, pG->c + Ji[x_3][y_3], 17);
                    116:        iequals(__LINE__, Ji[x_3][y_3] + pG->c, 17);
                    117:        iequals(__LINE__, pG->c + Juc[x_4][y_4], 18);
                    118:        iequals(__LINE__, Juc[x_4][y_4] + pG->c, 18);
                    119:        iequals(__LINE__, pG->c + Jus[x_5][y_5], 19);
                    120:        iequals(__LINE__, Jus[x_5][y_5] + pG->c, 19);
                    121:        iequals(__LINE__, pG->c + Jui[x_6][y_6], 20);
                    122:        iequals(__LINE__, Jui[x_6][y_6] + pG->c, 20);
                    123:        lequals(__LINE__, pG->c + Jl[x_7][y_7], 21L);
                    124:        lequals(__LINE__, Jl[x_7][y_7] + pG->c, 21L);
                    125:        lequals(__LINE__, pG->c + Jul[x_8][y_8], 22L);
                    126:        lequals(__LINE__, Jul[x_8][y_8] + pG->c, 22L);
                    127:        dequals(__LINE__, pG->c + Jf[x_9][y_9], 23.);
                    128:        dequals(__LINE__, Jf[x_9][y_9] + pG->c, 23.);
                    129:        dequals(__LINE__, pG->c + Jd[x_10][y_10], 24.);
                    130:        dequals(__LINE__, Jd[x_10][y_10] + pG->c, 24.);
                    131: #if ANSI
                    132:        ldequals(__LINE__, pG->c + Jld[x_11][y_11], 25.L);
                    133:        ldequals(__LINE__, Jld[x_11][y_11] + pG->c, 25.L);
                    134: #endif
                    135: #if ANSI
                    136:        iequals(__LINE__, pG->sc + Jc[x_0][y_0], 15);
                    137:        iequals(__LINE__, Jc[x_0][y_0] + pG->sc, 15);
                    138: #endif
                    139: #if ANSI
                    140:        iequals(__LINE__, pG->sc + Jsc[x_1][y_1], 16);
                    141:        iequals(__LINE__, Jsc[x_1][y_1] + pG->sc, 16);
                    142: #endif
                    143: #if ANSI
                    144:        iequals(__LINE__, pG->sc + Js[x_2][y_2], 17);
                    145:        iequals(__LINE__, Js[x_2][y_2] + pG->sc, 17);
                    146: #endif
                    147: #if ANSI
                    148:        iequals(__LINE__, pG->sc + Ji[x_3][y_3], 18);
                    149:        iequals(__LINE__, Ji[x_3][y_3] + pG->sc, 18);
                    150: #endif
                    151: #if ANSI
                    152:        iequals(__LINE__, pG->sc + Juc[x_4][y_4], 19);
                    153:        iequals(__LINE__, Juc[x_4][y_4] + pG->sc, 19);
                    154: #endif
                    155: #if ANSI
                    156:        iequals(__LINE__, pG->sc + Jus[x_5][y_5], 20);
                    157:        iequals(__LINE__, Jus[x_5][y_5] + pG->sc, 20);
                    158: #endif
                    159: #if ANSI
                    160:        iequals(__LINE__, pG->sc + Jui[x_6][y_6], 21);
                    161:        iequals(__LINE__, Jui[x_6][y_6] + pG->sc, 21);
                    162: #endif
                    163: #if ANSI
                    164:        lequals(__LINE__, pG->sc + Jl[x_7][y_7], 22L);
                    165:        lequals(__LINE__, Jl[x_7][y_7] + pG->sc, 22L);
                    166: #endif
                    167: #if ANSI
                    168:        lequals(__LINE__, pG->sc + Jul[x_8][y_8], 23L);
                    169:        lequals(__LINE__, Jul[x_8][y_8] + pG->sc, 23L);
                    170: #endif
                    171: #if ANSI
                    172:        dequals(__LINE__, pG->sc + Jf[x_9][y_9], 24.);
                    173:        dequals(__LINE__, Jf[x_9][y_9] + pG->sc, 24.);
                    174: #endif
                    175: #if ANSI
                    176:        dequals(__LINE__, pG->sc + Jd[x_10][y_10], 25.);
                    177:        dequals(__LINE__, Jd[x_10][y_10] + pG->sc, 25.);
                    178: #endif
                    179: #if ANSI
                    180:        ldequals(__LINE__, pG->sc + Jld[x_11][y_11], 26.L);
                    181:        ldequals(__LINE__, Jld[x_11][y_11] + pG->sc, 26.L);
                    182: #endif
                    183:        iequals(__LINE__, pG->s + Jc[x_0][y_0], 16);
                    184:        iequals(__LINE__, Jc[x_0][y_0] + pG->s, 16);
                    185: #if ANSI
                    186:        iequals(__LINE__, pG->s + Jsc[x_1][y_1], 17);
                    187:        iequals(__LINE__, Jsc[x_1][y_1] + pG->s, 17);
                    188: #endif
                    189:        iequals(__LINE__, pG->s + Js[x_2][y_2], 18);
                    190:        iequals(__LINE__, Js[x_2][y_2] + pG->s, 18);
                    191:        iequals(__LINE__, pG->s + Ji[x_3][y_3], 19);
                    192:        iequals(__LINE__, Ji[x_3][y_3] + pG->s, 19);
                    193:        iequals(__LINE__, pG->s + Juc[x_4][y_4], 20);
                    194:        iequals(__LINE__, Juc[x_4][y_4] + pG->s, 20);
                    195:        iequals(__LINE__, pG->s + Jus[x_5][y_5], 21);
                    196:        iequals(__LINE__, Jus[x_5][y_5] + pG->s, 21);
                    197:        iequals(__LINE__, pG->s + Jui[x_6][y_6], 22);
                    198:        iequals(__LINE__, Jui[x_6][y_6] + pG->s, 22);
                    199:        lequals(__LINE__, pG->s + Jl[x_7][y_7], 23L);
                    200:        lequals(__LINE__, Jl[x_7][y_7] + pG->s, 23L);
                    201:        lequals(__LINE__, pG->s + Jul[x_8][y_8], 24L);
                    202:        lequals(__LINE__, Jul[x_8][y_8] + pG->s, 24L);
                    203:        dequals(__LINE__, pG->s + Jf[x_9][y_9], 25.);
                    204:        dequals(__LINE__, Jf[x_9][y_9] + pG->s, 25.);
                    205:        dequals(__LINE__, pG->s + Jd[x_10][y_10], 26.);
                    206:        dequals(__LINE__, Jd[x_10][y_10] + pG->s, 26.);
                    207: #if ANSI
                    208:        ldequals(__LINE__, pG->s + Jld[x_11][y_11], 27.L);
                    209:        ldequals(__LINE__, Jld[x_11][y_11] + pG->s, 27.L);
                    210: #endif
                    211:        iequals(__LINE__, pG->i + Jc[x_0][y_0], 17);
                    212:        iequals(__LINE__, Jc[x_0][y_0] + pG->i, 17);
                    213: #if ANSI
                    214:        iequals(__LINE__, pG->i + Jsc[x_1][y_1], 18);
                    215:        iequals(__LINE__, Jsc[x_1][y_1] + pG->i, 18);
                    216: #endif
                    217:        iequals(__LINE__, pG->i + Js[x_2][y_2], 19);
                    218:        iequals(__LINE__, Js[x_2][y_2] + pG->i, 19);
                    219:        iequals(__LINE__, pG->i + Ji[x_3][y_3], 20);
                    220:        iequals(__LINE__, Ji[x_3][y_3] + pG->i, 20);
                    221:        iequals(__LINE__, pG->i + Juc[x_4][y_4], 21);
                    222:        iequals(__LINE__, Juc[x_4][y_4] + pG->i, 21);
                    223:        iequals(__LINE__, pG->i + Jus[x_5][y_5], 22);
                    224:        iequals(__LINE__, Jus[x_5][y_5] + pG->i, 22);
                    225:        iequals(__LINE__, pG->i + Jui[x_6][y_6], 23);
                    226:        iequals(__LINE__, Jui[x_6][y_6] + pG->i, 23);
                    227:        lequals(__LINE__, pG->i + Jl[x_7][y_7], 24L);
                    228:        lequals(__LINE__, Jl[x_7][y_7] + pG->i, 24L);
                    229:        lequals(__LINE__, pG->i + Jul[x_8][y_8], 25L);
                    230:        lequals(__LINE__, Jul[x_8][y_8] + pG->i, 25L);
                    231:        dequals(__LINE__, pG->i + Jf[x_9][y_9], 26.);
                    232:        dequals(__LINE__, Jf[x_9][y_9] + pG->i, 26.);
                    233:        dequals(__LINE__, pG->i + Jd[x_10][y_10], 27.);
                    234:        dequals(__LINE__, Jd[x_10][y_10] + pG->i, 27.);
                    235: #if ANSI
                    236:        ldequals(__LINE__, pG->i + Jld[x_11][y_11], 28.L);
                    237:        ldequals(__LINE__, Jld[x_11][y_11] + pG->i, 28.L);
                    238: #endif
                    239:        iequals(__LINE__, pG->uc + Jc[x_0][y_0], 18);
                    240:        iequals(__LINE__, Jc[x_0][y_0] + pG->uc, 18);
                    241: #if ANSI
                    242:        iequals(__LINE__, pG->uc + Jsc[x_1][y_1], 19);
                    243:        iequals(__LINE__, Jsc[x_1][y_1] + pG->uc, 19);
                    244: #endif
                    245:        iequals(__LINE__, pG->uc + Js[x_2][y_2], 20);
                    246:        iequals(__LINE__, Js[x_2][y_2] + pG->uc, 20);
                    247:        iequals(__LINE__, pG->uc + Ji[x_3][y_3], 21);
                    248:        iequals(__LINE__, Ji[x_3][y_3] + pG->uc, 21);
                    249:        iequals(__LINE__, pG->uc + Juc[x_4][y_4], 22);
                    250:        iequals(__LINE__, Juc[x_4][y_4] + pG->uc, 22);
                    251:        iequals(__LINE__, pG->uc + Jus[x_5][y_5], 23);
                    252:        iequals(__LINE__, Jus[x_5][y_5] + pG->uc, 23);
                    253:        iequals(__LINE__, pG->uc + Jui[x_6][y_6], 24);
                    254:        iequals(__LINE__, Jui[x_6][y_6] + pG->uc, 24);
                    255:        lequals(__LINE__, pG->uc + Jl[x_7][y_7], 25L);
                    256:        lequals(__LINE__, Jl[x_7][y_7] + pG->uc, 25L);
                    257:        lequals(__LINE__, pG->uc + Jul[x_8][y_8], 26L);
                    258:        lequals(__LINE__, Jul[x_8][y_8] + pG->uc, 26L);
                    259:        dequals(__LINE__, pG->uc + Jf[x_9][y_9], 27.);
                    260:        dequals(__LINE__, Jf[x_9][y_9] + pG->uc, 27.);
                    261:        dequals(__LINE__, pG->uc + Jd[x_10][y_10], 28.);
                    262:        dequals(__LINE__, Jd[x_10][y_10] + pG->uc, 28.);
                    263: #if ANSI
                    264:        ldequals(__LINE__, pG->uc + Jld[x_11][y_11], 29.L);
                    265:        ldequals(__LINE__, Jld[x_11][y_11] + pG->uc, 29.L);
                    266: #endif
                    267:        iequals(__LINE__, pG->us + Jc[x_0][y_0], 19);
                    268:        iequals(__LINE__, Jc[x_0][y_0] + pG->us, 19);
                    269: #if ANSI
                    270:        iequals(__LINE__, pG->us + Jsc[x_1][y_1], 20);
                    271:        iequals(__LINE__, Jsc[x_1][y_1] + pG->us, 20);
                    272: #endif
                    273:        iequals(__LINE__, pG->us + Js[x_2][y_2], 21);
                    274:        iequals(__LINE__, Js[x_2][y_2] + pG->us, 21);
                    275:        iequals(__LINE__, pG->us + Ji[x_3][y_3], 22);
                    276:        iequals(__LINE__, Ji[x_3][y_3] + pG->us, 22);
                    277:        iequals(__LINE__, pG->us + Juc[x_4][y_4], 23);
                    278:        iequals(__LINE__, Juc[x_4][y_4] + pG->us, 23);
                    279:        iequals(__LINE__, pG->us + Jus[x_5][y_5], 24);
                    280:        iequals(__LINE__, Jus[x_5][y_5] + pG->us, 24);
                    281:        iequals(__LINE__, pG->us + Jui[x_6][y_6], 25);
                    282:        iequals(__LINE__, Jui[x_6][y_6] + pG->us, 25);
                    283:        lequals(__LINE__, pG->us + Jl[x_7][y_7], 26L);
                    284:        lequals(__LINE__, Jl[x_7][y_7] + pG->us, 26L);
                    285:        lequals(__LINE__, pG->us + Jul[x_8][y_8], 27L);
                    286:        lequals(__LINE__, Jul[x_8][y_8] + pG->us, 27L);
                    287:        dequals(__LINE__, pG->us + Jf[x_9][y_9], 28.);
                    288:        dequals(__LINE__, Jf[x_9][y_9] + pG->us, 28.);
                    289:        dequals(__LINE__, pG->us + Jd[x_10][y_10], 29.);
                    290:        dequals(__LINE__, Jd[x_10][y_10] + pG->us, 29.);
                    291: #if ANSI
                    292:        ldequals(__LINE__, pG->us + Jld[x_11][y_11], 30.L);
                    293:        ldequals(__LINE__, Jld[x_11][y_11] + pG->us, 30.L);
                    294: #endif
                    295:        iequals(__LINE__, pG->ui + Jc[x_0][y_0], 20);
                    296:        iequals(__LINE__, Jc[x_0][y_0] + pG->ui, 20);
                    297: #if ANSI
                    298:        iequals(__LINE__, pG->ui + Jsc[x_1][y_1], 21);
                    299:        iequals(__LINE__, Jsc[x_1][y_1] + pG->ui, 21);
                    300: #endif
                    301:        iequals(__LINE__, pG->ui + Js[x_2][y_2], 22);
                    302:        iequals(__LINE__, Js[x_2][y_2] + pG->ui, 22);
                    303:        iequals(__LINE__, pG->ui + Ji[x_3][y_3], 23);
                    304:        iequals(__LINE__, Ji[x_3][y_3] + pG->ui, 23);
                    305:        iequals(__LINE__, pG->ui + Juc[x_4][y_4], 24);
                    306:        iequals(__LINE__, Juc[x_4][y_4] + pG->ui, 24);
                    307:        iequals(__LINE__, pG->ui + Jus[x_5][y_5], 25);
                    308:        iequals(__LINE__, Jus[x_5][y_5] + pG->ui, 25);
                    309:        iequals(__LINE__, pG->ui + Jui[x_6][y_6], 26);
                    310:        iequals(__LINE__, Jui[x_6][y_6] + pG->ui, 26);
                    311:        lequals(__LINE__, pG->ui + Jl[x_7][y_7], 27L);
                    312:        lequals(__LINE__, Jl[x_7][y_7] + pG->ui, 27L);
                    313:        lequals(__LINE__, pG->ui + Jul[x_8][y_8], 28L);
                    314:        lequals(__LINE__, Jul[x_8][y_8] + pG->ui, 28L);
                    315:        dequals(__LINE__, pG->ui + Jf[x_9][y_9], 29.);
                    316:        dequals(__LINE__, Jf[x_9][y_9] + pG->ui, 29.);
                    317:        dequals(__LINE__, pG->ui + Jd[x_10][y_10], 30.);
                    318:        dequals(__LINE__, Jd[x_10][y_10] + pG->ui, 30.);
                    319: #if ANSI
                    320:        ldequals(__LINE__, pG->ui + Jld[x_11][y_11], 31.L);
                    321:        ldequals(__LINE__, Jld[x_11][y_11] + pG->ui, 31.L);
                    322: #endif
                    323:        lequals(__LINE__, pG->l + Jc[x_0][y_0], 21L);
                    324:        lequals(__LINE__, Jc[x_0][y_0] + pG->l, 21L);
                    325: #if ANSI
                    326:        lequals(__LINE__, pG->l + Jsc[x_1][y_1], 22L);
                    327:        lequals(__LINE__, Jsc[x_1][y_1] + pG->l, 22L);
                    328: #endif
                    329:        lequals(__LINE__, pG->l + Js[x_2][y_2], 23L);
                    330:        lequals(__LINE__, Js[x_2][y_2] + pG->l, 23L);
                    331:        lequals(__LINE__, pG->l + Ji[x_3][y_3], 24L);
                    332:        lequals(__LINE__, Ji[x_3][y_3] + pG->l, 24L);
                    333:        lequals(__LINE__, pG->l + Juc[x_4][y_4], 25L);
                    334:        lequals(__LINE__, Juc[x_4][y_4] + pG->l, 25L);
                    335:        lequals(__LINE__, pG->l + Jus[x_5][y_5], 26L);
                    336:        lequals(__LINE__, Jus[x_5][y_5] + pG->l, 26L);
                    337:        lequals(__LINE__, pG->l + Jui[x_6][y_6], 27L);
                    338:        lequals(__LINE__, Jui[x_6][y_6] + pG->l, 27L);
                    339:        lequals(__LINE__, pG->l + Jl[x_7][y_7], 28L);
                    340:        lequals(__LINE__, Jl[x_7][y_7] + pG->l, 28L);
                    341:        lequals(__LINE__, pG->l + Jul[x_8][y_8], 29L);
                    342:        lequals(__LINE__, Jul[x_8][y_8] + pG->l, 29L);
                    343:        dequals(__LINE__, pG->l + Jf[x_9][y_9], 30.);
                    344:        dequals(__LINE__, Jf[x_9][y_9] + pG->l, 30.);
                    345:        dequals(__LINE__, pG->l + Jd[x_10][y_10], 31.);
                    346:        dequals(__LINE__, Jd[x_10][y_10] + pG->l, 31.);
                    347: #if ANSI
                    348:        ldequals(__LINE__, pG->l + Jld[x_11][y_11], 32.L);
                    349:        ldequals(__LINE__, Jld[x_11][y_11] + pG->l, 32.L);
                    350: #endif
                    351:        lequals(__LINE__, pG->ul + Jc[x_0][y_0], 22L);
                    352:        lequals(__LINE__, Jc[x_0][y_0] + pG->ul, 22L);
                    353: #if ANSI
                    354:        lequals(__LINE__, pG->ul + Jsc[x_1][y_1], 23L);
                    355:        lequals(__LINE__, Jsc[x_1][y_1] + pG->ul, 23L);
                    356: #endif
                    357:        lequals(__LINE__, pG->ul + Js[x_2][y_2], 24L);
                    358:        lequals(__LINE__, Js[x_2][y_2] + pG->ul, 24L);
                    359:        lequals(__LINE__, pG->ul + Ji[x_3][y_3], 25L);
                    360:        lequals(__LINE__, Ji[x_3][y_3] + pG->ul, 25L);
                    361:        lequals(__LINE__, pG->ul + Juc[x_4][y_4], 26L);
                    362:        lequals(__LINE__, Juc[x_4][y_4] + pG->ul, 26L);
                    363:        lequals(__LINE__, pG->ul + Jus[x_5][y_5], 27L);
                    364:        lequals(__LINE__, Jus[x_5][y_5] + pG->ul, 27L);
                    365:        lequals(__LINE__, pG->ul + Jui[x_6][y_6], 28L);
                    366:        lequals(__LINE__, Jui[x_6][y_6] + pG->ul, 28L);
                    367:        lequals(__LINE__, pG->ul + Jl[x_7][y_7], 29L);
                    368:        lequals(__LINE__, Jl[x_7][y_7] + pG->ul, 29L);
                    369:        lequals(__LINE__, pG->ul + Jul[x_8][y_8], 30L);
                    370:        lequals(__LINE__, Jul[x_8][y_8] + pG->ul, 30L);
                    371:        dequals(__LINE__, pG->ul + Jf[x_9][y_9], 31.);
                    372:        dequals(__LINE__, Jf[x_9][y_9] + pG->ul, 31.);
                    373:        dequals(__LINE__, pG->ul + Jd[x_10][y_10], 32.);
                    374:        dequals(__LINE__, Jd[x_10][y_10] + pG->ul, 32.);
                    375: #if ANSI
                    376:        ldequals(__LINE__, pG->ul + Jld[x_11][y_11], 33.L);
                    377:        ldequals(__LINE__, Jld[x_11][y_11] + pG->ul, 33.L);
                    378: #endif
                    379:        dequals(__LINE__, pG->f + Jc[x_0][y_0], 23.);
                    380:        dequals(__LINE__, Jc[x_0][y_0] + pG->f, 23.);
                    381: #if ANSI
                    382:        dequals(__LINE__, pG->f + Jsc[x_1][y_1], 24.);
                    383:        dequals(__LINE__, Jsc[x_1][y_1] + pG->f, 24.);
                    384: #endif
                    385:        dequals(__LINE__, pG->f + Js[x_2][y_2], 25.);
                    386:        dequals(__LINE__, Js[x_2][y_2] + pG->f, 25.);
                    387:        dequals(__LINE__, pG->f + Ji[x_3][y_3], 26.);
                    388:        dequals(__LINE__, Ji[x_3][y_3] + pG->f, 26.);
                    389:        dequals(__LINE__, pG->f + Juc[x_4][y_4], 27.);
                    390:        dequals(__LINE__, Juc[x_4][y_4] + pG->f, 27.);
                    391:        dequals(__LINE__, pG->f + Jus[x_5][y_5], 28.);
                    392:        dequals(__LINE__, Jus[x_5][y_5] + pG->f, 28.);
                    393:        dequals(__LINE__, pG->f + Jui[x_6][y_6], 29.);
                    394:        dequals(__LINE__, Jui[x_6][y_6] + pG->f, 29.);
                    395:        dequals(__LINE__, pG->f + Jl[x_7][y_7], 30.);
                    396:        dequals(__LINE__, Jl[x_7][y_7] + pG->f, 30.);
                    397:        dequals(__LINE__, pG->f + Jul[x_8][y_8], 31.);
                    398:        dequals(__LINE__, Jul[x_8][y_8] + pG->f, 31.);
                    399:        dequals(__LINE__, pG->f + Jf[x_9][y_9], 32.);
                    400:        dequals(__LINE__, Jf[x_9][y_9] + pG->f, 32.);
                    401:        dequals(__LINE__, pG->f + Jd[x_10][y_10], 33.);
                    402:        dequals(__LINE__, Jd[x_10][y_10] + pG->f, 33.);
                    403: #if ANSI
                    404:        ldequals(__LINE__, pG->f + Jld[x_11][y_11], 34.L);
                    405:        ldequals(__LINE__, Jld[x_11][y_11] + pG->f, 34.L);
                    406: #endif
                    407:        dequals(__LINE__, pG->d + Jc[x_0][y_0], 24.);
                    408:        dequals(__LINE__, Jc[x_0][y_0] + pG->d, 24.);
                    409: #if ANSI
                    410:        dequals(__LINE__, pG->d + Jsc[x_1][y_1], 25.);
                    411:        dequals(__LINE__, Jsc[x_1][y_1] + pG->d, 25.);
                    412: #endif
                    413:        dequals(__LINE__, pG->d + Js[x_2][y_2], 26.);
                    414:        dequals(__LINE__, Js[x_2][y_2] + pG->d, 26.);
                    415:        dequals(__LINE__, pG->d + Ji[x_3][y_3], 27.);
                    416:        dequals(__LINE__, Ji[x_3][y_3] + pG->d, 27.);
                    417:        dequals(__LINE__, pG->d + Juc[x_4][y_4], 28.);
                    418:        dequals(__LINE__, Juc[x_4][y_4] + pG->d, 28.);
                    419:        dequals(__LINE__, pG->d + Jus[x_5][y_5], 29.);
                    420:        dequals(__LINE__, Jus[x_5][y_5] + pG->d, 29.);
                    421:        dequals(__LINE__, pG->d + Jui[x_6][y_6], 30.);
                    422:        dequals(__LINE__, Jui[x_6][y_6] + pG->d, 30.);
                    423:        dequals(__LINE__, pG->d + Jl[x_7][y_7], 31.);
                    424:        dequals(__LINE__, Jl[x_7][y_7] + pG->d, 31.);
                    425:        dequals(__LINE__, pG->d + Jul[x_8][y_8], 32.);
                    426:        dequals(__LINE__, Jul[x_8][y_8] + pG->d, 32.);
                    427:        dequals(__LINE__, pG->d + Jf[x_9][y_9], 33.);
                    428:        dequals(__LINE__, Jf[x_9][y_9] + pG->d, 33.);
                    429:        dequals(__LINE__, pG->d + Jd[x_10][y_10], 34.);
                    430:        dequals(__LINE__, Jd[x_10][y_10] + pG->d, 34.);
                    431: #if ANSI
                    432:        ldequals(__LINE__, pG->d + Jld[x_11][y_11], 35.L);
                    433:        ldequals(__LINE__, Jld[x_11][y_11] + pG->d, 35.L);
                    434: #endif
                    435: #if ANSI
                    436:        ldequals(__LINE__, pG->ld + Jc[x_0][y_0], 25.L);
                    437:        ldequals(__LINE__, Jc[x_0][y_0] + pG->ld, 25.L);
                    438: #endif
                    439: #if ANSI
                    440:        ldequals(__LINE__, pG->ld + Jsc[x_1][y_1], 26.L);
                    441:        ldequals(__LINE__, Jsc[x_1][y_1] + pG->ld, 26.L);
                    442: #endif
                    443: #if ANSI
                    444:        ldequals(__LINE__, pG->ld + Js[x_2][y_2], 27.L);
                    445:        ldequals(__LINE__, Js[x_2][y_2] + pG->ld, 27.L);
                    446: #endif
                    447: #if ANSI
                    448:        ldequals(__LINE__, pG->ld + Ji[x_3][y_3], 28.L);
                    449:        ldequals(__LINE__, Ji[x_3][y_3] + pG->ld, 28.L);
                    450: #endif
                    451: #if ANSI
                    452:        ldequals(__LINE__, pG->ld + Juc[x_4][y_4], 29.L);
                    453:        ldequals(__LINE__, Juc[x_4][y_4] + pG->ld, 29.L);
                    454: #endif
                    455: #if ANSI
                    456:        ldequals(__LINE__, pG->ld + Jus[x_5][y_5], 30.L);
                    457:        ldequals(__LINE__, Jus[x_5][y_5] + pG->ld, 30.L);
                    458: #endif
                    459: #if ANSI
                    460:        ldequals(__LINE__, pG->ld + Jui[x_6][y_6], 31.L);
                    461:        ldequals(__LINE__, Jui[x_6][y_6] + pG->ld, 31.L);
                    462: #endif
                    463: #if ANSI
                    464:        ldequals(__LINE__, pG->ld + Jl[x_7][y_7], 32.L);
                    465:        ldequals(__LINE__, Jl[x_7][y_7] + pG->ld, 32.L);
                    466: #endif
                    467: #if ANSI
                    468:        ldequals(__LINE__, pG->ld + Jul[x_8][y_8], 33.L);
                    469:        ldequals(__LINE__, Jul[x_8][y_8] + pG->ld, 33.L);
                    470: #endif
                    471: #if ANSI
                    472:        ldequals(__LINE__, pG->ld + Jf[x_9][y_9], 34.L);
                    473:        ldequals(__LINE__, Jf[x_9][y_9] + pG->ld, 34.L);
                    474: #endif
                    475: #if ANSI
                    476:        ldequals(__LINE__, pG->ld + Jd[x_10][y_10], 35.L);
                    477:        ldequals(__LINE__, Jd[x_10][y_10] + pG->ld, 35.L);
                    478: #endif
                    479: #if ANSI
                    480:        ldequals(__LINE__, pG->ld + Jld[x_11][y_11], 36.L);
                    481:        ldequals(__LINE__, Jld[x_11][y_11] + pG->ld, 36.L);
                    482: #endif
                    483:        }}
                    484:        report(Filename);
                    485:        }
                    486: /* The Plum Hall Validation Suite for C
                    487:  * Unpublished copyright (c) 1986-1990, Chiron Systems Inc and Plum Hall Inc.
                    488:  * VERSION: 2.00
                    489:  * DATE: 90/04/05
                    490:  * The "ANSI" mode of this suite corresponds to official ANSI C, X3.159-1989.
                    491:  * As per your license agreement, your distribution is not to be moved or copied outside the Designated Site
                    492:  * without specific permission from Plum Hall Inc.
                    493:  */
                    494: 
                    495: /*
                    496:  * UTILS - various utility routines.
                    497:  */
                    498: #include <stdio.h>
                    499: #include <math.h>
                    500: #include "defs.h"
                    501: #ifdef __STDC__
                    502: #include <stdlib.h>
                    503: #include <string.h>
                    504: #endif
                    505: 
                    506: void setzero(), setremark(), trace();
                    507: int Nerrs = 0;
                    508: int Nremarks = 0;
                    509: long Nsuccess = 0;
                    510: int Debug = FALSE;
                    511: char *Filename = NULL;
                    512: static char details[BUFSIZ] = {0};
                    513: static int trace_msg_len = 0;
                    514: static char trace_routine[20] = "";
                    515: static char trace_filename[BUFSIZ] = "";
                    516: static int remarks = FALSE;
                    517: 
                    518: 
                    519: 
                    520: 
                    521: 
                    522: 
                    523: 
                    524: 
                    525: 
                    526: 
                    527: 
                    528: 
                    529: 
                    530: 
                    531: 
                    532: 
                    533: 
                    534: 
                    535: 
                    536: /*
                    537:  * ERRMSG - print and tabulate each message
                    538:  */
                    539: static void errmsg(msg, line)
                    540:        char *msg;
                    541:        int line;
                    542:        {
                    543:        if (trace_msg_len != 0)
                    544:                {
                    545:                printf("\n");
                    546:                trace_msg_len = 0;
                    547:                strcpy(trace_routine, "");
                    548:                }
                    549:        if (line > 0 || remarks)
                    550:                printf("%s in %s at line %d%s\n",
                    551:                        line > 0 ? "ERROR" : "REMARK",
                    552:                        Filename,
                    553:                        line > 0 ? line : -line, msg);
                    554:        fflush(stdout);
                    555:        if (line > 0)
                    556:                ++Nerrs;
                    557:        else
                    558:                ++Nremarks;
                    559:        }
                    560: 
                    561: 
                    562: 
                    563: 
                    564: 
                    565: 
                    566: 
                    567: 
                    568: 
                    569: 
                    570: 
                    571: 
                    572: 
                    573: 
                    574: 
                    575: 
                    576: 
                    577: 
                    578: 
                    579: 
                    580: 
                    581: 
                    582: 
                    583: 
                    584: 
                    585: 
                    586: /*
                    587:  * IEQUALS - 'int' quality check.  If val1 != val2, then report an error.
                    588:  */
                    589: int iequals(line, val1, val2)
                    590:        int val1, val2;
                    591:        int line;
                    592:        {
                    593:        if (val1 != val2)
                    594:                {
                    595:                sprintf(details, ": (%d) != (%d)",  val1, val2);
                    596:                errmsg(details, line);
                    597:                return (0);
                    598:                }
                    599:        else
                    600:                trace("iequals", line);
                    601:        return (1);
                    602:        }
                    603: 
                    604: /*
                    605:  * INOTEQUALS - 'int' non-equality check.  If val1 == val2, then
                    606:  * report an error.
                    607:  */
                    608: int inotequals(line, val1, val2)
                    609:        int val1, val2;
                    610:        int line;
                    611:        {
                    612:        if (val1 == val2)
                    613:                {
                    614:                sprintf(details, ": (%d) == (%d)",  val1, val2);
                    615:                errmsg(details, line);
                    616:                return (0);
                    617:                }
                    618:        else
                    619:                trace("inotequals", line);
                    620:        return (1);
                    621:        }
                    622: 
                    623: 
                    624: 
                    625: 
                    626: 
                    627: 
                    628: 
                    629: 
                    630: 
                    631: 
                    632: 
                    633: 
                    634: 
                    635: 
                    636: /*
                    637:  * LEQUALS - 'long' quality check.  If val1 != val2, then
                    638:  * report an error.
                    639:  */
                    640: int lequals(line, val1, val2)
                    641:        long val1, val2;
                    642:        int line;
                    643:        {
                    644:        if (val1 != val2)
                    645:                {
                    646:                sprintf(details, ": (%ld) != (%ld)",  val1, val2);
                    647:                errmsg(details, line);
                    648:                return (0);
                    649:                }
                    650:        else
                    651:                trace("lequals", line);
                    652:        return (1);
                    653:        }
                    654: 
                    655: /*
                    656:  * COMPLAIN - unconditional failure.
                    657:  */
                    658: int complain(line)
                    659:        int line;
                    660:        {
                    661:        errmsg("", line);
                    662:        return 0;
                    663:        }
                    664: 
                    665: /*
                    666:  * STEQUALS - string equality.
                    667:  */
                    668: int stequals(line, val1, val2)
                    669:        char * val1, *val2;
                    670:        int line;
                    671:        {
                    672:        if (strcmp(val1, val2))
                    673:                {
                    674:                sprintf(details, ": \"%s\" != \"%s\"",  val1, val2);
                    675:                errmsg(details, line);
                    676:                return (0);
                    677:                }
                    678:        else
                    679:                trace("stequals", line);
                    680:        return (1);
                    681:        }
                    682: 
                    683: 
                    684: 
                    685: 
                    686: /*
                    687:  * AEQUALS - 'address' equality check.  If val1 != val2, then
                    688:  * report an error.
                    689:  */
                    690: int aequals(line, val1, val2)
                    691: #if ANSI
                    692:        const void * val1, * val2;
                    693: #else
                    694:        char * val1, * val2;
                    695: #endif
                    696:        int line;
                    697:        {
                    698:        if (val1 != val2)
                    699:                {
                    700: #if ANSI
                    701:                sprintf(details, ": (%p) != (%p)",  val1, val2);
                    702: #else
                    703:                sprintf(details, ": (%lx) != (%lx)",  (long)val1, (long)val2);
                    704: #endif
                    705:                errmsg(details, line);
                    706:                return (0);
                    707:                }
                    708:        else
                    709:                trace("aequals", line);
                    710:        return (1);
                    711:        }
                    712: 
                    713: 
                    714: 
                    715: 
                    716: 
                    717: 
                    718: 
                    719: 
                    720: 
                    721: 
                    722: 
                    723: 
                    724: 
                    725: 
                    726: 
                    727: 
                    728: 
                    729: 
                    730: 
                    731: 
                    732: 
                    733: 
                    734: 
                    735: 
                    736: /*
                    737:  * ARBHEX - convert an arbitrary byte-sequence into hex codes
                    738:  */
                    739: #ifndef CHAR_BIT
                    740: #define CHAR_BIT 8
                    741: #endif
                    742: #define NIBBLES_PER_BYTE ((CHAR_BIT + 3) / 4)
                    743: char *arbhex(str, p, n)
                    744:        char *str;      /* where to store the target string */
                    745:        char *p;        /* where to find the source bytes */
                    746:        int n;          /* how many bytes */
                    747:        {
                    748:        int i, nib, hex_dig;
                    749:        static char codes[] = "0123456789ABCDEF";
                    750: 
                    751:        for (i = 0; i < n; ++i, ++p)
                    752:                for (nib = NIBBLES_PER_BYTE - 1; nib >= 0; --nib)
                    753:                        {
                    754:                        hex_dig = (*p & (unsigned int)(0xF << (nib*4))) >> (nib*4);
                    755:                        *str++ = codes[hex_dig];
                    756:                        }
                    757:        *str = '\0';
                    758:        return str;
                    759:        }
                    760: 
                    761: /*
                    762:  * FAEQUALS - function address equality check.  If val1 != val2, then
                    763:  * report an error. The address of a function is not necessarily the same
                    764:  * size/type as the address of data.
                    765:  */
                    766: int faequals(line, val1, val2)
                    767:        int (*val1)(), (*val2)();
                    768:        int line;
                    769:        {
                    770:        char buf1[sizeof(val1)*NIBBLES_PER_BYTE + 1];
                    771:        char buf2[sizeof(val2)*NIBBLES_PER_BYTE + 1];
                    772: 
                    773:        if (val1 != val2)
                    774:                {
                    775:                arbhex(buf1, (char *)&val1, (int)sizeof(val1));
                    776:                arbhex(buf2, (char *)&val2, (int)sizeof(val2));
                    777:                sprintf(details, ": (%s) != (%s)", buf1, buf2);
                    778:                errmsg(details, line);
                    779:                return (0);
                    780:                }
                    781:        else
                    782:                trace("faequals", line);
                    783:        return (1);
                    784:        }
                    785: 
                    786: /*
                    787:  * DEQUALS - 'double' equality check.  If val1 != val2, then
                    788:  * report an error. This is computed using an equality approximation
                    789:  * that verifies that the two numbers are equal to R digits whenever
                    790:  *
                    791:  *    |x - y|    1    1-R
                    792:  *    ------- <= - 10
                    793:  *      |x|      2
                    794:  *
                    795:  * DIGITS_MAX  is defined in defs.h
                    796:  */
                    797: double Delta = 0.0;
                    798: int dequals(line, val1, val2)
                    799:        double val1, val2;
                    800:        int line;
                    801:        {
                    802:        double *pd;
                    803: 
                    804:        if (Delta == 0.0)
                    805:                Delta = 0.5 / pow(10.0, DIGITS_MAX-1.0); 
                    806:        if (val1 == val2)
                    807:                {
                    808:                trace("dequals", line);
                    809:                return (1);
                    810:                }
                    811:        pd = &val1;
                    812:        if (val1 == 0.0)
                    813:                pd = &val2;
                    814: 
                    815:        /* special cases to handle zero against very small numbers */
                    816:        if (fabs(val1) == 0.0 && fabs(val2) < Delta)
                    817:                ;
                    818:        else if (fabs(val2) == 0.0 && fabs(val1) < Delta)
                    819:                ;
                    820:        else if ((fabs(val1 - val2) / fabs(*pd)) > Delta)
                    821:                {
                    822:                sprintf(details, ": (%.*G) != (%.*G)",
                    823:                        DIGITS_MAX+2, val1, DIGITS_MAX+2, val2);
                    824:                errmsg(details, line);
                    825:                return (0);
                    826:                }
                    827:        trace("dequals", line);
                    828:        return (1);
                    829:        }
                    830: 
                    831: 
                    832: 
                    833: 
                    834: 
                    835: 
                    836: #if ANSI
                    837: /*
                    838:  * LDEQUALS - Long double equality ... more of the same.
                    839:  */
                    840: #define ldabs(ld) ((ld) < 0.0 ? -(ld) : (ld))
                    841: long double LDelta = 0.0;
                    842: int ldequals(line, val1, val2)
                    843:        long double val1, val2;
                    844:        int line;
                    845:        {
                    846:        long double *pd;
                    847: 
                    848:        if (LDelta == 0.0)
                    849:                {
                    850:                LDelta = 0.5L / pow(10.0, LDIGITS_MAX-1.0); 
                    851:                }
                    852:        if (val1 == val2)
                    853:                {
                    854:                trace("ldequals", line);
                    855:                return (1);
                    856:                }
                    857:        pd = &val1;
                    858:        if (val1 == 0.0)
                    859:                pd = &val2;
                    860: 
                    861:        /* special cases to handle zero against very small numbers */
                    862:        if (ldabs(val1) == 0.0 && ldabs(val2) < LDelta)
                    863:                ;
                    864:        else if (ldabs(val2) == 0.0 && ldabs(val1) < LDelta)
                    865:                ;
                    866:        else if ((ldabs(val1 - val2) / ldabs(*pd)) > LDelta)
                    867:                {
                    868:                sprintf(details, ": (%.*LE) != (%.*LE)",
                    869:                        LDIGITS_MAX+2, val1, LDIGITS_MAX+2, val2);
                    870:                errmsg(details, line);
                    871:                return (0);
                    872:                }
                    873:        trace("ldequals", line);
                    874:        return (1);
                    875:        }
                    876: #endif
                    877: 
                    878: 
                    879: 
                    880: 
                    881: 
                    882: 
                    883: 
                    884: 
                    885: 
                    886: /*
                    887:  * FEQUALS - same as DEQUALS, but to FDIGITS_MAX instead of DIGITS_MAX.
                    888:  */
                    889: double FDelta = 0.0;
                    890: int fequals(line, in1, in2)
                    891:        double in1, in2;
                    892:        int line;
                    893:        {
                    894:        float *pf;
                    895:        float val1 = in1;
                    896:        float val2 = in2;
                    897: 
                    898:        if (FDelta == 0.0)
                    899:                FDelta = 0.5 / pow(10.0, FDIGITS_MAX-1.0); 
                    900:        if (val1 == val2)
                    901:                {
                    902:                trace("fequals", line);
                    903:                return (1);
                    904:                }
                    905:        pf = &val1;
                    906:        if (val1 == 0.0)
                    907:                pf = &val2;
                    908: 
                    909:        /* special cases to handle zero against very small numbers */
                    910:        if (fabs(val1) == 0.0 && fabs(val2) < FDelta)
                    911:                ;
                    912:        else if (fabs(val2) == 0.0 && fabs(val1) < FDelta)
                    913:                ;
                    914:        else if ((fabs(val1 - val2) / fabs(*pf)) > FDelta)
                    915:                {
                    916:                sprintf(details, ": (%.*G) != (%.*G)",
                    917:                        FDIGITS_MAX+2, val1, FDIGITS_MAX+2, val2);
                    918:                errmsg(details, line);
                    919:                return (0);
                    920:                }
                    921:        trace("fequals", line);
                    922:        return (1);
                    923:        }
                    924: 
                    925: 
                    926: 
                    927: 
                    928: 
                    929: 
                    930: 
                    931: 
                    932: 
                    933: 
                    934: 
                    935: 
                    936: /*
                    937:  * CHECKTHAT - simple condition check.  If val1 == 0, then
                    938:  * report an error.
                    939:  */
                    940: int checkthat(line, cond)
                    941:        int cond;
                    942:        int line;
                    943:        {
                    944:        if (!cond)
                    945:                {
                    946:                errmsg("", line);
                    947:                return (0);
                    948:                }
                    949:        else
                    950:                trace("checkthat", line);
                    951:        return (1);
                    952:        }
                    953: 
                    954: /*
                    955:  * VALUE - the value routines are used to defeat value propagation in optimizing compilers.
                    956:  * We want to make sure that we are testing what we think we are testing, not what the compiler transformed it to.
                    957:  * 1988: Some compilers "open-code" all small functions.  Now we have to hide the constants still further.
                    958:  */
                    959: static int Zero = 0;   /* See  setzero()  below */
                    960: int ivalue(i)
                    961:        int i;
                    962:        {
                    963:        return i + Zero;
                    964:        }
                    965: long lvalue(i)
                    966:        long i;
                    967:        {
                    968:        return i + Zero;
                    969:        }
                    970: double dvalue(i)
                    971:        double i;
                    972:        {
                    973:        return i + Zero;
                    974:        }
                    975: float fvalue(i)
                    976:        float i;
                    977:        {
                    978:        return i + Zero;
                    979:        }
                    980: generic_ptr avalue(i)
                    981:        generic_ptr i;
                    982:        {
                    983:        return (char *)i + Zero;
                    984:        }
                    985: 
                    986: /*
                    987:  * SCHECK - check both values and side effects.
                    988:  */
                    989: int Side = 0;
                    990: int scheck(line, val1, se, val2)
                    991:        int val1, se, val2, line;
                    992:        {
                    993:        int status = 1;
                    994: 
                    995:        if (Side != se)
                    996:                {
                    997:                errmsg(": incorrect side effect", line);
                    998:                status = 0;
                    999:                }
                   1000:        else
                   1001:                trace("scheck", line);
                   1002:        Side = 0;
                   1003:        return (status == 1 && iequals(line, val1, val2));
                   1004:        }
                   1005: 
                   1006: /*
                   1007:  * DO_NOTHING - this is also intended to defeat optimizers by passing
                   1008:  * the addresses of variables for which we want to stop any value propagation.
                   1009:  */
                   1010: #if ANSI
                   1011: #if NEW_STYLE_FN_DEF
                   1012: int do_nothing(void *p, ...) { *(char *)p = *((char *)p + Zero); return 0; }
                   1013: #else
                   1014: int do_nothing(p) void *p;   { *(char *)p = *((char *)p + Zero); return 0; }
                   1015: #endif
                   1016: #else
                   1017: int do_nothing(){ return 0; }
                   1018: #endif
                   1019: /*
                   1020:  * REPORT - summary report at end of testing.
                   1021:  */
                   1022: void report(program)
                   1023:        char *program;
                   1024:        {
                   1025:        if (trace_msg_len != 0)
                   1026:                printf("\n");
                   1027:        if (remarks && Nremarks != 0)
                   1028:                printf("***** %d remark%s detected in %s *****\n", Nremarks, 
                   1029:                        (Nremarks != 1) ? "s" : "", program);
                   1030:        exit(Nerrs);
                   1031:        }
                   1032: /*
                   1033:  * DBPRINT - print the message if the Debug flag is on.
                   1034:  */
                   1035: void dbprint(s)
                   1036:        char *s;
                   1037:        {
                   1038:        if (Debug)
                   1039:                {
                   1040:                printf("***DEBUG***");
                   1041:                printf(s);
                   1042:                }
                   1043:        }
                   1044: 
                   1045: /*
                   1046:  * TRACE - print a line-number trace for debugging
                   1047:  * Also count successful tests.
                   1048:  */
                   1049: void trace(routine, line)
                   1050:        char *routine;
                   1051:        int line;
                   1052:        {
                   1053:        char buf[10];
                   1054:        static int first = 1;
                   1055: 
                   1056:        if (first)
                   1057:                {
                   1058:                setzero();
                   1059:                setremark();
                   1060:                first = 0;
                   1061:                }
                   1062:        if (Debug)
                   1063:                {
                   1064:                if (strcmp(trace_routine, routine) != 0 ||
                   1065:                        strcmp(trace_filename, Filename) != 0 ||
                   1066:                        trace_msg_len > 60)
                   1067:                        {
                   1068:                        printf("\nTRACE: %s at %s ", routine, Filename);
                   1069:                        strcpy(trace_routine, routine);
                   1070:                        strcpy(trace_filename, Filename);
                   1071:                        trace_msg_len = 11 + strlen(routine) + strlen(Filename);
                   1072:                        }
                   1073:                sprintf(buf, "%d ", abs(line));
                   1074:                printf("%s", buf);
                   1075:                trace_msg_len += strlen(buf);
                   1076:                fflush(stdout);
                   1077:                }
                   1078:        ++Nsuccess;
                   1079:        }
                   1080: 
                   1081: 
                   1082: /*
                   1083:  * DIGITS - calculate the number of digits after the decimal 
                   1084:  * place so that the number is printed to DIGITS_MAX significant
                   1085:  * digits.
                   1086:  */
                   1087: int digits(d)
                   1088:        double d;
                   1089:        {
                   1090:        int i;
                   1091: 
                   1092:        if (d == 0.0)
                   1093:                i = 0;
                   1094:        else
                   1095:                i = log10(fabs(d));
                   1096:        return(DIGITS_MAX - (i < 0 ? 0 : i+1));
                   1097:        }
                   1098: int fdigits(d)
                   1099:        double d;
                   1100:        {
                   1101:        int i;
                   1102: 
                   1103:        if (d == 0.0)
                   1104:                i = 0;
                   1105:        else
                   1106:                i = log10(fabs(d));
                   1107:        return(FDIGITS_MAX - (i < 0 ? 0 : i+1));
                   1108:        }
                   1109: 
                   1110: /*
                   1111:  * SETZERO - appear, to a compiler, as though Zero is unpredictably set
                   1112:  */
                   1113: void setzero()
                   1114:        {
                   1115:        FILE *fp;
                   1116:        int save;
                   1117: 
                   1118:        save = errno;
                   1119:        fp = fopen("nonexistent", "r");
                   1120:        if (fp != 0)
                   1121:                {
                   1122:                fscanf(fp, "ignore format", &Zero);
                   1123:                fclose(fp);
                   1124:                }
                   1125:        errno = save;
                   1126:        }
                   1127: 
                   1128: 
                   1129: 
                   1130: /*
                   1131:  * PR_OK - printf a text line in ok situation (no error, just text)
                   1132:  */
                   1133: void pr_ok(s)
                   1134:        char *s;
                   1135:        {
                   1136:        fputs(s, stdout);
                   1137:        }
                   1138: 
                   1139: /*
                   1140:  * PR_ERR - printf a text line in error situation (such as "SKIP'ed")
                   1141:  */
                   1142: void pr_err(s)
                   1143:        char *s;
                   1144:        {
                   1145:        ++Nerrs;
                   1146:        pr_ok(s);
                   1147:        }
                   1148: 
                   1149: /*
                   1150:  * SETREMARK - determine whether "remark" messages should be printed
                   1151:  */
                   1152: void setremark()
                   1153:        {
                   1154:        FILE *fp;
                   1155: 
                   1156:        if (getenv("SUITE_REMARK") != 0)
                   1157:                remarks = TRUE;
                   1158:        else if ((fp = fopen("REMARK", "r")) == 0)
                   1159:                remarks = FALSE;
                   1160:        else
                   1161:                {
                   1162:                remarks = TRUE;
                   1163:                fclose(fp);
                   1164:                }
                   1165:        }
                   1166: 

unix.superglobalmegacorp.com

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