home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / utility / text / emacsdif.lha / emacs-18.58 / cpp-diffs < prev    next >
Encoding:
Text File  |  1992-05-17  |  7.7 KB  |  317 lines

  1. diff -C 3 emacs-18.58/cpp/cccp.c gnuemacs:cpp/cccp.c
  2. *** emacs-18.58/cpp/cccp.c    Sun May 03 14:46:13 1992
  3. --- gnuemacs:cpp/cccp.c    Sun May 03 14:34:10 1992
  4. ***************
  5. *** 97,103 ****
  6. --- 97,116 ----
  7.   
  8.   #ifdef EMACS
  9.   #define NO_SHORTNAMES
  10. + #ifdef AMIGA
  11. + #include "/src/config.h"
  12. + #undef free
  13. + #undef malloc
  14. + #undef calloc
  15. + #undef realloc
  16. + #undef fflush
  17. + #undef fwrite
  18. + #define fflush(fp) _flsbf(-1,fp)
  19. + #define rindex strrchr
  20. + #undef AMIGA_DUMP
  21. + #else
  22.   #include "../src/config.h"
  23. + #endif
  24.   #ifdef static
  25.   #undef static
  26.   #endif
  27. ***************
  28. *** 115,121 ****
  29. --- 128,138 ----
  30.   #include <ctype.h>
  31.   #include <stdio.h>
  32.   #ifndef USG
  33. + #ifdef AMIGA
  34. + #include <time.h>
  35. + #else
  36.   #include <sys/time.h>        /* for __DATE__ and __TIME__ */
  37. + #endif
  38.   #else
  39.   #define index strchr
  40.   #define rindex strrchr
  41. ***************
  42. *** 123,130 ****
  43. --- 140,149 ----
  44.   #include <fcntl.h>
  45.   #endif /* USG */
  46.   
  47. + #ifndef AMIGA
  48.   void bcopy (), bzero ();
  49.   int bcmp ();
  50. + #endif
  51.   
  52.   char *xmalloc (), *xrealloc (), *xcalloc ();
  53.   void fatal (), pfatal_with_name (), perror_with_name ();
  54. ***************
  55. *** 142,156 ****
  56. --- 161,189 ----
  57.   /* #include "file" starts with the first entry in the stack */
  58.   /* #include <file> starts with the second. */
  59.   /* -I directories are added after the first */
  60. + #ifdef AMIGA
  61.   struct directory_stack default_includes[2] =
  62.     {
  63. +     { &default_includes[1], "" },
  64. +     { 0, "cpp-include:" }
  65. +   };
  66. + #else
  67. + struct directory_stack default_includes[2] =
  68. +   {
  69.       { &default_includes[1], "." },
  70.       { 0, "/usr/include" }
  71.     };
  72. + #endif
  73.   struct directory_stack *include = &default_includes[0];
  74.   
  75. + #ifdef AMIGA
  76.   int max_include_len = 14;    /* strlen (default_include) + 2
  77.                               (for / and null) */
  78. + #else
  79. + int max_include_len = 9;    /* strlen (default_include) + 1
  80. +                             (for null) */
  81. + #endif
  82.   
  83.   char STDIN_FILE[] = "";        /* Empty, like real cpp */
  84.   int put_out_comments = 0;    /* JF non-zero means leave comments in the
  85. ***************
  86. *** 379,385 ****
  87.       dirtmp->next = include->next;
  88.       include->next = dirtmp;
  89.       dirtmp->fname = argv[i]+2;
  90. -     include = dirtmp;
  91.       if (strlen (argv[i]) > max_include_len)
  92.         max_include_len = strlen (argv[i]);
  93.       break;
  94. --- 412,417 ----
  95. ***************
  96. *** 405,411 ****
  97. --- 437,447 ----
  98.     else if ((f = open (in_fname, O_RDONLY)) < 0)
  99.       goto perror;
  100.   
  101. + #ifdef AMIGA
  102. +   stat (in_fname, &sbuf);
  103. + #else
  104.     fstat (f, &sbuf);
  105. + #endif
  106.     fp->fname = in_fname;
  107.     fp->lineno = 1;
  108.     /* JF all this is mine about reading pipes and ttys */
  109. ***************
  110. *** 652,658 ****
  111.           register U_CHAR *p = hp->name;
  112.           register U_CHAR *q = op->bufp - i;
  113.   
  114. !         if (c != (U_CHAR) -1)
  115.             q--;
  116.   
  117.           do {        /* all this to avoid a strncmp() */
  118. --- 688,694 ----
  119.           register U_CHAR *p = hp->name;
  120.           register U_CHAR *q = op->bufp - i;
  121.   
  122. !         if (c != -1)
  123.             q--;
  124.   
  125.           do {        /* all this to avoid a strncmp() */
  126. ***************
  127. *** 663,669 ****
  128.           save_ibufp = ip->bufp;
  129.           /* back up over identifier, then expand token */
  130.           op->bufp -= ident_length;
  131. !         if (c != (U_CHAR) -1) op->bufp--;
  132.           macroexpand (hp, ip, op, &excess_newlines);
  133.   
  134.           check_expand(op, ip->length - (ip->bufp - ip->buf));
  135. --- 699,705 ----
  136.           save_ibufp = ip->bufp;
  137.           /* back up over identifier, then expand token */
  138.           op->bufp -= ident_length;
  139. !         if (c != -1) op->bufp--;
  140.           macroexpand (hp, ip, op, &excess_newlines);
  141.   
  142.           check_expand(op, ip->length - (ip->bufp - ip->buf));
  143. ***************
  144. *** 670,676 ****
  145.           
  146.           /* If we just processed an identifier at end of input,
  147.              return right away.  */
  148. !         if (c == (U_CHAR) -1)
  149.             return;
  150.   
  151.           /* if the expansion routine has not moved the input
  152. --- 706,712 ----
  153.   
  154.           /* If we just processed an identifier at end of input,
  155.              return right away.  */
  156. !         if (c == -1)
  157.             return;
  158.   
  159.           /* if the expansion routine has not moved the input
  160. ***************
  161. *** 978,984 ****
  162.     struct stat sbuf;        /* to stat the include file */
  163.     FILE_BUF *fp;    /* for input stack frame */
  164.     struct directory_stack *stackp;
  165. !   int flen;
  166.   
  167.     int save_indepth = indepth;
  168.                   /* in case of errors */
  169. --- 1014,1020 ----
  170.     struct stat sbuf;        /* to stat the include file */
  171.     FILE_BUF *fp;    /* for input stack frame */
  172.     struct directory_stack *stackp;
  173. !   int flen, maxlen;
  174.   
  175.     int save_indepth = indepth;
  176.                   /* in case of errors */
  177. ***************
  178. *** 1019,1025 ****
  179. --- 1055,1064 ----
  180.     if (err)
  181.       goto nope;
  182.   
  183. +   /* DG: This doesn't handle includes of aa:... on the Amiga */
  184. +   /* It doesn't seem worth it. */
  185.     other_dir = NULL;
  186. +   maxlen = max_include_len;
  187.     if (stackp == include)
  188.       {
  189.         fp = &instack[indepth];
  190. ***************
  191. *** 1037,1042 ****
  192. --- 1076,1082 ----
  193.             other_dir = (char *) alloca (n + 1);
  194.             strncpy (other_dir, nam, n);
  195.             other_dir[n] = '\0';
  196. +                   if (n + 4 > maxlen) maxlen = n + 4;
  197.           }
  198.             break;
  199.           }
  200. ***************
  201. *** 1043,1049 ****
  202.       }
  203.       }
  204.                 /* JF search directory path */
  205. !   fname = (char *) alloca (max_include_len + flen);
  206.     for (; stackp; stackp = stackp->next)
  207.       {
  208.         if (other_dir)
  209. --- 1083,1089 ----
  210.       }
  211.       }
  212.                 /* JF search directory path */
  213. !   fname = (char *) alloca (maxlen + flen);
  214.     for (; stackp; stackp = stackp->next)
  215.       {
  216.         if (other_dir)
  217. ***************
  218. *** 1053,1058 ****
  219. --- 1093,1102 ----
  220.       }
  221.         else
  222.       strcpy (fname, stackp->fname);
  223. + #ifdef AMIGA
  224. +       if (fname[0] != 0 && fname[strlen(fname) - 1] != ':')
  225. +       /* Don't add / after : or empty strings */
  226. + #endif
  227.         strcat (fname, "/");
  228.         strncat (fname, fbeg, flen);
  229.         if ((f = open (fname, O_RDONLY)) >= 0)
  230. ***************
  231. *** 1064,1070 ****
  232. --- 1108,1118 ----
  233.         goto nope;
  234.       }
  235.   
  236. + #ifdef AMIGA
  237. +   if (stat(fname, &sbuf) < 0)
  238. + #else
  239.     if (fstat(f, &sbuf) < 0)
  240. + #endif
  241.       {
  242.         perror_with_name (fname);
  243.         goto nope;        /* impossible? */
  244. ***************
  245. *** 1308,1314 ****
  246.   
  247.       if (is_idstart[*p] && (p==buf || !is_idchar[*(p-1)])) {
  248.   
  249. !       for (id_len = 0; is_idchar[p[id_len]]; id_len++)
  250.       ;
  251.         for (arg = arglist; arg != NULL; arg = arg->next) {
  252.       struct reflist *tpat;
  253. --- 1356,1362 ----
  254.   
  255.       if (is_idstart[*p] && (p==buf || !is_idchar[*(p-1)])) {
  256.   
  257. !       for (id_len = 0; p+id_len < buf+size && is_idchar[p[id_len]]; id_len++)
  258.       ;
  259.         for (arg = arglist; arg != NULL; arg = arg->next) {
  260.       struct reflist *tpat;
  261. ***************
  262. *** 1465,1470 ****
  263. --- 1513,1533 ----
  264.    * the behavior of the #pragma directive is implementation defined.
  265.    * this implementation defines it as follows.
  266.    */
  267. + #ifdef AMIGA
  268. + do_pragma(buf, limit, op, keyword)
  269. +      U_CHAR *buf, *limit;
  270. +      FILE_BUF *op;
  271. +      struct keyword_table *keyword;
  272. + {
  273. +     /* Just copy the pragma directibe back out */
  274. +     int len2 = limit - buf, len1 = sizeof("#pragma") - 1;
  275. +     check_expand(op, len1 + len2);
  276. +     bcopy("#pragma", op->bufp, len1);
  277. +     bcopy(buf, op->bufp + len1, len2);
  278. +     op->bufp += len1 + len2;
  279. + }
  280. + #else
  281.   do_pragma()
  282.   {
  283.     close (0);
  284. ***************
  285. *** 1479,1484 ****
  286. --- 1542,1548 ----
  287.   nope:
  288.     fatal ("You are in a maze of twisty compiler features, all different");
  289.   }
  290. + #endif
  291.   
  292.   typedef struct if_stack {
  293.     struct if_stack *next;    /* for chaining to the next stack frame */
  294. ***************
  295. *** 2084,2092 ****
  296.       }
  297.   
  298.     if (ip != NULL)
  299. !     fprintf(stdout, "file %s, offset %d (line %d): ",
  300.           ip->fname, ip->bufp - ip->buf, ip->lineno);
  301. !   fprintf(stdout, "%s\n", msg);
  302.     return 0;
  303.   }
  304.   
  305. --- 2148,2156 ----
  306.       }
  307.   
  308.     if (ip != NULL)
  309. !     fprintf(stderr, "file %s, offset %d (line %d): ",
  310.           ip->fname, ip->bufp - ip->buf, ip->lineno);
  311. !   fprintf(stderr, "%s\n", msg);
  312.     return 0;
  313.   }
  314.   
  315.