OSDN Git Service

* doc/install.texi (Specific, mips-sgi-irix5): Document IRIX 5
[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  *          Copyright (C) 1992-2009, Free Software Foundation, Inc.         *
10  *                                                                          *
11  * GNAT is free software;  you can  redistribute it  and/or modify it under *
12  * terms of the  GNU General Public License as published  by the Free Soft- *
13  * ware  Foundation;  either version 3,  or (at your option) any later ver- *
14  * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
15  * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
16  * or FITNESS FOR A PARTICULAR PURPOSE.                                     *
17  *                                                                          *
18  * As a special exception under Section 7 of GPL version 3, you are granted *
19  * additional permissions described in the GCC Runtime Library Exception,   *
20  * version 3.1, as published by the Free Software Foundation.               *
21  *                                                                          *
22  * You should have received a copy of the GNU General Public License and    *
23  * a copy of the GCC Runtime Library Exception along with this program;     *
24  * see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    *
25  * <http://www.gnu.org/licenses/>.                                          *
26  *                                                                          *
27  * GNAT was originally developed  by the GNAT team at  New York University. *
28  * Extensive contributions were provided by Ada Core Technologies Inc.      *
29  *                                                                          *
30  ****************************************************************************/
31
32 #ifdef IN_RTS
33 #include "tconfig.h"
34 #include "tsystem.h"
35 #include <sys/stat.h>
36 #else
37 #include "config.h"
38 #include "system.h"
39 #endif
40
41 #include "adaint.h"
42
43 /* Don't use macros on GNU/Linux since they cause incompatible changes between
44    glibc 2.0 and 2.1 */
45 #ifdef linux
46 #undef putchar
47 #undef getchar
48 #undef fputc
49 #undef stderr
50 #undef stdout
51 #endif
52
53 #ifdef VTHREADS
54 #undef putchar
55 #undef getchar
56 #endif
57
58 #ifdef RTX
59 #include <windows.h>
60 #include <Rtapi.h>
61 #endif
62
63 int
64 get_char (void)
65 {
66 #ifdef VMS
67   return decc$getchar();
68 #else
69   return getchar ();
70 #endif
71 }
72
73 int
74 get_int (void)
75 {
76   int x;
77
78   scanf (" %d", &x);
79   return x;
80 }
81
82 void
83 put_int (int x)
84 {
85 #ifdef RTX
86    RtPrintf ("%d", x);
87 #else
88    /* Use fprintf rather than printf, since the latter is unbuffered
89       on vxworks */
90    fprintf (stdout, "%d", x);
91 #endif
92 }
93
94 void
95 put_int_stderr (int x)
96 {
97 #ifdef RTX
98   RtPrintf ("%d", x);
99 #else
100   fprintf (stderr, "%d", x);
101 #endif
102 }
103
104 void
105 put_char (int c)
106 {
107 #ifdef RTX
108   RtPrintf ("%c", c);
109 #else
110   putchar (c);
111 #endif
112 }
113
114 void
115 put_char_stderr (int c)
116 {
117 #ifdef RTX
118   RtPrintf ("%c", c);
119 #else
120   fputc (c, stderr);
121 #endif
122 }
123
124 #ifdef __vxworks
125
126 char *
127 mktemp (char *template)
128 {
129   return tmpnam (NULL);
130 }
131 #endif