OSDN Git Service

PR c++/9704
[pf3gnuchains/gcc-fork.git] / gcc / ada / cio.c
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                                  C I O                                   *
6  *                                                                          *
7  *                          C Implementation File                           *
8  *                                                                          *
9  *                                                                          *
10  *          Copyright (C) 1992-2001 Free Software Foundation, Inc.          *
11  *                                                                          *
12  * GNAT is free software;  you can  redistribute it  and/or modify it under *
13  * terms of the  GNU General Public License as published  by the Free Soft- *
14  * ware  Foundation;  either version 2,  or (at your option) any later ver- *
15  * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
16  * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
17  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License *
18  * for  more details.  You should have  received  a copy of the GNU General *
19  * Public License  distributed with GNAT;  see file COPYING.  If not, write *
20  * to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, *
21  * MA 02111-1307, USA.                                                      *
22  *                                                                          *
23  * As a  special  exception,  if you  link  this file  with other  files to *
24  * produce an executable,  this file does not by itself cause the resulting *
25  * executable to be covered by the GNU General Public License. This except- *
26  * ion does not  however invalidate  any other reasons  why the  executable *
27  * file might be covered by the  GNU Public License.                        *
28  *                                                                          *
29  * GNAT was originally developed  by the GNAT team at  New York University. *
30  * Extensive contributions were provided by Ada Core Technologies Inc.      *
31  *                                                                          *
32  ****************************************************************************/
33
34 #ifdef IN_RTS
35 #include "tconfig.h"
36 #include "tsystem.h"
37 #include <sys/stat.h>
38 #else
39 #include "config.h"
40 #include "system.h"
41 #endif
42
43 #include "adaint.h"
44
45 #ifdef __RT__
46
47 /* Linux kernel modules don't have inputs, so don't define get_int.
48    Simple output can be done via printk. */
49
50 void
51 put_char (c)
52      int c;
53 {
54   printk ("%c", c);
55 }
56
57 void
58 put_char_stderr (c)
59      int c;
60 {
61   put_char (c);
62 }
63
64 void
65 put_int (x)
66      int x;
67 {
68   printk ("%d", x);
69 }
70
71 void
72 put_int_stderr (int x)
73 {
74   put_int (x);
75 }
76
77 #else
78
79 /* Don't use macros on GNU/Linux since they cause incompatible changes between
80    glibc 2.0 and 2.1 */
81 #ifdef linux
82 #undef putchar
83 #undef getchar
84 #undef fputc
85 #undef stderr
86 #endif
87
88 int
89 get_char ()
90 {
91 #ifdef VMS
92   return decc$getchar();
93 #else
94   return getchar ();
95 #endif
96 }
97
98 int
99 get_int ()
100 {
101   int x;
102
103   scanf (" %d", &x);
104   return x;
105 }
106
107 void
108 put_int (x)
109      int x;
110 {
111   printf ("%d", x);
112 }
113
114 void
115 put_int_stderr (x)
116    int x;
117 {
118   fprintf (stderr, "%d", x);
119 }
120
121 void
122 put_char (c)
123      int c;
124 {
125   putchar (c);
126 }
127
128 void
129 put_char_stderr (c)
130      int c;
131 {
132   fputc (c, stderr);
133 }
134 #endif
135
136 #ifdef __vxworks
137
138 char *
139 mktemp (template)
140      char *template;
141 {
142   return tmpnam (NULL);
143 }
144 #endif