OpenScop  0.9.0
Data Structures | Typedefs | Functions
generic.h File Reference
#include <osl/interface.h>
Include dependency graph for generic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  osl_generic

Typedefs

typedef struct osl_generic osl_generic_t
typedef struct osl_genericosl_generic_p
typedef struct osl_generic const osl_const_generic_t
typedef struct osl_generic *const osl_generic_const_p
typedef struct osl_generic const * osl_const_generic_p
typedef struct osl_generic
const *const 
osl_const_generic_const_p

Functions

void osl_generic_idump (FILE *, osl_generic_p, int)
void osl_generic_dump (FILE *, osl_generic_p)
void osl_generic_print (FILE *, osl_generic_p)
char * osl_generic_sprint (osl_generic_p)
void osl_generic_print_options_scoplib (FILE *, osl_generic_p)
osl_generic_p osl_generic_sread (char **, osl_interface_p)
osl_generic_p osl_generic_sread_one (char **, osl_interface_p)
osl_generic_p osl_generic_read_one (FILE *, osl_interface_p)
osl_generic_p osl_generic_read (FILE *, osl_interface_p)
void osl_generic_add (osl_generic_p *, osl_generic_p)
void osl_generic_remove_node (osl_generic_p *, osl_generic_p)
void osl_generic_remove (osl_generic_p *, char *)
osl_generic_p osl_generic_malloc ()
void osl_generic_free (osl_generic_p)
int osl_generic_number (osl_generic_p)
osl_generic_p osl_generic_clone (osl_generic_p)
int osl_generic_equal (osl_generic_p, osl_generic_p)
int osl_generic_has_URI (osl_const_generic_const_p, char const *const)
void * osl_generic_lookup (osl_generic_p, char const *const)
osl_generic_p osl_generic_shell (void *, osl_interface_p)

Typedef Documentation

typedef struct osl_generic const* const osl_const_generic_const_p

Definition at line 91 of file generic.h.

typedef struct osl_generic const* osl_const_generic_p

Definition at line 90 of file generic.h.

typedef struct osl_generic const osl_const_generic_t

Definition at line 88 of file generic.h.

typedef struct osl_generic* const osl_generic_const_p

Definition at line 89 of file generic.h.

typedef struct osl_generic* osl_generic_p

Definition at line 87 of file generic.h.

typedef struct osl_generic osl_generic_t

Definition at line 86 of file generic.h.


Function Documentation

void osl_generic_add ( osl_generic_p list,
osl_generic_p  generic 
)

osl_generic_add function: this function adds a generic node (it may be a list as well) to a list of generics provided as parameter (list). The new node is inserted at the end of the list.

Parameters:
[in]listThe list of generics to add a node (NULL if empty).
[in]genericThe generic list to add to the initial list.

Definition at line 375 of file generic.c.

References osl_generic::interface, osl_generic::next, OSL_error, osl_generic_lookup(), and osl_interface::URI.

Referenced by osl_generic_clone(), osl_generic_sread(), osl_scop_register_extension(), and osl_statement_pread().

osl_generic_clone function: This function builds and returns a "hard copy" (not a pointer copy) of an osl_generic_t data structure.

Parameters:
[in]genericThe pointer to the generic structure we want to clone.
Returns:
A pointer to the clone of the input generic structure.

Definition at line 540 of file generic.c.

References osl_interface::clone, osl_generic_add(), osl_generic_malloc(), osl_interface_clone(), and OSL_warning.

Referenced by osl_scop_clone(), osl_statement_nclone(), and osl_symbols_nclone().

void osl_generic_dump ( FILE *  file,
osl_generic_p  generic 
)

osl_generic_dump function: this function prints the content of an osl_generic_t structure (*generic) into a file (file, possibly stdout).

Parameters:
[in]fileFile where the information has to be printed.
[in]genericThe generic structure to print.

Definition at line 146 of file generic.c.

References osl_generic_idump().

osl_generic_equal function: this function returns true if the two generic structures are the same, false otherwise. This functions considers two generic structures as equal independently of the order of the nodes.

Parameters:
[in]x1The first generic structure.
[in]x2The second generic structure.
Returns:
1 if x1 and x2 are the same (content-wise), 0 otherwise.

Definition at line 592 of file generic.c.

References osl_generic::data, osl_interface::equal, osl_generic::interface, osl_generic::next, osl_generic_count(), osl_interface_equal(), and OSL_warning.

