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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d54630460ea6a38e X-Google-Attributes: gid103376,public From: Corey Minyard Subject: Re: q: pkg for network/UNIX programming; system dependencies Date: 1997/05/30 Message-ID: #1/1 X-Deja-AN: 245009955 Sender: minyard@wf-rch References: Organization: Wonderforce Research Newsgroups: comp.lang.ada Date: 1997-05-30T00:00:00+00:00 List-Id: Ken Raeburn writes: > I'm thinking about working on a couple small spare-time UNIX projects in > Ada95 to help familiarize myself with the language. Most such projects > I'm considering right now make use of networking, both TCP and UDP. > > I'm looking for a package to help me deal with UNIX system-defined types, > socket- and network-related types and functionality, domain name service, > etc. I've looked at the "paradise" package, which seems to have some of > what I want, but the latest version I could find is about 3 years old, > only works on SunOS and HP-UX and with three specific compilers (none of > which is GNAT), and is specifically conditionalized in various places for > those systems and compilers. If that's the closest thing available, I'll > go with it; I just wanted to know if there's anything else. I have a port of the forest-1.4 library (it compiles without error under GNAT 3.09) with some limited Berkeley socket bindings at http://www.concentric.net/~Minyard. I understand that the standard forest library is not as extensive as paradise, but I have never used paradise. The socket stuff I wrote is pretty limited, and I'm not an Ada95 guru, so if anyone wants to take it and work on it, feel free. > Oh and a general question: How do you usually deal with OS or > configuration dependencies in Ada? For example, some systems have the > utmpx functions, some don't; some have wait4, some don't. Maybe I'm > building a package with a backwards-compatibility option enabled; maybe > it's disabled. In C and UNIX, I'd use #ifdef and maybe an > autoconf-generated script to test the system characteristics and > user-provided options, and define some macros for conditional > compilation. > > The conditionally-compiled region can be very small. Of course, there > are times when it's large, and when it seems worthwhile to use a separate > source file. But there are times when it isn't and it doesn't.... Under Ada, you generally have a file with the machine-dependent portion of the code separated from the machine-indepenent portion. You can link or copy the proper version to the right place to compile it. Ada has no conditional compilation like a #ifdef. I and kind of spoiled by the #ifdef, too, especially for small stuff, but having all the machine-dependent stuff in a separate file makes porting a lot easier because you know where all the stuff you have to fix is. -- Corey Minyard Internet: minyard@acm.org Work: minyard@nortel.ca UUCP: minyard@wf-rch.cirr.com