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,26aa6d7095c151,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-18 01:28:35 PST Message-ID: <3DAFC542.152C0EE0@lml.ls.fi.upm.es> Date: Fri, 18 Oct 2002 10:24:34 +0200 From: Manuel Collado X-Mailer: Mozilla 4.75 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Porting from Modula-2 to Ada Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 138.100.10.20 X-Trace: 18 Oct 2002 10:21:47 +0100, 138.100.10.20 Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-ge.switch.ch!news.rediris.es!news-2.rediris.es!138.100.251.9.MISMATCH!news.upm.es!138.100.10.20 Xref: archiver1.google.com comp.lang.ada:29893 Date: 2002-10-18T10:24:34+02:00 List-Id: We are porting some legacy Modula-2/C code to Ada. The code uses low-level facilities from Modula-2 and C. We would like to port it to clean Ada, without interfacing to C code. In addition we would like to keep the old interface unchanged (if possible). Al present we are looking for ways to manage memory and binary files as arrays of bytes. The trouble is that Modula-2 allows the use of relaxed ARRAY OF BYTE subprogram formal parameters, that are compatible with actual parameters of any type. Example: PROCEDURE Xxx( raw: ARRAY OF BYTE ); ... BEGIN FOR k := 0 TO HIGH(raw) DO ... raw[k] .... END END Xxx; Num: INTEGER; ... Xxx( Num ); ... So far, my only porting scheme is to replace ARRAY OF BYTE parameters by the pair (address, size), as follows: procedure Xxx (Raw_Address: System.Address; Raw_Size: Integer) ... Num: Integer; ... Xxx (Num'Address, Num'Size); ... But this requires recoding every call to the procedure. Is there another way to pass raw data without having to recode every call? Thanks. -- To reply by e-mail, please remove the extra dot in the given address: m.collado -> mcollado