static an GenScanTable( an node, sel_handle s_node, type_def *tipe ) /************************************************************************/ { an lt; cg_type value_type; cg_type real_type; value_type = SelType( s_node->upper - s_node->lower ); real_type = tipe->refno; if( real_type != value_type ) { node = BGBinary( O_MINUS, node, BGInteger( s_node->lower, tipe ), tipe, true ); if( s_node->other_wise != NULL ) { lt = BGCompare( O_LE, BGDuplicate(node), BGInteger( s_node->upper - s_node->lower, tipe ), NULL, UnSignedIntTipe( tipe ) ); BGControl( O_IF_FALSE, lt, s_node->other_wise ); } } ScanBlock( MakeScanTab( s_node->list, s_node->upper, s_node->other_wise, value_type, real_type ), node, (type_class_def)value_type, s_node->other_wise ); return( node ); }
LPBNDS BuildBounds ( WORD coff, LPUL rgoff, LPW lpcbnds ) { LPBNDS rgbnds = (LPBNDS) MHAlloc (sizeof (BNDS) * cbndsAllocBlock); WORD cbndsAlloc = cbndsAllocBlock; WORD cbnds = 0; WORD ioff = 0; while (ioff < coff) { ULONG uoffCurr = rgoff [ ioff ]; ULONG uoffMax = 0; WORD ibnds = FindPosition (rgbnds, cbnds, rgoff, uoffCurr); if (ibnds == cbnds) { // We're after all other known blocks, so our max // is "infinity" uoffMax = 0xFFFFFFFF; rgbnds = InsertBlock (ibnds, 1, rgbnds, &cbnds, &cbndsAlloc); } else if (rgoff [ rgbnds [ ibnds ].ilnStart ] > uoffCurr) { // We're at an insertion point, not in the middle of // another block candidate uoffMax = rgoff [ rgbnds [ ibnds ].ilnStart ]; rgbnds = InsertBlock (ibnds, 1, rgbnds, &cbnds, &cbndsAlloc); } else { // We're in the middle of another block candidate, so we // must split it in two rgbnds = InsertBlock (ibnds, 2, rgbnds, &cbnds, &cbndsAlloc); // Start of ibnds is already set rgbnds [ ibnds ].ilnEnd = ScanBlock ( rgoff, coff, rgbnds [ ibnds ].ilnStart, uoffCurr ); rgbnds [ ibnds + 2 ].ilnStart = rgbnds [ ibnds ].ilnEnd + 1; // End of ibnds + 2 is already set uoffMax = rgoff [ rgbnds [ ibnds + 2 ].ilnStart ]; ibnds += 1; } rgbnds [ ibnds ].ilnStart = ioff; rgbnds [ ibnds ].ilnEnd = ScanBlock (rgoff, coff, ioff, uoffMax); ioff = rgbnds [ ibnds ].ilnEnd + 1; } *lpcbnds = cbnds; return rgbnds; }