meta,
C++
4 Methoden:
|
/* public: */ static void St_htm :: to_htm
/* public: */ void St_htm :: word_to_htm
#define static
#include st_htm.h : cpp
#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 BB
#undef BBStr
#undef bb
#undef bbStr
#undef LB_
#undef LE_
#undef LE_ret
#undef ret
#undef ret_
#undef __
#undef ___
#define BB if ( 1 < call_nr || errno )
#define bb if ( 1 < call_nr || errno )
#define BBStr( x,y,z ) { BB traceStr( x,y,z ); }
#define bbStr( x,y,z ) { bb traceStr( x,y,z ); }
#define __ { bb { printf( "\nLine %i", __LINE__ ); }}
#define ___
#define ret_ { __ return ; }
#define LE_ __ return ; }
#define LE_ret( x ) __ return( x ); }
#define ret( x ) { __ return( x ); }
#define LB_( x ) { bb printf( "\n-> %s", x ); safe_ut.showSysCalls = 1 ;
#endif
/* public: */ static void St_htm :: to_htm
/* -----------------------------------------------------------------------------
replace HTML special chars
-----------------------------------------------------------------------------
*/ (
char * str
, char * htm
, long maxLen
)
LB_("St_htm.to_htm")
if ( ! htm ) fErr
if ( ! str ) fErr
char * c = str - 1 ;
char * e = htm ; char * ee = e + maxLen - 1 ;
// uint L = strlen( str ); if ( maxLen < L ) fErr2( L, L-maxLen ) _2( L,str )
// char * ce = c + L ;
while ( *( ++c ) )
// while ( ++c < ce )
{
switch ( ( uchar ) *c )
{
Case '<' : strcpy( e, "<" ); e += 4 ;
Case '>' : strcpy( e, ">" ); e += 4 ;
Else : *e++ = *c ;
}
if ( ee <= e )
{
printf( "\nstr = [%s]%s\n", str, c );
fErr1( maxLen )
}
}
*e = 0 ;
LE_
/* public: */ void St_htm :: word_to_htm
/* -----------------------------------------------------------------------------
for each MS Word file 'x/f.doc or 'x/f.rtf found in the given 'dir tree
create x/publish/f.htm
-----------------------------------------------------------------------------
*/ (
FILE * f
, char * dir
)
LB_("St_htm.word_to_htm")
char1000 wc ; s_( wc, "%s/*", dir ); dos_me( wc );
_finddata_t dta ; int h = _findfirst( wc, &dta );
char * e = wc + strlen( wc ) - 2 ; *e = 0 ;
while ( ! errno )
{
if ( not_is_( dta.name, "." )
&& not_is_( dta.name, ".." )
&& not_is_( dta.name, "System Volume Information" )
&& ( ! ( dta.attrib & _A_SUBDIR ) )
)
{
char * e = dta.name + strlen( dta.name ) - 1 ;
while ( *e != '.' && dta.name < e ) *( e-- ) = lower( *e );
if ( is_( e, ".doc" ) || is_( e, ".rtf" ) )
{
fprintf( f, "\napp.Documents.Open( \"%s/%s\", 1, 1 );"
"\napp.ActiveDocument.SaveAs( \"%s/publish/%s.htm\", 8 );"
"\napp.ActiveDocument.Close();"
, wc, dta.name
, wc, dta.name );
}
}
_findnext( h, &dta );
}
if ( errno != ENOENT )
{
m_errMess "System: errno %i: %s" m_
errno, wc, ret_error
}
;
ok _findclose( h ); ok
LE_
#undef static
#endif