GNU PROLOG with UTF8 support
Main Page
Data Structures
Files
File List
Globals
gprolog-utf8-tree
src
EnginePl
pl_long.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------*
2
* GNU Prolog *
3
* *
4
* Part : Prolog engine *
5
* File : wam_long.h *
6
* Descr.: Wam long type definition *
7
* Author: Daniel Diaz *
8
* *
9
* Copyright (C) 1999-2015 Daniel Diaz *
10
* *
11
* This file is part of GNU Prolog *
12
* *
13
* GNU Prolog is free software: you can redistribute it and/or *
14
* modify it under the terms of either: *
15
* *
16
* - the GNU Lesser General Public License as published by the Free *
17
* Software Foundation; either version 3 of the License, or (at your *
18
* option) any later version. *
19
* *
20
* or *
21
* *
22
* - the GNU General Public License as published by the Free *
23
* Software Foundation; either version 2 of the License, or (at your *
24
* option) any later version. *
25
* *
26
* or both in parallel, as here. *
27
* *
28
* GNU Prolog is distributed in the hope that it will be useful, *
29
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
30
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
31
* General Public License for more details. *
32
* *
33
* You should have received copies of the GNU General Public License and *
34
* the GNU Lesser General Public License along with this program. If *
35
* not, see http://www.gnu.org/licenses/. *
36
*-------------------------------------------------------------------------*/
37
38
#ifndef _PL_LONG_H
39
#define _PL_LONG_H
40
41
#include <stdint.h>
42
43
#include "gp_config.h"
44
45
/* A PlLong can store an address: it is thus an intptr_t (depends on 32/64 bits arch) */
46
47
typedef
intptr_t
PlLong
;
48
typedef
uintptr_t
PlULong
;
49
50
#ifdef HAVE_INTTYPES_H
51
52
#include <inttypes.h>
53
54
#define PL_FMT_d PRIdPTR
55
#define PL_FMT_u PRIuPTR
56
#define PL_FMT_o PRIoPTR
57
#define PL_FMT_x PRIxPTR
58
59
/* Utilities to work on int64_t independently of the 32/64 bits of the arch */
60
61
#define FMT64_d PRId64
62
#define FMT64_u PRIu64
63
#define FMT64_o PRIo64
64
#define FMT64_x PRIx64
65
66
#else
/* !HAVE_INTTYPES_H */
67
68
#if SIZEOF_LONG == SIZEOF_VOIDP
69
70
# define __PL_FMT_PREFIX "l"
71
72
#elif defined(_MSC_VER)
73
74
# define __PL_FMT_PREFIX "I64"
75
76
#else
77
78
# define __PL_FMT_PREFIX "ll"
79
80
#endif
81
82
#define PL_FMT_d __PL_FMT_PREFIX "d"
83
#define PL_FMT_u __PL_FMT_PREFIX "u"
84
#define PL_FMT_o __PL_FMT_PREFIX "o"
85
#define PL_FMT_x __PL_FMT_PREFIX "x"
86
87
/* Utilities to work on int64_t independently of the 32/64 bits of the arch */
88
89
#ifdef _MSC_VER
90
91
# define __FMT64_PREFIX "I64"
92
93
#elif WORD_SIZE == 64
94
95
# define __FMT64_PREFIX "l"
96
97
#else
98
99
# define __FMT64_PREFIX "ll"
100
101
#endif
102
103
#define FMT64_d __FMT64_PREFIX "d"
104
#define FMT64_u __FMT64_PREFIX "u"
105
#define FMT64_o __FMT64_PREFIX "o"
106
#define FMT64_x __FMT64_PREFIX "x"
107
108
#endif
/* !HAVE_INTTYPES_H */
109
110
111
/* --- strtol / strtoul --- */
112
113
#if SIZEOF_LONG == SIZEOF_VOIDP
114
115
# define Str_To_PlLong(__str, __end, __base) strtol (__str, __end, __base)
116
# define Str_To_PlULong(__str, __end, __base) strtoul(__str, __end, __base)
117
118
#elif defined(__GNUC__)
119
120
# define Str_To_PlLong(__str, __end, __base) strtoll (__str, __end, __base)
121
# define Str_To_PlULong(__str, __end, __base) strtoull(__str, __end, __base)
122
123
#else
/* MSVC */
124
125
# define Str_To_PlLong(__str, __end, __base) _strtoi64 (__str, __end, __base)
126
# define Str_To_PlULong(__str, __end, __base) _strtoui64(__str, __end, __base)
127
128
#endif
129
130
#endif
/* !_PL_LONG_H */
PlULong
uintptr_t PlULong
Definition:
pl_long.h:48
PlLong
intptr_t PlLong
Definition:
pl_long.h:47
Generated by
1.8.11