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

4.104.114.84.95
Last change on this file since 33b304f was 98e4ebf5, checked in by Joel Sherrill <joel.sherrill@…>, on 10/08/97 at 15:45:54

Fixed typo in the pointer to the license terms.

  • Property mode set to 100644
File size: 2.6 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-1997.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.OARcorp.com/rtems/license.html.
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-1997.\n"
63  " *  On-Line Applications Research Corporation (OAR).\n"
64  " *  Copyright assigned to U.S. Government, 1994.\n"
65  " *\n"
66  " *  The license and distribution terms for this file may be\n"
67  " *  found in the file LICENSE in this distribution or at\n"
68  " *  http://www.OARcorp.com/rtems/license.html.\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.