ANML API

Modules

 ANML Parser Error Codes
 All functions within the ANML API, with the exception of AP_GetAnmlSchemaPath() and AP_CreateAnml(), return zero on success, a positive integer to indicate a warning, or a negative integer on error.
 
 ANML Port Constants
 

Data Structures

struct  ap_anml_element
 Element definition. More...
 
struct  ap_substitution_holder
 Holder for substituting parameters of a macro definition. More...
 
struct  ap_substitution_holder::ap_ste_substitution
 STE substitution. More...
 
struct  ap_substitution_holder::ap_counter_substitution
 Counter substitution. More...
 

Macros

#define AP_PORT_MAX   128
 The maximum number of ports for a macro definition.
 

Typedefs

typedef unsigned ap_anml_element_ref_t
 Opaque object for referencing an element in a dynamic graph.
 
typedef unsigned ap_port_ref_t
 Opaque object for referencing a macro definition port element in a dynamic graph.
 
typedef unsigned ap_macro_param_ref_t
 Opaque object for referencing a macro definition port parameter in a dynamic graph.
 
typedef struct ap_anml_objref * ap_anml_t
 Opaque object for storing the anml object.
 
typedef struct ap_anml_namespace_objref * ap_anml_namespace_t
 Opaque object for storing a macro definition or an automata network.
 
typedef ap_anml_namespace_t ap_macro_def_t
 Opaque object for storing a macro definition.
 
typedef ap_anml_namespace_t ap_anml_network_t
 Opaque object for storing a automata network.
 
typedef struct ap_anml_lib_objref * ap_anml_library_t
 Opaque object for storing an anml library.
 

Enumerations

enum  ap_start_type_t { NO_START = 0, START_OF_DATA = 1, ALL_INPUT = 2, PCRE_SOD = 3 }
 The starting types of an STE or regular expression element. More...
 
enum  ap_anml_namespace_type_t { , AP_ANML_AUTOMATA_NETWORK = 1, AP_ANML_MACRO_DEF = 2 }
 ANML Namespace object types. More...
 
enum  ap_port_type_t { PORT_IN = 0, PORT_OUT = 1, PORT_REPORT = 3 }
 I/O type of macro ports. More...
 

Functions

COMPILE_API ap_anml_t AP_CreateAnml (void)
 Create an ANML workspace and return a reference. More...
 
COMPILE_API int AP_DestroyAnml (ap_anml_t anml)
 Destroy an ANML workspace and free all internal resources. More...
 
COMPILE_API int AP_CompileAnml (ap_anml_t anml, ap_automaton_t *automaton, ap_element_map_t *element_map, ap_anml_element_ref_t *element_ref, ap_cbinfo_t *callback, unsigned options, int devfamily)
 Compile all elements in an ANML workspace into an automaton. More...
 
COMPILE_API int AP_CompileAnmlFiles (ap_automaton_t *automaton, ap_element_map_t *element_map, int *file_index, int *linenum, const char **files, unsigned file_count, ap_cbinfo_t *callback, unsigned options, int devfamily)
 Compile multiple ANML files into a single automaton. More...
 
COMPILE_API const char * AP_GetAnmlSchemaPath (void)
 Return the absolute path to the ANML schema. More...
 
COMPILE_API int AP_LoadAnmlObjects (ap_anml_t anml, int *linenum, const char *filename, ap_cbinfo_t *callback, unsigned options)
 Load an ANML file into the ANML workspace object. More...
 
COMPILE_API int AP_LoadAnmlMacro (ap_anml_t anml, ap_macro_def_t *anml_macro, int *linenum, const char *filename, ap_cbinfo_t *callback, unsigned options, const char *anml_schema_version)
 Load a single ANML Macro Definition file into the ANML workspace object and return the reference to the ANML macro object. More...
 
COMPILE_API int AP_LoadAnmlLibrary (ap_anml_t anml, ap_anml_library_t *anml_library, int *linenum, const char *filename, ap_cbinfo_t *callback, unsigned options)
 Load an ANML Library file into the ANML workspace object. More...
 
COMPILE_API int AP_LoadAnmlMacroInLibrary (ap_anml_library_t anml_library, ap_macro_def_t *anml_macro, int *linenum, const char *filename, ap_cbinfo_t *callback, unsigned options)
 Load a single ANML Macro Definition file into an ANML library and return the reference to the ANML macro object. More...
 
COMPILE_API int AP_GetAnmlObjectType (ap_anml_namespace_t anml_ns, ap_anml_namespace_type_t *ns_type)
 Get the type of an ANML namespace object. More...
 
COMPILE_API int AP_AddAnmlElement (ap_anml_namespace_t anml_ns, ap_anml_element_ref_t *element_ref, struct ap_anml_element *element)
 Add an AP element, either STE, Counter, Boolean, Regular Expression, or Macro reference to an Automata Network or Macro Definition. More...
 
COMPILE_API int AP_AddAnmlEdge (ap_anml_namespace_t anml_ns, ap_anml_element_ref_t src_element_ref, ap_anml_element_ref_t dst_element_ref, ap_port_ref_t dst_port_ref)
 Add an edge from the default output port of source element to the destination element input port. More...
 
