Path: tut!draken!kth!mcvax!hp4nl!mcvax!unido!nixpbe!nixbln!agc From: agc@nixbln.UUCP Newsgroups: comp.os.minix Subject: Re: POSIX and the future of MINIX C Message-ID: <11100002@nixbln> Date: 3 Mar 89 11:32:00 GMT References: <552@eecea.eece.ksu.edu> Lines: 413 Nf-ID: #R:eecea.eece.ksu.edu:-55200:nixbln:11100002:000:9355 Nf-From: nixbln.UUCP!agc Mar 3 12:32:00 1989 Posted: Fri Mar 3 12:32:00 1989 Well, at least agcpp got out of here - that's about all you can say. 1. Marty Leisner (leisner@arisia.UUCP) said that the BELL characters hadn't made it across the pond. Fixes (below) to parse.c should sort this. Thanks, Marty. Sorry, everybody. 2. Detlev Droege (droege@infko.UUCP) pointed out the long-name folding didn't work correctly. The following fix to id.c should cure it. Danke, Detlev. 3. Klamer Schutte (n62@nikhefh.hep.nl) said that the ANSI argument removed the ANSI-style arguments. Unfortunately, I can't reproduce this. Script started on Fri Mar 3 12:22:51 1989 % cat t1 char *strnsave(char *s, int n); main() { } % agcpp -ANSI t1 char *strnsave(char *s, int n); main() { } % exit % script done on Fri Mar 3 12:23:07 1989 Can you give me some more info, Klamer? Alstublieft. 4. Klamer also pointed out a rather nasty bug which prevented white space being expanded within macro arguments. Following fix to mac.c should cure this. Dank je wel, Klamer. 5. I have also noticed that ANSI C varargs style functions will be expanded wrongly - the fixes to proto.c should cure this. 6. If anyone finds out what the sym.c file does, could they tell me please! So official fixes(#1) to agcpp follow. Thanks once again to everyone for bug reports. Please keep them coming - I'm sure that together we can manage a working space-efficient pre-processor sometime. Regards, Gruessen, Groetjes... Alistair G. Crooks. Joypace Ltd., 2 Vale Road, Hawkhurst, Kent TN18 4BU, UK. (+44 580 753114) UUCP Europe: ...!mcvax!unido!nixpbe!nixbln!agc UUCP the rest of the world: ...!uunet!linus!nixbur!nixpbe!nixbln!agc P.S. Anyone want to employ a tall Scot who writes pre-processors in his spare time, can speak English and German, and can muddle along in Dutch? *** id.c.old --- id.c ************** *** 1,5 /* ! * @(#)id.c 1.1 09/02/89 18:21:55 agc * * Copyright Joypace Ltd, UK, 1989. All rights reserved. * This file may be freely distributed provided that this --- 1,5 ----- /* ! * @(#)id.c 1.2 03/03/89 12:08:35 agc * * Copyright Joypace Ltd, UK, 1989. All rights reserved. * This file may be freely distributed provided that this ************** *** 18,24 * MINIX Minix 1.2 */ #ifndef lint ! static char *idnsccsid = "@(#)id.c 1.1 09/02/89 18:21:55 agc"; #endif /* not lint */ #include --- 18,24 ----- * MINIX Minix 1.2 */ #ifndef lint ! static char *idnsccsid = "@(#)id.c 1.2 03/03/89 12:08:35 agc"; #endif /* not lint */ #include ************** *** 39,45 } HID; static HID ids[HASHTABLEN]; - static int idnum; void addid(old, new) --- 39,44 ----- } HID; static HID ids[HASHTABLEN]; void addid(old, new) ************** *** 122,127 newid() { static char idname[10]; for (;;) { (void) sprintf(idname, "i%05d", idnum); --- 121,127 ----- newid() { static char idname[10]; + static int idnum; for (;;) { (void) sprintf(idname, "i%05d", idnum); ************** *** 125,130 for (;;) { (void) sprintf(idname, "i%05d", idnum); if (getclash(idname) == (char *) NULL) return(idname); idnum = (idnum == 99999) ? 0 : idnum + 1; --- 125,131 ----- for (;;) { (void) sprintf(idname, "i%05d", idnum); + idnum = (idnum == 99999) ? 0 : idnum + 1; if (getclash(idname) == (char *) NULL) return(idname); } ************** *** 127,133 (void) sprintf(idname, "i%05d", idnum); if (getclash(idname) == (char *) NULL) return(idname); - idnum = (idnum == 99999) ? 0 : idnum + 1; } } --- 128,133 ----- idnum = (idnum == 99999) ? 0 : idnum + 1; if (getclash(idname) == (char *) NULL) return(idname); } } *** mac.c.old --- mac.c ************** *** 1,5 /* ! * @(#)mac.c 1.11 09/02/89 18:22:10 agc * * Copyright Joypace Ltd, UK, 1989. All rights reserved. * This file may be freely distributed provided that this --- 1,5 ----- /* ! * @(#)mac.c 1.12 03/03/89 12:08:45 agc * * Copyright Joypace Ltd, UK, 1989. All rights reserved. * This file may be freely distributed provided that this ************** *** 18,24 * MINIX Minix 1.2 */ #ifndef lint ! static char *macnsccsid = "@(#)mac.c 1.11 09/02/89 18:22:10 agc"; #endif /* not lint */ #include --- 18,24 ----- * MINIX Minix 1.2 */ #ifndef lint ! static char *macnsccsid = "@(#)mac.c 1.12 03/03/89 12:08:45 agc"; #endif /* not lint */ #include ************** *** 226,232 } NEW(ARGS, ap); for (;;) { ! if (!gettoken(fp, bracket, &t)) error(1, "bad macro format", (char *) NULL); switch(t.t_token[0]) { case ',' : --- 226,232 ----- } NEW(ARGS, ap); for (;;) { ! if (!gettoken(fp, 0, &t)) error(1, "bad macro format", (char *) NULL); switch(t.t_token[0]) { case ',' : *** parse.c.old --- parse.c ************** *** 1,5 /* ! * @(#)parse.c 1.8 07/02/89 15:02:12 agc * * Copyright Joypace Ltd., UK, 1989. All rights reserved. * This code may be freely distributed, provided that this --- 1,5 ----- /* ! * @(#)parse.c 1.9 03/03/89 12:08:40 agc * * Copyright Joypace Ltd., UK, 1989. All rights reserved. * This code may be freely distributed, provided that this ************** *** 17,23 * MSC Microsoft C 5.0 */ #ifndef lint ! static char *parsensccsid = "@(#)parse.c 1.8 07/02/89 15:02:12 agc"; #endif /* not lint */ #include --- 17,23 ----- * MSC Microsoft C 5.0 */ #ifndef lint ! static char *parsensccsid = "@(#)parse.c 1.9 03/03/89 12:08:40 agc"; #endif /* not lint */ #include ************** *** 44,49 #define ISNL(c) ((c) == '\r' || (c) == '\n') /* read a line into buf, folding trigraphs, returning 0 at eof, 1 otherwise */ int --- 44,51 ----- #define ISNL(c) ((c) == '\r' || (c) == '\n') + #define BELL 007 + /* read a line into buf, folding trigraphs, returning 0 at eof, 1 otherwise */ int ************** *** 199,205 if (*here == '\\') { switch(*(here+1)) { case 'a' : ! *cp++ = ''; here += 2; i++; continue; --- 201,207 ----- if (*here == '\\') { switch(*(here+1)) { case 'a' : ! *cp++ = BELL; here += 2; i++; continue; ************** *** 230,236 case '\\' : switch(*++here) { case 'a' : ! num = ''; break; case 'n' : num = '\n'; --- 232,238 ----- case '\\' : switch(*++here) { case 'a' : ! num = BELL; break; case 'n' : num = '\n'; *** proto.c.old --- proto.c ************** *** 1,5 /* ! * @(#)proto.c 1.5 07/02/89 16:25:33 agc * * Copyright Joypace Ltd, UK, 1989. All rights reserved. * This file may be freely distributed provided that this --- 1,5 ----- /* ! * @(#)proto.c 1.6 03/03/89 12:08:47 agc * * Copyright Joypace Ltd, UK, 1989. All rights reserved. * This file may be freely distributed provided that this ************** *** 18,24 * MINIX Minix 1.2 */ #ifndef lint ! static char *protonsccsid = "@(#)proto.c 1.5 07/02/89 16:25:33 agc"; #endif /* lint */ #include --- 18,24 ----- * MINIX Minix 1.2 */ #ifndef lint ! static char *protonsccsid = "@(#)proto.c 1.6 03/03/89 12:08:47 agc"; #endif /* lint */ #include ************** *** 38,45 mt.t_type = T_SPACE; for (;;) { sgettoken(&s, 1, &mt); - if (mt.t_type == T_EOLN) - return; if (mt.t_type == T_WORD) (void) strcpy(out, mt.t_token); } --- 38,43 ----- mt.t_type = T_SPACE; for (;;) { sgettoken(&s, 1, &mt); if (mt.t_type == T_WORD) (void) strcpy(out, mt.t_token); if (mt.t_token[0] == '.' && strcmp(s, "..") == 0) { ************** *** 42,47 return; if (mt.t_type == T_WORD) (void) strcpy(out, mt.t_token); } } --- 40,51 ----- sgettoken(&s, 1, &mt); if (mt.t_type == T_WORD) (void) strcpy(out, mt.t_token); + if (mt.t_token[0] == '.' && strcmp(s, "..") == 0) { + (void) strcpy(out, "..."); + return; + } + if (mt.t_type == T_EOLN) + return; } } ************** *** 55,60 ARGS *ap; char **cpp; char *cp; int i; ap = fgetargs(fp, 0); --- 59,65 ----- ARGS *ap; char **cpp; char *cp; + int var = -1; int i; ap = fgetargs(fp, 0); ************** *** 72,77 i < ap->a_argc; cpp++, i++) { getname(*cpp, tmp); output(tmp, strlen(tmp)); if (i < ap->a_argc - 1) output(", ", 2); --- 77,87 ----- i < ap->a_argc; cpp++, i++) { getname(*cpp, tmp); + if (strcmp(&tmp[strlen(tmp) - 3], "...") == 0) { + output("va_alist", 8); + var = i; + break; + } output(tmp, strlen(tmp)); if (i < ap->a_argc - 1) output(", ", 2); ************** *** 82,87 for (i = 0, cpp = ap->a_argv; i < ap->a_argc; cpp++, i++) { cp = *cpp; mt.t_type = T_SPACE; for (;;) { --- 92,101 ----- for (i = 0, cpp = ap->a_argv; i < ap->a_argc; cpp++, i++) { + if (i == var) { + output("char *va_alist;\n", 16); + break; + } cp = *cpp; mt.t_type = T_SPACE; for (;;) {