Revision 18256,
1.2 KB
checked in by ghudson, 22 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r18255,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | #include "config.h" |
---|
3 | #include <stdlib.h> |
---|
4 | |
---|
5 | /** |
---|
6 | * A little utility function to generate header info. |
---|
7 | * |
---|
8 | * Yes, it would be possible to do this using more "native" autoconf |
---|
9 | * features, but I personally find this approach to be cleaner. |
---|
10 | * |
---|
11 | * The output of this program is generally written to art_config.h, |
---|
12 | * which is installed in libart's include dir. |
---|
13 | **/ |
---|
14 | |
---|
15 | static void |
---|
16 | die (char *why) |
---|
17 | { |
---|
18 | fprintf (stderr, "gen_art_config: %s\n", why); |
---|
19 | exit (1); |
---|
20 | } |
---|
21 | |
---|
22 | int |
---|
23 | main (int argc, char **argv) |
---|
24 | { |
---|
25 | printf ("/* Automatically generated by gen_art_config.c */\n" |
---|
26 | "\n" |
---|
27 | "#define ART_SIZEOF_CHAR %d\n" |
---|
28 | "#define ART_SIZEOF_SHORT %d\n" |
---|
29 | "#define ART_SIZEOF_INT %d\n" |
---|
30 | "#define ART_SIZEOF_LONG %d\n" |
---|
31 | "\n", |
---|
32 | (int)sizeof(char), (int)sizeof(short), (int)sizeof(int), (int)sizeof(long)); |
---|
33 | |
---|
34 | if (sizeof(char) == 1) |
---|
35 | printf ("typedef unsigned char art_u8;\n"); |
---|
36 | else |
---|
37 | die ("sizeof(char) != 1"); |
---|
38 | |
---|
39 | if (sizeof(short) == 2) |
---|
40 | printf ("typedef unsigned short art_u16;\n"); |
---|
41 | else |
---|
42 | die ("sizeof(short) != 2"); |
---|
43 | |
---|
44 | if (sizeof(int) == 4) |
---|
45 | printf ("typedef unsigned int art_u32;\n"); |
---|
46 | else if (sizeof(long) == 4) |
---|
47 | printf ("typedef unsigned long art_u32;\n"); |
---|
48 | else |
---|
49 | die ("sizeof(int) != 4 and sizeof(long) != 4"); |
---|
50 | |
---|
51 | return 0; |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.