--- psiconv/trunk/lib/psiconv/parse_texted.c 2003/11/23 21:47:24 167 +++ psiconv/trunk/lib/psiconv/parse_texted.c 2003/11/25 17:57:05 168 @@ -29,7 +29,8 @@ #include #endif -int psiconv_parse_texted_section(const psiconv_buffer buf,int lev, +int psiconv_parse_texted_section(const psiconv_config config, + const psiconv_buffer buf,int lev, psiconv_u32 off, int *length, psiconv_texted_section *result, psiconv_character_layout base_char, @@ -43,18 +44,18 @@ psiconv_u32 temp; int leng; - psiconv_progress(lev+1,off,"Going to read a texted section"); + psiconv_progress(config,lev+1,off,"Going to read a texted section"); if (!((*result) = malloc(sizeof(**result)))) goto ERROR1; - psiconv_progress(lev+2,off+len,"Going to read section id"); - temp = psiconv_read_u32(buf,lev+2,off+len,&res); + psiconv_progress(config,lev+2,off+len,"Going to read section id"); + temp = psiconv_read_u32(config,buf,lev+2,off+len,&res); if (res) goto ERROR2; if (temp != PSICONV_ID_TEXTED_BODY) { - psiconv_warn(lev+2,off+len, + psiconv_warn(config,lev+2,off+len, "Page header section body id not found"); - psiconv_debug(lev+2,off+len, + psiconv_debug(config,lev+2,off+len, "Page body id: read %08x, expected %08x",temp, PSICONV_ID_TEXTED); res = -PSICONV_E_PARSE; @@ -62,36 +63,36 @@ } len += 4; - psiconv_progress(lev+2,off+len,"Going to read the section jumptable"); - while (temp = psiconv_read_u32(buf,lev+3,off+len,&res), + psiconv_progress(config,lev+2,off+len,"Going to read the section jumptable"); + while (temp = psiconv_read_u32(config,buf,lev+3,off+len,&res), !res && temp != PSICONV_ID_TEXTED_TEXT) { len += 4; if (temp == PSICONV_ID_TEXTED_LAYOUT) { - layout_sec = psiconv_read_u32(buf,lev+3,off+len,&res); + layout_sec = psiconv_read_u32(config,buf,lev+3,off+len,&res); if (res) goto ERROR2; - psiconv_debug(lev+3,off+len,"Found Layout section at %08x",layout_sec); + psiconv_debug(config,lev+3,off+len,"Found Layout section at %08x",layout_sec); } else if (temp == PSICONV_ID_TEXTED_REPLACEMENT) { - replacement_sec = psiconv_read_u32(buf,lev+3,off+len,&res); + replacement_sec = psiconv_read_u32(config,buf,lev+3,off+len,&res); if (res) goto ERROR2; - psiconv_debug(lev+3,off+len,"Found Replacement section at %08x", + psiconv_debug(config,lev+3,off+len,"Found Replacement section at %08x", replacement_sec); } else if (temp == PSICONV_ID_TEXTED_UNKNOWN) { - unknown_sec= psiconv_read_u32(buf,lev+3,off+len,&res); + unknown_sec= psiconv_read_u32(config,buf,lev+3,off+len,&res); if (res) goto ERROR2; if (unknown_sec) { - psiconv_warn(lev+3,off+len, + psiconv_warn(config,lev+3,off+len, "Unknown section in TextEd jumptable has real offset (ignoring)"); } - psiconv_debug(lev+3,off+len,"Found Unknown section at %08x", + psiconv_debug(config,lev+3,off+len,"Found Unknown section at %08x", unknown_sec); } else { - psiconv_warn(lev+3,off+len, + psiconv_warn(config,lev+3,off+len, "Unknown section in TextEd jumptable (ignoring)"); - psiconv_debug(lev+3,off+len,"Section ID %08x at offset %08x",temp, - psiconv_read_u32(buf,lev+3,off+len,NULL)); + psiconv_debug(config,lev+3,off+len,"Section ID %08x at offset %08x",temp, + psiconv_read_u32(config,buf,lev+3,off+len,NULL)); } len += 4; } @@ -99,15 +100,15 @@ goto ERROR2; len += 4; - psiconv_progress(lev+2,off+len,"Going to read the text"); - if ((res = psiconv_parse_text_section(buf,lev+2,off+len,&leng, + psiconv_progress(config,lev+2,off+len,"Going to read the text"); + if ((res = psiconv_parse_text_section(config,buf,lev+2,off+len,&leng, &(*result)->paragraphs))) goto ERROR2; len += leng; if (layout_sec) { - psiconv_progress(lev+2,off+len,"Going to read the layout"); - if ((res = psiconv_parse_styleless_layout_section(buf,lev+2,layout_sec,NULL, + psiconv_progress(config,lev+2,off+len,"Going to read the layout"); + if ((res = psiconv_parse_styleless_layout_section(config,buf,lev+2,layout_sec,NULL, (*result)->paragraphs, base_char,base_para))) goto ERROR3; @@ -115,7 +116,7 @@ #if 0 if (replacement_sec) { - psiconv_progress(lev+2,off+len,"Going to read the replacements"); + psiconv_progress(config,lev+2,off+len,"Going to read the replacements"); /* WHATEVER */ } #endif @@ -123,7 +124,7 @@ if (length) *length = len; - psiconv_progress(lev+1,off+len-1,"End of TextEd section " + psiconv_progress(config,lev+1,off+len-1,"End of TextEd section " "(total length: %08x", len); return 0; @@ -133,7 +134,7 @@ ERROR2: free (*result); ERROR1: - psiconv_warn(lev+1,off,"Reading of TextEd Section failed"); + psiconv_warn(config,lev+1,off,"Reading of TextEd Section failed"); if (length) *length = 0; if (!res)