First public contribution.
2 * LIBOIL - Library of Optimized Inner Loops
3 * Copyright (c) 2004 David A. Schleef <ds@schleef.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
30 #include <liboil/liboil.h>
35 #include <liboil/liboilprototype.h>
37 static char * xstrdup (const char *s);
39 void print_header (void);
40 void print_footer (void);
42 int main (int argc, char *argv[])
44 OilFunctionClass *klass;
51 oil_init_no_optimize ();
55 n = oil_class_get_n_classes ();
57 klass = oil_class_get_by_index (i);
59 if(klass->prototype) {
60 proto = oil_prototype_from_string (klass->prototype);
62 string = oil_prototype_to_string (proto);
63 if (strlen (string) == 0) {
65 string = xstrdup("void");
67 arg_string = oil_prototype_to_arg_string (proto);
69 printf ("#undef oil_%s\n", klass->name);
71 printf ("oil_%s (%s)\n", klass->name, string);
73 printf (" if (_oil_function_class_%s.func == NULL) {\n", klass->name);
74 printf (" oil_class_optimize (&_oil_function_class_%s);\n", klass->name);
76 printf (" ((void (*)(%s))(_oil_function_class_%s.func))(%s);\n",
77 string, klass->name, arg_string);
81 oil_prototype_free (proto);
85 printf("/* ERROR: could not parse %s(%s) */\n", klass->name, klass->prototype);
95 void print_header (void)
98 printf (" * LIBOIL - Library of Optimized Inner Loops\n");
99 printf (" * Copyright (c) 2004 David A. Schleef <ds@schleef.org>\n");
100 printf (" * All rights reserved.\n");
102 printf (" * Redistribution and use in source and binary forms, with or without\n");
103 printf (" * modification, are permitted provided that the following conditions\n");
104 printf (" * are met:\n");
105 printf (" * 1. Redistributions of source code must retain the above copyright\n");
106 printf (" * notice, this list of conditions and the following disclaimer.\n");
107 printf (" * 2. Redistributions in binary form must reproduce the above copyright\n");
108 printf (" * notice, this list of conditions and the following disclaimer in the\n");
109 printf (" * documentation and/or other materials provided with the distribution.\n");
111 printf (" * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n");
112 printf (" * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n");
113 printf (" * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n");
114 printf (" * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,\n");
115 printf (" * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n");
116 printf (" * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n");
117 printf (" * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n");
118 printf (" * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n");
119 printf (" * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n");
120 printf (" * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n");
121 printf (" * POSSIBILITY OF SUCH DAMAGE.\n");
124 printf ("/* This file is automatically generated. Do not edit. */\n");
126 printf ("#include <liboil/liboil.h>\n");
127 printf ("#include <liboil/liboilclasses.h>\n");
128 printf ("#include <liboil/liboilfunction.h>\n");
132 void print_footer (void)
138 xstrdup (const char *s)