Modified the UGetCursor() routine to return a valid response if the
[xcircuit.git] / spiceparser / memory.h
blob6ea68b3814d972f7888d07f39ec4e198eccb66fa
1 /********************
2 This file is part of the software library CADLIB written by Conrad Ziesler
3 Copyright 2003, Conrad Ziesler, all rights reserved.
5 *************************
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 ******************/
21 /* memory.h, header for private memory allocation routines
22 Conrad Ziesler
25 #ifndef __MEMORY_H__
26 #define __MEMORY_H__
28 #define MEMORY_CHUNKSIZE (1024*16)
29 #define MEMORY_THRESHOLD 16 /* a block is full if it within this size of full */
31 typedef struct memory_chain_st
33 struct memory_chain_st *next;
34 int q;
35 int qref; /* we maintain an reference count */
36 char data[MEMORY_CHUNKSIZE];
37 int magic[4];
38 }memory_chain_t;
39 #define MEMORY_MAGIC 0x35dfa315
41 typedef struct memory_other_st
43 struct memory_other_st *next;
44 }memory_other_t;
46 typedef struct memory_head_st
48 memory_chain_t *head,*full;
49 memory_other_t *others;
50 }memory_t;
52 #define MEMORY_INIT { NULL, NULL, NULL }
55 void *memory_alloc(memory_t *ma, int size);
56 void memory_free(memory_t *ma, void *vp);
57 void memory_freeall(memory_t *ma);
58 void memory_init(memory_t *ma);
60 #endif