glob2-devel
[Top][All Lists]
Advanced

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

Re: [glob2-devel] Stream I/O


From: Andrew Sayers
Subject: Re: [glob2-devel] Stream I/O
Date: Sat, 1 Oct 2005 15:49:15 +0100
User-agent: Mutt/1.5.11

Ah, I hadn't realised that.  If the format is being used in the wild, I
agree it's worth the extra effort to have a more readable format.  And
of course, just as important is the fact that everyone already knows how
it works, and that we have a body of files written in that format.  I'll
have another go at writing a parser and see how things go.

At any rate, I completely agree that accepting text input is important -
in fact, using C++ iostreams, it's pretty easy to prompt the user to
input data on the standard input.

For an idea of the code I'm looking at, here are some files I've
uploaded to CVS recently:

        
http://savannah.nongnu.org/cgi-bin/viewcvs/glob2/glob2/testing/Attic/StreamTest.cpp?rev=1.1.2.3&only_with_tag=map-rewrite&content-type=text/vnd.viewcvs-markup
        Test program for stream I/O - shows the basic functioning of the
        library

        
http://savannah.nongnu.org/cgi-bin/viewcvs/glob2/glob2/doc/Attic/Streams.txt?rev=1.1.2.2&only_with_tag=map-rewrite&content-type=text/vnd.viewcvs-markup
        Text file documenting the proposed Glob2 I/O module, for
        programmers wanting to use it.

        
http://savannah.nongnu.org/cgi-bin/viewcvs/glob2/glob2/src/Attic/Grid.h?rev=1.1.2.16&only_with_tag=map-rewrite&content-type=text/vnd.viewcvs-markup
        "Grid" is a new class, the base class of "Map".  Grids
        themselves are a long story, but near the bottom of the file is
        an example of a (relatively complex) set of input/output
        operators.

        
http://savannah.nongnu.org/cgi-bin/viewcvs/glob2/glob2/libgag/include/Attic/Ostream.h?rev=1.1.2.1&only_with_tag=map-rewrite&content-type=text/vnd.viewcvs-markup
        Implementation of output streams - not to be read by pregnant
        women or people with heart conditions ;)

These files were written before I knew about text input was used in
practice, and I've already changed my mind about some things for other
reasons (like the extraneous spaces in the binary Grid I/O).  Obviously,
comments are welcome, but my answer might be "check the latest upload"
:)

One thing I would like to stand behind though is the ability to "stuff"
several values into a single variable.  For example, the grid should
print out something like this:

Grid
{
       Grid = 
252 253 253 253 253
252   0 254 254 253
252   0 255 254 253
252   0 254 254 253
252 253 253 253 253;
}

Although this is technically non-standard, it should be pretty easy to
parse, and is much easier to read than something like:

Grid
{
        0 = 252
        1 = 253
        2 = 253
        3 = 253
        4 = 253
        5 = 252
        ...
}

        - Andrew




reply via email to

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