OpenScop  0.9.0
Functions
arrays.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <osl/macros.h>
#include <osl/util.h>
#include <osl/strings.h>
#include <osl/interface.h>
#include <osl/extensions/arrays.h>
Include dependency graph for arrays.c:

Go to the source code of this file.

Functions

void osl_arrays_idump (FILE *file, osl_arrays_p arrays, int level)
void osl_arrays_dump (FILE *file, osl_arrays_p arrays)
char * osl_arrays_sprint (osl_arrays_p arrays)
osl_arrays_p osl_arrays_sread (char **input)
osl_arrays_p osl_arrays_malloc ()
void osl_arrays_free (osl_arrays_p arrays)
osl_arrays_p osl_arrays_clone (osl_arrays_p arrays)
int osl_arrays_equal (osl_arrays_p a1, osl_arrays_p a2)
osl_strings_p osl_arrays_to_strings (osl_arrays_p arrays)
osl_interface_p osl_arrays_interface ()

Function Documentation

osl_arrays_clone function: this function builds and returns a "hard copy" (not a pointer copy) of an osl_arrays_t data structure.

Parameters:
[in]arraysThe pointer to the arrays structure to clone.
Returns:
A pointer to the clone of the arrays structure.

Definition at line 283 of file arrays.c.

References osl_arrays::id, osl_arrays::names, osl_arrays::nb_names, osl_arrays_malloc(), OSL_malloc, and OSL_strdup.

Referenced by osl_arrays_interface().

void osl_arrays_dump ( FILE *  file,
osl_arrays_p  arrays 
)

osl_arrays_dump function: this function prints the content of an osl_arrays_t structure (*arrays) into a file (file, possibly stdout).

Parameters:
[in]fileThe file where the information has to be printed.
[in]arraysThe arrays structure to print.

Definition at line 134 of file arrays.c.

References osl_arrays_idump().

osl_arrays_equal function: this function returns true if the two arrays structures are the same (content-wise), false otherwise. This functions considers two arrays structures as equal if the order of the array names differ, however the identifiers and names must be the same.

Parameters:
[in]a1The first arrays structure.
[in]a2The second arrays structure.
Returns:
1 if a1 and a2 are the same (content-wise), 0 otherwise.

Definition at line 314 of file arrays.c.

References osl_arrays::id, osl_arrays::names, osl_arrays::nb_names, and OSL_info.

Referenced by osl_arrays_interface().

void osl_arrays_free ( osl_arrays_p  arrays)

osl_arrays_free function: this function frees the allocated memory for an arrays structure.

Parameters:
[in,out]arraysThe pointer to the arrays structure we want to free.

Definition at line 258 of file arrays.c.

References osl_arrays::id, osl_arrays::names, and osl_arrays::nb_names.

Referenced by osl_arrays_interface().

void osl_arrays_idump ( FILE *  file,
osl_arrays_p  arrays,
int  level 
)

osl_arrays_idump function: this function displays an osl_arrays_t structure (*arrays) 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]arraysThe arrays structure to print.
[in]levelNumber of spaces before printing, for each line.

Definition at line 90 of file arrays.c.

References osl_arrays::id, osl_arrays::names, and osl_arrays::nb_names.

Referenced by osl_arrays_dump(), and osl_arrays_interface().

osl_arrays_interface function: this function creates an interface structure corresponding to the arrays extension and returns it).

Returns:
An interface structure for the arrays extension.

Definition at line 392 of file arrays.c.

References osl_arrays_clone(), osl_arrays_equal(), osl_arrays_free(), osl_arrays_idump(), osl_arrays_malloc(), osl_arrays_sprint(), osl_arrays_sread(), osl_interface_malloc(), OSL_strdup, and OSL_URI_ARRAYS.

Referenced by osl_interface_get_default_registry().

osl_arrays_malloc function: this function allocates the memory space for an osl_arrays_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.

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

Definition at line 241 of file arrays.c.

References osl_arrays::id, osl_arrays::names, osl_arrays::nb_names, and OSL_malloc.

Referenced by osl_arrays_clone(), osl_arrays_interface(), and osl_arrays_sread().

char* osl_arrays_sprint ( osl_arrays_p  arrays)

osl_arrays_sprint function: this function prints the content of an osl_arrays_t structure (*arrays) into a string (returned) in the OpenScop textual format.

Parameters:
[in]arraysThe arrays structure to print.
Returns:
A string containing the OpenScop dump of the arrays structure.

Definition at line 146 of file arrays.c.

References osl_arrays::id, osl_arrays::names, osl_arrays::nb_names, OSL_malloc, OSL_MAX_STRING, OSL_realloc, and osl_util_safe_strcat().

Referenced by osl_arrays_interface(), and osl_generic_print_options_scoplib().

osl_arrays_p osl_arrays_sread ( char **  input)

osl_arrays_sread function: this function reads an arrays structure from a string complying to the OpenScop textual format and returns a pointer to this arrays structure. The string should contain only one textual format of an arrays structure. The input parameter is updated to the position in the input string this function reach right after reading the comment structure.

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

Definition at line 194 of file arrays.c.

References osl_arrays::id, osl_arrays::names, osl_arrays::nb_names, osl_arrays_malloc(), OSL_debug, OSL_malloc, osl_util_read_int(), and osl_util_read_string().

Referenced by osl_arrays_interface().

osl_arrays_to_strings function: this function creates a strings structure containing the textual names contained in a names structure. Each name is placed according to its id in the strings array. The "empty" strings cells are filled with dummy names.

Parameters:
[in]arraysThe arrays structure to convert to a strings.
Returns:
A strings structure containing all the array names.

Definition at line 360 of file arrays.c.

References osl_arrays::id, osl_arrays::names, osl_arrays::nb_names, OSL_strdup, osl_strings_generate(), and osl_strings::string.

Referenced by osl_scop_print(), and osl_scop_print_scoplib().