home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / GOFER2,03aBugFix.LHA / Gofer230a / src / amiga230a.diffs next >
Encoding:
Text File  |  1994-09-04  |  11.8 KB  |  354 lines

  1. diff --context orig/cmachine.c amiga/cmachine.c
  2. *** orig/cmachine.c    Thu Jun 23 17:00:00 1994
  3. --- amiga/cmachine.c    Thu Sep 01 08:13:33 1994
  4. ***************
  5. *** 23,28 ****
  6. --- 23,30 ----
  7.   #else
  8.   #if     RISCOS
  9.   #define GOFC_INCLUDE "\"Lib:h.gofc\""
  10. + #elif   (S_AMISAS | R_AMISAS | L_AMISAS)
  11. + #define GOFC_INCLUDE  "\"gofc.h\""
  12.   #else
  13.   #define GOFC_INCLUDE  "\"/usr/local/lib/Gofer/gofc.h\""
  14.   #endif
  15. diff --context orig/commonui.c amiga/commonui.c
  16. *** orig/commonui.c    Thu Jun 23 17:00:00 1994
  17. --- amiga/commonui.c    Mon Aug 22 14:56:25 1994
  18. ***************
  19. *** 273,279 ****
  20.       }
  21.       else
  22.       for (charCount=0; *what; charCount++)
  23. !         putchar(*what++);
  24.       fflush(stdout);
  25.   }
  26.   
  27. --- 273,279 ----
  28.       }
  29.       else
  30.       for (charCount=0; *what; charCount++)
  31. !         fputc(*what++, stdout);
  32.       fflush(stdout);
  33.   }
  34.   
  35. diff --context orig/machdep.c amiga/machdep.c
  36. *** orig/machdep.c    Thu Jun 23 17:00:00 1994
  37. --- amiga/machdep.c    Sun Sep 04 21:25:42 1994
  38. ***************
  39. *** 58,63 ****
  40. --- 58,78 ----
  41.   #include <sys/stat.h>
  42.   #endif
  43.   
  44. + #if (S_AMISAS | R_AMISAS | L_AMISAS)
  45. + #include <exec/types.h>
  46. + #include <stdlib.h>
  47. + #include <stdio.h>
  48. + #include <signal.h>
  49. + #include <fcntl.h>
  50. + #include <sys/types.h>
  51. + #include <sys/stat.h>
  52. + #include <dos.h>
  53. + #ifndef MACHDEP_RUNTIME
  54. + __near long __stack = 25000L;
  55. + unsigned char amigabreak = 0;
  56. + #endif
  57. + #endif
  58.   /* --------------------------------------------------------------------------
  59.    * Machine dependent code is used in each of:
  60.    *    - The gofer interpreter        MACHDEP_GOFER
  61. ***************
  62. *** 355,364 ****
  63. --- 370,478 ----
  64.   static Bool terminalEchoReqd = TRUE;
  65.   
  66.   #if (MACHDEP_GOFER | MACHDEP_GOFC)
  67. + #if (S_AMISAS | R_AMISAS | L_AMISAS)
  68. + Int getTerminalWidth() {
  69. +     int lm, rm;
  70. +     int c;
  71. +     static char *nosizecheck = NULL;
  72. +     static int check = 1;
  73. +     /* If the environment variable GOFERNOWIDTH exists,
  74. +      * Gofer will abstain from trying to determine the
  75. +      * width of the ternminal.
  76. +      * Use it if you run Gofer from inside GNU Emacs;
  77. +      * the FIFO device used to communicate lies to both
  78. +      * isatty() and rawcon() and claims it is interactive.
  79. +      */
  80. +     if (check) {
  81. +         /* Only the first time getTerminalWidth() is called */        
  82. +         nosizecheck = getenv("GOFERNOWIDTH");
  83. +         check = 0;
  84. +     }
  85. +     if (!nosizecheck && isatty(fileno(stdin)) > 0 && rawcon(1) == 0) {
  86. +         printf("%c%s",0x9B,"0 q");    /* Request window size report. */
  87. +     /*
  88. +      * Now read the size report.
  89. +      * <CSI>1;1;<bottom>;<right>r
  90. +      */
  91. +     c = getchar();
  92. +     for (;;) {
  93. +             if (c != 0x9B) {        /* <CSI>                       */
  94. +                 c = getchar();
  95. +                 continue;
  96. +             }
  97. +             if (!isdigit(c = getchar()))
  98. +             continue;        /* Top margin (not used).      */
  99. +         while (isdigit(c = getchar()))
  100. +             ;
  101. +         if (c != ';')
  102. +                 continue;        /* ';' seperator.              */
  103. +         if (!isdigit(c = getchar()))
  104. +             continue;        /* Left margin.                */
  105. +             lm = c - '0';
  106. +             while (isdigit(c = getchar()))
  107. +                 lm = lm * 10 + c - '0';
  108. +             if (c != ';')
  109. +                 continue;        /* ';' seperator.              */
  110. +             if (!isdigit(c = getchar()))
  111. +                 continue;        /* Bottom margin (not used).   */
  112. +             while (isdigit(c = getchar()))
  113. +                 ;
  114. +             if (c != ';')
  115. +                 continue;        /* ';' seperator.              */
  116. +             if (!isdigit(c = getchar()))
  117. +                 continue;        /* Right margin.               */
  118. +             rm = c - '0';
  119. +             while (isdigit(c = getchar()))
  120. +                 rm = rm * 10 + c - '0';
  121. +             if (c != ' ')
  122. +                 continue;        /* " r" terminator.            */
  123. +             if ((c = getchar()) != 'r')
  124. +                 continue;
  125. +         break;
  126. +         }
  127. +         if (terminalEchoReqd) rawcon(0);
  128. +         return rm - lm + 1;
  129. +     }
  130. +     else
  131. +         return 77;            /* Anybody's guess...           */
  132. + }
  133. + #else
  134.   Int getTerminalWidth() {        /* PC screen is fixed 80 chars       */
  135.       return 80;
  136.   }
  137.   #endif
  138. + #endif
  139. + #if (S_AMISAS | R_AMISAS | L_AMISAS)
  140. + Void normalTerminal() {            /* restore terminal initial state  */
  141. +     terminalEchoReqd = TRUE;
  142. +     rawcon(0);
  143. + }
  144. + Void noechoTerminal() {            /* turn terminal echo on/off       */
  145. +     terminalEchoReqd = FALSE;
  146. +     rawcon(1);
  147. + }
  148. + Int readTerminalChar() {        /* read character from terminal       */
  149. +     Int c = getchar();
  150. +     /*
  151. +      * This circumvents a problem with
  152. +      * Gofer code like  'run (map toUpper)'
  153. +      */
  154. +     if (c == 3) {            /* Ctrl-C is swallowed raw        */
  155. +         normalTerminal();        /* turn echo on                   */
  156. +     raise(SIGINT);
  157. +     c = '\n';            /* is this reasonable?            */
  158. +     }
  159. +     return c=='\r' ? '\n' : c;
  160. + }
  161. + #else
  162.   
  163.   Void normalTerminal() {            /* restore terminal initial state  */
  164.       terminalEchoReqd = TRUE;
  165. diff --context orig/prelude.h amiga/prelude.h
  166. *** orig/prelude.h    Thu Jun 23 17:00:00 1994
  167. --- amiga/prelude.h    Sun Sep 04 23:12:53 1994
  168. ***************
  169. *** 30,39 ****
  170.   #define OS2      0    /* For IBM OS/2 2.0 using EMX GCC           */
  171.   #define SUNOS    0      /* For Sun 3/Sun 4 running SunOs 4.x           */
  172.   #define MIPS     0    /* For MIPS RC6280/Sony machine NWS-3870    UN */
  173. ! #define NEXTSTEP 1      /* For NeXTstep 3.0 using NeXT cc           */
  174.   #define NEXTGCC  0    /* For NeXTstep with gcc 2.x, doesn't work w/ NS3.2*/
  175.   #define MINIX68K 0    /* For Minix68k with gcc            UN */
  176. ! #define AMIGA    0    /* For Amiga using gcc 2.2.2            UN */
  177.   #define HPUX     0      /* For HPUX using gcc                   */
  178.   #define LINUX    0      /* For Linux using gcc                UN */
  179.   #define RISCOS   0    /* For Acorn DesktopC and RISCOS2 or 3           */
  180. --- 30,42 ----
  181.   #define OS2      0    /* For IBM OS/2 2.0 using EMX GCC           */
  182.   #define SUNOS    0      /* For Sun 3/Sun 4 running SunOs 4.x           */
  183.   #define MIPS     0    /* For MIPS RC6280/Sony machine NWS-3870    UN */
  184. ! #define NEXTSTEP 0      /* For NeXTstep 3.0 using NeXT cc           */
  185.   #define NEXTGCC  0    /* For NeXTstep with gcc 2.x, doesn't work w/ NS3.2*/
  186.   #define MINIX68K 0    /* For Minix68k with gcc            UN */
  187. ! #define S_AMISAS 0      /* For Amiga using SAS/C 6.51 (16bit small)        */
  188. ! #define R_AMISAS 1      /* For Amiga using SAS/C 6.51 (32bit regular)      */
  189. ! #define L_AMISAS 0      /* For Amiga using SAS/C 6.51 (32bit large)        */
  190. ! #define AMIGAGCC 0      /* For Amiga using gcc 2.2.2                    UN */
  191.   #define HPUX     0      /* For HPUX using gcc                   */
  192.   #define LINUX    0      /* For Linux using gcc                UN */
  193.   #define RISCOS   0    /* For Acorn DesktopC and RISCOS2 or 3           */
  194. ***************
  195. *** 80,105 ****
  196.    *   FIXED_SUBST    to force a fixed size for the current substitution
  197.    *-------------------------------------------------------------------------*/
  198.   
  199. ! #define UNIX        (SUNOS  | NEXTSTEP | HPUX | NEXTGCC | LINUX | AMIGA | \
  200.                MINIX68K | ALPHA | OS2 | SVR4 | ULTRIX | AIX | MIPS |\
  201.                SGI4 | NETBSD)
  202. ! #define SMALL_GOFER    (TURBOC | BCC)
  203. ! #define REGULAR_GOFER    (RISCOS | DJGPP | ZTC | ATARI)
  204. ! #define LARGE_GOFER    (UNIX   | WATCOM)
  205.   #define JMPBUF_ARRAY    (UNIX   | DJGPP | RISCOS | ZTC | ATARI)
  206. ! #define DOS_IO        (TURBOC | BCC | DJGPP | ZTC | WATCOM | ATARI)
  207.   #define TERMIO_IO    (LINUX  | HPUX | OS2 | SVR4 | SGI4)
  208. ! #define SGTTY_IO    (SUNOS  | NEXTSTEP | NEXTGCC | AMIGA | MINIX68K | \
  209.                ALPHA  | ULTRIX | AIX | MIPS)
  210.   #define TERMIOS_IO      (NETBSD)
  211. ! #define BREAK_FLOATS    (TURBOC | BCC)
  212.   #define HAS_FLOATS    (REGULAR_GOFER | LARGE_GOFER | BREAK_FLOATS)
  213.   
  214.   #define HASKELL_ARRAYS    (REGULAR_GOFER | LARGE_GOFER)
  215.   #define IO_MONAD    (REGULAR_GOFER | LARGE_GOFER)
  216.   #define IO_DIALOGUE    1 /* Warning: This may become 0 in future versions */
  217.   #define NPLUSK        1 /* Warning: This may become 0 in future versions */
  218. ! #define DO_COMPS    0 /* Warning: This may become 1 in future versions */
  219.   #define FIXED_SUBST    0 /* Warning: This may not be appropriate for PCs  */
  220.   
  221.   /*---------------------------------------------------------------------------
  222. --- 83,109 ----
  223.    *   FIXED_SUBST    to force a fixed size for the current substitution
  224.    *-------------------------------------------------------------------------*/
  225.   
  226. ! #define UNIX        (SUNOS  | NEXTSTEP | HPUX | NEXTGCC | LINUX | AMIGAGCC | \
  227.                MINIX68K | ALPHA | OS2 | SVR4 | ULTRIX | AIX | MIPS |\
  228.                SGI4 | NETBSD)
  229. ! #define SMALL_GOFER    (TURBOC | BCC | S_AMISAS)
  230. ! #define REGULAR_GOFER    (RISCOS | DJGPP | ZTC | R_AMISAS | ATARI)
  231. ! #define LARGE_GOFER    (UNIX   | WATCOM | L_AMISAS)
  232.   #define JMPBUF_ARRAY    (UNIX   | DJGPP | RISCOS | ZTC | ATARI)
  233. ! #define DOS_IO        (TURBOC | BCC | DJGPP | ZTC | WATCOM | ATARI | \
  234. !                          S_AMISAS | R_AMISAS | L_AMISAS)
  235.   #define TERMIO_IO    (LINUX  | HPUX | OS2 | SVR4 | SGI4)
  236. ! #define SGTTY_IO    (SUNOS  | NEXTSTEP | NEXTGCC | AMIGAGCC | MINIX68K | \
  237.                ALPHA  | ULTRIX | AIX | MIPS)
  238.   #define TERMIOS_IO      (NETBSD)
  239. ! #define BREAK_FLOATS    (TURBOC | BCC | S_AMISAS)
  240.   #define HAS_FLOATS    (REGULAR_GOFER | LARGE_GOFER | BREAK_FLOATS)
  241.   
  242.   #define HASKELL_ARRAYS    (REGULAR_GOFER | LARGE_GOFER)
  243.   #define IO_MONAD    (REGULAR_GOFER | LARGE_GOFER)
  244.   #define IO_DIALOGUE    1 /* Warning: This may become 0 in future versions */
  245.   #define NPLUSK        1 /* Warning: This may become 0 in future versions */
  246. ! #define DO_COMPS    1 /* Warning: This may become 1 in future versions */
  247.   #define FIXED_SUBST    0 /* Warning: This may not be appropriate for PCs  */
  248.   
  249.   /*---------------------------------------------------------------------------
  250. ***************
  251. *** 195,201 ****
  252.   #define farCalloc(n,s)    (Void *)valloc(((unsigned)n)*((unsigned)s))
  253.   #endif
  254.   
  255. ! #if     AMIGA
  256.   #include <stdlib.h>
  257.   #define    Main        int
  258.   #define    far
  259. --- 199,205 ----
  260.   #define farCalloc(n,s)    (Void *)valloc(((unsigned)n)*((unsigned)s))
  261.   #endif
  262.   
  263. ! #if     AMIGAGCC
  264.   #include <stdlib.h>
  265.   #define    Main        int
  266.   #define    far
  267. ***************
  268. *** 213,218 ****
  269. --- 217,233 ----
  270.   #define  far
  271.   #endif
  272.   
  273. + #if     (S_AMISAS | R_AMISAS | L_AMISAS)
  274. + #include <stdlib.h>
  275. + #define far
  276. + #define farCalloc(n,s)        (Void *)calloc ((unsigned)n, (unsigned)s)
  277. + /*
  278. +  * This allowBreak() only checks every 64 times it is called:
  279. +  */
  280. + extern unsigned char amigabreak;
  281. + #define allowBreak() if (!(amigabreak -= 4)) chkabort()
  282. + #endif
  283.   #if    RISCOS
  284.   #include <string.h>
  285.   #include <stdlib.h>
  286. ***************
  287. *** 256,262 ****
  288.   #define MainDone
  289.   #endif
  290.   
  291. ! #if (UNIX | DJGPP | RISCOS | ZTC | WATCOM | ATARI)
  292.   #define ctrlbrk(bh)       signal(SIGINT,bh)
  293.   #endif
  294.   
  295. --- 271,277 ----
  296.   #define MainDone
  297.   #endif
  298.   
  299. ! #if (UNIX | DJGPP | RISCOS | ZTC | S_AMISAS | R_AMISAS | L_AMISAS | WATCOM | ATARI)
  300.   #define ctrlbrk(bh)       signal(SIGINT,bh)
  301.   #endif
  302.   
  303. ***************
  304. *** 265,271 ****
  305. --- 280,290 ----
  306.    *-------------------------------------------------------------------------*/
  307.   
  308.   #define Void     void   /* older compilers object to: typedef void Void;   */
  309. + #if (S_AMISAS | R_AMISAS | L_AMISAS)
  310. + typedef int Bool;
  311. + #else
  312.   typedef unsigned Bool;
  313. + #endif
  314.   #define TRUE     1
  315.   #define FALSE    0
  316.   typedef char    *String;
  317. ***************
  318. *** 381,387 ****
  319.   #endif
  320.   #endif
  321.   
  322. ! #define DEF_EDITOR       "vi"            /* replace with ((char *)0)*/
  323. ! #define DEF_EDITLINE       "vi +%d %s"        /* if no default editor rqd*/
  324.   /*-------------------------------------------------------------------------*/
  325. --- 400,416 ----
  326.   #endif
  327.   #endif
  328.   
  329. !   
  330. ! #if (S_AMISAS | R_AMISAS | L_AMISAS)
  331. ! /* I use vim, a nice vi clone    - Torsten
  332. !  * As far as I know, it's the best vi clone
  333. !  * available for AmigaDOS.
  334. !  * It's available in comp.sources.misc
  335. !  */
  336. ! #define DEF_EDITOR         "vim"
  337. ! #define DEF_EDITLINE       "vim +%d %s"
  338. ! #else
  339. ! #define DEF_EDITOR         "vi"                 /* replace with ((char *)0)*/
  340. ! #define DEF_EDITLINE       "vi +%d %s"          /* if no default editor rqd*/
  341. ! #endif
  342.   /*-------------------------------------------------------------------------*/
  343.