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