Re: I/O streaming with custom data transport



On Wed, 22 Nov 2006 11:39:48 +0100, Maciej Sobczak wrote:

Another issue - what about the text formatting? The standard Put(...)
procedures are quite powerful, is there any way to reuse them (or at
least their logic) with custom streams?

?

Stream-oriented I/O is unformatted per concept of. It is a stream of
elements, not even characters. Formatted I/O is when there are some things
beyond characters, like lines, columns, pages etc.

For formatted buffered I/O use strings. As a block/record/line use String.
You can find an example of string formatting library here:

http://www.dmitry-kazakov.de/ada/strings_edit.htm

For physical I/O, which is a separate issue, you can still use streams,
files, sockets, whatsoever. Just define a primitive operation Write_Line on
the abstract type of the "recipient," which takes String argument. For all
further types of objects use that primitive operation.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: Binary or Ascii Text?
    ... You mean, before Unix developed a uniform notation for text streams, ... misunderstanding Pascal i/o for generations now. ... and structured files -- if not always the same terminators. ...
    (comp.lang.c)
  • Re: Confusion about I/O Streams
    ... >> that I am definitely dealing with byte streams and that classes for ... > Characters are a higher-level abstraction than bytes. ... >> primitives and Strings to my scratchpad and I'm having trouble finding ... that's fine so far but it is only writing a single String to the ...
    (comp.lang.java.help)
  • Re: TCP/IP Sockets with GNAT.Sockets
    ... the problem is the use of attributes 'Output on arrays which output array bounds before array data. ... and since String is an array, String'Output outputs String bounds before string data. ... you should note that the problem is the same in C: when reading a string from a socket, ... Streams while a Socket package isn't required to give any explanations ...
    (comp.lang.ada)
  • Q: Line_IO
    ... Here are two alternative I/O subprograms for Line I/O, in plain Ada, ... pragma Elaborate_Body; ... function Getline return String; ... while Buffer/= Separator_Sequenceloop ...
    (comp.lang.ada)
  • Re: [OT] Re: How does C work on non-unix?
    ... So I can't debate that C makes sense on Unix; ... Pascal and Ada do text I/O as character streams broken into ...
    (comp.lang.c)