94   OSL_malloc(
string, 
char *, OSL_MAX_STRING * 
sizeof(
char));
 
   97   if (relation != NULL) {
 
   98     switch (relation->
type) {
 
  100         snprintf(
string, OSL_MAX_STRING, OSL_STRING_UNDEFINED);
 
  103       case OSL_TYPE_CONTEXT: {
 
  104         snprintf(
string, OSL_MAX_STRING, OSL_STRING_CONTEXT);
 
  107       case OSL_TYPE_DOMAIN: {
 
  108         snprintf(
string, OSL_MAX_STRING, OSL_STRING_DOMAIN);
 
  111       case OSL_TYPE_SCATTERING: {
 
  112         snprintf(
string, OSL_MAX_STRING, OSL_STRING_SCATTERING);
 
  115       case OSL_TYPE_READ: {
 
  116         snprintf(
string, OSL_MAX_STRING, OSL_STRING_READ);
 
  119       case OSL_TYPE_WRITE: {
 
  120         snprintf(
string, OSL_MAX_STRING, OSL_STRING_WRITE);
 
  123       case OSL_TYPE_MAY_WRITE: {
 
  124         snprintf(
string, OSL_MAX_STRING, OSL_STRING_MAY_WRITE);
 
  128         OSL_warning(
"unknown relation type, " 
  129                     "replaced with "OSL_STRING_UNDEFINED);
 
  130         snprintf(
string, OSL_MAX_STRING, OSL_STRING_UNDEFINED);
 
  149   fprintf(file, 
"%s", 
string);
 
  168   for (j = 0; j < level; j++)
 
  169     fprintf(file, 
"|\t");
 
  171   if (relation != NULL) {
 
  172     fprintf(file, 
"+-- osl_relation_t (");
 
  176     fprintf(file, 
")\n");
 
  179     fprintf(file, 
"+-- NULL relation\n");
 
  182   while (relation != NULL) {
 
  185       for (j = 0; j < level; j++)
 
  186         fprintf(file, 
"|\t");
 
  187       fprintf(file, 
"|   osl_relation_t (");
 
  191       fprintf(file, 
")\n");
 
  197     for(j = 0; j <= level; j++)
 
  198       fprintf(file, 
"|\t");
 
  199     fprintf(file, 
"%d %d %d %d %d %d\n",
 
  205     for (i = 0; i < relation->
nb_rows; i++) {
 
  206       for (j = 0; j <= level; j++)
 
  207         fprintf(file, 
"|\t");
 
  216       fprintf(file, 
"]\n");
 
  219     relation = relation->
next;
 
  222     if (relation != NULL) {
 
  223       for (j = 0; j <= level; j++)
 
  224         fprintf(file, 
"|\t");
 
  225       fprintf(file, 
"|\n");
 
  226       for (j = 0; j <= level; j++)
 
  227         fprintf(file, 
"|\t");
 
  228       fprintf(file, 
"V\n");
 
  233   for (j = 0; j <= level; j++)
 
  234     fprintf(file, 
"|\t");
 
  267                                        int precision, 
int * first,
 
  268                                        int cst, 
char * name) {
 
  269   char * temp, * body, * sval;
 
  271   OSL_malloc(temp, 
char *, OSL_MAX_STRING * 
sizeof(
char));
 
  272   OSL_malloc(body, 
char *, OSL_MAX_STRING * 
sizeof(
char));
 
  273   OSL_malloc(sval, 
char *, OSL_MAX_STRING * 
sizeof(
char));
 
  282         sprintf(sval, 
"%s", name);
 
  286           sprintf(sval, 
"-%s", name);
 
  290           sprintf(temp, 
"*%s", name);
 
  298         sprintf(sval, 
"+%s", name);
 
  304         sprintf(temp, 
"*%s", name);
 
  345   char temp[OSL_MAX_STRING];
 
  348   if ((relation == NULL) || (names == NULL)) {
 
  349     OSL_debug(
"no names or relation to build the name array");
 
  353   OSL_malloc(strings, 
char **, (relation->
nb_columns + 1)*
sizeof(
char *));
 
  357   OSL_strdup(strings[0], 
"e/i");
 
  363     OSL_strdup(strings[offset], 
"Arr");
 
  365     for (i = offset + 1; i < relation->
nb_output_dims + offset; i++) {
 
  366       sprintf(temp, 
"[%d]", i - 1);
 
  367       OSL_strdup(strings[i], temp);
 
  371   if ((relation->
type == OSL_TYPE_DOMAIN) ||
 
  372       (relation->
type == OSL_TYPE_CONTEXT)) {
 
  400   OSL_strdup(strings[offset], 
"1");
 
  421                                   int row, 
int start, 
int stop, 
int oppose,
 
  423   int i, first = 1, constant;
 
  427   OSL_malloc(sline, 
char *, OSL_MAX_STRING * 
sizeof(
char));
 
  431   for (i = start; i <= stop; i++) {
 
  434                      &relation->
m[row][i], relation->
m[row][i]);
 
  443         relation->
precision, &first, constant, strings[i]);
 
  447                      &relation->
m[row][i], relation->
m[row][i]);
 
  467                                int row, 
char ** strings) {
 
  492   if ((relation == NULL) ||
 
  493       (relation->
m == NULL) ||
 
  497   if ((row < 0) || (row > relation->
nb_rows))
 
  498     OSL_error(
"the specified row does not exist in the relation");
 
  541                                    char ** strings, 
char ** arrays) {
 
  543   int high_water_mark = OSL_MAX_STRING;
 
  544   char * 
string = NULL;
 
  546   char buffer[OSL_MAX_STRING];
 
  548   OSL_malloc(
string, 
char *, high_water_mark * 
sizeof(
char));
 
  551   if ((relation == NULL) || (strings == NULL)) {
 
  552     OSL_debug(
"no relation or names while asked to print a comment");
 
  563     snprintf(buffer, OSL_MAX_STRING, 
"   ## %s", expression);
 
  575       snprintf(buffer, OSL_MAX_STRING, 
" == %s", expression);
 
  580       snprintf(buffer, OSL_MAX_STRING, 
" == %s",
 
  589     snprintf(buffer, OSL_MAX_STRING, 
"   ## %s", expression);
 
  594       snprintf(buffer, OSL_MAX_STRING, 
" == 0");
 
  596       snprintf(buffer, OSL_MAX_STRING, 
" >= 0");
 
  616   int index_output_dims;
 
  617   int index_input_dims;
 
  618   int index_local_dims;
 
  619   int index_parameters;
 
  621   int space, length, left, right;
 
  623   char temp[OSL_MAX_STRING];
 
  625   OSL_malloc(scolumn, 
char *, OSL_MAX_STRING);
 
  627   index_output_dims = 1;
 
  629   index_local_dims  = index_input_dims  + relation->
nb_input_dims;
 
  630   index_parameters  = index_local_dims  + relation->
nb_local_dims;
 
  634   sprintf(scolumn, 
"#");
 
  635   for (j = 0; j < (OSL_FMT_LENGTH - 1)/2 - 1; j++)
 
  636     strcat(scolumn, 
" ");
 
  639   while (strings[i] != NULL) {
 
  640     space  = OSL_FMT_LENGTH;
 
  641     length = (space > (int)strlen(strings[i])) ? (
int)strlen(strings[i]) : space;
 
  642     right  = (space - length + (OSL_FMT_LENGTH % 2)) / 2;
 
  643     left   = space - length - right;
 
  646     for (j = 0; j < left; j++)
 
  647       strcat(scolumn, 
" ");
 
  650     for (j = 0; j < length - 1; j++) {
 
  651       sprintf(temp, 
"%c", strings[i][j]);
 
  652       strcat(scolumn, temp);
 
  654     if (length >= (
int)strlen(strings[i]))
 
  655       sprintf(temp, 
"%c", strings[i][j]);
 
  658     strcat(scolumn, temp);
 
  661     for (j = 0; j < right; j++)
 
  662       strcat(scolumn, 
" ");
 
  665     if ((i == index_output_dims) ||
 
  666         (i == index_input_dims)  ||
 
  667         (i == index_local_dims)  ||
 
  668         (i == index_parameters)  ||
 
  670       strcat(scolumn, 
"|");
 
  672       strcat(scolumn, 
" ");
 
  674   strcat(scolumn, 
"\n");
 
  693   int index_output_dims;
 
  694   int index_input_dims;
 
  695   int index_local_dims;
 
  696   int index_parameters;
 
  698   int space, length, left, right;
 
  700   char temp[OSL_MAX_STRING];
 
  702   OSL_malloc(scolumn, 
char *, OSL_MAX_STRING);
 
  704   index_output_dims = 1;
 
  706   index_local_dims  = index_input_dims  + relation->
nb_input_dims;
 
  707   index_parameters  = index_local_dims  + relation->
nb_local_dims;
 
  711   sprintf(scolumn, 
"#");
 
  712   for (j = 0; j < (OSL_FMT_LENGTH - 1)/2 - 1; j++)
 
  713     strcat(scolumn, 
" ");
 
  716   while (strings[i] != NULL) {
 
  719         (relation->
type != OSL_TYPE_DOMAIN && i >= index_input_dims) ||
 
  720         (relation->
type == OSL_TYPE_DOMAIN && i <= index_output_dims) ||
 
  721         i >= index_parameters) {
 
  722       space  = OSL_FMT_LENGTH;
 
  723       length = (space > (int)strlen(strings[i])) ? (
int)strlen(strings[i]) : space;
 
  724       right  = (space - length + (OSL_FMT_LENGTH % 2)) / 2;
 
  725       left   = space - length - right;
 
  728       for (j = 0; j < left; j++)
 
  729         strcat(scolumn, 
" ");
 
  732       for (j = 0; j < length - 1; j++) {
 
  733         sprintf(temp, 
"%c", strings[i][j]);
 
  734         strcat(scolumn, temp);
 
  736       if (length >= (
int)strlen(strings[i]))
 
  737         sprintf(temp, 
"%c", strings[i][j]);
 
  740       strcat(scolumn, temp);
 
  743       for (j = 0; j < right; j++)
 
  744         strcat(scolumn, 
" ");
 
  746       if ((i == index_output_dims-1) ||
 
  747           (i == index_input_dims-1)  ||
 
  748           (i == index_local_dims-1)  ||
 
  749           (i == index_parameters-1)  ||
 
  750           (i == index_scalar-1))
 
  751         strcat(scolumn, 
"|");
 
  753         strcat(scolumn, 
" ");
 
  758   strcat(scolumn, 
"\n");
 
  773   int nb_parameters = OSL_UNDEFINED;
 
  774   int nb_iterators  = OSL_UNDEFINED;
 
  775   int nb_scattdims  = OSL_UNDEFINED;
 
  776   int nb_localdims  = OSL_UNDEFINED;
 
  777   int array_id      = OSL_UNDEFINED;
 
  780                               &nb_scattdims, &nb_localdims, &array_id);
 
  798   int nb_components = 0;
 
  800   while (relation != NULL) {
 
  802     relation = relation->
next;
 
  805   return nb_components;
 
  822   int generated_names = 0;
 
  823   int high_water_mark = OSL_MAX_STRING;
 
  824   char * 
string = NULL;
 
  825   char buffer[OSL_MAX_STRING];
 
  826   char ** name_array = NULL;
 
  830   if (relation == NULL)
 
  833   OSL_malloc(
string, 
char *, high_water_mark * 
sizeof(
char));
 
  845     snprintf(buffer, OSL_MAX_STRING, 
"# Union with %d parts\n%d\n",
 
  851   for (part = 1; part <= nb_parts; part++) {
 
  856       snprintf(buffer, OSL_MAX_STRING, 
"# Union part No.%d\n", part);
 
  860     snprintf(buffer, OSL_MAX_STRING, 
"%d %d %d %d %d %d\n",
 
  868       snprintf(buffer, OSL_MAX_STRING, 
"%s", scolumn);
 
  873     for (i = 0; i < relation->
nb_rows; i++) {
 
  877         snprintf(buffer, OSL_MAX_STRING, 
" ");
 
  881       if (name_array != NULL) {
 
  887       snprintf(buffer, OSL_MAX_STRING, 
"\n");
 
  892     if (name_array != NULL) {
 
  898     relation = relation->
next;
 
  925   int generated_names = 0;
 
  927   int high_water_mark = OSL_MAX_STRING;
 
  929   int index_output_dims;
 
  930   int index_input_dims;
 
  932   char * 
string = NULL;
 
  933   char buffer[OSL_MAX_STRING];
 
  934   char ** name_array = NULL;
 
  938   if (relation == NULL)
 
  941   OSL_malloc(
string, 
char *, high_water_mark * 
sizeof(
char));
 
  952     snprintf(buffer, OSL_MAX_STRING, 
"# Union with %d parts\n%d\n",
 
  957   is_access_array = (relation->
type == OSL_TYPE_READ ||
 
  958                      relation->
type == OSL_TYPE_WRITE ? 1 : 0);
 
  962   for (part = 1; part <= nb_parts; part++) {
 
  964     index_output_dims = 1;
 
  972       snprintf(buffer, OSL_MAX_STRING, 
"# Union part No.%d\n", part);
 
  976     if (print_nth_part) {
 
  977       snprintf(buffer, OSL_MAX_STRING, 
"%d\n", part);
 
  983     if (!is_access_array) {
 
  986       if (relation->
type == OSL_TYPE_DOMAIN) {
 
  990           snprintf(buffer, OSL_MAX_STRING, 
"%d %d\n",
 
  996           snprintf(buffer, OSL_MAX_STRING, 
"   0 ");
 
  998           snprintf(buffer, OSL_MAX_STRING, 
"   1 "); 
 
 1002             snprintf(buffer, OSL_MAX_STRING, 
"   0 ");
 
 1006           snprintf(buffer, OSL_MAX_STRING, 
"    0  ## fakeiter == 0\n");
 
 1010           snprintf(buffer, OSL_MAX_STRING, 
"%d %d\n",
 
 1019           snprintf(buffer, OSL_MAX_STRING, 
"%d %d\n",
 
 1024           snprintf(buffer, OSL_MAX_STRING, 
"%d %d\n",
 
 1034         snprintf(buffer, OSL_MAX_STRING, 
"%s", scolumn);
 
 1050     for (i = start_row; i < relation->
nb_rows; i++) {
 
 1053       if (!is_access_array) {
 
 1057         snprintf(buffer, OSL_MAX_STRING, 
" ");
 
 1066           snprintf(buffer, OSL_MAX_STRING, 
"   0 ");
 
 1069         snprintf(buffer, OSL_MAX_STRING, 
" ");
 
 1074       if (relation->
type == OSL_TYPE_DOMAIN) {
 
 1076         for (j = 1; j < index_input_dims; j++) {
 
 1079           snprintf(buffer, OSL_MAX_STRING, 
" ");
 
 1084         for (j = index_params; j < relation->
nb_columns; j++) {
 
 1087           snprintf(buffer, OSL_MAX_STRING, 
" ");
 
 1094         for (j = index_input_dims; j < index_params; j++) {
 
 1095           if (is_access_array && relation->
nb_rows == 1 &&
 
 1097             snprintf(buffer, OSL_MAX_STRING, 
"   0 ");
 
 1102             snprintf(buffer, OSL_MAX_STRING, 
" ");
 
 1108           snprintf(buffer, OSL_MAX_STRING, 
"   0 ");
 
 1113           if (is_access_array && relation->
nb_rows == 1 &&
 
 1115             snprintf(buffer, OSL_MAX_STRING, 
"  0 ");
 
 1120             snprintf(buffer, OSL_MAX_STRING, 
" ");
 
 1127       if (name_array != NULL) {
 
 1132         snprintf(buffer, OSL_MAX_STRING, 
"\n");
 
 1137       if (relation->
nb_rows > 0 && add_fakeiter &&
 
 1138           relation->
type == OSL_TYPE_SCATTERING) {
 
 1140         for (i = 0 ; i < 2 ; i++) {
 
 1142             if (j == index_output_dims && i == 0)
 
 1143               snprintf(buffer, OSL_MAX_STRING, 
"   1 "); 
 
 1145               snprintf(buffer, OSL_MAX_STRING, 
"   0 ");
 
 1148           snprintf(buffer, OSL_MAX_STRING, 
"\n");
 
 1156     if (name_array != NULL) {
 
 1158         free(name_array[i]);
 
 1162     relation = relation->
next;
 
 1165   if (generated_names)
 
 1181   int high_water_mark = OSL_MAX_STRING;
 
 1182   char * 
string = NULL;
 
 1184   char buffer[OSL_MAX_STRING];
 
 1185   OSL_malloc(
string, 
char *, high_water_mark * 
sizeof(
char));
 
 1193     snprintf(buffer, OSL_MAX_STRING, 
"\n");
 
 1216                                     int print_nth_part, 
int add_fakeiter) {
 
 1217   int high_water_mark = OSL_MAX_STRING;
 
 1218   char * 
string = NULL;
 
 1220   OSL_malloc(
string, 
char *, high_water_mark * 
sizeof(
char));
 
 1225                                                 print_nth_part, add_fakeiter);
 
 1245   fprintf(file, 
"%s", 
string);
 
 1264                                                print_nth_part, add_fakeiter);
 
 1265   fprintf(file, 
"%s", 
string);
 
 1317   if ((file != NULL && str != NULL) || (file == NULL && str == NULL))
 
 1318     OSL_error(
"one and only one of the two parameters can be non-NULL");
 
 1326     OSL_warning(
"uninterpreted information (after the relation type)");
 
 1329     OSL_error(
"no relation type");
 
 1331   if (!strcmp(strings->
string[0], OSL_STRING_UNDEFINED)) {
 
 1332     type = OSL_UNDEFINED;
 
 1336   if (!strcmp(strings->
string[0], OSL_STRING_CONTEXT)) {
 
 1337     type = OSL_TYPE_CONTEXT; 
 
 1341   if (!strcmp(strings->
string[0], OSL_STRING_DOMAIN)) {
 
 1342     type = OSL_TYPE_DOMAIN; 
 
 1346   if (!strcmp(strings->
string[0], OSL_STRING_SCATTERING)) {
 
 1347     type = OSL_TYPE_SCATTERING; 
 
 1351   if (!strcmp(strings->
string[0], OSL_STRING_READ)) {
 
 1352     type = OSL_TYPE_READ; 
 
 1356   if (!strcmp(strings->
string[0], OSL_STRING_WRITE)) {
 
 1357     type = OSL_TYPE_WRITE; 
 
 1361   if (!strcmp(strings->
string[0], OSL_STRING_MAY_WRITE)) {
 
 1362     type = OSL_TYPE_MAY_WRITE; 
 
 1366   OSL_error(
"relation type not supported");
 
 1383   int i, j, k, n, read = 0;
 
 1384   int nb_rows, nb_columns;
 
 1385   int nb_output_dims, nb_input_dims, nb_local_dims, nb_parameters;
 
 1386   int nb_union_parts = 1;
 
 1387   int may_read_nb_union_parts = 1;
 
 1388   int read_attributes = 1;
 
 1391   char * c, s[OSL_MAX_STRING], str[OSL_MAX_STRING], *tmp;
 
 1397   for (k = 0; k < nb_union_parts; k++) {
 
 1399     while (read_attributes) {
 
 1400       read_attributes = 0;
 
 1404       read = sscanf(c, 
" %d %d %d %d %d %d", &nb_rows, &nb_columns,
 
 1405                                              &nb_output_dims, &nb_input_dims,
 
 1406                                              &nb_local_dims, &nb_parameters);
 
 1408       if (((read != 1) && (read != 6)) ||
 
 1409           ((read == 1) && (may_read_nb_union_parts != 1)))
 
 1410         OSL_error(
"not 1 or 6 integers on the first relation line");
 
 1414         nb_union_parts = nb_rows;
 
 1415         if (nb_union_parts < 1)
 
 1416           OSL_error(
"negative nb of union parts");
 
 1419         read_attributes = 1;
 
 1422       may_read_nb_union_parts = 0;
 
 1427     relation->
type           = type;
 
 1434     for (i = 0; i < relation->
nb_rows; i++) {
 
 1437         OSL_error(
"not enough rows");
 
 1440         if (c == NULL || *c == 
'#' || *c == 
'\n')
 
 1441           OSL_error(
"not enough columns");
 
 1442         if (sscanf(c, 
"%s%n", str, &n) == 0)
 
 1443           OSL_error(
"not enough rows");
 
 1454       relation_union = relation;
 
 1458       previous->
next = relation;
 
 1461     previous = relation;
 
 1462     read_attributes = 1;
 
 1465   return relation_union;
 
 1481   relation->
type = type; 
 
 1498   int i, j, k, n, read = 0;
 
 1499   int nb_rows, nb_columns;
 
 1500   int nb_output_dims, nb_input_dims, nb_local_dims, nb_parameters;
 
 1501   int nb_union_parts = 1;
 
 1502   int may_read_nb_union_parts = 1;
 
 1503   int read_attributes = 1;
 
 1505   char str[OSL_MAX_STRING], *tmp;
 
 1509   for (k = 0; k < nb_union_parts; k++) {
 
 1511     while (read_attributes) {
 
 1512       read_attributes = 0;
 
 1517       while ((*tmp != 
'\0') && (*tmp != 
'\n'))
 
 1519       strncpy(str, *input, 
sizeof(
char) * (tmp-*input));
 
 1520       str[(tmp-*input)] = 
'\0'; 
 
 1522       read = sscanf(str, 
" %d %d %d %d %d %d",
 
 1523           &nb_rows, &nb_columns,
 
 1524           &nb_output_dims, &nb_input_dims,
 
 1525           &nb_local_dims, &nb_parameters);
 
 1528       if (((read != 1) && (read != 6)) ||
 
 1529           ((read == 1) && (may_read_nb_union_parts != 1)))
 
 1530         OSL_error(
"not 1 or 6 integers on the first relation line");
 
 1534         nb_union_parts = nb_rows;
 
 1535         if (nb_union_parts < 1)
 
 1536           OSL_error(
"negative nb of union parts");
 
 1539         read_attributes = 1;
 
 1542       may_read_nb_union_parts = 0;
 
 1553     for (i = 0; i < relation->
nb_rows; i++) {
 
 1556         OSL_error(
"not enough rows");
 
 1559         if (*input == NULL || **input == 
'#' || **input == 
'\n')
 
 1560           OSL_error(
"not enough columns");
 
 1561         if (sscanf(*input, 
"%s%n", str, &n) == 0)
 
 1562           OSL_error(
"not enough rows");
 
 1573       relation_union = relation;
 
 1577       previous->
next = relation;
 
 1580     previous = relation;
 
 1581     read_attributes = 1;
 
 1584   return relation_union;
 
 1643                                     int nb_rows, 
int nb_columns) {
 
 1648   if ((precision != OSL_PRECISION_SP) &&
 
 1649       (precision != OSL_PRECISION_DP) &&
 
 1650       (precision != OSL_PRECISION_MP))
 
 1651     OSL_error(
"unknown precision");
 
 1653   if ((nb_rows < 0) || (nb_columns < 0))
 
 1654     OSL_error(
"negative sizes");
 
 1657   relation->
type           = OSL_UNDEFINED;
 
 1666   if ((nb_rows == 0) || (nb_columns == 0) ||
 
 1667       (nb_rows == OSL_UNDEFINED) || (nb_columns == OSL_UNDEFINED)) {
 
 1674     for (i = 0; i < nb_rows; i++) {
 
 1675       relation->
m[i] = q + i * nb_columns ;
 
 1676       for (j = 0; j < nb_columns; j++)
 
 1681   relation->
next = NULL;
 
 1709   if (relation == NULL)
 
 1714   for (i = 0; i < nb_elements; i++)
 
 1717   if (relation->
m != NULL) {
 
 1718     if (nb_elements > 0)
 
 1719       free(relation->
m[0]);
 
 1734   while (relation != NULL) {
 
 1735     tmp = relation->
next;
 
 1760   int first = 1, nb_components, nb_parts;
 
 1764   nb_parts = (n == -1) ? nb_components : n;
 
 1765   if (nb_components < nb_parts)
 
 1766     OSL_error(
"not enough union parts to clone");
 
 1768   for (k = 0; k < nb_parts; k++) {
 
 1771     node->type           = relation->
type;
 
 1777     for (i = 0; i < relation->
nb_rows; i++)
 
 1780                        &node->m[i][j], relation->
m[i][j]);
 
 1788       previous->
next = node;
 
 1789       previous = previous->
next;
 
 1792     relation = relation->
next;
 
 1814   int first = 1, all_rows = 0;
 
 1820   while (relation != NULL) {
 
 1825       OSL_error(
"not enough rows to clone in the relation");
 
 1828     node->type           = relation->
type;
 
 1834     for (i = 0; i < n; i++)
 
 1837                        &node->m[i][j], relation->
m[i][j]);
 
 1845       previous->
next = node;
 
 1846       previous = previous->
next;
 
 1849     relation = relation->
next;
 
 1864   if (relation == NULL)
 
 1882     r1 = &((*r1)->next);
 
 1901   if ((r1 == NULL) && (r2 == NULL))
 
 1925   if ((relation == NULL) || (vector == NULL)     ||
 
 1928       (row >= relation->
nb_rows) || (row < 0))
 
 1929     OSL_error(
"vector cannot replace relation row");
 
 1931   for (i = 0; i < vector->
size; i++)
 
 1949   if ((relation == NULL) || (vector == NULL)     ||
 
 1952       (row >= relation->
nb_rows) || (row < 0))
 
 1953     OSL_error(
"vector cannot be added to relation");
 
 1958   for (i = 1; i < vector->
size; i++)
 
 1960                 &relation->
m[row][i], relation->
m[row][i], vector->
v[i]);
 
 1977   if ((relation == NULL) || (vector == NULL)     ||
 
 1980       (row >= relation->
nb_rows) || (row < 0))
 
 1981     OSL_error(
"vector cannot be subtracted to row");
 
 1986   for (i = 1; i < vector->
size; i++)
 
 1988                 &relation->
m[row][i], relation->
m[row][i], vector->
v[i]);
 
 2047   if (relation != NULL) {
 
 2068   if (relation == NULL)
 
 2071   if ((column < 0) || (column > relation->
nb_columns))
 
 2072     OSL_error(
"bad column number");
 
 2078   for (i = 0; i < relation->
nb_rows; i++) {
 
 2079     for (j = 0; j < column; j++)
 
 2082     for (j = column; j < relation->
nb_columns; j++)
 
 2090   relation->
m = temp->
m;
 
 2129   if ((r1 == NULL) || (r2 == NULL)       ||
 
 2133     OSL_error(
"relation rows could not be replaced");
 
 2135   for (i = 0; i < r2->
nb_rows; i++)
 
 2158   if ((r1 == NULL) || (r2 == NULL))
 
 2166       (row > r1->
nb_rows) || (row < 0))
 
 2167     OSL_error(
"constraints cannot be inserted");
 
 2173   for (i = 0; i < row; i++)
 
 2205   if ((relation == NULL) || (c1 == c2))
 
 2208   if ((c1 >= relation->
nb_rows) || (c1 < 0) ||
 
 2209       (c2 >= relation->
nb_rows) || (c2 < 0))
 
 2210     OSL_error(
"bad constraint rows");
 
 2214                  &relation->
m[c1][i], &relation->
m[c2][i]);
 
 2232   if ((row < 0) || (row >= r->
nb_rows))
 
 2233     OSL_error(
"bad row number");
 
 2239   for (i = 0; i < row; i++)
 
 2243   for (i = row + 1; i < r->
nb_rows; i++)
 
 2272   if ((column < 0) || (column >= r->
nb_columns))
 
 2273     OSL_error(
"bad column number");
 
 2279   for (i = 0; i < r->
nb_rows; i++) {
 
 2280     for (j = 0; j < column; j++)
 
 2314   if ((relation == NULL) || (insert == NULL))
 
 2319       (column < 0) || (column > relation->
nb_columns))
 
 2320     OSL_error(
"columns cannot be inserted");
 
 2326   for (i = 0; i < relation->
nb_rows; i++) {
 
 2327     for (j = 0; j < column; j++)
 
 2330     for (j = column; j < column + insert->
nb_columns; j++)
 
 2332                      &temp->
m[i][j], insert->
m[i][j - column]);
 
 2335          j < insert->nb_columns + relation->
nb_columns; j++)
 
 2337                      &temp->
m[i][j], relation->
m[i][j - insert->
nb_columns]);
 
 2344   relation->
m = temp->
m;
 
 2374     OSL_error(
"incompatible sizes for concatenation");
 
 2377     OSL_warning(
"relation concatenation is done on the first elements " 
 2404   if (((r1 == NULL) && (r2 != NULL)) ||
 
 2405       ((r1 != NULL) && (r2 == NULL)))
 
 2418   for (i = 0; i < r1->
nb_rows; ++i)
 
 2436   while ((r1 != NULL) && (r2 != NULL)) {
 
 2444   if (((r1 == NULL) && (r2 != NULL)) || ((r1 != NULL) && (r2 == NULL)))
 
 2466   if (*expected != OSL_UNDEFINED) { 
 
 2467     if ((actual != OSL_UNDEFINED) &&
 
 2468         (actual != *expected)) {
 
 2469       OSL_warning(
"unexpected atribute");
 
 2496                                   int expected_nb_output_dims,
 
 2497                                   int expected_nb_input_dims,
 
 2498                                   int expected_nb_parameters) {
 
 2499   int expected_nb_local_dims, expected_nb_columns;
 
 2501   if ((expected_nb_output_dims != OSL_UNDEFINED) &&
 
 2502       (expected_nb_input_dims  != OSL_UNDEFINED) &&
 
 2503       (expected_nb_parameters  != OSL_UNDEFINED)) {
 
 2506       expected_nb_local_dims = 0;
 
 2510     expected_nb_columns = expected_nb_output_dims +
 
 2511                           expected_nb_input_dims  +
 
 2512                           expected_nb_local_dims  +
 
 2513                           expected_nb_parameters  +
 
 2516     if (expected_nb_columns != relation->
nb_columns) {
 
 2517       OSL_warning(
"unexpected number of columns");
 
 2542                                  int expected_nb_output_dims,
 
 2543                                  int expected_nb_input_dims,
 
 2544                                  int expected_nb_parameters) {
 
 2548   if (relation == NULL) {
 
 2549     if ((expected_nb_output_dims != OSL_UNDEFINED) ||
 
 2550         (expected_nb_input_dims  != OSL_UNDEFINED) ||
 
 2551         (expected_nb_parameters  != OSL_UNDEFINED)) {
 
 2552       OSL_debug(
"NULL relation with some expected attibutes");
 
 2560   if (((expected_type != OSL_TYPE_ACCESS) &&
 
 2561        (expected_type != relation->
type)) ||
 
 2562       ((expected_type == OSL_TYPE_ACCESS) &&
 
 2564     OSL_warning(
"wrong type");
 
 2574     OSL_warning(
"all attributes should be defined");
 
 2580   if ((relation->
type == OSL_TYPE_CONTEXT) &&
 
 2582     OSL_warning(
"context without 0 as number of output dimensions");
 
 2588   if (((relation->
type == OSL_TYPE_DOMAIN) ||
 
 2589        (relation->
type == OSL_TYPE_CONTEXT)) &&
 
 2591     OSL_warning(
"domain or context without 0 input dimensions");
 
 2608   while (relation != NULL) {
 
 2615       OSL_warning(
"inconsistent attributes");
 
 2622                                        expected_nb_output_dims,
 
 2623                                        expected_nb_input_dims,
 
 2624                                        expected_nb_parameters)) {
 
 2632       for (i = 0; i < relation->
nb_rows; i++) {
 
 2635           OSL_warning(
"first column of a relation is not " 
 2636                            "strictly made of 0 or 1");
 
 2650     relation = relation->
next;
 
 2668                                      int nb_output_dims, 
int nb_input_dims,
 
 2669                                      int nb_local_dims,  
int nb_parameters) {
 
 2670   if (relation != NULL) {
 
 2690                                  int nb_output_dims, 
int nb_input_dims,
 
 2691                                  int nb_local_dims,  
int nb_parameters) {
 
 2692   while (relation != NULL) {
 
 2694                                     nb_output_dims, nb_input_dims,
 
 2695                                     nb_local_dims,  nb_parameters);
 
 2696     relation = relation->
next;
 
 2710   while (relation != NULL) {
 
 2711     relation->
type = type;
 
 2712     relation = relation->
next;
 
 2728   int array_id = OSL_UNDEFINED;
 
 2729   int reference_array_id = OSL_UNDEFINED;
 
 2734   if (relation == NULL)
 
 2735     return OSL_UNDEFINED;
 
 2738     OSL_warning(
"asked for an array id of non-array relation");
 
 2739     return OSL_UNDEFINED;
 
 2742   while (relation != NULL) {
 
 2746     if ((relation->
nb_rows < 1) ||
 
 2748       OSL_warning(
"no array identifier in an access function");
 
 2749       return OSL_UNDEFINED;
 
 2759     for (i = 0; i < relation->
nb_rows; i++) {
 
 2765     if (nb_array_id == 0) {
 
 2766       OSL_warning(
"no array identifier in an access function");
 
 2767       return OSL_UNDEFINED;
 
 2769     if (nb_array_id > 1) {
 
 2770       OSL_warning(
"several array identifiers in one access function");
 
 2771       return OSL_UNDEFINED;
 
 2773     for (i = 0; i < relation->
nb_columns - 1; i++) {
 
 2774       if ((i != 1) && !
osl_int_zero(precision, relation->
m[row_id][i])) {
 
 2775         OSL_warning(
"non integer array identifier");
 
 2776         return OSL_UNDEFINED;
 
 2781                            relation->
m[row_id][1])) {
 
 2782       OSL_warning(
"rational array identifier");
 
 2783       return OSL_UNDEFINED;
 
 2788     if (array_id <= 0) {
 
 2789       OSL_warning(
"negative or 0 identifier in access function");
 
 2790       return OSL_UNDEFINED;
 
 2795       reference_array_id = array_id;
 
 2799       if (reference_array_id != array_id) {
 
 2800         OSL_warning(
"inconsistency of array identifiers in an " 
 2801                     "union of access relations");
 
 2802         return OSL_UNDEFINED;
 
 2806     relation = relation->
next;
 
 2822   if (relation == NULL)
 
 2825   if ((relation->
type == OSL_TYPE_ACCESS)    ||
 
 2826       (relation->
type == OSL_TYPE_READ)      ||
 
 2827       (relation->
type == OSL_TYPE_WRITE)     ||
 
 2828       (relation->
type == OSL_TYPE_MAY_WRITE))
 
 2854                                  int * nb_parameters,
 
 2860   int local_nb_parameters = OSL_UNDEFINED;
 
 2861   int local_nb_iterators  = OSL_UNDEFINED;
 
 2862   int local_nb_scattdims  = OSL_UNDEFINED;
 
 2863   int local_nb_localdims  = OSL_UNDEFINED;
 
 2864   int local_array_id      = OSL_UNDEFINED;
 
 2866   while (relation != NULL) {
 
 2868       type = OSL_TYPE_ACCESS;
 
 2870       type = relation->
type;
 
 2874       case OSL_TYPE_CONTEXT:
 
 2876         local_nb_iterators  = 0;
 
 2877         local_nb_scattdims  = 0;
 
 2882       case OSL_TYPE_DOMAIN:
 
 2885         local_nb_scattdims  = 0;
 
 2890       case OSL_TYPE_SCATTERING:
 
 2898       case OSL_TYPE_ACCESS:
 
 2901         local_nb_scattdims  = 0;
 
 2915     *nb_parameters = OSL_max(*nb_parameters, local_nb_parameters);
 
 2916     *nb_iterators  = OSL_max(*nb_iterators,  local_nb_iterators);
 
 2917     *nb_scattdims  = OSL_max(*nb_scattdims,  local_nb_scattdims);
 
 2918     *nb_localdims  = OSL_max(*nb_localdims,  local_nb_localdims);
 
 2919     *array_id      = OSL_max(*array_id,      local_array_id);
 
 2920     relation = relation->
next;
 
 2943   while (relation != NULL) {
 
 2945       OSL_error(
"Number of output dims is greater than required extension");
 
 2952     node->type           = relation->
type;
 
 2960     for (i = 0; i < relation->
nb_rows; i++) {
 
 2965            j < relation->nb_columns + offset; j++)
 
 2966         osl_int_assign(precision, &node->m[i][j], relation->
m[i][j - offset]);
 
 2970     for (i = relation->
nb_rows; i < relation->nb_rows + offset; i++) {
 
 2971       for (j = 0; j < relation->
nb_columns + offset; j++) {
 
 2983       previous->
next = node;
 
 2984       previous = previous->
next;
 
 2987     relation = relation->
next;
 
 3003   OSL_strdup(interface->URI, OSL_URI_RELATION);
 
 3027       for (i = 0; i < (size_t)r->
nb_rows; ++i) {
 
 3028         for (j = 0; j < (size_t)r->
nb_columns; ++j) {
 
int osl_int_get_si(int precision, osl_const_int_t value)
Get the value in a int. 
char * osl_relation_spprint(osl_relation_p relation, osl_names_p names)
void osl_relation_free(osl_relation_p relation)
osl_names_p osl_names_generate(char *parameter_prefix, int nb_parameters, char *iterator_prefix, int nb_iterators, char *scatt_dim_prefix, int nb_scatt_dims, char *local_dim_prefix, int nb_local_dims, char *array_prefix, int nb_arrays)
char * osl_relation_expression(osl_relation_p relation, int row, char **strings)
osl_relation_p osl_relation_clone_nconstraints(osl_relation_p relation, int n)
osl_relation_p osl_relation_pmalloc(int precision, int nb_rows, int nb_columns)
int osl_int_one(int precision, osl_const_int_t value)
value == 1 
void *(* osl_clone_f)(void *)
void osl_int_oppose(int precision, osl_int_const_p variable, osl_const_int_t value)
variable = - value 
int osl_int_divisible(int precision, osl_const_int_t val1, osl_const_int_t val2)
(val1 % val2) == 0 
static char * osl_relation_sprint_type(osl_relation_p relation)
char * osl_relation_spprint_polylib_scoplib(osl_relation_p relation, osl_names_p names, int print_nth_part, int add_fakeiter)
void osl_relation_free_inside(osl_relation_p relation)
struct osl_relation * next
osl_relation_p osl_relation_union(osl_relation_p r1, osl_relation_p r2)
void osl_int_swap(int precision, osl_int_const_p var1, osl_int_const_p var2)
Swap the osl ints. 
osl_interface_p osl_interface_malloc()
static char * osl_relation_column_string_scoplib(osl_relation_p relation, char **strings)
int osl_int_mone(int precision, osl_const_int_t value)
value == -1 
void osl_vector_free(osl_vector_p vector)
char * osl_relation_sprint(osl_relation_p relation)
void osl_int_sread(char **string, int precision, osl_int_const_p i)
sread for osl int 
int osl_int_neg(int precision, osl_const_int_t value)
value < 0 
char * osl_relation_spprint_polylib(osl_relation_p relation, osl_names_p names)
void osl_relation_print(FILE *file, osl_relation_p relation)
static void osl_relation_print_type(FILE *file, osl_relation_p relation)
int osl_int_ne(int precision, osl_const_int_t val1, osl_const_int_t val2)
val1 != val2 
void osl_int_sub(int precision, osl_int_const_p variable, osl_const_int_t val1, osl_const_int_t val2)
variable = val1 - val2 
void osl_relation_insert_constraints(osl_relation_p r1, osl_relation_p r2, int row)
static char * osl_relation_column_string(osl_relation_p relation, char **strings)
char * osl_util_strdup(char const *str)
String duplicate. 
void osl_relation_set_attributes_one(osl_relation_p relation, int nb_output_dims, int nb_input_dims, int nb_local_dims, int nb_parameters)
static char * osl_relation_sprint_comment(osl_relation_p relation, int row, char **strings, char **arrays)
void *(* osl_sread_f)(char **)
void osl_int_clear(int precision, osl_int_const_p variable)
variable = 0 // including cleaning for GMP 
void osl_relation_pprint(FILE *file, osl_relation_p relation, osl_names_p names)
osl_strings_p osl_strings_sread(char **input)
int osl_relation_get_array_id(osl_relation_p relation)
void osl_int_set_precision(int const precision, int const new_precision, osl_int_p i)
Change the precision of the osl_int. 
void osl_relation_dump(FILE *file, osl_relation_p relation)
int osl_relation_is_access(osl_relation_p relation)
void osl_util_safe_strcat(char **dst, char *src, int *hwm)
int osl_relation_equal(osl_relation_p r1, osl_relation_p r2)
void osl_relation_idump(FILE *file, osl_relation_p relation, int level)
static int osl_relation_is_simple_output(osl_relation_p relation, int row)
void osl_int_init_set_si(int precision, osl_int_const_p variable, int i)
variable = i // including initialization for GMP 
static char * osl_relation_subexpression(osl_relation_p relation, int row, int start, int stop, int oppose, char **strings)
void osl_relation_insert_blank_column(osl_relation_p relation, int column)
int osl_util_get_precision()
void osl_int_print(FILE *file, int precision, osl_const_int_t value)
osl_strings_p osl_strings_read(FILE *file)
void osl_relation_replace_constraints(osl_relation_p r1, osl_relation_p r2, int row)
osl_vector_p osl_vector_pmalloc(int precision, int size)
void osl_relation_pprint_scoplib(FILE *file, osl_relation_p relation, osl_names_p names, int print_nth_part, int add_fakeiter)
void osl_relation_sub_vector(osl_relation_p relation, osl_vector_p vector, int row)
size_t osl_strings_size(osl_const_strings_const_p strings)
void osl_util_sskip_blank_and_comments(char **str)
void(* osl_idump_f)(FILE *, void *, int)
void osl_relation_replace_vector(osl_relation_p relation, osl_vector_p vector, int row)
char * osl_relation_spprint_scoplib(osl_relation_p relation, osl_names_p names, int print_nth_part, int add_fakeiter)
osl_relation_p osl_relation_read(FILE *foo)
void osl_relation_set_type(osl_relation_p relation, int type)
void osl_relation_get_attributes(osl_relation_p relation, int *nb_parameters, int *nb_iterators, int *nb_scattdims, int *nb_localdims, int *array_id)
static int osl_relation_read_type(FILE *file, char **str)
void osl_names_free(osl_names_p names)
void osl_relation_insert_blank_row(osl_relation_p relation, int row)
static int osl_relation_check_nb_columns(osl_relation_p relation, int expected_nb_output_dims, int expected_nb_input_dims, int expected_nb_parameters)
void osl_int_set_si(int precision, osl_int_const_p variable, int i)
variable = i 
int osl_relation_integrity_check(osl_relation_p relation, int expected_type, int expected_nb_output_dims, int expected_nb_input_dims, int expected_nb_parameters)
void osl_relation_insert_columns(osl_relation_p relation, osl_relation_p insert, int column)
void osl_int_sprint_txt(char *string, int precision, osl_const_int_t value)
char *(* osl_sprint_f)(void *)
osl_relation_p osl_relation_sread(char **input)
char * osl_util_skip_blank_and_comments(FILE *file, char *str)
void osl_int_add(int precision, osl_int_const_p variable, osl_const_int_t val1, osl_const_int_t val2)
variable = val1 + val2 
osl_relation_p osl_relation_sread_polylib(char **input)
void osl_relation_add(osl_relation_p *r1, osl_relation_p r2)
osl_relation_p osl_relation_clone(osl_relation_p relation)
void osl_relation_remove_column(osl_relation_p r, int column)
int osl_relation_nb_components(osl_relation_p relation)
void osl_relation_add_vector(osl_relation_p relation, osl_vector_p vector, int row)
osl_relation_p osl_relation_malloc(int nb_rows, int nb_columns)
osl_relation_p osl_relation_nclone(osl_relation_p relation, int n)
static char * osl_relation_expression_element(osl_int_t val, int precision, int *first, int cst, char *name)
osl_relation_p osl_relation_concat_constraints(osl_relation_p r1, osl_relation_p r2)
void osl_relation_remove_row(osl_relation_p r, int row)
static int osl_relation_check_attribute(int *expected, int actual)
void osl_relation_swap_constraints(osl_relation_p relation, int c1, int c2)
void osl_strings_free(osl_strings_p strings)
int(* osl_equal_f)(void *, void *)
void osl_relation_insert_vector(osl_relation_p relation, osl_vector_p vector, int row)
void osl_relation_set_precision(int const precision, osl_relation_p r)
osl_relation_p osl_relation_psread_polylib(char **input, int precision)
void osl_int_sprint(char *string, int precision, osl_const_int_t value)
static char ** osl_relation_strings(osl_relation_p relation, osl_names_p names)
void osl_relation_set_attributes(osl_relation_p relation, int nb_output_dims, int nb_input_dims, int nb_local_dims, int nb_parameters)
void osl_int_assign(int precision, osl_int_const_p variable, osl_const_int_t value)
variable = value 
osl_relation_p osl_relation_psread(char **input, int precision)
int osl_relation_part_equal(osl_relation_p r1, osl_relation_p r2)
osl_relation_p osl_relation_from_vector(osl_vector_p vector)
int osl_int_zero(int precision, osl_const_int_t value)
value == 0 
osl_relation_p osl_relation_extend_output(osl_relation_p relation, int dim)
osl_relation_p osl_relation_pread(FILE *foo, int precision)
int osl_int_pos(int precision, osl_const_int_t value)
value > 0 
osl_interface_p osl_relation_interface()
osl_relation_p osl_relation_concat_vector(osl_relation_p relation, osl_vector_p vector)
void osl_relation_set_same_precision(osl_relation_p a, osl_relation_p b)
void osl_int_dump_precision(FILE *file, int precision)
static osl_names_p osl_relation_names(osl_relation_p relation)
void(* osl_free_f)(void *)