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

Go to the source code of this file.

Functions

void osl_coordinates_idump (FILE *file, osl_coordinates_p coordinates, int level)
void osl_coordinates_dump (FILE *file, osl_coordinates_p coordinates)
char * osl_coordinates_sprint (osl_coordinates_p coordinates)
osl_coordinates_p osl_coordinates_sread (char **input)
osl_coordinates_p osl_coordinates_malloc ()
void osl_coordinates_free (osl_coordinates_p coordinates)
osl_coordinates_p osl_coordinates_clone (osl_coordinates_p coordinates)
int osl_coordinates_equal (osl_coordinates_p c1, osl_coordinates_p c2)
osl_interface_p osl_coordinates_interface ()

Function Documentation

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

Parameters:
coordinatesThe pointer to the coordinates structure to clone.
Returns:
A pointer to the clone of the coordinates structure.

Definition at line 283 of file coordinates.c.

References osl_coordinates::column_end, osl_coordinates::column_start, osl_coordinates::indent, osl_coordinates::line_end, osl_coordinates::line_start, osl_coordinates::name, osl_coordinates_malloc(), and OSL_strdup.

Referenced by osl_coordinates_interface().

void osl_coordinates_dump ( FILE *  file,
osl_coordinates_p  coordinates 
)

osl_coordinates_dump function: this function prints the content of an osl_coordinates_t structure (*coordinates) into a file (file, possibly stdout).

Parameters:
fileThe file where the information has to be printed.
coordinatesThe coordinates structure to print.

Definition at line 143 of file coordinates.c.

References osl_coordinates_idump().

osl_coordinates_equal function: this function returns true if the two coordinates structures are the same (content-wise), false otherwise. This functions considers two coordinates

Parameters:
c1The first coordinates structure.
c2The second coordinates structure.
Returns:
1 if c1 and c2 are the same (content-wise), 0 otherwise.

Definition at line 309 of file coordinates.c.

References osl_coordinates::column_end, osl_coordinates::column_start, osl_coordinates::indent, osl_coordinates::line_end, osl_coordinates::line_start, osl_coordinates::name, and OSL_info.

Referenced by osl_coordinates_interface().

void osl_coordinates_free ( osl_coordinates_p  coordinates)

osl_coordinates_free function: this function frees the allocated memory for an osl_coordinates_t structure.

Parameters:
coordinatesThe pointer to the coordinates structure to free.

Definition at line 263 of file coordinates.c.

References osl_coordinates::name.

Referenced by osl_coordinates_interface().

void osl_coordinates_idump ( FILE *  file,
osl_coordinates_p  coordinates,
int  level 
)

osl_coordinates_idump function: this function displays an osl_coordinates_t structure (*coordinates) 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:
fileThe file where the information has to be printed.
coordinatesThe coordinates structure to print.
levelNumber of spaces before printing, for each line.

Definition at line 88 of file coordinates.c.

References osl_coordinates::column_end, osl_coordinates::column_start, osl_coordinates::indent, osl_coordinates::line_end, osl_coordinates::line_start, and osl_coordinates::name.

Referenced by osl_coordinates_dump(), and osl_coordinates_interface().

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

Returns:
An interface structure for the coordinates extension.

Definition at line 356 of file coordinates.c.

References osl_coordinates_clone(), osl_coordinates_equal(), osl_coordinates_free(), osl_coordinates_idump(), osl_coordinates_malloc(), osl_coordinates_sprint(), osl_coordinates_sread(), osl_interface_malloc(), OSL_strdup, and OSL_URI_COORDINATES.

Referenced by osl_interface_get_default_registry().

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

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

Definition at line 242 of file coordinates.c.

References osl_coordinates::column_end, osl_coordinates::column_start, osl_coordinates::indent, osl_coordinates::line_end, osl_coordinates::line_start, osl_coordinates::name, OSL_malloc, and OSL_UNDEFINED.

Referenced by osl_coordinates_clone(), osl_coordinates_interface(), and osl_coordinates_sread().

char* osl_coordinates_sprint ( osl_coordinates_p  coordinates)

osl_coordinates_sprint function: this function prints the content of an osl_coordinates_t structure (*coordinates) into a string (returned) in the OpenScop textual format.

Parameters:
coordinatesThe coordinates structure to be print.
Returns:
A string containing the OpenScop dump of the coordinates structure.

Definition at line 155 of file coordinates.c.

References osl_coordinates::column_end, osl_coordinates::column_start, osl_coordinates::indent, osl_coordinates::line_end, osl_coordinates::line_start, osl_coordinates::name, OSL_malloc, OSL_MAX_STRING, OSL_realloc, and osl_util_safe_strcat().

Referenced by osl_coordinates_interface().

osl_coordinates_sread function: this function reads a coordinates structure from a string complying to the OpenScop textual format and returns a pointer to this structure. The input parameter is updated to the position in the input string this function reach right after reading the coordinates structure.

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

Definition at line 202 of file coordinates.c.

References osl_coordinates::column_end, osl_coordinates::column_start, osl_coordinates::indent, osl_coordinates::line_end, osl_coordinates::line_start, osl_coordinates::name, osl_coordinates_malloc(), OSL_debug, osl_util_read_int(), and osl_util_read_line().

Referenced by osl_coordinates_interface().