yumapro  20.10-14
YumaPro SDK
YANG Compiler Error Messages

Handle compiler error messages. More...

Collaboration diagram for YANG Compiler Error Messages:

Functions

status_t errmsg_init (void)
 Initialize this module; must be after ext_init!!! More...
 
void errmsg_cleanup (void)
 Cleanup this module; must be before ext_cleanup!!! More...
 
void errmsg_dict_init (void)
 Initialize this module. More...
 
void errmsg_dict_cleanup (void)
 Cleanup this module. More...
 
status_t errmsg_dict_insert (const xmlChar *lang, ncx_errmsg_t *errmsg)
 Add a list entry to the errmsg_dict. More...
 
ncx_errmsg_terrmsg_dict_find (const xmlChar *lang, status_t findres)
 Find a value node from the specified language tree. More...
 
void ncx_print_errormsg (tk_chain_t *tkc, ncx_module_t *mod, status_t res)
 Print an parse error message to STDOUT. More...
 
void ncx_print_errormsg_ex (tk_chain_t *tkc, ncx_module_t *mod, status_t res, const char *filename, uint32 linenum, boolean fineoln)
 Print an parse error message to STDOUT (Extended) More...
 
void ncx_conf_exp_err (tk_chain_t *tkc, status_t result, const char *expstr)
 Print an error for wrong token, expected a different token. More...
 
void ncx_mod_exp_err (tk_chain_t *tkc, ncx_module_t *mod, status_t result, const char *expstr)
 Print an error for wrong token, expected a different token. More...
 
void ncx_mod_missing_err (tk_chain_t *tkc, ncx_module_t *mod, const char *stmtstr, const char *expstr)
 Print an error for wrong token, mandatory sub-statement is missing. More...
 
ncx_errmsg_tncx_new_errmsg (status_t res, const xmlChar *str)
 Malloc and init an ncx_errmsg_t struct. More...
 
void ncx_free_errmsg (ncx_errmsg_t *msg)
 Clean and free an ncx_errmsg_t struct. More...
 
void obj_errmsg_clean (obj_template_t *obj)
 Clean the error messages within an object template. More...
 
status_t obj_errmsg_add (obj_template_t *obj, const xmlChar *basestr, obj_errmsg_t **ret_errmsg)
 Create a new obj_errmsg struct for the object. More...
 
status_t obj_errmsg_add_parm (obj_errmsg_t *errmsg, const xmlChar *parmstr)
 Add an errmsg parameter for the object. More...
 
status_t obj_errmsg_add_filter (obj_errmsg_t *errmsg, const xmlChar *parmstr, boolean is_errortag)
 Add an errmsg filter for the object. More...
 
status_t obj_errmsg_set_lang (obj_errmsg_t *errmsg, const xmlChar *langstr)
 Set the errmsg-lang for the errmsg. More...
 
status_t obj_errmsg_check_val (const xmlChar *error_tag, const xmlChar *error_app_tag, const xmlChar *error_lang, val_value_t *error_val, xmlChar **retmsg)
 Get the custom error message if any configured for the eror_val. More...
 
status_t obj_errmsg_test_val (const xmlChar *error_tag, const xmlChar *error_app_tag, const xmlChar *error_lang, val_value_t *error_val)
 Check if there needs to be a custom error msg. More...
 

Detailed Description

Handle compiler error messages.

Handles YANG extensions for errmsg:

Lower level error message support for server and compiler

    obj_errmsg_t
      obj_errmsg_parm_t
      obj_errmsg_filter_t

Function Documentation

◆ errmsg_cleanup()

void errmsg_cleanup ( void  )

Cleanup this module; must be before ext_cleanup!!!

Here is the caller graph for this function:

◆ errmsg_dict_cleanup()

void errmsg_dict_cleanup ( void  )

Cleanup this module.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ errmsg_dict_find()

ncx_errmsg_t* errmsg_dict_find ( const xmlChar *  lang,
status_t  findres 
)

Find a value node from the specified language tree.

This is an internal API used only by errmsg.c

Parameters
langlanguage code to use for the key
findresstatus number to search for this error message
Returns
pointer to errmsg_dict errmsg_dict found or NULL if not found
Here is the call graph for this function:

◆ errmsg_dict_init()

void errmsg_dict_init ( void  )

Initialize this module.

Here is the call graph for this function:

◆ errmsg_dict_insert()

status_t errmsg_dict_insert ( const xmlChar *  lang,
ncx_errmsg_t errmsg 
)

Add a list entry to the errmsg_dict.

Each tree represents the error messages for the specified language code

This is an internal API used only by errmsg.c

Parameters
langlanguage code key for this error message
errmsgerror message to insert in the tree for lang
Returns
status
Here is the call graph for this function:

◆ errmsg_init()

status_t errmsg_init ( void  )

Initialize this module; must be after ext_init!!!

Returns
status
Here is the call graph for this function:

◆ ncx_conf_exp_err()

void ncx_conf_exp_err ( tk_chain_t tkc,
status_t  result,
const char *  expstr 
)

Print an error for wrong token, expected a different token.

Parameters
tkctoken chain
resulterror code
expstrexpected token description
Here is the call graph for this function:

