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

File Contents

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