source: vis_dev/glu-2.1/src/mem/memuser.h @ 10

Last change on this file since 10 was 8, checked in by cecile, 13 years ago

src glu

File size: 1.8 KB
Line 
1/*
2 * $Id: memuser.h,v 1.3 2002/08/27 15:47:48 fabio Exp $
3 *
4 */
5
6/* Memory management user-visible definitions */
7
8
9#if !defined(_MEMUSERH)
10#define _MEMUSERH
11
12#ifndef ARGS
13#  ifdef __STDC__
14#    define ARGS(args)  args
15#  else
16#    define ARGS(args)  ()
17#  endif
18#endif
19
20#ifdef __cplusplus
21#  define EXTERN        extern "C"
22#else
23#  define EXTERN        extern
24#endif
25
26#include <stdio.h>
27
28
29
30/* >>> Potentially machine dependent stuff */
31/* See memint.h as well. */
32
33typedef unsigned long INT_PTR;  /* Integral type that can hold a pointer */
34typedef unsigned long SIZE_T;   /* Integral type that can hold the maximum */
35                                /* size of an object */
36
37/* REQUIRED_ALIGNMENT is the alignment required by the machine hardware; */
38/* it is provided for user use. */
39
40#define REQUIRED_ALIGNMENT 4
41
42
43/* Types */
44
45#if defined(__STDC__)
46typedef void *pointer;
47#else
48typedef char *pointer;
49#endif
50
51
52typedef struct rec_mgr_ *rec_mgr;
53
54
55/* ALLOC_ALIGNMENT is the alignment for all storage returned by the */
56/* storage allocation routines. */
57
58#define ALLOC_ALIGNMENT 8
59
60
61/* Round a size up for alignment */
62
63#define ROUNDUP(size) ((((size)+ALLOC_ALIGNMENT-1)/ALLOC_ALIGNMENT)*ALLOC_ALIGNMENT)
64#define ALIGN(size) ((((size)+REQUIRED_ALIGNMENT-1)/REQUIRED_ALIGNMENT)*REQUIRED_ALIGNMENT)
65
66
67/* Block storage management routines */
68
69EXTERN pointer mem_get_block ARGS((SIZE_T));
70EXTERN void mem_free_block ARGS((pointer));
71EXTERN pointer mem_resize_block ARGS((pointer, SIZE_T));
72EXTERN void mem_copy ARGS((pointer, pointer, SIZE_T));
73EXTERN void mem_zero ARGS((pointer, SIZE_T));
74EXTERN void mem_fatal ARGS((char *));
75EXTERN SIZE_T mem_allocation ARGS((void));
76
77
78/* Record manager routines */
79
80EXTERN pointer mem_new_rec ARGS((rec_mgr));
81EXTERN void mem_free_rec ARGS((rec_mgr, pointer));
82EXTERN rec_mgr mem_new_rec_mgr ARGS((int));
83EXTERN void mem_free_rec_mgr ARGS((rec_mgr));
84
85
86#undef ARGS
87#undef EXTERN
88
89#endif
Note: See TracBrowser for help on using the repository browser.