/**************************************************************************** ** *F FuncLIST_SORTED_LIST( <self>, <list> ) . . . . . make a set from a list ** ** 'FuncLIST_SORTED_LIST' implements the internal function 'SetList'. ** ** 'SetList( <list> )' ** ** 'SetList' returns a new proper set, which is represented as a sorted list ** without holes or duplicates, containing the elements of the list <list>. ** ** 'SetList' returns a new list even if the list <list> is already a proper ** set, in this case it is equivalent to 'ShallowCopy' (see "ShallowCopy"). */ Obj FuncLIST_SORTED_LIST ( Obj self, Obj list ) { Obj set; /* result */ /* check the argument */ while ( ! IS_SMALL_LIST( list ) ) { list = ErrorReturnObj( "Set: <list> must be a small list (not a %s)", (Int)TNAM_OBJ(list), 0L, "you can replace <list> via 'return <list>;'" ); } /* if the list is empty create a new empty list */ if ( LEN_LIST(list) == 0 ) { set = NEW_PLIST( T_PLIST_EMPTY, 0 ); } /* if <list> is a set just shallow copy it */ else if ( /* IS_HOMOG_LIST(list) && */ IS_SSORT_LIST(list) ) { set = SHALLOW_COPY_OBJ( list ); } /* otherwise let 'SetList' do the work */ else { set = SetList( list ); } /* return the set */ return set; }
Int IsSet ( Obj list ) { Int isSet; /* result */ /* if <list> is a plain list */ if ( IS_PLIST( list ) ) { /* if <list> is the empty list, its a set (:-) */ if ( LEN_PLIST(list) == 0 ) { SET_FILT_LIST( list, FN_IS_EMPTY ); isSet = 1; } /* if <list> strictly sorted, its a set */ else if ( IS_SSORT_LIST(list) ) { isSet = 1; } /* otherwise it is not a set */ else { isSet = 0; } } /* if it is another small list */ else if ( IS_SMALL_LIST(list) ) { /* if <list> is the empty list, its a set (:-) */ if ( LEN_LIST(list) == 0 ) { PLAIN_LIST( list ); SET_FILT_LIST( list, FN_IS_EMPTY ); isSet = 1; } /* if <list> strictly sorted, its a set */ else if ( IS_SSORT_LIST(list) ) { PLAIN_LIST( list ); /* SET_FILT_LIST( list, FN_IS_HOMOG ); */ SET_FILT_LIST( list, FN_IS_SSORT ); isSet = 1; } /* otherwise it is not a set */ else { isSet = 0; } } /* otherwise it is certainly not a set */ else { isSet = 0; } /* return the result */ return isSet; }
Obj FuncIS_EQUAL_SET ( Obj self, Obj list1, Obj list2 ) { /* check the arguments, convert to sets if necessary */ while ( ! IS_SMALL_LIST(list1) ) { list1 = ErrorReturnObj( "IsEqualSet: <list1> must be a small list (not a %s)", (Int)TNAM_OBJ(list1), 0L, "you can replace <list1> via 'return <list1>;'" ); } if ( ! IsSet( list1 ) ) list1 = SetList( list1 ); while ( ! IS_SMALL_LIST(list2) ) { list2 = ErrorReturnObj( "IsEqualSet: <list2> must be a small list (not a %s)", (Int)TNAM_OBJ(list2), 0L, "you can replace <list2> via 'return <list2>;'" ); } if ( ! IsSet( list2 ) ) list2 = SetList( list2 ); /* and now compare them */ return (EqSet( list1, list2 ) ? True : False ); }
Con fill_container(Obj rec) { if(!(IS_SMALL_LIST(rec))) throw GAPException("Invalid attempt to read list"); int len = LEN_LIST(rec); Con v; typedef typename Con::value_type T; GAP_getter<T> getter; for(int i = 1; i <= len; ++i) { v.push_back(getter(ELM_LIST(rec, i))); } return v; }
Con fill_optional_container(Obj rec) { if(!(IS_SMALL_LIST(rec))) throw GAPException("Invalid attempt to read list"); int len = LEN_LIST(rec); Con v; GAP_getter<T> getter; for(int i = 1; i <= len; ++i) { if(ISB_LIST(rec, i)) { v.push_back(getter(ELM_LIST(rec, i))); } else { v.push_back(optional<T>()); } } return v; }
/**************************************************************************** ** *F FuncIS_SUBSET_SET(<self>,<s1>,<s2>) test if a set is a subset of another ** ** 'FuncIS_SUBSET_SET' implements the internal function 'IsSubsetSet'. ** ** 'IsSubsetSet( <set1>, <set2> )' ** ** 'IsSubsetSet' returns 'true' if the set <set2> is a subset of the set ** <set1>, that is if every element of <set2> is also an element of <set1>. ** Either argument may also be a list that is not a proper set, in which ** case 'IsSubsetSet' silently applies 'Set' (see "Set") to it first. */ Obj FuncIS_SUBSET_SET ( Obj self, Obj set1, Obj set2 ) { UInt len1; /* length of the left set */ UInt len2; /* length of the right set */ UInt i1; /* index into the left set */ UInt i2; /* index into the right set */ Obj e1; /* element of left set */ Obj e2; /* element of right set */ UInt pos; /* position */ /* check the arguments, convert to sets if necessary */ while ( ! IS_SMALL_LIST(set1) ) { set1 = ErrorReturnObj( "IsSubsetSet: <set1> must be a small list (not a %s)", (Int)TNAM_OBJ(set1), 0L, "you can replace <set1> via 'return <set1>;'" ); } while ( ! IS_SMALL_LIST(set2) ) { set2 = ErrorReturnObj( "IsSubsetSet: <set2> must be a small list (not a %s)", (Int)TNAM_OBJ(set2), 0L, "you can replace <set2> via 'return <set2>;'" ); } if ( ! IsSet( set1 ) ) set1 = SetList( set1 ); if ( ! IsSet( set2 ) ) set2 = SetList( set2 ); /* special case if the second argument is a set */ if ( IsSet( set2 ) ) { /* get the logical lengths and get the pointer */ len1 = LEN_PLIST( set1 ); len2 = LEN_PLIST( set2 ); i1 = 1; i2 = 1; /* now compare the two sets */ while ( i1 <= len1 && i2 <= len2 && len2 - i2 <= len1 - i1 ) { e1 = ELM_PLIST( set1, i1 ); e2 = ELM_PLIST( set2, i2 ); if ( EQ( e1, e2 ) ) { i1++; i2++; } else if ( LT( e1, e2 ) ) { i1++; } else { break; } } } /* general case */ else { /* first convert the other argument into a proper list */ PLAIN_LIST( set2 ); /* get the logical lengths */ len1 = LEN_PLIST( set1 ); len2 = LEN_PLIST( set2 ); /* loop over the second list and look for every element */ for ( i2 = 1; i2 <= len2; i2++ ) { /* ignore holes */ if ( ELM_PLIST(set2,i2) == 0 ) continue; /* perform the binary search to find the position */ pos = PositionSortedDensePlist( set1, ELM_PLIST(set2,i2) ); /* test if the element was found at position k */ if ( len1<pos || ! EQ(ELM_PLIST(set1,pos),ELM_PLIST(set2,i2)) ) { break; } } } /* return 'true' if every element of <set2> appeared in <set1> */ return ((i2 == len2 + 1) ? True : False); }
Obj SCTableEntryHandler ( Obj self, Obj table, Obj i, Obj j, Obj k ) { Obj tmp; /* temporary */ Obj basis; /* basis list */ Obj coeffs; /* coeffs list */ Int dim; /* dimension */ Int len; /* length of basis/coeffs lists */ Int l; /* loop variable */ /* check the table */ if ( ! IS_SMALL_LIST(table) ) { table = ErrorReturnObj( "SCTableEntry: <table> must be a small list (not a %s)", (Int)TNAM_OBJ(table), 0L, "you can replace <table> via 'return <table>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } dim = LEN_LIST(table) - 2; if ( dim <= 0 ) { table = ErrorReturnObj( "SCTableEntry: <table> must be a list with at least 3 elements", 0L, 0L, "you can replace <table> via 'return <table>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* check <i> */ if ( ! IS_INTOBJ(i) || INT_INTOBJ(i) <= 0 || dim < INT_INTOBJ(i) ) { i = ErrorReturnObj( "SCTableEntry: <i> must be an integer between 0 and %d", dim, 0L, "you can replace <i> via 'return <i>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* get and check the relevant row */ tmp = ELM_LIST( table, INT_INTOBJ(i) ); if ( ! IS_SMALL_LIST(tmp) || LEN_LIST(tmp) != dim ) { table = ErrorReturnObj( "SCTableEntry: <table>[%d] must be a list with %d elements", INT_INTOBJ(i), dim, "you can replace <table> via 'return <table>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* check <j> */ if ( ! IS_INTOBJ(j) || INT_INTOBJ(j) <= 0 || dim < INT_INTOBJ(j) ) { j = ErrorReturnObj( "SCTableEntry: <j> must be an integer between 0 and %d", dim, 0L, "you can replace <j> via 'return <j>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* get and check the basis and coefficients list */ tmp = ELM_LIST( tmp, INT_INTOBJ(j) ); if ( ! IS_SMALL_LIST(tmp) || LEN_LIST(tmp) != 2 ) { table = ErrorReturnObj( "SCTableEntry: <table>[%d][%d] must be a basis/coeffs list", 0L, 0L, "you can replace <table> via 'return <table>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* get and check the basis list */ basis = ELM_LIST( tmp, 1 ); if ( ! IS_SMALL_LIST(basis) ) { table = ErrorReturnObj( "SCTableEntry: <table>[%d][%d][1] must be a basis list", 0L, 0L, "you can replace <table> via 'return <table>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* get and check the coeffs list */ coeffs = ELM_LIST( tmp, 2 ); if ( ! IS_SMALL_LIST(coeffs) ) { table = ErrorReturnObj( "SCTableEntry: <table>[%d][%d][2] must be a coeffs list", 0L, 0L, "you can replace <table> via 'return <table>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* check that they have the same length */ len = LEN_LIST(basis); if ( LEN_LIST(coeffs) != len ) { table = ErrorReturnObj( "SCTableEntry: <table>[%d][%d][1], ~[2] must have equal length", 0L, 0L, "you can replace <table> via 'return <table>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* check <k> */ if ( ! IS_INTOBJ(k) || INT_INTOBJ(k) <= 0 || dim < INT_INTOBJ(k) ) { k = ErrorReturnObj( "SCTableEntry: <k> must be an integer between 0 and %d", dim, 0L, "you can replace <k> via 'return <k>;'" ); return SCTableEntryHandler( self, table, i, j, k ); } /* look for the (i,j,k) entry */ for ( l = 1; l <= len; l++ ) { if ( EQ( ELM_LIST( basis, l ), k ) ) break; } /* return the coefficient of zero */ if ( l <= len ) { return ELM_LIST( coeffs, l ); } else { return ELM_LIST( table, dim+2 ); } }
Obj SCTableProductHandler ( Obj self, Obj table, Obj list1, Obj list2 ) { Obj res; /* result list */ Obj row; /* one row of sc table */ Obj zero; /* zero from sc table */ Obj ai, aj; /* elements from list1 */ Obj bi, bj; /* elements from list2 */ Obj c, c1, c2; /* products of above */ Int dim; /* dimension of vectorspace */ Int i, j; /* loop variables */ /* check the arguments a bit */ if ( ! IS_SMALL_LIST(table) ) { table = ErrorReturnObj( "SCTableProduct: <table> must be a list (not a %s)", (Int)TNAM_OBJ(table), 0L, "you can replace <table> via 'return <table>;'" ); return SCTableProductHandler( self, table, list1, list2 ); } dim = LEN_LIST(table) - 2; if ( dim <= 0 ) { table = ErrorReturnObj( "SCTableProduct: <table> must be a list with at least 3 elements", 0L, 0L, "you can replace <table> via 'return <table>;'" ); return SCTableProductHandler( self, table, list1, list2 ); } zero = ELM_LIST( table, dim+2 ); if ( ! IS_SMALL_LIST(list1) || LEN_LIST(list1) != dim ) { list1 = ErrorReturnObj( "SCTableProduct: <list1> must be a list with %d elements", dim, 0L, "you can replace <list1> via 'return <list1>;'" ); return SCTableProductHandler( self, table, list1, list2 ); } if ( ! IS_SMALL_LIST(list2) || LEN_LIST(list2) != dim ) { list2 = ErrorReturnObj( "SCTableProduct: <list2> must be a list with %d elements", dim, 0L, "you can replace <list2> via 'return <list2>;'" ); return SCTableProductHandler( self, table, list1, list2 ); } /* make the result list */ res = NEW_PLIST( T_PLIST, dim ); SET_LEN_PLIST( res, dim ); for ( i = 1; i <= dim; i++ ) { SET_ELM_PLIST( res, i, zero ); } CHANGED_BAG( res ); /* general case */ if ( EQ( ELM_LIST( table, dim+1 ), INTOBJ_INT(0) ) ) { for ( i = 1; i <= dim; i++ ) { ai = ELM_LIST( list1, i ); if ( EQ( ai, zero ) ) continue; row = ELM_LIST( table, i ); for ( j = 1; j <= dim; j++ ) { bj = ELM_LIST( list2, j ); if ( EQ( bj, zero ) ) continue; c = PROD( ai, bj ); if ( ! EQ( c, zero ) ) { SCTableProdAdd( res, c, ELM_LIST( row, j ), dim ); } } } } /* commutative case */ else if ( EQ( ELM_LIST( table, dim+1 ), INTOBJ_INT(1) ) ) { for ( i = 1; i <= dim; i++ ) { ai = ELM_LIST( list1, i ); bi = ELM_LIST( list2, i ); if ( EQ( ai, zero ) && EQ( bi, zero ) ) continue; row = ELM_LIST( table, i ); c = PROD( ai, bi ); if ( ! EQ( c, zero ) ) { SCTableProdAdd( res, c, ELM_LIST( row, i ), dim ); } for ( j = i+1; j <= dim; j++ ) { bj = ELM_LIST( list2, j ); aj = ELM_LIST( list1, j ); if ( EQ( aj, zero ) && EQ( bj, zero ) ) continue; c1 = PROD( ai, bj ); c2 = PROD( aj, bi ); c = SUM( c1, c2 ); if ( ! EQ( c, zero ) ) { SCTableProdAdd( res, c, ELM_LIST( row, j ), dim ); } } } } /* anticommutative case */ else if ( EQ( ELM_LIST( table, dim+1 ), INTOBJ_INT(-1) ) ) { for ( i = 1; i <= dim; i++ ) { ai = ELM_LIST( list1, i ); bi = ELM_LIST( list2, i ); if ( EQ( ai, zero ) && EQ( bi, zero ) ) continue; row = ELM_LIST( table, i ); for ( j = i+1; j <= dim; j++ ) { bj = ELM_LIST( list2, j ); aj = ELM_LIST( list1, j ); if ( EQ( aj, zero ) && EQ( bj, zero ) ) continue; c1 = PROD( ai, bj ); c2 = PROD( aj, bi ); c = DIFF( c1, c2 ); if ( ! EQ( c, zero ) ) { SCTableProdAdd( res, c, ELM_LIST( row, j ), dim ); } } } } /* return the result */ return res; }
/* handler for function 3 */ static Obj HdlrFunc3 ( Obj self, Obj a_flags ) { Obj l_with = 0; Obj l_changed = 0; Obj l_imp = 0; Obj l_hash = 0; Obj l_hash2 = 0; Obj l_i = 0; Obj t_1 = 0; Obj t_2 = 0; Obj t_3 = 0; Obj t_4 = 0; Obj t_5 = 0; Obj t_6 = 0; Obj t_7 = 0; Obj t_8 = 0; Obj t_9 = 0; Obj t_10 = 0; Obj t_11 = 0; Bag oldFrame; OLD_BRK_CURR_STAT /* allocate new stack frame */ SWITCH_TO_NEW_FRAME(self,0,0,oldFrame); REM_BRK_CURR_STAT(); SET_BRK_CURR_STAT(0); /* hash := HASH_FLAGS( flags ) mod 11001; */ t_3 = GF_HASH__FLAGS; t_2 = CALL_1ARGS( t_3, a_flags ); CHECK_FUNC_RESULT( t_2 ) t_1 = MOD( t_2, INTOBJ_INT(11001) ); l_hash = t_1; /* for i in [ 0 .. 3 ] do */ for ( t_1 = INTOBJ_INT(0); ((Int)t_1) <= ((Int)INTOBJ_INT(3)); t_1 = (Obj)(((UInt)t_1)+4) ) { l_i = t_1; /* hash2 := 2 * ((hash + 31 * i) mod 11001) + 1; */ C_PROD_INTOBJS( t_6, INTOBJ_INT(31), l_i ) C_SUM_FIA( t_5, l_hash, t_6 ) t_4 = MOD( t_5, INTOBJ_INT(11001) ); C_PROD_FIA( t_3, INTOBJ_INT(2), t_4 ) C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) ) l_hash2 = t_2; /* if IsBound( WITH_IMPS_FLAGS_CACHE[hash2] ) then */ t_4 = GC_WITH__IMPS__FLAGS__CACHE; CHECK_BOUND( t_4, "WITH_IMPS_FLAGS_CACHE" ) CHECK_INT_POS( l_hash2 ) t_3 = C_ISB_LIST( t_4, l_hash2 ); t_2 = (Obj)(UInt)(t_3 != False); if ( t_2 ) { /* if IS_IDENTICAL_OBJ( WITH_IMPS_FLAGS_CACHE[hash2], flags ) then */ t_4 = GF_IS__IDENTICAL__OBJ; t_6 = GC_WITH__IMPS__FLAGS__CACHE; CHECK_BOUND( t_6, "WITH_IMPS_FLAGS_CACHE" ) C_ELM_LIST_FPL( t_5, t_6, l_hash2 ) t_3 = CALL_2ARGS( t_4, t_5, a_flags ); CHECK_FUNC_RESULT( t_3 ) CHECK_BOOL( t_3 ) t_2 = (Obj)(UInt)(t_3 != False); if ( t_2 ) { /* WITH_IMPS_FLAGS_CACHE_HIT := WITH_IMPS_FLAGS_CACHE_HIT + 1; */ t_3 = GC_WITH__IMPS__FLAGS__CACHE__HIT; CHECK_BOUND( t_3, "WITH_IMPS_FLAGS_CACHE_HIT" ) C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) ) AssGVar( G_WITH__IMPS__FLAGS__CACHE__HIT, t_2 ); /* return WITH_IMPS_FLAGS_CACHE[hash2 + 1]; */ t_3 = GC_WITH__IMPS__FLAGS__CACHE; CHECK_BOUND( t_3, "WITH_IMPS_FLAGS_CACHE" ) C_SUM_FIA( t_4, l_hash2, INTOBJ_INT(1) ) CHECK_INT_POS( t_4 ) C_ELM_LIST_FPL( t_2, t_3, t_4 ) RES_BRK_CURR_STAT(); SWITCH_TO_OLD_FRAME(oldFrame); return t_2; } /* fi */ } /* else */ else { /* break; */ break; } /* fi */ } /* od */ /* if i = 3 then */ t_1 = (Obj)(UInt)(((Int)l_i) == ((Int)INTOBJ_INT(3))); if ( t_1 ) { /* WITH_IMPS_FLAGS_COUNT := (WITH_IMPS_FLAGS_COUNT + 1) mod 4; */ t_3 = GC_WITH__IMPS__FLAGS__COUNT; CHECK_BOUND( t_3, "WITH_IMPS_FLAGS_COUNT" ) C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) ) t_1 = MOD( t_2, INTOBJ_INT(4) ); AssGVar( G_WITH__IMPS__FLAGS__COUNT, t_1 ); /* i := WITH_IMPS_FLAGS_COUNT; */ t_1 = GC_WITH__IMPS__FLAGS__COUNT; CHECK_BOUND( t_1, "WITH_IMPS_FLAGS_COUNT" ) l_i = t_1; /* hash2 := 2 * ((hash + 31 * i) mod 11001) + 1; */ C_PROD_FIA( t_5, INTOBJ_INT(31), l_i ) C_SUM_FIA( t_4, l_hash, t_5 ) t_3 = MOD( t_4, INTOBJ_INT(11001) ); C_PROD_FIA( t_2, INTOBJ_INT(2), t_3 ) C_SUM_FIA( t_1, t_2, INTOBJ_INT(1) ) l_hash2 = t_1; } /* fi */ /* WITH_IMPS_FLAGS_CACHE_MISS := WITH_IMPS_FLAGS_CACHE_MISS + 1; */ t_2 = GC_WITH__IMPS__FLAGS__CACHE__MISS; CHECK_BOUND( t_2, "WITH_IMPS_FLAGS_CACHE_MISS" ) C_SUM_FIA( t_1, t_2, INTOBJ_INT(1) ) AssGVar( G_WITH__IMPS__FLAGS__CACHE__MISS, t_1 ); /* with := flags; */ l_with = a_flags; /* changed := true; */ t_1 = True; l_changed = t_1; /* while changed od */ while ( 1 ) { t_1 = (Obj)(UInt)(l_changed != False); if ( ! t_1 ) break; /* changed := false; */ t_1 = False; l_changed = t_1; /* for imp in IMPLICATIONS do */ t_4 = GC_IMPLICATIONS; CHECK_BOUND( t_4, "IMPLICATIONS" ) if ( IS_SMALL_LIST(t_4) ) { t_3 = (Obj)(UInt)1; t_1 = INTOBJ_INT(1); } else { t_3 = (Obj)(UInt)0; t_1 = CALL_1ARGS( GF_ITERATOR, t_4 ); } while ( 1 ) { if ( t_3 ) { if ( LEN_LIST(t_4) < INT_INTOBJ(t_1) ) break; t_2 = ELMV0_LIST( t_4, INT_INTOBJ(t_1) ); t_1 = (Obj)(((UInt)t_1)+4); if ( t_2 == 0 ) continue; } else { if ( CALL_1ARGS( GF_IS_DONE_ITER, t_1 ) != False ) break; t_2 = CALL_1ARGS( GF_NEXT_ITER, t_1 ); } l_imp = t_2; /* if IS_SUBSET_FLAGS( with, imp[2] ) and not IS_SUBSET_FLAGS( with, imp[1] ) then */ t_8 = GF_IS__SUBSET__FLAGS; C_ELM_LIST_FPL( t_9, l_imp, INTOBJ_INT(2) ) t_7 = CALL_2ARGS( t_8, l_with, t_9 ); CHECK_FUNC_RESULT( t_7 ) CHECK_BOOL( t_7 ) t_6 = (Obj)(UInt)(t_7 != False); t_5 = t_6; if ( t_5 ) { t_10 = GF_IS__SUBSET__FLAGS; C_ELM_LIST_FPL( t_11, l_imp, INTOBJ_INT(1) ) t_9 = CALL_2ARGS( t_10, l_with, t_11 ); CHECK_FUNC_RESULT( t_9 ) CHECK_BOOL( t_9 ) t_8 = (Obj)(UInt)(t_9 != False); t_7 = (Obj)(UInt)( ! ((Int)t_8) ); t_5 = t_7; } if ( t_5 ) { /* with := AND_FLAGS( with, imp[1] ); */ t_6 = GF_AND__FLAGS; C_ELM_LIST_FPL( t_7, l_imp, INTOBJ_INT(1) ) t_5 = CALL_2ARGS( t_6, l_with, t_7 ); CHECK_FUNC_RESULT( t_5 ) l_with = t_5; /* changed := true; */ t_5 = True; l_changed = t_5; } /* fi */ } /* od */ } /* od */ /* WITH_IMPS_FLAGS_CACHE[hash2] := flags; */ t_1 = GC_WITH__IMPS__FLAGS__CACHE; CHECK_BOUND( t_1, "WITH_IMPS_FLAGS_CACHE" ) CHECK_INT_POS( l_hash2 ) C_ASS_LIST_FPL( t_1, l_hash2, a_flags ) /* WITH_IMPS_FLAGS_CACHE[hash2 + 1] := with; */ t_1 = GC_WITH__IMPS__FLAGS__CACHE; CHECK_BOUND( t_1, "WITH_IMPS_FLAGS_CACHE" ) C_SUM_FIA( t_2, l_hash2, INTOBJ_INT(1) ) CHECK_INT_POS( t_2 ) C_ASS_LIST_FPL( t_1, t_2, l_with ) /* return with; */ RES_BRK_CURR_STAT(); SWITCH_TO_OLD_FRAME(oldFrame); return l_with; /* return; */ RES_BRK_CURR_STAT(); SWITCH_TO_OLD_FRAME(oldFrame); return 0; }
/* handler for function 4 */ static Obj HdlrFunc4 ( Obj self, Obj a_filter ) { Obj l_rank = 0; Obj l_flags = 0; Obj l_i = 0; Obj t_1 = 0; Obj t_2 = 0; Obj t_3 = 0; Obj t_4 = 0; Obj t_5 = 0; Obj t_6 = 0; Obj t_7 = 0; Bag oldFrame; OLD_BRK_CURR_STAT /* allocate new stack frame */ SWITCH_TO_NEW_FRAME(self,0,0,oldFrame); REM_BRK_CURR_STAT(); SET_BRK_CURR_STAT(0); /* rank := 0; */ l_rank = INTOBJ_INT(0); /* if IS_FUNCTION( filter ) then */ t_3 = GF_IS__FUNCTION; t_2 = CALL_1ARGS( t_3, a_filter ); CHECK_FUNC_RESULT( t_2 ) CHECK_BOOL( t_2 ) t_1 = (Obj)(UInt)(t_2 != False); if ( t_1 ) { /* flags := FLAGS_FILTER( filter ); */ t_2 = GF_FLAGS__FILTER; t_1 = CALL_1ARGS( t_2, a_filter ); CHECK_FUNC_RESULT( t_1 ) l_flags = t_1; } /* else */ else { /* flags := filter; */ l_flags = a_filter; } /* fi */ /* for i in TRUES_FLAGS( WITH_HIDDEN_IMPS_FLAGS( flags ) ) do */ t_5 = GF_TRUES__FLAGS; t_7 = GF_WITH__HIDDEN__IMPS__FLAGS; t_6 = CALL_1ARGS( t_7, l_flags ); CHECK_FUNC_RESULT( t_6 ) t_4 = CALL_1ARGS( t_5, t_6 ); CHECK_FUNC_RESULT( t_4 ) if ( IS_SMALL_LIST(t_4) ) { t_3 = (Obj)(UInt)1; t_1 = INTOBJ_INT(1); } else { t_3 = (Obj)(UInt)0; t_1 = CALL_1ARGS( GF_ITERATOR, t_4 ); } while ( 1 ) { if ( t_3 ) { if ( LEN_LIST(t_4) < INT_INTOBJ(t_1) ) break; t_2 = ELMV0_LIST( t_4, INT_INTOBJ(t_1) ); t_1 = (Obj)(((UInt)t_1)+4); if ( t_2 == 0 ) continue; } else { if ( CALL_1ARGS( GF_IS_DONE_ITER, t_1 ) != False ) break; t_2 = CALL_1ARGS( GF_NEXT_ITER, t_1 ); } l_i = t_2; /* if IsBound( RANK_FILTERS[i] ) then */ t_7 = GC_RANK__FILTERS; CHECK_BOUND( t_7, "RANK_FILTERS" ) CHECK_INT_POS( l_i ) t_6 = C_ISB_LIST( t_7, l_i ); t_5 = (Obj)(UInt)(t_6 != False); if ( t_5 ) { /* rank := rank + RANK_FILTERS[i]; */ t_7 = GC_RANK__FILTERS; CHECK_BOUND( t_7, "RANK_FILTERS" ) C_ELM_LIST_FPL( t_6, t_7, l_i ) C_SUM_FIA( t_5, l_rank, t_6 ) l_rank = t_5; } /* else */ else { /* rank := rank + 1; */ C_SUM_FIA( t_5, l_rank, INTOBJ_INT(1) ) l_rank = t_5; } /* fi */ } /* od */ /* return rank; */ RES_BRK_CURR_STAT(); SWITCH_TO_OLD_FRAME(oldFrame); return l_rank; /* return; */ RES_BRK_CURR_STAT(); SWITCH_TO_OLD_FRAME(oldFrame); return 0; }
/* handler for function 2 */ static Obj HdlrFunc2 ( Obj self, Obj a_filter ) { Obj l_i = 0; Obj l_flags = 0; Obj t_1 = 0; Obj t_2 = 0; Obj t_3 = 0; Obj t_4 = 0; Obj t_5 = 0; Obj t_6 = 0; Obj t_7 = 0; Obj t_8 = 0; Obj t_9 = 0; Obj t_10 = 0; Bag oldFrame; OLD_BRK_CURR_STAT /* allocate new stack frame */ SWITCH_TO_NEW_FRAME(self,0,0,oldFrame); REM_BRK_CURR_STAT(); SET_BRK_CURR_STAT(0); /* flags := FLAGS_FILTER( filter ); */ t_2 = GF_FLAGS__FILTER; t_1 = CALL_1ARGS( t_2, a_filter ); CHECK_FUNC_RESULT( t_1 ) l_flags = t_1; /* for i in [ 1, 3 .. LEN_LIST( WITH_HIDDEN_IMPS_FLAGS_CACHE ) - 1 ] do */ t_7 = GF_LEN__LIST; t_8 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE; CHECK_BOUND( t_8, "WITH_HIDDEN_IMPS_FLAGS_CACHE" ) t_6 = CALL_1ARGS( t_7, t_8 ); CHECK_FUNC_RESULT( t_6 ) C_DIFF_FIA( t_5, t_6, INTOBJ_INT(1) ) t_4 = Range3Check( INTOBJ_INT(1), INTOBJ_INT(3), t_5 ); if ( IS_SMALL_LIST(t_4) ) { t_3 = (Obj)(UInt)1; t_1 = INTOBJ_INT(1); } else { t_3 = (Obj)(UInt)0; t_1 = CALL_1ARGS( GF_ITERATOR, t_4 ); } while ( 1 ) { if ( t_3 ) { if ( LEN_LIST(t_4) < INT_INTOBJ(t_1) ) break; t_2 = ELMV0_LIST( t_4, INT_INTOBJ(t_1) ); t_1 = (Obj)(((UInt)t_1)+4); if ( t_2 == 0 ) continue; } else { if ( CALL_1ARGS( GF_IS_DONE_ITER, t_1 ) != False ) break; t_2 = CALL_1ARGS( GF_NEXT_ITER, t_1 ); } l_i = t_2; /* if IsBound( WITH_HIDDEN_IMPS_FLAGS_CACHE[i] ) then */ t_7 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE; CHECK_BOUND( t_7, "WITH_HIDDEN_IMPS_FLAGS_CACHE" ) CHECK_INT_POS( l_i ) t_6 = C_ISB_LIST( t_7, l_i ); t_5 = (Obj)(UInt)(t_6 != False); if ( t_5 ) { /* if IS_SUBSET_FLAGS( WITH_HIDDEN_IMPS_FLAGS_CACHE[i + 1], flags ) then */ t_7 = GF_IS__SUBSET__FLAGS; t_9 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE; CHECK_BOUND( t_9, "WITH_HIDDEN_IMPS_FLAGS_CACHE" ) C_SUM_FIA( t_10, l_i, INTOBJ_INT(1) ) CHECK_INT_POS( t_10 ) C_ELM_LIST_FPL( t_8, t_9, t_10 ) t_6 = CALL_2ARGS( t_7, t_8, l_flags ); CHECK_FUNC_RESULT( t_6 ) CHECK_BOOL( t_6 ) t_5 = (Obj)(UInt)(t_6 != False); if ( t_5 ) { /* Unbind( WITH_HIDDEN_IMPS_FLAGS_CACHE[i] ); */ t_5 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE; CHECK_BOUND( t_5, "WITH_HIDDEN_IMPS_FLAGS_CACHE" ) C_UNB_LIST( t_5, l_i ); /* Unbind( WITH_HIDDEN_IMPS_FLAGS_CACHE[i + 1] ); */ t_5 = GC_WITH__HIDDEN__IMPS__FLAGS__CACHE; CHECK_BOUND( t_5, "WITH_HIDDEN_IMPS_FLAGS_CACHE" ) C_SUM_FIA( t_6, l_i, INTOBJ_INT(1) ) CHECK_INT_POS( t_6 ) C_UNB_LIST( t_5, t_6 ); } /* fi */ } /* fi */ } /* od */ /* return; */ RES_BRK_CURR_STAT(); SWITCH_TO_OLD_FRAME(oldFrame); return 0; /* return; */ RES_BRK_CURR_STAT(); SWITCH_TO_OLD_FRAME(oldFrame); return 0; }
bool isa(Obj recval) const { return IS_SMALL_LIST(recval); }
bool isa(Obj recval) const { return IS_SMALL_LIST(recval) && LEN_LIST(recval) == 2; }