source: rtems/c/src/exec/score/tools/unix/gensize.c @ a5f56a43

4.104.114.84.9
Last change on this file since a5f56a43 was a5f56a43, checked in by Joel Sherrill <joel.sherrill@…>, on May 23, 1996 at 3:35:32 PM

* empty log message *

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 *  gensize.c
3 *
4 *  This file generates the file unixsize.h
5 *
6 *  NOTE:  It only prints the minimal information required.
7 *
8 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  This material may be reproduced by or for the U.S. Government pursuant
12 *  to the copyright license under the clause at DFARS 252.227-7013.  This
13 *  notice must appear in all copies of this file and its derivatives.
14 *
15 *  $Id$
16 *
17 */
18
19/*
20 *  This feels like a very crude way to determine if we are on a Solaris
21 *  host but it does work.
22 */
23
24#if defined(__sun__) && defined(__sparc__) && \
25    defined(__unix__) && defined(__svr4__)
26#undef  _POSIX_C_SOURCE
27#define _POSIX_C_SOURCE 3
28#undef  __STRICT_ANSI__
29#endif
30
31#include <stdio.h>
32#include <unistd.h>
33#include <setjmp.h>
34#include <signal.h>
35
36typedef struct {
37  jmp_buf     regs;
38  int         isr_level;
39} Context_Control;
40
41int main(
42  int argc,
43  char **argv
44)
45{
46  Context_Control *cc = 0;
47
48  /*
49   * Print the file header
50   */
51
52printf(
53  "/*  unixsize.h\n"
54  " *\n"
55  " *  This include file contans the size of the context control block\n"
56  " *  C data structure.  This structure must be defined in such a way\n"
57  " *  that files NOT including the native header files can work.\n"
58  " *\n"
59  " *  NOTE:  THIS FILE IS AUTOMATICALLY GENERATED!!!!\n"
60  " *         DO NOT EDIT THIS BY HAND!!!!\n"
61  " *\n"
62  " *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.\n"
63  " *  On-Line Applications Research Corporation (OAR).\n"
64  " *  All rights assigned to U.S. Government, 1994.\n"
65  " *\n"
66  " *  This material may be reproduced by or for the U.S. Government pursuant\n"
67  " *  to the copyright license under the clause at DFARS 252.227-7013.  This\n"
68  " *  notice must appear in all copies of this file and its derivatives.\n"
69  " */\n"
70  "\n"
71  "#ifndef __UNIXSIZE_h\n"
72  "#define __UNIXSIZE_h\n"
73  "\n"
74);
75
76#define PRINT_IT( STRING, NUMBER ) \
77  printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
78          STRING, \
79          NUMBER, \
80          NUMBER );
81
82#define PRINT_SIZE( STRING, NUMBER ) \
83  printf( "#define\t%s\t0x%x\t\t/* %d */\n", \
84          STRING, \
85          NUMBER, \
86          NUMBER );
87
88#define PRINT_COMMENT( STRING ) \
89  printf(       \
90    "\n"        \
91    "/*\n"      \
92    " * " STRING "\n" \
93    " */\n"     \
94    "\n"        \
95  );
96
97  PRINT_COMMENT("Context_Control information");
98
99  PRINT_SIZE("CPU_CONTEXT_SIZE_IN_BYTES", sizeof( Context_Control ) );
100  PRINT_SIZE("CPU_CONTEXT_REGISTERS_OFFSET_IN_BYTES", (int) &cc->regs );
101  PRINT_SIZE("CPU_CONTEXT_SIGNALS_OFFSET_IN_BYTES", (int) &cc->isr_level );
102
103  /*
104   *  Print the end of file stuff
105   */
106
107   printf(
108    "\n"
109    "#endif    /* __UNIXSIZE_h  */\n"
110    "\n"
111    "/* end of include file */\n"
112  );
113
114  return 0;
115}
116
Note: See TracBrowser for help on using the repository browser.