Merge branch 'master' of github.com:periscop/clay
[clay.git] / include / clay / array.h
blobb840d42b2cde50357df7decac0023efbf54b62ee
2 /*--------------------------------------------------------------------+
3 | Clay |
4 |--------------------------------------------------------------------|
5 | array.h |
6 |--------------------------------------------------------------------|
7 | First version: 03/04/2012 |
8 +--------------------------------------------------------------------+
10 +--------------------------------------------------------------------------+
11 | / __)( ) /__\ ( \/ ) |
12 | ( (__ )(__ /(__)\ \ / Chunky Loop Alteration wizardrY |
13 | \___)(____)(__)(__)(__) |
14 +--------------------------------------------------------------------------+
15 | Copyright (C) 2012 University of Paris-Sud |
16 | |
17 | This library is free software; you can redistribute it and/or modify it |
18 | under the terms of the GNU Lesser General Public License as published by |
19 | the Free Software Foundation; either version 2.1 of the License, or |
20 | (at your option) any later version. |
21 | |
22 | This library is distributed in the hope that it will be useful but |
23 | WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
25 | General Public License for more details. |
26 | |
27 | You should have received a copy of the GNU Lesser General Public License |
28 | along with this software; if not, write to the Free Software Foundation, |
29 | Inc., 51 Franklin Street, Fifth Floor, |
30 | Boston, MA 02110-1301 USA |
31 | |
32 | Clay, the Chunky Loop Alteration wizardrY |
33 | Written by Joel Poudroux, joel.poudroux@u-psud.fr |
34 +--------------------------------------------------------------------------*/
37 #ifndef CLAY_ARRAY_H
38 #define CLAY_ARRAY_H
40 #define CLAY_ARRAY_INIT_SIZE 10
42 #include <stdio.h>
44 # if defined(__cplusplus)
45 extern "C"
47 # endif
49 struct clay_array {
50 int *data;
51 int size; // memory used
52 int available; // total allocated memory
55 typedef struct clay_array clay_array_t;
56 typedef struct clay_array* clay_array_p;
58 clay_array_p clay_array_malloc();
59 void clay_array_add(clay_array_p, int);
60 void clay_array_remove_last(clay_array_p);
61 void clay_array_free(clay_array_p);
62 void clay_array_print(FILE*, clay_array_p, int);
63 clay_array_p clay_array_clone(clay_array_p);
64 void clay_array_concat(clay_array_p, clay_array_p);
65 int clay_array_equal(clay_array_p, clay_array_p);
67 # if defined(__cplusplus)
69 # endif
71 #endif