Skip to content

Commit

Permalink
Replace all calls to SetFeatureObj, mark it as obsolete
Browse files Browse the repository at this point in the history
Various packages still use it, and most likely also code that people keep
around locally, so we cannot and should not remove it for the foreseeable
future. But at least new code should not use it.
  • Loading branch information
fingolfin committed Oct 30, 2018
1 parent 0414b68 commit 641586f
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 188 deletions.
6 changes: 5 additions & 1 deletion lib/coll.gd
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,11 @@ BIND_GLOBAL( "InstallSubsetMaintenance",
SUBSET_MAINTAINED_INFO[1][ i+1 ]:= MakeImmutable(
[ filt1, filt2, operation, operation,
function( sub, val )
SetFeatureObj( sub, operation, val );
if val then
SetFilterObj( sub, operation );
else
ResetFilterObj( sub, operation );
fi;
end ]);
fi;
od; # end atomic
Expand Down
17 changes: 17 additions & 0 deletions lib/obsolete.gi
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,23 @@ BindGlobal( "SetUserPreferences", function( arg )
fi;
end );

#############################################################################
##
#F SetFeatureObj( <obj>, <filter>, <val> )
##
## Moved to obsoletes in October 2018 for GAP 4.11.
##
## still used by guarana, lpres, nq (10/2018)
##
BIND_GLOBAL( "SetFeatureObj", function ( obj, filter, val )
Info( InfoObsolete, 1, "'SetFeatureObj' is obsolete, use 'SetFilterObj' or 'ResetFilterObj' instead" );
if val then
SetFilterObj( obj, filter );
else
ResetFilterObj( obj, filter );
fi;
end );

#############################################################################
##
#E
Expand Down
2 changes: 1 addition & 1 deletion lib/pquot.gi
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ UpdateWeightInfo := function( qs )
od;
qs!.collector![SCP_AVECTOR2] := avc2;

SetFeatureObj( qs!.collector, IsUpToDatePolycyclicCollector, true );
SetFilterObj( qs!.collector, IsUpToDatePolycyclicCollector );
end;

#############################################################################
Expand Down
12 changes: 6 additions & 6 deletions lib/rwsdt.gi
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ function( dtrws, orders )
dtrws![PC_EXPONENTS] := orders;
if Length(orders) < dtrws![PC_NUMBER_OF_GENERATORS] or
not IsHomogeneousList( orders ) then
SetFeatureObj( dtrws, IsFinite, false );
SetIsFinite( dtrws, false );
else
SetFeatureObj( dtrws, IsFinite, true );
SetIsFinite( dtrws, true );
fi;
end );

Expand Down Expand Up @@ -258,14 +258,14 @@ function( dtrws, i, ord )
if ord = infinity or ord = 0 then
if IsBound( dtrws![PC_EXPONENTS][i] ) then
Unbind( dtrws![PC_EXPONENTS][i] );
SetFeatureObj( dtrws, IsFinite, false );
SetIsFinite( dtrws, false );
fi;
else
dtrws![PC_EXPONENTS][i] := ord;
if 0 in RelativeOrders( dtrws ) then
SetFeatureObj( dtrws, IsFinite, false );
SetIsFinite( dtrws, false );
else
SetFeatureObj( dtrws, IsFinite, true );
SetIsFinite( dtrws, true );
fi;
fi;
end );
Expand Down Expand Up @@ -584,7 +584,7 @@ function( dtrws )
# reduce the coefficients of the deep thought polynomials
ReduceCoefficientsOfRws(dtrws);

SetFeatureObj( dtrws, IsUpToDatePolycyclicCollector, true );
SetFilterObj( dtrws, IsUpToDatePolycyclicCollector );

end );

Expand Down
2 changes: 1 addition & 1 deletion lib/rwspcclt.gi
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ InstallMethod( OutdatePolycyclicCollector,
0,

function( col )
SetFeatureObj( col, IsUpToDatePolycyclicCollector, false );
ResetFilterObj( col, IsUpToDatePolycyclicCollector );
end );


Expand Down
6 changes: 3 additions & 3 deletions lib/rwspccoc.gi
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function( cc )
CombiCollector_MakeAvector2(cc);

# 'MakeInverses' is very careful
SetFeatureObj( cc, IsUpToDatePolycyclicCollector, true );
SetFilterObj( cc, IsUpToDatePolycyclicCollector );

# construct the inverses
SingleCollector_MakeInverses(cc);
Expand Down Expand Up @@ -313,7 +313,7 @@ function( efam, gens, orders )
cc![SCP_WEIGHTS] := [1..cc![SCP_NUMBER_RWS_GENERATORS]] * 0;
cc![SCP_CLASS] := 666666;

SetFeatureObj( cc, IsCombinatorialCollectorRep, true );
SetFilterObj( cc, IsCombinatorialCollectorRep );

# and return
return cc;
Expand Down Expand Up @@ -345,7 +345,7 @@ function( comcol )
fi;

