44 |
#include "cmpfunc.h" |
#include "cmpfunc.h" |
45 |
#include "notate.h" |
#include "notate.h" |
46 |
|
|
47 |
|
/** |
48 |
|
This data structure holds a NOTE in memory, including a reference to the |
49 |
|
database it belongs to. @see About 'NOTES' in ASCEND |
50 |
|
*/ |
51 |
struct Note { |
struct Note { |
52 |
symchar *typename; /**< ascend type library name, if any, for context. */ |
symchar *typename; /**< ascend type library name, if any, for context. */ |
53 |
symchar *id; /**< child name in type, if only for 1 child, or SELF */ |
symchar *id; /**< child name in type, if only for 1 child, or SELF */ |
64 |
struct Note *next; /**< database master list chain */ |
struct Note *next; /**< database master list chain */ |
65 |
}; |
}; |
66 |
|
|
67 |
|
/** |
68 |
|
Some kind of tree or list data structure referenced in struct data_base... |
69 |
|
*/ |
70 |
struct note_bucket { |
struct note_bucket { |
71 |
symchar *key; /* hash key. type, id, or other heap pointer. */ |
symchar *key; /** hash key. type, id, or other heap pointer. */ |
72 |
struct note_bucket *next; /* next bucket. duh */ |
struct note_bucket *next; /** next bucket. duh */ |
73 |
void *obj; /* data for bucket. usually a note or list. */ |
void *obj; /** data for bucket. usually a note or list. */ |
74 |
}; |
}; |
75 |
|
|
76 |
/* replace this with a pool */ |
/* replace this with a pool */ |
90 |
#define NTAB 1024 |
#define NTAB 1024 |
91 |
#define PTRHASH(p) (((((long) (p))*1103515245) >> 20) & 1023) |
#define PTRHASH(p) (((((long) (p))*1103515245) >> 20) & 1023) |
92 |
|
|
93 |
/* |
/** |
94 |
* This module manages possibly several databases of this sort. |
This module manages possibly several databases of this sort. |
95 |
*/ |
*/ |
96 |
struct data_base { |
struct data_base { |
97 |
struct Note *all; /* all notes committed */ |
struct Note *all; /** all notes committed */ |
98 |
struct gl_list_t *note_tokens; |
struct gl_list_t *note_tokens; |
99 |
symchar *dbid; /* name of this database */ |
symchar *dbid; /** name of this database */ |
100 |
struct data_base *next; /* linked list of databases */ |
struct data_base *next; /** linked list of databases */ |
101 |
struct note_bucket *typetab[NTAB]; /* hash keyed on type name */ |
struct note_bucket *typetab[NTAB]; /** hash keyed on type name */ |
102 |
struct note_bucket *idtab[NTAB]; /* hash keyed on id name */ |
struct note_bucket *idtab[NTAB]; /** hash keyed on id name */ |
103 |
int dead; |
int dead; |
104 |
}; |
}; |
105 |
|
|