Skip to content
Merged
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
64 changes: 38 additions & 26 deletions lib/methsel.g
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@
##

VMETHOD_PRINT_INFO := function ( methods, i, arity)
Print("#I ", methods[(arity+4)*(i-1)+(arity+4)]);
if FILENAME_FUNC(methods[(arity+4)*(i-1)+(arity+2)]) <> fail then
local offset;
offset := (arity+4)*(i-1)+arity;
Print("#I ", methods[offset+4]);
if FILENAME_FUNC(methods[offset+2]) <> fail then
Print(" at ",
FILENAME_FUNC(methods[(arity+4)*(i-1)+(arity+2)]), ":",
STARTLINE_FUNC(methods[(arity+4)*(i-1)+(arity+2)]));
FILENAME_FUNC(methods[offset+2]), ":",
STARTLINE_FUNC(methods[offset+2]));
fi;
Print("\n");
end;
Expand Down Expand Up @@ -213,7 +215,17 @@ end;

#F # # # # # # # # # # # verbose try next method # # # # # # # # # # # # #
##

NEXT_VMETHOD_PRINT_INFO := function ( methods, i, arity)
local offset;
offset := (arity+4)*(i-1)+arity;
Print("#I Trying next: ", methods[offset+4]);
if FILENAME_FUNC(methods[offset+2]) <> fail then
Print(" at ",
FILENAME_FUNC(methods[offset+2]), ":",
STARTLINE_FUNC(methods[offset+2]));
fi;
Print("\n");
end;


