Handles definition of entities, parsing them from entities.ufo. More...
Go to the source code of this file.
Data Structures | |
union | int_float_u |
struct | entityKeyRange_s |
struct | entityKeyDef_s |
struct | entityDef_s |
Defines | |
#define | ED_MAX_DEFS 64 |
#define | ED_ERROR -1 |
#define | ED_OK 1 |
#define | ED_OPTIONAL (1<<0) |
#define | ED_MANDATORY (1<<1) |
#define | ED_ABSTRACT (1<<2) |
#define | ED_TYPE_FLOAT (1<<3) |
#define | ED_TYPE_INT (1<<4) |
#define | ED_TYPE_STRING (1<<5) |
#define | ED_DEFAULT (1<<6) |
#define | ED_MODE_TYPE (1<<7) |
#define | ED_RANGE (1<<8) |
#define | ED_INSIST_POSITIVE (1<<9) |
#define | ED_CONCRETE (ED_OPTIONAL | ED_MANDATORY) |
#define | ED_KEY_TYPE (ED_TYPE_FLOAT | ED_TYPE_INT | ED_TYPE_STRING) |
Typedefs | |
typedef union int_float_u | int_float_tu |
typedef struct entityKeyRange_s | entityKeyRange_t |
typedef struct entityKeyDef_s | entityKeyDef_t |
typedef struct entityDef_s | entityDef_t |
Functions | |
int | ED_GetDefaultFloat (float *defaultBuf, const int n, const entityKeyDef_t *kd) |
gets the default value for the key | |
int | ED_GetDefaultInt (int *defaultBuf, const int n, const entityKeyDef_t *kd) |
gets the default value for the key | |
int | ED_GetDefaultString (char *defaultBuf, const size_t n, const entityKeyDef_t *kd) |
gets the default value for the key | |
int | ED_GetIntVector (const entityKeyDef_t *kd, int v[], const int n) |
parses a value from the definition | |
int | ED_Check (const char *classname, const char *key, const char *value) |
tests if a value string matches the type for this key. Also checks the value against the range, if one was defined. | |
int | ED_CheckKey (const entityKeyDef_t *kd, const char *value) |
as ED_Check, but where the entity and key are known, so takes different arguments. | |
const entityDef_t * | ED_GetEntityDef (const char *classname) |
searches for the parsed entity def by classname | |
const entityKeyDef_t * | ED_GetKeyDef (const char *classname, const char *keyname, const int abstract) |
searches for the parsed key def | |
const entityKeyDef_t * | ED_GetKeyDefEntity (const entityDef_t *ed, const char *keyname, const int abstract) |
searches for the parsed key def, when the entity def is known | |
int | ED_Parse (const char *data_p) |
const char * | ED_GetLastError (void) |
void | ED_Free (void) |
Variables | |
int | numEntityDefs |
entityDef_t | entityDefs [ED_MAX_DEFS+1] |
Handles definition of entities, parsing them from entities.ufo.
Definition in file entitiesdef.h.
#define ED_ABSTRACT (1<<2) |
flag and parse mode, radiant use exclusively, should not be in .map file as a key
Definition at line 42 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), ED_FindKeyDefInArray(), ED_GetKeyDefEntity(), ED_PairParsed(), and ED_ParseEntities().
#define ED_CONCRETE (ED_OPTIONAL | ED_MANDATORY) |
flags indicating that this is a real key for use in a map file
Definition at line 51 of file entitiesdef.h.
#define ED_DEFAULT (1<<6) |
Definition at line 46 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), and ED_PairParsed().
#define ED_ERROR -1 |
Definition at line 37 of file entitiesdef.h.
Referenced by Check_InfoStartAligned(), Check_InitEntityDefs(), CheckEntities(), ED_Check(), ED_ParseEntities(), and ED_ParseType().
#define ED_INSIST_POSITIVE (1<<9) |
the type insists that the values are unsigned
Definition at line 49 of file entitiesdef.h.
Referenced by ED_CheckNumericType(), ED_ParseType(), and ED_ProcessRanges().
#define ED_KEY_TYPE (ED_TYPE_FLOAT | ED_TYPE_INT | ED_TYPE_STRING) |
Definition at line 52 of file entitiesdef.h.
Referenced by ED_CheckKey(), and ED_ProcessRanges().
#define ED_MANDATORY (1<<1) |
flag and parse mode. for entityKeyDef_t flags. entities of this type are not valid without this key. also a parse mode
Definition at line 41 of file entitiesdef.h.
Referenced by CheckEntities(), ED_Block2Constant(), ED_Constant2Block(), ED_PairParsed(), and ED_ParseEntities().
#define ED_MAX_DEFS 64 |
Definition at line 35 of file entitiesdef.h.
Referenced by ED_Parse(), and ED_ParseEntities().
#define ED_MODE_TYPE (1<<7) |
flag parse mode indicating that a type is being parsed
Definition at line 47 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), and ED_PairParsed().
#define ED_OK 1 |
Definition at line 38 of file entitiesdef.h.
Referenced by ED_AllocEntityDef(), ED_AllocRange(), ED_CheckDefaultTypes(), ED_CheckKey(), ED_CheckNumber(), ED_CheckNumericType(), ED_CheckRange(), ED_GetDefaultFloat(), ED_GetDefaultInt(), ED_GetDefaultString(), ED_GetFloatVectorFromString(), ED_GetIntVector(), ED_GetIntVectorFromString(), ED_PairParsed(), ED_Parse(), ED_ParseEntities(), ED_ParseType(), and ED_ProcessRanges().
#define ED_OPTIONAL (1<<0) |
flag and parse mode
Definition at line 40 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), and ED_PairParsed().
#define ED_RANGE (1<<8) |
Definition at line 48 of file entitiesdef.h.
Referenced by ED_Block2Constant(), ED_Constant2Block(), and ED_PairParsed().
#define ED_TYPE_FLOAT (1<<3) |
Definition at line 43 of file entitiesdef.h.
Referenced by ED_CheckKey(), ED_CheckNumber(), ED_CheckNumericType(), ED_CheckRange(), ED_Constant2Type(), ED_GetDefaultFloat(), ED_ProcessRanges(), and ED_Type2Constant().
#define ED_TYPE_INT (1<<4) |
Definition at line 44 of file entitiesdef.h.
Referenced by ED_CheckKey(), ED_CheckNumber(), ED_CheckNumericType(), ED_CheckRange(), ED_Constant2Type(), ED_GetDefaultInt(), ED_ParseType(), ED_ProcessRanges(), and ED_Type2Constant().
#define ED_TYPE_STRING (1<<5) |
Definition at line 45 of file entitiesdef.h.
Referenced by ED_CheckKey(), ED_Constant2Type(), ED_ParseType(), ED_ProcessRanges(), and ED_Type2Constant().
typedef struct entityDef_s entityDef_t |
typedef struct entityKeyDef_s entityKeyDef_t |
typedef struct entityKeyRange_s entityKeyRange_t |
typedef union int_float_u int_float_tu |
int ED_Check | ( | const char * | classname, | |
const char * | key, | |||
const char * | value | |||
) |
tests if a value string matches the type for this key. Also checks the value against the range, if one was defined.
Definition at line 402 of file entitiesdef.c.
References ED_CheckKey(), ED_ERROR, and ED_GetKeyDef().
int ED_CheckKey | ( | const entityKeyDef_t * | kd, | |
const char * | value | |||
) |
as ED_Check, but where the entity and key are known, so takes different arguments.
Definition at line 417 of file entitiesdef.c.
References ED_CheckNumericType(), ED_KEY_TYPE, ED_OK, ED_RETURN_ERROR, ED_TEST_RETURN_ERROR, ED_TYPE_FLOAT, ED_TYPE_INT, ED_TYPE_STRING, and entityKeyDef_s::flags.
Referenced by CheckEntities(), ED_Check(), and ED_CheckDefaultTypes().
void ED_Free | ( | void | ) |
Definition at line 887 of file entitiesdef.c.
References entityDef_s::classname, entityKeyDef_s::defaultVal, entityKeyDef_s::desc, entityKeyRange_s::fArr, i, entityKeyRange_s::iArr, entityDef_s::keyDefs, entityKeyDef_s::name, numEntityDefs, entityDef_s::numKeyDefs, entityKeyDef_s::numRanges, entityKeyDef_s::ranges, and entityKeyRange_s::str.
Referenced by Check_Free().
int ED_GetDefaultFloat | ( | float * | defaultBuf, | |
const int | n, | |||
const entityKeyDef_t * | kd | |||
) |
gets the default value for the key
[in] | defaultBuf | the calling function is responsible for ensuring this buffer has enough space |
n | the number of floats the defaultBuf can hold | |
kd | the key definition to get the default for. |
Definition at line 230 of file entitiesdef.c.
References entityKeyDef_s::defaultVal, ED_GetFloatVectorFromString(), ED_OK, ED_PASS_ERROR, ED_TEST_RETURN_ERROR, ED_TYPE_FLOAT, and entityKeyDef_s::flags.
int ED_GetDefaultInt | ( | int * | defaultBuf, | |
const int | n, | |||
const entityKeyDef_t * | kd | |||
) |
gets the default value for the key
[in] | defaultBuf | the calling function is responsible for ensuring this buffer has enough space |
n | the number of ints the defaultBuf can hold | |
kd | the key definition to get the default for. |
Definition at line 248 of file entitiesdef.c.
References entityKeyDef_s::defaultVal, ED_GetIntVectorFromString(), ED_OK, ED_PASS_ERROR, ED_TEST_RETURN_ERROR, ED_TYPE_INT, and entityKeyDef_s::flags.
int ED_GetDefaultString | ( | char * | defaultBuf, | |
const size_t | n, | |||
const entityKeyDef_t * | kd | |||
) |
gets the default value for the key
[in] | defaultBuf | the calling function is responsible for ensuring this buffer has enough space |
n | the number of chars the defualtBuf can hold | |
kd | the key definition to get the default for. E |
Definition at line 442 of file entitiesdef.c.
References entityKeyDef_s::defaultVal, ED_OK, and ED_TEST_RETURN_ERROR.
const entityDef_t* ED_GetEntityDef | ( | const char * | classname | ) |
searches for the parsed entity def by classname
Definition at line 875 of file entitiesdef.c.
References entityDef_s::classname, lastErr, and entityDef_s::numKeyDefs.
Referenced by CheckEntities(), ED_GetKeyDef(), and ED_ParseEntities().
int ED_GetIntVector | ( | const entityKeyDef_t * | kd, | |
int | v[], | |||
const int | n | |||
) |
parses a value from the definition
kd | the key definition to parse from | |
[out] | v | the array of int to put the answer in it must have enough space for n elements. |
n | the number of elements expected in the vector |
Definition at line 265 of file entitiesdef.c.
References entityKeyDef_s::desc, ED_GetIntVectorFromString(), ED_OK, and ED_PASS_ERROR.
Referenced by Check_InfoStartAligned().
const entityKeyDef_t* ED_GetKeyDef | ( | const char * | classname, | |
const char * | keyname, | |||
const int | abstract | |||
) |
searches for the parsed key def
abstract | send abstract to find an abstract key with this name |
Definition at line 837 of file entitiesdef.c.
References ED_GetEntityDef(), and ED_GetKeyDefEntity().
Referenced by ED_Check().
const entityKeyDef_t* ED_GetKeyDefEntity | ( | const entityDef_t * | ed, | |
const char * | keyname, | |||
const int | abstract | |||
) |
searches for the parsed key def, when the entity def is known
abstract | send a nonzero value if the abstract (radiant - not in any block) version of the key is required |
Definition at line 849 of file entitiesdef.c.
References entityDef_s::classname, ED_ABSTRACT, entityKeyDef_s::flags, entityDef_s::keyDefs, lastErr, and entityKeyDef_s::name.
Referenced by Check_InfoStartAligned(), CheckEntities(), and ED_GetKeyDef().
const char* ED_GetLastError | ( | void | ) |
Definition at line 827 of file entitiesdef.c.
References lastErr.
Referenced by Check_InfoStartAligned(), Check_InitEntityDefs(), and CheckEntities().
int ED_Parse | ( | const char * | data_p | ) |
parses entity definitions from entities.ufo
Definition at line 798 of file entitiesdef.c.
References ED_CheckDefaultTypes(), ED_MAX_DEFS, ED_OK, ED_ParseEntities(), ED_PASS_ERROR, ED_ProcessRanges(), ED_TEST_RETURN_ERROR, lastErr, and numEntityDefs.
Referenced by Check_InitEntityDefs().
entityDef_t entityDefs[ED_MAX_DEFS+1] |
Definition at line 45 of file entitiesdef.c.
Referenced by Check_Stats().
int numEntityDefs |
Definition at line 44 of file entitiesdef.c.
Referenced by Check_InitEntityDefs(), Check_Stats(), ED_Free(), ED_Parse(), and ED_ParseEntities().