| 1 | /* | 1 | /* | 
| 2 | parse_routines.h - Part of psiconv, a PSION 5 file formats converter | 2 | parse_routines.h - Part of psiconv, a PSION 5 file formats converter | 
| 3 | Copyright (c) 1999  Frodo Looijaard <frodol@dds.nl> | 3 | Copyright (c) 1999, 2000  Frodo Looijaard <frodol@dds.nl> | 
| 4 |  | 4 |  | 
| 5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify | 
| 6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by | 
| 7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or | 
| 8 | (at your option) any later version. | 8 | (at your option) any later version. | 
| … |  | … |  | 
| 18 | */ | 18 | */ | 
| 19 |  | 19 |  | 
| 20 | #ifndef PSICONV_PARSE_ROUTINES_H | 20 | #ifndef PSICONV_PARSE_ROUTINES_H | 
| 21 | #define PSICONV_PARSE_ROUTINES_H | 21 | #define PSICONV_PARSE_ROUTINES_H | 
| 22 |  | 22 |  | 
| 23 | #include "data.h" | 23 | #include <psiconv/general.h> | 
| 24 | #include "parse.h" | 24 | #include <psiconv/data.h> | 
|  |  | 25 | #include <psiconv/buffer.h> | 
|  |  | 26 | #include <psiconv/common.h> | 
| 25 |  | 27 |  | 
| 26 | /* *************** | 28 | #ifdef __cplusplus | 
| 27 | * parse_aux.c * | 29 | extern "C" { | 
| 28 | *************** */ | 30 | #endif /* __cplusplus */ | 
| 29 |  | 31 |  | 
| 30 | /* These functions print error, warning, progress and debug information to |  |  | 
| 31 | stderr */ |  |  | 
| 32 | extern void psiconv_fatal(int level, psiconv_u32 off, const char *format,...); |  |  | 
| 33 | extern void psiconv_warn(int level, psiconv_u32 off, const char *format,...); |  |  | 
| 34 | extern void psiconv_progress(int level, psiconv_u32 off, |  |  | 
| 35 | const char *format,...); |  |  | 
| 36 | extern void psiconv_debug(int level, psiconv_u32 off, const char *format,...); |  |  | 
| 37 |  |  |  | 
| 38 | /* This function returns a copy of a string, that contains no ASCII codes |  |  | 
| 39 | that are not printable. You should free this string yourself when you are |  |  | 
| 40 | done with it. */ |  |  | 
| 41 | extern char *psiconv_make_printable(const char *s); |  |  | 
| 42 |  |  |  | 
| 43 | /* ************** |  |  | 
| 44 | * checkuid.c * |  |  | 
| 45 | ************** */ |  |  | 
| 46 |  |  |  | 
| 47 | extern psiconv_u32 psiconv_checkuid(psiconv_u32 uid1, |  |  | 
| 48 | psiconv_u32 uid2,psiconv_u32 uid3); |  |  | 
| 49 |  | 32 |  | 
| 50 | /* ****************** | 33 | /* ****************** | 
| 51 | * parse_simple.c * | 34 | * parse_simple.c * | 
| 52 | ****************** */ | 35 | ****************** */ | 
| 53 |  | 36 |  | 
| 54 | extern psiconv_u8 psiconv_read_u8(const psiconv_buffer buf,int lev, | 37 | extern psiconv_u8 psiconv_read_u8(const psiconv_buffer buf,int lev, | 
| 55 | psiconv_u32 off); | 38 | psiconv_u32 off, int *status); | 
| 56 | extern psiconv_u16 psiconv_read_u16(const psiconv_buffer buf,int lev, | 39 | extern psiconv_u16 psiconv_read_u16(const psiconv_buffer buf,int lev, | 
| 57 | psiconv_u32 off); | 40 | psiconv_u32 off, int *status); | 
| 58 | extern psiconv_u32 psiconv_read_u32(const psiconv_buffer buf,int lev, | 41 | extern psiconv_u32 psiconv_read_u32(const psiconv_buffer buf,int lev, | 
| 59 | psiconv_u32 off); | 42 | psiconv_u32 off, int *status); | 
|  |  | 43 | extern psiconv_s32 psiconv_read_sint(const psiconv_buffer buf,int lev, | 
|  |  | 44 | psiconv_u32 off, int *length, int *status); | 
| 60 |  | 45 |  | 
| 61 | extern psiconv_S_t psiconv_read_S(const psiconv_buffer buf, int lev, | 46 | extern psiconv_S_t psiconv_read_S(const psiconv_buffer buf, int lev, | 
| 62 | psiconv_u32 off, int *length); | 47 | psiconv_u32 off, int *length, int *status); | 
| 63 | extern psiconv_X_t psiconv_read_X(const psiconv_buffer buf, int lev, | 48 | extern psiconv_X_t psiconv_read_X(const psiconv_buffer buf, int lev, | 
| 64 | psiconv_u32 off, int *length); | 49 | psiconv_u32 off, int *length, int *status); | 
| 65 | extern psiconv_length_t psiconv_read_length(const psiconv_buffer buf, int lev, | 50 | extern psiconv_length_t psiconv_read_length(const psiconv_buffer buf, int lev, | 
| 66 | psiconv_u32 off, int *length); | 51 | psiconv_u32 off, int *length, | 
|  |  | 52 | int *status); | 
| 67 | extern psiconv_size_t psiconv_read_size (const psiconv_buffer buf, int lev, | 53 | extern psiconv_size_t psiconv_read_size (const psiconv_buffer buf, int lev, | 
| 68 | psiconv_u32 off, int *length); | 54 | psiconv_u32 off, int *length, | 
|  |  | 55 | int *status); | 
| 69 | extern psiconv_string_t psiconv_read_string(const psiconv_buffer buf,int lev, | 56 | extern psiconv_string_t psiconv_read_string(const psiconv_buffer buf,int lev, | 
| 70 | psiconv_u32 off,int *length); | 57 | psiconv_u32 off,int *length, | 
|  |  | 58 | int *status); | 
|  |  | 59 | extern psiconv_string_t psiconv_read_short_string(const psiconv_buffer buf, | 
|  |  | 60 | int lev,psiconv_u32 off, | 
|  |  | 61 | int *length,int *status); | 
| 71 |  | 62 |  | 
| 72 | extern int psiconv_parse_bool(const psiconv_buffer buf, int lev, | 63 | extern int psiconv_parse_bool(const psiconv_buffer buf, int lev, | 
| 73 | psiconv_u32 off, int *length, | 64 | psiconv_u32 off, int *length, | 
| 74 | psiconv_bool_t *result); | 65 | psiconv_bool_t *result); | 
| 75 |  | 66 |  | 
|  |  | 67 | extern psiconv_float_t psiconv_read_float(const psiconv_buffer buf, int lev, | 
|  |  | 68 | psiconv_u32 off, int *length, int *status); | 
|  |  | 69 |  | 
|  |  | 70 |  | 
| 76 |  | 71 |  | 
| 77 | /* ****************** | 72 | /* ****************** | 
| 78 | * parse_layout.c * | 73 | * parse_layout.c * | 
| 79 | ****************** */ | 74 | ****************** */ | 
| 80 |  | 75 |  | 
| … |  | … |  | 
| 95 | psiconv_bullet *result); | 90 | psiconv_bullet *result); | 
| 96 |  | 91 |  | 
| 97 | extern int psiconv_parse_tab(const psiconv_buffer buf, int lev, | 92 | extern int psiconv_parse_tab(const psiconv_buffer buf, int lev, | 
| 98 | psiconv_u32 off, int *length, | 93 | psiconv_u32 off, int *length, | 
| 99 | psiconv_tab *result); | 94 | psiconv_tab *result); | 
|  |  | 95 |  | 
|  |  | 96 | /* Note: the next two are special, because they modify an existing | 
|  |  | 97 | layout structure! If it exits due to an unexpected error, part | 
|  |  | 98 | of the structure may be modified, but it is still safe to call | 
|  |  | 99 | psiconv_free_{paragraph,character}_layout_list on it (and that | 
|  |  | 100 | is the only safe thing to do!) */ | 
| 100 |  | 101 |  | 
| 101 | extern int psiconv_parse_paragraph_layout_list(const psiconv_buffer buf, | 102 | extern int psiconv_parse_paragraph_layout_list(const psiconv_buffer buf, | 
| 102 | int lev, psiconv_u32 off, int *length, | 103 | int lev, psiconv_u32 off, int *length, | 
| 103 | psiconv_paragraph_layout result); | 104 | psiconv_paragraph_layout result); | 
| 104 |  | 105 |  | 
| … |  | … |  | 
| 139 | extern int psiconv_parse_text_section(const psiconv_buffer buf,int lev, | 140 | extern int psiconv_parse_text_section(const psiconv_buffer buf,int lev, | 
| 140 | psiconv_u32 off, int *length, | 141 | psiconv_u32 off, int *length, | 
| 141 | psiconv_text_and_layout *result); | 142 | psiconv_text_and_layout *result); | 
| 142 |  | 143 |  | 
| 143 | extern int psiconv_parse_styled_layout_section(const psiconv_buffer buf, | 144 | extern int psiconv_parse_styled_layout_section(const psiconv_buffer buf, | 
| 144 | int lev,psiconv_u32 off, | 145 | int lev,psiconv_u32 off, | 
| 145 | int *length, | 146 | int *length, | 
| 146 | psiconv_text_and_layout result, | 147 | psiconv_text_and_layout result, | 
| 147 | psiconv_word_styles_section styles); | 148 | const psiconv_word_styles_section styles); | 
| 148 | extern int psiconv_parse_styleless_layout_section(const psiconv_buffer buf, | 149 | extern int psiconv_parse_styleless_layout_section(const psiconv_buffer buf, | 
| 149 | int lev,psiconv_u32 off, | 150 | int lev,psiconv_u32 off, | 
| 150 | int *length, | 151 | int *length, | 
| 151 | psiconv_text_and_layout result, | 152 | psiconv_text_and_layout result, | 
| 152 | psiconv_character_layout base_char, | 153 | const psiconv_character_layout base_char, | 
| 153 | psiconv_paragraph_layout base_para); | 154 | const psiconv_paragraph_layout base_para); | 
| 154 |  | 155 |  | 
| 155 |  | 156 |  | 
| 156 | /* ****************** | 157 | /* ****************** | 
| 157 | * parse_texted.c * | 158 | * parse_texted.c * | 
| 158 | ****************** */ | 159 | ****************** */ | 
| … |  | … |  | 
| 176 | psiconv_u32 off, int *length, | 177 | psiconv_u32 off, int *length, | 
| 177 | psiconv_word_styles_section *result); | 178 | psiconv_word_styles_section *result); | 
| 178 |  | 179 |  | 
| 179 |  | 180 |  | 
| 180 | /* ***************** | 181 | /* ***************** | 
|  |  | 182 | * parse_sheet.c * | 
|  |  | 183 | ***************** */ | 
|  |  | 184 |  | 
|  |  | 185 | extern int psiconv_parse_sheet_status_section(const psiconv_buffer buf, int lev, | 
|  |  | 186 | psiconv_u32 off, int *length, | 
|  |  | 187 | psiconv_sheet_status_section *result); | 
|  |  | 188 |  | 
|  |  | 189 | extern int psiconv_parse_sheet_formula_list(const psiconv_buffer buf, int lev, | 
|  |  | 190 | psiconv_u32 off, int *length, | 
|  |  | 191 | psiconv_formula_list *result); | 
|  |  | 192 |  | 
|  |  | 193 | extern int psiconv_parse_formula(const psiconv_buffer buf, int lev, | 
|  |  | 194 | psiconv_u32 off, int *length, | 
|  |  | 195 | psiconv_formula *result); | 
|  |  | 196 |  | 
|  |  | 197 | extern int psiconv_parse_sheet_workbook_section(const psiconv_buffer buf, | 
|  |  | 198 | int lev, | 
|  |  | 199 | psiconv_u32 off, int *length, | 
|  |  | 200 | psiconv_sheet_workbook_section *result); | 
|  |  | 201 | extern int psiconv_parse_sheet_cell(const psiconv_buffer buf, int lev, | 
|  |  | 202 | psiconv_u32 off, int *length, | 
|  |  | 203 | psiconv_sheet_cell *result, | 
|  |  | 204 | const psiconv_sheet_cell_layout default_layout, | 
|  |  | 205 | const psiconv_sheet_line_list row_default_layouts, | 
|  |  | 206 | const psiconv_sheet_line_list col_default_layouts); | 
|  |  | 207 |  | 
|  |  | 208 | extern int psiconv_parse_sheet_cell_list(const psiconv_buffer buf, int lev, | 
|  |  | 209 | psiconv_u32 off, int *length, | 
|  |  | 210 | psiconv_sheet_cell_list *result, | 
|  |  | 211 | const psiconv_sheet_cell_layout default_layout, | 
|  |  | 212 | const psiconv_sheet_line_list row_default_layouts, | 
|  |  | 213 | const psiconv_sheet_line_list col_default_layouts); | 
|  |  | 214 | extern int psiconv_parse_sheet_worksheet_list( const psiconv_buffer buf, | 
|  |  | 215 | int lev, | 
|  |  | 216 | psiconv_u32 off, int *length, | 
|  |  | 217 | psiconv_sheet_worksheet_list *result); | 
|  |  | 218 | extern int psiconv_parse_sheet_worksheet(const psiconv_buffer buf, int lev, | 
|  |  | 219 | psiconv_u32 off, int *length, | 
|  |  | 220 | psiconv_sheet_worksheet *result); | 
|  |  | 221 | extern int psiconv_parse_sheet_numberformat(const psiconv_buffer buf, int lev, | 
|  |  | 222 | psiconv_u32 off, int *length, | 
|  |  | 223 | psiconv_sheet_numberformat result); | 
|  |  | 224 | extern int psiconv_parse_sheet_cell_layout(const psiconv_buffer buf, int lev, | 
|  |  | 225 | psiconv_u32 off, int *length, | 
|  |  | 226 | psiconv_sheet_cell_layout result); | 
|  |  | 227 | extern int psiconv_parse_sheet_line(const psiconv_buffer buf, int lev, | 
|  |  | 228 | psiconv_u32 off, int *length, | 
|  |  | 229 | psiconv_sheet_line *result, | 
|  |  | 230 | const psiconv_sheet_cell_layout default_layout); | 
|  |  | 231 | extern int psiconv_parse_sheet_line_list(const psiconv_buffer buf, int lev, | 
|  |  | 232 | psiconv_u32 off, int *length, | 
|  |  | 233 | psiconv_sheet_line_list *result, | 
|  |  | 234 | const psiconv_sheet_cell_layout default_layout); | 
|  |  | 235 | extern int psiconv_parse_sheet_name_section(const psiconv_buffer buf, int lev, | 
|  |  | 236 | psiconv_u32 off, int *length, | 
|  |  | 237 | psiconv_sheet_name_section *result); | 
|  |  | 238 | extern int psiconv_parse_sheet_info_section(const psiconv_buffer buf, int lev, | 
|  |  | 239 | psiconv_u32 off, int *length, | 
|  |  | 240 | psiconv_sheet_info_section *result); | 
|  |  | 241 | extern int psiconv_parse_sheet_variable(const psiconv_buffer buf, int lev, | 
|  |  | 242 | psiconv_u32 off, int *length, | 
|  |  | 243 | psiconv_sheet_variable *result); | 
|  |  | 244 | extern int psiconv_parse_sheet_variable_list(const psiconv_buffer buf, int lev, | 
|  |  | 245 | psiconv_u32 off, int *length, | 
|  |  | 246 | psiconv_sheet_variable_list *result); | 
|  |  | 247 | extern int psiconv_parse_sheet_grid_section(const psiconv_buffer buf, int lev, | 
|  |  | 248 | psiconv_u32 off, int *length, | 
|  |  | 249 | psiconv_sheet_grid_section *result); | 
|  |  | 250 | extern int psiconv_parse_sheet_grid_size_list(const psiconv_buffer buf, int lev, | 
|  |  | 251 | psiconv_u32 off, int *length, | 
|  |  | 252 | psiconv_sheet_grid_size_list *result); | 
|  |  | 253 | extern int psiconv_parse_sheet_grid_size(const psiconv_buffer buf, int lev, | 
|  |  | 254 | psiconv_u32 off, int *length, | 
|  |  | 255 | psiconv_sheet_grid_size *result); | 
|  |  | 256 | extern int psiconv_parse_sheet_grid_break_list(const psiconv_buffer buf, | 
|  |  | 257 | int lev, psiconv_u32 off, int *length, | 
|  |  | 258 | psiconv_sheet_grid_break_list *result); | 
|  |  | 259 |  | 
|  |  | 260 |  | 
|  |  | 261 |  | 
|  |  | 262 |  | 
|  |  | 263 | /* ***************** | 
| 181 | * parse_image.c * | 264 | * parse_image.c * | 
| 182 | ***************** */ | 265 | ***************** */ | 
| 183 |  | 266 |  | 
| 184 | extern int psiconv_parse_paint_data_section(const psiconv_buffer buf,int lev, | 267 | extern int psiconv_parse_paint_data_section(const psiconv_buffer buf,int lev, | 
| 185 | psiconv_u32 off, int *length, | 268 | psiconv_u32 off, int *length, | 
|  |  | 269 | int isclipart, | 
| 186 | psiconv_paint_data_section *result); | 270 | psiconv_paint_data_section *result); | 
| 187 |  | 271 |  | 
| 188 | extern int psiconv_parse_mbm_jumptable_section(const psiconv_buffer buf,int lev, | 272 | extern int psiconv_parse_jumptable_section(const psiconv_buffer buf,int lev, | 
| 189 | psiconv_u32 off, int *length, | 273 | psiconv_u32 off, int *length, | 
| 190 | psiconv_mbm_jumptable_section *result); | 274 | psiconv_jumptable_section *result); | 
| 191 | extern int psiconv_parse_sketch_section(const psiconv_buffer buf, int lev, | 275 | extern int psiconv_parse_sketch_section(const psiconv_buffer buf, int lev, | 
| 192 | psiconv_u32 off, int *length, int is_object, | 276 | psiconv_u32 off, int *length, int is_object, | 
| 193 | psiconv_sketch_section *result); | 277 | psiconv_sketch_section *result); | 
|  |  | 278 | extern int psiconv_parse_clipart_section(const psiconv_buffer buf, int lev, | 
|  |  | 279 | psiconv_u32 off, int *length, | 
|  |  | 280 | psiconv_clipart_section *result); | 
|  |  | 281 |  | 
| 194 |  | 282 |  | 
| 195 |  | 283 |  | 
| 196 |  | 284 |  | 
| 197 |  | 285 |  | 
| 198 | /* **************** | 286 | /* **************** | 
| … |  | … |  | 
| 211 | extern int psiconv_parse_sketch_file(const psiconv_buffer buf,int lev, | 299 | extern int psiconv_parse_sketch_file(const psiconv_buffer buf,int lev, | 
| 212 | psiconv_u32 off, psiconv_sketch_f *result); | 300 | psiconv_u32 off, psiconv_sketch_f *result); | 
| 213 |  | 301 |  | 
| 214 | extern int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev, | 302 | extern int psiconv_parse_clipart_file(const psiconv_buffer buf,int lev, | 
| 215 | psiconv_u32 off, psiconv_clipart_f *result); | 303 | psiconv_u32 off, psiconv_clipart_f *result); | 
|  |  | 304 | extern int psiconv_parse_sheet_file(const psiconv_buffer buf,int lev, | 
|  |  | 305 | psiconv_u32 off, psiconv_sheet_f *result); | 
|  |  | 306 |  | 
|  |  | 307 | #ifdef __cplusplus | 
|  |  | 308 | } | 
|  |  | 309 | #endif /* __cplusplus */ | 
| 216 |  | 310 |  | 
| 217 | #endif /* PSICONV_PARSE_ROUTINES_H */ | 311 | #endif /* PSICONV_PARSE_ROUTINES_H */ |