#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <osl/macros.h>
#include <osl/util.h>
#include <osl/interface.h>
#include <osl/generic.h>
Go to the source code of this file.
Functions | |
void | osl_generic_idump (FILE *file, osl_generic_p generic, int level) |
void | osl_generic_dump (FILE *file, osl_generic_p generic) |
void | osl_generic_print (FILE *file, osl_generic_p generic) |
osl_generic_p | osl_generic_sread (char *string, osl_interface_p registry) |
osl_generic_p | osl_generic_read_one (FILE *file, osl_interface_p registry) |
osl_generic_p | osl_generic_read (FILE *file, osl_interface_p registry) |
void | osl_generic_add (osl_generic_p *list, osl_generic_p generic) |
osl_generic_p | osl_generic_malloc () |
void | osl_generic_free (osl_generic_p generic) |
osl_generic_p | osl_generic_clone (osl_generic_p generic) |
int | osl_generic_count (osl_generic_p x) |
int | osl_generic_equal (osl_generic_p x1, osl_generic_p x2) |
int | osl_generic_has_URI (osl_generic_p x, char *URI) |
void * | osl_generic_lookup (osl_generic_p x, char *URI) |
osl_generic_p | osl_generic_shell (void *data, osl_interface_p interface) |
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.
[in] | list | The list of generics to add a node (NULL if empty). |
[in] | generic | The generic list to add to the initial list. |
Definition at line 295 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(), and osl_scop_register_extension().
osl_generic_p osl_generic_clone | ( | osl_generic_p | generic | ) |
osl_generic_clone function: This function builds and returns a "hard copy" (not a pointer copy) of an osl_generic_t data structure.
[in] | generic | The pointer to the generic structure we want to clone. |
Definition at line 381 of file generic.c.
References osl_interface::clone, osl_generic::interface, osl_generic_add(), osl_generic_malloc(), osl_interface_clone(), and OSL_warning.
Referenced by osl_scop_clone(), and osl_statement_clone().
int osl_generic_count | ( | osl_generic_p | x | ) |
osl_generic_count function: this function counts the number of elements in the generic list provided as parameter (x) and returns this number.
[in] | x | The list of generics. |
Definition at line 412 of file generic.c.
References osl_generic::next.
Referenced by osl_generic_equal().
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).
[in] | file | File where the information has to be printed. |
[in] | generic | The generic structure to print. |
Definition at line 145 of file generic.c.
References osl_generic_idump().
int osl_generic_equal | ( | osl_generic_p | x1, | |
osl_generic_p | x2 | |||
) |
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.
[in] | x1 | The first generic structure. |
[in] | x2 | The second generic structure. |
Definition at line 433 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(), and osl_statement_equal().
void osl_generic_free | ( | osl_generic_p | generic | ) |
osl_generic_free function: This function frees the allocated memory for a generic structure.
[in] | generic | The pointer to the generic structure we want to free. |
Definition at line 348 of file generic.c.
References osl_interface::free, osl_generic::interface, osl_generic::next, osl_interface_free(), and OSL_warning.
Referenced by osl_scop_free(), and osl_statement_free().
int osl_generic_has_URI | ( | osl_generic_p | x, | |
char * | URI | |||
) |
osl_generic_has_URI function: this function returns 1 if the generic provided as parameter has a given URI, 0 other wise.
[in] | x | The generic structure to test. |
[in] | URI | The URI value to test. |
Definition at line 489 of file generic.c.
References osl_generic::interface, and osl_interface::URI.
Referenced by osl_generic_lookup(), osl_scop_print(), osl_statement_integrity_check(), and osl_statement_pprint().
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.
[in] | file | File where informations are printed. |
[in] | generic | The generic whose information has to be printed. |
[in] | level | Number of spaces before printing, for each line. |
Definition at line 88 of file generic.c.
References osl_interface_idump().
Referenced by osl_generic_dump(), osl_scop_idump(), and osl_statement_idump().
void* osl_generic_lookup | ( | osl_generic_p | x, | |
char * | 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.
[in] | x | The generic list where to search a given generic URI. |
[in] | URI | The URI of the generic we are looking for. |
Definition at line 510 of file generic.c.
References osl_generic::data, osl_generic::next, and osl_generic_has_URI().
Referenced by osl_generic_add(), osl_scop_print(), and osl_scop_register_extension().
osl_generic_p osl_generic_malloc | ( | ) |
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.
Definition at line 331 of file generic.c.
References OSL_malloc.
Referenced by osl_generic_clone(), osl_generic_read_one(), osl_generic_shell(), and osl_generic_sread().
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.
[in] | file | File where the information has to be printed. |
[in] | generic | The generic structure to print. |
Definition at line 157 of file generic.c.
Referenced by osl_scop_print(), and osl_statement_pprint().
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.
[in] | file | The input file where to read a list of data. |
[in] | registry | The list of known interfaces (others are ignored). |
Definition at line 271 of file generic.c.
References osl_generic_sread(), OSL_TAG_END_SCOP, and osl_util_read_uptotag().
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.
[in] | file | The input file where to read a list of data. |
[in] | registry | The list of known interfaces (others are ignored). |
Definition at line 230 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().
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.
[in] | data | Data to put in the generic shell. |
[in] | interface | Interface to put in the generic shell. |
Definition at line 530 of file generic.c.
References osl_generic_malloc(), and OSL_warning.
osl_generic_p osl_generic_sread | ( | char * | string, | |
osl_interface_p | registry | |||
) |
osl_generic_sread function: this function reads a list of generics from a string complying to the OpenScop textual format and a list of known interfaces. It returns a pointer to the corresponding list of generic structures.
[in] | string | The string where to read a list of data. |
[in] | registry | The list of known interfaces (others are ignored). |
Definition at line 194 of file generic.c.
References osl_interface::next, osl_generic_add(), osl_generic_malloc(), osl_interface_nclone(), osl_util_tag_content(), osl_interface::sread, osl_coordinates::start, and osl_interface::URI.
Referenced by osl_generic_read(), and osl_scop_register_extension().