/* Module ut/safe_uts safe_uts.ic
*****************************************************************************
Authors GRT
# define exit safe_ut.ok_EXIT
itoa not provided by GNU - better use sprintf
arrays arr = new char[ 201 ] + 10 ; --> arr[ -10 .. 190 ]
toupper are Macros - they have s i d e e f f e c t s on their
tolower arguments ( so never say e.g. toupper( *c++ ) )
Beachte: Es ist ( space( 0 ) == false ) !!
_____________________________________________________________________________
*/
#define __SPU__
#define _Do ); system( exut.ccc );
//
#define fErrStr( x,z )
{
showStr( "STR", x, z ); fErr
}
#ifdef GNU
#define find_1st( x ) ffblk gef ; \
BOOL done = findfirst( x, &gef, 0 | FA_DIREC )
#define name ff_name
#define attribute ff_attrib
#define _O_BINARY O_BINARY
#else
#define find_1st( x ) FIND * gefunden = findfirst( x, 0 | FA_DIREC )
#define find_next
{
*gefunden = gef ; gefunden = findnext();
}
#endif
#define flush2
{
fflush( stdout ); fflush( stderr );
}
#undef find_next
#define find_first( wc ) _finddata_t dta ; dos_me( wc ); int h = \
_findfirst( wc, &dta );
#define find_next _findnext( h, &dta );
#define find_close errno = 0 ; _findclose( h );
#define Arial_1 "<font face=\"Verdena,Arial\" size=1>"
#define Arial_2 "<font face=\"Verdena,Arial\" size=2>"
#define Arial_3 "<font face=\"Verdena,Arial\" size=3>"
#define Arial_4 "<font face=\"Verdena,Arial\" size=4>"
#define Blu_ "<font color=#3300FF>"
#define Rot_ "<font color=#FF3333>"
// # define isA_ public virtual
// # define p1_ public virtual
// # define p2_ protected virtual
// # define p3_ private virtual
#define cWD
{
char800 cwd ; getcwd( cwd, 800 ); _1( cwd )
}
// # define this_exe argv[ 0 ]
#define O_READ O_RDONLY
#define GAZError "c:/error.GAZ"
#define sysRes safe_ut.ok_sysRes
#define LOOP( a,a1 ) a = a1 ; while ( a )
#define Loop for(;;)
#define eoName( c,s ) safe_ut.ok_eoName( c,s )
#define _to( c,c1 ) while ( *c != c1 ) c-- ;
#define to_( c,c1 ) while ( *c != c1 ) c++ ;
#define str_( c,c1 )
{
while ( *c != c1 ) c++ ; *c++ = 0 ;
}
#define eow( c,c1 )
{
while ( *c != c1 ) c++ ; *c = 0 ;
}
#define skip_to( c,c1 ) while ( *c != c1 ) c++ ;
#define skip_at( c,c1 ) while ( *c == c1 ) c++ ;
#define skip_name( c ) while in_name( *c ) c++ ;
#define skip_space( c ) while space( *c ) c++ ;
#define to_space( c ) while not_space( *c ) c++ ;
#define noErr( c,s,L ) if not_is( c,s,L )\
{
\
showStr( "EEE", c, max( 20, L ) ); fErr\
}
#define tmp_DRIVE tmp_DR
#define SyntaxCheck( c,e ) safe_ut.Syntax( __LINE__,__FILE__, c,e )
#define eos( s ) s + strlen( s )
#define spaceTo( c,s )
{
skip_space( c ); SyntaxCheck( c,s );
}
#define tausche( t,a,b )
{
t x = a ; a = b ; b = x ;
}
#define add_as_head( a,h )
{
a -> next = h ; h = a ;
}
#define posBehind( e,c )
{
while ( *e != c ) e++ ; e++ ;
}
#ifdef __DATA_TRACE
#define SS_
{
sprintf( exut.ccc,
#else
#define SS_ S_
#define SSS /
#endif
#include <io.h>
#include for_spu.h
// #undef find_next
#undef Unlink
#undef tmpName
#undef not_digit
#undef max
#undef min
// typedef char char_subset[ 256 ] ;
// typedef uint4 Surr ;
#define max_unsigned -1
#ifdef __WINDOWS__
#define P_ fprintf( stout,
#else
#define P_ printf(
#endif
#define _1m
{
_ safe_ut.ok_1m();
}
#define _E( x ) ); exit( x );
#define SCTr if ( safe_ut.ok_showComm() )
#define show_LB safe_ut.ok_show_LB
#define Z1_( name, a1, n ) safe_ut.ok_show_str( name, a1, a1, n );
#define Z2_( name, a1, a2, n ) safe_ut.ok_show_str( name, a1, a2, n );
#define uint32 unsigned long
#define printable( c ) ( isprint( c ) )
#define is_upper( c ) ( 'A' <= c && c <= 'Z' )
#define is_lower( c ) ( 'a' <= c && c <= 'z' )
// #define showStr( x,y,z ) { safe_ut.ok_show_text( x,y,z ); getch(); }
#define showStr( x,y,z )
{
safe_ut.ok_show_text( x,y,z );
}
#define show_fErr( x,y,z )
{
safe_ut.ok_show_text( x,y,z ); fErr
}
#define strTrace safe_ut.ok_strTrace
#define traceStr( x,y,z )
{
int m = okAt ; okAt = -1 ; \
showStr( x,y,z ); okAt = m ;
}
#ifdef __OPTIMIZED__
#define show_str( x,y,z )
{
exut.show_text( x,y,z ); getch();
}
#define check_str( m,M,s ) if ( !s ) fErr
#else
#define show_str( x,y,z ) exut.show_text( x,y,z );
#define check_str( m,M,s ) \
if ( safe_ut.ok_check_str( m,M,s ) ) fErr
#endif
#define Check_str( m,M,s ) if ( safe_ut.ok_check_str( m,M,s ) ) fErr
#define trace_ exut.trace
#define clone safe_ut.ok_clone
// # define put(x,y,z) { if ( z < 0 ) fErr ; safe_ut.ok_put(x,y,z); }
// # define re_derive( f, from ) ( time_of( f ) < time_of( from ) )
// # define o _ out
#define _FL_ __FILE__,__LINE__
#define back_to goto
#define es_ safe_ut.ok_es_
#define neuNr safe_ut.neuNrs
#define memstr safe_ut.ok_memstr
#define doAnderswo safe_ut.ok_doAnderswo
#define popup safe_ut.ok_popup
#define KILL safe_ut.ok_KILL
#define sleep Sleep
#define show_or_DEL safe_ut.ok_show_or_DEL
#define mae2win safe_ut.ok_mae2win
#define win2utf8 safe_ut.ok_win2utf8
#define utf2win safe_ut.ok_utf2win
#define strUm safe_ut.ok_strUm
#define eosAt safe_ut.ok_eosAt
#define norm_date safe_ut.ok_norm_date
#define normName safe_ut.ok_normName
#define namAnf safe_ut.ok_namAnf
#define backtoSucc safe_ut.ok_backtoSucc
#define backto safe_ut.ok_backto
#define Appwin_exists( x ) ( safe_ut.ok_Appwin_exists( x ) )
#define close_Appwins safe_ut.ok_close_Appwins
#define exe_exists( e ) ( safe_ut.ok_exePath( e,0,0 ) )
#define not_exe_exists( e ) ( ! safe_ut.ok_exePath( e,0,0 ) )
#define not_on_path( e ) ( ! safe_ut.ok_exePath( e,0,0 ) )
#define not( e ) ( ! ( e ) )
#define ro_currDir (( char * ) getcwd( 0, 400 ))
#define CWD (( char * ) getcwd( 0, 400 ))
#define is_tabulator( c ) ( ( uchar )c == ( uchar )160 )
#define createdAt( x )
{
x -> Line = __LINE__ ;
}
#define showProgress
{
if ( ++safe_ut.xxAnz % 10 == 0 ) printf( "." );
}
#define Unlink( x )
{
unlink( x ); ok
}
#define not_asChar( c ) ( ! safe_ut.ok_asChar( c ) )
#define asChar( c ) ( safe_ut.ok_asChar( c ) )
#define ourHome safe_ut.ok_ourHome( par0 )
#define no_xNUL safe_ut.ok_no_xNUL
#define Absfp safe_ut.ok_Absfp
#define MaxAbsfp safe_ut.ok_MaxAbsfp
#define Maxfp safe_ut.ok_Maxfp
#define Max safe_ut.ok_Max
#define setMx safe_ut.ok_setMx
#define traceNr safe_ut.traceNr_
#define fazit_trace safe_ut.ok_fazit_trace
#define do_tree safe_ut.ok_do_tree
#define execAt safe_ut.ok_execAt
#define wfind safe_ut.ok_wfind
#define maexUmlaut( c ) in_str( ( uchar )c, safe_ut.maestro_Umlaute )
#define environment( v,n ) safe_ut.ok_environment( v,n )
#define needsOnPath( e,L ) safe_ut.ok_exePath( e,1,L )
#define flush( f ) if ( ! _commit( f ) ) fErr
#define notAllCapital( x ) safe_ut.ok_notAllCapital( x )
#define tmp_ safe_ut.ok_tmp_
#define toz safe_ut.ok_toz
#define trace_LB safe_ut.ok_trace_LB
#define rette_fs safe_ut.ok_rette_fs
#define DEL safe_ut.ok_DEL
#define es_ safe_ut.ok_es_
#define ABC safe_ut.ok_ABC
#define abc safe_ut.ok_abc
#define ABC_sec safe_ut.ok_ABC_sec
#define showfdescr safe_ut.showfdes
#define showfcreate safe_ut.showfcre
#define currentTime_en safe_ut.ok_currentTime_en
#define currentTime safe_ut.ok_currentTime
#define currentTimestamp safe_ut.ok_currentTimestamp
#define currentDate safe_ut.ok_currentDate
#define heute safe_ut.ok_heute
#define execute safe_ut.ok_execute
#define extract_sections safe_ut.ok_extract_sections
#define shrink safe_ut.ok_shrink
#define put safe_ut.ok_put
#define close_windows safe_ut.ok_close_windows
#define select_this( x,z ) ( safe_ut.ok_select_this( x,z ) )
#define tmpName safe_ut.ok_tmpName
#define get_more safe_ut.ok_get_more
#define get safe_ut.ok_get
#define putfw safe_ut.ok_putfw
#define getfw safe_ut.ok_getfw
#define xfopen safe_ut.ok_fopen
#define off( x,z )
{
close( x ); Unlink( z );
}
#define close( x )
{
safe_ut.ok_close(x, _FL_ );
}
#define nextf safe_ut.ok_nextf
#define system_do safe_ut.ok_system_do
#define do_ safe_ut.ok_system_do
#define system safe_ut.ok_system
#define cutstr safe_ut.ok_cutstr
#define isubstr( x,z ) ( safe_ut.ok_subSTR( x,z ) )
#define substr( x,z ) ( safe_ut.ok_substr( x,z ) )
#define subSTR( x,z ) ( safe_ut.ok_subSTR( x,z ) )
#define not_subSTR( x,z ) ( ! safe_ut.ok_subSTR( x,z ) )
#define not_substr( x,z ) ( ! safe_ut.ok_substr( x,z ) )
#define Identifier( z ) ( safe_ut.ok_Identifier( z ) )
#define not_Identifier( z ) ( ! safe_ut.ok_Identifier( z ) )
#define quote( c ) ( safe_ut.ok_quote( c ) )
#define not_quote( c ) ( ! safe_ut.ok_quote( c ) )
#define names( z ) ( safe_ut.ok_names( z ) )
#define not_names( z ) ( ! safe_ut.ok_names( z ) )
#define subStr( x,z,e ) ( safe_ut.ok_subStr( x,z,e ) )
#define not_subStr( x,z,e ) ( ! safe_ut.ok_subStr( x,z,e ) )
#define strCode safe_ut.ok_strCode
#define strNorm safe_ut.ok_strNorm
// # define show_str exut.show_text
#define corrStr safe_ut.ok_corrStr
#define show_pos( z,f ) safe_ut.ok_show_pos( z,f )
#define ersChar safe_ut.ok_ersChar
#define teile safe_ut.ok_teile
#define MMDD safe_ut.ok_MMDD
#define seek safe_ut.ok_seek
#define prefix_match safe_ut.ok_prefix_match
#define substr_match safe_ut.ok_substr_match
#define word_match safe_ut.ok_word_match
#define str_match safe_ut.ok_str_match
#define skip_phpstr safe_ut.ok_skip_phpstr
#define skip_str safe_ut.ok_skip_str
#define skip_str1 safe_ut.ok_skip_str1
#define skip_nest safe_ut.ok_skip_nest
#define skip_nest_o_str safe_ut.ok_skip_nest_o_str
#define skip_Br safe_ut.ok_skip_Br
#define skip_comment safe_ut.ok_skip_comment
#define skip_cout_cerr safe_ut.ok_skip_cout_cerr
#define skip_space_and_comment safe_ut.ok_skip_space_and_comment
#define to_o_str safe_ut.ok_to_o_str
#define file_len safe_ut.ok_file_len
#define file_pos safe_ut.ok_file_pos
#define setenv safe_ut.ok_setenv
#define retVar safe_ut.ok_retVar
#define getenv_ safe_ut.ok_getenv
#define path_exists( x ) ( safe_ut.ok_path_exists( x ) )
#define not_path_exists( x ) ( ! safe_ut.ok_path_exists( x ) )
#define exit_if_no( s,f,e ) safe_ut.ok_exit_if_no( s,f,e )
#define path_stat safe_ut.ok_path_stat
#define file_Date safe_ut.ok_file_Date
#define file_Time safe_ut.ok_file_Time
#define umf_ safe_ut.ok_size_Surr
#define size_Surr safe_ut.ok_size_Surr
#define file_Surr safe_ut.ok_file_Surr
#define time_of safe_ut.ok_time_of
#define expansion safe_ut.ok_expansion
#define add_to_path safe_ut.ok_add_to_path
#define max_me safe_ut.ok_max_me
#define min_me safe_ut.ok_min_me
#define def_subset safe_ut.ok_def_subset
#define dir_at safe_ut.ok_dir_at
#define file_exist_dir_fn safe_ut.ok_file_exist_dir_fn
#define dir_exist safe_ut.ok_dir_exist
#define dir_exist_empty safe_ut.ok_dir_exist_empty
#define create_ safe_ut.ok_create_
#define create safe_ut.ok_create
#define crAppend safe_ut.ok_crAppend
#define copy safe_ut.ok_copy
#define move safe_ut.ok_move
#define append safe_ut.ok_append
#define goto_char( c,x )
{
while ( *c != x ) c++ ;
}
#define goto_chars safe_ut.ok_goto_chars
#define goto_word safe_ut.ok_goto_word
#define goto_str safe_ut.ok_goto_str
#define temp_file safe_ut.ok_temp_file
#define norm_( s,fc,tc ) safe_ut.ok_norm( s,fc,tc )
#define reduce_current safe_ut.ok_reduce_current
#define subdir safe_ut.ok_subdir
#define upper safe_ut.to_upper
#define upperName safe_ut.ok_upperName
#define lower safe_ut.to_lower
#define zufkBuchst safe_ut.ok_zufchar( 'a', 'z' )
#define zufZiffer safe_ut.ok_zufchar( '0', '9' )
#define zufchar safe_ut.ok_zufchar
#define get_word safe_ut.ok_get_word
#define Do safe_ut.ok_Do
#define thisDir safe_ut.ok_thisDir
#define rm_tree safe_ut.ok_rm_tree
#define cp_tree safe_ut.ok_cp_tree
#define cp_file( N,V )
{
__ safe_ut.ok_cp_file( N,V );
}
#define cp_file_( N,V ) safe_ut.ok_cp_file( N, V, 1 )
#define get_header_files safe_ut.ok_get_header_files
#define f_to_dir safe_ut.ok_f_to_dir
#define endword safe_ut.ok_endword
#define checkstr safe_ut.ok_checkstr
#define Sprintf safe_ut.ok_sprintf
#define xemcmp safe_ut.ok_memcmp
#define not_text( s ) ( safe_ut.ok_not_text( s ) )
#define see_str safe_ut.ok_see_str
#define see_tree safe_ut.ok_see_tree
#define ShowTreeView safe_ut.ok_ShowTreeView
#define assert_in_str safe_ut.ok_assert_in_str
#define assert_at safe_ut.ok_assert_at
#define open safe_ut.ok_open
#define eoStr safe_ut.ok_eoStr
#define fsubstr safe_ut.ok_str_in_file
#define toEndOfStr safe_ut.ok_toEndOfStr
#define charOf safe_ut.ok_charOf
#define resInto safe_ut.ok_resInto
#define same_( s1,s2 ) safe_ut.ok_common( s1, s2 )
#define trimm( s,c ) safe_ut.ok_trimm( s,c )
#define Value( s ) safe_ut.ok_Value( s )
#define replace( f,s1,s2 ) safe_ut.ok_replace( f, s1, s2 )
#define A_ safe_ut.ok_askChar();
#define in_Str( s,c,e ) ( safe_ut.ok_anz( s, c, e ) )
#define atComm( x ) safe_ut.ok_atComm( x )
#define DECNr( x,k ) safe_ut.ok_DECNr( x, k, __FL__ )
#define decNr( x ) safe_ut.ok_decNr( x, __FL__ )
#define decdecNr( x ) safe_ut.ok_decdecNr( x )
#define trace_strIn( a,b,m,n ) safe_ut.ok_trace_strIn( a,b,m,n, __FL__ )
#define checker( n,f )
{
__ safe_ut.ok_checker( n,f );
}
// # define checker( n,f ) __
#define not_alpha( c ) ( ! safe_ut.ok_alpha ( c ) )
#define not_digit( c ) ( ! isdigit ( c ) )
#define alpha( c ) ( safe_ut.ok_alpha ( c ) )
#define not_alphanum( c ) ( ! safe_ut.ok_alphanum( c ) )
#define alphanum( c ) ( safe_ut.ok_alphanum( c ) )
#define not_in_name( c ) ( ! safe_ut.ok_in_name ( c ) )
#define XMLName( c ) ( safe_ut.ok_XMLName ( c ) )
#define not_XMLName( c ) ( ! safe_ut.ok_XMLName ( c ) )
#define in_name( c ) ( safe_ut.ok_in_name ( c ) )
#define umlaut( c ) ( safe_ut.ok_umlaut ( c ) )
#define in_Range( c,a,e ) ( safe_ut.ok_in_Range( c,a,e ) )
#define out_of_Range( c,a,e ) ( ! safe_ut.ok_in_Range( c,a,e ) )
// # define not_escaped( c ) ( safe_ut.ok_not_escaped( c ) )
// # define escaped( c ) ( ! safe_ut.ok_not_escaped( c ) )
#define escaped( c ) ( safe_ut.ok_escaped( c ) )
#define not_escaped( c ) ( ! safe_ut.ok_escaped( c ) )
#define in_nameStr( c,s ) ( safe_ut.ok_in_nameStr( c,s ) )
#define not_in_nameStr( c,s ) ( ! safe_ut.ok_in_nameStr( c,s ) )
#define in_str( c,s ) ( safe_ut.ok_in_str( c,s ) )
#define not_in_str( c,s ) ( ! safe_ut.ok_in_str( c,s ) )
#define is_ext( f,e ) ( safe_ut.ok_is_ext( f,e ) )
#define not_is_ext( f,e ) ( ! safe_ut.ok_is_ext( f,e ) )
#define not_is_dir( x ) ( safe_ut.ok_is_a( x ) != 'd' )
#define is_dir( x ) ( safe_ut.ok_is_a( x ) == 'd' )
#define is_file( x ) ( safe_ut.ok_is_a( x ) == 'f' )
#define no_file( x ) ( safe_ut.ok_is_a( x ) != 'f' )
#define not_is_file( x ) ( safe_ut.ok_is_a( x ) != 'f' )
// # define is_prefix( x,z ) ( safe_ut.ok_is_prefix( x,z ) )
#define is_prefix( x,z ) ( At( z,x ) )
// # define not_prefix( x,z ) ( ! safe_ut.ok_is_prefix( x,z ) )
#define not_prefix( x,z ) ( ! At( z,x ) )
#define chain( x, c )
{
if ( c ) c -> next = x ; c = x ;
}
#define deleteChain( c,t ) while ( c )
{
t * c1 = c -> next ; \
delete( c ); c = c1 ;
}
#define ret_false return( 0 );
#define ret_true return( 1 );
#define loop( x ) while( x )
{
}
#define dos_expansion( to, from )
{
safe_ut.ok_expansion( to, from ); \
dos_me( to );
}
#define show_ascii( s1, s2, n ) safe_ut.ok_show_ascii( \
s1, #s1, s2, #s2, n )
#define new_dos_fn( x, e ) path x ; dos_expansion( x, e );
#define new_dos_fn_exists( x, e ) new_dos_fn(x,e) check_exists(x)
#define max( x,y ) (( x < y )? y : x )
#define min( x,y ) (( x < y )? x : y )
#define W( x,y ) ( 0 + ( x = y ) )
#define max_str( n, s ) safe_ut.ok_max_str( n, s, __FILE__, __LINE__ );
#define A( a ) (( char * )a )
#define tA( T, a, n ) ( ( T * )(( char * )a + n ) )
/*
For pointers T * a and integers n in C++
a + n means: a + n * sizeof( T ) = &( a[n] )
*/
#ifdef SYMANTEC
#define _write write
#define _read read
#endif
#ifdef GNU
#define _write write
#define _read read
#define memshift safe_ut.ok_memshift
#define memmove safe_ut.ok_memshift
#define movmem safe_ut.ok_memshift
#else
#define memshift memmove
#endif
#define continue_( x )
{
offset = x ; more_
}
#define continue__( x )
{
offs = x ; more_
}
#define more_
{
__ continue ;
}
#define check_exists( x ) if ( ! path_exists( x ) )
{
printf( \
"\nno such file: ( %s )\n\n", x ); errors++ ;
}
#define check_dir( x ) if not_is_dir( x )
{
printf( \
"\nno such folder: ( %s )\n\n", x ); errors++ ;
}
#define check_file( x ) if not_is_file( x )
{
printf( \
"\nno such file: ( %s )\n\n", x ); errors++ ;
}
#define close_to( f,n,x )
{
close( f ); cp_file( n,x ); Unlink( x );
}
#define not_htm( x ) ( safe_ut.ok_not_htm( x ) )
// #define not_htm( x ) ( 0 )
#define werde_fNam safe_ut.ok_werde_fNam
#define wait_for safe_ut.ok_wait_for
#define existiere_Leer safe_ut.ok_existiere_Leer
#define trace_utf safe_ut.ok_trace_utf
#define toUtf8 safe_ut.ok_toUtf8
#define ersUtf_HTM safe_ut.ok_ersUtf_HTM
#define schmutz safe_ut.ok_schmutz
#define XMLUmlaute safe_ut.ok_XMLUmlaute
#define fastAlphaNum( x ) ( safe_ut.ok_fastAlphaNum( x ) )
#define nester safe_ut.ok_nester
#define koSEL( x,s ) ( safe_ut.ok_koSEL( x,s ) )
#define file_substr( x,s ) ( safe_ut.ok_file_substr( x,s ) )
#define create_me safe_ut.ok_create_me
#define cp_prefix safe_ut.ok_cp_prefix
#define escto safe_ut.ok_escto
#define hoAus safe_ut.ok_hoAus
#define cutAt safe_ut.ok_cutAt
#define cp_section safe_ut.ok_cp_section
#define cp_ms_project safe_ut.ok_cp_ms_project
#define Atc( c,s ) ( safe_ut.ok_in_str( c,s ) )
#define not_file not_is_file
#define not_dir not_is_dir
#define tmA "tmp.A.tmp"
#define tmN "tmp.N.tmp"
// Wenn Methodenabdeckung sichtbar werden soll, sage im Hauptprogramm:
// #define doAtNester
#define strchecker( s ) ( safe_ut.ok_strchecker( s ) )
#define strchecker( s ) ( 0 )
#define ersUmlaute safe_ut.ok_ersUmlaute
#define not_isubstr( x,z ) ( ! safe_ut.ok_subSTR( x,z ) )
static char tmp_DR ;
static int x_step ;
static time_t x_start ;
char40 xx ;
class safe_uts
/* _____________________________________________________________________________ R e u s e . f o r . ALL to implement wrappers around C Standard Library functions (for robustness, for error handling, and to have an Interface to the C Standard Library that is polymorphic - an interface more like C++). The class is also implementing small utilities often needed - functions so often needed that defining a macro for code snippets around them is useful. Methods with a name ok_X, X any identifier, should never be called directly. Do only call it via the corresponding macro X defined above. _____________________________________________________________________________ */ { public:
struct  tmppath
{ tmppath :: tmppath(); char100 str ; } ;
struct  nestrec
{ nestrec :: nestrec(); char * p ; } ;
struct  nestArr
top . is_inc_for . C++
{ nestArr :: nestArr(); nestrec * a ; int e ; } ; char ** nest ; // siehe :: ok_create( x ) char * neuNam ; // siehe :: ok_create( x ) int neuNrMax ; // siehe :: constructor int neuNrs ; // siehe :: ok_create( x ) int xxAnz ; // counter for progress indication int checkerNr ; int processNr ; char * atProc ; BOOL showfdes ; BOOL showfcre ; BOOL showSysCalls ; char * maestro_Umlaute ; uint traceNr_ ; char * ok_sysRes ; protected: private: #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 #define mx_tmps 100 #define mx_nALen 20000 Btree * procALL ; nestArr nA ; BOOL AtNester ; BOOL deconstruct ; uint nameNr ; path ourhome ; path cwd ; path fschr ; FILE * fstop ; // siehe ok_close() FILE * merke1 ; // siehe ok_close() path merke1fAt ; // siehe ok_close() char * eM ; uint e_tmps ; char * tmps[ mx_tmps ] ; char1000 tmpsAt ; // exported methods: public: ~safe_uts( // ----------------------------------------------------------------------------- ) ; public: safe_uts :: safe_uts( // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_1m ( // ----------------------------------------------------------------------------- ) ; public: int safe_uts :: ok_showComm ( // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_nester /* ----------------------------------------------------------------------------- to trace method calls (is a basis for test coverage reporter) ----------------------------------------------------------------------------- */ ( BOOL rein , char * proc ) ; public: void safe_uts :: ok_show_LB /* ----------------------------------------------------------------------------- a trace function ----------------------------------------------------------------------------- */ ( char p , char * proc ) ; public: void safe_uts :: ok_teile /* ----------------------------------------------------------------------------- quot * n + rem = z ----------------------------------------------------------------------------- */ ( int z // calculate div_t = z/n, int n //, int & quot //, int & rem // ) ; public: void safe_uts :: ok_memshift /* ----------------------------------------------------------------------------- the same as memcpy (but now overlaps are allowed) ----------------------------------------------------------------------------- */ ( void * dest //, void * src //, size_t n // move n bytes from src to dest ) ; public: long safe_uts :: ok_seek // ----------------------------------------------------------------------------- ( int f , long offset , int from ) ; public: long safe_uts :: ok_seek // ----------------------------------------------------------------------------- ( FILE * f , long offset , int from ) ; public: FILE * safe_uts :: ok_fopen // ----------------------------------------------------------------------------- ( char * fn , char * mode // posit 0 : "r" read , "r+" read & write // , "w+" create or recreate // posit eof : "a" append , "a+" read & write ) ; public: long safe_uts :: ok_file_len /* ----------------------------------------------------------------------------- ret length of open file f ----------------------------------------------------------------------------- */ ( FILE * f ) ; public: long safe_uts :: ok_file_len /* ----------------------------------------------------------------------------- return length of file ----------------------------------------------------------------------------- */ ( char * fn ) ; public: long safe_uts :: ok_file_len ( int f /* ----------------------------------------------------------------------------- ret length of open file f ----------------------------------------------------------------------------- */ ) ; public: long safe_uts :: ok_file_pos /* ----------------------------------------------------------------------------- ret number of bytes in front of current position ----------------------------------------------------------------------------- */ ( int f ) ; public: long safe_uts :: ok_file_pos /* ----------------------------------------------------------------------------- ret number of bytes in front of current position ----------------------------------------------------------------------------- */ ( FILE * f ) ; public: char * safe_uts :: ok_getenv /* ----------------------------------------------------------------------------- a better getenv ----------------------------------------------------------------------------- */ ( char * name ) ; public: BOOL safe_uts :: ok_path_stat /* ----------------------------------------------------------------------------- check whether file (or directory) exists; if so, fill stat B ----------------------------------------------------------------------------- */ ( char * file , struct stat & B // file status structure ) ; public: BOOL safe_uts :: ok_path_exists /* ----------------------------------------------------------------------------- check whether file (or directory) exists ----------------------------------------------------------------------------- */ ( char * file ) ; public: void safe_uts :: ok_exit_if_no /* ----------------------------------------------------------------------------- check whether file (or directory) exists ----------------------------------------------------------------------------- */ ( BOOL stop , char * name // a path into the file system, char * ext // rest of path ) ; public: BOOL safe_uts :: ok_path_exists /* ----------------------------------------------------------------------------- fs //fs + ext ; return BOOL( fs + ext ) exists ) ----------------------------------------------------------------------------- */ ( char * fs , char * fs_e // the NULL position thereof, char * ext // 2nd part of path ) ; public: void safe_uts :: ok_expansion /* ----------------------------------------------------------------------------- replace substrings representing defined environment variables ----------------------------------------------------------------------------- */ ( char * two , char * one // the same path with substrings %xxx\ re- // placed by XXX if XXX was found to be // the value of environment variable xxx . ) ; public: void safe_uts :: ok_dir_exist_empty /* ----------------------------------------------------------------------------- guarantees existence of directory, backslashes in the path, and must n o t be the current directory ----------------------------------------------------------------------------- */ ( char * pf ) ; public: void safe_uts :: ok_dir_exist /* ----------------------------------------------------------------------------- guarantees existence of directory, backslashes in the path, and may be the current directory ----------------------------------------------------------------------------- */ ( char * pf ) ; public: void safe_uts :: ok_file_exist_dir_fn // ----------------------------------------------------------------------------- ( char * dir , char * fn ) ; public: FILE * safe_uts :: ok_create /* ----------------------------------------------------------------------------- create file 'dir/fn ----------------------------------------------------------------------------- */ ( char * x , char * plus // ) ; public: FILE * safe_uts :: ok_create /* ----------------------------------------------------------------------------- create file 'dir/nr.ext ----------------------------------------------------------------------------- */ ( int n // 0, 1, 2, ..., char * ext //, char * dir //, char * dir_e // ) ; public: FILE * safe_uts :: ok_create_me( char * x /* ----------------------------------------------------------------------------- create file x and also dir ----------------------------------------------------------------------------- */ ) ; public: FILE * safe_uts :: ok_create_( char * x /* ----------------------------------------------------------------------------- create file x and also dir ----------------------------------------------------------------------------- */ ) ; public: FILE * safe_uts :: ok_create /* ----------------------------------------------------------------------------- create file x ----------------------------------------------------------------------------- */ ( char * x ) ; public: void safe_uts :: ok_create /* ----------------------------------------------------------------------------- create file x ----------------------------------------------------------------------------- */ ( FILE * & fx , char * x // a path into the file system ) ; public: FILE * safe_uts :: ok_crAppend ( char * fAt /* ----------------------------------------------------------------------------- open or create file for appending data ----------------------------------------------------------------------------- */ ) ; public: void safe_uts :: ok_close_to // ----------------------------------------------------------------------------- ( FILE * & f , char * nch , char * tmp ) ; public: void safe_uts :: ok_close /* ----------------------------------------------------------------------------- close file ----------------------------------------------------------------------------- */ ( FILE * & f , char * File , int Line ) ; public: void safe_uts :: ok_close /* ----------------------------------------------------------------------------- close file ----------------------------------------------------------------------------- */ ( int & f , char * File , int Line ) ; public: void safe_uts :: ok_no_xNUL( /* ----------------------------------------------------------------------------- delete ./xNUL_* ----------------------------------------------------------------------------- */ ) ; public: void safe_uts :: ok_system_do( char * comm /* ----------------------------------------------------------------------------- execute a command as if on the command line Use system_do iff stdout of the command must not vanish in xNUL_* ----------------------------------------------------------------------------- */ ) ; public: void safe_uts :: ok_system( char * comm /* ----------------------------------------------------------------------------- execute a command as if on the command line Wichtig: 2>&1 muss stets ganz am Ende des Kommandos stehen (d.h. statt exe 2>&1 1>x muss exe > x 2&1 stehen) Postcondition: Hat comm die Form ?..., so wird danach sysRes auf eine Kopie des per 2>&1 nach stdout geschriebenen Outputs zeigen. ----------------------------------------------------------------------------- */ ) ; public: uchar safe_uts :: ok_umlaut ( uchar c // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_ersUmlaute ( char * str // ----------------------------------------------------------------------------- // ersetzt jeden Umlaut durch den entsprechenden einfachen Buchstaben // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_cutAt /* ----------------------------------------------------------------------------- return pointer to first substring of 'of' equal to 'part' ----------------------------------------------------------------------------- */ ( char * str , char * ustr ) ; public: char * safe_uts :: ok_subStr /* ----------------------------------------------------------------------------- return pointer to first substring of 'of' equal to 'part' starting before the first ee char ----------------------------------------------------------------------------- */ ( char * part , char * of // any string, char ee // any character ) ; public: char * safe_uts :: ok_substr /* ----------------------------------------------------------------------------- return pointer to first substring of 'of' equal to 'part' ----------------------------------------------------------------------------- */ ( char * part , char * of // any string ) ; public: char * safe_uts :: ok_subSTR /* ----------------------------------------------------------------------------- return pointer to first substring of 'of' equal to 'part' -- compare ignoring case -- ----------------------------------------------------------------------------- */ ( char * part , char * of // any string ) ; public: char * safe_uts :: ok_cutstr /* ----------------------------------------------------------------------------- cut away trailing characters 'tc' return pointer to end of string (at NULL) ----------------------------------------------------------------------------- */ ( char tc , char * str // any string ) ; public: void safe_uts :: ok_putfw /* ----------------------------------------------------------------------------- file // ( kopf + satz[] ), effect: file.satz[ n ] = from ----------------------------------------------------------------------------- */ ( int f // the open file, long kL // length of kopf, long n // nr of satz ( 0 <= n ), uint sL // length of satz, void * from // source ) ; public: void safe_uts :: ok_getfw /* ----------------------------------------------------------------------------- file // ( kopf + satz[] ), effect: to = file.satz[ n ] ----------------------------------------------------------------------------- */ ( int f // the open file, long kL // length of kopf, long n // nr of satz ( 0 <= n ), uint sL // length of satz, void * to // destination ) ; public: int safe_uts :: ok_get /* ----------------------------------------------------------------------------- read 'anz' Bytes from file 'f' ----------------------------------------------------------------------------- */ ( FILE * f , void * to , int anz ) ; public: void safe_uts :: ok_get /* ----------------------------------------------------------------------------- read exactly 'anz' Bytes from file 'f' ----------------------------------------------------------------------------- */ ( int f , void * to , int anz ) ; public: int safe_uts :: ok_get_more /* ----------------------------------------------------------------------------- read at most 'anz' Bytes from file 'f' ----------------------------------------------------------------------------- */ ( int f , void * to , int anz ) ; public: int safe_uts :: ok_get_more /* ----------------------------------------------------------------------------- read at most 'anz' Bytes from file 'f' ----------------------------------------------------------------------------- */ ( FILE * f , void * to , int anz ) ; public: void safe_uts :: ok_put /* ----------------------------------------------------------------------------- write 'anz' Bytes to file 'f' ----------------------------------------------------------------------------- */ ( FILE * f , void * from , int anz ) ; public: void safe_uts :: ok_put /* ----------------------------------------------------------------------------- write 'anz' Bytes to file 'f' ----------------------------------------------------------------------------- */ ( int f , void * from , int anz ) ; public: int safe_uts :: ok_clone /* ----------------------------------------------------------------------------- clone string 'str' to 'destin', return length of string ----------------------------------------------------------------------------- */ ( char * & dest , char * str ) ; public: void safe_uts :: ok_temp_file /* ----------------------------------------------------------------------------- Create and open a new temporary file %tmprestN, 1 <= N . ----------------------------------------------------------------------------- */ ( FILE * & opn_tf , path_ref tf // out, char * rest // in ) ; public: void safe_uts :: ok_show_str /* ----------------------------------------------------------------------------- output to stdout for debugging - use macros Z1_ Z2_ ----------------------------------------------------------------------------- */ ( char * name , char * a1 // any text, a1 <= a2, char * a2 //, int n // n <= 0 ) ; public: BOOL safe_uts :: ok_in_name ( uchar c // ----------------------------------------------------------------------------- ) ; public: BOOL safe_uts :: ok_in_nameStr // ----------------------------------------------------------------------------- ( uchar c , char * str ) ; public: BOOL safe_uts :: ok_alphanum // ----------------------------------------------------------------------------- ( uchar c ) ; public: BOOL safe_uts :: ok_alpha // ----------------------------------------------------------------------------- ( uchar c ) ; public: BOOL safe_uts :: ok_XMLName ( uchar c // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: to_upper /* ----------------------------------------------------------------------------- copy thereby transforming to upper ----------------------------------------------------------------------------- */ ( char * to , char * from ) ; public: char safe_uts :: to_upper /* ----------------------------------------------------------------------------- Damit man auch ... = toupper( *c++ ) sagen kann ----------------------------------------------------------------------------- */ ( char c ) ; public: char * safe_uts :: to_lower /* ----------------------------------------------------------------------------- copy thereby transforming to lower, return end of 'to' ----------------------------------------------------------------------------- */ ( char * to , char * from ) ; public: void safe_uts :: to_lower // ----------------------------------------------------------------------------- ( char * c , int n ) ; public: void safe_uts :: to_upper // ----------------------------------------------------------------------------- ( char * c , int n ) ; public: char safe_uts :: to_lower /* ----------------------------------------------------------------------------- Damit man auch ... = lower( *c++ ) sagen kann ----------------------------------------------------------------------------- */ ( char c ) ; public: char * safe_uts :: to_lower( char * str // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: to_upper( char * str // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_show_ascii // ----------------------------------------------------------------------------- ( char * str1 , char * str1n // name of str1, char * str2 , char * str2n // name of str2, int n ) ; public: BOOL safe_uts :: ok_reduce_current /* ----------------------------------------------------------------------------- if ( dir == current_dir ) strcpy( dir, "." ) ----------------------------------------------------------------------------- */ ( char * dir ) ; public: void safe_uts :: ok_subdir /* ----------------------------------------------------------------------------- add something to the path ----------------------------------------------------------------------------- */ ( char * dir , char * plus ) ; public: int safe_uts :: ok_get_word /* ----------------------------------------------------------------------------- get word and its length ----------------------------------------------------------------------------- */ ( char * to , char * from , char * at ) ; public: void safe_uts :: ok_add_to_path /* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ ( char * to , char * add ) ; public: char safe_uts :: ok_is_a ( char * atx /* ----------------------------------------------------------------------------- Return 'd' if directory Return 'f' if file Return 'n' if not exists ----------------------------------------------------------------------------- */ ) ; public: void safe_uts :: ok_cp_tree // ----------------------------------------------------------------------------- ( char * nach , char * tree ) ; public: void safe_uts :: ok_cp_tree // ----------------------------------------------------------------------------- ( char * to , char * from , BOOL create_dirs // as far as path 'to not yet exists ) ; public: void safe_uts :: ok_see_tree /* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ ( char * from , FILE * f , int br ) ; public: void safe_uts :: ok_cp_ms_project /* ----------------------------------------------------------------------------- copy MS Project (relevant files only) if 'from not 'to If 'from is 'to, just prune the MS Project. Der Aufrufer garantiert: Beide Pfade in DOS-Format ----------------------------------------------------------------------------- */ ( char * to , char * from , BOOL add // additive or deleting old version first ) ; public: void safe_uts :: ok_get_header_files /* ----------------------------------------------------------------------------- Der Aufrufer garantiert: Pfad 'from' in DOS-Format ----------------------------------------------------------------------------- */ ( FILE * hfs , char * from // tree ) ; public: void safe_uts :: ok_Do /* ----------------------------------------------------------------------------- Call '( comm f ) for all files 'f.with_extension in tree 'from ----------------------------------------------------------------------------- */ ( char * comm , char * from , char * with_extension , BOOL also_subdirs ) ; public: void safe_uts :: ok_max_str /* ----------------------------------------------------------------------------- assert strlen( str ) < max ----------------------------------------------------------------------------- */ ( int max , char * str , char * file , int line ) ; public: void safe_uts :: ok_rm_tree /* ----------------------------------------------------------------------------- remove tree or file 'rm (if it exists) ----------------------------------------------------------------------------- */ ( char * tree ) ; public: void safe_uts :: ok_cp_file /* ----------------------------------------------------------------------------- cp_file( to + postfix, from + postfix ) ----------------------------------------------------------------------------- */ ( char * to , char * from , char * postfix ) ; public: void safe_uts :: ok_cp_file /* ----------------------------------------------------------------------------- copy file ----------------------------------------------------------------------------- */ ( char * to , char * from ) ; public: void safe_uts :: ok_cp_file /* ----------------------------------------------------------------------------- copy file + create target dir (if it does not exist) ----------------------------------------------------------------------------- */ ( char * to , char * from , BOOL force ) ; public: char * safe_uts :: ok_in_str /* ----------------------------------------------------------------------------- return BOOL( c in string str ) ----------------------------------------------------------------------------- */ ( char c , char * str ) ; public: BOOL safe_uts :: ok_is_prefix /* ----------------------------------------------------------------------------- return BOOL( pre is prefix of str ) ----------------------------------------------------------------------------- */ ( char * pre , char * str ) ; public: void safe_uts :: ok_f_to_dir /* ----------------------------------------------------------------------------- copy into directory ----------------------------------------------------------------------------- */ ( char * f , char * to //, BOOL exist // create destination dir 'to' if necessary, BOOL move_it // delete the original file ) ; public: void safe_uts :: ok_cp_section /* ----------------------------------------------------------------------------- copy the specified section of the file ----------------------------------------------------------------------------- */ ( char * to , char * from , long a , long e ) ; public: char * safe_uts :: ok_dir_at /* ----------------------------------------------------------------------------- make 'dir the father node of place 'at ----------------------------------------------------------------------------- */ ( char * dir , char * at ) ; public: void safe_uts :: ok_def_subset /* ----------------------------------------------------------------------------- specify 'cf (= subset of char) ----------------------------------------------------------------------------- */ ( char * cf , char * str // subset charcters up to 'e (so that the NULL, char e // character may also be element of the set) ) ; public: void safe_uts :: ok_goto_str /* ----------------------------------------------------------------------------- while not_is_( c, str ) c++ ; ... ----------------------------------------------------------------------------- */ ( char * & c , char * str // c to this string, int n1 // c + n1, char c1 // and then c to this char ) ; public: BOOL safe_uts :: ok_goto_str /* ----------------------------------------------------------------------------- while not_is_( c, str ) c++ ; ... ----------------------------------------------------------------------------- */ ( char * & c , char * str // c to this string, char * e // end search here at the latest (with fErr) ) ; public: void safe_uts :: ok_copy /* ----------------------------------------------------------------------------- make 'to' a copy of file 'from' ----------------------------------------------------------------------------- */ ( char * from , char * to ) ; public: void safe_uts :: ok_copy /* ----------------------------------------------------------------------------- make 'to' a copy of file 'from' ----------------------------------------------------------------------------- */ ( char * from , FILE * f ) ; public: void safe_uts :: ok_move /* ----------------------------------------------------------------------------- move the file ----------------------------------------------------------------------------- */ ( char * from , char * to ) ; public: void safe_uts :: ok_execute /* ----------------------------------------------------------------------------- execute file cf containing commands of the following form: -/cp_into &1 &2 -/cp &1 &2 -/rm &1 ----------------------------------------------------------------------------- */ ( char * cf ) ; public: BOOL safe_uts :: ok_access /* ----------------------------------------------------------------------------- Return errno that would result, when we try to open the file in mode O_RDWR ----------------------------------------------------------------------------- */ ( char * fn ) ; public: long safe_uts :: ok_time_of /* ----------------------------------------------------------------------------- return time of last update to the file or 0 if the file not exists ----------------------------------------------------------------------------- */ ( char * file ) ; public: void safe_uts :: ok_append /* ----------------------------------------------------------------------------- write the tail 'fr( offset, whence ) to 'fw ----------------------------------------------------------------------------- */ ( FILE * fw , FILE * fr , long offset , int whence ) ; public: void safe_uts :: ok_append /* ----------------------------------------------------------------------------- schreibe den Inhalt der Datei aus nach f ----------------------------------------------------------------------------- */ ( FILE * f , char * aus ) ; public: void safe_uts :: ok_endword /* ----------------------------------------------------------------------------- Macro to find and to mark the end of a word in o n e line of text ----------------------------------------------------------------------------- */ ( char * & c , char e ) ; public: void safe_uts :: ok_checkstr /* ----------------------------------------------------------------------------- Macro to find characters not allowed in the string ----------------------------------------------------------------------------- */ ( uchar a , uchar e , char * str ) ; public: void safe_uts :: ok_sprintf // ----------------------------------------------------------------------------- ( char * to , char * format , ... ) ; public: int safe_uts :: ok_memcmp /* ----------------------------------------------------------------------------- because of a BUG in SCC, Version 7.0 ----------------------------------------------------------------------------- */ ( char * s , char * t , int n ) ; public: BOOL safe_uts :: ok_not_text /* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ ( char * s ) ; public: void safe_uts :: ok_see_str /* ----------------------------------------------------------------------------- for debugging only ----------------------------------------------------------------------------- */ ( int see , char * s , char * ex ) ; public: BOOL safe_uts :: ok_assert_in_str // ----------------------------------------------------------------------------- ( char c , char * str , char * at ) ; public: BOOL safe_uts :: ok_assert_at // ----------------------------------------------------------------------------- ( char * str , char * at ) ; public: BOOL safe_uts :: ok_check_str /* ----------------------------------------------------------------------------- check address and length of string return 0 iff ok ----------------------------------------------------------------------------- */ ( int min_len , int max_len , char * str , char * file , int line ) ; public: int safe_uts :: ok_open /* ----------------------------------------------------------------------------- open file 'at, return file handle ----------------------------------------------------------------------------- */ ( char * fn , char opn // 'r' for read // 'R' for read, but not fErr // 'a' for append // 'u' for update // 'c' for creating (or re-creating) the file // 'C' for creating, fErr if file exists, char how // 't' cooked - i.e. as text // 'B' binary ) ; public: void safe_uts :: ok_show_text /* ----------------------------------------------------------------------------- show to stdout the first n_... characters of txt ----------------------------------------------------------------------------- */ ( char * name , char * txt // any text, int n_chars // ) ; public: void safe_uts :: ok_show_pos /* ----------------------------------------------------------------------------- show to stdout position in source code ----------------------------------------------------------------------------- */ ( int line , char * file ) ; public: char safe_uts :: ok_eoStr /* ----------------------------------------------------------------------------- NULL( end of string ), return char there (= m) ----------------------------------------------------------------------------- */ ( char * & e , char m ) ; public: char safe_uts :: ok_eoStr /* ----------------------------------------------------------------------------- NULL( end of string ), return char there ----------------------------------------------------------------------------- */ ( char * & e , char * str ) ; public: char safe_uts :: ok_toEndOfStr // ----------------------------------------------------------------------------- ( char * & c , char e ) ; public: char safe_uts :: ok_toEndOfStr // ----------------------------------------------------------------------------- ( char * & c , char e , char stattBlank ) ; public: char safe_uts :: ok_charOf // ----------------------------------------------------------------------------- ( char * c , char * str ) ; public: char safe_uts :: ok_goto_word // ----------------------------------------------------------------------------- ( char * & c , int offset , int jumps ) ; public: char * safe_uts :: ok_currentTime ( int x // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_currentTime_en ( int x // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_currentTimestamp ( // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_currentDate ( // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_heute ( // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_test( // ----------------------------------------------------------------------------- ) ; public: char safe_uts :: ok_askChar( // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_resInto /* ----------------------------------------------------------------------------- Create to == toDir/fn aus from = dir/fn ----------------------------------------------------------------------------- */ ( path & to , char * toDir , char * from ) ; public: char * safe_uts :: ok_ourHome ( char * fn /* ----------------------------------------------------------------------------- return the path to the folder containing the file fn ----------------------------------------------------------------------------- */ ) ; public: char * safe_uts :: ok_exePath // ----------------------------------------------------------------------------- #define ourPath( fn ) safe_ut.ok_exePath( fn, 0, 0 ) // ----------------------------------------------------------------------------- ( char * exe , BOOL me // must exist, long L // expected file size ) ; public: void safe_uts :: Syntax /* ----------------------------------------------------------------------------- Der Aufrufer sagt: Zeige die Zeile, die den Syntax Error beinhaltet, dann sage fErr Die Funktion garantiert: fErr ----------------------------------------------------------------------------- */ ( int line , char * file , char * c , char * expected ) ; public: void safe_uts :: ok_notAllCapital /* ----------------------------------------------------------------------------- Transform the string to mixed case letters (no all capital). ----------------------------------------------------------------------------- */ ( char * s ) ; public: int safe_uts :: ok_common /* ----------------------------------------------------------------------------- Return length of common prefix ----------------------------------------------------------------------------- */ ( char * s1 , char * s2 ) ; public: char * safe_uts :: ok_trimm /* ----------------------------------------------------------------------------- Trimm at the end of 's all 'c characters ----------------------------------------------------------------------------- */ ( char * s , char c ) ; public: char * safe_uts :: ok_trimm /* ----------------------------------------------------------------------------- Trimm at the end of 's all characters found in 'estr ----------------------------------------------------------------------------- */ ( char * s , char * estr ) ; public: int safe_uts :: ok_Value // ----------------------------------------------------------------------------- ( char * s ) ; public: int safe_uts :: ok_anz // ----------------------------------------------------------------------------- ( char * s , char c , char e ) ; public: int safe_uts :: ok_replace /* ----------------------------------------------------------------------------- In 'file replace 'str1 by 'str2. Return number of replacements. ----------------------------------------------------------------------------- */ ( char * file , char * str1 , char * str2 ) ; public: BOOL safe_uts :: ok_atComm // ----------------------------------------------------------------------------- ( int s // Zeile ) ; public: void safe_uts :: ok_trace_LB // ----------------------------------------------------------------------------- ( char * enter ) ; public: long safe_uts :: ok_strCode /* ----------------------------------------------------------------------------- map str to a pseudo-random long number ----------------------------------------------------------------------------- */ ( char * str , char * before ) ; public: long safe_uts :: ok_decNr /* ----------------------------------------------------------------------------- decimal string to int (auch dann, wenn fhrende Nullen) ----------------------------------------------------------------------------- */ ( char * str , char * File , int Line ) ; public: float safe_uts :: ok_DECNr /* ----------------------------------------------------------------------------- Beispiel: str == " -1.455,66 EUR" ----------------------------------------------------------------------------- */ ( char * str , char ko // das Komma als '.' oder ',', char * File , int Line ) ; public: uchar safe_uts :: ok_zufchar /* ----------------------------------------------------------------------------- return an random char x out of the range [ from .. to ] ----------------------------------------------------------------------------- */ ( uchar from , uchar to ) ; public: void safe_uts :: ok_ABC /* ----------------------------------------------------------------------------- Create ABC navigation record [A] B C ... Z ----------------------------------------------------------------------------- */ ( FILE * f , char * abcName , char * pre ) ; public: void safe_uts :: ok_abc /* ----------------------------------------------------------------------------- Create ABC navigation record [A] B C ... Z ----------------------------------------------------------------------------- */ ( FILE * f , char * abcName , char * pre ) ; public: char safe_uts :: ok_ABC_sec /* ----------------------------------------------------------------------------- Connect ABC section ----------------------------------------------------------------------------- */ ( FILE * f , char c1 , char c2 , char * abcName ) ; public: FILE * safe_uts :: ok_nextf // ----------------------------------------------------------------------------- ( FILE * f , char * cr , char * rm ) ; public: BOOL safe_uts :: ok_in_Range // ----------------------------------------------------------------------------- ( uchar c , uchar a , uchar e ) ; public: char safe_uts :: ok_eoName // ----------------------------------------------------------------------------- ( char * & e , char * also ) ; public: BOOL safe_uts :: ok_not_escaped // obsolete// ----------------------------------------------------------------------------- ( char * s ) ; public: BOOL safe_uts :: ok_escaped ( char * c // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_skip_nest // ----------------------------------------------------------------------------- ( char * & c , char a // Klammer auf, char z // Klammer zu ) ; public: char * safe_uts :: ok_skip_nest_o_str // ----------------------------------------------------------------------------- ( char * & c , char a // Klammer auf, char z // Klammer zu, char * e // end of range to search ) ; public: char * safe_uts :: ok_to_o_str // ----------------------------------------------------------------------------- ( char * & c , char z , char * e // end of range to search ) ; public: char * safe_uts :: ok_skip_comment ( char * c /* ----------------------------------------------------------------------------- Precondition: At( c, "//" ) || At( c, "/*" ) ----------------------------------------------------------------------------- */ ) ; public: char * safe_uts :: ok_skip_cout_cerr /* ----------------------------------------------------------------------------- Precondition: At( c, "cout") || At( c, "cerr" ) ----------------------------------------------------------------------------- */ ( char * c , char * e ) ; public: void safe_uts :: ok_skip_space_and_comment ( char *& c // ----------------------------------------------------------------------------- ) ; public: BOOL safe_uts :: ok_asChar ( char * c // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_skip_phpstr /* ----------------------------------------------------------------------------- Note: in PHP, strings may contain \n skip float quoted string or a " char written as '"' or '\"' skip single quoted string or a ' char written as ' or '\'' ----------------------------------------------------------------------------- */ ( char * & c , char * e ) ; public: char * safe_uts :: ok_skip_str /* ----------------------------------------------------------------------------- skip float quoted string or a " char written as '"' or '\"' skip single quoted string or a ' char written as ' or '\'' ----------------------------------------------------------------------------- */ ( char * & c , char * e ) ; public: char * safe_uts :: ok_skip_str1 /* ----------------------------------------------------------------------------- skip single quoted string or a ' char written as '\'' ----------------------------------------------------------------------------- */ ( char * & c , char * e ) ; public: char * safe_uts :: ok_skip_Br /* ----------------------------------------------------------------------------- skip a bracket such as <... "..." ... '...' ...> | return this position ----------------------------------------------------------------------------- */ ( char * c , char * e , char c1 , char c2 ) ; public: void safe_uts :: ok_skip_strXXXXXXX // ----------------------------------------------------------------------------- ( char * & c , char * e ) ; public: void safe_uts :: ok_extract_sections /* ----------------------------------------------------------------------------- extract sections [str1 ... str2] ----------------------------------------------------------------------------- */ ( char * from , char * str1 , char * str2 , char * into ) ; public: char safe_uts :: ok_eoStr // ----------------------------------------------------------------------------- ( char * c , char * & e , char m ) ; public: char safe_uts :: ok_environment // ----------------------------------------------------------------------------- ( char * to , char * from ) ; public: int safe_uts :: ok_max_me // ----------------------------------------------------------------------------- ( int & M , int m ) ; public: int safe_uts :: ok_min_me // ----------------------------------------------------------------------------- ( int & M , int m ) ; public: char * safe_uts :: ok_file_Date // obsolete - use file_Time/* ----------------------------------------------------------------------------- Return pointer to Last Update Time in format YYYY.MM.DD ----------------------------------------------------------------------------- */ ( char * fn ) ; public: char * safe_uts :: ok_file_Time /* ----------------------------------------------------------------------------- Write to buffer xx the file's Update Time in format if ( form == 0 ) then DD.MM.YYYY if ( form == 1 ) then YYYY.MM.DD if ( form == 2 ) then YYYY.MM.DD HH:MM if ( form >= 3 ) then YYYY.MM.DD HH:MM:SS ----------------------------------------------------------------------------- */ ( char * fn , char * xx , int form ) ; public: time_t safe_uts :: ok_file_Surr ( char * fn /* ----------------------------------------------------------------------------- Return the file's st_mtime value (= Last Update Time) ----------------------------------------------------------------------------- */ ) ; public: unsigned long safe_uts :: ok_size_Surr ( char * fn /* ----------------------------------------------------------------------------- Return the file's st_mtime value (= Last Update Time) ----------------------------------------------------------------------------- */ ) ; public: char * safe_uts :: ok_MMDD ( char * date // YYYY.MM.DD or YYYY_MM_DD/* ----------------------------------------------------------------------------- Transform date in place to "MMM DD" ----------------------------------------------------------------------------- */ ) ; public: BOOL safe_uts :: ok_str_in_file /* ----------------------------------------------------------------------------- return BOOL( string 'str was found in the file 'fn ) ----------------------------------------------------------------------------- */ ( char * str , char * fn ) ; public: BOOL safe_uts :: ok_strchecker ( char * str // ----------------------------------------------------------------------------- // wird zum Debugging von Fall zu Fall geeignet codiert // um Trace oder Abbruch zu liefern // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_checker // ----------------------------------------------------------------------------- // wird zum Debugging von Fall zu Fall geeignet codiert // um Trace oder Abbruch zu liefern // ----------------------------------------------------------------------------- ( int stNr , char * fn ) ; public: int safe_uts :: ok_trace_strIn /* ----------------------------------------------------------------------------- trace occurrances of 'str in file 'fn if 'str found at z[a], show z[ a-n .. a+m ] ----------------------------------------------------------------------------- */ ( char * str , char * fn , uint m , int n // n < 0 means: fErr if 'str found // oder: uint, char * File , int Line ) ; public: BOOL safe_uts :: ok_is_ext // ----------------------------------------------------------------------------- ( char * fn , char * ext ) ; public: char * safe_uts :: ok_tmp_ ( char * str /* ----------------------------------------------------------------------------- Return pointer to the tmp fileAt suggested This function is to ensure that we use our RamDisk for tmp files if such a RamDisk actually exists ----------------------------------------------------------------------------- */ ) ; public: uint safe_uts :: ok_tmpName ( char * dir /* ----------------------------------------------------------------------------- Return a number N such that 'dir/N does not exist ----------------------------------------------------------------------------- */ ) ; public: uint safe_uts :: ok_wfind /* ----------------------------------------------------------------------------- ein ufind() ohne Probleme mit Umlauten return number of files found ----------------------------------------------------------------------------- */ ( FILE * f , char * stru // path to file, char * oftree // path to dir ( -oftree: nur Verzeichnisse sehen ) ) ; public: uint safe_uts :: ok_do_tree /* ----------------------------------------------------------------------------- for f in *.ext do: S_ "%s %s %s", co1, f, co2 _Do ----------------------------------------------------------------------------- */ ( char * os , char * oftree , char * ext , char * co1 , char * co2 , FILE * f // if ( f == 0 ) execute command, else write it to 'f ) ; public: int safe_uts :: ok_setMx // ----------------------------------------------------------------------------- ( int & n1 , int n2 ) ; public: float safe_uts :: ok_Maxfp // ----------------------------------------------------------------------------- ( float n1 , float n2 ) ; public: float safe_uts :: ok_Absfp ( float x // ----------------------------------------------------------------------------- ) ; public: float safe_uts :: ok_MaxAbsfp // ----------------------------------------------------------------------------- ( float n1 , float n2 ) ; public: int safe_uts :: ok_Max // ----------------------------------------------------------------------------- ( int n1 , int n2 ) ; public: void safe_uts :: ok_setenv /* ----------------------------------------------------------------------------- notwendig nur beim MS Compiler ----------------------------------------------------------------------------- */ ( char * Var , char * Value ) ; public: void safe_uts :: ok_setenv ( char * fn /* ----------------------------------------------------------------------------- executiert alle set Statements im file ----------------------------------------------------------------------------- */ ) ; public: char * safe_uts :: ok_retVar /* ----------------------------------------------------------------------------- executiert alle set Statements im file ----------------------------------------------------------------------------- */ ( char * fn , char * Var , str_set & store ) ; public: float safe_uts :: ok_decdecNr ( char * str /* ----------------------------------------------------------------------------- FEHLER in exec_ut.cpp bei Ausgabe von float-Werten: Dezimalstellen werden von _1() nicht gezeigt, sind aber dennoch da !!!! string to float ----------------------------------------------------------------------------- */ ) ; public: void safe_uts :: ok_execAt /* ----------------------------------------------------------------------------- execute command from a specific folder ----------------------------------------------------------------------------- */ ( char * dir , char * comm ) ; public: char * safe_uts :: ok_backto /* ----------------------------------------------------------------------------- back to character c or str ----------------------------------------------------------------------------- */ ( char * str , char c ) ; public: char * safe_uts :: ok_backto /* ----------------------------------------------------------------------------- back to s ----------------------------------------------------------------------------- */ ( char * str , char * sustr ) ; public: char * safe_uts :: ok_backtoSucc /* ----------------------------------------------------------------------------- Back to the first char in the longest postfix not containing c ----------------------------------------------------------------------------- */ ( char * str , char * substr ) ; public: char * safe_uts :: ok_namAnf ( char * str /* ----------------------------------------------------------------------------- Back to the first char folowing / or \ ----------------------------------------------------------------------------- */ ) ; public: void safe_uts :: ok_rette_fs /* ----------------------------------------------------------------------------- mache nch/fs zu einer Kopie von aus/fs Hierbei kann fs auch Wildcards enthalten (etwa * sein). ----------------------------------------------------------------------------- */ ( char * aus , char * nch , uint dated // BOOL( 0, 5, 8, 9 ), char * fs ) ; public: uint safe_uts :: ok_str_match /* ----------------------------------------------------------------------------- return the length of the longest common prefix ----------------------------------------------------------------------------- */ ( char * s1 , char * s2 ) ; public: uint safe_uts :: ok_prefix_match /* ----------------------------------------------------------------------------- return the length of the longest prefix of s1 that is substring of s2 ----------------------------------------------------------------------------- */ ( char * s1 , char * s2 ) ; public: uint safe_uts :: ok_substr_match /* ----------------------------------------------------------------------------- return the length of the 1st longest substr of s1 that is substring of s2 ----------------------------------------------------------------------------- */ ( char * s1 , char * s2 ) ; public: uint safe_uts :: ok_word_match /* ----------------------------------------------------------------------------- return BOOL( each word in s1 is substring of s2 ) ----------------------------------------------------------------------------- */ ( BOOL capitalized , char * s1 , char * s2 ) ; public: char * safe_uts :: ok_thisDir ( /* ----------------------------------------------------------------------------- return absolute path of Current Working Directory (= CWD) ----------------------------------------------------------------------------- */ ) ; public: void safe_uts :: ok_ersChar /* ----------------------------------------------------------------------------- Ersetze in 'str jedes 'c1 durch ein 'c2 ----------------------------------------------------------------------------- */ ( char c1 , char c2 , char * str ) ; public: char * safe_uts :: ok_corrStr /* ----------------------------------------------------------------------------- Ersetze in 'str jeden substr 'str1 durch 'str2 ----------------------------------------------------------------------------- */ ( char * str , char * str1 , char * str2 , char * zstr // destination buffer, char * estr // end of destination buffer (= 0 if strlen is not to grow) ) ; public: char * safe_uts :: ok_normName /* ----------------------------------------------------------------------------- Ersetze in 'str jeden substr 'str1 durch 'str2 ----------------------------------------------------------------------------- */ ( char * nch , char * aus ) ; public: void safe_uts :: ok_upperName ( char * c // ----------------------------------------------------------------------------- ) ; public: BOOL safe_uts :: ok_Identifier ( char * c // ----------------------------------------------------------------------------- ) ; public: BOOL safe_uts :: ok_names ( char * c // ----------------------------------------------------------------------------- ) ; public: BOOL safe_uts :: ok_quote ( char c // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_shrink ( char * str // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_eosAt /* ----------------------------------------------------------------------------- return new eos(str) ----------------------------------------------------------------------------- */ ( char * str , char * endAt ) ; public: void safe_uts :: ok_strUm /* ----------------------------------------------------------------------------- trace Zeichenfolge um c herum ----------------------------------------------------------------------------- */ ( char * c1 , char * c , uint n2 , char * e1 , char * e ) ; public: BOOL safe_uts :: ok_cp_prefix // return substr( str, aus )// ----------------------------------------------------------------------------- ( char * nch , char * aus , char * str , BOOL mitstr ) ; public: void safe_uts :: ok_hoAus // hole aus ... bis zu str// ----------------------------------------------------------------------------- ( char * nch , char * aus , char * str ) ; public: char * safe_uts :: ok_koSEL // ----------------------------------------------------------------------------- // return TRUE, iff one part x of SEL = x1,x2,x3,..... is substr of str // ----------------------------------------------------------------------------- ( char * SEL , char * str ) ; public: BOOL safe_uts :: ok_select_this // ----------------------------------------------------------------------------- // return TRUE, iff all parts x of SEL = x1~x2~x3~..... are substr of str // ----------------------------------------------------------------------------- ( char * SEL , char * str ) ; public: char safe_uts :: ok_fastAlphaNum ( char x // ----------------------------------------------------------------------------- // wandelt Umlaute zum entsprechenden Vokal bzw. zu s // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_mae2win ( char * str // ----------------------------------------------------------------------------- ) ; public: uint safe_uts :: ok_schmutz ( char * fAt // ----------------------------------------------------------------------------- // grep "Y =" auf stdout zeigt not-win-character coding (sog. Schmutz) // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_utf2win ( char * str // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_norm_date ( char * str // ----------------------------------------------------------------------------- // DD.MM.YYYY, and also DD-MM-YYYY, become YYYY.MM.DD // // Note: YYYY.MM.DD in CSV is presented in EXCEL GUI as DD.MM.YYYY // // Code for timestamp to YYYY.MM.DD exists in mantis.ic // ----------------------------------------------------------------------------- ) ; public: char * safe_uts :: ok_Appwin_exists ( char * str // ----------------------------------------------------------------------------- // str muss substr() des Fenstertitels sein // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_close_Appwins /* ----------------------------------------------------------------------------- str //win1~win2~win3~win4~... str //win1/win2/win3/win4/... str //win1:win2:win3:win4:... via autoIt3 for X //1, 2, 3, 4, ... do: close ALL windows with a title containing winX as a substring WARNING: If more than one such window is open, the function will ask the user for confirmation. NOTE: close_Appwins.exe = ntuse_/run/R.exe (dort auch ein *.HLP file) ----------------------------------------------------------------------------- VBScript: set wsh = CreateObject( "wscript.shell" ) if wsh.appActivate( "Untitled - Notepad" ) then wsh.sendkeys "%{F4}" end If ODER: set o = CreateObject("APIWrapperCOM.APIWrapper") winHandle //o.findWindow("test.txt - Notepad") o.killWindow( winHandle ) ODER: tasklist /V > tmp Dann in tmp alle Window Titles suchen, die betroffen sind, und dann in jeweils derselben Zeile die Process ID. Mit der dann pskill aufrufen. ----------------------------------------------------------------------------- */ ( BOOL sync , char * str ) ; public: void safe_uts :: ok_close_windows // ----------------------------------------------------------------------------- // str //str1/str2/.../strN // // Close all windows having one such strX as a substring in the title // ----------------------------------------------------------------------------- ( BOOL sync , char * str ) ; public: BOOL safe_uts :: ok_show_or_DEL // ----------------------------------------------------------------------------- ( long L , char * fAt ) ; public: char * safe_uts :: ok_toz // ----------------------------------------------------------------------------- ( char * z , char * str ) ; public: void safe_uts :: ok_KILL ( char * exe // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_fazit_trace // ----------------------------------------------------------------------------- ( char * traceAt , char * nch ) ; public: void safe_uts :: ok_EXIT ( int rc // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_DEL ( char * str // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_popup ( char * str // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_doAnderswo // ----------------------------------------------------------------------------- // If ( *comm ) then execute command comm in folder doAt // else make doAt the current working dir // ----------------------------------------------------------------------------- ( char * doAt , char * comm , char * trace ) ; public: char * safe_uts :: ok_memstr // ----------------------------------------------------------------------------- // Erweitere string c um eine Vorsilbe, die Kopie von str ist. // ----------------------------------------------------------------------------- ( char * c , char * str ) ; public: char * safe_uts :: ok_es_ // ----------------------------------------------------------------------------- ( char * e , char * str ) ; public: void safe_uts :: ok_strTrace // ----------------------------------------------------------------------------- ( char * Nam , char * str ) ; public: char * safe_uts :: ok_strNorm // ----------------------------------------------------------------------------- // Strings, die sich nur durch Spaces, Underscores oder gro/klein // unterscheiden, haben dieselbe Norm // ----------------------------------------------------------------------------- ( char * nstr , char * str , uint mxLen ) ; public: uint safe_uts :: ok_wait_for /* ----------------------------------------------------------------------------- Die C++ proc sleep() = Sleep() funktioniert nicht - warum ????? Sie ist - als Sleep() - definiert in WINBASE.H ----------------------------------------------------------------------------- */ ( char * fAt , uint msec , BOOL rm , uint M ) ; public: void safe_uts :: ok_existiere_Leer ( char * fAt // ----------------------------------------------------------------------------- ) ; public: BOOL safe_uts :: ok_not_htm ( char * fAt // ----------------------------------------------------------------------------- ) ; public: BOOL safe_uts :: ok_rm_unicode // ----------------------------------------------------------------------------- // unicode to iso // ----------------------------------------------------------------------------- ( char * x , uchar c1 , uchar c2 , uchar c3 ) ; public: char * safe_uts :: ok_werde_fNam ( char * str // ----------------------------------------------------------------------------- // um UTF chars zu finden ... // ----------------------------------------------------------------------------- ) ; public: uint safe_uts :: ok_trace_utf ( char * fAt // ----------------------------------------------------------------------------- // um UTF chars zu finden ... // ----------------------------------------------------------------------------- ) ; public: void safe_uts :: ok_XMLUmlaute /* ----------------------------------------------------------------------------- Was in XML als entity ...; stehen muss: ----------------------------------------------------------------------------- */ ( char * aus , char * nch ) ; public: char * safe_uts :: utf // ----------------------------------------------------------------------------- ( char * z , uchar z1 , uchar z2 ) ; public: void safe_uts :: ok_win2utf8 ( char * htm /* ----------------------------------------------------------------------------- ... soweit das rBuffer.unicode() NICHT erledigen konnte ----------------------------------------------------------------------------- */ ) ; public: uint safe_uts :: ok_toUtf8 /* ----------------------------------------------------------------------------- ... soweit das rBuffer.unicode() NICHT erledigen konnte ----------------------------------------------------------------------------- */ ( char * str , char * utfstr // der ist zu setzen ... ) ; public: uint safe_uts :: ok_ersUtf_HTM /* ----------------------------------------------------------------------------- ... soweit das rBuffer.unicode() NICHT erledigen konnte ----------------------------------------------------------------------------- */ ( char * aus , char * nch // fileAt or string ) ; public: BOOL safe_uts :: ok_file_substr /* ----------------------------------------------------------------------------- return TRUE, iff str is substr of text in the file ----------------------------------------------------------------------------- */ ( char * fAt , char * str // fileAt or string ) ; public: void safe_uts :: ok_escto // ----------------------------------------------------------------------------- ( char * aus , char * nch // mit '<' ersetzt durch < ) ; public: char * safe_uts :: ok_s2fstr // ----------------------------------------------------------------------------- // Aus str soll ein Dateine fstr werden // ----------------------------------------------------------------------------- ( char * str , char * fstr , uint L // strlen( fstr ) wir als kleiner L erwartet ) ; #include safe_uts.h3 : cpp } ; #endif