OpenScop  0.9.0
Data Structures | Namespaces | Typedefs | Functions
strings.h File Reference

Go to the source code of this file.

Data Structures

struct  osl_strings
 

Namespaces

 osl
 

Typedefs

typedef struct osl_strings osl_strings_t
 
typedef struct osl_stringsosl_strings_p
 
typedef struct osl_strings const osl_const_strings_t
 
typedef struct osl_strings *const osl_strings_const_p
 
typedef struct osl_strings const * osl_const_strings_p
 
typedef struct osl_strings
const *const 
osl_const_strings_const_p
 

Functions

void osl_strings_idump (FILE *, osl_strings_p, int)
 
void osl_strings_dump (FILE *, osl_strings_p)
 
char * osl_strings_sprint (osl_strings_p)
 
void osl_strings_print (FILE *, osl_strings_p)
 
osl_strings_p osl_strings_sread (char **)
 
osl_strings_p osl_strings_read (FILE *)
 
osl_strings_p osl_strings_malloc ()
 
void osl_strings_free (osl_strings_p)
 
osl_strings_p osl_strings_clone (osl_strings_p)
 
void osl_strings_add (osl_strings_p, char const *const)
 
size_t osl_strings_find (osl_strings_p, char const *const)
 
int osl_strings_equal (osl_strings_p, osl_strings_p)
 
size_t osl_strings_size (osl_const_strings_const_p)
 
osl_strings_p osl_strings_encapsulate (char *)
 
osl_interface_p osl_strings_interface ()
 
osl_strings_p osl_strings_generate (char *, int)
 
std::vector< std::string > osl::osl_strings_to_cpp (osl_const_strings_const_p s)
 Convert osl_strings to std::vector<std::string> More...
 

Typedef Documentation

typedef struct osl_strings const* const osl_const_strings_const_p

Definition at line 89 of file strings.h.

typedef struct osl_strings const* osl_const_strings_p

Definition at line 88 of file strings.h.

typedef struct osl_strings const osl_const_strings_t

Definition at line 86 of file strings.h.

typedef struct osl_strings* const osl_strings_const_p

Definition at line 87 of file strings.h.

typedef struct osl_strings* osl_strings_p

Definition at line 85 of file strings.h.

typedef struct osl_strings osl_strings_t

Definition at line 84 of file strings.h.

Function Documentation

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.

Parameters
[in,out]stringsThe strings structure.
[in]stringThe string to add in strings.

Definition at line 370 of file strings.c.

References 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.

Parameters
[in]stringsThe strings structure to clone.
Returns
The clone of the strings structure.

Definition at line 328 of file strings.c.

References 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).

Parameters
[in]fileThe file where the information has to be printed.
[in]stringsThe 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).

Parameters
[in]stringThe string to encapsulate in a strings structure.
Returns
A new strings structure containing only the provided string.

Definition at line 433 of file strings.c.

References 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.

Parameters
[in]s1The first strings structure.
[in]s2The second strings structure.
Returns
1 if s1 and s2 are the same (content-wise), 0 otherwise.

Definition at line 387 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.

Parameters
[in,out]stringsThe strings structure.
[in]stringThe string to find in strings.
Returns
the index where is the string, osl_strings_size if not found

Definition at line 355 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.

Parameters
[in]stringsThe strings structure we want to free.

Definition at line 299 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.

Parameters
[in]prefixThe prefix of the generated strings.
[in]nb_stringsThe number of strings to generate.
Returns
A new strings structure containing generated strings.

Definition at line 475 of file strings.c.

References 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.

Parameters
[in]fileThe file where the information has to be printed.
[in]stringsThe array of strings that has to be printed.
[in]levelNumber 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_interface_p osl_strings_interface ( )

osl_strings_interface function: this function creates an interface structure corresponding to the strings structure and returns it).

Returns
An interface structure for the strings structure.

Definition at line 450 of file strings.c.

References osl_interface_malloc(), osl_strings_clone(), osl_strings_equal(), osl_strings_free(), osl_strings_idump(), osl_strings_malloc(), osl_strings_sprint(), and osl_strings_sread().

Referenced by osl_interface_get_default_registry().

osl_strings_p osl_strings_malloc ( )

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.

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

Definition at line 283 of file strings.c.

References 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.

Parameters
[in]fileFile where informations are printed.
[in]stringsThe 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).

Parameters
[in]fileThe file where to read the strings structure.
Returns
The strings structure that has been read.

Definition at line 259 of file strings.c.

References 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.

Parameters
[in]stringsThe strings structure we need to know the size.
Returns
The number of strings in the strings structure.

Definition at line 413 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(), osl_strings_sprint(), and osl::osl_strings_to_cpp().

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.

Parameters
[in]stringsThe strings structure which has to be printed.
Returns
A string containing the OpenScop dump of the strings structure.

Definition at line 131 of file strings.c.

References 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.

Parameters
[in,out]inputThe input string where to find a strings structure. Updated to the position after what has been read.
Returns
A pointer to the strings structure that has been read.

Definition at line 194 of file strings.c.

References 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().