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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,3869f0598191b11d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!01cc3b7c!not-for-mail Reply-To: "Richard Riehle" From: "Richard Riehle" Newsgroups: comp.lang.ada References: Subject: Re: Porting ADA source X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 Message-ID: Date: Sat, 31 Jul 2004 16:04:35 GMT NNTP-Posting-Host: 66.81.223.93 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.pas.earthlink.net 1091289875 66.81.223.93 (Sat, 31 Jul 2004 09:04:35 PDT) NNTP-Posting-Date: Sat, 31 Jul 2004 09:04:35 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:2471 Date: 2004-07-31T16:04:35+00:00 List-Id: Porting from DEC to anything else can be very entertaining, especially when numerics are involved. The sign bit, on the VAX, is not located where you might think. Confronted with this problem, in a one-time conversion, many years ago, we opted to convert the VAX numerics to human-readable (using Text_IO) and read them back into the target system, again using Text_IO. This is a brute-force approach, but it was suitable to the problem at-hand at that time. NOTE: For some reason, many long-term users of Ada do not realize that these conversions are already a part of the language and found in the nested IO packages within Text_IO. We first tried to create an algorithm to convert the VAX word into the word of our target platform. That turned out to be an ugly mess with lots of code to verify the correctness of each translated word. It is even more fun when the DEC word represents a floating point value and needs to be converted to a floating point value on the target. I realize this is only part of your problem, but others may want to contribute additional recommedations based on their direct experience. Richard Riehle "Giacomo Polizzi" wrote in message news:cdfu3s$k1a$1@e3k.asi.ansaldo.it... > Hello, > > I have to port an ADA program from an Unix DEC Alpha machine with a DEC ADA > compiler to a Linux pc machine with gnat (gcc) compiler. > > The task is to have, if possible, an unique source code compilable on both > platforms but there are the following problems: > > 1) some system packages that execute the same kind of operations have > different names in the two compilers > > 2) some system functions (for example mathematical function) have different > names in the two compilers > > 3) the word length is 64 bits on DEC Alpha and 32 bits on pc so it is not > always possible to use the same standard type (for example the long type is > 64 bits on Alpha and 32 bits on pc) > > 4) the standard type (long long) used by gcc on pc to solve the previous > problem is not supported by the DEC ADA compiler > > 5) the different word length modifies some structure length used to define > interface messages with other external programs > > Is there something like #IFDEF of C language that I can use in ADA ? > > Is there any other kind of solution for the above problems ? > > Thanks to everybody > > Giacomo > >