COMPILE_API int AP_AddAnmlEdgeEx (ap_anml_namespace_t anml_ns, ap_anml_element_ref_t src_element_ref, ap_port_ref_t src_port_ref, ap_anml_element_ref_t dst_element_ref, ap_port_ref_t dst_port_ref)
 Extended version of AP_AddEdge(). More...
 
COMPILE_API int AP_GetAnmlIdFromObject (ap_anml_namespace_t anml_ns, char *anml_id, unsigned anml_id_length)
 Get an ANML object identifier. More...
 
COMPILE_API int AP_GetAnmlObjectFromId (ap_anml_t anml, ap_anml_namespace_t *anml_ns, const char *ns_id)
 Get an ANML namespace object from its string identifier. More...
 
COMPILE_API int AP_ExportAnml (ap_anml_namespace_t anml_ns, const char *filename, const char *basename)
 Export an ANML namespace object to an XML file. More...
 
COMPILE_API int AP_ExportAnmlLibrary (ap_anml_library_t anml_library, const char *filename, const char *basename)
 Export an ANML library object to an XML file. More...
 
COMPILE_API int AP_CreateAutomataNetwork (ap_anml_t anml, ap_anml_network_t *anml_net, const char *id)
 Create an empty automata network object and return an object reference. More...
 
COMPILE_API int AP_CreateMacroDef (ap_anml_t anml, ap_macro_def_t *macro_def, const char *id)
 Create an empty macro definition object and return an object reference. More...
 
COMPILE_API int AP_CreateAnmlLibrary (ap_anml_t anml, ap_anml_library_t *anml_library, const char *id)
 Create an empty anml library object and return an object reference. More...
 
COMPILE_API int AP_CreateMacroDefInLibrary (ap_anml_library_t anml_library, ap_macro_def_t *macro_def, const char *id)
 Create an empty macro definition object and return an object reference. More...
 
COMPILE_API int AP_AddMacroPort (ap_macro_def_t macro_def, ap_port_ref_t *port_ref, const char *port_id, ap_port_type_t port_type)
 Add a port to a macro definition. More...
 
COMPILE_API int AP_SetMacroPortLayoutPosition (ap_macro_def_t macro_def, ap_port_ref_t port_ref, unsigned x, unsigned y)
 Set the default AP Workbench layout position for a macro definition port. More...
 
COMPILE_API int AP_GetMacroPortFromId (ap_macro_def_t macro_def, ap_port_ref_t *port_ref, const char *port_id)
 Get a macro port reference from a string identifier. More...
 
COMPILE_API int AP_SetMacroPortInDegree (ap_macro_def_t macro_def, ap_port_ref_t port_ref, unsigned in_degree)
 Set port in-degree. More...
 
COMPILE_API int AP_AttachElementToPort (ap_macro_def_t macro_def, ap_port_ref_t port_ref, ap_anml_element_ref_t element_ref, ap_port_ref_t element_ref_port)
 Attach an element to a port. More...
 
COMPILE_API int AP_AddMacroParam (ap_macro_def_t macro_def, ap_macro_param_ref_t *param_ref, const char *param_name, ap_anml_element_ref_t element_ref)
 Add a parameter to a macro definition. More...
 
COMPILE_API int AP_AddMacroParamMulti (ap_macro_def_t macro_def, ap_macro_param_ref_t *param_ref, const char *param_name, ap_anml_element_ref_t *element_refs, unsigned element_refs_size)
 Add a parameter to a macro definition. More...
 
COMPILE_API int AP_GetMacroParamFromName (ap_macro_def_t macro_def, ap_macro_param_ref_t *param_ref, const char *param_name)
 Get a parameter reference from a parameter name in a macro definition. More...
 
COMPILE_API int AP_GetMacroParamSubstitutionHolder (ap_macro_def_t macro_def, struct ap_substitution_holder *holder, ap_macro_param_ref_t param_ref)
 Get a substitution holder from macro definition. More...
 
COMPILE_API int AP_SetMacroParamSubstitution (ap_anml_namespace_t anml_ns, ap_anml_element_ref_t macro_ref_element, const struct ap_substitution_holder *holder)
 Apply substitutions to a macro reference based on the substitution holder that was initialized by AP_GetMacroParamSubstitutionHolder(). More...
 
COMPILE_API int AP_SetMacroLayoutSize (ap_macro_def_t macro_def, unsigned width, unsigned height)
 Set the default AP Workbench layout size for a macro definition. More...
 
COMPILE_API int AP_SetMacroDefToBeCompiled (ap_macro_def_t macro_def)
 Flag a macro definition to be pre-compiled. More...
 
COMPILE_API int AP_CompileMacros (ap_anml_t anml, ap_macro_def_t *macro_def, ap_anml_element_ref_t *element_ref, ap_cbinfo_t *callback, unsigned options, int devfamily)
 Compile all of the macro definitions in the ANML object that have been flagged with AP_SetMacroDefToBeCompiled(). More...
 

Detailed Description

The programming interface for compiling ANML.

All functions within the ANML API, with the exception of AP_GetAnmlSchemaPath() and AP_CreateAnml(), return zero on success, a positive integer to indicate a warning, or a negative integer on error.

#include <micron/ap/ap_error.h>
#include <micron/ap/ap_element_map.h>
#include <micron/ap/ap_anml.h>