OpenScop 0.8.1
|
#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>
Go to the source code of this file.
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.
list | The pointer to the relation list we want to copy. |
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.
l1 | The first relation list. |
l2 | The second relation list. |
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.
[in,out] | l1 | Pointer to the first relation list. |
[in] | l2 | The 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.
list | The relation list to count the number of elements. |
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).
file | File where informations are printed. |
list | The 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..
l1 | The first relation list. |
l2 | The second relation list. |
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.).
list | The relation list to copy/filter. |
type | The filtering 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.
list | The 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.
[in] | list | The relation list to extract attribute values. |
[in,out] | nb_parameters | Number of parameter attribute. |
[in,out] | nb_iterators | Number of iterators attribute. |
[in,out] | nb_scattdims | Number of scattering dimensions attribute. |
[in,out] | nb_localdims | Number of local dimensions attribute. |
[in,out] | array_id | Maximum 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.
file | File where informations are printed. |
l | The list of relations whose information has to be printed. |
level | Number 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.
list | The relation list we want to check. |
type | Semantics about this relation (domain, access...). |
expected_nb_output_dims | Expected number of output dimensions. |
expected_nb_input_dims | Expected number of input dimensions. |
expected_nb_parameters | Expected number of parameters. |
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.
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.
r | The pointer to the relation to copy/paste in a list node. |
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.
[in] | file | File where informations are printed. |
[in] | list | The relation list whose information has to be printed. |
[in] | names | Array 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.
file | File where informations are printed. | |
list | The relation list whose information has to be printed. | |
[in] | names | Array 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.
[in] | file | The input stream. |
[in] | precision | The precision of the relation elements. |
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.
file | File where informations are printed. |
list | The 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.
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.
list | The list of relations to set the type. |
type | The type. |
Definition at line 505 of file relation_list.c.
References osl_relation_list::elt, osl_relation_list::next, and osl_relation::type.