• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ie_impexp_Palm.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2001 AbiSource, Inc.
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00017  * 02110-1301 USA.
00018  */
00019 
00020 #ifndef IE_IMPEXP_PALM_H
00021 #define IE_IMPEXP_PALM_H
00022 
00023 #include <limits.h>
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 
00028 #include "ut_types.h"
00029 
00030 /*****************************************************************************
00031  *
00032  *  Define integral type Byte, Word, and DWord to match those on the
00033  *  Pilot being 8, 16, and 32 bits, respectively.
00034  *
00035  *****************************************************************************/
00036 
00037 typedef UT_uint8 Byte;
00038 typedef UT_uint16 Word;
00039 typedef UT_uint32 DWord;
00040 
00041 #define RECORD_SIZE_MAX 4096    /* Pilots have a fixed 4K record size */
00042 #define BUFFER_SIZE 4096
00043 #define COUNT_BITS  3
00044 #define DISP_BITS   11
00045 #define DOC_CREATOR "REAd"
00046 #define DOC_TYPE    "TEXt"
00047 
00048 /*****************************************************************************
00049  *
00050  *  PDB file header
00051  *
00052  *****************************************************************************/
00053 
00054 #define dmDBNameLength  32  /* 31 chars + 1 null terminator */
00055 
00056 typedef struct {        /* 78 bytes total */
00057     char    name[ dmDBNameLength ];
00058     Word    attributes;
00059     Word    version;
00060     DWord   create_time;
00061     DWord   modify_time;
00062     DWord   backup_time;
00063     DWord   modificationNumber;
00064     DWord   appInfoID;
00065     DWord   sortInfoID;
00066     char    type[4];
00067     char    creator[4];
00068     DWord   id_seed;
00069     DWord   nextRecordList;
00070     Word    numRecords;
00071 } pdb_header;
00072 
00073 /*
00074 ** Some compilers pad structures out to DWord boundaries so using sizeof()
00075 ** doesn't give the intended result.
00076 */
00077 #define PDB_HEADER_SIZE     78
00078 #define PDB_RECORD_HEADER_SIZE  8
00079 
00080 /*****************************************************************************
00081  *
00082  *  Doc record 0
00083  *
00084  *****************************************************************************/
00085 
00086 typedef struct {        /* 16 bytes total */
00087     Word    version;    /* 1 = plain text, 2 = compressed */
00088     Word    reserved1;
00089     DWord   doc_size;   /* in bytes, when uncompressed */
00090     Word    numRecords;     /* text rec's only; = pdb_header.numRecords-1 */
00091     Word    rec_size;   /* usually RECORD_SIZE_MAX */
00092     DWord   reserved2;
00093 } doc_record0;
00094 
00095 /*****************************************************************************
00096  *
00097  *  Globals
00098  *
00099  *****************************************************************************/
00100 
00101 typedef struct {
00102     Byte buf[BUFFER_SIZE];
00103     UT_uint32   len;
00104     UT_uint32   position;
00105 } buffer;
00106 
00107 #define PUT_Word(f,n)   {  Word n1 = _swap_Word ( n ); gsf_output_write(f, 2, (guint8*)&n1); }
00108 #define PUT_DWord(f,n)  { DWord n1 = _swap_DWord( n ); gsf_output_write(f, 4, (guint8*)&n1); }
00109 
00110 #define GET_Word(f,n)   { gsf_input_read( f, 2, (guint8*)&n ); n = _swap_Word ( n ); }
00111 #define GET_DWord(f,n)  { gsf_input_read( f, 4, (guint8*)&n ); n = _swap_DWord( n ); }
00112 
00113 #endif

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1