[Coco] "C" Compiler C_PREP19 errors or mine?
Stephen H. Fischer
SFischer1 at Mindspring.com
Sat May 21 10:59:13 EDT 2011
Hi,
Please read this E-mail using a monospaced font!
In trying to build a new copy of my program I discovered two things that
puzzle me both related to C_PREP19.
I am using CPREP19.lzh from Gene as well as CC252.lzh.
http://gene.homelinux.net:85/gene/Genes-os9-stf/
------------------------------------------------
The first item are the Syntax errors reported for the
"fputs("\x1BM\x1Bl\d010\x1BQ\d090",fcb);" lines.
This sends control codes to an Epson printer.
Twenty years ago this was accepted just fine.
I checked the CoCo OS-9 "C" Compiler manual and they are correct.
They are NOT correct for ANSI "C" AFAIK.
C_PREP is an ANSI standard C preprocessor. It can completely replace
Microware's c.prep. It contains all of the features of c.prep plus some
extras. It follows the grammar set out in the ANSI C standard by the X3J11
committee.
The unofficial ANSI "C" document I looked at did not give an option for
decimal and in any case the CoCo OS-9 "C" Compiler requires the format I
used. (I converted to HEX.)
I think that this checking is NOT proper to be done in C_PREP without
running CC with the
"-A Run ansifront for ANSI-C processing." option selected.
------------------------------------------------
The second item is the suggested use of __DATE__, __TIME__ and __FILE__
taken right from the "cprep19.doc" file.
To me these need to substituted into strings, but they are not.
"__DATE__, __TIME__ and __FILE__ " would be useful.
------------------------------------------------
/*----------- testcp19 -------------------*/
#include <stdio.h>
#include <ctype.h>
/* Globals */
FILE *fcb;
char ch3;
int num;
main(argc,argv)
int argc;
char *argv[];
{
fcb=fopen("/P","w");
fcb->_flag |= _RBF; /* stop output editing */
/* Switch to stdout from /P */
fcb = stdout;
fputs("\x1BM\x1Bl\d010\x1BQ\d090",fcb);
fputs("\x1BP\x1Bl\d004\x1BQ\d084",fcb);
fprintf(stderr,"Current file name is: %s\n",__FILE__);
fprintf(stderr,"Compile date is: %s\n",__DATE__);
fprintf(stderr,"Compile time: %s\n",__TIME__);
}
/*----------- testcp19 -------------------*/
------------------------------------------------
*** "testcp19.c" <Line #23> Syntax error - Illegal escape sequence ***
fputs("\x1BM\x1Bl\d010\x1BQ\d090",fcb);
^
*** "testcp19.c" <Line #23> Syntax error - Illegal escape sequence ***
fputs("\x1BM\x1Bl\d010\x1BQ\d090",fcb);
^
*** "testcp19.c" <Line #23> Syntax error - Illegal escape sequence ***
fputs ( x1BM\x1Bl\d010\x1BQ\d090",fcb);
^
*** "testcp19.c" <Line #23> Syntax error - Illegal escape sequence ***
fputs ( x1BM\x1Bl\d010\x1BQ\d090",fcb);
^
*** "testcp19.c" <Line #25> Syntax error - Illegal escape sequence ***
fputs("\x1BP\x1Bl\d004\x1BQ\d084",fcb);
^
*** "testcp19.c" <Line #25> Syntax error - Illegal escape sequence ***
fputs("\x1BP\x1Bl\d004\x1BQ\d084",fcb);
^
*** "testcp19.c" <Line #25> Syntax error - Illegal escape sequence ***
fputs ( x1BP\x1Bl\d004\x1BQ\d084",fcb);
^
*** "testcp19.c" <Line #25> Syntax error - Illegal escape sequence ***
fputs ( x1BP\x1Bl\d004\x1BQ\d084",fcb);
^
testcp19.c : line 28 **** undeclared variable ****
fprintf ( ( & _iob [ 2 ] ) , "Current file name is: %s\n" , testcp19.c ) ;
^
testcp19.c : line 28 **** struct member required ****
fprintf ( ( & _iob [ 2 ] ) , "Current file name is: %s\n" , testcp19.c ) ;
^
testcp19.c : line 28 **** undeclared variable ****
fprintf ( ( & _iob [ 2 ] ) , "Current file name is: %s\n" , testcp19.c ) ;
^
testcp19.c : line 29 **** ) expected ****
fprintf ( ( & _iob [ 2 ] ) , "Compile date is: %s\n" , May 21 1911 ) ;
^
testcp19.c : line 29 **** undeclared variable ****
fprintf ( ( & _iob [ 2 ] ) , "Compile date is: %s\n" , May 21 1911 ) ;
^
testcp19.c : line 29 **** ; expected ****
fprintf ( ( & _iob [ 2 ] ) , "Compile date is: %s\n" , May 21 1911 ) ;
^
testcp19.c : line 29 **** ; expected ****
fprintf ( ( & _iob [ 2 ] ) , "Compile date is: %s\n" , May 21 1911 ) ;
^
testcp19.c : line 29 **** ; expected ****
fprintf ( ( & _iob [ 2 ] ) , "Compile date is: %s\n" , May 21 1911 ) ;
^
testcp19.c : line 29 **** syntax error ****
fprintf ( ( & _iob [ 2 ] ) , "Compile date is: %s\n" , May 21 1911 ) ;
^
testcp19.c : line 30 **** ) expected ****
fprintf ( ( & _iob [ 2 ] ) , "Compile time: %s\n" , 07:04:30 ) ;
^
testcp19.c : line 30 **** ; expected ****
fprintf ( ( & _iob [ 2 ] ) , "Compile time: %s\n" , 07:04:30 ) ;
^
testcp19.c : line 30 **** syntax error ****
fprintf ( ( & _iob [ 2 ] ) , "Compile time: %s\n" , 07:04:30 ) ;
^
errors in compilation : 12
cc version 2.5.2
'testcp19.c'
c_prep : testcp19.c
c.pass1: /DD/TMP/ctmp.4.m -o=/DD/TMP/ctmp.4.a
------------------------------------------------
TIA
SHF
More information about the Coco
mailing list