diff --git a/lib/filter.g b/lib/filter.g index 17c06c8464..96d819e4ed 100644 --- a/lib/filter.g +++ b/lib/filter.g @@ -52,8 +52,8 @@ fi; ## 2 = category ## 3 = representation kernel ## 4 = representation -## 5 = attribute kernel -## 6 = attribute +## 5 = attribute tester kernel +## 6 = attribute tester ## 7 = property kernel ## 8 = tester of 7 ## 9 = property @@ -64,13 +64,26 @@ if IsHPCGAP then LockAndMigrateObj(INFO_FILTERS, FILTER_REGION); fi; -BIND_GLOBAL( "FNUM_CATS", MakeImmutable([ 1, 2 ]) ); -BIND_GLOBAL( "FNUM_REPS", MakeImmutable([ 3, 4 ]) ); -BIND_GLOBAL( "FNUM_ATTS", MakeImmutable([ 5, 6 ]) ); -BIND_GLOBAL( "FNUM_PROS", MakeImmutable([ 7, 9 ]) ); -BIND_GLOBAL( "FNUM_TPRS", MakeImmutable([ 8, 10 ]) ); +BIND_CONSTANT( "FNUM_CAT_KERN", 1 ); +BIND_CONSTANT( "FNUM_CAT", 2 ); +BIND_CONSTANT( "FNUM_REP_KERN", 3 ); +BIND_CONSTANT( "FNUM_REP", 4 ); +BIND_CONSTANT( "FNUM_ATTR_KERN", 5 ); +BIND_CONSTANT( "FNUM_ATTR", 6 ); +BIND_CONSTANT( "FNUM_PROP_KERN", 7 ); +BIND_CONSTANT( "FNUM_PROP", 9 ); +BIND_CONSTANT( "FNUM_TPR_KERN", 8 ); +BIND_CONSTANT( "FNUM_TPR", 10 ); -BIND_GLOBAL( "FNUM_CATS_AND_REPS", MakeImmutable([ 1 .. 4 ]) ); +BIND_GLOBAL( "FNUM_CATS", MakeImmutable([ FNUM_CAT_KERN, FNUM_CAT ]) ); +BIND_GLOBAL( "FNUM_REPS", MakeImmutable([ FNUM_REP_KERN, FNUM_REP ]) ); +BIND_GLOBAL( "FNUM_ATTS", MakeImmutable([ FNUM_ATTR_KERN, FNUM_ATTR ]) ); +BIND_GLOBAL( "FNUM_PROS", MakeImmutable([ FNUM_PROP_KERN, FNUM_PROP ]) ); +BIND_GLOBAL( "FNUM_TPRS", MakeImmutable([ FNUM_TPR_KERN, FNUM_TPR ]) ); + +BIND_GLOBAL( "FNUM_CATS_AND_REPS", + MakeImmutable([ FNUM_CAT_KERN, FNUM_CAT, + FNUM_REP_KERN, FNUM_REP ]) ); ############################################################################# @@ -245,6 +258,15 @@ end ); ## ## <#/GAPDoc> ## +BIND_GLOBAL( "REGISTER_FILTER", function( filter, id, rank, info ) + atomic FILTER_REGION do + FILTERS[id] := filter; + IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( filter ) ); + RANK_FILTERS[id] := rank; + INFO_FILTERS[id] := info; + od; +end ); + BIND_GLOBAL( "NewFilter", function( arg ) local name, implied, rank, filter; @@ -272,12 +294,7 @@ BIND_GLOBAL( "NewFilter", function( arg ) filter := NEW_FILTER( name ); # Do some administrational work. - atomic FILTER_REGION do - FILTERS[ FLAG1_FILTER( filter ) ] := filter; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( filter ) ); - RANK_FILTERS[ FLAG1_FILTER( filter ) ] := rank; - INFO_FILTERS[ FLAG1_FILTER( filter ) ] := 0; - od; + REGISTER_FILTER( filter, FLAG1_FILTER( filter ), rank, 0 ); if implied <> 0 then InstallTrueMethodNewFilter( implied, filter ); @@ -420,11 +437,7 @@ BIND_GLOBAL( "RankFilter", function( filter ) all := WITH_IMPS_FLAGS(flags); fi; for i in TRUES_FLAGS(all) do - if IsBound(RANK_FILTERS[i]) then - rank := rank + RANK_FILTERS[i]; - else - rank := rank + 1; - fi; + rank := rank + RANK_FILTERS[i]; od; return rank; end ); diff --git a/lib/oper.g b/lib/oper.g index c06b0a43f4..bcbf31b757 100644 --- a/lib/oper.g +++ b/lib/oper.g @@ -1109,11 +1109,7 @@ BIND_GLOBAL( "DeclareAttributeKernel", function ( name, filter, getter ) STORE_OPER_FLAGS(tester, [ FLAGS_FILTER(filter) ]); # store the information about the filter - atomic FILTER_REGION do - FILTERS[ FLAG2_FILTER( tester ) ] := tester; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( tester ) ); - INFO_FILTERS[ FLAG2_FILTER( tester ) ] := 5; - od; + REGISTER_FILTER( tester, FLAG2_FILTER( tester ), 1, FNUM_ATTR_KERN ); # clear the cache because is something old if not GAPInfo.CommandLineOptions.N then @@ -1124,10 +1120,6 @@ BIND_GLOBAL( "DeclareAttributeKernel", function ( name, filter, getter ) # run the attribute functions RUN_ATTR_FUNCS( filter, getter, setter, tester, false ); - # store the ranks - atomic FILTER_REGION do - RANK_FILTERS[ FLAG2_FILTER( tester ) ] := 1; - od; # and make the remaining assignments BIND_SETTER_TESTER( name, setter, tester ); @@ -1200,9 +1192,6 @@ end ); BIND_GLOBAL( "OPER_SetupAttribute", function(getter, flags, mutflag, filter, rank, name) local setter, tester, nname; - # store the information about the filter - INFO_FILTERS[ FLAG2_FILTER(getter) ] := 6; - # add setter and tester to the list of operations setter := SETTER_FILTER( getter ); tester := TESTER_FILTER( getter ); @@ -1210,9 +1199,8 @@ BIND_GLOBAL( "OPER_SetupAttribute", function(getter, flags, mutflag, filter, ran STORE_OPER_FLAGS(setter, [ flags, FLAGS_FILTER( IS_OBJECT ) ]); STORE_OPER_FLAGS(tester, [ flags ]); - # install the default functions - FILTERS[ FLAG2_FILTER( tester ) ] := tester; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( tester ) ); + # store information about the filter + REGISTER_FILTER( tester, FLAG2_FILTER( tester ), rank, FNUM_ATTR ); # the is newly made, therefore the cache cannot contain a flag # list involving @@ -1224,8 +1212,6 @@ BIND_GLOBAL( "OPER_SetupAttribute", function(getter, flags, mutflag, filter, ran # run the attribute functions RUN_ATTR_FUNCS( filter, getter, setter, tester, mutflag ); - # store the rank - RANK_FILTERS[ FLAG2_FILTER( tester ) ] := rank; end); # construct getter, setter and tester @@ -1267,9 +1253,7 @@ BIND_GLOBAL( "NewAttribute", function ( name, filter, args... ) fi; STORE_OPER_FLAGS(getter, [ flags ]); - atomic FILTER_REGION do OPER_SetupAttribute(getter, flags, mutflag, filter, rank, name); - od; # And return the getter return getter; @@ -1313,7 +1297,7 @@ function(name, op, filter, rank, mutable) od; flags := FLAGS_FILTER(filter); - STORE_OPER_FLAGS( op, [ FLAGS_FILTER( filter ) ] ); + STORE_OPER_FLAGS( op, [ flags ] ); # kernel magic for the conversion if mutable then @@ -1358,7 +1342,6 @@ BIND_GLOBAL( "DeclareAttribute", function ( name, filter, args... ) fi; if ISB_GVAR( name ) then - atomic FILTER_REGION do # The variable exists already. gvar := VALUE_GLOBAL( name ); @@ -1367,19 +1350,22 @@ BIND_GLOBAL( "DeclareAttribute", function ( name, filter, args... ) Error( "variable `", name, "' is not bound to an operation" ); fi; - # The attribute has already been declared. - # If it was not created as an attribute - # then we may be able to convert it - if FLAG2_FILTER( gvar ) = 0 or IS_ELEMENTARY_FILTER(gvar) then - ConvertToAttribute(name, gvar, filter, rank, mutflag); - else + # Check whether the variable is in fact bound to an attribute, i.e., + # it has an associated tester (whose id is in FLAG2_FILTER) but is not + # a filter itself (to exclude properties, and also and-filters for which + # FLAG2_FILTER also is non-zero). + if FLAG2_FILTER( gvar ) <> 0 and not IsFilter(gvar) then + # gvar is already an attribute, extend it by the new filter STORE_OPER_FLAGS( gvar, [ FLAGS_FILTER( filter ) ] ); # also set the extended range for the setter req := GET_OPER_FLAGS( Setter(gvar) ); STORE_OPER_FLAGS( Setter(gvar), [ FLAGS_FILTER( filter), req[1][2] ] ); + else + # gvar is a an existing non-attribute operation, try to convert it + # into an attribute + ConvertToAttribute(name, gvar, filter, rank, mutflag); fi; - od; else # The attribute is new. attr := NewAttribute(name, filter, mutflag, rank); @@ -1438,12 +1424,9 @@ BIND_GLOBAL( "DeclarePropertyKernel", function ( name, filter, getter ) STORE_OPER_FLAGS(setter, [ FLAGS_FILTER(filter), FLAGS_FILTER(IS_BOOL) ]); STORE_OPER_FLAGS(tester, [ FLAGS_FILTER(filter) ]); - # install the default functions - FILTERS[ FLAG1_FILTER( getter ) ]:= getter; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( getter ) ); - FILTERS[ FLAG2_FILTER( getter ) ]:= tester; - INFO_FILTERS[ FLAG1_FILTER( getter ) ]:= 7; - INFO_FILTERS[ FLAG2_FILTER( getter ) ]:= 8; + # store information about the filters + REGISTER_FILTER( getter, FLAG1_FILTER( getter ), 1, FNUM_PROP_KERN ); + REGISTER_FILTER( tester, FLAG2_FILTER( tester ), 1, FNUM_TPR_KERN ); # clear the cache because is something old if not GAPInfo.CommandLineOptions.N then @@ -1456,9 +1439,6 @@ BIND_GLOBAL( "DeclarePropertyKernel", function ( name, filter, getter ) # run the attribute functions RUN_ATTR_FUNCS( filter, getter, setter, tester, false ); - # store the ranks - RANK_FILTERS[ FLAG1_FILTER( getter ) ] := 1; - RANK_FILTERS[ FLAG2_FILTER( getter ) ] := 1; # and make the remaining assignments BIND_SETTER_TESTER( name, setter, tester ); @@ -1489,10 +1469,15 @@ end ); ## <#/GAPDoc> ## BIND_GLOBAL( "NewProperty", function ( arg ) - local name, filter, flags, getter, setter, tester; + local name, filter, rank, flags, getter, setter, tester; name := arg[1]; filter := arg[2]; + if LEN_LIST( arg ) = 3 and IS_INT( arg[3] ) then + rank := arg[3]; + else + rank := 1; + fi; if not IS_OPERATION( filter ) then Error( " must be an operation" ); @@ -1509,14 +1494,9 @@ BIND_GLOBAL( "NewProperty", function ( arg ) STORE_OPER_FLAGS(setter, [ flags, FLAGS_FILTER(IS_BOOL) ]); STORE_OPER_FLAGS(tester, [ flags ]); - # install the default functions - atomic FILTER_REGION do - FILTERS[ FLAG1_FILTER( getter ) ] := getter; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( getter ) ); - FILTERS[ FLAG2_FILTER( getter ) ] := tester; - INFO_FILTERS[ FLAG1_FILTER( getter ) ] := 9; - INFO_FILTERS[ FLAG2_FILTER( getter ) ] := 10; - od; + # store information about the filters + REGISTER_FILTER( getter, FLAG1_FILTER( getter ), rank, FNUM_PROP ); + REGISTER_FILTER( tester, FLAG2_FILTER( tester ), 1, FNUM_TPR ); # the and are newly made, therefore the cache cannot # contain a flag list involving or @@ -1529,15 +1509,6 @@ BIND_GLOBAL( "NewProperty", function ( arg ) # run the attribute functions RUN_ATTR_FUNCS( filter, getter, setter, tester, false ); - # store the rank - atomic FILTER_REGION do - if LEN_LIST( arg ) = 3 and IS_INT( arg[3] ) then - RANK_FILTERS[ FLAG1_FILTER( getter ) ]:= arg[3]; - else - RANK_FILTERS[ FLAG1_FILTER( getter ) ]:= 1; - fi; - RANK_FILTERS[ FLAG2_FILTER( tester ) ]:= 1; - od; # and return the getter return getter; diff --git a/lib/oper1.g b/lib/oper1.g index 71067774e0..4a7e9bf5a3 100644 --- a/lib/oper1.g +++ b/lib/oper1.g @@ -211,8 +211,8 @@ BIND_GLOBAL( "INSTALL_METHOD_FLAGS", fi; # push the other functions back if not REREADING or not replace then - methods{[narg+BASE_SIZE_METHODS_OPER_ENTRY+i+1..narg+BASE_SIZE_METHODS_OPER_ENTRY+LEN_LIST(methods)]} - := methods{[i+1..LEN_LIST(methods)]}; + COPY_LIST_ENTRIES(methods, i+1, 1, methods, narg+BASE_SIZE_METHODS_OPER_ENTRY+i+1,1, + LEN_LIST(methods)-i); fi; # install the new method diff --git a/lib/type.g b/lib/type.g index 18c816d357..4eed2ac87e 100644 --- a/lib/type.g +++ b/lib/type.g @@ -40,10 +40,7 @@ BIND_GLOBAL( "DeclareCategoryKernel", function ( name, super, cat ) if not IS_IDENTICAL_OBJ( cat, IS_OBJECT ) then atomic readwrite CATS_AND_REPS, FILTER_REGION do ADD_LIST( CATS_AND_REPS, FLAG1_FILTER( cat ) ); - FILTERS[ FLAG1_FILTER( cat ) ] := cat; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( cat ) ); - INFO_FILTERS[ FLAG1_FILTER( cat ) ] := 1; - RANK_FILTERS[ FLAG1_FILTER( cat ) ] := 1; + REGISTER_FILTER( cat, FLAG1_FILTER( cat ), 1, FNUM_CAT_KERN ); od; InstallTrueMethod( super, cat ); fi; @@ -83,23 +80,20 @@ end ); ## <#/GAPDoc> ## BIND_GLOBAL( "NewCategory", function ( arg ) - local cat; + local cat, rank; # Create the filter. cat:= NEW_FILTER( arg[1] ); + if LEN_LIST( arg ) >= 3 and IS_INT( arg[3] ) then + rank := arg[3]; + else + rank := 1; + fi; # Do some administrational work. atomic readwrite CATS_AND_REPS, FILTER_REGION do ADD_LIST( CATS_AND_REPS, FLAG1_FILTER( cat ) ); - FILTERS[ FLAG1_FILTER( cat ) ] := cat; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( cat ) ); - - if LEN_LIST( arg ) = 3 and IS_INT( arg[3] ) then - RANK_FILTERS[ FLAG1_FILTER( cat ) ]:= arg[3]; - else - RANK_FILTERS[ FLAG1_FILTER( cat ) ]:= 1; - fi; - INFO_FILTERS[ FLAG1_FILTER( cat ) ] := 2; + REGISTER_FILTER( cat, FLAG1_FILTER( cat ), rank, FNUM_CAT ); od; # Do not call this before adding 'cat' to 'FILTERS'. @@ -160,11 +154,11 @@ BIND_GLOBAL( "DeclareRepresentationKernel", function ( arg ) else Error("usage: DeclareRepresentation( , , [, ] )"); fi; - ADD_LIST( CATS_AND_REPS, FLAG1_FILTER( rep ) ); - FILTERS[ FLAG1_FILTER( rep ) ] := rep; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( rep ) ); - RANK_FILTERS[ FLAG1_FILTER( rep ) ] := 1; - INFO_FILTERS[ FLAG1_FILTER( rep ) ] := 3; + atomic readwrite CATS_AND_REPS, FILTER_REGION do + ADD_LIST( CATS_AND_REPS, FLAG1_FILTER( rep ) ); + REGISTER_FILTER( rep, FLAG1_FILTER( rep ), 1, FNUM_REP_KERN ); + od; + od; InstallTrueMethod( arg[2], rep ); BIND_GLOBAL( arg[1], rep ); @@ -252,10 +246,7 @@ BIND_GLOBAL( "NewRepresentation", function ( arg ) # Do some administrational work. atomic readwrite CATS_AND_REPS, FILTER_REGION do ADD_LIST( CATS_AND_REPS, FLAG1_FILTER( rep ) ); - FILTERS[ FLAG1_FILTER( rep ) ] := rep; - IMM_FLAGS:= AND_FLAGS( IMM_FLAGS, FLAGS_FILTER( rep ) ); - RANK_FILTERS[ FLAG1_FILTER( rep ) ] := 1; - INFO_FILTERS[ FLAG1_FILTER( rep ) ] := 4; + REGISTER_FILTER( rep, FLAG1_FILTER( rep ), 1, FNUM_REP ); od; # Do not call this before adding 'rep' to 'FILTERS'. diff --git a/src/c_oper1.c b/src/c_oper1.c index aeb413b27f..813936c29f 100644 --- a/src/c_oper1.c +++ b/src/c_oper1.c @@ -1,7 +1,7 @@ #ifndef AVOID_PRECOMPILED /* C file produced by GAC */ #include "compiled.h" -#define FILE_CRC "32938550" +#define FILE_CRC "70528668" /* global variables used in handlers */ static GVar G_REREADING; @@ -82,6 +82,8 @@ static GVar G_LEN__LIST; static Obj GF_LEN__LIST; static GVar G_APPEND__LIST__INTR; static Obj GF_APPEND__LIST__INTR; +static GVar G_COPY__LIST__ENTRIES; +static Obj GF_COPY__LIST__ENTRIES; static GVar G_CONV__STRING; static Obj GF_CONV__STRING; static GVar G_Print; @@ -923,23 +925,31 @@ static Obj HdlrFunc3 ( } if ( t_1 ) { - /* methods{[ narg + 5 + i + 1 .. narg + 5 + LEN_LIST( methods ) ]} := methods{[ i + 1 .. LEN_LIST( methods ) ]}; */ - C_SUM_FIA( t_4, l_narg, INTOBJ_INT(5) ) - C_SUM_FIA( t_3, t_4, l_i ) - C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) ) - C_SUM_FIA( t_4, l_narg, INTOBJ_INT(5) ) - t_6 = GF_LEN__LIST; - t_5 = CALL_1ARGS( t_6, l_methods ); - CHECK_FUNC_RESULT( t_5 ) - C_SUM_FIA( t_3, t_4, t_5 ) - t_1 = Range2Check( t_2, t_3 ); - C_SUM_FIA( t_4, l_i, INTOBJ_INT(1) ) - t_6 = GF_LEN__LIST; - t_5 = CALL_1ARGS( t_6, l_methods ); - CHECK_FUNC_RESULT( t_5 ) - t_3 = Range2Check( t_4, t_5 ); - t_2 = ElmsListCheck( l_methods, t_3 ); - AsssListCheck( l_methods, t_1, t_2 ); + /* COPY_LIST_ENTRIES( methods, i + 1, 1, methods, narg + 5 + i + 1, 1, LEN_LIST( methods ) - i ); */ + t_1 = GF_COPY__LIST__ENTRIES; + t_2 = NEW_PLIST( T_PLIST, 7 ); + SET_LEN_PLIST( t_2, 7 ); + SET_ELM_PLIST( t_2, 1, l_methods ); + CHANGED_BAG( t_2 ); + C_SUM_FIA( t_3, l_i, INTOBJ_INT(1) ) + SET_ELM_PLIST( t_2, 2, t_3 ); + CHANGED_BAG( t_2 ); + SET_ELM_PLIST( t_2, 3, INTOBJ_INT(1) ); + SET_ELM_PLIST( t_2, 4, l_methods ); + CHANGED_BAG( t_2 ); + C_SUM_FIA( t_5, l_narg, INTOBJ_INT(5) ) + C_SUM_FIA( t_4, t_5, l_i ) + C_SUM_FIA( t_3, t_4, INTOBJ_INT(1) ) + SET_ELM_PLIST( t_2, 5, t_3 ); + CHANGED_BAG( t_2 ); + SET_ELM_PLIST( t_2, 6, INTOBJ_INT(1) ); + t_5 = GF_LEN__LIST; + t_4 = CALL_1ARGS( t_5, l_methods ); + CHECK_FUNC_RESULT( t_4 ) + C_DIFF_FIA( t_3, t_4, l_i ) + SET_ELM_PLIST( t_2, 7, t_3 ); + CHANGED_BAG( t_2 ); + CALL_XARGS( t_1, t_2 ); } /* fi */ @@ -4082,7 +4092,7 @@ static Obj HdlrFunc1 ( od; fi; if not REREADING or not replace then - methods{[ narg + 5 + i + 1 .. narg + 5 + LEN_LIST( methods ) ]} := methods{[ i + 1 .. LEN_LIST( methods ) ]}; + COPY_LIST_ENTRIES( methods, i + 1, 1, methods, narg + 5 + i + 1, 1, LEN_LIST( methods ) - i ); fi; if rel = true then methods[i + 1] := RETURN_TRUE; @@ -4650,6 +4660,7 @@ static Int PostRestore ( StructInitInfo * module ) G_RETURN__FALSE = GVarName( "RETURN_FALSE" ); G_LEN__LIST = GVarName( "LEN_LIST" ); G_APPEND__LIST__INTR = GVarName( "APPEND_LIST_INTR" ); + G_COPY__LIST__ENTRIES = GVarName( "COPY_LIST_ENTRIES" ); G_CONV__STRING = GVarName( "CONV_STRING" ); G_Print = GVarName( "Print" ); G_ViewObj = GVarName( "ViewObj" ); @@ -4766,6 +4777,7 @@ static Int InitKernel ( StructInitInfo * module ) InitCopyGVar( "RETURN_FALSE", &GC_RETURN__FALSE ); InitFopyGVar( "LEN_LIST", &GF_LEN__LIST ); InitFopyGVar( "APPEND_LIST_INTR", &GF_APPEND__LIST__INTR ); + InitFopyGVar( "COPY_LIST_ENTRIES", &GF_COPY__LIST__ENTRIES ); InitFopyGVar( "CONV_STRING", &GF_CONV__STRING ); InitFopyGVar( "Print", &GF_Print ); InitCopyGVar( "ViewObj", &GC_ViewObj ); @@ -4880,7 +4892,7 @@ static Int InitLibrary ( StructInitInfo * module ) static StructInitInfo module = { .type = MODULE_STATIC, .name = "GAPROOT/lib/oper1.g", - .crc = 32938550, + .crc = 70528668, .initKernel = InitKernel, .initLibrary = InitLibrary, .postRestore = PostRestore, diff --git a/src/hpc/c_oper1.c b/src/hpc/c_oper1.c index 1c5ef2b2ab..2cfea3416a 100644 --- a/src/hpc/c_oper1.c +++ b/src/hpc/c_oper1.c @@ -1,7 +1,7 @@ #ifndef AVOID_PRECOMPILED /* C file produced by GAC */ #include "compiled.h" -#define FILE_CRC "32938550" +#define FILE_CRC "70528668" /* global variables used in handlers */ static GVar G_REREADING; @@ -82,6 +82,8 @@ static GVar G_LEN__LIST; static Obj GF_LEN__LIST; static GVar G_APPEND__LIST__INTR; static Obj GF_APPEND__LIST__INTR; +static GVar G_COPY__LIST__ENTRIES; +static Obj GF_COPY__LIST__ENTRIES; static GVar G_CONV__STRING; static Obj GF_CONV__STRING; static GVar G_Print; @@ -955,23 +957,31 @@ static Obj HdlrFunc3 ( } if ( t_1 ) { - /* methods{[ narg + 5 + i + 1 .. narg + 5 + LEN_LIST( methods ) ]} := methods{[ i + 1 .. LEN_LIST( methods ) ]}; */ - C_SUM_FIA( t_4, l_narg, INTOBJ_INT(5) ) - C_SUM_FIA( t_3, t_4, l_i ) - C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) ) - C_SUM_FIA( t_4, l_narg, INTOBJ_INT(5) ) - t_6 = GF_LEN__LIST; - t_5 = CALL_1ARGS( t_6, l_methods ); - CHECK_FUNC_RESULT( t_5 ) - C_SUM_FIA( t_3, t_4, t_5 ) - t_1 = Range2Check( t_2, t_3 ); - C_SUM_FIA( t_4, l_i, INTOBJ_INT(1) ) - t_6 = GF_LEN__LIST; - t_5 = CALL_1ARGS( t_6, l_methods ); - CHECK_FUNC_RESULT( t_5 ) - t_3 = Range2Check( t_4, t_5 ); - t_2 = ElmsListCheck( l_methods, t_3 ); - AsssListCheck( l_methods, t_1, t_2 ); + /* COPY_LIST_ENTRIES( methods, i + 1, 1, methods, narg + 5 + i + 1, 1, LEN_LIST( methods ) - i ); */ + t_1 = GF_COPY__LIST__ENTRIES; + t_2 = NEW_PLIST( T_PLIST, 7 ); + SET_LEN_PLIST( t_2, 7 ); + SET_ELM_PLIST( t_2, 1, l_methods ); + CHANGED_BAG( t_2 ); + C_SUM_FIA( t_3, l_i, INTOBJ_INT(1) ) + SET_ELM_PLIST( t_2, 2, t_3 ); + CHANGED_BAG( t_2 ); + SET_ELM_PLIST( t_2, 3, INTOBJ_INT(1) ); + SET_ELM_PLIST( t_2, 4, l_methods ); + CHANGED_BAG( t_2 ); + C_SUM_FIA( t_5, l_narg, INTOBJ_INT(5) ) + C_SUM_FIA( t_4, t_5, l_i ) + C_SUM_FIA( t_3, t_4, INTOBJ_INT(1) ) + SET_ELM_PLIST( t_2, 5, t_3 ); + CHANGED_BAG( t_2 ); + SET_ELM_PLIST( t_2, 6, INTOBJ_INT(1) ); + t_5 = GF_LEN__LIST; + t_4 = CALL_1ARGS( t_5, l_methods ); + CHECK_FUNC_RESULT( t_4 ) + C_DIFF_FIA( t_3, t_4, l_i ) + SET_ELM_PLIST( t_2, 7, t_3 ); + CHANGED_BAG( t_2 ); + CALL_XARGS( t_1, t_2 ); } /* fi */ @@ -4166,7 +4176,7 @@ static Obj HdlrFunc1 ( od; fi; if not REREADING or not replace then - methods{[ narg + 5 + i + 1 .. narg + 5 + LEN_LIST( methods ) ]} := methods{[ i + 1 .. LEN_LIST( methods ) ]}; + COPY_LIST_ENTRIES( methods, i + 1, 1, methods, narg + 5 + i + 1, 1, LEN_LIST( methods ) - i ); fi; if rel = true then methods[i + 1] := RETURN_TRUE; @@ -4735,6 +4745,7 @@ static Int PostRestore ( StructInitInfo * module ) G_RETURN__FALSE = GVarName( "RETURN_FALSE" ); G_LEN__LIST = GVarName( "LEN_LIST" ); G_APPEND__LIST__INTR = GVarName( "APPEND_LIST_INTR" ); + G_COPY__LIST__ENTRIES = GVarName( "COPY_LIST_ENTRIES" ); G_CONV__STRING = GVarName( "CONV_STRING" ); G_Print = GVarName( "Print" ); G_ViewObj = GVarName( "ViewObj" ); @@ -4859,6 +4870,7 @@ static Int InitKernel ( StructInitInfo * module ) InitCopyGVar( "RETURN_FALSE", &GC_RETURN__FALSE ); InitFopyGVar( "LEN_LIST", &GF_LEN__LIST ); InitFopyGVar( "APPEND_LIST_INTR", &GF_APPEND__LIST__INTR ); + InitFopyGVar( "COPY_LIST_ENTRIES", &GF_COPY__LIST__ENTRIES ); InitFopyGVar( "CONV_STRING", &GF_CONV__STRING ); InitFopyGVar( "Print", &GF_Print ); InitCopyGVar( "ViewObj", &GC_ViewObj ); @@ -4981,7 +4993,7 @@ static Int InitLibrary ( StructInitInfo * module ) static StructInitInfo module = { .type = MODULE_STATIC, .name = "GAPROOT/lib/oper1.g", - .crc = 32938550, + .crc = 70528668, .initKernel = InitKernel, .initLibrary = InitLibrary, .postRestore = PostRestore,