1 | /*
|
---|
2 | * $Id: alloc.h,v 1.1.1.1 2001-12-19 18:01:18 perderos Exp $
|
---|
3 | */
|
---|
4 |
|
---|
5 | /* GNUPLOT - alloc.h */
|
---|
6 |
|
---|
7 | /*[
|
---|
8 | * Copyright 1986 - 1993, 1998 Thomas Williams, Colin Kelley
|
---|
9 | *
|
---|
10 | * Permission to use, copy, and distribute this software and its
|
---|
11 | * documentation for any purpose with or without fee is hereby granted,
|
---|
12 | * provided that the above copyright notice appear in all copies and
|
---|
13 | * that both that copyright notice and this permission notice appear
|
---|
14 | * in supporting documentation.
|
---|
15 | *
|
---|
16 | * Permission to modify the software is granted, but not the right to
|
---|
17 | * distribute the complete modified source code. Modifications are to
|
---|
18 | * be distributed as patches to the released version. Permission to
|
---|
19 | * distribute binaries produced by compiling modified sources is granted,
|
---|
20 | * provided you
|
---|
21 | * 1. distribute the corresponding source modifications from the
|
---|
22 | * released version in the form of a patch file along with the binaries,
|
---|
23 | * 2. add special version identification to distinguish your version
|
---|
24 | * in addition to the base release version number,
|
---|
25 | * 3. provide your name and address as the primary contact for the
|
---|
26 | * support of your modified version, and
|
---|
27 | * 4. retain our contact information in regard to use of the base
|
---|
28 | * software.
|
---|
29 | * Permission to distribute the released version of the source code along
|
---|
30 | * with corresponding source modifications in the form of a patch file is
|
---|
31 | * granted with same provisions 2 through 4 for binary distributions.
|
---|
32 | *
|
---|
33 | * This software is provided "as is" without express or implied warranty
|
---|
34 | * to the extent permitted by applicable law.
|
---|
35 | ]*/
|
---|
36 |
|
---|
37 | #ifndef GNUPLOT_ALLOC_H
|
---|
38 | # define GNUPLOT_ALLOC_H
|
---|
39 |
|
---|
40 | #include <stdio.h>
|
---|
41 | #include <stdlib.h>
|
---|
42 | #include "graph3d.h"
|
---|
43 | /****
|
---|
44 | #ifdef HAVE_CONFIG_H
|
---|
45 | # include "config.h"
|
---|
46 | #endif
|
---|
47 |
|
---|
48 | #include "stdfn.h"
|
---|
49 | ****/
|
---|
50 | /* prototypes from "alloc.c". This file figures out if the free hack is needed
|
---|
51 | * and redefines free if necessary.
|
---|
52 | */
|
---|
53 |
|
---|
54 | void *gp_alloc(size_t size, const char *message);
|
---|
55 | void *gp_realloc(void *p, size_t size, const char *message);
|
---|
56 | struct iso_curve *iso_alloc(int);
|
---|
57 |
|
---|
58 | void iso_free(struct iso_curve *);
|
---|
59 | void gp_free(void *);
|
---|
60 | void contour_free(struct gnuplot_contours *ptr);
|
---|
61 | /* dont define CHECK_HEAP_USE on a FARALLOC machine ! */
|
---|
62 |
|
---|
63 | #ifdef CHECK_HEAP_USE
|
---|
64 |
|
---|
65 | /* all allocated blocks have guards at front and back.
|
---|
66 | * CHECK_POINTER checks guards on block, and checks that p is in range
|
---|
67 | * START_LEAK_CHECK and END_LEAK_CHECK allow assert that no net memory
|
---|
68 | * is allocated within enclosed block
|
---|
69 | */
|
---|
70 |
|
---|
71 | void checked_free(void *p);
|
---|
72 | void check_pointer_in_block(void *block, void *p, int size, char *file, int line);
|
---|
73 | void start_leak_check(char *file,int line);
|
---|
74 | void end_leak_check(char *file,int line);
|
---|
75 | /*# define free(x) checked_free(x)*/
|
---|
76 | # define CHECK_POINTER(block, p) check_pointer_in_block(block, p, sizeof(*p), __FILE__, __LINE__)
|
---|
77 | # define START_LEAK_CHECK() start_leak_check(__FILE__, __LINE__)
|
---|
78 | # define END_LEAK_CHECK() end_leak_check(__FILE__, __LINE__)
|
---|
79 | #else
|
---|
80 | # define CHECK_POINTER(block, p) /*nowt*/
|
---|
81 | # define START_LEAK_CHECK() /*nowt*/
|
---|
82 | # define END_LEAK_CHECK() /*nowt*/
|
---|
83 | #endif
|
---|
84 |
|
---|
85 | /***
|
---|
86 | #if defined(MSDOS) && defined(__TURBOC__) && !defined(DOSX286) || defined(_Windows) && !defined(WIN32)
|
---|
87 | #define FARALLOC
|
---|
88 | void gpfree((generic *p));
|
---|
89 | #define free gpfree
|
---|
90 | #endif
|
---|
91 | ***/
|
---|
92 | #endif /* GNUPLOT_ALLOC_H */
|
---|