Annotation of researchv8dc/cmd/trace/assert.c, revision 1.1

1.1     ! root        1: 
        !             2: require(TT, stuff, by, with, pr)
        !             3: {
        !             4:        if (assertbl != NONE)
        !             5:                assert(TT, stuff, by, with, pr);
        !             6:        if (errortbl != NONE)
        !             7:                errort(TT, stuff, by, with, pr);
        !             8: }
        !             9: 
        !            10: inscope(TT, stuff, by)
        !            11: { register int i;
        !            12: 
        !            13:        for (i = 0; i < tbl[assertbl].nrcols; i++)
        !            14:                if (TT == tbl[assertbl].coltyp[i]
        !            15:                &&  stuff == tbl[assertbl].colmap[i]
        !            16:                &&  by == tbl[assertbl].colorg[i])
        !            17:                        return 1;
        !            18: 
        !            19:        return 0;
        !            20: }
        !            21: 
        !            22: assert(TT, stuff, by, with, pr)
        !            23: { int h, i, j, x, frst;
        !            24: 
        !            25:        for (frst = 0; frst < tbl[assertbl].nrcols; frst++)
        !            26:                if (tbl[assertbl].coltyp[frst] == TT
        !            27:                &&  stuff == tbl[assertbl].colmap[frst]
        !            28:                &&  by == tbl[assertbl].colorg[frst])
        !            29:                        break;
        !            30: 
        !            31:        if (frst == tbl[assertbl].nrcols)
        !            32:                return;         /* not within assertion's scope */
        !            33: 
        !            34:        for (i = 0; i < tbl[assertbl].nrrows; i++)
        !            35:        {
        !            36:                if (globvars[i+abase] != 1)
        !            37:                        continue;
        !            38: 
        !            39:                for (j = frst; j < tbl[assertbl].nrcols; j++)
        !            40:                {
        !            41:                        if (TT == tbl[assertbl].coltyp[j]
        !            42:                        &&  stuff == tbl[assertbl].colmap[j]
        !            43:                        &&  by == tbl[assertbl].colorg[j])
        !            44:                        {
        !            45:                         if (tbl[assertbl].ptr[i][j].nrpils == 0)
        !            46:                                output("assertion violated: ", 2);
        !            47:                         else
        !            48:                         for (h = 0; h < tbl[assertbl].ptr[i][j].nrpils; h++)
        !            49:                         {      x = tbl[assertbl].ptr[i][j].one[h].transf;
        !            50:                                globvars[x+abase] = 2;
        !            51:                                globvars[i+abase] = 0;
        !            52:                         }
        !            53:                        }
        !            54:                }
        !            55:        }
        !            56:        for (i = abase; i < nrvars; i++)
        !            57:                if (globvars[i] == 2)
        !            58:                        globvars[i] = 1;
        !            59: }
        !            60: 
        !            61: assertholds()
        !            62: { int i;
        !            63:        if (assertbl == NONE)
        !            64:                return 1;
        !            65: 
        !            66:        for (i = abase; i < nrvars; i++)
        !            67:                if (globvars[i] && tbl[assertbl].endrow[i-abase])
        !            68:                        return 1;
        !            69:        return 0;
        !            70: }
        !            71: 
        !            72: errort(TT, stuff, by, with, pr)
        !            73: { int h, i, j, x, frst;
        !            74: 
        !            75:        for (frst = 0; frst < tbl[errortbl].nrcols; frst++)
        !            76:                if (tbl[errortbl].coltyp[frst] == TT
        !            77:                &&  stuff == tbl[errortbl].colmap[frst]
        !            78:                &&  by == tbl[errortbl].colorg[frst])
        !            79:                        break;
        !            80: 
        !            81:        if (frst == tbl[errortbl].nrcols)
        !            82:                return;         /* not within assertion's scope */
        !            83: 
        !            84:        for (i = 0; i < tbl[errortbl].nrrows; i++)
        !            85:        {
        !            86:                if (globvars[i+ebase] != 1)
        !            87:                        continue;
        !            88: 
        !            89:                for (j = frst; j < tbl[errortbl].nrcols; j++)
        !            90:                {
        !            91:                        if (TT == tbl[errortbl].coltyp[j]
        !            92:                        &&  stuff == tbl[errortbl].colmap[j]
        !            93:                        &&  by == tbl[errortbl].colorg[j])
        !            94:                        {
        !            95:                         if (tbl[errortbl].ptr[i][j].nrpils == 0)
        !            96:                                globvars[i+ebase] = 0;
        !            97:                         else
        !            98:                         for (h = 0; h < tbl[errortbl].ptr[i][j].nrpils; h++)
        !            99:                         {      x = tbl[errortbl].ptr[i][j].one[h].transf;
        !           100:                                globvars[x+ebase] = 2;
        !           101:                                globvars[i+ebase] = 0;
        !           102:                         }
        !           103:        }       }       }
        !           104:        for (i = ebase; i < nrvars; i++)
        !           105:                if (globvars[i] == 2)
        !           106:                {       globvars[i] = 1;
        !           107:                        if (tbl[errortbl].endrow[i-ebase])
        !           108:                                output("error matched: ", 2);
        !           109:                }
        !           110:        globvars[ebase] = 1;
        !           111: }
        !           112: 
        !           113: peekassert(ice)
        !           114:        struct FREEZE *ice;
        !           115: { register int i;
        !           116:   if (assertbl != NONE)
        !           117:        for (i = abase; i < nrvars; i++)
        !           118:                globvars[i] = ice->varsaved[i];
        !           119:   else if (errortbl != NONE)
        !           120:        for (i = ebase; i < nrvars; i++)
        !           121:                globvars[i] = ice->varsaved[i];
        !           122: }

unix.superglobalmegacorp.com

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