OpenScop
0.9.0
|
#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>
#include <osl/extensions/arrays.h>
Go to the source code of this file.
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 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_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 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().
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 571 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 146 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 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.
[in] | generic | The 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.
[in] | x | The generic structure to test. |
[in] | URI | The URI value to test. |
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.
[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 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.
[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 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.
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().
int osl_generic_number | ( | osl_generic_p | generic | ) |
osl_generic_number function: this function returns the number of statements in the generic list provided as parameter.
[in] | generic | The first element of 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.
[in] | file | File where the information has to be printed. |
[in] | generic | The 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)
[in] | file | File where the information has to be printed. |
[in] | generic | The 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.
[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 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.
[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 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
[in] | list | Address of a generic list |
[in] | URI | Pointer 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
[in] | list | Address of a generic list |
[in] | generic | Pointer 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.
[in] | data | Data to put in the generic shell. |
[in] | interface | Interface to put in the generic shell. |
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.
[in] | generic | The generic structure which has to be printed. |
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.
[in,out] | input | The input string where to find a list of generic. Updated to the position after what has been read. |
[in] | registry | The list of known interfaces (others are ignored). |
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.
[in,out] | input | The input string where to find a generic. Updated to the position after what has been read. |
[in] | registry | The list of known interfaces (others are ignored). |
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().