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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dc22a6c765e4ced6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-20 07:55:54 PST Path: archiver1.google.com!newsfeed.google.com!postnews1.google.com!not-for-mail From: pauljud@yahoo.com (Paul Jud) Newsgroups: comp.lang.ada Subject: Re: converting VADS Ada 83 code to GNAT Ada 95 Date: 20 Jul 2001 07:55:53 -0700 Organization: http://groups.google.com/ Message-ID: <51614484.0107200655.1d7a93d3@posting.google.com> References: NNTP-Posting-Host: 12.13.226.12 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 995640953 8389 127.0.0.1 (20 Jul 2001 14:55:53 GMT) X-Complaints-To: groups-support@google.com NNTP-Posting-Date: 20 Jul 2001 14:55:53 GMT Xref: archiver1.google.com comp.lang.ada:10336 Date: 2001-07-20T14:55:53+00:00 List-Id: The gnatchop hint is probably the one that will save people the most time. It worked great. Did you create your own packages to handle things like interrupts, mutexes, mailboxes, and tasking calls that were used in VADS or did you find another way to handle those (I am specifically thinking about GNAT for NT)? Do you know of any online sources for VADS documentation of the libraries and the calls that I will probably have to rewrite? I also found that the math functions can mostly be replaced with Ada.Numerics.xxx Paul Jud "Terry Westley" wrote in message news:... > Since there's always an interest in this topic and I answered a question on > Team-Ada mailing list, I decided to post a copy here of our experience > converting VADS Ada 83 code to GNAT Ada 95... > > Posted to the Team-Ada mailing list: > > > I have a requirement where in i have to port code from VADS Ada 83 > > compiler to GNAT Ada 95 compiler. My query is, if there is any tool > > available for this work or any guideline sort of thing which helps in > > porting. > > We recently completed converting ~750K SLOC of VADS Ada 83 code > to GNAT Ada 95. I know of no tool to do the heavy lifting for > you. Here are some tips that may prove useful. I concur with > David Hoos that the major difficulty is in how much you used > VADS-specific features (such as passive tasking) and VADS library > calls. > > First and foremost, do NOT ignore any GNAT warning messages unless > you understand the warning and choose to leave it there. We tried > to eliminate all warning messages by correcting the code. Trust > the compiler; it's your best tool. > > We didn't have the luxury to stop all development while doing > the conversion, so we preserved VADS implementations in package > bodies along with parallel Ada95 implementations for awhile. > > 1) Use gnatchop to separate compilation units into separate files > and to rename files as needed. > > 2) We created our own packages which mirrored the purpose of some > of the VADS packages. Each of these packages had two bodies, > the VADS/Ada83 body and the GNAT/Ada95 body. As it turns out, > very little code was GNAT-specific since there's lots more > predefined packages to handle things like unbounded strings, > command line arguments, environment variables, and random numbers, > and exception information in Ada95 than in Ada83. > > 3) We replaced all references to VADS Os_Files and File_Support > with our own Unix I/O packages rather than using GNAT-specific > packages. POSIX may have been a better choice, but this is > what we did. > > 4) Replace "pragma Optimize_Code" with "pragma Optimize." > > 5) Replace "System.No_Addr" with "System.Null_Address." > > 6) Replace "pragma Inline_Only" with "pragma Inline." > > 7) Replace "Natural'size" and "Positive'size" with "Integer'size." > This is because Natural'size is 31 bits in Ada since you can fit > a Natural in 31 bits. The VADS implementers interpreted this > differently and we didn't know any better. You'll also want to > evaluate your use of Boolean'size. > > 8) Change all tasks with "pragma passive" to protected records. > Our experience is that GNAT protected records are VERY efficient. > Better than VADS passive tasks. > > 9) Examine all arrays of Boolean for whether or not you need > to use pragma Pack. > > 10) Access types to unconstrained types are 64 bits in GNAT. Watch > out for unchecked conversion of access types to System.ADDRESS. > Compiler will warn you. A workaround is to add a size representation > clause: for Some_Access_Type'size use 32. > > 11) If your target is Solaris, you'll find that each exception handler > setup will cost some CPU time since there's no Solaris zero-cost > exception handling capability. "When others" is cheaper than > specific handlers. > > This certainly isn't comprehensive, but it may help a little.