gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Gm2] iso streams


From: Breeden, Thomas (tmb)
Subject: RE: [Gm2] iso streams
Date: Fri, 4 Jun 2010 17:12:08 -0400

> -----Original Message-----
> From: address@hidden [mailto:gm2-
> address@hidden On Behalf Of Martin Kalbfuß
> Sent: June 04, 2010 3:12 PM
> To: GNU Modula-2
> Subject: [Gm2] iso streams
> 
> Hi,
> 
> I try to understand the streams of ISO Modula-2. And I'm a bit confused.
> Maybe someone can help me a bit? That would be kind.
> 
> I try to understand how to create temporary memory only stream. I don't
> want to write to a mass storage.
> But how?
> 
> I found the IOLink module. There you can create a unique stream. Fine.
> But how to proceed? If I now try to write to the stream, an exception is
> thrown telling me that the stream isn't prepared.
> 
> It would be nice if someone could give me a short explanation about the
> different stream types, too.
> 
> Many thanks,
> Martin
> 

Hi,

I put together a stream for writing text to memory a while ago

see this web page for download: 

User Device for ISO Std Channel I/O to Memory
http://www.modula2.org/projects/tbchans.php

It gives a text stream (IOChan) which I named "TBChan" because I layered
it on top of a TextBlocks module I already had.

I was working pretty much in the dark, but followed the pattern of the source
code in SeqFile and Terminal. I've forgotten, but looking at the code it
is a matter of 
   > using IOLink to AllocateDevice in your stream handler module 
initialization code
   > implementing the usual Open() and Close() procs for export
   > implementing the specific procs for callback from TextIO - Skip(), Look()
     TextRead(), TextWrite() etc.
   > using IOLinks to MakeChan() for the ChanId structure, and filling the proc 
fields
     with your callbacks.

TBChans is not high on the efficiency scale, but if you want to use it let me 
know, and I'll
check to see if I have any bugfixes since that was posted on www.modula2.org.

regards,

Tom

Tom Breeden
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]