TaPAS  0.2
template-plugin.c
1 /*
2  * template-plugin.c -- Functions to implement to build a valid GENEPI plugin.
3  *
4  * This file is a part of the GENEric Presburger programming Interface.
5  *
6  * Copyright (C) 2010 CNRS UMR 5800 & Université Bordeaux I (see AUTHORS file).
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23 
28 #include <stdio.h>
29 #include <stdlib.h>
30 
31 #ifndef GENEPI_PLUGIN_PREFIX
32 /* replace the 'template' prefix by the one of the module name */
33 # warning "GENEPI_PLUGIN_PREFIX is not defined"
34 # define GENEPI_PLUGIN_PREFIX(_f) template ## _f
35 #endif /* ! GENEPI_PLUGIN_NAME */
36 
37 #include <genepi/genepi-plugin.h>
38 
39 
40 #define ENABLE_ALL_PROTOS 1
41 
42 struct genepi_plugin_impl_st
43 {
44  /* fill it with your own fields */
45  genepi_plugconf *conf;
46 };
47 
48 struct genepi_set_impl_st
49 {
50  /* fill it with your own fields */
51  int refcount;
52 };
53 
54  /* --------------- */
55 
57 GENEPI_PLUGIN_FUNC(init) (genepi_plugconf *conf)
58 {
59  genepi_plugin_impl *result = malloc (sizeof *result);
60 
61  result->conf = genepi_plugconf_add_reference (conf);
62 
63  return result;
64 }
65 
66  /* --------------- */
67 
68 
69 void
71 {
72  genepi_plugconf_del_reference (plugin->conf);
73  free (plugin);
74 }
75 
76 
77  /* --------------- */
78 
79 #if ENABLE_ALL_PROTOS
80 int
82 {
83  return 1;
84 }
85 #endif
86  /* --------------- */
87 
88 
90 GENEPI_PLUGIN_FUNC(get_solver_type) (genepi_plugin_impl *plugin)
91 {
92  return GENEPI_N_SOLVER;
93 }
94 
95 
96  /* --------------- */
97 
98 #if ENABLE_ALL_PROTOS
100 GENEPI_PLUGIN_FUNC(add_reference) (genepi_plugin_impl *plugin,
101  genepi_set_impl *X)
102 {
103  X->refcount++;
104 
105  return X;
106 }
107 #endif
108  /* --------------- */
109 
110 #if ENABLE_ALL_PROTOS
111 void
112 GENEPI_PLUGIN_FUNC(del_reference) (genepi_plugin_impl *plugin,
113  genepi_set_impl *X)
114 {
115  X->refcount--;
116  if (X->refcount == 0)
117  {
118  free (X);
119  }
120 }
121 #endif
122  /* --------------- */
123 
124 #if ENABLE_ALL_PROTOS
127 {
128  return NULL;
129 }
130 #endif
131  /* --------------- */
132 
133 #if ENABLE_ALL_PROTOS
135 GENEPI_PLUGIN_FUNC(top_N) (genepi_plugin_impl *plugin, int n)
136 {
137  return NULL;
138 }
139 #endif
140  /* --------------- */
141 
142 #if ENABLE_ALL_PROTOS
144 GENEPI_PLUGIN_FUNC (top_Z) (genepi_plugin_impl *plugin, int n)
145 {
146  return NULL;
147 }
148 #endif
149 
150  /* --------------- */
151 
152 #if ENABLE_ALL_PROTOS
154 GENEPI_PLUGIN_FUNC (top_P) (genepi_plugin_impl *plugin, int n)
155 {
156 return NULL;
157 }
158 #endif
159 
160  /* --------------- */
161 
162 #if ENABLE_ALL_PROTOS
164 GENEPI_PLUGIN_FUNC (top_R) (genepi_plugin_impl *plugin, int n)
165 {
166  return NULL;
167 }
168 #endif
169 
170 #if ENABLE_ALL_PROTOS
173 {
174  return NULL;
175 }
176 #endif
177  /* --------------- */
178 
179 #if ENABLE_ALL_PROTOS
181 GENEPI_PLUGIN_FUNC(linear_operation) (genepi_plugin_impl *plugin,
182  const int *alpha, int alpha_size,
183  genepi_comparator op, int c)
184 {
185  return NULL;
186 }
187 #endif
188  /* --------------- */
189 
190 #if ENABLE_ALL_PROTOS
193  genepi_set_impl *X2)
194 {
195  return NULL;
196 }
197 #endif
198 
199  /* --------------- */
200 
201 #if ENABLE_ALL_PROTOS
203 GENEPI_PLUGIN_FUNC(set_intersection) (genepi_plugin_impl *plugin,
205 {
206  return NULL;
207 }
208 #endif
209  /* --------------- */
210 
211 #if ENABLE_ALL_PROTOS
213 GENEPI_PLUGIN_FUNC(set_complement) (genepi_plugin_impl *plugin,
214  genepi_set_impl *X)
215 {
216  return NULL;
217 }
218 #endif
219  /* --------------- */
220 
221 #if ENABLE_ALL_PROTOS
224  const int *selection, int size)
225 {
226  return NULL;
227 }
228 #endif
229 
230  /* --------------- */
231 
232 #if ENABLE_ALL_PROTOS
235  const int *selection, int size)
236 {
237  return NULL;
238 }
239 #endif
240 
241  /* --------------- */
242 
243 #if ENABLE_ALL_PROTOS
246  genepi_set_impl *A)
247 {
248  return NULL;
249 }
250 #endif
251 
252  /* --------------- */
253 
254 #if ENABLE_ALL_PROTOS
257  genepi_set_impl *A)
258 {
259  return NULL;
260 }
261 #endif
262  /* --------------- */
263 
264 #if ENABLE_ALL_PROTOS
265 int
268 {
269  return 0;
270 }
271 #endif
272  /* --------------- */
273 
274 #if ENABLE_ALL_PROTOS
275 int
277 {
278  return 0;
279 }
280 #endif
281 
282  /* --------------- */
283 
284 #if ENABLE_ALL_PROTOS
285 int
287 {
288  return 0;
289 }
290 #endif
291 
292  /* --------------- */
293 
294 #if ENABLE_ALL_PROTOS
295 int
297 {
298  return 0;
299 }
300 #endif
301 
302  /* --------------- */
303 
304 #if ENABLE_ALL_PROTOS
305 int
307  const int *sel, int selsize)
308 {
309  return 0;
310 }
311 #endif
312 
313  /* --------------- */
314 
315 #if ENABLE_ALL_PROTOS
316 void
317 GENEPI_PLUGIN_FUNC(get_solutions) (genepi_plugin_impl *plugin,
318  genepi_set_impl *X, int ***psolutions,
319  int *psize, int max)
320 {
321 }
322 #endif
323 
324  /* --------------- */
325 
326 #if ENABLE_ALL_PROTOS
327 void
328 GENEPI_PLUGIN_FUNC(display_all_solutions) (genepi_plugin_impl *plugin,
329  genepi_set_impl *X, FILE *output,
330  const char * const *varname)
331 {
332 }
333 #endif
334 
335  /* --------------- */
336 
337 #if ENABLE_ALL_PROTOS
338 void
339 GENEPI_PLUGIN_FUNC(display_data_structure) (genepi_plugin_impl *plugin,
340  genepi_set_impl *X, FILE *output)
341 {
342 }
343 #endif
344 
345  /* --------------- */
346 
347 #if ENABLE_ALL_PROTOS
348 int
350 {
351  return 0;
352 }
353 #endif
354 
355  /* --------------- */
356 
357 #if ENABLE_ALL_PROTOS
358 int
359 GENEPI_PLUGIN_FUNC(get_data_structure_size) (genepi_plugin_impl *plugin,
360  genepi_set_impl *X)
361 {
362  return 0;
363 }
364 #endif
365 
366  /* --------------- */
367 
368 #if ENABLE_ALL_PROTOS
369 int
370 GENEPI_PLUGIN_FUNC(is_solution) (genepi_plugin_impl *plugin,
371  genepi_set_impl *X, const int *x, int x_size,
372  int xden)
373 {
374  return 0;
375 }
376 #endif
377 
378  /* --------------- */
379 
380 #if ENABLE_ALL_PROTOS
381 int
382 GENEPI_PLUGIN_FUNC(get_one_solution) (genepi_plugin_impl *plugin,
383  genepi_set_impl *X, int *x, int x_size)
384 {
385  return 0;
386 }
387 #endif
388 
389  /* --------------- */
390 
391 #if ENABLE_ALL_PROTOS
392 unsigned int
394 {
395  return 0;
396 }
397 #endif
398 
399  /* --------------- */
400 
401 #if ENABLE_ALL_PROTOS
402 int
403 GENEPI_PLUGIN_FUNC(cache_equal) (genepi_plugin_impl *plugin,
405 {
406  return 0;
407 }
408 #endif
409 
410  /* --------------- */
411 
412 #if ENABLE_ALL_PROTOS
413 int
414 GENEPI_PLUGIN_FUNC (write_set) (genepi_plugin_impl *plugin, FILE *output,
415  genepi_set_impl *set)
416 {
417  return GENEPI_RW_ERR_IO;
418 }
419 #endif
420 
421  /* --------------- */
422 
423 #if ENABLE_ALL_PROTOS
424 int
425 GENEPI_PLUGIN_FUNC (read_set) (genepi_plugin_impl *plugin, FILE *input,
426  genepi_set_impl **pset)
427 {
428  return GENEPI_RW_ERR_IO;
429 }
430 #endif
431 
432  /* --------------- */
433 
434 #if ENABLE_ALL_PROTOS
435 int
437  genepi_set_impl *X2)
438 {
439  return 0;
440 }
441 #endif
struct genepi_plugin_impl_st genepi_plugin_impl
Abstraction of a GENEPI plugin instance.
An has occurred on the stream at the system level.
Definition: genepi.h:279
genepi_solver_type
Indicate the domain of variable used by a solver.
Definition: genepi.h:248
#define GENEPI_PLUGIN_FUNC(_f)
Macro used to prefix function symbols.
Definition: genepi-plugin.h:96
genepi_comparator
Comparison specifier.
Definition: genepi.h:230
Specification of Plugin Prototypes.
struct genepi_set_impl_st genepi_set_impl
Abstraction of a GENEPI set.