Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP Stop system setters storing attribute values in mutable objects #3588

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions lib/sgpres.gi
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,21 @@ DeclareRepresentation( "IsPresentationDefaultRep",
#T eventually the admissible component names should be listed here


#############################################################################
##
#M One( <pres> ) . . . . . . . . . . . . . . . . . . . . for a presentation
##
InstallOtherMethod(One, [IsPresentationDefaultRep],
T -> T!.identity);

#############################################################################
##
#M PrimaryGeneratorWords( <pres> ) . . . . . . . . . . . for a presentation
##
InstallOtherMethod(PrimaryGeneratorWords, [IsPresentationDefaultRep],
T -> T!.primaryGeneratorWords);


#############################################################################
##
#M \.( <pres>, <nam> ) . . . . . . . . . . . . . . . . . for a presentation
Expand Down Expand Up @@ -1069,7 +1084,6 @@ InstallGlobalFunction( PresentationAugmentedCosetTable,
T!.components := comps;
T!.nextFree := numgens + 1;
T!.identity := One( fgens[1] );
SetOne(T,One( fgens[1] ));

# save the tree as component of the Tietze record.
tree[TR_TREENUMS] := treeNums;
Expand All @@ -1079,8 +1093,8 @@ InstallGlobalFunction( PresentationAugmentedCosetTable,

# save the definitions of the primary generators as words in the original
# group generators.
SetPrimaryGeneratorWords(T,aug.primaryGeneratorWords);

T!.primaryGeneratorWords := aug.primaryGeneratorWords;
# handle relators of length 1 or 2, but do not eliminate any primary
# generators.
TzOptions(T).protected := tree[TR_PRIMARY];
Expand Down
29 changes: 17 additions & 12 deletions src/opers.c
Original file line number Diff line number Diff line change
Expand Up @@ -3371,36 +3371,41 @@ static Obj DoSetterFunction(Obj self, Obj obj, Obj value)
int atomic = 0;
#endif

/* System setter does not store attribute values in mutable objects */
if (IS_MUTABLE_OBJ(obj)) {
return 0;
}

switch (TNUM_OBJ(obj)) {
#ifdef HPCGAP
case T_ACOMOBJ:
case T_ACOMOBJ:
atomic = 1;
#endif
case T_COMOBJ:
case T_COMOBJ:
break;
default:
ErrorQuit( "<obj> must be a component object", 0L, 0L );
default:
ErrorQuit("<obj> must be a component object", 0L, 0L);
return 0L;
}

/* if the attribute is already there *do not* chage it */
tmp = ENVI_FUNC(self);
tester = ELM_PLIST( tmp, 2 );
flag2 = INT_INTOBJ( FLAG2_FILT(tester) );
type = TYPE_OBJ_FEO(obj);
flags = FLAGS_TYPE(type);
if ( SAFE_C_ELM_FLAGS(flags,flag2) ) {
tester = ELM_PLIST(tmp, 2);
flag2 = INT_INTOBJ(FLAG2_FILT(tester));
type = TYPE_OBJ_FEO(obj);
flags = FLAGS_TYPE(type);
if (SAFE_C_ELM_FLAGS(flags, flag2)) {
return 0;
}

/* set the value */
UInt rnam = (UInt)INT_INTOBJ(ELM_PLIST(tmp,1));
UInt rnam = (UInt)INT_INTOBJ(ELM_PLIST(tmp, 1));
#ifdef HPCGAP
if (atomic)
SetARecordField( obj, rnam, CopyObj(value,0) );
SetARecordField(obj, rnam, CopyObj(value, 0));
else
#endif
AssPRec( obj, rnam, CopyObj(value,0) );
AssPRec(obj, rnam, CopyObj(value, 0));
CALL_2ARGS( SET_FILTER_OBJ, obj, tester );
return 0;
}
Expand Down