GNU header update.
[cacao.git] / src / native / tools / gennativetable.c
index 50d448e9686769d4f9fcd21e784478472e2fbe17..327a4ba5d249b8e4088909a7d836f225bbfe2146 100644 (file)
@@ -1,9 +1,9 @@
 /* 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.
 
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: gennativetable.c 1621 2004-11-30 13:06:55Z twisti $
+   $Id: gennativetable.c 1735 2004-12-07 14:33:27Z twisti $
 
 */
 
@@ -190,9 +190,10 @@ int main(int argc, char **argv)
        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;
@@ -207,18 +208,28 @@ int main(int argc, char **argv)
 
                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 */