PIPS
sommets.c
Go to the documentation of this file.
1 /*
2 
3  $Id: sommets.c 1641 2016-03-02 08:20:19Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25  /* package plint */
26 
27 #ifdef HAVE_CONFIG_H
28  #include "config.h"
29 #endif
30 
31 #include <stdlib.h>
32 #include <stdio.h>
33 
34 #include "boolean.h"
35 #include "arithmetique.h"
36 #include "vecteur.h"
37 #include "contrainte.h"
38 #include "sc.h"
39 
40 #include "sommet.h"
41 
42 #define MALLOC(s,t,f) malloc(s)
43 #define FREE(s,t,f) free(s)
44 
45 
46 /* Psommet sommets_dup(Psommet som):
47  * copie d'une liste de sommets tout en respectant le meme ordre
48  */
50 Psommet som;
51 {
52 
53  Psommet som1,som2;
54  /* pointeur vers le dernier element de la liste*/
55  Psommet pred;
56  /* pointeur vers le premier element de la liste*/
57  Psommet debut = NULL;
58 
59 
60 #ifdef TRACE
61  printf(" ***** duplication du systeme \n");
62 #endif
63  if (som)
64  {
65  som2 = sommet_dup(som);
66  debut = som2;
67  pred = som2;
68  for (som1 = som->succ; som1 != NULL; som1 = som1->succ)
69  {
70 
71  som2 = sommet_dup(som1);
72  pred->succ = som2;
73  pred = som2;
74  };
75  };
76  return (debut);
77 }
78 
79 /* void sommets_rm(Psommet ps):
80  * liberation de l'espace memoire alloue a une liste de sommets
81  *
82  */
83 void sommets_rm(ps)
84 Psommet ps;
85 {
86  Psommet p1,p2;
87 
88 #ifdef TRACE2
89  printf(" ***** erase systeme \n");
90 #endif
91 
92  for (p2 = ps;p2 != NULL;)
93  {
94  p1 = p2->succ;
95  FREE((int *)p2->eq_sat,INTEGER,"sommets_rm");
96  vect_rm(p2->vecteur);
97  FREE((Psommet)p2,SOMMET,"sommets_rm");
98  p2 = p1;
99  }
100 
101 }
102 
103 /* void sommets_normalize(som)
104  * Normalisation des elements d'une liste de sommets i.e. division par le pgcd de tous
105  * les elements.
106  *
107  */
109 Psommet som;
110 {
111  Psommet ps;
112  for (ps = som;ps!= NULL; ps= ps->succ)
113  sommet_normalize(ps);
114 }
115 
int printf()
#define SOMMET
package sommet: structure de donnees representant les sommets d'un systeme generateur; elle contient:
Definition: sommet-local.h:48
void sommet_normalize(Psommet ns)
void sommet_normalize(Psommet ns): normalisation des coordonnees d'un sommet par le pgcd des coordonn...
Definition: sommet.c:205
Psommet sommet_dup(Psommet s_in)
Psommet sommet_dup(Psommet s_in): allocation et copie de la valeur d'un sommet.
Definition: sommet.c:82
void sommets_normalize(Psommet som)
void sommets_normalize(som) Normalisation des elements d'une liste de sommets i.e.
Definition: sommets.c:108
Psommet sommets_dup(Psommet som)
Psommet sommets_dup(Psommet som): copie d'une liste de sommets tout en respectant le meme ordre.
Definition: sommets.c:49
#define FREE(s, t, f)
Definition: sommets.c:43
void sommets_rm(Psommet ps)
void sommets_rm(Psommet ps): liberation de l'espace memoire alloue a une liste de sommets
Definition: sommets.c:83
structure de donnees Sommet
Definition: sommet-local.h:64
struct typ_som * succ
Definition: sommet-local.h:68
Pvecteur vecteur
Definition: sommet-local.h:66
int * eq_sat
Definition: sommet-local.h:65
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78