/* gennativetable.c - generate nativetable.h for native.c
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
- M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
- P. Tomsich, J. Wenninger
+ Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+ R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+ C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+ Institut f. Computersprachen - TU Wien
This file is part of CACAO.
Changes:
- $Id: gennativetable.c 1621 2004-11-30 13:06:55Z twisti $
+ $Id: gennativetable.c 1735 2004-12-07 14:33:27Z twisti $
*/
chain_free(nativemethod_chain);
fprintf(file, "};\n");
- fprintf(file,"\n#else\n");
- fprintf(file, "/*ensure that symbols for functions implemented within cacao are used and exported to dlopen*/\n");
- fprintf(file, "static functionptr dummynativetable[]={\n");
+ fprintf(file, "\n#else\n\n");
+ fprintf(file, "/* Ensure that symbols for functions implemented within cacao are used and */\n");
+ fprintf(file, "/* exported to dlopen. */\n\n");
+ fprintf(file, "static functionptr dummynativetable[] = {\n");
{
FILE *implData;
while (!feof(implData)) {
char functionLine[1024];
- functionLine[0]='\0';
- fgets(functionLine,1024,implData);
- if (strlen(functionLine)<2) continue;
- if (functionLine[strlen(functionLine)-1]!='\n') { fclose(implData); fclose(file); exit(4);}
- functionLine[strlen(functionLine)-1]=',';
- fprintf(file,"\t(functionptr) %s\n",functionLine);
+ functionLine[0] = '\0';
+ fgets(functionLine, 1024, implData);
+
+ if (strlen(functionLine) < 2)
+ continue;
+
+ if (functionLine[strlen(functionLine) - 1] != '\n') {
+ fclose(implData);
+ fclose(file);
+ exit(4);
+ }
+
+ functionLine[strlen(functionLine) - 1] = ',';
+ fprintf(file,"\t(functionptr) %s\n", functionLine);
}
- fprintf(file,"\t(functionptr)0");
+
+ fprintf(file, "\t(functionptr) 0\n");
fclose(implData);
}
+
fprintf(file, "};\n");
- fprintf(file,"\n#endif\n");
+ fprintf(file, "\n#endif\n");
fclose(file);
/* release all resources */