Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

l_struct.h

Go to the documentation of this file.
00001 /*
00002 ===========================================================================
00003 Copyright (C) 1999-2005 Id Software, Inc.
00004 
00005 This file is part of Quake III Arena source code.
00006 
00007 Quake III Arena source code is free software; you can redistribute it
00008 and/or modify it under the terms of the GNU General Public License as
00009 published by the Free Software Foundation; either version 2 of the License,
00010 or (at your option) any later version.
00011 
00012 Quake III Arena source code is distributed in the hope that it will be
00013 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 GNU General Public License for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Foobar; if not, write to the Free Software
00019 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 ===========================================================================
00021 */
00022 
00023 /*****************************************************************************
00024  * name:        l_struct.h
00025  *
00026  * desc:        structure reading/writing
00027  *
00028  * $Archive: /source/code/botlib/l_struct.h $
00029  *
00030  *****************************************************************************/
00031 
00032 
00033 #define MAX_STRINGFIELD             80
00034 //field types
00035 #define FT_CHAR                     1           // char
00036 #define FT_INT                          2           // int
00037 #define FT_FLOAT                        3           // float
00038 #define FT_STRING                       4           // char [MAX_STRINGFIELD]
00039 #define FT_STRUCT                       6           // struct (sub structure)
00040 //type only mask
00041 #define FT_TYPE                     0x00FF  // only type, clear subtype
00042 //sub types
00043 #define FT_ARRAY                        0x0100  // array of type
00044 #define FT_BOUNDED                  0x0200  // bounded value
00045 #define FT_UNSIGNED                 0x0400
00046 
00047 //structure field definition
00048 typedef struct fielddef_s
00049 {
00050     char *name;                                     //name of the field
00051     int offset;                                     //offset in the structure
00052     int type;                                       //type of the field
00053     //type specific fields
00054     int maxarray;                                   //maximum array size
00055     float floatmin, floatmax;                   //float min and max
00056     struct structdef_s *substruct;          //sub structure
00057 } fielddef_t;
00058 
00059 //structure definition
00060 typedef struct structdef_s
00061 {
00062     int size;
00063     fielddef_t *fields;
00064 } structdef_t;
00065 
00066 //read a structure from a script
00067 int ReadStructure(source_t *source, structdef_t *def, char *structure);
00068 //write a structure to a file
00069 int WriteStructure(FILE *fp, structdef_t *def, char *structure);
00070 //writes indents
00071 int WriteIndent(FILE *fp, int indent);
00072 //writes a float without traling zeros
00073 int WriteFloat(FILE *fp, float value);
00074 
00075 

Generated on Thu Aug 25 12:37:13 2005 for Quake III Arena by  doxygen 1.3.9.1