SCM Repository
Annotation of /sml/trunk/src/smlnj-c/cc-info.c
Parent Directory
|
Revision Log
Revision 2 - (view) (download) (as text)
1 : | monnier | 2 | /* |
2 : | * | ||
3 : | * COPYRIGHT (c) 1995 by AT&T Bell Laboratories. | ||
4 : | * | ||
5 : | * generates, on stdout, a "cc-info" file for the SML/NJ C interface | ||
6 : | * using the data sizes of the compiling C compiler. | ||
7 : | */ | ||
8 : | |||
9 : | #include <stdio.h> | ||
10 : | |||
11 : | #define PUTS(s) printf("%s",s) | ||
12 : | #define PUTVAL(n,i) printf("\t\tval %s = %d\n", n, i) | ||
13 : | #define COMMENT(s) printf("(* %s *)\n", s) | ||
14 : | #define NEWLINE() putchar('\n') | ||
15 : | |||
16 : | main(int argc,char *argv[]) | ||
17 : | { | ||
18 : | if (argc != 2) { | ||
19 : | fprintf(stderr,"usage: %s name-for-structure\n", argv[0]); | ||
20 : | exit(1); | ||
21 : | } | ||
22 : | NEWLINE(); | ||
23 : | PUTS("structure "); PUTS(argv[1]); PUTS(" : CC_INFO =\n"); | ||
24 : | PUTS("\tstruct\n"); | ||
25 : | PUTS("\t\t");COMMENT("all sizes in bytes"); | ||
26 : | NEWLINE(); | ||
27 : | PUTVAL("intSzB", sizeof(int)); | ||
28 : | PUTVAL("shortSzB", sizeof(short)); | ||
29 : | PUTVAL("longSzB", sizeof(long)); | ||
30 : | NEWLINE(); | ||
31 : | PUTVAL("charSzB", sizeof(char)); | ||
32 : | NEWLINE(); | ||
33 : | PUTVAL("floatSzB", sizeof(float)); | ||
34 : | PUTVAL("doubleSzB", sizeof(double)); | ||
35 : | NEWLINE(); | ||
36 : | PUTVAL("ptrSzB", sizeof(int *)); | ||
37 : | NEWLINE(); | ||
38 : | PUTVAL("unionAlign", sizeof(int *)); | ||
39 : | PUTVAL("structAlign", sizeof(int *)); | ||
40 : | NEWLINE(); | ||
41 : | PUTS("\tend "); PUTS("(* structure "); PUTS(argv[1]); PUTS(" *)\n"); | ||
42 : | exit(0); | ||
43 : | } |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |