[1844] | 1 | /* GNUPLOT - dynarray.h */
|
---|
| 2 |
|
---|
| 3 | /*[
|
---|
| 4 | * Copyright 1999 Thomas Williams, Colin Kelley
|
---|
| 5 | *
|
---|
| 6 | * Permission to use, copy, and distribute this software and its
|
---|
| 7 | * documentation for any purpose with or without fee is hereby granted,
|
---|
| 8 | * provided that the above copyright notice appear in all copies and
|
---|
| 9 | * that both that copyright notice and this permission notice appear
|
---|
| 10 | * in supporting documentation.
|
---|
| 11 | *
|
---|
| 12 | * Permission to modify the software is granted, but not the right to
|
---|
| 13 | * distribute the complete modified source code. Modifications are to
|
---|
| 14 | * be distributed as patches to the released version. Permission to
|
---|
| 15 | * distribute binaries produced by compiling modified sources is granted,
|
---|
| 16 | * provided you
|
---|
| 17 | * 1. distribute the corresponding source modifications from the
|
---|
| 18 | * released version in the form of a patch file along with the binaries,
|
---|
| 19 | * 2. add special version identification to distinguish your version
|
---|
| 20 | * in addition to the base release version number,
|
---|
| 21 | * 3. provide your name and address as the primary contact for the
|
---|
| 22 | * support of your modified version, and
|
---|
| 23 | * 4. retain our contact information in regard to use of the base
|
---|
| 24 | * software.
|
---|
| 25 | * Permission to distribute the released version of the source code along
|
---|
| 26 | * with corresponding source modifications in the form of a patch file is
|
---|
| 27 | * granted with same provisions 2 through 4 for binary distributions.
|
---|
| 28 | *
|
---|
| 29 | * This software is provided "as is" without express or implied warranty
|
---|
| 30 | * to the extent permitted by applicable law.
|
---|
| 31 | ]*/
|
---|
| 32 |
|
---|
| 33 | #ifndef GP_DYNARRAY__H
|
---|
| 34 | #define GP_DYNARRAY__H
|
---|
| 35 |
|
---|
| 36 | /***
|
---|
| 37 | # include "syscfg.h"
|
---|
| 38 | # include "stdfn.h"
|
---|
| 39 | ***/
|
---|
| 40 | #include <stdio.h>
|
---|
| 41 | #include "gpc_misc.h"
|
---|
| 42 |
|
---|
| 43 | typedef struct dynarray {
|
---|
| 44 | long size; /* alloced size of the array */
|
---|
| 45 | long end; /* index of first unused entry */
|
---|
| 46 | long increment; /* amount to increment size by, on realloc */
|
---|
| 47 | size_t entry_size; /* size of the entries in this array */
|
---|
| 48 | void *v; /* the vector itself */
|
---|
| 49 | } dynarray;
|
---|
| 50 |
|
---|
| 51 | /* Prototypes */
|
---|
| 52 | void init_dynarray (dynarray * array, size_t element, long size, long increment);
|
---|
| 53 | void free_dynarray (dynarray * array);
|
---|
| 54 | void extend_dynarray(dynarray * array, long increment);
|
---|
| 55 | void resize_dynarray (dynarray * array, long newsize);
|
---|
| 56 | void *nextfrom_dynarray (dynarray * array);
|
---|
| 57 | void droplast_dynarray (dynarray * array);
|
---|
| 58 |
|
---|
| 59 | #endif /* GP_DYNARRAY_H */
|
---|