--- parser3/src/main/pa_common.C 2001/04/25 11:02:57 1.51 +++ parser3/src/main/pa_common.C 2001/06/28 07:41:59 1.55 @@ -5,10 +5,10 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_common.C,v 1.51 2001/04/25 11:02:57 paf Exp $ + $Id: pa_common.C,v 1.55 2001/06/28 07:41:59 parser Exp $ */ +static char *RCSId="$Id: pa_common.C,v 1.55 2001/06/28 07:41:59 parser Exp $"; -#include "pa_config_includes.h" #include "pa_common.h" #include "pa_types.h" #include "pa_exception.h" @@ -100,7 +100,8 @@ bool file_read(Pool& pool, const String& if(fail_on_read_problem) PTHROW(0, 0, &file_spec, - "read failed: %s (%d)", strerror(errno), errno); + "read failed: %s (%d), actual filename '%s'", + strerror(errno), errno, fname); return false; } @@ -144,7 +145,8 @@ void file_write(Pool& pool, } PTHROW(0, 0, &file_spec, - "write failed: %s (%d)", strerror(errno), errno); + "write failed: %s (%d), actual filename '%s'", + strerror(errno), errno, fname); } static void rmdir(const String& file_spec, size_t pos_after) { @@ -155,10 +157,12 @@ static void rmdir(const String& file_spe rmdir(file_spec.mid(0, pos_after-1/* / */).cstr(String::UL_FILE_NAME)); } void file_delete(Pool& pool, const String& file_spec) { - if(unlink(file_spec.cstr(String::UL_FILE_NAME))!=0) + const char *fname=file_spec.cstr(String::UL_FILE_NAME); + if(unlink(fname)!=0) PTHROW(0, 0, &file_spec, - "unlink failed: %s (%d)", strerror(errno), errno); + "unlink failed: %s (%d), actual filename '%s'", + strerror(errno), errno, fname); rmdir(file_spec, 1); } @@ -190,7 +194,8 @@ size_t file_size(const String& file_spec if(stat(fname, &finfo)!=0) PTHROW(0, 0, &file_spec, - "write failed: %s (%d)", strerror(errno), errno); + "getting file size failed: %s (%d), real filename '%s'", + strerror(errno), errno, fname); return finfo.st_size; } @@ -306,9 +311,10 @@ const char *unescape_chars(Pool& pool, c return s; } +/// used by attributed_meaning_to_string / append_attribute_subattribute struct Attributed_meaning_info { - String::Untaint_lang lang; - String *header; + String *header; // header line being constructed + String::Untaint_lang lang; // language in which to append to that line }; static void append_attribute_subattribute(const Hash::Key& akey, Hash::Val *avalue, void *info) { @@ -332,8 +338,8 @@ const String& attributed_meaning_to_stri result.append(value->as_string(), lang, true); Attributed_meaning_info attributed_meaning_info={ - lang, - &result + &result, + lang }; hash->for_each(append_attribute_subattribute, &attributed_meaning_info); } else // result value