Debian Codegraph @

texk/dvipdfm-x/mem.h

raw
1 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
2
3 Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata,
4 the dvipdfmx project team.
5
6 Copyright (C) 1998, 1999 by Mark A. Wicks <[email protected]>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22
23 #ifndef _MEM_H_
24 #define _MEM_H_
25
26 #include <stdlib.h>
27 #ifdef HAVE_INTTYPES_H
28 # include <inttypes.h>
29 #endif
30 #ifdef HAVE_STDINT_H
31 # include <stdint.h>
32 #endif
33
34 extern void *new (uint32_t size);
35 extern void *renew (void *p, uint32_t size);
36
37 #define NEW(n,type) (type *) new(((uint32_t)(n))*sizeof(type))
38 #define RENEW(p,n,type) (type *) renew(p,((uint32_t)(n))*sizeof(type))
39 #define RELEASE(p) free(p)
40
41 /*
42 * mem.h is not suitable for the following, but it is the only common
43 * header file for dpxcrypt.c, pdfencrypt.c, and pdffont.c, which use
44 * the function rand().
45 */
46 extern void init_genrand(unsigned long long s);
47 extern long genrand_int31(void);
48 #define srand(x) init_genrand((x))
49 #define rand() genrand_int31()
50 #endif /* _MEM_H_ */