2011-10-31 19:04:16 +00:00
|
|
|
/**
|
|
|
|
* @file psyc/variable.h
|
|
|
|
*/
|
|
|
|
|
2011-11-28 13:00:41 +00:00
|
|
|
#ifndef PSYC_VARIABLE_H
|
|
|
|
#define PSYC_VARIABLE_H
|
|
|
|
|
|
|
|
#include "packet.h"
|
|
|
|
|
2011-10-31 19:04:16 +00:00
|
|
|
/// Routing variables in alphabetical order.
|
2012-01-09 10:52:09 +00:00
|
|
|
//extern const PsycString psyc_routing_vars[];
|
|
|
|
extern const PsycDictInt psyc_routing_vars[];
|
2011-10-31 19:04:16 +00:00
|
|
|
|
|
|
|
// Variable types in alphabetical order.
|
2011-11-01 11:06:58 +00:00
|
|
|
extern const PsycDictInt psyc_var_types[];
|
2011-10-31 19:04:16 +00:00
|
|
|
|
2011-11-30 12:51:50 +00:00
|
|
|
/// Method names in alphabetical order.
|
|
|
|
extern const PsycDictInt psyc_methods[];
|
|
|
|
|
2011-10-31 19:04:16 +00:00
|
|
|
extern const size_t psyc_routing_vars_num;
|
|
|
|
extern const size_t psyc_var_types_num;
|
2011-11-30 12:51:50 +00:00
|
|
|
extern const size_t psyc_methods_num;
|
2011-10-31 19:04:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this a routing variable name?
|
|
|
|
*/
|
2012-01-09 10:52:09 +00:00
|
|
|
static inline PsycBool
|
|
|
|
psyc_var_is_routing (const char *name, size_t len)
|
|
|
|
{
|
|
|
|
return (PsycBool) psyc_dict_lookup((PsycDict *)psyc_routing_vars,
|
|
|
|
psyc_routing_vars_num, name, len, PSYC_NO);
|
|
|
|
}
|
2011-10-31 19:04:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the type of variable name.
|
|
|
|
*/
|
2012-01-09 10:52:09 +00:00
|
|
|
static inline PsycType
|
|
|
|
psyc_var_type (const char *name, size_t len)
|
|
|
|
{
|
|
|
|
return (PsycType) psyc_dict_lookup((PsycDict *)psyc_var_types,
|
|
|
|
psyc_var_types_num, name, len, PSYC_YES);
|
|
|
|
}
|
2011-10-31 19:04:16 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this a list variable name?
|
|
|
|
*/
|
2011-11-11 21:18:24 +00:00
|
|
|
static inline PsycBool
|
|
|
|
psyc_var_is_list (const char *name, size_t len)
|
2011-10-31 19:04:16 +00:00
|
|
|
{
|
2011-11-11 21:18:24 +00:00
|
|
|
return len < 5 || memcmp(name, "_list", 5) != 0 || (len > 5 && name[5] != '_')
|
|
|
|
? PSYC_FALSE : PSYC_TRUE;
|
2011-10-31 19:04:16 +00:00
|
|
|
}
|
|
|
|
|
2011-11-28 13:00:41 +00:00
|
|
|
PsycMethod
|
2011-11-30 12:51:50 +00:00
|
|
|
psyc_method (char *method, size_t methodlen, PsycMethod *family, unsigned int *flag);
|
2011-11-28 13:00:41 +00:00
|
|
|
|
2011-10-31 19:04:16 +00:00
|
|
|
#endif
|