Referenced by osl_scop_equal(), osl_statement_equal(), and osl_symbols_equal().

void osl_generic_free ( osl_generic_p  generic)

osl_generic_free function: This function frees the allocated memory for a generic structure.

Parameters:
[in]genericThe pointer to the generic structure we want to free.

Definition at line 489 of file generic.c.

References osl_interface::free, osl_generic::interface, osl_generic::next, osl_interface_free(), and OSL_warning.

Referenced by osl_generic_remove_node(), osl_scop_free(), osl_statement_free(), and osl_symbols_free().

int osl_generic_has_URI ( osl_const_generic_const_p  x,
char const *const  URI 
)

osl_generic_has_URI function: this function returns 1 if the generic provided as parameter has a given URI, 0 other wise.

Parameters:
[in]xThe generic structure to test.
[in]URIThe URI value to test.
Returns:
1 if x has the provided URI, 0 otherwise.

Definition at line 648 of file generic.c.

Referenced by osl_generic_lookup(), osl_generic_remove(), osl_scop_print(), and osl_scop_print_scoplib().

void osl_generic_idump ( FILE *  file,
osl_generic_p  generic,
int  level 
)

osl_generic_idump function: this function displays an osl_generic_t structure (*generic) into a file (file, possibly stdout) in a way that trends to be understandable. It includes an indentation level (level) in order to work with others idump functions.

Parameters:
[in]fileFile where informations are printed.
[in]genericThe generic whose information has to be printed.
[in]levelNumber of spaces before printing, for each line.

Definition at line 89 of file generic.c.

References osl_interface_idump().

Referenced by osl_generic_dump(), osl_scop_idump(), osl_statement_idump(), and osl_symbols_idump().

void* osl_generic_lookup ( osl_generic_p  x,
char const *const  URI 
)

osl_generic_lookup function: this function returns the first generic with a given URI in the generic list provided as parameter and NULL if it doesn't find such a generic.

Parameters:
[in]xThe generic list where to search a given generic URI.
[in]URIThe URI of the generic we are looking for.
Returns:
The first generic of the requested URI in the list.

Definition at line 669 of file generic.c.

References osl_generic::data, osl_generic::next, and osl_generic_has_URI().

Referenced by osl_generic_add(), osl_generic_print_options_scoplib(), osl_scop_print(), osl_scop_print_scoplib(), osl_scop_register_extension(), osl_statement_get_body(), osl_statement_integrity_check(), osl_statement_pprint(), and osl_statement_pprint_scoplib().

osl_generic_malloc function: This function allocates the memory space for an osl_generic_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.

Returns:
A pointer to an empty generic structure with fields set to default values.

Definition at line 472 of file generic.c.

References OSL_malloc.

Referenced by osl_generic_clone(), osl_generic_read_one(), osl_generic_shell(), and osl_generic_sread_one().

osl_generic_number function: this function returns the number of statements in the generic list provided as parameter.

Parameters:
[in]genericThe first element of the generic list.
Returns:
The number of statements in the generic list.

Definition at line 522 of file generic.c.

Referenced by osl_statement_pprint().

void osl_generic_print ( FILE *  file,
osl_generic_p  generic 
)

osl_generic_print function: this function prints the content of an osl_generic_t structure (*generic) into a string (returned) in the OpenScop format.

Parameters:
[in]fileFile where the information has to be printed.
[in]genericThe generic structure to print.

Definition at line 196 of file generic.c.

References osl_generic_sprint().

Referenced by osl_scop_print(), and osl_statement_pprint().

void osl_generic_print_options_scoplib ( FILE *  file,
osl_generic_p  generic 
)

osl_generic_print_options_scoplib function: this function prints the options sections (only arrays in the SCoPLib format)

Parameters:
[in]fileFile where the information has to be printed.
[in]genericThe generic structure to print.

Definition at line 214 of file generic.c.

References osl_arrays_sprint(), osl_generic_lookup(), and OSL_URI_ARRAYS.

Referenced by osl_scop_print_scoplib().

osl_generic_p osl_generic_read ( FILE *  file,
osl_interface_p  registry 
)

osl_generic_read function: this function reads a list of generics from a file (possibly stdin) complying to the OpenScop textual format and a list of known interfaces. It returns a pointer to the list of corresponding generic structures.

Parameters:
[in]fileThe input file where to read a list of data.
[in]registryThe list of known interfaces (others are ignored).
Returns:
A pointer to the generic information list that has been read.

Definition at line 350 of file generic.c.

References osl_generic_sread(), OSL_URI_SCOP, and osl_util_read_uptoendtag().

Referenced by osl_scop_pread().

osl_generic_p osl_generic_read_one ( FILE *  file,
osl_interface_p  registry 
)

osl_generic_read_one function: this function reads one generic from a file (possibly stdin) complying to the OpenScop textual format and a list of known interfaces. It returns a pointer to the corresponding generic structure. If no tag is found, an error is reported, in the case of an empty or closing tag name the function returns the NULL pointer.

Parameters:
[in]fileThe input file where to read a list of data.
[in]registryThe list of known interfaces (others are ignored).
Returns:
A pointer to the generic that has been read.

Definition at line 309 of file generic.c.

References OSL_debug, osl_generic_malloc(), osl_interface_lookup(), osl_interface_nclone(), osl_util_read_tag(), osl_util_read_uptoendtag(), OSL_warning, and osl_interface::sread.

Referenced by osl_scop_pread(), and osl_statement_pread().

void osl_generic_remove ( osl_generic_p list,
char *  URI 
)

osl_generic_remove function: given a URI, this function removes that generic from the list

Parameters:
[in]listAddress of a generic list
[in]URIPointer to the URI string

Definition at line 447 of file generic.c.

References osl_generic::next, osl_generic_has_URI(), and osl_generic_remove_node().

void osl_generic_remove_node ( osl_generic_p list,
osl_generic_p  generic 
)

osl_generic_remove_node function: this functions removes a given generic from a generic list

Parameters:
[in]listAddress of a generic list
[in]genericPointer to the generic to be removed Assumes a single node is to be removed.

Definition at line 409 of file generic.c.

References osl_generic::next, osl_generic_free(), and OSL_warning.

Referenced by osl_generic_remove().

osl_generic_p osl_generic_shell ( void *  data,
osl_interface_p  interface 
)

osl_generic_shell function: this function creates and returns a generic structure "shell" which embed the data and interface provided as parameters.

Parameters:
[in]dataData to put in the generic shell.
[in]interfaceInterface to put in the generic shell.
Returns:
A new generic structure containing the data and interface.

Definition at line 689 of file generic.c.

References osl_generic_malloc(), and OSL_warning.

char* osl_generic_sprint ( osl_generic_p  generic)

osl_generic_sprint function: this function prints the content of an osl_generic_t structure (*strings) into a string (returned) in the OpenScop textual format.

Parameters:
[in]genericThe generic structure which has to be printed.
Returns:
A string containing the OpenScop dump of the generic structure.

Definition at line 158 of file generic.c.

References OSL_malloc, OSL_MAX_STRING, and osl_util_safe_strcat().

Referenced by osl_generic_print(), and osl_symbols_sprint().

osl_generic_p osl_generic_sread ( char **  input,
osl_interface_p  registry 
)

osl_generic_sread function: this function reads a list of generic structure from a string complying to the OpenScop textual format and returns a pointer to this generic structure. The input parameter is updated to the position in the input string this function reach right after reading the generic structure.

Parameters:
[in,out]inputThe input string where to find a list of generic. Updated to the position after what has been read.
[in]registryThe list of known interfaces (others are ignored).
Returns:
A pointer to the generic information list that has been read.

Definition at line 243 of file generic.c.

References osl_generic_add(), and osl_generic_sread_one().

Referenced by osl_generic_read(), and osl_scop_register_extension().

osl_generic_p osl_generic_sread_one ( char **  input,
osl_interface_p  registry 
)

osl_generic_sread_one function: this function reads one generic structure from a string complying to the OpenScop textual format and returns a pointer to this generic structure. The input parameter is updated to the position in the input string this function reach right after reading the generic structure.

Parameters:
[in,out]inputThe input string where to find a generic. Updated to the position after what has been read.
[in]registryThe list of known interfaces (others are ignored).
Returns:
A pointer to the generic structure that has been read.

Definition at line 266 of file generic.c.

References OSL_debug, osl_generic_malloc(), osl_interface_lookup(), osl_interface_nclone(), osl_util_read_tag(), osl_util_read_uptoendtag(), OSL_warning, and osl_interface::sread.

Referenced by osl_generic_sread(), and osl_symbols_sread().