#ifndef	V_NSL_H
#define	V_NSL_H

/*
 * The first position in array of variables reserved for exit code.
 */
#define EXIT_CODE_OFFSET    0

typedef struct nsl_var_entry_s
{
	char    *name;
	u32_t	offset; /* must be ordered, from EXIT_CODE_OFFSET+1 */
	char    *desc;
}   nsl_var_entry_t, *nsl_var_entry_p;

typedef struct nsl_const_entry_s
{
	char    *name;
	vec_t   value; /* must be ordered, from 0 */
	char    *desc;
}   nsl_const_entry_t, *nsl_const_entry_p;

typedef vboolean (V_CALL *nsl_unresolved_cb)
	(void_p arg,vhandle_t script,vec_p const_ret);

#ifdef	__cplusplus
extern "C" {
#endif	/* __cplusplus */
	vhandle_t	V_GLOBAL nslCreateFunctionGroup(nsl_var_entry_p extra_vars,
		nsl_const_entry_p constants,
		nsl_unresolved_cb unresolved,
		void_p unresolved_arg);
	vboolean	V_GLOBAL nslParseFunction(vhandle_t nslfg,vhandle_t lexer);
	vboolean	V_GLOBAL nslCreateExecutables(vhandle_t nslfg);
	vboolean	V_GLOBAL nslGetExecutable(vhandle_t nslfg,u32_t index,
		vp_stack_p *fn_ret,vec_p *var_pool_ret);
	/* NO error checking ! */
	vboolean	V_GLOBAL nslExecuteCompound(vp_stack_p body,vec_p var_pool);
	void		V_GLOBAL nslDestroyFunctionGroup(vhandle_t nslfg);
#ifdef	__cplusplus
}
#endif	/* __cplusplus */

#define	NSL_EXECUTE(fn,var_pool)	nslExecuteCompound(fn,var_pool)
#define	NSL_EXIT_CODE(var_pool)		((var_pool)[EXIT_CODE_OFFSET])

#endif	/* !V_NSL_H */