# it's a combinatorial collector now
SetFeatureObj( copy, IsCombinatorialCollectorRep, true );
SetFilterObj( copy, IsCombinatorialCollectorRep );

return copy;

Expand Down
24 changes: 12 additions & 12 deletions lib/rwspcsng.gi
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function( sc )

# return if there is nothing to reduce
if n = 0 then
SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, true );
SetFilterObj( sc, IsDefaultRhsTypeSingleCollector );
OutdatePolycyclicCollector(sc);
UpdatePolycyclicCollector(sc);
return;
Expand Down Expand Up @@ -404,7 +404,7 @@ function( sc )
od;

# now all right hand sides have the default type
SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, true );
SetFilterObj( sc, IsDefaultRhsTypeSingleCollector );

# but we have to outdate the collector to force recomputation of avec
OutdatePolycyclicCollector(sc);
Expand Down Expand Up @@ -439,7 +439,7 @@ function( sc, i, j, rhs )
sc![SCP_CONJUGATES][i][j] := rhs;
if not sc![SCP_IS_DEFAULT_TYPE](rhs) then
Print( "#W Warning: mixed types in collector\n" );
SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, false );
ResetFilterObj( sc, IsDefaultRhsTypeSingleCollector );
fi;
fi;

Expand All @@ -455,7 +455,7 @@ SingleCollector_SetConjugateNC := function( sc, i, j, rhs )
else
sc![SCP_CONJUGATES][i][j] := rhs;
if not sc![SCP_IS_DEFAULT_TYPE](rhs) then
SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, false );
ResetFilterObj( sc, IsDefaultRhsTypeSingleCollector );
fi;
fi;

Expand Down Expand Up @@ -545,7 +545,7 @@ function( sc, i, rhs )
sc![SCP_POWERS][i] := rhs;
if not sc![SCP_IS_DEFAULT_TYPE](rhs) then
Print( "# Warning: mixed types in collector\n" );
SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, false );
ResetFilterObj( sc, IsDefaultRhsTypeSingleCollector );
fi;
fi;

Expand All @@ -559,7 +559,7 @@ SingleCollector_SetPowerNC := function( sc, i, rhs )
else
sc![SCP_POWERS][i] := rhs;
if not sc![SCP_IS_DEFAULT_TYPE](rhs) then
SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, false );
ResetFilterObj( sc, IsDefaultRhsTypeSingleCollector );
fi;
fi;

Expand Down Expand Up @@ -816,7 +816,7 @@ function( sc )
SingleCollector_MakeAvector(sc);

# 'MakeInverses' is very careful
SetFeatureObj( sc, IsUpToDatePolycyclicCollector, true );
SetFilterObj( sc, IsUpToDatePolycyclicCollector );

# construct the inverses
SingleCollector_MakeInverses(sc);
Expand Down Expand Up @@ -1026,13 +1026,13 @@ function( efam, gens, orders )
type := NewType( fam, IsSingleCollectorRep and bits and IsFinite
and IsMutable );
Objectify( type, sc );
SetFeatureObj( sc, HasUnderlyingFamily, true );
SetFeatureObj( sc, HasRelativeOrders, true );
SetFeatureObj( sc, HasGeneratorsOfRws, true );
SetFeatureObj( sc, HasNumberGeneratorsOfRws, true );
SetFilterObj( sc, HasUnderlyingFamily );
SetFilterObj( sc, HasRelativeOrders );
SetFilterObj( sc, HasGeneratorsOfRws );
SetFilterObj( sc, HasNumberGeneratorsOfRws );

# there are no right hand sides
SetFeatureObj( sc, IsDefaultRhsTypeSingleCollector, true );
SetFilterObj( sc, IsDefaultRhsTypeSingleCollector );

# we haven't computed the avector and the inverses
OutdatePolycyclicCollector(sc);
Expand Down
20 changes: 0 additions & 20 deletions lib/type1.g
Original file line number Diff line number Diff line change
Expand Up @@ -825,26 +825,6 @@ end );
BIND_GLOBAL( "RESET_FILTER_OBJ", ResetFilterObj );


#############################################################################
##
#F SetFeatureObj( <obj>, <filter>, <val> )
##
## <ManSection>
## <Func Name="SetFeatureObj" Arg='obj, filter, val'/>
##
## <Description>
## </Description>
## </ManSection>
##
BIND_GLOBAL( "SetFeatureObj", function ( obj, filter, val )
if val then
SetFilterObj( obj, filter );
else
ResetFilterObj( obj, filter );
fi;
end );


#############################################################################
##
#F ObjectifyWithAttributes(<obj>,<type>,<attr1>,<val1>,<attr2>,<val2>... )
Expand Down
78 changes: 6 additions & 72 deletions src/c_type1.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef AVOID_PRECOMPILED
/* C file produced by GAC */
#include "compiled.h"
#define FILE_CRC "-43167549"
#define FILE_CRC "-66698575"

