OpenScop 0.8.1
Functions

relation_list.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/relation.h>
#include <osl/relation_list.h>
Include dependency graph for relation_list.c:

Go to the source code of this file.

Functions

void osl_relation_list_idump (FILE *file, osl_relation_list_p l, int level)
void osl_relation_list_dump (FILE *file, osl_relation_list_p list)
void osl_relation_list_pprint_elts (FILE *file, osl_relation_list_p list, osl_names_p names)
void osl_relation_list_pprint (FILE *file, osl_relation_list_p list, osl_names_p names)
void osl_relation_list_print (FILE *file, osl_relation_list_p list)
osl_relation_list_p osl_relation_list_pread (FILE *file, int precision)
osl_relation_list_p osl_relation_list_read (FILE *foo)
osl_relation_list_p osl_relation_list_malloc ()
void osl_relation_list_free (osl_relation_list_p list)
osl_relation_list_p osl_relation_list_node (osl_relation_p r)
osl_relation_list_p osl_relation_list_clone (osl_relation_list_p list)
osl_relation_list_p osl_relation_list_concat (osl_relation_list_p l1, osl_relation_list_p l2)
void osl_relation_list_concat_inplace (osl_relation_list_p *l1, osl_relation_list_p l2)
int osl_relation_list_equal (osl_relation_list_p l1, osl_relation_list_p l2)
int osl_relation_list_integrity_check (osl_relation_list_p list, int type, int expected_nb_output_dims, int expected_nb_input_dims, int expected_nb_parameters)
void osl_relation_list_set_type (osl_relation_list_p list, int type)
osl_relation_list_p osl_relation_list_filter (osl_relation_list_p list, int type)
int osl_relation_list_count (osl_relation_list_p list)
void osl_relation_list_get_attributes (osl_relation_list_p list, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)

Function Documentation

osl_relation_list_p osl_relation_list_clone ( osl_relation_list_p  list)

osl_relation_list_clone function: This functions builds and returns a quasi-"hard copy" (not a pointer copy) of a osl_relation_list_t data structure provided as parameter.

Parameters:
listThe pointer to the relation list we want to copy.
Returns:
A pointer to the full copy of the relation list in parameter.

Definition at line 354 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, osl_relation_clone(), and osl_relation_list_malloc().

Referenced by osl_relation_list_concat(), osl_relation_list_filter(), and osl_statement_clone().

osl_relation_list_p osl_relation_list_concat ( osl_relation_list_p  l1,
osl_relation_list_p  l2 
)

osl_relation_list_concat function: this function builds a new relation list as the concatenation of the two lists sent as parameters.

Parameters:
l1The first relation list.
l2The second relation list.
Returns:
A pointer to the relation list resulting from the concatenation of l1 and l2.

Definition at line 389 of file relation_list.c.

References osl_relation_list::next, and osl_relation_list_clone().

void osl_relation_list_concat_inplace ( osl_relation_list_p l1,
osl_relation_list_p  l2 
)

osl_relation_list_concat_inplace function: this function concatenates a relation list to another. No new list is created: this functions links the two input lists. If the first relation list is NULL, it is set to the second relation list. two lists sent as parameters.

Parameters:
[in,out]l1Pointer to the first relation list.
[in]l2The second relation list.

Definition at line 418 of file relation_list.c.

References osl_relation_list::next.

int osl_relation_list_count ( osl_relation_list_p  list)

osl_relation_list_count function: this function returns the number of elements with non-NULL content in a relation list.

Parameters:
listThe relation list to count the number of elements.
Returns:
The number of nodes with non-NULL content in the relation list.

Definition at line 569 of file relation_list.c.

References osl_relation_list::elt, and osl_relation_list::next.

Referenced by osl_relation_list_pprint(), osl_relation_list_pprint_elts(), osl_statement_dispatch(), and osl_statement_pprint().

void osl_relation_list_dump ( FILE *  file,
osl_relation_list_p  list 
)

osl_relation_dump function: This function prints the content of a osl_relation_list_t into a file (file, possibly stdout).

Parameters:
fileFile where informations are printed.
listThe relation whose information has to be printed.

