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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,47645c013367a8d6 X-Google-Attributes: gid103376,public From: Stephen Leake Subject: Re: Text control characters Date: 1997/09/12 Message-ID: <341954D6.162C@gsfc.nasa.gov>#1/1 X-Deja-AN: 271896231 References: <5v9vj1$dge$1@goanna.cs.rmit.edu.au> Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA Reply-To: Stephen.Leake@gsfc.nasa.gov Newsgroups: comp.lang.ada Date: 1997-09-12T00:00:00+00:00 List-Id: Dale Stanbrough wrote: > > package Unix.Line_Terminators is > Line_Terminator : constant String := Ascii.LF & ""; > > end; > > with Unix.Line_Terminators; > package OS.Line_Terminators is > > Line_Terminator : String renames Unix.Line_Terminators.Line_Terminator; > > end; > > and then get your configuration system to choose the appropriate with > (maybe even use a preprocessor! to select a with statement). > > Thinking about it, the preprocessor selection of a with statement > would seem to be a fairly benign use of preprocessors. Can anyone see > any great harm in this scheme? you don't need a preprocessor; you can set things up so only the BODY of the package is OS dependent, and let the CM system choose which FILE to use for the body: file os-line_terminator.ads: -------------------- package OS.Line_Terminators is function Line_Terminator return String; end OS.Line_Terminators; -------------------- file os-line_terminator__aix432.adb: -------------------- package body OS.Line_Terminators is -- this is for AIX 4.3.2 function Line_Terminator return String is begin return "" & Ascii.LF; end Line_terminator; end OS.Line_Terminators; -------------------- Under GNAT, since we're not using the conventional name for the body file, we need a configuration pragma: file gnat.adc: -------------------- pragma Source_File_Name (OS.Line_Terminators, BODY_FILE_NAME => "os-line_terminator__aix432.adb"); -------------------- other compilers will have other ways of specifying which file contains which compilation unit. -- - Stephe