comp.lang.ada
 help / color / mirror / Atom feed
* procedure Create(file : in out File_Type; from : in Stream_Access); ?
@ 2003-09-29  8:45 Lutz Donnerhacke
  2003-09-29 14:11 ` sk
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Lutz Donnerhacke @ 2003-09-29  8:45 UTC (permalink / raw)


Knows anybody out there a way to create a File_Type (for Ada.Text_IO) from a
Ada.Streams.Root_Type derivate?



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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-29  8:45 procedure Create(file : in out File_Type; from : in Stream_Access); ? Lutz Donnerhacke
@ 2003-09-29 14:11 ` sk
  2003-09-29 14:21   ` Lutz Donnerhacke
  2003-09-29 15:14 ` Stephen Leake
  2003-10-01 11:19 ` sk
  2 siblings, 1 reply; 13+ messages in thread
From: sk @ 2003-09-29 14:11 UTC (permalink / raw)
  To: comp.lang.ada

lutz@iks-jena.de:
 > Knows anybody out there a way to create a File_Type (for
 > Ada.Text_IO) from a  Ada.Streams.Root_Type derivate?

Without knowing exactly what you are aiming at :

1) Cut'n'paste File_Type into your code; manually
hook the stream in; UC it into and Ada.Text_Io file type.

2) If possible (using GNAT 3.15p packages) try using
the package Ada.Text_Io.C_Streams which can hook up
a "C" style stream to an Ada.Text_Io.File_Type.

Not much help, but I vaguely recall that the 2nd method
(Ada.Text_Io.C_Streams.Open) can be very useful in that
one can use Text_Io to do the parsing instead of having
to reimplement parsers to look for "CRLF" or "LF" etc
for oneself.

-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------




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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-29 14:11 ` sk
@ 2003-09-29 14:21   ` Lutz Donnerhacke
  2003-09-29 16:36     ` sk
  0 siblings, 1 reply; 13+ messages in thread
From: Lutz Donnerhacke @ 2003-09-29 14:21 UTC (permalink / raw)


* sk wrote:
> lutz@iks-jena.de:
> > Knows anybody out there a way to create a File_Type (for
> > Ada.Text_IO) from a  Ada.Streams.Root_Type derivate?
>
> Without knowing exactly what you are aiming at :

You got the point exactly enough. I'd like to apply Text_IO procedures to a
Stream (i.e. from GNAT.Sockets).

> 1) Cut'n'paste File_Type into your code; manually
> hook the stream in; UC it into and Ada.Text_Io file type.
>
> 2) If possible (using GNAT 3.15p packages) try using
> the package Ada.Text_Io.C_Streams which can hook up
> a "C" style stream to an Ada.Text_Io.File_Type.

Found both yesterday, but:
 1) is very implementation dependant.
 2) requires an non portable way to convert GNAT.Sockets.Streams into
    C_Streams.

> Not much help, but I vaguely recall that the 2nd method
> (Ada.Text_Io.C_Streams.Open) can be very useful in that
> one can use Text_Io to do the parsing instead of having
> to reimplement parsers to look for "CRLF" or "LF" etc
> for oneself.

Exactly. I'm looking f�r CRLF in the stream. Now I wrote a Get_Line myself.
:-/



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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-29  8:45 procedure Create(file : in out File_Type; from : in Stream_Access); ? Lutz Donnerhacke
  2003-09-29 14:11 ` sk
@ 2003-09-29 15:14 ` Stephen Leake
  2003-09-29 19:29   ` Lutz Donnerhacke
  2003-10-01 11:19 ` sk
  2 siblings, 1 reply; 13+ messages in thread
From: Stephen Leake @ 2003-09-29 15:14 UTC (permalink / raw)


Lutz Donnerhacke <lutz@iks-jena.de> writes:

> Knows anybody out there a way to create a File_Type (for Ada.Text_IO) from a
> Ada.Streams.Root_Type derivate?

I don't see how this would be possible; a stream may not be a file (it
may be a socket or just memory, for example).

Why do you want to do this? Perhaps there is another way ...

