Path: csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "Rod Pemberton" Newsgroups: comp.os.msdos.programmer,alt.os.development Subject: Re: Smaller C compiler Date: Tue, 03 Dec 2013 10:47:42 -0500 Organization: Aioe.org NNTP Server Lines: 69 Message-ID: References: <7223cdfa-c54f-4c8a-aa99-be810f8e78d1@googlegroups.com> <9906a74b-ba42-4617-bcae-98cad502663f@googlegroups.com> NNTP-Posting-Host: CNsg4fVcCsvs3UaOgZtQCw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.16 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.os.msdos.programmer:1097 On Tue, 03 Dec 2013 08:31:18 -0500, Auric__ wrote: > Alexei A. Frounze wrote: >> [snip] >> As for #include, you can use it, it's supported (you can find #include >> "cgx86.c" inside smlrc.c), but you'll have to provide some include file >> of yours as there's no standard library coming with the compiler as of >> yet (no stdio.h, etc). > > Yeah, I noticed that. I *strongly* recommend moving your implementation > of stdlib functions out of the compiler ASAP. The further you get with > this project, the more of a PITA it will be to do so down the road. > No... Alexei probably needs some C library functions to be internal in order to bootstrap the C compiler when no C library is present. That's typical of any C compiler that can bootstrap itself completely, even GNU's GCC. I frequently code some of my programs to only use ANSI C without a C library, or ANSI C and only when I need features like memory allocation (using file I/O...). In which case, I'll need a few functions from the "missing" C libraries implemented internally. The most common other one IMO would be . You really don't need the remainder of the C library, if you know what you're doing. A better solution would be to make the functions conditionally included if Alexei has enough preprocessor support in his Smaller C compiler: #define STDIOH #ifddef STDIOH #include #else ... stdio.h functions #endif Or, if only rudimentary preprocessor support is available: /* stdio.h */ #if 1 /* disable here, enable below to bootstrap */ #include #include #endif /* stdio.h bootstrap functions */ /* string.h bootstrap functions */ #if 0 ... stdio.h bootstrap functions ... ... string.h bootstrap functions ... #endif FYI, if you remember Alexei, Steve Dubrovich wrote a file I/O library for his updates to and modified verion of Ron Cain's Small C. He wrote both a CP/M version for for DOS, and an Int 21h version. They're on his website in his various projects: http://www.project-fbin.hostoi.com/index.htm I used the CP/M version for my modifications to Ron Cain's Small C. It worked just fine in a Windows SE DOS console window, but I couldn't get it to work properly in real-mode MS-DOS v7.10. The Int 21h version was setup differently, more for Steve's variant than for Ron Cain's original version. So, I haven't used it. Rod Pemberton