2 4ti2 -- A software package for algebraic, geometric and combinatorial
3 problems on linear spaces.
5 Copyright (C) 2006 4ti2 team.
6 Main author(s): Matthias Walter.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
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.
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 02110-1301, USA.
23 #include "indexarray.h"
31 IndexArray
createIndexArray()
33 IndexArray array
= (IndexArray
)malloc(sizeof(indexarray_t
));
37 fprintf(stderr
, "Fatal Error: Could not allocate memory for IndexArray!\n");
49 void deleteIndexArray(IndexArray array
)
61 void appendToIndexArray(IndexArray array
, int index
)
66 for (i
=0; i
<array
->Size
; i
++)
67 assert(array
->Data
[i
]!=index
);
73 array
->Data
= (int *)realloc(array
->Data
, array
->Size
*sizeof(int));
74 array
->Data
[array
->Size
-1] = index
;
79 void fprintIndexArray(FILE *stream
, IndexArray array
)
86 for (i
=0; i
<array
->Size
; i
++)
87 fprintf(stream
, i
>0 ? " %d" : "%d", array
->Data
[i
]);