Skip to content

Commit

Permalink
Simplify some code dealing with METHODS_OPERATION
Browse files Browse the repository at this point in the history
Remove some code which deal with different BASE_SIZE_METHODS_OPER_ENTRY
values. This only matters if one uses a GAP kernel version with a different
GAP library version, which is a bad idea generally.

The resulting code is easier to understand.
  • Loading branch information
ThomasBreuer authored and fingolfin committed Apr 20, 2021
1 parent 5ef54a8 commit d7bf712
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 228 deletions.
23 changes: 4 additions & 19 deletions lib/methsel.g
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ local type,fam,methods,i,j,flag,erg;
fam:=FamilyObj(obj);
methods:=METHODS_OPERATION(attr,1);
for i in [1..LEN_LIST(methods)/(1+BASE_SIZE_METHODS_OPER_ENTRY)] do
# nam:=methods[5*(i-1)+5]; # name
j:=(1+BASE_SIZE_METHODS_OPER_ENTRY)*(i-1);
flag:=true;
flag:=flag and IS_SUBSET_FLAGS(type![2],methods[j+2]);
Expand All @@ -57,15 +56,8 @@ end;
VMETHOD_PRINT_INFO := function ( methods, i, arity)
local offset;
offset := (arity+BASE_SIZE_METHODS_OPER_ENTRY)*(i-1)+arity;
Print("#I ", methods[offset+4]);
if BASE_SIZE_METHODS_OPER_ENTRY >= 5 then
Print(" at ", methods[offset+5][1], ":", methods[offset+5][2]);
elif FILENAME_FUNC(methods[offset+2]) <> fail then
Print(" at ",
FILENAME_FUNC(methods[offset+2]), ":",
STARTLINE_FUNC(methods[offset+2]));
fi;
Print("\n");
Print("#I ", methods[offset+4],
" at ", methods[offset+5][1], ":", methods[offset+5][2], "\n");
end;

#############################################################################
Expand All @@ -75,13 +67,6 @@ end;
NEXT_VMETHOD_PRINT_INFO := function ( methods, i, arity)
local offset;
offset := (arity+BASE_SIZE_METHODS_OPER_ENTRY)*(i-1)+arity;
Print("#I Trying next: ", methods[offset+4]);
if BASE_SIZE_METHODS_OPER_ENTRY >= 5 then
Print(" at ", methods[offset+5][1], ":", methods[offset+5][2]);
elif FILENAME_FUNC(methods[offset+2]) <> fail then
Print(" at ",
FILENAME_FUNC(methods[offset+2]), ":",
STARTLINE_FUNC(methods[offset+2]));
fi;
Print("\n");
Print("#I Trying next: ", methods[offset+4],
" at ", methods[offset+5][1], ":", methods[offset+5][2], "\n");
end;
4 changes: 1 addition & 3 deletions lib/oper.g
Original file line number Diff line number Diff line change
Expand Up @@ -2025,12 +2025,10 @@ BIND_GLOBAL("MethodsOperation", function(oper, nargs)
func := meths[i + nargs + 2],
rank := meths[i + nargs + 3],
info := meths[i + nargs + 4],
location := meths[i + nargs + 5],
rankbase := meths[i + nargs + 6],
);
ADD_LIST(result, m);
if IsBound(meths[i + nargs + 5]) then
m.location := meths[i + nargs + 5];
fi;
od;
return result;
end );
Expand Down
11 changes: 2 additions & 9 deletions lib/oper1.g
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,9 @@ BIND_GLOBAL( "INSTALL_METHOD_FLAGS",
# install the method
methods[i+(narg+2)] := method;
methods[i+(narg+3)] := rank;

methods[i+(narg+4)] := IMMUTABLE_COPY_OBJ(info);

if BASE_SIZE_METHODS_OPER_ENTRY >= 5 then
methods[i+(narg+5)] := MakeImmutable([INPUT_FILENAME(), READEVALCOMMAND_LINENUMBER, INPUT_LINENUMBER()]);
fi;

if BASE_SIZE_METHODS_OPER_ENTRY >= 6 then
methods[i+(narg+6)] := baserank;
fi;
methods[i+(narg+5)] := MakeImmutable([INPUT_FILENAME(), READEVALCOMMAND_LINENUMBER, INPUT_LINENUMBER()]);
methods[i+(narg+6)] := baserank;

# flush the cache
if IsHPCGAP then
Expand Down
Loading

0 comments on commit d7bf712

Please sign in to comment.