home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / adav313.zip / gnat-3_13p-os2-bin-20010916.zip / emx / gnatlib / a-cio.c < prev    next >
C/C++ Source or Header  |  2000-07-19  |  4KB  |  100 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /*                         GNAT COMPILER COMPONENTS                         */
  4. /*                                                                          */
  5. /*                                A - C I O                                 */
  6. /*                                                                          */
  7. /*                          C Implementation File                           */
  8. /*                                                                          */
  9. /*                            $Revision: 1.15 $
  10. /*                                                                          */
  11. /*          Copyright (C) 1992-1999 Free Software Foundation, Inc.          */
  12. /*                                                                          */
  13. /* GNAT is free software;  you can  redistribute it  and/or modify it under */
  14. /* terms of the  GNU General Public License as published  by the Free Soft- */
  15. /* ware  Foundation;  either version 2,  or (at your option) any later ver- */
  16. /* sion.  GNAT is distributed in the hope that it will be useful, but WITH- */
  17. /* OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY */
  18. /* or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License */
  19. /* for  more details.  You should have  received  a copy of the GNU General */
  20. /* Public License  distributed with GNAT;  see file COPYING.  If not, write */
  21. /* to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, */
  22. /* MA 02111-1307, USA.                                                      */
  23. /*                                                                          */
  24. /* As a  special  exception,  if you  link  this file  with other  files to */
  25. /* produce an executable,  this file does not by itself cause the resulting */
  26. /* executable to be covered by the GNU General Public License. This except- */
  27. /* ion does not  however invalidate  any other reasons  why the  executable */
  28. /* file might be covered by the  GNU Public License.                        */
  29. /*                                                                          */
  30. /* GNAT was originally developed  by the GNAT team at  New York University. */
  31. /* It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). */
  32. /*                                                                          */
  33. /****************************************************************************/
  34.  
  35. /* Routines for interface to scanf and printf functions for integer values */
  36.  
  37. #ifdef __RT__
  38. /* Linux kernel modules don't have inputs, so don't define get_int.
  39.    Simple output can be done via printk. */
  40.  
  41. put_int (int x)
  42. {
  43.   printk ("%d", x);
  44. }
  45.  
  46. void put_char (int c)
  47. {
  48.   printk ("%c", c);
  49. }
  50.  
  51. void put_char_stderr (int c)
  52. {
  53.   put_char (c);
  54. }
  55.  
  56. #else
  57. #include <stdio.h>
  58.  
  59. /* Don't use macros on linux since they cause incompatible changes between
  60.    glibc 2.0 and 2.1 */
  61. #ifdef linux
  62. #undef putchar
  63. #undef getchar
  64. #undef fputc
  65. #undef stderr
  66. #endif
  67.  
  68. int get_int ()
  69. {
  70.   int x;
  71.   scanf (" %d", &x);
  72.   return x;
  73. }
  74.  
  75. put_int (int x)
  76. {
  77.   printf ("%d", x);
  78. }
  79.  
  80. int get_char (void)
  81. {
  82. #ifdef VMS
  83.   return decc$getchar();
  84. #else
  85.   return getchar();
  86. #endif
  87. }
  88.  
  89. void put_char (int c) { putchar (c); }
  90.  
  91. void put_char_stderr (int c) { fputc (c, stderr); }
  92. #endif
  93.  
  94. #ifdef __vxworks
  95. char *mktemp (char *template)
  96. {
  97.   return tmpnam (NULL);
  98. }
  99. #endif
  100.