-- 
-- Stephe



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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-29 14:21   ` Lutz Donnerhacke
@ 2003-09-29 16:36     ` sk
  0 siblings, 0 replies; 13+ messages in thread
From: sk @ 2003-09-29 16:36 UTC (permalink / raw)
  To: comp.lang.ada

lutz@iks-jena.de:
 > Exactly. I'm looking f�r CRLF in the stream. Now I wrote a
 > Get_Line myself.

I have one if you are interested. Part of a package
"Internet.Pop3" which I am polishing up at the moment
since there seems to be interest in recent threads.

-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------




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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-29 15:14 ` Stephen Leake
@ 2003-09-29 19:29   ` Lutz Donnerhacke
  2003-09-30 12:34     ` Jean-Pierre Rosen
  0 siblings, 1 reply; 13+ messages in thread
From: Lutz Donnerhacke @ 2003-09-29 19:29 UTC (permalink / raw)


* Stephen Leake wrote:
> Lutz Donnerhacke <lutz@iks-jena.de> writes:
>> Knows anybody out there a way to create a File_Type (for Ada.Text_IO) from a
>> Ada.Streams.Root_Type derivate?
>
> I don't see how this would be possible; a stream may not be a file (it
> may be a socket or just memory, for example).

All my programs does read data sequentially from a file/stream. So I use as
file as a stream. That's why, I'd like to handle a Stream with the common
Text_IO functions.

> Why do you want to do this? Perhaps there is another way ...

Sure. I can rewrite 'Read and 'Write.



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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-29 19:29   ` Lutz Donnerhacke
@ 2003-09-30 12:34     ` Jean-Pierre Rosen
  2003-09-30 13:27       ` Lutz Donnerhacke
  0 siblings, 1 reply; 13+ messages in thread
From: Jean-Pierre Rosen @ 2003-09-30 12:34 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 822 bytes --]


"Lutz Donnerhacke" <lutz@iks-jena.de> a �crit dans le message de news:slrnbnh205.dsr.lutz@belenus.iks-jena.de...
> * Stephen Leake wrote:
> > Lutz Donnerhacke <lutz@iks-jena.de> writes:
> >> Knows anybody out there a way to create a File_Type (for Ada.Text_IO) from a
> >> Ada.Streams.Root_Type derivate?
> >
> > I don't see how this would be possible; a stream may not be a file (it
> > may be a socket or just memory, for example).
>
> All my programs does read data sequentially from a file/stream. So I use as
> file as a stream. That's why, I'd like to handle a Stream with the common
> Text_IO functions.
>
Did you notice Ada.Text_IO.Text_Streams (A.12.2) ?

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-30 12:34     ` Jean-Pierre Rosen
@ 2003-09-30 13:27       ` Lutz Donnerhacke
  2003-09-30 14:24         ` Jean-Pierre Rosen
  0 siblings, 1 reply; 13+ messages in thread
From: Lutz Donnerhacke @ 2003-09-30 13:27 UTC (permalink / raw)


* Jean-Pierre Rosen wrote:
> "Lutz Donnerhacke" <lutz@iks-jena.de> a �crit dans le message de news:slrnbnh205.dsr.lutz@belenus.iks-jena.de...
>> All my programs does read data sequentially from a file/stream. So I use as
>> file as a stream. That's why, I'd like to handle a Stream with the common
>> Text_IO functions.
>>
> Did you notice Ada.Text_IO.Text_Streams (A.12.2) ?

This is the other way around.



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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-30 13:27       ` Lutz Donnerhacke
@ 2003-09-30 14:24         ` Jean-Pierre Rosen
  2003-10-01  0:10           ` sk
  0 siblings, 1 reply; 13+ messages in thread
From: Jean-Pierre Rosen @ 2003-09-30 14:24 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]


