OpenScop
0.9.0
|
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <osl/macros.h>
#include <osl/util.h>
#include <osl/interface.h>
#include <osl/strings.h>
Go to the source code of this file.
Functions | |
void | osl_strings_idump (FILE *file, osl_strings_p strings, int level) |
void | osl_strings_dump (FILE *file, osl_strings_p strings) |
char * | osl_strings_sprint (osl_strings_p strings) |
void | osl_strings_print (FILE *file, osl_strings_p strings) |
osl_strings_p | osl_strings_sread (char **input) |
osl_strings_p | osl_strings_read (FILE *file) |
osl_strings_p | osl_strings_malloc () |
void | osl_strings_free (osl_strings_p strings) |
osl_strings_p | osl_strings_clone (osl_strings_p strings) |
size_t | osl_strings_find (osl_strings_p strings, char const *const string) |
void | osl_strings_add (osl_strings_p strings, char const *const string) |
int | osl_strings_equal (osl_strings_p s1, osl_strings_p s2) |
size_t | osl_strings_size (osl_const_strings_const_p strings) |
osl_strings_p | osl_strings_encapsulate (char *string) |
osl_interface_p | osl_strings_interface () |
osl_strings_p | osl_strings_generate (char *prefix, int nb_strings) |
void osl_strings_add | ( | osl_strings_p | strings, |
char const *const | string | ||
) |
osl_strings_add function. this function adds a copy of the string in the strings.
[in,out] | strings | The strings structure. |
[in] | string | The string to add in strings. |
Definition at line 368 of file strings.c.
References OSL_realloc, osl_strings_size(), and osl_strings::string.
osl_strings_p osl_strings_clone | ( | osl_strings_p | strings | ) |
osl_strings_clone function. this function builds and return a "hard copy" (not a pointer copy) of an strings structure provided as parameter.
[in] | strings | The strings structure to clone. |
Definition at line 327 of file strings.c.
References OSL_malloc, OSL_strdup, osl_strings_malloc(), osl_strings_size(), and osl_strings::string.
Referenced by osl_body_clone(), osl_names_clone(), osl_scatnames_clone(), and osl_strings_interface().
void osl_strings_dump | ( | FILE * | file, |
osl_strings_p | strings | ||
) |
osl_strings_dump function: this function prints the content of an osl_strings_t structure (*strings) into a file (file, possibly stdout).
[in] | file | The file where the information has to be printed. |
[in] | strings | The strings structure which has to be printed. |
Definition at line 119 of file strings.c.
References osl_strings_idump().
osl_strings_p osl_strings_encapsulate | ( | char * | string | ) |
osl_strings_encapsulate function: this function builds a new strings structure to encapsulate the string provided as a parameter (the reference to this string is used directly).
[in] | string | The string to encapsulate in a strings structure. |
Definition at line 431 of file strings.c.
References OSL_malloc, osl_strings_malloc(), and osl_strings::string.
Referenced by osl_body_sread().
int osl_strings_equal | ( | osl_strings_p | s1, |
osl_strings_p | s2 | ||
) |
osl_strings_equal function: this function returns true if the two strings structures are the same (content-wise), false otherwise.
[in] | s1 | The first strings structure. |
[in] | s2 | The second strings structure. |
Definition at line 385 of file strings.c.
References osl_strings_size(), and osl_strings::string.
Referenced by osl_body_equal(), osl_scatnames_equal(), and osl_strings_interface().
size_t osl_strings_find | ( | osl_strings_p | strings, |
char const *const | string | ||
) |
osl_strings_find function. this function finds the string in the strings.
[in,out] | strings | The strings structure. |
[in] | string | The string to find in strings. |
Definition at line 353 of file strings.c.
References osl_strings_size(), and osl_strings::string.
void osl_strings_free | ( | osl_strings_p | strings | ) |
osl_strings_free function: this function frees the allocated memory for a strings data structure.
[in] | strings | The strings structure we want to free. |
Definition at line 298 of file strings.c.
References osl_strings::string.
Referenced by osl_body_free(), osl_names_free(), osl_relation_read_type(), osl_scatnames_free(), osl_scop_pread(), osl_scop_print(), osl_scop_print_scoplib(), and osl_strings_interface().
osl_strings_p osl_strings_generate | ( | char * | prefix, |
int | nb_strings | ||
) |
osl_strings_generate function: this function generates a new strings structure containing 'nb_strings' strings of the form "prefixXX" where XX goes from 1 to nb_strings.
[in] | prefix | The prefix of the generated strings. |
[in] | nb_strings | The number of strings to generate. |
Definition at line 473 of file strings.c.
References OSL_error, OSL_malloc, OSL_strdup, osl_strings_malloc(), and osl_strings::string.
Referenced by osl_arrays_to_strings(), and osl_names_generate().
void osl_strings_idump | ( | FILE * | file, |
osl_strings_p | strings, | ||
int | level | ||
) |
osl_strings_idump function: this function displays an array of strings 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 | The file where the information has to be printed. |
[in] | strings | The array of strings that has to be printed. |
[in] | level | Number of spaces before printing, for each line. |
Definition at line 89 of file strings.c.
References osl_strings_size(), and osl_strings::string.
Referenced by osl_body_idump(), osl_names_idump(), osl_scatnames_idump(), osl_strings_dump(), and osl_strings_interface().
osl_strings_interface function: this function creates an interface structure corresponding to the strings structure and returns it).
Definition at line 448 of file strings.c.
References osl_interface_malloc(), OSL_strdup, osl_strings_clone(), osl_strings_equal(), osl_strings_free(), osl_strings_idump(), osl_strings_malloc(), osl_strings_sprint(), osl_strings_sread(), and OSL_URI_STRINGS.
Referenced by osl_interface_get_default_registry().
osl_strings_malloc function: This function allocates the memory space for an osl_strings_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.
Definition at line 282 of file strings.c.
References OSL_malloc, and osl_strings::string.
Referenced by osl_body_sread(), osl_strings_clone(), osl_strings_encapsulate(), osl_strings_generate(), osl_strings_interface(), and osl_strings_sread().
void osl_strings_print | ( | FILE * | file, |
osl_strings_p | strings | ||
) |
osl_strings_print function: this function prints the content of an osl_strings_t structure (*body) into a file (file, possibly stdout) in the OpenScop format.
[in] | file | File where informations are printed. |
[in] | strings | The strings whose information has to be printed. |
Definition at line 166 of file strings.c.
References osl_strings_sprint().
Referenced by osl_body_print(), osl_body_print_scoplib(), and osl_scop_print_scoplib().
osl_strings_p osl_strings_read | ( | FILE * | file | ) |
osl_strings_read function. this function reads a strings structure from a file (possibly stdin) complying to the OpenScop textual format and returns a pointer to this structure. parameter nb_strings).
[in] | file | The file where to read the strings structure. |
Definition at line 258 of file strings.c.
References OSL_MAX_STRING, osl_strings_sread(), and osl_util_skip_blank_and_comments().
Referenced by osl_relation_read_type(), and osl_scop_pread().
size_t osl_strings_size | ( | osl_const_strings_const_p | strings | ) |
osl_strings_size function: this function returns the number of elements in the NULL-terminated strings array of the strings structure.
[in] | strings | The strings structure we need to know the size. |
Definition at line 411 of file strings.c.
Referenced by osl_body_print(), osl_body_print_scoplib(), osl_body_sprint(), osl_relation_read_type(), osl_scop_pread(), osl_statement_integrity_check(), osl_strings_add(), osl_strings_clone(), osl_strings_equal(), osl_strings_find(), osl_strings_idump(), and osl_strings_sprint().
char* osl_strings_sprint | ( | osl_strings_p | strings | ) |
osl_strings_sprint function: this function prints the content of an osl_strings_t structure (*strings) into a string (returned) in the OpenScop textual format.
[in] | strings | The strings structure which has to be printed. |
Definition at line 131 of file strings.c.
References OSL_malloc, OSL_MAX_STRING, osl_strings_size(), osl_util_safe_strcat(), and osl_strings::string.
Referenced by osl_body_sprint(), osl_scatnames_sprint(), osl_strings_interface(), and osl_strings_print().
osl_strings_p osl_strings_sread | ( | char ** | input | ) |
osl_strings_sread function: this function reads a strings structure from a string complying to the OpenScop textual format and returns a pointer to this strings structure. The input string should only contain the list of strings this function has to read (comments at the end of the line are accepted). The input parameter is updated to the position in the input string this function reach right after reading the strings structure.
[in,out] | input | The input string where to find a strings structure. Updated to the position after what has been read. |
Definition at line 194 of file strings.c.
References OSL_malloc, OSL_MAX_STRING, OSL_strdup, osl_strings_malloc(), osl_util_sskip_blank_and_comments(), and osl_strings::string.
Referenced by osl_body_sread(), osl_relation_read_type(), osl_scatnames_sread(), osl_strings_interface(), and osl_strings_read().