Changed russian description a little bit
[gnuplot] / src / alloc.h
1 /*
2  * $Id: alloc.h,v 1.9 2004/07/01 17:10:03 broeker Exp $
3  */
4
5 /* GNUPLOT - alloc.h */
6
7 /*[
8  * Copyright 1986 - 1993, 1998, 2004   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 #ifdef HAVE_CONFIG_H
41 # include "config.h"
42 #endif
43
44 #include "stdfn.h"
45
46 /* prototypes from "alloc.c". This file figures out if the free hack is needed
47  * and redefines free if necessary.
48  */
49
50 generic *gp_alloc __PROTO((size_t size, const char *message));
51 generic *gp_realloc __PROTO((generic *p, size_t size, const char *message));
52
53 /* dont define CHECK_HEAP_USE on a FARALLOC machine ! */
54
55 #ifdef CHECK_HEAP_USE
56
57 /* all allocated blocks have guards at front and back.
58  * CHECK_POINTER checks guards on block, and checks that p is in range
59  * START_LEAK_CHECK and END_LEAK_CHECK allow assert that no net memory
60  * is allocated within enclosed block
61  */
62
63 void checked_free(void *p);
64 void check_pointer_in_block(void *block, void *p, int size, char *file, int line);
65 void start_leak_check(char *file,int line);
66 void end_leak_check(char *file,int line);
67 # define free(x) checked_free(x)
68 # define CHECK_POINTER(block, p) check_pointer_in_block(block, p, sizeof(*p), __FILE__, __LINE__)
69 # define START_LEAK_CHECK() start_leak_check(__FILE__, __LINE__)
70 # define END_LEAK_CHECK() end_leak_check(__FILE__, __LINE__)
71 #else
72 # define CHECK_POINTER(block, p) /*nowt*/
73 # define START_LEAK_CHECK() /*nowt*/
74 # define END_LEAK_CHECK() /*nowt*/
75 #endif
76
77 #if defined(MSDOS) && defined(__TURBOC__) && !defined(DOSX286) || defined(_Windows) && !defined(WIN32)
78 #define FARALLOC
79 void gpfree __PROTO((generic *p));
80 #define free gpfree
81 #endif
82
83 #endif /* GNUPLOT_ALLOC_H */