home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!unido!pcsbst!wd
- From: wd@pcsbst.pcs.com (wd)
- Newsgroups: comp.editors
- Subject: Re: Editor mined (Unix, VMS, MSDOS) - easy, solid, non-8-bit-obstructing (1/4)
- Message-ID: <wd.712563342@tukan>
- Date: 31 Jul 92 06:15:42 GMT
- References: <42I54HD@math.fu-berlin.de> <id.SWWR.HZI@ferranti.com> <86K51ZK@math.fu-berlin.de>
- Sender: @pcsbst.pcs.com
- Organization: PCS Computer Systeme GmbH
- Lines: 299
-
- wolff@inf.fu-berlin.de (Thomas Wolff) writes:
-
- >Mined runs fine on SunOS, Micro-Vax Ultrix, Iris IRIX, VMS, and MSDOS including the
- >following assignment you feel disturbed by and its later uses:
- >char * (* fnamv) [];
- > ...
- > char * argv [];
- > fnamv = argv; /* Why does this produce a warning? C is such a stupid language! */
- >I really don't think it's my fault that compilers produce warnings like
- >"illegal pointer combination" on this.
-
- But this _IS_ an illegal pointer combination, and a C compiler
- _is_ expected to complain about it.
-
- >On the one hand, type inconsistencies are quite common in C, aren't they?, and the
-
- Bad argument - never follow bad examples!
-
- >assigment does work as it is, on the other hand, I tried lots of variations of
- >the declarations most of which did not work. If you could advise me how to change
- >the declarations such that the compiler does not complain AND it works, I would be
- >thankful.
-
- Ok, here it is:
-
- *** mined1.c! Wed Jul 29 08:48:08 1992
- --- mined1.c Wed Jul 29 12:53:26 1992
- ***************
- *** 14,20 ****
- --- 14,24 ----
-
- #ifdef unix
- #define helpcommand "man mined"
- + #ifdef USG
- + #define printcommand "lp %s"
- + #else
- #define printcommand "lpr %s"
- + #endif /* USG */
- #endif
- #ifdef vms
- #define helpcommand "help mined"
- ***************
- *** 86,92 ****
- int panic_level = 0; /* To adjust error handling to situation */
- int fnami; /* Parameter index of current file name */
- int fnami_min, fnami_max, fnami_cnt;
- ! char * (* fnamv) [];
- /*
- * Yank variables.
- */
- --- 90,96 ----
- int panic_level = 0; /* To adjust error handling to situation */
- int fnami; /* Parameter index of current file name */
- int fnami_min, fnami_max, fnami_cnt;
- ! char **fnamv;
- /*
- * Yank variables.
- */
- ***************
- *** 475,490 ****
-
- #ifndef msdos
-
- ! #ifdef msdos
- ! #ifndef single_pass_compilation
- ! /* This seems to conflict with the same declaration in minedmp.c when
- ! compiled with Turbo-C. C is just too stupid a language.
- ! Luckily, we don't need this part at all on MSDOS */
- ! extern struct {char * fk; int (* fp) ();} keycode [];
- ! #endif
- ! #else
- ! extern struct {char * fk; int (* fp) ();} keycode [];
- ! #endif
- #define MAXCODELEN 7 /* max. length of function key sequence to be detected,
- depending on the keycode table */
-
- --- 479,488 ----
-
- #ifndef msdos
-
- ! extern struct {
- ! char * fk;
- ! int (* fp) ();
- ! } keycode [];
- #define MAXCODELEN 7 /* max. length of function key sequence to be detected,
- depending on the keycode table */
-
- ***************
- *** 576,582 ****
- return (q_len () > 0) || inputreadyafter (input_fd, msec);
- }
-
- ! #else ndef msdos
-
- char_ready_within (msec)
- int msec;
- --- 574,580 ----
- return (q_len () > 0) || inputreadyafter (input_fd, msec);
- }
-
- ! #else /* !msdos */
-
- char_ready_within (msec)
- int msec;
- ***************
- *** 584,590 ****
- return 0;
- }
-
- ! #endif def msdos
-
- extern I ();
- int (* keyproc) () = I;
- --- 582,588 ----
- return 0;
- }
-
- ! #endif /* msdos */
-
- extern I ();
- int (* keyproc) () = I;
- ***************
- *** 1168,1174 ****
-
- fnami = n;
- if (fnami < fnami_min) load_file (NIL_PTR);
- ! else load_file ((* fnamv) [fnami]);
- }
-
- NXTFILE ()
- --- 1166,1172 ----
-
- fnami = n;
- if (fnami < fnami_min) load_file (NIL_PTR);
- ! else load_file (fnamv[fnami]);
- }
-
- NXTFILE ()
- ***************
- *** 2124,2133 ****
- {
- char new_dir [maxLINE_LEN]; /* Buffer to hold new dir. name */
-
- ! #ifdef vms
- ! # define _getcwd_
- ! #endif
- ! #ifdef msdos
- # define _getcwd_
- #endif
- #ifdef _getcwd_
- --- 2122,2128 ----
- {
- char new_dir [maxLINE_LEN]; /* Buffer to hold new dir. name */
-
- ! #if (defined(vms) || defined(msdos) || defined(USG))
- # define _getcwd_
- #endif
- #ifdef _getcwd_
-
- BTW - ANSI C does not allow text other than comments following an
- #endif. After "#ifndef msdos" a "ifdef msdos" will always be
- evaluate to false (I hope, at least :-). getwd is usually only
- available in BSD-like environments, not all flavour of System V
- provide it. Etc. - the code has really lots of (mostly minor and
- easy to fix) problems.
-
- >A Makefile is in the posting part (1/4). (mkmined is just my shell script I used
- >before I cared about learning make. You can safely delete it.)
-
- I don't call that a Makefile. What about his one:
-
- --- cut here ---
- SOURCES = mined1.c mined2.c minedio.c minedmp.c
- OBJ = mined1.o mined2.o minedio.o minedmp.o
- I = /usr/include
-
- # chose one of the following:
- #
- #SCREEN = -DTERMIO
- #SLIB = -ltermcap
- #
- #SCREEN = -DSGTTY
- #SLIB = -ltermcap
- #
- SCREEN = -DCURSES
- SLIB = -lcurses -ltermcap
-
- # define USG if on System V flavour
- XFLAGS = -DUSG
-
- CFLAGS = -O $(SCREEN) $(XFLAGS)
-
- all: mined
-
- mined: $(OBJ)
- cc -O $(OBJ) $(SLIB) -o mined
-
- strip: mined
- strip mined
-
- clean:
- rm -f $(OBJ) core
-
- clobber: clean
- rm -f mined
-
- mined.o: mined.c minedmp.c mined.h \
- $(I)/stdio.h \
- $(I)/errno.h \
- $(I)/sys/signal.h \
- $(I)/time.h
- mined1.o: mined1.c mined.h \
- $(I)/stdio.h \
- $(I)/sys/fcntl.h
- mined2.o: mined2.c mined.h \
- $(I)/stdio.h \
- $(I)/sys/fcntl.h
- minedio.o: minedio.c mined.h \
- $(I)/stdio.h \
- $(I)/sys/errno.h \
- $(I)/time.h
- minedmp.o: minedmp.c mined.h \
- $(I)/stdio.h \
- $(I)/sys/fcntl.h
- --- cut here ---
-
- >I've already cleaned it a lot. If there are further wishes, I'd be glad to hear of them.
-
- >> I'll be happy to help,
-
- Ok, here it comes:
-
- *** mined2.c! Wed Jul 29 11:42:18 1992
- --- mined2.c Wed Jul 29 11:43:06 1992
- ***************
- *** 1797,1803 ****
- --- 1797,1807 ----
- /* Allocate space */
- program->result.expression = (int *) alloc (length);
- /* Copy expression. (expression consists of ints!) */
- + #ifdef USG
- + memcpy (program->result.expression, exp_buffer, length);
- + #else
- bcopy (exp_buffer, program->result.expression, length);
- + #endif /* USG */
- }
-
- /*
- *** minedmp.c! Wed Jul 29 08:53:17 1992
- --- minedmp.c Wed Jul 29 12:54:15 1992
- ***************
- *** 98,104 ****
- case 'P' : return '^';
- case 'p' : return '~';
- case '|' : return '&';
- ! case '&' : return ''';
- case '\\' : return ',';
- case '_' : return '/';
- case '-' : return '-';
- --- 98,104 ----
- case 'P' : return '^';
- case 'p' : return '~';
- case '|' : return '&';
- ! case '&' : return '\'';
- case '\\' : return ',';
- case '_' : return '/';
- case '-' : return '-';
- ***************
- *** 244,250 ****
- case 'E' : return 'K';
- case 'I' : return 'O';
- case 'O' : return 'V';
- ! case 'U' : return '\';
- case 'a' : return 'd';
- case 'e' : return 'k';
- case 'i' : return 'o';
- --- 244,250 ----
- case 'E' : return 'K';
- case 'I' : return 'O';
- case 'O' : return 'V';
- ! case 'U' : return '\\';
- case 'a' : return 'd';
- case 'e' : return 'k';
- case 'i' : return 'o';
-
-
-
- Wolfgang
-
- ==================================================================
- Name : Wolfgang Denk (+49)-89-68004-288
- Company : PCS GmbH, Pfaelzer-Wald-Str. 36, 8000 Munich, Germany.
- UUCP : ..[pyramid ;uunet!unido]!pcsbst!wd (PYRAMID PREFERRED!!)
- DOMAIN : wd@pcsbst.pcs.[ COM From rest of world; DE From Europe ]
- ###################################################################
- # "UNIX was not designed to stop you from doing stupid things, #
- # because that would also stop you from doing clever things." #
- # -- Doug Gwyn #
- ###################################################################
-