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,c425816b20dec2e2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-16 17:12:28 PST Sender: jerry@localhost Newsgroups: comp.lang.ada Subject: Re: Ada Procedures Required for GNAT 3.10p (for DOS) Port References: From: Jerry van Dijk Date: 17 Jul 2003 02:03:14 +0200 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.93 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: slip32-106-5-86.rot.nl.prserv.net X-Trace: 17 Jul 2003 00:10:46 GMT, slip32-106-5-86.rot.nl.prserv.net Organization: Global Network Services - Remote Access Mail & News Services X-Complaints-To: abuse@prserv.net Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!newspeer1-gui.server.ntli.net!ntli.net!news-hub.cableinet.net!blueyonder!amsnews01.chello.com!cleanfeed.casema.net!newsfeed.uk.prserv.net!newsfeed2.us.prserv.net!prserv.net!news3.prserv.net!slip32-106-5-86.rot.nl.prserv.net Xref: archiver1.google.com comp.lang.ada:40369 Date: 2003-07-17T02:03:14+02:00 List-Id: To complete Gautiers response: > I am trying to write an Ada procedure that can rename a file, given > the old filename and new filename as strings. A perhaps better way is to use the embedded C DOS library. For example: -- Example of Rename under DOS. UNTESTED !!! with System; -- needed for Rename !!! with Ada.Text_IO; procedure Check is -- RENAME -- -- Renames file using the embedded DOS C library. -- -- If New_Name exists it is deleted! -- Wildcards are not allowed. -- -- Returns False if rename fails function Rename (Old_Name, New_Name : String) return Boolean; function Rename (Old_Name, New_Name : String) return Boolean is C_Old : String := Old_Name & ASCII.NUL; C_New : String := New_Name & ASCII.NUL; function Clib_Rename (Old_Name, New_Name : System.Address) return Integer; pragma Import (C, Clib_Rename, "_rename"); begin return Clib_Rename (C_Old'Address, C_New'Address) = 0; end Rename; begin if Rename ("oops", "glob") = True then Ada.Text_IO.Put_Line ("Success"); else Ada.Text_IO.Put_Line ("Failure"); end if; end Check; Untested as I do not have DOS handy right now. We could help more if you gave the specification/documentation of the original function. > I am trying to write an Ada procedure that can write to/read from > address locations. That is more difficult to answer. As Gautier noted it depends on what memory you want to access. Remember that your GNAT program will be 32-bit protected mode code instead of 16-bit realmode code. Not only is memory protected, it is also using virtual memory adresses instead of the physical addresses that DOS uses. Yes, it can be accessed by using DPMI magic, but the way to do it depends on what memory needs to be accessed: video memory (character or graphical), bios, dos, program, IO card, etc. Hope this helps, email if you need more help. -- -- Jerry van Dijk | email: jvandyk@attglobal.net -- Leiden, Holland | web: users.ncrvnet.nl/gmvdijk