"Lutz Donnerhacke" <lutz@iks-jena.de> a �crit dans le message de news:slrnbnj15t.nr.lutz@taranis.iks-jena.de...
> > Did you notice Ada.Text_IO.Text_Streams (A.12.2) ?
>
> This is the other way around.
???
With this package, you have both a File and a Stream refering to the same physical file.
You can use that any way you want.
Unless I missed something?

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-30 14:24         ` Jean-Pierre Rosen
@ 2003-10-01  0:10           ` sk
  2003-10-01  7:34             ` Jean-Pierre Rosen
  0 siblings, 1 reply; 13+ messages in thread
From: sk @ 2003-10-01  0:10 UTC (permalink / raw)
  To: comp.lang.ada

rosen@adalog.fr:
 > With this package, you have both a File and a Stream refering
 > to the same physical file.You can use that any way you want.
 > Unless I missed something?

The Gnat 3.15p Ada.Text_Io.Text_Streams provides stream
access to an Ada.Text_Io.File_Type, not the other way
around (an Ada.Text_Io.File_Type from an Ada Stream)
unless I am missing something :-)


-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------




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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-10-01  0:10           ` sk
@ 2003-10-01  7:34             ` Jean-Pierre Rosen
  2003-10-01 12:32               ` Lutz Donnerhacke
  0 siblings, 1 reply; 13+ messages in thread
From: Jean-Pierre Rosen @ 2003-10-01  7:34 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 820 bytes --]


"sk" <noname@myob.com> a �crit dans le message de news:mailman.19.1064966674.25614.comp.lang.ada@ada-france.org...
> rosen@adalog.fr:
>  > With this package, you have both a File and a Stream refering
>  > to the same physical file.You can use that any way you want.
>  > Unless I missed something?
>
> The Gnat 3.15p Ada.Text_Io.Text_Streams provides stream
> access to an Ada.Text_Io.File_Type, not the other way
> around (an Ada.Text_Io.File_Type from an Ada Stream)
> unless I am missing something :-)
>
So, if I understand correctly, you want a Text_IO.File_Type from
*any* stream? Can't you use Ada.Text_IO.Text_Streams.Stream_Access
right from the start?

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-09-29  8:45 procedure Create(file : in out File_Type; from : in Stream_Access); ? Lutz Donnerhacke
  2003-09-29 14:11 ` sk
  2003-09-29 15:14 ` Stephen Leake
@ 2003-10-01 11:19 ` sk
  2 siblings, 0 replies; 13+ messages in thread
From: sk @ 2003-10-01 11:19 UTC (permalink / raw)
  To: comp.lang.ada

rosen@adalog.fr:
 > So, if I understand correctly, you ...

I think the threads are crossed-up or getting dropped.

The OP is <lutz@iks-jena.de> and it turns out
that the OP is trying to parse CRLF from a
Gnat.Sockets supplied Stream.


-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------




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

* Re: procedure Create(file : in out File_Type; from : in Stream_Access); ?
  2003-10-01  7:34             ` Jean-Pierre Rosen
@ 2003-10-01 12:32               ` Lutz Donnerhacke
  0 siblings, 0 replies; 13+ messages in thread
From: Lutz Donnerhacke @ 2003-10-01 12:32 UTC (permalink / raw)


* Jean-Pierre Rosen wrote:
> So, if I understand correctly, you want a Text_IO.File_Type from
> *any* stream?

Yes, I do.

> Can't you use Ada.Text_IO.Text_Streams.Stream_Access right from the
> start?

No. I have GNAT.Sockets.Socket_Type.



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

end of thread, other threads:[~2003-10-01 12:32 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-29  8:45 procedure Create(file : in out File_Type; from : in Stream_Access); ? Lutz Donnerhacke
2003-09-29 14:11 ` sk
2003-09-29 14:21   ` Lutz Donnerhacke
2003-09-29 16:36     ` sk
2003-09-29 15:14 ` Stephen Leake
2003-09-29 19:29   ` Lutz Donnerhacke
2003-09-30 12:34     ` Jean-Pierre Rosen
2003-09-30 13:27       ` Lutz Donnerhacke
2003-09-30 14:24         ` Jean-Pierre Rosen
2003-10-01  0:10           ` sk
2003-10-01  7:34             ` Jean-Pierre Rosen
2003-10-01 12:32               ` Lutz Donnerhacke
2003-10-01 11:19 ` sk

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