/* xls2xml: Converts from Microsoft Excel files to XML. Copyright 1999 Roberto Arturo Tena Sanchez This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* Roberto Arturo Tena Sanchez */ #include #include #include /* 5 11 14=end of records 15 19 */ int get_next_record (COLEFILE * xlsfile) { U32 bytes; U16 b2; assert_return (xls2xml, xlsfile != NULL, 19); /* clean record */ parameters->record.opcode = parameters->record.size = 0; /* read opcode */ bytes = cole_fread (xlsfile, &b2, 2, NULL); if (bytes != 2) { if (cole_feof (xlsfile)) { if (parameters->dont_care_end) return 14; else return 5; } return 11; } parameters->record.opcode = _xls2xml_sreadU16 (((U8*)(&b2))); /* read size */ bytes = cole_fread (xlsfile, &b2, 2, NULL); if (bytes != 2) { if (cole_feof (xlsfile)) { if (parameters->dont_care_end) return 14; else return 5; } return 11; } parameters->record.size = _xls2xml_sreadU16 (((U8*)(&b2))); test (parameters->record.size <= MAX_RECORD_SIZE, 15); if (parameters->record.size > 0) { /* read info */ bytes = cole_fread (xlsfile, parameters->record.info, parameters->record.size, NULL); if (bytes != parameters->record.size) { if (cole_feof (xlsfile)) { if (parameters->dont_care_end) return 14; else return 5; } return 11; } } return 0; }