home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / tos / updates / update26.zoo / gcc-231 / gcc-231.diff < prev    next >
Encoding:
Text File  |  1992-11-07  |  62.1 KB  |  2,366 lines

  1. *** 1.9    1992/11/07 04:57:45
  2. --- c-decl.c    1992/11/08 00:48:24
  3. ***************
  4. *** 5868,5873 ****
  5. --- 5868,5875 ----
  6.   
  7.     expand_function_start (fndecl, 0);
  8.   
  9. + #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  10. +   /* we will only need this in cp-decl.c, not here */
  11.     /* If this function is `main', emit a call to `__main'
  12.        to run global initializers, etc.  */
  13.     if (DECL_NAME (fndecl)
  14. ***************
  15. *** 5874,5879 ****
  16. --- 5876,5882 ----
  17.         && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main") == 0
  18.         && DECL_CONTEXT (fndecl) == NULL_TREE)
  19.       expand_main_function ();
  20. + #endif
  21.   }
  22.   
  23.   /* SPECPARMS is an identifier list--a chain of TREE_LIST nodes
  24. *** 1.5    1992/11/07 04:57:45
  25. --- c-lex.c    1992/11/08 00:48:25
  26. ***************
  27. *** 391,396 ****
  28. --- 391,397 ----
  29.       case '\r':
  30.         /* ANSI C says the effects of a carriage return in a source file
  31.            are undefined.  */
  32. + #ifndef atarist /* but not on an atarist, though hopefully we should'nt see it */
  33.         if (pedantic && !newline_warning)
  34.           {
  35.             warning ("carriage return in source file");
  36. ***************
  37. *** 397,402 ****
  38. --- 398,404 ----
  39.             warning ("(we only warn about the first carriage return)");
  40.             newline_warning = 1;
  41.           }
  42. + #endif
  43.         c = getc (finput);
  44.         break;
  45.   
  46. *** 1.11    1992/11/07 04:57:45
  47. --- cccp.c    1992/11/08 00:48:31
  48. ***************
  49. *** 71,76 ****
  50. --- 71,78 ----
  51.   #undef bzero
  52.   #undef bcmp
  53.   
  54. + #ifndef atarist
  55.   #include <sys/types.h>
  56.   #include <sys/stat.h>
  57.   #include <ctype.h>
  58. ***************
  59. *** 77,91 ****
  60.   #include <stdio.h>
  61.   
  62.   #ifndef VMS
  63. ! #ifndef USG
  64.   #include <sys/time.h>        /* for __DATE__ and __TIME__ */
  65.   #include <sys/resource.h>
  66.   #else
  67.   #include <time.h>
  68.   #include <fcntl.h>
  69. ! #endif /* USG */
  70.   #endif /* not VMS */
  71.   
  72.   /* VMS-specific definitions */
  73.   #ifdef VMS
  74.   #include <time.h>
  75. --- 79,111 ----
  76.   #include <stdio.h>
  77.   
  78.   #ifndef VMS
  79. ! #if (!(defined(USG) || defined(atariminix)))
  80.   #include <sys/time.h>        /* for __DATE__ and __TIME__ */
  81.   #include <sys/resource.h>
  82.   #else
  83.   #include <time.h>
  84.   #include <fcntl.h>
  85. ! #endif /* USG or atariminix */
  86.   #endif /* not VMS */
  87.   
  88. + #else    /* atarist */
  89. + #include <ctype.h>
  90. + #include <stdio.h>
  91. + #include <types.h>
  92. + #include <stat.h>
  93. + #include <file.h>
  94. + #include <time.h>
  95. + #include <string.h>
  96. + #include "stddef.h"
  97. + long _stksize = -1L;    /* want big stack cause include files
  98. +                    get alloca'ed there */
  99. + #define read(fd,buf,size)    _text_read(fd,buf,size)
  100. + #endif        /* atarist */
  101.   /* VMS-specific definitions */
  102.   #ifdef VMS
  103.   #include <time.h>
  104. ***************
  105. *** 925,930 ****
  106. --- 945,971 ----
  107.   /* Nonzero means -I- has been seen,
  108.      so don't look for #include "foo" the source-file directory.  */
  109.   static int ignore_srcdir;
  110. +  
  111. + #ifdef atarist
  112. + /* the following dingus is used in place of some calls to bcopy,
  113. +    to ensure that backslashes get properly slashified when getting
  114. +    shoved into strings.  Note that it returns the new pointer!!
  115. +    There ought to be a better way... */
  116. + U_CHAR * slashifying_bcopy(from_buf, to_buf, nbytes)
  117. + U_CHAR * from_buf, * to_buf;
  118. + int nbytes;
  119. + {
  120. +   for ( ; nbytes > 0 ; )
  121. +     {
  122. +     if(*from_buf == '\\')
  123. +         *to_buf++ = '\\';
  124. +     *to_buf++ = *from_buf++;
  125. +     nbytes--;
  126. +     }
  127. +   return(to_buf);
  128. + }
  129. + #endif        /* atarist */
  130.   
  131.   int
  132.   main (argc, argv)
  133. ***************
  134. *** 963,968 ****
  135. --- 1004,1014 ----
  136.     /* Target-name to write with the dependency information.  */
  137.     char *deps_target = 0;
  138.   
  139. + #ifdef atarist
  140. + /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
  141. + /*  _malloczero(1); */     /* zero mallocs by default */
  142. + #endif  
  143.   #ifdef RLIMIT_STACK
  144.     /* Get rid of any avoidable limit on stack size.  */
  145.     {
  146. ***************
  147. *** 1210,1219 ****
  148. --- 1256,1271 ----
  149.       break;
  150.   
  151.         case 'v':
  152. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  153. + #include "PatchLev.h"
  154. +     fprintf (stderr, "GNU CPP-atariST version %s Patchlevel %s",
  155. +          version_string, PatchLevel);
  156. + #else
  157.       fprintf (stderr, "GNU CPP version %s", version_string);
  158.   #ifdef TARGET_VERSION
  159.       TARGET_VERSION;
  160.   #endif
  161. + #endif
  162.       fprintf (stderr, "\n");
  163.       break;
  164.   
  165. ***************
  166. *** 1345,1350 ****
  167. --- 1397,1403 ----
  168.       }
  169.     }
  170.   
  171. + #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  172.     /* Add dirs from CPATH after dirs from -I.  */
  173.     /* There seems to be confusion about what CPATH should do,
  174.        so for the moment it is not documented.  */
  175. ***************
  176. *** 1354,1359 ****
  177. --- 1407,1413 ----
  178.     p = (char *) getenv ("CPATH");
  179.     if (p != 0 && ! no_standard_includes)
  180.       path_include (p);
  181. + #endif
  182.   
  183.     /* Now that dollars_in_ident is known, initialize is_idchar.  */
  184.     initialize_char_syntax ();
  185. ***************
  186. *** 1477,1484 ****
  187.     { /* read the appropriate environment variable and if it exists
  188.          replace include_defaults with the listed path. */
  189.       char *epath = 0;
  190.       switch ((objc << 1) + cplusplus)
  191. !       {
  192.         case 0:
  193.       epath = getenv ("C_INCLUDE_PATH");
  194.       break;
  195. --- 1531,1586 ----
  196.     { /* read the appropriate environment variable and if it exists
  197.          replace include_defaults with the listed path. */
  198.       char *epath = 0;
  199. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  200. +     int db_hack = 0;
  201. +     char *e1 = getenv("GNUINC"), *e2 = getenv("GNULIB"),
  202. +          *e3 = getenv("GXXINC");
  203. +     /* Get length of the alloc'ed array. (Yeah I know, I might alloc
  204. +      * a character more than I need but who cares...
  205. +      */
  206. +     if (cplusplus && e3)
  207. +     db_hack += strlen (e3);
  208. +     if (e1)
  209. +         db_hack += strlen (e1) + 1;
  210. +     if (e2)
  211. +         db_hack += strlen (e1) + 1;
  212. +     if (db_hack) {
  213. +     epath = alloca (db_hack + 1);
  214. +     *epath = '\0';
  215. +     db_hack = 0;
  216. +     /* Concatenate the paths together. */
  217. +     if (cplusplus && e3) {
  218. +         strcpy (epath, e3);
  219. +         db_hack = 1;
  220. +     }
  221. +     if (e1) {
  222. +         if (db_hack) {
  223. +         strcat (epath, PATH_SEP_STR);
  224. +         }
  225. +         strcat (epath, e1);
  226. +         db_hack = 1;
  227. +     }
  228. +     if (e2) {
  229. +         if (db_hack) {
  230. +         strcat (epath, PATH_SEP_STR);
  231. +         }
  232. +         strcat (epath, e2);
  233. +     }
  234. +     }
  235. + #ifdef atarist
  236. +     if (epath)
  237. +         for (e3=epath; *e3; e3++)    /* Use one kind of path separator */
  238. +         if (*e3 == ';')
  239. +         *e3 = PATH_SEPARATOR;
  240. + #endif
  241. + #else
  242.       switch ((objc << 1) + cplusplus)
  243. !     {
  244.         case 0:
  245.       epath = getenv ("C_INCLUDE_PATH");
  246.       break;
  247. ***************
  248. *** 1491,1497 ****
  249.         case 3:
  250.       epath = getenv ("OBJCPLUS_INCLUDE_PATH");
  251.       break;
  252. !       }
  253.       /* If the environment var for this language is set,
  254.          add to the default list of include directories.  */
  255.       if (epath) {
  256. --- 1593,1601 ----
  257.         case 3:
  258.       epath = getenv ("OBJCPLUS_INCLUDE_PATH");
  259.       break;
  260. !     }
  261. ! #endif
  262.       /* If the environment var for this language is set,
  263.          add to the default list of include directories.  */
  264.       if (epath) {
  265. ***************
  266. *** 1545,1551 ****
  267. --- 1649,1659 ----
  268.     if (!no_standard_includes) {
  269.       struct default_include *p = include_defaults;
  270.       char *specd_prefix = include_prefix;
  271. + #ifdef GCC_INCLUDE_DIR
  272.       char *default_prefix = savestring (GCC_INCLUDE_DIR);
  273. + #else
  274. +     char *default_prefix = savestring ("./");
  275. + #endif
  276.       int default_len = 0;
  277.       /* Remove the `include' from /usr/local/lib/gcc.../include.  */
  278.       if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
  279. ***************
  280. *** 1552,1557 ****
  281. --- 1660,1671 ----
  282.         default_len = strlen (default_prefix) - 7;
  283.         default_prefix[default_len] = 0;
  284.       }
  285. + #ifdef atarist
  286. +     else if (!strcmp (default_prefix + strlen (default_prefix) - 8, "\\include")) {
  287. +       default_len = strlen (default_prefix) - 7;
  288. +       default_prefix[default_len] = 0;
  289. +     }
  290. + #endif
  291.       /* Search "translated" versions of GNU directories.
  292.          These have /usr/local/lib/gcc... replaced by specd_prefix.  */
  293.       if (specd_prefix != 0 && default_len != 0)
  294. ***************
  295. *** 1678,1684 ****
  296. --- 1792,1802 ----
  297.         char *p1 = p;
  298.         /* Discard all directory prefixes from P.  */
  299.         while (*p1) {
  300. + #ifdef atarist
  301. +     if ((*p1 == '/') || (*p1 == '\\'))
  302. + #else
  303.       if (*p1 == '/')
  304. + #endif
  305.         p = p1 + 1;
  306.       p1++;
  307.         }
  308. ***************
  309. *** 1840,1845 ****
  310. --- 1958,1964 ----
  311.     return 0;
  312.   }
  313.   
  314. + #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  315.   /* Given a colon-separated list of file names PATH,
  316.      add all the names to the search path for include files.  */
  317.   
  318. ***************
  319. *** 1886,1891 ****
  320. --- 2005,2011 ----
  321.         p++;
  322.       }
  323.   }
  324. + #endif /* atarist */
  325.   
  326.   /* Pre-C-Preprocessor to translate ANSI trigraph idiocy in BUF
  327.      before main CCCP processing.  Name `pcp' is also in honor of the
  328. ***************
  329. *** 3040,3045 ****
  330. --- 3160,3166 ----
  331.     assertions_flag = save_assertions_flag;
  332.     return obuf;
  333.   }
  334. + /* #endif */
  335.   
  336.   /*
  337.    * Process a # directive.  Expects IP->bufp to point after the '#', as in
  338. ***************
  339. *** 3501,3508 ****
  340. --- 3622,3638 ----
  341.   
  342.         if (string)
  343.       {
  344. + #ifndef atarist
  345.         buf = (char *) alloca (3 + strlen (string));
  346.         sprintf (buf, "\"%s\"", string);
  347. + #else
  348. +           buf = (char *) alloca (16 + strlen (string));
  349. +           {
  350. +           char *tbuf = (char *) alloca (16 + strlen (string));
  351. +           (void) slashifying_bcopy(string, tbuf, strlen(string)+1);
  352. +           sprintf (buf, "\"%s\"", tbuf);
  353. +           }
  354. + #endif /* atarist */
  355.       }
  356.         else
  357.       buf = "\"\"";
  358. ***************
  359. *** 3724,3730 ****
  360. --- 3854,3865 ----
  361.           dsp[0].next = search_start;
  362.           search_start = dsp;
  363.   #ifndef VMS
  364. + #ifdef atarist
  365. +         if((ep = rindex(nam, '\\')) == NULL)
  366. +         ep = rindex(nam, '/');
  367. + #else
  368.           ep = rindex (nam, '/');
  369. + #endif
  370.   #else                /* VMS */
  371.           ep = rindex (nam, ']');
  372.           if (ep == NULL) ep = rindex (nam, '>');
  373. ***************
  374. *** 3800,3808 ****
  375. --- 3935,3957 ----
  376.   
  377.     /* If specified file name is absolute, just open it.  */
  378.   
  379. + #ifdef atarist
  380. +   if ((*fbeg == '\\') || (*fbeg == '/')) {
  381. +     if(fbeg[2] == ':')
  382. +     { /* allow "\D:\xxx" */
  383. +         strncpy (fname, fbeg+1, flen-1);
  384. +         fname[flen-1] = 0;
  385. +     }
  386. +     else
  387. +     {  /* allow "\lib\xxx" == "\currentdrive:\lib\xxx" */
  388. +         strncpy (fname, fbeg, flen);
  389. +         fname[flen] = 0;
  390. +     }
  391. + #else
  392.     if (*fbeg == '/') {
  393.       strncpy (fname, fbeg, flen);
  394.       fname[flen] = 0;
  395. + #endif
  396.       if (redundant_include_p (fname))
  397.         return 0;
  398.       if (importing)
  399. ***************
  400. *** 3823,3829 ****
  401. --- 3972,3982 ----
  402.       if (searchptr->fname[0] == 0)
  403.         continue;
  404.       strcpy (fname, searchptr->fname);
  405. + #ifdef atarist
  406. +     strcat (fname, "\\");
  407. + #else
  408.       strcat (fname, "/");
  409. + #endif
  410.       fname[strlen (fname) + flen] = 0;
  411.         } else {
  412.       fname[0] = 0;
  413. ***************
  414. *** 3945,3961 ****
  415.   
  416.       if (!no_precomp)
  417.         do {
  418.       sprintf (pcftry, "%s%d", fname, pcfnum++);
  419.       
  420.       pcf = open (pcftry, O_RDONLY, 0666);
  421.       if (pcf != -1)
  422.         {
  423.           struct stat s;
  424.   
  425.           fstat (pcf, &s);
  426.           if (bcmp (&stat_f.st_ino, &s.st_ino, sizeof (s.st_ino))
  427.           || stat_f.st_dev != s.st_dev)
  428. !           {
  429.           pcfbuf = check_precompiled (pcf, fname, &pcfbuflimit);
  430.           /* Don't need it any more.  */
  431.           close (pcf);
  432. --- 4098,4156 ----
  433.   
  434.       if (!no_precomp)
  435.         do {
  436. + #ifdef atarist
  437. +     int numlen;
  438. +     char *dot;
  439. +     char *slash;
  440. +     /* cut extension to 3 chars and dont depend on UNIXMODE           */
  441. +     /* this will have to be done when saving precompiled headers, too */
  442. +     /* but as far as I tried, they dont work up to now, anyway   (AL) */
  443. +       if( pcfnum>=100 )     numlen=3;
  444. +       else if( pcfnum>=10 ) numlen=2;
  445. +       else                  numlen=1;
  446. +       dot=strrchr( fname, '.' );
  447. +       if( (slash=strrchr( fname, '/')) && slash>dot )
  448. +         dot=NULL;
  449. +       else
  450. +       if( (slash=strrchr( fname, '\\')) && slash>dot )
  451. +         dot=NULL;
  452. +       if( dot ) {
  453. +         if( strlen(dot)-1>3-numlen ) {
  454. +           sprintf(pcftry, "%.*s%d", strlen(fname)-(strlen(dot)-(4-numlen)),
  455. +                   fname, pcfnum++);
  456. +         } else {
  457. +           sprintf(pcftry, "%s%d", fname, pcfnum++);
  458. +         }
  459. +       } else {
  460. +         sprintf( pcftry, "%s.%d", fname, pcfnum++);
  461. +       }
  462. + #else    /* looks like we got a sane filesystem */
  463.       sprintf (pcftry, "%s%d", fname, pcfnum++);
  464. + #endif
  465. + #if 0
  466. +     fprintf ( stderr, "trying precompiled file %s.\n", pcftry );
  467. + #endif
  468.       
  469.       pcf = open (pcftry, O_RDONLY, 0666);
  470.       if (pcf != -1)
  471.         {
  472. + #ifndef atarist
  473. +         /* dont bother with this on the ST since these field are faked
  474. +          * anyways
  475. +              */
  476.           struct stat s;
  477.   
  478.           fstat (pcf, &s);
  479.           if (bcmp (&stat_f.st_ino, &s.st_ino, sizeof (s.st_ino))
  480.           || stat_f.st_dev != s.st_dev)
  481. ! #else
  482. !         if (1)
  483. ! #endif
  484. !               {
  485.           pcfbuf = check_precompiled (pcf, fname, &pcfbuflimit);
  486.           /* Don't need it any more.  */
  487.           close (pcf);
  488. ***************
  489. *** 6831,6838 ****
  490. --- 7026,7037 ----
  491.     check_expand (op, len + 1);
  492.     if (op->bufp > op->buf && op->bufp[-1] != '\n')
  493.       *op->bufp++ = '\n';
  494. + #ifdef atarist
  495. +   op->bufp = slashifying_bcopy (line_cmd_buf, op->bufp, len);
  496. + #else
  497.     bcopy (line_cmd_buf, op->bufp, len);
  498.     op->bufp += len;
  499. + #endif
  500.     op->lineno = ip->lineno;
  501.   }
  502.   
  503. ***************
  504. *** 8476,8481 ****
  505. --- 8675,8681 ----
  506.     deps_buffer[deps_size] = 0;
  507.   }
  508.   
  509. + #if (!(defined(atarist) || defined(atariminix)))
  510.   #if defined(USG) || defined(VMS)
  511.   #ifndef BSTRING
  512.   
  513. ***************
  514. *** 8512,8518 ****
  515.   }
  516.   #endif /* not BSTRING */
  517.   #endif /* USG or VMS */
  518.   
  519.   static void
  520.   fatal (str, arg)
  521. --- 8712,8718 ----
  522.   }
  523.   #endif /* not BSTRING */
  524.   #endif /* USG or VMS */
  525. ! #endif /* any atari */
  526.   
  527.   static void
  528.   fatal (str, arg)
  529. *** 1.8    1992/11/07 04:57:45
  530. --- cp-tree.c    1992/11/08 00:48:47
  531. ***************
  532. *** 1692,1697 ****
  533. --- 1692,1698 ----
  534.     print_class_statistics ();
  535.   }
  536.   
  537. + #ifndef atarist
  538.   /* This is used by the `assert' macro.  It is provided in libgcc.a,
  539.      which `cc' doesn't know how to link.  */
  540.   void
  541. ***************
  542. *** 1712,1717 ****
  543. --- 1713,1719 ----
  544.     fflush (stderr);
  545.     abort ();
  546.   }
  547. + #endif
  548.   
  549.   /* Return, as an INTEGER_CST node, the number of elements for
  550.      TYPE (which is an ARRAY_TYPE).  This counts only elements of the top array. */
  551. *** 1.5    1992/11/07 04:57:45
  552. --- expr.c    1992/11/08 00:49:01
  553. ***************
  554. *** 1960,1965 ****
  555. --- 1960,1971 ----
  556.   
  557.     argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
  558.   
  559. + /* how would you do this RIGHT ?? fake a DECL node? dunno... */
  560. + #ifdef ENCODE_SECTION_INFO
  561. +   /* mark it as a function (to be in the text section that is) */
  562. +   SYMBOL_REF_FLAG (fun) = 1;
  563. + #endif
  564.     INIT_CUMULATIVE_ARGS (args_so_far, (tree)0, fun);
  565.   
  566.     args_size.constant = 0;
  567. *** 1.10    1992/11/07 04:57:45
  568. --- final.c    1992/11/08 00:49:02
  569. ***************
  570. *** 67,74 ****
  571. --- 67,78 ----
  572.   #if defined (USG) || defined (NO_STAB_H)
  573.   #include "gstab.h"  /* If doing DBX on sysV, use our own stab.h.  */
  574.   #else
  575. + #if defined(CROSSATARI) || defined(atarist) || defined(atariminix)
  576. + #include "astab.h"
  577. + #else
  578.   #include <stab.h>  /* On BSD, use the system's stab.h.  */
  579.   #endif /* not USG */
  580. + #endif /* not atari */
  581.   #endif /* DBX_DEBUGGING_INFO || XCOFF_DEBUGGING_INFO */
  582.   
  583.   #ifdef XCOFF_DEBUGGING_INFO
  584. *** 1.15    1992/11/07 04:57:45
  585. --- gcc.c    1992/11/08 00:49:08
  586. ***************
  587. *** 30,35 ****
  588. --- 30,44 ----
  589.   Once it knows which kind of compilation to perform, the procedure for
  590.   compilation is specified by a string called a "spec".  */
  591.   
  592. + #ifdef CROSSATARI
  593. + #ifdef atarist
  594. + #undef atarist
  595. + #endif
  596. + #ifdef atariminix
  597. + #undef atariminix
  598. + #endif
  599. + #endif
  600. +   
  601.   #include <sys/types.h>
  602.   #include <ctype.h>
  603.   #include <signal.h>
  604. ***************
  605. *** 40,45 ****
  606. --- 49,57 ----
  607.   #include "obstack.h"
  608.   #include "gvarargs.h"
  609.   #include <stdio.h>
  610. + #ifdef CROSSATARI
  611. + #include <ctype.h>
  612. + #endif
  613.   
  614.   #ifndef R_OK
  615.   #define R_OK 4
  616. ***************
  617. *** 65,71 ****
  618.   #define NULL_PTR ((GENERIC_PTR)0)
  619.   #endif
  620.   
  621. ! #ifdef USG
  622.   #define vfork fork
  623.   #endif /* USG */
  624.   
  625. --- 77,83 ----
  626.   #define NULL_PTR ((GENERIC_PTR)0)
  627.   #endif
  628.   
  629. ! #if (defined(USG) || defined(atariminix))
  630.   #define vfork fork
  631.   #endif /* USG */
  632.   
  633. ***************
  634. *** 97,102 ****
  635. --- 109,121 ----
  636.   #define PATH_SEPARATOR ':'
  637.   #endif
  638.   
  639. + #ifdef atarist
  640. + #include <osbind.h>
  641. + #include <ctype.h>
  642. + #include <fcntl.h>        /* fgth, for redirection of stderr */
  643. + long _stksize = 8192;
  644. + #endif
  645.   #define obstack_chunk_alloc xmalloc
  646.   #define obstack_chunk_free free
  647.   
  648. ***************
  649. *** 153,159 ****
  650. --- 172,180 ----
  651.      pass the compiler in building the list of pointers to constructors
  652.      and destructors.  */
  653.   
  654. + #if (!(defined(CROSSATARI) || defined(atarist)))
  655.   static struct obstack collect_obstack;
  656. + #endif
  657.   
  658.   extern char *version_string;
  659.   
  660. ***************
  661. *** 445,451 ****
  662.              %{aux-info*}\
  663.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  664.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  665. !               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  666.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  667.                         %{!pipe:%g.s} %A\n }}}}"},
  668.     {"-",
  669. --- 466,472 ----
  670.              %{aux-info*}\
  671.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  672.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  673. !               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  674.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  675.                         %{!pipe:%g.s} %A\n }}}}"},
  676.     {"-",
  677. ***************
  678. *** 478,484 ****
  679.              %{aux-info*}\
  680.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  681.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  682. !               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  683.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  684.                         %{!pipe:%g.s} %A\n }}}}"},
  685.     {".h", "@c-header"},
  686. --- 499,505 ----
  687.              %{aux-info*}\
  688.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  689.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  690. !               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  691.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  692.                         %{!pipe:%g.s} %A\n }}}}"},
  693.     {".h", "@c-header"},
  694. ***************
  695. *** 513,519 ****
  696.              %{aux-info*}\
  697.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  698.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  699. !               %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  700.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  701.                         %{!pipe:%g.s} %A\n }}}}"},
  702.     {".i", "@cpp-output"},
  703. --- 534,540 ----
  704.              %{aux-info*}\
  705.              %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  706.              %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  707. !               %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  708.                 %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  709.                         %{!pipe:%g.s} %A\n }}}}"},
  710.     {".i", "@cpp-output"},
  711. ***************
  712. *** 524,530 ****
  713.       %{aux-info*}\
  714.       %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  715.       %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  716. !     %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  717.               %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %{!pipe:%g.s} %A\n }"},
  718.     {".ii", "@c++-cpp-output"},
  719.     {"@c++-cpp-output",
  720. --- 545,551 ----
  721.       %{aux-info*}\
  722.       %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  723.       %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  724. !     %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  725.               %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %{!pipe:%g.s} %A\n }"},
  726.     {".ii", "@c++-cpp-output"},
  727.     {"@c++-cpp-output",
  728. ***************
  729. *** 534,547 ****
  730.           %{aux-info*}\
  731.           %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  732.           %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  733. !        %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  734.              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  735.              %{!pipe:%g.s} %A\n }"},
  736.     {".s", "@assembler"},
  737.     {"@assembler",
  738. !    "%{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  739.               %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %i %A\n }"},
  740.     {".S", "@assembler-with-cpp"},
  741.     {"@assembler-with-cpp",
  742.      "cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
  743.       %{C:%{!E:%eGNU C does not support -C without using -E}}\
  744. --- 555,571 ----
  745.           %{aux-info*}\
  746.           %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\
  747.           %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\
  748. !        %{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  749.              %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  750.              %{!pipe:%g.s} %A\n }"},
  751.     {".s", "@assembler"},
  752.     {"@assembler",
  753. !    "%{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  754.               %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %i %A\n }"},
  755.     {".S", "@assembler-with-cpp"},
  756. +   {".ss", "@assembler-with-cpp"},
  757. +   {".cpp", "@assembler-with-cpp"},
  758. +   {".spp", "@assembler-with-cpp"},
  759.     {"@assembler-with-cpp",
  760.      "cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{D*} %{U*} %{I*} %{i*} %{P} %I\
  761.       %{C:%{!E:%eGNU C does not support -C without using -E}}\
  762. ***************
  763. *** 551,557 ****
  764.           %{traditional-cpp:-traditional}\
  765.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  766.           %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
  767. !    "%{!M:%{!MM:%{!E:%{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\
  768.                       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  769.               %{!pipe:%g.s} %A\n }}}}"},
  770.     /* Mark end of table */
  771. --- 575,581 ----
  772.           %{traditional-cpp:-traditional}\
  773.       %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C\
  774.           %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
  775. !    "%{!M:%{!MM:%{!E:%{!S:as %{v} %{R} %{j} %{J} %{h} %{d2} %a %Y\
  776.                       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\
  777.               %{!pipe:%g.s} %A\n }}}}"},
  778.     /* Mark end of table */
  779. ***************
  780. *** 565,570 ****
  781. --- 589,603 ----
  782.   
  783.   /* Here is the spec for running the linker, after compiling all files.  */
  784.   
  785. + #if (defined(CROSSATARI) || defined(atarist) || defined(atariminix))
  786. + static char *link_command_spec = 
  787. +  "%{!c:%{!M*:%{!E:%{!S:ld %X %{v} %{G} %{o*} %l\
  788. +  %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
  789. +  %{y*} %{!nostdlib:%S} \
  790. +  %{L*} %o %{!nostdlib:%s %L}\n }}}}";
  791. + #else
  792.   #ifdef LINK_LIBGCC_SPECIAL
  793.   /* Have gcc do the search for libgcc.a.  */
  794.   /* -u* was put back because both BSD and SysV seem to support it.  */
  795. ***************
  796. *** 583,588 ****
  797. --- 616,622 ----
  798.               %{!A:%{!nostdlib:%S}} %{static:}\
  799.               %{L*} %D %o %{!nostdlib:-lgcc %L -lgcc %{!A:%E}}\n }}}}}";
  800.   #endif
  801. + #endif
  802.   
  803.   /* A vector of options to give to the linker.
  804.      These options are accumulated by -Xlinker and -Wl,
  805. ***************
  806. *** 596,601 ****
  807. --- 630,636 ----
  808.   static int n_assembler_options;
  809.   static char **assembler_options;
  810.   
  811. + #if (!(defined(atarist) || defined(CROSSATARI) || defined(atariminix)))
  812.   /* Read compilation specs from a file named FILENAME,
  813.      replacing the default ones.
  814.   
  815. ***************
  816. *** 734,739 ****
  817. --- 769,775 ----
  818.   
  819.     return p;
  820.   }
  821. + #endif /* ataris */
  822.   
  823.   /* Structure to keep track of the specs that have been defined so far.  These
  824.      are accessed using %(specname) or %[specname] in a compiler or link spec. */
  825. ***************
  826. *** 838,843 ****
  827. --- 874,886 ----
  828.   /* Name with which this program was invoked.  */
  829.   
  830.   static char *programname;
  831. + #ifdef atarist
  832. + /* Flag indicating, that stderr should be redirected for the child
  833. +    processes */
  834. + unsigned char zflag;
  835. + #endif
  836.   
  837.   /* Structures to keep track of prefixes to try when looking for files. */
  838.   
  839. ***************
  840. *** 1094,1102 ****
  841.   static void
  842.   choose_temp_base ()
  843.   {
  844. -   char *base = getenv ("TMPDIR");
  845.     int len;
  846.   
  847.     if (base == (char *)0)
  848.       {
  849.   #ifdef P_tmpdir
  850. --- 1137,1162 ----
  851.   static void
  852.   choose_temp_base ()
  853.   {
  854.     int len;
  855. + #if (!(defined(atarist) || defined(atariminix)))
  856. +   char *base = getenv ("TMPDIR");
  857. + #else
  858. +   char *base = getenv ("TEMP");
  859.   
  860. +   if(base == (char *)0)
  861. +   {
  862. +       base = getenv("TMPDIR");
  863. +       if(base == (char *)0)
  864. +       base = getenv("TMP");
  865. +   }
  866. +   if(base != (char *)0)
  867. +   {
  868. +       char *newbase = alloca(FILENAME_MAX);
  869. +       dos2unx(base,newbase);
  870. +       base = newbase;
  871. +   }
  872. + #endif
  873.     if (base == (char *)0)
  874.       {
  875.   #ifdef P_tmpdir
  876. ***************
  877. *** 1115,1121 ****
  878.     len = strlen (base);
  879.     temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
  880.     strcpy (temp_filename, base);
  881. !   if (len > 0 && temp_filename[len-1] != '/')
  882.       temp_filename[len++] = '/';
  883.     strcpy (temp_filename + len, "ccXXXXXX");
  884.   
  885. --- 1175,1185 ----
  886.     len = strlen (base);
  887.     temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
  888.     strcpy (temp_filename, base);
  889. !   if (len > 0 && (temp_filename[len-1] != '/' 
  890. ! #ifdef atarist
  891. !           || temp_filename[len-1] != '\\'
  892. ! #endif
  893. !            ))
  894.       temp_filename[len++] = '/';
  895.     strcpy (temp_filename + len, "ccXXXXXX");
  896.   
  897. ***************
  898. *** 1132,1137 ****
  899. --- 1196,1202 ----
  900.      use come from an obstack, we don't have to worry about allocating
  901.      space for them.  */
  902.   
  903. + #if (!(defined(CROSSATARI) || defined(atarist)))
  904.   #ifndef HAVE_PUTENV
  905.   
  906.   putenv (str)
  907. ***************
  908. *** 1226,1231 ****
  909. --- 1291,1297 ----
  910.     obstack_grow (&collect_obstack, "\0", 1);
  911.     putenv (obstack_finish (&collect_obstack));
  912.   }
  913. + #endif /* ataris */
  914.   
  915.   
  916.   /* Search for NAME using the prefix list PREFIXES.  MODE is passed to
  917. ***************
  918. *** 1501,1506 ****
  919. --- 1567,1573 ----
  920.   
  921.   #else /* not __MSDOS__ */
  922.   
  923. + #ifndef atarist
  924.   static int
  925.   pexecute (search_flag, program, argv, not_last)
  926.        int search_flag;
  927. ***************
  928. *** 1589,1594 ****
  929. --- 1656,1662 ----
  930.       }
  931.   }
  932.   
  933. + #endif /* not atarist */
  934.   #endif /* not __MSDOS__ */
  935.   #else /* not OS2 */
  936.   
  937. ***************
  938. *** 1619,1634 ****
  939.       {
  940.         char *prog;        /* program name.  */
  941.         char **argv;        /* vector of args.  */
  942.         int pid;            /* pid of process for this command.  */
  943.       };
  944.   
  945.     struct command *commands;    /* each command buffer with above info.  */
  946.   
  947.     /* Count # of piped commands.  */
  948.     for (n_commands = 1, i = 0; i < argbuf_index; i++)
  949.       if (strcmp (argbuf[i], "|") == 0)
  950.         n_commands++;
  951.     /* Get storage for each command.  */
  952.     commands
  953.       = (struct command *) alloca (n_commands * sizeof (struct command));
  954. --- 1687,1707 ----
  955.       {
  956.         char *prog;        /* program name.  */
  957.         char **argv;        /* vector of args.  */
  958. + #ifndef atarist
  959.         int pid;            /* pid of process for this command.  */
  960. + #endif
  961.       };
  962.   
  963.     struct command *commands;    /* each command buffer with above info.  */
  964.   
  965. + #ifndef atarist
  966.     /* Count # of piped commands.  */
  967.     for (n_commands = 1, i = 0; i < argbuf_index; i++)
  968.       if (strcmp (argbuf[i], "|") == 0)
  969.         n_commands++;
  970. ! #else
  971. !   n_commands = 1;
  972. ! #endif
  973.     /* Get storage for each command.  */
  974.     commands
  975.       = (struct command *) alloca (n_commands * sizeof (struct command));
  976. ***************
  977. *** 1643,1648 ****
  978. --- 1716,1722 ----
  979.     if (string)
  980.       commands[0].argv[0] = string;
  981.   
  982. + #ifndef atarist
  983.     for (n_commands = 1, i = 0; i < argbuf_index; i++)
  984.       if (strcmp (argbuf[i], "|") == 0)
  985.         {                /* each command.  */
  986. ***************
  987. *** 1657,1662 ****
  988. --- 1731,1739 ----
  989.         commands[n_commands].argv[0] = string;
  990.       n_commands++;
  991.         }
  992. + #else
  993. +   n_commands = 1;
  994. + #endif
  995.   
  996.     argbuf[argbuf_index] = 0;
  997.   
  998. ***************
  999. *** 1672,1680 ****
  1000. --- 1749,1759 ----
  1001.         for (j = commands[i].argv; *j; j++)
  1002.           fprintf (stderr, " %s", *j);
  1003.   
  1004. + #ifndef atarist
  1005.         /* Print a pipe symbol after all but the last command.  */
  1006.         if (i + 1 != n_commands)
  1007.           fprintf (stderr, " |");
  1008. + #endif
  1009.         fprintf (stderr, "\n");
  1010.       }
  1011.         fflush (stderr);
  1012. ***************
  1013. *** 1689,1699 ****
  1014. --- 1768,1780 ----
  1015.   #endif /* DEBUG */
  1016.       }
  1017.   
  1018. + #ifndef atarist
  1019.     /* Run each piped subprocess.  */
  1020.   
  1021.     last_pipe_input = STDIN_FILE_NO;
  1022.     for (i = 0; i < n_commands; i++)
  1023.       {
  1024. + #ifndef atariminix
  1025.         char *string = commands[i].argv[0];
  1026.   
  1027.         commands[i].pid = pexecute (string != commands[i].prog,
  1028. ***************
  1029. *** 1700,1705 ****
  1030. --- 1781,1794 ----
  1031.                     string, commands[i].argv,
  1032.                     i + 1 < n_commands);
  1033.   
  1034. + #else
  1035. +       extern int execv();
  1036. +       char *string = commands[i].argv[0];
  1037. +       commands[i].pid = pexecute (execv,
  1038. +                   string, commands[i].argv,
  1039. +                   i + 1 < n_commands);
  1040. + #endif
  1041.         if (string != commands[i].prog)
  1042.       free (string);
  1043.       }
  1044. ***************
  1045. *** 1746,1751 ****
  1046. --- 1835,1885 ----
  1047.         }
  1048.       return ret_code;
  1049.     }
  1050. + #else /* atarist */
  1051. +  {
  1052. +      register int iii;
  1053. +      int errfd, oldfd;
  1054. +      char **j;
  1055. +      execution_count++;
  1056. +      if (zflag)
  1057. +        {
  1058. +      errfd = Fopen("compile.err", 2);
  1059. +      if (errfd < __SMALLEST_VALID_HANDLE)
  1060. +        errfd = Fcreate("compile.err", 0);
  1061. +      else
  1062. +        Fseek(0L, errfd, 2);
  1063. +      if (errfd >= __SMALLEST_VALID_HANDLE)
  1064. +        {
  1065. +          oldfd = Fdup (2);
  1066. +          Fforce(2, errfd);
  1067. +        }
  1068. +      else
  1069. +        {
  1070. +          error("cannot open %s", "compile.err");
  1071. +          zflag = 0;        /* no redirection */
  1072. +        }
  1073. +        }
  1074. +      for (i = 0; i < n_commands ; i++)
  1075. +      {
  1076. +          j = commands[i].argv;
  1077. +          iii = spawnve(0, j[0], j, NULL);
  1078. +      if(iii != 0)
  1079. +          break;
  1080. +      }
  1081. +      if (zflag)
  1082. +        {
  1083. +      Fforce(2, oldfd);
  1084. +      Fclose(oldfd);
  1085. +      Fclose(errfd);
  1086. +        }
  1087. +      if (iii != 0)
  1088. +        return -1;
  1089. +      else
  1090. +        return 0;
  1091. +  }
  1092. + #endif /* atarist */  
  1093.   }
  1094.   
  1095.   /* Find all the switches given to us
  1096. ***************
  1097. *** 1809,1814 ****
  1098. --- 1943,1949 ----
  1099.   
  1100.     /* Set up the default search paths.  */
  1101.   
  1102. + #ifndef CROSSATARI
  1103.     if (gcc_exec_prefix)
  1104.       {
  1105.         add_prefix (&exec_prefix, gcc_exec_prefix, 0, 0, NULL_PTR);
  1106. ***************
  1107. *** 1885,1890 ****
  1108. --- 2020,2026 ----
  1109.           endp++;
  1110.       }
  1111.       }
  1112. + #endif /* CROSSATARI */
  1113.   
  1114.     /* Use LPATH like LIBRARY_PATH (for the CMU build program).  */
  1115.     temp = getenv ("LPATH");
  1116. ***************
  1117. *** 2092,2097 ****
  1118. --- 2228,2239 ----
  1119.             n_switches++;
  1120.             break;
  1121.           }
  1122. + #ifdef atarist
  1123. +         case 'z':    /* redirect stderr to a file */
  1124. +           zflag++;
  1125. +           n_switches++;
  1126. +           break;
  1127. + #endif
  1128.           default:
  1129.             n_switches++;
  1130.   
  1131. ***************
  1132. *** 2111,2121 ****
  1133. --- 2253,2274 ----
  1134.        (such as cpp) rather than those of the host system.  */
  1135.     /* Use 2 as fourth arg meaning try just the machine as a suffix,
  1136.        as well as trying the machine and the version.  */
  1137. + #if (defined(atarist) || defined(CROSSATARI) || defined(WEIRD))
  1138. + /* NB defined(WEIRD) should not really be there, its only for my weird setup */
  1139. +   /* We are not using machine_suffix here, so do not make */
  1140. +   /* these prefixes available only when we have one       */
  1141. +   add_prefix (&exec_prefix, standard_exec_prefix, 0, 0, NULL_PTR);
  1142. +   add_prefix (&exec_prefix, standard_exec_prefix_1, 0, 0, NULL_PTR);
  1143. +   add_prefix (&startfile_prefix, standard_exec_prefix, 0, 0, NULL_PTR);
  1144. +   add_prefix (&startfile_prefix, standard_exec_prefix_1, 0, 0, NULL_PTR);
  1145. + #else
  1146.     add_prefix (&exec_prefix, standard_exec_prefix, 0, 2, NULL_PTR);
  1147.     add_prefix (&exec_prefix, standard_exec_prefix_1, 0, 2, NULL_PTR);
  1148.   
  1149.     add_prefix (&startfile_prefix, standard_exec_prefix, 0, 1, NULL_PTR);
  1150.     add_prefix (&startfile_prefix, standard_exec_prefix_1, 0, 1, NULL_PTR);
  1151. + #endif /* (defined(atarist) || defined(CROSSATARI)) */
  1152.   
  1153.     /* More prefixes are enabled in main, after we read the specs file
  1154.        and determine whether this is cross-compilation or not.  */
  1155. ***************
  1156. *** 2283,2288 ****
  1157. --- 2436,2450 ----
  1158.      search dirs for it.  */
  1159.   static int this_is_library_file;
  1160.   
  1161. + #ifdef atarist
  1162. + /* I don't know why this is necessary.  Recursive calls to do_spec_1
  1163. +    end up ignoring the error code from calls to execute().  That causes
  1164. +    do_spec to get a 0 return value, and do_spec_1("\n"), which causes the
  1165. +    command to get executed again.
  1166. + */
  1167. + int execute_return_error = 0;
  1168. + #endif
  1169.   /* Process the spec SPEC and run the commands specified therein.
  1170.      Returns 0 if the spec is successfully processed; -1 if failed.  */
  1171.   
  1172. ***************
  1173. *** 2302,2311 ****
  1174. --- 2464,2482 ----
  1175.   
  1176.     /* Force out any unfinished command.
  1177.        If -pipe, this forces out the last command if it ended in `|'.  */
  1178. + #ifdef atarist
  1179. +   if (!value && execute_return_error)
  1180. +     {
  1181. +     value = execute_return_error;
  1182. +     execute_return_error = 0;
  1183. +     }
  1184. + #endif
  1185.     if (value == 0)
  1186.       {
  1187. + #ifndef atarist
  1188.         if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
  1189.       argbuf_index--;
  1190. + #endif
  1191.   
  1192.         if (argbuf_index > 0)
  1193.       value = execute ();
  1194. ***************
  1195. *** 2342,2347 ****
  1196. --- 2513,2569 ----
  1197.          Otherwise, NL, SPC, TAB and % are special.  */
  1198.       switch (inswitch ? 'a' : c)
  1199.         {
  1200. + #if (defined(atarist) || defined(CROSSATARI))
  1201. + /* this stuff added by jrd.  if see '$', expect name of env var, delimited
  1202. +    by '$'.  Find it's value, and subst it in.
  1203. +    modified by ERS to only collect things that look like names; this
  1204. +    saves e.g. the -$ arg. to cpp from getting munged */
  1205. +       case '$':
  1206. +       {
  1207. +     char varname[32];        /* should be enough */
  1208. +     char * value;            /* deciphered value string */
  1209. +     char *temp;
  1210. +     int i;
  1211. +     extern char *getenv(), *index();
  1212. +     
  1213. +     for (i = 0 ; ((c = *p) != '$') && isalnum(c) && i < 31 ; i++, p++)
  1214. +         varname[i] = c;
  1215. +     varname[i] = '\0';
  1216. +     if (strlen(varname) > 0) /* ++jrb fix */
  1217. +     {
  1218. +                  ++p;    /* skip trailing '$' */
  1219. +         value = getenv(varname); /* ++jrb fix */
  1220. +         if (value)
  1221. +         { /* if value is a path, only consider 1'st component */
  1222. + #ifdef atarist
  1223. +             if((temp = index(value, ',')) == NULL)
  1224. +                 temp = index(value, ';');
  1225. + #else
  1226. +             temp = index(value, ':');
  1227. + #endif
  1228. +             if(temp != NULL)
  1229. +             {
  1230. +                 char *t = (char *) alloca(strlen(value) + 1);
  1231. +                 strcpy(t, value);
  1232. +                 t[temp-value] = '\0';
  1233. +                 do_spec_1(t, 0);
  1234. +             }
  1235. +             else
  1236. +                 do_spec_1(value, 0);
  1237. +         }
  1238. +             else
  1239. +             do_spec_1(".", 0);    /* a compleat kludge... */
  1240. +     }
  1241. +         else
  1242. +         {
  1243. +              obstack_1grow(&obstack, '$');
  1244. +              arg_going = 1;
  1245. +         }
  1246. +       }
  1247. +      break;
  1248. + #endif /* atarist */
  1249.         case '\n':
  1250.       /* End of line: finish any pending argument,
  1251.          then run the pending command if one has been started.  */
  1252. ***************
  1253. *** 2379,2384 ****
  1254. --- 2601,2610 ----
  1255.       if (argbuf_index > 0)
  1256.         {
  1257.           int value = execute ();
  1258. + #ifdef atarist
  1259. +         if (!execute_return_error)
  1260. +             execute_return_error = value;
  1261. + #endif
  1262.           if (value)
  1263.             return value;
  1264.         }
  1265. ***************
  1266. *** 2923,2935 ****
  1267. --- 3149,3169 ----
  1268.           break;
  1269.   
  1270.         default:
  1271. + #if 1 /* atarist */
  1272. +         fprintf(stderr, "Bogus char '%c' found at pos %d of spec '%s'\n",
  1273. +         c, (p - spec - 1), spec);
  1274. + #endif
  1275.           abort ();
  1276.         }
  1277.       break;
  1278.   
  1279. + #ifndef atarist
  1280. +       /* on the atari it is important to preserve backslash in spec */
  1281. +       /* so just let it go into default case */
  1282.         case '\\':
  1283.       /* Backslash: treat next character as ordinary.  */
  1284.       c = *p++;
  1285. + #endif
  1286.   
  1287.       /* fall through */
  1288.         default:
  1289. ***************
  1290. *** 3197,3202 ****
  1291. --- 3431,3437 ----
  1292.   
  1293.   /* On fatal signals, delete all the temporary files.  */
  1294.   
  1295. + #ifndef atarist
  1296.   static void
  1297.   fatal_error (signum)
  1298.        int signum;
  1299. ***************
  1300. *** 3208,3213 ****
  1301. --- 3443,3449 ----
  1302.        so its normal effect occurs.  */
  1303.     kill (getpid (), signum);
  1304.   }
  1305. + #endif
  1306.   
  1307.   int
  1308.   main (argc, argv)
  1309. ***************
  1310. *** 3222,3227 ****
  1311. --- 3458,3468 ----
  1312.     char *explicit_link_files;
  1313.     char *specs_file;
  1314.   
  1315. + #ifdef atarist
  1316. + /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
  1317. + /*  _malloczero(1); */     /* zero mallocs by default */
  1318. +   programname = "gcc";
  1319. + #else  
  1320.     programname = argv[0];
  1321.   
  1322.     if (signal (SIGINT, SIG_IGN) != SIG_IGN)
  1323. ***************
  1324. *** 3234,3239 ****
  1325. --- 3475,3481 ----
  1326.     if (signal (SIGPIPE, SIG_IGN) != SIG_IGN)
  1327.       signal (SIGPIPE, fatal_error);
  1328.   #endif
  1329. + #endif /* atarist */
  1330.   
  1331.     argbuf_length = 10;
  1332.     argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
  1333. ***************
  1334. *** 3240,3245 ****
  1335. --- 3482,3488 ----
  1336.   
  1337.     obstack_init (&obstack);
  1338.   
  1339. + #if (!(defined(atarist) || defined(CROSSATARI)))
  1340.     /* Set up to remember the pathname of gcc and any options
  1341.        needed for collect.  */
  1342.     obstack_init (&collect_obstack);
  1343. ***************
  1344. *** 3246,3251 ****
  1345. --- 3489,3495 ----
  1346.     obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=")-1);
  1347.     obstack_grow (&collect_obstack, programname, strlen (programname)+1);
  1348.     putenv (obstack_finish (&collect_obstack));
  1349. + #endif
  1350.   
  1351.     /* Choose directory for temp files.  */
  1352.   
  1353. ***************
  1354. *** 3257,3262 ****
  1355. --- 3501,3515 ----
  1356.   
  1357.     process_command (argc, argv);
  1358.   
  1359. + #if (defined(atarist) || defined(CROSSATARI))
  1360. +   {
  1361. +     char *temp;
  1362. +     
  1363. +     if((temp = getenv ("GCCEXEC")))
  1364. +     add_prefix (&exec_prefix, temp, 0, 0, 0);
  1365. +   }
  1366. + #endif
  1367. +   
  1368.     /* Initialize the vector of specs to just the default.
  1369.        This means one element containing 0s, as a terminator.  */
  1370.   
  1371. ***************
  1372. *** 3264,3269 ****
  1373. --- 3517,3526 ----
  1374.     bcopy (default_compilers, compilers, sizeof default_compilers);
  1375.     n_compilers = n_default_compilers;
  1376.   
  1377. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  1378. +   specs_file = 0;
  1379. + #else
  1380.     /* Read specs from a file if there is one.  */
  1381.   
  1382.     machine_suffix = concat (spec_machine, "/", concat (spec_version, "/", ""));
  1383. ***************
  1384. *** 3273,3278 ****
  1385. --- 3530,3536 ----
  1386.     /* Read the specs file unless it is a default one.  */
  1387.     if (specs_file != 0 && strcmp (specs_file, "specs"))
  1388.       read_specs (specs_file);
  1389. + #endif
  1390.   
  1391.     /* If not cross-compiling, look for startfiles in the standard places.  */
  1392.     /* The fact that these are done here, after reading the specs file,
  1393. ***************
  1394. *** 3325,3331 ****
  1395. --- 3583,3595 ----
  1396.   
  1397.     if (verbose_flag)
  1398.       {
  1399. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  1400. + #include "PatchLev.h"
  1401. +       fprintf (stderr, "gcc-atariST version %s Patchlevel %s\n",
  1402. +            version_string, PatchLevel);
  1403. + #else
  1404.         fprintf (stderr, "gcc version %s\n", version_string);
  1405. + #endif
  1406.         if (n_infiles == 0)
  1407.       exit (0);
  1408.       }
  1409. ***************
  1410. *** 3373,3379 ****
  1411. --- 3637,3648 ----
  1412.   
  1413.         input_basename = input_filename;
  1414.         for (p = input_filename; *p; p++)
  1415. + #ifdef atarist
  1416. +         if (((*p == '/') || (*p == '\\')) && (*(p-1) != ':'))
  1417. +             /* allow both '\' and '/' with  our new lib */
  1418. + #else
  1419.           if (*p == '/')
  1420. + #endif
  1421.             input_basename = p + 1;
  1422.   
  1423.         /* Find a suffix starting with the last period,
  1424. ***************
  1425. *** 3436,3441 ****
  1426. --- 3705,3711 ----
  1427.         int i;
  1428.         int first_time;
  1429.   
  1430. + #if (!(defined(atarist) || defined(CROSSATARI)))
  1431.         /* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
  1432.        for collect.  */
  1433.         putenv_from_prefixes (&exec_prefix, "COMPILER_PATH=");
  1434. ***************
  1435. *** 3466,3471 ****
  1436. --- 3736,3742 ----
  1437.       }
  1438.         obstack_grow (&collect_obstack, "\0", 1);
  1439.         putenv (obstack_finish (&collect_obstack));
  1440. + #endif
  1441.   
  1442.         value = do_spec (link_command_spec);
  1443.         if (value < 0)
  1444. *** 1.6    1992/11/07 04:57:45
  1445. --- getpwd.c    1992/11/08 00:49:15
  1446. ***************
  1447. *** 14,20 ****
  1448.      BSD systems) now provides getcwd as called for by POSIX.  Allow for
  1449.      the few exceptions to the general rule here.  */
  1450.   
  1451. ! #if !(defined (POSIX) || defined (USG) || defined (VMS))
  1452.   #include <sys/param.h>
  1453.   extern char *getwd ();
  1454.   #define getcwd(buf,len) getwd(buf)
  1455. --- 14,20 ----
  1456.      BSD systems) now provides getcwd as called for by POSIX.  Allow for
  1457.      the few exceptions to the general rule here.  */
  1458.   
  1459. ! #if !(defined (POSIX) || defined (USG) || defined (VMS) || defined(atarist) || defined(CROSSHPUX))
  1460.   #include <sys/param.h>
  1461.   extern char *getwd ();
  1462.   #define getcwd(buf,len) getwd(buf)
  1463. ***************
  1464. *** 48,58 ****
  1465.     if (!p && !(errno = failure_errno))
  1466.       {
  1467.         if (! ((p = getenv ("PWD")) != 0
  1468.            && *p == '/'
  1469.            && stat (p, &pwdstat) == 0
  1470.            && stat (".", &dotstat) == 0
  1471.            && dotstat.st_ino == pwdstat.st_ino
  1472. !          && dotstat.st_dev == pwdstat.st_dev))
  1473.   
  1474.       /* The shortcut didn't work.  Try the slow, ``sure'' way.  */
  1475.       for (s = GUESSPATHLEN;  ! getcwd (p = xmalloc (s), s);  s *= 2)
  1476. --- 48,61 ----
  1477.     if (!p && !(errno = failure_errno))
  1478.       {
  1479.         if (! ((p = getenv ("PWD")) != 0
  1480. + #ifndef atarist
  1481.            && *p == '/'
  1482.            && stat (p, &pwdstat) == 0
  1483.            && stat (".", &dotstat) == 0
  1484.            && dotstat.st_ino == pwdstat.st_ino
  1485. !          && dotstat.st_dev == pwdstat.st_dev
  1486. ! #endif
  1487. !          ))
  1488.   
  1489.       /* The shortcut didn't work.  Try the slow, ``sure'' way.  */
  1490.       for (s = GUESSPATHLEN;  ! getcwd (p = xmalloc (s), s);  s *= 2)
  1491. *** 1.13    1992/11/07 04:57:45
  1492. --- toplev.c    1992/11/08 00:50:00
  1493. ***************
  1494. *** 31,37 ****
  1495.   
  1496.   #include <sys/stat.h>
  1497.   
  1498. ! #ifdef USG
  1499.   #undef FLOAT
  1500.   #include <sys/param.h>
  1501.   /* This is for hpux.  It is a real screw.  They should change hpux.  */
  1502. --- 31,37 ----
  1503.   
  1504.   #include <sys/stat.h>
  1505.   
  1506. ! #if defined(USG) || defined(CROSSHPUX)
  1507.   #undef FLOAT
  1508.   #include <sys/param.h>
  1509.   /* This is for hpux.  It is a real screw.  They should change hpux.  */
  1510. ***************
  1511. *** 41,49 ****
  1512. --- 41,57 ----
  1513.   #undef FFS  /* Some systems define this in param.h.  */
  1514.   #else
  1515.   #ifndef VMS
  1516. + #if (!(defined(atarist) || defined(atariminix)))
  1517.   #include <sys/time.h>
  1518.   #include <sys/resource.h>
  1519. + #endif /* !(atarist || atariminix) */
  1520. + #endif
  1521.   #endif
  1522. + #ifdef atariminix
  1523. + #include <sys/times.h>
  1524. + /* #include <minix/const.h>, avoid dragging this in */
  1525. + #define HZ 60    /* this is the only thing needed from minix/const.h */
  1526.   #endif
  1527.   
  1528.   #include "input.h"
  1529. ***************
  1530. *** 57,62 ****
  1531. --- 65,75 ----
  1532.   #include "xcoffout.h"
  1533.   #endif
  1534.   
  1535. + #ifdef atarist
  1536. + long _stksize = -1L;    /* for all sizes of ST's */
  1537. +     /* -1 means malloc from own heap and keep all  of memory */
  1538. + #endif /* atarist */
  1539.   #ifdef VMS
  1540.   /* The extra parameters substantially improve the I/O performance.  */
  1541.   static FILE *
  1542. ***************
  1543. *** 739,745 ****
  1544.   int
  1545.   get_run_time ()
  1546.   {
  1547. ! #ifdef USG
  1548.     struct tms tms;
  1549.   #else
  1550.   #ifndef VMS
  1551. --- 752,761 ----
  1552.   int
  1553.   get_run_time ()
  1554.   {
  1555. ! #ifdef atarist
  1556. !   long now;
  1557. ! #else
  1558. ! #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
  1559.     struct tms tms;
  1560.   #else
  1561.   #ifndef VMS
  1562. ***************
  1563. *** 754,764 ****
  1564.       } vms_times;
  1565.   #endif
  1566.   #endif
  1567.   
  1568.     if (quiet_flag)
  1569.       return 0;
  1570.   
  1571. ! #ifdef USG
  1572.     times (&tms);
  1573.     return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  1574.   #else
  1575. --- 770,784 ----
  1576.       } vms_times;
  1577.   #endif
  1578.   #endif
  1579. + #endif
  1580.   
  1581.     if (quiet_flag)
  1582.       return 0;
  1583.   
  1584. ! #ifdef atarist
  1585. !   return(time(NULL) * 1000000);
  1586. ! #else
  1587. ! #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
  1588.     times (&tms);
  1589.     return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  1590.   #else
  1591. ***************
  1592. *** 771,776 ****
  1593. --- 791,797 ----
  1594.     return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
  1595.   #endif
  1596.   #endif
  1597. + #endif
  1598.   }
  1599.   
  1600.   #define TIMEVAR(VAR, BODY)    \
  1601. ***************
  1602. *** 1407,1412 ****
  1603. --- 1428,1434 ----
  1604.     longjmp (float_handler, 1);
  1605.   }
  1606.   
  1607. + #ifndef atarist
  1608.   /* Handler for SIGPIPE.  */
  1609.   
  1610.   static void
  1611. ***************
  1612. *** 1416,1421 ****
  1613. --- 1438,1444 ----
  1614.   {
  1615.     fatal ("output pipe has been closed");
  1616.   }
  1617. + #endif
  1618.   
  1619.   /* Strip off a legitimate source ending from the input string NAME of
  1620.      length LEN. */
  1621. ***************
  1622. *** 1447,1452 ****
  1623. --- 1470,1476 ----
  1624.       name[len - 4] = 0;
  1625.   }
  1626.   
  1627. + #ifdef SYSV
  1628.   /* Output a file name in the form wanted by System V.  */
  1629.   
  1630.   void
  1631. ***************
  1632. *** 1475,1480 ****
  1633. --- 1499,1505 ----
  1634.   #endif
  1635.   #endif
  1636.   }
  1637. + #endif
  1638.   
  1639.   /* Compile an entire file of output from cpp, named NAME.
  1640.      Write a file of assembly output and various debugging dumps.  */
  1641. ***************
  1642. *** 1574,1580 ****
  1643. --- 1599,1609 ----
  1644.       {
  1645.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1646.         strcpy (dumpname, dump_base_name);
  1647. + #ifndef atarist
  1648.         strcat (dumpname, ".jump");
  1649. + #else
  1650. +       strcat (dumpname, ".jmp");
  1651. + #endif
  1652.         jump_opt_dump_file = fopen (dumpname, "w");
  1653.         if (jump_opt_dump_file == 0)
  1654.       pfatal_with_name (dumpname);
  1655. ***************
  1656. *** 1596,1602 ****
  1657. --- 1625,1635 ----
  1658.       {
  1659.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1660.         strcpy (dumpname, dump_base_name);
  1661. + #ifndef atarist
  1662.         strcat (dumpname, ".loop");
  1663. + #else
  1664. +       strcat (dumpname, ".lop");
  1665. + #endif
  1666.         loop_dump_file = fopen (dumpname, "w");
  1667.         if (loop_dump_file == 0)
  1668.       pfatal_with_name (dumpname);
  1669. ***************
  1670. *** 1607,1613 ****
  1671. --- 1640,1650 ----
  1672.       {
  1673.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1674.         strcpy (dumpname, dump_base_name);
  1675. + #ifndef atarist
  1676.         strcat (dumpname, ".cse2");
  1677. + #else
  1678. +       strcat (dumpname, ".cs2");
  1679. + #endif
  1680.         cse2_dump_file = fopen (dumpname, "w");
  1681.         if (cse2_dump_file == 0)
  1682.       pfatal_with_name (dumpname);
  1683. ***************
  1684. *** 1618,1624 ****
  1685. --- 1655,1665 ----
  1686.       {
  1687.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1688.         strcpy (dumpname, dump_base_name);
  1689. + #ifndef atarist
  1690.         strcat (dumpname, ".flow");
  1691. + #else
  1692. +       strcat (dumpname, ".flo");
  1693. + #endif
  1694.         flow_dump_file = fopen (dumpname, "w");
  1695.         if (flow_dump_file == 0)
  1696.       pfatal_with_name (dumpname);
  1697. ***************
  1698. *** 1629,1635 ****
  1699. --- 1670,1680 ----
  1700.       {
  1701.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
  1702.         strcpy (dumpname, dump_base_name);
  1703. + #ifndef atarist
  1704.         strcat (dumpname, ".combine");
  1705. + #else
  1706. +       strcat (dumpname, ".cmb");
  1707. + #endif
  1708.         combine_dump_file = fopen (dumpname, "w");
  1709.         if (combine_dump_file == 0)
  1710.       pfatal_with_name (dumpname);
  1711. ***************
  1712. *** 1640,1646 ****
  1713. --- 1685,1695 ----
  1714.       {
  1715.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
  1716.         strcpy (dumpname, dump_base_name);
  1717. + #ifndef atarist
  1718.         strcat (dumpname, ".sched");
  1719. + #else
  1720. +       strcat (dumpname, ".sch");
  1721. + #endif
  1722.         sched_dump_file = fopen (dumpname, "w");
  1723.         if (sched_dump_file == 0)
  1724.       pfatal_with_name (dumpname);
  1725. ***************
  1726. *** 1651,1657 ****
  1727. --- 1700,1710 ----
  1728.       {
  1729.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1730.         strcpy (dumpname, dump_base_name);
  1731. + #ifndef atarist
  1732.         strcat (dumpname, ".lreg");
  1733. + #else
  1734. +       strcat (dumpname, ".lrg");
  1735. + #endif
  1736.         local_reg_dump_file = fopen (dumpname, "w");
  1737.         if (local_reg_dump_file == 0)
  1738.       pfatal_with_name (dumpname);
  1739. ***************
  1740. *** 1662,1668 ****
  1741. --- 1715,1725 ----
  1742.       {
  1743.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1744.         strcpy (dumpname, dump_base_name);
  1745. + #ifndef atarist
  1746.         strcat (dumpname, ".greg");
  1747. + #else
  1748. +       strcat (dumpname, ".grg");
  1749. + #endif
  1750.         global_reg_dump_file = fopen (dumpname, "w");
  1751.         if (global_reg_dump_file == 0)
  1752.       pfatal_with_name (dumpname);
  1753. ***************
  1754. *** 1673,1679 ****
  1755. --- 1730,1740 ----
  1756.       {
  1757.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 8);
  1758.         strcpy (dumpname, dump_base_name);
  1759. + #ifndef atarist
  1760.         strcat (dumpname, ".sched2");
  1761. + #else
  1762. +       strcat (dumpname, ".sc2");
  1763. + #endif
  1764.         sched2_dump_file = fopen (dumpname, "w");
  1765.         if (sched2_dump_file == 0)
  1766.       pfatal_with_name (dumpname);
  1767. ***************
  1768. *** 1684,1690 ****
  1769. --- 1745,1755 ----
  1770.       {
  1771.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
  1772.         strcpy (dumpname, dump_base_name);
  1773. + #ifndef atarist
  1774.         strcat (dumpname, ".jump2");
  1775. + #else
  1776. +       strcat (dumpname, ".jp2");
  1777. + #endif
  1778.         jump2_opt_dump_file = fopen (dumpname, "w");
  1779.         if (jump2_opt_dump_file == 0)
  1780.       pfatal_with_name (dumpname);
  1781. ***************
  1782. *** 1708,1714 ****
  1783. --- 1773,1783 ----
  1784.       {
  1785.         register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
  1786.         strcpy (dumpname, dump_base_name);
  1787. + #ifndef atarist
  1788.         strcat (dumpname, ".stack");
  1789. + #else
  1790. +       strcat (dumpname, ".stk");
  1791. + #endif
  1792.         stack_reg_dump_file = fopen (dumpname, "w");
  1793.         if (stack_reg_dump_file == 0)
  1794.       pfatal_with_name (dumpname);
  1795. ***************
  1796. *** 2749,2760 ****
  1797. --- 2818,2839 ----
  1798.     int version_flag = 0;
  1799.     char *p;
  1800.   
  1801. + #ifdef atarist
  1802. + /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
  1803. + /*  _malloczero(1); */     /* zero mallocs by default */
  1804. + #endif  
  1805.     /* save in case md file wants to emit args as a comment.  */
  1806.     save_argc = argc;
  1807.     save_argv = argv;
  1808.   
  1809.     p = argv[0] + strlen (argv[0]);
  1810. + #ifndef atarist
  1811.     while (p != argv[0] && p[-1] != '/') --p;
  1812. + #else
  1813. +   while (p != argv[0] && ((p[-1] != '/') && (p[-1] != '\\') &&
  1814. +               (p[-1] != ':'))) --p;
  1815. + #endif
  1816.     progname = p;
  1817.   
  1818.   #ifdef RLIMIT_STACK
  1819. ***************
  1820. *** 2771,2777 ****
  1821. --- 2850,2858 ----
  1822.   
  1823.     signal (SIGFPE, float_signal);
  1824.   
  1825. + #ifndef atarist
  1826.     signal (SIGPIPE, pipe_closed);
  1827. + #endif
  1828.   
  1829.     decl_printable_name = decl_name;
  1830.     lang_expand_expr = (struct rtx_def *(*)()) do_abort;
  1831. ***************
  1832. *** 2869,2874 ****
  1833. --- 2950,2965 ----
  1834.         else if (!strcmp (str, "dumpbase"))
  1835.           {
  1836.             dump_base_name = argv[++i];
  1837. + #ifdef atarist
  1838. + /* dump_base_name will typically be 'foo.c' here.  Need to truncate at the '.',
  1839. +    cause dots mean something here */
  1840. +         {
  1841. +           char * n = dump_base_name;
  1842. +           for ( ; ((*n) && (*n != '.')) ; )
  1843. +         n++;
  1844. +           *n = '\0';
  1845. +         }
  1846. + #endif
  1847.           }
  1848.         else if (str[0] == 'd')
  1849.           {
  1850. ***************
  1851. *** 3261,3267 ****
  1852. --- 3352,3364 ----
  1853.        option flags in use.  */
  1854.     if (version_flag)
  1855.       {
  1856. + #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  1857. + #include "PatchLev.h"
  1858. +         fprintf (stderr, "%s version %s-atariST Patchlevel %s",
  1859. +          language_string, version_string, PatchLevel);
  1860. + #else
  1861.         fprintf (stderr, "%s version %s", language_string, version_string);
  1862. + #endif
  1863.   #ifdef TARGET_VERSION
  1864.         TARGET_VERSION;
  1865.   #endif
  1866. ***************
  1867. *** 3282,3287 ****
  1868. --- 3379,3386 ----
  1869.   
  1870.     compile_file (filename);
  1871.   
  1872. + #if (!(defined(atarist) || defined(atariminix)))
  1873. + #if (!(defined(CROSSHPUX)))
  1874.   #ifndef OS2
  1875.   #ifndef VMS
  1876.     if (flag_print_mem)
  1877. ***************
  1878. *** 3300,3305 ****
  1879. --- 3399,3406 ----
  1880.       }
  1881.   #endif /* not VMS */
  1882.   #endif /* not OS2 */
  1883. + #endif
  1884. + #endif
  1885.   
  1886.     if (errorcount)
  1887.       exit (FATAL_EXIT_CODE);
  1888. ***************
  1889. *** 3411,3413 ****
  1890. --- 3512,3545 ----
  1891.   
  1892.     fprintf (stderr, "\n");
  1893.   }
  1894. + #ifdef atarist
  1895. + void atari_output_filename(file, filename)
  1896. + FILE *file;
  1897. + char *filename;
  1898. + {
  1899. +     if( (!file) || (!filename) ) return;
  1900. +     for(; *filename; filename++)
  1901. +     {
  1902. +     if(*filename == '\\') putc('\\', file);
  1903. +     putc(*filename, file);
  1904. +     }
  1905. + }
  1906. + #include <string.h>
  1907. + char *atari_filename_nondirectory(p)
  1908. + char *p;
  1909. + {
  1910. +     char *s;
  1911. +     
  1912. +     for(s = p + strlen(p); s != p; --s)
  1913. +     {
  1914. +     if((*s == '/') || (*s == '\\'))
  1915. +         break;
  1916. +     }
  1917. +     
  1918. +     return (s == p) ? p : s+1;
  1919. + }
  1920. + #endif
  1921. *** 1.5    1992/11/07 04:57:45
  1922. --- varasm.c    1992/11/08 00:50:05
  1923. ***************
  1924. *** 978,991 ****
  1925.   assemble_external_libcall (fun)
  1926.        rtx fun;
  1927.   {
  1928. - #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
  1929.     /* Declare library function name external when first used, if nec.  */
  1930.     if (! SYMBOL_REF_USED (fun))
  1931.       {
  1932.         SYMBOL_REF_USED (fun) = 1;
  1933.         ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
  1934. -     }
  1935.   #endif
  1936.   }
  1937.   
  1938.   /* Declare the label NAME global.  */
  1939. --- 978,991 ----
  1940.   assemble_external_libcall (fun)
  1941.        rtx fun;
  1942.   {
  1943.     /* Declare library function name external when first used, if nec.  */
  1944.     if (! SYMBOL_REF_USED (fun))
  1945.       {
  1946.         SYMBOL_REF_USED (fun) = 1;
  1947. + #ifdef ASM_OUTPUT_EXTERNAL_LIBCALL
  1948.         ASM_OUTPUT_EXTERNAL_LIBCALL (asm_out_file, fun);
  1949.   #endif
  1950. +     }
  1951.   }
  1952.   
  1953.   /* Declare the label NAME global.  */
  1954. *** 1.4    1992/11/07 05:03:40
  1955. --- m68k.c    1992/11/08 00:54:49
  1956. ***************
  1957. *** 60,66 ****
  1958.      
  1959.   finalize_pic ()
  1960.   {
  1961. !   if (flag_pic && current_function_uses_pic_offset_table)
  1962.       emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
  1963.   }
  1964.   
  1965. --- 60,66 ----
  1966.      
  1967.   finalize_pic ()
  1968.   {
  1969. !   if (flag_pic && (flag_pic < 3) && current_function_uses_pic_offset_table)
  1970.       emit_insn (gen_rtx (USE, VOIDmode, pic_offset_table_rtx));
  1971.   }
  1972.   
  1973. ***************
  1974. *** 213,219 ****
  1975.         asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@-\n", mask);
  1976.   #endif
  1977.       }
  1978. !   if (flag_pic && current_function_uses_pic_offset_table)
  1979.       {
  1980.   #ifdef MOTOROLA
  1981.         asm_fprintf (stream, "\t%Omove.l %0I__GLOBAL_OFFSET_TABLE_, %s\n",
  1982. --- 213,219 ----
  1983.         asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@-\n", mask);
  1984.   #endif
  1985.       }
  1986. !   if (flag_pic && (flag_pic < 3) && current_function_uses_pic_offset_table)
  1987.       {
  1988.   #ifdef MOTOROLA
  1989.         asm_fprintf (stream, "\t%Omove.l %0I__GLOBAL_OFFSET_TABLE_, %s\n",
  1990. ***************
  1991. *** 803,814 ****
  1992.     /* First handle a simple SYMBOL_REF or LABEL_REF */
  1993.     if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
  1994.       {
  1995.         if (reg == 0)
  1996.       abort ();
  1997.   
  1998. !       pic_ref = gen_rtx (MEM, Pmode,
  1999. !              gen_rtx (PLUS, Pmode,
  2000. !                   pic_offset_table_rtx, orig));
  2001.         current_function_uses_pic_offset_table = 1;
  2002.         RTX_UNCHANGING_P (pic_ref) = 1;
  2003.         emit_move_insn (reg, pic_ref);
  2004. --- 803,822 ----
  2005.     /* First handle a simple SYMBOL_REF or LABEL_REF */
  2006.     if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
  2007.       {
  2008. + #ifdef LEGITIMATE_BASEREL_OPERAND_P
  2009. +   if (LEGITIMATE_BASEREL_OPERAND_P (orig))
  2010. +     return orig;
  2011. + #endif
  2012.         if (reg == 0)
  2013.       abort ();
  2014.   
  2015. !       if (flag_pic == 3)
  2016. !         pic_ref = gen_rtx (PLUS, Pmode, pic_offset_table_rtx, orig);
  2017. !       else
  2018. !         pic_ref = gen_rtx (MEM, Pmode,
  2019. !                gen_rtx (PLUS, Pmode,
  2020. !                     pic_offset_table_rtx, orig));
  2021.         current_function_uses_pic_offset_table = 1;
  2022.         RTX_UNCHANGING_P (pic_ref) = 1;
  2023.         emit_move_insn (reg, pic_ref);
  2024. ***************
  2025. *** 840,845 ****
  2026. --- 848,854 ----
  2027.         pic_ref = gen_rtx (PLUS, Pmode, base, orig);
  2028.         /* Likewise, should we set special REG_NOTEs here?  */
  2029.       }
  2030.     return pic_ref;
  2031.   }
  2032.   
  2033. ***************
  2034. *** 1582,1587 ****
  2035. --- 1591,1599 ----
  2036.         output_address (XEXP (op, 0));
  2037.         if (letter == 'd' && ! TARGET_68020
  2038.         && CONSTANT_ADDRESS_P (XEXP (op, 0))
  2039. +       && !(TARGET_PC_REL && GET_CODE (XEXP (op, 0)) == SYMBOL_REF
  2040. +            && SYMBOL_REF_FLAG (XEXP (op, 0))
  2041. +            && !SYMBOL_REF_USED (XEXP (op, 0)))
  2042.         && !(GET_CODE (XEXP (op, 0)) == CONST_INT
  2043.              && INTVAL (XEXP (op, 0)) < 0x8000
  2044.              && INTVAL (XEXP (op, 0)) >= -0x8000))
  2045. ***************
  2046. *** 1887,1892 ****
  2047. --- 1899,1906 ----
  2048.                 fprintf (file, ":w");
  2049.               if ((flag_pic == 2) && (breg == pic_offset_table_rtx))
  2050.                 fprintf (file, ":l");
  2051. +             if ((flag_pic == 3) && (breg == pic_offset_table_rtx))
  2052. +               fprintf (file, ":W");
  2053.             }
  2054.           if (addr != 0 && ireg != 0)
  2055.             {
  2056. ***************
  2057. *** 1964,1969 ****
  2058. --- 1978,1996 ----
  2059.           fprintf (file, "%d:w", INTVAL (addr));
  2060.   #endif
  2061.         }
  2062. +     else if (TARGET_PC_REL && GET_CODE (addr) == SYMBOL_REF
  2063. +          && SYMBOL_REF_FLAG (addr)
  2064. +          && !SYMBOL_REF_USED (addr))
  2065. +       {
  2066. + #ifdef MOTOROLA
  2067. +         output_addr_const (file, addr);
  2068. +         fputs ("(pc)", file);
  2069. + #else
  2070. +         fputs ("pc@(", file);
  2071. +         output_addr_const (file, addr);
  2072. +         putc (')', file);
  2073. + #endif
  2074. +       }
  2075.       else
  2076.         {
  2077.           output_addr_const (file, addr);
  2078. ***************
  2079. *** 1971,1973 ****
  2080. --- 1998,2015 ----
  2081.       break;
  2082.       }
  2083.   }
  2084. + #ifdef ENCODE_SECTION_INFO
  2085. + /* Does operand (which is a symbolic_operand) live in text space? If
  2086. +    so SYMBOL_REF_FLAG, which is set by ENCODE_SECTION_INFO, will be true.*/
  2087. + int
  2088. + read_only_operand (operand)
  2089. +      rtx operand;
  2090. + {
  2091. +   if (GET_CODE (operand) == CONST)
  2092. +     operand = XEXP (XEXP (operand, 0), 0);
  2093. +   if (GET_CODE (operand) == SYMBOL_REF)
  2094. +     return SYMBOL_REF_FLAG (operand) || CONSTANT_POOL_ADDRESS_P (operand);
  2095. +   return 1;
  2096. + }
  2097. + #endif
  2098. *** 1.6    1992/11/07 05:03:40
  2099. --- m68k.h    1992/11/08 00:54:49
  2100. ***************
  2101. *** 92,97 ****
  2102. --- 92,103 ----
  2103.   /* Use the 68040-only fp instructions (-m68040).  */
  2104.   #define TARGET_68040_ONLY (target_flags & 01000)
  2105.   
  2106. + /* Use PC-relative addressing for refs to read-only data */
  2107. + #define TARGET_PC_REL (target_flags & 02000)
  2108. + /* Use base-relative addressing for refs to data&bss segments */
  2109. + #define TARGET_BASE_REL (target_flags & 04000)
  2110.   /* Macro to define tables used to set the flags.
  2111.      This is a list in braces of pairs in braces,
  2112.      each pair being { "NAME", VALUE }
  2113. ***************
  2114. *** 119,124 ****
  2115. --- 125,134 ----
  2116.       { "68030", -01400},                \
  2117.       { "68030", 7},                \
  2118.       { "68040", 01007},            \
  2119. +     { "pcrel", 02000},                \
  2120. +     { "nopcrel", -02000},            \
  2121. +     { "baserel", 04000},            \
  2122. +     { "nobaserel", -04000},            \
  2123.       { "", TARGET_DEFAULT}}
  2124.   /* TARGET_DEFAULT is defined in sun*.h and isi.h, etc.  */
  2125.   
  2126. ***************
  2127. *** 130,135 ****
  2128. --- 140,146 ----
  2129.     if (TARGET_FPA) target_flags &= ~2;    \
  2130.     if (! TARGET_68020 && flag_pic == 2)    \
  2131.       error("-fPIC is not currently supported on the 68000 or 68010\n");    \
  2132. +   if (TARGET_BASE_REL) flag_pic = 3;    \
  2133.   }
  2134.   #else
  2135.   #define OVERRIDE_OPTIONS        \
  2136. ***************
  2137. *** 136,141 ****
  2138. --- 147,153 ----
  2139.   {                    \
  2140.     if (! TARGET_68020 && flag_pic == 2)    \
  2141.       error("-fPIC is not currently supported on the 68000 or 68010\n");    \
  2142. +   if (TARGET_BASE_REL) flag_pic = 3;    \
  2143.   }
  2144.   #endif /* defined SUPPORT_SUN_FPA */
  2145.   
  2146. ***************
  2147. *** 327,335 ****
  2148.   #ifndef SUPPORT_SUN_FPA
  2149.   
  2150.   #define CONDITIONAL_REGISTER_USAGE \
  2151. ! {                                               \
  2152. !   if (flag_pic)                                 \
  2153. !     fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;    \
  2154.   }
  2155.   
  2156.   #else /* defined SUPPORT_SUN_FPA */
  2157. --- 339,350 ----
  2158.   #ifndef SUPPORT_SUN_FPA
  2159.   
  2160.   #define CONDITIONAL_REGISTER_USAGE \
  2161. ! {                                                \
  2162. !   if (flag_pic)                                  \
  2163. !     fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;     \
  2164. !   /* prevent saving/restoring of the base reg */ \
  2165. !   if (flag_pic == 3)                 \
  2166. !     call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1; \
  2167.   }
  2168.   
  2169.   #else /* defined SUPPORT_SUN_FPA */
  2170. ***************
  2171. *** 1111,1116 ****
  2172. --- 1126,1133 ----
  2173.          && REG_P (XEXP (X, 0)) && REG_OK_FOR_BASE_P (XEXP (X, 0))    \
  2174.          && GET_CODE (XEXP (X, 1)) == CONST_INT                \
  2175.          && ((unsigned) INTVAL (XEXP (X, 1)) + 0x8000) < 0x10000)        \
  2176. +    || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx     \
  2177. +        && flag_pic == 3 && CONSTANT_ADDRESS_P (XEXP (X, 1)))        \
  2178.      || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx     \
  2179.          && flag_pic && GET_CODE (XEXP (X, 1)) == SYMBOL_REF)        \
  2180.      || (GET_CODE (X) == PLUS && XEXP (X, 0) == pic_offset_table_rtx     \
  2181. *** 1.5    1992/11/07 05:03:40
  2182. --- m68k.md    1992/11/08 00:54:50
  2183. ***************
  2184. *** 704,716 ****
  2185.   {
  2186.     if (flag_pic && symbolic_operand (operands[1], SImode)) 
  2187.       {
  2188. !       /* The source is an address which requires PIC relocation.  
  2189. !          Call legitimize_pic_address with the source, mode, and a relocation
  2190. !          register (a new pseudo, or the final destination if reload_in_progress
  2191. !          is set).   Then fall through normally */
  2192. !       extern rtx legitimize_pic_address();
  2193. !       rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
  2194. !       operands[1] = legitimize_pic_address (operands[1], SImode, temp);
  2195.       }
  2196.   }")
  2197.   
  2198. --- 704,721 ----
  2199.   {
  2200.     if (flag_pic && symbolic_operand (operands[1], SImode)) 
  2201.       {
  2202. ! #ifdef LEGITIMATE_BASEREL_OPERAND_P
  2203. !       if (flag_pic != 3 || !LEGITIMATE_BASEREL_OPERAND_P (operands[1]))
  2204. ! #endif
  2205. !       {
  2206. !         /* The source is an address which requires PIC relocation.  
  2207. !            Call legitimize_pic_address with the source, mode, and a relocation
  2208. !            register (a new pseudo, or the final destination if reload_in_progress
  2209. !            is set).   Then fall through normally */
  2210. !         extern rtx legitimize_pic_address();
  2211. !         rtx temp = reload_in_progress ? operands[0] : gen_reg_rtx (Pmode);
  2212. !         operands[1] = legitimize_pic_address (operands[1], SImode, temp);
  2213. !       }
  2214.       }
  2215.   }")
  2216.   
  2217. ***************
  2218. *** 4651,4657 ****
  2219.     ""
  2220.     "
  2221.   {
  2222. !   if (flag_pic && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  2223.       operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  2224.                  force_reg (Pmode, XEXP (operands[0], 0)));
  2225.   }")
  2226. --- 4656,4662 ----
  2227.     ""
  2228.     "
  2229.   {
  2230. !   if (flag_pic && flag_pic < 3 && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  2231.       operands[0] = gen_rtx (MEM, GET_MODE (operands[0]),
  2232.                  force_reg (Pmode, XEXP (operands[0], 0)));
  2233.   }")
  2234. ***************
  2235. *** 4662,4668 ****
  2236.        (match_operand:SI 1 "general_operand" "g"))]
  2237.     ;; Operand 1 not really used on the m68000.
  2238.   
  2239. !   "! flag_pic"
  2240.     "*
  2241.   #ifdef MOTOROLA
  2242.     return \"jsr %0\";
  2243. --- 4667,4673 ----
  2244.        (match_operand:SI 1 "general_operand" "g"))]
  2245.     ;; Operand 1 not really used on the m68000.
  2246.   
  2247. !   "(! flag_pic || flag_pic == 3)"
  2248.     "*
  2249.   #ifdef MOTOROLA
  2250.     return \"jsr %0\";
  2251. ***************
  2252. *** 4677,4683 ****
  2253.        (match_operand:SI 1 "general_operand" "g"))]
  2254.     ;; Operand 1 not really used on the m68000.
  2255.   
  2256. !   "flag_pic"
  2257.     "*
  2258.     return \"jsr %0\";
  2259.   ")
  2260. --- 4682,4688 ----
  2261.        (match_operand:SI 1 "general_operand" "g"))]
  2262.     ;; Operand 1 not really used on the m68000.
  2263.   
  2264. !   "(flag_pic && flag_pic < 3)"
  2265.     "*
  2266.     return \"jsr %0\";
  2267.   ")
  2268. ***************
  2269. *** 4693,4699 ****
  2270.     ""
  2271.     "
  2272.   {
  2273. !   if (flag_pic && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  2274.       operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
  2275.                  force_reg (Pmode, XEXP (operands[1], 0)));
  2276.   }")
  2277. --- 4698,4704 ----
  2278.     ""
  2279.     "
  2280.   {
  2281. !   if (flag_pic && flag_pic < 3 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  2282.       operands[1] = gen_rtx (MEM, GET_MODE (operands[1]),
  2283.                  force_reg (Pmode, XEXP (operands[1], 0)));
  2284.   }")
  2285. ***************
  2286. *** 4704,4710 ****
  2287.       (call (match_operand:QI 1 "memory_operand" "o")
  2288.             (match_operand:SI 2 "general_operand" "g")))]
  2289.     ;; Operand 2 not really used on the m68000.
  2290. !   "! flag_pic"
  2291.     "*
  2292.   #ifdef MOTOROLA
  2293.     return \"jsr %1\";
  2294. --- 4709,4715 ----
  2295.       (call (match_operand:QI 1 "memory_operand" "o")
  2296.             (match_operand:SI 2 "general_operand" "g")))]
  2297.     ;; Operand 2 not really used on the m68000.
  2298. !   "(! flag_pic || flag_pic == 3)"
  2299.     "*
  2300.   #ifdef MOTOROLA
  2301.     return \"jsr %1\";
  2302. ***************
  2303. *** 4719,4725 ****
  2304.       (call (match_operand:QI 1 "memory_operand" "o")
  2305.             (match_operand:SI 2 "general_operand" "g")))]
  2306.     ;; Operand 2 not really used on the m68000.
  2307. !   "flag_pic"
  2308.     "*
  2309.     return \"jsr %1\";
  2310.   ")
  2311. --- 4724,4730 ----
  2312.       (call (match_operand:QI 1 "memory_operand" "o")
  2313.             (match_operand:SI 2 "general_operand" "g")))]
  2314.     ;; Operand 2 not really used on the m68000.
  2315. !   "(flag_pic && flag_pic < 3)"
  2316.     "*
  2317.     return \"jsr %1\";
  2318.   ")
  2319.