File: list.h

package info (click to toggle)
pymol 2.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 42,288 kB
  • sloc: cpp: 476,472; python: 76,538; ansic: 29,510; javascript: 6,792; sh: 47; makefile: 24
file content (84 lines) | stat: -rw-r--r-- 1,994 bytes parent folder | download | duplicates (12)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* 
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* copyright 1998-2000 by Warren Lyford Delano of DeLano Scientific. 
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information. 
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-* 
-* 
-*
Z* -------------------------------------------------------------------
*/
#ifndef _H_List
#define _H_List

/* All data structures which use List must have this header */

typedef struct {
  int link;
} ListElem;

typedef struct { 
  /* NOTE: happy lists must have record sizes equal or larger 
     than the length of this struct */
  int rec_size;
  int next_avail;
} List;

typedef struct {
  int link; 
  int value;
} ListInt;

typedef struct {
  int link; 
  int value[2];
} ListInt2;

typedef struct {
  int link; 
  int value[3];
} ListInt3;

typedef struct {
  int link; 
  int value[4];
} ListInt4;

typedef struct {
  int link; 
  int value[5];
} ListInt5;

void *ListNew(int init_size,int rec_size); 
int   ListElemNewZero(void *list_ptr);
int   ListElemNew(void *list_ptr_ptr);
void  ListFree(void *list);
void  ListElemFree(void *list,int elem);
void  ListElemFreeChain(void *list,int start);
int   ListLen(void *list,int start);
int   ListGetNAlloc(void *list);

/* shortcut routines for managing tops of lists */
int   ListElemPop(void *list,int elem);
int   ListElemPush(void *list_ptr_ptr,int elem);

int   ListElemPushInt(ListInt **list,int elem,int value);
int   ListElemPopInt(ListInt *list,int elem,int *value);
int   ListElemGetInt(ListInt *list,int elem,int *value);

int   ListElemPurgeInt(ListInt *list,int start, int value); /* slow! */
#endif