Introduce POLYGONHOLE_MODE for creating holes in polygons
[geda-pcb/gde.git] / src / vector.h
blob3eabef54d1aa1c849a8be67a6a3ef318a281932d
1 /* $Id$ */
3 /*
4 * COPYRIGHT
6 * PCB, interactive printed circuit board design
7 * Copyright (C) 1994,1995,1996 Thomas Nau
8 * Copyright (C) 1998,1999,2000,2001 harry eaton
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 * Contact addresses for paper mail and Email:
25 * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA
26 * haceaton@aplcomm.jhuapl.edu
30 /* this file, vector.h, was written and is
31 * Copyright (c) 2001 C. Scott Ananian.
34 /* prototypes for vector routines.
37 #ifndef __VECTOR_INCLUDED__
38 #define __VECTOR_INCLUDED__
40 /* what a vector looks like */
41 typedef struct vector_struct vector_t;
42 /* what data in a vector looks like */
43 typedef void *vector_element_t;
45 /* create an empty vector */
46 vector_t *vector_create ();
47 /* destroy a vector */
48 void vector_destroy (vector_t ** vector);
49 /* copy a vector */
50 vector_t *vector_duplicate (vector_t * vector);
52 /* -- interrogation -- */
53 int vector_is_empty (vector_t * vector);
54 int vector_size (vector_t * vector);
55 vector_element_t vector_element (vector_t * vector, int N);
56 vector_element_t vector_element_first (vector_t * vector);
57 vector_element_t vector_element_last (vector_t * vector);
59 /* -- mutation -- */
60 /* add data to end of vector */
61 void vector_append (vector_t * vector, vector_element_t data);
62 /* add multiple elements to end of vector */
63 void vector_append_many (vector_t * vector,
64 vector_element_t data[], int count);
65 /* add a vector of elements to the end of vector */
66 void vector_append_vector (vector_t * vector, vector_t * other_vector);
67 /* add data at specified position of vector */
68 void vector_insert (vector_t * vector, int N, vector_element_t data);
69 /* add multiple elements at specified position of vector */
70 void vector_insert_many (vector_t * vector, int N,
71 vector_element_t data[], int count);
72 /* return and delete the *last* element of vector */
73 vector_element_t vector_remove_last (vector_t * vector);
74 /* return and delete data at specified position of vector */
75 vector_element_t vector_remove (vector_t * vector, int N);
76 /* replace the data at the specified position with the given data.
77 * returns the old data. */
78 vector_element_t vector_replace (vector_t * vector,
79 vector_element_t data, int N);
81 #endif /* __VECTOR_INCLUDED__ */