comp.lang.ada
 help / color / mirror / Atom feed
* Ada95 file management, (Rename, Wildcard)
@ 1998-08-27  0:00 Hans Marqvardsen
  1998-08-28  0:00 ` Markus Kuhn
  1998-08-31  0:00 ` Dr Richard A. O'Keefe
  0 siblings, 2 replies; 7+ messages in thread
From: Hans Marqvardsen @ 1998-08-27  0:00 UTC (permalink / raw)


Two questions:

1: Is it a fact, that Ada95 has no language-defined procedure allowing 
you to rename files, or to search for wildcard filenames ?  

2: Can you do it in Windows NT4, using ObjectAda 7.1 ?

Sincerely, 
Hans Marqvardsen, hm@ddre.dk




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

* Re: Ada95 file management, (Rename, Wildcard)
  1998-08-27  0:00 Ada95 file management, (Rename, Wildcard) Hans Marqvardsen
@ 1998-08-28  0:00 ` Markus Kuhn
  1998-08-30  0:00   ` Hans Marqvardsen
  1998-08-31  0:00 ` Dr Richard A. O'Keefe
  1 sibling, 1 reply; 7+ messages in thread
From: Markus Kuhn @ 1998-08-28  0:00 UTC (permalink / raw)


Hans Marqvardsen wrote:
> 1: Is it a fact, that Ada95 has no language-defined procedure allowing
> you to rename files

Such functions are standardized in the POSIX.5 standard
(IEEE Std 1003.5), not in the Ada Reference Manual. Ada is used
on systems that have no file system, therefore it makes sense
to modularize the standards a bit. The POSIX standard is responsible
for the API for accessing operating resources such as directories,
network connections, etc.

Markus

-- 
Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>




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

* Re: Ada95 file management, (Rename, Wildcard)
  1998-08-31  0:00 ` Dr Richard A. O'Keefe
@ 1998-08-30  0:00   ` Hans Marqvardsen
  1998-08-31  0:00     ` Larry Kilgallen
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Marqvardsen @ 1998-08-30  0:00 UTC (permalink / raw)


Dr Richard A. O'Keefe wrote:
> 
> Hans Marqvardsen wrote:
> > 1: Is it a fact, that Ada95 has no language-defined procedure allowing
> > you to rename files, or to search for wildcard filenames ?
> 
> There are no wildcard facilities in the C89, C++98, Pascal, Fortran 
<snip>
> Renaming and wildcards are *operating-system* features...

Guess, that creating or opening files are operating-system features as
well.
Fortunately, these _are_ included in the RM.

Hans




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

* Re: Ada95 file management, (Rename, Wildcard)
  1998-08-28  0:00 ` Markus Kuhn
@ 1998-08-30  0:00   ` Hans Marqvardsen
  1998-09-02  0:00     ` Dr Richard A. O'Keefe
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Marqvardsen @ 1998-08-30  0:00 UTC (permalink / raw)


Markus Kuhn wrote:
> 
> Hans Marqvardsen wrote:
> > 1: Is it a fact, that Ada95 has no language-defined procedure allowing
> > you to rename files
> 
> Such functions are standardized in the POSIX.5 standard
> (IEEE Std 1003.5), not in the Ada Reference Manual. 
<...>
> Markus G. Kuhn, Security Group, Computer Lab, Cambridge University, UK
> email: mkuhn at acm.org,  home page: <http://www.cl.cam.ac.uk/~mgk25/>

Please, do you mean that this standard will be of help to someone
wanting to rename files under windows NT4.0 ?

If so, where is it found ?

-- Hans.




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

* Re: Ada95 file management, (Rename, Wildcard)
  1998-08-27  0:00 Ada95 file management, (Rename, Wildcard) Hans Marqvardsen
  1998-08-28  0:00 ` Markus Kuhn
@ 1998-08-31  0:00 ` Dr Richard A. O'Keefe
  1998-08-30  0:00   ` Hans Marqvardsen
  1 sibling, 1 reply; 7+ messages in thread
From: Dr Richard A. O'Keefe @ 1998-08-31  0:00 UTC (permalink / raw)


Hans Marqvardsen wrote:
> 1: Is it a fact, that Ada95 has no language-defined procedure allowing
> you to rename files, or to search for wildcard filenames ?

There are no wildcard facilities in the C89, C++98, Pascal, Fortran 90,
or draft Smalltalk language standards.  So those languages have no
language-defined procedures for wildcard searches either.  Come to
think of it, I don't know _any_ international programming language
standards (other that the shell standard in POSIX.2) that cover
wild-card scans.  POSIX.2 also lists an interface that can be called
from other languages, the glob(3c) function, for example.

