OpenScop  0.9.0
Functions
body.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/body.h>
Include dependency graph for body.c:

Go to the source code of this file.

Functions

void osl_body_idump (FILE *file, osl_body_p body, int level)
void osl_body_dump (FILE *file, osl_body_p body)
void osl_body_print (FILE *file, osl_body_p body)
void osl_body_print_scoplib (FILE *file, osl_body_p body)
char * osl_body_sprint (osl_body_p body)
osl_body_p osl_body_sread (char **input)
osl_body_p osl_body_malloc ()
void osl_body_free (osl_body_p body)
osl_body_p osl_body_clone (osl_body_p body)
int osl_body_equal (osl_body_p b1, osl_body_p b2)
osl_interface_p osl_body_interface ()

Function Documentation

osl_body_clone function: this functions builds and returns a "hard copy" (not a pointer copy) of an osl_body_t data structure provided as parameter. However, let us recall here that non-string elements are untouched by the OpenScop Library.

Parameters:
[in]bodyThe pointer to the body we want to copy.
Returns:
A pointer to the full copy of the body provided as parameter.

Definition at line 339 of file body.c.

References osl_body::expression, osl_body::iterators, osl_body_malloc(), and osl_strings_clone().

Referenced by osl_body_interface(), and osl_extbody_clone().

void osl_body_dump ( FILE *  file,
osl_body_p  body 
)

osl_body_dump function: this function prints the content of an osl_body_t structure (*body) into a file (file, possibly stdout).

Parameters:
[in]fileFile where informations are printed.
[in]bodyThe body whose information has to be printed.

Definition at line 129 of file body.c.

References osl_body_idump().

int osl_body_equal ( osl_body_p  b1,
osl_body_p  b2 
)

osl_body_equal function: this function returns true if the two bodies are the same, false otherwise (the usr field is not tested). However, let us recall here that non-string elements are untouched by the OpenScop Library.

Parameters:
[in]b1The first body.
[in]b2The second body.
Returns:
1 if b1 and b2 are the same (content-wise), 0 otherwise.

Definition at line 361 of file body.c.

References osl_body::expression, osl_body::iterators, OSL_info, and osl_strings_equal().

Referenced by osl_body_interface(), and osl_extbody_equal().

void osl_body_free ( osl_body_p  body)

osl_body_free function: this function frees the allocated memory for an osl_body_t structure.

Parameters:
[in,out]bodyThe pointer to the body we want to free.

Definition at line 316 of file body.c.

References osl_body::expression, osl_body::iterators, and osl_strings_free().

Referenced by osl_body_interface(), and osl_extbody_free().

void osl_body_idump ( FILE *  file,
osl_body_p  body,
int  level 
)

osl_body_idump function: this function displays an osl_body_t structure (*body) 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 dumping functions.

Parameters:
[in]fileFile where informations are printed.
[in]bodyThe body whose information has to be printed.
[in]levelNumber of spaces before printing, for each line.

Definition at line 90 of file body.c.

References osl_body::expression, osl_body::iterators, and osl_strings_idump().

Referenced by osl_body_dump(), osl_body_interface(), and osl_extbody_idump().

osl_body_interface function: this function creates an interface structure corresponding to the body structure and returns it).

Returns:
An interface structure for the body structure.

Definition at line 392 of file body.c.

References osl_body_clone(), osl_body_equal(), osl_body_free(), osl_body_idump(), osl_body_malloc(), osl_body_sprint(), osl_body_sread(), osl_interface_malloc(), OSL_strdup, and OSL_URI_BODY.

Referenced by osl_interface_get_default_registry().

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

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

Definition at line 299 of file body.c.

References osl_body::expression, osl_body::iterators, and OSL_malloc.

Referenced by osl_body_clone(), osl_body_interface(), and osl_body_sread().

void osl_body_print ( FILE *  file,
osl_body_p  body 
)

osl_body_print function: this function prints the content of an osl_body_t structure (*body) into a file (file, possibly stdout) in the OpenScop format.

Parameters:
[in]fileFile where informations are printed.
[in]bodyThe body whose information has to be printed.

Definition at line 141 of file body.c.

References osl_body::expression, osl_body::iterators, osl_strings_print(), and osl_strings_size().

void osl_body_print_scoplib ( FILE *  file,
osl_body_p  body 
)

osl_body_print_scoplib function: this function prints the content of an osl_body_t structure (*body) into a file (file, possibly stdout) in the SCoPLib format.

Parameters:
[in]fileFile where informations are printed.
[in]bodyThe body whose information has to be printed.

Definition at line 170 of file body.c.

References osl_body::expression, osl_body::iterators, osl_strings_print(), and osl_strings_size().

Referenced by osl_statement_pprint_scoplib().

char* osl_body_sprint ( osl_body_p  body)

osl_body_sprint function: this function prints the content of an osl_body_t structure (*body) into a string (returned) in the OpenScop textual format.

Parameters:
[in]bodyThe body structure which has to be printed.
Returns:
A string containing the OpenScop dump of the body structure.

Definition at line 199 of file body.c.

References osl_body::expression, osl_body::iterators, OSL_malloc, OSL_MAX_STRING, osl_strings_size(), osl_strings_sprint(), and osl_util_safe_strcat().

Referenced by osl_body_interface(), and osl_extbody_sprint().

osl_body_p osl_body_sread ( char **  input)

osl_body_read function: this function reads a body structure from a string complying to the OpenScop textual format and returns a pointer to this body structure. The input string should only contain the body 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 body structure. Updated to the position after what has been read.
Returns:
A pointer to the body structure that has been read.

Definition at line 255 of file body.c.

References osl_body::expression, osl_body::iterators, osl_body_malloc(), OSL_malloc, osl_strings_encapsulate(), osl_strings_malloc(), osl_strings_sread(), osl_util_read_int(), osl_util_read_line(), and osl_strings::string.

Referenced by osl_body_interface(), and osl_extbody_sread().