Skip to content
Closed
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
52 changes: 30 additions & 22 deletions lib/methsel.g
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,15 @@ end;

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading methods[(arity+4)*(i-1)+(arity+2)] three times in a row like this makes my eyes bleed :-P. Could you perhaps put it into a local variable? That would make the code easier to understand, too.



#############################################################################
Expand All @@ -230,7 +238,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 +263,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 +289,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 +316,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 +346,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 +377,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 +409,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 +455,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 +475,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 +496,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 +518,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 +543,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 +569,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 +596,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 +635,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 +660,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 +686,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 +713,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 +743,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 +774,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 +806,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