◆ ncx_free_errmsg()

void ncx_free_errmsg ( ncx_errmsg_t msg)

Clean and free an ncx_errmsg_t struct.

Parameters
msgstruct to clean and free

◆ ncx_mod_exp_err()

void ncx_mod_exp_err ( tk_chain_t tkc,
ncx_module_t mod,
status_t  result,
const char *  expstr 
)

Print an error for wrong token, expected a different token.

Parameters
tkctoken chain
modmodule in progress
resulterror code
expstrexpected token description
Here is the caller graph for this function:

◆ ncx_mod_missing_err()

void ncx_mod_missing_err ( tk_chain_t tkc,
ncx_module_t mod,
const char *  stmtstr,
const char *  expstr 
)

Print an error for wrong token, mandatory sub-statement is missing.

Parameters
tkctoken chain
modmodule in progress
stmtstrparent statement
expstrexpected sub-statement
Here is the call graph for this function:

◆ ncx_new_errmsg()

ncx_errmsg_t* ncx_new_errmsg ( status_t  res,
const xmlChar *  str 
)

Malloc and init an ncx_errmsg_t struct.

Create an error message str mapping for status res

Parameters
resstatus enum index
strconst string to point at
Returns
malloced and initialized struct; must free with ncx_free_errmsg

◆ ncx_print_errormsg()

void ncx_print_errormsg ( tk_chain_t tkc,
ncx_module_t mod,
status_t  res 
)

Print an parse error message to STDOUT.

Used by the YANG compiler to generate the formatted error line after log_error is called

Parameters
tkctoken chain (may be NULL)
modmodule in progress (may be NULL)
reserror status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_print_errormsg_ex()

void ncx_print_errormsg_ex ( tk_chain_t tkc,
ncx_module_t mod,
status_t  res,
const char *  filename,
uint32  linenum,
boolean  fineoln 
)

Print an parse error message to STDOUT (Extended)

Used by the YANG compiler to generate the formatted error line after log_error is called

Parameters
tkctoken chain (may be NULL)
modmodule in progress (may be NULL)
reserror status
filenamescript filespec
linenumscript file line number
fineolnTRUE if finish with a newline, FALSE if not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ obj_errmsg_add()

status_t obj_errmsg_add ( obj_template_t obj,
const xmlChar *  basestr,
obj_errmsg_t **  ret_errmsg 
)

Create a new obj_errmsg struct for the object.

Parameters
objobject to set errmsg
basestrbase error string
ret_errmsgaddress of return message
Return values
*ret_errmsgpoints to the created errmsg
Returns
status
Here is the call graph for this function:

◆ obj_errmsg_add_filter()

status_t obj_errmsg_add_filter ( obj_errmsg_t errmsg,
const xmlChar *  parmstr,
boolean  is_errortag 
)

Add an errmsg filter for the object.

Parameters
errmsgerror message control block to set
parmstrparameter string
is_errortagTRUE if error-tag; FALSE if error-app-tag
Returns
status
Here is the call graph for this function:

◆ obj_errmsg_add_parm()

status_t obj_errmsg_add_parm ( obj_errmsg_t errmsg,
const xmlChar *  parmstr 
)

Add an errmsg parameter for the object.

Parameters
errmsgobject error message to set
parmstrparameter string
Returns
status
Here is the call graph for this function:

◆ obj_errmsg_check_val()

status_t obj_errmsg_check_val ( const xmlChar *  error_tag,
const xmlChar *  error_app_tag,
const xmlChar *  error_lang,
val_value_t error_val,
xmlChar **  retmsg 
)

Get the custom error message if any configured for the eror_val.

Parameters
error_tagerror-tag value from error in progress
error_app_tagerror-app-tag value from error in progress (may be NULL)
error_langerrmsg-lang language code to use
error_valerror value node to check for errmsg config and use as the context node for any XPath eval
retmsgaddress of return address string
Return values
*retmsgmalloced string to use as the error-message must be freed with m__free()
Returns
status; ERR_NCX_SKIPPED if no custom error msg
Here is the call graph for this function:

◆ obj_errmsg_clean()

void obj_errmsg_clean ( obj_template_t obj)

Clean the error messages within an object template.

Parameters
objobject to check to clean
Here is the call graph for this function:
Here is the caller graph for this function:

◆ obj_errmsg_set_lang()

status_t obj_errmsg_set_lang ( obj_errmsg_t errmsg,
const xmlChar *  langstr 
)

Set the errmsg-lang for the errmsg.

Parameters
errmsgerror message control block to set
langstrlanguage code string
Returns
status
Here is the call graph for this function:

◆ obj_errmsg_test_val()

status_t obj_errmsg_test_val ( const xmlChar *  error_tag,
const xmlChar *  error_app_tag,
const xmlChar *  error_lang,
val_value_t error_val 
)

Check if there needs to be a custom error msg.

Parameters
error_tagerror-tag value from error in progress
error_app_tagerror-app-tag value from error in progress (may be NULL)
error_langerrmsg-lang language code to use
error_valerror value node to check for errmsg config and use as the context node for any XPath eval
Returns
status; ERR_NCX_SKIPPED if no custom error msg NO_ERR if there needs to be one
Here is the call graph for this function: