Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /smlnj-c/releases/release-110.63/cc-info.c
ViewVC logotype

View of /smlnj-c/releases/release-110.63/cc-info.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2379 - (download) (as text) (annotate)
Thu Mar 22 21:07:49 2007 UTC (12 years, 4 months ago) by blume
File size: 1130 byte(s)
Release 110.63
/* 
 *
 * COPYRIGHT (c) 1995 by AT&T Bell Laboratories.
 *
 * generates, on stdout, a "cc-info" file for the SML/NJ C interface
 * using the data sizes of the compiling C compiler.
 */

#include <stdio.h>

#define PUTS(s) printf("%s",s)
#define PUTVAL(n,i) printf("\t\tval %s = %d\n", n, i)
#define COMMENT(s) printf("(* %s *)\n", s)
#define NEWLINE() putchar('\n')

main(int argc,char *argv[])
{
  if (argc != 2) {
    fprintf(stderr,"usage: %s name-for-structure\n", argv[0]);
    exit(1);
  }
  NEWLINE();
  PUTS("structure "); PUTS(argv[1]); PUTS(" : CC_INFO =\n");
  PUTS("\tstruct\n");
  PUTS("\t\t");COMMENT("all sizes in bytes");
  NEWLINE();
  PUTVAL("intSzB", sizeof(int));
  PUTVAL("shortSzB", sizeof(short));
  PUTVAL("longSzB", sizeof(long));
  NEWLINE();
  PUTVAL("charSzB", sizeof(char));
  NEWLINE();
  PUTVAL("floatSzB", sizeof(float));
  PUTVAL("doubleSzB", sizeof(double));
  NEWLINE();
  PUTVAL("ptrSzB", sizeof(int *));
  NEWLINE();
  PUTVAL("unionAlign", sizeof(int *));
  PUTVAL("structAlign", sizeof(int *));
  NEWLINE();
  PUTS("\tend "); PUTS("(* structure "); PUTS(argv[1]); PUTS(" *)\n");
  exit(0);
}

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0