3 * This program is a port of wine project's make_ctests script
5 # Script to generate a C file containing a list of tests
7 # Copyright 2002 Alexandre Julliard
8 # Copyright 2002 Dimitrie O. Paun
10 # This library is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public
12 # License as published by the Free Software Foundation; either
13 # version 2.1 of the License, or (at your option) any later version.
15 # This library is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with this library; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 # ***** Keep in sync with tools/winapi/msvcmaker:_generate_testlist_c *****
32 "/* Automatically generated file; DO NOT EDIT!! */\n"
34 "/* stdarg.h is needed for Winelib */\n"
35 "#include <stdarg.h>\n"
36 "#include <stdio.h>\n"
37 "#include <stdlib.h>\n"
38 "#include \"windef.h\"\n"
39 "#include \"winbase.h\"\n"
46 " const char *name;\n"
47 " void (*func)(void);\n"
50 "static const struct test winetest_testlist[] =\n"
57 "#define WINETEST_WANT_MAIN\n"
58 "#include \"wine/test.h\"\n"
62 basename ( const char* filename
)
68 if ( filename
== NULL
)
70 fprintf ( stderr
, "basename() called with null filename\n" );
73 p
= strrchr ( filename
, '/' );
79 /* look for backslashes, too... */
80 p2
= strrchr ( filename
, '\\' );
84 /* find extension... */
85 p2
= strrchr ( filename
, '.' );
91 out
= malloc ( out_len
+1 );
94 fprintf ( stderr
, "malloc() failed\n" );
97 memmove ( out
, p
, out_len
);
103 main ( int argc
, const char** argv
)
107 printf ( "%s", header
);
109 for ( i
= 1; i
< argc
; i
++ )
111 char* test
= basename(argv
[i
]);
114 printf ( "extern void func_%s(void);\n", test
);
118 printf ( "%s", middle
);
120 for ( i
= 1; i
< argc
; i
++ )
122 char* test
= basename(argv
[i
]);
125 printf ( " { \"%s\", func_%s },\n", test
, test
);
129 printf ( "%s", end
);