home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Source / GNU / cc / cc / defaults.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-03  |  2.4 KB  |  65 lines

  1. /* Definitions of various defaults for how to do assembler output
  2.    (most of which are designed to be appropriate for GAS or for
  3.    some BSD assembler).
  4.  
  5.    Written by Ron Guilmette (rfg@ncd.com)
  6.  
  7. Copyright (C) 1992 Free Software Foundation, Inc.
  8.  
  9. This file is part of GNU CC.
  10.  
  11. GNU CC is free software; you can redistribute it and/or modify
  12. it under the terms of the GNU General Public License as published by
  13. the Free Software Foundation; either version 2, or (at your option)
  14. any later version.
  15.  
  16. GNU CC is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. GNU General Public License for more details.
  20.  
  21. You should have received a copy of the GNU General Public License
  22. along with GNU CC; see the file COPYING.  If not, write to
  23. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  24.  
  25. /* choose a reasonable default for ASM_OUTPUT_ASCII.  */
  26.  
  27. #ifndef ASM_OUTPUT_ASCII
  28. #define ASM_OUTPUT_ASCII(MYFILE, MYSTRING, MYLENGTH) \
  29.   do {                                          \
  30.     FILE *_hide_asm_out_file = (MYFILE);                      \
  31.     unsigned char *_hide_p = (unsigned char *) (MYSTRING);              \
  32.     int _hide_thissize = (MYLENGTH);                          \
  33.     {                                          \
  34.       FILE *asm_out_file = _hide_asm_out_file;                      \
  35.       unsigned char *p = _hide_p;                          \
  36.       int thissize = _hide_thissize;                          \
  37.       int i;                                      \
  38.       fprintf (asm_out_file, "\t.ascii \"");                      \
  39.                                           \
  40.       for (i = 0; i < thissize; i++)                          \
  41.     {                                      \
  42.       register int c = p[i];                          \
  43.       if (c == '\"' || c == '\\')                          \
  44.         putc ('\\', asm_out_file);                          \
  45.       if (c >= ' ' && c < 0177)                          \
  46.         putc (c, asm_out_file);                          \
  47.       else                                      \
  48.         {                                      \
  49.           fprintf (asm_out_file, "\\%o", c);                  \
  50.           /* After an octal-escape, if a digit follows,              \
  51.          terminate one string constant and start another.          \
  52.          The Vax assembler fails to stop reading the escape          \
  53.          after three digits, so this is the only way we              \
  54.          can get it to parse the data properly.  */              \
  55.           if (i < thissize - 1                          \
  56.           && p[i + 1] >= '0' && p[i + 1] <= '9')              \
  57.         fprintf (asm_out_file, "\"\n\t.ascii \"");              \
  58.       }                                      \
  59.     }                                      \
  60.       fprintf (asm_out_file, "\"\n");                          \
  61.     }                                          \
  62.   }                                          \
  63.   while (0)
  64. #endif
  65.