4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
6 * Copyright (C) 1998,1999,2000,2001 harry eaton
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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Contact addresses for paper mail and Email:
23 * harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA
24 * haceaton@aplcomm.jhuapl.edu
28 /* this file, vector.h, was written and is
29 * Copyright (c) 2001 C. Scott Ananian.
32 /* prototypes for vector routines.
38 /* what a vector looks like */
39 typedef struct vector_struct vector_t
;
40 /* what data in a vector looks like */
41 typedef void *vector_element_t
;
43 /* create an empty vector */
44 vector_t
*vector_create ();
45 /* destroy a vector */
46 void vector_destroy (vector_t
** vector
);
48 vector_t
*vector_duplicate (vector_t
* vector
);
50 /* -- interrogation -- */
51 int vector_is_empty (vector_t
* vector
);
52 int vector_size (vector_t
* vector
);
53 vector_element_t
vector_element (vector_t
* vector
, int N
);
54 vector_element_t
vector_element_first (vector_t
* vector
);
55 vector_element_t
vector_element_last (vector_t
* vector
);
58 /* add data to end of vector */
59 void vector_append (vector_t
* vector
, vector_element_t data
);
60 /* add multiple elements to end of vector */
61 void vector_append_many (vector_t
* vector
,
62 vector_element_t data
[], int count
);
63 /* add a vector of elements to the end of vector */
64 void vector_append_vector (vector_t
* vector
, vector_t
* other_vector
);
65 /* add data at specified position of vector */
66 void vector_insert (vector_t
* vector
, int N
, vector_element_t data
);
67 /* add multiple elements at specified position of vector */
68 void vector_insert_many (vector_t
* vector
, int N
,
69 vector_element_t data
[], int count
);
70 /* return and delete the *last* element of vector */
71 vector_element_t
vector_remove_last (vector_t
* vector
);
72 /* return and delete data at specified position of vector */
73 vector_element_t
vector_remove (vector_t
* vector
, int N
);
74 /* replace the data at the specified position with the given data.
75 * returns the old data. */
76 vector_element_t
vector_replace (vector_t
* vector
,
77 vector_element_t data
, int N
);
79 #endif /* PCB_VECTOR_H */