As for renaming, that's in POSIX.5, the Ada binding for POSIX.1.
It's called Rename, oddly enough.
Renaming and wildcards are *operating-system* features...




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

* Re: Ada95 file management, (Rename, Wildcard)
  1998-08-30  0:00   ` Hans Marqvardsen
@ 1998-08-31  0:00     ` Larry Kilgallen
  0 siblings, 0 replies; 7+ messages in thread
From: Larry Kilgallen @ 1998-08-31  0:00 UTC (permalink / raw)


In article <35E8FD6D.28EE@ddre.dk>, Hans Marqvardsen <hm@ddre.dk> writes:
> Dr Richard A. O'Keefe wrote:
>> 
>> Hans Marqvardsen wrote:
>> > 1: Is it a fact, that Ada95 has no language-defined procedure allowing
>> > you to rename files, or to search for wildcard filenames ?
>> 
>> There are no wildcard facilities in the C89, C++98, Pascal, Fortran 
> <snip>
>> Renaming and wildcards are *operating-system* features...
> 
> Guess, that creating or opening files are operating-system features as
> well.
> Fortunately, these _are_ included in the RM.

Creating files mostly requires that the filename syntax be legal --
this can be accomplished by keeping it deadly simple.  Even with
that, creating files in Ada has this ugly bit known as the Form
parameter, which is where all the non-portable stuff is hidden.
File ownership, RMS attributes, etc. are all hidden there on a
VMS system, making the resulting program quite non-portable.

Now consider wildcarding.  I bet your OS2 system would not
like a a filespec of MY_DEV:[FOO.BAR.][LATEST]FILE.D%T;-0.
But putting the whole filespec in the "hide the system-specific
part" parameter like Form sort of leaves the Ada Rename call
to being one with _no_ standard parameters and _all_ the information
carried in the non-portable parameters.

The Posix people have a method for those willing to accept
least-common-denominator Unix semantics.  A wider general
capability seems impossible.

Larry Kilgallen




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

* Re: Ada95 file management, (Rename, Wildcard)
  1998-08-30  0:00   ` Hans Marqvardsen
@ 1998-09-02  0:00     ` Dr Richard A. O'Keefe
  0 siblings, 0 replies; 7+ messages in thread
From: Dr Richard A. O'Keefe @ 1998-09-02  0:00 UTC (permalink / raw)


Hans Marqvardsen wrote:
> > Such functions are standardized in the POSIX.5 standard
> > (IEEE Std 1003.5), not in the Ada Reference Manual.
> <...>

> Please, do you mean that this standard will be of help to someone
> wanting to rename files under windows NT4.0 ?
> 
> If so, where is it found ?

Microsoft claim that Windows NT is POSIX-compliant, or has a
POSIX-compliant subsystem, so it _should_ be useful.  You get
the standard from the IEEE.  You get the code from your Ada
vendor.

More seriously, you presumably want to call the Windows functions

   MoveFile(old, new)
or MoveFileEx(old, new, how)
   FindFirstFile(pat, resultptr)
   FindNextFile(hnd, resultptr)
   FindClose(hnd)

The tricky thing here is that you need
   BOOL (whatever _that_ is implemented as)
   HANDLE (whatever _that_ is implemented as)
   LPSTR ('long' pointer to C-style string)
   LPWIN32_FIND_DATA ('long pointer' to WIN32_FIND_DATA record,
     which contains DWORD, FILETIME, C string, and a nasty
     instance of an int64_t that has been broken into two pieces).

Your Windows Ada compiler should have come with some information
about how to access Windows API elements.  ObjectAda, even the
free version, certainly does.

If for some reason you are using an Ada95 compiler for which you
do not have adequate documentation, and you _also_ have a C
compiler, your best bet might be to write your own C functions
as "glue code" and use Ada95's standard C interface to call them.




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

end of thread, other threads:[~1998-09-02  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-27  0:00 Ada95 file management, (Rename, Wildcard) Hans Marqvardsen
1998-08-28  0:00 ` Markus Kuhn
1998-08-30  0:00   ` Hans Marqvardsen
1998-09-02  0:00     ` Dr Richard A. O'Keefe
1998-08-31  0:00 ` Dr Richard A. O'Keefe
1998-08-30  0:00   ` Hans Marqvardsen
1998-08-31  0:00     ` Larry Kilgallen

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