ide: RPC_METHOD support

git-svn-id: svn://ultimatepp.org/upp/trunk@5233 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2012-07-26 19:39:19 +00:00
parent e3aa869ee7
commit 61aa2e1c31
5 changed files with 40 additions and 27 deletions

View file

@ -401,7 +401,7 @@ void CodeEditor::InitKeywords()
"CLASSNAME", "THISBACK", "THISBACK1", "THISBACK2", "THISBACK3", "THISBACK4",
"PTEBACK", "PTEBACK1", "PTEBACK2", "PTEBACK3", "PTEBACK4",
"QUOTE", "XASSERT", "NEVER", "XNEVER", "CHECK", "XCHECK", "ASSERT",
"NAMESPACE_UPP", "END_UPP_NAMESPACE", "NEVER_", "SKYLARK",
"NAMESPACE_UPP", "END_UPP_NAMESPACE", "NEVER_", "SKYLARK", "RPC_METHOD", "RPC_GMETHOD",
NULL
};
static const char *upp_logs[] = {

View file

@ -235,15 +235,8 @@ String FormatXmlRpcError(int code, const char *text);
void Register(const char *name, void (*method)(RpcData&), const char *group = NULL);
#define RPC_METHOD(x) \
void rpc_method_##x(RpcData& rpc); \
INITBLOCK { Register(#x, rpc_method_##x); } \
void rpc_method_##x(RpcData& rpc)
#define RPC_GMETHOD(x, group) \
void rpc_method_##x(RpcData& rpc); \
INITBLOCK { Register(#x, rpc_method_##x, group); } \
void rpc_method_##x(RpcData& rpc)
#define RPC_METHOD(name) void name(RpcData& rpc); INITBLOCK { Register(#name, name); } void name(RpcData& rpc)
#define RPC_GMETHOD(name, group) void name(RpcData& rpc); INITBLOCK { Register(#name, name, group); } void name(RpcData& rpc)
struct RpcError {
int code;

View file

@ -668,22 +668,39 @@ Array<Parser::Decl> Parser::Declaration0(bool l0, bool more)
break;
}
Qualifier();
if(l0 && lex == tk_SKYLARK && lex[1] == '(') {
++lex;
++lex;
Decl& a = r.Add();
a.name = lex.GetId();
a.function = true;
a.natural = String().Cat() << "void " << a.name << "(Http& http)";
Decl& p = a.param.Add();
p.name = "http";
p.type = "Http";
p.natural = "Http& http";
Key(',');
lex.GetText();
Key(')');
return r;
}
if(l0)
if(lex == tk_SKYLARK && lex[1] == '(') {
++lex;
++lex;
Decl& a = r.Add();
a.name = lex.GetId();
a.function = true;
a.natural = String().Cat() << "void " << a.name << "(Http& http)";
Decl& p = a.param.Add();
p.name = "http";
p.type = "Http";
p.natural = "Http& http";
Key(',');
lex.GetText();
Key(')');
return r;
} else
if((lex == tk_RPC_METHOD || lex == tk_RPC_GMETHOD) && lex[1] == '(') {
++lex;
++lex;
Decl& a = r.Add();
a.name = lex.GetId();
a.function = true;
a.natural = String().Cat() << "void " << a.name << "(RpcData& rpc)";
Decl& p = a.param.Add();
p.name = "rpc";
p.type = "RpcData";
p.natural = "RpcData& rpc";
if (Key(','))
lex.GetText();
Key(')');
return r;
}
bool isdestructor = Key('~');
if(l0 && context.typenames.Find(lex) >= 0 && lex[1] == '(' && lex.IsId()) {
Decl& a = r.Add();

View file

@ -81,3 +81,6 @@ CPPID(catch)
CPPID(do)
CPPID(SKYLARK)
CPPID(RPC_METHOD)
CPPID(RPC_GMETHOD)

View file

@ -404,7 +404,7 @@ void AutoSetup()
"DEBUG_OPTIONS = \"-Od\";\n"
"RELEASE_BLITZ = \"0\";\n"
"RELEASE_LINKMODE = \"0\";\n"
"RELEASE_OPTIONS = \"-O2 -GS-\";\n"
d "RELEASE_OPTIONS = \"-O2 -GS-\";\n"
"RELEASE_SIZE_OPTIONS = \"-O1 -GS-\";\n"
"DEBUGGER = \"\";\n"
"REMOTE_HOST = \"\";\n"