/Protocol/generator/typedef.lua
http://awoe.googlecode.com/ · Lua · 53 lines · 43 code · 10 blank · 0 comment · 1 complexity · 26c2b53cb933931cdf8829f8cd9e155e MD5 · raw file
- local old_path = package.path
- package.path = ";..\\..\\Generator\\lua\\?.lua" .. package.path
-
- require 'codeengine'
-
- package.path = old_path
-
- typedef_cpp =
- {
- int8 = "char",
- uint8 = "unsigned char",
- int16 = "short",
- uint16 = "unsigned short",
- int32 = "int",
- uint32 = "unsigned int",
- int64 = "__int64",
- uint64 = "unsigned __int64",
- string = "string",
- }
-
-
- typedef_java =
- {
- int8 = "byte",
- uint8 = "byte",
- int16 = "short",
- uint16 = "short",
- int32 = "int",
- uint32 = "int",
- int64 = "long",
- uint64 = "long",
- string = "String",
- }
-
- function use_cpp_types()
- typedef = typedef_cpp
- end
-
- function use_java_types()
- typedef = typedef_java
- end
-
- function types(vtype)
- return typedef[vtype] or vtype
- end
-
- function is_simple_type(vtype)
- return typedef[vtype]
- end
-
- vname = function(name)
- return name
- end