1 | /* |
1 | /* |
2 | parse_simple.c - Part of psiconv, a PSION 5 file formats converter |
2 | parse_simple.c - Part of psiconv, a PSION 5 file formats converter |
3 | Copyright (c) 1999, 2000 Frodo Looijaard <frodol@dds.nl> |
3 | Copyright (c) 1999-2004 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. |
… | |
… | |
114 | *length = localstatus?0:4; |
114 | *length = localstatus?0:4; |
115 | |
115 | |
116 | return localstatus?0:(temp & 0x7fffffff)*(temp&0x80000000?-1:1); |
116 | return localstatus?0:(temp & 0x7fffffff)*(temp&0x80000000?-1:1); |
117 | } |
117 | } |
118 | |
118 | |
119 | psiconv_S_t psiconv_read_S(const psiconv_config config,const psiconv_buffer buf, int lev, psiconv_u32 off, |
119 | psiconv_u32 psiconv_read_S(const psiconv_config config,const psiconv_buffer buf, int lev, psiconv_u32 off, |
120 | int *length,int *status) |
120 | int *length,int *status) |
121 | { |
121 | { |
122 | psiconv_u8 temp; |
122 | psiconv_u8 temp; |
123 | psiconv_S_t res; |
123 | psiconv_u32 res; |
124 | int len,localstatus; |
124 | int len,localstatus; |
125 | |
125 | |
126 | psiconv_progress(config,lev+1,off,"Going to read a S length indicator"); |
126 | psiconv_progress(config,lev+1,off,"Going to read a S length indicator"); |
127 | temp = psiconv_read_u8(config,buf,lev+2,off,&localstatus); |
127 | temp = psiconv_read_u8(config,buf,lev+2,off,&localstatus); |
128 | if (localstatus) |
128 | if (localstatus) |
… | |
… | |
162 | if (length) |
162 | if (length) |
163 | *length = 0; |
163 | *length = 0; |
164 | return 0; |
164 | return 0; |
165 | } |
165 | } |
166 | |
166 | |
167 | psiconv_X_t psiconv_read_X(const psiconv_config config,const psiconv_buffer buf, int lev, psiconv_u32 off, |
167 | psiconv_u32 psiconv_read_X(const psiconv_config config,const psiconv_buffer buf, int lev, psiconv_u32 off, |
168 | int *length, int *status) |
168 | int *length, int *status) |
169 | { |
169 | { |
170 | psiconv_u8 temp; |
170 | psiconv_u8 temp; |
171 | psiconv_X_t res; |
171 | psiconv_u32 res; |
172 | int len,localstatus; |
172 | int len,localstatus; |
173 | |
173 | |
174 | psiconv_progress(config,lev+1,off,"Going to read a X length indicator"); |
174 | psiconv_progress(config,lev+1,off,"Going to read a X length indicator"); |
175 | temp = psiconv_read_u8(config,buf,lev+2,off,&localstatus); |
175 | temp = psiconv_read_u8(config,buf,lev+2,off,&localstatus); |
176 | if (localstatus) |
176 | if (localstatus) |