--- parser3/src/include/pa_common.h 2003/01/24 14:36:10 1.89.2.3 +++ parser3/src/include/pa_common.h 2003/01/27 15:07:47 1.89.2.4 @@ -8,7 +8,7 @@ #ifndef PA_COMMON_H #define PA_COMMON_H -static const char* IDENT_COMMON_H="$Date: 2003/01/24 14:36:10 $"; +static const char* IDENT_COMMON_H="$Date: 2003/01/27 15:07:47 $"; #include "pa_pool.h" #include "pa_string.h" @@ -91,10 +91,10 @@ void fix_line_breaks( size_t& size ///< may change! used to speedup next actions ); -typedef void (*File_read_action)( +typedef void (*File_read_action)(Pool& pool, struct stat& finfo, int f, - ConstStringPtr file_spec, CharPtr fname, bool as_text, + ConstStringPtr file_spec, const char *fname, bool as_text, void *context); /** @@ -104,7 +104,7 @@ typedef void (*File_read_action)( @returns true if read OK */ -bool file_read_action_under_lock(ConstStringPtr file_spec, +bool file_read_action_under_lock(Pool& pool, ConstStringPtr file_spec, const char *action_name, File_read_action action, void *context, bool as_text=false, bool fail_on_read_problem=true); @@ -119,15 +119,20 @@ char *file_read_text(Pool& pool, Charset bool fail_on_read_problem=true, HashStringValue* options=0, HashStringValue** out_fields=0); +struct File_read_result { + bool success; + HashStringValuePtr fields; +}; + /** read specified file using pool, if fail_on_read_problem is true[default] throws an exception @returns true if read OK */ -bool file_read(Pool& pool, Charset& charset, +File_read_result file_read(Pool& pool, Charset& charset, ConstStringPtr file_spec, - void *& ptr, size_t& size, + char *& ptr, size_t& size, bool as_text, HashStringValue* options=0, HashStringValue** out_fields=0, bool fail_on_read_problem=true); @@ -175,7 +180,7 @@ bool entry_exists(const char *fname, str bool entry_exists(ConstStringPtr file_spec); bool file_readable(ConstStringPtr file_spec); bool dir_readable(ConstStringPtr file_spec); -String *file_readable(ConstStringPtr path, ConstStringPtr name); +ConstStringPtr file_readable(ConstStringPtr path, ConstStringPtr name); bool file_executable(ConstStringPtr file_spec); bool file_stat(ConstStringPtr file_spec, @@ -195,7 +200,7 @@ char *getrow(char **row_ref,char delim=' char *lsplit(char *string, char delim); char *lsplit(char **string_ref,char delim); char *rsplit(char *string, char delim); -char *format(double value, char *fmt); +const char *format(Pool& pool, double value, char *fmt); #ifndef max inline int max(int a, int b) { return a>b?a:b; }