Definition at line 143 of file relation_list.c.

References osl_relation_list_idump().

int osl_relation_list_equal ( osl_relation_list_p  l1,
osl_relation_list_p  l2 
)

osl_relation_list_equal function: This function returns true if the two relation lists are the same, false otherwise..

Parameters:
l1The first relation list.
l2The second relation list.
Returns:
1 if l1 and l2 are the same (content-wise), 0 otherwise.

Definition at line 442 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, and osl_relation_equal().

Referenced by osl_statement_equal().

osl_relation_list_p osl_relation_list_filter ( osl_relation_list_p  list,
int  type 
)

osl_relation_list_filter function: this function returns a copy of the input relation list, restricted to the relations of a given type. The special type OSL_TYPE_ACCESS filters any kind of access (read, write, rdwr etc.).

Parameters:
listThe relation list to copy/filter.
typeThe filtering type.
Returns:
A copy of the input list with only relation of the given type.

Definition at line 525 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, osl_relation_is_access(), osl_relation_list_clone(), osl_relation_list_free(), OSL_TYPE_ACCESS, and osl_relation::type.

Referenced by osl_statement_dispatch().

void osl_relation_list_free ( osl_relation_list_p  list)

osl_relation_list_free function: This function frees the allocated memory for a osl_relation_list_t structure, and all the relations stored in the list.

Parameters:
listThe pointer to the relation list we want to free.

Definition at line 307 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, and osl_relation_free().

Referenced by osl_relation_list_filter(), osl_statement_dispatch(), and osl_statement_free().

void osl_relation_list_get_attributes ( osl_relation_list_p  list,
int *  nb_parameters,
int *  nb_iterators,
int *  nb_scattdims,
int *  nb_localdims,
int *  array_id 
)

osl_relation_list_get_attributes function: this function returns, through its parameters, the maximum values of the relation attributes (nb_iterators, nb_parameters etc) in the relation list, depending on its type. HOWEVER, it updates the parameter value iff the attribute is greater than the input parameter value. Hence it may be used to get the attributes as well as to find the maximum attributes for several relation lists. The array identifier 0 is used when there is no array identifier (AND this is OK), OSL_UNDEFINED is used to report it is impossible to provide the property while it should. This function is not intended for checking, the input relation list should be correct.

Parameters:
[in]listThe relation list to extract attribute values.
[in,out]nb_parametersNumber of parameter attribute.
[in,out]nb_iteratorsNumber of iterators attribute.
[in,out]nb_scattdimsNumber of scattering dimensions attribute.
[in,out]nb_localdimsNumber of local dimensions attribute.
[in,out]array_idMaximum array identifier attribute.

Definition at line 600 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, OSL_max, osl_relation_get_attributes(), and OSL_UNDEFINED.

Referenced by osl_statement_get_attributes().

void osl_relation_list_idump ( FILE *  file,
osl_relation_list_p  l,
int  level 
)

osl_relation_list_idump function: Displays a osl_relation_list_t structure (a list of relations) into a file (file, possibly stdout). See osl_relation_print_structure for more details.

Parameters:
fileFile where informations are printed.
lThe list of relations whose information has to be printed.
levelNumber of spaces before printing, for each line.

Definition at line 89 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, and osl_relation_idump().

Referenced by osl_relation_list_dump(), and osl_statement_idump().

int osl_relation_list_integrity_check ( osl_relation_list_p  list,
int  type,
int  expected_nb_output_dims,
int  expected_nb_input_dims,
int  expected_nb_parameters 
)

osl_relation_integrity_check function: This function checks that a list of relation is "well formed" according to some expected properties (setting an expected value to OSL_UNDEFINED means that we do not expect a specific value) and what the relations are supposed to represent (all relations of a list are supposed to have the same semantics). It returns 0 if the check failed or 1 if no problem has been detected.

Parameters:
listThe relation list we want to check.
typeSemantics about this relation (domain, access...).
expected_nb_output_dimsExpected number of output dimensions.
expected_nb_input_dimsExpected number of input dimensions.
expected_nb_parametersExpected number of parameters.
Returns:
0 if the integrity check fails, 1 otherwise.

