PIPS
tab.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "genC.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "ray_dte.h"
#include "sommet.h"
#include "sg.h"
#include "sc.h"
#include "polyedre.h"
#include "matrix.h"
#include "ri.h"
#include "constants.h"
#include "ri-util.h"
#include "misc.h"
#include "bootstrap.h"
#include "complexity_ri.h"
#include "database.h"
#include "graph.h"
#include "dg.h"
#include "paf_ri.h"
#include "parser_private.h"
#include "property.h"
#include "reduction.h"
#include "text.h"
#include "paf-util.h"
#include "pip.h"
+ Include dependency graph for tab.c:

Go to the source code of this file.

Macros

#define max(x, y)   (x>y? x : y)
 lint More...
 
#define TAB_CHUNK   4096*sizeof(Entier)
 

Functions

void tab_init ()
 
char * tab_hwm ()
 
void tab_reset (char *p)
 
Tableautab_alloc (int h, int w, int n)
 h : le nombre de ligne reelles; n : le nombre de lignes virtuelles More...
 
Tableautab_get (FILE *foo, int h, int w, int n)
 
void tab_display (Tableau *p, FILE *foo)
 

Variables

char vcid_pip_tab [] = "$Id: tab.c 23065 2016-03-02 09:05:50Z coelho $"
 
static char * tab_free
 
static char * tab_top
 
static struct Atab_base
 
int allocation
 External variables for direct call to PIP. More...
 
long int cross_product
 
long int limit
 
char * Attr [] = {"Unit", "+", "-", "0", "*", "?"}
 

Macro Definition Documentation

◆ max

#define max (   x,
 
)    (x>y? x : y)

lint

Newgen includes
C3 includes
Pips includes

Definition at line 69 of file tab.c.

◆ TAB_CHUNK

#define TAB_CHUNK   4096*sizeof(Entier)

Definition at line 70 of file tab.c.

Function Documentation

◆ tab_alloc()

Tableau* tab_alloc ( int  h,
int  w,
int  n 
)

h : le nombre de ligne reelles; n : le nombre de lignes virtuelles

Definition at line 113 of file tab.c.

118 {
119  char *p; Tableau *tp;
120  Entier *q;
121  long taille;
122  int i;
123  taille = 2 * sizeof(int) + (h+n) * sizeof (struct L)
124  + h * w * sizeof (Entier);
125  if(tab_free + taille >= tab_top)
126  {struct A * g;
127  long int d;
128  d = max(TAB_CHUNK, taille + sizeof(struct A));
129  tab_free = (char*) malloc(d);
130  if(!tab_free)
131  {printf("tab_alloc : plus de place\n");
132  exit(23);
133  }
134  allocation++;
135  g = (struct A *)tab_free;
136  g->precedent = tab_base;
137  tab_top = tab_free + d;
138  tab_free += sizeof(struct A);
139  tab_base = g;
140  g->bout = tab_top;
141  }
142  p = tab_free;
143  tab_free += taille;
144  tp = (Tableau *)p;
145  q = (Entier *)(p + 2 * sizeof(int) + (h+n) * sizeof (struct L));
146  for(i = 0; i<n ; i++)
147  {tp->row[i].flags = Unit | Zero;
148  tp->row[i].objet.unit = i;
149  }
150  for(i = n; i < (h+n); i++)
151  {tp->row[i].flags = 0;
152  tp->row[i].objet.val = q;
153  q += w;
154  }
155  tp->height = h + n; tp->width = w;
156  return(tp);
157 }
void const char const char const int
void * malloc(YYSIZE_T)
#define exit(code)
Definition: misc-local.h:54
#define Unit
Definition: pip__tab.h:36
#define Zero
Definition: pip__tab.h:39
#define Entier
Definition: pip__type.h:24
int printf()
Definition: pip__tab.h:25
char * bout
Definition: pip__tab.h:26
struct A * precedent
Definition: pip__tab.h:25
Definition: pip__tab.h:30
int flags
Definition: pip__tab.h:30
int unit
Definition: pip__tab.h:31
Entier * val
Definition: pip__tab.h:32
union L::@15 objet
Definition: pip__tab.h:48
int width
Definition: pip__tab.h:48
int height
Definition: pip__tab.h:48
struct L row[1]
Definition: pip__tab.h:49
static char * tab_top
Definition: tab.c:72
static struct A * tab_base
Definition: tab.c:73
#define TAB_CHUNK
Definition: tab.c:70
int allocation
External variables for direct call to PIP.
Definition: pip.c:92
static char * tab_free
Definition: tab.c:72
#define max(x, y)
lint
Definition: tab.c:69

References allocation, A::bout, Entier, exit, L::flags, T::height, int, malloc(), max, L::objet, A::precedent, printf(), T::row, tab_base, TAB_CHUNK, tab_free, tab_top, L::unit, Unit, L::val, T::width, and Zero.

Referenced by tab_get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tab_display()

void tab_display ( Tableau p,
FILE *  foo 
)

Definition at line 181 of file tab.c.

