Miscellaneous

Documentatiton of miscellaneous functions present in verigen module.

Diagnostics

verigen.diag(lvl, *args, **kwargs)

Print diagnostics at specified verbosity (or severity) level.

The output diagnostics tries to resemble (more or less) the GCC output.

Severity levels
  • FATAL - fatal error, immediate exit
  • ERROR - translation or embedded script error
  • WARNING - translation warnings that require user attention
  • INFO - translation process info
  • DIAG - extra diagnostics for errors and warnings
  • TRACE - for debugging only
Parameters:
  • lvl (int) – verbosity or severity level.
  • args (list) – extra parameters passed as is to print function
  • file (str, keyword, optional) – related file name
  • line_no (int, keyword, optional) – related line coordinate
verigen.keep_short(string)

Make string shorter. Strip any newlines. Used by debug diagnostics

Parameters:string (str) – Input string.
Returns:Input or it’s shorter version.
Return type:str

Embedded code execution

verigen.execute_embedded(cmd, globals=None, locals=None, description='source string')

This function executes specified command cmd and returns content of the standard output.

Parameters:
  • cmd (str, required) – script to execute
  • globals (list, optional) – list of global variables passed to exec
  • locals (list, optional) – list of local variables passed to exec
  • description (str, optional) – description of executed code
Raises:

EmbeddedScriptError – when in-text script is ill-formed or cannot execute from other reasons