Mir 1.0
Mir application programming interface
Parser engine

Data Structures

struct  mir_arg_iter_t
 
struct  mir_defarg_t
 

Macros

#define MIR_AST_O(obj, ast, pool)
 
#define MIR_AST_A(obj, ast, pool)
 
#define MIR_AST_NA(name, obj, ast, pool)
 
#define mir_parse_mpi_synch(status, pp)   (mir_parse_mpi_synch_i(status,pp,0,NULL,NULL))
 
#define MIR_ARGITO_DIRECT   1
 
#define MIR_ARGITO_REVERSE   2
 
#define MIR_ARGITF_NORMAL   0x00000001
 
#define MIR_ARGITF_NAMED   0x00000002
 
#define MIR_DEFARG_MAXTYPES   25
 
#define MIR_DEFARGF_REQUIRED   0x00000001
 
#define MIR_DEFARGF_MULTIPLE   0x00000002
 

Typedefs

typedef struct mir_ast_t mir_ast_t
 
typedef struct mir_prsdata_t mir_prsdata_t
 
typedef struct mir_arg_iter_t mir_arg_iter_t
 
typedef struct mir_defarg_t mir_defarg_t
 

Functions

mir_ast_t * mir_ast_newast (int nodetype, void *obj, mir_ast_t *l, mir_ast_t *r, apr_pool_t *pool)
 Creates new AST node. More...
 
mir_ast_t * mir_ast_set (mir_ast_t *ast, int nodetype, void *obj, mir_ast_t *l, mir_ast_t *r)
 Set nodetype, object, l and r for ast. More...
 
mir_ast_t * mir_ast_newlocast (int nodetype, void *obj, char *inp_name, mirkl_uint32_t inp_line, mirkl_uint32_t inp_fcol, mirkl_uint32_t inp_lcol, mir_ast_t *l, mir_ast_t *r, apr_pool_t *pool)
 Creates new AST node. More...
 
mir_ast_t * mir_ast_traverse (mir_ast_t *a, mir_ast_t *prl, int flag, mir_prsdata_t *pp, apr_pool_t *pool)
 
unsigned int mir_ast_llist_count (mir_ast_t *a)
 
mir_ast_t * mir_ast_llist_last (mir_ast_t *ast)
 
mirkl_error_tmir_ast_llist_setfargs (mirkl_object_t *obj, mir_ast_t *args, mir_ast_t *vals, mir_prsdata_t *pp, apr_pool_t *tmp_pool)
 
void mir_ast_llist_walk (mir_ast_t *ast, void(*func)(mir_ast_t *, void *), void *args)
 
mirkl_error_tmir_ast_llist_walk_err_first (mir_ast_t *ast, mirkl_error_t *(*func)(mir_ast_t *, void *), void *args)
 
void mir_ast_pwalk (mir_ast_t *ast, void(*func)(mir_ast_t *, void *), void *args)
 
mirkl_error_tmir_ast_pwalk_err_first (mir_ast_t *ast, mirkl_error_t *(*func)(mir_ast_t *, void *), void *args)
 
void * mir_ast_arg_getobj (mir_ast_t *a)
 
void * mir_ast_arg_getobjn (mir_ast_t *a, int num, int *totnum)
 
void * mir_ast_arg_getobjnamen (mir_ast_t *a, int num, int *totnum, char **name)
 
unsigned int mir_ast_arg_num (mir_ast_t *a)
 
mirkl_error_tmir_ast_arg_walk_err_first (mir_ast_t *ast, mirkl_error_t *(*func)(mir_ast_t *, void *), void *args)
 
mirkl_error_tmir_mpisynch_code_register (int *newcode)
 
mirkl_error_tmir_mpisynch_code_deregister (int code)
 
mir_ast_t * mir_ast_newnarg (int nodetype, const char *name, void *obj, mir_ast_t *l, apr_pool_t *pool)
 
mirkl_error_tmir_parse_get_obj_from_path (const char *path, mirkl_object_t *start_scope, mirkl_object_t **retobj)
 
int mir_ast_check_args_types (mir_ast_t *args,...)
 
mir_session_t * mir_parse_get_sesh (mir_prsdata_t *pp)
 Returns session handler.
 
mirkl_error_tmir_parse_mpi_synch_i (int status, mir_prsdata_t *pp, int line, const char *file, const char *func)
 Returns MPI communicator.
 
int mir_ast_arg_iter_init (mir_arg_iter_t *it, mir_ast_t *a, int order, mirkl_uint32_t flags)
 
mir_ast_t * mir_ast_arg_iter_next (mir_arg_iter_t *it)
 
mirkl_error_tmir_arg_get_defined (mir_ast_t *ast, int arg_tot, const mir_defarg_t *defarg, mir_defarg_t *arg)
 

Variables

mir_ast_t * MirNilAast
 
mir_ast_t * MirNilOast
 
mir_ast_t * MirTrueOast
 
mir_ast_t * MirFalseOast
 

Detailed Description

Macro Definition Documentation

◆ MIR_ARGITF_NAMED

#define MIR_ARGITF_NAMED   0x00000002

Named arguments

◆ MIR_ARGITF_NORMAL

#define MIR_ARGITF_NORMAL   0x00000001

Types of arguments, which should be iterated. Normal arguments

◆ MIR_ARGITO_DIRECT

#define MIR_ARGITO_DIRECT   1

The order in which iteration of arguments is done. Left to right

◆ MIR_ARGITO_REVERSE

#define MIR_ARGITO_REVERSE   2

Right to left

◆ MIR_AST_A

#define MIR_AST_A (   obj,
  ast,
  pool 
)
Value:
do { \
(ast) = mir_ast_newast('A', (obj), (ast), NULL, (pool)); \
} while (0)
mir_ast_t * mir_ast_newast(int nodetype, void *obj, mir_ast_t *l, mir_ast_t *r, apr_pool_t *pool)
Creates new AST node.

Macro to create L-list AST, containing objects. Used in implementations of methods for returning lists of objects or for creating lists of arguments.

◆ MIR_AST_NA

#define MIR_AST_NA (   name,
  obj,
  ast,
  pool 
)
Value:
do { \
(ast) = mir_ast_newnarg('A', (name), (obj), (ast), (pool)); \
} while (0)

◆ MIR_AST_O

#define MIR_AST_O (   obj,
  ast,
  pool 
)
Value:
do { \
if(!(ast)) { \
(ast) = mir_ast_newast('O', (obj), NULL, NULL, (pool)); \
} \
else { \
(ast) = mir_ast_set((ast), 'O', (obj), NULL, NULL); \
} \
} while (0)
mir_ast_t * mir_ast_set(mir_ast_t *ast, int nodetype, void *obj, mir_ast_t *l, mir_ast_t *r)
Set nodetype, object, l and r for ast.

Macro to create O-type single AST. Used in implementations of methods.

◆ MIR_DEFARG_MAXTYPES

#define MIR_DEFARG_MAXTYPES   25

Maximal number of types for argument. Up to now we did not need this to be large. We set this to a value, which is close to amount of different MIR_OBJDATA_..., but we can increase it if need.

◆ MIR_DEFARGF_MULTIPLE

#define MIR_DEFARGF_MULTIPLE   0x00000002

There can be more than one argument with respective data type(s).

◆ MIR_DEFARGF_REQUIRED

#define MIR_DEFARGF_REQUIRED   0x00000001

Required argument. Otherwise optional, if this flag is not set.

◆ mir_parse_mpi_synch

#define mir_parse_mpi_synch (   status,
  pp 
)    (mir_parse_mpi_synch_i(status,pp,0,NULL,NULL))

Wrapper macro to collect file&line and func information.

Function Documentation

◆ mir_ast_check_args_types()

int mir_ast_check_args_types ( mir_ast_t *  args,
  ... 
)

Checks types of arguments for methods/functions. For example mir_ast_check_args_types(args, MIR_OBJDATA_INT, MIR_OBJDATA_DOUBLE, MIR_OBJDATA_NULL). Last argument must be MIR_OBJDATA_NULL.

Returns
(0) if argument types correspond to input types. (> 0) if at least one argument does not correspond to input type. (-1) if there are less argument then input types.

◆ mir_ast_llist_walk()

void mir_ast_llist_walk ( mir_ast_t *  ast,
void(*)(mir_ast_t *, void *)  func,
void *  args 
)

Walk through left sides of AST from head to tail.

◆ mir_ast_llist_walk_err_first()

mirkl_error_t * mir_ast_llist_walk_err_first ( mir_ast_t *  ast,
mirkl_error_t *(*)(mir_ast_t *, void *)  func,
void *  args 
)

Walk through left sides of AST from head to tail. Stop if func returns error and return this error.

◆ mir_ast_newast()

mir_ast_t * mir_ast_newast ( int  nodetype,
void *  obj,
mir_ast_t *  l,
mir_ast_t *  r,
apr_pool_t *  pool 
)

Creates new AST node.

Parameters
nodetypeType of new node.
objReference to the data in the new node.
lLeft child node.
rRight child node.
poolThe pool to allocate new node.
Returns
Reference to the created node.

◆ mir_ast_newlocast()

mir_ast_t * mir_ast_newlocast ( int  nodetype,
void *  obj,
char *  inp_name,
mirkl_uint32_t  inp_line,
mirkl_uint32_t  inp_fcol,
mirkl_uint32_t  inp_lcol,
mir_ast_t *  l,
mir_ast_t *  r,
apr_pool_t *  pool 
)

Creates new AST node.

Similar to mir_ast_newast but with possibility to indicate name of input source, line number, first and last positions in the line.

◆ mir_ast_pwalk()

void mir_ast_pwalk ( mir_ast_t *  ast,
void(*)(mir_ast_t *, void *)  func,
void *  args 
)

Walk through parents of AST (from tail to head).

◆ mir_ast_pwalk_err_first()

mirkl_error_t * mir_ast_pwalk_err_first ( mir_ast_t *  ast,
mirkl_error_t *(*)(mir_ast_t *, void *)  func,
void *  args 
)

Walk through parents of AST (from tail to head). Stop if func returns error and return this error.

◆ mir_ast_set()

mir_ast_t * mir_ast_set ( mir_ast_t *  ast,
int  nodetype,
void *  obj,
mir_ast_t *  l,
mir_ast_t *  r 
)

Set nodetype, object, l and r for ast.

Returns
Returns the same ast as was on input.

◆ mir_parse_get_obj_from_path()

mirkl_error_t * mir_parse_get_obj_from_path ( const char *  path,
mirkl_object_t *  start_scope,
mirkl_object_t **  retobj 
)

Finds object by name of variable in the path of type [::]Scope1[::Scope2[...]]::Object

Parameters
[in]pathIf it starts with :: then the starting scope is always MirMainObjext.
[in]start_scopeThe searching starts from this object, unless the path has intial "::".
[out]retobjHopefully found object.
Returns
Error in case of wrong input data or non-existend variables/objects.

Variable Documentation

◆ MirFalseOast

mir_ast_t* MirFalseOast
extern

False object in AST of type 'O'

◆ MirNilAast

mir_ast_t* MirNilAast
extern

Nil Object in AST of type 'A'

◆ MirNilOast

mir_ast_t* MirNilOast
extern

Nil Object in AST of type 'O'

◆ MirTrueOast

mir_ast_t* MirTrueOast
extern

True object in AST of type 'O'