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

Go to the source code of this file.

Functions

void osl_comment_idump (FILE *file, osl_comment_p comment, int level)
void osl_comment_dump (FILE *file, osl_comment_p comment)
char * osl_comment_sprint (osl_comment_p comment)
osl_comment_p osl_comment_sread (char **input)
osl_comment_p osl_comment_malloc ()
void osl_comment_free (osl_comment_p comment)
osl_comment_p osl_comment_clone (osl_comment_p comment)
int osl_comment_equal (osl_comment_p c1, osl_comment_p c2)
osl_interface_p osl_comment_interface ()

Function Documentation

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

Parameters:
[in]commentThe pointer to the comment structure to clone.
Returns:
A pointer to the clone of the comment structure.

Definition at line 250 of file comment.c.

References osl_comment::comment, osl_comment_malloc(), and OSL_strdup.

Referenced by osl_comment_interface().

void osl_comment_dump ( FILE *  file,
osl_comment_p  comment 
)

osl_comment_dump function: this function prints the content of an osl_comment_t structure (*comment) into a file (file, possibly stdout).

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

Definition at line 130 of file comment.c.

References osl_comment_idump().

osl_comment_equal function: this function returns true if the two comment structures are the same (content-wise), false otherwise.

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

Definition at line 271 of file comment.c.

References osl_comment::comment, and OSL_info.

Referenced by osl_comment_interface().

void osl_comment_free ( osl_comment_p  comment)

osl_comment_free function: this function frees the allocated memory for an osl_comment_t structure.

Parameters:
[in,out]commentThe pointer to the comment structure to free.

Definition at line 229 of file comment.c.

References osl_comment::comment.

Referenced by osl_comment_interface().

void osl_comment_idump ( FILE *  file,
osl_comment_p  comment,
int  level 
)

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

Definition at line 88 of file comment.c.

References osl_comment::comment, and OSL_strdup.

Referenced by osl_comment_dump(), and osl_comment_interface().

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

Returns:
An interface structure for the comment extension.

Definition at line 297 of file comment.c.

References osl_comment_clone(), osl_comment_equal(), osl_comment_free(), osl_comment_idump(), osl_comment_malloc(), osl_comment_sprint(), osl_comment_sread(), osl_interface_malloc(), OSL_strdup, and OSL_URI_COMMENT.

Referenced by osl_interface_get_default_registry().

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

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

Definition at line 213 of file comment.c.

References osl_comment::comment, and OSL_malloc.

Referenced by osl_comment_clone(), osl_comment_interface(), and osl_comment_sread().

char* osl_comment_sprint ( osl_comment_p  comment)

osl_comment_sprint function: this function prints the content of an osl_comment_t structure (*comment) into a string (returned) in the OpenScop textual format.

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

Definition at line 142 of file comment.c.

References osl_comment::comment, OSL_malloc, OSL_MAX_STRING, OSL_realloc, and osl_util_safe_strcat().

Referenced by osl_comment_interface().

osl_comment_p osl_comment_sread ( char **  input)

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

Definition at line 178 of file comment.c.

References osl_comment::comment, osl_comment_malloc(), OSL_debug, OSL_error, OSL_MAX_STRING, and OSL_strdup.

Referenced by osl_comment_interface().