From ab7e691cc6d78d25354509b7b5cf096ca425d61a Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 10 Jul 2012 11:55:33 +0000 Subject: [PATCH] Core: JsonRpc support git-svn-id: svn://ultimatepp.org/upp/trunk@5164 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Rpc/Client.cpp | 2 +- uppsrc/Core/Rpc/{XmlRpc.h => Rpc.h} | 6 ++- uppsrc/Core/Rpc/Rpc.upp | 2 +- uppsrc/Core/Rpc/Server.cpp | 3 +- uppsrc/Core/Rpc/Value.cpp | 2 +- uppsrc/Core/Rpc/Xml.cpp | 2 +- uppsrc/Core/Rpc/init | 4 +- uppsrc/Core/Rpc/legacy.h | 53 +++++++++++++++++++++++++++ uppsrc/Draw/src.tpp/ImageOp$en-us.tpp | 14 ------- 9 files changed, 64 insertions(+), 24 deletions(-) rename uppsrc/Core/Rpc/{XmlRpc.h => Rpc.h} (95%) create mode 100644 uppsrc/Core/Rpc/legacy.h delete mode 100644 uppsrc/Draw/src.tpp/ImageOp$en-us.tpp diff --git a/uppsrc/Core/Rpc/Client.cpp b/uppsrc/Core/Rpc/Client.cpp index 88c660ddc..d0e071692 100644 --- a/uppsrc/Core/Rpc/Client.cpp +++ b/uppsrc/Core/Rpc/Client.cpp @@ -1,4 +1,4 @@ -#include "XmlRpc.h" +#include "Rpc.h" NAMESPACE_UPP diff --git a/uppsrc/Core/Rpc/XmlRpc.h b/uppsrc/Core/Rpc/Rpc.h similarity index 95% rename from uppsrc/Core/Rpc/XmlRpc.h rename to uppsrc/Core/Rpc/Rpc.h index 5d96e4df9..808f19832 100644 --- a/uppsrc/Core/Rpc/XmlRpc.h +++ b/uppsrc/Core/Rpc/Rpc.h @@ -1,5 +1,5 @@ -#ifndef _XmlRpc_XmlRpc_h -#define _XmlRpc_XmlRpc_h +#ifndef Rpc_Rpc_h +#define Rpc_Rpc_h #include @@ -334,6 +334,8 @@ void LogRpcRequests(bool b = true); void SetRpcServerTrace(Stream& s, int level = 1); +#include "legacy.h" + END_UPP_NAMESPACE #endif diff --git a/uppsrc/Core/Rpc/Rpc.upp b/uppsrc/Core/Rpc/Rpc.upp index 690b7ec7d..51a78eba8 100644 --- a/uppsrc/Core/Rpc/Rpc.upp +++ b/uppsrc/Core/Rpc/Rpc.upp @@ -4,7 +4,7 @@ uses Web; file - XmlRpc.h, + Rpc.h, legacy.h, Value.cpp, Xml.cpp, diff --git a/uppsrc/Core/Rpc/Server.cpp b/uppsrc/Core/Rpc/Server.cpp index 609500958..1d61373fc 100644 --- a/uppsrc/Core/Rpc/Server.cpp +++ b/uppsrc/Core/Rpc/Server.cpp @@ -1,5 +1,4 @@ -#include "XmlRpc.h" -#include "XmlRpc.h" +#include "Rpc.h" #define LLOG(x) DLOG(x) diff --git a/uppsrc/Core/Rpc/Value.cpp b/uppsrc/Core/Rpc/Value.cpp index 09708c152..ab7b03823 100644 --- a/uppsrc/Core/Rpc/Value.cpp +++ b/uppsrc/Core/Rpc/Value.cpp @@ -1,4 +1,4 @@ -#include "XmlRpc.h" +#include "Rpc.h" NAMESPACE_UPP diff --git a/uppsrc/Core/Rpc/Xml.cpp b/uppsrc/Core/Rpc/Xml.cpp index b788d3520..dfc2dc0f4 100644 --- a/uppsrc/Core/Rpc/Xml.cpp +++ b/uppsrc/Core/Rpc/Xml.cpp @@ -1,4 +1,4 @@ -#include "XmlRpc.h" +#include "Rpc.h" NAMESPACE_UPP diff --git a/uppsrc/Core/Rpc/init b/uppsrc/Core/Rpc/init index 061809f74..ef62a6844 100644 --- a/uppsrc/Core/Rpc/init +++ b/uppsrc/Core/Rpc/init @@ -1,4 +1,4 @@ -#ifndef _Core_XmlRpc_icpp_init_stub -#define _Core_XmlRpc_icpp_init_stub +#ifndef _Core_Rpc_icpp_init_stub +#define _Core_Rpc_icpp_init_stub #include "Web/init" #endif diff --git a/uppsrc/Core/Rpc/legacy.h b/uppsrc/Core/Rpc/legacy.h new file mode 100644 index 000000000..14c0546af --- /dev/null +++ b/uppsrc/Core/Rpc/legacy.h @@ -0,0 +1,53 @@ +#define XMLRPC_METHOD(x) RPC_METHOD(x) + +#define XMLRPC_GMETHOD(x, group) RPC_GMETHOD(x, group) + +typedef RpcError XmlRpcError; + +inline +void SetXmlRpcMethodFilter(String (*filter)(const String& methodname)) +{ + SetRpcMethodFilter(filter); +} + +inline +String XmlRpcExecute(const String& request, const char *group, const char *peeraddr) +{ + RpcExecute(request, group, peeraddr); +} + +inline +bool XmlRpcPerform(TcpSocket& http, const char *group) +{ + RpcPerform(http, group); +} + +inline +bool XmlRpcServerLoop(int port, const char *group = NULL) +{ + RpcServerLoop(port, group); +} + +inline +void ThrowXmlRpcError(int code, const char *s) +{ + ThrowXmlRpcError(code, s); +} + +inline +void ThrowXmlRpcError(const char *s) +{ + ThrowXmlRpcError(s); +} + +inline +void LogXmlRpcRequests(bool b = true) +{ + LogRpcRequests(b); +} + +inline +void SetXmlRpcServerTrace(Stream& s, int level = 1) +{ + SetRpcServerTrace(s, level); +} diff --git a/uppsrc/Draw/src.tpp/ImageOp$en-us.tpp b/uppsrc/Draw/src.tpp/ImageOp$en-us.tpp deleted file mode 100644 index 8c69e92de..000000000 --- a/uppsrc/Draw/src.tpp/ImageOp$en-us.tpp +++ /dev/null @@ -1,14 +0,0 @@ -topic ""; -[ $$0,0#00000000000000000000000000000000:Default] -[H6;0 $$1,0#05600065144404261032431302351956:begin] -[i448;a25;kKO9;2 $$2,0#37138531426314131252341829483370:codeitem] -[l288;2 $$3,0#27521748481378242620020725143825:desc] -[0 $$4,0#96390100711032703541132217272105:end] -[{_}%EN-US -[s1;%- &] -[s2;:WithHotSpot`(const Image`&`,int`,int`):%- [_^Image^ Image]_[* WithHotSpot]([@(0.0.255) c -onst]_[_^Image^ Image][@(0.0.255) `&]_[*@3 m], [@(0.0.255) int]_[*@3 x1], -[@(0.0.255) int]_[*@3 y1])&] -[s3; [%-*@3 m] [%-*@3 x1] [%-*@3 y1].&] -[s4; &] -[s0; ] \ No newline at end of file