File: DAarray.h

package info (click to toggle)
gopher 3.0.17.3%2Bnmu1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 1,476 kB
  • sloc: ansic: 13,895; sh: 1,349; makefile: 318
file content (68 lines) | stat: -rw-r--r-- 1,749 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/********************************************************************
 * lindner
 * 3.1.1.1
 * 1993/02/11 18:03:06
 * /home/mudhoney/GopherSrc/CVS/gopher+/object/DAarray.h,v
 * Exp
 *
 * Paul Lindner, University of Minnesota CIS.
 *
 * Copyright 1991, 1992 by the Regents of the University of Minnesota
 * see the file "Copyright" in the distribution for conditions of use.
 *********************************************************************
 * MODULE: DAarray.h
 * Dynamic Array Header file/abstraction
 *********************************************************************
 * Revision History:
 * DAarray.h,v
 * Revision 3.1.1.1  1993/02/11  18:03:06  lindner
 * Gopher+1.2beta release
 *
 * Revision 1.2  1992/12/21  20:04:04  lindner
 * Added DAcpy()
 *
 * Revision 1.1  1992/12/10  23:27:52  lindner
 * gopher 1.1 release
 *
 *
 *********************************************************************/


#ifndef DAARRAY_H
#define DAARRAY_H

/*
 *  A dynamic array class
 */ 

struct da_struct {
     char **objects;  /** Should be void** perhaps */
     
     int Top;
     int maxsize;

     char * (*newfn)();
     void   (*initfn)();
     void   (*destroyfn)();
     char * (*copyfn)();
};

typedef struct da_struct DynArray;

#define DAgetEntry(a,b)   (((a)->objects[b]))
#define DAgetTop(a)       ((a)->Top)
#define DAsetTop(a,b)     ((a)->Top=(b))
#define DAgetNumitems(a)   ((a)->Top)

DynArray *DAnew();
void     DAdestroy(DynArray *da);
void     DAinit(DynArray *da);
void     DApush(DynArray *da, char *obj);
char *   DApop(DynArray *da);
void     DAsort(DynArray *da, int (*sortfn)());
void     DAgrow(DynArray *da, int size);
void     DAsort(DynArray *da, int (*sortfn)());
void     DAcpy(DynArray *dest, DynArray *orig);
#endif