comp.lang.ada
 help / color / mirror / Atom feed
* Ada Procedures Required for GNAT 3.10p (for DOS) Port
@ 2003-07-16 14:53 Debs Wisbey
  2003-07-16 20:14 ` Gautier Write-only
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Debs Wisbey @ 2003-07-16 14:53 UTC (permalink / raw)


All,

I am trying to port an old bit of code from the Alsys Compiler to GNAT
3.01p for DOS and have come across a few problems.  Unfortunately, my
Ada knowledge is not a string as I would like or require and so have a
limited knowledge of the available packages.

I am trying to write an Ada procedure that can call DOS commands from
an Ada program that is running on a 386 machine that ONLY runs DOS.
 
I am trying to write an Ada procedure that can rename a file, given
the old filename and new filename as strings.

I am trying to write an Ada procedure that can write to/read from
address locations.

Does anyone know if there are any Ada packages that contain
functionality to perform these tasks?

Thank you for any help that you can give me,
Debs.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Procedures Required for GNAT 3.10p (for DOS) Port
  2003-07-16 14:53 Ada Procedures Required for GNAT 3.10p (for DOS) Port Debs Wisbey
@ 2003-07-16 20:14 ` Gautier Write-only
  2003-07-17  0:03 ` Jerry van Dijk
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gautier Write-only @ 2003-07-16 20:14 UTC (permalink / raw)


Debs Wisbey:

> I am trying to write an Ada procedure that can call DOS commands from
> an Ada program that is running on a 386 machine that ONLY runs DOS.

Hello again! I suspect that in dos_paqs.zip (link below) you'll find
what you are looking for. Especially the "Exec_command" procedure...

> I am trying to write an Ada procedure that can rename a file, given
> the old filename and new filename as strings.

Exec_command("ren old.ext new.ext");

> I am trying to write an Ada procedure that can write to/read from
> address locations.

Where ? In the "DOS zone" or in the graphics one or ?...
Anyway you can mimick the code in VGAGraph and SVGA.
I'd take a look at
http://users.ncrvnet.nl/gmvdijk/other_os.html#VGAPCK

________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Procedures Required for GNAT 3.10p (for DOS) Port
  2003-07-16 14:53 Ada Procedures Required for GNAT 3.10p (for DOS) Port Debs Wisbey
  2003-07-16 20:14 ` Gautier Write-only
@ 2003-07-17  0:03 ` Jerry van Dijk
  2003-07-17  1:45 ` Jeffrey Carter
  2003-07-17  2:03 ` Randy Brukardt
  3 siblings, 0 replies; 6+ messages in thread
From: Jerry van Dijk @ 2003-07-17  0:03 UTC (permalink / raw)



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



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Procedures Required for GNAT 3.10p (for DOS) Port
  2003-07-16 14:53 Ada Procedures Required for GNAT 3.10p (for DOS) Port Debs Wisbey
  2003-07-16 20:14 ` Gautier Write-only
  2003-07-17  0:03 ` Jerry van Dijk
@ 2003-07-17  1:45 ` Jeffrey Carter
  2003-07-17 13:25   ` Frank J. Lhota
  2003-07-17  2:03 ` Randy Brukardt
  3 siblings, 1 reply; 6+ messages in thread
From: Jeffrey Carter @ 2003-07-17  1:45 UTC (permalink / raw)


Debs Wisbey wrote:
> 
> I am trying to port an old bit of code from the Alsys Compiler to GNAT
> 3.01p for DOS and have come across a few problems.  Unfortunately, my
> Ada knowledge is not a string as I would like or require and so have a
> limited knowledge of the available packages.

I don't think it is a good idea for your Ada knowledge to be a string :)

> I am trying to write an Ada procedure that can call DOS commands from
> an Ada program that is running on a 386 machine that ONLY runs DOS.
>  
> I am trying to write an Ada procedure that can rename a file, given
> the old filename and new filename as strings.

I don't recall 3.10 very well. Does GNAT.OS_Lib exist for that release? 
If so, Spawn will do these kinds of things for you. You use the program 
"command" and give it the arguments "/c desired-command arguments". For 
example, for renaming a file, you would pass the arguments

"/c ren " & Old_Name & ' ' & New_Name

-- 
Jeff Carter
"You tiny-brained wipers of other people's bottoms!"
Monty Python & the Holy Grail




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Procedures Required for GNAT 3.10p (for DOS) Port
  2003-07-16 14:53 Ada Procedures Required for GNAT 3.10p (for DOS) Port Debs Wisbey
                   ` (2 preceding siblings ...)
  2003-07-17  1:45 ` Jeffrey Carter
@ 2003-07-17  2:03 ` Randy Brukardt
  3 siblings, 0 replies; 6+ messages in thread
From: Randy Brukardt @ 2003-07-17  2:03 UTC (permalink / raw)


For what's it's worth, all of that functionality is in the MS-DOS versions
of Janus/Ada, which are still available and supported (see
www.rrsoftware.com).

                 Randy.

"Debs Wisbey" <debs.wisbey@amsjv.com> wrote in message
news:b3b4e2d7.0307160653.691c5ca3@posting.google.com...
> All,
>
> I am trying to port an old bit of code from the Alsys Compiler to GNAT
> 3.01p for DOS and have come across a few problems.  Unfortunately, my
> Ada knowledge is not a string as I would like or require and so have a
> limited knowledge of the available packages.
>
> I am trying to write an Ada procedure that can call DOS commands from
> an Ada program that is running on a 386 machine that ONLY runs DOS.
>
> I am trying to write an Ada procedure that can rename a file, given
> the old filename and new filename as strings.
>
> I am trying to write an Ada procedure that can write to/read from
> address locations.
>
> Does anyone know if there are any Ada packages that contain
> functionality to perform these tasks?
>
> Thank you for any help that you can give me,
> Debs.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Ada Procedures Required for GNAT 3.10p (for DOS) Port
  2003-07-17  1:45 ` Jeffrey Carter
@ 2003-07-17 13:25   ` Frank J. Lhota
  0 siblings, 0 replies; 6+ messages in thread
From: Frank J. Lhota @ 2003-07-17 13:25 UTC (permalink / raw)


"Jeffrey Carter" <spam@spam.com> wrote in message
news:3F16004D.7000902@spam.com...
> Debs Wisbey wrote:
> >
> > Unfortunately, my
> > Ada knowledge is not a string as I would like or require and so have a
> > limited knowledge of the available packages.
>
> I don't think it is a good idea for your Ada knowledge to be a string :)

I would recommend that your Ada knowledge be an Unbounded_String, so that it
can be expanded as needed. :)





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-07-17 13:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-16 14:53 Ada Procedures Required for GNAT 3.10p (for DOS) Port Debs Wisbey
2003-07-16 20:14 ` Gautier Write-only
2003-07-17  0:03 ` Jerry van Dijk
2003-07-17  1:45 ` Jeffrey Carter
2003-07-17 13:25   ` Frank J. Lhota
2003-07-17  2:03 ` Randy Brukardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox