| 1 | /* |
1 | /* |
| 2 | parse_layout.c - Part of psiconv, a PSION 5 file formats converter |
2 | parse_layout.c - Part of psiconv, a PSION 5 file formats converter |
| 3 | Copyright (c) 1999, 2000 Frodo Looijaard <frodol@dds.nl> |
3 | Copyright (c) 1999-2014 Frodo Looijaard <frodo@frodo.looijaard.name> |
| 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. |
| … | |
… | |
| 91 | fontlen = psiconv_read_u8(config,buf,lev+2,off,&res); |
91 | fontlen = psiconv_read_u8(config,buf,lev+2,off,&res); |
| 92 | if (res) |
92 | if (res) |
| 93 | goto ERROR2; |
93 | goto ERROR2; |
| 94 | len = 1; |
94 | len = 1; |
| 95 | |
95 | |
| 96 | (*result)->name = psiconv_read_charlist(config,buf,lev+2,off, fontlen-1,&res); |
96 | (*result)->name = psiconv_read_charlist(config,buf,lev+2,off+len, fontlen-1,&res); |
| 97 | if (res) |
97 | if (res) |
| 98 | goto ERROR2; |
98 | goto ERROR2; |
| 99 | len += fontlen - 1; |
99 | len += fontlen - 1; |
| 100 | |
100 | |
| 101 | (*result)->screenfont = psiconv_read_u8(config,buf,lev+2,off+len,&res); |
101 | (*result)->screenfont = psiconv_read_u8(config,buf,lev+2,off+len,&res); |
| … | |
… | |
| 233 | { |
233 | { |
| 234 | int res = 0; |
234 | int res = 0; |
| 235 | int len = 0; |
235 | int len = 0; |
| 236 | int leng; |
236 | int leng; |
| 237 | int bullet_length; |
237 | int bullet_length; |
| 238 | psiconv_u8 temp; |
|
|
| 239 | |
238 | |
| 240 | if (!(*result = malloc(sizeof(**result)))) |
239 | if (!(*result = malloc(sizeof(**result)))) |
| 241 | goto ERROR1; |
240 | goto ERROR1; |
| 242 | (*result)->on = psiconv_bool_true; |
241 | (*result)->on = psiconv_bool_true; |
| 243 | |
242 | |
| … | |
… | |
| 254 | if (res) |
253 | if (res) |
| 255 | goto ERROR2; |
254 | goto ERROR2; |
| 256 | len +=leng; |
255 | len +=leng; |
| 257 | |
256 | |
| 258 | psiconv_progress(config,lev+2,off+len,"Going to read bullet character"); |
257 | psiconv_progress(config,lev+2,off+len,"Going to read bullet character"); |
| 259 | temp = psiconv_read_u8(config,buf,lev+2,off+len,&res); |
|
|
| 260 | if (res) |
|
|
| 261 | goto ERROR2; |
|
|
| 262 | (*result)->character = psiconv_unicode_from_char(config,temp); |
258 | (*result)->character = psiconv_unicode_read_char(config,buf,lev+2, |
|
|
259 | off+len,&leng,&res); |
|
|
260 | if (res) |
|
|
261 | goto ERROR2; |
| 263 | psiconv_debug(config,lev+2,off+len,"Character: %02x",(*result)->character); |
262 | psiconv_debug(config,lev+2,off+len,"Character: %02x",(*result)->character); |
| 264 | len ++; |
263 | len += leng; |
| 265 | |
264 | |
| 266 | psiconv_progress(config,lev+2,off+len,"Going to read indent on/off"); |
265 | psiconv_progress(config,lev+2,off+len,"Going to read indent on/off"); |
| 267 | if ((res = psiconv_parse_bool(config,buf,lev+2,off+len,&leng,&(*result)->indent))) |
266 | if ((res = psiconv_parse_bool(config,buf,lev+2,off+len,&leng,&(*result)->indent))) |
| 268 | goto ERROR2; |
267 | goto ERROR2; |
| 269 | psiconv_debug(config,lev+2,off+len,"Indent on: %02x",(*result)->indent); |
268 | psiconv_debug(config,lev+2,off+len,"Indent on: %02x",(*result)->indent); |