/* global variables used in handlers */
static GVar G_NAME__FUNC;
Expand Down Expand Up @@ -194,7 +194,7 @@ static RNam R_HASH__SIZE;
static RNam R_TYPES;

/* information for the functions */
static Obj NameFunc[32];
static Obj NameFunc[31];
static Obj FileName;

/* handler for function 2 */
Expand Down Expand Up @@ -2485,49 +2485,6 @@ static Obj HdlrFunc29 (

/* handler for function 30 */
static Obj HdlrFunc30 (
Obj self,
Obj a_obj,
Obj a_filter,
Obj a_val )
{
Obj t_1 = 0;
Bag oldFrame;

/* allocate new stack frame */
SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);

/* if val then */
CHECK_BOOL( a_val )
t_1 = (Obj)(UInt)(a_val != False);
if ( t_1 ) {

/* SetFilterObj( obj, filter ); */
t_1 = GF_SetFilterObj;
CALL_2ARGS( t_1, a_obj, a_filter );

}

/* else */
else {

/* ResetFilterObj( obj, filter ); */
t_1 = GF_ResetFilterObj;
CALL_2ARGS( t_1, a_obj, a_filter );

}
/* fi */

/* return; */
SWITCH_TO_OLD_FRAME(oldFrame);
return 0;

/* return; */
SWITCH_TO_OLD_FRAME(oldFrame);
return 0;
}

/* handler for function 31 */
static Obj HdlrFunc31 (
Obj self,
Obj a_arg )
{
Expand Down Expand Up @@ -3609,26 +3566,6 @@ static Obj HdlrFunc1 (
CHECK_BOUND( t_3, "ResetFilterObj" )
CALL_2ARGS( t_1, t_2, t_3 );

/* BIND_GLOBAL( "SetFeatureObj", function ( obj, filter, val )
if val then
SetFilterObj( obj, filter );
else
ResetFilterObj( obj, filter );
fi;
return;
end ); */
t_1 = GF_BIND__GLOBAL;
t_2 = MakeString( "SetFeatureObj" );
t_3 = NewFunction( NameFunc[30], 3, 0, HdlrFunc30 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 839);
SET_ENDLINE_BODY(t_4, 845);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
CALL_2ARGS( t_1, t_2, t_3 );

/* BIND_GLOBAL( "IsAttributeStoringRepFlags", FLAGS_FILTER( IsAttributeStoringRep ) ); */
t_1 = GF_BIND__GLOBAL;
t_2 = MakeString( "IsAttributeStoringRepFlags" );
Expand Down Expand Up @@ -3698,11 +3635,11 @@ static Obj HdlrFunc1 (
end ); */
t_1 = GF_BIND__GLOBAL;
t_2 = MakeString( "ObjectifyWithAttributes" );
t_3 = NewFunction( NameFunc[31], -1, 0, HdlrFunc31 );
t_3 = NewFunction( NameFunc[30], -1, 0, HdlrFunc30 );
SET_ENVI_FUNC( t_3, STATE(CurrLVars) );
t_4 = NewBag( T_BODY, sizeof(BodyHeader) );
SET_STARTLINE_BODY(t_4, 893);
SET_ENDLINE_BODY(t_4, 959);
SET_STARTLINE_BODY(t_4, 873);
SET_ENDLINE_BODY(t_4, 939);
SET_FILENAME_BODY(t_4, FileName);
SET_BODY_FUNC(t_3, t_4);
CHANGED_BAG( STATE(CurrLVars) );
Expand Down Expand Up @@ -3851,7 +3788,6 @@ static Int PostRestore ( StructInitInfo * module )
NameFunc[28] = 0;
NameFunc[29] = 0;
NameFunc[30] = 0;
NameFunc[31] = 0;

/* return success */
return 0;
Expand Down Expand Up @@ -4018,8 +3954,6 @@ static Int InitKernel ( StructInitInfo * module )
InitGlobalBag( &(NameFunc[29]), "GAPROOT/lib/type1.g:NameFunc[29]("FILE_CRC")" );
InitHandlerFunc( HdlrFunc30, "GAPROOT/lib/type1.g:HdlrFunc30("FILE_CRC")" );
InitGlobalBag( &(NameFunc[30]), "GAPROOT/lib/type1.g:NameFunc[30]("FILE_CRC")" );
InitHandlerFunc( HdlrFunc31, "GAPROOT/lib/type1.g:HdlrFunc31("FILE_CRC")" );
InitGlobalBag( &(NameFunc[31]), "GAPROOT/lib/type1.g:NameFunc[31]("FILE_CRC")" );

/* return success */
return 0;
Expand Down Expand Up @@ -4055,7 +3989,7 @@ static Int InitLibrary ( StructInitInfo * module )
static StructInitInfo module = {
.type = MODULE_STATIC,
.name = "GAPROOT/lib/type1.g",
.crc = -43167549,
.crc = -66698575,
.initKernel = InitKernel,
.initLibrary = InitLibrary,
.postRestore = PostRestore,
Expand Down
Loading

0 comments on commit 641586f

Please sign in to comment.