typedef struct et_built_in_var_s
{
	char    *var_name;
	int     var_offset;
	char    *var_desc;
}   et_built_in_var_t, *et_built_in_var_p;

typedef struct et_built_in_const_s
{
	char    *const_name;
	USL_REAL   const_value;
	char    *const_desc;
}   et_built_in_const_t, *et_built_in_const_p;

V_LOCAL et_built_in_var_t known_built_in_vars[] =
{
	{EXIT_CODE_NAME,EXIT_CODE_OFFSET,"exit code of last operator"},
	{NULL,-1,NULL}
};

V_LOCAL et_built_in_const_t known_built_in_consts[] =
{
	{"Pi",M_PI,"built-in: Pi"},
	{NULL,0,NULL}
};


int
etFirstBuiltInVariableOffset(void)
{
	et_built_in_var_p ptr = known_built_in_vars;
	if(ptr->var_name)
		return ptr->var_offset;
	return -1;
}

int
etLastBuiltInVariableOffset(void)
{
	et_built_in_var_p ptr = known_built_in_vars;
	if(!ptr->var_name)
		return -1;
	while(ptr->var_name)
		ptr++;
	ptr--;
	return ptr->var_offset;
}

vboolean
etFindBuiltInVariable(char *var_name,int *idx_ret)
{
	et_built_in_var_p ptr = known_built_in_vars;
	while(ptr->var_name)
	{
		if(STR_EQ(var_name,ptr->var_name))
		{
			if(idx_ret)
				*idx_ret = ptr->var_offset;
			return true;
		}
		ptr++;
	}
	return false;
}

vboolean
etFindBuiltInConstant(char *const_name,USL_REAL *const_ret)
{
	et_built_in_const_p ptr = known_built_in_consts;
	while(ptr->const_name)
	{
		if(STR_EQ(const_name,ptr->const_name))
		{
			if(const_ret)
				*const_ret = ptr->const_value;
			return true;
		}
		ptr++;
	}
	return false;
}

