Eneboo - Documentación para desarrolladores
src/dbf/tables.h
Ir a la documentación de este archivo.
00001 /***********************************************************************************
00002  * tables.h
00003  ***********************************************************************************
00004  * describes table file header and table field descriptor array
00005  * for dBASE III PLUS, IV 2.0 and 5.0 for DOS/Windows
00006  *
00007  * Author: Bjoern Berg, clergyman@gmx.de
00008  * Version 0.3, August 2003
00009  *
00010  * History:
00011  * 2003-08-27   teterin,berg    changed unsigned integer values to u_int
00012  * 2003-01-21   berg                    added support for Alpha RISC systems (Cancelling 
00013  *                                                              datatype long, because AXP uses 8 Byte for long, 
00014  *                                                              i386 4 Byte -> incompatible)
00015  * 2002-09-22   berg                    added additional dBASE Header
00016  *                                                              support for dBASE IV 2.0, 5.0 DOS/Windows introduced
00017  * 2002-09-20   berg                    first implementation, split off dbf.c
00018  * 
00019  ************************************************************************************/
00020 
00021 #ifndef _DBF_TABLES_
00022 #define _DBF_TABLES_
00023 
00024 #ifdef __unix__   
00025    #include <sys/types.h>
00026    #ifndef __ANUBISNET_TYPES__
00027    #define __ANUBISNET_TYPES__
00028      typedef u_int16_t uint16_t;
00029      typedef u_int32_t uint32_t;
00030    #endif
00031 /*
00032  * Windows does not know UINT16 types, therefore we have to make an improvement
00033  * for 32 Bit systems. unsigned short is only verified to work properly on 32 Bit
00034  * systems.
00035  */
00036 #elif _WIN32
00037         #include <windows.h>
00038     #ifndef __ANUBISNET_TYPES__
00039     #define __ANUBISNET_TYPES__
00040       typedef UINT32 u_int32_t; 
00041       typedef unsigned short u_int16_t;
00042     #endif
00043 #else
00044    #include <sys/types.h>
00045 #endif
00046 
00047 
00048 /*
00049  * These defines are used to distinguish between types in the
00050  * dbf fields.
00051  */
00052 #define IS_STRING 1
00053 #define IS_NUMERIC 2
00054 
00055 /*
00056  * table file header
00057  * Standard dBASE Header
00058  * Additional dBASE Header FLAGS
00059  * Since version IV 2.0 dBASE has introduced new flags, like:
00060  * - incomplete transmission
00061  * - encryption
00062  * - mdx
00063  * - language
00064  * Offsets of this header are the same in all versions of dBASE
00065  */
00066 struct DB_HEADER {
00067         unsigned char version;                  /* Byte: 0; dBase version */
00068         unsigned char last_update[3];   /* Byte: 1-3; date of last update */
00069     //unsigned long records;            /* Byte: 4-7; number of records in table */
00070     unsigned int records;                       /* Byte: 4-7; number of records in table */
00071         u_int16_t header_length;                /* Byte: 8-9; number of bytes in the header */
00072         u_int16_t record_length;                /* Byte: 10-11; number of bytes in the record */
00073         unsigned char reserved01[2];    /* Byte: 12-13; reserved, see specification of dBase databases */
00074         unsigned char transaction;              /* Byte: 14; Flag indicating incomplete transaction */
00075         unsigned char encryption;               /* Byte: 15; Encryption Flag */
00076         unsigned char reserved02[12];   /* Byte: 16-27; reserved for dBASE in a multiuser environment*/
00077         unsigned char mdx;                              /* Byte: 28; Production MDX file flag */
00078         unsigned char language;                 /* Byte: 29; Language driver ID */
00079         unsigned char reserved03[2];    /* Byte: 30-31; reserved, filled with zero */
00080 };
00081 
00082 /* The field descriptor array */
00083 /* Offsets of this header are the same in all versions of dBASE */
00084 struct DB_FIELD {
00085         unsigned char field_name[11];   /* Byte: 0-10; fieldname in ASCII */
00086         unsigned char field_type;               /* Byte: 11; field type in ASCII (C, D, L, M or N) */
00087         //unsigned long field_adress;           /* Byte: 12-15; field data adress */
00088         u_int32_t field_adress;         /* Byte: 12-15; field data adress */
00089         unsigned char field_length;             /* Byte: 16; field length in binary */
00090         unsigned char field_decimals;   /* Byte: 17; field decimal count in binary */
00091         unsigned char reserved[13];             /* Byte: 18-30; reserved */
00092         unsigned char mdx;                              /* Byte: 31; Production MDX field flag */
00093 };
00094 
00095 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'