www.digitalmars.com         C & C++   DMDScript  

c++ - Open-RJ 1.3.1 released

reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
This is a minor update, primarily comprising the addition of record 
comment information representation by the API. (Previously, the 
comments used on records within Open-RJ database files were not 
available at the programmatic level.

This does not contain any write functionality that's currently 
underway in collaboration with Lars Ivar Igesund.

Download from http://openrj.org/ (redirects to SourceForge)

Details:

================================================================================
23rd May 2005 : Open-RJ 1.2.1 => 1.3.1
--------------------------------------------------------------------------------

The main change is that record comments are now made available in 
the API, in
the form of the 'comment' member of the ORJRecordA structure, and 
the
ORJ_Record_GetCommentA() function.

There is also a new auto-link header, which causes compilers that 
support such
behaviour to insert comment records that direct their linker to link 
to the
appropriate Open-RJ library, e.g. openrj.vc71.mt.debug.lib, without 
requiring
explicit specification in the linker command. Some developers prefer 
this kind
of automatic behaviour, and now have this facility if they so wish 
just by
including openrj_implicit_link.h

Other changes are as follows:

 - c_str_ptr() shims are added for ORJStringA. (See chapter 19 of 
Imperfect C++
   (http://imperfectcplusplus.com/) for an explanation of the Shims 
concept)
 - c_str_data() and c_str_len() shims are provided in addition to 
c_str_ptr().
   These are of general use, but are particularly useful with 
STLSoft's
   basic_string_view template

Changes to the mappings are as follows:

 C++ mapping:
  - the headers are separated out, one per class. They are all fully 
configured,
    i.e. including openrj/cpp/filedatabase.hpp includes 
openrj/cpp/record.hpp
    and openrj/cpp/field.hpp
  - addition of (in-)equality operators (operator == and operator 
!=) for Field
    class
  - addition of String typedef within openrj::cpp namespace, which 
is actually
    a typedef for stlsoft::basic_string_view<char> (for providing 
views onto
    the string information within database fields).
  - addition of Record::GetComment(), Record::HasField(char const 
*name),
    Record::HasField(char const *name, char const *value),
    Record::HasFieldWithValue(char const *value) methods
  - Record::operator []() overloads taking string objects now return 
String
    rather than ORJString

 STL mapping:
  - addition of record::comment() method

 Python mapping:
  - addition of comment property to record type

 Ruby mapping:
  - addition of comment property to record type

================================================================================
May 22 2005
parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
Matthew,
OpenRJ seems to be such a simple spec. I wonder why the code to access it
has to be so big in size and not so evidently clear to look at. This is a
simpler spec for a simple database (actualy not even that, just a table) so
I was expecting much simpler code.

Obviously the use of templates means it is not targetted to 'c' users. To
me, the simpler use would be:
<pre>
#include "oneheader.h"
// Table taken from the original sample ..
const char *str = "%% Sample Open-RJ database - Cats and Dogs\n"
"%% Created:   28th September 2004\n"
"%% Updated:   29th September 2004\n"
"Name:  Barney\n"
"Species: Dog\n"
"%%\n"
...

"Name:  Sparky\n"
"Species: Cat\n"
"%%\n";

// Emit the table contents as specified by 'str'
void emit(const char *str){
    Table   table;
    Record  rec;
    Field   fld;

    table.read_from_memory(str);
    cout << table.comment();
    foreach(table){                      // Loop over the records of the
table
        rec = table.current();                    // grab the 'current'
record
        foreach(rec){                                  // Loop over the
fields
            fld = rec.current();                   // grab the 'current'
field
            cout << fld.name() << "= '" << fld.value() << "'" << endl; //
use!
            }
        cout << "%% " << rec.comment() << endl;
        }
    }

int main(){
    try {
        emit(str);                                              // from
memory
        }
    catch (const std::exception & e){
        cout << e.what() << endl;
        return 1;
        }
    return 0;
    }

</pre>

Any comments? Am I missing something deeper? Is there a place in OpenRj for
such a 'simpler', essentially 1 header version?
- Rajiv
PS: Yet to grab your book, but liked your DDJ articles very much. Thats why
it is painful to see complex code coming from you..


"Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message
news:d6rob3$cf7$1 digitaldaemon.com...
 This is a minor update, primarily comprising the addition of record
 comment information representation by the API. (Previously, the
 comments used on records within Open-RJ database files were not
 available at the programmatic level.

 This does not contain any write functionality that's currently
 underway in collaboration with Lars Ivar Igesund.

 Download from http://openrj.org/ (redirects to SourceForge)

 Details:
============================================================================ ====
 23rd May 2005 : Open-RJ 1.2.1 => 1.3.1
 --------------------------------------------------------------------------
------
 The main change is that record comments are now made available in
 the API, in
 the form of the 'comment' member of the ORJRecordA structure, and
 the
 ORJ_Record_GetCommentA() function.

 There is also a new auto-link header, which causes compilers that
 support such
 behaviour to insert comment records that direct their linker to link
 to the
 appropriate Open-RJ library, e.g. openrj.vc71.mt.debug.lib, without
 requiring
 explicit specification in the linker command. Some developers prefer
 this kind
 of automatic behaviour, and now have this facility if they so wish
 just by
 including openrj_implicit_link.h

 Other changes are as follows:

  - c_str_ptr() shims are added for ORJStringA. (See chapter 19 of
 Imperfect C++
    (http://imperfectcplusplus.com/) for an explanation of the Shims
 concept)
  - c_str_data() and c_str_len() shims are provided in addition to
 c_str_ptr().
    These are of general use, but are particularly useful with
 STLSoft's
    basic_string_view template

 Changes to the mappings are as follows:

  C++ mapping:
   - the headers are separated out, one per class. They are all fully
 configured,
     i.e. including openrj/cpp/filedatabase.hpp includes
 openrj/cpp/record.hpp
     and openrj/cpp/field.hpp
   - addition of (in-)equality operators (operator == and operator
 !=) for Field
     class
   - addition of String typedef within openrj::cpp namespace, which
 is actually
     a typedef for stlsoft::basic_string_view<char> (for providing
 views onto
     the string information within database fields).
   - addition of Record::GetComment(), Record::HasField(char const
 *name),
     Record::HasField(char const *name, char const *value),
     Record::HasFieldWithValue(char const *value) methods
   - Record::operator []() overloads taking string objects now return
 String
     rather than ORJString

  STL mapping:
   - addition of record::comment() method

  Python mapping:
   - addition of comment property to record type

  Ruby mapping:
   - addition of comment property to record type
============================================================================ ====

May 23 2005
parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message 
news:d6stkt$1ee6$1 digitaldaemon.com...
 Matthew,
 OpenRJ seems to be such a simple spec.
It is
 I wonder why the code to access it
 has to be so big in size and not so evidently clear to look at.
What's big? The source files are small 23/05/2005 10:52:26 AM R----A-- 38949 H:\freelibs\openrj\1.3.x\src\orjapi.c 18/02/2005 02:04:51 PM R----A-- 3319 H:\freelibs\openrj\1.3.x\src\orjmem.c 11/04/2005 11:12:53 PM R----A-- 6223 H:\freelibs\openrj\1.3.x\src\orjstr.c 23/05/2005 12:29:20 PM R----A-- 30756 H:\freelibs\openrj\1.3.x\include\openrj\openrj.h 08/04/2005 04:34:24 PM R----A-- 3285 H:\freelibs\openrj\1.3.x\include\openrj\openrj_assert.h 08/04/2005 04:47:59 PM R----A-- 5543 H:\freelibs\openrj\1.3.x\include\openrj\openrj_implicit_link.h 08/04/2005 04:34:30 PM R----A-- 3399 H:\freelibs\openrj\1.3.x\include\openrj\openrj_memory.h Effectively everything is declared within openrj.h, and implemented within orjapi.c. It compiles to ~10K.
 This is a
 simpler spec for a simple database (actualy not even that, just a 
 table) so
 I was expecting much simpler code.
Maybe you're mistaking the extent of the code for the other mappings - C++, Ch, D, .NET, Python, Ruby, STL, etc. - with the base API?
 Obviously the use of templates means it is not targetted to 'c' 
 users. To
 me, the simpler use would be:
 <pre>
 #include "oneheader.h"
 // Table taken from the original sample ..
 const char *str = "%% Sample Open-RJ database - Cats and Dogs\n"
 "%% Created:   28th September 2004\n"
 "%% Updated:   29th September 2004\n"
 "Name:  Barney\n"
 "Species: Dog\n"
 "%%\n"
 ...

 "Name:  Sparky\n"
 "Species: Cat\n"
 "%%\n";

 // Emit the table contents as specified by 'str'
 void emit(const char *str){
    Table   table;
    Record  rec;
    Field   fld;

    table.read_from_memory(str);
    cout << table.comment();
    foreach(table){                      // Loop over the records 
 of the
 table
        rec = table.current();                    // grab the 
 'current'
 record
        foreach(rec){                                  // Loop over 
 the
 fields
            fld = rec.current();                   // grab the 
 'current'
 field
            cout << fld.name() << "= '" << fld.value() << "'" << 
 endl; //
 use!
            }
        cout << "%% " << rec.comment() << endl;
        }
    }

 int main(){
    try {
        emit(str);                                              // 
 from
 memory
        }
    catch (const std::exception & e){
        cout << e.what() << endl;
        return 1;
        }
    return 0;
    }

 </pre>

 Any comments? Am I missing something deeper? Is there a place in 
 OpenRj for
 such a 'simpler', essentially 1 header version?
I don't really get your point. It pretty much does that. I've attached a fully functioning program adapted from your example code. The only Open-RJ #include it requires is #include <openrj/stl/database.hpp> Can you explain where the program fails to satisfy your (and my!) desire for simplicity?
 - Rajiv
 PS: Yet to grab your book, but liked your DDJ articles very much.
Thanks.
 Thats why
 it is painful to see complex code coming from you..
Ok. I guess I see complexity as something different. I'm keen to hear more, though, about what/why you think it's complex. Cheers Matthew begin 666 rajiv.cpp M+R\ 5&AI<R!S86UP;&4 861A<'1E9"!F<F]M(&$ ;F5W<V=R;W5P('!O<W0 M7VQI;FLN:#X +R\ 16YA8FQE('1H:7, =&\ 879O:60 =&AE(&YE960 =&\ M;F%L('-A;7!L92 N+ T*8V]N<W0 8VAA<B!C;VYT96YT<UM=(#T (B4E(%-A M;7!L92!/<&5N+5)*(&1A=&%B87-E("T 0V%T<R!A;F0 1&]G<UQN( T*(B4E M($-R96%T960Z(" ,CAT:"!397!T96UB97( ,C P-%QN( T*(B4E(%5P9&%T M960Z(" ,C1T:"!-87D ,C P-5QN( T*(DYA;64Z("!"87)N97E<;B(-"B)3 M<&5C:65S.B!$;V=<;B(-"B(E)5QN( T*(DYA;64Z("!3<&%R:WE<;B(-"B)3 M*3L-" T*(" (&9O<BAM96UO<GE?9&%T86)A<V4Z.F-O;G-T7VET97)A=&]R M(')I(#T 9&(N8F5G:6XH*3L <FD (3T 9&(N96YD*"D[("LK<FDI("\O($QO M;W ;W9E<B!T:&4 <F5C;W)D<PT*(" ('L-"B (" (" <W1D.CIC;W5T M(#P M9F]R*')E8V]R9#HZ8V]N<W1?:71E<F%T;W( 9FD /2 H*G)I*2YB96=I;B I M.R!F:2 A/2 H*G)I*2YE;F0H*3L *RMF:2D +R\ 3&]O<"!O=F5R('1H92!F M:65L9',-"B (" (" >PT*(" (" (" (" <W1D.CIC;W5T(#P\(" J M9FDI+FYA;64H*2 \/" B/2 G(B \/" H*F9I*2YV86QU92 I(#P\("(G(B \ M('-T9#HZ96YD;#L-"B ('T-"GT-" T*:6YT(&UA:6XH*0T*>PT*(" =')Y M>0T*(" ('T-"B ("!C871C:" H8V]N<W0 <W1D.CIE>&-E<'1I;VX )B!E M*0T*(" ('L-"B (" (" <W1D.CIC;W5T(#P\(&4N=VAA=" I(#P\('-T M9#HZ96YD;#L- *<FX ,#L-"GT-" `` ` end
May 23 2005
parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
The previous one used the STL mapping. Here's one using the C++ 
mapping.

I'm not being a smart-arse. I really don't see where the complexity 
is, and I'm keen to understand your position.

Cheers

Matthew


begin 666 rajiv2.cpp
M+R\ 5&AI<R!S86UP;&4 861A<'1E9"!F<F]M(&$ ;F5W<V=R;W5P('!O<W0 


M<&QI8VET7VQI;FLN:#X +R\ 16YA8FQE('1H:7, =&\ 879O:60 =&AE(&YE


M(%1A8FQE('1A:V5N(&9R;VT =&AE(&]R:6=I;F%L('-A;7!L92 N+ T*8V]N
M<W0 8VAA<B!C;VYT96YT<UM=(#T (B4E(%-A;7!L92!/<&5N+5)*(&1A=&%B
M87-E("T 0V%T<R!A;F0 1&]G<UQN( T*(B4E($-R96%T960Z("  ,CAT:"!3
M97!T96UB97( ,C P-%QN( T*(B4E(%5P9&%T960Z("  ,C1T:"!-87D ,C P
M-5QN( T*(DYA;64Z("!"87)N97E<;B(-"B)3<&5C:65S.B!$;V=<;B(-"B(E

M)5QN(CL-" T*+R\ 16UI="!T:&4 =&%B;&4 8V]N=&5N=', 87, <W!E8VEF


M365M;W)Y1&%T86)A<V4 9&(H8V]N=&5N=',L(#HZ<W1R;&5N*&-O;G1E;G1S

M<F1S*"D[("LK:3$I("\O($QO;W  ;W9E<B!T:&4 <F5C;W)D<PT*"7L-" D)

M/"!R96-O<F0N1V5T0V]M;65N=" I(#P\('-T9#HZ96YD;#L-" T*("  ("  
M("!F;W(H<VEZ95]T(&DR(#T ,#L :3( /"!R96-O<F0N1V5T3G5M1FEE;&1S

M"B  ("  ("  ("  ('-T9#HZ8V]U=" \/"!R96-O<F1;:3)=+D=E=$YA;64H
M*2 \/" B/2 G(B \/"!R96-O<F1;:3)=+D=E=%9A;'5E*"D /#P (B<B(#P\
M('-T9#HZ96YD;#L-"B  ("  ("  ?0T*("  ("  ("!S=&0Z.F-O=70 /#P 

M>PT*("  ("  (&5M:70H8V]N=&5N=',I.R  +R\ 9G)O;2!M96UO<GD-"B  




`
end
May 23 2005
parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
"Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message
news:d6tl85$27ok$1 digitaldaemon.com...
 The previous one used the STL mapping. Here's one using the C++
 mapping.

 I'm not being a smart-arse. I really don't see where the complexity
 is, and I'm keen to understand your position.
Matthew, I have a lot of respect for the way you have analysed things, that's why I dared to point out the simplicity issues to you. With others, I would just let it pass. No, I am not confusing with the other language mappings: I am talking about the basic code. The code which I sent you compiles as is and runs (with an alternate implementation - before I put my foot in the mouth, I had to come up with the so called 'simpler' solution). I am pointing out several things which need attention: (Btw: this could be a wrong newsgroup for such analysis, but I believe most of the readers would benefit. I have learned a lot of things from such comments.) I am outlining the thought train when people look for the use of third party source: 1. When I saw something like: static ORJRC ORJ_ExpandBlockAndParseA_( ORJDatabaseA *db , const size_t cbDbStruct , size_t cbData , const size_t cbAll , unsigned flags , IORJAllocator *ator , ORJDatabaseA const **pdatabase , ORJError *error , size_t size); the first thought that crossed the mind: 'ohmygosh! whats this?'. I would have reservations about using such functions, however proven, along with my code. The mere length of the function makes it non-obvious. Do we need all such allocations and reallocations? Can't we really use simpler STL constructs? After all, we want to handle a small table with less than 100 records, anything more and we will use Sqlite or Mysql. 2. Ok, I said, maybe all that is well tested. How to use it? In the test directory, the C program is 450 lines, the c++ one is 475, STL more than 500. Not counting the test table of around 25 lines, it is still quite a bit. The examples have to be much smaller, skimpier. If found suitable at the first sight, the programmers won't mind going thru the code & the documentation (in that order!) to see how to adopt it to more complex use. Do we have to include this one every program? I wondered. #include <openrj/cpp/openrj.hpp> #include <openrj/cpp/field.hpp> #include <openrj/cpp/record.hpp> #include <openrj/cpp/database.hpp> .. using std::cerr; using std::endl; using std::cout; #if !defined(ORJ_NO_NAMESPACE) using openrj::ORJRC; #endif /* !ORJ_NO_NAMESPACE */ using openrj::cpp::FileDatabase; using openrj::cpp::MemoryDatabase; using openrj::cpp::DatabaseException; using openrj::cpp::Field; using openrj::cpp::Record; Thats why my comment: #include "oneheader.h" and it should handle all the required includes and namespaces. Your later examples do have the use of the single header, but we the potential users of the library, would look at the provided test programs. A simple, quick one and another more exhaustive one for deeper understanding would help. If the library uses STL, why have a C program? Initially it gave the impression that C only implementations can use this library. 3. The test code uses something like 'catch(DatabaseException &x)' - why can't these people use the standard std::exceptions ? Is this one derived from that? Does it mean I have to handle this AND the standard exceptions? No immediate answers. What if I am writing a throw-away program and don't want all the exception handling? On top of this, this guy keeps on confusing Databases with Tables everywhere... Unless the spec will be enhanced, why is he calling a Table as a Database? Aren't fields, records, tables and databases clear to everyone?? Still stuck with DBF? Oh - later on there seems to be a 'real' main, and it shows std::exception and catch(...). Is he expecting other exceptions? Matthew, we look for simpler 'demo' programs... 4. What parts are 'Wizard-generated' for this program?? Would that not be a real, usable demo program, if it uses OpenRJ? And where is 'execute_unittest();' - its not in this file.. Will this compile then? What's a 'goto' doing here??? Do I trust this code? Are there any in the base library? 5. I see the use of: memory_database db(contents); for(memory_database::c...... That means there must be a separate class for 'file_database'... Why two? Is there a difference in the interfaces of the two classes? What if one is ammended and the other one is not? Also, in case I have to switch over from one to other, do I need to edit every use? After all, the name is used in every 'for' ... 6. Matthew had a great article about iterating over arrays & containers in many languages.. (thats all I remember now!) but why is he still using: memory_database db(contents); for(memory_database::const_iterator ri = db.begin(); ri != db.end(); ++ri) // Loop over the records followed by - (*ri).comment() Yes, with a lot of code again and again using 'begin' and 'end' it looks 'natural' - but how come he is not tired of typing the whole thing again and again and inventing 'ri' and 'fi', i1 and i2 and so on... How come he hasn't stumbled upon simpler 'foreach' which hides these things? (Does he love typing? Not worried about Carpel Tunnel?) foreach == begin..end construct current= (*ri) Etc, etc. This was a typical line of thinking. I have also typed much more than reqd, surely, sorry. Am not looking for real, line by line answers, got them (it compiling to around 10k was also not obvious, it is nice to know.) This was wondering aloud. My only expectation is a good, prolific programmer like you should keep much more simpler users in mind. We all will benefit from slimmer software with simpler examples. Thanks and regards, - Rajiv PS: Do I leave the implementation of the simpler version to diligent readers? My Field and Record classes are almost empty, the Table class has 3 routines to speak of, 2 of which handle using the memory and the file. All within one header. Read the example earlier, it compiles and runs.
 Cheers

 Matthew
May 24 2005
next sibling parent "Rajiv Bhagwat" <dataflow vsnl.com> writes:
And yes, I am talking (and regularly use) 'foreach' for c++. I have not seen
it elsewhere, but I could be (easily) wrong.. Just wondered after
deliberating over iterating and writing an article about it, how come you
still use the longer, inflexible begin()..end() form? What makes you choose
that one over others? (You are saying that 'foreach' is for D guys!)

- Rajiv
May 24 2005
prev sibling parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
Wow! A lot to think about, and a lot of very useful feedback that's already got
me thinking.

Even though you say at the end you don't expect it, I have answered most
points, partly to show you where your feedback 
has really got me thinking, and probably changing some of my ways of doing
things.

 No, I am not confusing with the other language mappings: I am talking about
 the basic code.
 The code which I sent you compiles as is and runs (with an alternate
 implementation -  before I put my foot in the mouth, I had to come up with
 the so called 'simpler' solution).

 I am pointing out several things which need attention:
 (Btw: this could be a wrong newsgroup for such analysis, but I believe most
 of the readers would benefit. I have learned a lot of things from such
 comments.) I am outlining the thought train when people look for the use of
 third party source:

 1. When I saw something like:
 static ORJRC    ORJ_ExpandBlockAndParseA_(  ORJDatabaseA                *db
                                        ,   const size_t
 cbDbStruct
                                        ,   size_t
 cbData
                                        ,   const size_t
 cbAll
                                        ,   unsigned
 flags
                                        ,   IORJAllocator
 *ator
                                        ,   ORJDatabaseA const
 **pdatabase
                                        ,   ORJError
 *error
                                        ,   size_t
 size);

 the first thought that crossed the mind: 'ohmygosh! whats this?'. I would
 have reservations about using such functions, however proven, along with my
 code. The mere length of the function makes it non-obvious.

 Do we need all such allocations and reallocations? Can't we really use
 simpler STL constructs? After all, we want to handle a small table with less
 than 100 records, anything more and we will use Sqlite or Mysql.
First, although I like STL and use it a lot, I think libraries benefit from being written in C wherever possible and practicable. Since Open-RJ is a pretty straightforward (or I thought it was! <g>) thing, and small, I thought a C implementation appropriate. As to that function, it's a worker function, that's only used inside the implementation. The reason it entered the codebase was when I added support for memory databases along with file databases. I preferred to keep as much code as possible common between the parsing of the memory and file databases for reasons of maintainability. The reason that it does reallocation is that I am pathologically opposed to inefficiency, and so Open-RJ only makes two allocations, resulting in the one block. Naturally I accept that this is likely unnecessary on performance grounds for Open-RJ, but it does have the nice side-effect that closing a database is simply a case of one call to free(). The reason that an allocator may be specified is that I am also a big flexibility fan. Again, this might be largely moot, but when one's writing an open-source library that will be mapped to many languages, as few assumptions as possible is the best. In summary, I've good reasons for the decisions made, although I'm _not_ saying that they're necessarily optimal.
 2. Ok, I said, maybe all that is well tested. How to use it? In the test
 directory, the C program is 450 lines, the c++ one is 475, STL more than
 500. Not counting the test table of around 25 lines, it is still quite a
 bit. The examples have to be much smaller, skimpier. If found suitable at
 the first sight, the programmers won't mind going thru the code & the
 documentation (in that order!) to see how to adopt it to more complex use.

 Do we have to include this one every program? I wondered.
 #include <openrj/cpp/openrj.hpp>
 #include <openrj/cpp/field.hpp>
 #include <openrj/cpp/record.hpp>
 #include <openrj/cpp/database.hpp>

 ..
 using std::cerr;
 using std::endl;
 using std::cout;
 #if !defined(ORJ_NO_NAMESPACE)
 using openrj::ORJRC;
 #endif /* !ORJ_NO_NAMESPACE */
 using openrj::cpp::FileDatabase;
 using openrj::cpp::MemoryDatabase;
 using openrj::cpp::DatabaseException;
 using openrj::cpp::Field;
 using openrj::cpp::Record;

 Thats why my comment:
 #include "oneheader.h"
 and it should handle all the required includes and namespaces. Your later
 examples do have the use of the single header, but we the potential users of
 the library, would look at the provided test programs. A simple, quick one
 and another more exhaustive one for deeper understanding would help.
You're 100% correct on this. I avoid using directives like the plague, and I believe there are very good reasons for doing so in production code, but I can (now) see that for pedagogical purposes it's not exactly helpful. I'm so chagrined I'm changing this right now! :-)
 If the library uses STL, why have a C program? Initially it gave the
 impression that C only implementations can use this library.
Here I disagree/diverge. The library is C, and has C-API. And it has mappings to other languages. So it's appropriate to have a C test program, and to have test programs in other languages. Nonetheless, I'm keen to hear how the (mis-)impression is given. If you can spare further advice on this issue, I'll definitely listen.
 3. The test code uses something like 'catch(DatabaseException &x)' - why
 can't these people use the standard std::exceptions ? Is this one derived
 from that? Does it mean I have to handle this AND the standard exceptions?
 No immediate answers. What if I am writing a throw-away program and don't
 want all the exception handling?
Fair enough. I guess I wanted to show the full functionality. I don't think this is black-and-white, so maybe the answer is to have separate examples - a minimal example and a full-functionality example?
 On top of this, this guy keeps on confusing Databases with Tables
 everywhere... Unless the spec will be enhanced, why is he calling a Table as
 a Database? Aren't fields, records, tables and databases clear to everyone??
 Still stuck with DBF?
The records in a database don't have to have the same structure, so (I don't think) it's reasonable to call it a table (which would imply uniformity of structure). Convinced? (Maybe I should have documented that somewhere ...)
 Oh - later on there seems to be a 'real' main, and it shows std::exception
 and catch(...). Is he expecting other exceptions?
 Matthew, we look for simpler 'demo' programs...
Again, the separation of main_() and main() is an artefact of real applications, rather than something helpful in an example program, that's crept in as a result of habit. Maybe I'll trim that out.
 4. What parts are 'Wizard-generated' for this program??
The skeleton. Not useful information for potential users. It's gone.
Would that not be a
 real, usable demo program, if it uses OpenRJ?
 And where is 'execute_unittest();' - its not in this file.. Will this
 compile then?
Erm, vestigial/unfinished. Getting fixed now ...
 What's a 'goto' doing here??? Do I trust this code? Are there any in the
 base library?
He he. Point taken. Going, going, gone ...
 5. I see the use of:
    memory_database db(contents);

    for(memory_database::c......
 That means there must be a separate class for 'file_database'... Why two?
One for files one for memory, both derived from a common base which has the 'main' interface, i.e. access to records and fields.
 Is there a difference in the interfaces of the two classes? What if one is
 ammended and the other one is not? Also, in case I have to switch over from
 one to other, do I need to edit every use? After all, the name is used in
 every 'for' ...
I disagree here, as far as I follow your argument. The common aspects of the two classes are in the base class. The derived classes merely differ in their constructors, as appropriate to the source of the database. I still think that's the best design choice.
 6. Matthew had a great article about iterating over arrays & containers in
 many languages.. (thats all I remember now!) but why is he still using:
    memory_database db(contents);
    for(memory_database::const_iterator ri = db.begin(); ri != db.end();
 ++ri) // Loop over the records

 followed by - (*ri).comment()
 Yes, with a lot of code again and again using 'begin' and 'end' it looks
 'natural' - but how come he is not tired of typing the whole thing again and
 again and inventing 'ri' and 'fi', i1 and i2 and so on... How come he hasn't
 stumbled upon simpler 'foreach' which hides these things? (Does he love
 typing? Not worried about Carpel Tunnel?)
 foreach == begin..end construct
 current= (*ri)
Well, this one's the desire not to prescribe that users of one library should have to use another, or should have to learn concepts that are not (yet) accepted into the mainstream of C++ programming practice. I still think that's the right choice.
 Etc, etc. This was a typical line of thinking. I have also typed much more
 than reqd, surely, sorry.
No apologies. Indeed, I'm very grateful for the input, and will change my libs in all those areas you've pointed out that I agree on. Thanks!
 Am not looking for real, line by line answers, got
 them (it compiling to around 10k was also not obvious, it is nice to know.)
Maybe I should mention that somewhere in the docs.
 This was wondering aloud. My only expectation is a good, prolific programmer
 like you should keep much more simpler users in mind. We all will benefit
 from slimmer software with simpler examples.
Yes, I agree. Again, thanks. I'm touched by your sentiments, albeit I _know_ that I'm a good engineer, and a half-decent author. What I'm not good at, as I know all too well, is documentation and so I'm very grateful for your feedback. Please feel free to make as much similar feedback about Open-RJ (and recls and STLSoft) as you are able in future.
 Thanks and regards,
 - Rajiv

 PS: Do I leave the implementation of the simpler version to diligent
 readers? My Field and Record classes are almost empty, the Table class has 3
 routines to speak of, 2 of which handle using the memory and the file. All
 within one header. Read the example earlier, it compiles and runs.
I'll happily take a look at it, if you want to post/send it to me.
May 24 2005
next sibling parent reply "Matthew" <admin.hat stlsoft.dot.org> writes:
I've updated the three C/C++ test files (C.c, Cpp.cpp and STL.cpp), and also
added two new test files (Cpp_minimal.cpp) 
and STL_minimal.cpp).

If you've time, please take a look at them and let me know whether (and by how
much) they address your concerns.

Cheers

Matthew


begin 666 C.c
M+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($9I;&4Z



M,C P-0T*("H-"B J('=W=SH ("  ("  ("!H='1P.B\O=W=W+F]P96YR:BYO

M('!O:6YT:6YG(&]U="!T:&%T('1H92!T97-T('!R;V=R86US(&QE9G0-"B J
M("  ("  ("  ("  ("!M=6-H('1O(&)E(&1E<VER960 :6X =&5R;7, ;V8 



M("  ("  ("  *$QI8V5N<V5D('5N9&5R('1H92!3>6YE<VES(%-O9G1W87)E





M("H +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M<&5N+5)*($AE861E<B!&:6QE<R J+PT*(VEN8VQU9&4 /&]P96YR:B]O<&5N
M<FHN:#X-
M;'5D92 \<W1D:6\N:#X-"B-I;F-L=61E(#QS=&1L:6(N:#X-"B-I;F-L=61E
M(#QS=')I;F<N:#X-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O


M14Q?0T]-4$E,15(I("8F(%P-"B  (" A9&5F:6YE9"A?7T1-0U]?*0T*(R!I

M.B T,3(W*2  ("\J(%-U<'!R97-S97, (F-O;F1I=&EO;F%L(&5X<')E<W-I

M9&EF("\J(%]-4T-?5D52(#P ,3,P," J+PT*(V5N9&EF("\J(&-O;7!I;&5R



M('9O:60 =7-A9V4H:6YT(&)%>&ET+"!C:&%R(&-O;G-T("IR96%S;VXL(&EN
M="!I;G9A;&ED07)G+"!I;G0 87)G8RP 8VAA<B J87)G=EM=*3L-"G-T871I

M=71E7W5N:71T97-T*$]22D1A=&%B87-E02!C;VYS=" J9&%T86)A<V4I.PT*


M;6%I;BAI;G0 87)G8RP 8VAA<B J87)G=EM=*0T*>PT*("  (&EN="  ("  


M*B!087)S92!T:&4 8V]M;6%N9"UL:6YE(&%R9W5M96YT<RX *B\-"B  ("!F

M="!C:&%R(" J87)G("  (#T









M(&DL(&%R9V,L(&%R9W8I.PT*("  ("  ("  ("  ("  ('T-"B  ("  ("  
M("  ('T-"B  ("  ("  ("  (&5L<V4-"B  ("  ("  ("  ('L-"B  ("  
M("  ("  ("  (" O*B M(&%R9W5M96YT<R J+PT*("  ("  ("  ("  ("  

M("  ("  ("  ("!C87-E("  ("<_)SH-"B  ("  ("  ("  ("  ("  ("  

M("  ("  ("  ("  ("  (&)R96%K.PT*("  ("  ("  ("  ("  ("  ("!C
M87-E("  ("=O)SH-"B  ("  ("  ("  ("  ("  ("  ("  (&9L86=S('P]
M($]22E]&3$%'7T]21$521DE%3$13.PT*("  ("  ("  ("  ("  ("  ("  

M("  ("  ("  ("  ("  ("  ("  ("  9FQA9W, ?#T 3U)*7T9,04=?14Q)

M:SL-"B  ("  ("  ("  ("  ("  ("  9&5F875L=#H-"B  ("  ("  ("  

M96-I9FEE9"(L(&DL(&%R9V,L(&%R9W8I.PT*("  ("  ("  ("  ("  ("  



M54Q,(#T
M("  :F%R3F%M92 ](&%R9SL-"B  ("  ("  ("  ('T-"B  ("  ("  ("  
M(&5L<V4-"B  ("  ("  ("  ('L-"B  ("  ("  ("  ("  ("!U<V%G92 Q
M+" B26YV86QI9"!A<F=U;65N="AS*2!S<&5C:69I960B+"!I+"!A<F=C+"!A
M<F=V*3L-"B  ("  ("  ("  ('T-"B  ("  ("  ?0T*("  ('T-" T*("  

M(")-=7-T('-P96-I9GD 82!*05( ;F%M92(L("TQ+"!A<F=C+"!A<F=V*3L-


M("  ($]22D1A=&%B87-E(&-O;G-T("  *F1A=&%B87-E.PT*("  ("  ("!/
M4DI%<G)O<B  ("  ("  ("  (&5R<F]R.PT*("  ("  ("!/4DI20R  ("  
M("  ("  ("  (')C(" ]("  3U)*7U)E861$871A8F%S92AJ87).86UE+"!.


M;W( :6X )7,L(&%T(&QI;F4 )74L(&-O;'5M;B E=5QN(BP :F%R3F%M92P 



M('1O(&5X97)C:7-E('1H92!D871A8F%S92!V:6$ <W1R=6-T=7)E(&UE;6)E

M("  ("!P<FEN=&8H(E)E8V]R9"U*05( )7, :&%S("5D(&QI;F5S(&EN("5D
M(&9I96QD<R!I;B E9"!R96-O<F1S7&XB+"!J87).86UE+"!D871A8F%S92T^
M;G5M3&EN97,L(&1A=&%B87-E+3YN=6U&:65L9',L(&1A=&%B87-E+3YN=6U2
M96-O<F1S*3L-" T*("  ("  ("  ("  9F]R*&E296-O<F0 /2 P.R!I4F5C
M;W)D(#P 9&%T86)A<V4M/FYU;5)E8V]R9',[("LK:5)E8V]R9"D-"B  ("  
M("  ("  ('L-"B  ("  ("  ("  ("  ("!S:7IE7W0 ("  ("!I1FEE;&0[


M:68H($Y53$P (3T <F5C;W)D+3YC;VUM96YT+G!T<B F) T*("  ("  ("  

M("  ("  ("  >PT*("  ("  ("  ("  ("  ("  ("!P<FEN=&8H(G)E8V]R
M9"TC)74[("4N*G, *"5U(')E8V]R9',I7&XB+"!I4F5C;W)D+"!R96-O<F0M
M/F-O;6UE;G0N;&5N+"!R96-O<F0M/F-O;6UE;G0N<'1R+"!R96-O<F0M/FYU


M('!R:6YT9B B<F5C;W)D+2,E9" H)60 <F5C;W)D<RE<;B(L(&E296-O<F0L

M("  ("  ("  ("  ("!F;W(H:49I96QD(#T ,#L :49I96QD(#P <F5C;W)D
M+3YN=6U&:65L9',[("LK:49I96QD*0T*("  ("  ("  ("  ("  ('L-"B  
M("  ("  ("  ("  ("  ("  3U)*1FEE;&1!("  *F9I96QD(" ]("  )G)E

M<')I;G1F*"( (&9I96QD+2,E9"!;)2XJ<UTZ6R4N*G-=7&XB+"!I1FEE;&0L
M(&9I96QD+3YN86UE+FQE;BP 9FEE;&0M/FYA;64N<'1R+"!F:65L9"T^=F%L
M=64N;&5N+"!F:65L9"T^=F%L=64N<'1R*3L-"B  ("  ("  ("  ("  ("!]

M('!R:6YT9B B4F5C;W)D+4I!4B E<R!H87, )74 ;&EN97, :6X )74 9FEE
M;&1S(&EN("5U(')E8V]R9'-<;B(L(&IA<DYA;64L($]22E]$871A8F%S95]'
M971.=6U,:6YE<T$H9&%T86)A<V4I+"!/4DI?1&%T86)A<V5?1V5T3G5M1FEE
M;&1S02AD871A8F%S92DL($]22E]$871A8F%S95]'971.=6U296-O<F1S02AD

M96-O<F0 /"!/4DI?1&%T86)A<V5?1V5T3G5M4F5C;W)D<T$H9&%T86)A<V4I


M3U)*4F5C;W)D02!C;VYS="  (" J<F5C;W)D.PT*("  ("  ("  ("  ("  

M("  ("!/4DI?1&%T86)A<V5?1V5T4F5C;W)D02AD871A8F%S92P :5)E8V]R


M96YT*2 F) T*("  ("  ("  ("  ("  ("  (" P("$](&-O;6UE;G0M/FQE

M:6YT9B B<F5C;W)D+2,E=3L )2XJ<R H)74 <F5C;W)D<RE<;B(L(&E296-O
M<F0L(&-O;6UE;G0M/FQE;BP 8V]M;65N="T^<'1R+"!/4DI?4F5C;W)D7T=E


M("  ("  ("  ("  ('!R:6YT9B B<F5C;W)D+2,E=2 H)74 <F5C;W)D<RE<
M;B(L(&E296-O<F0L($]22E]296-O<F1?1V5T3G5M1FEE;&1S02AR96-O<F0I

M:49I96QD(#T ,#L :49I96QD(#P 3U)*7U)E8V]R9%]'971.=6U&:65L9'-!
M*')E8V]R9"D[("LK:49I96QD*0T*("  ("  ("  ("  ("  ('L-"B  ("  

M("  ("  ("  ("  ("  ("  ($]22D9I96QD02!C;VYS="  ("  *F9I96QD
M,CL-"B  ("  ("  ("  ("  ("  ("  3U)*4W1R:6YG02!C;VYS="  (" J
M;F%M93L-"B  ("  ("  ("  ("  ("  ("  3U)*4W1R:6YG02!C;VYS="  


M("  ("  ("  ("  3U)*7T9I96QD7T=E=$YA;65!;F1686QU94$H9FEE;&0L

M9B B("!F:65L9"TC)74 6R4N*G-=.ELE+BIS75QN(BP :49I96QD+" H:6YT
M*69I96QD+3YN86UE+FQE;BP 9FEE;&0M/FYA;64N<'1R+" H:6YT*69I96QD

M("  ("  ("  ("\J($YO=R!D;R!A(&-H96-K('1O('9E<FEF>2!T:&%T('1H
M92!/4DI?4F5C;W)D7T9I;F1&:65L9$)Y3F%M94$H*2!M971H;V0 =V]R:W,A

M8V]R9%]&:6YD1FEE;&1">4YA;65!*')E8V]R9"P ;F%M92T^<'1R+"!V86QU
M92T^<'1R*3L-" T*("  ("  ("  ("  ("  ("  ("!I9BAF:65L9" A/2!F

M("  ("  ("  (&9P<FEN=&8H<W1D97)R+" B*BH 1FEE;&0 ;6ES;6%T8V A


M("  ("  ("!/4DI?1G)E941A=&%B87-E*&1A=&%B87-E*3L-"B  ("  ("  

M("\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M;F5D*%]?1TY50U]?*0T*(R!I9F1E9B!A;&QO8V$-"B, ('5N9&5F(&%L;&]C

M("  ("  ("  7U]B=6EL=&EN7V%L;&]C80T*(V5L:68 9&5F:6YE9"A724XS




M:6YT(&)%>&ET+"!C:&%R(&-O;G-T("IR96%S;VXL(&EN="!I;G9A;&ED07)G

M>&5C=71A8FQE(&YA;64 *B\-"B  ("!C:&%R("  ("I%6$5?3D%-12  (#T 
M("!S=')C<'DH*&-H87(J*6%L;&]C82 Q("L <W1R;&5N*&%R9W9;,%TI*2P 



M"B  ("!I9BA.54Q,("$]("AP(#T <W1R<F-H<BA%6$5?3D%-12P )R\G*2DI



M;3H )7-<;B(L($5815].04U%*3L-"B  ("!F<')I;G1F*'-T9&5R<BP (EQN



M9B P(#P
M("  ("  (&9P<FEN=&8H<W1D97)R+" B("!&:7)S="!I;G9A;&ED(&%R9W5M
M96YT(",E9#H )7-<;B(L(&EN=F%L:61!<F<L(&%R9W9;:6YV86QI9$%R9UTI
M.PT*("  ("  ("!F<')I;G1F*'-T9&5R<BP (B  07)G=6UE;G1S('=E<F4 
M*&9I<G-T(&)A9"!M87)K960 *BDZ7&Y<;B(I.PT*("  ("  ("!F;W(H:2 ]

M<FEN=&8H<W1D97)R+" B(" E<R5S7&XB+" H:2 ]/2!I;G9A;&ED07)G*2 _
M("(J("( .B B(" B+"!A<F=V6VE=*3L-"B  ("  ("  ?0T*("  ("  ("!F


M;B(L($5815].04U%*3L-"B  ("!F<')I;G1F*'-T9&5R<BP (B  (" M;R  
M("  ("  ("  ("T ("!O<F1E<G, =&AE(&9I96QD<R!W:71H:6X 96%C:"!R
M96-O<F1<;B(I.PT*("  (&9P<FEN=&8H<W1D97)R+" B("  ("US("  ("  
M("  ("  +2  (&5L:61E(&)L86YK(')E8V]R9', 9G)O;2!T:&4 9&%T86)A
M<V5<;B(I.PT*("  (&9P<FEN=&8H<W1D97)R+" B("  (#QD871A8F%S93X 
M("  +2  ('1H92!/<&5N+5)*(&1A=&%B87-E(&9I;&5<;B(I.PT*("  (&9P
M<FEN=&8H<W1D97)R+" B7&XB*3L-"B  ("!F<')I;G1F*'-T9&5R<BP (B  


M0F%S92TV-"!E;F-O9&EN9R H+64I(&]R($)A<V4M-C0 9&5C;V1I;F< *"UD

M=&8H<W1D97)R+" B("!54T%'12 R.B E<R M+75N:71T97-T7&XB+"!%6$5?

M=&8H<W1D97)R+" B("  (%)U;G, :6YT97)N86P =&5S=',L(')E='5R;FEN
M9R P(&EF(&%L;"!S=6-C965D+"!N;VXM,"!O=&AE<G=I<V5<;B(I.PT*("  
M(&9P<FEN=&8H<W1D97)R+" B7&XB*3L-"B  ("!F<')I;G1F*'-T9&5R<BP 
M(B  55-!1T4 ,SH )7, +3]<;B(L($5815].04U%*3L-"B  ("!F<')I;G1F

M<&QA>7, =&AI<R!H96QP7&XB*3L-"B  ("!F<')I;G1F*'-T9&5R<BP (EQN


M;FET=&5S="A/4DI$871A8F%S94$ 8V]N<W0 *F1A=&%B87-E*0T*>PT*("  
M("\J($Y/5$4Z($YO="!Y970 :6UP;&5M96YT960 *B\-" T*("  (')E='5R


M(B4E(%-A;7!L92!/<&5N+5)*(&1A=&%B87-E("T 0V%T<R!A;F0 1&]G<UQN
M( T*("  ("  (" B)24 0W)E871E9#H


M96-I97,Z"41O9UQN( T*("  ("  (" B0G)E960Z"0E":6IO;B!<7%QN( T*

M(" B3F%M93H)"45L<V%<;B(-"B  ("  ("  (E-P96-I97,Z"41O9UQN( T*
M("  ("  (" B0G)E960Z"0E-:7AE9%QN( T*("  ("  (" B)25<;B(-"B  



M<F5E9#H


M9%QN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA;64Z"0E097!P97)<
M;B(-"B  ("  ("  (E-P96-I97,Z"41O9UQN( T*("  ("  (" B0G)E960Z


M("  ("  (")"<F5E9#H)"5)I9&=E8F%C:UQN( T*("  ("  (" B)25<;B(-

M. E$;V=<;B(-"B  ("  ("  (D)R965D. D)4VAE=&QA;F0 7%Q<;B(-"B  

M(" B3F%M93H)"5-P87)K>5QN( T*("  ("  (" B4W!E8VEE<SH)0V%T7&XB

M*B!E;&ED:6YG(&)L86YK<R!G:79E<R!T:&4 <FEG:'0 ;G5M8F5R(&]F(')E

M*F1A=&%B87-E.PT*("  ("  ("!/4DI%<G)O<B  ("  ("  ("  (&5R<F]R


M7T-R96%T941A=&%B87-E1G)O;4UE;6]R>4$H)F-O;G1E;G1S6S!=+"!S:7IE
M;V8H8V]N=&5N=',I+"!.54Q,+"!F;&%G<RP )F1A=&%B87-E+" F97)R;W(I

M("  (&9P<FEN=&8H<W1D97)R+" B17)R;W( :6X 870 ;&EN92 E=2P 8V]L
M=6UN("5U7&XB+"!E<G)O<BYI;G9A;&ED3&EN92P 97)R;W(N:6YV86QI9$-O



M87-E+3YN=6U296-O<F1S*0T*("  ("  ("  ("  >PT*("  ("  ("  ("  
M("  (&9P<FEN=&8H<W1D97)R+" B26YC;W)R96-T(&YU;6)E<B!O9B!R96-O
M<F1S7&XB*3L-" T*("  ("  ("  ("  ("  (&E2970 /2 Q.PT*("  ("  
M("  ("  ?0T*("  ("  ("  ("  96QS92!I9B R-2 A/2!D871A8F%S92T^
M;G5M1FEE;&1S*0T*("  ("  ("  ("  >PT*("  ("  ("  ("  ("  (&9P
M<FEN=&8H<W1D97)R+" B26YC;W)R96-T(&YU;6)E<B!O9B!F:65L9'-<;B(I



M("  ("  ("  ("  :6YT("  ("  ("  :3L-" T*("  ("  ("  ("  ("  
M(&9O<BAI(#T ,#L :2 \($Y535]415-44SL *RMI*0T*("  ("  ("  ("  
M("  ('L-"B  ("  ("  ("  ("  ("  ("  :5)E=" ](&5X96-U=&5?=6YI

M(3T :5)E="D-"B  ("  ("  ("  ("  ("  ("  >PT*("  ("  ("  ("  



M<')I;G1F*'-T9&5R<BP (B5D('1E<W1S('-U8V-E961E9%QN(BP 3E5-7U1%

M90T*("  ("  ("  ("  ("  ('L-"B  ("  ("  ("  ("  ("  ("  9G!R
M:6YT9BAS=&1E<G(L(")497-T(",E9"!F86EL961<;B(L(&DI.PT*("  ("  
M("  ("  ("  ('T-"B  ("  ("  ("  ('T-" T*("  ("  ("  ("  3U)*


M"B  ("  ("  ?0T*("  ('T-"GT-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

`
end

begin 666 Cpp.cpp
M+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($9I;&4Z

M('!R;V=R86T 9F]R('1H92!/<&5N+5)*+T,K*R H=&AE($,K*R!M87!P:6YG

M* T*("H 0W)E871E9#H
M.B  ("  ,C1T:"!-87D ,C P-0T*("H-"B J('=W=SH ("  ("  ("!H='1P

M:FEV($)H86=W870 9F]R('!O:6YT:6YG(&]U="!T:&%T('1H92!T97-T('!R
M;V=R86US(&QE9G0-"B J("  ("  ("  ("  ("!M=6-H('1O(&)E(&1E<VER
M960 :6X =&5R;7, ;V8 9&ES8V]V97)A8FEL:71Y+ T*("H-"B J($QI8V5N




M("  ("  5&AI<R!S;W5R8V4 8V]D92!I<R!P;&%C960 :6YT;R!T:&4 <'5B


M*B  ("  ("  ("  ("  =VAA='-O979E<B!T;R!Y;W5R('5S92!O9B!T:&4 

M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O


M("H 16YA8FQE('1H:7, =&\ =7-E(&$ 365M;W)Y1&%T86)A<V4L(')A=&AE




M(&5X8V5P=&EO;G, 9G)O;2!T:&4 05!)('9I82!S=&0Z.F5X8V5P=&EO;B!R
M871H97(-"B J('1H86X ;W!E;G)J.CIC<' Z.D1A=&%B87-E17AC97!T:6]N





M:#X-"B-I;F-L=61E(#QS=')I;F<N:#X-" T*+RH +R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M('-T9#HZ8V5R<CL-"G5S:6YG('-T9#HZ96YD;#L-"G5S:6YG('-T9#HZ8V]U
M=#L-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J

M=F]I9"!U<V%G92AI;G0 8D5X:70L(&-H87( 8V]N<W0 *G)E87-O;BP :6YT
M(&EN=F%L:61!<F<L(&EN="!A<F=C+"!C:&%R("IA<F=V6UTI.PT*<W1A=&EC
M(&EN="  <G5N7W5N:71T97-T<R I.PT*<W1A=&EC(&EN="  97AE8W5T95]U
M;FET=&5S="AO<&5N<FHZ.F-P<#HZ1&%T86)A<V5"87-E(&-O;G-T("9D871A

M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O("HO

M"GL-"B  ("!I;G0 ("  ("  ("!I.PT*("  (&-H87( 8V]N<W0 ("IJ87).
M86UE("  (#T ("!.54Q,.PT*("  ('5N<VEG;F5D("  (&9L86=S("  ("  
M(#T


M("  (#T




M8VUP*")U;FET=&5S=',B+"!A<F< *R R*2D-"B  ("  ("  ("  ("  ("![



M("));G9A;&ED(&%R9W5M96YT*',I('-P96-I9FEE9"(L(&DL(&%R9V,L(&%R
M9W8I.PT*("  ("  ("  ("  ("  ('T-"B  ("  ("  ("  ('T-"B  ("  
M("  ("  (&5L<V4-"B  ("  ("  ("  ('L-"B  ("  ("  ("  ("  (" O
M*B M(&%R9W5M96YT<R J+PT*("  ("  ("  ("  ("  ('-W:71C:"AA<F=;


M($Y53$PL("TQ+"!A<F=C+"!A<F=V*3L-"B  ("  ("  ("  ("  ("  ("  
M("  (&)R96%K.PT*("  ("  ("  ("  ("  ("  ("!C87-E("  ("=O)SH-
M"B  ("  ("  ("  ("  ("  ("  ("  (&9L86=S('P](&]P96YR:CHZ3U)*


M("  ("  ("  ("  ("  ("  ("!F;&%G<R!\/2!O<&5N<FHZ.D]22E]&3$%'
M7T5,241%0DQ!3DM214-/4D13.PT*("  ("  ("  ("  ("  ("  ("  ("  

M("  ("  ("  ("  ("  ("!U<V%G92 Q+" B26YV86QI9"!A<F=U;65N="AS
M*2!S<&5C:69I960B+"!I+"!A<F=C+"!A<F=V*3L-"B  ("  ("  ("  ("  
M("  ("  ("  (&)R96%K.PT*("  ("  ("  ("  ("  ('T-"B  ("  ("  

M("  ("  ("  ("\J(&]T:&5R(&%R9W5M96YT<R J+PT*("  ("  ("  ("  
M:68H3E5,3" ]/2!J87).86UE*0T*("  ("  ("  ("  >PT*("  ("  ("  


M9V4H,2P (DEN=F%L:60 87)G=6UE;G0H<RD <W!E8VEF:65D(BP :2P 87)G

M"B-I9FYD968 55-%7TU%34]265]$051!0D%310T*("  (&EF*$Y53$P /3T 



M>PT*("  ("  (" O*B!(97)E)W, =VAE<F4 =&AE('5S92!O9B!T:&4 ;&EB




M(%-A;7!L92!/<&5N+5)*(&1A=&%B87-E("T 0V%T<R!A;F0 1&]G<UQN( T*




M("  ("  ("  ("  ("  (D)R965D. D)0FEJ;VX 7%Q<;B(-"B  ("  ("  


M("  ("  (E-P96-I97,Z"41O9UQN( T*("  ("  ("  ("  ("  (")"<F5E
M9#H

M("  ("  (E-P96-I97,Z"4-A=%QN( T*("  ("  ("  ("  ("  ("(E)5QN
M( T*("  ("  ("  ("  ("  (").86UE. D)36]E=%QN( T*("  ("  ("  
M("  ("  (")3<&5C:65S. E$;V=<;B(-"B  ("  ("  ("  ("  (" B0G)E
M960Z"0E";WAE<EQN( T*("  ("  ("  ("  ("  ("(E)5QN( T*("  ("  
M("  ("  ("  (").86UE. D)4F5B96Q<;B(-"B  ("  ("  ("  ("  (" B



M"0E097!P97)<;B(-"B  ("  ("  ("  ("  (" B4W!E8VEE<SH)1&]G7&XB

M("  ("  ("  ("  ("  ("(E)5QN( T*("  ("  ("  ("  ("  (").86UE

M( T*("  ("  ("  ("  ("  (")"<F5E9#H)"5)I9&=E8F%C:UQN( T*("  
M("  ("  ("  ("  ("(E)5QN( T*("  ("  ("  ("  ("  (").86UE. D)
M4VAE;'1I95QN( T*("  ("  ("  ("  ("  (")3<&5C:65S. E$;V=<;B(-
M"B  ("  ("  ("  ("  (" B0G)E960Z"0E3:&5T;&%N9"!<7%QN( T*("  
M("  ("  ("  ("  ("()"0E3:&5E<&1O9UQN( T*("  ("  ("  ("  ("  

M("  ("  ("  ("  ("  (E-P96-I97,Z"4-A=%QN( T*("  ("  ("  ("  
M("  ("(E)5QN(CL-" T*("  ("  ("  ("  365M;W)Y1&%T86)A<V4 (&1B

M96QS92 O*B _(%5315]-14U/4EE?1$%404)!4T4 *B\-" T*("  ("  ("  
M("  1FEL941A=&%B87-E("  (&1B*&IA<DYA;64L(&9L86=S*3L-" T*(V5N
M9&EF("\J(%5315]-14U/4EE?1$%404)!4T4 *B\-" T*("  ("  ("  ("  
M8V]U="  (" \/" B4F5C;W)D+4I!4B B(#P\(&IA<DYA;64 /#P (B!H87, 
M( T*("  ("  ("  ("  ("  ("  (" \/"!D8BY'971.=6U,:6YE<R I(#P\
M("( ;&EN97, :6X ( T*("  ("  ("  ("  ("  ("  (" \/"!D8BY'971.

M("  (#P
M("  ("  ("  ("  ("  (#P

M*"D[("LK:5)E8V]R9"D-"B  ("  ("  ("  ('L-"B  ("  ("  ("  ("  
M("!S:7IE7W0 (&E&:65L9#L-"B  ("  ("  ("  ("  ("!296-O<F0 (')E

M(#P\(")R96-O<F0M(R( /#P :5)E8V]R9" -"B  ("  ("  ("  ("  ("  
M("  ("  (#P\("( (B \/"!R96-O<F0N1V5T0V]M;65N=" I(#P\("( ( T*
M("  ("  ("  ("  ("  ("  ("  ("  /#P (B H(B \/"!D8BY'971.=6U2
M96-O<F1S*"D /#P (B!R96-O<F1S*2(-"B  ("  ("  ("  ("  ("  ("  
M("  (#P
M,#L :49I96QD(#P <F5C;W)D+D=E=$YU;49I96QD<R I.R K*VE&:65L9"D-

M("  ("  (&9I96QD*')E8V]R9%MI1FEE;&1=*3L-"B  ("  ("  ("  ("  
M("  ("  8VAA<B!C;VYS="  *FYA;64 (" ]("  9FEE;&0N1V5T3F%M92 I
M.PT*("  ("  ("  ("  ("  ("  ("!C:&%R(&-O;G-T(" J=F%L=64 (#T 

M=70 ("  /#P (B  9FEE;&0M(R( /#P :49I96QD(#P\("( (B \/"!F:65L
M9 T*("  ("  ("  ("  ("  ("  ("  ("  ("  (#P\("( *&YA;64](B \
M/"!N86UE(#P\("([('9A;'5E/2( /#P =F%L=64 /#P
M("  ("  ("  ("  ("  ("  ("  /#P 96YD;#L-"B  ("  ("  ("  ("  



M=&\ ;W!E;B!D871A8F%S93H (B \/"!X+G=H870H*2 \/"!E;F1L.PT*("  

M"B  ("  ("  8V%T8V H;W!E;G)J.CIC<' Z.D1A=&%B87-E17AC97!T:6]N



M("  ("  ("  ('L-"B  ("  ("  ("  ("  ("  ("  8V%S92  ("!O<&5N

M("  ("  ("  (&-E<G( /#P (D-A;FYO="!O<&5N(&9I;&4Z("( /#P :F%R
M3F%M92 \/"!E;F1L.PT*("  ("  ("  ("  ("  ("  ("  ("  8G)E86L[

M4$%24T5%4E)/4CH-"B  ("  ("  ("  ("  ("  ("  ("  (&-E<G( ("  
M/#P (D5R<F]R(&EN("( /#P :F%R3F%M90T*("  ("  ("  ("  ("  ("  
M("  ("  ("  ("  (" \/" B(&%T(&QI;F4 (B \/"!X+F5R<F]R*"DN:6YV
M86QI9$QI;F4-"B  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  /#P 
M(BP 8V]L=6UN("( /#P
M("  ("  ("  ("  ("  ("  ("  ("  ("  /#P (CL (B \/"  <W1L<V]F
M=#HZ8U]S=')?<'1R*' N97)R;W(H*2YP87)S945R<F]R*0T*("  ("  ("  
M("  ("  ("  ("  ("  ("  ("  (" \/"!E;F1L.PT*("  ("  ("  ("  









M960 97)R;W(Z("( /#P >"YW:&%T*"D /#P 96YD;#L-
M8V%T8V H+BXN*0T*("  ('L-"B  ("  ("  8V5R<B \/" B56YH86YD;&5D
M('5N:VYO=VX 97)R;W(B(#P
M($58251?1D%)3%5213L-"GT-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O


M*B\-"B, 9&5F:6YE(&%L;&]C82  ("  ("  ("  ("!?7V)U:6QT:6Y?86QL

M:#X-"B, :69N9&5F(&%L;&]C80T*(R  9&5F:6YE(&%L;&]C82  ("  ("  
M("  (%]A;&QO8V$-"B, 96YD:68 +RH (6%L;&]C82 J+PT*(V5L<V4 +RH 
M/R!/4R J+PT*(R!I;F-L=61E(#QA;&QO8V$N:#X-"B-E;F1I9B O*B!/4R J

M*G)E87-O;BP :6YT(&EN=F%L:61!<F<L(&EN="!A<F=C+"!C:&%R("IA<F=V

M871I8U]C87-T/&-H87(J/BAA;&QO8V$H,2 K('-T<FQE;BAA<F=V6S!=*2DI



M" T*("  (&EF*$Y53$P (3T *'  /2!S=')R8VAR*$5815].04U%+" G+R<I


M("!C97)R(#P\("( ($]P96XM4DH 0RLK('1E<W0 <')O9W)A;3H (B \/"!%
M6$5?3D%-12 \/"!E;F1L.SL-"B  ("!C97)R(#P\("(B(#P
M"B  ("!S=&QS;V9T7V%S<V5R="AI;G9A;&ED07)G(#P

M(B  17)R;W(Z("( /#P <F5A<V]N(#P\("(B(#P
M(&-E<G( /#P (B( /#P 96YD;#L-

M86QI9"!A<F=U;65N=" C(B \/"!I;G9A;&ED07)G(#P\("(Z("( /#P 87)G
M=EMI;G9A;&ED07)G72 \/"!E;F1L.PT*("  ("  ("!C97)R(#P\("( ($%R
M9W5M96YT<R!W97)E("AF:7)S="!B860 ;6%R:V5D("HI.B( /#P 96YD;" \
M/"!E;F1L.PT*("  ("  ("!F;W(H:6YT(&D /2 Q.R!I(#P 87)G8SL *RMI

M(#T
M96YD;#L-"B  ("  ("  ?0T*("  ("  ("!C97)R(#P\("(B(#P\(&5N9&P[

M04U%(#P\("( 6RUO72!;+7-=(#QD871A8F%S93XB(#P
M8V5R<B \/" B(B \/"!E;F1L.PT*("  (&-E<G( /#P (B  (" M;R  ("  
M("  ("  ("T ("!O<F1E<G, =&AE(&9I96QD<R!W:71H:6X 96%C:"!R96-O
M<F0B(#P
M+2  (&5L:61E(&)L86YK(')E8V]R9', 9G)O;2!T:&4 9&%T86)A<V4B(#P\

M92!/<&5N+5)*(&1A=&%B87-E(&9I;&4B(#P
M/" B(B \/"!E;F1L.PT*("  (&-E<G( /#P
M/&EN<'5T+69I;&4^('1O('1H92 \;W5T<'5T+69I;&4^(&)Y(&5I=&AE<B( 
M/#P 96YD;#L-"B  ("!C97)R(#P\("( ("  0F%S92TV-"!E;F-O9&EN9R H
M+64I(&]R($)A<V4M-C0 9&5C;V1I;F< *"UD*2( /#P 96YD;#L-"B  ("!C
M97)R(#P\("(B(#P
M(#P\($5815].04U%(#P\("( +2UU;FET=&5S="( /#P 96YD;#L-"B  ("!C
M97)R(#P\("(B(#P
M97)N86P =&5S=',L(')E='5R;FEN9R P(&EF(&%L;"!S=6-C965D+"!N;VXM
M,"!O=&AE<G=I<V4B(#P
M.PT*("  (&-E<G( /#P (B  55-!1T4 ,SH (B \/"!%6$5?3D%-12 \/" B
M("T_(B \/"!E;F1L.PT*("  (&-E<G( /#P (B( /#P 96YD;#L-"B  ("!C
M97)R(#P\("( ("  1&ES<&QA>7, =&AI<R!H96QP(B \/"!E;F1L.PT*("  
M(&-E<G( /#P (B( /#P 96YD;#L-" T*("  (&EF*&)%>&ET*0T*("  ('L-
M"B  ("  ("  97AI="A%6$E47T9!24Q54D4I.PT*("  ('T-"GT-" T*<W1A
M=&EC(&EN="!E>&5C=71E7W5N:71T97-T*&]P96YR:CHZ8W!P.CI$871A8F%S

M870 =&AE(&1A=&%B87-E('1H:6YK<R!I="!H87, =&AE('-A;64 ;G5M8F5R

M(')E8V]R9 T*("  (" J+PT*("  ('-I>F5?="  ;G5M1FEE;&1S,2  /2  
M(&1A=&%B87-E+D=E=$YU;49I96QD<R I.PT*("  ('-I>F5?="  ;G5M1FEE



M("  ?7T-" T*("  (&EF*&YU;49I96QD<S$ (3T ;G5M1FEE;&1S,BD-"B  

M971.=6U&:65L9',H*3H )6QU.R!N('  4F5C;W)D.CI'971.=6U&:65L9',H
M*3H )6QU7&XB+"!N=6U&:65L9',Q+"!N=6U&:65L9',R*3L-" T*("  ("  


M" T*<W1A=&EC(&EN="!R=6Y?=6YI='1E<W1S*"D-"GL-"B  ("!S=&%T:6, 

M;&4 3W!E;BU22B!D871A8F%S92 M($-A=', 86YD($1O9W-<;B(-"B  ("  
M("  (B4E($-R96%T960Z("  ,CAT:"!397!T96UB97( ,C P-%QN( T*("  
M("  (" B)24 57!D871E9#H

M;V=<;B(-"B  ("  ("  (D)R965D. D)0FEJ;VX 7%Q<;B(-"B  ("  ("  
M( D)"49R:65Z95QN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA;64Z


M86UE. D)1FQU9F9Y($MI='1E;EQN( T*("  ("  (" B4W!E8VEE<SH)0V%T

M"B  ("  ("  (E-P96-I97,Z"41O9UQN( T*("  ("  (" B0G)E960Z"0E"
M;WAE<EQN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA;64Z"0E296)E

M9#H)"4=E<FUA;B!<7%QN( T*("  ("  (" B"0D)4VAE<&AE<F1<;B(-"B  

M("  (")3<&5C:65S. E$;V=<;B(-"B  ("  ("  (D)R965D. D)0F]R9&5R
M($-O;&QI95QN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA;64Z"0E3
M86US;VY<;B(-"B  ("  ("  (E-P96-I97,Z"41O9UQN( T*("  ("  (" B

M(").86UE. D)4VAE;'1I95QN( T*("  ("  (" B4W!E8VEE<SH)1&]G7&XB

M"0E3:&5E<&1O9UQN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA;64Z
M"0E3<&%R:WE<;B(-"B  ("  ("  (E-P96-I97,Z"4-A=%QN( T*("  ("  

M9R!B;&%N:W, 9VEV97, =&AE(')I9VAT(&YU;6)E<B!O9B!R96-O<F1S("HO


M8W!P.CI-96UO<GE$871A8F%S92  ("  9&%T86)A<V4H)F-O;G1E;G1S6S!=


M8V]R9',H*2D-"B  ("  ("  >PT*("  ("  ("  ("  9G!R:6YT9BAS=&1E

M("  ("  ("!I4F5T(#T ,3L-"B  ("  ("  ?0T*("  ("  ("!E;'-E(&EF

M("  ("  ("  ("!F<')I;G1F*'-T9&5R<BP (DEN8V]R<F5C="!N=6UB97( 


M;VYS="!I;G0 ("!.54U?5$535%, (" ]("  ,3 P,#L-"B  ("  ("  ("  

M($Y535]415-44SL *RMI*0T*("  ("  ("  ("  >PT*("  ("  ("  ("  
M("  (&E2970 /2!E>&5C=71E7W5N:71T97-T*&1A=&%B87-E*3L-" T*("  


M('T-"B  ("  ("  ("  ('T-" T*("  ("  ("  ("  :68H," ]/2!I4F5T
M*0T*("  ("  ("  ("  >PT*("  ("  ("  ("  ("  (&9P<FEN=&8H<W1D
M97)R+" B)60 =&5S=', <W5C8V5E9&5D7&XB+"!.54U?5$535%,I.PT*("  
M("  ("  ("  ?0T*("  ("  ("  ("  96QS90T*("  ("  ("  ("  >PT*
M("  ("  ("  ("  ("  (&9P<FEN=&8H<W1D97)R+" B5&5S=" C)60 9F%I




M*"D /#P 96YD;#L-" T*("  ("  ("!R971U<FX 15A)5%]&04E,55)%.PT*
M("  ('T-"GT-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

`
end

begin 666 Cpp_minimal.cpp
M+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($9I;&4Z

M('!R;V=R86T 9F]R('1H92!/<&5N+5)*+T,K*R H=&AE($,K*R!M87!P:6YG
M(&]F('1H90T*("H ("  ("  ("  ("  ($]P96XM4DH ;&EB<F%R>2DN(%1H
M:7, <')O9W)A;2!U<V5S('1H92!M96UO<GE?9&%T86)A<V4 8VQA<W,-"B J
M("  ("  ("  ("  ("!A;F0 871T96UP=', =&\ 8F4 82!S;6%L;&5S="UP
M;W-S:6)L92!I;F9O<FUA=&EV92!E>&%M<&QE+ T*("H-"B J($-R96%T960Z

M,C P-0T*("H-"B J('=W=SH ("  ("  ("!H='1P.B\O=W=W+F]P96YR:BYO

M('!O:6YT:6YG(&]U="!T:&%T('1H92!T97-T('!R;V=R86US(&QE9G0-"B J
M("  ("  ("  ("  ("!M=6-H('1O(&)E(&1E<VER960 :6X =&5R;7, ;V8 

M:'0 ,C P-2P 4WEN97-I<R!3;V9T=V%R92!0='D 3'1D+ T*("H ("  ("  

M("  ("A,:6-E;G-E9"!U;F1E<B!T:&4 4WEN97-I<R!3;V9T=V%R92!/<&5N

M9&4 :7, <&QA8V5D(&EN=&\ =&AE('!U8FQI8R!D;VUA:6X ,C P- T*("H 
M("  ("  ("  ("  (&)Y(%-Y;F5S:7, 4V]F='=A<F4 4'1Y($QT9"X 5&AE
M<F4 87)E(&YO(')E<W1R:6-T:6]N<PT*("H ("  ("  ("  ("  ('=H871S
M;V5V97( =&\ >6]U<B!U<V4 ;V8 =&AE('-O9G1W87)E+ T*("H-"B J("\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M2B!(96%D97( 1FEL97, *B\-"B-I;F-L=61E(#QO<&5N<FHO8W!P+V1A=&%B
M87-E+FAP<#X-" T*+RH 4W1A;F1A<F0 0RLK($QI8G)A<GD 1FEL97, *B\-
M"B-I;F-L=61E(#QI;W-T<F5A;3X-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M9#HZ8V5R<CL-"G5S:6YG('-T9#HZ96YD;#L-"G5S:6YG('-T9#HZ8V]U=#L-
M" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($=L



M960Z("  ,CAT:"!397!T96UB97( ,C P-%QN( T*("  ("(E)2!5<&1A=&5D

M>5QN( T*("  (")3<&5C:65S. E$;V=<;B(-"B  (" B0G)E960Z"0E":6IO
M;B!<7%QN( T*("  ("()"0E&<FEE>F5<;B(-"B  (" B)25<;B(-"B  (" B

M965D. D)36EX961<;B(-"B  (" B)25<;B(-"B  (" B3F%M93H)"49L=69F


M("  (")"<F5E9#H
M"0E296)E;%QN( T*("  (")3<&5C:65S. E$;V=<;B(-"B  (" B0G)E960Z
M"0E'97)M86X 7%Q<;B(-"B  (" B"0D)4VAE<&AE<F1<;B(-"B  (" B)25<
M;B(-"B  (" B3F%M93H)"5!E<'!E<EQN( T*("  (")3<&5C:65S. E$;V=<




M(")"<F5E9#H


M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O




M;F5D("  ("  ("  ("  ("  ("  ("  ("  9FQA9W, (" ]("  ,#L ("\O
M($YO('-P96-I86P 9FQA9W, :&5R92X-"B  ("  ("  ;W!E;G)J.CIC<' Z
M.DUE;6]R>41A=&%B87-E("  ("!D8B F8V]N=&5N='-;,%TL('-I>F5O9BAC
M;VYT96YT<RDL(&9L86=S*3L-" T*("  ("  (" O+R R+B!$:7-P;&%Y(&1A

M;" \/" B,BX 1&ES<&QA>2!D871A8F%S92!C:&%R86-T97)I<W1I8W,Z(B \

M( T*("  ("  ("  ("  ("  (#P\(&1B+D=E=$YU;4QI;F5S*"D /#P (B!L
M:6YE<R!I;B B( T*("  ("  ("  ("  ("  (#P\(&1B+D=E=$YU;49I96QD
M<R I(#P\("( 9FEE;&1S(&EN("(-"B  ("  ("  ("  ("  (" \/"!D8BY'
M971.=6U296-O<F1S*"D /#P (B!R96-O<F1S( T*("  ("  ("  ("  ("  
M(#P

M=" \/"!E;F1L(#P\("(S+B!%;G5M97)A=&4 <F5C;W)D<R!A;F0 =&AE:7( 
M9FEE;&1S('5S:6YG('-U8G-C<FEP="!O<&5R871O<G,Z(B \/"!E;F1L.PT*


M("  ("  ("  ("!O<&5N<FHZ.F-P<#HZ4F5C;W)D(')E8V]R9"AD8EMI4F5C


M<F0N1V5T0V]M;65N=" I(#P\("( ( T*("  ("  ("  ("  ("  ("  (" \
M/" B(" B(#P\(&1B+D=E=$YU;5)E8V]R9',H*2 \/" B(')E8V]R9',I( T*



M("  ("  ;W!E;G)J.CIC<' Z.D9I96QD("!F:65L9"AR96-O<F1;:49I96QD

M("  (#T
M.CIS=')I;F< ("  ("  ("!V86QU92  (#T ("!F:65L9"Y'971686QU92 I

M1FEE;&0 /#P (CH (B \/"!F:65L9" \/"!E;F1L.PT*("  ("  ("  ("  
M?0T*("  ("  ("!]?0T*("  ('T-"B  ("!C871C:"AS=&0Z.F5X8V5P=&EO

M(&1A=&%B87-E.B B(#P\(' N=VAA=" I(#P

M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

`
end

begin 666 STL.cpp
M+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($9I;&4Z

M('!R;V=R86T 9F]R('1H92!/<&5N+5)*+U-43" H=&AE(%-43"!M87!P:6YG

M* T*("H 0W)E871E9#H
M.B  ("  ,C1T:"!-87D ,C P-0T*("H-"B J('=W=SH ("  ("  ("!H='1P

M:FEV($)H86=W870 9F]R('!O:6YT:6YG(&]U="!T:&%T('1H92!T97-T('!R
M;V=R86US(&QE9G0-"B J("  ("  ("  ("  ("!M=6-H('1O(&)E(&1E<VER
M960 :6X =&5R;7, ;V8 9&ES8V]V97)A8FEL:71Y+ T*("H-"B J($QI8V5N




M("  ("  5&AI<R!S;W5R8V4 8V]D92!I<R!P;&%C960 :6YT;R!T:&4 <'5B


M*B  ("  ("  ("  ("  =VAA='-O979E<B!T;R!Y;W5R('5S92!O9B!T:&4 

M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O


M("H 16YA8FQE('1H:7, =&\ =7-E(&$ ;65M;W)Y7V1A=&%B87-E+"!R871H
M97( =&AA;B!A(&9I;&5?9&%T86)A<V4 ;VX =&AE(&9I;&4-"B J('-P96-I
M9FEE9"!I;B!T:&4 8V]M;6%N9"UL:6YE+ T*("H-"B J+PT*+RH (V1E9FEN


M;GD 97AC97!T:6]N<R!F<F]M('1H92!!4$D =FEA('-T9#HZ97AC97!T:6]N
M(')A=&AE< T*("H =&AA;B!O<&5N<FHZ.G-T;#HZ9&%T86)A<V5?97AC97!T





M:6(N:#X-"B-I;F-L=61E(#QS=')I;F<N:#X-" T*+RH +R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M:6YG('-T9#HZ8V5R<CL-"G5S:6YG('-T9#HZ96YD;#L-"G5S:6YG('-T9#HZ
M8V]U=#L-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-

M:6, =F]I9"!U<V%G92AI;G0 8D5X:70L(&-H87( 8V]N<W0 *G)E87-O;BP 
M:6YT(&EN=F%L:61!<F<L(&EN="!A<F=C+"!C:&%R("IA<F=V6UTI.PT*<W1A
M=&EC(&EN="  <G5N7W5N:71T97-T<R I.PT*<W1A=&EC(&EN="  97AE8W5T
M95]U;FET=&5S="AO<&5N<FHZ.G-T;#HZ9&%T86)A<V4 8V]N<W0 )F1A=&%B
M87-E*3L-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\ *B\-
M" T*<W1A=&EC(&EN="!M86EN7RAI;G0 87)G8RP 8VAA<B J87)G=EM=*0T*



M96YT<RP =&\ <W!E8VEF>2!T:&4 +B J+PT*("  (&9O<BAI(#T ,3L :2 \


M"B  ("  ("  >PT*("  ("  ("  ("  :68H87)G6S%=(#T]("<M)RD-"B  
M("  ("  ("  ('L-"B  ("  ("  ("  ("  (" O*B M+2!A<F=U;65N=', 
M*B\-"B  ("  ("  ("  ("  ("!I9B  ," ]/2!S=')C;7 H(G5N:71T97-T
M(BP 87)G("L ,BD ?'P-"B  ("  ("  ("  ("  ("  ("  ," ]/2!S=')C

M"B  ("  ("  ("  ("  ("  ("  <F5T=7)N(')U;E]U;FET=&5S=',H*3L-

M("  ("  ("  ("  ('L-"B  ("  ("  ("  ("  ("  ("  =7-A9V4H,2P 
M(DEN=F%L:60 87)G=6UE;G0H<RD <W!E8VEF:65D(BP :2P 87)G8RP 87)G

M("  ("  96QS90T*("  ("  ("  ("  >PT*("  ("  ("  ("  ("  ("\J


M<V4 ("  )S\G. T*("  ("  ("  ("  ("  ("  ("  ("  =7-A9V4H,2P 
M3E5,3"P +3$L(&%R9V,L(&%R9W8I.PT*("  ("  ("  ("  ("  ("  ("  

M("  ("  ("  ("  ("  ("  ("  ("  9FQA9W, ?#T ;W!E;G)J.CI/4DI?
M1DQ!1U]/4D1%4D9)14Q$4SL-"B  ("  ("  ("  ("  ("  ("  ("  (&)R
M96%K.PT*("  ("  ("  ("  ("  ("  ("!C87-E("  ("=S)SH-"B  ("  
M("  ("  ("  ("  ("  ("  (&9L86=S('P](&]P96YR:CHZ3U)*7T9,04=?

M<F5A:SL-"B  ("  ("  ("  ("  ("  ("  9&5F875L=#H-"B  ("  ("  

M('-P96-I9FEE9"(L(&DL(&%R9V,L(&%R9W8I.PT*("  ("  ("  ("  ("  



M9BA.54Q,(#T
M("  ("  :F%R3F%M92 ](&%R9SL-"B  ("  ("  ("  ('T-"B  ("  ("  
M("  (&5L<V4-"B  ("  ("  ("  ('L-"B  ("  ("  ("  ("  ("!U<V%G
M92 Q+" B26YV86QI9"!A<F=U;65N="AS*2!S<&5C:69I960B+"!I+"!A<F=C
M+"!A<F=V*3L-"B  ("  ("  ("  ('T-"B  ("  ("  ?0T*("  ('T-" T*

M87).86UE*0T*("  ('L-"B  ("  ("  =7-A9V4H,2P (DUU<W0 <W!E8VEF
M>2!A($I!4B!N86UE(BP +3$L(&%R9V,L(&%R9W8I.PT*("  ('T-"B  ("!E




M+5)*(&1A=&%B87-E("T 0V%T<R!A;F0 1&]G<UQN( T*("  ("  ("  ("  

M("  ("  ("  ("  (" B)24 57!D871E9#H (" R.71H(%-E<'1E;6)E<B R


M("  (D)R965D. D)0FEJ;VX 7%Q<;B(-"B  ("  ("  ("  ("  (" B"0D)


M97,Z"41O9UQN( T*("  ("  ("  ("  ("  (")"<F5E9#H)"4UI>&5D7&XB


M97,Z"4-A=%QN( T*("  ("  ("  ("  ("  ("(E)5QN( T*("  ("  ("  
M("  ("  (").86UE. D)36]E=%QN( T*("  ("  ("  ("  ("  (")3<&5C
M:65S. E$;V=<;B(-"B  ("  ("  ("  ("  (" B0G)E960Z"0E";WAE<EQN
M( T*("  ("  ("  ("  ("  ("(E)5QN( T*("  ("  ("  ("  ("  (").
M86UE. D)4F5B96Q<;B(-"B  ("  ("  ("  ("  (" B4W!E8VEE<SH)1&]G




M("  ("  (D)R965D. D)0F]R9&5R($-O;&QI95QN( T*("  ("  ("  ("  
M("  ("(E)5QN( T*("  ("  ("  ("  ("  (").86UE. D)4V%M<V]N7&XB

M("  ("  (")"<F5E9#H)"5)I9&=E8F%C:UQN( T*("  ("  ("  ("  ("  
M("(E)5QN( T*("  ("  ("  ("  ("  (").86UE. D)4VAE;'1I95QN( T*
M("  ("  ("  ("  ("  (")3<&5C:65S. E$;V=<;B(-"B  ("  ("  ("  
M("  (" B0G)E960Z"0E3:&5T;&%N9"!<7%QN( T*("  ("  ("  ("  ("  
M("()"0E3:&5E<&1O9UQN( T*("  ("  ("  ("  ("  ("(E)5QN( T*("  

M("  (E-P96-I97,Z"4-A=%QN( T*("  ("  ("  ("  ("  ("(E)5QN(CL-
M" T*("  ("  ("  ("  ;W!E;G)J.CIS=&PZ.FUE;6]R>5]D871A8F%S92  
M("!D8B F8V]N=&5N='-;,%TL('-I>F5O9BAC;VYT96YT<RDL(&9L86=S*3L-

M("  ("  (&]P96YR:CHZ<W1L.CID871A8F%S92  (&1B*&IA<DYA;64L(&9L
M86=S*3L-" T*(V5N9&EF("\J(%5315]-14U/4EE?1$%404)!4T4 *B\-" T*
M("  ("  ("  ("  8V]U=" \/" B4F5C;W)D+4I!4B B(#P\(&IA<DYA;64 
M/#P (B!H87, (B \/"!D8BYN=6U?;&EN97,H*2 \/" B(&QI;F5S(&EN("( 
M/#P 9&(N;G5M7V9I96QD<R I(#P\("( 9FEE;&1S(&EN("( /#P 9&(N;G5M
M7W)E8V]R9',H*2 \/" B(')E8V]R9',B(#P
M("  (&-O=70 /#P 96YD;" \/" B4F5C;W)D<R!A;F0 =&AE:7( 9FEE;&1S
M.B( /#P 96YD;#L-
M96-O<F0 /2 P.R!I4F5C;W)D(#P


M8V]U="  (" \/" B<F5C;W)D+2,B(#P\(&E296-O<F0-"B  ("  ("  ("  
M("  ("  ("  ("  (#P\("( (B \/"!R96-O<F0N8V]M;65N=" I(#P\("( 
M( T*("  ("  ("  ("  ("  ("  ("  ("  /#P (B H(B \/"!D8BYS:7IE
M*"D /#P (B!R96-O<F1S*2(-"B  ("  ("  ("  ("  ("  ("  ("  (#P\


M("  ("  ("  ('L-"B  ("  ("  ("  ("  ("  ("  ;W!E;G)J.CIS=&PZ

M("  ("  ('-T9#HZ<W1R:6YG("  ("  ("  ;F%M92  (" ]("  9FEE;&0N
M;F%M92 I.PT*("  ("  ("  ("  ("  ("  ("!S=&0Z.G-T<FEN9R  ("  

M("  ("  ("  8V]U=" \/" B("!F:65L9"TC(B \/"!I1FEE;&0 /#P 9FEE
M;&0 /#P 96YD;#L-

M.F1A=&%B87-E.CIC;VYS=%]I=&5R871O<B  (&)E9VEN("  /2  (&1B+F)E



M*RMB96=I;BP *RMI4F5C;W)D*0T*("  ("  ("  ("  >PT*("  ("  ("  

M"B  ("  ("  ("  ("  ("!C;W5T("  (#P\(")R96-O<F0M(R( /#P :5)E
M8V]R9 T*("  ("  ("  ("  ("  ("  ("  ("  /#P (B B(#P\(')E8V]R
M9"YC;VUM96YT*"D /#P
M/" B("AO9B B(#P\(&1B+G-I>F4H*2 \/" B(')E8V]R9',I( T*("  ("  
M("  ("  ("  ("  ("  ("  /#P 96YD;#L-" T*("  ("  ("  ("  ("  
M(&EF*')E8V]R9"YH87-?9FEE;&0H(DYA;64B*2D-"B  ("  ("  ("  ("  

M="  ('9A;'5E("  ("  (#T ("!R96-O<F1;(DYA;64B73L-" T*("  ("  
M("  ("  ("  ("  ("!C;W5T(#P\(")4:&ES(')E8V]R9"!H87, 82!<(DYA
M;65<(B!F:65L9"P =VAO<V4 =F%L=64 :7, (B \/"!V86QU92 \/"!E;F1L

M("  (&YU;4YA;65S("  (#T ("!R96-O<F0N8V]U;G1?9FEE;&1S*").86UE

M3E53140H;G5M3F%M97,I.PT*("  ("  ("  ("  ("  ('T-" T*("  ("  
M("  ("  ("  (&]P96YR:CHZ<W1L.CIR96-O<F0Z.F-O;G-T7VET97)A=&]R
M(&)E9VEN("  /2  (')E8V]R9"YB96=I;B I.PT*("  ("  ("  ("  ("  
M(&]P96YR:CHZ<W1L.CIR96-O<F0Z.F-O;G-T7VET97)A=&]R(&5N9"  ("  
M/2  (')E8V]R9"YE;F0H*3L-" T*("  ("  ("  ("  ("  (&9O<BAS:7IE
M7W0 :49I96QD(#T ,#L 8F5G:6X (3T 96YD.R K*V)E9VEN+" K*VE&:65L

M96YR:CHZ<W1L.CIF:65L9"  9FEE;&0H*F)E9VEN*3L-"B  ("  ("  ("  
M("  ("  ("  <W1D.CIS=')I;F< ("  ("  ("!N86UE("  (#T ("!F:65L

M("  ("  =F%L=64 (" ]("  9FEE;&0N=F%L=64H*3L-" T*(VEF("%D969I


M9FEE;&0M(R( /#P :49I96QD(#P\("( (B \/"!F:65L9" \/"!E;F1L.PT*
M(V5L<V4 +RH /R!C;VUP:6QE<B J+PT*("  ("  ("  ("  ("  ("  ("!C
M;W5T(#P\("( (&9I96QD+2,B(#P\(&E&:65L9" \/" B("( /#P <W1L<V]F
M=#HZ8U]S=')?<'1R*&9I96QD*2 \/"!E;F1L.PT*(V5N9&EF("\J(&-O;7!I

M:69N9&5F($]014Y22E]35$Q?1$%404)!4T5?3D]?1DE%3$1?251%4D%43U)3

M/"!E;F1L.PT*("  ("  ("  ("  <W1D.CIC;W!Y*&1B+F9I96QD<U]B96=I
M;B I+"!D8BYF:65L9'-?96YD*"DL('-T9#HZ;W-T<F5A;5]I=&5R871O<CQO
M<&5N<FHZ.G-T;#HZ9FEE;&0^*'-T9#HZ8V]U="P (EQN(BDI.PT*(V5N9&EF
M("\J("%/4$5.4DI?4U1,7T1!5$%"05-%7TY/7T9)14Q$7TE415)!5$]24R J

M1%]%6$-%4%1)3TY?3TY,60T*("  ("  ("!C871C:"AS=&0Z.F5X8V5P=&EO
M;B F>"D-"B  ("  ("  >PT*("  ("  ("  ("  8V5R<B \/" B1F%I;&5D
M('1O(&]P96X 9&%T86)A<V4Z("( /#P >"YW:&%T*"D /#P 96YD;#L-"B  
M("  ("  ?0T*(V5L<V4 +RH /R!54T5?4U1$7T580T505$E/3E]/3DQ9("HO


M("!R8R ](' N<F,H*3L-" T*("  ("  ("  ("  :68H," A/2!R8RD-"B  

M("  ("  ("  ("  >PT*("  ("  ("  ("  ("  ("  ("!C87-E("  (&]P

M("  ("  ("  ("  8V]U=" \/" B0V%N;F]T(&]P96X 9FEL93H (B \/"!J
M87).86UE(#P\("(B(#P
M("!B<F5A:SL-"B  ("  ("  ("  ("  ("  ("  8V%S92  ("!O<&5N<FHZ
M.D]22E]20U]005)314524D]2. T*("  ("  ("  ("  ("  ("  ("  ("  

M("  ("  ("  ("  ("  ("  ("  (#P\("(L(&%T(&QI;F4 (B \/"!X+F5R
M<F]R*"DN:6YV86QI9$QI;F4-"B  ("  ("  ("  ("  ("  ("  ("  ("  
M("  ("  /#P (BP 8V]L=6UN("( /#P
M;6X-"B  ("  ("  ("  ("  ("  ("  ("  ("  ("  ("  /#P (CL (B \

M("  ("  ("  ("  ("  ("  ("  ("  ("  ("  (#P\("(B(#P\(&5N9&P[

M("  ("  ("  9&5F875L=#H-"B  ("  ("  ("  ("  ("  ("  ("  (&)R
M96%K.PT*("  ("  ("  ("  ("  ('T-"B  ("  ("  ("  ('T-"B  ("  




M"B  ("  ("  <F5T=7)N(&UA:6Y?*&%R9V,L(&%R9W8I.PT*("  ('T-"B  

M<G( /#P (E5N:&%N9&QE9"!E<G)O<CH (B \/"!X+G=H870H*2 \/"!E;F1L

M(#P\(")5;FAA;F1L960 =6YK;F]W;B!E<G)O<B( /#P 96YD;#L-"B  ("!]

M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O


M:68 +RH (6%L;&]C82 J+PT*(R!D969I;F4 86QL;V-A("  ("  ("  ("  


M86QL;V-A("  ("  ("  ("  7V%L;&]C80T*(R!E;F1I9B O*B A86QL;V-A


M="P 8VAA<B!C;VYS=" J<F5A<V]N+"!I;G0 :6YV86QI9$%R9RP :6YT(&%R
M9V,L(&-H87( *F%R9W9;72D-"GL-"B  ("!C:&%R("  ("I%6$5?3D%-12  
M(#T ("!S=')C<'DH<W1A=&EC7V-A<W0\8VAA<BH^*&%L;&]C82 Q("L <W1R

M"B  ("!I9BA.54Q,("$]("AP(#T <W1R<F-H<BA%6$5?3D%-12P )UQ<)RDI
M*0T*("  ('L-"B  ("  ("  ,%LH15A%7TY!344 /2!P("L ,2D +2 Q72 ]

M15A%7TY!344L("<O)RDI*0T*("  ('L-"B  ("  ("  ,%LH15A%7TY!344 

M(B \/"!E;F1L.PT*("  (&-E<G( /#P (B  3W!E;BU22B!35$P =&5S="!P
M<F]G<F%M.B B(#P\($5815].04U%(#P\(&5N9&P[.PT*("  (&-E<G( /#P 
M(B( /#P 96YD;#L-" T*("  ('-T;'-O9G1?87-S97)T*&EN=F%L:61!<F< 
M/"!A<F=C*3L-" T*("  (&EF*$Y53$P (3T <F5A<V]N*0T*("  ('L-"B  
M("  ("  8V5R<B \/" B("!%<G)O<CH (B \/"!R96%S;VX /#P (B( /#P 
M96YD;#L-"B  ("  ("  8V5R<B \/" B(B \/"!E;F1L.PT*("  ('T-" T*

M/" B("!&:7)S="!I;G9A;&ED(&%R9W5M96YT(",B(#P\(&EN=F%L:61!<F< 
M/#P (CH (B \/"!A<F=V6VEN=F%L:61!<F==(#P
M(&-E<G( /#P (B  07)G=6UE;G1S('=E<F4 *&9I<G-T(&)A9"!M87)K960 
M*BDZ(B \/"!E;F1L(#P

M/#P (B  (B \/" H*&D /3T :6YV86QI9$%R9RD /R B*B B(#H (B  (BD 
M/#P
M/#P (B( /#P 96YD;#L-

M/#P 96YD;#L-"B  ("!C97)R(#P\("(B(#P
M/" B("  ("UO("  ("  ("  ("  +2  (&]R9&5R<R!T:&4 9FEE;&1S('=I
M=&AI;B!E86-H(')E8V]R9"( /#P 96YD;#L-"B  ("!C97)R(#P\("( ("  
M+7, ("  ("  ("  (" M("  96QI9&4 8FQA;FL <F5C;W)D<R!F<F]M('1H
M92!D871A8F%S92( /#P 96YD;#L-"B  ("!C97)R(#P\("( ("  /&1A=&%B
M87-E/B  (" M("  =&AE($]P96XM4DH 9&%T86)A<V4 9FEL92( /#P 96YD
M;#L-"B  ("!C97)R(#P\("(B(#P
M($-O;G9E<G1S('1H92 \:6YP=70M9FEL93X =&\ =&AE(#QO=71P=70M9FEL
M93X 8GD 96ET:&5R(B \/"!E;F1L.PT*("  (&-E<G( /#P (B  ("!"87-E
M+38T(&5N8V]D:6YG(" M92D ;W( 0F%S92TV-"!D96-O9&EN9R H+60I(B \
M/"!E;F1L.PT*("  (&-E<G( /#P (B( /#P 96YD;#L-"B  ("!C97)R(#P\

M/"!E;F1L.PT*("  (&-E<G( /#P (B( /#P 96YD;#L-"B  ("!C97)R(#P\

M('-U8V-E960L(&YO;BTP(&]T:&5R=VES92( /#P 96YD;#L-"B  ("!C97)R
M(#P\("(B(#P
M($5815].04U%(#P\("( +3\B(#P
M/"!E;F1L.PT*("  (&-E<G( /#P (B  ("!$:7-P;&%Y<R!T:&ES(&AE;' B
M(#P


M.CIS=&PZ.F1A=&%B87-E7V)A<V4 8V]N<W0 )F1A=&%B87-E*0T*>PT*("  


M92!T;W1A;"!O9B!E86-H(')E8V]R9 T*("  (" J+PT*("  ('-I>F5?="  
M;G5M1FEE;&1S,2  /2  (&1A=&%B87-E+FYU;5]F:65L9',H*3L-"B  ("!S
M:7IE7W0 (&YU;49I96QD<S( (#T
M(&D /2 P.R!I(#P 9&%T86)A<V4N;G5M7W)E8V]R9',H*3L *RMI*0T*("  
M('L-"B  ("  ("  ;G5M1FEE;&1S,B K/2!D871A8F%S95MI72YS:7IE*"D[


M.CI'971.=6U&:65L9',H*3H )6QU.R!N('  4F5C;W)D.CI'971.=6U&:65L
M9',H*3H )6QU7&XB+"!N=6U&:65L9',Q+"!N=6U&:65L9',R*3L-" T*("  


M"GT-" T*<W1A=&EC(&EN="!R=6Y?=6YI='1E<W1S*"D-"GL-"B  ("!S=&%T

M86UP;&4 3W!E;BU22B!D871A8F%S92 M($-A=', 86YD($1O9W-<;B(-"B  
M("  ("  (B4E($-R96%T960Z("  ,CAT:"!397!T96UB97( ,C P-%QN( T*
M("  ("  (" B)24 57!D871E9#H

M. E$;V=<;B(-"B  ("  ("  (D)R965D. D)0FEJ;VX 7%Q<;B(-"B  ("  
M("  ( D)"49R:65Z95QN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA


M(").86UE. D)1FQU9F9Y($MI='1E;EQN( T*("  ("  (" B4W!E8VEE<SH)

M;B(-"B  ("  ("  (E-P96-I97,Z"41O9UQN( T*("  ("  (" B0G)E960Z
M"0E";WAE<EQN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA;64Z"0E2

M<F5E9#H)"4=E<FUA;B!<7%QN( T*("  ("  (" B"0D)4VAE<&AE<F1<;B(-

M("  ("  (")3<&5C:65S. E$;V=<;B(-"B  ("  ("  (D)R965D. D)0F]R
M9&5R($-O;&QI95QN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA;64Z
M"0E386US;VY<;B(-"B  ("  ("  (E-P96-I97,Z"41O9UQN( T*("  ("  

M("  (").86UE. D)4VAE;'1I95QN( T*("  ("  (" B4W!E8VEE<SH)1&]G

M("()"0E3:&5E<&1O9UQN( T*("  ("  (" B)25<;B(-"B  ("  ("  (DYA
M;64Z"0E3<&%R:WE<;B(-"B  ("  ("  (E-P96-I97,Z"4-A=%QN( T*("  

M9&EN9R!B;&%N:W, 9VEV97, =&AE(')I9VAT(&YU;6)E<B!O9B!R96-O<F1S


M:CHZ<W1L.CIM96UO<GE?9&%T86)A<V4 ("  9&%T86)A<V4H)F-O;G1E;G1S



M97)R+" B26YC;W)R96-T(&YU;6)E<B!O9B!R96-O<F1S7&XB*3L-" T*("  


M("  ("  ("  (&9P<FEN=&8H<W1D97)R+" B26YC;W)R96-T(&YU;6)E<B!O


M;G-T(&EN="  ($Y535]415-44R  (#T
M:6YT("  ("  ("  :3L-" T*("  ("  ("  ("  9F]R*&D /2 P.R!I(#P 


M("  ("  ("  ("  :68H," A/2!I4F5T*0T*("  ("  ("  ("  ("  ('L-





M("  ("  ("  ("  ("  9G!R:6YT9BAS=&1E<G(L(")497-T(",E9"!F86EL

M("  <F5T=7)N(" P(#T
M04E,55)%.PT*("  ('T-"B  ("!C871C:"AS=&0Z.F5X8V5P=&EO;B F>"D-



M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
8+PT*("H 96YD(&]F(&9I;&4-"B J+PT*
`
end

begin 666 STL_minimal.cpp
M+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($9I;&4Z

M('!R;V=R86T 9F]R('1H92!/<&5N+5)*+U-43" H=&AE(%-43"!M87!P:6YG
M(&]F('1H90T*("H ("  ("  ("  ("  ($]P96XM4DH ;&EB<F%R>2DN(%1H
M:7, <')O9W)A;2!U<V5S('1H92!M96UO<GE?9&%T86)A<V4 8VQA<W,-"B J
M("  ("  ("  ("  ("!A;F0 871T96UP=', =&\ 8F4 82!S;6%L;&5S="UP
M;W-S:6)L92!I;F9O<FUA=&EV92!E>&%M<&QE+ T*("H-"B J($-R96%T960Z

M,C P-0T*("H-"B J('=W=SH ("  ("  ("!H='1P.B\O=W=W+F]P96YR:BYO

M('!O:6YT:6YG(&]U="!T:&%T('1H92!T97-T('!R;V=R86US(&QE9G0-"B J
M("  ("  ("  ("  ("!M=6-H('1O(&)E(&1E<VER960 :6X =&5R;7, ;V8 

M:'0 ,C P-2P 4WEN97-I<R!3;V9T=V%R92!0='D 3'1D+ T*("H ("  ("  

M("  ("A,:6-E;G-E9"!U;F1E<B!T:&4 4WEN97-I<R!3;V9T=V%R92!/<&5N

M9&4 :7, <&QA8V5D(&EN=&\ =&AE('!U8FQI8R!D;VUA:6X ,C P- T*("H 
M("  ("  ("  ("  (&)Y(%-Y;F5S:7, 4V]F='=A<F4 4'1Y($QT9"X 5&AE
M<F4 87)E(&YO(')E<W1R:6-T:6]N<PT*("H ("  ("  ("  ("  ('=H871S
M;V5V97( =&\ >6]U<B!U<V4 ;V8 =&AE('-O9G1W87)E+ T*("H-"B J("\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M2B!(96%D97( 1FEL97, *B\-"B-I;F-L=61E(#QO<&5N<FHO<W1L+V1A=&%B
M87-E+FAP<#X-" T*+RH 4W1A;F1A<F0 0RLK($QI8G)A<GD 1FEL97, *B\-
M"B-I;F-L=61E(#QI;W-T<F5A;3X-" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

M9#HZ8V5R<CL-"G5S:6YG('-T9#HZ96YD;#L-"G5S:6YG('-T9#HZ8V]U=#L-
M" T*+RH +R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O
M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\-"B J($=L



M960Z("  ,CAT:"!397!T96UB97( ,C P-%QN( T*("  ("(E)2!5<&1A=&5D

M>5QN( T*("  (")3<&5C:65S. E$;V=<;B(-"B  (" B0G)E960Z"0E":6IO
M;B!<7%QN( T*("  ("()"0E&<FEE>F5<;B(-"B  (" B)25<;B(-"B  (" B

M965D. D)36EX961<;B(-"B  (" B)25<;B(-"B  (" B3F%M93H)"49L=69F


M("  (")"<F5E9#H
M"0E296)E;%QN( T*("  (")3<&5C:65S. E$;V=<;B(-"B  (" B0G)E960Z
M"0E'97)M86X 7%Q<;B(-"B  (" B"0D)4VAE<&AE<F1<;B(-"B  (" B)25<
M;B(-"B  (" B3F%M93H)"5!E<'!E<EQN( T*("  (")3<&5C:65S. E$;V=<




M(")"<F5E9#H


M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O




M;F5D("  ("  ("  ("  ("  ("  ("  ("  9FQA9W, (" ]("  ,#L ("\O
M($YO('-P96-I86P 9FQA9W, :&5R92X-"B  ("  ("  ;W!E;G)J.CIS=&PZ
M.FUE;6]R>5]D871A8F%S92  ("!D8B F8V]N=&5N='-;,%TL('-I>F5O9BAC
M;VYT96YT<RDL(&9L86=S*3L-" T*("  ("  (" O+R R+B!$:7-P;&%Y(&1A

M;" \/" B,BX 1&ES<&QA>2!D871A8F%S92!C:&%R86-T97)I<W1I8W,Z(B \

M( T*("  ("  ("  ("  ("  (#P\(&1B+FYU;5]L:6YE<R I(#P\("( ;&EN
M97, :6X (B -"B  ("  ("  ("  ("  (" \/"!D8BYN=6U?9FEE;&1S*"D 
M/#P (B!F:65L9', :6X ( T*("  ("  ("  ("  ("  (#P\(&1B+FYU;5]R
M96-O<F1S*"D /#P (B!R96-O<F1S( T*("  ("  ("  ("  ("  (#P\(&5N


M;F1L(#P\("(S+B!%;G5M97)A=&4 <F5C;W)D<R!A;F0 =&AE:7( 9FEE;&1S

M("  ('L 9F]R*'-I>F5?="!I4F5C;W)D(#T ,#L :5)E8V]R9" \(&1B+G-I

M<FHZ.G-T;#HZ
M("  ("  (&-O=70 ("  /#P
M("  ("  ("  ("  ("  (#P\("( (B \/"!R96-O<F0N8V]M;65N=" I(#P\
M("( ( T*("  ("  ("  ("  ("  ("  (" \/" B(" B(#P\(&1B+G-I>F4H
M*2 \/" B(')E8V]R9',I( T*("  ("  ("  ("  ("  ("  (" \/"!E;F1L

M9" \(')E8V]R9"YS:7IE*"D[("LK:49I96QD*0T*("  ("  ("  ("  >PT*
M("  ("  ("  ("  ("  (&]P96YR:CHZ<W1L.CIF:65L9"  9FEE;&0H<F5C
M;W)D6VE&:65L9%TI.PT*("  ("  ("  ("  ("  ('-T9#HZ<W1R:6YG("  
M("  ("  ;F%M92  (" ]("  9FEE;&0N;F%M92 I.PT*("  ("  ("  ("  
M("  ('-T9#HZ<W1R:6YG("  ("  ("  =F%L=64 (" ]("  9FEE;&0N=F%L
M=64H*3L-" T*("  ("  ("  ("  ("  (&-O=70 /#P (B  9FEE;&0M(R( 
M/#P :49I96QD(#P\("(Z("( /#P 9FEE;&0 /#P 96YD;#L-"B  ("  ("  
M("  ('T-"B  ("  ("  ?7T-" T*("  ("  (" O+R T+B!%;G5M97)A=&4 

M("  ("  (&-O=70 /#P 96YD;" \/" B-"X 16YU;65R871E(')E8V]R9', 
M86YD('1H96ER(&9I96QD<R!U<VEN9R!B96=I;B I+V5N9" I(&UE=&AO9',Z

M87-E.CIC;VYS=%]I=&5R871O<B  (&)E9VEN("  /2  (&1B+F)E9VEN*"D[


M9F]R*#L
M("  ("  ("!O<&5N<FHZ.G-T;#HZ<F5C;W)D(')E8V]R9" J8F5G:6XI.PT*

M("  ("  ("  (#P\("( (B \/"!R96-O<F0N8V]M;65N=" I(#P\("( ( T*
M("  ("  ("  ("  ("  ("  (" \/" B("AO9B B(#P\(&1B+G-I>F4H*2 \
M/" B(')E8V]R9',I( T*("  ("  ("  ("  ("  ("  (" \/"!E;F1L.PT*

M92(I*0T*("  ("  ("  ("  >PT*("  ("  ("  ("  ("  (&]P96YR:CHZ
M<W1L.CIS=')I;F=?="  ('9A;'5E("  ("  (#T ("!R96-O<F1;(DYA;64B
M73L-" T*("  ("  ("  ("  ("  (&-O=70 /#P (E1H:7, <F5C;W)D(&AA
M<R!A(%PB3F%M95PB(&9I96QD+"!W:&]S92!V86QU92!I<R B(#P\('9A;'5E
M(#P
M("  ("  ("!N=6U.86UE<R  (" ]("  <F5C;W)D+F-O=6YT7V9I96QD<R B


M*B\-" T*("  ("  ("  ("  ;W!E;G)J.CIS=&PZ.G)E8V]R9#HZ8V]N<W1?

M("  ("!O<&5N<FHZ.G-T;#HZ<F5C;W)D.CIC;VYS=%]I=&5R871O<B!E;F0 
M("  (#T
M9VEN("$](&5N9#L *RMB96=I;BD-"B  ("  ("  ("  ('L-"B  ("  ("  
M("  ("  ("!O<&5N<FHZ.G-T;#HZ9FEE
M("  ("  ("  ("  ("  <W1D.CIS=')I;F< ("  ("  ("!N86UE("  (#T 

M("  ("  ("!V86QU92  (#T
M("  ("  ("  +R\ 5D,K*R V+C  86YD(&5A<FQI97( 9&]N)W0 9&\ =&AE
M(&EN<V5R=&EO;B!O<&5R871O<B!P<F]P97)L>0T*(VEF("%D969I;F5D*%]?


M/#P 9FEE;&0 /#P 96YD;#L-
M("  ("  ("  ("  ("!C;W5T(#P\("( (&9I96QD(B \/" B("( /#P <W1L
M<V]F=#HZ8U]S=')?<'1R*&9I96QD*2 \/"!E;F1L.PT*(V5N9&EF("\J(&-O

M968 3U!%3E)*7U-43%]$051!0D%315].3U]&245,1%])5$52051/4E, +R\ 
M3F]T(&%L;"!C;VUP:6QE<G, <W5P<&]R="!T:&ES+"!S;R N+BX-"B  ("  
M("  +R\ -2X 16YU;65R871E(&%L;"!T:&4 9FEE;&1S(&]F('1H92!D871A

M;G5M97)A=&4 86QL('1H92!F:65L9', ;V8 =&AE(&1A=&%B87-E(&5N(&)L

M(&9I96QD<SHB(#P
M9'-?8F5G:6XH*2P 9&(N9FEE;&1S7V5N9" I+"!S=&0Z.F]S=')E86U?:71E
M<F%T;W(\;W!E;G)J.CIS=&PZ.F9I96QD/BAS=&0Z.F-O=70L(")<;B(I*3L-
M"B-E;F1I9B O*B A3U!%3E)*7U-43%]$051!0D%315].3U]&245,1%])5$52
M051/4E, *B\-" T*("  ('T-"B  ("!C871C:"AS=&0Z.F5X8V5P=&EO;B F

M=&%B87-E.B B(#P\(' N=VAA=" I(#P

M+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O+R\O

`
end
May 24 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Matthew" <admin.hat stlsoft.dot.org> wrote in message
news:d6v9va$19nt$1 digitaldaemon.com...
 I've updated the three C/C++ test files (C.c, Cpp.cpp and STL.cpp), and
also added two new test files (Cpp_minimal.cpp)
 and STL_minimal.cpp).
Can you put large files on the web site and post a link here instead? Lots of people access these newsgroups with dialups, and these large attachments make it difficult. Thanks!
May 24 2005
parent "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
For some reason, when it was in the send folder, it looked like 6 
KB. Sorry.

"Walter" <newshound digitalmars.com> wrote in message 
news:d6vspj$2236$1 digitaldaemon.com...
 "Matthew" <admin.hat stlsoft.dot.org> wrote in message
 news:d6v9va$19nt$1 digitaldaemon.com...
 I've updated the three C/C++ test files (C.c, Cpp.cpp and 
 STL.cpp), and
also added two new test files (Cpp_minimal.cpp)
 and STL_minimal.cpp).
Can you put large files on the web site and post a link here instead? Lots of people access these newsgroups with dialups, and these large attachments make it difficult. Thanks!
May 24 2005
prev sibling parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
Thanks for taking the comments in the right spirit.

1. Open source:
The success of the open source model lies in (competent) others being able
to (relatively) easily understand the code and hence develop confidence, use
it and further be able to enhance it. Goes perfectly well with the idiom
that programmers write code for other programmers (could be 'new' you, after
3 months!). Got to keep it simple, if can't, got to put comments next to it.
I strictly follow that 95% of code be less than 20 line routines, but don't
want to give others any advise on this issue. (Those who are sold on it,
don't need the advice; others are going to call me impractical, anyway!).
And, I have written and am maintaining reasonably big programs for a number
of years (decades). Oops, giving away my age..
So, others are going to look at your code first to see if they can
understand it .. that decides whether they will use it. So, 'internal /
worker' routines also need to be 'good'!

2. 'c' and 'stl'
With practically every platform having a c++ compiler, today I use C only
for the embedded projects, where it is not possible/often not required to
have c++. Thus, the mention of 'c' usability gave me the hopes of using this
with the smaller 8031 based 'c' projects. The small 'file system' would be a
better standard to follow than a proprietary one for every project. From
this perspective, the first look at the library is disappointing.

The thick STL book convinced me that STL beats 'hand coding' in every
situation. So, it should be used without reservation. What I am looking for,
however, is 'minimum' use of STL to avoid problems with various
'differently' conforming compilers. Even here, as written, my 'desired'
sample program effectively hides the use of STL, so it is largely usable
as-is on the smaller configurations. So, no boost, no stlsoft. Not for such
a small thing..

Even then, aggressively using STL for every situation still eludes me. Hats
off to guys like you who can understand the complex templates and 'meta'
programming. Just keep on explaining and we will (hopefully) pick it up.
But, use it for the wrong things and we will be driven away. (After saying
this, I have made an attempt to use nothing else but STL, and I am aware
that there must be umpteen ways to do it right!)

3. Other design choices:
This task of picking up records can be done easily (if the setup is right)
using lex/yacc, boost spirit and any other dozens of similar parsing
mechanisms, but all are overkills for separating 'name: value'. This looks
like a simple C thing. What's the big deal about it? Yes, this action needs
to be center-stage. The table - record comments, count of records,
selectively ignoring spaces are all peripheral. The present implementation
needs to segregate these in obvious ways.

Fields are smallest operable entities, each record has multiple fields
(whether 2 records have same named fields is a design decision, OpenRj is
attractive because it does not force us to), many records constitute a table
(same size=rectangular table. Otherwise 'round'??), many tables make a
database. A real database is a much bigger beast. This is a table handler,
and it is useful as one. Pretend it to be anything else and it gets
ridiculed. Anything slightly bigger and programmers would use Sqlite, MySql
or other 'in-memory' databases capable of understanding SQL. Too much prior
art there to ignore.

One class or two derived from a base? That's your choice. The possibility of
testing using in-memory strings and then switching over to files is very
real. Users want minimum change then. That's why the suggestion about a
single class. And that is where writing a real application before the
library comes into the picture. So, please don't say 'vestigial/unfinished'
!! Please start with the app, first.

Also, I am talking about the use of 'foreach' in the example code. The
library does not use it. This is a perfect way to illustrate a technique, in
this case, the emphasis would be on the library classes 'capable' of being
traversed in this way. In my illustrative design, the same ones may be
traversed in the 'usual' begin-end way!! I needed your opinion on this as a
researcher of iterations over containers. Are you aware of an implementation
of 'foreach' for c++? I would find it hard to believe that what I have been
using for quite some time (even before I started using STL) has not been in
circulation...

Already, we have discussed too much regarding this ;-) Only excusable, if we
consider the principles in general, not for this project.
The only reason I have still not posted any code is to make sure that this
is read! I know I would rush to the code first and ignore everything ;-)

Regards,
- Rajiv



"Matthew" <admin.hat stlsoft.dot.org> wrote in message
news:d6v7jf$15om$1 digitaldaemon.com...
 Wow! A lot to think about, and a lot of very useful feedback that's
already got me thinking.

...
May 24 2005
parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
 1. Open source:
 The success of the open source model lies in (competent) others 
 being able
 to (relatively) easily understand the code and hence develop 
 confidence, use
 it and further be able to enhance it. Goes perfectly well with the 
 idiom
 that programmers write code for other programmers (could be 'new' 
 you, after
 3 months!). Got to keep it simple, if can't, got to put comments 
 next to it.
 I strictly follow that 95% of code be less than 20 line routines, 
 but don't
 want to give others any advise on this issue. (Those who are sold 
 on it,
 don't need the advice; others are going to call me impractical, 
 anyway!).
 And, I have written and am maintaining reasonably big programs for 
 a number
 of years (decades). Oops, giving away my age..
 So, others are going to look at your code first to see if they can
 understand it .. that decides whether they will use it. So, 
 'internal /
 worker' routines also need to be 'good'!
Agreed, and well taken. I've updated Open-RJ - now 1.3.2 (http://openrj.org/) - in line with this good advice. I shall do the same with recls in a few days, and STLSoft for its next release. Thanks for this
 2. 'c' and 'stl'
 With practically every platform having a c++ compiler, today I use 
 C only
 for the embedded projects, where it is not possible/often not 
 required to
 have c++. Thus, the mention of 'c' usability gave me the hopes of 
 using this
 with the smaller 8031 based 'c' projects. The small 'file system' 
 would be a
 better standard to follow than a proprietary one for every 
 project. From
 this perspective, the first look at the library is disappointing.
I don't agree here, as the aims for Open-RJ are not commensurate with that. Specifically: - I wanted it to be as attractive to pure-C (particularly Linux) folks, as C++; there are a lot of C programmers who aren't C++ programmers. - I wanted it to be super small, and flexible, with as few dependencies as possible. In its chopped down state - where you bring your own allocator - it requires only stddef.h! - A library that's to be mapped to many different languages must have a C-API. Given that, and the fact that the impl is pretty simple - the original was written in a couple of hours - it seems pointless not to implement in C. This is informed, in part, by my experience with recls, which _is_ implemented in C++ (though still presents a C-API).
 The thick STL book convinced me that STL beats 'hand coding' in 
 every
 situation. So, it should be used without reservation.
Agreed, for application code, and for library code that's only going to be used by C++ client code.
 What I am looking for,
 however, is 'minimum' use of STL to avoid problems with various
 'differently' conforming compilers. Even here, as written, my 
 'desired'
 sample program effectively hides the use of STL, so it is largely 
 usable
 as-is on the smaller configurations. So, no boost, no stlsoft. Not 
 for such
 a small thing..
Can't respond to this, until I see the code. Walter wrote a very small impl in D, which was great as far as it went, but it didn't go further than the parsing into fields and records. That's fine, if that's all that's wanted, but it's not a fully representative comparison. (FYI: May's instalment of "Positive Integration" http://www.cuj.com/documents/s=9784/cuj0505wilson/, discusses this very subject, and shows how the 100% D version is slightly slower. I expect the same from a pure C++ version, although I wouldn't bet the house on it. Hmmm, maybe I'll try it with string_view, that might be as fast.)
 Even then, aggressively using STL for every situation still eludes 
 me. Hats
 off to guys like you who can understand the complex templates and 
 'meta'
 programming. Just keep on explaining and we will (hopefully) pick 
 it up.
The only reason I write about it is because I find it confusing as well. :-)
 3. Other design choices:
 This task of picking up records can be done easily (if the setup 
 is right)
 using lex/yacc, boost spirit and any other dozens of similar 
 parsing
 mechanisms, but all are overkills for separating 'name: value'. 
 This looks
 like a simple C thing. What's the big deal about it?
There is no big deal. It's just a simple little library, with mappings to many languages. It's useful, small, portable. Just badly documented. (Or maybe 'was', as I'm hoping the 1.3.2 release answers a lot of your concerns. Please let me know if/where it doesn't.) FYI: I read about the Record-JAR in Raymond's "The Art Of UNIX Programming" - a book I'd recommend to *everyone*. It is one of many formats he discusses, each of which has its own virtues and niches. I've found Open-RJ ideal for the configuration files of various programs where they need more than a few command-line args, and where XML would be overkill.
 Yes, this action needs
 to be center-stage. The table - record comments, count of records,
 selectively ignoring spaces are all peripheral. The present 
 implementation
 needs to segregate these in obvious ways.

 Fields are smallest operable entities, each record has multiple 
 fields
 (whether 2 records have same named fields is a design decision, 
 OpenRj is
 attractive because it does not force us to), many records 
 constitute a table
 (same size=rectangular table. Otherwise 'round'??), many tables 
 make a
 database. A real database is a much bigger beast. This is a table 
 handler,
 and it is useful as one. Pretend it to be anything else and it 
 gets
 ridiculed. Anything slightly bigger and programmers would use 
 Sqlite, MySql
 or other 'in-memory' databases capable of understanding SQL. Too 
 much prior
 art there to ignore.
Well, I think anything more complex and one would use XML, but then I see it as a configuration format, rather than a database format. (I guess using the term Database was somewhat ill-chosen, then <g>)
 One class or two derived from a base? That's your choice. The 
 possibility of
 testing using in-memory strings and then switching over to files 
 is very
 real. Users want minimum change then. That's why the suggestion 
 about a
 single class.
Because they inherit, there is no confusion/complexity here. The only difference is the constructors for the derived (file and memory) classes. I think it's very simple, orthogonal, discoverable.
 And that is where writing a real application before the
 library comes into the picture. So, please don't say 
 'vestigial/unfinished'
 !! Please start with the app, first.
Point taken.
 Also, I am talking about the use of 'foreach' in the example code. 
 The
 library does not use it. This is a perfect way to illustrate a 
 technique, in
 this case, the emphasis would be on the library classes 'capable' 
 of being
 traversed in this way. In my illustrative design, the same ones 
 may be
 traversed in the 'usual' begin-end way!! I needed your opinion on 
 this as a
 researcher of iterations over containers. Are you aware of an 
 implementation
 of 'foreach' for c++? I would find it hard to believe that what I 
 have been
 using for quite some time (even before I started using STL) has 
 not been in
 circulation...
Maybe I'll plug in "Ranges" into the Open-RJ/C++ and /STL mappings. A 1.4 feature, perhaps ...
 Already, we have discussed too much regarding this ;-) Only 
 excusable, if we
 consider the principles in general, not for this project.
Sure
 The only reason I have still not posted any code is to make sure 
 that this
 is read! I know I would rush to the code first and ignore 
 everything ;-)
It is read. Now post! :-)
May 25 2005
next sibling parent reply "Rajiv Bhagwat" <dataflow vsnl.com> writes:
I have taken Walter's advice - instead of posting files here, I have posted
an article on CodeProject.
"Implementing 'foreach' for c++ as a Design Pattern"
http://www.codeproject.com/

Have attached the alternate OpenRj implementation as the 'sample project'.
It has been tested (obviously) on DMC, as well as on VC6 & gcc under linux.

- Rajiv


"Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message
news:d73k78$dkh$1 digitaldaemon.com...
 1. Open source:
 The success of the open source model lies in (competent) others
 being able
 to (relatively) easily understand the code and hence develop
 confidence, use
 it and further be able to enhance it. Goes perfectly well with the
 idiom
 that programmers write code for other programmers (could be 'new'
 you, after
 3 months!). Got to keep it simple, if can't, got to put comments
 next to it.
 I strictly follow that 95% of code be less than 20 line routines,
 but don't
 want to give others any advise on this issue. (Those who are sold
 on it,
 don't need the advice; others are going to call me impractical,
 anyway!).
 And, I have written and am maintaining reasonably big programs for
 a number
 of years (decades). Oops, giving away my age..
 So, others are going to look at your code first to see if they can
 understand it .. that decides whether they will use it. So,
 'internal /
 worker' routines also need to be 'good'!
Agreed, and well taken. I've updated Open-RJ - now 1.3.2 (http://openrj.org/) - in line with this good advice. I shall do the same with recls in a few days, and STLSoft for its next release. Thanks for this
 2. 'c' and 'stl'
 With practically every platform having a c++ compiler, today I use
 C only
 for the embedded projects, where it is not possible/often not
 required to
 have c++. Thus, the mention of 'c' usability gave me the hopes of
 using this
 with the smaller 8031 based 'c' projects. The small 'file system'
 would be a
 better standard to follow than a proprietary one for every
 project. From
 this perspective, the first look at the library is disappointing.
I don't agree here, as the aims for Open-RJ are not commensurate with that. Specifically: - I wanted it to be as attractive to pure-C (particularly Linux) folks, as C++; there are a lot of C programmers who aren't C++ programmers. - I wanted it to be super small, and flexible, with as few dependencies as possible. In its chopped down state - where you bring your own allocator - it requires only stddef.h! - A library that's to be mapped to many different languages must have a C-API. Given that, and the fact that the impl is pretty simple - the original was written in a couple of hours - it seems pointless not to implement in C. This is informed, in part, by my experience with recls, which _is_ implemented in C++ (though still presents a C-API).
 The thick STL book convinced me that STL beats 'hand coding' in
 every
 situation. So, it should be used without reservation.
Agreed, for application code, and for library code that's only going to be used by C++ client code.
 What I am looking for,
 however, is 'minimum' use of STL to avoid problems with various
 'differently' conforming compilers. Even here, as written, my
 'desired'
 sample program effectively hides the use of STL, so it is largely
 usable
 as-is on the smaller configurations. So, no boost, no stlsoft. Not
 for such
 a small thing..
Can't respond to this, until I see the code. Walter wrote a very small impl in D, which was great as far as it went, but it didn't go further than the parsing into fields and records. That's fine, if that's all that's wanted, but it's not a fully representative comparison. (FYI: May's instalment of "Positive Integration" http://www.cuj.com/documents/s=9784/cuj0505wilson/, discusses this very subject, and shows how the 100% D version is slightly slower. I expect the same from a pure C++ version, although I wouldn't bet the house on it. Hmmm, maybe I'll try it with string_view, that might be as fast.)
 Even then, aggressively using STL for every situation still eludes
 me. Hats
 off to guys like you who can understand the complex templates and
 'meta'
 programming. Just keep on explaining and we will (hopefully) pick
 it up.
The only reason I write about it is because I find it confusing as well. :-)
 3. Other design choices:
 This task of picking up records can be done easily (if the setup
 is right)
 using lex/yacc, boost spirit and any other dozens of similar
 parsing
 mechanisms, but all are overkills for separating 'name: value'.
 This looks
 like a simple C thing. What's the big deal about it?
There is no big deal. It's just a simple little library, with mappings to many languages. It's useful, small, portable. Just badly documented. (Or maybe 'was', as I'm hoping the 1.3.2 release answers a lot of your concerns. Please let me know if/where it doesn't.) FYI: I read about the Record-JAR in Raymond's "The Art Of UNIX Programming" - a book I'd recommend to *everyone*. It is one of many formats he discusses, each of which has its own virtues and niches. I've found Open-RJ ideal for the configuration files of various programs where they need more than a few command-line args, and where XML would be overkill.
 Yes, this action needs
 to be center-stage. The table - record comments, count of records,
 selectively ignoring spaces are all peripheral. The present
 implementation
 needs to segregate these in obvious ways.

 Fields are smallest operable entities, each record has multiple
 fields
 (whether 2 records have same named fields is a design decision,
 OpenRj is
 attractive because it does not force us to), many records
 constitute a table
 (same size=rectangular table. Otherwise 'round'??), many tables
 make a
 database. A real database is a much bigger beast. This is a table
 handler,
 and it is useful as one. Pretend it to be anything else and it
 gets
 ridiculed. Anything slightly bigger and programmers would use
 Sqlite, MySql
 or other 'in-memory' databases capable of understanding SQL. Too
 much prior
 art there to ignore.
Well, I think anything more complex and one would use XML, but then I see it as a configuration format, rather than a database format. (I guess using the term Database was somewhat ill-chosen, then <g>)
 One class or two derived from a base? That's your choice. The
 possibility of
 testing using in-memory strings and then switching over to files
 is very
 real. Users want minimum change then. That's why the suggestion
 about a
 single class.
Because they inherit, there is no confusion/complexity here. The only difference is the constructors for the derived (file and memory) classes. I think it's very simple, orthogonal, discoverable.
 And that is where writing a real application before the
 library comes into the picture. So, please don't say
 'vestigial/unfinished'
 !! Please start with the app, first.
Point taken.
 Also, I am talking about the use of 'foreach' in the example code.
 The
 library does not use it. This is a perfect way to illustrate a
 technique, in
 this case, the emphasis would be on the library classes 'capable'
 of being
 traversed in this way. In my illustrative design, the same ones
 may be
 traversed in the 'usual' begin-end way!! I needed your opinion on
 this as a
 researcher of iterations over containers. Are you aware of an
 implementation
 of 'foreach' for c++? I would find it hard to believe that what I
 have been
 using for quite some time (even before I started using STL) has
 not been in
 circulation...
Maybe I'll plug in "Ranges" into the Open-RJ/C++ and /STL mappings. A 1.4 feature, perhaps ...
 Already, we have discussed too much regarding this ;-) Only
 excusable, if we
 consider the principles in general, not for this project.
Sure
 The only reason I have still not posted any code is to make sure
 that this
 is read! I know I would rush to the code first and ignore
 everything ;-)
It is read. Now post! :-)
May 26 2005
parent reply "Walter" <newshound digitalmars.com> writes:
"Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
news:d74nle$2j8j$1 digitaldaemon.com...
 I have taken Walter's advice - instead of posting files here, I have
posted
 an article on CodeProject.
 "Implementing 'foreach' for c++ as a Design Pattern"
 http://www.codeproject.com/

 Have attached the alternate OpenRj implementation as the 'sample project'.
 It has been tested (obviously) on DMC, as well as on VC6 & gcc under
linux.
 - Rajiv
The link is to the front page, which is awfully busy. Can we please have a link to the sub-page with the article? <g>
May 26 2005
parent "Rajiv Bhagwat" <dataflow vsnl.com> writes:
The new articles are placed in 'unedited user contributions'. They are moved
later to appropriate sections later. Thats why I did not give the complete
link. Pls look under 'C++ / MFC'.

-Rajiv


"Walter" <newshound digitalmars.com> wrote in message
news:d7570j$3085$2 digitaldaemon.com...
 "Rajiv Bhagwat" <dataflow vsnl.com> wrote in message
 news:d74nle$2j8j$1 digitaldaemon.com...
 I have taken Walter's advice - instead of posting files here, I have
posted
 an article on CodeProject.
 "Implementing 'foreach' for c++ as a Design Pattern"
 http://www.codeproject.com/

 Have attached the alternate OpenRj implementation as the 'sample
project'.
 It has been tested (obviously) on DMC, as well as on VC6 & gcc under
linux.
 - Rajiv
The link is to the front page, which is awfully busy. Can we please have a link to the sub-page with the article? <g>
May 26 2005
prev sibling parent "Walter" <newshound digitalmars.com> writes:
"Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message
news:d73k78$dkh$1 digitaldaemon.com...
 Walter wrote a very small impl in D, which was great as far as it
 went, but it didn't go further than the parsing into fields and
 records.
Here it is, for comparison purposes: ------------------------------------------ // openrj.d // placed into Public Domain module std.openrj; import std.string; alias char[][] [char[]] [] openrj_t; class OpenrjException : Exception { uint linnum; this(uint linnum, char[] msg) { this.linnum = linnum; super(std.string.format("OpenrjException line %s: %s", linnum, msg)); } } openrj_t parse(char[] db) { openrj_t rj; char[][] lines; char[][] [char[]] record; lines = std.string.splitlines(db); for (uint linnum = 0; linnum < lines.length; linnum++) { char[] line = lines[linnum]; // Splice lines ending with backslash while (line.length && line[length - 1] == '\\') { if (++linnum == lines.length) throw new OpenrjException(linnum, "no line after \\ line"); line = line[0 .. length - 1] ~ lines[linnum]; } if (line[0 .. 2] == "%%") { // Comment lines separate records if (record) rj ~= record; record = null; line = null; continue; } int colon = std.string.find(line, ':'); if (colon == -1) throw new OpenrjException(linnum, "'key : value' expected"); char[] key = std.string.strip(line[0 .. colon]); char[] value = std.string.strip(line[colon + 1 .. length]); char[][] fields = record[key]; fields ~= value; record[key] = fields; } if (record) rj ~= record; return rj; } -------------------------------------------------------------------- And here's a simple driver for it: -------------------------------------------------------------------- import std.stdio; import std.file; import std.openrj; int main() { char[] db = cast(char[])std.file.read("test.rj"); openrj_t rj = std.openrj.parse(db); foreach (char[][] [char[]] record; rj) { foreach (char[] key, char[][] fields; record) { writefln(key, ":"); foreach (char[] field; fields) { writefln("\t", field); } } writefln("---------------------"); } return 0; } ----------------------------------------------------
May 26 2005