#############################################################################
Expand All @@ -230,7 +242,7 @@ NEXT_VMETHOD_0ARGS := function ( operation, k )
if methods[4*(i-1)+1]()
then
if k = j then
Print( "#I trying next: ", methods[4*(i-1)+4], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 0);
return methods[4*(i-1)+2];
else
j := j + 1;
Expand All @@ -255,7 +267,7 @@ NEXT_VMETHOD_1ARGS := function ( operation, k, type1 )
and methods[5*(i-1)+1]( type1![1] )
then
if k = j then
Print( "#I trying next: ", methods[5*(i-1)+5], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 1);
return methods[5*(i-1)+3];
else
j := j + 1;
Expand All @@ -281,7 +293,7 @@ NEXT_VMETHOD_2ARGS := function ( operation, k, type1, type2 )
and methods[6*(i-1)+1]( type1![1], type2![1] )
then
if k = j then
Print( "#I trying next: ", methods[6*(i-1)+6], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 2);
return methods[6*(i-1)+4];
else
j := j + 1;
Expand All @@ -308,7 +320,7 @@ NEXT_VMETHOD_3ARGS := function ( operation, k, type1, type2, type3 )
and methods[7*(i-1)+1]( type1![1], type2![1], type3![1] )
then
if k = j then
Print( "#I trying next: ", methods[7*(i-1)+7], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 3);
return methods[7*(i-1)+5];
else
j := j + 1;
Expand Down Expand Up @@ -338,7 +350,7 @@ NEXT_VMETHOD_4ARGS := function ( operation, k, type1, type2, type3,
type4![1] )
then
if k = j then
Print( "#I trying next: ", methods[8*(i-1)+8], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 4);
return methods[8*(i-1)+6];
else
j := j + 1;
Expand Down Expand Up @@ -369,7 +381,7 @@ NEXT_VMETHOD_5ARGS := function ( operation, k, type1, type2, type3,
type4![1], type5![1] )
then
if k = j then
Print( "#I trying next: ", methods[9*(i-1)+9], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 5);
return methods[9*(i-1)+7];
else
j := j + 1;
Expand Down Expand Up @@ -401,7 +413,7 @@ NEXT_VMETHOD_6ARGS := function ( operation, k, type1, type2, type3,
type4![1], type5![1], type6![1] )
then
if k = j then
Print( "#I trying next: ", methods[10*(i-1)+10], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 6);
return methods[10*(i-1)+8];
else
j := j + 1;
Expand Down Expand Up @@ -447,7 +459,7 @@ VCONSTRUCTOR_0ARGS := function ( operation )
for i in [1..LEN_LIST(methods)/4] do
if methods[4*(i-1)+1]()
then
Print( "#I ", methods[4*(i-1)+4], "\n" );
VMETHOD_PRINT_INFO(methods, i, 0);
return methods[4*(i-1)+2];
fi;
od;
Expand All @@ -467,7 +479,7 @@ VCONSTRUCTOR_1ARGS := function ( operation, flags1 )
if IS_SUBSET_FLAGS( methods[5*(i-1)+2], flags1 )
and methods[5*(i-1)+1]( flags1 )
then
Print( "#I ", methods[5*(i-1)+5], "\n" );
VMETHOD_PRINT_INFO(methods, i, 1);
return methods[5*(i-1)+3];
fi;
od;
Expand All @@ -488,7 +500,7 @@ VCONSTRUCTOR_2ARGS := function ( operation, flags1, type2 )
and IS_SUBSET_FLAGS( type2![2], methods[6*(i-1)+3] )
and methods[6*(i-1)+1]( flags1, type2![1] )
then
Print( "#I ", methods[6*(i-1)+6], "\n" );
VMETHOD_PRINT_INFO(methods, i, 2);
return methods[6*(i-1)+4];
fi;
od;
Expand All @@ -510,7 +522,7 @@ VCONSTRUCTOR_3ARGS := function ( operation, flags1, type2, type3 )
and IS_SUBSET_FLAGS( type3![2], methods[7*(i-1)+4] )
and methods[7*(i-1)+1]( flags1, type2![1], type3![1] )
then
Print( "#I ", methods[7*(i-1)+7], "\n" );
VMETHOD_PRINT_INFO(methods, i, 3);
return methods[7*(i-1)+5];
fi;
od;
Expand All @@ -535,7 +547,7 @@ VCONSTRUCTOR_4ARGS := function ( operation, flags1, type2, type3,
and methods[8*(i-1)+1]( flags1, type2![1], type3![1],
type4![1] )
then
Print( "#I ", methods[8*(i-1)+8], "\n" );
VMETHOD_PRINT_INFO(methods, i, 4);
return methods[8*(i-1)+6];
fi;
od;
Expand All @@ -561,7 +573,7 @@ VCONSTRUCTOR_5ARGS := function ( operation, flags1, type2, type3,
and methods[9*(i-1)+1]( flags1, type2![1], type3![1],
type4![1], type5![1] )
then
Print( "#I ", methods[9*(i-1)+9], "\n" );
VMETHOD_PRINT_INFO(methods, i, 5);
return methods[9*(i-1)+7];
fi;
od;
Expand All @@ -588,7 +600,7 @@ VCONSTRUCTOR_6ARGS := function ( operation, flags1, type2, type3,
and methods[10*(i-1)+1]( flags1, type2![1], type3![1],
type4![1], type5![1], type6![1] )
then
Print( "#I ", methods[10*(i-1)+10], "\n" );
VMETHOD_PRINT_INFO(methods, i, 6);
return methods[10*(i-1)+8];
fi;
od;
Expand Down Expand Up @@ -627,7 +639,7 @@ NEXT_VCONSTRUCTOR_0ARGS := function ( operation, k )
if methods[4*(i-1)+1]()
then
if k = j then
Print( "#I trying next: ", methods[4*(i-1)+4], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 0);
return methods[4*(i-1)+2];
else
j := j + 1;
Expand All @@ -652,7 +664,7 @@ NEXT_VCONSTRUCTOR_1ARGS := function ( operation, k, flags1 )
and methods[5*(i-1)+1]( flags1 )
then
if k = j then
Print( "#I trying next: ", methods[5*(i-1)+5], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 1);
return methods[5*(i-1)+3];
else
j := j + 1;
Expand All @@ -678,7 +690,7 @@ NEXT_VCONSTRUCTOR_2ARGS := function ( operation, k, flags1, type2 )
and methods[6*(i-1)+1]( flags1, type2![1] )
then
if k = j then
Print( "#I trying next: ", methods[6*(i-1)+6], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 2);
return methods[6*(i-1)+4];
else
j := j + 1;
Expand All @@ -705,7 +717,7 @@ NEXT_VCONSTRUCTOR_3ARGS := function ( operation, k, flags1, type2, type3 )
and methods[7*(i-1)+1]( flags1, type2![1], type3![1] )
then
if k = j then
Print( "#I trying next: ", methods[7*(i-1)+7], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 3);
return methods[7*(i-1)+5];
else
j := j + 1;
Expand Down Expand Up @@ -735,7 +747,7 @@ NEXT_VCONSTRUCTOR_4ARGS := function ( operation, k, flags1, type2, type3,
type4![1] )
then
if k = j then
Print( "#I trying next: ", methods[8*(i-1)+8], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 4);
return methods[8*(i-1)+6];
else
j := j + 1;
Expand Down Expand Up @@ -766,7 +778,7 @@ NEXT_VCONSTRUCTOR_5ARGS := function ( operation, k, flags1, type2, type3,
type4![1], type5![1] )
then
if k = j then
Print( "#I trying next: ", methods[9*(i-1)+9], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 5);
return methods[9*(i-1)+7];
else
j := j + 1;
Expand Down Expand Up @@ -798,7 +810,7 @@ NEXT_VCONSTRUCTOR_6ARGS := function ( operation, k, flags1, type2, type3,
type4![1], type5![1], type6![1] )
then
if k = j then
Print( "#I trying next: ", methods[10*(i-1)+10], "\n" );
NEXT_VMETHOD_PRINT_INFO(methods, i, 6);
return methods[10*(i-1)+8];
else
j := j + 1;
Expand Down