|
@ -1,15 +1,9 @@ |
|
|
%% Author: NoteBook |
|
|
|
|
|
%% Created: 2009-9-18 |
|
|
|
|
|
%% Description: TODO: Add description to gen_protocal_charp |
|
|
|
|
|
-module(gLuaGen). |
|
|
-module(gLuaGen). |
|
|
|
|
|
|
|
|
%% |
|
|
|
|
|
%% Include files |
|
|
|
|
|
%% |
|
|
|
|
|
|
|
|
-export([ |
|
|
|
|
|
genLua/4 |
|
|
|
|
|
]). |
|
|
|
|
|
|
|
|
%% |
|
|
|
|
|
%% Exported Functions |
|
|
|
|
|
%% |
|
|
|
|
|
-export([start/0]). |
|
|
-export([start/0]). |
|
|
-export([test/0]). |
|
|
-export([test/0]). |
|
|
%% |
|
|
%% |
|
@ -20,35 +14,14 @@ start() -> |
|
|
StructList = protocol_def:get_struct_def(), |
|
|
StructList = protocol_def:get_struct_def(), |
|
|
TypeList = gen_common:get_type(), |
|
|
TypeList = gen_common:get_type(), |
|
|
FileStr = make_protocal(StructList, "", TypeList), |
|
|
FileStr = make_protocal(StructList, "", TypeList), |
|
|
%%根据前端需求更改 原:file:write_file("NetPacket.lua", FileStr), |
|
|
|
|
|
%% file:write_file("NetPacket.lua", lists:concat(["return {", FileStr, "}"])), |
|
|
|
|
|
file:write_file("NetPacket.lua", FileStr), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file:write_file("NetPacket.lua", FileStr), |
|
|
EnumStr = make_protocal_enum(protocol_def:get_enum_def(), ""), |
|
|
EnumStr = make_protocal_enum(protocol_def:get_enum_def(), ""), |
|
|
ConstStr = make_protocal_const(protocol_def:get_version()), |
|
|
ConstStr = make_protocal_const(protocol_def:get_version()), |
|
|
file:write_file("NetEnumDef.lua", EnumStr ++ "\n" ++ ConstStr), |
|
|
file:write_file("NetEnumDef.lua", EnumStr ++ "\n" ++ ConstStr), |
|
|
MsgTypeStr = make_protocal_msg_type(StructList, "", 1), |
|
|
MsgTypeStr = make_protocal_msg_type(StructList, "", 1), |
|
|
file:write_file("NetMsgType.lua", MsgTypeStr). |
|
|
file:write_file("NetMsgType.lua", MsgTypeStr). |
|
|
|
|
|
|
|
|
%% |
|
|
|
|
|
%% Local Functions |
|
|
|
|
|
%% |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%生成包含文件%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
|
|
|
|
|
|
|
|
|
%% make_include() -> |
|
|
|
|
|
%% "using System; |
|
|
|
|
|
%% using System.Collections;". |
|
|
|
|
|
%% "#pragma once |
|
|
|
|
|
%% #include\"ByteArray.h\" |
|
|
|
|
|
%% #include\"BaseType.h\" |
|
|
|
|
|
%% #include\"INetPacket.h\" |
|
|
|
|
|
%% #include\"NetMsgType.h\" |
|
|
|
|
|
%% #include<string> |
|
|
|
|
|
%% #include<vector> |
|
|
|
|
|
%% ". |
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%生成函数的方法%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
|
|
|
|
|
|
|
|
|
|
make_protocal([], StructStr, _TypeList) -> |
|
|
make_protocal([], StructStr, _TypeList) -> |
|
|
StructStr; |
|
|
StructStr; |
|
|
make_protocal([Struct | Structs], StructStr, TypeList) -> |
|
|
make_protocal([Struct | Structs], StructStr, TypeList) -> |
|
|