ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libcpjit/cpjit.h
Revision: 1.6
Committed: Tue Oct 11 20:43:29 2005 UTC (21 years ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.5: +46 -3 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.2 /*
2 root 1.5 This file is AUTOMAGICALLY created by cpjit.h.PL. Modifications will
3     be lost.
4    
5 root 1.2 cpjit.h -- c portable jit in time compiler
6 root 1.4 Copyright (C) 2005 Marc Lehmann <cpjit.de>
7 root 1.2
8     This file is part of libcpjit.
9    
10     libcpjit is free software; you can redistribute it and/or modify
11     it under the terms of the GNU General Public License as published by
12     the Free Software Foundation; either version 2 of the License, or
13     (at your option) any later version.
14    
15     This program is distributed in the hope that it will be useful,
16     but WITHOUT ANY WARRANTY; without even the implied warranty of
17     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18     GNU General Public License for more details.
19    
20     You should have received a copy of the GNU General Public License
21     along with gvpe; if not, write to the Free Software
22     Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23     */
24 root 1.3
25 root 1.6 #include <string>
26     #include <cstdint>
27    
28 root 1.3 namespace cpjit
29     {
30    
31 root 1.6 typedef std::string idstr;
32    
33 root 1.5 // environment for persistent or temporary storage
34     struct env
35     {
36     };
37    
38     struct func_base
39     {
40 root 1.6 enc &e;
41     idstr id;
42     const char *retval;
43    
44     func_base (env &e, const idstr &id, const char *retval, const char *args)
45     : e(e), id(id)
46 root 1.5 };
47    
48     struct funcbuilder_base
49     {
50     };
51    
52 root 1.6 typedef unsigned char U8;
53     typedef signed char I8;
54     typedef uint16_t U16;
55     typedef int16_t I16;
56     typedef uint32_t U32;
57     typedef int32_t I32;
58     typedef uint64_t U64;
59     typedef int64_t I64;
60     typedef float F32;
61     typedef double F64;
62    
63     template<> struct typestr<U8 > { static const char *str };
64     template<> struct typestr<U16 > { static const char *str };
65     template<> struct typestr<U32 > { static const char *str };
66     template<> struct typestr<U64 > { static const char *str };
67     template<> struct typestr<I8 > { static const char *str };
68     template<> struct typestr<I16 > { static const char *str };
69     template<> struct typestr<I32 > { static const char *str };
70     template<> struct typestr<I64 > { static const char *str };
71     template<> struct typestr<F32 > { static const char *str };
72     template<> struct typestr<F64 > { static const char *str };
73     template<> struct typestr<U8 *> { static const char *str };
74     template<> struct typestr<U16 *> { static const char *str };
75     template<> struct typestr<U32 *> { static const char *str };
76     template<> struct typestr<U64 *> { static const char *str };
77     template<> struct typestr<I8 *> { static const char *str };
78     template<> struct typestr<I16 *> { static const char *str };
79     template<> struct typestr<I32 *> { static const char *str };
80     template<> struct typestr<I64 *> { static const char *str };
81     template<> struct typestr<F32 *> { static const char *str };
82     template<> struct typestr<F64 *> { static const char *str };
83    
84 root 1.5 template<typename R, typename A1>
85     struct function : func_base
86     {
87 root 1.6 function (env &e, const idstr &id)
88     : func_base (e, i, typestr<typename R>.str)
89 root 1.5 {
90     typename R
91     operator ()(A1 a1)
92     {
93     return ((typename R (*)(A1 a1)) ptr ())(a1);
94     }
95     };
96 root 1.6
97 root 1.3 }