cpp, meta, C++


#undef   BB

#undef   BBStr

#undef   bb

#undef   bbStr

#define BB

#define BBStr( x,y,z )  ;

#define bb

#define bbStr( x,y,z )  ;

#ifndef procNestOn

#undef   LB_

#undef   LE_

#undef   LE_ret

#undef      ret

#undef      ret_

#undef   __

#undef   ___

#define LB_( x )   

    {

    #define LE_        

    }

#define ret_   return ;

#define LE_ret( x )   return( x );   

#define ret( x )   return( x );

#define __

#define ___

#endif

/* Module      ut/str_set                         rbuffer.ic

   *****************************************************************************

   Authors     GRT                                                 ALL

*/

#include for_spu.h

#define L_stopage  120000

#define max_Relation    8

struct  match_rec


{ match_rec :: match_rec(); char * str ; // key - not unique char * str2 ; // value int L /* .len */ ; // actual length of str match_rec * next ; // int w1 ; // application semantics void * w2 ; // application semantics char wc ; // application semantics char co[4] ; // application semantics int see ; // for str_set :: rm_see() int x ; // no semantics int x1 ; // no semantics int x2 ; // no semantics int x3 ; // no semantics void * to ; // void * sp1 ; // void * sp2 ; // void * sp3 ; // void * sp4 ; // };

struct  store


{ store :: store(); char sto[ L_stopage + 2 ] ; // store * pre ; // previous page };

struct  arrow


{ arrow :: arrow(); match_rec * to ; // arrow * next ; // }; #define L_res 2000

struct  rsh_set


{ rsh_set :: rsh_set(); match_rec * res[ L_res ] ; // int e ; // int a_trans ; // non-direct arrows };

C++ . ALL . top . meta    

class str_set


: public EStandardServices /* _____________________________________________________________________________ R e u s e . f o r . ALL for storing a set of strings (a set not too large). _ You may also store a n y sequence of bytes (for this to do you will have to use the 'ascii. ... ' notation mapping any byte sequence to a NULL-terminated string, see exe 'ersetze' for help on this notation). _____________________________________________________________________________ */ { public: store * sto ; match_rec * nextstr ; match_rec * strings[ 256 ] ; // match_rec * strings[ 888 ] ; match_rec ** elem ; // element int card ; // cardinality of the str_set int card_largest ; // int maxlen ; // max strlen + 1 int updates ; // max strlen + 1 int errors ; // number of appErr calls int L_pre ; // strlen( pre ) char * pre ; // common prefix char * ste ; // storage + L_storage char * sta ; // free storage position str_set( char * pre ) { init( pre ); } str_set( ) { init( "" ); } void sort() { sort(1); } protected: private: str_set * ich ; str_set * aset ; void ** cksto ; // for newSto(), checkSto() // exported methods: public: void str_set :: init // ----------------------------------------------------------------------------- ( char * prefix ) ; public: void str_set :: forgetALL( // ----------------------------------------------------------------------------- ) ; public: ~str_set // ----------------------------------------------------------------------------- ( ) ; public: void * str_set :: newSto /* ----------------------------------------------------------------------------- Diese Methode gestattet, das str_set als lokalen Heap zu nutzen - mit dem Vorteil, darauf allokierten Speicher nicht mehr einzeln freigeben zu mssen. Mittels checkSto() kann man untersuchen, ob der lokale Heap noch intakt ist. Der Aufrufer sagt: allocate L bytes, their scope will be the scope of 'this Die Funktion garantiert: fErr || ok ----------------------------------------------------------------------------- */ ( int L // allocate L bytes ) ; public: void str_set :: checkSto( /* ----------------------------------------------------------------------------- check all storage allocated so far on the local heap ----------------------------------------------------------------------------- */ ) ; public: match_rec * str_set :: to_char /* ----------------------------------------------------------------------------- return address of first rec X satisfying X.str[0] == c ----------------------------------------------------------------------------- */ ( char c ) ; public: void str_set :: trace // ----------------------------------------------------------------------------- ( char * name , FILE * f // soll geschrieben werden nach ) ; public: char * str_set :: take /* ----------------------------------------------------------------------------- clone string str, return pointer to clone ----------------------------------------------------------------------------- */ ( char * str ) ; public: char * str_set :: alloc /* ----------------------------------------------------------------------------- allocate storage of length L ----------------------------------------------------------------------------- */ ( int L , char * str ) ; public: int str_set :: st_clone /* ----------------------------------------------------------------------------- clone string str, return its length ----------------------------------------------------------------------------- */ ( char * & dest , char * str ) ; public: int str_set :: st_clone /* ----------------------------------------------------------------------------- clone prefix( str, L ) as if it were a string, return corrected L ----------------------------------------------------------------------------- */ ( char * & dest , char * str , int L ) ; public: void str_set :: msHtm_escape ( uchar u // ----------------------------------------------------------------------------- ) ; public: match_rec * str_set :: ins_pc /* ----------------------------------------------------------------------------- insert a padded clone of a string representing an int ----------------------------------------------------------------------------- */ ( char * & c , char * k // pointer to key representation ) ; public: match_rec * str_set :: get_pc /* ----------------------------------------------------------------------------- return int value of a padded clone representing an int ----------------------------------------------------------------------------- */ ( char * & c , char * k // pointer to key representation, char * mess // 0, or "e..." (= fErr), or "a..." (= appErr) ) ; public: match_rec * str_set :: to_first ( /* ----------------------------------------------------------------------------- Let nextstr point to the first element of the set ----------------------------------------------------------------------------- */ ) ; public: match_rec * str_set :: to_next ( /* ----------------------------------------------------------------------------- Let nextstr point to the next element of the set ----------------------------------------------------------------------------- */ ) ; public: uint str_set :: rm_see /* ----------------------------------------------------------------------------- forget all elements x with s1 <= x.see <= s2 return number of elements forgotten ----------------------------------------------------------------------------- */ ( int s1 , int s2 , BOOL trace ) ; public: void str_set :: check ( // ----------------------------------------------------------------------------- ) ; public: match_rec * str_set :: insert ( char * str // ----------------------------------------------------------------------------- ) ; public: match_rec * str_set :: insert // ----------------------------------------------------------------------------- ( char * str , char * str2 ) ; public: match_rec * str_set :: insert // ----------------------------------------------------------------------------- ( char * str , void * data , int of_len ) ; public: match_rec * str_set :: ensure( char * str /* ----------------------------------------------------------------------------- Der Aufrufer sagt: Wenn ( str ) noch nicht im str_set, dann schreib' es rein als Paar ( str, "" ). Die Funktion garantiert: fErr || ok ----------------------------------------------------------------------------- */ ) ; public: match_rec * str_set :: ensure /* ----------------------------------------------------------------------------- Der Aufrufer sagt: Wenn das Paar ( str, str2 ) noch nicht im str_set, dann schreib' es rein. Ist von str2 schon ein Clone vorhanden, so verwende den - es zeigen dann die Pointer str2 mehrerer Paare auf denselben Speicher. Die Funktion garantiert: fErr || ok ----------------------------------------------------------------------------- */ ( char * str , char * str2 ) ; public: BOOL str_set :: forget ( char * str1 /* ----------------------------------------------------------------------------- post condition: String 'str' is not element of 'strings' return 'str was in set' ----------------------------------------------------------------------------- */ ) ; public: match_rec * str_set :: element /* ----------------------------------------------------------------------------- return 0 if string 'str' not in the set ----------------------------------------------------------------------------- */ ( char * str ) ; public: BOOL str_set :: rm ( char * str /* ----------------------------------------------------------------------------- return 1 if found and deleted return 0 if not found ----------------------------------------------------------------------------- */ ) ; public: match_rec * str_set :: match /* ----------------------------------------------------------------------------- return 0 if no match found else return pointer to f i r s t match ----------------------------------------------------------------------------- */ ( char * such , int prefix // e.g. strlen( such ) ) ; public: void str_set :: rsh /* ----------------------------------------------------------------------------- insert relationship ----------------------------------------------------------------------------- */ ( match_rec * f , int r // use relation, match_rec * s // to ) ; public: void str_set :: rsh /* ----------------------------------------------------------------------------- insert relationship ----------------------------------------------------------------------------- */ ( match_rec * f , int r // use relation, char * s // to ) ; public: void str_set :: rsh /* ----------------------------------------------------------------------------- insert relationship ----------------------------------------------------------------------------- */ ( char * f , int r // use relation, char * s // to ) ; public: void str_set :: rsh /* ----------------------------------------------------------------------------- insert relationship ----------------------------------------------------------------------------- */ ( char * f , int r // use relation, match_rec * s // to son ) ; public: void str_set :: closure /* ----------------------------------------------------------------------------- Der Aufrufer sagt: Mache Relation 'r transitiv abgeschlossen. Die Funktion garantiert: fErr || ok ----------------------------------------------------------------------------- */ ( int r ) ; public: void str_set :: rsh_at /* ----------------------------------------------------------------------------- Der Aufrufer sagt: Make 'Res the set of arrows ( 'mr, 'relation, * ) Die Funktion garantiert: fErr || ok ----------------------------------------------------------------------------- */ ( rsh_set & Res , match_rec * mr , int relation ) ; public: int str_set :: cardinality( /* ----------------------------------------------------------------------------- Return cardinality of this str_set ----------------------------------------------------------------------------- */ ) ; public: void str_set :: sort /* ----------------------------------------------------------------------------- Make elem[ 0 .. card [ the ascendingly sorted str_set. Note: sort( 0 ) defines card and elem[], but does not sort. ----------------------------------------------------------------------------- */ ( int a_compare_method ) ; #include str_set.h3 : cpp } ; #endif
top . is_inc_for . C++
Include-structure of
todir / str_set.h

.   for_spu.h
.   .   for_all.h
.   .   .   exec_ut.h
.   .   .   .   exec_ut.h3
.   .   .   .   macros_1.h
.   .   .   .   traceco.h
.   .   .   precomp.h
.   .   .   .   basis.h
.   .   .   .   .   compiler.h
.   .   .   .   .   dmlerr.h
.   .   .   .   en.h
.   .   .   .   .   en_lec.h
.   .   .   .   limits.h
.   .   .   .   mt.h
.   .   .   .   obsolete.h
.   .   .   .   ot.h
.   .   .   .   st.h
.   .   .   .   trace.h
.   .   .   standard.h
.   .   .   toscreen.h
.   .   spu.h
.   .   .   help_gen.h
.   .   .   .   help_gen.h3
.   .   .   rbuffer.h
.   .   .   .   rbuffer.h3
.   .   .   .   str_set.h
.   .   .   .   .   str_set.h3
.   .   .   safe_uts.h
.   .   .   .   safe_uts.h3
.   .   .   ut_repl.h

30 include files
top . is_inc_for . C++