184 {
185 
186  int i, j, ff, fff, n;
187  Entier x;
188  fprintf(foo, "%ld/[%d * %d]\n", cross_product, p->height, p->width);
189  for(i = 0; i<p->height; i++)
190  {fff = ff = p->row[i].flags;
191  if(ff == 0) break;
192  n = 0;
193  while(fff)
194  {if(fff & 1) fprintf(foo, "%s ",Attr[n]);
195  n++; fff >>= 1;
196  }
197  fprintf(foo, "#[");
198  if(ff & Unit)
199  for(j = 0; j<p->width; j++)
200  fprintf(foo, " /%d/",(j == p->row[i].objet.unit)? 1: 0);
201  else
202  for(j = 0; j<p->width; j++)
203  {x = Index(p,i,j);
204  fprintf(foo, FORMAT, x);
205  fprintf(foo, " ");
206  }
207  fprintf(foo, " ]\n");
208  }
209 }
#define Index(p, i, j)
Definition: pip__tab.h:45
#define FORMAT
Definition: pip__type.h:25
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static char * x
Definition: split_file.c:159
char * Attr[]
Definition: tab.c:179
long int cross_product
Definition: pip.c:91

References Attr, cross_product, Entier, L::flags, FORMAT, fprintf(), T::height, Index, L::objet, T::row, L::unit, Unit, T::width, and x.

+ Here is the call graph for this function:

◆ tab_get()

Tableau* tab_get ( FILE *  foo,
int  h,
int  w,
int  n 
)

Definition at line 159 of file tab.c.

162 {
163  Tableau *p;
164  int i, j, c;
165  p = tab_alloc(h, w, n);
166  while((c = dgetc(foo)) != EOF)if(c == '(')break;
167  for(i = n; i<h+n; i++)
168  {p->row[i].flags = Unknown;
169  while((c = dgetc(foo)) != EOF)if(c == '[')break;
170  for(j = 0; j<w; j++)
171  if(dscanf(foo, FORMAT, p->row[i].objet.val+j) < 0)
172  return NULL;
173  while((c = dgetc(foo)) != EOF)if(c == ']')break;
174  }
175  while((c = dgetc(foo)) != EOF)if(c == ')')break;
176  return((Tableau *) p);
177 }
int dgetc(FILE *foo)
Definition: maind.c:52
int dscanf(FILE *foo, char *format, Entier *val)
Definition: maind.c:70
#define Unknown
Definition: pip__tab.h:41
Tableau * tab_alloc(int h, int w, int n)
h : le nombre de ligne reelles; n : le nombre de lignes virtuelles
Definition: tab.c:113

References dgetc(), dscanf(), L::flags, FORMAT, L::objet, T::row, tab_alloc(), Unknown, and L::val.

+ Here is the call graph for this function:

◆ tab_hwm()

char* tab_hwm ( )

Definition at line 92 of file tab.c.

93 {
94  return(tab_free);
95 }

References tab_free.

Referenced by compa_test(), pip_solve(), pip_solve_min_with_big(), and traiter().

+ Here is the caller graph for this function:

◆ tab_init()

void tab_init ( )

Definition at line 77 of file tab.c.

78 {
79  tab_free = (char*) malloc(sizeof (struct A));
80  if(!tab_free)
81  {printf("tab_init : la machine est trop petite\n");
82  exit(21);
83  }
84  allocation = 1;
85  tab_top = tab_free + sizeof (struct A);
86  tab_base = (struct A *)tab_free;
87  tab_free += sizeof(struct A);
88  tab_base->precedent = NULL;
90 }

References allocation, A::bout, exit, malloc(), A::precedent, printf(), tab_base, tab_free, and tab_top.

Referenced by pip_solve(), and pip_solve_min_with_big().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ tab_reset()

void tab_reset ( char *  p)

Definition at line 97 of file tab.c.

99 {struct A *g;
100  while(tab_base)
101  {
102  if((char *)tab_base + sizeof(struct A) <= p && p <= tab_top) break;
103  g = tab_base->precedent;
104  free(tab_base);
105  allocation--;
106  tab_base = g;
107  tab_top = tab_base->bout;
108  }
109  if(tab_base) tab_free = p;
110  else printf("tab_reset : panique\n");
111 }
void free(void *)

References allocation, A::bout, free(), A::precedent, printf(), tab_base, tab_free, and tab_top.

+ Here is the call graph for this function:

Variable Documentation

◆ allocation

int allocation
extern

External variables for direct call to PIP.

Definition at line 92 of file pip.c.

Referenced by tab_alloc(), tab_init(), and tab_reset().

◆ Attr

char* Attr[] = {"Unit", "+", "-", "0", "*", "?"}

Definition at line 179 of file tab.c.

Referenced by tab_display().

◆ cross_product

long int cross_product
extern

Definition at line 91 of file pip.c.

Referenced by pip_solve(), pip_solve_min_with_big(), and tab_display().

◆ limit

long int limit

Definition at line 75 of file tab.c.

◆ tab_base

struct A* tab_base
static

Definition at line 73 of file tab.c.

Referenced by tab_alloc(), tab_init(), and tab_reset().

◆ tab_free

char* tab_free
static

Definition at line 72 of file tab.c.

Referenced by tab_alloc(), tab_hwm(), tab_init(), and tab_reset().

◆ tab_top

char * tab_top
static

Definition at line 72 of file tab.c.

Referenced by tab_alloc(), tab_init(), and tab_reset().

◆ vcid_pip_tab

char vcid_pip_tab[] = "$Id: tab.c 23065 2016-03-02 09:05:50Z coelho $"

Definition at line 29 of file tab.c.