From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,216b18d81cce4f75 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-02 18:09:23 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.stealth.net!204.127.161.2.MISMATCH!wn2feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3B198ED7.6FA8F8F7@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada Microkernel? References: <3B183CB8.3EE396E7@engineer.com> <_M3S6.8957$HL5.1284411@news6-win.server.ntlworld.com> <3B1958AD.F7D7A5CC@engineer.com> <3B195D98.C220C407@engineer.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 03 Jun 2001 01:09:22 GMT NNTP-Posting-Host: 12.82.160.237 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 991530562 12.82.160.237 (Sun, 03 Jun 2001 01:09:22 GMT) NNTP-Posting-Date: Sun, 03 Jun 2001 01:09:22 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:8030 Date: 2001-06-03T01:09:22+00:00 List-Id: "B. Douglas Hilton" wrote: > > Ok, here is the oskit "hello" kernel. Any ideas how to convert this > to Ada? > > #include > #include > #include > #include > > int main() > { > #ifndef KNIT > oskit_clientos_init(); > #endif > #ifdef GPROF > start_fs_bmod(); > start_gprof(); > #endif > oskit_print_version(); > printf("Hello, World\n"); > return 0; > } > The first rule to learn is that Ada should be written as Ada and C should be written as C. Clearly, any standard Ada version would not use a preprocessor. The C preprocessor conditionals provide for conditional compilation of the C sources. The Ada way to achieve the same goal is to provide several versions of the entry point procedure for the program, each one specifying its own set of dependencies. Each of the include files in the C version will require a corresponding Ada package. The Ada package corresponding to stdio.h is clearly Ada.Text_Io. Each of the other included files must be rewritten in Ada. One version of the Ada entry point procedure might look like the following: with Oskit.ClientOs; with OsKit.Startup; with OsKit.Version; with Ada.Text_Io; procedure HelloKernel is begin OsKit.ClientOs.Init; OsKit.Startup.FsBmod; OsKit.Startup.Gprof; OsKit.Version.Print; Ada.Text_Io.Put_Line("Hello World!"); end HelloKernel; Jim Rogers Colorado Springs, Colorado USA