Eco-C Compiler
John Lowry
jlowry at bbnccv.UUCP
Thu Aug 1 07:43:47 AEST 1985
Despite my earlier posting praising Ecosoft's Eco-C Compiler, I
now have to add some warnings and complaints. (For $49.95 what did
I expect ...)
1. It is true that the parser barfs on "printf (...)" and not on
"printf(...)". (note the space). Frustrating but livable.
Only one I've found so far ...
2. Functions may be a little different. From examples in K&R
putc() uses an int c;. putc() in Eco-C expects a char.
3. The compiler hates my ramdisk. I have the QuadRam board and use
the supplied ramdisk. Because the compiler, library, header
files, linker, editor, etc. consume so much room, I have been
forced to use 3 floppies. I tried to load the compiler into the
ramdisk, and when it came time to link the ramdisk FAT was
trashed. So I tried to load the library into the ramdisk...
same problem. Apparently, the parser gets available memory from
BIOS and does all it's work at some offset from high memory.
Since this is where my ramdisk lives ... This means that you
can't use the 'make' function of the compiler or the auto-link
because there isn't enough room for all that is needed and your
sources. (I know, buy a hard-disk. Of course, if I could
afford a hard-disk, I wouldn't be playing with a $49.95
compiler.)
4. Included below is a (large) fragment of code that will compile
fine but will not open and read the correct file. Specifically,
this is part of a small nroff-like program that I got from a
BBS. The problems occur when the file name of the macro file is
passed to a function for reading. fopen() returns NULL
consistently. This fragment compiles on the Mark Williams
compiler, and two other mini-computer compilers, and runs. If
you can see what is questionable with this code, please respond.
After compiling, run with "nro -m<textfile>", same format
as loading a macrofile into nroff.
Header File: nroall.h -----------------------------------------
#define NFILES 4 /* nesting depth for input files */
#define ERR -1
#ifndef EXTERN
#define EXTERN extern
#endif
EXTERN FILE *sofile[NFILES]; /* input file buffers */
C Source File: nro.c ---------------------------------------------
/*
* Word Processor
* similar to Unix NROFF or RSX-11M RNO -
* adaptation of text processor given in
* "Software Tools", Kernighan and Plauger.
*
* Stephen L. Browning
* 5723 North Parker Avenue
* Indianapolis, Indiana 46220
*/
#include <stdio.h>
#define TRUE 1
#define FALSE 0
#define EXTERN
#include "nroall.h"
main(argc, argv)
int argc;
char *argv[];
{
int i,c;
int swflg;
int ifp, ofp;
FILE *fopen();
swflg = FALSE;
pout = stdout;
ifp = ofp = 0;
for (i=1; i<argc; ++i) {
if (*argv[i] == '-' || *argv[i] == '+') {
/* start of problem, here is the call */
if (pswitch(argv[i],&swflg) == ERR) exit(-1);
}
}
for (i=1; i<argc; ++i) {
if (*argv[i] != '-' && *argv[i] != '+' && *argv[i] != '>') {
if ((sofile[0] = fopen(argv[i], "r")) == NULL) {
printf("nro: unable to open file %s\n",argv[i]);
exit(-1);
}
else {
while((c=getc(sofile[0])) != EOF)
putchar(c);
fclose(sofile[0]);
}
}
}
if (argc == 1) {
puts("Usage: nro [-n] [+n] [-pxx] [-v] [-b] [-mmacfile] infile...[>outfile]\n");
exit(-1);
}
}
/*
* process switch values from command line
*/
pswitch(p,q)
char *p;
int *q;
{
int swgood, c;
swgood = TRUE;
if (*p == '-') {
switch (*++p) {
/* here is the offending(?) code. */
case 'm':
if ((sofile[0] = fopen(++p, "r")) == NULL) {
printf("***nro: unable to open file %s\n",p);
exit(-1);
}
while((c=getc(sofile[0])) != EOF)
putchar(c);
fclose(sofile[0]);
break;
default:
swgood = FALSE;
break;
}
}
if (swgood == FALSE) {
printf("nro: illegal switch %s",p);
return(ERR);
}
return(TRUE);
}
John Lowry
jlowry at bbnz
jlowry at bbnccv
More information about the Comp.lang.c
mailing list