Definition at line 476 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, and osl_relation_integrity_check().

Referenced by osl_statement_integrity_check().

osl_relation_list_p osl_relation_list_malloc ( )

osl_relation_list_malloc function: This function allocates the memory space for a osl_relation_list_t structure and sets its fields with default values. Then it returns a pointer to the allocated space.

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

Definition at line 289 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, and OSL_malloc.

Referenced by osl_relation_list_clone(), osl_relation_list_node(), and osl_relation_list_pread().

osl_relation_list_p osl_relation_list_node ( osl_relation_p  r)

osl_relation_list_node function: This function builds an osl_relation_list_t node and sets its relation element as a copy of the one provided as parameter. If the relation provided as an argument is NULL, NULL is returned.

Parameters:
rThe pointer to the relation to copy/paste in a list node.
Returns:
A pointer to a relation list node containing a copy of "relation".

Definition at line 336 of file relation_list.c.

References osl_relation_clone(), and osl_relation_list_malloc().

void osl_relation_list_pprint ( FILE *  file,
osl_relation_list_p  list,
osl_names_p  names 
)

osl_relation_list_pprint function: This function pretty-prints the content of a osl_relation_list_t structure into a file (file, possibly stdout) in the OpenScop format. It prints an element of the list only if it is not NULL.

Parameters:
[in]fileFile where informations are printed.
[in]listThe relation list whose information has to be printed.
[in]namesArray of constraint columns names.

Definition at line 194 of file relation_list.c.

References osl_relation_list_count(), and osl_relation_list_pprint_elts().

Referenced by osl_relation_list_print().

void osl_relation_list_pprint_elts ( FILE *  file,
osl_relation_list_p  list,
osl_names_p  names 
)

osl_relation_list_pprint_elts function: This function pretty-prints the elements of a osl_relation_list_t structure into a file (file, possibly stdout) in the OpenScop format. I.e., it prints only the elements and not the number of elements. It prints an element of the list only if it is not NULL.

Parameters:
fileFile where informations are printed.
listThe relation list whose information has to be printed.
[in]namesArray of constraint columns names.

Definition at line 158 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, osl_relation_list_count(), and osl_relation_pprint().

Referenced by osl_relation_list_pprint(), and osl_statement_pprint().

osl_relation_list_p osl_relation_list_pread ( FILE *  file,
int  precision 
)

osl_relation_list_pread function ("precision read"): this function reads a list of relations into a file (foo, posibly stdin) and returns a pointer this relation list.

Parameters:
[in]fileThe input stream.
[in]precisionThe precision of the relation elements.
Returns:
A pointer to the relation list structure that has been read.

Definition at line 238 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, OSL_error, osl_relation_list_malloc(), osl_relation_pread(), and osl_util_read_int().

Referenced by osl_relation_list_read(), and osl_statement_pread().

void osl_relation_list_print ( FILE *  file,
osl_relation_list_p  list 
)

osl_relation_list_print function: This function prints the content of a osl_relation_list_t structure into a file (file, possibly stdout) in the OpenScop format. It prints an element of the list only if it is not NULL.

Parameters:
fileFile where informations are printed.
listThe relation list whose information has to be printed.

Definition at line 220 of file relation_list.c.

References osl_relation_list_pprint().

osl_relation_list_p osl_relation_list_read ( FILE *  foo)

osl_relation_list_read function: this function is equivalent to osl_relation_list_pread() except that the precision corresponds to the precision environment variable or to the highest available precision if it is not defined.

See also:
{osl_relation_list_pread}

Definition at line 270 of file relation_list.c.

References osl_relation_list_pread(), osl_util_get_precision(), and osl_relation::precision.

void osl_relation_list_set_type ( osl_relation_list_p  list,
int  type 
)

osl_relation_list_set_type function: this function sets the type of each relation in the relation list to the one provided as parameter.

Parameters:
listThe list of relations to set the type.
typeThe type.

Definition at line 505 of file relation_list.c.

References osl_relation_list::elt, osl_relation_list::next, and osl_relation::type.