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

Go to the source code of this file.

Data Structures

struct  osl_strings
 

Macros

#define OSL_URI_STRINGS   "strings"
 

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)
 
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 (void)
 
osl_strings_p osl_strings_generate (char *, int)
 
void osl_strings_add_strings (osl_strings_p *, osl_strings_p, osl_strings_p)
 Concatenate two osl_strings into one. The parameter are cloned and not modified. More...
 

Macro Definition Documentation

◆ OSL_URI_STRINGS

#define OSL_URI_STRINGS   "strings"

Definition at line 75 of file strings.h.

Referenced by osl_scop_print(), osl_scop_print_scoplib(), and osl_strings_interface().

Typedef Documentation

◆ osl_const_strings_const_p

typedef struct osl_strings const* const osl_const_strings_const_p

Definition at line 89 of file strings.h.

◆ osl_const_strings_p

typedef struct osl_strings const* osl_const_strings_p

Definition at line 88 of file strings.h.

◆ osl_const_strings_t

typedef struct osl_strings const osl_const_strings_t

Definition at line 86 of file strings.h.

◆ osl_strings_const_p

typedef struct osl_strings* const osl_strings_const_p

Definition at line 87 of file strings.h.

◆ osl_strings_p

typedef struct osl_strings* osl_strings_p

Definition at line 85 of file strings.h.

◆ osl_strings_t

typedef struct osl_strings osl_strings_t

Definition at line 84 of file strings.h.

Function Documentation

◆ osl_strings_add()

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 371 of file strings.c.

References OSL_realloc, osl_strings_size(), and osl_strings::string.

Referenced by osl_strings_add_strings().

◆ osl_strings_add_strings()

void osl_strings_add_strings ( osl_strings_p dest,
osl_strings_p  str1,
osl_strings_p  str2 
)

Concatenate two osl_strings into one. The parameter are cloned and not modified.

Parameters
dest[out]A pointer to the destination osl_strings.
str1[in]The first osl_strings.
str2[in]The second osl_strings.

Definition at line 506 of file strings.c.

References osl_strings_add(), osl_strings_clone(), and osl_strings::string.

◆ osl_strings_clone()

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 329 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(), osl_strings_add_strings(), and osl_strings_interface().

◆ osl_strings_dump()

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 120 of file strings.c.

References osl_strings_idump().

◆ osl_strings_encapsulate()

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 434 of file strings.c.

References OSL_malloc, osl_strings_malloc(), and osl_strings::string.

Referenced by osl_body_sread().

◆ osl_strings_equal()

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 388 of file strings.c.

References osl_strings_size(), and osl_strings::string.

Referenced by osl_body_equal(), osl_scatnames_equal(), and osl_strings_interface().

◆ osl_strings_find()

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 356 of file strings.c.

References osl_strings_size(), and osl_strings::string.

◆ osl_strings_free()

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 300 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_generate()

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

◆ osl_strings_idump()

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_strings_interface()

osl_interface_p osl_strings_interface ( void  )

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 451 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()

osl_strings_p osl_strings_malloc ( void  )

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

◆ osl_strings_print()

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 167 of file strings.c.

References osl_strings_sprint().

Referenced by osl_body_print(), osl_body_print_scoplib(), and osl_scop_print_scoplib().

◆ osl_strings_read()

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

◆ osl_strings_size()

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

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

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

Definition at line 132 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_sread()

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