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_add (osl_relation_list_p *l1, osl_relation_list_p l2)
void osl_relation_list_push (osl_relation_list_p *head, osl_relation_list_p node)
osl_relation_list_p osl_relation_list_pop (osl_relation_list_p *head)
void osl_relation_list_dup (osl_relation_list_p *head)
void osl_relation_list_drop (osl_relation_list_p *head)
void osl_relation_list_destroy (osl_relation_list_p *head)
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

void osl_relation_list_add ( osl_relation_list_p l1,
osl_relation_list_p  l2 
)

osl_relation_list_add function: this function adds a relation list at the end of the relation list pointed by l1. 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.

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.

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:
list The 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_dup(), 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:
l1 The first relation list.
l2 The 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().

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:
list The relation list to count the number of elements.
Returns:
The number of nodes with non-NULL content in the relation list.

Definition at line 645 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_destroy ( osl_relation_list_p head  ) 

osl_relation_list_destroy function: this function sees a list of relations as a stack of relations and performs the destroy operation onto this stack, i.e., it completely free it.

Parameters:
[in,out] head Pointer to the head of the relation stack. Updated to NULL.

Definition at line 503 of file relation_list.c.

References osl_relation_list_drop().

void osl_relation_list_drop ( osl_relation_list_p head  ) 

osl_relation_list_drop function: this function sees a list of relations as a stack of relations and performs the drop operation (pop and destroy popped element) onto this stack.

Parameters:
[in,out] head Pointer to the head of the relation stack. It is updated to the previous element in the stack (NULL if there is none).

Definition at line 489 of file relation_list.c.

References osl_relation_list_free(), and osl_relation_list_pop().

Referenced by osl_relation_list_destroy().

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:
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().

void osl_relation_list_dup ( osl_relation_list_p head  ) 

osl_relation_list_dup function: this function sees a list of relations as a stack of relations and performs the dup operation (duplicate the top element) onto this stack.

Parameters:
[in,out] head Pointer to the head of the relation stack. It is updated to the new element after duplication.

Definition at line 473 of file relation_list.c.

References osl_relation_list_clone(), osl_relation_list_pop(), and osl_relation_list_push().

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:
l1 The first relation list.
l2 The second relation list.
Returns:
1 if l1 and l2 are the same (content-wise), 0 otherwise.

Definition at line 518 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:
list The relation list to copy/filter.
type The filtering type.
Returns:
A copy of the input list with only relation of the given type.

Definition at line 601 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:
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_drop(), 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] 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 676 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:
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.

Parameters:
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.
Returns:
0 if the integrity check fails, 1 otherwise.

Definition at line 552 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:
r The 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().

osl_relation_list_p osl_relation_list_pop ( osl_relation_list_p head  ) 

osl_relation_list_pop function: this function sees a list of relations as a stack of relations and performs the pop operation onto this stack.

Parameters:
[in,out] head Pointer to the head of the relation stack. It is updated to the previous element in the stack (NULL if there is none).
Returns:
The top element of the stack (detached from the list).

Definition at line 452 of file relation_list.c.

References osl_relation_list::next.

Referenced by osl_relation_list_drop(), and osl_relation_list_dup().

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] 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.

Parameters:
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.

Parameters:
[in] file The input stream.
[in] precision The 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:
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().

void osl_relation_list_push ( osl_relation_list_p head,
osl_relation_list_p  node 
)

osl_relation_list_push function: this function sees a list of relations as a stack of relations and performs the push operation onto this stack.

Parameters:
[in,out] head Pointer to the head of the relation stack.
[in,out] node Relation node to add to the stack. Its next field is updated to the previous head of the stack.

Definition at line 434 of file relation_list.c.

References osl_relation_list::next.

Referenced by osl_relation_list_dup().

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:
list The list of relations to set the type.
type The type.

Definition at line 581 of file relation_list.c.

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

Generated on Fri Feb 17 15:26:46 2012 for OpenScop by  doxygen 1.6.3