home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / editors / 1859 < prev    next >
Encoding:
Text File  |  1992-07-30  |  7.7 KB  |  311 lines

  1. Path: sparky!uunet!mcsun!Germany.EU.net!unido!pcsbst!wd
  2. From: wd@pcsbst.pcs.com (wd)
  3. Newsgroups: comp.editors
  4. Subject: Re: Editor mined (Unix, VMS, MSDOS) - easy, solid, non-8-bit-obstructing (1/4)
  5. Message-ID: <wd.712563342@tukan>
  6. Date: 31 Jul 92 06:15:42 GMT
  7. References: <42I54HD@math.fu-berlin.de> <id.SWWR.HZI@ferranti.com> <86K51ZK@math.fu-berlin.de>
  8. Sender: @pcsbst.pcs.com
  9. Organization: PCS Computer Systeme GmbH
  10. Lines: 299
  11.  
  12. wolff@inf.fu-berlin.de (Thomas Wolff) writes:
  13.  
  14. >Mined runs fine on SunOS, Micro-Vax Ultrix, Iris IRIX, VMS, and MSDOS including the 
  15. >following assignment you feel disturbed by and its later uses:
  16. >char * (* fnamv) [];
  17. >  ...
  18. >  char * argv [];
  19. >  fnamv = argv;    /* Why does this produce a warning? C is such a stupid language! */
  20. >I really don't think it's my fault that compilers produce warnings like 
  21. >"illegal pointer combination" on this. 
  22.  
  23. But this _IS_ an illegal pointer combination, and  a  C  compiler
  24. _is_ expected to complain about it. 
  25.  
  26. >On the one hand, type inconsistencies are quite common in C, aren't they?, and the 
  27.  
  28. Bad argument - never follow bad examples!
  29.  
  30. >assigment does work as it is, on the other hand, I tried lots of variations of 
  31. >the declarations most of which did not work. If you could advise me how to change 
  32. >the declarations such that the compiler does not complain AND it works, I would be 
  33. >thankful.
  34.  
  35. Ok, here it is:
  36.  
  37. *** mined1.c!    Wed Jul 29 08:48:08 1992
  38. --- mined1.c    Wed Jul 29 12:53:26 1992
  39. ***************
  40. *** 14,20 ****
  41. --- 14,24 ----
  42.   
  43.   #ifdef unix
  44.   #define helpcommand "man mined"
  45. + #ifdef    USG
  46. + #define printcommand "lp %s"
  47. + #else
  48.   #define printcommand "lpr %s"
  49. + #endif    /* USG */
  50.   #endif
  51.   #ifdef vms
  52.   #define helpcommand "help mined"
  53. ***************
  54. *** 86,92 ****
  55.   int panic_level = 0;        /* To adjust error handling to situation */
  56.   int fnami;            /* Parameter index of current file name */
  57.   int fnami_min, fnami_max, fnami_cnt;
  58. ! char * (* fnamv) [];
  59.   /*
  60.    * Yank variables.
  61.    */
  62. --- 90,96 ----
  63.   int panic_level = 0;        /* To adjust error handling to situation */
  64.   int fnami;            /* Parameter index of current file name */
  65.   int fnami_min, fnami_max, fnami_cnt;
  66. ! char **fnamv;
  67.   /*
  68.    * Yank variables.
  69.    */
  70. ***************
  71. *** 475,490 ****
  72.   
  73.   #ifndef msdos
  74.   
  75. ! #ifdef msdos
  76. ! #ifndef single_pass_compilation
  77. ! /* This seems to conflict with the same declaration in minedmp.c when
  78. !    compiled with Turbo-C. C is just too stupid a language.
  79. !    Luckily, we don't need this part at all on MSDOS */
  80. ! extern struct {char * fk; int (* fp) ();} keycode [];
  81. ! #endif
  82. ! #else
  83. ! extern struct {char * fk; int (* fp) ();} keycode [];
  84. ! #endif
  85.   #define MAXCODELEN 7 /* max. length of function key sequence to be detected,
  86.               depending on the keycode table */
  87.   
  88. --- 479,488 ----
  89.   
  90.   #ifndef msdos
  91.   
  92. ! extern struct {
  93. !     char * fk;
  94. !     int (* fp) ();
  95. ! } keycode [];
  96.   #define MAXCODELEN 7 /* max. length of function key sequence to be detected,
  97.               depending on the keycode table */
  98.   
  99. ***************
  100. *** 576,582 ****
  101.     return (q_len () > 0) || inputreadyafter (input_fd, msec);
  102.   }
  103.   
  104. ! #else ndef msdos
  105.   
  106.   char_ready_within (msec)
  107.     int msec;
  108. --- 574,580 ----
  109.     return (q_len () > 0) || inputreadyafter (input_fd, msec);
  110.   }
  111.   
  112. ! #else /* !msdos */
  113.   
  114.   char_ready_within (msec)
  115.     int msec;
  116. ***************
  117. *** 584,590 ****
  118.     return 0;
  119.   }
  120.   
  121. ! #endif def msdos
  122.   
  123.   extern I ();
  124.   int (* keyproc) () = I;
  125. --- 582,588 ----
  126.     return 0;
  127.   }
  128.   
  129. ! #endif /* msdos */
  130.   
  131.   extern I ();
  132.   int (* keyproc) () = I;
  133. ***************
  134. *** 1168,1174 ****
  135.   
  136.     fnami = n;
  137.     if (fnami < fnami_min) load_file (NIL_PTR);
  138. !   else load_file ((* fnamv) [fnami]);
  139.   }
  140.   
  141.   NXTFILE ()
  142. --- 1166,1172 ----
  143.   
  144.     fnami = n;
  145.     if (fnami < fnami_min) load_file (NIL_PTR);
  146. !   else load_file (fnamv[fnami]);
  147.   }
  148.   
  149.   NXTFILE ()
  150. ***************
  151. *** 2124,2133 ****
  152.   {
  153.     char new_dir [maxLINE_LEN];    /* Buffer to hold new dir. name */
  154.   
  155. ! #ifdef vms
  156. ! #  define _getcwd_
  157. ! #endif
  158. ! #ifdef msdos
  159.   #  define _getcwd_
  160.   #endif
  161.   #ifdef _getcwd_
  162. --- 2122,2128 ----
  163.   {
  164.     char new_dir [maxLINE_LEN];    /* Buffer to hold new dir. name */
  165.   
  166. ! #if    (defined(vms) || defined(msdos) || defined(USG))
  167.   #  define _getcwd_
  168.   #endif
  169.   #ifdef _getcwd_
  170.  
  171. BTW - ANSI C does not allow text other than comments following an 
  172. #endif. After "#ifndef msdos" a  "ifdef  msdos"  will  always  be
  173. evaluate  to  false  (I hope, at least :-). getwd is usually only
  174. available in BSD-like environments, not all flavour of  System  V
  175. provide  it. Etc. - the code has really lots of (mostly minor and
  176. easy to fix) problems. 
  177.  
  178. >A Makefile is in the posting part (1/4). (mkmined is just my shell script I used 
  179. >before I cared about learning make. You can safely delete it.)
  180.  
  181. I don't call that a Makefile. What about his one:
  182.  
  183. --- cut here ---
  184. SOURCES    = mined1.c mined2.c minedio.c minedmp.c
  185. OBJ    = mined1.o mined2.o minedio.o minedmp.o
  186. I    = /usr/include
  187.  
  188. # chose one of the following:
  189. #
  190. #SCREEN    = -DTERMIO
  191. #SLIB    =  -ltermcap
  192. #
  193. #SCREEN    = -DSGTTY
  194. #SLIB    = -ltermcap
  195. #
  196. SCREEN    = -DCURSES
  197. SLIB    = -lcurses -ltermcap
  198.  
  199. # define USG if on System V flavour
  200. XFLAGS    = -DUSG
  201.  
  202. CFLAGS    = -O $(SCREEN) $(XFLAGS)
  203.  
  204. all:    mined
  205.  
  206. mined:    $(OBJ)
  207.     cc -O $(OBJ) $(SLIB) -o mined
  208.  
  209. strip:    mined
  210.     strip mined
  211.  
  212. clean:
  213.     rm -f $(OBJ) core
  214.  
  215. clobber: clean
  216.     rm -f mined
  217.  
  218. mined.o:    mined.c minedmp.c mined.h \
  219.         $(I)/stdio.h \
  220.         $(I)/errno.h \
  221.         $(I)/sys/signal.h \
  222.         $(I)/time.h 
  223. mined1.o:    mined1.c mined.h \
  224.         $(I)/stdio.h \
  225.         $(I)/sys/fcntl.h 
  226. mined2.o:    mined2.c mined.h \
  227.         $(I)/stdio.h \
  228.         $(I)/sys/fcntl.h 
  229. minedio.o:    minedio.c mined.h \
  230.         $(I)/stdio.h \
  231.         $(I)/sys/errno.h \
  232.         $(I)/time.h 
  233. minedmp.o:    minedmp.c mined.h \
  234.         $(I)/stdio.h \
  235.         $(I)/sys/fcntl.h 
  236. --- cut here ---
  237.  
  238. >I've already cleaned it a lot. If there are further wishes, I'd be glad to hear of them.
  239.  
  240. >> I'll be happy to help, 
  241.  
  242. Ok, here it comes:
  243.  
  244. *** mined2.c!    Wed Jul 29 11:42:18 1992
  245. --- mined2.c    Wed Jul 29 11:43:06 1992
  246. ***************
  247. *** 1797,1803 ****
  248. --- 1797,1807 ----
  249.   /* Allocate space */
  250.     program->result.expression = (int *) alloc (length);
  251.   /* Copy expression. (expression consists of ints!) */
  252. + #ifdef    USG
  253. +   memcpy (program->result.expression, exp_buffer, length);
  254. + #else
  255.     bcopy (exp_buffer, program->result.expression, length);
  256. + #endif    /* USG */
  257.   }
  258.   
  259.   /*
  260. *** minedmp.c!    Wed Jul 29 08:53:17 1992
  261. --- minedmp.c    Wed Jul 29 12:54:15 1992
  262. ***************
  263. *** 98,104 ****
  264.       case 'P' : return '^';
  265.       case 'p' : return '~';
  266.       case '|' : return '&';
  267. !     case '&' : return ''';
  268.       case '\\' : return ',';
  269.       case '_' : return '/';
  270.       case '-' : return '-';
  271. --- 98,104 ----
  272.       case 'P' : return '^';
  273.       case 'p' : return '~';
  274.       case '|' : return '&';
  275. !     case '&' : return '\'';
  276.       case '\\' : return ',';
  277.       case '_' : return '/';
  278.       case '-' : return '-';
  279. ***************
  280. *** 244,250 ****
  281.           case 'E' : return 'K';
  282.           case 'I' : return 'O';
  283.           case 'O' : return 'V';
  284. !         case 'U' : return '\';
  285.           case 'a' : return 'd';
  286.           case 'e' : return 'k';
  287.           case 'i' : return 'o';
  288. --- 244,250 ----
  289.           case 'E' : return 'K';
  290.           case 'I' : return 'O';
  291.           case 'O' : return 'V';
  292. !         case 'U' : return '\\';
  293.           case 'a' : return 'd';
  294.           case 'e' : return 'k';
  295.           case 'i' : return 'o';
  296.  
  297.  
  298.  
  299. Wolfgang
  300.  
  301. ==================================================================
  302. Name    : Wolfgang Denk                         (+49)-89-68004-288
  303. Company : PCS GmbH, Pfaelzer-Wald-Str. 36,  8000 Munich,  Germany.
  304. UUCP    : ..[pyramid ;uunet!unido]!pcsbst!wd  (PYRAMID PREFERRED!!)
  305. DOMAIN  : wd@pcsbst.pcs.[ COM From rest of world; DE From Europe ]
  306. ###################################################################
  307. #  "UNIX was not designed to stop you from doing stupid things,   #
  308. #   because that would  also stop you from doing clever things."  #
  309. #   -- Doug Gwyn                                                  #
  310. ###################################################################
  311.