PageRenderTime 20ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Protocol/generator/typedef.lua

http://awoe.googlecode.com/
Lua | 53 lines | 43 code | 10 blank | 0 comment | 0 complexity | 26c2b53cb933931cdf8829f8cd9e155e MD5 | raw file
 1local old_path = package.path
 2package.path = ";..\\..\\Generator\\lua\\?.lua" .. package.path
 3
 4require 'codeengine'
 5
 6package.path = old_path
 7
 8typedef_cpp =
 9{
10	int8 = "char",
11	uint8 = "unsigned char",
12	int16 = "short",
13	uint16 = "unsigned short",
14	int32 = "int",
15	uint32 = "unsigned int",
16	int64 = "__int64",
17	uint64 = "unsigned __int64",
18	string = "string",
19}
20
21
22typedef_java =
23{
24	int8 = "byte",
25	uint8 = "byte",
26	int16 = "short",
27	uint16 = "short",
28	int32 = "int",
29	uint32 = "int",
30	int64 = "long",
31	uint64 = "long",
32	string = "String",
33}
34
35function use_cpp_types()
36	typedef = typedef_cpp
37end
38
39function use_java_types()
40	typedef = typedef_java
41end
42
43function types(vtype)
44	return typedef[vtype] or vtype
45end
46
47function is_simple_type(vtype)
48	return typedef[vtype]
49end
50
51vname = function(name)
52	return name
53end