Commit 2aabf748 authored by David Gobbi's avatar David Gobbi
Browse files

ENH: Add proper support for vtkIdType to the wrappers.

The previous implementation mapped vtkIdType to "long", whereas this implementation identifies vtkIdType as a new basic type.
The number of distinct types that the wrappers can handle has also been expanded: previously types were identified using decimal numbers, and now they are identified using hexidecimal numbers.  This provides enough room for 6 additional basic types.
parent fb090f86
This diff is collapsed.
......@@ -176,7 +176,7 @@ Modify lex.yy.c:
"static" return(STATIC);
"vtkFloatingPointType" return(DOUBLE);
"vtkIdType" return(LONG);
"vtkIdType" return(IdType);
"vtkSetMacro" return(SetMacro);
"vtkGetMacro" return(GetMacro);
"vtkSetStringMacro" return(SetStringMacro);
......
This diff is collapsed.
......@@ -174,6 +174,7 @@ char *vtkstrdup(const char *in)
%token VTK_LEGACY
/* macro tokens */
%token IdType
%token SetMacro
%token GetMacro
%token SetStringMacro
......@@ -330,15 +331,15 @@ arg: type
| type var_id
{
currentFunction->ArgCounts[currentFunction->NumberOfArguments] =
$<integer>2 / 10000;
$<integer>2 / 0x10000;
currentFunction->ArgTypes[currentFunction->NumberOfArguments] =
$<integer>1 + $<integer>2 % 10000;
$<integer>1 + $<integer>2 % 0x10000;
} opt_var_assign
| VAR_FUNCTION
{
postSig("void (*func)(void *) ");
currentFunction->ArgCounts[currentFunction->NumberOfArguments] = 0;
currentFunction->ArgTypes[currentFunction->NumberOfArguments] = 5000;
currentFunction->ArgTypes[currentFunction->NumberOfArguments] = 0x5000;
};
opt_var_assign: | '=' float_num;
......@@ -348,62 +349,62 @@ var: type var_id ';' {delSig();} | VAR_FUNCTION ';' {delSig();};
var_id: any_id var_array { $<integer>$ = $<integer>2; };
/*
300 = [n]
600 = [n][m]
900 = [n][m][l]
0x300 = [n]
0x600 = [n][m]
0x900 = [n][m][l]
*/
var_array: { $<integer>$ = 0; }
| ARRAY_NUM { char temp[100]; sprintf(temp,"[%i]",$<integer>1);
postSig(temp); }
var_array { $<integer>$ = 300 + 10000 * $<integer>1 + $<integer>3 % 1000; }
var_array { $<integer>$ = 0x300 + 0x10000 * $<integer>1 + $<integer>3 % 0x1000; }
| '[' maybe_other_no_semi ']' var_array
{ postSig("[]"); $<integer>$ = 300 + $<integer>4 % 1000; };
{ postSig("[]"); $<integer>$ = 0x300 + $<integer>4 % 0x1000; };
type: const_mod type_red1 {$<integer>$ = 1000 + $<integer>2;}
type: const_mod type_red1 {$<integer>$ = 0x1000 + $<integer>2;}
| type_red1 {$<integer>$ = $<integer>1;}
| static_mod type_red1 {$<integer>$ = 2000 + $<integer>2;}
| static_mod const_mod type_red1 {$<integer>$ = 3000 + $<integer>3;};
| static_mod type_red1 {$<integer>$ = 0x2000 + $<integer>2;}
| static_mod const_mod type_red1 {$<integer>$ = 0x3000 + $<integer>3;};
type_red1: type_red2 {$<integer>$ = $<integer>1;}
| type_red2 type_indirection
{$<integer>$ = $<integer>1 + $<integer>2;};
/* 100 = &
200 = &&
300 = *
400 = &*
500 = *&
700 = **
/* 0x100 = &
0x200 = &&
0x300 = *
0x400 = &*
0x500 = *&
0x700 = **
*/
type_indirection: '&' { postSig("&"); $<integer>$ = 100;}
| '*' { postSig("*"); $<integer>$ = 300;}
| '&' type_indirection { $<integer>$ = 100 + $<integer>2;}
| '*' type_indirection { $<integer>$ = 400 + $<integer>2;};
type_indirection: '&' { postSig("&"); $<integer>$ = 0x100;}
| '*' { postSig("*"); $<integer>$ = 0x300;}
| '&' type_indirection { $<integer>$ = 0x100 + $<integer>2;}
| '*' type_indirection { $<integer>$ = 0x400 + $<integer>2;};
type_red2: UNSIGNED {postSig("unsigned ");}
type_primitive { $<integer>$ = 10 + $<integer>3;}
type_primitive { $<integer>$ = 0x10 + $<integer>3;}
| type_primitive { $<integer>$ = $<integer>1;};
type_primitive:
FLOAT { postSig("float "); $<integer>$ = 1;} |
VOID { postSig("void "); $<integer>$ = 2;} |
CHAR { postSig("char "); $<integer>$ = 3;} |
INT { postSig("int "); $<integer>$ = 4;} |
SHORT { postSig("short "); $<integer>$ = 5;} |
LONG { postSig("long "); $<integer>$ = 6;} |
DOUBLE { postSig("double "); $<integer>$ = 7;} |
FLOAT { postSig("float "); $<integer>$ = 0x1;} |
VOID { postSig("void "); $<integer>$ = 0x2;} |
CHAR { postSig("char "); $<integer>$ = 0x3;} |
INT { postSig("int "); $<integer>$ = 0x4;} |
SHORT { postSig("short "); $<integer>$ = 0x5;} |
LONG { postSig("long "); $<integer>$ = 0x6;} |
DOUBLE { postSig("double "); $<integer>$ = 0x7;} |
ID {
char ctmpid[2048];
sprintf(ctmpid,"%s ",$<str>1);
postSig(ctmpid);
$<integer>$ = 8;} |
$<integer>$ = 0x8;} |
VTK_ID
{
char ctmpid[2048];
sprintf(ctmpid,"%s ",$<str>1);
postSig(ctmpid);
$<integer>$ = 9;
$<integer>$ = 0x9;
currentFunction->ArgClasses[currentFunction->NumberOfArguments] =
vtkstrdup($1);
/* store the string into the return value just in case we need it */
......@@ -414,7 +415,8 @@ type_primitive:
{
currentFunction->ReturnClass = vtkstrdup($1);
}
};
} |
IdType { postSig("vtkIdType "); $<integer>$ = 0xA;};
optional_scope: | ':' scope_list;
......@@ -448,7 +450,7 @@ macro:
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = $<integer>6;
currentFunction->ArgCounts[0] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
}
| GetMacro '('{postSig("Get");} any_id ',' {postSig(" ();"); invertSig = 1;}
......@@ -466,9 +468,9 @@ macro:
sprintf(temps,"Set%s",$<str>4);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 303;
currentFunction->ArgTypes[0] = 0x303;
currentFunction->ArgCounts[0] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
}
| GetStringMacro '(' {preSig("char *Get");} any_id ')'
......@@ -477,7 +479,7 @@ macro:
sprintf(temps,"Get%s",$<str>4);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 303;
currentFunction->ReturnType = 0x303;
output_function();
}
| SetClampMacro '(' any_id ','
......@@ -491,7 +493,7 @@ macro:
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = $<integer>6;
currentFunction->ArgCounts[0] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -519,9 +521,9 @@ macro:
sprintf(temps,"Set%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 309;
currentFunction->ArgTypes[0] = 0x309;
currentFunction->ArgCounts[0] = 1;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
}
| SetReferenceCountedObjectMacro '(' any_id ','
......@@ -531,9 +533,9 @@ macro:
sprintf(temps,"Set%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 309;
currentFunction->ArgTypes[0] = 0x309;
currentFunction->ArgCounts[0] = 1;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
}
| GetObjectMacro '(' {postSig("*Get");} any_id ','
......@@ -542,7 +544,7 @@ macro:
sprintf(temps,"Get%s",$<str>4);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 309;
currentFunction->ReturnType = 0x309;
output_function();
}
| BooleanMacro '(' any_id
......@@ -552,7 +554,7 @@ macro:
sprintf(temps,"%sOn",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
currentFunction->Signature = (char *)malloc(2048);
sigAllocatedLength = 2048;
......@@ -579,7 +581,7 @@ macro:
currentFunction->ArgCounts[0] = 0;
currentFunction->ArgTypes[1] = $<integer>6;
currentFunction->ArgCounts[1] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -588,8 +590,8 @@ macro:
local);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 300 + $<integer>6;
currentFunction->ArgCounts[0] = 2;
currentFunction->ArgTypes[0] = 0x300 + $<integer>6;
currentFunction->ArgCounts[0] = 0x2;
output_function();
}
| GetVector2Macro '(' any_id ','
......@@ -604,7 +606,7 @@ macro:
sprintf(temps,"Get%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 300 + $<integer>6;
currentFunction->ReturnType = 0x300 + $<integer>6;
currentFunction->HaveHint = 1;
currentFunction->HintSize = 2;
output_function();
......@@ -628,7 +630,7 @@ macro:
currentFunction->ArgCounts[1] = 0;
currentFunction->ArgTypes[2] = $<integer>6;
currentFunction->ArgCounts[2] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -637,7 +639,7 @@ macro:
local);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 300 + $<integer>6;
currentFunction->ArgTypes[0] = 0x300 + $<integer>6;
currentFunction->ArgCounts[0] = 3;
output_function();
}
......@@ -653,7 +655,7 @@ macro:
sprintf(temps,"Get%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 300 + $<integer>6;
currentFunction->ReturnType = 0x300 + $<integer>6;
currentFunction->HaveHint = 1;
currentFunction->HintSize = 3;
output_function();
......@@ -679,7 +681,7 @@ macro:
currentFunction->ArgCounts[2] = 0;
currentFunction->ArgTypes[3] = $<integer>6;
currentFunction->ArgCounts[3] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -688,7 +690,7 @@ macro:
local);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 300 + $<integer>6;
currentFunction->ArgTypes[0] = 0x300 + $<integer>6;
currentFunction->ArgCounts[0] = 4;
output_function();
}
......@@ -704,7 +706,7 @@ macro:
sprintf(temps,"Get%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 300 + $<integer>6;
currentFunction->ReturnType = 0x300 + $<integer>6;
currentFunction->HaveHint = 1;
currentFunction->HintSize = 4;
output_function();
......@@ -734,7 +736,7 @@ macro:
currentFunction->ArgCounts[4] = 0;
currentFunction->ArgTypes[5] = $<integer>6;
currentFunction->ArgCounts[5] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -743,7 +745,7 @@ macro:
local);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 300 + $<integer>6;
currentFunction->ArgTypes[0] = 0x300 + $<integer>6;
currentFunction->ArgCounts[0] = 6;
output_function();
}
......@@ -759,7 +761,7 @@ macro:
sprintf(temps,"Get%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 300 + $<integer>6;
currentFunction->ReturnType = 0x300 + $<integer>6;
currentFunction->HaveHint = 1;
currentFunction->HintSize = 6;
output_function();
......@@ -776,9 +778,9 @@ macro:
local, $<integer>8);
sprintf(temps,"Set%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 300 + $<integer>6;
currentFunction->ArgTypes[0] = 0x300 + $<integer>6;
currentFunction->ArgCounts[0] = $<integer>8;
output_function();
}
......@@ -794,7 +796,7 @@ macro:
sprintf(temps,"Get%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 300 + $<integer>6;
currentFunction->ReturnType = 0x300 + $<integer>6;
currentFunction->HaveHint = 1;
currentFunction->HintSize = $<integer>8;
output_function();
......@@ -807,7 +809,7 @@ macro:
sprintf(temps,"Get%sCoordinate",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 309;
currentFunction->ReturnType = 0x309;
currentFunction->ReturnClass = vtkstrdup("vtkCoordinate");
output_function();
......@@ -818,11 +820,11 @@ macro:
sprintf(temps,"Set%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 2;
currentFunction->ArgTypes[0] = 7;
currentFunction->ArgTypes[0] = 0x7;
currentFunction->ArgCounts[0] = 0;
currentFunction->ArgTypes[1] = 7;
currentFunction->ArgTypes[1] = 0x7;
currentFunction->ArgCounts[1] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -831,7 +833,7 @@ macro:
$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 307;
currentFunction->ArgTypes[0] = 0x307;
currentFunction->ArgCounts[0] = 2;
output_function();
......@@ -841,7 +843,7 @@ macro:
sprintf(temps,"Get%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 307;
currentFunction->ReturnType = 0x307;
currentFunction->HaveHint = 1;
currentFunction->HintSize = 2;
output_function();
......@@ -854,7 +856,7 @@ macro:
sprintf(temps,"Get%sCoordinate",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 309;
currentFunction->ReturnType = 0x309;
currentFunction->ReturnClass = vtkstrdup("vtkCoordinate");
output_function();
......@@ -865,13 +867,13 @@ macro:
sprintf(temps,"Set%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 3;
currentFunction->ArgTypes[0] = 7;
currentFunction->ArgTypes[0] = 0x7;
currentFunction->ArgCounts[0] = 0;
currentFunction->ArgTypes[1] = 7;
currentFunction->ArgTypes[1] = 0x7;
currentFunction->ArgCounts[1] = 0;
currentFunction->ArgTypes[2] = 7;
currentFunction->ArgTypes[2] = 0x7;
currentFunction->ArgCounts[2] = 0;
currentFunction->ReturnType = 2;
currentFunction->ReturnType = 0x2;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -880,7 +882,7 @@ macro:
$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 307;
currentFunction->ArgTypes[0] = 0x307;
currentFunction->ArgCounts[0] = 3;
output_function();
......@@ -890,7 +892,7 @@ macro:
sprintf(temps,"Get%s",$<str>3);
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 307;
currentFunction->ReturnType = 0x307;
currentFunction->HaveHint = 1;
currentFunction->HintSize = 3;
output_function();
......@@ -903,7 +905,7 @@ macro:
sprintf(temps,"GetClassName");
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 1303;
currentFunction->ReturnType = 0x1303;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -913,9 +915,9 @@ macro:
sprintf(temps,"IsA");
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 1303;
currentFunction->ArgTypes[0] = 0x1303;
currentFunction->ArgCounts[0] = 0;
currentFunction->ReturnType = 4;
currentFunction->ReturnType = 0x4;
output_function();
currentFunction->Signature = (char *)malloc(2048);
......@@ -925,7 +927,7 @@ macro:
sprintf(temps,"NewInstance");
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 0;
currentFunction->ReturnType = 309;
currentFunction->ReturnType = 0x309;
currentFunction->ReturnClass = vtkstrdup($<str>3);
output_function();
......@@ -938,10 +940,10 @@ macro:
sprintf(temps,"SafeDownCast");
currentFunction->Name = vtkstrdup(temps);
currentFunction->NumberOfArguments = 1;
currentFunction->ArgTypes[0] = 309;
currentFunction->ArgTypes[0] = 0x309;
currentFunction->ArgCounts[0] = 1;
currentFunction->ArgClasses[0] = vtkstrdup("vtkObject");
currentFunction->ReturnType = 2309;
currentFunction->ReturnType = 0x2309;
currentFunction->ReturnClass = vtkstrdup($<str>3);
output_function();
}
......@@ -992,7 +994,7 @@ void InitFunction(FunctionInfo *func)
func->IsOperator = 0;
func->HaveHint = 0;
func->HintSize = 0;
func->ReturnType = 2;
func->ReturnType = 0x2;
func->ReturnClass = NULL;
func->Comment = NULL;
func->Signature = NULL;
......@@ -1007,7 +1009,7 @@ void look_for_hint()
{
char h_cls[80];
char h_func[80];
int h_type;
unsigned int h_type;
int h_value;
/* reset the position */
......@@ -1018,12 +1020,12 @@ void look_for_hint()
rewind(fhint);
/* first find a hint */
while (fscanf(fhint,"%s %s %i %i",h_cls,h_func,&h_type,&h_value) != EOF)
while (fscanf(fhint,"%s %s %x %i",h_cls,h_func,&h_type,&h_value) != EOF)
{
if ((!strcmp(h_cls,data.ClassName))&&
currentFunction->Name &&
(!strcmp(h_func,currentFunction->Name))&&
(h_type == currentFunction->ReturnType))
((int)h_type == currentFunction->ReturnType))
{
currentFunction->HaveHint = 1;
currentFunction->HintSize = h_value;
......@@ -1037,7 +1039,7 @@ void output_function()
int i;
/* a void argument is the same as no arguements */
if (currentFunction->ArgTypes[0]%1000 == 2)
if (currentFunction->ArgTypes[0] % 0x1000 == 0x2)
{
currentFunction->NumberOfArguments = 0;
}
......@@ -1047,7 +1049,7 @@ void output_function()
/* look for VAR FUNCTIONS */
if (currentFunction->NumberOfArguments
&& (currentFunction->ArgTypes[0] == 5000))
&& (currentFunction->ArgTypes[0] == 0x5000))
{
if (currentFunction->NumberOfArguments == 2)
{
......@@ -1070,10 +1072,10 @@ void output_function()
/* then try to find one */
if (!currentFunction->HaveHint)
{
switch (currentFunction->ReturnType%1000)
switch (currentFunction->ReturnType % 0x1000)
{
case 301: case 302: case 307:
case 304: case 305: case 306: case 313:
case 0x301: case 0x302: case 0x307: case 0x30A:
case 0x304: case 0x305: case 0x306: case 0x313:
look_for_hint();
break;
}
......@@ -1082,8 +1084,8 @@ void output_function()
/* reject multi-dimensional arrays from wrappers */
for (i = 0; i < currentFunction->NumberOfArguments; i++)
{
if ((currentFunction->ArgTypes[i]%1000)/100 == 6 ||
(currentFunction->ArgTypes[i]%1000)/100 == 9)
if ((currentFunction->ArgTypes[i] % 0x1000)/0x100 == 0x6 ||
(currentFunction->ArgTypes[i] % 0x1000)/0x100 == 0x9)
{
currentFunction->ArrayFailure = 1;
}
......
......@@ -25,42 +25,43 @@ extern FunctionInfo *currentFunction;
void output_temp(FILE *fp,int i)
{
/* ignore void */
if (((currentFunction->ArgTypes[i] % 10) == 2)&&
(!((currentFunction->ArgTypes[i]%1000)/100)))
if (((currentFunction->ArgTypes[i] % 0x10) == 0x2)&&
(!((currentFunction->ArgTypes[i] % 0x1000)/0x100)))
{
return;
}
if (currentFunction->ArgTypes[i] == 5000)
if (currentFunction->ArgTypes[i] == 0x5000)
{
fprintf(fp,"Object id0, String id1");
return;
}
if (currentFunction->ArgTypes[i]%1000 == 303)
if (currentFunction->ArgTypes[i] % 0x1000 == 0x303)
{
fprintf(fp,"String ");
}
else
{
switch (currentFunction->ArgTypes[i]%10)
switch (currentFunction->ArgTypes[i] % 0x10)
{
case 1: fprintf(fp,"double "); break;
case 7: fprintf(fp,"double "); break;
case 4: fprintf(fp,"int "); break;
case 5: fprintf(fp,"int "); break;
case 6: fprintf(fp,"int "); break;
case 2: fprintf(fp,"void "); break;
case 3: fprintf(fp,"char "); break;
case 9: fprintf(fp,"%s ",currentFunction->ArgClasses[i]); break;
case 8: return;
case 0x1: fprintf(fp,"double "); break;
case 0x7: fprintf(fp,"double "); break;
case 0x4: fprintf(fp,"int "); break;
case 0x5: fprintf(fp,"int "); break;
case 0x6: fprintf(fp,"int "); break;
case 0xA: fprintf(fp,"int "); break;
case 0x2: fprintf(fp,"void "); break;
case 0x3: fprintf(fp,"char "); break;
case 0x9: fprintf(fp,"%s ",currentFunction->ArgClasses[i]); break;
case 0x8: return;
}
}
fprintf(fp,"id%i",i);
if (((currentFunction->ArgTypes[i]%1000)/100 == 3)&&
(currentFunction->ArgTypes[i]%1000 != 303)&&
(currentFunction->ArgTypes[i]%1000 != 309))
if (((currentFunction->ArgTypes[i] % 0x1000)/0x100 == 0x3)&&
(currentFunction->ArgTypes[i] % 0x1000 != 0x303)&&
(currentFunction->ArgTypes[i] % 0x1000 != 0x309))
{
fprintf(fp,"[]");
}
......@@ -68,30 +69,30 @@ void output_temp(FILE *fp,int i)
void return_result(FILE *fp)
{
switch (currentFunction->ReturnType%1000)
switch (currentFunction->ReturnType % 0x1000)
{
case 1: fprintf(fp,"double "); break;
case 2: fprintf(fp,"void "); break;
case 3: fprintf(fp,"char "); break;
case 7: fprintf(fp,"double "); break;
case 4: case 5: case 6: case 13: case 14: case 15: case 16:
case 0x1: fprintf(fp,"double "); break;
case 0x2: fprintf(fp,"void "); break;
case 0x3: fprintf(fp,"char "); break;
case 0x7: fprintf(fp,"double "); break;
case 0x4: case 0x5: case 0x6: case 0xA: case 0x13: case 0x14: case 0x15: case 0x16: case 0x1A:
fprintf(fp,"int ");
break;
case 303: fprintf(fp,"String "); break;
case 109:
case 309:
case 0x303: fprintf(fp,"String "); break;
case 0x109:
case 0x309:
fprintf(fp,"%s ",currentFunction->ReturnClass);
break;
/* handle functions returning vectors */
/* this is done by looking them up in a hint file */
case 301: case 307:
case 0x301: case 0x307:
fprintf(fp,"double[] ");
break;
case 313:
case 0x313:
fprintf(fp,"byte[] ");
break;
case 304: case 305: case 306: case 314: case 315: case 316:
case 0x304: case 0x305: case 0x306: case 0x30A: case 0x314: case 0x315: case 0x316: case 0x31A:
fprintf(fp,"int[] "); break;
}
}
......@@ -113,32 +114,48 @@ int DoneOne()
for (j = 0; j < fi->NumberOfArguments; j++)
{
if ((fi->ArgTypes[j] != currentFunction->ArgTypes[j]) &&
!(((fi->ArgTypes[j]%1000 == 309)&&
(currentFunction->ArgTypes[j]%1000 == 109)) ||
((fi->ArgTypes[j]%1000 == 109)&&
(currentFunction->ArgTypes[j]%1000 == 309)) ||
((fi->ArgTypes[j]%1000 == 301)&&
(currentFunction->ArgTypes[j]%1000 == 307)) ||
((fi->ArgTypes[j]%1000 == 307)&&
(currentFunction->ArgTypes[j]%1000 == 301)) ||
((fi->ArgTypes[j]%1000 == 304)&&
(currentFunction->ArgTypes[j]%1000 == 306)) ||