Lhogho  0.0.028
 All Data Structures Files Functions Variables Typedefs Macros Pages
numbers.h
Go to the documentation of this file.
1 //
2 // Project: Lhogho
3 // File: numbers.h
4 //
5 // Copyright (C) 2007 P.Boytchev
6 //
7 // Revision history:
8 // 2007-06-09 - file created from atoms.c
9 // 2007-06-25 - atom_to_float()
10 //
11 //
12 // This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 //
26 
27 #ifndef LHOGHO_NUMBERS_H
28 #define LHOGHO_NUMBERS_H
29 
30 #include "stdint.h"
31 #include "stddef.h"
32 #include "globals.h"
33 #include "atoms.h"
34 
35 
36 
37 #define INTEGER(x) ((x)->unode.i[1])
38 #define FLOAT(x) ((x)->unode.f[1])
39 #define IS_INTEGER(x) (ID(x)==INTEGER_ID)
40 #define IS_FLOAT(x) (ID(x)==FLOAT_ID)
41 #define REPCOUNT(x) ((x)->unode.n[2])
42 #define REPLIMIT(x) ((x)->unode.n[3])
43 
44 
45 
46 #ifdef WINDOWS
47  #define FORMAT_INT TEXT("%I64d")
48  //#define FORMAT_INT TEXT("%lld")
49 #else
50  #define FORMAT_INT TEXT("%Ld")
51 #endif //WINDOWS
52 
53 #define FORMAT_FP TEXT("%0.14f") //TEXT("%f")
54 #define FORMAT_EXTRA_FP TEXT("%g") //TEXT("%f")
55 
56 
57 
58 
59 #ifdef ADVANCED
60  extern int stats_free;
61 #endif //ADVANCED
62 
63 
64 
65 
66 extern atom_t new_integer( int64_t data );
67 extern atom_t new_float( float64_t data );
68 extern void delete_numeric( atom_t a );
69 extern void dump_integer( atom_t a, int level );
70 extern void dump_integer_const( int a );
71 extern void dump_float( atom_t a, int level );
72 extern int atom_to_float( atom_t a, float64_t *np );
73 extern int atom_to_int( atom_t a, int64_t* np );
74 extern int atom_to_integer( atom_t a, int* np );
75 
76 #if defined(DEBUG_RUNTIME_ATOMS) || defined(DEBUG_COMPILETIME_ATOMS)
77 extern void dump_atom_address( atom_t a );
78 #endif
79 
80 
81 #endif //LHOGHO_NUMBERS_H

[ HOME | INDEX | ATOMS | VARS | REFERENCE ]
Lhogho Developer's Documentation
Wed Jul 10 2013