diff --git a/Build/Linux/CppUnitTest.workspace b/Build/Linux/CppUnitTest.workspace new file mode 100644 index 000000000..52761e46c --- /dev/null +++ b/Build/Linux/CppUnitTest.workspace @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Build/Linux/Linux_Bin/AutoTestClient b/Build/Linux/Linux_Bin/AutoTestClient new file mode 100755 index 000000000..cc31d70c3 Binary files /dev/null and b/Build/Linux/Linux_Bin/AutoTestClient differ diff --git a/Build/Linux/Linux_Bin/CommonTCPClient b/Build/Linux/Linux_Bin/CommonTCPClient new file mode 100755 index 000000000..21a9197bf Binary files /dev/null and b/Build/Linux/Linux_Bin/CommonTCPClient differ diff --git a/Build/Linux/Linux_Bin/ConsoleCommand.xml b/Build/Linux/Linux_Bin/ConsoleCommand.xml new file mode 100644 index 000000000..15f743198 --- /dev/null +++ b/Build/Linux/Linux_Bin/ConsoleCommand.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/CppUnitTest.ini b/Build/Linux/Linux_Bin/CppUnitTest.ini new file mode 100644 index 000000000..933e647cf --- /dev/null +++ b/Build/Linux/Linux_Bin/CppUnitTest.ini @@ -0,0 +1,2 @@ +[Config] +CppUnitTest=aaa \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/FileTest/1.txt b/Build/Linux/Linux_Bin/FileTest/1.txt new file mode 100644 index 000000000..3c8b0d689 --- /dev/null +++ b/Build/Linux/Linux_Bin/FileTest/1.txt @@ -0,0 +1 @@ +01 00 00 10 08 00 00 00 46 45 45 45 45 59 45 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 be cd aa 8f 3c 01 00 00 \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/FileTestCfg.xml b/Build/Linux/Linux_Bin/FileTestCfg.xml new file mode 100644 index 000000000..bf038231c --- /dev/null +++ b/Build/Linux/Linux_Bin/FileTestCfg.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/FileWatch.xml b/Build/Linux/Linux_Bin/FileWatch.xml new file mode 100644 index 000000000..edf4e55f6 --- /dev/null +++ b/Build/Linux/Linux_Bin/FileWatch.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/Icon.jpg b/Build/Linux/Linux_Bin/Icon.jpg new file mode 100644 index 000000000..b214c3bba Binary files /dev/null and b/Build/Linux/Linux_Bin/Icon.jpg differ diff --git a/Build/Linux/Linux_Bin/LoginBufferFile/UserLogin.txt b/Build/Linux/Linux_Bin/LoginBufferFile/UserLogin.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Build/Linux/Linux_Bin/LoginBufferFile/UserValid.txt b/Build/Linux/Linux_Bin/LoginBufferFile/UserValid.txt new file mode 100644 index 000000000..e54c28003 --- /dev/null +++ b/Build/Linux/Linux_Bin/LoginBufferFile/UserValid.txt @@ -0,0 +1 @@ +freeeyes,123456; horse,111111; rabbit,222222; freeeyes1,123456; freeeyes2,123456; freeeyes3,123456; freeeyes4,123456; freeeyes5,123456; freeeyes6,123456; freeeyes7,123456; freeeyes8,123456; freeeyes9,123456; freeeyes10,123456; freeeyes11,123456; freeeyes12,123456; freeeyes13,123456; freeeyes14,123456; freeeyes15,123456; freeeyes16,123456; freeeyes17,123456; freeeyes18,123456; freeeyes19,123456; freeeyes20,123456; freeeyes21,123456; freeeyes22,123456; freeeyes23,123456; freeeyes24,123456; freeeyes25,123456; freeeyes26,123456; freeeyes27,123456; freeeyes28,123456; \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/LuaScript/LuaTest.lua b/Build/Linux/Linux_Bin/LuaScript/LuaTest.lua new file mode 100644 index 000000000..559d4cfae --- /dev/null +++ b/Build/Linux/Linux_Bin/LuaScript/LuaTest.lua @@ -0,0 +1,36 @@ +--һ׼Lua PassTcpű +--ṩ¼ķװͽյ¼ķװ +--֯ķݺ֤ +--ӿƣҪǿǵ̲߳ٲҪ߳ +--ݿ鲻Ҫڽű㲻ͷ +--Ŀǰ֧100KݿС +--add by freeeyes + +--Ҫݵ¼PassTCPãʵķݷ +--ڲnThreadIDǵǰ߳IDszDataϢ(char* )nLenǻ󳤶ȣnSendIndexǵǰӵķʹ +function LuaTest_SendData(szData, nLen, nThreadID, nSendIndex) + -- + --szDataΪchar* ҪĻ顣 + --nLenǵǰ󳤶 + --nNextIndex-1˵ֵ,򷵻һεʼλ + + --4ֽڰͷ + nPacketSize = 10 + nStartIndex = 0 + nNextIndex = 0 + nNextIndex = Lua_Tcp_Buffer_In_Int32(szData, nPacketSize, nStartIndex, nLen) + + --2ֽڵ + --nCommandID = 4096 + --nNextIndex = Lua_Tcp_Buffer_In_Int16(szData, nCommandID, nNextIndex, nLen) + + --ݿ + szBuff = '12345678' + nNextIndex = Lua_Tcp_Buffer_In_Block(szData, szBuff, 8, nNextIndex, nLen) + + --뷵ݿijȣPassTCP֪ܳ + return nNextIndex +end + + + diff --git a/Build/Linux/Linux_Bin/LuaScript/RoomLogic.lua b/Build/Linux/Linux_Bin/LuaScript/RoomLogic.lua new file mode 100644 index 000000000..4f98d6531 --- /dev/null +++ b/Build/Linux/Linux_Bin/LuaScript/RoomLogic.lua @@ -0,0 +1,187 @@ +--ڷе߼ +--add by freeeyes + +ROOM_PLAYER_SIZE = 5 --Ҳμӵ +ROOM_PLAYER_VISITOR_SIZE = 5 --۲ҵ + +ROOM_ERROR_NULL = 0 --ȷķֵ + +--ҽ뷿䣬nRoomIDIDnPlayerIDID +function EnterRoom(nRoomID, nPlayerID) + --λʾ + if LuaFn_Room_API_GetPlayerCount(nRoomID) > ROOM_PLAYER_SIZE then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Room Player is full.") + return -1 + end + + --ڲιʾ + if LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) > ROOM_PLAYER_SIZE then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Room Player is full.") + return -1 + end + + --뷿 + nRet = LuaFn_Room_API_EnterRoom(nRoomID, nPlayerID, "freeeyes", 1000) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom success.") + + --ⲿΪԴ룬ݸ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + return 0 + end +end + +--£nRoomIDIDnPlayerIDID, nLocationλ +function SitRoom(nRoomID, nPlayerID, nLocation) + -- + nRet = LuaFn_Room_API_PlayerSit(nRoomID, nPlayerID, nLocation) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom success.") + + --жϷǷڶʱ + if LuaFn_RoomTimer_API_Check(nRoomID) == false then + --ûжʱչһʱ + nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + if nCount > 1 then + --жϵǰʱǷڷʱ5 + if LuaFn_Room_API_CheckRoomUpdateTime(nRoomID, 5) == true then + --һĶʱ + nRet = LuaFn_RoomTimer_API_Add(2, nRoomID, nPlayerID, 1001) + if nRet <= 0 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer fail.[nRet="..nRet.."]") + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer success.[nsecond=5]") + end + else + --һĶʱ + nRet = LuaFn_RoomTimer_API_Add(5, nRoomID, nPlayerID, 1001) + if nRet <= 0 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer fail.[nRet="..nRet.."]") + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer success.[nsecond=2]") + end + end + end + end + end + return 0 +end + +--뿪nRoomIDIDnPlayerIDID +function ExitRoom(nRoomID, nPlayerID) + --Դ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + + --һû + --nPlayerID1 = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + --nPlayerID2 = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [nPlayerID1="..nPlayerID1.."][nPlayerID2="..nPlayerID2.."]") + + nRet = LuaFn_Room_API_Exit(nRoomID, nPlayerID) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom success.") + + --Դ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + return 0 + end +end + +--߳ҹnRoomIDIDnPlayerIDIDnOperationIDcID +function OutRoom(nRoomID, nPlayerID, nOperationID) + +end + +--ұ任䣬nSrcRoomIDԭʼIDnDstRoomIDĿ귿IDnPlayerIDID +function ChangeRoom(nSrcRoomID, nDstRoomID, nPlayerID) + +end + +--¼ʱµánEventID¼IDnPlayerIDIDûҴ-1 +function Update(nRoomID, nPlayerID, nEventID, nData) + --ע + if nEventID == 3001 then + nRet = LuaFn_Room_API_SetPlayerBet(nRoomID, nPlayerID, nData) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update SetPlayerBet.[nRet="..nRet.."]") + return 0 + else + --ƶһ + nNextPlayer = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + if nNextPlayer > 0 then + --㵱ǰִDzһ + if LuaFn_Room_GameInfo_API_GetRoundCount(nRoomID) >= 4 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update LuaFn_Room_GameInfo_API_GetRoundCount.[RoundCount=4]") + --ƾֽ + else + + --һװ϶ʱ + LuaFn_PlayerTimer_API_Add(5, nRoomID, nNextPlayer, 2001) + end + else + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update GetRoomNextPlayerID.[nRet="..nRet.."]") + end + end + end + + return 0 +end + +--䣬ȫ˳ +function ClearRoom() + +end + +--ʼ +function InitRoom() + +end + +--PlayerϵĶʱ +function PlayerTimer(nRoomID, nPlayerID, nEventID) + if nEventID == 2001 then + --ûע + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] PlayerTimer Begin") + + --ﴦƶĹ + end +end + +--Ķʱ +function RoomTimer(nRoomID, nPlayerID, nEventID) + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] RoomTimer Begin") + if nEventID == 1001 then + --1001¼ôǵʱ¼(C++˷ƣ´äעСäעԼǷ״̬) + nRet = LuaFn_Room_API_DealCode(nRoomID, 1000, -1, -1) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] RoomTimer Begin DealCode.[nRet="..nRet.."]") + return 0 + else + nCurrPlayerID = LuaFn_Room_API_GetRoomCurrPlayerID(nRoomID) + + --ÿʼIDԴΪִμݣGetRoomNextPlayerIDңִμ+1 + LuaFn_Room_API_SetBenginePlayerID(nCurrPlayerID) + + --һƵӶʱ + LuaFn_PlayerTimer_API_Add(5, nRoomID, nPlayerID, 2001) + end + end +end + diff --git a/Build/Linux/Linux_Bin/Module/PacketParse_Interface b/Build/Linux/Linux_Bin/Module/PacketParse_Interface new file mode 100755 index 000000000..4d4a7ce4b Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/PacketParse_Interface differ diff --git a/Build/Linux/Linux_Bin/Module/PacketParse_Interface_Http b/Build/Linux/Linux_Bin/Module/PacketParse_Interface_Http new file mode 100755 index 000000000..6a7868a75 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/PacketParse_Interface_Http differ diff --git a/Build/Linux/Linux_Bin/Module/PacketParse_Interface_Monitor b/Build/Linux/Linux_Bin/Module/PacketParse_Interface_Monitor new file mode 100755 index 000000000..cd628d2fe Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/PacketParse_Interface_Monitor differ diff --git a/Build/Linux/Linux_Bin/Module/PacketParse_Interface_WebSocket b/Build/Linux/Linux_Bin/Module/PacketParse_Interface_WebSocket new file mode 100755 index 000000000..50bd829d1 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/PacketParse_Interface_WebSocket differ diff --git a/Build/Linux/Linux_Bin/Module/libAutoTest b/Build/Linux/Linux_Bin/Module/libAutoTest new file mode 100755 index 000000000..a2a914a80 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libAutoTest differ diff --git a/Build/Linux/Linux_Bin/Module/libFtpTest b/Build/Linux/Linux_Bin/Module/libFtpTest new file mode 100755 index 000000000..1e4d8f540 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libFtpTest differ diff --git a/Build/Linux/Linux_Bin/Module/libHttp b/Build/Linux/Linux_Bin/Module/libHttp new file mode 100755 index 000000000..c098e4716 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libHttp differ diff --git a/Build/Linux/Linux_Bin/Module/libKafkaClient b/Build/Linux/Linux_Bin/Module/libKafkaClient new file mode 100755 index 000000000..33279df2a Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libKafkaClient differ diff --git a/Build/Linux/Linux_Bin/Module/libLGLogic b/Build/Linux/Linux_Bin/Module/libLGLogic new file mode 100755 index 000000000..007449716 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libLGLogic differ diff --git a/Build/Linux/Linux_Bin/Module/libLoginBuffer_Login b/Build/Linux/Linux_Bin/Module/libLoginBuffer_Login new file mode 100755 index 000000000..c3f500f33 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libLoginBuffer_Login differ diff --git a/Build/Linux/Linux_Bin/Module/libLoginBuffer_Watch b/Build/Linux/Linux_Bin/Module/libLoginBuffer_Watch new file mode 100755 index 000000000..48f155422 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libLoginBuffer_Watch differ diff --git a/Build/Linux/Linux_Bin/Module/libLsPlugIn b/Build/Linux/Linux_Bin/Module/libLsPlugIn new file mode 100755 index 000000000..219e313c2 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libLsPlugIn differ diff --git a/Build/Linux/Linux_Bin/Module/libLuaTest b/Build/Linux/Linux_Bin/Module/libLuaTest new file mode 100755 index 000000000..76dbdfdc8 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libLuaTest differ diff --git a/Build/Linux/Linux_Bin/Module/libMonitorServer b/Build/Linux/Linux_Bin/Module/libMonitorServer new file mode 100755 index 000000000..c565a3f69 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libMonitorServer differ diff --git a/Build/Linux/Linux_Bin/Module/libMutiProcess_Queue b/Build/Linux/Linux_Bin/Module/libMutiProcess_Queue new file mode 100755 index 000000000..a3c1ec9e1 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libMutiProcess_Queue differ diff --git a/Build/Linux/Linux_Bin/Module/libMutiProcess_Watch b/Build/Linux/Linux_Bin/Module/libMutiProcess_Watch new file mode 100755 index 000000000..48f155422 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libMutiProcess_Watch differ diff --git a/Build/Linux/Linux_Bin/Module/libPlugA b/Build/Linux/Linux_Bin/Module/libPlugA new file mode 100755 index 000000000..326ed75de Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libPlugA differ diff --git a/Build/Linux/Linux_Bin/Module/libPlugB b/Build/Linux/Linux_Bin/Module/libPlugB new file mode 100755 index 000000000..6ee2b9f6f Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libPlugB differ diff --git a/Build/Linux/Linux_Bin/Module/libProxy b/Build/Linux/Linux_Bin/Module/libProxy new file mode 100755 index 000000000..2116e3c06 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libProxy differ diff --git a/Build/Linux/Linux_Bin/Module/libProxyServer b/Build/Linux/Linux_Bin/Module/libProxyServer new file mode 100755 index 000000000..d12a2d248 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libProxyServer differ diff --git a/Build/Linux/Linux_Bin/Module/libRealTimeMonitor b/Build/Linux/Linux_Bin/Module/libRealTimeMonitor new file mode 100755 index 000000000..48b0ab893 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libRealTimeMonitor differ diff --git a/Build/Linux/Linux_Bin/Module/libTTyTest b/Build/Linux/Linux_Bin/Module/libTTyTest new file mode 100755 index 000000000..a3e6aa2ed Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libTTyTest differ diff --git a/Build/Linux/Linux_Bin/Module/libTcpTest b/Build/Linux/Linux_Bin/Module/libTcpTest new file mode 100755 index 000000000..d34235fcb Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libTcpTest differ diff --git a/Build/Linux/Linux_Bin/Module/libTestTCPPost b/Build/Linux/Linux_Bin/Module/libTestTCPPost new file mode 100755 index 000000000..2d61d1fac Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libTestTCPPost differ diff --git a/Build/Linux/Linux_Bin/Module/libTestUDPPost b/Build/Linux/Linux_Bin/Module/libTestUDPPost new file mode 100755 index 000000000..a5342e259 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libTestUDPPost differ diff --git a/Build/Linux/Linux_Bin/Module/libTimerTest b/Build/Linux/Linux_Bin/Module/libTimerTest new file mode 100755 index 000000000..628965ee2 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libTimerTest differ diff --git a/Build/Linux/Linux_Bin/Module/libUDPTest b/Build/Linux/Linux_Bin/Module/libUDPTest new file mode 100755 index 000000000..b2ec5a89f Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libUDPTest differ diff --git a/Build/Linux/Linux_Bin/Module/libWebSocket b/Build/Linux/Linux_Bin/Module/libWebSocket new file mode 100755 index 000000000..6ca5f23c7 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libWebSocket differ diff --git a/Build/Linux/Linux_Bin/Module/libXMLParse b/Build/Linux/Linux_Bin/Module/libXMLParse new file mode 100755 index 000000000..29083f691 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libXMLParse differ diff --git a/Build/Linux/Linux_Bin/Module/libZooClient b/Build/Linux/Linux_Bin/Module/libZooClient new file mode 100755 index 000000000..980ab1b22 Binary files /dev/null and b/Build/Linux/Linux_Bin/Module/libZooClient differ diff --git a/Build/Linux/Linux_Bin/PSSLoginClient b/Build/Linux/Linux_Bin/PSSLoginClient new file mode 100755 index 000000000..348d5ee77 Binary files /dev/null and b/Build/Linux/Linux_Bin/PSSLoginClient differ diff --git a/Build/Linux/Linux_Bin/PSSPlugClient b/Build/Linux/Linux_Bin/PSSPlugClient new file mode 100755 index 000000000..4ab682c12 Binary files /dev/null and b/Build/Linux/Linux_Bin/PSSPlugClient differ diff --git a/Build/Linux/Linux_Bin/PSSProxyClient b/Build/Linux/Linux_Bin/PSSProxyClient new file mode 100755 index 000000000..a081fab9c Binary files /dev/null and b/Build/Linux/Linux_Bin/PSSProxyClient differ diff --git a/Build/Linux/Linux_Bin/PSS_ClientManager b/Build/Linux/Linux_Bin/PSS_ClientManager new file mode 100755 index 000000000..0b05df072 Binary files /dev/null and b/Build/Linux/Linux_Bin/PSS_ClientManager differ diff --git a/Build/Linux/Linux_Bin/PassTCP b/Build/Linux/Linux_Bin/PassTCP new file mode 100755 index 000000000..8214c24d7 Binary files /dev/null and b/Build/Linux/Linux_Bin/PassTCP differ diff --git a/Build/Linux/Linux_Bin/PssFtpClient b/Build/Linux/Linux_Bin/PssFtpClient new file mode 100755 index 000000000..59517bcba Binary files /dev/null and b/Build/Linux/Linux_Bin/PssFtpClient differ diff --git a/Build/Linux/Linux_Bin/PurenessScopeServer b/Build/Linux/Linux_Bin/PurenessScopeServer new file mode 100755 index 000000000..7a18d594a Binary files /dev/null and b/Build/Linux/Linux_Bin/PurenessScopeServer differ diff --git a/Build/Linux/Linux_Bin/Test b/Build/Linux/Linux_Bin/Test new file mode 100755 index 000000000..c9d206188 Binary files /dev/null and b/Build/Linux/Linux_Bin/Test differ diff --git a/Build/Linux/Linux_Bin/XML2CPP b/Build/Linux/Linux_Bin/XML2CPP new file mode 100755 index 000000000..46a568865 Binary files /dev/null and b/Build/Linux/Linux_Bin/XML2CPP differ diff --git a/Build/Linux/Linux_Bin/alert.xml b/Build/Linux/Linux_Bin/alert.xml new file mode 100644 index 000000000..3fd8438d1 --- /dev/null +++ b/Build/Linux/Linux_Bin/alert.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/forbiddenIP.xml b/Build/Linux/Linux_Bin/forbiddenIP.xml new file mode 100644 index 000000000..cc74ee7d4 --- /dev/null +++ b/Build/Linux/Linux_Bin/forbiddenIP.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/killp b/Build/Linux/Linux_Bin/killp new file mode 100644 index 000000000..e8bbe3c11 --- /dev/null +++ b/Build/Linux/Linux_Bin/killp @@ -0,0 +1,9 @@ +#!/bin/sh +. ${HOME}/.bash_profile + +ps -ef|grep $LOGNAME | grep -w $1 |grep -v pts| grep -v killp|awk '{print $2}'|while read tt +do +echo "killed $tt" +kill $tt +done +#ps -ef|grep $LOGNAME|grep $1|grep -v grep|awk '{print $2}'|xargs kill -9 diff --git a/Build/Linux/Linux_Bin/logger.xml b/Build/Linux/Linux_Bin/logger.xml new file mode 100644 index 000000000..24c5a1bf7 --- /dev/null +++ b/Build/Linux/Linux_Bin/logger.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/main.xml b/Build/Linux/Linux_Bin/main.xml new file mode 100644 index 000000000..ac5d87a4e --- /dev/null +++ b/Build/Linux/Linux_Bin/main.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/Linux/Linux_Bin/reports/cppunit/report.xml b/Build/Linux/Linux_Bin/reports/cppunit/report.xml new file mode 100644 index 000000000..e69de29bb diff --git a/Build/Linux/Linux_Bin/runpss.sh b/Build/Linux/Linux_Bin/runpss.sh new file mode 100644 index 000000000..3a507577f --- /dev/null +++ b/Build/Linux/Linux_Bin/runpss.sh @@ -0,0 +1,5 @@ +#!/bin/sh +. ${HOME}/.bash_profile + +./killp PurenessScopeServer +nohup ./PurenessScopeServer > nohup.out 2>&1 & diff --git a/Build/Linux/Linux_Bin/small.ico b/Build/Linux/Linux_Bin/small.ico new file mode 100644 index 000000000..b3ec03bd6 Binary files /dev/null and b/Build/Linux/Linux_Bin/small.ico differ diff --git a/Build/Linux/Linux_Bin/valgrind-deadlock.run b/Build/Linux/Linux_Bin/valgrind-deadlock.run new file mode 100644 index 000000000..863516505 --- /dev/null +++ b/Build/Linux/Linux_Bin/valgrind-deadlock.run @@ -0,0 +1 @@ +valgrind --tool=helgrind --log-file=deadlock.log --error-limit=no ./PurenessScopeServer diff --git a/Build/Linux/Linux_Bin/valgrind-efc.run b/Build/Linux/Linux_Bin/valgrind-efc.run new file mode 100644 index 000000000..481213f0b --- /dev/null +++ b/Build/Linux/Linux_Bin/valgrind-efc.run @@ -0,0 +1 @@ +valgrind --tool=callgrind --separate-threads=yes --log-file=RunLog.log ./PurenessScopeServer \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/valgrind-mem.run b/Build/Linux/Linux_Bin/valgrind-mem.run new file mode 100644 index 000000000..ef9b3e78e --- /dev/null +++ b/Build/Linux/Linux_Bin/valgrind-mem.run @@ -0,0 +1 @@ +valgrind --tool=memcheck --leak-check=full --show-reachable=yes --log-file=EfcLog.log ./PurenessScopeServer \ No newline at end of file diff --git a/Build/Linux/Linux_Bin/valgrind.run b/Build/Linux/Linux_Bin/valgrind.run new file mode 100644 index 000000000..de6bea4ea --- /dev/null +++ b/Build/Linux/Linux_Bin/valgrind.run @@ -0,0 +1 @@ +valgrind --tool=memcheck --leak-check=full --show-reachable=yes --log-file=RunLog.log ./PurenessScopeServer \ No newline at end of file diff --git a/Build/Linux/Makefile b/Build/Linux/Makefile new file mode 100644 index 000000000..dd700e1dc --- /dev/null +++ b/Build/Linux/Makefile @@ -0,0 +1,8 @@ +.PHONY: clean All + +All: + @echo "----------正在构建项目:[ PssFtpClient - Release ]----------" + @cd "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSFtpClient" && "$(MAKE)" -f "PssFtpClient.mk" +clean: + @echo "----------正在清理项目:[ PssFtpClient - Release ]----------" + @cd "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSFtpClient" && "$(MAKE)" -f "PssFtpClient.mk" clean diff --git a/Build/Linux/PSS_2017.workspace b/Build/Linux/PSS_2017.workspace new file mode 100644 index 000000000..ca862c0b4 --- /dev/null +++ b/Build/Linux/PSS_2017.workspace @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/Linux/PluginMaker.workspace b/Build/Linux/PluginMaker.workspace new file mode 100644 index 000000000..ac68595bc --- /dev/null +++ b/Build/Linux/PluginMaker.workspace @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/Build/Linux/PssSampleClient.workspace b/Build/Linux/PssSampleClient.workspace new file mode 100644 index 000000000..58581a3d6 --- /dev/null +++ b/Build/Linux/PssSampleClient.workspace @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/Linux/TestNetworkTool.workspace b/Build/Linux/TestNetworkTool.workspace new file mode 100644 index 000000000..066c64a6b --- /dev/null +++ b/Build/Linux/TestNetworkTool.workspace @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Build/Linux/example-Module.workspace b/Build/Linux/example-Module.workspace new file mode 100644 index 000000000..b7e8d4002 --- /dev/null +++ b/Build/Linux/example-Module.workspace @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/Linux/make.sh b/Build/Linux/make.sh new file mode 100755 index 000000000..6423f20d1 --- /dev/null +++ b/Build/Linux/make.sh @@ -0,0 +1,132 @@ +cd ../../CppUnitTest/ +make -f Makefile + +cd ../PluginMaker/XML2CPP/ +make -f Makefile + + + +cd ../../TestNetworkTool/ +make -f Makefile_PSS_ClientManager +make -f Makefile_PassTCP + + + +cd ../purenessscopeserver/FrameCore/ +make -f Makefile + +cd ../PacketParse_Interface_Monitor/ +make -f Makefile + +cd ../PacketParse_Interface_WebSocket/ +make -f Makefile + +cd ../PacketParse_Interface/ +make -f Makefile + +cd ../PacketParse_Interface_Http/ +make -f Makefile + + + + +cd ../example-Module/LGLogic/ +make -f Makefile + +cd ../TTyTest/ +make -f Makefile + +cd ../WebSocket/ +make -f Makefile + +cd ../PlugAtoB/ +make -f Makefile_PlugB + +cd ../PlugAtoB/ +make -f Makefile_PlugA + +cd ../TestTCPPost/ +make -f Makefile + +cd ../Http/ +make -f Makefile + +cd ../MutiProcess/ +make -f Makefile_MutiProcess_Watch + +cd ../MutiProcess/ +make -f Makefile_MutiProcess_Queue + +cd ../LuaTest/ +make -f Makefile + +cd ../TimerTest/ +make -f Makefile + +cd ../TestUDPPost/ +make -f Makefile + +cd ../ZooClient/ +make -f Makefile + +cd ../LsPlugIn/ +make -f Makefile + +cd ../KafkaClient/ +make -f Makefile + +cd ../TcpTest/ +make -f Makefile + +cd ../MonitorServer/ +make -f Makefile + +cd ../RealTimeMonitor/ +make -f Makefile + +cd ../Proxy/ +make -f Makefile_ProxyServer + +cd ../Proxy/ +make -f Makefile + +cd ../FtpTest/ +make -f Makefile + +cd ../XMLParse/ +make -f Makefile + +cd ../AutoTest/ +make -f Makefile + +cd ../UDPTest/ +make -f Makefile + +cd ../LoginBuffer/ +make -f Makefile_Watch + +cd ../LoginBuffer/ +make -f Makefile_Login + + +cd ../../../PssSampleClient/CommonTCPClient/ +make -f Makefile + +cd ../PSSProxyClient/ +make -f Makefile + +cd ../PSSLoginClient/ +make -f Makefile + +cd ../PSSPlugClient/ +make -f Makefile + +cd ../AutoTestClient/ +make -f Makefile + +cd ../PSSFtpClient/ +make -f Makefile + +cd ../../Build/Linux/ + + diff --git a/Build/Linux/makefile.mpc b/Build/Linux/makefile.mpc new file mode 100644 index 000000000..9f851f216 --- /dev/null +++ b/Build/Linux/makefile.mpc @@ -0,0 +1,51 @@ +project(PurenessScopeServer):aceexe{ + exename = PurenessScopeServer + + Source_Files{ + ../../purenessscopeserver/Common/*.cpp + ../../purenessscopeserver/FrameCore/Common/*.cpp + ../../purenessscopeserver/FrameCore/Console/*.cpp + ../../purenessscopeserver/FrameCore/LogSystem/*.cpp + ../../purenessscopeserver/FrameCore/Message/*.cpp + ../../purenessscopeserver/FrameCore/PacketParse/*.cpp + ../../purenessscopeserver/FrameCore/Reactor/*.cpp + ../../purenessscopeserver/FrameCore/UDP/*.cpp + ../../purenessscopeserver/FrameCore/TinyXML/*.cpp + ../../purenessscopeserver/FrameCore/Mail/*.cpp + ../../purenessscopeserver/FrameCore/FileTest/*.cpp + ../../purenessscopeserver/FrameCore/*.cpp + } + includes += ../../purenessscopeserver/Common \ + ../../purenessscopeserver/FrameCore/Common \ + ../../purenessscopeserver/FrameCore/Console \ + ../../purenessscopeserver/FrameCore/LogSystem \ + ../../purenessscopeserver/FrameCore/Message \ + ../../purenessscopeserver/FrameCore/PacketParse \ + ../../purenessscopeserver/FrameCore/Reactor \ + ../../purenessscopeserver/FrameCore/UDP \ + ../../purenessscopeserver/FrameCore/TinyXML \ + ../../purenessscopeserver/FrameCore/Mail \ + ../../purenessscopeserver/FrameCore/FileTest + + includes += /usr/local/include/ + includes += /usr/include/ + libpaths += /usr/lib64/ + libpaths += /usr/lib/x86_64-linux-gnu/ + + specific(make) { + compile_flags += -fcheck-new + } + + verbatim(gnuace, local) { + ifneq (, $(shell which curl)) + CPPFLAGS += -D__THREE_LIBRARY_CURL__ + LDLIBS += -lcurl + endif + } + + specific(gnuace) { + compile_flags += -Wno-deprecated -std=c++11 + } + + +} diff --git a/Build/Linux/makegcov.mpc b/Build/Linux/makegcov.mpc new file mode 100644 index 000000000..3de42886b --- /dev/null +++ b/Build/Linux/makegcov.mpc @@ -0,0 +1,57 @@ +project(PurenessScopeServer):aceexe{ + exename = PurenessScopeServer + + Source_Files{ + ../../purenessscopeserver/Common/*.cpp + ../../purenessscopeserver/FrameCore/Common/*.cpp + ../../purenessscopeserver/FrameCore/Console/*.cpp + ../../purenessscopeserver/FrameCore/LogSystem/*.cpp + ../../purenessscopeserver/FrameCore/Message/*.cpp + ../../purenessscopeserver/FrameCore/PacketParse/*.cpp + ../../purenessscopeserver/FrameCore/Encrypt/*.cpp + ../../purenessscopeserver/FrameCore/Reactor/*.cpp + ../../purenessscopeserver/FrameCore/UDP/*.cpp + ../../purenessscopeserver/FrameCore/TinyXML/*.cpp + ../../purenessscopeserver/FrameCore/Mail/*.cpp + ../../purenessscopeserver/FrameCore/FileTest/*.cpp + ../../purenessscopeserver/FrameCore/CppUnit/*.cpp + ../../purenessscopeserver/FrameCore/*.cpp + } + includes += ../../include + includes += ../../purenessscopeserver/Common \ + ../../purenessscopeserver/FrameCore/Common \ + ../../purenessscopeserver/FrameCore/Console \ + ../../purenessscopeserver/FrameCore/LogSystem \ + ../../purenessscopeserver/FrameCore/Message \ + ../../purenessscopeserver/FrameCore/PacketParse \ + ../../purenessscopeserver/FrameCore/Encrypt \ + ../../purenessscopeserver/FrameCore/Reactor \ + ../../purenessscopeserver/FrameCore/UDP \ + ../../purenessscopeserver/FrameCore/TinyXML \ + ../../purenessscopeserver/FrameCore/Mail \ + ../../purenessscopeserver/FrameCore/FileTest \ + ../../purenessscopeserver/FrameCore/CppUnit + + libpaths += ../../lib + libs += cppunit + + includes += /usr/local/include/ + includes += /usr/include/ + libpaths += /usr/lib64/ + libpaths += /usr/lib/x86_64-linux-gnu/ + + macros += _CPPUNIT_TEST + + verbatim(gnuace, local) { + ifneq (, $(shell which curl)) + CPPFLAGS += -D__THREE_LIBRARY_CURL__ + LDLIBS += -lcurl + endif + } + + specific(gnuace) { + compile_flags += -fprofile-arcs -ftest-coverage -std=c++11 + } + + +} \ No newline at end of file diff --git a/Build/Linux/pss.mwc b/Build/Linux/pss.mwc new file mode 100644 index 000000000..331c75744 --- /dev/null +++ b/Build/Linux/pss.mwc @@ -0,0 +1,4 @@ +workspace(PSS) { + makefile.mpc + cmdline += -include $PWD +} \ No newline at end of file diff --git a/Build/Linux/psssonar.mwc b/Build/Linux/psssonar.mwc new file mode 100644 index 000000000..c5b9ce131 --- /dev/null +++ b/Build/Linux/psssonar.mwc @@ -0,0 +1,4 @@ +workspace(PSS) { + makegcov.mpc + cmdline += -include $PWD +} \ No newline at end of file diff --git a/Build/Linux/runlinuxmpc.sh b/Build/Linux/runlinuxmpc.sh new file mode 100644 index 000000000..093bf5e27 --- /dev/null +++ b/Build/Linux/runlinuxmpc.sh @@ -0,0 +1 @@ +mwc.pl -type gnuace pss.mwc \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/CppUnitTest.workspace b/Build/Prj_CodeBlocks/CppUnitTest.workspace new file mode 100644 index 000000000..d47396908 --- /dev/null +++ b/Build/Prj_CodeBlocks/CppUnitTest.workspace @@ -0,0 +1,6 @@ + + + + + + diff --git a/Build/Prj_CodeBlocks/CppUnitTest.workspace.layout b/Build/Prj_CodeBlocks/CppUnitTest.workspace.layout new file mode 100644 index 000000000..a17209048 --- /dev/null +++ b/Build/Prj_CodeBlocks/CppUnitTest.workspace.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/Build/Prj_CodeBlocks/Linux_Bin/AutoTestClient b/Build/Prj_CodeBlocks/Linux_Bin/AutoTestClient new file mode 100755 index 000000000..ce439f9b2 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/AutoTestClient differ diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/CheckServer.xml b/Build/Prj_CodeBlocks/Linux_Bin/CheckServer.xml similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/CheckServer.xml rename to Build/Prj_CodeBlocks/Linux_Bin/CheckServer.xml diff --git a/Build/Prj_CodeBlocks/Linux_Bin/CommonTCPClient b/Build/Prj_CodeBlocks/Linux_Bin/CommonTCPClient new file mode 100755 index 000000000..28bef2f21 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/CommonTCPClient differ diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/Config.xml b/Build/Prj_CodeBlocks/Linux_Bin/Config.xml similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/Config.xml rename to Build/Prj_CodeBlocks/Linux_Bin/Config.xml diff --git a/Build/Prj_CodeBlocks/Linux_Bin/ConsoleCommand.xml b/Build/Prj_CodeBlocks/Linux_Bin/ConsoleCommand.xml new file mode 100644 index 000000000..15f743198 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/ConsoleCommand.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/CppUnitTest.ini b/Build/Prj_CodeBlocks/Linux_Bin/CppUnitTest.ini new file mode 100644 index 000000000..933e647cf --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/CppUnitTest.ini @@ -0,0 +1,2 @@ +[Config] +CppUnitTest=aaa \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/FileTest/1.txt b/Build/Prj_CodeBlocks/Linux_Bin/FileTest/1.txt new file mode 100644 index 000000000..3c8b0d689 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/FileTest/1.txt @@ -0,0 +1 @@ +01 00 00 10 08 00 00 00 46 45 45 45 45 59 45 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 be cd aa 8f 3c 01 00 00 \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/FileTestCfg.xml b/Build/Prj_CodeBlocks/Linux_Bin/FileTestCfg.xml new file mode 100644 index 000000000..bf038231c --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/FileTestCfg.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/FileWatch.xml b/Build/Prj_CodeBlocks/Linux_Bin/FileWatch.xml new file mode 100644 index 000000000..edf4e55f6 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/FileWatch.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/LoginBufferFile/UserLogin.txt b/Build/Prj_CodeBlocks/Linux_Bin/LoginBufferFile/UserLogin.txt new file mode 100644 index 000000000..e69de29bb diff --git a/Build/Prj_CodeBlocks/Linux_Bin/LoginBufferFile/UserValid.txt b/Build/Prj_CodeBlocks/Linux_Bin/LoginBufferFile/UserValid.txt new file mode 100644 index 000000000..e54c28003 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/LoginBufferFile/UserValid.txt @@ -0,0 +1 @@ +freeeyes,123456; horse,111111; rabbit,222222; freeeyes1,123456; freeeyes2,123456; freeeyes3,123456; freeeyes4,123456; freeeyes5,123456; freeeyes6,123456; freeeyes7,123456; freeeyes8,123456; freeeyes9,123456; freeeyes10,123456; freeeyes11,123456; freeeyes12,123456; freeeyes13,123456; freeeyes14,123456; freeeyes15,123456; freeeyes16,123456; freeeyes17,123456; freeeyes18,123456; freeeyes19,123456; freeeyes20,123456; freeeyes21,123456; freeeyes22,123456; freeeyes23,123456; freeeyes24,123456; freeeyes25,123456; freeeyes26,123456; freeeyes27,123456; freeeyes28,123456; \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/LuaScript/LuaTest.lua b/Build/Prj_CodeBlocks/Linux_Bin/LuaScript/LuaTest.lua new file mode 100644 index 000000000..559d4cfae --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/LuaScript/LuaTest.lua @@ -0,0 +1,36 @@ +--һ׼Lua PassTcpű +--ṩ¼ķװͽյ¼ķװ +--֯ķݺ֤ +--ӿƣҪǿǵ̲߳ٲҪ߳ +--ݿ鲻Ҫڽű㲻ͷ +--Ŀǰ֧100KݿС +--add by freeeyes + +--Ҫݵ¼PassTCPãʵķݷ +--ڲnThreadIDǵǰ߳IDszDataϢ(char* )nLenǻ󳤶ȣnSendIndexǵǰӵķʹ +function LuaTest_SendData(szData, nLen, nThreadID, nSendIndex) + -- + --szDataΪchar* ҪĻ顣 + --nLenǵǰ󳤶 + --nNextIndex-1˵ֵ,򷵻һεʼλ + + --4ֽڰͷ + nPacketSize = 10 + nStartIndex = 0 + nNextIndex = 0 + nNextIndex = Lua_Tcp_Buffer_In_Int32(szData, nPacketSize, nStartIndex, nLen) + + --2ֽڵ + --nCommandID = 4096 + --nNextIndex = Lua_Tcp_Buffer_In_Int16(szData, nCommandID, nNextIndex, nLen) + + --ݿ + szBuff = '12345678' + nNextIndex = Lua_Tcp_Buffer_In_Block(szData, szBuff, 8, nNextIndex, nLen) + + --뷵ݿijȣPassTCP֪ܳ + return nNextIndex +end + + + diff --git a/Build/Prj_CodeBlocks/Linux_Bin/LuaScript/RoomLogic.lua b/Build/Prj_CodeBlocks/Linux_Bin/LuaScript/RoomLogic.lua new file mode 100644 index 000000000..4f98d6531 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/LuaScript/RoomLogic.lua @@ -0,0 +1,187 @@ +--ڷе߼ +--add by freeeyes + +ROOM_PLAYER_SIZE = 5 --Ҳμӵ +ROOM_PLAYER_VISITOR_SIZE = 5 --۲ҵ + +ROOM_ERROR_NULL = 0 --ȷķֵ + +--ҽ뷿䣬nRoomIDIDnPlayerIDID +function EnterRoom(nRoomID, nPlayerID) + --λʾ + if LuaFn_Room_API_GetPlayerCount(nRoomID) > ROOM_PLAYER_SIZE then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Room Player is full.") + return -1 + end + + --ڲιʾ + if LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) > ROOM_PLAYER_SIZE then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Room Player is full.") + return -1 + end + + --뷿 + nRet = LuaFn_Room_API_EnterRoom(nRoomID, nPlayerID, "freeeyes", 1000) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom success.") + + --ⲿΪԴ룬ݸ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + return 0 + end +end + +--£nRoomIDIDnPlayerIDID, nLocationλ +function SitRoom(nRoomID, nPlayerID, nLocation) + -- + nRet = LuaFn_Room_API_PlayerSit(nRoomID, nPlayerID, nLocation) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom success.") + + --жϷǷڶʱ + if LuaFn_RoomTimer_API_Check(nRoomID) == false then + --ûжʱչһʱ + nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + if nCount > 1 then + --жϵǰʱǷڷʱ5 + if LuaFn_Room_API_CheckRoomUpdateTime(nRoomID, 5) == true then + --һĶʱ + nRet = LuaFn_RoomTimer_API_Add(2, nRoomID, nPlayerID, 1001) + if nRet <= 0 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer fail.[nRet="..nRet.."]") + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer success.[nsecond=5]") + end + else + --һĶʱ + nRet = LuaFn_RoomTimer_API_Add(5, nRoomID, nPlayerID, 1001) + if nRet <= 0 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer fail.[nRet="..nRet.."]") + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer success.[nsecond=2]") + end + end + end + end + end + return 0 +end + +--뿪nRoomIDIDnPlayerIDID +function ExitRoom(nRoomID, nPlayerID) + --Դ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + + --һû + --nPlayerID1 = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + --nPlayerID2 = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [nPlayerID1="..nPlayerID1.."][nPlayerID2="..nPlayerID2.."]") + + nRet = LuaFn_Room_API_Exit(nRoomID, nPlayerID) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom success.") + + --Դ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + return 0 + end +end + +--߳ҹnRoomIDIDnPlayerIDIDnOperationIDcID +function OutRoom(nRoomID, nPlayerID, nOperationID) + +end + +--ұ任䣬nSrcRoomIDԭʼIDnDstRoomIDĿ귿IDnPlayerIDID +function ChangeRoom(nSrcRoomID, nDstRoomID, nPlayerID) + +end + +--¼ʱµánEventID¼IDnPlayerIDIDûҴ-1 +function Update(nRoomID, nPlayerID, nEventID, nData) + --ע + if nEventID == 3001 then + nRet = LuaFn_Room_API_SetPlayerBet(nRoomID, nPlayerID, nData) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update SetPlayerBet.[nRet="..nRet.."]") + return 0 + else + --ƶһ + nNextPlayer = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + if nNextPlayer > 0 then + --㵱ǰִDzһ + if LuaFn_Room_GameInfo_API_GetRoundCount(nRoomID) >= 4 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update LuaFn_Room_GameInfo_API_GetRoundCount.[RoundCount=4]") + --ƾֽ + else + + --һװ϶ʱ + LuaFn_PlayerTimer_API_Add(5, nRoomID, nNextPlayer, 2001) + end + else + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update GetRoomNextPlayerID.[nRet="..nRet.."]") + end + end + end + + return 0 +end + +--䣬ȫ˳ +function ClearRoom() + +end + +--ʼ +function InitRoom() + +end + +--PlayerϵĶʱ +function PlayerTimer(nRoomID, nPlayerID, nEventID) + if nEventID == 2001 then + --ûע + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] PlayerTimer Begin") + + --ﴦƶĹ + end +end + +--Ķʱ +function RoomTimer(nRoomID, nPlayerID, nEventID) + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] RoomTimer Begin") + if nEventID == 1001 then + --1001¼ôǵʱ¼(C++˷ƣ´äעСäעԼǷ״̬) + nRet = LuaFn_Room_API_DealCode(nRoomID, 1000, -1, -1) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] RoomTimer Begin DealCode.[nRet="..nRet.."]") + return 0 + else + nCurrPlayerID = LuaFn_Room_API_GetRoomCurrPlayerID(nRoomID) + + --ÿʼIDԴΪִμݣGetRoomNextPlayerIDңִμ+1 + LuaFn_Room_API_SetBenginePlayerID(nCurrPlayerID) + + --һƵӶʱ + LuaFn_PlayerTimer_API_Add(5, nRoomID, nPlayerID, 2001) + end + end +end + diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/ProxyServer b/Build/Prj_CodeBlocks/Linux_Bin/Module/ProxyServer new file mode 100755 index 000000000..9a4b1a9dd Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/ProxyServer differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/Watch b/Build/Prj_CodeBlocks/Linux_Bin/Module/Watch new file mode 100755 index 000000000..1f1d24a0b Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/Watch differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libAutoTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libAutoTest.so new file mode 100755 index 000000000..7269eae97 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libAutoTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libFtpTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libFtpTest.so new file mode 100755 index 000000000..ab1801f70 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libFtpTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libHttpTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libHttpTest.so new file mode 100755 index 000000000..43f0a118d Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libHttpTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libKafkaClient.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libKafkaClient.so new file mode 100755 index 000000000..03ed6d510 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libKafkaClient.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libLGLogic.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLGLogic.so new file mode 100755 index 000000000..a8df86fda Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLGLogic.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libLSLogic.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLSLogic.so new file mode 100755 index 000000000..71b43c5d8 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLSLogic.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libLinuxQueue.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLinuxQueue.so new file mode 100755 index 000000000..8df5ceab1 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLinuxQueue.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libLogin.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLogin.so new file mode 100755 index 000000000..71b1c0c95 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLogin.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libLuaTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLuaTest.so new file mode 100755 index 000000000..022aed0a0 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libLuaTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libMonitorServer.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libMonitorServer.so new file mode 100755 index 000000000..652d565e9 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libMonitorServer.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libPlugA.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libPlugA.so new file mode 100755 index 000000000..29163741d Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libPlugA.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libPlugB.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libPlugB.so new file mode 100755 index 000000000..2f1cf8d04 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libPlugB.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libProxyTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libProxyTest.so new file mode 100755 index 000000000..90d530c42 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libProxyTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libRealTimeMonitor.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libRealTimeMonitor.so new file mode 100755 index 000000000..40c5ba72c Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libRealTimeMonitor.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libTTyTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libTTyTest.so new file mode 100755 index 000000000..5f2c2d950 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libTTyTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libTcpTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libTcpTest.so new file mode 100755 index 000000000..1ceb3af54 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libTcpTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libTcpTestPost.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libTcpTestPost.so new file mode 100755 index 000000000..36fb2a438 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libTcpTestPost.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libTimerTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libTimerTest.so new file mode 100755 index 000000000..773d2a446 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libTimerTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libUDPTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libUDPTest.so new file mode 100755 index 000000000..b329f76d5 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libUDPTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libUDPTestPost.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libUDPTestPost.so new file mode 100755 index 000000000..3ef3453ea Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libUDPTestPost.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libWebSocketTest.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libWebSocketTest.so new file mode 100755 index 000000000..13d28e79d Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libWebSocketTest.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libXMLParse.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libXMLParse.so new file mode 100755 index 000000000..447582c58 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libXMLParse.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Module/libZooClient.so b/Build/Prj_CodeBlocks/Linux_Bin/Module/libZooClient.so new file mode 100755 index 000000000..9c818e186 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Module/libZooClient.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/PSSClientManager b/Build/Prj_CodeBlocks/Linux_Bin/PSSClientManager new file mode 100755 index 000000000..7229a7035 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/PSSClientManager differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/PSSLoginClient b/Build/Prj_CodeBlocks/Linux_Bin/PSSLoginClient new file mode 100755 index 000000000..fa02fd234 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/PSSLoginClient differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/PSSPlugClient b/Build/Prj_CodeBlocks/Linux_Bin/PSSPlugClient new file mode 100755 index 000000000..b63c3e113 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/PSSPlugClient differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/PSSProxyClient b/Build/Prj_CodeBlocks/Linux_Bin/PSSProxyClient new file mode 100755 index 000000000..9f867c051 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/PSSProxyClient differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/PassTCP b/Build/Prj_CodeBlocks/Linux_Bin/PassTCP new file mode 100755 index 000000000..11f661182 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/PassTCP differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/PssFtpClient b/Build/Prj_CodeBlocks/Linux_Bin/PssFtpClient new file mode 100755 index 000000000..5a24295bf Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/PssFtpClient differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/PurenessScopeServer_R b/Build/Prj_CodeBlocks/Linux_Bin/PurenessScopeServer_R new file mode 100755 index 000000000..5283a7e0c Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/PurenessScopeServer_R differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/Test b/Build/Prj_CodeBlocks/Linux_Bin/Test new file mode 100755 index 000000000..a876502a8 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/Test differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/XML2CPP b/Build/Prj_CodeBlocks/Linux_Bin/XML2CPP new file mode 100755 index 000000000..6c0f00fc7 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/XML2CPP differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/alert.xml b/Build/Prj_CodeBlocks/Linux_Bin/alert.xml new file mode 100644 index 000000000..3fd8438d1 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/alert.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/forbiddenIP.xml b/Build/Prj_CodeBlocks/Linux_Bin/forbiddenIP.xml new file mode 100644 index 000000000..cc74ee7d4 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/forbiddenIP.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/killp b/Build/Prj_CodeBlocks/Linux_Bin/killp new file mode 100644 index 000000000..e8bbe3c11 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/killp @@ -0,0 +1,9 @@ +#!/bin/sh +. ${HOME}/.bash_profile + +ps -ef|grep $LOGNAME | grep -w $1 |grep -v pts| grep -v killp|awk '{print $2}'|while read tt +do +echo "killed $tt" +kill $tt +done +#ps -ef|grep $LOGNAME|grep $1|grep -v grep|awk '{print $2}'|xargs kill -9 diff --git a/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface.so b/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface.so new file mode 100755 index 000000000..1255edf4a Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_Http.so b/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_Http.so new file mode 100755 index 000000000..51706f5e9 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_Http.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_Monitor.so b/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_Monitor.so new file mode 100755 index 000000000..e31698285 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_Monitor.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_WebSocket.so b/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_WebSocket.so new file mode 100755 index 000000000..e46cb3acf Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/libPacketParse_Interface_WebSocket.so differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/logger.xml b/Build/Prj_CodeBlocks/Linux_Bin/logger.xml new file mode 100644 index 000000000..24c5a1bf7 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/logger.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/main.xml b/Build/Prj_CodeBlocks/Linux_Bin/main.xml new file mode 100644 index 000000000..ac5d87a4e --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/main.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/Prj_CodeBlocks/Linux_Bin/reports/cppunit/report.xml b/Build/Prj_CodeBlocks/Linux_Bin/reports/cppunit/report.xml new file mode 100644 index 000000000..e69de29bb diff --git a/Build/Prj_CodeBlocks/Linux_Bin/runpss.sh b/Build/Prj_CodeBlocks/Linux_Bin/runpss.sh new file mode 100644 index 000000000..3a507577f --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/runpss.sh @@ -0,0 +1,5 @@ +#!/bin/sh +. ${HOME}/.bash_profile + +./killp PurenessScopeServer +nohup ./PurenessScopeServer > nohup.out 2>&1 & diff --git a/Build/Prj_CodeBlocks/Linux_Bin/small.ico b/Build/Prj_CodeBlocks/Linux_Bin/small.ico new file mode 100644 index 000000000..b3ec03bd6 Binary files /dev/null and b/Build/Prj_CodeBlocks/Linux_Bin/small.ico differ diff --git a/Build/Prj_CodeBlocks/Linux_Bin/valgrind-deadlock.run b/Build/Prj_CodeBlocks/Linux_Bin/valgrind-deadlock.run new file mode 100644 index 000000000..863516505 --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/valgrind-deadlock.run @@ -0,0 +1 @@ +valgrind --tool=helgrind --log-file=deadlock.log --error-limit=no ./PurenessScopeServer diff --git a/Build/Prj_CodeBlocks/Linux_Bin/valgrind-efc.run b/Build/Prj_CodeBlocks/Linux_Bin/valgrind-efc.run new file mode 100644 index 000000000..481213f0b --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/valgrind-efc.run @@ -0,0 +1 @@ +valgrind --tool=callgrind --separate-threads=yes --log-file=RunLog.log ./PurenessScopeServer \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/valgrind-mem.run b/Build/Prj_CodeBlocks/Linux_Bin/valgrind-mem.run new file mode 100644 index 000000000..ef9b3e78e --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/valgrind-mem.run @@ -0,0 +1 @@ +valgrind --tool=memcheck --leak-check=full --show-reachable=yes --log-file=EfcLog.log ./PurenessScopeServer \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/Linux_Bin/valgrind.run b/Build/Prj_CodeBlocks/Linux_Bin/valgrind.run new file mode 100644 index 000000000..de6bea4ea --- /dev/null +++ b/Build/Prj_CodeBlocks/Linux_Bin/valgrind.run @@ -0,0 +1 @@ +valgrind --tool=memcheck --leak-check=full --show-reachable=yes --log-file=RunLog.log ./PurenessScopeServer \ No newline at end of file diff --git a/Build/Prj_CodeBlocks/PSS_2017.workspace b/Build/Prj_CodeBlocks/PSS_2017.workspace new file mode 100644 index 000000000..6ae41ac63 --- /dev/null +++ b/Build/Prj_CodeBlocks/PSS_2017.workspace @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Build/Prj_CodeBlocks/PSS_2017.workspace.layout b/Build/Prj_CodeBlocks/PSS_2017.workspace.layout new file mode 100644 index 000000000..fa3204539 --- /dev/null +++ b/Build/Prj_CodeBlocks/PSS_2017.workspace.layout @@ -0,0 +1,6 @@ + + + + + + diff --git a/Build/Prj_CodeBlocks/PluginMaker.workspace b/Build/Prj_CodeBlocks/PluginMaker.workspace new file mode 100644 index 000000000..b1a9ea3dd --- /dev/null +++ b/Build/Prj_CodeBlocks/PluginMaker.workspace @@ -0,0 +1,6 @@ + + + + + + diff --git a/Build/Prj_CodeBlocks/PluginMaker.workspace.layout b/Build/Prj_CodeBlocks/PluginMaker.workspace.layout new file mode 100644 index 000000000..2ad4d31df --- /dev/null +++ b/Build/Prj_CodeBlocks/PluginMaker.workspace.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/Build/Prj_CodeBlocks/PssSampleClient.workspace b/Build/Prj_CodeBlocks/PssSampleClient.workspace new file mode 100644 index 000000000..8e0728718 --- /dev/null +++ b/Build/Prj_CodeBlocks/PssSampleClient.workspace @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Build/Prj_CodeBlocks/PssSampleClient.workspace.layout b/Build/Prj_CodeBlocks/PssSampleClient.workspace.layout new file mode 100644 index 000000000..6bf1d01c1 --- /dev/null +++ b/Build/Prj_CodeBlocks/PssSampleClient.workspace.layout @@ -0,0 +1,6 @@ + + + + + + diff --git a/Build/Prj_CodeBlocks/TestNetworkTool.workspace b/Build/Prj_CodeBlocks/TestNetworkTool.workspace new file mode 100644 index 000000000..20260f2f4 --- /dev/null +++ b/Build/Prj_CodeBlocks/TestNetworkTool.workspace @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Build/Prj_CodeBlocks/TestNetworkTool.workspace.layout b/Build/Prj_CodeBlocks/TestNetworkTool.workspace.layout new file mode 100644 index 000000000..e5034658d --- /dev/null +++ b/Build/Prj_CodeBlocks/TestNetworkTool.workspace.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/Build/Prj_CodeBlocks/example-Module.workspace b/Build/Prj_CodeBlocks/example-Module.workspace new file mode 100644 index 000000000..f226fd577 --- /dev/null +++ b/Build/Prj_CodeBlocks/example-Module.workspace @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/Prj_CodeBlocks/example-Module.workspace.layout b/Build/Prj_CodeBlocks/example-Module.workspace.layout new file mode 100644 index 000000000..74b6ac04d --- /dev/null +++ b/Build/Prj_CodeBlocks/example-Module.workspace.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/Build/Windows/Windows_Bin/AutoTestClient.exe b/Build/Windows/Windows_Bin/AutoTestClient.exe new file mode 100644 index 000000000..88eac1de8 Binary files /dev/null and b/Build/Windows/Windows_Bin/AutoTestClient.exe differ diff --git a/Build/Windows/Windows_Bin/CheckServer.xml b/Build/Windows/Windows_Bin/CheckServer.xml new file mode 100644 index 000000000..0560c292f --- /dev/null +++ b/Build/Windows/Windows_Bin/CheckServer.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/CommonTCPClient.exe b/Build/Windows/Windows_Bin/CommonTCPClient.exe new file mode 100644 index 000000000..9f3e9403d Binary files /dev/null and b/Build/Windows/Windows_Bin/CommonTCPClient.exe differ diff --git a/Build/Windows/Windows_Bin/Config.xml b/Build/Windows/Windows_Bin/Config.xml new file mode 100644 index 000000000..37e2b7e84 --- /dev/null +++ b/Build/Windows/Windows_Bin/Config.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/Build/Windows/Windows_Bin/ConsoleCommand.xml b/Build/Windows/Windows_Bin/ConsoleCommand.xml new file mode 100644 index 000000000..15f743198 --- /dev/null +++ b/Build/Windows/Windows_Bin/ConsoleCommand.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/FileTest/1.txt b/Build/Windows/Windows_Bin/FileTest/1.txt new file mode 100644 index 000000000..3c8b0d689 --- /dev/null +++ b/Build/Windows/Windows_Bin/FileTest/1.txt @@ -0,0 +1 @@ +01 00 00 10 08 00 00 00 46 45 45 45 45 59 45 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 be cd aa 8f 3c 01 00 00 \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/FileTestCfg.xml b/Build/Windows/Windows_Bin/FileTestCfg.xml new file mode 100644 index 000000000..bf038231c --- /dev/null +++ b/Build/Windows/Windows_Bin/FileTestCfg.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/FileWatch.xml b/Build/Windows/Windows_Bin/FileWatch.xml new file mode 100644 index 000000000..edf4e55f6 --- /dev/null +++ b/Build/Windows/Windows_Bin/FileWatch.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/Icon.jpg b/Build/Windows/Windows_Bin/Icon.jpg new file mode 100644 index 000000000..b214c3bba Binary files /dev/null and b/Build/Windows/Windows_Bin/Icon.jpg differ diff --git a/Build/Windows/Windows_Bin/ListServer_LS.ini b/Build/Windows/Windows_Bin/ListServer_LS.ini new file mode 100644 index 000000000..80b9a0bce --- /dev/null +++ b/Build/Windows/Windows_Bin/ListServer_LS.ini @@ -0,0 +1,5 @@ +[List] +Count=1 +LGID0=1001 +LGIP0=127.0.0.1 +LGPort0=10002 \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/LoginBufferFile/UserLogin.txt b/Build/Windows/Windows_Bin/LoginBufferFile/UserLogin.txt new file mode 100644 index 000000000..d1a3de0ee --- /dev/null +++ b/Build/Windows/Windows_Bin/LoginBufferFile/UserLogin.txt @@ -0,0 +1,7 @@ +1001,1000,1000; +1002,1102,1102; +1003,1200,1200; +1004,1400,1400; +1005,1400,1400; +1006,1400,1400; +1007,1700,1700; diff --git a/Build/Windows/Windows_Bin/LoginBufferFile/UserValid.txt b/Build/Windows/Windows_Bin/LoginBufferFile/UserValid.txt new file mode 100644 index 000000000..16c3a4d90 --- /dev/null +++ b/Build/Windows/Windows_Bin/LoginBufferFile/UserValid.txt @@ -0,0 +1 @@ +freeeyes,123456; horse,111111; rabbit,222222; freeeyes1,123456; freeeyes2,123456; freeeyes3,123456; freeeyes4,123456; freeeyes5,123456; freeeyes6,123456; freeeyes7,123456; freeeyes8,123456; freeeyes9,123456; freeeyes10,123456; freeeyes11,123456; freeeyes12,123456; freeeyes13,123456; freeeyes14,123456; freeeyes15,123456; freeeyes16,123456; freeeyes17,123456; freeeyes18,123456; freeeyes19,123456; freeeyes20,123456; freeeyes21,123456; freeeyes22,123456; freeeyes23,123456; freeeyes24,123456; freeeyes25,123456; freeeyes26,123456; freeeyes27,123456; freeeyes28,123456; freeeyes29,123456; freeeyes30,123456; \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/LuaScript/LuaTest.lua b/Build/Windows/Windows_Bin/LuaScript/LuaTest.lua new file mode 100644 index 000000000..559d4cfae --- /dev/null +++ b/Build/Windows/Windows_Bin/LuaScript/LuaTest.lua @@ -0,0 +1,36 @@ +--һ׼Lua PassTcpű +--ṩ¼ķװͽյ¼ķװ +--֯ķݺ֤ +--ӿƣҪǿǵ̲߳ٲҪ߳ +--ݿ鲻Ҫڽű㲻ͷ +--Ŀǰ֧100KݿС +--add by freeeyes + +--Ҫݵ¼PassTCPãʵķݷ +--ڲnThreadIDǵǰ߳IDszDataϢ(char* )nLenǻ󳤶ȣnSendIndexǵǰӵķʹ +function LuaTest_SendData(szData, nLen, nThreadID, nSendIndex) + -- + --szDataΪchar* ҪĻ顣 + --nLenǵǰ󳤶 + --nNextIndex-1˵ֵ,򷵻һεʼλ + + --4ֽڰͷ + nPacketSize = 10 + nStartIndex = 0 + nNextIndex = 0 + nNextIndex = Lua_Tcp_Buffer_In_Int32(szData, nPacketSize, nStartIndex, nLen) + + --2ֽڵ + --nCommandID = 4096 + --nNextIndex = Lua_Tcp_Buffer_In_Int16(szData, nCommandID, nNextIndex, nLen) + + --ݿ + szBuff = '12345678' + nNextIndex = Lua_Tcp_Buffer_In_Block(szData, szBuff, 8, nNextIndex, nLen) + + --뷵ݿijȣPassTCP֪ܳ + return nNextIndex +end + + + diff --git a/Build/Windows/Windows_Bin/LuaScript/RoomLogic.lua b/Build/Windows/Windows_Bin/LuaScript/RoomLogic.lua new file mode 100644 index 000000000..4f98d6531 --- /dev/null +++ b/Build/Windows/Windows_Bin/LuaScript/RoomLogic.lua @@ -0,0 +1,187 @@ +--ڷе߼ +--add by freeeyes + +ROOM_PLAYER_SIZE = 5 --Ҳμӵ +ROOM_PLAYER_VISITOR_SIZE = 5 --۲ҵ + +ROOM_ERROR_NULL = 0 --ȷķֵ + +--ҽ뷿䣬nRoomIDIDnPlayerIDID +function EnterRoom(nRoomID, nPlayerID) + --λʾ + if LuaFn_Room_API_GetPlayerCount(nRoomID) > ROOM_PLAYER_SIZE then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Room Player is full.") + return -1 + end + + --ڲιʾ + if LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) > ROOM_PLAYER_SIZE then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Room Player is full.") + return -1 + end + + --뷿 + nRet = LuaFn_Room_API_EnterRoom(nRoomID, nPlayerID, "freeeyes", 1000) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom success.") + + --ⲿΪԴ룬ݸ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] EnterRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + return 0 + end +end + +--£nRoomIDIDnPlayerIDID, nLocationλ +function SitRoom(nRoomID, nPlayerID, nLocation) + -- + nRet = LuaFn_Room_API_PlayerSit(nRoomID, nPlayerID, nLocation) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom success.") + + --жϷǷڶʱ + if LuaFn_RoomTimer_API_Check(nRoomID) == false then + --ûжʱչһʱ + nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + if nCount > 1 then + --жϵǰʱǷڷʱ5 + if LuaFn_Room_API_CheckRoomUpdateTime(nRoomID, 5) == true then + --һĶʱ + nRet = LuaFn_RoomTimer_API_Add(2, nRoomID, nPlayerID, 1001) + if nRet <= 0 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer fail.[nRet="..nRet.."]") + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer success.[nsecond=5]") + end + else + --һĶʱ + nRet = LuaFn_RoomTimer_API_Add(5, nRoomID, nPlayerID, 1001) + if nRet <= 0 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer fail.[nRet="..nRet.."]") + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] SitRoom timer success.[nsecond=2]") + end + end + end + end + end + return 0 +end + +--뿪nRoomIDIDnPlayerIDID +function ExitRoom(nRoomID, nPlayerID) + --Դ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + + --һû + --nPlayerID1 = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + --nPlayerID2 = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [nPlayerID1="..nPlayerID1.."][nPlayerID2="..nPlayerID2.."]") + + nRet = LuaFn_Room_API_Exit(nRoomID, nPlayerID) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom fail.[nRet="..nRet.."]") + return -1 + else + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom success.") + + --Դ + --nCount = LuaFn_Room_API_GetPlayerCount(nRoomID) + --nVisitorCount = LuaFn_Room_API_GetVisitorPlayerCount(nRoomID) + --LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] ExitRoom [Count="..nCount.."][Visit Count="..nVisitorCount.."]") + return 0 + end +end + +--߳ҹnRoomIDIDnPlayerIDIDnOperationIDcID +function OutRoom(nRoomID, nPlayerID, nOperationID) + +end + +--ұ任䣬nSrcRoomIDԭʼIDnDstRoomIDĿ귿IDnPlayerIDID +function ChangeRoom(nSrcRoomID, nDstRoomID, nPlayerID) + +end + +--¼ʱµánEventID¼IDnPlayerIDIDûҴ-1 +function Update(nRoomID, nPlayerID, nEventID, nData) + --ע + if nEventID == 3001 then + nRet = LuaFn_Room_API_SetPlayerBet(nRoomID, nPlayerID, nData) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update SetPlayerBet.[nRet="..nRet.."]") + return 0 + else + --ƶһ + nNextPlayer = LuaFn_Room_API_GetRoomNextPlayerID(nRoomID) + if nNextPlayer > 0 then + --㵱ǰִDzһ + if LuaFn_Room_GameInfo_API_GetRoundCount(nRoomID) >= 4 then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update LuaFn_Room_GameInfo_API_GetRoundCount.[RoundCount=4]") + --ƾֽ + else + + --һװ϶ʱ + LuaFn_PlayerTimer_API_Add(5, nRoomID, nNextPlayer, 2001) + end + else + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] Update GetRoomNextPlayerID.[nRet="..nRet.."]") + end + end + end + + return 0 +end + +--䣬ȫ˳ +function ClearRoom() + +end + +--ʼ +function InitRoom() + +end + +--PlayerϵĶʱ +function PlayerTimer(nRoomID, nPlayerID, nEventID) + if nEventID == 2001 then + --ûע + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] PlayerTimer Begin") + + --ﴦƶĹ + end +end + +--Ķʱ +function RoomTimer(nRoomID, nPlayerID, nEventID) + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] RoomTimer Begin") + if nEventID == 1001 then + --1001¼ôǵʱ¼(C++˷ƣ´äעСäעԼǷ״̬) + nRet = LuaFn_Room_API_DealCode(nRoomID, 1000, -1, -1) + if nRet ~= ROOM_ERROR_NULL then + LuaFn_Print("RoomID["..nRoomID.."],nPlayerID["..nPlayerID.."] RoomTimer Begin DealCode.[nRet="..nRet.."]") + return 0 + else + nCurrPlayerID = LuaFn_Room_API_GetRoomCurrPlayerID(nRoomID) + + --ÿʼIDԴΪִμݣGetRoomNextPlayerIDңִμ+1 + LuaFn_Room_API_SetBenginePlayerID(nCurrPlayerID) + + --һƵӶʱ + LuaFn_PlayerTimer_API_Add(5, nRoomID, nPlayerID, 2001) + end + end +end + diff --git a/Build/Windows/Windows_Bin/Module/AutoTest.dll b/Build/Windows/Windows_Bin/Module/AutoTest.dll new file mode 100644 index 000000000..817c43216 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/AutoTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/FtpTest.dll b/Build/Windows/Windows_Bin/Module/FtpTest.dll new file mode 100644 index 000000000..5d0145a2f Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/FtpTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/HttpTest.dll b/Build/Windows/Windows_Bin/Module/HttpTest.dll new file mode 100644 index 000000000..5bf191efa Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/HttpTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/LGLogic.dll b/Build/Windows/Windows_Bin/Module/LGLogic.dll new file mode 100644 index 000000000..0ff837e68 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/LGLogic.dll differ diff --git a/Build/Windows/Windows_Bin/Module/LSLogic.dll b/Build/Windows/Windows_Bin/Module/LSLogic.dll new file mode 100644 index 000000000..25179473f Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/LSLogic.dll differ diff --git a/Build/Windows/Windows_Bin/Module/LinuxQueue.dll b/Build/Windows/Windows_Bin/Module/LinuxQueue.dll new file mode 100644 index 000000000..381982e6d Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/LinuxQueue.dll differ diff --git a/Build/Windows/Windows_Bin/Module/Login.dll b/Build/Windows/Windows_Bin/Module/Login.dll new file mode 100644 index 000000000..1c9ed6e44 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/Login.dll differ diff --git a/Build/Windows/Windows_Bin/Module/LuaTest.dll b/Build/Windows/Windows_Bin/Module/LuaTest.dll new file mode 100644 index 000000000..ff5cfd226 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/LuaTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/MonitorServer.dll b/Build/Windows/Windows_Bin/Module/MonitorServer.dll new file mode 100644 index 000000000..cf4ddc7e4 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/MonitorServer.dll differ diff --git a/Build/Windows/Windows_Bin/Module/PlugA.dll b/Build/Windows/Windows_Bin/Module/PlugA.dll new file mode 100644 index 000000000..89c545fb2 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/PlugA.dll differ diff --git a/Build/Windows/Windows_Bin/Module/PlugB.dll b/Build/Windows/Windows_Bin/Module/PlugB.dll new file mode 100644 index 000000000..cc698f8db Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/PlugB.dll differ diff --git a/Build/Windows/Windows_Bin/Module/ProxyServer.exe b/Build/Windows/Windows_Bin/Module/ProxyServer.exe new file mode 100644 index 000000000..533a24223 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/ProxyServer.exe differ diff --git a/Build/Windows/Windows_Bin/Module/ProxyTest.dll b/Build/Windows/Windows_Bin/Module/ProxyTest.dll new file mode 100644 index 000000000..7c63c1800 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/ProxyTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/RealTimeMonitor.dll b/Build/Windows/Windows_Bin/Module/RealTimeMonitor.dll new file mode 100644 index 000000000..a56bccb96 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/RealTimeMonitor.dll differ diff --git a/Build/Windows/Windows_Bin/Module/TTyTest.dll b/Build/Windows/Windows_Bin/Module/TTyTest.dll new file mode 100644 index 000000000..ca1f08cf3 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/TTyTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/TcpTest.dll b/Build/Windows/Windows_Bin/Module/TcpTest.dll new file mode 100644 index 000000000..231fb6d69 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/TcpTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/TcpTestPost.dll b/Build/Windows/Windows_Bin/Module/TcpTestPost.dll new file mode 100644 index 000000000..85ee01dfe Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/TcpTestPost.dll differ diff --git a/Build/Windows/Windows_Bin/Module/TimerTest.dll b/Build/Windows/Windows_Bin/Module/TimerTest.dll new file mode 100644 index 000000000..378da4bc3 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/TimerTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/UDPTest.dll b/Build/Windows/Windows_Bin/Module/UDPTest.dll new file mode 100644 index 000000000..2fb67b166 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/UDPTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/UDPTestPost.dll b/Build/Windows/Windows_Bin/Module/UDPTestPost.dll new file mode 100644 index 000000000..76c3c3956 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/UDPTestPost.dll differ diff --git a/Build/Windows/Windows_Bin/Module/Watch.exe b/Build/Windows/Windows_Bin/Module/Watch.exe new file mode 100644 index 000000000..8850be35d Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/Watch.exe differ diff --git a/Build/Windows/Windows_Bin/Module/WebSocketTest.dll b/Build/Windows/Windows_Bin/Module/WebSocketTest.dll new file mode 100644 index 000000000..d0b2ec6f7 Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/WebSocketTest.dll differ diff --git a/Build/Windows/Windows_Bin/Module/XMLParse.dll b/Build/Windows/Windows_Bin/Module/XMLParse.dll new file mode 100644 index 000000000..52936558d Binary files /dev/null and b/Build/Windows/Windows_Bin/Module/XMLParse.dll differ diff --git a/Build/Windows/Windows_Bin/PSSLoginClient.exe b/Build/Windows/Windows_Bin/PSSLoginClient.exe new file mode 100644 index 000000000..df89e362b Binary files /dev/null and b/Build/Windows/Windows_Bin/PSSLoginClient.exe differ diff --git a/Build/Windows/Windows_Bin/PSSPlugClient.exe b/Build/Windows/Windows_Bin/PSSPlugClient.exe new file mode 100644 index 000000000..f07295df9 Binary files /dev/null and b/Build/Windows/Windows_Bin/PSSPlugClient.exe differ diff --git a/Build/Windows/Windows_Bin/PSSProxyClient.exe b/Build/Windows/Windows_Bin/PSSProxyClient.exe new file mode 100644 index 000000000..2adce25a9 Binary files /dev/null and b/Build/Windows/Windows_Bin/PSSProxyClient.exe differ diff --git a/Build/Windows/Windows_Bin/PSS_ClientManager.exe b/Build/Windows/Windows_Bin/PSS_ClientManager.exe new file mode 100644 index 000000000..ca2592fa5 Binary files /dev/null and b/Build/Windows/Windows_Bin/PSS_ClientManager.exe differ diff --git a/Build/Windows/Windows_Bin/PSS_vc2017_R.exe b/Build/Windows/Windows_Bin/PSS_vc2017_R.exe new file mode 100644 index 000000000..8a88cc150 Binary files /dev/null and b/Build/Windows/Windows_Bin/PSS_vc2017_R.exe differ diff --git a/Build/Windows/Windows_Bin/PacketParse_Interface.dll b/Build/Windows/Windows_Bin/PacketParse_Interface.dll new file mode 100644 index 000000000..bda503d51 Binary files /dev/null and b/Build/Windows/Windows_Bin/PacketParse_Interface.dll differ diff --git a/Build/Windows/Windows_Bin/PacketParse_VS2017.dll b/Build/Windows/Windows_Bin/PacketParse_VS2017.dll new file mode 100644 index 000000000..7f0878cce Binary files /dev/null and b/Build/Windows/Windows_Bin/PacketParse_VS2017.dll differ diff --git a/Build/Windows/Windows_Bin/PacketParse_VS2017_Http.dll b/Build/Windows/Windows_Bin/PacketParse_VS2017_Http.dll new file mode 100644 index 000000000..2f962b031 Binary files /dev/null and b/Build/Windows/Windows_Bin/PacketParse_VS2017_Http.dll differ diff --git a/Build/Windows/Windows_Bin/PacketParse_VS2017_WebSocket.dll b/Build/Windows/Windows_Bin/PacketParse_VS2017_WebSocket.dll new file mode 100644 index 000000000..90ffab8f9 Binary files /dev/null and b/Build/Windows/Windows_Bin/PacketParse_VS2017_WebSocket.dll differ diff --git a/Build/Windows/Windows_Bin/PassTCP.exe b/Build/Windows/Windows_Bin/PassTCP.exe new file mode 100644 index 000000000..708bf318b Binary files /dev/null and b/Build/Windows/Windows_Bin/PassTCP.exe differ diff --git a/Build/Windows/Windows_Bin/PssFtpClient.exe b/Build/Windows/Windows_Bin/PssFtpClient.exe new file mode 100644 index 000000000..5d13247a0 Binary files /dev/null and b/Build/Windows/Windows_Bin/PssFtpClient.exe differ diff --git a/Build/Windows/Windows_Bin/Test.exe b/Build/Windows/Windows_Bin/Test.exe new file mode 100644 index 000000000..f15a5ec37 Binary files /dev/null and b/Build/Windows/Windows_Bin/Test.exe differ diff --git a/Build/Windows/Windows_Bin/XML2CPP.exe b/Build/Windows/Windows_Bin/XML2CPP.exe new file mode 100644 index 000000000..61cbccae1 Binary files /dev/null and b/Build/Windows/Windows_Bin/XML2CPP.exe differ diff --git a/Build/Windows/Windows_Bin/alert.xml b/Build/Windows/Windows_Bin/alert.xml new file mode 100644 index 000000000..3fd8438d1 --- /dev/null +++ b/Build/Windows/Windows_Bin/alert.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/forbiddenIP.xml b/Build/Windows/Windows_Bin/forbiddenIP.xml new file mode 100644 index 000000000..cc74ee7d4 --- /dev/null +++ b/Build/Windows/Windows_Bin/forbiddenIP.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/logger.xml b/Build/Windows/Windows_Bin/logger.xml new file mode 100644 index 000000000..0cb53b0d9 --- /dev/null +++ b/Build/Windows/Windows_Bin/logger.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/main.xml b/Build/Windows/Windows_Bin/main.xml new file mode 100644 index 000000000..3f06a036b --- /dev/null +++ b/Build/Windows/Windows_Bin/main.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/Windows/Windows_Bin/small.ico b/Build/Windows/Windows_Bin/small.ico new file mode 100644 index 000000000..b3ec03bd6 Binary files /dev/null and b/Build/Windows/Windows_Bin/small.ico differ diff --git a/Build_Windows.bat b/Build_Windows.bat new file mode 100644 index 000000000..96b5c2958 --- /dev/null +++ b/Build_Windows.bat @@ -0,0 +1,57 @@ +@echo off + +echo "Check Vs Path..." +REM echo %VS140COMNTOOLS% +set VSFind="false" +set VSPath=%VS140COMNTOOLS% +if defined VSPath ( + echo "Find VS2015" + set VSFind="true" +) else ( + echo "No Find VS2015, You must install vs2015" +) + +if %VSFind%=="true" ( +echo "Check Vs OK" +) +echo "Check ACE Path..." +REM echo %VS140COMNTOOLS% +set ACEFind="false" +set ACEPath=%ACE_ROOT% +if defined ACEPath ( + echo "Find ACE" + set VSFind="true" +) else ( + echo "No Find ACE, begin download ace..." + powershell -Command "Invoke-WebRequest http://download.dre.vanderbilt.edu/previous_versions/ACE-6.4.0.zip -OutFile ACE-src-6.4.0.zip" + echo "download ace ok" + echo "download ace expand zip begin..." + powershell -Command "Expand-Archive 'ACE-6.4.0.zip' '.\'" + echo "download ace expand zip end..." + echo "create ace config.h begin..." + powershell -Command "New-Item .\ACE_wrappers\ace\config.h -type file -force" + powershell -Command "'#define ACE_HAS_STANDARD_LIBRARY 1' >> '.\ACE_wrappers\ace\config.h'" + powershell -Command "'#define ACE_HAS_IPV6' >> '.\ACE_wrappers\ace\config.h'" + powershell -Command "'#include \"ace/config-win32.h\"' >> '.\ACE_wrappers\ace\config.h'" + echo "create ace config.h end..."\ + echo "compile ace begin..." + cmake -G "Visual Studio 15 Win64" .. + "%VSPath%..\IDE\Devenv" .\ACE_wrappers\ace\ace_vc14.sln /build "Debug|x64" /project .\ACE_wrappers\ace\ACE_vc14.vcxproj + echo "compile ace end..." + echo "set environment ACE_ROOT begin..." + set CurrPath=%cd%\ACE_wrappers\ + echo %CurrPath% + setx /M ACE_ROOT "%CurrPath%" + echo "set environment ACE_ROOT end..." + echo "set environment PATH begin..." + wmic ENVIRONMENT where "name='path' and username=''" set VariableValue="%path%;%ACE_ROOT%\bin" + echo "set environment PATH end..." +) + +if %VSFind%=="true" ( +echo "Check ACE OK" +) + + + + diff --git a/CppUnitTest/CMakeLists.txt b/CppUnitTest/CMakeLists.txt new file mode 100644 index 000000000..fdbc7811f --- /dev/null +++ b/CppUnitTest/CMakeLists.txt @@ -0,0 +1,95 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(Test) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_Test_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + . + ../ThirdLib/thirdparty + ../ThirdLib/include + +) + + +# Compiler options +add_definitions(-g -Wall) +add_definitions( + -D_LINUX_PLATFORM_ +) + + +# Linker options +set(LINK_OPTIONS -O0) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./Test/testcase.cpp + ${CMAKE_CURRENT_LIST_DIR}/./Test/test_linux.cpp + ${CMAKE_CURRENT_LIST_DIR}/../ThirdLib/thirdparty/sock_wrap.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -g -Wall") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(Test ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(Test ${LINK_OPTIONS}) + +target_link_libraries(Test + libpthread.so +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/CppUnitTest/Makefile b/CppUnitTest/Makefile new file mode 100644 index 000000000..34374cfde --- /dev/null +++ b/CppUnitTest/Makefile @@ -0,0 +1,126 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=Test +ConfigurationName :=Release +WorkspacePath :=../Build/Linux +ProjectPath :=../CppUnitTest +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="Test.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -O0 +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ThirdLib/thirdparty $(IncludeSwitch)../ThirdLib/include +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)pthread +ArLibs := "libpthread.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -g -Wall $(Preprocessors) +CFLAGS := $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Test_testcase.cpp$(ObjectSuffix) $(IntermediateDirectory)/Test_test_linux.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Test_testcase.cpp$(ObjectSuffix): ./Test/testcase.cpp $(IntermediateDirectory)/Test_testcase.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Test/testcase.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Test_testcase.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Test_testcase.cpp$(DependSuffix): ./Test/testcase.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Test_testcase.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Test_testcase.cpp$(DependSuffix) -MM ./Test/testcase.cpp + +$(IntermediateDirectory)/Test_testcase.cpp$(PreprocessSuffix): ./Test/testcase.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Test_testcase.cpp$(PreprocessSuffix) ./Test/testcase.cpp + +$(IntermediateDirectory)/Test_test_linux.cpp$(ObjectSuffix): ./Test/test_linux.cpp $(IntermediateDirectory)/Test_test_linux.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Test/test_linux.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Test_test_linux.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Test_test_linux.cpp$(DependSuffix): ./Test/test_linux.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Test_test_linux.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Test_test_linux.cpp$(DependSuffix) -MM ./Test/test_linux.cpp + +$(IntermediateDirectory)/Test_test_linux.cpp$(PreprocessSuffix): ./Test/test_linux.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Test_test_linux.cpp$(PreprocessSuffix) ./Test/test_linux.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../ThirdLib/thirdparty/sock_wrap.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/CppUnitTest/Test.cbp b/CppUnitTest/Test.cbp new file mode 100644 index 000000000..5fa364044 --- /dev/null +++ b/CppUnitTest/Test.cbp @@ -0,0 +1,45 @@ + + + + + + diff --git a/CppUnitTest/Test.depend b/CppUnitTest/Test.depend new file mode 100644 index 000000000..792e76f15 --- /dev/null +++ b/CppUnitTest/Test.depend @@ -0,0 +1,77 @@ +# depslib dependency file v1.0 +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp + + + + "sock_wrap.h" + + + + + + + + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.h + + + + + + + + + + +1553657405 source:/data/develop/Lib/Network/PSS-master/CppUnitTest/Test/test_linux.cpp + "commons.h" + "testcase.h" + +1553658616 /data/develop/Lib/Network/PSS-master/CppUnitTest/Test/commons.h + + + + + + + + + + + + + + + + + + + + + +1553657405 /data/develop/Lib/Network/PSS-master/CppUnitTest/Test/testcase.h + + + + + + + + + + "commons.h" + "sock_wrap.h" + +1553658737 source:/data/develop/Lib/Network/PSS-master/CppUnitTest/Test/testcase.cpp + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//sock_wrap.h + + + + + + + + + + diff --git a/CppUnitTest/Test.layout b/CppUnitTest/Test.layout new file mode 100644 index 000000000..727b791ea --- /dev/null +++ b/CppUnitTest/Test.layout @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/CppUnitTest/Test.mk b/CppUnitTest/Test.mk new file mode 100644 index 000000000..34374cfde --- /dev/null +++ b/CppUnitTest/Test.mk @@ -0,0 +1,126 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=Test +ConfigurationName :=Release +WorkspacePath :=../Build/Linux +ProjectPath :=../CppUnitTest +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="Test.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -O0 +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ThirdLib/thirdparty $(IncludeSwitch)../ThirdLib/include +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)pthread +ArLibs := "libpthread.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -g -Wall $(Preprocessors) +CFLAGS := $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Test_testcase.cpp$(ObjectSuffix) $(IntermediateDirectory)/Test_test_linux.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Test_testcase.cpp$(ObjectSuffix): ./Test/testcase.cpp $(IntermediateDirectory)/Test_testcase.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Test/testcase.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Test_testcase.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Test_testcase.cpp$(DependSuffix): ./Test/testcase.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Test_testcase.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Test_testcase.cpp$(DependSuffix) -MM ./Test/testcase.cpp + +$(IntermediateDirectory)/Test_testcase.cpp$(PreprocessSuffix): ./Test/testcase.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Test_testcase.cpp$(PreprocessSuffix) ./Test/testcase.cpp + +$(IntermediateDirectory)/Test_test_linux.cpp$(ObjectSuffix): ./Test/test_linux.cpp $(IntermediateDirectory)/Test_test_linux.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Test/test_linux.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Test_test_linux.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Test_test_linux.cpp$(DependSuffix): ./Test/test_linux.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Test_test_linux.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Test_test_linux.cpp$(DependSuffix) -MM ./Test/test_linux.cpp + +$(IntermediateDirectory)/Test_test_linux.cpp$(PreprocessSuffix): ./Test/test_linux.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Test_test_linux.cpp$(PreprocessSuffix) ./Test/test_linux.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../ThirdLib/thirdparty/sock_wrap.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/CppUnitTest/Test.project b/CppUnitTest/Test.project new file mode 100644 index 000000000..9d85c3867 --- /dev/null +++ b/CppUnitTest/Test.project @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/CppUnitTest/Test.txt b/CppUnitTest/Test.txt new file mode 100644 index 000000000..154ee3f67 --- /dev/null +++ b/CppUnitTest/Test.txt @@ -0,0 +1 @@ +../Build/Linux/Temp/Test_testcase.cpp.o ../Build/Linux/Temp/Test_test_linux.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_sock_wrap.cpp.o diff --git a/CppUnitTest/Test/commons.h b/CppUnitTest/Test/commons.h index 81d8274a1..0b637ea4f 100644 --- a/CppUnitTest/Test/commons.h +++ b/CppUnitTest/Test/commons.h @@ -1,12 +1,53 @@ -#ifndef _COMMON_H +#ifndef _COMMON_H #define _COMMON_H #include #include -#include + #include #include #include +#include + +#if defined(_WIN32_PLATFORM_) +#include +#pragma comment(lib,"ws2_32.lib") + + +static int gettimeofday(struct timeval *tp, void *tzp) +{ + time_t clock; + struct tm tm; + SYSTEMTIME wtm; + GetLocalTime(&wtm); + tm.tm_year = wtm.wYear - 1900; + tm.tm_mon = wtm.wMonth - 1; + tm.tm_mday = wtm.wDay; + tm.tm_hour = wtm.wHour; + tm.tm_min = wtm.wMinute; + tm.tm_sec = wtm.wSecond; + tm.tm_isdst = -1; + clock = mktime(&tm); + tp->tv_sec = clock; + tp->tv_usec = wtm.wMilliseconds * 1000; + return (0); +} + + + + +#endif + +#if defined(_LINUX_PLATFORM_) +#include +#include +#include +#include +#include +#include +#include +#define timelong_t struct timeval + #include #include #include @@ -14,6 +55,16 @@ #include #include + +#endif + + + + + + + + #define MAX_BUFF_200 200 #define MAX_BUFF_300 300 #define MAX_BUFF_1024 1024 @@ -39,7 +90,7 @@ #define HTML_NAME "../../testresult/result.md" -//ݼ +//²âÊÔÊý¾Ý¼¯ struct _ClientInfo { char m_szServerIP[30]; @@ -58,13 +109,13 @@ struct _ClientInfo } }; -// +//Êä³ö½á¹û¼¯ struct _ResultInfo { - char m_szTestName[MAX_BUFF_300]; //Լ - char m_szResult[MAX_BUFF_1024]; //Խ - int m_nRet; //Խ 0 ɹ 1 ʧ - float m_fMilliseconds; //ʱ + char m_szTestName[MAX_BUFF_300]; //²âÊÔ¼¯Ãû³Æ + char m_szResult[MAX_BUFF_1024]; //²âÊÔ½á¹ûÃèÊö + int m_nRet; //²âÊÔ½á¹û 0 ³É¹¦ 1 ʧ°Ü + float m_fMilliseconds; //ÏûºÄʱ¼ä _ResultInfo() { @@ -95,18 +146,17 @@ struct _ResultInfo } }; -//̲߳Բ +//¶àÏ̲߳âÊÔ²ÎÊý struct _ThreadParam { _ClientInfo* m_pClientInfo; _ResultInfo* m_pResultInfo; - pthread_barrier_t* m_Barrier; - + _ThreadParam() { m_pClientInfo = NULL; m_pResultInfo = NULL; - m_Barrier = NULL; + } }; diff --git a/CppUnitTest/Test/test_linux.cpp b/CppUnitTest/Test/test_linux.cpp index ea69c6be9..b8bf0c437 100644 --- a/CppUnitTest/Test/test_linux.cpp +++ b/CppUnitTest/Test/test_linux.cpp @@ -1,4 +1,4 @@ -#include +#include #include "commons.h" #include "testcase.h" @@ -6,14 +6,14 @@ using namespace std; int main() { - //в + //运行测试用例 int nTestCount = 0; string strResultInfo; char szHtmlResult[MAX_BUFF_1024] = {'\0'}; _ResultInfo objResultInfo; _ClientInfo objClientInfo; - //õǰʱ + //获得当前测试运行时间 time_t ttCurrentTime; time(&ttCurrentTime); struct tm* pTime; @@ -27,7 +27,7 @@ int main() pTime->tm_min, pTime->tm_sec); - //ʼ + //开始测试用例 char szBuff[20] = {'\0'}; sprintf(szBuff, "freeeyes"); @@ -90,7 +90,7 @@ int main() strResultInfo += szHtmlResult; nTestCount++; - //ļʽ + //输出成文件格式 char* pHtmlFile = new char[nTestCount*MAX_BUFF_1024]; memset(pHtmlFile, 0, nTestCount*MAX_BUFF_1024); diff --git a/CppUnitTest/Test/testcase.cpp b/CppUnitTest/Test/testcase.cpp index ca0622257..a02d599cf 100644 --- a/CppUnitTest/Test/testcase.cpp +++ b/CppUnitTest/Test/testcase.cpp @@ -1,9 +1,10 @@ -#include "testcase.h" +#include "testcase.h" + bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) { struct timeval ttStart, ttEnd; - int sckClient; + char szSession[32] = {'\0'}; int nSrcLen = 0; int nDecLen = 0; @@ -13,34 +14,25 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) sprintf(objResultInfo.m_szTestName, "single packet test"); sprintf(szSession, "FREEEYES"); - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(objClientInfo.m_nPort); - sockaddr.sin_addr.s_addr = inet_addr(objClientInfo.m_szServerIP); - - sckClient = socket(AF_INET, SOCK_STREAM, 0); - struct timeval tvTimeout; - tvTimeout.tv_sec = 5; - tvTimeout.tv_usec = 0; - setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char*)&tvTimeout, sizeof(tvTimeout)); + InitializeSocketEnvironment(); + HSocket obj_ODSocket =SocketOpen(SOCK_STREAM); + sockaddr_in addr; + GetAddressFrom(&addr, objClientInfo.m_szServerIP, objClientInfo.m_nPort); + SocketTimeOut(obj_ODSocket,5,-1,-1); + int nErr =SocketConnect(obj_ODSocket, &addr); - //Զ̷ - int nErr = connect(sckClient, (struct sockaddr*)&sockaddr, sizeof(sockaddr)); if(0 != nErr) { gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; } - //ƴװͰ + //Æ´×°·¢ËͰüÌå char szSendBuffer[MAX_BUFF_200] = {'\0'}; short sVersion = 1; @@ -54,7 +46,7 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) memcpy((char* )&szSendBuffer[40], (char* )objClientInfo.m_pSendBuffer, sizeof(char) * objClientInfo.m_nSendLength); int nSendLen = nPacketLen + 40; - // + //·¢ËÍÊý¾Ý int nTotalSendLen = nSendLen; int nBeginSend = 0; int nCurrSendLen = 0; @@ -65,13 +57,15 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) while(true) { - nCurrSendLen = send(sckClient, szSendBuffer + nBeginSend, nTotalSendLen, 0); + transresult_t rt; + SocketSend(obj_ODSocket, szSendBuffer + nBeginSend, nTotalSendLen, rt); + nCurrSendLen =rt.nbytes; if(nCurrSendLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; @@ -82,7 +76,7 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) if(nTotalSendLen == 0) { - // + //·¢ËÍÍê³É blSendFlag = true; break; } @@ -95,7 +89,7 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) if(blSendFlag == false) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]send buff size not equal, buffer size[%d], send size[%d]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, objClientInfo.m_nSendLength, nTotalSendLen); objResultInfo.m_nRet = 1; @@ -110,12 +104,14 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) while(true) { - //ͳɹˣ - nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); - + //Èç¹û·¢Ëͳɹ¦ÁË£¬Ôò´¦Àí½ÓÊÕÊý¾Ý + transresult_t rt; + SocketRecv(obj_ODSocket, szRecvBuffData + nBeginRecv, nTotalRecvLen, rt); + nCurrRecvLen =rt.nbytes; + if(nCurrRecvLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]client recv data error.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; @@ -128,7 +124,7 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) if(nTotalRecvLen == 0) { - // + //½ÓÊÕÍê³É break; } else @@ -143,7 +139,7 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) gettimeofday(&ttEnd, NULL); objResultInfo.m_nRet = 0; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; - close(sckClient); + SocketClose(obj_ODSocket); return true; } @@ -151,7 +147,7 @@ bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& objResultInfo) { struct timeval ttStart, ttEnd; - int sckClient; + char szSession[32] = {'\0'}; int nSrcLen = 0; int nDecLen = 0; @@ -161,34 +157,23 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& sprintf(objResultInfo.m_szTestName, "multiple packet test(%d)", nCount); sprintf(szSession, "FREEEYES"); - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(objClientInfo.m_nPort); - sockaddr.sin_addr.s_addr = inet_addr(objClientInfo.m_szServerIP); - - sckClient = socket(AF_INET, SOCK_STREAM, 0); - - struct timeval tvTimeout; - tvTimeout.tv_sec = 5; - tvTimeout.tv_usec = 0; - setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char*)&tvTimeout, sizeof(tvTimeout)); - - //Զ̷ - int nErr = connect(sckClient, (struct sockaddr*)&sockaddr, sizeof(sockaddr)); + InitializeSocketEnvironment(); + HSocket obj_ODSocket =SocketOpen(SOCK_STREAM); + sockaddr_in addr; + GetAddressFrom(&addr, objClientInfo.m_szServerIP, objClientInfo.m_nPort); + SocketTimeOut(obj_ODSocket,5,-1,-1); + int nErr =SocketConnect(obj_ODSocket, &addr); if(0 != nErr) { gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; } - //ƴװͰ + //Æ´×°·¢ËͰüÌå char szSendBuffer[MAX_BUFF_200] = {'\0'}; short sVersion = 1; @@ -202,7 +187,7 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& memcpy((char* )&szSendBuffer[40], (char* )objClientInfo.m_pSendBuffer, sizeof(char) * objClientInfo.m_nSendLength); int nSendLen = nPacketLen + 40; - //ƴװԷݰ + //Æ´×°²âÊÔ·¢ËÍÊý¾Ý°ü char* pData = new char[nCount * nSendLen]; memset(pData, 0, nCount * nSendLen); @@ -211,7 +196,7 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& memcpy((char* )&pData[i * nSendLen], szSendBuffer, nSendLen); } - // + //·¢ËÍÊý¾Ý int nTotalSendLen = nCount * nSendLen; int nBeginSend = 0; int nCurrSendLen = 0; @@ -222,14 +207,16 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& while(true) { - nCurrSendLen = send(sckClient, pData + nBeginSend, nTotalSendLen, 0); + transresult_t rt; + SocketSend(obj_ODSocket, pData + nBeginSend, nTotalSendLen, rt); + nCurrSendLen =rt.nbytes; if(nCurrSendLen <= 0) { delete [] pData; - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; @@ -240,7 +227,7 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& if(nTotalSendLen == 0) { - // + //·¢ËÍÍê³É delete [] pData; blSendFlag = true; break; @@ -254,7 +241,7 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& if(blSendFlag == false) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]send buff size not equal, buffer size[%d], send size[%d]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, objClientInfo.m_nSendLength, nTotalSendLen); objResultInfo.m_nRet = 1; @@ -269,12 +256,14 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& while(true) { - //ͳɹˣ - nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); - + //Èç¹û·¢Ëͳɹ¦ÁË£¬Ôò´¦Àí½ÓÊÕÊý¾Ý + transresult_t rt; + SocketRecv(obj_ODSocket, szRecvBuffData + nBeginRecv, nTotalRecvLen, rt); + nCurrRecvLen =rt.nbytes; + if(nCurrRecvLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]client recv data error.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; @@ -287,7 +276,7 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& if(nTotalRecvLen == 0) { - // + //½ÓÊÕÍê³É break; } else @@ -302,7 +291,7 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& gettimeofday(&ttEnd, NULL); objResultInfo.m_nRet = 0; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; - close(sckClient); + SocketClose(obj_ODSocket); return true; } @@ -310,7 +299,7 @@ bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo& objResultInfo) { struct timeval ttStart, ttEnd; - int sckClient; + HSocket obj_ODSocket; char szSession[32] = {'\0'}; int nSrcLen = 0; int nDecLen = 0; @@ -320,36 +309,27 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo sprintf(objResultInfo.m_szTestName, "multiple connect test(%d)", nCount); sprintf(szSession, "FREEEYES"); - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(objClientInfo.m_nPort); - sockaddr.sin_addr.s_addr = inet_addr(objClientInfo.m_szServerIP); - + InitializeSocketEnvironment(); + sockaddr_in addr; + GetAddressFrom(&addr, objClientInfo.m_szServerIP, objClientInfo.m_nPort); + + for(int i = 0; i < nCount; i++) { - sckClient = socket(AF_INET, SOCK_STREAM, 0); - - struct timeval tvTimeout; - tvTimeout.tv_sec = 5; - tvTimeout.tv_usec = 0; - setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char*)&tvTimeout, sizeof(tvTimeout)); - - //Զ̷ - int nErr = connect(sckClient, (struct sockaddr*)&sockaddr, sizeof(sockaddr)); + obj_ODSocket =SocketOpen(SOCK_STREAM); + SocketTimeOut(obj_ODSocket,5,-1,-1); + int nErr =SocketConnect(obj_ODSocket, &addr); if(0 != nErr) { gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; } - //ƴװͰ + //Æ´×°·¢ËͰüÌå char szSendBuffer[MAX_BUFF_200] = {'\0'}; short sVersion = 1; @@ -363,7 +343,7 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo memcpy((char* )&szSendBuffer[40], (char* )objClientInfo.m_pSendBuffer, sizeof(char) * objClientInfo.m_nSendLength); int nSendLen = nPacketLen + 40; - // + //·¢ËÍÊý¾Ý int nTotalSendLen = nSendLen; int nBeginSend = 0; int nCurrSendLen = 0; @@ -374,13 +354,14 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo while(true) { - nCurrSendLen = send(sckClient, szSendBuffer + nBeginSend, nTotalSendLen, 0); - + transresult_t rt; + SocketSend(obj_ODSocket, szSendBuffer + nBeginSend, nTotalSendLen, rt); + nCurrSendLen =rt.nbytes; if(nCurrSendLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; @@ -391,7 +372,7 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo if(nTotalSendLen == 0) { - // + //·¢ËÍÍê³É blSendFlag = true; break; } @@ -404,7 +385,7 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo if(blSendFlag == false) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]send buff size not equal, buffer size[%d], send size[%d]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, objClientInfo.m_nSendLength, nTotalSendLen); objResultInfo.m_nRet = 1; @@ -419,12 +400,13 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo while(true) { - //ͳɹˣ - nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); - + //Èç¹û·¢Ëͳɹ¦ÁË£¬Ôò´¦Àí½ÓÊÕÊý¾Ý + transresult_t rt; + SocketRecv(obj_ODSocket, szRecvBuffData +nBeginRecv , nTotalRecvLen, rt); + nCurrRecvLen =rt.nbytes; if(nCurrRecvLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]client recv data error.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; @@ -437,7 +419,7 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo if(nTotalRecvLen == 0) { - // + //½ÓÊÕÍê³É break; } else @@ -452,7 +434,7 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo gettimeofday(&ttEnd, NULL); objResultInfo.m_nRet = 0; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; - close(sckClient); + SocketClose(obj_ODSocket); } return true; @@ -461,7 +443,7 @@ bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) { struct timeval ttStart, ttEnd; - int sckClient; + char szSession[32] = {'\0'}; int nSrcLen = 0; int nDecLen = 0; @@ -471,46 +453,34 @@ bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultI sprintf(objResultInfo.m_szTestName, "unvaild packet test"); sprintf(szSession, "FREEEYES"); - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(objClientInfo.m_nPort); - sockaddr.sin_addr.s_addr = inet_addr(objClientInfo.m_szServerIP); - - sckClient = socket(AF_INET, SOCK_STREAM, 0); - - struct timeval tvTimeout; - tvTimeout.tv_sec = 5; - tvTimeout.tv_usec = 0; - setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char*)&tvTimeout, sizeof(tvTimeout)); - - //Զ̷ - int nErr = connect(sckClient, (struct sockaddr*)&sockaddr, sizeof(sockaddr)); - + InitializeSocketEnvironment(); + HSocket obj_ODSocket =SocketOpen(SOCK_STREAM); + sockaddr_in addr; + GetAddressFrom(&addr, objClientInfo.m_szServerIP, objClientInfo.m_nPort); + SocketTimeOut(obj_ODSocket,5,-1,-1); + int nErr =SocketConnect(obj_ODSocket, &addr); if(0 != nErr) { gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; } - //ƴװͰ + //Æ´×°·¢ËͰüÌå char szSendBuffer[MAX_BUFF_200] = {'\0'}; short sVersion = 1; short sCommand = (short)COMMAND_AUTOTEST_HEAD; int nPacketLen = objClientInfo.m_nSendLength; - //ģһЧͷ + //Ä£ÄâÒ»¸öÎÞЧ°üÍ· memset(szSendBuffer, 0, 40); memcpy((char* )&szSendBuffer[40], (char* )objClientInfo.m_pSendBuffer, sizeof(char) * objClientInfo.m_nSendLength); int nSendLen = nPacketLen + 40; - // + //·¢ËÍÊý¾Ý int nTotalSendLen = nSendLen; int nBeginSend = 0; int nCurrSendLen = 0; @@ -521,13 +491,14 @@ bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultI while(true) { - nCurrSendLen = send(sckClient, szSendBuffer + nBeginSend, nTotalSendLen, 0); - + transresult_t rt; + SocketSend(obj_ODSocket, szSendBuffer + nBeginSend, nTotalSendLen, rt); + nCurrSendLen =rt.nbytes; if(nCurrSendLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; @@ -538,7 +509,7 @@ bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultI if(nTotalSendLen == 0) { - // + //·¢ËÍÍê³É blSendFlag = true; break; } @@ -551,7 +522,7 @@ bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultI if(blSendFlag == false) { - close(sckClient); + SocketClose(obj_ODSocket);; gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]send buff size not equal, buffer size[%d], send size[%d]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, objClientInfo.m_nSendLength, nTotalSendLen); objResultInfo.m_nRet = 1; @@ -566,12 +537,14 @@ bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultI while(true) { - //ͳɹˣ - nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); - + //Èç¹û·¢Ëͳɹ¦ÁË£¬Ôò´¦Àí½ÓÊÕÊý¾Ý + transresult_t rt; + SocketRecv(obj_ODSocket, szRecvBuffData + nBeginRecv, nTotalRecvLen, rt); + nCurrRecvLen =rt.nbytes; + if(nCurrRecvLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[s][%s:%d]success.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 0; @@ -584,7 +557,7 @@ bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultI if(nTotalRecvLen == 0) { - // + //½ÓÊÕÍê³É break; } else @@ -599,15 +572,14 @@ bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultI gettimeofday(&ttEnd, NULL); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; - close(sckClient); - + SocketClose(obj_ODSocket); + return true; } bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) { struct timeval ttStart, ttEnd; - int sckClient; char szSession[32] = {'\0'}; int nSrcLen = 0; int nDecLen = 0; @@ -617,34 +589,24 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) sprintf(objResultInfo.m_szTestName, "helf packet test"); sprintf(szSession, "FREEEYES"); - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(objClientInfo.m_nPort); - sockaddr.sin_addr.s_addr = inet_addr(objClientInfo.m_szServerIP); - sckClient = socket(AF_INET, SOCK_STREAM, 0); - - struct timeval tvTimeout; - tvTimeout.tv_sec = 5; - tvTimeout.tv_usec = 0; - setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char*)&tvTimeout, sizeof(tvTimeout)); - - //Զ̷ - int nErr = connect(sckClient, (struct sockaddr*)&sockaddr, sizeof(sockaddr)); + InitializeSocketEnvironment(); + HSocket obj_ODSocket =SocketOpen(SOCK_STREAM); + sockaddr_in addr; + GetAddressFrom(&addr, objClientInfo.m_szServerIP, objClientInfo.m_nPort); + SocketTimeOut(obj_ODSocket,5,-1,-1); + int nErr =SocketConnect(obj_ODSocket, &addr); if(0 != nErr) { gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]connnect server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; } - //ƴװͰ + //Æ´×°·¢ËͰüÌå char szSendBuffer[MAX_BUFF_200] = {'\0'}; short sVersion = 1; @@ -658,7 +620,7 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) memcpy((char* )&szSendBuffer[40], (char* )objClientInfo.m_pSendBuffer, sizeof(char) * objClientInfo.m_nSendLength); int nSendLen = nPacketLen + 40; - // + //·¢ËÍÊý¾Ý int nTotalSendLen = 2; int nBeginSend = 0; int nCurrSendLen = 0; @@ -669,13 +631,14 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) while(true) { - nCurrSendLen = send(sckClient, szSendBuffer + nBeginSend, nTotalSendLen, 0); - + transresult_t rt; + SocketSend(obj_ODSocket, szSendBuffer + nBeginSend, nTotalSendLen, rt); + nCurrSendLen =rt.nbytes; if(nCurrSendLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; @@ -686,7 +649,7 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) if(nTotalSendLen == 0) { - // + //·¢ËÍÍê³É blSendFlag = true; break; } @@ -697,7 +660,8 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) } } - usleep(1); + //usleep(1); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); nTotalSendLen = nSendLen - 2; nBeginSend = 2; nCurrSendLen = 0; @@ -707,13 +671,14 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) while(true) { - nCurrSendLen = send(sckClient, szSendBuffer + nBeginSend, nTotalSendLen, 0); - + transresult_t rt; + SocketSend(obj_ODSocket, szSendBuffer + nBeginSend, nTotalSendLen, rt); + nCurrSendLen =rt.nbytes; if(nCurrSendLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][%s:%d]send server fail.[%s]¡£", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; @@ -724,7 +689,7 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) if(nTotalSendLen == 0) { - // + //·¢ËÍÍê³É blSendFlag = true; break; } @@ -737,7 +702,7 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) if(blSendFlag == false) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]send buff size not equal, buffer size[%d], send size[%d]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, objClientInfo.m_nSendLength, nTotalSendLen); objResultInfo.m_nRet = 1; @@ -752,12 +717,14 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) while(true) { - //ͳɹˣ - nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); - + //Èç¹û·¢Ëͳɹ¦ÁË£¬Ôò´¦Àí½ÓÊÕÊý¾Ý + transresult_t rt; + SocketRecv(obj_ODSocket, szRecvBuffData + nBeginRecv, nTotalRecvLen, rt); + nCurrRecvLen =rt.nbytes; + if(nCurrRecvLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]client recv data error.[%s]", objClientInfo.m_szServerIP, objClientInfo.m_nPort, strerror(errno)); objResultInfo.m_nRet = 1; @@ -770,7 +737,7 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) if(nTotalRecvLen == 0) { - // + //½ÓÊÕÍê³É break; } else @@ -785,12 +752,12 @@ bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) gettimeofday(&ttEnd, NULL); objResultInfo.m_nRet = 0; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; - close(sckClient); + SocketClose(obj_ODSocket); return true; } -void* Thread_CheckTcpPacket(void* arg) +void Thread_CheckTcpPacket(void* arg) { _ThreadParam* pThreadParam = (_ThreadParam* )arg; @@ -799,11 +766,11 @@ void* Thread_CheckTcpPacket(void* arg) CheckTcpPacket(*pThreadParam->m_pClientInfo, *pThreadParam->m_pResultInfo); } - pthread_barrier_wait(pThreadParam->m_Barrier); + //pthread_barrier_wait(pThreadParam->m_Barrier); } -void* Thread_CheckRecvUdpPacket(void* arg) +void Thread_CheckRecvUdpPacket(void* arg) { _ThreadParam* pThreadParam = (_ThreadParam* )arg; @@ -812,13 +779,12 @@ void* Thread_CheckRecvUdpPacket(void* arg) Thread_CheckUdpPacket_Recv(*pThreadParam->m_pClientInfo, *pThreadParam->m_pResultInfo); } - pthread_barrier_wait(pThreadParam->m_Barrier); + //pthread_barrier_wait(pThreadParam->m_Barrier); } bool CheckTcpMulipleThreadPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& objResultInfo) { struct timeval ttStart, ttEnd; - int sckClient; char szSession[32] = {'\0'}; int nSrcLen = 0; int nDecLen = 0; @@ -833,26 +799,25 @@ bool CheckTcpMulipleThreadPacket(int nCount, _ClientInfo& objClientInfo, _Result memset(pResultInfoList, 0, sizeof(pResultInfoList)); memset(pThreadParamList, 0, sizeof(pThreadParamList)); - pthread_barrier_t barrier; - - //ʼդ - pthread_barrier_init(&barrier, NULL, 1 + nCount); - + std::vector Thread_CheckTcpPacket_list; for(int i = 0; i < nCount; i++) { - pthread_t pid; - _ThreadParam* pThreadParam = &pThreadParamList[i]; pThreadParam->m_pClientInfo = &objClientInfo; pThreadParam->m_pResultInfo = &pResultInfoList[i]; - pThreadParam->m_Barrier = &barrier; - - pthread_create(&pid, NULL, &Thread_CheckTcpPacket, (void* )pThreadParam); + + //std::thread thread_test(Thread_CheckTcpPacket,(void*)(pThreadParam)); + //std::thread thread_test(std::bind(Thread_CheckTcpPacket, this, (void*)(pThreadParam))); + std::thread thread_test([&] { Thread_CheckTcpPacket((void*)(pThreadParam)); }); + + Thread_CheckTcpPacket_list.push_back(std::move(thread_test)); } - pthread_barrier_wait(&barrier); - pthread_barrier_destroy(&barrier); - + for(int i = 0; i < nCount; i++) + { + Thread_CheckTcpPacket_list[i].join(); + } + for(int i = 0; i < nCount; i++) { if(pResultInfoList[i].m_nRet == 1) @@ -874,9 +839,8 @@ bool CheckTcpMulipleThreadPacket(int nCount, _ClientInfo& objClientInfo, _Result bool Thread_CheckUdpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo, _ResultInfo& objRecvResultInfo) { - //UDP + //²âÊÔUDP·¢°ü struct timeval ttStart, ttEnd; - int sckClient; char szSession[32] = {'\0'}; int nSrcLen = 0; int nDecLen = 0; @@ -886,17 +850,15 @@ bool Thread_CheckUdpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInf sprintf(objResultInfo.m_szTestName, "single UDP packet test"); sprintf(szSession, "FREEEYES"); - //socket׼ - struct sockaddr_in sockaddr_Client; + //socket´´½¨µÄ×¼±¸¹¤×÷ - memset(&sockaddr_Client, 0, sizeof(sockaddr_Client)); - sockaddr_Client.sin_family = AF_INET; - sockaddr_Client.sin_port = htons(10003); - sockaddr_Client.sin_addr.s_addr = inet_addr(objClientInfo.m_szServerIP); + InitializeSocketEnvironment(); + HSocket obj_ODSocket =SocketOpen(SOCK_DGRAM); + sockaddr_in addr; + GetAddressFrom(&addr, objClientInfo.m_szServerIP, objClientInfo.m_nPort); - sckClient = socket(AF_INET, SOCK_DGRAM, 0); - //ƴװͰ + //Æ´×°·¢ËͰüÌå char szSendBuffer[MAX_BUFF_200] = {'\0'}; short sVersion = 1; @@ -910,22 +872,16 @@ bool Thread_CheckUdpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInf memcpy((char* )&szSendBuffer[40], (char* )objClientInfo.m_pSendBuffer, sizeof(char) * objClientInfo.m_nSendLength); int nSendLen = nPacketLen + 40; - //ýݰ߳ - pthread_t pid; + //ÉèÖýÓÊÕÊý¾Ý°üÏß³Ì _ThreadParam* pThreadParam = new _ThreadParam(); - pthread_barrier_t barrier; - - //ʼդ - pthread_barrier_init(&barrier, NULL, 1 + 1); - pThreadParam->m_pClientInfo = &objClientInfo; pThreadParam->m_pResultInfo = &objRecvResultInfo; - pThreadParam->m_Barrier = &barrier; + + std::thread thread_test(&Thread_CheckRecvUdpPacket,pThreadParam); + thread_test.join(); // 等待线程结束 - pthread_create(&pid, NULL, &Thread_CheckRecvUdpPacket, (void* )pThreadParam); - - // + //·¢ËÍÊý¾Ý int nTotalSendLen = nSendLen; int nBeginSend = 0; int nCurrSendLen = 0; @@ -935,10 +891,9 @@ bool Thread_CheckUdpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInf bool blRecvFlag = false; printf("[Thread_CheckUdpPacket]nTotalSendLen=%d.\n", nTotalSendLen); - - if( sendto(sckClient, szSendBuffer, nTotalSendLen, 0, (struct sockaddr*)&sockaddr_Client, sizeof(sockaddr_Client)) == -1) + if( SockSendTo(obj_ODSocket, szSendBuffer, nTotalSendLen, &addr) == -1) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]client Udp Send data error.[%s]", objClientInfo.m_szServerIP, 10003, strerror(errno)); objResultInfo.m_nRet = 1; @@ -950,11 +905,13 @@ bool Thread_CheckUdpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInf gettimeofday(&ttEnd, NULL); objResultInfo.m_nRet = 0; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; - close(sckClient); + SocketClose(obj_ODSocket); - //ȴ̷߳Ϣ - pthread_barrier_wait(&barrier); - pthread_barrier_destroy(&barrier); + //µÈ´ý½ÓÊÕÏ̷߳µ»ØÐÅÏ¢ + //pthread_barrier_wait(&barrier); + //pthread_barrier_destroy(&barrier); + //pthread_barrier_wait(&barrier); + //pthread_barrier_destroy(&barrier); delete pThreadParam; @@ -964,27 +921,23 @@ bool Thread_CheckUdpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInf bool Thread_CheckUdpPacket_Recv(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo) { struct timeval ttStart, ttEnd; - int sockListen = socket(AF_INET, SOCK_DGRAM, 0); gettimeofday(&ttStart, NULL); sprintf(objResultInfo.m_szTestName, "single UDP packet recv test"); - int set = 1; - setsockopt(sockListen, SOL_SOCKET, SO_REUSEADDR, &set, sizeof(int)); - struct sockaddr_in recvAddr; - memset(&recvAddr, 0, sizeof(struct sockaddr_in)); - recvAddr.sin_family = AF_INET; - recvAddr.sin_port = htons(20002); - recvAddr.sin_addr.s_addr = inet_addr(objClientInfo.m_szServerIP); - - //óʱʱ - struct timeval timeout = {3,0}; - setsockopt(sockListen, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(struct timeval)); - - // 󶨣޷ - if(bind(sockListen, (struct sockaddr*)&recvAddr, sizeof(struct sockaddr)) == -1) + //int set = 1; + //setsockopt(sockListen, SOL_SOCKET, SO_REUSEADDR, &set, sizeof(int)); + + InitializeSocketEnvironment(); + HSocket obj_ODSocket =SocketOpen(SOCK_DGRAM); + sockaddr_in addr; + GetAddressFrom(&addr, objClientInfo.m_szServerIP, objClientInfo.m_nPort); + SocketTimeOut(obj_ODSocket,5,-1,-1); + + // ±ØÐë°ó¶¨£¬·ñÔòÎÞ·¨¼àÌý + if(SocketBind(obj_ODSocket, &addr) == -1) { - close(sockListen); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]client Udp bind error.[%s]", objClientInfo.m_szServerIP, 20002, strerror(errno)); objResultInfo.m_nRet = 1; @@ -997,8 +950,7 @@ bool Thread_CheckUdpPacket_Recv(_ClientInfo& objClientInfo, _ResultInfo& objResu char recvbuf[128]; int addrLen = sizeof(struct sockaddr_in); - if((recvbytes = recvfrom(sockListen, recvbuf, 128, 0, - (struct sockaddr*)&recvAddr, (socklen_t*)&addrLen)) != -1) + if((recvbytes = SockRecvFrom(obj_ODSocket, recvbuf, 128, &addr)) != -1) { recvbuf[recvbytes] = '\0'; @@ -1019,11 +971,11 @@ bool Thread_CheckUdpPacket_Recv(_ClientInfo& objClientInfo, _ResultInfo& objResu objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; } - close(sockListen); + SocketClose(obj_ODSocket); } else { - close(sockListen); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][%s:%d]client Udp bind error.[%s]", objClientInfo.m_szServerIP, 20002, strerror(errno)); objResultInfo.m_nRet = 1; @@ -1037,7 +989,7 @@ bool Thread_CheckUdpPacket_Recv(_ClientInfo& objClientInfo, _ResultInfo& objResu bool CheckConsolePacket(_ResultInfo& objResultInfo) { struct timeval ttStart, ttEnd; - int sckClient; + char szSession[32] = {'\0'}; int nSrcLen = 0; int nDecLen = 0; @@ -1047,41 +999,30 @@ bool CheckConsolePacket(_ResultInfo& objResultInfo) sprintf(objResultInfo.m_szTestName, "console command test"); sprintf(szSession, "FREEEYES"); - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(10010); - sockaddr.sin_addr.s_addr = inet_addr("127.0.0.1"); - - sckClient = socket(AF_INET, SOCK_STREAM, 0); - - struct timeval tvTimeout; - tvTimeout.tv_sec = 5; - tvTimeout.tv_usec = 0; - setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char*)&tvTimeout, sizeof(tvTimeout)); - - //Զ̷ - int nErr = connect(sckClient, (struct sockaddr*)&sockaddr, sizeof(sockaddr)); + InitializeSocketEnvironment(); + HSocket obj_ODSocket =SocketOpen(SOCK_STREAM); + sockaddr_in addr; + GetAddressFrom(&addr, "127.0.0.1", 10010); + SocketTimeOut(obj_ODSocket,5,-1,-1); + int nErr =SocketConnect(obj_ODSocket, &addr); if(0 != nErr) { gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][127.0.0.1:10010]connnect server fail.[%s]", strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][127.0.0.1:10010]connnect server fail.[%s]¡£", strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; } - //ƴװͰ + //Æ´×°·¢ËͰüÌå char szSendBuffer[MAX_BUFF_200] = {'\0'}; char szSendData[200] = { '\0' }; sprintf(szSendData, "b freeeyes ShowModule -a&"); int nSendDataLen = strlen(szSendData); - // + //·¢ËÍÊý¾Ý int nTotalSendLen = nSendDataLen; int nBeginSend = 0; int nCurrSendLen = 0; @@ -1092,13 +1033,14 @@ bool CheckConsolePacket(_ResultInfo& objResultInfo) while(true) { - nCurrSendLen = send(sckClient, szSendData + nBeginSend, nTotalSendLen, 0); - + transresult_t rt; + SocketSend(obj_ODSocket, szSendData+ nBeginSend, nTotalSendLen, rt); + nCurrSendLen =rt.nbytes; if(nCurrSendLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); - sprintf(objResultInfo.m_szResult, "[e][127.0.0.1:10010]send server fail.[%s]", strerror(errno)); + sprintf(objResultInfo.m_szResult, "[e][127.0.0.1:10010]send server fail.[%s]¡£", strerror(errno)); objResultInfo.m_nRet = 1; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; return false; @@ -1109,7 +1051,7 @@ bool CheckConsolePacket(_ResultInfo& objResultInfo) if(nTotalSendLen == 0) { - // + //·¢ËÍÍê³É blSendFlag = true; break; } @@ -1122,7 +1064,7 @@ bool CheckConsolePacket(_ResultInfo& objResultInfo) if(blSendFlag == false) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][127.0.0.1:10010]send buff size not equal, buffer size[%d], send size[%d]", nTotalSendLen); objResultInfo.m_nRet = 1; @@ -1137,12 +1079,14 @@ bool CheckConsolePacket(_ResultInfo& objResultInfo) while(true) { - //ͳɹˣ - nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); - + //Èç¹û·¢Ëͳɹ¦ÁË£¬Ôò´¦Àí½ÓÊÕÊý¾Ý + transresult_t rt; + SocketRecv(obj_ODSocket, szRecvBuffData + nBeginRecv, nTotalRecvLen, rt); + nCurrRecvLen =rt.nbytes; + if(nCurrRecvLen <= 0) { - close(sckClient); + SocketClose(obj_ODSocket); gettimeofday(&ttEnd, NULL); sprintf(objResultInfo.m_szResult, "[e][127.0.0.1:10010]client recv data error.[%s]", strerror(errno)); objResultInfo.m_nRet = 1; @@ -1161,7 +1105,7 @@ bool CheckConsolePacket(_ResultInfo& objResultInfo) gettimeofday(&ttEnd, NULL); objResultInfo.m_nRet = 0; objResultInfo.m_fMilliseconds = (float)(1000000*(ttEnd.tv_sec - ttStart.tv_sec) + (ttEnd.tv_usec - ttStart.tv_usec))/1000.0f; - close(sckClient); + SocketClose(obj_ODSocket); return true; diff --git a/CppUnitTest/Test/testcase.h b/CppUnitTest/Test/testcase.h index 7ee69577c..b8fc0bf76 100644 --- a/CppUnitTest/Test/testcase.h +++ b/CppUnitTest/Test/testcase.h @@ -1,37 +1,54 @@ -#ifndef _TESTCASE_H +#ifndef _TESTCASE_H #define _TESTCASE_H +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +//#include "pthread.h" + + #include "commons.h" -#include "pthread.h" +#include "sock_wrap.h" + + + -//Եݰշ +//²âÊÔµ¥¸öÊý¾Ý°üÊÕ·¢Çé¿ö bool CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo); -//Զݰշ +//²âÊÔ¶à¸öÊý¾Ý°üÊÕ·¢Çé¿ö bool CheckMultipleTcpPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& objResultInfo); -//Զշ +//²âÊÔ¶à¸öÁ¬½ÓÊÕ·¢°üÇé¿ö bool CheckMultipleTcpConnect(int nCount, _ClientInfo& objClientInfo, _ResultInfo& objResultInfo); -//ԷǷݰͷ +//²âÊÔ·Ç·¨Êý¾Ý°üÍ·µÄÎÊÌâ bool CheckTcpErrorPacketHead(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo); -//ճ +//²âÊÔÊý¾ÝÕ³°ü bool CheckTcpHalfPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo); -//̲߳ +//¶àÏ̲߳âÊÔÁ¬½Ó bool Thread_CheckTcpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo); -//Զ̲߳ +//²âÊÔ¶àÏ̲߳¢·¢ bool CheckTcpMulipleThreadPacket(int nCount, _ClientInfo& objClientInfo, _ResultInfo& objResultInfo); -//UDP +//²âÊÔUDP°ü·¢ËÍ bool Thread_CheckUdpPacket(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo, _ResultInfo& objRecvResultInfo); -//UDP +//²âÊÔUDP°ü½ÓÊÕ bool Thread_CheckUdpPacket_Recv(_ClientInfo& objClientInfo, _ResultInfo& objResultInfo); -//Console +//²âÊÔConsoleÁ¬½Ó bool CheckConsolePacket(_ResultInfo& objResultInfo); #endif diff --git a/Icon.jpg b/Icon.jpg index debe70d71..b214c3bba 100644 Binary files a/Icon.jpg and b/Icon.jpg differ diff --git a/PluginMaker/XML2CPP/CMakeLists.txt b/PluginMaker/XML2CPP/CMakeLists.txt new file mode 100644 index 000000000..4d5dc093a --- /dev/null +++ b/PluginMaker/XML2CPP/CMakeLists.txt @@ -0,0 +1,92 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(XML2CPP) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_XML2CPP_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../ThirdLib/include/TinyXML + ../../ThirdLib/include + ../../ThirdLib/thirdparty + ../../ThirdLib/src + +) + + +# Compiler options +add_definitions(-g -Wall) + +# Linker options +set(LINK_OPTIONS -O0) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./XML2CPP/ParseCAPIFile.cpp + ${CMAKE_CURRENT_LIST_DIR}/./XML2CPP/XML2CPP.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/XmlOpeation.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxml.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinystr.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -g -Wall") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(XML2CPP ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(XML2CPP ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/PluginMaker/XML2CPP/Makefile b/PluginMaker/XML2CPP/Makefile new file mode 100644 index 000000000..72392cd7f --- /dev/null +++ b/PluginMaker/XML2CPP/Makefile @@ -0,0 +1,158 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=XML2CPP +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../PluginMaker/XML2CPP +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="XML2CPP.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -O0 +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/thirdparty $(IncludeSwitch)../../ThirdLib/src +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -g -Wall $(Preprocessors) +CFLAGS := $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(ObjectSuffix) $(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(ObjectSuffix): ./XML2CPP/ParseCAPIFile.cpp $(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./XML2CPP/ParseCAPIFile.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(DependSuffix): ./XML2CPP/ParseCAPIFile.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(DependSuffix) -MM ./XML2CPP/ParseCAPIFile.cpp + +$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(PreprocessSuffix): ./XML2CPP/ParseCAPIFile.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(PreprocessSuffix) ./XML2CPP/ParseCAPIFile.cpp + +$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(ObjectSuffix): ./XML2CPP/XML2CPP.cpp $(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./XML2CPP/XML2CPP.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(DependSuffix): ./XML2CPP/XML2CPP.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(DependSuffix) -MM ./XML2CPP/XML2CPP.cpp + +$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(PreprocessSuffix): ./XML2CPP/XML2CPP.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(PreprocessSuffix) ./XML2CPP/XML2CPP.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix): ../../ThirdLib/include/XmlOpeation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix): ../../ThirdLib/include/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) -MM ../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix): ../../ThirdLib/include/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix) ../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinystr.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PluginMaker/XML2CPP/XML2CPP.cbp b/PluginMaker/XML2CPP/XML2CPP.cbp new file mode 100644 index 000000000..c0cc40887 --- /dev/null +++ b/PluginMaker/XML2CPP/XML2CPP.cbp @@ -0,0 +1,50 @@ + + + + + + diff --git a/PluginMaker/XML2CPP/XML2CPP.depend b/PluginMaker/XML2CPP/XML2CPP.depend new file mode 100644 index 000000000..33e6a20de --- /dev/null +++ b/PluginMaker/XML2CPP/XML2CPP.depend @@ -0,0 +1,95 @@ +# depslib dependency file v1.0 +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp + "tinystr.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.h + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp + + + + "tinyxml.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.h + + + + + + + + + "tinystr.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp + "tinyxml.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp + + + "tinyxml.h" + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/XmlOpeation.cpp + "XmlOpeation.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/XmlOpeation.h + "tinyxml.h" + "tinystr.h" + "Common.h" + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Common.h + + + + "winsock2.h" + + + + + + + + + + +1551867304 source:/data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/ParseCAPIFile.cpp + "ParseCAPIFile.h" + +1551867304 /data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/ParseCAPIFile.h + "Common.h" + + +1553358157 source:/data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/XML2CPP.cpp + + + "Write_Packet_Parse_cpp.h" + "Write_Plugin_Main_cpp.h" + "Write_Plugin_Command.h" + "Write_Plugin_Make.h" + "Write_Plugin_Logic.h" + +1551867304 /data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/Write_Packet_Parse_cpp.h + "XmlOpeation.h" + +1551867304 /data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/Write_Plugin_Main_cpp.h + "XmlOpeation.h" + +1551867304 /data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/Write_Plugin_Command.h + "XmlOpeation.h" + +1551867304 /data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/Write_Plugin_Make.h + "XmlOpeation.h" + +1551867304 /data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/Write_Plugin_Logic.h + "XmlOpeation.h" + "ParseCAPIFile.h" + diff --git a/PluginMaker/XML2CPP/XML2CPP.layout b/PluginMaker/XML2CPP/XML2CPP.layout new file mode 100644 index 000000000..f4a27d3bd --- /dev/null +++ b/PluginMaker/XML2CPP/XML2CPP.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/PluginMaker/XML2CPP/XML2CPP.mk b/PluginMaker/XML2CPP/XML2CPP.mk new file mode 100644 index 000000000..c0a6e32eb --- /dev/null +++ b/PluginMaker/XML2CPP/XML2CPP.mk @@ -0,0 +1,158 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=XML2CPP +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="XML2CPP.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -O0 +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/thirdparty $(IncludeSwitch)../../ThirdLib/src +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -g -Wall $(Preprocessors) +CFLAGS := $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(ObjectSuffix) $(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(ObjectSuffix): ./XML2CPP/ParseCAPIFile.cpp $(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/ParseCAPIFile.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(DependSuffix): ./XML2CPP/ParseCAPIFile.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(DependSuffix) -MM ./XML2CPP/ParseCAPIFile.cpp + +$(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(PreprocessSuffix): ./XML2CPP/ParseCAPIFile.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/XML2CPP_ParseCAPIFile.cpp$(PreprocessSuffix) ./XML2CPP/ParseCAPIFile.cpp + +$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(ObjectSuffix): ./XML2CPP/XML2CPP.cpp $(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PluginMaker/XML2CPP/XML2CPP/XML2CPP.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(DependSuffix): ./XML2CPP/XML2CPP.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(DependSuffix) -MM ./XML2CPP/XML2CPP.cpp + +$(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(PreprocessSuffix): ./XML2CPP/XML2CPP.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/XML2CPP_XML2CPP.cpp$(PreprocessSuffix) ./XML2CPP/XML2CPP.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix): ../../ThirdLib/include/XmlOpeation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix): ../../ThirdLib/include/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) -MM ../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix): ../../ThirdLib/include/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix) ../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinystr.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PluginMaker/XML2CPP/XML2CPP.project b/PluginMaker/XML2CPP/XML2CPP.project new file mode 100644 index 000000000..f8ab62e6f --- /dev/null +++ b/PluginMaker/XML2CPP/XML2CPP.project @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PluginMaker/XML2CPP/XML2CPP.sln b/PluginMaker/XML2CPP/XML2CPP.sln deleted file mode 100644 index 821da35c2..000000000 --- a/PluginMaker/XML2CPP/XML2CPP.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XML2CPP", "XML2CPP\XML2CPP.vcxproj", "{F5BFBE54-E2D1-46AA-96C1-090ACC0CF420}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F5BFBE54-E2D1-46AA-96C1-090ACC0CF420}.Debug|Win32.ActiveCfg = Debug|Win32 - {F5BFBE54-E2D1-46AA-96C1-090ACC0CF420}.Debug|Win32.Build.0 = Debug|Win32 - {F5BFBE54-E2D1-46AA-96C1-090ACC0CF420}.Release|Win32.ActiveCfg = Release|Win32 - {F5BFBE54-E2D1-46AA-96C1-090ACC0CF420}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/PluginMaker/XML2CPP/XML2CPP.txt b/PluginMaker/XML2CPP/XML2CPP.txt new file mode 100644 index 000000000..2b720e5ab --- /dev/null +++ b/PluginMaker/XML2CPP/XML2CPP.txt @@ -0,0 +1 @@ +../../Build/Linux/Temp/XML2CPP_ParseCAPIFile.cpp.o ../../Build/Linux/Temp/XML2CPP_XML2CPP.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_XmlOpeation.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxml.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinystr.cpp.o diff --git a/PluginMaker/XML2CPP/XML2CPP/Common.h b/PluginMaker/XML2CPP/XML2CPP/Common.h deleted file mode 100644 index eb209ea5e..000000000 --- a/PluginMaker/XML2CPP/XML2CPP/Common.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _COMMON_H -#define _COMMON_H - -#include -#include -#include -#include -#include -#include - -// -#define MAX_CODE_LINE_SIZE 1024 - -inline void sprintf_safe(char* szText, int nLen, const char* fmt ...) -{ - if(szText == NULL) - { - return; - } - - va_list ap; - va_start(ap, fmt); - - vsnprintf(szText, nLen, fmt, ap); - szText[nLen - 1] = '\0'; - - va_end(ap); -}; - -static void To_Upper_String(const char* pSrc, char* pRet) -{ - int nLen = (int)strlen(pSrc); - - for(int i = 0; i < nLen; i++) - { - pRet[i] = toupper(pSrc[i]); - } - - pRet[nLen] = '\0'; -} - -#endif - diff --git a/PluginMaker/XML2CPP/XML2CPP/Makefile b/PluginMaker/XML2CPP/XML2CPP/Makefile deleted file mode 100644 index c8678a90a..000000000 --- a/PluginMaker/XML2CPP/XML2CPP/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -include Makefile.define - -# Ĭϳ -default:all - -# Ӧļб -PATS = ./TinyXML/tinystr.o ./TinyXML/tinyxml.o ./TinyXML/tinyxmlerror.o ./TinyXML/tinyxmlparser.o \ - XmlOpeation.o XML2CPP.o - -LIB_BASE_OBJS = tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o \ - XmlOpeation.o XML2CPP.o -LIB_BASE = XML2CPP - -all: XML2CPP clear - -# Ӧó -all:$(LIB_BASE) Makefile - -$(LIB_BASE):$(PATS) - $(CC) -rdynamic -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) - -# -clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv XML2CPP ./Bin -cl: - rm -rf *.o diff --git a/PluginMaker/XML2CPP/XML2CPP/Makefile.define b/PluginMaker/XML2CPP/XML2CPP/Makefile.define deleted file mode 100644 index d7313a02a..000000000 --- a/PluginMaker/XML2CPP/XML2CPP/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I ./TinyXML -LIBS = -L/usr/lib64 -L/usr/local/lib64 -L./ -L../ -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/PluginMaker/XML2CPP/XML2CPP/XML2CPP.cpp b/PluginMaker/XML2CPP/XML2CPP/XML2CPP.cpp index ad0d41c02..41b4ce4aa 100644 --- a/PluginMaker/XML2CPP/XML2CPP/XML2CPP.cpp +++ b/PluginMaker/XML2CPP/XML2CPP/XML2CPP.cpp @@ -60,7 +60,7 @@ int main(int argc, char* argv[]) #ifdef WIN32 _mkdir(objProjectInfo.m_szProjectName); #else - mkdir(objProjectInfo.m_szProjectName); + mkdir(objProjectInfo.m_szProjectName,0777); #endif //дļ diff --git a/PluginMaker/XML2CPP/XML2CPP/XML2CPP.vcproj b/PluginMaker/XML2CPP/XML2CPP/XML2CPP.vcproj deleted file mode 100644 index b4ffe3cda..000000000 --- a/PluginMaker/XML2CPP/XML2CPP/XML2CPP.vcproj +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PluginMaker/XML2CPP/XML2CPP/XML2CPP.vcxproj b/PluginMaker/XML2CPP/XML2CPP/XML2CPP.vcxproj deleted file mode 100644 index ac1b6f61b..000000000 --- a/PluginMaker/XML2CPP/XML2CPP/XML2CPP.vcxproj +++ /dev/null @@ -1,117 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {F5BFBE54-E2D1-46AA-96C1-090ACC0CF420} - XML2CPP - Win32Proj - - - - Application - v140 - Unicode - true - - - Application - v140 - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - .\Bin\ - $(Configuration)\ - true - - - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - - - - Disabled - ./TinyXML;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level3 - EditAndContinue - - - true - Console - MachineX86 - - - - - MaxSpeed - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - Level3 - ProgramDatabase - - - true - Console - true - true - MachineX86 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PluginMaker/XML2CPP/XML2CPP/XmlOpeation.cpp b/PluginMaker/XML2CPP/XML2CPP/XmlOpeation.cpp deleted file mode 100644 index 941ac386e..000000000 --- a/PluginMaker/XML2CPP/XML2CPP/XmlOpeation.cpp +++ /dev/null @@ -1,430 +0,0 @@ -#include "XmlOpeation.h" - -CXmlOpeation::CXmlOpeation(void) -{ - m_pTiXmlDocument = NULL; - m_pRootElement = NULL; -} - -CXmlOpeation::~CXmlOpeation(void) -{ - Close(); -} - -bool CXmlOpeation::Init(const char* pFileName) -{ - Close(); - m_pTiXmlDocument = new TiXmlDocument(pFileName); - if(NULL == m_pTiXmlDocument) - { - return false; - } - - if(false == m_pTiXmlDocument->LoadFile()) - { - return false; - } - - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - return true; -} - -bool CXmlOpeation::Init_String(const char* pXMLText) -{ - //ַ - Close(); - m_pTiXmlDocument = new TiXmlDocument(); - m_pTiXmlDocument->Parse(pXMLText, 0, TIXML_DEFAULT_ENCODING); - - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - return true; -} - -void CXmlOpeation::Close() -{ - if(NULL != m_pTiXmlDocument) - { - delete m_pTiXmlDocument; - m_pTiXmlDocument = NULL; - m_pRootElement = NULL; - } -} - -char* CXmlOpeation::GetData(const char* pName, const char* pAttrName) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = m_pRootElement->FirstChildElement(pName); - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->Attribute(pAttrName); - } - - return NULL; -} - -char* CXmlOpeation::GetData(const char* pName, const char* pAttrName, TiXmlElement*& pNextTiXmlElement) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = NULL; - if(NULL == pNextTiXmlElement) - { - pTiXmlElement = m_pRootElement->FirstChildElement(pName); - pNextTiXmlElement = pTiXmlElement; - } - else - { - pTiXmlElement = pNextTiXmlElement->NextSiblingElement(); - pNextTiXmlElement = pTiXmlElement; - } - - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->Attribute(pAttrName); - } - - return NULL; -} - -char* CXmlOpeation::GetData_Text(const char* pName) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = m_pRootElement->FirstChildElement(pName); - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->GetText(); - } - - return NULL; -} - -char* CXmlOpeation::GetData_Text(const char* pName, TiXmlElement*& pNextTiXmlElement) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = NULL; - if(NULL == pNextTiXmlElement) - { - pTiXmlElement = m_pRootElement->FirstChildElement(pName); - pNextTiXmlElement = pTiXmlElement; - } - else - { - pTiXmlElement = pNextTiXmlElement->NextSiblingElement(); - pNextTiXmlElement = pTiXmlElement; - } - - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->GetText(); - } - - return NULL; -} - -bool CXmlOpeation::Parse_Class_File(const char* pFileName, vecClassInfo& objvecClassInfo) -{ - Close(); - m_pTiXmlDocument = new TiXmlDocument(pFileName); - if(NULL == m_pTiXmlDocument) - { - return false; - } - - if(false == m_pTiXmlDocument->LoadFile()) - { - Close(); - return false; - } - - TiXmlNode* pMainNode = NULL; - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - //ѭӡÿһ - if(NULL == m_pRootElement) - { - return false; - } - - //øԪصԪ - for(pMainNode = m_pRootElement->FirstChildElement();pMainNode;pMainNode=pMainNode->NextSiblingElement()) - { - _Class_Info objClassInfo; - - int nMainType = pMainNode->Type(); - - if(nMainType != TiXmlText::TINYXML_ELEMENT) - { - continue; - } - - TiXmlElement* pMainElement = pMainNode->ToElement(); - - //Ԫص - sprintf_safe(objClassInfo.m_szXMLName, 60, pMainElement->Value()); - sprintf_safe(objClassInfo.m_szDesc, 100, "%s", pMainElement->Attribute("desc")); - - //printf("Root=%s.\n", m_pRootElement->Value()); - - TiXmlNode* pNode = NULL; - - for(pNode = pMainElement->FirstChildElement();pNode;pNode=pNode->NextSiblingElement()) - { - int nType = pNode->Type(); - if(nType == TiXmlText::TINYXML_ELEMENT) - { - //printf("Name=%s,Values=%s.\n", pNode->Value(), pNode->ToElement()->GetText()); - _Property objProperty; - sprintf_safe(objProperty.m_szPropertyName, 50, "%s", pNode->Value()); - if(strcmp(pNode->ToElement()->GetText(), "char") == 0) - { - objProperty.m_emType = PROPERTY_CHAR; - - //ͬʱַ󳤶 - char* pLength = (char* )pNode->ToElement()->Attribute("length"); - if(NULL != pLength) - { - objProperty.m_nLength = (int)atoi(pLength); - } - - //Streamָ - char* pStreamLength = (char* )pNode->ToElement()->Attribute("StreamLength"); - if(NULL != pStreamLength) - { - sprintf_safe(objProperty.m_szStreamLength, 10, "%s", pStreamLength); - } - } - else if(strcmp(pNode->ToElement()->GetText(), "string") == 0) - { - objProperty.m_emType = PROPERTY_STRING; - } - else if(strcmp(pNode->ToElement()->GetText(), "uint8") == 0) - { - objProperty.m_emType = PROPERTY_UINT8; - } - else if(strcmp(pNode->ToElement()->GetText(), "uint16") == 0) - { - objProperty.m_emType = PROPERTY_UINT16; - } - else if(strcmp(pNode->ToElement()->GetText(), "uint32") == 0) - { - objProperty.m_emType = PROPERTY_UINT32; - } - else if(strcmp(pNode->ToElement()->GetText(), "uint64") == 0) - { - objProperty.m_emType = PROPERTY_UINT64; - } - else if(strcmp(pNode->ToElement()->GetText(), "int8") == 0) - { - objProperty.m_emType = PROPERTY_INT8; - } - else if(strcmp(pNode->ToElement()->GetText(), "int16") == 0) - { - objProperty.m_emType = PROPERTY_INT16; - } - else if(strcmp(pNode->ToElement()->GetText(), "int32") == 0) - { - objProperty.m_emType = PROPERTY_INT32; - } - else if(strcmp(pNode->ToElement()->GetText(), "float32") == 0) - { - objProperty.m_emType = PROPERTY_FLOAT32; - } - else if(strcmp(pNode->ToElement()->GetText(), "float64") == 0) - { - objProperty.m_emType = PROPERTY_FLOAT64; - } - else - { - //ǻͣ - objProperty.m_emType = PROPERTY_UNKNOW; - sprintf_safe(objProperty.m_szClassName, 100, "%s", pNode->ToElement()->GetText()); - } - - //鿴 - if(NULL != pNode->ToElement()->Attribute("class")) - { - if(strcmp(pNode->ToElement()->Attribute("class"), "vector") == 0) - { - objProperty.m_emClass = CLASS_VECTOR; - } - else if(strcmp(pNode->ToElement()->Attribute("class"), "map") == 0) - { - objProperty.m_emClass = CLASS_MAP; - - //map 鿴keyNamekeyType - sprintf_safe(objProperty.m_szKeyName, 100, "%s", pNode->ToElement()->Attribute("keyName")); - - if(strcmp(pNode->ToElement()->Attribute("KeyClass"), "string") == 0) - { - objProperty.m_emKeyType = PROPERTY_STRING; - } - else if(strcmp(pNode->ToElement()->Attribute("KeyClass"), "uint16") == 0) - { - objProperty.m_emKeyType = PROPERTY_UINT16; - } - else if(strcmp(pNode->ToElement()->Attribute("KeyClass"), "uint32") == 0) - { - objProperty.m_emKeyType = PROPERTY_UINT32; - } - } - } - - //õϢ - sprintf_safe(objProperty.m_szDesc, 100, "%s", pNode->ToElement()->Attribute("desc")); - objClassInfo.m_vecProperty.push_back(objProperty); - } - } - - objvecClassInfo.push_back(objClassInfo); - } - - Close(); - return true; -} - -bool CXmlOpeation::Parse_Plug_In_Project(const char* pFileName, _Project_Info& objProjectInfo) -{ - Close(); - m_pTiXmlDocument = new TiXmlDocument(pFileName); - if(NULL == m_pTiXmlDocument) - { - return false; - } - - if(false == m_pTiXmlDocument->LoadFile()) - { - Close(); - return false; - } - - TiXmlNode* pMainNode = NULL; - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - //ѭӡÿһ - if(NULL == m_pRootElement) - { - return false; - } - - //ͷԪ - char* pName = (char* )m_pRootElement->Attribute("Name"); - if(NULL != pName) - { - sprintf_safe(objProjectInfo.m_szProjectName, 100, "%s", pName); - } - - char* pDesc = (char* )m_pRootElement->Attribute("desc"); - if(NULL != pDesc) - { - sprintf_safe(objProjectInfo.m_szProjectDesc, 200, "%s", pDesc); - } - - char* pKeyID = (char* )m_pRootElement->Attribute("keyID"); - if(NULL != pKeyID) - { - sprintf_safe(objProjectInfo.m_szProjectKey, 100, "%s", pKeyID); - } - - //е - TiXmlNode* pNode = NULL; - for(pNode = m_pRootElement->FirstChildElement();pNode;pNode=pNode->NextSiblingElement()) - { - TiXmlElement* pSecondElement = pNode->ToElement(); - if(strcmp(pSecondElement->Value(), "Define") == 0) - { - _Define_Info obj_Define_Info; - char* pTemp = (char* )pSecondElement->Attribute("DefName"); - if(NULL != pTemp) - { - sprintf_safe(obj_Define_Info.m_szDefineName, 100, "%s", pTemp); - } - pTemp = (char* )pSecondElement->Attribute("type"); - if(NULL != pTemp) - { - sprintf_safe(obj_Define_Info.m_szType, 20, "%s", pTemp); - } - pTemp = (char* )pSecondElement->Attribute("DefValue"); - if(NULL != pTemp) - { - sprintf_safe(obj_Define_Info.m_szDefineValue, 100, "%s", pTemp); - } - objProjectInfo.m_objDefineInfoList.push_back(obj_Define_Info); - } - else if(strcmp(pSecondElement->Value(), "Command") == 0) - { - _Command_Info obj_Command_Info; - char* pTemp = (char* )pSecondElement->Attribute("CommandIn"); - if(NULL != pTemp) - { - sprintf_safe(obj_Command_Info.m_szCommandInID, 50, "%s", pTemp); - } - pTemp = (char* )pSecondElement->Attribute("CommandOut"); - if(NULL != pTemp) - { - sprintf_safe(obj_Command_Info.m_szCommandOutID, 50, "%s", pTemp); - } - pTemp = (char* )pSecondElement->Attribute("FuncName"); - if(NULL != pTemp) - { - sprintf_safe(obj_Command_Info.m_szCommandFuncName, 100, "%s", pTemp); - } - - TiXmlNode* pObjectNode = NULL; - for(pObjectNode = pSecondElement->FirstChildElement();pObjectNode;pObjectNode=pObjectNode->NextSiblingElement()) - { - _Object_Info obj_Object_Info; - TiXmlElement* pThreeElement = pObjectNode->ToElement(); - - pTemp = (char* )pThreeElement->Attribute("class"); - if(NULL != pTemp) - { - sprintf_safe(obj_Object_Info.m_szClassName, 50, "%s", pTemp); - } - pTemp = (char* )pThreeElement->Attribute("PacketType"); - if(NULL != pTemp) - { - if(strcmp(pTemp, "HEAD") == 0) - { - obj_Object_Info.m_emPacketType = PACKET_TYPE_HEAD; - } - else if(strcmp(pTemp, "BODY") == 0) - { - obj_Object_Info.m_emPacketType = PACKET_TYPE_BODY; - } - else if(strcmp(pTemp, "RETURN") == 0) - { - obj_Object_Info.m_emPacketType = PACKET_TYPE_RETURN; - } - } - - obj_Command_Info.m_vecObjectInfo.push_back(obj_Object_Info); - } - - objProjectInfo.m_objCommandList.push_back(obj_Command_Info); - } - } - - Close(); - return true; -} \ No newline at end of file diff --git a/PluginMaker/XML2CPP/XML2CPP/XmlOpeation.h b/PluginMaker/XML2CPP/XML2CPP/XmlOpeation.h deleted file mode 100644 index b39ee3054..000000000 --- a/PluginMaker/XML2CPP/XML2CPP/XmlOpeation.h +++ /dev/null @@ -1,233 +0,0 @@ -#ifndef _XMLOPRATION_H -#define _XMLOPRATION_H - -#include "tinyxml.h" -#include "tinystr.h" - -#include "Common.h" - -using namespace std; - -//XMLתΪMAPṹ -//add by freeeyes - -//֧ -enum PROPERTY_TYPE -{ - PROPERTY_UNKNOW, - PROPERTY_CHAR, - PROPERTY_STRING, - PROPERTY_UINT8, - PROPERTY_UINT16, - PROPERTY_UINT32, - PROPERTY_UINT64, - PROPERTY_INT8, - PROPERTY_INT16, - PROPERTY_INT32, - PROPERTY_FLOAT32, - PROPERTY_FLOAT64, -}; - -enum PROPERTY_CLASS -{ - CLASS_SINGLE, - CLASS_VECTOR, - CLASS_MAP, -}; - -enum COMMAND_TYPE -{ - COMMAND_NONE, - COMMAND_IN, - COMMAND_OUT, -}; - -enum STREAM_TYPE -{ - STREAM_TYPE_STRING = 0, - STREAM_TYPE_CHAR, - STREAM_TYPE_ALL, -}; - -enum PACKET_TYPE -{ - PACKET_TYPE_HEAD = 0, - PACKET_TYPE_BODY, - PACKET_TYPE_RETURN, -}; - -//õStream -struct _Stream_Type_Info -{ - STREAM_TYPE m_emType; - int m_nLength; - - _Stream_Type_Info() - { - m_emType = STREAM_TYPE_STRING; - m_nLength = 0; - } -}; - -//Ԥṹ -struct _Define_Info -{ - char m_szDefineName[100]; - char m_szType[20]; - char m_szDefineValue[100]; - - _Define_Info() - { - m_szDefineName[0] = '\0'; - m_szType[0] = '\0'; - m_szDefineValue[0] = '\0'; - } -}; -typedef vector<_Define_Info> vecDefineInfo; - - -//Ϣ -struct _Property -{ - char m_szPropertyName[50]; // - char m_szClassName[50]; // - char m_szDesc[100]; //Ϣ - char m_szStreamLength[10]; //ݳ - PROPERTY_TYPE m_emType; // - PROPERTY_CLASS m_emClass; // - int m_nLength; // - int m_nNeedHeadLength; //ǷҪԶ׷ݳ 0׷ӣ1׷ - char m_szKeyName[50]; //KeyName - PROPERTY_TYPE m_emKeyType; //key - - _Property() - { - m_szPropertyName[0] = '\0'; - m_szClassName[0] = '\0'; - m_szDesc[0] = '\0'; - m_szKeyName[0] = '\0'; - m_emType = PROPERTY_UNKNOW; - m_emKeyType = PROPERTY_UNKNOW; - m_emClass = CLASS_SINGLE; - m_nLength = 0; - m_nNeedHeadLength = 0; - - sprintf_safe(m_szStreamLength, 10, "0"); - } - - _Stream_Type_Info Get_Stream_Info() - { - _Stream_Type_Info obj_Stream_Type_Info; - if(strcmp(m_szStreamLength, "all") == 0) - { - obj_Stream_Type_Info.m_emType = STREAM_TYPE_ALL; - obj_Stream_Type_Info.m_nLength = 0; - return obj_Stream_Type_Info; - } - else - { - int n_Stream_Length = atoi(m_szStreamLength); - if(0 == n_Stream_Length) - { - obj_Stream_Type_Info.m_emType = STREAM_TYPE_STRING; - obj_Stream_Type_Info.m_nLength = 0; - return obj_Stream_Type_Info; - } - else - { - obj_Stream_Type_Info.m_emType = STREAM_TYPE_CHAR; - obj_Stream_Type_Info.m_nLength = n_Stream_Length; - return obj_Stream_Type_Info; - } - } - } -}; -typedef vector<_Property> vecProperty; - -//Ϣ -struct _Class_Info -{ - char m_szXMLName[60]; - char m_szDesc[100]; - vecProperty m_vecProperty; - - _Class_Info() - { - m_szXMLName[0] = '\0'; - m_szDesc[0] = '\0'; - } -}; -typedef vector<_Class_Info> vecClassInfo; - -struct _Object_Info -{ - char m_szClassName[50]; - PACKET_TYPE m_emPacketType; - - _Object_Info() - { - m_szClassName[0] = '\0'; - m_emPacketType = PACKET_TYPE_HEAD; - } -}; -typedef vector<_Object_Info> vecObjectInfo; - -struct _Command_Info -{ - char m_szCommandFuncName[100]; - char m_szCommandInID[50]; - char m_szCommandOutID[50]; - - vecObjectInfo m_vecObjectInfo; - - _Command_Info() - { - m_szCommandFuncName[0] = '\0'; - m_szCommandInID[0] = '\0'; - m_szCommandOutID[0] = '\0'; - } -}; -typedef vector<_Command_Info> vecCommandRelationinfo; - -struct _Project_Info -{ - char m_szProjectName[100]; // - char m_szProjectDesc[200]; // - char m_szProjectKey[100]; //key - - vecCommandRelationinfo m_objCommandList; //ϵ - vecDefineInfo m_objDefineInfoList; //ԤϢ - - _Project_Info() - { - m_szProjectName[0] = '\0'; - m_szProjectDesc[0] = '\0'; - m_szProjectKey[0] = '\0'; - } -}; - -class CXmlOpeation -{ -public: - CXmlOpeation(void); - ~CXmlOpeation(void); - - bool Init(const char* pFileName); - bool Init_String(const char* pXMLText); - - char* GetData(const char* pName, const char* pAttrName); - char* GetData(const char* pName, const char* pAttrName, TiXmlElement*& pNextTiXmlElement); - - char* GetData_Text(const char* pName); - char* GetData_Text(const char* pName, TiXmlElement*& pNextTiXmlElement); - - bool Parse_Class_File(const char* pFileName, vecClassInfo& objvecClassInfo); - bool Parse_Plug_In_Project(const char* pFileName, _Project_Info& objProjectInfo); - - void Close(); - -private: - TiXmlDocument* m_pTiXmlDocument; - TiXmlElement* m_pRootElement; -}; -#endif diff --git a/PssSampleClient/AutoTestClient/AutoTestClient.cbp b/PssSampleClient/AutoTestClient/AutoTestClient.cbp new file mode 100644 index 000000000..6479e3a5b --- /dev/null +++ b/PssSampleClient/AutoTestClient/AutoTestClient.cbp @@ -0,0 +1,47 @@ + + + + + + diff --git a/PssSampleClient/AutoTestClient/AutoTestClient.depend b/PssSampleClient/AutoTestClient/AutoTestClient.depend new file mode 100644 index 000000000..a9d495160 --- /dev/null +++ b/PssSampleClient/AutoTestClient/AutoTestClient.depend @@ -0,0 +1,25 @@ +# depslib dependency file v1.0 +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp + + + + "sock_wrap.h" + + + + + + + + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.h + + + + + + + + + + diff --git a/PssSampleClient/AutoTestClient/AutoTestClient.layout b/PssSampleClient/AutoTestClient/AutoTestClient.layout new file mode 100644 index 000000000..6044234ee --- /dev/null +++ b/PssSampleClient/AutoTestClient/AutoTestClient.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/PssSampleClient/AutoTestClient/AutoTestClient.mk b/PssSampleClient/AutoTestClient/AutoTestClient.mk new file mode 100644 index 000000000..c77f709e3 --- /dev/null +++ b/PssSampleClient/AutoTestClient/AutoTestClient.mk @@ -0,0 +1,158 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=AutoTestClient +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/PssSampleClient/AutoTestClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="AutoTestClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/thirdparty +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)pthread +ArLibs := "libpthread.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(Preprocessors) +CFLAGS := -O2 -Wall $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(ObjectSuffix): ./AutoTestClient/AutoTestClient.cpp $(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/AutoTestClient/AutoTestClient/AutoTestClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(DependSuffix): ./AutoTestClient/AutoTestClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(DependSuffix) -MM ./AutoTestClient/AutoTestClient.cpp + +$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(PreprocessSuffix): ./AutoTestClient/AutoTestClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(PreprocessSuffix) ./AutoTestClient/AutoTestClient.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix): ../../ThirdLib/include/XmlOpeation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix): ../../ThirdLib/include/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) -MM ../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix): ../../ThirdLib/include/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix) ../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinystr.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/AutoTestClient/AutoTestClient.project b/PssSampleClient/AutoTestClient/AutoTestClient.project new file mode 100644 index 000000000..e15b37a9a --- /dev/null +++ b/PssSampleClient/AutoTestClient/AutoTestClient.project @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + diff --git a/PssSampleClient/AutoTestClient/AutoTestClient.sln b/PssSampleClient/AutoTestClient/AutoTestClient.sln deleted file mode 100644 index 803c502e0..000000000 --- a/PssSampleClient/AutoTestClient/AutoTestClient.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoTestClient", "AutoTestClient\AutoTestClient.vcxproj", "{751C180A-FFF7-4D64-A497-C8D9A14F3630}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {751C180A-FFF7-4D64-A497-C8D9A14F3630}.Debug|Win32.ActiveCfg = Debug|Win32 - {751C180A-FFF7-4D64-A497-C8D9A14F3630}.Debug|Win32.Build.0 = Debug|Win32 - {751C180A-FFF7-4D64-A497-C8D9A14F3630}.Release|Win32.ActiveCfg = Release|Win32 - {751C180A-FFF7-4D64-A497-C8D9A14F3630}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/PssSampleClient/AutoTestClient/AutoTestClient.txt b/PssSampleClient/AutoTestClient/AutoTestClient.txt new file mode 100644 index 000000000..a980a54f9 --- /dev/null +++ b/PssSampleClient/AutoTestClient/AutoTestClient.txt @@ -0,0 +1 @@ +../../Build/Linux/Temp/up_up_ThirdLib_thirdparty_sock_wrap.cpp.o ../../Build/Linux/Temp/AutoTestClient_AutoTestClient.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_XmlOpeation.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxml.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinystr.cpp.o diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/AutoTestClient.cpp b/PssSampleClient/AutoTestClient/AutoTestClient/AutoTestClient.cpp index 2e03b892c..4fd6240fa 100644 --- a/PssSampleClient/AutoTestClient/AutoTestClient/AutoTestClient.cpp +++ b/PssSampleClient/AutoTestClient/AutoTestClient/AutoTestClient.cpp @@ -1,22 +1,14 @@ // AutoTestClient.cpp : ̨Ӧóڵ㡣 // +#include +#include #include "XmlOpeation.h" -#include "TcpSocketClient.h" -#ifdef WIN32 -#include -#else -#include -#endif +#include "sock_wrap.h" #define XML_PATH "XML_Packet" #define XML_FILE_RESULT "Auto_Test_Resault.html" -#ifdef WIN32 -typedef HANDLE Thread_Mutex; -#else -typedef pthread_mutex_t Thread_Mutex -#endif struct _Thread_Info { @@ -26,7 +18,7 @@ struct _Thread_Info int nPort; short sOrder; int nThreadID; - Thread_Mutex mutex; + std::mutex mutex; _Thread_Info() { @@ -39,63 +31,13 @@ struct _Thread_Info } }; -//߳ -Thread_Mutex Create_Mutex() -{ - Thread_Mutex mutex; -#ifdef WIN32 - mutex = CreateMutex(NULL, FALSE, NULL); -#else - pthread_mutex_init(&mutex, NULL); -#endif - return mutex; -} - -//߳ -static void Close_Mutex(Thread_Mutex& mutex) -{ -#ifdef WIN32 - CloseHandle(mutex); -#else - pthread_mutex_destroy(&mutex, NULL); -#endif -} - -//߳ -static void Lock(Thread_Mutex& mutex) -{ - if(NULL != mutex) - { -#ifdef WIN32 - WaitForSingleObject(mutex, INFINITE); -#else - pthread_mutex_lock(&mutex); -#endif - } -} - -//߳ -static void UnLock(Thread_Mutex& mutex) -{ - if(NULL != mutex) - { -#ifdef WIN32 - ReleaseMutex(mutex); -#else - pthread_mutex_unlock(&mutex); -#endif - } -} //вӼ -#ifdef WIN32 -DWORD WINAPI Run_Test(LPVOID arg) -#else void* Run_Test(void * arg) -#endif + { //Զ̲ - ODSocket obj_ODSocket; + //ODSocket obj_ODSocket; string strContent; string strTime; @@ -103,14 +45,20 @@ void* Run_Test(void * arg) printf("[Run_Test]obj_Command_Info.m_szCommandName=%s.\n", p_Thread_Info->p_Command_Info->m_szCommandName); - obj_ODSocket.Init(); - obj_ODSocket.Create(AF_INET, SOCK_STREAM, 0); - bool blState = obj_ODSocket.Connect(p_Thread_Info->szIP, p_Thread_Info->nPort, 5); + //obj_ODSocket.Init(); + //obj_ODSocket.Create(AF_INET, SOCK_STREAM, 0); + //bool blState = obj_ODSocket.Connect(p_Thread_Info->szIP, p_Thread_Info->nPort, 5); + + InitializeSocketEnvironment(); + HSocket obj_ODSocket =SocketOpen(SOCK_STREAM); + sockaddr_in addr; + GetAddressFrom(&addr, p_Thread_Info->szIP, p_Thread_Info->nPort); + bool blState = SocketConnect(obj_ODSocket, &addr); if(false == blState) { - Lock(p_Thread_Info->mutex); + std::lock_guard lock(p_Thread_Info->mutex); Create_TD_Content(p_Thread_Info->pFile, "error", p_Thread_Info->p_Command_Info->m_szCommandName, "ӽʧ", strTime.c_str()); - UnLock(p_Thread_Info->mutex); + return 0; } @@ -126,8 +74,12 @@ void* Run_Test(void * arg) bool blSendFlag = false; int nCurrSend = 0; while(true) - { - int nDataLen = obj_ODSocket.Send(&pSend[nCurrSend], nSendLen - nCurrSend); + { + //int nDataLen = obj_ODSocket.Send(&pSend[nCurrSend], nSendLen - nCurrSend); + + transresult_t rt; + SocketSend(obj_ODSocket, &pSend[nCurrSend], nSendLen - nCurrSend, rt); + int nDataLen = rt.nbytes; if(nDataLen < 0) { strContent = "ݰʧ"; @@ -141,7 +93,7 @@ void* Run_Test(void * arg) } else { - nCurrSend += nDataLen; + nCurrSend += nDataLen; } } delete pSend; @@ -161,7 +113,12 @@ void* Run_Test(void * arg) int nCurrRecv = 0; while(true) { - int nDataLen = obj_ODSocket.Recv(&pRecv[nCurrRecv], nRecvLen - nCurrRecv); + //int nDataLen = obj_ODSocket.Recv(&pRecv[nCurrRecv], nRecvLen - nCurrRecv); + + transresult_t rt; + SocketRecv(obj_ODSocket, &pRecv[nCurrRecv], nRecvLen - nCurrRecv, rt); + int nDataLen = rt.nbytes; + if(nDataLen <= 0) { strContent = "շݰʧ"; @@ -176,7 +133,7 @@ void* Run_Test(void * arg) } else { - //հ + //հ nCurrRecv += nDataLen; } } @@ -207,7 +164,7 @@ void* Run_Test(void * arg) if(blIsError == true) { - Lock(p_Thread_Info->mutex); + std::lock_guard lock(p_Thread_Info->mutex); if(p_Thread_Info->nThreadID == 0) { Create_TD_Content(p_Thread_Info->pFile, "error", p_Thread_Info->p_Command_Info->m_szCommandName, strContent.c_str(), strTime.c_str()); @@ -218,11 +175,10 @@ void* Run_Test(void * arg) sprintf_safe(szName, MAX_BUFF_100, "%s(߳ID:%d)", p_Thread_Info->p_Command_Info->m_szCommandName, p_Thread_Info->nThreadID); Create_TD_Content(p_Thread_Info->pFile, "error", szName, strContent.c_str(), strTime.c_str()); } - UnLock(p_Thread_Info->mutex); } else { - Lock(p_Thread_Info->mutex); + std::lock_guard lock(p_Thread_Info->mutex); if(p_Thread_Info->nThreadID == 0) { Create_TD_Content(p_Thread_Info->pFile, "content", p_Thread_Info->p_Command_Info->m_szCommandName, strContent.c_str(), strTime.c_str()); @@ -233,9 +189,11 @@ void* Run_Test(void * arg) sprintf_safe(szName, MAX_BUFF_100, "%s(߳ID:%d)", p_Thread_Info->p_Command_Info->m_szCommandName, p_Thread_Info->nThreadID); Create_TD_Content(p_Thread_Info->pFile, "content", szName, strContent.c_str(), strTime.c_str()); } - UnLock(p_Thread_Info->mutex); } - obj_ODSocket.Close(); + //obj_ODSocket.Close(); + SocketClose(obj_ODSocket); + + FreeSocketEnvironment(); return 0; } @@ -255,7 +213,7 @@ void Run_Assemble_List(vec_Test_Assemble obj_Test_Assemble_List) for(int i = 0; i < (int)obj_Test_Assemble_List.size(); i++) { - Create_TD_Title(pFile, obj_Test_Assemble_List[i].m_szTestAssembleName, obj_Test_Assemble_List[i].m_szDesc, + Create_TD_Title(pFile, obj_Test_Assemble_List[i].m_szTestAssembleName, obj_Test_Assemble_List[i].m_szDesc, obj_Test_Assemble_List[i].m_szIP, obj_Test_Assemble_List[i].m_nPort); short sOrder = 0; @@ -266,7 +224,7 @@ void Run_Assemble_List(vec_Test_Assemble obj_Test_Assemble_List) for(int j = 0; j < (int)obj_Test_Assemble_List[i].m_obj_Command_Info_List.size(); j++) { - Thread_Mutex objmutex = Create_Mutex(); + //鿴ǷҪ߳ if(obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount == 1) @@ -277,7 +235,6 @@ void Run_Assemble_List(vec_Test_Assemble obj_Test_Assemble_List) sprintf_safe(p_Thread_Info->szIP, 50, "%s", obj_Test_Assemble_List[i].m_szIP); p_Thread_Info->nPort = obj_Test_Assemble_List[i].m_nPort; p_Thread_Info->sOrder = sOrder; - p_Thread_Info->mutex = objmutex; Run_Test((void* )p_Thread_Info); @@ -286,30 +243,11 @@ void Run_Assemble_List(vec_Test_Assemble obj_Test_Assemble_List) else { //̲߳ -#ifdef WIN32 _Thread_Info* threadinfoarray = new _Thread_Info[obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount]; - HANDLE* handleArray = new HANDLE[obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount]; - for(int k = 0; k < obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount; k++) - { - threadinfoarray[k].pFile = pFile; - threadinfoarray[k].p_Command_Info = &obj_Test_Assemble_List[i].m_obj_Command_Info_List[j]; - sprintf_safe(threadinfoarray[k].szIP, MAX_BUFF_50, "%s", obj_Test_Assemble_List[i].m_szIP); - threadinfoarray[k].nPort = obj_Test_Assemble_List[i].m_nPort; - threadinfoarray[k].sOrder = sOrder; - threadinfoarray[k].mutex = objmutex; - threadinfoarray[k].nThreadID = k + 1; - - DWORD ThID; - handleArray[k] = CreateThread(NULL, 0, Run_Test, (void* )&threadinfoarray[k], 0, &ThID); - } + std::vector threads; + - //ȴ߳̽ - WaitForMultipleObjects(2, handleArray, TRUE, INFINITE); - delete[] handleArray; - delete[] threadinfoarray; -#else - _Thread_Info* threadinfoarray = new _Thread_Info[obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount]; - pthread_t* handleArray = new pthread_t[obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount]; + //std::thread threads[obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount]; for(int k = 1; k <= obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount; k++) { threadinfoarray[k].pFile = pFile; @@ -317,24 +255,21 @@ void Run_Assemble_List(vec_Test_Assemble obj_Test_Assemble_List) sprintf_safe(threadinfoarray[k].szIP, MAX_BUFF_50, "%s", obj_Test_Assemble_List[i].m_szIP); threadinfoarray[k].nPort = obj_Test_Assemble_List[i].m_nPort; threadinfoarray[k].sOrder = sOrder; - threadinfoarray[k].mutex = objmutex; threadinfoarray[k].nThreadID = k; - pthread_create(&handleArray[k], NULL, &Run_Test, (void* )&threadinfoarray[k]); + threads.push_back(std::thread(Run_Test, (void* )&threadinfoarray[k])); + } //ȴ߳̽ for(int k = 1; k <= obj_Test_Assemble_List[i].m_obj_Command_Info_List[j].m_nThreadCount; k++) { - pthread_join(handleArray[k], NULL); + threads[k-1].join(); } - delete[] handleArray; delete[] threadinfoarray; -#endif } - Close_Mutex(objmutex); } } Create_HTML_End(pFile); diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/AutoTestClient.vcxproj b/PssSampleClient/AutoTestClient/AutoTestClient/AutoTestClient.vcxproj deleted file mode 100644 index a87370c53..000000000 --- a/PssSampleClient/AutoTestClient/AutoTestClient/AutoTestClient.vcxproj +++ /dev/null @@ -1,104 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {751C180A-FFF7-4D64-A497-C8D9A14F3630} - Win32Proj - AutoTestClient - - - - Application - true - v140 - Unicode - - - Application - false - v140 - true - Unicode - - - - - - - - - - - - - true - .\Bin - - - false - - - - - - Level3 - Disabled - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - ./TinyXML - - - Console - true - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/Common.h b/PssSampleClient/AutoTestClient/AutoTestClient/Common.h deleted file mode 100644 index be9e5fc81..000000000 --- a/PssSampleClient/AutoTestClient/AutoTestClient/Common.h +++ /dev/null @@ -1,694 +0,0 @@ -#ifndef COMMON_H -#define COMMON_H - -#include -#include -#ifdef _WIN32 -#include -#include "winsock2.h" -#else -#include -#include -#include -#include -#include -#include -#endif - -#include -#include -using namespace std; - - -//֧memcpyı߽ -inline bool memcpy_safe(char* pSrc, int nSrcLen, char* pDes, int nDesLen) -{ - if(nSrcLen > nDesLen) - { - return false; - } - else - { -#ifdef WIN32 - memcpy_s((void* )pDes, nDesLen, (void* )pSrc, (size_t)nSrcLen); -#else - memcpy((void* )pDes, (void* )pSrc, (size_t)nSrcLen); -#endif - return true; - } -} - -static unsigned long GetSystemTickCount() -{ -#ifdef WIN32 - return GetTickCount(); -#else - struct timespec ts; - - clock_gettime(CLOCK_MONOTONIC, &ts); - - return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000); -#endif -} - -//sprintf -static void sprintf_safe(char* szText, int nLen, const char* fmt ...) -{ - if(szText == NULL) - { - return; - } - - va_list ap; - va_start(ap, fmt); - - vsnprintf(szText, nLen, fmt, ap); - szText[nLen - 1] = '\0'; - - va_end(ap); -}; - -//ַתΪ -static int Char2Number(const char* pData) -{ - if(pData[0] == '0' && pData[1] == 'x') - { - //ʮת - return (int)strtol(pData, NULL, 16); - } - else - { - //ʮת - return (int)atoi(pData); - } -} - -//ַתAPI -static bool Get_binary_Char(unsigned char cTag, unsigned char& cDes) -{ - if(cTag >='A'&& cTag <='F') - { - cDes = cTag - 'A' + 10; - return true; - } - else if(cTag >='a'&& cTag <='f') - { - cDes = cTag - 'a' + 10; - return true; - } - else if(cTag >= '0'&& cTag<= '9') - { - cDes = cTag-'0'; - return true; - } - else - { - return false; - } -} - -static bool ConvertStr2char(const char* pData, unsigned char& cData) -{ - if(pData == NULL || strlen(pData) != 2) - { - return false; - } - - char cFirst = pData[1]; - unsigned char cTemp = 0; - bool blStste = Get_binary_Char(cFirst, cTemp); - if(false == blStste) - { - return false; - } - cData = cTemp; - char cSecond = pData[0]; - blStste = Get_binary_Char(cSecond, cTemp); - if(false == blStste) - { - return false; - } - cTemp = cTemp << 4; - cData = cData | cTemp; - - return true; -} - -//õתַ -static int GetBufferSize(const char* pData, int nSrcLen) -{ - char szData[3] = {'\0'}; - int nPos = 0; - int nCurrSize = 0; - int nConvertSize = 0; - bool blState = false; //תַǷЧ - bool blSrcState = true; //ԪַǷЧ - unsigned char cData; - - while(nPos < nSrcLen) - { - if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) - { - if(nPos == nSrcLen - 1) - { - szData[nCurrSize++] = pData[nPos]; - } - - szData[nCurrSize] = '\0'; - if(blSrcState == true) - { - blState = ConvertStr2char(szData, cData); - if(blState == true) - { - nConvertSize++; - } - } - nCurrSize = 0; - blSrcState = true; - nPos++; - } - else - { - if(nCurrSize < 2) - { - szData[nCurrSize++] = pData[nPos]; - } - else - { - blSrcState = false; - } - nPos++; - } - } - - return nConvertSize; -}; - -//ַתΪƴĴ -static bool Convertstr2charArray(const char* pData, int nSrcLen, unsigned char* pDes, int& nMaxLen) -{ - char szData[3] = {'\0'}; - int nPos = 0; - int nCurrSize = 0; - int nConvertSize = 0; - bool blState = false; //תַǷЧ - bool blSrcState = true; //ԪַǷЧ - - while(nPos < nSrcLen) - { - if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) - { - if(nPos == nSrcLen - 1) - { - szData[nCurrSize++] = pData[nPos]; - } - - szData[nCurrSize] = '\0'; - if(nConvertSize < nMaxLen && blSrcState == true) - { - blState = ConvertStr2char(szData, pDes[nConvertSize]); - if(blState == true) - { - nConvertSize++; - } - } - nCurrSize = 0; - blSrcState = true; - nPos++; - } - else - { - if(nCurrSize < 2) - { - szData[nCurrSize++] = pData[nPos]; - } - else - { - blSrcState = false; - } - nPos++; - } - } - - nMaxLen = nConvertSize; - return true; -}; - -typedef vector vec_Xml_File_Name; - -#define MAX_BUFF_50 50 -#define MAX_BUFF_100 100 -#define MAX_BUFF_500 500 - -//ݸʽ -struct _Data_Info -{ - char m_szDataName[MAX_BUFF_50]; - char m_szDataType[MAX_BUFF_50]; - int m_nLength; - bool m_blIsString; - string m_strValue; - - _Data_Info() - { - m_szDataName[0] = '\0'; - m_szDataType[0] = '\0'; - m_nLength = 0; - m_blIsString = true; - m_strValue = ""; - } -}; -typedef vector<_Data_Info> vec_Data_Info; - -struct _Packet_Send -{ - vec_Data_Info m_obj_Data_Info_List; - - int Get_Length() - { - int nSize = 0; - for(int i = 0; i < (int)m_obj_Data_Info_List.size(); i++) - { - if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "short") == 0) - { - nSize += 2; - } - else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "int") == 0) - { - nSize += 4; - } - else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "char") == 0) - { - if(m_obj_Data_Info_List[i].m_nLength > 0) - { - nSize += m_obj_Data_Info_List[i].m_nLength; - } - else - { - nSize += (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()); - } - } - } - - return nSize; - } - - // - void In_Stream(char* pData, int nLen, short sOrder) - { - int nPos = 0; - for(int i = 0; i < (int)m_obj_Data_Info_List.size(); i++) - { - if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "short") == 0) - { - short sData = (short)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str()); - if(sOrder == 1) - { - // - sData = htons(sData); - } - memcpy_safe((char* )&sData, 2, &pData[nPos], nLen - nPos); - nPos += 2; - } - else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "int") == 0) - { - int nData = (int)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str()); - if(sOrder == 1) - { - // - nData = htonl(nData); - } - memcpy_safe((char* )&nData, 4, &pData[nPos], nLen - nPos); - nPos += 4; - } - else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "char") == 0) - { - if(m_obj_Data_Info_List[i].m_nLength > 0) - { - if(m_obj_Data_Info_List[i].m_blIsString == true) - { - memcpy_safe((char* )m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_nLength, &pData[nPos], nLen - nPos); - nPos += m_obj_Data_Info_List[i].m_nLength; - } - else - { - //ƴװ - int nValueLen = GetBufferSize((char*)m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_strValue.length()); - char* pValue = new char[nValueLen]; - Convertstr2charArray(m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_strValue.length(), (unsigned char* )pValue, nValueLen); - memcpy_safe(pValue, nValueLen, &pData[nPos], nLen - nPos); - delete pValue; - nPos += m_obj_Data_Info_List[i].m_nLength; - } - } - else if(m_obj_Data_Info_List[i].m_nLength == 1) - { - short sData = (short)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str()); - memcpy_safe((char* )&sData, 1, &pData[nPos], nLen - nPos); - nPos += m_obj_Data_Info_List[i].m_nLength; - } - else - { - if(m_obj_Data_Info_List[i].m_blIsString == true) - { - memcpy_safe((char* )m_obj_Data_Info_List[i].m_strValue.c_str(), (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()), &pData[nPos], nLen - nPos); - nPos += (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()); - } - else - { - //ƴװ - int nValueLen = GetBufferSize((char*)m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_strValue.length()); - char* pValue = new char[nValueLen]; - Convertstr2charArray(m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_strValue.length(), (unsigned char* )pValue, nValueLen); - memcpy_safe(pValue, nValueLen, &pData[nPos], nLen - nPos); - delete pValue; - nPos += nValueLen; - } - } - } - } - } -}; - -struct _Packet_Recv -{ - vec_Data_Info m_obj_Data_Info_List; - - int Get_Length() - { - int nSize = 0; - for(int i = 0; i < (int)m_obj_Data_Info_List.size(); i++) - { - if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "short") == 0) - { - nSize += 2; - } - else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "int") == 0) - { - nSize += 4; - } - else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "char") == 0) - { - if(m_obj_Data_Info_List[i].m_nLength > 0) - { - nSize += m_obj_Data_Info_List[i].m_nLength; - } - else - { - nSize += (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()); - } - } - - } - return nSize; - } - - string Check_Stream(char* pData, int nLen, short sOrder, bool& blIsError) - { - string strRet = "ݰɹ"; - int nPos = 0; - for(int i = 0; i < (int)m_obj_Data_Info_List.size(); i++) - { - if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "short") == 0) - { - short sData = 0; - memcpy_safe(&pData[nPos], 2, (char* )&sData, 2); - if(sOrder == 1) - { - // - sData = ntohs(sData); - } - if(sData != (short)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str())) - { - char szError[MAX_BUFF_50] = {'\0'}; - sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%d],ʵֵ[%d]", - m_obj_Data_Info_List[i].m_szDataName, - (short)atoi(m_obj_Data_Info_List[i].m_strValue.c_str()), - sData); - blIsError = true; - return strRet; - } - nPos += 2; - } - else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "int") == 0) - { - int nData = 0; - memcpy_safe(&pData[nPos], 4, (char* )&nData, 4); - if(sOrder == 1) - { - // - nData = ntohl(nData); - } - if(nData != (int)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str())) - { - char szError[MAX_BUFF_50] = {'\0'}; - sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%d],ʵֵ[%d]", - m_obj_Data_Info_List[i].m_szDataName, - (int)atoi(m_obj_Data_Info_List[i].m_strValue.c_str()), - nData); - blIsError = true; - return strRet; - } - nPos += 4; - } - else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "char") == 0) - { - if(m_obj_Data_Info_List[i].m_nLength > 1) - { - char* pObjectData = new char[m_obj_Data_Info_List[i].m_nLength + 1]; - memcpy_safe(&pData[nPos], m_obj_Data_Info_List[i].m_nLength, (char* )pObjectData, m_obj_Data_Info_List[i].m_nLength); - pObjectData[m_obj_Data_Info_List[i].m_nLength] = '\0'; - if(strcmp(pObjectData, m_obj_Data_Info_List[i].m_strValue.c_str()) != 0) - { - char szError[MAX_BUFF_500] = {'\0'}; - sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%s],ʵֵ[%s]", - m_obj_Data_Info_List[i].m_szDataName, - m_obj_Data_Info_List[i].m_strValue.c_str(), - pObjectData); - delete pObjectData; - blIsError = true; - return strRet; - } - - delete pObjectData; - nPos += m_obj_Data_Info_List[i].m_nLength; - } - else if(m_obj_Data_Info_List[i].m_nLength == 1) - { - //һֽڣֱΪ - char* pObjectData = new char[m_obj_Data_Info_List[i].m_nLength + 1]; - memcpy_safe(&pData[nPos], m_obj_Data_Info_List[i].m_nLength, (char* )pObjectData, m_obj_Data_Info_List[i].m_nLength); - pObjectData[m_obj_Data_Info_List[i].m_nLength] = '\0'; - if(atoi(pObjectData) != atoi(m_obj_Data_Info_List[i].m_strValue.c_str())) - { - char szError[MAX_BUFF_500] = {'\0'}; - sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%s],ʵֵ[%s]", - m_obj_Data_Info_List[i].m_szDataName, - m_obj_Data_Info_List[i].m_strValue.c_str(), - pObjectData); - delete pObjectData; - blIsError = true; - return strRet; - } - delete pObjectData; - nPos += m_obj_Data_Info_List[i].m_nLength; - } - else - { - char* pObjectData = new char[nLen - nPos + 1]; - memcpy_safe(&pData[nPos], nLen - nPos, (char* )pObjectData, nLen - nPos); - pObjectData[nLen - nPos] = '\0'; - if(strcmp(pObjectData, m_obj_Data_Info_List[i].m_strValue.c_str()) != 0) - { - char szError[MAX_BUFF_500] = {'\0'}; - sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%s],ʵֵ[%s]", - m_obj_Data_Info_List[i].m_szDataName, - m_obj_Data_Info_List[i].m_strValue.c_str(), - pObjectData); - delete pObjectData; - blIsError = true; - return strRet; - } - - delete pObjectData; - nPos += (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()); - } - } - - } - - blIsError = false; - return strRet; - } -}; - -struct _Command_Info -{ - char m_szCommandName[MAX_BUFF_50]; - int m_nCount; - int m_nTimeCost; //λǺ - int m_nThreadCount; //߳ - _Packet_Send m_obj_Packet_Send; - _Packet_Recv m_obj_Packet_Recv; - - _Command_Info() - { - m_szCommandName[0] = '\0'; - m_nCount = 1; - m_nTimeCost = 100; - m_nThreadCount = 1; - } -}; -typedef vector<_Command_Info> vec_Command_Info; - -struct _Test_Assemble -{ - char m_szTestAssembleName[MAX_BUFF_50]; - char m_szDesc[MAX_BUFF_100]; - char m_szIP[MAX_BUFF_50]; - char m_szOrder[MAX_BUFF_50]; - int m_nPort; - vec_Command_Info m_obj_Command_Info_List; - - _Test_Assemble() - { - m_szTestAssembleName[0] = '\0'; - m_szDesc[0] = '\0'; - m_szIP[0] = '\0'; - m_nPort = 0; - sprintf_safe(m_szOrder, MAX_BUFF_50,"HOST"); - } -}; -typedef vector<_Test_Assemble> vec_Test_Assemble; - -//ָĿ¼XMLļ -static bool Read_Xml_Folder( string folderPath, vec_Xml_File_Name& obj_vec_Xml_File_Name) -{ -#ifdef WIN32 - _finddata_t FileInfo; - string strfind = folderPath + "\\*"; - long Handle = _findfirst(strfind.c_str(), &FileInfo); - - if (Handle == -1L) - { - return false; - } - do - { - //жǷĿ¼ - if (FileInfo.attrib & _A_SUBDIR) - { - //Ҫ - if( (strcmp(FileInfo.name,".") != 0 ) &&(strcmp(FileInfo.name,"..") != 0)) - { - //֧Ŀ¼ - //string newPath = folderPath + "\\" + FileInfo.name; - //dfsFolder(newPath); - } - } - else - { - string filename = folderPath + "\\" + FileInfo.name; - obj_vec_Xml_File_Name.push_back(filename); - } - } while (_findnext(Handle, &FileInfo) == 0); - - _findclose(Handle); -#else - DIR *dp; - struct dirent *entry; - struct stat statbuf; - if((dp = opendir(folderPath.c_str())) == NULL) - { - printf("cannot open directory: %s\n", folderPath.c_str()); - return false; - } - chdir(folderPath.c_str()); - while((entry = readdir(dp)) != NULL) - { - lstat(entry->d_name,&statbuf); - if(S_ISDIR(statbuf.st_mode)) - { - if(strcmp(".",entry->d_name) == 0 || strcmp("..",entry->d_name) == 0) - continue; - //Ҫ֧Ŀ¼ - //printf("%*s%s/\n",depth,"",entry->d_name); - //dfsFolder(entry->d_name,depth+4); - } - else - { - string filename = folderPath + "/" + entry->d_name; - obj_vec_Xml_File_Name.push_back(filename); - } - } - chdir(".."); - closedir(dp); -#endif - return true; -} - -static void Create_HTML_Begin(FILE* pFile) -{ - char szTemp[MAX_BUFF_500] = {'\0'}; - - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - fflush(pFile); -} - -static void Create_TD_Title(FILE* pFile, const char* pAssemableName, const char* pDesc, const char* pIP, int nPort) -{ - char szTemp[MAX_BUFF_500] = {'\0'}; - - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n", pAssemableName, pDesc, pIP, nPort); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - fflush(pFile); -} - -static void Create_TD_Content(FILE* pFile, const char* pCssName, const char* pCommandName, const char* pContent, const char* pTime) -{ - char szTemp[MAX_BUFF_500] = {'\0'}; - - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n", pCssName, pCommandName); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n", pCssName, pContent); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n", pCssName, pTime); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - fflush(pFile); -} - -static void Create_HTML_End(FILE* pFile) -{ - char szTemp[MAX_BUFF_500] = {'\0'}; - sprintf_safe(szTemp, MAX_BUFF_500, "
%s:%s(%s:%d)
%s%s%s
\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - sprintf_safe(szTemp, MAX_BUFF_500, "\n"); - fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); - fflush(pFile); -} - -#endif diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/TcpSocketClient.cpp b/PssSampleClient/AutoTestClient/AutoTestClient/TcpSocketClient.cpp deleted file mode 100644 index 9b4bcaeb3..000000000 --- a/PssSampleClient/AutoTestClient/AutoTestClient/TcpSocketClient.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Source file about portable socket class. - * - * design:odison - * e-mail:odison@126.com> - * - */ - -#include "TcpSocketClient.h" - -#ifdef WIN32 - #pragma comment(lib, "wsock32") -#endif - - -ODSocket::ODSocket(SOCKET sock) -{ - m_sock = sock; -} - -ODSocket::~ODSocket() -{ -} - -int ODSocket::Init() -{ -#ifdef WIN32 - /* - http://msdn.microsoft.com/zh-cn/vstudio/ms741563(en-us,VS.85).aspx - - typedef struct WSAData { - WORD wVersion; //winsock version - WORD wHighVersion; //The highest version of the Windows Sockets specification that the Ws2_32.dll can support - char szDescription[WSADESCRIPTION_LEN+1]; - char szSystemStatus[WSASYSSTATUS_LEN+1]; - unsigned short iMaxSockets; - unsigned short iMaxUdpDg; - char FAR * lpVendorInfo; - }WSADATA, *LPWSADATA; - */ - WSADATA wsaData; - //#define MAKEWORD(a,b) ((WORD) (((BYTE) (a)) | ((WORD) ((BYTE) (b))) << 8)) - WORD version = MAKEWORD(2, 0); - int ret = WSAStartup(version, &wsaData);//win sock start up - if ( ret ) { - printf("[ODSocket::Init]Initilize winsock error !"); - return -1; - } -#endif - - return 0; -} -//this is just for windows -int ODSocket::Clean() -{ -#ifdef WIN32 - return (WSACleanup()); -#endif - return 0; -} - -ODSocket& ODSocket::operator = (SOCKET s) -{ - m_sock = s; - return (*this); -} - -ODSocket::operator SOCKET () -{ - return m_sock; -} -//create a socket object win/lin is the same -// af: -bool ODSocket::Create(int af, int type, int protocol) -{ - m_sock = socket(af, type, protocol); - if ( m_sock == INVALID_SOCKET ) { - return false; - } - return true; -} - -bool ODSocket::Connect(const char* ip, unsigned short port,int timeout) -{ - fd_set set; - int error = -1; - int len = sizeof(int); - - struct timeval timeo; - //óʱʱ - if(timeout != 0) - { - timeo.tv_sec = timeout; - timeo.tv_usec = 0; - - //connectóɷ - int nonblock = 1; -#ifdef WIN32 - ioctlsocket(m_sock, FIONBIO, (u_long FAR*)&nonblock); -#else - ioctl (m_sock, FIONBIO, &nonblock); -#endif - } - - struct sockaddr_in svraddr; - svraddr.sin_family = AF_INET; - svraddr.sin_addr.s_addr = inet_addr(ip); - svraddr.sin_port = htons(port); - int ret = connect(m_sock, (struct sockaddr*)&svraddr, sizeof(svraddr)); - - if(timeout != 0) - { - //selectȴ - FD_ZERO(&set); - FD_SET(m_sock, &set); - int nSelectReturn = select(m_sock + 1, NULL, &set, NULL, &timeo); - if(nSelectReturn > 0) - { - getsockopt(m_sock, SOL_SOCKET, SO_ERROR, (char FAR * )&error, (socklen_t *)&len); - if(error == 0) - { - ret = 0; - } - else - { - ret = -1; - } - } - else - { - ret = -1; - } - - //ó - int nonblock = 0; -#ifdef WIN32 - ioctlsocket(m_sock, FIONBIO, (u_long FAR*)&nonblock); -#else - ioctl (m_sock, FIONBIO, &nonblock); -#endif - - //ýݳʱʱ - //struct timeval tvRecv;//ճʱ - //tvRecv.tv_sec = timeout; - //tvRecv.tv_usec = 0; - //setsockopt(m_sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tvRecv, sizeof(struct timeval)); - } - - - - if(ret != 0) - { - return false; - } - else - { - return true; - } -} - -int ODSocket::Send(const char* buf, int len, int flags) -{ - int bytes; - int count = 0; - - while ( count < len ) { - - bytes = send(m_sock, buf + count, len - count, flags); - if ( bytes == -1 || bytes == 0 ) - return -1; - count += bytes; - } - - return count; -} - -int ODSocket::Recv(char* buf, int len, int flags) -{ - return (recv(m_sock, buf, len, flags)); -} - -int ODSocket::Close() -{ -#ifdef WIN32 - return (closesocket(m_sock)); -#else - return (close(m_sock)); -#endif -} - -int ODSocket::GetError() -{ -#ifdef WIN32 - return (WSAGetLastError()); -#else - return (errno); -#endif -} - -bool ODSocket::DnsParse(const char* domain, char* ip) -{ - struct hostent* p; - if ( (p = gethostbyname(domain)) == NULL ) - return false; - - sprintf(ip, - "%u.%u.%u.%u", - (unsigned char)p->h_addr_list[0][0], - (unsigned char)p->h_addr_list[0][1], - (unsigned char)p->h_addr_list[0][2], - (unsigned char)p->h_addr_list[0][3]); - - return true; -} \ No newline at end of file diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/TcpSocketClient.h b/PssSampleClient/AutoTestClient/AutoTestClient/TcpSocketClient.h deleted file mode 100644 index 1175243a8..000000000 --- a/PssSampleClient/AutoTestClient/AutoTestClient/TcpSocketClient.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * define file about portable socket class. - * description:this sock is suit both windows and linux - * design:odison - * e-mail:odison@126.com> - * - */ - -#ifndef _ODSOCKET_H_ -#define _ODSOCKET_H_ - -#include -#ifdef WIN32 - #include - typedef int socklen_t; -#else - #include - #include - #include - #include - #include - #include - #include - #include - #include - typedef int SOCKET; - - //#pragma region define win32 const variable in linux - #define INVALID_SOCKET -1 - #define SOCKET_ERROR -1 - //#pragma endregion -#endif - - -class ODSocket { - -public: - ODSocket(SOCKET sock = INVALID_SOCKET); - ~ODSocket(); - - // Create socket object for snd/recv data - bool Create(int af, int type, int protocol = 0); - - // Connect socket - bool Connect(const char* ip, unsigned short port,int timeout = 0); - - // Send socket - int Send(const char* buf, int len, int flags = 0); - - // Recv socket - int Recv(char* buf, int len, int flags = 0); - - // Close socket - int Close(); - - // Get errno - int GetError(); - - //#pragma region just for win32 - // Init winsock DLL - static int Init(); - // Clean winsock DLL - static int Clean(); - //#pragma endregion - - // Domain parse - static bool DnsParse(const char* domain, char* ip); - - ODSocket& operator = (SOCKET s); - - operator SOCKET (); - -protected: - SOCKET m_sock; - -}; -#endif diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/XmlOpeation.cpp b/PssSampleClient/AutoTestClient/AutoTestClient/XmlOpeation.cpp deleted file mode 100644 index 44b3333bd..000000000 --- a/PssSampleClient/AutoTestClient/AutoTestClient/XmlOpeation.cpp +++ /dev/null @@ -1,279 +0,0 @@ -#include "XmlOpeation.h" - -CXmlOpeation::CXmlOpeation(void) -{ - m_pTiXmlDocument = NULL; - m_pRootElement = NULL; -} - -CXmlOpeation::~CXmlOpeation(void) -{ - Close(); -} - -bool CXmlOpeation::Init(const char* pFileName) -{ - Close(); - m_pTiXmlDocument = new TiXmlDocument(pFileName); - if(NULL == m_pTiXmlDocument) - { - return false; - } - - if(false == m_pTiXmlDocument->LoadFile()) - { - return false; - } - - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - return true; -} - -bool CXmlOpeation::Init_String(const char* pXMLText) -{ - //ַ - Close(); - m_pTiXmlDocument = new TiXmlDocument(); - m_pTiXmlDocument->Parse(pXMLText, 0, TIXML_DEFAULT_ENCODING); - - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - return true; -} - -void CXmlOpeation::Close() -{ - if(NULL != m_pTiXmlDocument) - { - delete m_pTiXmlDocument; - m_pTiXmlDocument = NULL; - m_pRootElement = NULL; - } -} - -char* CXmlOpeation::GetData(const char* pName, const char* pAttrName) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = m_pRootElement->FirstChildElement(pName); - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->Attribute(pAttrName); - } - - return NULL; -} - -char* CXmlOpeation::GetData(const char* pName, const char* pAttrName, TiXmlElement*& pNextTiXmlElement) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = NULL; - if(NULL == pNextTiXmlElement) - { - pTiXmlElement = m_pRootElement->FirstChildElement(pName); - pNextTiXmlElement = pTiXmlElement; - } - else - { - pTiXmlElement = pNextTiXmlElement->NextSiblingElement(); - pNextTiXmlElement = pTiXmlElement; - } - - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->Attribute(pAttrName); - } - - return NULL; -} - -char* CXmlOpeation::GetData_Text(const char* pName) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = m_pRootElement->FirstChildElement(pName); - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->GetText(); - } - - return NULL; -} - -char* CXmlOpeation::GetData_Text(const char* pName, TiXmlElement*& pNextTiXmlElement) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = NULL; - if(NULL == pNextTiXmlElement) - { - pTiXmlElement = m_pRootElement->FirstChildElement(pName); - pNextTiXmlElement = pTiXmlElement; - } - else - { - pTiXmlElement = pNextTiXmlElement->NextSiblingElement(); - pNextTiXmlElement = pTiXmlElement; - } - - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->GetText(); - } - - return NULL; -} - -bool CXmlOpeation::Parse_XML_Test_Assemble(const char* pFileName, _Test_Assemble& obj_Test_Assemble) -{ - Close(); - m_pTiXmlDocument = new TiXmlDocument(pFileName); - if(NULL == m_pTiXmlDocument) - { - return false; - } - - if(false == m_pTiXmlDocument->LoadFile()) - { - return false; - } - - TiXmlNode* pMainNode = NULL; - TiXmlNode* pSecondNode = NULL; - TiXmlNode* pThreeNode = NULL; - TiXmlNode* pColumnNode = NULL; - - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - if(NULL == m_pRootElement) - { - return false; - } - - //òԼϢ - sprintf_safe(obj_Test_Assemble.m_szTestAssembleName, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("Name")); - sprintf_safe(obj_Test_Assemble.m_szDesc, MAX_BUFF_100, "%s", (char* )m_pRootElement->Attribute("desc")); - sprintf_safe(obj_Test_Assemble.m_szIP, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("IP")); - sprintf_safe(obj_Test_Assemble.m_szOrder, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("ORDER")); - obj_Test_Assemble.m_nPort = atoi((char* )m_pRootElement->Attribute("Port")); - - //ѭȡԤϢ - for(pMainNode = m_pRootElement->FirstChildElement();pMainNode;pMainNode = pMainNode->NextSiblingElement()) - { - _Command_Info obj_Command_Info; - - int nMainType = pMainNode->Type(); - - if(nMainType != TiXmlText::TINYXML_ELEMENT) - { - continue; - } - - TiXmlElement* pMainElement = pMainNode->ToElement(); - sprintf_safe(obj_Command_Info.m_szCommandName, MAX_BUFF_50, "%s", (char* )pMainElement->Attribute("CommandName")); - obj_Command_Info.m_nCount = atoi((char* )pMainElement->Attribute("Count")); - obj_Command_Info.m_nTimeCost = atoi((char* )pMainElement->Attribute("TimeCost")); - if(pMainElement->Attribute("ThreadCount") != NULL) - { - obj_Command_Info.m_nThreadCount = atoi((char* )pMainElement->Attribute("ThreadCount")); - } - - for(pSecondNode = pMainElement->FirstChildElement();pSecondNode;pSecondNode = pSecondNode->NextSiblingElement()) - { - int nMainType = pMainNode->Type(); - - if(nMainType != TiXmlText::TINYXML_ELEMENT) - { - continue; - } - - TiXmlElement* pSecondElement = pSecondNode->ToElement(); - if(strcmp("Packet_Send", pSecondElement->Value()) == 0) - { - //ԪϢ - for(pThreeNode = pSecondElement->FirstChildElement();pThreeNode;pThreeNode = pThreeNode->NextSiblingElement()) - { - TiXmlElement* pThreeElement = pThreeNode->ToElement(); - _Data_Info obj_Data_Info; - sprintf_safe(obj_Data_Info.m_szDataType, MAX_BUFF_50, "%s", (char* )pThreeElement->Value()); - sprintf_safe(obj_Data_Info.m_szDataName, MAX_BUFF_50, "%s", (char* )pThreeElement->Attribute("name")); - if(NULL != pThreeElement->Attribute("length")) - { - obj_Data_Info.m_nLength = atoi((char* )pThreeElement->Attribute("length")); - } - if(NULL != pThreeElement->Attribute("IsString")) - { - if(strcmp("1", pThreeElement->Attribute("IsString")) == 0) - { - obj_Data_Info.m_blIsString = true; - } - else - { - obj_Data_Info.m_blIsString = false; - } - } - if(NULL != (char* )pThreeElement->GetText()) - { - obj_Data_Info.m_strValue = (string)pThreeElement->GetText(); - } - obj_Command_Info.m_obj_Packet_Send.m_obj_Data_Info_List.push_back(obj_Data_Info); - } - } - else if(strcmp("Packet_Recv", pSecondElement->Value()) == 0) - { - //ԪϢ - for(pThreeNode = pSecondElement->FirstChildElement();pThreeNode;pThreeNode = pThreeNode->NextSiblingElement()) - { - TiXmlElement* pThreeElement = pThreeNode->ToElement(); - _Data_Info obj_Data_Info; - sprintf_safe(obj_Data_Info.m_szDataType, MAX_BUFF_50, "%s", (char* )pThreeElement->Value()); - sprintf_safe(obj_Data_Info.m_szDataName, MAX_BUFF_50, "%s", (char* )pThreeElement->Attribute("name")); - if(NULL != pThreeElement->Attribute("length")) - { - obj_Data_Info.m_nLength = atoi((char* )pThreeElement->Attribute("length")); - } - if(NULL != pThreeElement->Attribute("IsString")) - { - if(strcmp("1", pThreeElement->Attribute("IsString")) == 0) - { - obj_Data_Info.m_blIsString = true; - } - else - { - obj_Data_Info.m_blIsString = false; - } - } - if(NULL != (char* )pThreeElement->GetText()) - { - obj_Data_Info.m_strValue = (string)((char* )pThreeElement->GetText()); - } - obj_Command_Info.m_obj_Packet_Recv.m_obj_Data_Info_List.push_back(obj_Data_Info); - } - } - } - - obj_Test_Assemble.m_obj_Command_Info_List.push_back(obj_Command_Info); - } - - delete m_pTiXmlDocument; - m_pTiXmlDocument = NULL; - return true; -} - diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/XmlOpeation.h b/PssSampleClient/AutoTestClient/AutoTestClient/XmlOpeation.h deleted file mode 100644 index d70b2c264..000000000 --- a/PssSampleClient/AutoTestClient/AutoTestClient/XmlOpeation.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _XMLOPRATION_H -#define _XMLOPRATION_H - -#include "tinyxml.h" -#include "tinystr.h" - -#include "Common.h" - -//XMLתΪMAPṹ -//add by freeeyes - - -class CXmlOpeation -{ -public: - CXmlOpeation(void); - ~CXmlOpeation(void); - - bool Init(const char* pFileName); - bool Init_String(const char* pXMLText); - - char* GetData(const char* pName, const char* pAttrName); - char* GetData(const char* pName, const char* pAttrName, TiXmlElement*& pNextTiXmlElement); - - char* GetData_Text(const char* pName); - char* GetData_Text(const char* pName, TiXmlElement*& pNextTiXmlElement); - - bool Parse_XML_Test_Assemble(const char* pFileName, _Test_Assemble& obj_Test_Assemble); - - void Close(); - -private: - TiXmlDocument* m_pTiXmlDocument; - TiXmlElement* m_pRootElement; -}; -#endif diff --git a/PssSampleClient/AutoTestClient/CMakeLists.txt b/PssSampleClient/AutoTestClient/CMakeLists.txt new file mode 100644 index 000000000..3b79b7358 --- /dev/null +++ b/PssSampleClient/AutoTestClient/CMakeLists.txt @@ -0,0 +1,101 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(AutoTestClient) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_AutoTestClient_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + . + ../../ThirdLib/include + ../../ThirdLib/include/TinyXML + ../../ThirdLib/thirdparty + +) + + +# Compiler options +add_definitions(-O2) +add_definitions(-Wall) +add_definitions( + -DNDEBUG + -D_LINUX_PLATFORM_ +) + + +# Linker options + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L/usr/lib/ ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/sock_wrap.cpp + ${CMAKE_CURRENT_LIST_DIR}/./AutoTestClient/AutoTestClient.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/XmlOpeation.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxml.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinystr.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -Wall") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(AutoTestClient ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(AutoTestClient ${LINK_OPTIONS}) + +target_link_libraries(AutoTestClient + libpthread.so +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/PssSampleClient/AutoTestClient/Makefile b/PssSampleClient/AutoTestClient/Makefile new file mode 100644 index 000000000..c9b8e2f5f --- /dev/null +++ b/PssSampleClient/AutoTestClient/Makefile @@ -0,0 +1,158 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=AutoTestClient +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../PssSampleClient/AutoTestClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="AutoTestClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/thirdparty +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)pthread +ArLibs := "libpthread.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(Preprocessors) +CFLAGS := -O2 -Wall $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(ObjectSuffix): ./AutoTestClient/AutoTestClient.cpp $(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./AutoTestClient/AutoTestClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(DependSuffix): ./AutoTestClient/AutoTestClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(DependSuffix) -MM ./AutoTestClient/AutoTestClient.cpp + +$(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(PreprocessSuffix): ./AutoTestClient/AutoTestClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/AutoTestClient_AutoTestClient.cpp$(PreprocessSuffix) ./AutoTestClient/AutoTestClient.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix): ../../ThirdLib/include/XmlOpeation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix): ../../ThirdLib/include/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) -MM ../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix): ../../ThirdLib/include/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix) ../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinystr.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/CommonTCPClient/CMakeLists.txt b/PssSampleClient/CommonTCPClient/CMakeLists.txt new file mode 100644 index 000000000..b3276326f --- /dev/null +++ b/PssSampleClient/CommonTCPClient/CMakeLists.txt @@ -0,0 +1,93 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(CommonTCPClient) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_CommonTCPClient_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + . + ../../ThirdLib/include + ../../ThirdLib/include/TinyXML + ../../ThirdLib/thirdparty + +) + + +# Compiler options +add_definitions( + -DNDEBUG + -D_LINUX_PLATFORM_ +) + + +# Linker options +set(LINK_OPTIONS -O2) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/sock_wrap.cpp + ${CMAKE_CURRENT_LIST_DIR}/CommonTCPClient/TpClientManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/CommonTCPClient/CommonTCPClient.cpp + ${CMAKE_CURRENT_LIST_DIR}/CommonTcpTest/CommonTcpTest.cpp +) + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(CommonTCPClient ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(CommonTCPClient ${LINK_OPTIONS}) + +target_link_libraries(CommonTCPClient + /usr/lib/libpthread.so +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient.cbp b/PssSampleClient/CommonTCPClient/CommonTCPClient.cbp new file mode 100644 index 000000000..fee8e7699 --- /dev/null +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient.cbp @@ -0,0 +1,42 @@ + + + + + + diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient.depend b/PssSampleClient/CommonTCPClient/CommonTCPClient.depend new file mode 100644 index 000000000..f5ffcf2a0 --- /dev/null +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient.depend @@ -0,0 +1,57 @@ +# depslib dependency file v1.0 +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp + + + + "sock_wrap.h" + + + + + + + + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.h + + + + + + + + + + +1551945112 source:/data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.cpp + "CommonTCPClient.h" + +1551967834 /data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.h + "TpClientManager.h" + +1551612453 /data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.h + + "sock_wrap.h" + "macro.h" + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//sock_wrap.h + + + + + + + + + + +1553738330 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//macro.h + + + +1552880194 source:/data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.cpp + "TpClientManager.h" + +1551967848 source:/data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.cpp + "../CommonTCPClient/CommonTCPClient.h" + diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient.layout b/PssSampleClient/CommonTCPClient/CommonTCPClient.layout new file mode 100644 index 000000000..3e7955fdd --- /dev/null +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient.mk b/PssSampleClient/CommonTCPClient/CommonTCPClient.mk new file mode 100644 index 000000000..e936764de --- /dev/null +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient.mk @@ -0,0 +1,134 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=CommonTCPClient +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="CommonTCPClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -O2 +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/thirdparty +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)pthread +ArLibs := "libpthread.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := $(Preprocessors) +CFLAGS := $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(ObjectSuffix): CommonTCPClient/TpClientManager.cpp $(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(DependSuffix): CommonTCPClient/TpClientManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(DependSuffix) -MM CommonTCPClient/TpClientManager.cpp + +$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(PreprocessSuffix): CommonTCPClient/TpClientManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(PreprocessSuffix) CommonTCPClient/TpClientManager.cpp + +$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(ObjectSuffix): CommonTCPClient/CommonTCPClient.cpp $(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(DependSuffix): CommonTCPClient/CommonTCPClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(DependSuffix) -MM CommonTCPClient/CommonTCPClient.cpp + +$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(PreprocessSuffix): CommonTCPClient/CommonTCPClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(PreprocessSuffix) CommonTCPClient/CommonTCPClient.cpp + +$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(ObjectSuffix): CommonTcpTest/CommonTcpTest.cpp $(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(DependSuffix): CommonTcpTest/CommonTcpTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(DependSuffix) -MM CommonTcpTest/CommonTcpTest.cpp + +$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(PreprocessSuffix): CommonTcpTest/CommonTcpTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(PreprocessSuffix) CommonTcpTest/CommonTcpTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient.project b/PssSampleClient/CommonTCPClient/CommonTCPClient.project new file mode 100644 index 000000000..31c4c94bc --- /dev/null +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient.project @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient.sln b/PssSampleClient/CommonTCPClient/CommonTCPClient.sln deleted file mode 100644 index 4b8e54fe5..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonTCPClient", "CommonTCPClient\CommonTCPClient.vcxproj", "{C3460AB9-2AEC-4B04-A26C-5C55BBB022A0}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CommonTcpTest", "CommonTcpTest\CommonTcpTest.vcxproj", "{5C8A5873-5D6B-4700-B6F6-4F7D74610094}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C3460AB9-2AEC-4B04-A26C-5C55BBB022A0}.Debug|Win32.ActiveCfg = Debug|Win32 - {C3460AB9-2AEC-4B04-A26C-5C55BBB022A0}.Debug|Win32.Build.0 = Debug|Win32 - {C3460AB9-2AEC-4B04-A26C-5C55BBB022A0}.Release|Win32.ActiveCfg = Release|Win32 - {C3460AB9-2AEC-4B04-A26C-5C55BBB022A0}.Release|Win32.Build.0 = Release|Win32 - {5C8A5873-5D6B-4700-B6F6-4F7D74610094}.Debug|Win32.ActiveCfg = Debug|Win32 - {5C8A5873-5D6B-4700-B6F6-4F7D74610094}.Debug|Win32.Build.0 = Debug|Win32 - {5C8A5873-5D6B-4700-B6F6-4F7D74610094}.Release|Win32.ActiveCfg = Release|Win32 - {5C8A5873-5D6B-4700-B6F6-4F7D74610094}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient.txt b/PssSampleClient/CommonTCPClient/CommonTCPClient.txt new file mode 100644 index 000000000..19bebfe3e --- /dev/null +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient.txt @@ -0,0 +1 @@ +../../Build/Linux/Temp/up_up_ThirdLib_thirdparty_sock_wrap.cpp.o ../../Build/Linux/Temp/CommonTCPClient_TpClientManager.cpp.o ../../Build/Linux/Temp/CommonTCPClient_CommonTCPClient.cpp.o ../../Build/Linux/Temp/CommonTcpTest_CommonTcpTest.cpp.o diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.cpp b/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.cpp index 4b82a74d4..669ed8c98 100644 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.cpp +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.cpp @@ -1,7 +1,7 @@ -// CommonTCPClient.cpp : ̨Ӧóڵ㡣 +// CommonTCPClient.cpp : ¶¨Òå¿ØÖÆÌ¨Ó¦ÓóÌÐòµÄÈë¿Úµã¡£ // -#include "stdafx.h" +//#include "stdafx.h" #include "CommonTCPClient.h" //add by freeeyes diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.h b/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.h index 4cecbf4e1..66a100f5b 100644 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.h +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.h @@ -3,25 +3,20 @@ #include "TpClientManager.h" -#ifdef TCPLINET_BUILD_DLL -#define DLL_PUBLIC __declspec(dllexport) -#else -#define DLL_PUBLIC __declspec(dllimport) // Note: actually gcc seems to also supports this syntax. -#endif -DLL_PUBLIC int TPClient_Run(bool blDebug = false); + int TPClient_Run(bool blDebug = false); -DLL_PUBLIC int TPClient_Connect(int nServerID, const char* pIP, int nPort, CRecvData* pRecvData = NULL); + int TPClient_Connect(int nServerID, const char* pIP, int nPort, CRecvData* pRecvData = NULL); -DLL_PUBLIC int TPClient_DisConnect(int nServerID); + int TPClient_DisConnect(int nServerID); -DLL_PUBLIC int TPClient_DisConnect_All(); + int TPClient_DisConnect_All(); -DLL_PUBLIC int TPClient_Send(int nServerID, const char* pBuff, int nLen); + int TPClient_Send(int nServerID, const char* pBuff, int nLen); -DLL_PUBLIC int TPClient_ConnectState(int nServerID); + int TPClient_ConnectState(int nServerID); -DLL_PUBLIC int TPClient_ReConnect(int nServerID); + int TPClient_ReConnect(int nServerID); #endif diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.vcproj b/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.vcproj deleted file mode 100644 index 5989d8bcf..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/CommonTCPClient.vcproj +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/ReadMe.txt b/PssSampleClient/CommonTCPClient/CommonTCPClient/ReadMe.txt deleted file mode 100644 index 29e1c50b1..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/ReadMe.txt +++ /dev/null @@ -1,29 +0,0 @@ -======================================================================== - 控制台应用程序:CommonTCPClient 项目概述 -======================================================================== - -应用程序向导已为您创建了此 CommonTCPClient 应用程序。 - -本文件概要介绍组成 CommonTCPClient 应用程序的 -的每个文件的内容。 - - -CommonTCPClient.vcproj - 这是使用应用程序向导生成的 VC++ 项目的主项目文件, - 其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 - -CommonTCPClient.cpp - 这是主应用程序源文件。 - -///////////////////////////////////////////////////////////////////////////// -其他标准文件: - -StdAfx.h, StdAfx.cpp - 这些文件用于生成名为 CommonTCPClient.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 - -///////////////////////////////////////////////////////////////////////////// -其他注释: - -应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 - -///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.cpp b/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.cpp index 4d16c2a2b..2f35e2856 100644 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.cpp +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.cpp @@ -1,63 +1,40 @@ -#include "StdAfx.h" +//#include "StdAfx.h" #include "TpClientManager.h" CTpClientManager* CTpClientManager::m_pTpClientManager = NULL; -//ʱTimerID -UINT g_nTimerID = 0; -//ʱص¼ -void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) -{ - CTpClientManager::Instance().TPClient_HandleEvents((int)idEvent); -} +//¶¨Ê±Æ÷µ½´ï»Øµ÷ʼþ -DWORD CALLBACK Recv_thread(PVOID pvoid) +int Recv_thread( ) { - //ѭеļӣݣյ + //±éÀúÑ­»·ËùÓе碌îÁ¬½Ó£¬Èç¹ûÓÐÊý¾Ý£¬ÔòÊÕµ½ while(true) { CTpClientManager::Instance().Recv_All_Data(); - DWORD dwMilliseconds = TCP_RECV_SLEEP; - Sleep(dwMilliseconds); + int dwMilliseconds = TCP_RECV_SLEEP; + std::this_thread::sleep_for(std::chrono::milliseconds(dwMilliseconds)); } } - -DWORD CALLBACK Timer_thread(PVOID pvoid) +int Timer_thread( ) { - MSG objmsg; - PeekMessage(&objmsg, NULL, WM_USER, WM_USER, PM_NOREMOVE); - g_nTimerID = SetTimer(NULL, TIMER_EVENT_ID, TIMER_EVENT_INTERVAL, TimerProc); - - if(g_nTimerID <= 0) + while(true) { - printf_s("[Timer Thread]nTimerID create error.\n"); - return 0; - } + CTpClientManager::Instance().TPClient_HandleEvents((int)TIMER_EVENT_ID); + + int dwMilliseconds = TIMER_EVENT_INTERVAL; + std::this_thread::sleep_for(std::chrono::milliseconds(dwMilliseconds)); + printf_s("[Timer Thread]Timer is End.\n"); - BOOL blRet; - while((blRet = GetMessage(&objmsg, NULL, 0, 0))!= 0) - { - if(blRet == -1) - { - printf_s("[Timer Thread]Errror =%d.\n", errno); - break; - } - else - { - TranslateMessage(&objmsg); - DispatchMessage(&objmsg); - } } - KillTimer(NULL, g_nTimerID); - g_nTimerID = 0; - printf_s("[Timer Thread]Timer is End.\n"); return 0; } + + CTpClientManager::CTpClientManager(void) { } @@ -65,17 +42,18 @@ CTpClientManager::CTpClientManager(void) CTpClientManager::~CTpClientManager(void) { TPClient_DisConnect_All(); + FreeSocketEnvironment(); } int CTpClientManager::TPClient_Connect( int nServerID, const char* pIP, int nPort, CRecvData* pRecvData /*= NULL*/ ) { - //鵱ǰǷѰڣ򷵻ش + //¼ì²éµ±Ç°Á¬½ÓÊÇ·ñѰÔÚ£¬´æÔÚÔò·µ»Ø´íÎó if(IsFindTpClient(nServerID) == true) { return FUNC_FAIL_EXIST; } - //ڣӽб + //Èç¹û²»´æÔÚ£¬ÔòÌí¼Ó½øÁбí _TpClientInfo objTpClientInfo; objTpClientInfo.m_nServerID = nServerID; sprintf_s(objTpClientInfo.m_szTpIP, MAX_BUFF_50, "%s", pIP); @@ -108,25 +86,31 @@ int CTpClientManager::TPClient_Send( int nServerID, const char* pBuff, int nLen _TpClientInfo* pTpClientInfo = IsGetTpClient(nServerID); if(NULL != pTpClientInfo) { - //ǷڣԶ + //¿´¿´Á¬½ÓÊÇ·ñ´æÔÚ£¬Èç¹û²»´æÔÚÔò×Ô¶¯ÖØÁ· if(pTpClientInfo->m_nState == 0) { ConnectToServer((*pTpClientInfo)); } - + int nTotalSendLen = nLen; int nBeginSend = 0; int nCurrSendLen = 0; - //Ƿɹ + //¿´¿´Á¬½ÓÊÇ·ñ½¨Á¢³É¹¦ if(pTpClientInfo->m_nState == 1 && pTpClientInfo->m_sckClient != INVALID_SOCKET) { while(true) { - nCurrSendLen = send(pTpClientInfo->m_sckClient, pBuff + nBeginSend, nTotalSendLen, 0); + //nCurrSendLen = send(pTpClientInfo->m_sckClient, pBuff + nBeginSend, nTotalSendLen, 0); + transresult_t rt; + SocketSend(pTpClientInfo->m_sckClient, pBuff + nBeginSend, nTotalSendLen, rt); + nCurrSendLen =rt.nbytes; + if(nCurrSendLen <= 0) { - closesocket(pTpClientInfo->m_sckClient); + //closesocket(pTpClientInfo->m_sckClient); + SocketClose(pTpClientInfo->m_sckClient); + pTpClientInfo->m_nState = 0; pTpClientInfo->m_sckClient = INVALID_SOCKET; break; @@ -136,7 +120,7 @@ int CTpClientManager::TPClient_Send( int nServerID, const char* pBuff, int nLen nTotalSendLen -= nCurrSendLen; if(nTotalSendLen == 0) { - // + //·¢ËÍÍê³É blSendFlag = true; break; } @@ -216,10 +200,13 @@ bool CTpClientManager::DelTcpClient( int nServerID ) { if(((_TpClientInfo)(*b)).m_nServerID == nServerID) { - //жǷҪϿ + //ÅжÏÊÇ·ñÐèÒª¶Ï¿ªÁ¬½Ó if(((_TpClientInfo)(*b)).m_nState == 1 && ((_TpClientInfo)(*b)).m_sckClient != INVALID_SOCKET) { - closesocket(((_TpClientInfo)(*b)).m_sckClient); + //closesocket(((_TpClientInfo)(*b)).m_sckClient); + HSocket sckclent =((_TpClientInfo)(*b)).m_sckClient; + SocketClose(sckclent); + if(m_blDebug) { printf_s("[CTpClientManager::DelTcpClient]close ServerID=%d socket.\n", ((_TpClientInfo)(*b)).m_nServerID); @@ -236,13 +223,16 @@ bool CTpClientManager::DelTcpClient( int nServerID ) bool CTpClientManager::DelTcpClient_All() { - //ѭжǷҪر + //Ñ­»·Åж¨ÊÇ·ñÒª¹Ø±ÕÒÑÓÐÁ¬½Ó for(vecTpClientInfo::iterator b = m_vecTpClientInfo.begin(); b != m_vecTpClientInfo.end(); b++) { - //жǷҪϿ + //ÅжÏÊÇ·ñÐèÒª¶Ï¿ªÁ¬½Ó if(((_TpClientInfo)(*b)).m_nState == 1 && ((_TpClientInfo)(*b)).m_sckClient != INVALID_SOCKET) { - closesocket(((_TpClientInfo)(*b)).m_sckClient); + HSocket sckclent =((_TpClientInfo)(*b)).m_sckClient; + //closesocket(((_TpClientInfo)(*b)).m_sckClient); + SocketClose(sckclent); + if(m_blDebug) { printf_s("[CTpClientManager::DelTcpClient_All]close ServerID=%d socket\n.", ((_TpClientInfo)(*b)).m_nServerID); @@ -267,14 +257,20 @@ int CTpClientManager::TPClient_HandleEvents( int nEventsID ) int CTpClientManager::TPClient_Run(bool blIsDebug) { - DWORD dwThreadId; - //һ߳жʱ - HANDLE hThread = CreateThread(NULL, 0, Timer_thread, 0, 0, &dwThreadId); + //´´½¨Ò»¸öÏ̶߳¨Ê±ÔËÐÐ + //std::thread hThreadTimer(&Timer_thread); + //hThreadTimer.detach(); - DWORD dwThreadRecvId; - //һ߳̽ - HANDLE hThreadRecv = CreateThread(NULL, 0, Recv_thread, 0, 0, &dwThreadRecvId); + //´´½¨Ò»¸öÏ߳̽ÓÊÕËùÓÐÊý¾Ý + //std::thread hThreadRecv(&Recv_thread); + //hThreadRecv.detach(); + + auto hThreadTimer = std::make_shared(&Timer_thread); + hThreadTimer->detach(); + + auto hThreadRecv = std::make_shared(&Recv_thread); + hThreadRecv->detach(); return 0; } @@ -286,34 +282,30 @@ void CTpClientManager::SetDebug( bool blDebug ) int CTpClientManager::ConnectToServer( _TpClientInfo& objTpClientInfo ) { - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(objTpClientInfo.m_nPort); - sockaddr.sin_addr.S_un.S_addr = inet_addr(objTpClientInfo.m_szTpIP); + //socket´´½¨µÄ×¼±¸¹¤×÷ + //ÉèÖýÓÊÕ³¬Ê±Ê±¼ä + int TimeOut = TCP_RECV_TIMEOUT; - SOCKET sckClient = socket(AF_INET, SOCK_STREAM, 0); + struct sockaddr_in sockaddr; + HSocket sckClient = SocketOpen(SOCK_STREAM); + SocketTimeOut(sckClient, TimeOut, -1, -1); + GetAddressFrom(&sockaddr,objTpClientInfo.m_szTpIP, objTpClientInfo.m_nPort); - //ýճʱʱ - DWORD TimeOut = (DWORD)TCP_RECV_TIMEOUT; - ::setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); - - int nErr = connect(sckClient, (SOCKADDR*)&sockaddr, sizeof(SOCKADDR)); + int nErr = SocketConnect(sckClient, &sockaddr); if(0 != nErr) { if(m_blDebug) { - printf_s("[CTpClientManager::ConnectToServer]connect error(%d).\n", WSAGetLastError()); + printf_s("[CTpClientManager::ConnectToServer]connect error(%d).\n", GetLastSocketError()); objTpClientInfo.m_nState = 0; objTpClientInfo.m_sckClient = INVALID_SOCKET; } } else { - unsigned long ul = 1;//1Ϊ,0Ϊ - ioctlsocket(sckClient, FIONBIO, (unsigned long*)&ul); + bool ul = true;//falseΪ·Ç×èÈû,trueΪ×èÈû + //ioctlsocket(sckClient, FIONBIO, (unsigned long*)&ul); + SocketBlock(sckClient, ul); if(m_blDebug) { @@ -338,34 +330,40 @@ void CTpClientManager::Recv_All_Data() if(m_vecTpClientInfo[i].m_nState == 1 && m_vecTpClientInfo[i].m_sckClient != INVALID_SOCKET) { char szBuff[MAX_BUFF_1024] = {'\0'}; - int nCurrRecvLen = recv(m_vecTpClientInfo[i].m_sckClient, (char* )szBuff, MAX_BUFF_1024, 0); + + transresult_t rt; + SocketRecv(m_vecTpClientInfo[i].m_sckClient, (char* )szBuff, MAX_BUFF_1024, rt); + int nCurrRecvLen =rt.nbytes; + if(nCurrRecvLen <= 0) { - int nError = WSAGetLastError(); + int nError = GetLastSocketError(); - //ΪǷ10035 - if(nError != WSAEWOULDBLOCK) + //ÒòΪÊÇ·Ç×èÈû£¬ËùÒÔÈç¹ûÊÇ10035ÔòºöÂÔ + if((nError != 0) ||(nError != 10035) ) { if(m_blDebug) { - printf_s("[CTpClientManager::Recv_All_Data][%d](%s:%d) is close%d.\n", m_vecTpClientInfo[i].m_nServerID, m_vecTpClientInfo[i].m_szTpIP, m_vecTpClientInfo[i].m_nPort, nError); + printf_s("[CTpClientManager::Recv_All_Data][%d](%s:%d) is close£¨%d£©.\n", m_vecTpClientInfo[i].m_nServerID, m_vecTpClientInfo[i].m_szTpIP, m_vecTpClientInfo[i].m_nPort, nError); } - closesocket(m_vecTpClientInfo[i].m_sckClient); + //closesocket(m_vecTpClientInfo[i].m_sckClient); + SocketClose(m_vecTpClientInfo[i].m_sckClient); + m_vecTpClientInfo[i].m_sckClient = INVALID_SOCKET; m_vecTpClientInfo[i].m_nState = 0; } - continue; + continue; } if(m_vecTpClientInfo[i].m_pRecvData != NULL) { - //յ + //´¦Àí½ÓÊÕµ½µÄÊý¾Ý m_vecTpClientInfo[i].m_pRecvData->RecvData(szBuff, nCurrRecvLen); } } - + } } @@ -373,7 +371,7 @@ void CTpClientManager::Connect_All_Server() { for(int i = 0; i < (int)m_vecTpClientInfo.size(); i++) { - //ǷڣԶ + //¿´¿´Á¬½ÓÊÇ·ñ´æÔÚ£¬Èç¹û²»´æÔÚÔò×Ô¶¯ÖØÁ· if(m_vecTpClientInfo[i].m_nState == 0) { if(m_blDebug) diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.h b/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.h index 114fedb48..7f07904e0 100644 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.h +++ b/PssSampleClient/CommonTCPClient/CommonTCPClient/TpClientManager.h @@ -1,9 +1,11 @@ #pragma once //ѽӶ -#include -#include +//#include +//#include #include +#include "sock_wrap.h" +#include "macro.h" using namespace std; @@ -12,7 +14,7 @@ using namespace std; #define FUNC_SUCCESS 0 //ִгɹ #define FUNC_FAIL_EXIST -1 //Ѿ -#define FUNC_FAIL_NO_EXIST -2 //Ӳ +#define FUNC_FAIL_NO_EXIST -2 //Ӳ #define FUNC_SEND_ERROR -3 //ʧ #define INTVALID_SERVERID -1 //ЧID @@ -35,7 +37,7 @@ struct _TpClientInfo int m_nServerID; //ID char m_szTpIP[MAX_BUFF_50]; //TCPIP int m_nPort; //TCPĶ˿ - SOCKET m_sckClient; //Socket + HSocket m_sckClient; //Socket int m_nState; //0Ϊδӣ1Ϊ CRecvData* m_pRecvData; //ݵĻص @@ -58,8 +60,9 @@ class CTpClientManager static CTpClientManager& Instance() { //ʼTCP - WSADATA wsaData; - int nErr = WSAStartup(MAKEWORD(2, 2), &wsaData); + //WSADATA wsaData; + //int nErr = WSAStartup(MAKEWORD(2, 2), &wsaData); + int nErr = InitializeSocketEnvironment(); if(nErr != 0) { //MessageBox(_T("socketʧܣ鱾socket汾"), _T("Ϣ"), MB_OK); diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/stdafx.cpp b/PssSampleClient/CommonTCPClient/CommonTCPClient/stdafx.cpp deleted file mode 100644 index f87cfb73c..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : ֻ׼ļԴļ -// CommonTCPClient.pch ΪԤͷ -// stdafx.obj ԤϢ - -#include "stdafx.h" - -// TODO: STDAFX.H -// κĸͷļڴļ diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/stdafx.h b/PssSampleClient/CommonTCPClient/CommonTCPClient/stdafx.h deleted file mode 100644 index 9d41f0f14..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/stdafx.h +++ /dev/null @@ -1,15 +0,0 @@ -// stdafx.h : ׼ϵͳļİļ -// Ǿʹõĵ -// ضĿİļ -// - -#pragma once - -#include "targetver.h" - -#include -#include - - - -// TODO: ڴ˴óҪͷļ diff --git a/PssSampleClient/CommonTCPClient/CommonTCPClient/targetver.h b/PssSampleClient/CommonTCPClient/CommonTCPClient/targetver.h deleted file mode 100644 index 91794a5b6..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTCPClient/targetver.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// º궨Ҫƽ̨Ҫƽ̨ -// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ -// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ -// - -// ҪԵָ汾ƽ̨޸ж塣 -// йزͬƽ̨ӦֵϢο MSDN -#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista -#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 -#endif - diff --git a/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.cpp b/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.cpp index 8dc0e00a0..6e9cd4ee0 100644 --- a/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.cpp +++ b/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.cpp @@ -1,10 +1,10 @@ // CommonTcpTest.cpp : ̨Ӧóڵ㡣 // -#include "stdafx.h" + #include "../CommonTCPClient/CommonTCPClient.h" -int _tmain(int argc, _TCHAR* argv[]) +int main(int argc, char* argv[]) { TPClient_Connect(1, "127.0.0.1", 10040, NULL); TPClient_Run(true); diff --git a/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.vcproj b/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.vcproj deleted file mode 100644 index 6f8720b28..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTcpTest/CommonTcpTest.vcproj +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PssSampleClient/CommonTCPClient/CommonTcpTest/ReadMe.txt b/PssSampleClient/CommonTCPClient/CommonTcpTest/ReadMe.txt deleted file mode 100644 index 97c560f31..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTcpTest/ReadMe.txt +++ /dev/null @@ -1,29 +0,0 @@ -======================================================================== - 控制台应用程序:CommonTcpTest 项目概述 -======================================================================== - -应用程序向导已为您创建了此 CommonTcpTest 应用程序。 - -本文件概要介绍组成 CommonTcpTest 应用程序的 -的每个文件的内容。 - - -CommonTcpTest.vcproj - 这是使用应用程序向导生成的 VC++ 项目的主项目文件, - 其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 - -CommonTcpTest.cpp - 这是主应用程序源文件。 - -///////////////////////////////////////////////////////////////////////////// -其他标准文件: - -StdAfx.h, StdAfx.cpp - 这些文件用于生成名为 CommonTcpTest.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 - -///////////////////////////////////////////////////////////////////////////// -其他注释: - -应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 - -///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/PssSampleClient/CommonTCPClient/CommonTcpTest/stdafx.cpp b/PssSampleClient/CommonTCPClient/CommonTcpTest/stdafx.cpp deleted file mode 100644 index 0e874e1d9..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTcpTest/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : ֻ׼ļԴļ -// CommonTcpTest.pch ΪԤͷ -// stdafx.obj ԤϢ - -#include "stdafx.h" - -// TODO: STDAFX.H -// κĸͷļڴļ diff --git a/PssSampleClient/CommonTCPClient/CommonTcpTest/stdafx.h b/PssSampleClient/CommonTCPClient/CommonTcpTest/stdafx.h deleted file mode 100644 index 9d41f0f14..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTcpTest/stdafx.h +++ /dev/null @@ -1,15 +0,0 @@ -// stdafx.h : ׼ϵͳļİļ -// Ǿʹõĵ -// ضĿİļ -// - -#pragma once - -#include "targetver.h" - -#include -#include - - - -// TODO: ڴ˴óҪͷļ diff --git a/PssSampleClient/CommonTCPClient/CommonTcpTest/targetver.h b/PssSampleClient/CommonTCPClient/CommonTcpTest/targetver.h deleted file mode 100644 index 91794a5b6..000000000 --- a/PssSampleClient/CommonTCPClient/CommonTcpTest/targetver.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -// º궨Ҫƽ̨Ҫƽ̨ -// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ -// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ -// - -// ҪԵָ汾ƽ̨޸ж塣 -// йزͬƽ̨ӦֵϢο MSDN -#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista -#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 -#endif - diff --git a/PssSampleClient/CommonTCPClient/Makefile b/PssSampleClient/CommonTCPClient/Makefile new file mode 100644 index 000000000..666782e4d --- /dev/null +++ b/PssSampleClient/CommonTCPClient/Makefile @@ -0,0 +1,134 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=CommonTCPClient +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../PssSampleClient/CommonTCPClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="CommonTCPClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -O2 +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/thirdparty +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)pthread +ArLibs := "libpthread.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := $(Preprocessors) +CFLAGS := $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(ObjectSuffix): CommonTCPClient/TpClientManager.cpp $(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./CommonTCPClient/TpClientManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(DependSuffix): CommonTCPClient/TpClientManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(DependSuffix) -MM CommonTCPClient/TpClientManager.cpp + +$(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(PreprocessSuffix): CommonTCPClient/TpClientManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/CommonTCPClient_TpClientManager.cpp$(PreprocessSuffix) CommonTCPClient/TpClientManager.cpp + +$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(ObjectSuffix): CommonTCPClient/CommonTCPClient.cpp $(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./CommonTCPClient/CommonTCPClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(DependSuffix): CommonTCPClient/CommonTCPClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(DependSuffix) -MM CommonTCPClient/CommonTCPClient.cpp + +$(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(PreprocessSuffix): CommonTCPClient/CommonTCPClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/CommonTCPClient_CommonTCPClient.cpp$(PreprocessSuffix) CommonTCPClient/CommonTCPClient.cpp + +$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(ObjectSuffix): CommonTcpTest/CommonTcpTest.cpp $(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./CommonTcpTest/CommonTcpTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(DependSuffix): CommonTcpTest/CommonTcpTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(DependSuffix) -MM CommonTcpTest/CommonTcpTest.cpp + +$(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(PreprocessSuffix): CommonTcpTest/CommonTcpTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/CommonTcpTest_CommonTcpTest.cpp$(PreprocessSuffix) CommonTcpTest/CommonTcpTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/CommonTCPClient/compile_flags.txt b/PssSampleClient/CommonTCPClient/compile_flags.txt new file mode 100644 index 000000000..ea8f24e86 --- /dev/null +++ b/PssSampleClient/CommonTCPClient/compile_flags.txt @@ -0,0 +1,6 @@ +-I/data/develop/Lib/Network/PSS-master/PssSampleClient/CommonTCPClient +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML +-I/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty +-D_LINUX_PLATFORM_ +-DNDEBUG diff --git a/PssSampleClient/PSSFtpClient/CMakeLists.txt b/PssSampleClient/PSSFtpClient/CMakeLists.txt new file mode 100644 index 000000000..b1d430cfd --- /dev/null +++ b/PssSampleClient/PSSFtpClient/CMakeLists.txt @@ -0,0 +1,132 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PssFtpClient) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PssFtpClient_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../ThirdLib/include/TinyXML + ../../ThirdLib/include + ../../ThirdLib/thirdparty + ../../ThirdLib/src + +) + + +# Compiler options +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_1) +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_2) +add_definitions(${CL_VAR_1}) +add_definitions(${CL_VAR_2}) +add_definitions(-O2) +add_definitions(-Wall) +add_definitions(-fpermissive) +add_definitions(-fPIC) +add_definitions( + -DNDEBUG + -D_LINUX_PLATFORM_ + -D_FILE_OFFSET_BITS=64 + -DWXUSINGDLL + -D__WXGTK__ +) + + +# Linker options +execute_process(COMMAND + wx-config --debug=no --libs --unicode=yes + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_3) +set(LINK_OPTIONS ${CL_VAR_3}) + + +if(WIN32) + # Resource options + execute_process(COMMAND + wx-config --rcflags + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(STRIP ${CL_TMP_VAR} CL_VAR_4) + set(RC_OPTIONS ${CL_VAR_4}) +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/sock_wrap.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/CNetOperation.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PssFtpClient/PssFtpClientMain.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PssFtpClient/PssFtpClientApp.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/Mylog.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -Wall -pthread -fpermissive -fPIC") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(PssFtpClient ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PssFtpClient ${LINK_OPTIONS}) + +target_link_libraries(PssFtpClient + /usr/local/lib/liblog4cplus.so +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/PssSampleClient/PSSFtpClient/Makefile b/PssSampleClient/PSSFtpClient/Makefile new file mode 100644 index 000000000..45d179d43 --- /dev/null +++ b/PssSampleClient/PSSFtpClient/Makefile @@ -0,0 +1,142 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PssFtpClient +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../PssSampleClient/PSSFtpClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PssFtpClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/thirdparty $(IncludeSwitch)../../ThirdLib/src +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)log4cplus +ArLibs := "liblog4cplus.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -fpermissive -fPIC $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(ObjectSuffix) $(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix): ../../ThirdLib/include/CNetOperation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/CNetOperation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix): ../../ThirdLib/include/CNetOperation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) -MM ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix): ../../ThirdLib/include/CNetOperation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix) ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(ObjectSuffix): ./PssFtpClient/PssFtpClientMain.cpp $(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PssFtpClient/PssFtpClientMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(DependSuffix): ./PssFtpClient/PssFtpClientMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(DependSuffix) -MM ./PssFtpClient/PssFtpClientMain.cpp + +$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(PreprocessSuffix): ./PssFtpClient/PssFtpClientMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(PreprocessSuffix) ./PssFtpClient/PssFtpClientMain.cpp + +$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(ObjectSuffix): ./PssFtpClient/PssFtpClientApp.cpp $(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PssFtpClient/PssFtpClientApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(DependSuffix): ./PssFtpClient/PssFtpClientApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(DependSuffix) -MM ./PssFtpClient/PssFtpClientApp.cpp + +$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(PreprocessSuffix): ./PssFtpClient/PssFtpClientApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(PreprocessSuffix) ./PssFtpClient/PssFtpClientApp.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/Mylog.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/Mylog.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/Mylog.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/Mylog.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient.cbp b/PssSampleClient/PSSFtpClient/PssFtpClient.cbp new file mode 100644 index 000000000..e04924b0b --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient.cbp @@ -0,0 +1,48 @@ + + + + + + diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient.depend b/PssSampleClient/PSSFtpClient/PssFtpClient.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient.layout b/PssSampleClient/PSSFtpClient/PssFtpClient.layout new file mode 100644 index 000000000..8cc270e34 --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient.layout @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient.mk b/PssSampleClient/PSSFtpClient/PssFtpClient.mk new file mode 100644 index 000000000..d5e14cb2a --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient.mk @@ -0,0 +1,142 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PssFtpClient +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSFtpClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox-mulder +Date :=2019年04月02日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PssFtpClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/thirdparty $(IncludeSwitch)../../ThirdLib/src +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -fpermissive -fPIC $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(ObjectSuffix) $(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix): ../../ThirdLib/include/CNetOperation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/CNetOperation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix): ../../ThirdLib/include/CNetOperation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) -MM ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix): ../../ThirdLib/include/CNetOperation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix) ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(ObjectSuffix): ./PssFtpClient/PssFtpClientMain.cpp $(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(DependSuffix): ./PssFtpClient/PssFtpClientMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(DependSuffix) -MM ./PssFtpClient/PssFtpClientMain.cpp + +$(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(PreprocessSuffix): ./PssFtpClient/PssFtpClientMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PssFtpClient_PssFtpClientMain.cpp$(PreprocessSuffix) ./PssFtpClient/PssFtpClientMain.cpp + +$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(ObjectSuffix): ./PssFtpClient/PssFtpClientApp.cpp $(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(DependSuffix): ./PssFtpClient/PssFtpClientApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(DependSuffix) -MM ./PssFtpClient/PssFtpClientApp.cpp + +$(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(PreprocessSuffix): ./PssFtpClient/PssFtpClientApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PssFtpClient_PssFtpClientApp.cpp$(PreprocessSuffix) ./PssFtpClient/PssFtpClientApp.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/Mylog.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/Mylog.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/Mylog.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/Mylog.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient.project b/PssSampleClient/PSSFtpClient/PssFtpClient.project new file mode 100644 index 000000000..fd7d2e278 --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient.project @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient.sln b/PssSampleClient/PSSFtpClient/PssFtpClient.sln deleted file mode 100644 index 37f87b58c..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PssFtpClient", "PssFtpClient\PssFtpClient.vcxproj", "{E16D3A07-B791-4243-BFAA-415DA02656C4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E16D3A07-B791-4243-BFAA-415DA02656C4}.Debug|Win32.ActiveCfg = Debug|Win32 - {E16D3A07-B791-4243-BFAA-415DA02656C4}.Debug|Win32.Build.0 = Debug|Win32 - {E16D3A07-B791-4243-BFAA-415DA02656C4}.Release|Win32.ActiveCfg = Release|Win32 - {E16D3A07-B791-4243-BFAA-415DA02656C4}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient.txt b/PssSampleClient/PSSFtpClient/PssFtpClient.txt new file mode 100644 index 000000000..cef3379de --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient.txt @@ -0,0 +1 @@ +/data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_thirdparty_sock_wrap.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_include_CNetOperation.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/PssFtpClient_PssFtpClientMain.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/PssFtpClient_PssFtpClientApp.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_thirdparty_Mylog.cpp.o diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.cpp b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.cpp deleted file mode 100644 index f5a67be84..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// PssFtpClient.cpp : ӦóΪ -// - -#include "stdafx.h" -#include "PssFtpClient.h" -#include "PssFtpClientDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CPssFtpClientApp - -BEGIN_MESSAGE_MAP(CPssFtpClientApp, CWinApp) - ON_COMMAND(ID_HELP, &CWinApp::OnHelp) -END_MESSAGE_MAP() - - -// CPssFtpClientApp - -CPssFtpClientApp::CPssFtpClientApp() -{ - // TODO: ڴ˴ӹ룬 - // Ҫijʼ InitInstance -} - - -// Ψһһ CPssFtpClientApp - -CPssFtpClientApp theApp; - - -// CPssFtpClientApp ʼ - -BOOL CPssFtpClientApp::InitInstance() -{ - // һ Windows XP ϵӦó嵥ָҪ - // ʹ ComCtl32.dll 汾 6 ߰汾ÿӻʽ - //Ҫ InitCommonControlsEx()򣬽޷ڡ - INITCOMMONCONTROLSEX InitCtrls; - InitCtrls.dwSize = sizeof(InitCtrls); - // ΪҪӦóʹõ - // ؼࡣ - InitCtrls.dwICC = ICC_WIN95_CLASSES; - InitCommonControlsEx(&InitCtrls); - - CWinApp::InitInstance(); - - AfxEnableControlContainer(); - - // ׼ʼ - // δʹЩܲϣС - // տִļĴСӦƳ - // Ҫضʼ - // ڴ洢õע - // TODO: Ӧʵ޸ĸַ - // ޸Ϊ˾֯ - SetRegistryKey(_T("ӦóɵıӦó")); - - CPssFtpClientDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: ڴ˷ôʱ - // ȷرնԻĴ - } - else if (nResponse == IDCANCEL) - { - // TODO: ڴ˷ôʱ - // ȡرնԻĴ - } - - // ڶԻѹرգԽ FALSE Ա˳Ӧó - // ӦóϢá - return FALSE; -} diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.h b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.h deleted file mode 100644 index 084d019a3..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.h +++ /dev/null @@ -1,31 +0,0 @@ -// PssFtpClient.h : PROJECT_NAME Ӧóͷļ -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error "ڰļ֮ǰstdafx.h PCH ļ" -#endif - -#include "resource.h" // - - -// CPssFtpClientApp: -// йشʵ֣ PssFtpClient.cpp -// - -class CPssFtpClientApp : public CWinApp -{ -public: - CPssFtpClientApp(); - -// д - public: - virtual BOOL InitInstance(); - -// ʵ - - DECLARE_MESSAGE_MAP() -}; - -extern CPssFtpClientApp theApp; \ No newline at end of file diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.rc b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.rc deleted file mode 100644 index 5c809b161..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.rc +++ /dev/null @@ -1,221 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// (л񹲺͹) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -#ifdef _WIN32 -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -#pragma code_page(936) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n" - "LANGUAGE 4, 2\r\n" - "#pragma code_page(936)\r\n" - "#include ""res\\PssFtpClient.rc2"" // Microsoft Visual C++ ༭Դ\r\n" - "#include ""l.CHS\\afxres.rc"" // ׼\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\PssFtpClient.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " PssFtpClient" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20 - LTEXT "PssFtpClient1.0 ",IDC_STATIC,42,14,114,8,SS_NOPREFIX - LTEXT "Copyright (C) 2013",IDC_STATIC,42,26,114,8 - DEFPUSHBUTTON "ȷ",IDOK,113,41,50,14,WS_GROUP -END - -IDD_PSSFTPCLIENT_DIALOG DIALOGEX 0, 0, 418, 220 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "PSS FTPͻ" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "FTP",IDC_STATIC,7,7,404,46 - LTEXT "IP",IDC_STATIC,13,19,29,8 - EDITTEXT IDC_EDIT1,43,17,57,14,ES_AUTOHSCROLL - LTEXT "˿",IDC_STATIC,110,19,39,8 - EDITTEXT IDC_EDIT2,151,17,57,14,ES_AUTOHSCROLL - LTEXT "û",IDC_STATIC,17,36,22,8 - EDITTEXT IDC_EDIT3,42,34,57,14,ES_AUTOHSCROLL - LTEXT "",IDC_STATIC,115,36,22,8 - EDITTEXT IDC_EDIT4,151,34,57,14,ES_PASSWORD | ES_AUTOHSCROLL - PUSHBUTTON "½",IDC_BUTTON1,215,17,34,30 - PUSHBUTTON "˳",IDC_BUTTON2,260,17,34,30 - CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,94,404,119 - LTEXT "·",IDC_STATIC,14,59,28,8 - EDITTEXT IDC_EDIT5,47,57,118,14,ES_AUTOHSCROLL - LTEXT "Զ·",IDC_STATIC,171,59,28,8 - EDITTEXT IDC_EDIT6,203,57,118,14,ES_AUTOHSCROLL - PUSHBUTTON "",IDC_BUTTON3,324,57,41,14 - PUSHBUTTON "",IDC_BUTTON4,372,57,39,14 - LTEXT "ϴļ",IDC_STATIC,15,77,35,8 - EDITTEXT IDC_EDIT7,55,75,118,14,ES_AUTOHSCROLL - PUSHBUTTON "ϴ",IDC_BUTTON5,181,74,41,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080403a8" - BEGIN - VALUE "CompanyName", "TODO: <˾>" - VALUE "FileDescription", "TODO: <ļ˵>" - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "PssFtpClient.exe" - VALUE "LegalCopyright", "TODO: (C) <˾>Ȩ" - VALUE "OriginalFilename", "PssFtpClient.exe" - VALUE "ProductName", "TODO: <Ʒ>" - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x804, 936 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 163 - TOPMARGIN, 7 - BOTTOMMARGIN, 55 - END - - IDD_PSSFTPCLIENT_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 411 - TOPMARGIN, 7 - BOTTOMMARGIN, 213 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_ABOUTBOX " PssFtpClient(&A)..." -END - -#endif // (л񹲺͹) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -LANGUAGE 4, 2 -#pragma code_page(936) -#include "res\PssFtpClient.rc2" // Microsoft Visual C++ ༭Դ -#include "l.CHS\afxres.rc" // ׼ -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.vcproj b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.vcproj deleted file mode 100644 index 72ac20cef..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.vcproj +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.vcxproj b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.vcxproj deleted file mode 100644 index e2b594deb..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClient.vcxproj +++ /dev/null @@ -1,148 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {E16D3A07-B791-4243-BFAA-415DA02656C4} - PssFtpClient - MFCProj - - - - Application - v110 - Dynamic - Unicode - true - - - Application - v110 - Dynamic - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ./Bin\ - $(Configuration)\ - true - - - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - - - - _DEBUG;%(PreprocessorDefinitions) - false - true - - - Disabled - WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Use - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0804 - $(IntDir);%(AdditionalIncludeDirectories) - - - ws2_32.lib;%(AdditionalDependencies) - true - Windows - MachineX86 - - - - - NDEBUG;%(PreprocessorDefinitions) - false - true - - - MaxSpeed - true - WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) - false - MultiThreadedDLL - true - Use - Level3 - ProgramDatabase - - - NDEBUG;%(PreprocessorDefinitions) - 0x0804 - $(IntDir);%(AdditionalIncludeDirectories) - - - true - Windows - true - true - MachineX86 - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientApp.cpp b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientApp.cpp new file mode 100644 index 000000000..a84a16fd0 --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientApp.cpp @@ -0,0 +1,33 @@ +/*************************************************************** + * Name: PssFtpClientApp.cpp + * Purpose: Code for Application Class + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PssFtpClientApp.h" + +//(*AppHeaders +#include "PssFtpClientMain.h" +#include +//*) + +IMPLEMENT_APP(PssFtpClientApp); + +bool PssFtpClientApp::OnInit() +{ + //(*AppInitialize + bool wxsOK = true; + wxInitAllImageHandlers(); + if ( wxsOK ) + { + PssFtpClientFrame* Frame = new PssFtpClientFrame(0); + Frame->Show(); + SetTopWindow(Frame); + } + //*) + return wxsOK; + +} diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientApp.h b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientApp.h new file mode 100644 index 000000000..99da3b0ce --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientApp.h @@ -0,0 +1,22 @@ +/*************************************************************** + * Name: PssFtpClientApp.h + * Purpose: Defines Application Class + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSSFTPCLIENTAPP_H +#define PSSFTPCLIENTAPP_H + + +#include + +class PssFtpClientApp : public wxApp +{ + public: + virtual bool OnInit(); +}; + +#endif // PSSFTPCLIENTAPP_H diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientDlg.cpp b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientDlg.cpp deleted file mode 100644 index 10f15a502..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientDlg.cpp +++ /dev/null @@ -1,1276 +0,0 @@ -// PssFtpClientDlg.cpp : ʵļ -// - -#include "stdafx.h" -#include "PssFtpClient.h" -#include "PssFtpClientDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -//ִ߳ -DWORD WINAPI ThreadProc(LPVOID argv) -{ - CPssFtpClientDlg* pPssFtpClientDlg = (CPssFtpClientDlg *)argv; - if(NULL != pPssFtpClientDlg) - { - pPssFtpClientDlg->DownLoadListFile(); - } - - return 0; -} - -// Ӧó򡰹ڡ˵ CAboutDlg Ի - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - - // Ի - enum { IDD = IDD_ABOUTBOX }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - - // ʵ -protected: - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) -END_MESSAGE_MAP() - - -// CPssFtpClientDlg Ի - - - - -CPssFtpClientDlg::CPssFtpClientDlg(CWnd* pParent /*=NULL*/) -: CDialog(CPssFtpClientDlg::IDD, pParent) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CPssFtpClientDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_EDIT1, m_txtServerIP); - DDX_Control(pDX, IDC_EDIT2, m_txtServerPort); - DDX_Control(pDX, IDC_EDIT3, m_txtUserName); - DDX_Control(pDX, IDC_EDIT4, m_txtUserPass); - DDX_Control(pDX, IDC_LIST1, m_lcPath); - DDX_Control(pDX, IDC_BUTTON1, m_btnLogin); - DDX_Control(pDX, IDC_BUTTON2, m_btnLogout); - DDX_Control(pDX, IDC_EDIT5, m_txtLocalPath); - DDX_Control(pDX, IDC_EDIT6, m_txtRemotePath); - DDX_Control(pDX, IDC_BUTTON4, m_btnDownLoadFile); - DDX_Control(pDX, IDC_EDIT7, m_txtUpFileName); -} - -BEGIN_MESSAGE_MAP(CPssFtpClientDlg, CDialog) - ON_WM_SYSCOMMAND() - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDC_BUTTON1, &CPssFtpClientDlg::OnBnClickedButton1) - ON_WM_CLOSE() - ON_BN_CLICKED(IDC_BUTTON2, &CPssFtpClientDlg::OnBnClickedButton2) - ON_BN_CLICKED(IDC_BUTTON3, &CPssFtpClientDlg::OnBnClickedButton3) - ON_NOTIFY(NM_CLICK, IDC_LIST1, &CPssFtpClientDlg::OnNMClickList1) - ON_BN_CLICKED(IDC_BUTTON4, &CPssFtpClientDlg::OnBnClickedButton4) - ON_BN_CLICKED(IDC_BUTTON5, &CPssFtpClientDlg::OnBnClickedButton5) -END_MESSAGE_MAP() - - -// CPssFtpClientDlg Ϣ - -BOOL CPssFtpClientDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // ...˵ӵϵͳ˵С - - // IDM_ABOUTBOX ϵͳΧڡ - ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); - ASSERT(IDM_ABOUTBOX < 0xF000); - - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - CString strAboutMenu; - strAboutMenu.LoadString(IDS_ABOUTBOX); - if (!strAboutMenu.IsEmpty()) - { - pSysMenu->AppendMenu(MF_SEPARATOR); - pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); - } - } - - // ô˶ԻͼꡣӦóڲǶԻʱܽԶ - // ִд˲ - SetIcon(m_hIcon, TRUE); // ôͼ - SetIcon(m_hIcon, FALSE); // Сͼ - - // TODO: ڴӶijʼ - Init(); - - return TRUE; // ǽõؼ򷵻 TRUE -} - -void CPssFtpClientDlg::OnSysCommand(UINT nID, LPARAM lParam) -{ - if ((nID & 0xFFF0) == IDM_ABOUTBOX) - { - CAboutDlg dlgAbout; - dlgAbout.DoModal(); - } - else - { - CDialog::OnSysCommand(nID, lParam); - } -} - -// ԻСťҪĴ -// Ƹͼꡣʹĵ/ͼģ͵ MFC Ӧó -// ⽫ɿԶɡ - -void CPssFtpClientDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // ڻƵ豸 - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // ʹͼڹо - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // ͼ - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -//û϶Сʱϵͳô˺ȡù -//ʾ -HCURSOR CPssFtpClientDlg::OnQueryDragIcon() -{ - return static_cast(m_hIcon); -} - - -void CPssFtpClientDlg::OnBnClickedButton1() -{ - // TODO: ڴӿؼ֪ͨ - CString strData; - - m_txtServerIP.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_ClientFTPInfo.szServerIP, MAX_BUFF_50, NULL,NULL); - m_ClientFTPInfo.szServerIP[nDecLen] = '\0'; - - m_txtServerPort.GetWindowText(strData); - m_ClientFTPInfo.nServerPort = _ttoi((LPCTSTR)strData); - - m_txtUserName.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_ClientFTPInfo.szUserName, MAX_BUFF_50, NULL,NULL); - m_ClientFTPInfo.szUserName[nDecLen] = '\0'; - - m_txtUserPass.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_ClientFTPInfo.szUserPass, MAX_BUFF_50, NULL,NULL); - m_ClientFTPInfo.szUserPass[nDecLen] = '\0'; - - //жsocketǷѾӣϿ - if(m_sckClient != INVALID_SOCKET) - { - Close(); - } - - if(Connect() == false) - { - return; - } - - if(true == Send_Login()) - { - MessageBox(_T("Զ̷ɹ"), _T("ʾϢ"), MB_OK); - m_btnLogin.EnableWindow(FALSE); - m_btnLogout.EnableWindow(TRUE); - } - else - { - Close(); - } -} - -void CPssFtpClientDlg::OnBnClickedButton2() -{ - //õdzΪ - Send_Logout(); - Close(); - MessageBox(_T("dzɹ"), _T("ʾϢ"), MB_OK); - m_btnLogin.EnableWindow(TRUE); - m_btnLogout.EnableWindow(FALSE); -} - -void CPssFtpClientDlg::Init() -{ - m_txtServerIP.SetWindowText(_T("127.0.0.1")); - m_txtServerPort.SetWindowText(_T("10002")); - m_txtUserName.SetWindowText(_T("freeeyes")); - m_txtUserPass.SetWindowText(_T("1234")); - - m_lcPath.InsertColumn(0, _T("ļ"), LVCFMT_CENTER, 300); - m_lcPath.InsertColumn(1, _T(""), LVCFMT_CENTER, 50); - m_lcPath.InsertColumn(2, _T("С"), LVCFMT_CENTER, 150); - - DWORD dwStyle = m_lcPath.GetExtendedStyle(); - dwStyle |= LVS_EX_FULLROWSELECT;//ѡijʹиֻreportlistctrl - dwStyle |= LVS_EX_GRIDLINES;//ߣֻreportlistctrl - dwStyle |= LVS_EX_CHECKBOXES;//itemǰcheckboxؼ - m_lcPath.SetExtendedStyle(dwStyle); //չ - - //ʼTCP - WSADATA wsaData; - int nErr = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(nErr != 0) - { - MessageBox(_T("socketʧܣ鱾socket汾"), _T("Ϣ"), MB_OK); - } - - m_txtLocalPath.SetWindowText(_T("./")); - m_txtRemotePath.SetWindowText(_T("./")); - - m_btnLogin.EnableWindow(TRUE); - m_btnLogout.EnableWindow(FALSE); - - m_sckClient = INVALID_SOCKET; -} - -void CPssFtpClientDlg::Close() -{ - closesocket(m_sckClient); - m_sckClient = INVALID_SOCKET; -} - -bool CPssFtpClientDlg::Connect() -{ - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(m_ClientFTPInfo.nServerPort); - sockaddr.sin_addr.S_un.S_addr = inet_addr(m_ClientFTPInfo.szServerIP); - - m_sckClient = socket(AF_INET, SOCK_STREAM, 0); - - DWORD TimeOut = (DWORD)100; - ::setsockopt(m_sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); - - int nErr = connect(m_sckClient, (SOCKADDR*)&sockaddr, sizeof(SOCKADDR)); - if(0 != nErr) - { - //ʧ - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - return true; -} - -void CPssFtpClientDlg::OnClose() -{ - // TODO: ڴϢ/Ĭֵ - - //жsocketǷѾӣϿ - if(m_sckClient != INVALID_SOCKET) - { - Close(); - } - - CDialog::OnClose(); -} - -bool CPssFtpClientDlg::Send_Login() -{ - int nCommand = COMMAND_LOGIN; - char szSendBuff[MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - short sVersion = 1; - int nPos = 0; - int nLen = 1 + 1 + (int)strlen(m_ClientFTPInfo.szUserName) + (int)strlen(m_ClientFTPInfo.szUserPass); - char szSession[32] = {'\0'}; - - sprintf_s(szSession, 32, "FREEEYES"); - - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&sVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - int nStrLen = (int)strlen(m_ClientFTPInfo.szUserName); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_ClientFTPInfo.szUserName, nStrLen); - nPos += nStrLen; - - nStrLen = (int)strlen(m_ClientFTPInfo.szUserPass); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_ClientFTPInfo.szUserPass, nStrLen); - nPos += nStrLen; - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRet = 0; - nPos = 0; - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRet, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - if(nRet == LOGIN_FAIL_NOEXIST) - { - MessageBox(_T("û"), _T("Ϣ"), MB_OK); - return false; - } - else if(nRet == LOGIN_FAIL_ONLINE) - { - MessageBox(_T("ûߣܵ¼"), _T("Ϣ"), MB_OK); - return false; - } - else if(nRet == LOGIN_FAIL_PASSWORD) - { - MessageBox(_T("û벻ȷ"), _T("Ϣ"), MB_OK); - return false; - } - - return true; -} - -bool CPssFtpClientDlg::Send_Logout() -{ - int nCommand = COMMAND_LOGOUT; - char szSendBuff[MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - short sVersion = 1; - int nPos = 0; - int nLen = 1 + (int)strlen(m_ClientFTPInfo.szUserName); - char szSession[32] = {'\0'}; - - sprintf_s(szSession, 32, "FREEEYES"); - - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&sVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - int nStrLen = (int)strlen(m_ClientFTPInfo.szUserName); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_ClientFTPInfo.szUserName, nStrLen); - nPos += nStrLen; - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRet = 0; - nPos = 0; - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRet, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - return true; -} - -bool CPssFtpClientDlg::Send_FileList(const char* pRemotePath) -{ - m_lcPath.DeleteAllItems(); - int nCommand = COMMAND_FILELIST; - char szSendBuff[MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - short sVersion = 1; - int nPos = 0; - int nLen = 1 + 2 + (int)strlen(m_ClientFTPInfo.szUserName) + (int)strlen(pRemotePath); - char szSession[32] = {'\0'}; - - sprintf_s(szSession, 32, "FREEEYES"); - - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&sVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - int nStrLen = (int)strlen(m_ClientFTPInfo.szUserName); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_ClientFTPInfo.szUserName, nStrLen); - nPos += nStrLen; - - nStrLen = (int)strlen(pRemotePath); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nStrLen, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)pRemotePath, nStrLen); - nPos += nStrLen; - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRet = 0; - nPos = 0; - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRet, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - if(nRet == OP_OK) - { - int nCount = 0; - memcpy_s((char*)&nCount, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - for(int i = 0; i < nCount; i++) - { - int nFileNameLen = 0; - char szFileName[MAX_BUFF_500] = {'\0'}; - int nFileType = IS_FILE; - int nFileSize = 0; - memcpy_s((char*)&nFileNameLen, sizeof(char), &pRecvBuff[nPos], sizeof(char)); - nPos += sizeof(char); - memcpy_s((char*)&szFileName, nFileNameLen, &pRecvBuff[nPos], nFileNameLen); - nPos += nFileNameLen; - memcpy_s((char*)&nFileType, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - memcpy_s((char*)&nFileSize, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - //ʾ - CString strData; - wchar_t wszFileName[MAX_BUFF_500] = {'\0'}; - - int nSrcLen = MultiByteToWideChar(CP_ACP, 0, szFileName, -1, NULL, 0); - int nDecLen = MultiByteToWideChar(CP_ACP, 0, szFileName, -1, wszFileName, MAX_BUFF_500); - - m_lcPath.InsertItem(i, wszFileName); - if(nFileType == IS_FILE) - { - m_lcPath.SetItemText(i, 1, _T("ļ")); - } - else - { - m_lcPath.SetItemText(i, 1, _T("ļ")); - } - strData.Format(_T("%d"), nFileSize); - m_lcPath.SetItemText(i, 2, strData); - } - } - - return true; -} - -bool CPssFtpClientDlg::Send_Download(const char* pLocalPath, const char* pFileName, const char* pRemotePath, int nIndex, int nSize, int& nBockCount) -{ - int nCommand = COMMAND_FILE_DOWNLOAD; - char szSendBuff[MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - short sVersion = 1; - int nPos = 0; - int nLen = 2 + 1 + 8 + (int)strlen(m_ClientFTPInfo.szUserName) + (int)strlen(pRemotePath); - char szSession[32] = {'\0'}; - - sprintf_s(szSession, 32, "FREEEYES"); - - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&sVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - int nStrLen = (int)strlen(m_ClientFTPInfo.szUserName); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_ClientFTPInfo.szUserName, nStrLen); - nPos += nStrLen; - - nStrLen = (int)strlen(pRemotePath); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nStrLen, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)pRemotePath, nStrLen); - nPos += nStrLen; - - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nSize, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nIndex, sizeof(int)); - nPos += sizeof(int); - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRet = 0; - nPos = 0; - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRet, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - if(nRet == OP_OK) - { - //õļ飬дļ - char* pBuffer = new char[nSize]; - int nFileBlockCount = 0; - int nFileCurrIndex = 0; - int nFileCurrBufferSize = 0; - - memcpy_s((char*)&nBockCount, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - memcpy_s((char*)&nFileCurrIndex, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - memcpy_s((char*)&nFileCurrBufferSize, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - memcpy_s((char*)pBuffer, nFileCurrBufferSize, &pRecvBuff[nPos], nFileCurrBufferSize); - nPos += nFileCurrBufferSize; - - char szLocalFilePath[MAX_BUFF_500] = {'\0'}; - sprintf_s(szLocalFilePath, MAX_BUFF_500, "%s%s", pLocalPath, pFileName); - - //дļ - if(nFileCurrIndex == 0) - { - //dzʼɾǰļ - remove(szLocalFilePath); - } - - FILE* pFile = NULL; - fopen_s(&pFile, szLocalFilePath, "ab+"); - if(pFile == NULL) - { - MessageBox(_T("д뱾ļʧ"), _T("Ϣ"), MB_OK); - delete[] pBuffer; - return false; - } - - fwrite(pBuffer, sizeof(char), nFileCurrBufferSize, pFile); - fclose(pFile); - delete[] pBuffer; - } - else - { - MessageBox(_T("Զļʧ"), _T("Ϣ"), MB_OK); - return false; - } - - return true; -} - -bool CPssFtpClientDlg::Send_Upload( const char* pLocalPath, const char* pFileName, const char* pRemotePath ) -{ - int nBufferSize = MAX_BUFF_10240; - int nCommand = COMMAND_FILE_UPLOAD; - char szSendBuff[MAX_BUFF_10240 + MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - char szLoaclFilePath[MAX_BUFF_500] = {'\0'}; - sprintf_s(szLoaclFilePath, MAX_BUFF_500, "%s%s", pLocalPath, pFileName); - - //õǰļС - FILE* pFile = NULL; - fopen_s(&pFile, szLoaclFilePath, "rb"); - if(NULL == pFile) - { - return false; - } - - fseek(pFile, 0L, SEEK_END); - int nFileLen = (int)ftell(pFile); - int nBlockCount = 0; - int nLastBufferSize = 0; - - if(nFileLen % nBufferSize != 0) - { - nBlockCount = nFileLen / nBufferSize + 1; - nLastBufferSize = nFileLen % nBufferSize; - } - else - { - nBlockCount = nFileLen / nBufferSize; - nLastBufferSize = nBufferSize; - } - - fclose(pFile); - pFile = NULL; - - for(int i = 0; i < nBlockCount; i++) - { - fopen_s(&pFile, szLoaclFilePath, "rb"); - if(NULL == pFile) - { - return false; - } - - int nPos = 0; - char szBuffer[MAX_BUFF_10240] = {'\0'}; - if(i != nBlockCount - 1) - { - //һ - fseek(pFile, (long)(i * nBufferSize), SEEK_CUR); - - int nReadSize = fread((char* )szBuffer, sizeof(char), nBufferSize, pFile); - - int nLen = 2 + 1 + 12 + (int)strlen(m_ClientFTPInfo.szUserName) + (int)strlen(pRemotePath) + nBufferSize; - - short sVersion = 1; - char szSession[32] = {'\0'}; - - sprintf_s(szSession, 32, "FREEEYES"); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&sVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - int nStrLen = (int)strlen(m_ClientFTPInfo.szUserName); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_ClientFTPInfo.szUserName, nStrLen); - nPos += nStrLen; - - nStrLen = (int)strlen(pRemotePath); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nStrLen, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)pRemotePath, nStrLen); - nPos += nStrLen; - - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nBufferSize, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&i, sizeof(int)); - nPos += sizeof(int); - - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nBufferSize, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], nBufferSize, (char*)szBuffer, nBufferSize); - nPos += nBufferSize; - } - else - { - //һ - fseek(pFile, (long)(i * nBufferSize), SEEK_CUR); - - int nReadSize = fread((char* )szBuffer, sizeof(char), nLastBufferSize, pFile); - - int nLen = 2 + 1 + 12 + (int)strlen(m_ClientFTPInfo.szUserName) + (int)strlen(pRemotePath) + nLastBufferSize; - - short sVersion = 1; - char szSession[32] = {'\0'}; - - sprintf_s(szSession, 32, "FREEEYES"); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&sVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - int nStrLen = (int)strlen(m_ClientFTPInfo.szUserName); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_ClientFTPInfo.szUserName, nStrLen); - nPos += nStrLen; - - nStrLen = (int)strlen(pRemotePath); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nStrLen, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)pRemotePath, nStrLen); - nPos += nStrLen; - - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLastBufferSize, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&i, sizeof(int)); - nPos += sizeof(int); - - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLastBufferSize, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], nLastBufferSize, (char*)szBuffer, nLastBufferSize); - nPos += nLastBufferSize; - } - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - fclose(pFile); - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - fclose(pFile); - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - fclose(pFile); - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRet = 0; - nPos = 0; - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRet, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - if(nRet != OP_OK) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - fclose(pFile); - return false; - } - - fclose(pFile); - } - - MessageBox(_T("ϴļɹ"), _T("Ϣ"), MB_OK); - - return true; -} - -void CPssFtpClientDlg::OnBnClickedButton3() -{ - //ԶĿ¼,б - CString strData; - char szRemotePath[MAX_BUFF_500] = {'\0'}; - - m_txtRemotePath.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szRemotePath, MAX_BUFF_500, NULL,NULL); - szRemotePath[nDecLen] = '\0'; - - Send_FileList(szRemotePath); -} - -void CPssFtpClientDlg::OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult) -{ - //LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast(pNMHDR); - // TODO: ڴӿؼ֪ͨ - HD_NOTIFY *phdn = (HD_NOTIFY *)pNMHDR; - - //к - int nRow = phdn->iItem; - - CString StrPathName = m_lcPath.GetItemText(nRow, 0); - CString StrPathType = m_lcPath.GetItemText(nRow, 1); - - if(wcscmp((LPCTSTR)StrPathType, _T("ļ")) == 0) - { - //ļУm_txtRemotePath - CString strData; - m_txtRemotePath.GetWindowText(strData); - strData += StrPathName + _T("/"); - m_txtRemotePath.SetWindowText(strData); - } - - if(StrPathType ) - - *pResult = 0; -} - -void CPssFtpClientDlg::OnBnClickedButton4() -{ - //̨߳ - DWORD ThreadID = 0; - CreateThread(NULL, NULL, ThreadProc, (LPVOID)this, NULL, &ThreadID); -} - -void CPssFtpClientDlg::DownLoadListFile() -{ - m_btnDownLoadFile.EnableWindow(FALSE); - //ļ - for(int i = 0; i < m_lcPath.GetItemCount(); i++) - { - if( m_lcPath.GetItemState(i, LVIS_SELECTED) == LVIS_SELECTED || m_lcPath.GetCheck(i)) - { - //ѡļ - int nBufferCount = 0; - char szFileName[MAX_BUFF_500] = {'\0'}; - char szRemotePath[MAX_BUFF_500] = {'\0'}; - char szLocalPath[MAX_BUFF_500] = {'\0'}; - - //õļ - CString strData; - CString strRomoteFilePath; - CString strLocalPath; - CString StrPathName = m_lcPath.GetItemText(i, 0); - m_txtRemotePath.GetWindowText(strData); - strRomoteFilePath = strData + StrPathName; - - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strRomoteFilePath, strRomoteFilePath.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strRomoteFilePath, nSrcLen, szRemotePath, MAX_BUFF_500, NULL, NULL); - szRemotePath[nDecLen] = '\0'; - - nSrcLen = WideCharToMultiByte(CP_ACP, 0, StrPathName, StrPathName.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, StrPathName, nSrcLen, szFileName, MAX_BUFF_500, NULL, NULL); - szFileName[nDecLen] = '\0'; - - m_txtLocalPath.GetWindowText(strLocalPath); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strLocalPath, strLocalPath.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strLocalPath, nSrcLen, szLocalPath, MAX_BUFF_500, NULL, NULL); - szLocalPath[nDecLen] = '\0'; - - _DownloadFileInfo objDownloadFileInfo; - - //Ҫע⣬Ҫøݿ飬Ҫ޸PSSݰСļ - //ĬPSS֧ݰ20KҪԸĵĸ - int nSize = MAX_BUFF_10240; - - sprintf_s(objDownloadFileInfo.szLocalPath, MAX_BUFF_500, "%s", szLocalPath); - sprintf_s(objDownloadFileInfo.szFileName, MAX_BUFF_500, "%s", szFileName); - sprintf_s(objDownloadFileInfo.szRemotePath, MAX_BUFF_500, "%s", szRemotePath); - objDownloadFileInfo.nSize = nSize; - - int nIndex = 0; - - bool blState = Send_Download(szLocalPath, szFileName, szRemotePath, nIndex, nSize, nBufferCount); - if(blState == false) - { - MessageBox(_T("Զļʧ"), _T("Ϣ"), MB_OK); - continue; - } - - for(int i = 1; i < nBufferCount; i++) - { - blState = Send_Download(szLocalPath, szFileName, szRemotePath, i, nSize, nBufferCount); - if(blState == false) - { - MessageBox(_T("Զļʧ"), _T("Ϣ"), MB_OK); - break; - } - } - } - } - - MessageBox(_T("ļ"), _T("ʾϢ"), MB_OK); - m_btnDownLoadFile.EnableWindow(TRUE); -} -void CPssFtpClientDlg::OnBnClickedButton5() -{ - //ϴļ - char szFileName[MAX_BUFF_500] = {'\0'}; - char szRemotePath[MAX_BUFF_500] = {'\0'}; - char szLocalPath[MAX_BUFF_500] = {'\0'}; - char szLocalFile[MAX_BUFF_500] = {'\0'}; - char szRemoteFile[MAX_BUFF_500] = {'\0'}; - - //õļ - CString strData; - CString strRomoteFilePath; - CString strLocalPath; - CString strLocalFile; - - m_txtRemotePath.GetWindowText(strRomoteFilePath); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strRomoteFilePath, strRomoteFilePath.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strRomoteFilePath, nSrcLen, szRemotePath, MAX_BUFF_500, NULL, NULL); - szRemotePath[nDecLen] = '\0'; - - m_txtLocalPath.GetWindowText(strLocalPath); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strLocalPath, strLocalPath.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strLocalPath, nSrcLen, szLocalPath, MAX_BUFF_500, NULL, NULL); - szLocalPath[nDecLen] = '\0'; - - m_txtUpFileName.GetWindowText(strLocalFile); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strLocalFile, strLocalFile.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strLocalFile, nSrcLen, szLocalFile, MAX_BUFF_500, NULL, NULL); - szLocalFile[nDecLen] = '\0'; - - sprintf_s(szRemoteFile, MAX_BUFF_500, "%s/%s", strRomoteFilePath, szLocalFile); - - Send_Upload(szLocalPath, szLocalFile, szRemoteFile); - -} diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientDlg.h b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientDlg.h deleted file mode 100644 index 7d86f9d45..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientDlg.h +++ /dev/null @@ -1,123 +0,0 @@ -// PssFtpClientDlg.h : ͷļ -// - -#pragma once -#include "afxwin.h" -#include "afxcmn.h" - -#include - -#define MAX_BUFF_50 50 -#define MAX_BUFF_500 500 -#define MAX_BUFF_10240 10240 - -#define COMMAND_LOGIN 0x2000 //½ -#define COMMAND_LOGOUT 0x2001 //˳ -#define COMMAND_FILELIST 0x2002 //ļļб -#define COMMAND_FILE_DOWNLOAD 0x2003 //ļ -#define COMMAND_FILE_UPLOAD 0x2004 //ļϴ -#define COMMAND_RETURN_LOGIN 0xe000 //½Ӧ -#define COMMAND_RETURN_LOGOUT 0xe001 //dzӦ -#define COMMAND_RETURN_FILELIST 0xe002 //ļļбӦ -#define COMMAND_RETURN_FILE_DOWNLOAD 0xe003 //ļ -#define COMMAND_RETURN_FILE_UPLOAD 0xe004 //ļϴ - -#define LOGIN_SUCCESS 0 -#define LOGIN_FAIL_NOEXIST 1 -#define LOGIN_FAIL_ONLINE 2 -#define LOGIN_FAIL_PASSWORD 3 - -#define OP_OK 0 -#define OP_FAIL 1 - -#define IS_FILE 0 -#define IS_DIRRNT 1 - -struct _ClientFTPInfo -{ - char szServerIP[MAX_BUFF_50]; - int nServerPort; - char szUserName[MAX_BUFF_50]; - char szUserPass[MAX_BUFF_50]; - - _ClientFTPInfo() - { - szServerIP[0] = '\0'; - nServerPort = 0; - szUserName[0] = '\0'; - szUserPass[0] = '\0'; - } -}; - -struct _DownloadFileInfo -{ - char szLocalPath[MAX_BUFF_500]; - char szFileName[MAX_BUFF_500]; - char szRemotePath[MAX_BUFF_500]; - int nSize; -}; - -// CPssFtpClientDlg Ի -class CPssFtpClientDlg : public CDialog -{ -// -public: - CPssFtpClientDlg(CWnd* pParent = NULL); // ׼캯 - -// Ի - enum { IDD = IDD_PSSFTPCLIENT_DIALOG }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - - -// ʵ -protected: - HICON m_hIcon; - - // ɵϢӳ亯 - virtual BOOL OnInitDialog(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - DECLARE_MESSAGE_MAP() -public: - afx_msg void OnBnClickedButton1(); - CEdit m_txtServerIP; - CEdit m_txtServerPort; - CEdit m_txtUserName; - CEdit m_txtUserPass; - CListCtrl m_lcPath; - CButton m_btnLogin; - CButton m_btnLogout; - CEdit m_txtLocalPath; - CEdit m_txtRemotePath; - CButton m_btnDownLoadFile; - CEdit m_txtUpFileName; - -private: - void Init(); - void Close(); - bool Connect(); - - bool Send_Login(); - bool Send_Logout(); - bool Send_FileList(const char* pRemotePath); - bool Send_Download(const char* pLocalPath, const char* pFileName, const char* pRemotePath, int nIndex, int nSize, int& nBockCount); - bool Send_Upload(const char* pLocalPath, const char* pFileName, const char* pRemotePath); - -private: - SOCKET m_sckClient; - _ClientFTPInfo m_ClientFTPInfo; - -public: - void DownLoadListFile(); - -public: - afx_msg void OnClose(); - afx_msg void OnBnClickedButton2(); - afx_msg void OnBnClickedButton3(); - afx_msg void OnNMClickList1(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnBnClickedButton4(); - afx_msg void OnBnClickedButton5(); -}; diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientMain.cpp b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientMain.cpp new file mode 100644 index 000000000..0365d5e26 --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientMain.cpp @@ -0,0 +1,331 @@ +/*************************************************************** + * Name: PssFtpClientMain.cpp + * Purpose: Code for Application Frame + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PssFtpClientMain.h" +#include + +//(*InternalHeaders(PssFtpClientFrame) +#include +#include +#include +#include +#include +//*) + +//helper functions +enum wxbuildinfoformat { + short_f, long_f }; + +wxString wxbuildinfo(wxbuildinfoformat format) +{ + wxString wxbuild(wxVERSION_STRING); + + if (format == long_f ) + { +#if defined(__WXMSW__) + wxbuild << wxT("-Windows"); +#elif defined(__UNIX__) + wxbuild << wxT("-Linux"); +#endif + +#if wxUSE_UNICODE + wxbuild << wxT("-Unicode build"); +#else + wxbuild << wxT("-ANSI build"); +#endif // wxUSE_UNICODE + } + + return wxbuild; +} + + + +//(*IdInit(PssFtpClientFrame) +const long PssFtpClientFrame::ID_STATICBOX1 = wxNewId(); +const long PssFtpClientFrame::ID_STATICTEXT1 = wxNewId(); +const long PssFtpClientFrame::ID_TEXTCTRL1 = wxNewId(); +const long PssFtpClientFrame::ID_STATICTEXT2 = wxNewId(); +const long PssFtpClientFrame::ID_TEXTCTRL2 = wxNewId(); +const long PssFtpClientFrame::ID_STATICTEXT3 = wxNewId(); +const long PssFtpClientFrame::ID_STATICTEXT4 = wxNewId(); +const long PssFtpClientFrame::ID_TEXTCTRL3 = wxNewId(); +const long PssFtpClientFrame::ID_TEXTCTRL4 = wxNewId(); +const long PssFtpClientFrame::ID_BUTTON1 = wxNewId(); +const long PssFtpClientFrame::ID_BUTTON2 = wxNewId(); +const long PssFtpClientFrame::ID_STATICTEXT5 = wxNewId(); +const long PssFtpClientFrame::ID_TEXTCTRL5 = wxNewId(); +const long PssFtpClientFrame::ID_STATICTEXT6 = wxNewId(); +const long PssFtpClientFrame::ID_TEXTCTRL6 = wxNewId(); +const long PssFtpClientFrame::ID_BUTTON3 = wxNewId(); +const long PssFtpClientFrame::ID_BUTTON4 = wxNewId(); +const long PssFtpClientFrame::ID_STATICTEXT7 = wxNewId(); +const long PssFtpClientFrame::ID_TEXTCTRL7 = wxNewId(); +const long PssFtpClientFrame::ID_BUTTON5 = wxNewId(); +const long PssFtpClientFrame::ID_LISTCTRL1 = wxNewId(); +const long PssFtpClientFrame::ID_PANEL1 = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(PssFtpClientFrame,wxFrame) + //(*EventTable(PssFtpClientFrame) + //*) +END_EVENT_TABLE() + +PssFtpClientFrame::PssFtpClientFrame(wxWindow* parent,wxWindowID id) +{ + //(*Initialize(PssFtpClientFrame) + Create(parent, id, wxT("PSS FTP客户端"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); + SetClientSize(wxSize(747,418)); + { + wxIcon FrameIcon; + FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("./Icon.jpg")))); + SetIcon(FrameIcon); + } + Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(168,120), wxSize(744,418), wxTAB_TRAVERSAL, _T("ID_PANEL1")); + StaticBox1 = new wxStaticBox(Panel1, ID_STATICBOX1, wxT("FTP配置"), wxPoint(8,0), wxSize(728,104), 0, _T("ID_STATICBOX1")); + StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, wxT("服务器IP"), wxPoint(16,32), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + TextCtrl_ServerIP = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxT("127.0.0.1"), wxPoint(88,24), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); + StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, wxT("服务器端口"), wxPoint(248,32), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + TextCtrl_ServerPort = new wxTextCtrl(Panel1, ID_TEXTCTRL2, wxT("10002"), wxPoint(328,24), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); + StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, wxT("用户名"), wxPoint(16,72), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + StaticText4 = new wxStaticText(Panel1, ID_STATICTEXT4, wxT("密码"), wxPoint(248,72), wxDefaultSize, 0, _T("ID_STATICTEXT4")); + TextCtrl_Username = new wxTextCtrl(Panel1, ID_TEXTCTRL3, wxT("freeeyes"), wxPoint(88,64), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL3")); + TextCtrl_Password = new wxTextCtrl(Panel1, ID_TEXTCTRL4, wxT("1234"), wxPoint(328,64), wxSize(136,35), wxTE_PASSWORD, wxDefaultValidator, _T("ID_TEXTCTRL4")); + Button_Login = new wxButton(Panel1, ID_BUTTON1, wxT("登陆"), wxPoint(488,24), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); + Button_Logout = new wxButton(Panel1, ID_BUTTON2, wxT("退出"), wxPoint(488,64), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); + Button_Logout->Disable(); + StaticText5 = new wxStaticText(Panel1, ID_STATICTEXT5, wxT("保存路径"), wxPoint(16,120), wxDefaultSize, 0, _T("ID_STATICTEXT5")); + TextCtrl_SavePath = new wxTextCtrl(Panel1, ID_TEXTCTRL5, wxT("./"), wxPoint(88,112), wxSize(192,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL5")); + StaticText6 = new wxStaticText(Panel1, ID_STATICTEXT6, wxT("远程路径"), wxPoint(288,120), wxDefaultSize, 0, _T("ID_STATICTEXT6")); + TextCtrl_RemotePath = new wxTextCtrl(Panel1, ID_TEXTCTRL6, wxT("./"), wxPoint(344,112), wxSize(194,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL6")); + Button_Open = new wxButton(Panel1, ID_BUTTON3, wxT("打开"), wxPoint(552,112), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); + Button_Download = new wxButton(Panel1, ID_BUTTON4, wxT("下载"), wxPoint(648,112), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); + StaticText7 = new wxStaticText(Panel1, ID_STATICTEXT7, wxT("上传文件名"), wxPoint(16,168), wxDefaultSize, 0, _T("ID_STATICTEXT7")); + TextCtrl_UploadFilename = new wxTextCtrl(Panel1, ID_TEXTCTRL7, wxEmptyString, wxPoint(88,160), wxSize(184,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL7")); + Button_Upload = new wxButton(Panel1, ID_BUTTON5, wxT("上传"), wxPoint(288,160), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5")); + ListCtrl_FileList = new wxListCtrl(Panel1, ID_LISTCTRL1, wxPoint(16,200), wxSize(712,208), wxLC_LIST|wxLC_REPORT, wxDefaultValidator, _T("ID_LISTCTRL1")); + + Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PssFtpClientFrame::OnButton_LoginClick); + Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PssFtpClientFrame::OnButton_LogoutClick); + Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PssFtpClientFrame::OnButton_OpenClick); + Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PssFtpClientFrame::OnButton_DownloadClick); + Connect(ID_BUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PssFtpClientFrame::OnButton_UploadClick); + //*) + + + this->Init(); +} + +PssFtpClientFrame::~PssFtpClientFrame() +{ + //(*Destroy(PssFtpClientFrame) + //*) + delete pNetOperation; +} + +void PssFtpClientFrame::OnQuit(wxCommandEvent& event) +{ + pNetOperation->Close(); +} + + + + +void PssFtpClientFrame::Init() +{ + + this->ListCtrl_FileList->InsertColumn(0, wxT("文件名称"), wxLIST_FORMAT_CENTER, 300); + this->ListCtrl_FileList->InsertColumn(1, wxT("属性"), wxLIST_FORMAT_CENTER, 50); + this->ListCtrl_FileList->InsertColumn(2, wxT("大小"), wxLIST_FORMAT_CENTER, 150); + + + + //初始化TCP链接 + pNetOperation =new CNetOperation(SOCK_STREAM); + +} + +void PssFtpClientFrame::OnAbout(wxCommandEvent& event) +{ + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, wxT("Welcome to...")); +} + + +void PssFtpClientFrame::OnButton_LogoutClick(wxCommandEvent& event) +{ + //设置登出行为 + wxCSConv cvGBK( wxT("GBK") ); + std::string szRemotePath =std::string( cvGBK.cWX2MB( this->TextCtrl_RemotePath->GetValue().c_str() ) ); + std::string strUserName =std::string( cvGBK.cWX2MB( this->TextCtrl_Username->GetValue().c_str() ) ); +// + _LoginInfo objLoginInfo; + pNetOperation->Send_Logout(objLoginInfo,COMMAND_FTP_LOGOUT,strUserName); + pNetOperation->Close(); + wxMessageBox(wxT("登出服务器成功。"), wxT("提示信息"), wxOK | wxICON_INFORMATION, this); + this->Button_Login->Enable(true); + this->Button_Logout->Enable(false); + +} + +void PssFtpClientFrame::OnButton_OpenClick(wxCommandEvent& event) +{ + + //打开远程目录,并获得列表 + + wxCSConv cvGBK( wxT("GBK") ); + std::string szRemotePath =std::string( cvGBK.cWX2MB( this->TextCtrl_RemotePath->GetValue().c_str() ) ); + std::string strUserName =std::string( cvGBK.cWX2MB( this->TextCtrl_Username->GetValue().c_str() ) ); + + pNetOperation->Send_FileList(strUserName,szRemotePath); + +} +void PssFtpClientFrame::OnButton_DownloadClick(wxCommandEvent& event) +{ + + //启动后台线程下载 + // std::thread thread_download(&PssFtpClientFrame::DownLoadListFile,this); + // thread_download.detach(); // 等待线程结束 + + this->DownLoadListFile(); + +} + + +void PssFtpClientFrame::OnButton_UploadClick(wxCommandEvent& event) +{ +//上传文件 + + wxCSConv cvGBK( wxT("GBK") ); + std::string strRomoteFilePath =std::string( cvGBK.cWX2MB( this->TextCtrl_RemotePath->GetValue().c_str() ) ); + std::string strLocalPath =std::string( cvGBK.cWX2MB( this->TextCtrl_SavePath->GetValue().c_str() ) ); + std::string strLocalFile =std::string( cvGBK.cWX2MB( this->TextCtrl_UploadFilename->GetValue().c_str() ) ); + std::string strRemoteFile =strRomoteFilePath+std::string("/")+strLocalFile; + std::string strUserName =std::string( cvGBK.cWX2MB( this->TextCtrl_Username->GetValue().c_str() ) ); + + pNetOperation->Send_Upload(strUserName,strRomoteFilePath,strLocalPath, strLocalFile); +} + + +void PssFtpClientFrame::OnButton_LoginClick(wxCommandEvent& event) +{ + + std::string strServerIP =std::string(this->TextCtrl_ServerIP->GetValue()); + int nPort = wxAtoi(this->TextCtrl_ServerPort->GetValue()); + + memcpy(m_ClientFTPInfo.szServerIP,strServerIP.c_str(),strServerIP.length()); + m_ClientFTPInfo.szServerIP[strServerIP.length()] = '\0'; + m_ClientFTPInfo.nServerPort =nPort; + + if(strServerIP == wxT("") || nPort == 0) + { + wxString msg = wxT("请输入完整的服务器IP地址和端口信息。"); + wxMessageBox(msg, wxT("服务器信息"), wxOK | wxICON_INFORMATION, this); + return; + } + + //获得相关测试信息 + wxCSConv cvGBK( wxT("GBK") ); + std::string strUserName =std::string( cvGBK.cWX2MB( this->TextCtrl_Username->GetValue().c_str() ) ); + std::string strUserPass =std::string( cvGBK.cWX2MB( this->TextCtrl_Password->GetValue().c_str() ) ); + + + + memcpy(m_ClientFTPInfo.szUserName,strUserName.c_str(),strUserName.length()); + memcpy(m_ClientFTPInfo.szUserPass,strUserPass.c_str(),strUserPass.length()); + + m_ClientFTPInfo.szUserName[strUserName.length()] = '\0'; + m_ClientFTPInfo.szUserPass[strUserPass.length()] = '\0'; + + + //判断socket是否已经连接,如果有连接则断开 + if(pNetOperation->Conn(strServerIP,nPort,1000) == false) + { + return; + } + + _LoginInfo objLoginInfo; + if(pNetOperation->Send_Login(objLoginInfo,COMMAND_FTP_LOGIN,strUserName,strUserPass) ==true ) + { + wxMessageBox(wxT("连接远程服务器成功"), wxT("提示信息"), wxOK | wxICON_INFORMATION, this); + this->Button_Login->Enable(false); + this->Button_Logout->Enable(true); + } + else + { + pNetOperation->Close(); + } + +} + +void PssFtpClientFrame::DownLoadListFile() +{ + this->Button_Download->Enable(false); + + //下载文件 + for(int i = 0; i < this->ListCtrl_FileList->GetItemCount(); i++) + { + if( this->ListCtrl_FileList->GetItemState(i, wxLIST_STATE_SELECTED) == wxLIST_STATE_SELECTED ) + { + //选中了下载文件 + int nBufferCount = 0; + + //得到文件名 + wxCSConv cvGBK( wxT("GBK") ); + std::string strData =std::string( cvGBK.cWX2MB( this->TextCtrl_RemotePath->GetValue().c_str() ) ); + + std::string strLocalPath=std::string( cvGBK.cWX2MB( this->TextCtrl_SavePath->GetValue().c_str() ) ); + std::string strPathName = std::string( cvGBK.cWX2MB( this->ListCtrl_FileList->GetItemText(i, 0).c_str() ) ); + std::string strRomoteFilePath = strData + strPathName; + + std::string strUserName =std::string( cvGBK.cWX2MB( this->TextCtrl_Username->GetValue().c_str() ) ); + std::string strUserPass =std::string( cvGBK.cWX2MB( this->TextCtrl_Password->GetValue().c_str() ) ); + + _DownloadFileInfo objDownloadFileInfo; + + //这里要注意,如果要设置更大的数据块,需要修改PSS的数据包最大大小的配置文件 + //默认PSS支持最大单数据包是20K,如果需要可以改的更大 + int nSize = MAX_BUFF_10240; + + sprintf_s(objDownloadFileInfo.szLocalPath, MAX_BUFF_500, "%s", strLocalPath.c_str()); + sprintf_s(objDownloadFileInfo.szFileName, MAX_BUFF_500, "%s", strPathName.c_str()); + sprintf_s(objDownloadFileInfo.szRemotePath, MAX_BUFF_500, "%s", strRomoteFilePath.c_str()); + + + + objDownloadFileInfo.nSize = nSize; + + int nIndex = 0; + + bool blState = pNetOperation->Send_Download(strUserName,strRomoteFilePath,strLocalPath, strPathName, nIndex, nSize, nBufferCount); + + if(blState == false) + { + wxMessageBox(wxT("远程文件下载失败"), wxT("错误信息"), wxOK | wxICON_INFORMATION, this); + continue; + } + + for(int i = 1; i < nBufferCount; i++) + { + blState = pNetOperation->Send_Download(strUserName,strRomoteFilePath,strLocalPath, strPathName, i, nSize, nBufferCount); + + if(blState == false) + { + wxMessageBox(wxT("远程文件下载失败"), wxT("错误信息"), wxOK | wxICON_INFORMATION, this); + break; + } + } + } + } + + wxMessageBox(wxT("下载文件完成"), wxT("提示信息"), wxOK | wxICON_INFORMATION, this); + this->Button_Download->Enable(true); + +} + + diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientMain.h b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientMain.h new file mode 100644 index 000000000..6168dceeb --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient/PssFtpClientMain.h @@ -0,0 +1,151 @@ +/*************************************************************** + * Name: PssFtpClientMain.h + * Purpose: Defines Application Frame + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSSFTPCLIENTMAIN_H +#define PSSFTPCLIENTMAIN_H +#include + +#include "CNetOperation.h" + +//(*Headers(PssFtpClientFrame) +#include +#include +#include +#include +#include +#include +#include +//*) + + + + + + + +struct _ClientFTPInfo +{ + char szServerIP[MAX_BUFF_50]; + int nServerPort; + char szUserName[MAX_BUFF_50]; + char szUserPass[MAX_BUFF_50]; + + _ClientFTPInfo() + { + szServerIP[0] = '\0'; + nServerPort = 0; + szUserName[0] = '\0'; + szUserPass[0] = '\0'; + } +}; + +struct _DownloadFileInfo +{ + char szLocalPath[MAX_BUFF_500]; + char szFileName[MAX_BUFF_500]; + char szRemotePath[MAX_BUFF_500]; + int nSize; +}; + +class PssFtpClientFrame: public wxFrame +{ + public: + + PssFtpClientFrame(wxWindow* parent,wxWindowID id = -1); + virtual ~PssFtpClientFrame(); + + private: + + //(*Handlers(PssFtpClientFrame) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnButton_LoginClick(wxCommandEvent& event); + void OnButton_LogoutClick(wxCommandEvent& event); + void OnButton_OpenClick(wxCommandEvent& event); + void OnButton_DownloadClick(wxCommandEvent& event); + void OnButton5Click(wxCommandEvent& event); + void OnButton_UploadClick(wxCommandEvent& event); + //*) + + //(*Identifiers(PssFtpClientFrame) + static const long ID_STATICBOX1; + static const long ID_STATICTEXT1; + static const long ID_TEXTCTRL1; + static const long ID_STATICTEXT2; + static const long ID_TEXTCTRL2; + static const long ID_STATICTEXT3; + static const long ID_STATICTEXT4; + static const long ID_TEXTCTRL3; + static const long ID_TEXTCTRL4; + static const long ID_BUTTON1; + static const long ID_BUTTON2; + static const long ID_STATICTEXT5; + static const long ID_TEXTCTRL5; + static const long ID_STATICTEXT6; + static const long ID_TEXTCTRL6; + static const long ID_BUTTON3; + static const long ID_BUTTON4; + static const long ID_STATICTEXT7; + static const long ID_TEXTCTRL7; + static const long ID_BUTTON5; + static const long ID_LISTCTRL1; + static const long ID_PANEL1; + //*) + + //(*Declarations(PssFtpClientFrame) + wxButton* Button_Download; + wxButton* Button_Login; + wxButton* Button_Logout; + wxButton* Button_Open; + wxButton* Button_Upload; + wxListCtrl* ListCtrl_FileList; + wxPanel* Panel1; + wxStaticBox* StaticBox1; + wxStaticText* StaticText1; + wxStaticText* StaticText2; + wxStaticText* StaticText3; + wxStaticText* StaticText4; + wxStaticText* StaticText5; + wxStaticText* StaticText6; + wxStaticText* StaticText7; + wxTextCtrl* TextCtrl_Password; + wxTextCtrl* TextCtrl_RemotePath; + wxTextCtrl* TextCtrl_SavePath; + wxTextCtrl* TextCtrl_ServerIP; + wxTextCtrl* TextCtrl_ServerPort; + wxTextCtrl* TextCtrl_UploadFilename; + wxTextCtrl* TextCtrl_Username; + //*) + + DECLARE_EVENT_TABLE() + + +private: + + void Init(); +/* void Close(); + bool Conn(); + + bool Send_Login(); + bool Send_Logout(); + bool Send_FileList(const char* pRemotePath); + bool Send_Download(const char* pLocalPath, const char* pFileName, const char* pRemotePath, int nIndex, int nSize, int& nBockCount); + bool Send_Upload(const char* pLocalPath, const char* pFileName, const char* pRemotePath); +*/ + +private: + CNetOperation *pNetOperation; + _ClientFTPInfo m_ClientFTPInfo; + +public: + void DownLoadListFile(); + +}; + +#endif // PSSFTPCLIENTMAIN_H diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/ReadMe.txt b/PssSampleClient/PSSFtpClient/PssFtpClient/ReadMe.txt deleted file mode 100644 index 239e69a47..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/ReadMe.txt +++ /dev/null @@ -1,73 +0,0 @@ -================================================================================ -MICROSOFT : PssFtpClient Ŀ -=============================================================================== - -ӦóΪ PssFtpClient Ӧó򡣴Ӧó򲻽ʾ Microsoft Ļʹ÷ΪдӦó㡣 - -ļҪ PssFtpClient Ӧóÿļݡ - -PssFtpClient.vcproj -ʹӦóɵ VC++ ĿĿļ -ɸļ Visual C++ İ汾ϢԼйʹӦóѡƽ̨úĿܵϢ - -PssFtpClient.h -ӦóҪͷļĿضͷļ( Resource.h) CPssFtpClientApp Ӧóࡣ - -PssFtpClient.cpp -ǰӦó CPssFtpClientApp ҪӦóԴļ - -PssFtpClient.rc -dzʹõ Microsoft Windows Դб RES Ŀ¼д洢ͼꡢλͼ͹ꡣļֱ Microsoft Visual C++ нб༭ĿԴλ 2052 С - -res\PssFtpClient.ico -ӦóͼͼļͼҪԴļ PssFtpClient.rc С - -res\PssFtpClient.rc2 -ļ Microsoft Visual C++ нб༭ԴӦýԴ༭༭ԴڴļС - - -///////////////////////////////////////////////////////////////////////////// - -Ӧó򵼴һԻ: - -PssFtpClientDlg.hPssFtpClientDlg.cpp - Ի -Щļ CPssFtpClientDlg ࡣඨӦóԻΪöԻģλ PssFtpClient.rc Уļ Microsoft Visual C++ нб༭ - - -///////////////////////////////////////////////////////////////////////////// - -: - -ActiveX ؼ -Ӧóʹ ActiveX ؼ֧֡ - -ӡӡԤ֧ -Ӧóͨ MFC CView еijԱڴӡӡúʹӡԤĴ롣 - -///////////////////////////////////////////////////////////////////////////// - -׼ļ: - -StdAfx.hStdAfx.cpp -ЩļΪ PssFtpClient.pch Ԥͷ (PCH) ļΪ StdAfx.obj Ԥļ - -Resource.h -DZ׼ͷļµԴ ID -Microsoft Visual C++ ȡ´ļ - -PssFtpClient.manifest - Ӧó嵥ļ Windows XP Ӧó - ض汾г򼯵ԡسʹô - Ϣӳ򼯻ʵij򼯻 - Ӧó˽ϢӦó嵥Ϊ·ַΪ - Ӧóִļװͬļеⲿ .manifest ļ - ҲԴʽڸÿִļС -///////////////////////////////////////////////////////////////////////////// - -ע: - -ӦóʹáTODO:ָʾӦӻԶԴ벿֡ - -Ӧóڹ DLL ʹ MFCҪ·Щ MFC DLLӦóõϵͳĵǰòͬҪ·ӦıػԴ MFC90XXX.DLLйĸϢμ MSDN ĵй Redistributing Visual C++ applications (· Visual C++ Ӧó)½ڡ - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/res/PssFtpClient.ico b/PssSampleClient/PSSFtpClient/PssFtpClient/res/PssFtpClient.ico deleted file mode 100644 index 8a84ca3d3..000000000 Binary files a/PssSampleClient/PSSFtpClient/PssFtpClient/res/PssFtpClient.ico and /dev/null differ diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/res/PssFtpClient.rc2 b/PssSampleClient/PSSFtpClient/PssFtpClient/res/PssFtpClient.rc2 deleted file mode 100644 index 4a5a6aacc..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/res/PssFtpClient.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// PssFtpClient.RC2 - Microsoft Visual C++ ֱӱ༭Դ -// - -#ifdef APSTUDIO_INVOKED -#error ļ Microsoft Visual C++ ༭ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// ڴ˴ֶ༭Դ... - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/resource.h b/PssSampleClient/PSSFtpClient/PssFtpClient/resource.h deleted file mode 100644 index 1d6c271c7..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/resource.h +++ /dev/null @@ -1,33 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PssFtpClient.rc -// -#define IDM_ABOUTBOX 0x0010 -#define IDD_ABOUTBOX 100 -#define IDS_ABOUTBOX 101 -#define IDD_PSSFTPCLIENT_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDC_EDIT1 1000 -#define IDC_EDIT2 1001 -#define IDC_EDIT3 1002 -#define IDC_EDIT4 1003 -#define IDC_BUTTON1 1004 -#define IDC_BUTTON2 1005 -#define IDC_LIST1 1006 -#define IDC_EDIT5 1007 -#define IDC_EDIT6 1008 -#define IDC_BUTTON3 1009 -#define IDC_BUTTON4 1010 -#define IDC_EDIT7 1011 -#define IDC_BUTTON5 1012 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1010 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/stdafx.cpp b/PssSampleClient/PSSFtpClient/PssFtpClient/stdafx.cpp deleted file mode 100644 index f6dd289aa..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/stdafx.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// stdafx.cpp : ֻ׼ļԴļ -// PssFtpClient.pch ΪԤͷ -// stdafx.obj ԤϢ - -#include "stdafx.h" - - diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/stdafx.h b/PssSampleClient/PSSFtpClient/PssFtpClient/stdafx.h deleted file mode 100644 index 4d4711a70..000000000 --- a/PssSampleClient/PSSFtpClient/PssFtpClient/stdafx.h +++ /dev/null @@ -1,57 +0,0 @@ -// stdafx.h : ׼ϵͳļİļ -// Ǿʹõĵ -// ضĿİļ - -#pragma once - -#ifndef _SECURE_ATL -#define _SECURE_ATL 1 -#endif - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Windows ͷųʹõ -#endif - -#include "targetver.h" - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // ijЩ CString 캯ʽ - -// ر MFC ijЩɷĺԵľϢ -#define _AFX_ALL_WARNINGS - -#include // MFC ͱ׼ -#include // MFC չ - - -#include // MFC Զ - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC Internet Explorer 4 ؼ֧ -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC Windows ؼ֧ -#endif // _AFX_NO_AFXCMN_SUPPORT - - - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_IA64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - - diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/wxsmith/PssFtpClientframe.wxs b/PssSampleClient/PSSFtpClient/PssFtpClient/wxsmith/PssFtpClientframe.wxs new file mode 100644 index 000000000..53f9ce0fe --- /dev/null +++ b/PssSampleClient/PSSFtpClient/PssFtpClient/wxsmith/PssFtpClientframe.wxs @@ -0,0 +1,112 @@ + + + + PSS FTP客户端 + ./Icon.jpg + 747,418 + + + 168,120 + 744,418 + + + 8,0 + 728,104 + + + + 16,32 + + + 127.0.0.1 + 88,24 + 136,35 + + + + 248,32 + + + 10002 + 328,24 + 136,35 + + + + 16,72 + + + + 248,72 + + + freeeyes + 88,64 + 136,35 + + + 1234 + 328,64 + 136,35 + + + + + 488,24 + + + + + 488,64 + 0 + + + + + 16,120 + + + ./ + 88,112 + 192,35 + + + + 288,120 + + + ./ + 344,112 + 194,35 + + + + 552,112 + + + + + 648,112 + + + + + 16,168 + + + 88,160 + 184,35 + + + + 288,160 + + + + 16,200 + 712,208 + + + + + diff --git a/PssSampleClient/PSSFtpClient/compile_flags.txt b/PssSampleClient/PSSFtpClient/compile_flags.txt new file mode 100644 index 000000000..90ccc07da --- /dev/null +++ b/PssSampleClient/PSSFtpClient/compile_flags.txt @@ -0,0 +1,12 @@ +-I/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSFtpClient +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include +-I/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty +-I/data/develop/Lib/Network/PSS-master/ThirdLib/src +-I/usr/lib/wx/include/gtk2-unicode-3.0 +-I/usr/include/wx-3.0 +-D__WXGTK__ +-D_FILE_OFFSET_BITS=64 +-DWXUSINGDLL +-DNDEBUG +-D_LINUX_PLATFORM_ diff --git a/PssSampleClient/PSSLoginClient/CMakeLists.txt b/PssSampleClient/PSSLoginClient/CMakeLists.txt new file mode 100644 index 000000000..c61885d23 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/CMakeLists.txt @@ -0,0 +1,132 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PSSLoginClient) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PSSLoginClient_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../ThirdLib/include/TinyXML + ../../ThirdLib/include + ../../ThirdLib/thirdparty + ../../ThirdLib/src + +) + + +# Compiler options +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_1) +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_2) +add_definitions(${CL_VAR_1}) +add_definitions(${CL_VAR_2}) +add_definitions(-O2) +add_definitions(-Wall) +add_definitions(-fpermissive) +add_definitions(-fPIC) +add_definitions( + -DNDEBUG + -D_LINUX_PLATFORM_ + -D_FILE_OFFSET_BITS=64 + -DWXUSINGDLL + -D__WXGTK__ +) + + +# Linker options +execute_process(COMMAND + wx-config --debug=no --libs --unicode=yes + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_3) +set(LINK_OPTIONS ${CL_VAR_3}) + + +if(WIN32) + # Resource options + execute_process(COMMAND + wx-config --rcflags + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(STRIP ${CL_TMP_VAR} CL_VAR_4) + set(RC_OPTIONS ${CL_VAR_4}) +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L/usr/local/lib/ ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/sock_wrap.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/CNetOperation.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PSSLoginClient/PSSLoginClientApp.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PSSLoginClient/PSSLoginClientMain.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/Mylog.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -Wall -pthread -fpermissive -fPIC") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(PSSLoginClient ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PSSLoginClient ${LINK_OPTIONS}) + +target_link_libraries(PSSLoginClient + liblog4cplus.so +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/PssSampleClient/PSSLoginClient/LoginClient.sln b/PssSampleClient/PSSLoginClient/LoginClient.sln deleted file mode 100644 index b2e1c21f4..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LoginClient", "LoginClient\LoginClient.vcproj", "{C5D863A1-2306-40C6-8901-CDDEB8BE8068}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C5D863A1-2306-40C6-8901-CDDEB8BE8068}.Debug|Win32.ActiveCfg = Debug|Win32 - {C5D863A1-2306-40C6-8901-CDDEB8BE8068}.Debug|Win32.Build.0 = Debug|Win32 - {C5D863A1-2306-40C6-8901-CDDEB8BE8068}.Release|Win32.ActiveCfg = Release|Win32 - {C5D863A1-2306-40C6-8901-CDDEB8BE8068}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.cpp b/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.cpp deleted file mode 100644 index 279fa76ef..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// LoginClient.cpp : ӦóΪ -// - -#include "stdafx.h" -#include "LoginClient.h" -#include "LoginClientDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CLoginClientApp - -BEGIN_MESSAGE_MAP(CLoginClientApp, CWinApp) - ON_COMMAND(ID_HELP, &CWinApp::OnHelp) -END_MESSAGE_MAP() - - -// CLoginClientApp - -CLoginClientApp::CLoginClientApp() -{ - // TODO: ڴ˴ӹ룬 - // Ҫijʼ InitInstance -} - - -// Ψһһ CLoginClientApp - -CLoginClientApp theApp; - - -// CLoginClientApp ʼ - -BOOL CLoginClientApp::InitInstance() -{ - // һ Windows XP ϵӦó嵥ָҪ - // ʹ ComCtl32.dll 汾 6 ߰汾ÿӻʽ - //Ҫ InitCommonControlsEx()򣬽޷ڡ - INITCOMMONCONTROLSEX InitCtrls; - InitCtrls.dwSize = sizeof(InitCtrls); - // ΪҪӦóʹõ - // ؼࡣ - InitCtrls.dwICC = ICC_WIN95_CLASSES; - InitCommonControlsEx(&InitCtrls); - - CWinApp::InitInstance(); - - if (!AfxSocketInit()) - { - AfxMessageBox(IDP_SOCKETS_INIT_FAILED); - return FALSE; - } - - AfxEnableControlContainer(); - - // ׼ʼ - // δʹЩܲϣС - // տִļĴСӦƳ - // Ҫضʼ - // ڴ洢õע - // TODO: Ӧʵ޸ĸַ - // ޸Ϊ˾֯ - SetRegistryKey(_T("ӦóɵıӦó")); - - CLoginClientDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: ڴ˷ôʱ - // ȷرնԻĴ - } - else if (nResponse == IDCANCEL) - { - // TODO: ڴ˷ôʱ - // ȡرնԻĴ - } - - // ڶԻѹرգԽ FALSE Ա˳Ӧó - // ӦóϢá - return FALSE; -} diff --git a/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.h b/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.h deleted file mode 100644 index f237e9861..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.h +++ /dev/null @@ -1,31 +0,0 @@ -// LoginClient.h : PROJECT_NAME Ӧóͷļ -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error "ڰļ֮ǰstdafx.h PCH ļ" -#endif - -#include "resource.h" // - - -// CLoginClientApp: -// йشʵ֣ LoginClient.cpp -// - -class CLoginClientApp : public CWinApp -{ -public: - CLoginClientApp(); - -// д - public: - virtual BOOL InitInstance(); - -// ʵ - - DECLARE_MESSAGE_MAP() -}; - -extern CLoginClientApp theApp; \ No newline at end of file diff --git a/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.rc b/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.rc deleted file mode 100644 index 34d303e23..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.rc +++ /dev/null @@ -1,232 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// (л񹲺͹) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -#ifdef _WIN32 -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -#pragma code_page(936) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n" - "LANGUAGE 4, 2\r\n" - "#pragma code_page(936)\r\n" - "#include ""res\\LoginClient.rc2"" // Microsoft Visual C++ ༭Դ\r\n" - "#include ""l.CHS\\afxres.rc"" // ׼\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\LoginClient.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " LoginClient" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,14,14,20,20 - LTEXT "LoginClientԶͻ",IDC_STATIC,42,14,114,8,SS_NOPREFIX - LTEXT "Copyright (C) freeeyes 2013",IDC_STATIC,42,26,114,8 - DEFPUSHBUTTON "ȷ",IDOK,113,41,50,14,WS_GROUP -END - -IDD_LOGINCLIENT_DIALOG DIALOGEX 0, 0, 339, 280 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "Կͻ" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "½",IDC_STATIC,7,7,325,73 - GROUPBOX "Խ",IDC_STATIC,7,147,325,126 - CONTROL "",IDC_LIST1,"SysListView32",LVS_REPORT | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,14,161,308,91 - EDITTEXT IDC_EDIT1,49,255,96,14,ES_AUTOHSCROLL - LTEXT "ʱ",IDC_STATIC,16,257,31,8 - EDITTEXT IDC_EDIT2,50,17,75,14,ES_AUTOHSCROLL - LTEXT "IP",IDC_STATIC,14,19,33,8,SS_WORDELLIPSIS - EDITTEXT IDC_EDIT3,173,17,75,14,ES_AUTOHSCROLL - LTEXT "˿",IDC_STATIC,130,19,40,8,SS_WORDELLIPSIS - EDITTEXT IDC_EDIT4,50,35,75,14,ES_AUTOHSCROLL - LTEXT "û",IDC_STATIC,14,37,33,8,SS_WORDELLIPSIS - EDITTEXT IDC_EDIT5,173,34,75,14,ES_AUTOHSCROLL - LTEXT "",IDC_STATIC,137,37,33,8,SS_WORDELLIPSIS - PUSHBUTTON "һ",IDC_BUTTON1,255,34,37,14 - EDITTEXT IDC_EDIT6,50,53,75,14,ES_AUTOHSCROLL - LTEXT "",IDC_STATIC,14,55,33,8,SS_WORDELLIPSIS - EDITTEXT IDC_EDIT7,173,52,75,14,ES_AUTOHSCROLL - LTEXT "",IDC_STATIC,137,54,33,8,SS_WORDELLIPSIS - PUSHBUTTON "ѹ",IDC_BUTTON2,254,52,37,14 - PUSHBUTTON "ֹͣ",IDC_BUTTON3,293,52,37,14 - GROUPBOX "ûϢ",IDC_STATIC,7,82,325,61 - EDITTEXT IDC_EDIT8,51,91,75,14,ES_AUTOHSCROLL - LTEXT "ûID",IDC_STATIC,15,93,33,8,SS_WORDELLIPSIS - PUSHBUTTON "һ",IDC_BUTTON4,135,91,37,14 - EDITTEXT IDC_EDIT9,51,109,41,14,ES_AUTOHSCROLL - LTEXT "ûID",IDC_STATIC,15,111,33,8,SS_WORDELLIPSIS - EDITTEXT IDC_EDIT10,124,109,39,14,ES_AUTOHSCROLL - LTEXT "Life",IDC_STATIC,107,111,14,8,SS_WORDELLIPSIS - EDITTEXT IDC_EDIT11,200,109,39,14,ES_AUTOHSCROLL - LTEXT "Magic",IDC_STATIC,175,111,21,8,SS_WORDELLIPSIS - PUSHBUTTON "ֵ",IDC_BUTTON5,247,108,37,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080403a8" - BEGIN - VALUE "CompanyName", "TODO: <˾>" - VALUE "FileDescription", "TODO: <ļ˵>" - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "LoginClient.exe" - VALUE "LegalCopyright", "TODO: (C) <˾>Ȩ" - VALUE "OriginalFilename", "LoginClient.exe" - VALUE "ProductName", "TODO: <Ʒ>" - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x804, 936 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 163 - TOPMARGIN, 7 - BOTTOMMARGIN, 55 - END - - IDD_LOGINCLIENT_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 332 - TOPMARGIN, 7 - BOTTOMMARGIN, 273 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_ABOUTBOX " LoginClient(&A)..." - IDP_SOCKETS_INIT_FAILED "Windows ׽ֳʼʧܡ" -END - -#endif // (л񹲺͹) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -LANGUAGE 4, 2 -#pragma code_page(936) -#include "res\LoginClient.rc2" // Microsoft Visual C++ ༭Դ -#include "l.CHS\afxres.rc" // ׼ -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.vcproj b/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.vcproj deleted file mode 100644 index 57a3e39fa..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/LoginClient.vcproj +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PssSampleClient/PSSLoginClient/LoginClient/LoginClientDlg.cpp b/PssSampleClient/PSSLoginClient/LoginClient/LoginClientDlg.cpp deleted file mode 100644 index 1d48867a8..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/LoginClientDlg.cpp +++ /dev/null @@ -1,968 +0,0 @@ -// LoginClientDlg.cpp : ʵļ -// - -#include "stdafx.h" -#include "LoginClient.h" -#include "LoginClientDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - -//ִ߳ -DWORD WINAPI ThreadProc(LPVOID argv) -{ - CLoginClientDlg* pLoginClientDlg = (CLoginClientDlg *)argv; - if(NULL != pLoginClientDlg) - { - pLoginClientDlg->Send_Multiple_Login(); - } - - return 0; -} - - -// Ӧó򡰹ڡ˵ CAboutDlg Ի - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - -// Ի - enum { IDD = IDD_ABOUTBOX }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - -// ʵ -protected: - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) -END_MESSAGE_MAP() - - -// CLoginClientDlg Ի - - - - -CLoginClientDlg::CLoginClientDlg(CWnd* pParent /*=NULL*/) - : CDialog(CLoginClientDlg::IDD, pParent) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CLoginClientDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_EDIT2, m_txtServerIP); - DDX_Control(pDX, IDC_EDIT3, m_txtServerPort); - DDX_Control(pDX, IDC_EDIT4, m_txtUserName); - DDX_Control(pDX, IDC_EDIT5, m_txtUserPass); - DDX_Control(pDX, IDC_EDIT6, m_txtIDFrom); - DDX_Control(pDX, IDC_EDIT7, m_txtIDTo); - DDX_Control(pDX, IDC_LIST1, m_lcServer); - DDX_Control(pDX, IDC_EDIT1, m_txtClientCost); - DDX_Control(pDX, IDC_EDIT8, m_txtSeachUserID); - DDX_Control(pDX, IDC_EDIT9, m_txtUserID); - DDX_Control(pDX, IDC_EDIT10, m_txtUserLife); - DDX_Control(pDX, IDC_EDIT11, m_txtUserMagic); -} - -BEGIN_MESSAGE_MAP(CLoginClientDlg, CDialog) - ON_WM_SYSCOMMAND() - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDC_BUTTON1, &CLoginClientDlg::OnBnClickedButton1) - ON_BN_CLICKED(IDC_BUTTON2, &CLoginClientDlg::OnBnClickedButton2) - ON_WM_CLOSE() - ON_BN_CLICKED(IDC_BUTTON3, &CLoginClientDlg::OnBnClickedButton3) - ON_WM_TIMER() - ON_BN_CLICKED(IDC_BUTTON4, &CLoginClientDlg::OnBnClickedButton4) - ON_BN_CLICKED(IDC_BUTTON5, &CLoginClientDlg::OnBnClickedButton5) -END_MESSAGE_MAP() - - -// CLoginClientDlg Ϣ - -BOOL CLoginClientDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // ...˵ӵϵͳ˵С - - // IDM_ABOUTBOX ϵͳΧڡ - ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); - ASSERT(IDM_ABOUTBOX < 0xF000); - - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - CString strAboutMenu; - strAboutMenu.LoadString(IDS_ABOUTBOX); - if (!strAboutMenu.IsEmpty()) - { - pSysMenu->AppendMenu(MF_SEPARATOR); - pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); - } - } - - // ô˶ԻͼꡣӦóڲǶԻʱܽԶ - // ִд˲ - SetIcon(m_hIcon, TRUE); // ôͼ - SetIcon(m_hIcon, FALSE); // Сͼ - - Init(); - - // TODO: ڴӶijʼ - - return TRUE; // ǽõؼ򷵻 TRUE -} - -void CLoginClientDlg::OnSysCommand(UINT nID, LPARAM lParam) -{ - if ((nID & 0xFFF0) == IDM_ABOUTBOX) - { - CAboutDlg dlgAbout; - dlgAbout.DoModal(); - } - else - { - CDialog::OnSysCommand(nID, lParam); - } -} - -// ԻСťҪĴ -// Ƹͼꡣʹĵ/ͼģ͵ MFC Ӧó -// ⽫ɿԶɡ - -void CLoginClientDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // ڻƵ豸 - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // ʹͼڹо - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // ͼ - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -//û϶Сʱϵͳô˺ȡù -//ʾ -HCURSOR CLoginClientDlg::OnQueryDragIcon() -{ - return static_cast(m_hIcon); -} - -void CLoginClientDlg::OnBnClickedButton1() -{ - //һ - CString strData; - - //طϢ - m_txtServerIP.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objServerInfo.m_szServerIP, MAX_BUFF_50, NULL,NULL); - m_objServerInfo.m_szServerIP[nDecLen] = '\0'; - - m_txtServerPort.GetWindowText(strData); - m_objServerInfo.m_nServerPort = _ttoi((LPCTSTR)strData); - - //زϢ - m_txtUserName.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objLoginClient.m_szUserName, MAX_BUFF_50, NULL,NULL); - m_objLoginClient.m_szUserName[nDecLen] = '\0'; - - m_txtUserPass.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objLoginClient.m_szUserPass, MAX_BUFF_50, NULL,NULL); - m_objLoginClient.m_szUserPass[nDecLen] = '\0'; - - m_txtIDFrom.GetWindowText(strData); - m_objLoginClient.m_nUserIDFrom = _ttoi((LPCTSTR)strData); - - m_txtIDTo.GetWindowText(strData); - m_objLoginClient.m_nUserIDTo = _ttoi((LPCTSTR)strData); - - //жsocketǷѾӣϿ - if(m_sckClient != INVALID_SOCKET) - { - Close(); - } - - if(Connect() == false) - { - return; - } - - Send_Single_Login(); - - Close(); -} - -void CLoginClientDlg::OnBnClickedButton2() -{ - //ѹ - CString strData; - - //طϢ - m_txtServerIP.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objServerInfo.m_szServerIP, MAX_BUFF_50, NULL,NULL); - m_objServerInfo.m_szServerIP[nDecLen] = '\0'; - - m_txtServerPort.GetWindowText(strData); - m_objServerInfo.m_nServerPort = _ttoi((LPCTSTR)strData); - - //زϢ - m_txtUserName.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objLoginClient.m_szUserName, MAX_BUFF_50, NULL,NULL); - m_objLoginClient.m_szUserName[nDecLen] = '\0'; - - m_txtUserPass.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objLoginClient.m_szUserPass, MAX_BUFF_50, NULL,NULL); - m_objLoginClient.m_szUserPass[nDecLen] = '\0'; - - m_txtIDFrom.GetWindowText(strData); - m_objLoginClient.m_nUserIDFrom = _ttoi((LPCTSTR)strData); - - m_txtIDTo.GetWindowText(strData); - m_objLoginClient.m_nUserIDTo = _ttoi((LPCTSTR)strData); - - m_blMultiple = true; - m_nSendCount = 0; - - //ʼҪ͵ - m_vecLoginInfo.clear(); - m_lcServer.SetRedraw(FALSE); - m_lcServer.DeleteAllItems(); - for (int i = m_objLoginClient.m_nUserIDFrom; i < m_objLoginClient.m_nUserIDTo; i++) - { - _LoginInfo objLoginInfo; - sprintf_s(objLoginInfo.m_szUserName, MAX_BUFF_50, "%s%d", m_objLoginClient.m_szUserName, i); - sprintf_s(objLoginInfo.m_szUserPass, MAX_BUFF_50, "%s", m_objLoginClient.m_szUserPass); - m_vecLoginInfo.push_back(objLoginInfo); - - // - wchar_t wszUserName[MAX_BUFF_50] = { '\0' }; - wchar_t wszUserPass[MAX_BUFF_50] = { '\0' }; - - int nSrcLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserName, -1, NULL, 0); - int nDecLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserName, -1, wszUserName, MAX_BUFF_50); - - nSrcLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserPass, -1, NULL, 0); - nDecLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserPass, -1, wszUserPass, MAX_BUFF_50); - - int itemIndex = m_lcServer.GetItemCount(); - m_lcServer.InsertItem(itemIndex, wszUserName); - m_lcServer.SetItemText(itemIndex, 1, wszUserPass); - m_lcServer.SetItemText(itemIndex, 2, L"0"); - m_lcServer.SetItemText(itemIndex, 3, L"0"); - m_lcServer.SetItemText(itemIndex, 4, L"0"); - } - m_lcServer.SetRedraw(TRUE); - - DWORD ThreadID = 0; - CreateThread(NULL, NULL, ThreadProc, (LPVOID)this, NULL, &ThreadID); -} - -void CLoginClientDlg::Init() -{ - m_txtServerIP.SetWindowText(_T("127.0.0.1")); - m_txtServerPort.SetWindowText(_T("10002")); - m_txtUserName.SetWindowText(_T("freeeyes")); - m_txtUserPass.SetWindowText(_T("123456")); - m_txtIDFrom.SetWindowText(_T("1")); - m_txtIDTo.SetWindowText(_T("5")); - m_txtSeachUserID.SetWindowText(_T("1001")); - - m_lcServer.InsertColumn(0, _T("û"), LVCFMT_CENTER, 100); - m_lcServer.InsertColumn(1, _T(""), LVCFMT_CENTER, 100); - m_lcServer.InsertColumn(2, _T("ʹ"), LVCFMT_CENTER, 100); - m_lcServer.InsertColumn(3, _T("ɹ"), LVCFMT_CENTER, 100); - m_lcServer.InsertColumn(4, _T("ʧ"), LVCFMT_CENTER, 100); - - DWORD dwStyle = m_lcServer.GetExtendedStyle(); - dwStyle |= LVS_EX_FULLROWSELECT;//ѡijʹиֻreportlistctrl - dwStyle |= LVS_EX_GRIDLINES;//ߣֻreportlistctrl - //dwStyle |= LVS_EX_CHECKBOXES;//itemǰcheckboxؼ - dwStyle |= LVS_EX_DOUBLEBUFFER; // ʹ˫ - m_lcServer.SetExtendedStyle(dwStyle); //չ - - //ʼTCP - WSADATA wsaData; - int nErr = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(nErr != 0) - { - MessageBox(_T("socketʧܣ鱾socket汾"), _T("Ϣ"), MB_OK); - } - - m_blMultiple = false; - m_nSendCount = 0; - - srand(unsigned(time(0))); -} - -bool CLoginClientDlg::Connect() -{ - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(m_objServerInfo.m_nServerPort); - sockaddr.sin_addr.S_un.S_addr = inet_addr(m_objServerInfo.m_szServerIP); - - m_sckClient = socket(AF_INET, SOCK_STREAM, 0); - - DWORD TimeOut = (DWORD)1000; - ::setsockopt(m_sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); - - int nErr = connect(m_sckClient, (SOCKADDR*)&sockaddr, sizeof(SOCKADDR)); - if(0 != nErr) - { - //ʧ - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - return true; -} - -void CLoginClientDlg::Close() -{ - closesocket(m_sckClient); - m_sckClient = INVALID_SOCKET; -} - -void CLoginClientDlg::OnClose() -{ - // TODO: ڴϢ/Ĭֵ - //жsocketǷѾӣϿ - if(m_blMultiple == true) - { - m_blMultiple = false; - Sleep(1); - } - - if(m_sckClient != INVALID_SOCKET) - { - Close(); - } - - CDialog::OnClose(); -} - -bool CLoginClientDlg::Send_Login(_LoginInfo& objLoginInfo) -{ - int nCommand = COMMAND_LOGIN; - char szSendBuff[MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - short sVersion = 1; - int nPos = 0; - int nLen = 1 + 1 + (int)strlen(m_objLoginClient.m_szUserName) + (int)strlen(m_objLoginClient.m_szUserPass); - char szSession[32] = {'\0'}; - sprintf_s(szSession, 32, "FREEETES"); - - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&sVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - int nStrLen = (int)strlen(m_objLoginClient.m_szUserName); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_objLoginClient.m_szUserName, nStrLen); - nPos += nStrLen; - - nStrLen = (int)strlen(m_objLoginClient.m_szUserPass); - memcpy_s(&szSendBuff[nPos], sizeof(char), (char*)&nStrLen, sizeof(char)); - nPos += sizeof(char); - memcpy_s(&szSendBuff[nPos], nStrLen, (char*)m_objLoginClient.m_szUserPass, nStrLen); - nPos += nStrLen; - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - objLoginInfo.m_nServerFail++; - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - objLoginInfo.m_nSendCount++; - - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - objLoginInfo.m_nServerFail++; - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - delete[] pRecvBuff; - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - objLoginInfo.m_nServerFail++; - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRet = 0; - nPos = 0; - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRet, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - if(nRet == LOGIN_SUCCESS) - { - objLoginInfo.m_nServerSuccess++; - } - else - { - objLoginInfo.m_nServerFail++; - } - - delete[] pRecvBuff; - - return true; -} - -bool CLoginClientDlg::Send_Single_Login() -{ - m_vecLoginInfo.clear(); - - _LoginInfo objLoginInfo; - - sprintf_s(objLoginInfo.m_szUserName, MAX_BUFF_50, "%s", m_objLoginClient.m_szUserName); - sprintf_s(objLoginInfo.m_szUserPass, MAX_BUFF_50, "%s", m_objLoginClient.m_szUserPass); - - m_vecLoginInfo.push_back(objLoginInfo); - - // - m_lcServer.SetRedraw(FALSE); - m_lcServer.DeleteAllItems(); - - wchar_t wszUserName[MAX_BUFF_50] = { '\0' }; - wchar_t wszUserPass[MAX_BUFF_50] = { '\0' }; - int nSrcLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserName, -1, NULL, 0); - int nDecLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserName, -1, wszUserName, MAX_BUFF_50); - nSrcLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserPass, -1, NULL, 0); - nDecLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserPass, -1, wszUserPass, MAX_BUFF_50); - - m_lcServer.InsertItem(0, wszUserName); - m_lcServer.SetItemText(0, 1, wszUserPass); - m_lcServer.SetItemText(0, 2, L"0"); - m_lcServer.SetItemText(0, 3, L"0"); - m_lcServer.SetItemText(0, 4, L"0"); - - m_lcServer.SetRedraw(TRUE); - - Send_Login(m_vecLoginInfo[0]); - updateItemData(objLoginInfo, 0); - - return true; -} - -bool CLoginClientDlg::Send_Multiple_Login() -{ - if(m_sckClient != INVALID_SOCKET) - { - Close(); - } - - if(Connect() == false) - { - return false; - } - - // öʱȥÿԼ͵ - m_nLastSecondSendCount = 0; - m_nSendCount = 0; - SetTimer(1, 1000, NULL); - - ULONG lulSendCount = 0; - while(m_blMultiple) - { - int id = Random(m_objLoginClient.m_nUserIDFrom, m_objLoginClient.m_nUserIDTo); - int nIndex = id - m_objLoginClient.m_nUserIDFrom; - _LoginInfo& rdLoginInfo = m_vecLoginInfo[nIndex]; - - Send_Login(rdLoginInfo); - updateItemData(rdLoginInfo, nIndex); - - ++m_nSendCount; - } - KillTimer(1); - - m_blMultiple = false; - Close(); - - return true; -} - -bool CLoginClientDlg::Send_UserInfo( int nUserID ) -{ - int nCommand = COMMAND_USERINFO; - char szSendBuff[MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - short sVersion = 1; - int nPos = 0; - int nLen = 2 + 4; - char szSession[32] = {'\0'}; - sprintf_s(szSession, 32, "FREEETES"); - - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&sVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nUserID, sizeof(int)); - nPos += sizeof(int); - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - delete[] pRecvBuff; - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRet = 0; - nPos = 0; - int nReUserID = 0; - int nLife = 0; - int nMagic = 0; - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRet, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - memcpy_s((char*)&nReUserID, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - memcpy_s((char*)&nLife, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - memcpy_s((char*)&nMagic, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - CString strData; - strData.Format(_T("%d"), nReUserID); - m_txtUserID.SetWindowText(strData); - strData.Format(_T("%d"), nLife); - m_txtUserLife.SetWindowText(strData); - strData.Format(_T("%d"), nMagic); - m_txtUserMagic.SetWindowText(strData); - - delete[] pRecvBuff; - - return true; -} - -bool CLoginClientDlg::Send_SetUserInfo( int nUserID, int nLife, int nMagic ) -{ - int nCommand = COMMAND_SET_USERINFO; - char szSendBuff[MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - short sVersion = 1; - int nPos = 0; - int nLen = 2 + 4 + 4 + 4; - char szSession[32] = {'\0'}; - sprintf_s(szSession, 32, "FREEEYES"); - - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nUserID, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLife, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nMagic, sizeof(int)); - nPos += sizeof(int); - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - delete[] pRecvBuff; - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRet = 0; - nPos = 0; - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRet, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - if(nRet == LOGIN_SUCCESS) - { - MessageBox(_T("ûϢɹ"), _T("ʾϢ"), MB_OK); - } - else - { - MessageBox(_T("ûϢʧ"), _T("ʾϢ"), MB_OK); - } - - delete[] pRecvBuff; - return true; -} - -// ָ -void CLoginClientDlg::updateItemData(_LoginInfo& objLoginInfo, const int nItemIndex) -{ - // Listб - //add by @ - m_lcServer.SetRedraw(FALSE); - CString strData; - - strData.Format(_T("%d"), objLoginInfo.m_nSendCount); - m_lcServer.SetItemText(nItemIndex, 2, strData); - - strData.Format(_T("%d"), objLoginInfo.m_nServerSuccess); - m_lcServer.SetItemText(nItemIndex, 3, strData); - - strData.Format(_T("%d"), objLoginInfo.m_nServerFail); - m_lcServer.SetItemText(nItemIndex, 4, strData); - m_lcServer.SetRedraw(TRUE); -} - - - -void CLoginClientDlg::OnBnClickedButton3() -{ - //ֹͣѹ - m_blMultiple = false; - - KillTimer(1); - - m_txtClientCost.SetWindowText(L""); -} - -int CLoginClientDlg::Random( int nStart, int nEnd ) -{ - return nStart + (nEnd - nStart)*rand()/(RAND_MAX + 1); -} - -void CLoginClientDlg::OnTimer(UINT_PTR nIDEvent) -{ - // TODO: ڴϢ/Ĭֵ - switch(nIDEvent) - { - case 1: - CString steData; - steData.Format(_T("ÿԼ[%d]"), m_nSendCount - m_nLastSecondSendCount); - m_nLastSecondSendCount = m_nSendCount; - m_txtClientCost.SetWindowText(steData); - } - - CDialog::OnTimer(nIDEvent); -} - -void CLoginClientDlg::OnBnClickedButton4() -{ - char szSeachUserID[MAX_BUFF_50] = {'\0'}; - // ԻûϢ - CString strData; - - //طϢ - m_txtServerIP.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objServerInfo.m_szServerIP, MAX_BUFF_50, NULL,NULL); - m_objServerInfo.m_szServerIP[nDecLen] = '\0'; - - m_txtServerPort.GetWindowText(strData); - m_objServerInfo.m_nServerPort = _ttoi((LPCTSTR)strData); - - //ûID - m_txtSeachUserID.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szSeachUserID, MAX_BUFF_50, NULL,NULL); - szSeachUserID[nDecLen] = '\0'; - - int nSeachUserID = atoi(szSeachUserID); - - if(Connect() == false) - { - return; - } - - Send_UserInfo(nSeachUserID); - - Close(); -} - - -void CLoginClientDlg::OnBnClickedButton5() -{ - char szTemp[MAX_BUFF_50] = {'\0'}; - // ԻûϢ - CString strData; - - //طϢ - m_txtServerIP.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objServerInfo.m_szServerIP, MAX_BUFF_50, NULL,NULL); - m_objServerInfo.m_szServerIP[nDecLen] = '\0'; - - m_txtServerPort.GetWindowText(strData); - m_objServerInfo.m_nServerPort = _ttoi((LPCTSTR)strData); - - //ûϢ - m_txtUserID.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szTemp, MAX_BUFF_50, NULL,NULL); - szTemp[nDecLen] = '\0'; - int nUserID = atoi(szTemp); - m_txtUserLife.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szTemp, MAX_BUFF_50, NULL,NULL); - szTemp[nDecLen] = '\0'; - int nLife = atoi(szTemp); - m_txtUserMagic.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szTemp, MAX_BUFF_50, NULL,NULL); - szTemp[nDecLen] = '\0'; - int nMagic = atoi(szTemp); - - if(Connect() == false) - { - return; - } - - Send_SetUserInfo(nUserID, nLife, nMagic); - - Close(); -} \ No newline at end of file diff --git a/PssSampleClient/PSSLoginClient/LoginClient/LoginClientDlg.h b/PssSampleClient/PSSLoginClient/LoginClient/LoginClientDlg.h deleted file mode 100644 index f15eff1b9..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/LoginClientDlg.h +++ /dev/null @@ -1,148 +0,0 @@ -// LoginClientDlg.h : ͷļ -// - -#pragma once -#include "afxwin.h" -#include "afxcmn.h" - -#include - -#include - -using namespace std; - -#define MAX_BUFF_50 50 -#define MAX_BUFF_500 500 - -#define COMMAND_LOGIN 0x2100 //½ -#define COMMAND_LOGOUT 0x2101 //˳ -#define COMMAND_USERINFO 0x2102 //Ϣ -#define COMMAND_SET_USERINFO 0x2103 //ûϢ - -#define LOGIN_SUCCESS 0 -#define LOGIN_FAIL_NOEXIST 1 -#define LOGIN_FAIL_ONLINE 2 -#define LOGIN_FAIL_PASSWORD 3 - -struct _LoginInfo -{ - char m_szUserName[MAX_BUFF_50]; - char m_szUserPass[MAX_BUFF_50]; - int m_nSendCount; - int m_nServerSuccess; - int m_nServerFail; - - _LoginInfo() - { - m_szUserName[0] = '\0'; - m_szUserPass[0] = '\0'; - m_nSendCount = 0; - m_nServerSuccess = 0; - m_nServerFail = 0; - } -}; - -struct _ServerInfo -{ - char m_szServerIP[MAX_BUFF_50]; - int m_nServerPort; - - _ServerInfo() - { - m_szServerIP[0] = '\0'; - m_nServerPort = 0; - } -}; - -struct _LoginClient -{ - char m_szUserName[MAX_BUFF_50]; - char m_szUserPass[MAX_BUFF_50]; - int m_nUserIDFrom; - int m_nUserIDTo; - - _LoginClient() - { - m_szUserName[0] = '\0'; - m_szUserPass[0] = '\0'; - m_nUserIDFrom = 0; - m_nUserIDTo = 0; - } -}; - -typedef vector<_LoginInfo> vecLoginInfo; - -// CLoginClientDlg Ի -class CLoginClientDlg : public CDialog -{ -// -public: - CLoginClientDlg(CWnd* pParent = NULL); // ׼캯 - -// Ի - enum { IDD = IDD_LOGINCLIENT_DIALOG }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - - -// ʵ -protected: - HICON m_hIcon; - - // ɵϢӳ亯 - virtual BOOL OnInitDialog(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - DECLARE_MESSAGE_MAP() - -public: - bool Send_Multiple_Login(); - -private: - void Init(); - void Close(); - bool Connect(); - int Random(int nStart, int nEnd); - - bool Send_Login(_LoginInfo& objLoginInfo); - bool Send_Single_Login(); - - bool Send_UserInfo(int nUserID); - bool Send_SetUserInfo(int nUserID, int nLife, int nMagic); - - // ָ - void updateItemData(_LoginInfo& objLoginInfo, const int nItemIndex); - -private: - vecLoginInfo m_vecLoginInfo; - _ServerInfo m_objServerInfo; - _LoginClient m_objLoginClient; - SOCKET m_sckClient; - bool m_blMultiple; - - int m_nLastSecondSendCount; - int m_nSendCount; - -public: - CEdit m_txtServerIP; - CEdit m_txtServerPort; - CEdit m_txtUserName; - CEdit m_txtUserPass; - CEdit m_txtIDFrom; - CEdit m_txtIDTo; - CListCtrl m_lcServer; - CEdit m_txtClientCost; - afx_msg void OnBnClickedButton1(); - afx_msg void OnBnClickedButton2(); - afx_msg void OnClose(); - afx_msg void OnBnClickedButton3(); - afx_msg void OnTimer(UINT_PTR nIDEvent); - CEdit m_txtSeachUserID; - CEdit m_txtUserID; - CEdit m_txtUserLife; - CEdit m_txtUserMagic; - afx_msg void OnBnClickedButton4(); - afx_msg void OnBnClickedButton5(); -}; diff --git a/PssSampleClient/PSSLoginClient/LoginClient/ReadMe.txt b/PssSampleClient/PSSLoginClient/LoginClient/ReadMe.txt deleted file mode 100644 index f0cea14e3..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/ReadMe.txt +++ /dev/null @@ -1,73 +0,0 @@ -================================================================================ -MICROSOFT : LoginClient Ŀ -=============================================================================== - -ӦóΪ LoginClient Ӧó򡣴Ӧó򲻽ʾ Microsoft Ļʹ÷ΪдӦó㡣 - -ļҪ LoginClient Ӧóÿļݡ - -LoginClient.vcproj -ʹӦóɵ VC++ ĿĿļ -ɸļ Visual C++ İ汾ϢԼйʹӦóѡƽ̨úĿܵϢ - -LoginClient.h -ӦóҪͷļĿضͷļ( Resource.h) CLoginClientApp Ӧóࡣ - -LoginClient.cpp -ǰӦó CLoginClientApp ҪӦóԴļ - -LoginClient.rc -dzʹõ Microsoft Windows Դб RES Ŀ¼д洢ͼꡢλͼ͹ꡣļֱ Microsoft Visual C++ нб༭ĿԴλ 2052 С - -res\LoginClient.ico -ӦóͼͼļͼҪԴļ LoginClient.rc С - -res\LoginClient.rc2 -ļ Microsoft Visual C++ нб༭ԴӦýԴ༭༭ԴڴļС - - -///////////////////////////////////////////////////////////////////////////// - -Ӧó򵼴һԻ: - -LoginClientDlg.hLoginClientDlg.cpp - Ի -Щļ CLoginClientDlg ࡣඨӦóԻΪöԻģλ LoginClient.rc Уļ Microsoft Visual C++ нб༭ - - -///////////////////////////////////////////////////////////////////////////// - -: - -ActiveX ؼ -Ӧóʹ ActiveX ؼ֧֡ - -Windows Sockets -Ӧó֧ͨ TCP/IP 罨ͨš - -///////////////////////////////////////////////////////////////////////////// - -׼ļ: - -StdAfx.hStdAfx.cpp -ЩļΪ LoginClient.pch Ԥͷ (PCH) ļΪ StdAfx.obj Ԥļ - -Resource.h -DZ׼ͷļµԴ ID -Microsoft Visual C++ ȡ´ļ - -LoginClient.manifest - Ӧó嵥ļ Windows XP Ӧó - ض汾г򼯵ԡسʹô - Ϣӳ򼯻ʵij򼯻 - Ӧó˽ϢӦó嵥Ϊ·ַΪ - Ӧóִļװͬļеⲿ .manifest ļ - ҲԴʽڸÿִļС -///////////////////////////////////////////////////////////////////////////// - -ע: - -ӦóʹáTODO:ָʾӦӻԶԴ벿֡ - -Ӧóڹ DLL ʹ MFCҪ·Щ MFC DLLӦóõϵͳĵǰòͬҪ·ӦıػԴ MFC90XXX.DLLйĸϢμ MSDN ĵй Redistributing Visual C++ applications (· Visual C++ Ӧó)½ڡ - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PSSLoginClient/LoginClient/res/LoginClient.ico b/PssSampleClient/PSSLoginClient/LoginClient/res/LoginClient.ico deleted file mode 100644 index 8a84ca3d3..000000000 Binary files a/PssSampleClient/PSSLoginClient/LoginClient/res/LoginClient.ico and /dev/null differ diff --git a/PssSampleClient/PSSLoginClient/LoginClient/res/LoginClient.rc2 b/PssSampleClient/PSSLoginClient/LoginClient/res/LoginClient.rc2 deleted file mode 100644 index 5c76b905c..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/res/LoginClient.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// LoginClient.RC2 - Microsoft Visual C++ ֱӱ༭Դ -// - -#ifdef APSTUDIO_INVOKED -#error ļ Microsoft Visual C++ ༭ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// ڴ˴ֶ༭Դ... - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PSSLoginClient/LoginClient/resource.h b/PssSampleClient/PSSLoginClient/LoginClient/resource.h deleted file mode 100644 index 6e5eef821..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/resource.h +++ /dev/null @@ -1,39 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by LoginClient.rc -// -#define IDM_ABOUTBOX 0x0010 -#define IDD_ABOUTBOX 100 -#define IDS_ABOUTBOX 101 -#define IDD_LOGINCLIENT_DIALOG 102 -#define IDP_SOCKETS_INIT_FAILED 103 -#define IDR_MAINFRAME 128 -#define IDC_LIST1 1000 -#define IDC_LIST2 1001 -#define IDC_EDIT1 1002 -#define IDC_EDIT2 1003 -#define IDC_EDIT3 1004 -#define IDC_EDIT4 1005 -#define IDC_EDIT5 1006 -#define IDC_BUTTON1 1007 -#define IDC_EDIT6 1008 -#define IDC_EDIT7 1009 -#define IDC_BUTTON2 1010 -#define IDC_BUTTON3 1011 -#define IDC_EDIT8 1012 -#define IDC_BUTTON4 1013 -#define IDC_EDIT9 1014 -#define IDC_EDIT10 1015 -#define IDC_EDIT11 1016 -#define IDC_BUTTON5 1017 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1008 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/PssSampleClient/PSSLoginClient/LoginClient/stdafx.cpp b/PssSampleClient/PSSLoginClient/LoginClient/stdafx.cpp deleted file mode 100644 index 50ab706f7..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/stdafx.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// stdafx.cpp : ֻ׼ļԴļ -// LoginClient.pch ΪԤͷ -// stdafx.obj ԤϢ - -#include "stdafx.h" - - diff --git a/PssSampleClient/PSSLoginClient/LoginClient/stdafx.h b/PssSampleClient/PSSLoginClient/LoginClient/stdafx.h deleted file mode 100644 index d0f2baa26..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/stdafx.h +++ /dev/null @@ -1,58 +0,0 @@ -// stdafx.h : ׼ϵͳļİļ -// Ǿʹõĵ -// ضĿİļ - -#pragma once - -#ifndef _SECURE_ATL -#define _SECURE_ATL 1 -#endif - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Windows ͷųʹõ -#endif - -#include "targetver.h" - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // ijЩ CString 캯ʽ - -// ر MFC ijЩɷĺԵľϢ -#define _AFX_ALL_WARNINGS - -#include // MFC ͱ׼ -#include // MFC չ - - -#include // MFC Զ - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC Internet Explorer 4 ؼ֧ -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC Windows ؼ֧ -#endif // _AFX_NO_AFXCMN_SUPPORT - - -#include // MFC ׽չ - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_IA64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - - diff --git a/PssSampleClient/PSSLoginClient/LoginClient/targetver.h b/PssSampleClient/PSSLoginClient/LoginClient/targetver.h deleted file mode 100644 index 93f0450cb..000000000 --- a/PssSampleClient/PSSLoginClient/LoginClient/targetver.h +++ /dev/null @@ -1,26 +0,0 @@ - -#pragma once - -// º궨Ҫƽ̨Ҫƽ̨ -// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ -// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ -// - -// ҪԵָ汾ƽ̨޸ж塣 -// йزͬƽ̨ӦֵϢο MSDN -#ifndef WINVER // ָҪƽ̨ Windows Vista -#define WINVER 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista -#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINDOWS // ָҪƽ̨ Windows 98 -#define _WIN32_WINDOWS 0x0410 // ֵΪʵֵ Windows Me ߰汾 -#endif - -#ifndef _WIN32_IE // ָҪƽ̨ Internet Explorer 7.0 -#define _WIN32_IE 0x0700 // ֵΪӦֵ IE 汾 -#endif - diff --git a/PssSampleClient/PSSLoginClient/Makefile b/PssSampleClient/PSSLoginClient/Makefile new file mode 100644 index 000000000..81f669ec5 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/Makefile @@ -0,0 +1,142 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PSSLoginClient +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../PssSampleClient/PSSLoginClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PSSLoginClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/thirdparty $(IncludeSwitch)../../ThirdLib/src +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)log4cplus +ArLibs := "liblog4cplus.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -fpermissive -fPIC $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix): ../../ThirdLib/include/CNetOperation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/CNetOperation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix): ../../ThirdLib/include/CNetOperation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) -MM ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix): ../../ThirdLib/include/CNetOperation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix) ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(ObjectSuffix): ./PSSLoginClient/PSSLoginClientApp.cpp $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PSSLoginClient/PSSLoginClientApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(DependSuffix): ./PSSLoginClient/PSSLoginClientApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(DependSuffix) -MM ./PSSLoginClient/PSSLoginClientApp.cpp + +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(PreprocessSuffix): ./PSSLoginClient/PSSLoginClientApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(PreprocessSuffix) ./PSSLoginClient/PSSLoginClientApp.cpp + +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(ObjectSuffix): ./PSSLoginClient/PSSLoginClientMain.cpp $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PSSLoginClient/PSSLoginClientMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(DependSuffix): ./PSSLoginClient/PSSLoginClientMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(DependSuffix) -MM ./PSSLoginClient/PSSLoginClientMain.cpp + +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(PreprocessSuffix): ./PSSLoginClient/PSSLoginClientMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(PreprocessSuffix) ./PSSLoginClient/PSSLoginClientMain.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/Mylog.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/Mylog.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/Mylog.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/Mylog.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient.cbp b/PssSampleClient/PSSLoginClient/PSSLoginClient.cbp new file mode 100644 index 000000000..f0bac3dba --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient.cbp @@ -0,0 +1,51 @@ + + + + + + diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient.depend b/PssSampleClient/PSSLoginClient/PSSLoginClient.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient.layout b/PssSampleClient/PSSLoginClient/PSSLoginClient.layout new file mode 100644 index 000000000..76620b8b7 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient.mk b/PssSampleClient/PSSLoginClient/PSSLoginClient.mk new file mode 100644 index 000000000..35d2292db --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient.mk @@ -0,0 +1,142 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PSSLoginClient +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSLoginClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox-mulder +Date :=2019年04月02日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PSSLoginClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/thirdparty $(IncludeSwitch)../../ThirdLib/src +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -fpermissive -fPIC $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix): ../../ThirdLib/include/CNetOperation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/CNetOperation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix): ../../ThirdLib/include/CNetOperation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) -MM ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix): ../../ThirdLib/include/CNetOperation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix) ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(ObjectSuffix): ./PSSLoginClient/PSSLoginClientApp.cpp $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(DependSuffix): ./PSSLoginClient/PSSLoginClientApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(DependSuffix) -MM ./PSSLoginClient/PSSLoginClientApp.cpp + +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(PreprocessSuffix): ./PSSLoginClient/PSSLoginClientApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientApp.cpp$(PreprocessSuffix) ./PSSLoginClient/PSSLoginClientApp.cpp + +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(ObjectSuffix): ./PSSLoginClient/PSSLoginClientMain.cpp $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(DependSuffix): ./PSSLoginClient/PSSLoginClientMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(DependSuffix) -MM ./PSSLoginClient/PSSLoginClientMain.cpp + +$(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(PreprocessSuffix): ./PSSLoginClient/PSSLoginClientMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSLoginClient_PSSLoginClientMain.cpp$(PreprocessSuffix) ./PSSLoginClient/PSSLoginClientMain.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/Mylog.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/Mylog.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/Mylog.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/Mylog.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient.project b/PssSampleClient/PSSLoginClient/PSSLoginClient.project new file mode 100644 index 000000000..3297e1f82 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient.project @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient.txt b/PssSampleClient/PSSLoginClient/PSSLoginClient.txt new file mode 100644 index 000000000..048e49e6e --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient.txt @@ -0,0 +1 @@ +/data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_thirdparty_sock_wrap.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_include_CNetOperation.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/PSSLoginClient_PSSLoginClientApp.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/PSSLoginClient_PSSLoginClientMain.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_thirdparty_Mylog.cpp.o diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientApp.cpp b/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientApp.cpp new file mode 100644 index 000000000..c64229e44 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientApp.cpp @@ -0,0 +1,33 @@ +/*************************************************************** + * Name: PSSLoginClientApp.cpp + * Purpose: Code for Application Class + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PSSLoginClientApp.h" + +//(*AppHeaders +#include "PSSLoginClientMain.h" +#include +//*) + +IMPLEMENT_APP(PSSLoginClientApp); + +bool PSSLoginClientApp::OnInit() +{ + //(*AppInitialize + bool wxsOK = true; + wxInitAllImageHandlers(); + if ( wxsOK ) + { + PSSLoginClientFrame* Frame = new PSSLoginClientFrame(0); + Frame->Show(); + SetTopWindow(Frame); + } + //*) + return wxsOK; + +} diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientApp.h b/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientApp.h new file mode 100644 index 000000000..14e674188 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientApp.h @@ -0,0 +1,21 @@ +/*************************************************************** + * Name: PSSLoginClientApp.h + * Purpose: Defines Application Class + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSSLOGINCLIENTAPP_H +#define PSSLOGINCLIENTAPP_H + +#include + +class PSSLoginClientApp : public wxApp +{ + public: + virtual bool OnInit(); +}; + +#endif // PSSLOGINCLIENTAPP_H diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientMain.cpp b/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientMain.cpp new file mode 100644 index 000000000..3ce6072e2 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientMain.cpp @@ -0,0 +1,472 @@ +/*************************************************************** + * Name: PSSLoginClientMain.cpp + * Purpose: Code for Application Frame + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PSSLoginClientMain.h" +#include + +//(*InternalHeaders(PSSLoginClientFrame) +#include +#include +#include +#include +#include +//*) + +//helper functions +enum wxbuildinfoformat { + short_f, long_f }; + +wxString wxbuildinfo(wxbuildinfoformat format) +{ + wxString wxbuild(wxVERSION_STRING); + + if (format == long_f ) + { +#if defined(__WXMSW__) + wxbuild << _T("-Windows"); +#elif defined(__UNIX__) + wxbuild << _T("-Linux"); +#endif + +#if wxUSE_UNICODE + wxbuild << _T("-Unicode build"); +#else + wxbuild << _T("-ANSI build"); +#endif // wxUSE_UNICODE + } + + return wxbuild; +} + + + + +//(*IdInit(PSSLoginClientFrame) +const long PSSLoginClientFrame::ID_STATICBOX1 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICBOX2 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICBOX3 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT1 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL1 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT2 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT3 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT4 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT5 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL2 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL3 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL4 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT6 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL5 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL6 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT7 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL7 = wxNewId(); +const long PSSLoginClientFrame::ID_BUTTON1 = wxNewId(); +const long PSSLoginClientFrame::ID_BUTTON2 = wxNewId(); +const long PSSLoginClientFrame::ID_BUTTON3 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT8 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL8 = wxNewId(); +const long PSSLoginClientFrame::ID_BUTTON4 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT9 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL9 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT10 = wxNewId(); +const long PSSLoginClientFrame::ID_STATICTEXT11 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL10 = wxNewId(); +const long PSSLoginClientFrame::ID_TEXTCTRL11 = wxNewId(); +const long PSSLoginClientFrame::ID_BUTTON5 = wxNewId(); +const long PSSLoginClientFrame::ID_LISTCTRL1 = wxNewId(); +const long PSSLoginClientFrame::ID_PANEL1 = wxNewId(); +const long PSSLoginClientFrame::ID_TIMER1 = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(PSSLoginClientFrame,wxFrame) + //(*EventTable(PSSLoginClientFrame) + //*) +END_EVENT_TABLE() + +PSSLoginClientFrame::PSSLoginClientFrame(wxWindow* parent,wxWindowID id) +{ + //(*Initialize(PSSLoginClientFrame) + Create(parent, id, wxT("二级缓冲测试客户端"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); + SetClientSize(wxSize(643,496)); + { + wxIcon FrameIcon; + FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("./Icon.jpg")))); + SetIcon(FrameIcon); + } + Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(128,112), wxSize(643,496), wxTAB_TRAVERSAL, _T("ID_PANEL1")); + StaticBox1 = new wxStaticBox(Panel1, ID_STATICBOX1, wxT("登陆测试"), wxPoint(8,8), wxSize(624,160), 0, _T("ID_STATICBOX1")); + StaticBox2 = new wxStaticBox(Panel1, ID_STATICBOX2, wxT("用户信息"), wxPoint(8,176), wxSize(624,128), 0, _T("ID_STATICBOX2")); + StaticBox3 = new wxStaticBox(Panel1, ID_STATICBOX3, wxT("测试结果"), wxPoint(8,304), wxSize(624,136), 0, _T("ID_STATICBOX3")); + StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, wxT("时间消耗"), wxPoint(8,456), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + TextCtrl_TimeUsed = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxEmptyString, wxPoint(72,448), wxSize(256,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); + StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, wxT("服务器IP"), wxPoint(24,40), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, wxT("用户名"), wxPoint(24,80), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + StaticText4 = new wxStaticText(Panel1, ID_STATICTEXT4, wxT("随机从"), wxPoint(24,120), wxDefaultSize, 0, _T("ID_STATICTEXT4")); + StaticText5 = new wxStaticText(Panel1, ID_STATICTEXT5, wxT("服务器端口"), wxPoint(232,40), wxDefaultSize, 0, _T("ID_STATICTEXT5")); + TextCtrl_ServerPort = new wxTextCtrl(Panel1, ID_TEXTCTRL2, wxT("10002"), wxPoint(304,32), wxSize(128,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); + TextCtrl_ServerIP = new wxTextCtrl(Panel1, ID_TEXTCTRL3, wxT("127.0.0.1"), wxPoint(88,32), wxSize(128,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL3")); + TextCtrl_Username = new wxTextCtrl(Panel1, ID_TEXTCTRL4, wxT("freeeyes"), wxPoint(88,72), wxSize(128,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL4")); + StaticText6 = new wxStaticText(Panel1, ID_STATICTEXT6, wxT("密码"), wxPoint(232,80), wxDefaultSize, 0, _T("ID_STATICTEXT6")); + TextCtrl_Password = new wxTextCtrl(Panel1, ID_TEXTCTRL5, wxT("123456"), wxPoint(304,72), wxSize(128,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL5")); + TextCtrl_RadomStart = new wxTextCtrl(Panel1, ID_TEXTCTRL6, wxT("1"), wxPoint(88,112), wxSize(128,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL6")); + StaticText7 = new wxStaticText(Panel1, ID_STATICTEXT7, wxT("到"), wxPoint(232,120), wxDefaultSize, 0, _T("ID_STATICTEXT7")); + TextCtrl_RadomEnd = new wxTextCtrl(Panel1, ID_TEXTCTRL7, wxT("5"), wxPoint(304,112), wxSize(128,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL7")); + Button_LoginOnceTest = new wxButton(Panel1, ID_BUTTON1, wxT("单一测试"), wxPoint(448,72), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); + Button_StartTest = new wxButton(Panel1, ID_BUTTON2, wxT("压力测试"), wxPoint(448,112), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); + Button_StopTest = new wxButton(Panel1, ID_BUTTON3, wxT("停止测试"), wxPoint(544,112), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); + StaticText8 = new wxStaticText(Panel1, ID_STATICTEXT8, wxT("用户ID"), wxPoint(24,208), wxDefaultSize, 0, _T("ID_STATICTEXT8")); + TextCtrl_UserID_Once = new wxTextCtrl(Panel1, ID_TEXTCTRL8, wxT("1001"), wxPoint(88,200), wxSize(128,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL8")); + Button_UserID_OnceTest = new wxButton(Panel1, ID_BUTTON4, wxT("单一测试"), wxPoint(232,200), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); + StaticText9 = new wxStaticText(Panel1, ID_STATICTEXT9, wxT("用户ID"), wxPoint(24,248), wxDefaultSize, 0, _T("ID_STATICTEXT9")); + TextCtrl_UserID_Set = new wxTextCtrl(Panel1, ID_TEXTCTRL9, wxEmptyString, wxPoint(88,248), wxSize(120,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL9")); + StaticText10 = new wxStaticText(Panel1, ID_STATICTEXT10, wxT("Life"), wxPoint(232,256), wxDefaultSize, 0, _T("ID_STATICTEXT10")); + StaticText11 = new wxStaticText(Panel1, ID_STATICTEXT11, wxT("Magic"), wxPoint(392,256), wxDefaultSize, 0, _T("ID_STATICTEXT11")); + TextCtrl_Life = new wxTextCtrl(Panel1, ID_TEXTCTRL10, wxEmptyString, wxPoint(264,248), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL10")); + TextCtrl_Magic = new wxTextCtrl(Panel1, ID_TEXTCTRL11, wxEmptyString, wxPoint(432,248), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL11")); + Button_SetParam = new wxButton(Panel1, ID_BUTTON5, wxT("设置数值"), wxPoint(544,248), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5")); + ListCtrl_Result = new wxListCtrl(Panel1, ID_LISTCTRL1, wxPoint(24,328), wxSize(600,104), wxLC_LIST|wxLC_REPORT, wxDefaultValidator, _T("ID_LISTCTRL1")); + Timer_MainForm.SetOwner(this, ID_TIMER1); + + Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSLoginClientFrame::OnButton_LoginOnceTestClick); + Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSLoginClientFrame::OnButton_StartTestClick); + Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSLoginClientFrame::OnButton_StopTestClick); + Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSLoginClientFrame::OnButton_UserID_OnceTestClick); + Connect(ID_BUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSLoginClientFrame::OnButton_SetParamClick); + Connect(ID_TIMER1,wxEVT_TIMER,(wxObjectEventFunction)&PSSLoginClientFrame::OnTimer_MainFormTrigger); + //*) + + + Init(); +} + +PSSLoginClientFrame::~PSSLoginClientFrame() +{ + //(*Destroy(PSSLoginClientFrame) + //*) + delete pNetOperation; +} + +void PSSLoginClientFrame::OnQuit(wxCommandEvent& event) +{ + pNetOperation->Close(); + if(m_blMultiple == true) + { + m_blMultiple = false; + } + +} + +void PSSLoginClientFrame::OnAbout(wxCommandEvent& event) +{ + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, wxT("Welcome to...")); +} + + +void PSSLoginClientFrame::OnButton_StartTestClick(wxCommandEvent& event) +{ + + //压力测试 + std::string strServerIP =std::string(this->TextCtrl_ServerIP->GetValue()); + int nPort = wxAtoi(this->TextCtrl_ServerPort->GetValue()); + + memcpy(m_objServerInfo.m_szServerIP,strServerIP.c_str(),strServerIP.length()); + m_objServerInfo.m_szServerIP[strServerIP.length()] = '\0'; + m_objServerInfo.m_nServerPort =nPort; + + if(strServerIP == wxT("") || nPort == 0) + { + wxString msg = wxT("请输入完整的服务器IP地址和端口信息。"); + wxMessageBox(msg, wxT("服务器信息"), wxOK | wxICON_INFORMATION, this); + return; + } + + //获得相关测试信息 + wxCSConv cvGBK( wxT("GBK") ); + std::string strUserNmae =std::string( cvGBK.cWX2MB( this->TextCtrl_Username->GetValue().c_str() ) ); + std::string strUserPass =std::string( cvGBK.cWX2MB( this->TextCtrl_Password->GetValue().c_str() ) ); + //std::string strUserIDFrom =std::string( cvGBK.cWX2MB( this->TextCtrl_RadomStart->GetValue().c_str() ) ); + //std::string strUserIDTo =std::string( cvGBK.cWX2MB( this->TextCtrl_RadomEnd->GetValue().c_str() ) ); + + memcpy(m_objLoginClient.m_szUserName,strUserNmae.c_str(),strUserNmae.length()); + memcpy(m_objLoginClient.m_szUserPass,strUserPass.c_str(),strUserPass.length()); + m_objLoginClient.m_szUserName[strUserNmae.length()] = '\0'; + m_objLoginClient.m_szUserPass[strUserPass.length()] = '\0'; + + m_objLoginClient.m_nUserIDFrom = wxAtoi(this->TextCtrl_RadomStart->GetValue()); + m_objLoginClient.m_nUserIDTo = wxAtoi(this->TextCtrl_RadomEnd->GetValue()); + + + m_blMultiple = true; + m_nSendCount = 0; + + //初始化要发送的数据 + m_vecLoginInfo.clear(); + this->ListCtrl_Result->DeleteAllItems(); + + for (int i = m_objLoginClient.m_nUserIDFrom; i < m_objLoginClient.m_nUserIDTo; i++) + { + _LoginInfo objLoginInfo; + sprintf_s(objLoginInfo.m_szUserName, MAX_BUFF_50, "%s%d", m_objLoginClient.m_szUserName, i); + sprintf_s(objLoginInfo.m_szUserPass, MAX_BUFF_50, "%s", m_objLoginClient.m_szUserPass); + m_vecLoginInfo.push_back(objLoginInfo); + + // 插入新项 + +// wchar_t wszUserName[MAX_BUFF_50] = { '\0' }; +// wchar_t wszUserPass[MAX_BUFF_50] = { '\0' }; +// +// int nSrcLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserName, -1, NULL, 0); +// int nDecLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserName, -1, wszUserName, MAX_BUFF_50); +// +// nSrcLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserPass, -1, NULL, 0); +// nDecLen = MultiByteToWideChar(CP_ACP, 0, objLoginInfo.m_szUserPass, -1, wszUserPass, MAX_BUFF_50); + + int itemIndex = this->ListCtrl_Result->GetItemCount(); + this->ListCtrl_Result->InsertItem(itemIndex, wxString(objLoginInfo.m_szUserName)); + this->ListCtrl_Result->SetItem(itemIndex, 1, wxString(objLoginInfo.m_szUserPass)); + this->ListCtrl_Result->SetItem(itemIndex, 2, wxT("0")); + this->ListCtrl_Result->SetItem(itemIndex, 3, wxT("0")); + this->ListCtrl_Result->SetItem(itemIndex, 4, wxT("0")); + } + + //auto thread_test= std::make_shared(&PSSLoginClientFrame::Send_Multiple_Login,this); + std::thread thread_test(&PSSLoginClientFrame::Send_Multiple_Login,this); + thread_test.detach(); // 等待线程结束 + + +} + +void PSSLoginClientFrame::OnButton_StopTestClick(wxCommandEvent& event) +{ + //停止压测 + m_blMultiple = false; + + this->Timer_MainForm.Stop(); + this->TextCtrl_TimeUsed->SetValue(wxT("")); + +} + + +int PSSLoginClientFrame::Random( int nStart, int nEnd ) +{ + return nStart + (nEnd - nStart)*rand()/(RAND_MAX + 1); +} + + + + +void PSSLoginClientFrame::OnButton_SetParamClick(wxCommandEvent& event) +{ + //获得相关用户信息 + int nUserID = wxAtoi(this->TextCtrl_UserID_Set->GetValue()); + int nLife = wxAtoi(this->TextCtrl_Life->GetValue()); + int nMagic = wxAtoi(this->TextCtrl_Magic->GetValue()); + + + if(this->Conn() == false) + { + return ; + } + + pNetOperation->Send_SetUserInfo(nUserID, nLife, nMagic); + + pNetOperation->Close(); + +} + +void PSSLoginClientFrame::OnButton_UserID_OnceTestClick(wxCommandEvent& event) +{ + //获得相关服务器连接信息 + + if(this->Conn() == false) + { + return ; + } + int nSeachUserID = wxAtoi(this->TextCtrl_UserID_Once->GetValue()); + + + int nUserID = 0; + int nLife = 0; + int nMagic = 0; + + pNetOperation->Send_UserInfo(nSeachUserID,nUserID,nLife,nMagic); + + this->TextCtrl_UserID_Set->SetValue(wxString::Format(wxT("%d"),nUserID)); + this->TextCtrl_Life->SetValue(wxString::Format(wxT("%d"),nLife)); + this->TextCtrl_Magic->SetValue(wxString::Format(wxT("%d"),nMagic)); + + pNetOperation->Close(); + +} + +void PSSLoginClientFrame::OnButton_LoginOnceTestClick(wxCommandEvent& event) +{ + if(this->Conn() == false) + { + return ; + } + + //获得相关测试信息 + + wxCSConv cvGBK( wxT("GBK") ); + std::string strUserNmae =std::string( cvGBK.cWX2MB( this->TextCtrl_Username->GetValue().c_str() ) ); + std::string strUserPass =std::string( cvGBK.cWX2MB( this->TextCtrl_Password->GetValue().c_str() ) ); + //std::string strUserIDFrom =std::string( cvGBK.cWX2MB( this->TextCtrl_RadomStart->GetValue().c_str() ) ); + //std::string strUserIDTo =std::string( cvGBK.cWX2MB( this->TextCtrl_RadomEnd->GetValue().c_str() ) ); + + memcpy(m_objLoginClient.m_szUserName,strUserNmae.c_str(),strUserNmae.length()); + memcpy(m_objLoginClient.m_szUserPass,strUserPass.c_str(),strUserPass.length()); + m_objLoginClient.m_szUserName[strUserNmae.length()] = '\0'; + m_objLoginClient.m_szUserPass[strUserPass.length()] = '\0'; + + m_objLoginClient.m_nUserIDFrom = wxAtoi(this->TextCtrl_RadomStart->GetValue()); + m_objLoginClient.m_nUserIDTo = wxAtoi(this->TextCtrl_RadomEnd->GetValue()); + + + Send_Single_Login(); + + pNetOperation->Close(); + +} + + + + +void PSSLoginClientFrame::Init() +{ + + this->ListCtrl_Result->InsertColumn(0, wxT("用户名"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_Result->InsertColumn(1, wxT("密码"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_Result->InsertColumn(2, wxT("发送次数"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_Result->InsertColumn(3, wxT("成功"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_Result->InsertColumn(4, wxT("失败"), wxLIST_FORMAT_CENTER, 100); + + + //初始化TCP链接 + pNetOperation =new CNetOperation(SOCK_STREAM); + + m_blMultiple = false; + m_nSendCount = 0; + + srand(unsigned(time(0))); +} + +bool PSSLoginClientFrame::Conn() +{ + //socket创建的准备工作 + std::string strServerIP =std::string(this->TextCtrl_ServerIP->GetValue()); + int nPort = wxAtoi(this->TextCtrl_ServerPort->GetValue()); + + if(strServerIP == wxT("") || nPort == 0) + { + wxString msg = wxT("请输入完整的服务器IP地址和端口信息。"); + wxMessageBox(msg, wxT("错误信息"), wxOK | wxICON_INFORMATION, this); + return false; + } + memcpy(m_objServerInfo.m_szServerIP,strServerIP.c_str(),strServerIP.length()); + m_objServerInfo.m_szServerIP[strServerIP.length()] = '\0'; + m_objServerInfo.m_nServerPort =nPort; + + if(pNetOperation->Conn(strServerIP,nPort,1000) == false) + { + wxMessageBox(wxT("连接远程服务器失败。"), wxT("错误信息"), wxOK | wxICON_INFORMATION, this); + return false; + } + + return true; + +} + + +bool PSSLoginClientFrame::Send_Single_Login() +{ + m_vecLoginInfo.clear(); + + _LoginInfo objLoginInfo; + + sprintf_s(objLoginInfo.m_szUserName, MAX_BUFF_50, "%s", m_objLoginClient.m_szUserName); + sprintf_s(objLoginInfo.m_szUserPass, MAX_BUFF_50, "%s", m_objLoginClient.m_szUserPass); + + m_vecLoginInfo.push_back(objLoginInfo); + + // 插入新项 + // 插入新项 + + int itemIndex = this->ListCtrl_Result->GetItemCount(); + this->ListCtrl_Result->InsertItem(itemIndex, wxString(objLoginInfo.m_szUserName)); + this->ListCtrl_Result->SetItem(itemIndex, 1, wxString(objLoginInfo.m_szUserPass)); + this->ListCtrl_Result->SetItem(itemIndex, 2, wxT("0")); + this->ListCtrl_Result->SetItem(itemIndex, 3, wxT("0")); + this->ListCtrl_Result->SetItem(itemIndex, 4, wxT("0")); + + + pNetOperation->Send_Login(objLoginInfo,COMMAND_FTP_LOGIN,objLoginInfo.m_szUserName,objLoginInfo.m_szUserPass) ; + + + updateItemData(objLoginInfo, 0); + + return true; +} + +bool PSSLoginClientFrame::Send_Multiple_Login() +{ + if(this->Conn() == false) + { + return false; + } + + // 设置定时器去计算每秒大约发送的请求数 + m_nLastSecondSendCount = 0; + m_nSendCount = 0; + //SetTimer(1, 1000, NULL); + + + unsigned long lulSendCount = 0; + while(m_blMultiple) + { + int id = Random(m_objLoginClient.m_nUserIDFrom, m_objLoginClient.m_nUserIDTo); + int nIndex = id - m_objLoginClient.m_nUserIDFrom; + _LoginInfo& rdLoginInfo = m_vecLoginInfo[nIndex]; + + pNetOperation->Send_Login(rdLoginInfo,COMMAND_FTP_LOGIN,rdLoginInfo.m_szUserName,rdLoginInfo.m_szUserPass) ; + + updateItemData(rdLoginInfo, nIndex); + + ++m_nSendCount; + } + this->Timer_MainForm.Stop(); + + m_blMultiple = false; + pNetOperation->Close(); + + return true; +} + +// 更新指定项测试数据 +void PSSLoginClientFrame::updateItemData(_LoginInfo& objLoginInfo, const int nItemIndex) +{ + // 更新List列表项 + //add by @单调 + + this->ListCtrl_Result->SetItem(nItemIndex, 2, wxString::Format(wxT("%d"),objLoginInfo.m_nSendCount)); + this->ListCtrl_Result->SetItem(nItemIndex, 3, wxString::Format(wxT("%d"),objLoginInfo.m_nServerSuccess)); + this->ListCtrl_Result->SetItem(nItemIndex, 4, wxString::Format(wxT("%d"),objLoginInfo.m_nServerFail)); + +} + + + +void PSSLoginClientFrame::OnTimer_MainFormTrigger(wxTimerEvent& event) +{ + // TODO: 在此添加消息处理程序代码和/或调用默认值 + + this->TextCtrl_TimeUsed->SetValue(wxString::Format(wxT("每秒约发送[%d]个请求"),m_nSendCount - m_nLastSecondSendCount)); + + +} diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientMain.h b/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientMain.h new file mode 100644 index 000000000..315501d32 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient/PSSLoginClientMain.h @@ -0,0 +1,166 @@ +/*************************************************************** + * Name: PSSLoginClientMain.h + * Purpose: Defines Application Frame + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSSLOGINCLIENTMAIN_H +#define PSSLOGINCLIENTMAIN_H + +//(*Headers(PSSLoginClientFrame) +#include +#include +#include +#include +#include +#include +#include +#include +//*) + +#include + + +#include "CNetOperation.h" + + +using namespace std; + +class PSSLoginClientFrame: public wxFrame +{ + public: + + PSSLoginClientFrame(wxWindow* parent,wxWindowID id = -1); + virtual ~PSSLoginClientFrame(); + + private: + + //(*Handlers(PSSLoginClientFrame) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnClose(wxCloseEvent& event); + void OnButton_StartTestClick(wxCommandEvent& event); + void OnButton_StopTestClick(wxCommandEvent& event); + void OnButton_SetParamClick(wxCommandEvent& event); + void OnButton_UserID_OnceTestClick(wxCommandEvent& event); + void OnButton_LoginOnceTestClick(wxCommandEvent& event); + void OnTimer_MainFormTrigger(wxTimerEvent& event); + //*) + + //(*Identifiers(PSSLoginClientFrame) + static const long ID_STATICBOX1; + static const long ID_STATICBOX2; + static const long ID_STATICBOX3; + static const long ID_STATICTEXT1; + static const long ID_TEXTCTRL1; + static const long ID_STATICTEXT2; + static const long ID_STATICTEXT3; + static const long ID_STATICTEXT4; + static const long ID_STATICTEXT5; + static const long ID_TEXTCTRL2; + static const long ID_TEXTCTRL3; + static const long ID_TEXTCTRL4; + static const long ID_STATICTEXT6; + static const long ID_TEXTCTRL5; + static const long ID_TEXTCTRL6; + static const long ID_STATICTEXT7; + static const long ID_TEXTCTRL7; + static const long ID_BUTTON1; + static const long ID_BUTTON2; + static const long ID_BUTTON3; + static const long ID_STATICTEXT8; + static const long ID_TEXTCTRL8; + static const long ID_BUTTON4; + static const long ID_STATICTEXT9; + static const long ID_TEXTCTRL9; + static const long ID_STATICTEXT10; + static const long ID_STATICTEXT11; + static const long ID_TEXTCTRL10; + static const long ID_TEXTCTRL11; + static const long ID_BUTTON5; + static const long ID_LISTCTRL1; + static const long ID_PANEL1; + static const long ID_TIMER1; + //*) + + //(*Declarations(PSSLoginClientFrame) + wxButton* Button_LoginOnceTest; + wxButton* Button_SetParam; + wxButton* Button_StartTest; + wxButton* Button_StopTest; + wxButton* Button_UserID_OnceTest; + wxListCtrl* ListCtrl_Result; + wxPanel* Panel1; + wxStaticBox* StaticBox1; + wxStaticBox* StaticBox2; + wxStaticBox* StaticBox3; + wxStaticText* StaticText10; + wxStaticText* StaticText11; + wxStaticText* StaticText1; + wxStaticText* StaticText2; + wxStaticText* StaticText3; + wxStaticText* StaticText4; + wxStaticText* StaticText5; + wxStaticText* StaticText6; + wxStaticText* StaticText7; + wxStaticText* StaticText8; + wxStaticText* StaticText9; + wxTextCtrl* TextCtrl_Life; + wxTextCtrl* TextCtrl_Magic; + wxTextCtrl* TextCtrl_Password; + wxTextCtrl* TextCtrl_RadomEnd; + wxTextCtrl* TextCtrl_RadomStart; + wxTextCtrl* TextCtrl_ServerIP; + wxTextCtrl* TextCtrl_ServerPort; + wxTextCtrl* TextCtrl_TimeUsed; + wxTextCtrl* TextCtrl_UserID_Once; + wxTextCtrl* TextCtrl_UserID_Set; + wxTextCtrl* TextCtrl_Username; + wxTimer Timer_MainForm; + //*) + + DECLARE_EVENT_TABLE() + + + + +public: + bool Send_Multiple_Login(); + +private: + void Init(); + + bool Conn(); + int Random(int nStart, int nEnd); + + + bool Send_Single_Login(); + + + // 更新指定项测试数据 + void updateItemData(_LoginInfo& objLoginInfo, const int nItemIndex); + + + +private: + CNetOperation *pNetOperation; + + +private: + vecLoginInfo m_vecLoginInfo; + _ServerInfo m_objServerInfo; + _LoginClient m_objLoginClient; + //CSockWrap *m_sckClient; + bool m_blMultiple; + + int m_nLastSecondSendCount; + int m_nSendCount; + + + +}; + +#endif // PSSLOGINCLIENTMAIN_H diff --git a/PssSampleClient/PSSLoginClient/PSSLoginClient/wxsmith/PSSLoginClientframe.wxs b/PssSampleClient/PSSLoginClient/PSSLoginClient/wxsmith/PSSLoginClientframe.wxs new file mode 100644 index 000000000..7697dafb6 --- /dev/null +++ b/PssSampleClient/PSSLoginClient/PSSLoginClient/wxsmith/PSSLoginClientframe.wxs @@ -0,0 +1,154 @@ + + + + 二级缓冲测试客户端 + ./Icon.jpg + 643,496 + + + 128,112 + 643,496 + + + 8,8 + 624,160 + + + + 8,176 + 624,128 + + + + 8,304 + 624,136 + + + + 8,456 + + + 72,448 + 256,35 + + + + 24,40 + + + + 24,80 + + + + 24,120 + + + + 232,40 + + + 10002 + 304,32 + 128,35 + + + 127.0.0.1 + 88,32 + 128,35 + + + freeeyes + 88,72 + 128,35 + + + + 232,80 + + + 123456 + 304,72 + 128,35 + + + 1 + 88,112 + 128,35 + + + + 232,120 + + + 5 + 304,112 + 128,35 + + + + 448,72 + + + + + 448,112 + + + + + 544,112 + + + + + 24,208 + + + 1001 + 88,200 + 128,35 + + + + 232,200 + + + + + 24,248 + + + 88,248 + 120,35 + + + + 232,256 + + + + 392,256 + + + 264,248 + + + 432,248 + + + + 544,248 + + + + 24,328 + 600,104 + + + + + + + + diff --git a/PssSampleClient/PSSLoginClient/compile_flags.txt b/PssSampleClient/PSSLoginClient/compile_flags.txt new file mode 100644 index 000000000..fc721e8fc --- /dev/null +++ b/PssSampleClient/PSSLoginClient/compile_flags.txt @@ -0,0 +1,12 @@ +-I/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSLoginClient +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include +-I/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty +-I/data/develop/Lib/Network/PSS-master/ThirdLib/src +-I/usr/lib/wx/include/gtk2-unicode-3.0 +-I/usr/include/wx-3.0 +-D__WXGTK__ +-D_FILE_OFFSET_BITS=64 +-DWXUSINGDLL +-DNDEBUG +-D_LINUX_PLATFORM_ diff --git a/PssSampleClient/PSSPlugClient/CMakeLists.txt b/PssSampleClient/PSSPlugClient/CMakeLists.txt new file mode 100644 index 000000000..12e0143c8 --- /dev/null +++ b/PssSampleClient/PSSPlugClient/CMakeLists.txt @@ -0,0 +1,132 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PSSPlugClient) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PSSPlugClient_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../ThirdLib/include/TinyXML + ../../ThirdLib/include + ../../ThirdLib/thirdparty + ../../ThirdLib/src + +) + + +# Compiler options +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_1) +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_2) +add_definitions(${CL_VAR_1}) +add_definitions(${CL_VAR_2}) +add_definitions(-O2) +add_definitions(-Wall) +add_definitions(-fpermissive) +add_definitions(-fPIC) +add_definitions( + -DNDEBUG + -D_LINUX_PLATFORM_ + -D_FILE_OFFSET_BITS=64 + -DWXUSINGDLL + -D__WXGTK__ +) + + +# Linker options +execute_process(COMMAND + wx-config --debug=no --libs --unicode=yes + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_3) +set(LINK_OPTIONS ${CL_VAR_3}) + + +if(WIN32) + # Resource options + execute_process(COMMAND + wx-config --rcflags + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(STRIP ${CL_TMP_VAR} CL_VAR_4) + set(RC_OPTIONS ${CL_VAR_4}) +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/CNetOperation.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/sock_wrap.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PSSPlugClient/PSSPlugClientMain.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PSSPlugClient/PSSPlugClientApp.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/Mylog.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -Wall -pthread -fpermissive -fPIC") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(PSSPlugClient ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PSSPlugClient ${LINK_OPTIONS}) + +target_link_libraries(PSSPlugClient + /usr/local/lib/liblog4cplus.so +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/PssSampleClient/PSSPlugClient/Makefile b/PssSampleClient/PSSPlugClient/Makefile new file mode 100644 index 000000000..7d2182a79 --- /dev/null +++ b/PssSampleClient/PSSPlugClient/Makefile @@ -0,0 +1,142 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PSSPlugClient +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../PssSampleClient/PSSPlugClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PSSPlugClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/thirdparty $(IncludeSwitch)../../ThirdLib/src +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)log4cplus +ArLibs := "liblog4cplus.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -fpermissive -fPIC $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix): ../../ThirdLib/include/CNetOperation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/CNetOperation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix): ../../ThirdLib/include/CNetOperation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) -MM ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix): ../../ThirdLib/include/CNetOperation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix) ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(ObjectSuffix): ./PSSPlugClient/PSSPlugClientMain.cpp $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PSSPlugClient/PSSPlugClientMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(DependSuffix): ./PSSPlugClient/PSSPlugClientMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(DependSuffix) -MM ./PSSPlugClient/PSSPlugClientMain.cpp + +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(PreprocessSuffix): ./PSSPlugClient/PSSPlugClientMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(PreprocessSuffix) ./PSSPlugClient/PSSPlugClientMain.cpp + +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(ObjectSuffix): ./PSSPlugClient/PSSPlugClientApp.cpp $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PSSPlugClient/PSSPlugClientApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(DependSuffix): ./PSSPlugClient/PSSPlugClientApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(DependSuffix) -MM ./PSSPlugClient/PSSPlugClientApp.cpp + +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(PreprocessSuffix): ./PSSPlugClient/PSSPlugClientApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(PreprocessSuffix) ./PSSPlugClient/PSSPlugClientApp.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/Mylog.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/Mylog.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/Mylog.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/Mylog.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient.cbp b/PssSampleClient/PSSPlugClient/PSSPlugClient.cbp new file mode 100644 index 000000000..e5ab495a7 --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient.cbp @@ -0,0 +1,51 @@ + + + + + + diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient.depend b/PssSampleClient/PSSPlugClient/PSSPlugClient.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient.layout b/PssSampleClient/PSSPlugClient/PSSPlugClient.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient.mk b/PssSampleClient/PSSPlugClient/PSSPlugClient.mk new file mode 100644 index 000000000..3a296e7fb --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient.mk @@ -0,0 +1,142 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PSSPlugClient +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSPlugClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox-mulder +Date :=2019年04月02日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PSSPlugClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/thirdparty $(IncludeSwitch)../../ThirdLib/src +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)log4cplus +ArLibs := "liblog4cplus.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -fpermissive -fPIC $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix): ../../ThirdLib/include/CNetOperation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/CNetOperation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix): ../../ThirdLib/include/CNetOperation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) -MM ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix): ../../ThirdLib/include/CNetOperation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix) ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(ObjectSuffix): ./PSSPlugClient/PSSPlugClientMain.cpp $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(DependSuffix): ./PSSPlugClient/PSSPlugClientMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(DependSuffix) -MM ./PSSPlugClient/PSSPlugClientMain.cpp + +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(PreprocessSuffix): ./PSSPlugClient/PSSPlugClientMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientMain.cpp$(PreprocessSuffix) ./PSSPlugClient/PSSPlugClientMain.cpp + +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(ObjectSuffix): ./PSSPlugClient/PSSPlugClientApp.cpp $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(DependSuffix): ./PSSPlugClient/PSSPlugClientApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(DependSuffix) -MM ./PSSPlugClient/PSSPlugClientApp.cpp + +$(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(PreprocessSuffix): ./PSSPlugClient/PSSPlugClientApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSPlugClient_PSSPlugClientApp.cpp$(PreprocessSuffix) ./PSSPlugClient/PSSPlugClientApp.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/Mylog.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/Mylog.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/Mylog.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/Mylog.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient.project b/PssSampleClient/PSSPlugClient/PSSPlugClient.project new file mode 100644 index 000000000..9689e362a --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient.project @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient.txt b/PssSampleClient/PSSPlugClient/PSSPlugClient.txt new file mode 100644 index 000000000..7769797e2 --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient.txt @@ -0,0 +1 @@ +/data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_include_CNetOperation.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_thirdparty_sock_wrap.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/PSSPlugClient_PSSPlugClientMain.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/PSSPlugClient_PSSPlugClientApp.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_thirdparty_Mylog.cpp.o diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientApp.cpp b/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientApp.cpp new file mode 100644 index 000000000..71d5bfb76 --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientApp.cpp @@ -0,0 +1,33 @@ +/*************************************************************** + * Name: PSSPlugClientApp.cpp + * Purpose: Code for Application Class + * Author: smith () + * Created: 2019-02-22 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PSSPlugClientApp.h" + +//(*AppHeaders +#include "PSSPlugClientMain.h" +#include +//*) + +IMPLEMENT_APP(PSSPlugClientApp); + +bool PSSPlugClientApp::OnInit() +{ + //(*AppInitialize + bool wxsOK = true; + wxInitAllImageHandlers(); + if ( wxsOK ) + { + PSSPlugClientFrame* Frame = new PSSPlugClientFrame(0); + Frame->Show(); + SetTopWindow(Frame); + } + //*) + return wxsOK; + +} diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientApp.h b/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientApp.h new file mode 100644 index 000000000..3035e3306 --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientApp.h @@ -0,0 +1,21 @@ +/*************************************************************** + * Name: PSSPlugClientApp.h + * Purpose: Defines Application Class + * Author: smith () + * Created: 2019-02-22 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSSPLUGCLIENTAPP_H +#define PSSPLUGCLIENTAPP_H + +#include + +class PSSPlugClientApp : public wxApp +{ + public: + virtual bool OnInit(); +}; + +#endif // PSSPLUGCLIENTAPP_H diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientMain.cpp b/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientMain.cpp new file mode 100644 index 000000000..dc5440743 --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientMain.cpp @@ -0,0 +1,293 @@ +/*************************************************************** + * Name: PSSPlugClientMain.cpp + * Purpose: Code for Application Frame + * Author: smith () + * Created: 2019-02-22 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PSSPlugClientMain.h" +#include + +//(*InternalHeaders(PSSPlugClientFrame) +#include +#include +#include +#include +#include +//*) + +//helper functions +enum wxbuildinfoformat +{ + short_f, long_f +}; + +wxString wxbuildinfo(wxbuildinfoformat format) +{ + wxString wxbuild(wxVERSION_STRING); + + if (format == long_f ) + { +#if defined(__WXMSW__) + wxbuild << _T("-Windows"); +#elif defined(__UNIX__) + wxbuild << _T("-Linux"); +#endif + +#if wxUSE_UNICODE + wxbuild << _T("-Unicode build"); +#else + wxbuild << _T("-ANSI build"); +#endif // wxUSE_UNICODE + } + + return wxbuild; +} + + +//(*IdInit(PSSPlugClientFrame) +const long PSSPlugClientFrame::ID_STATICBOX1 = wxNewId(); +const long PSSPlugClientFrame::ID_STATICBOX2 = wxNewId(); +const long PSSPlugClientFrame::ID_STATICTEXT1 = wxNewId(); +const long PSSPlugClientFrame::ID_TEXTCTRL1 = wxNewId(); +const long PSSPlugClientFrame::ID_STATICTEXT2 = wxNewId(); +const long PSSPlugClientFrame::ID_TEXTCTRL2 = wxNewId(); +const long PSSPlugClientFrame::ID_STATICTEXT3 = wxNewId(); +const long PSSPlugClientFrame::ID_TEXTCTRL3 = wxNewId(); +const long PSSPlugClientFrame::ID_STATICTEXT4 = wxNewId(); +const long PSSPlugClientFrame::ID_TEXTCTRL4 = wxNewId(); +const long PSSPlugClientFrame::ID_BUTTON1 = wxNewId(); +const long PSSPlugClientFrame::ID_BUTTON2 = wxNewId(); +const long PSSPlugClientFrame::ID_BUTTON3 = wxNewId(); +const long PSSPlugClientFrame::ID_STATICTEXT5 = wxNewId(); +const long PSSPlugClientFrame::ID_TEXTCTRL5 = wxNewId(); +const long PSSPlugClientFrame::ID_STATICTEXT6 = wxNewId(); +const long PSSPlugClientFrame::ID_TEXTCTRL6 = wxNewId(); +const long PSSPlugClientFrame::ID_PANEL1 = wxNewId(); +const long PSSPlugClientFrame::ID_TIMER1 = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(PSSPlugClientFrame,wxFrame) + //(*EventTable(PSSPlugClientFrame) + //*) +END_EVENT_TABLE() + +PSSPlugClientFrame::PSSPlugClientFrame(wxWindow* parent,wxWindowID id) +{ + //(*Initialize(PSSPlugClientFrame) + Create(parent, id, wxT("插件间调用测试工具"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); + SetClientSize(wxSize(559,345)); + { + wxIcon FrameIcon; + FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("./Icon.jpg")))); + SetIcon(FrameIcon); + } + Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(256,192), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1")); + StaticBox1 = new wxStaticBox(Panel1, ID_STATICBOX1, wxT("测试信息"), wxPoint(8,8), wxSize(544,160), 0, _T("ID_STATICBOX1")); + StaticBox2 = new wxStaticBox(Panel1, ID_STATICBOX2, wxT("压力测试"), wxPoint(8,176), wxSize(544,160), 0, _T("ID_STATICBOX2")); + StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, wxT("服务器IP"), wxPoint(32,40), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + TextCtrl_ServerIP = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxT("127.0.0.1"), wxPoint(96,32), wxSize(152,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); + TextCtrl_ServerIP->SetMaxLength(16); + StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, wxT("服务器端口"), wxPoint(272,40), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + TextCtrl_ServerPort = new wxTextCtrl(Panel1, ID_TEXTCTRL2, wxT("10002"), wxPoint(352,32), wxSize(-1,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); + StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, wxT("内容"), wxPoint(32,80), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + TextCtrl_SendData = new wxTextCtrl(Panel1, ID_TEXTCTRL3, wxT("freeeyes,在天际,随云聚云散,梦起梦逝,雁过留影。"), wxPoint(96,72), wxSize(352,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL3")); + StaticText4 = new wxStaticText(Panel1, ID_STATICTEXT4, wxT("回应"), wxPoint(32,120), wxDefaultSize, 0, _T("ID_STATICTEXT4")); + TextCtrl_ServerResponse = new wxTextCtrl(Panel1, ID_TEXTCTRL4, wxEmptyString, wxPoint(96,112), wxSize(352,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL4")); + TextCtrl_ServerResponse->Disable(); + Button_SendData = new wxButton(Panel1, ID_BUTTON1, wxT("发送"), wxPoint(456,72), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); + Button_StartTest = new wxButton(Panel1, ID_BUTTON2, wxT("压力测试开始"), wxPoint(24,208), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); + Button_StopTest = new wxButton(Panel1, ID_BUTTON3, wxT("压力测试结束"), wxPoint(136,208), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3")); + StaticText5 = new wxStaticText(Panel1, ID_STATICTEXT5, wxT("已发送数据包"), wxPoint(32,264), wxDefaultSize, 0, _T("ID_STATICTEXT5")); + TextCtrl_SendCount = new wxTextCtrl(Panel1, ID_TEXTCTRL5, wxEmptyString, wxPoint(136,256), wxSize(-1,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL5")); + StaticText6 = new wxStaticText(Panel1, ID_STATICTEXT6, wxT("已接收数据包"), wxPoint(32,304), wxDefaultSize, 0, _T("ID_STATICTEXT6")); + TextCtrl_RecvCount = new wxTextCtrl(Panel1, ID_TEXTCTRL6, wxEmptyString, wxPoint(136,296), wxSize(-1,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL6")); + Timer_ShowData.SetOwner(this, ID_TIMER1); + Timer_ShowData.Start(1000, false); + + Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSPlugClientFrame::OnButton_SendDataClick); + Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSPlugClientFrame::OnButton_StartTestClick); + Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSPlugClientFrame::OnButton_StopTestClick); + Connect(ID_TIMER1,wxEVT_TIMER,(wxObjectEventFunction)&PSSPlugClientFrame::OnTimer_ShowDataTrigger); + //*) + + this->Init(); + +} + +PSSPlugClientFrame::~PSSPlugClientFrame() +{ + //(*Destroy(PSSPlugClientFrame) + //*) + delete pNetOperation; +} + +void PSSPlugClientFrame::OnQuit(wxCommandEvent& event) +{ + pNetOperation->Close(); + Close(); +} + +void PSSPlugClientFrame::OnAbout(wxCommandEvent& event) +{ + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, wxT("Welcome to...")); +} + + + + +void PSSPlugClientFrame::SendData(char* ParamText) +{ + if(this->Conn( ) == false) + { + return; + } + + wxCSConv cvGBK( wxT("GBK") ); + std::string strSendData =std::string( cvGBK.cWX2MB( this->TextCtrl_SendData->GetValue().c_str() ) ); + if(strSendData.length() ==0) + { + wxMessageBox(wxT("测试数据不能为空。"), wxT("测试数据"), wxOK | wxICON_INFORMATION, this); + return; + }; + + int nDecLen = strSendData.length(); + memcpy(ParamText,strSendData.c_str(),strSendData.length()); + + ParamText[nDecLen] = '\0'; + + short nRecvCommandID = 0; + int nRetA = 0; + int nRetB = 0; + pNetOperation->Send_Plug(ParamText,nRecvCommandID,nRetB,nRetA); +} + +void PSSPlugClientFrame::OnButton_SendDataClick(wxCommandEvent& event) +{ + char szText[MAX_BUFF_200] = {'\0'}; + this->SendData(szText); + pNetOperation->Close(); + +} + +void PSSPlugClientFrame::OnButton_StartTestClick(wxCommandEvent& event) +{ + //压测 + if(this->Conn( ) == false) + { + return; + } + + this->Timer_ShowData.Start(1000); + + std::thread thread_test(&PSSPlugClientFrame::Send_Multiple_Plug,this); + + //thread_test.join(); // 等待线程结束 + thread_test.detach(); // 等待线程结束 + +} + +void PSSPlugClientFrame::OnButton_StopTestClick(wxCommandEvent& event) +{ + //this->Init(); + m_blIsRun = false; +} + +void PSSPlugClientFrame::OnTimer_ShowDataTrigger(wxTimerEvent& event) +{ + Show_Send_List(); +} + + +void PSSPlugClientFrame::Init() +{ + //初始化TCP链接 + pNetOperation =new CNetOperation(SOCK_STREAM); + + m_blIsRun = false; + this->Timer_ShowData.Stop(); +} + + +bool PSSPlugClientFrame::Conn() +{ + std::string strServerIP =std::string(this->TextCtrl_ServerIP->GetValue()); + int nPort = wxAtoi(this->TextCtrl_ServerPort->GetValue()); + + memcpy(m_objServerInfo.m_szServerIP,strServerIP.c_str(),strServerIP.length()); + m_objServerInfo.m_szServerIP[strServerIP.length()] = '\0'; + m_objServerInfo.m_nServerPort =nPort; + + if(strServerIP == wxT("") || nPort == 0) + { + wxString msg = wxT("请输入完整的服务器IP地址和端口信息。"); + wxMessageBox(msg, wxT("错误信息"), wxOK | wxICON_INFORMATION, this); + return false; + } + + if(pNetOperation->Conn(strServerIP,nPort,1000) == false) + { + wxMessageBox(wxT("连接远程服务器失败。"), wxT("错误信息"), wxOK | wxICON_INFORMATION, this); + return false; + } + + return true; + +} + +bool PSSPlugClientFrame::Send_Multiple_Plug() +{ + char szText[MAX_BUFF_200] = {'\0'}; + this->SendData(szText); + + + m_blIsRun = true; + m_objPassTest.Init(); + + while(m_blIsRun) + { + short nRecvCommandID = 0; + int nRetA = 0; + int nRetB = 0; + bool blState =pNetOperation->Send_Plug(szText,nRecvCommandID,nRetB,nRetA); + + +// if(blIsDisPlay == true) +// { +// char szReturnText[MAX_BUFF_50] = {'\0'}; +// wchar_t wszReturnText[MAX_BUFF_50] = {'\0'}; +// sprintf_s(szReturnText, MAX_BUFF_50, "PlugA:%d,PlugB:%d.", nRetA, nRetB); +// this->TextCtrl_ServerResponse->SetValue( wxString::Format(wxT("接收回应包字节数:%d,PlugA应答:%d,PlugB应答:%d."),nRecvLength + sizeof(int), nRetA, nRetB)); +// } + + + if(true == blState) + { + m_objPassTest.m_nSendCount++; + m_objPassTest.m_nRecvCount++; + } + //std::this_thread::sleep_for(std::chrono::milliseconds(100*10)); + + } + + pNetOperation->Close(); + this->Timer_ShowData.Stop(); + + + Show_Send_List(); + + return true; + +} + + + +void PSSPlugClientFrame::Show_Send_List() +{ + this->TextCtrl_SendCount->SetValue( wxString::Format(wxT("%d"),m_objPassTest.m_nSendCount)); + this->TextCtrl_RecvCount->SetValue( wxString::Format(wxT("%d"),m_objPassTest.m_nRecvCount)); + +} diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientMain.h b/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientMain.h new file mode 100644 index 000000000..5d58488fe --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient/PSSPlugClientMain.h @@ -0,0 +1,112 @@ +/*************************************************************** + * Name: PSSPlugClientMain.h + * Purpose: Defines Application Frame + * Author: smith () + * Created: 2019-02-22 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSSPLUGCLIENTMAIN_H +#define PSSPLUGCLIENTMAIN_H + +//(*Headers(PSSPlugClientFrame) +#include +#include +#include +#include +#include +#include +#include +//*) + +#include "CNetOperation.h" + + + +class PSSPlugClientFrame: public wxFrame +{ + public: + + PSSPlugClientFrame(wxWindow* parent,wxWindowID id = -1); + virtual ~PSSPlugClientFrame(); + + private: + + //(*Handlers(PSSPlugClientFrame) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnButton_SendDataClick(wxCommandEvent& event); + void OnButton_StartTestClick(wxCommandEvent& event); + void OnButton_StopTestClick(wxCommandEvent& event); + void OnTimer_ShowDataTrigger(wxTimerEvent& event); + //*) + + //(*Identifiers(PSSPlugClientFrame) + static const long ID_STATICBOX1; + static const long ID_STATICBOX2; + static const long ID_STATICTEXT1; + static const long ID_TEXTCTRL1; + static const long ID_STATICTEXT2; + static const long ID_TEXTCTRL2; + static const long ID_STATICTEXT3; + static const long ID_TEXTCTRL3; + static const long ID_STATICTEXT4; + static const long ID_TEXTCTRL4; + static const long ID_BUTTON1; + static const long ID_BUTTON2; + static const long ID_BUTTON3; + static const long ID_STATICTEXT5; + static const long ID_TEXTCTRL5; + static const long ID_STATICTEXT6; + static const long ID_TEXTCTRL6; + static const long ID_PANEL1; + static const long ID_TIMER1; + //*) + + //(*Declarations(PSSPlugClientFrame) + wxButton* Button_SendData; + wxButton* Button_StartTest; + wxButton* Button_StopTest; + wxPanel* Panel1; + wxStaticBox* StaticBox1; + wxStaticBox* StaticBox2; + wxStaticText* StaticText1; + wxStaticText* StaticText2; + wxStaticText* StaticText3; + wxStaticText* StaticText4; + wxStaticText* StaticText5; + wxStaticText* StaticText6; + wxTextCtrl* TextCtrl_RecvCount; + wxTextCtrl* TextCtrl_SendCount; + wxTextCtrl* TextCtrl_SendData; + wxTextCtrl* TextCtrl_ServerIP; + wxTextCtrl* TextCtrl_ServerPort; + wxTextCtrl* TextCtrl_ServerResponse; + wxTimer Timer_ShowData; + //*) + + DECLARE_EVENT_TABLE() + + + private: + void Init(); + bool Conn(); + + void SendData(char* ParamText); + + void Show_Send_List(); + + public: + bool Send_Multiple_Plug(); + +private: + _ServerInfo m_objServerInfo; + _PassTest m_objPassTest; + //CSockWrap *m_sckClient; + CNetOperation *pNetOperation; + bool m_blIsRun; //是否在进行压力测试 + +}; + +#endif // PSSPLUGCLIENTMAIN_H diff --git a/PssSampleClient/PSSPlugClient/PSSPlugClient/wxsmith/PSSPlugClientframe.wxs b/PssSampleClient/PSSPlugClient/PSSPlugClient/wxsmith/PSSPlugClientframe.wxs new file mode 100644 index 000000000..60172a1b8 --- /dev/null +++ b/PssSampleClient/PSSPlugClient/PSSPlugClient/wxsmith/PSSPlugClientframe.wxs @@ -0,0 +1,94 @@ + + + + 插件间调用测试工具 + ./Icon.jpg + 559,345 + + + 256,192 + + + 8,8 + 544,160 + + + + 8,176 + 544,160 + + + + 32,40 + + + 127.0.0.1 + 16 + 96,32 + 152,35 + + + + 272,40 + + + 10002 + 352,32 + -1,35 + + + + 32,80 + + + freeeyes,在天际,随云聚云散,梦起梦逝,雁过留影。 + 96,72 + 352,35 + + + + 32,120 + + + 96,112 + 352,35 + 0 + + + + 456,72 + + + + + 24,208 + + + + + 136,208 + + + + + 32,264 + + + 136,256 + -1,35 + + + + 32,304 + + + 136,296 + -1,35 + + + + 1000 + + + + diff --git a/PssSampleClient/PSSPlugClient/PlugClient.sln b/PssSampleClient/PSSPlugClient/PlugClient.sln deleted file mode 100644 index 6dee99205..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSSPlugClient", "PlugClient\PlugClient.vcxproj", "{B223B8DE-0548-413F-8FCC-F7A5E37FCE8A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B223B8DE-0548-413F-8FCC-F7A5E37FCE8A}.Debug|Win32.ActiveCfg = Debug|Win32 - {B223B8DE-0548-413F-8FCC-F7A5E37FCE8A}.Debug|Win32.Build.0 = Debug|Win32 - {B223B8DE-0548-413F-8FCC-F7A5E37FCE8A}.Release|Win32.ActiveCfg = Release|Win32 - {B223B8DE-0548-413F-8FCC-F7A5E37FCE8A}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.cpp b/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.cpp deleted file mode 100644 index 1dd048b13..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// PlugClient.cpp : ӦóΪ -// - -#include "stdafx.h" -#include "PlugClient.h" -#include "PlugClientDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CPlugClientApp - -BEGIN_MESSAGE_MAP(CPlugClientApp, CWinApp) - ON_COMMAND(ID_HELP, &CWinApp::OnHelp) -END_MESSAGE_MAP() - - -// CPlugClientApp - -CPlugClientApp::CPlugClientApp() -{ - // TODO: ڴ˴ӹ룬 - // Ҫijʼ InitInstance -} - - -// Ψһһ CPlugClientApp - -CPlugClientApp theApp; - - -// CPlugClientApp ʼ - -BOOL CPlugClientApp::InitInstance() -{ - // һ Windows XP ϵӦó嵥ָҪ - // ʹ ComCtl32.dll 汾 6 ߰汾ÿӻʽ - //Ҫ InitCommonControlsEx()򣬽޷ڡ - INITCOMMONCONTROLSEX InitCtrls; - InitCtrls.dwSize = sizeof(InitCtrls); - // ΪҪӦóʹõ - // ؼࡣ - InitCtrls.dwICC = ICC_WIN95_CLASSES; - InitCommonControlsEx(&InitCtrls); - - CWinApp::InitInstance(); - - AfxEnableControlContainer(); - - // ׼ʼ - // δʹЩܲϣС - // տִļĴСӦƳ - // Ҫضʼ - // ڴ洢õע - // TODO: Ӧʵ޸ĸַ - // ޸Ϊ˾֯ - SetRegistryKey(_T("ӦóɵıӦó")); - - CPlugClientDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: ڴ˷ôʱ - // ȷرնԻĴ - } - else if (nResponse == IDCANCEL) - { - // TODO: ڴ˷ôʱ - // ȡرնԻĴ - } - - // ڶԻѹرգԽ FALSE Ա˳Ӧó - // ӦóϢá - return FALSE; -} diff --git a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.h b/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.h deleted file mode 100644 index b605739ab..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.h +++ /dev/null @@ -1,31 +0,0 @@ -// PlugClient.h : PROJECT_NAME Ӧóͷļ -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error "ڰļ֮ǰstdafx.h PCH ļ" -#endif - -#include "resource.h" // - - -// CPlugClientApp: -// йشʵ֣ PlugClient.cpp -// - -class CPlugClientApp : public CWinApp -{ -public: - CPlugClientApp(); - -// д - public: - virtual BOOL InitInstance(); - -// ʵ - - DECLARE_MESSAGE_MAP() -}; - -extern CPlugClientApp theApp; \ No newline at end of file diff --git a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.rc b/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.rc deleted file mode 100644 index 658d22235..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.rc +++ /dev/null @@ -1,217 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// (л񹲺͹) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -#ifdef _WIN32 -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -#pragma code_page(936) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n" - "LANGUAGE 4, 2\r\n" - "#pragma code_page(936)\r\n" - "#include ""res\\PlugClient.rc2"" // Microsoft Visual C++ ༭Դ\r\n" - "#include ""l.CHS\\afxres.rc"" // ׼\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\PlugClient.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " PlugClient" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,14,14,20,20 - LTEXT "PSSPlugClient1.0 ",IDC_STATIC,42,14,114,8,SS_NOPREFIX - LTEXT "Copyright (C) 2013",IDC_STATIC,42,26,114,8 - DEFPUSHBUTTON "ȷ",IDOK,113,41,50,14,WS_GROUP -END - -IDD_PLUGCLIENT_DIALOG DIALOGEX 0, 0, 319, 167 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "òԹ" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Ϣ",IDC_STATIC,7,7,305,76 - LTEXT "IP",IDC_STATIC,17,19,30,8 - EDITTEXT IDC_EDIT1,47,17,74,14,ES_AUTOHSCROLL - LTEXT "˿",IDC_STATIC,124,19,40,8 - EDITTEXT IDC_EDIT2,163,17,60,14,ES_AUTOHSCROLL - LTEXT "",IDC_STATIC,23,37,21,8 - EDITTEXT IDC_EDIT3,47,35,176,14,ES_AUTOHSCROLL - PUSHBUTTON "",IDC_BUTTON1,239,35,50,14 - EDITTEXT IDC_EDIT4,47,58,176,14,ES_AUTOHSCROLL | ES_READONLY - LTEXT "Ӧ",IDC_STATIC,22,60,15,8 - GROUPBOX "ѹ",IDC_STATIC,7,90,305,70 - PUSHBUTTON "ѹԿʼ",IDC_BUTTON2,15,103,50,14 - PUSHBUTTON "ѹԽ",IDC_BUTTON3,74,103,50,14 - LTEXT "ѷݰ",IDC_STATIC,7,124,42,8 - EDITTEXT IDC_EDIT5,55,122,60,14,ES_AUTOHSCROLL - LTEXT "ѽݰ",IDC_STATIC,7,142,42,8 - EDITTEXT IDC_EDIT7,55,140,60,14,ES_AUTOHSCROLL -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080403a8" - BEGIN - VALUE "CompanyName", "TODO: <˾>" - VALUE "FileDescription", "TODO: <ļ˵>" - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "PlugClient.exe" - VALUE "LegalCopyright", "TODO: (C) <˾>Ȩ" - VALUE "OriginalFilename", "PlugClient.exe" - VALUE "ProductName", "TODO: <Ʒ>" - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x804, 936 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 163 - TOPMARGIN, 7 - BOTTOMMARGIN, 55 - END - - IDD_PLUGCLIENT_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 312 - TOPMARGIN, 7 - BOTTOMMARGIN, 160 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_ABOUTBOX " PlugClient(&A)..." -END - -#endif // (л񹲺͹) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -LANGUAGE 4, 2 -#pragma code_page(936) -#include "res\PlugClient.rc2" // Microsoft Visual C++ ༭Դ -#include "l.CHS\afxres.rc" // ׼ -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.vcproj b/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.vcproj deleted file mode 100644 index 510de0af2..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.vcproj +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.vcxproj b/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.vcxproj deleted file mode 100644 index 93e43ce5b..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/PlugClient.vcxproj +++ /dev/null @@ -1,149 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - PSSPlugClient - {B223B8DE-0548-413F-8FCC-F7A5E37FCE8A} - PlugClient - MFCProj - - - - Application - v140 - Dynamic - Unicode - true - - - Application - v140 - Dynamic - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ./Bin\ - $(Configuration)\ - true - - - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - - - - _DEBUG;%(PreprocessorDefinitions) - false - true - - - Disabled - WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Use - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0804 - $(IntDir);%(AdditionalIncludeDirectories) - - - ws2_32.lib;%(AdditionalDependencies) - true - Windows - MachineX86 - - - - - NDEBUG;%(PreprocessorDefinitions) - false - true - - - MaxSpeed - true - WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) - false - MultiThreadedDLL - true - Use - Level3 - ProgramDatabase - - - NDEBUG;%(PreprocessorDefinitions) - 0x0804 - $(IntDir);%(AdditionalIncludeDirectories) - - - true - Windows - true - true - MachineX86 - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PssSampleClient/PSSPlugClient/PlugClient/PlugClientDlg.cpp b/PssSampleClient/PSSPlugClient/PlugClient/PlugClientDlg.cpp deleted file mode 100644 index 33961d05d..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/PlugClientDlg.cpp +++ /dev/null @@ -1,489 +0,0 @@ -// PlugClientDlg.cpp : ʵļ -// - -#include "stdafx.h" -#include "PlugClient.h" -#include "PlugClientDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// Ӧó򡰹ڡ˵ CAboutDlg Ի - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - -// Ի - enum { IDD = IDD_ABOUTBOX }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - -// ʵ -protected: - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) -END_MESSAGE_MAP() - - -// CPlugClientDlg Ի -//ִ߳ -DWORD WINAPI ThreadProc(LPVOID argv) -{ - CPlugClientDlg* pLoginClientDlg = (CPlugClientDlg *)argv; - if(NULL != pLoginClientDlg) - { - pLoginClientDlg->Send_Multiple_Plug(); - } - - return 0; -} - - - -CPlugClientDlg::CPlugClientDlg(CWnd* pParent /*=NULL*/) - : CDialog(CPlugClientDlg::IDD, pParent) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CPlugClientDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_EDIT1, m_txtServerIP); - DDX_Control(pDX, IDC_EDIT2, m_txtServerPort); - DDX_Control(pDX, IDC_EDIT3, m_txtText); - DDX_Control(pDX, IDC_EDIT4, m_txtReturnText); - DDX_Control(pDX, IDC_EDIT5, m_txtSendCount); - DDX_Control(pDX, IDC_EDIT7, m_txtRecvCount); -} - -BEGIN_MESSAGE_MAP(CPlugClientDlg, CDialog) - ON_WM_SYSCOMMAND() - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDC_BUTTON1, &CPlugClientDlg::OnBnClickedButton1) - ON_BN_CLICKED(IDC_BUTTON2, &CPlugClientDlg::OnBnClickedButton2) - ON_BN_CLICKED(IDC_BUTTON3, &CPlugClientDlg::OnBnClickedButton3) - ON_WM_CLOSE() - ON_WM_TIMER() -END_MESSAGE_MAP() - - -// CPlugClientDlg Ϣ - -BOOL CPlugClientDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // ...˵ӵϵͳ˵С - - // IDM_ABOUTBOX ϵͳΧڡ - ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); - ASSERT(IDM_ABOUTBOX < 0xF000); - - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - CString strAboutMenu; - strAboutMenu.LoadString(IDS_ABOUTBOX); - if (!strAboutMenu.IsEmpty()) - { - pSysMenu->AppendMenu(MF_SEPARATOR); - pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); - } - } - - // ô˶ԻͼꡣӦóڲǶԻʱܽԶ - // ִд˲ - SetIcon(m_hIcon, TRUE); // ôͼ - SetIcon(m_hIcon, FALSE); // Сͼ - - // TODO: ڴӶijʼ - Init(); - - return TRUE; // ǽõؼ򷵻 TRUE -} - -void CPlugClientDlg::OnSysCommand(UINT nID, LPARAM lParam) -{ - if ((nID & 0xFFF0) == IDM_ABOUTBOX) - { - CAboutDlg dlgAbout; - dlgAbout.DoModal(); - } - else - { - CDialog::OnSysCommand(nID, lParam); - } -} - -// ԻСťҪĴ -// Ƹͼꡣʹĵ/ͼģ͵ MFC Ӧó -// ⽫ɿԶɡ - -void CPlugClientDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // ڻƵ豸 - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // ʹͼڹо - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // ͼ - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -//û϶Сʱϵͳô˺ȡù -//ʾ -HCURSOR CPlugClientDlg::OnQueryDragIcon() -{ - return static_cast(m_hIcon); -} - -void CPlugClientDlg::Init() -{ - m_txtServerIP.SetWindowText(_T("127.0.0.1")); - m_txtServerPort.SetWindowText(_T("10002")); - m_txtText.SetWindowText(_T("freeeyesʣƾɢţӰ")); - - //ʼTCP - WSADATA wsaData; - int nErr = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(nErr != 0) - { - MessageBox(_T("socketʧܣ鱾socket汾"), _T("Ϣ"), MB_OK); - } - - m_blIsRun = false; -} - - -void CPlugClientDlg::OnBnClickedButton1() -{ - CString strData; - - //طϢ - m_txtServerIP.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objServerInfo.m_szServerIP, MAX_BUFF_50, NULL,NULL); - m_objServerInfo.m_szServerIP[nDecLen] = '\0'; - - m_txtServerPort.GetWindowText(strData); - m_objServerInfo.m_nServerPort = _ttoi((LPCTSTR)strData); - - //жsocketǷѾӣϿ - if(m_sckClient != INVALID_SOCKET) - { - Close(); - } - - if(Connect() == false) - { - return; - } - - char szText[MAX_BUFF_200] = {'\0'}; - - m_txtText.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szText, MAX_BUFF_200, NULL,NULL); - szText[nDecLen] = '\0'; - - Send_Plug(szText); - - - Close(); -} - -bool CPlugClientDlg::Connect() -{ - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(m_objServerInfo.m_nServerPort); - sockaddr.sin_addr.S_un.S_addr = inet_addr(m_objServerInfo.m_szServerIP); - - m_sckClient = socket(AF_INET, SOCK_STREAM, 0); - - DWORD TimeOut = (DWORD)1000; - ::setsockopt(m_sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); - - int nErr = connect(m_sckClient, (SOCKADDR*)&sockaddr, sizeof(SOCKADDR)); - if(0 != nErr) - { - //ʧ - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - return true; -} - -bool CPlugClientDlg::Send_Plug(const char* pText, bool blIsDisPlay) -{ - // - int nCommand = COMMAND_PLUGA; - char szSendBuff[MAX_BUFF_500] = {'\0'}; - if(m_sckClient == INVALID_SOCKET) - { - return false; - } - - int nVersion = 1; - int nPos = 0; - int nLen = (int)strlen(pText) + 2; - char szSession[32] = {'\0'}; - - sprintf_s(szSession, 32, "FREEEYES"); - - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nVersion, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nCommand, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], sizeof(int), (char*)&nLen, sizeof(int)); - nPos += sizeof(int); - memcpy_s(&szSendBuff[nPos], sizeof(char)*32, (char*)szSession, sizeof(char)*32); - nPos += sizeof(char)*32; - - int nStrLen = (int)strlen(pText); - memcpy_s(&szSendBuff[nPos], sizeof(short), (char*)&nStrLen, sizeof(short)); - nPos += sizeof(short); - memcpy_s(&szSendBuff[nPos], nStrLen, (char* )pText, nStrLen); - nPos += nStrLen; - - int nTotalSendLen = nPos; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, szSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //շ - //Ƚֽڵݰ - char szRecvLength[4] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 4, 0); - if(nCurrRecvLen != 4) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), szRecvLength, sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - delete[] pRecvBuff; - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - int nRecvCommandID = 0; - int nRetA = 0; - int nRetB = 0; - nPos = 0; - - - memcpy_s((char*)&nRecvCommandID, sizeof(short), &pRecvBuff[nPos], sizeof(short)); - nPos += sizeof(short); - memcpy_s((char*)&nRetB, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - memcpy_s((char*)&nRetA, sizeof(int), &pRecvBuff[nPos], sizeof(int)); - nPos += sizeof(int); - - if(blIsDisPlay == true) - { - char szReturnText[MAX_BUFF_50] = {'\0'}; - wchar_t wszReturnText[MAX_BUFF_50] = {'\0'}; - sprintf_s(szReturnText, MAX_BUFF_50, "PlugA:%d,PlugB:%d.", nRetA, nRetB); - - CString steData; - steData.Format(_T("ջӦֽ:%d,PlugAӦ:%d,PlugBӦ:%d."), nRecvLength + sizeof(int), nRetA, nRetB); - m_txtReturnText.SetWindowText(steData); - } - - return true; -} - -void CPlugClientDlg::Close() -{ - closesocket(m_sckClient); - m_sckClient = INVALID_SOCKET; -} -void CPlugClientDlg::OnBnClickedButton2() -{ - //ѹ - SetTimer(1, 1000, NULL); - - DWORD ThreadID = 0; - CreateThread(NULL, NULL, ThreadProc, (LPVOID)this, NULL, &ThreadID); -} - -void CPlugClientDlg::OnBnClickedButton3() -{ - m_blIsRun = false; -} - -bool CPlugClientDlg::Send_Multiple_Plug() -{ - //ʼѹ - CString strData; - - //طϢ - m_txtServerIP.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, m_objServerInfo.m_szServerIP, MAX_BUFF_50, NULL,NULL); - m_objServerInfo.m_szServerIP[nDecLen] = '\0'; - - m_txtServerPort.GetWindowText(strData); - m_objServerInfo.m_nServerPort = _ttoi((LPCTSTR)strData); - - //жsocketǷѾӣϿ - if(m_sckClient != INVALID_SOCKET) - { - Close(); - } - - if(Connect() == false) - { - return false; - } - - char szText[MAX_BUFF_200] = {'\0'}; - - m_txtText.GetWindowText(strData); - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szText, MAX_BUFF_200, NULL,NULL); - szText[nDecLen] = '\0'; - - m_blIsRun = true; - m_objPassTest.Init(); - - while(m_blIsRun) - { - bool blState = Send_Plug(szText, false); - if(true == blState) - { - m_objPassTest.m_nSendCount++; - m_objPassTest.m_nRecvCount++; - } - } - - Close(); - KillTimer(1); - - Show_Send_List(); - - return true; -} - -void CPlugClientDlg::OnClose() -{ - // TODO: ڴϢ/Ĭֵ - if(m_blIsRun == true) - { - m_blIsRun = false; - Sleep(1); - } - - CDialog::OnClose(); -} - -void CPlugClientDlg::OnTimer(UINT_PTR nIDEvent) -{ - // TODO: ڴϢ/Ĭֵ - switch(nIDEvent) - { - case 1: - Show_Send_List(); - } - - - CDialog::OnTimer(nIDEvent); -} - -void CPlugClientDlg::Show_Send_List() -{ - CString strData; - - strData.Format(_T("%d"), m_objPassTest.m_nSendCount); - m_txtSendCount.SetWindowText(strData); - strData.Format(_T("%d"), m_objPassTest.m_nRecvCount); - m_txtRecvCount.SetWindowText(strData); -} \ No newline at end of file diff --git a/PssSampleClient/PSSPlugClient/PlugClient/PlugClientDlg.h b/PssSampleClient/PSSPlugClient/PlugClient/PlugClientDlg.h deleted file mode 100644 index 024ade2f3..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/PlugClientDlg.h +++ /dev/null @@ -1,96 +0,0 @@ -// PlugClientDlg.h : ͷļ -// - -#pragma once -#include "afxwin.h" - -#define MAX_BUFF_50 50 -#define MAX_BUFF_200 200 -#define MAX_BUFF_500 500 - -#define COMMAND_PLUGA 0x2201 - -struct _ServerInfo -{ - char m_szServerIP[MAX_BUFF_50]; - int m_nServerPort; - - _ServerInfo() - { - m_szServerIP[0] = '\0'; - m_nServerPort = 0; - } -}; - -struct _PassTest -{ - int m_nSendCount; //ѹⷢݰ - int m_nRecvCount; //ѹݰ - - _PassTest() - { - Init(); - } - - void Init() - { - m_nSendCount = 0; - m_nRecvCount = 0; - } -}; - -// CPlugClientDlg Ի -class CPlugClientDlg : public CDialog -{ -// -public: - CPlugClientDlg(CWnd* pParent = NULL); // ׼캯 - -// Ի - enum { IDD = IDD_PLUGCLIENT_DIALOG }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - -private: - void Init(); - bool Connect(); - void Close(); - bool Send_Plug(const char* pText, bool blIsDisPlay = true); - void Show_Send_List(); - -public: - bool Send_Multiple_Plug(); - -// ʵ -protected: - HICON m_hIcon; - - // ɵϢӳ亯 - virtual BOOL OnInitDialog(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - DECLARE_MESSAGE_MAP() - -public: - CEdit m_txtServerIP; - CEdit m_txtServerPort; - CEdit m_txtText; - CEdit m_txtReturnText; - CEdit m_txtSendCount; - CEdit m_txtRecvCount; - - afx_msg void OnBnClickedButton1(); - afx_msg void OnBnClickedButton2(); - afx_msg void OnBnClickedButton3(); - afx_msg void OnClose(); - -private: - _ServerInfo m_objServerInfo; - _PassTest m_objPassTest; - SOCKET m_sckClient; - bool m_blIsRun; //Ƿڽѹ -public: - afx_msg void OnTimer(UINT_PTR nIDEvent); -}; diff --git a/PssSampleClient/PSSPlugClient/PlugClient/ReadMe.txt b/PssSampleClient/PSSPlugClient/PlugClient/ReadMe.txt deleted file mode 100644 index 1f26f5d51..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/ReadMe.txt +++ /dev/null @@ -1,73 +0,0 @@ -================================================================================ -MICROSOFT : PlugClient Ŀ -=============================================================================== - -ӦóΪ PlugClient Ӧó򡣴Ӧó򲻽ʾ Microsoft Ļʹ÷ΪдӦó㡣 - -ļҪ PlugClient Ӧóÿļݡ - -PlugClient.vcproj -ʹӦóɵ VC++ ĿĿļ -ɸļ Visual C++ İ汾ϢԼйʹӦóѡƽ̨úĿܵϢ - -PlugClient.h -ӦóҪͷļĿضͷļ( Resource.h) CPlugClientApp Ӧóࡣ - -PlugClient.cpp -ǰӦó CPlugClientApp ҪӦóԴļ - -PlugClient.rc -dzʹõ Microsoft Windows Դб RES Ŀ¼д洢ͼꡢλͼ͹ꡣļֱ Microsoft Visual C++ нб༭ĿԴλ 2052 С - -res\PlugClient.ico -ӦóͼͼļͼҪԴļ PlugClient.rc С - -res\PlugClient.rc2 -ļ Microsoft Visual C++ нб༭ԴӦýԴ༭༭ԴڴļС - - -///////////////////////////////////////////////////////////////////////////// - -Ӧó򵼴һԻ: - -PlugClientDlg.hPlugClientDlg.cpp - Ի -Щļ CPlugClientDlg ࡣඨӦóԻΪöԻģλ PlugClient.rc Уļ Microsoft Visual C++ нб༭ - - -///////////////////////////////////////////////////////////////////////////// - -: - -ActiveX ؼ -Ӧóʹ ActiveX ؼ֧֡ - -ӡӡԤ֧ -Ӧóͨ MFC CView еijԱڴӡӡúʹӡԤĴ롣 - -///////////////////////////////////////////////////////////////////////////// - -׼ļ: - -StdAfx.hStdAfx.cpp -ЩļΪ PlugClient.pch Ԥͷ (PCH) ļΪ StdAfx.obj Ԥļ - -Resource.h -DZ׼ͷļµԴ ID -Microsoft Visual C++ ȡ´ļ - -PlugClient.manifest - Ӧó嵥ļ Windows XP Ӧó - ض汾г򼯵ԡسʹô - Ϣӳ򼯻ʵij򼯻 - Ӧó˽ϢӦó嵥Ϊ·ַΪ - Ӧóִļװͬļеⲿ .manifest ļ - ҲԴʽڸÿִļС -///////////////////////////////////////////////////////////////////////////// - -ע: - -ӦóʹáTODO:ָʾӦӻԶԴ벿֡ - -Ӧóڹ DLL ʹ MFCҪ·Щ MFC DLLӦóõϵͳĵǰòͬҪ·ӦıػԴ MFC90XXX.DLLйĸϢμ MSDN ĵй Redistributing Visual C++ applications (· Visual C++ Ӧó)½ڡ - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PSSPlugClient/PlugClient/res/PlugClient.ico b/PssSampleClient/PSSPlugClient/PlugClient/res/PlugClient.ico deleted file mode 100644 index 8a84ca3d3..000000000 Binary files a/PssSampleClient/PSSPlugClient/PlugClient/res/PlugClient.ico and /dev/null differ diff --git a/PssSampleClient/PSSPlugClient/PlugClient/res/PlugClient.rc2 b/PssSampleClient/PSSPlugClient/PlugClient/res/PlugClient.rc2 deleted file mode 100644 index 779a86af8..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/res/PlugClient.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// PlugClient.RC2 - Microsoft Visual C++ ֱӱ༭Դ -// - -#ifdef APSTUDIO_INVOKED -#error ļ Microsoft Visual C++ ༭ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// ڴ˴ֶ༭Դ... - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PSSPlugClient/PlugClient/resource.h b/PssSampleClient/PSSPlugClient/PlugClient/resource.h deleted file mode 100644 index b3e10caf2..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/resource.h +++ /dev/null @@ -1,30 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PlugClient.rc -// -#define IDM_ABOUTBOX 0x0010 -#define IDD_ABOUTBOX 100 -#define IDS_ABOUTBOX 101 -#define IDD_PLUGCLIENT_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDC_EDIT1 1000 -#define IDC_EDIT2 1001 -#define IDC_EDIT3 1002 -#define IDC_BUTTON1 1003 -#define IDC_EDIT4 1004 -#define IDC_BUTTON2 1005 -#define IDC_EDIT6 1006 -#define IDC_BUTTON3 1006 -#define IDC_EDIT5 1007 -#define IDC_EDIT7 1008 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1007 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/PssSampleClient/PSSPlugClient/PlugClient/stdafx.cpp b/PssSampleClient/PSSPlugClient/PlugClient/stdafx.cpp deleted file mode 100644 index b763ba9cf..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/stdafx.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// stdafx.cpp : ֻ׼ļԴļ -// PlugClient.pch ΪԤͷ -// stdafx.obj ԤϢ - -#include "stdafx.h" - - diff --git a/PssSampleClient/PSSPlugClient/PlugClient/stdafx.h b/PssSampleClient/PSSPlugClient/PlugClient/stdafx.h deleted file mode 100644 index 4d4711a70..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/stdafx.h +++ /dev/null @@ -1,57 +0,0 @@ -// stdafx.h : ׼ϵͳļİļ -// Ǿʹõĵ -// ضĿİļ - -#pragma once - -#ifndef _SECURE_ATL -#define _SECURE_ATL 1 -#endif - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Windows ͷųʹõ -#endif - -#include "targetver.h" - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // ijЩ CString 캯ʽ - -// ر MFC ijЩɷĺԵľϢ -#define _AFX_ALL_WARNINGS - -#include // MFC ͱ׼ -#include // MFC չ - - -#include // MFC Զ - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC Internet Explorer 4 ؼ֧ -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC Windows ؼ֧ -#endif // _AFX_NO_AFXCMN_SUPPORT - - - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_IA64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - - diff --git a/PssSampleClient/PSSPlugClient/PlugClient/targetver.h b/PssSampleClient/PSSPlugClient/PlugClient/targetver.h deleted file mode 100644 index 93f0450cb..000000000 --- a/PssSampleClient/PSSPlugClient/PlugClient/targetver.h +++ /dev/null @@ -1,26 +0,0 @@ - -#pragma once - -// º궨Ҫƽ̨Ҫƽ̨ -// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ -// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ -// - -// ҪԵָ汾ƽ̨޸ж塣 -// йزͬƽ̨ӦֵϢο MSDN -#ifndef WINVER // ָҪƽ̨ Windows Vista -#define WINVER 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista -#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINDOWS // ָҪƽ̨ Windows 98 -#define _WIN32_WINDOWS 0x0410 // ֵΪʵֵ Windows Me ߰汾 -#endif - -#ifndef _WIN32_IE // ָҪƽ̨ Internet Explorer 7.0 -#define _WIN32_IE 0x0700 // ֵΪӦֵ IE 汾 -#endif - diff --git a/PssSampleClient/PSSPlugClient/compile_flags.txt b/PssSampleClient/PSSPlugClient/compile_flags.txt new file mode 100644 index 000000000..d992e2e2b --- /dev/null +++ b/PssSampleClient/PSSPlugClient/compile_flags.txt @@ -0,0 +1,12 @@ +-I/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSPlugClient +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include +-I/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty +-I/data/develop/Lib/Network/PSS-master/ThirdLib/src +-I/usr/lib/wx/include/gtk2-unicode-3.0 +-I/usr/include/wx-3.0 +-D__WXGTK__ +-D_FILE_OFFSET_BITS=64 +-DWXUSINGDLL +-DNDEBUG +-D_LINUX_PLATFORM_ diff --git a/PssSampleClient/PSSProxyClient/CMakeLists.txt b/PssSampleClient/PSSProxyClient/CMakeLists.txt new file mode 100644 index 000000000..22b7624c9 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/CMakeLists.txt @@ -0,0 +1,134 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PSSProxyClient) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PSSProxyClient_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + . + ../../ThirdLib/include + ../../ThirdLib/include/TinyXML + ../../ThirdLib/thirdparty + +) + + +# Compiler options +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_1) +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_2) +add_definitions(${CL_VAR_1}) +add_definitions(${CL_VAR_2}) +add_definitions(-O2) +add_definitions(-Wall) +add_definitions(-fpermissive) +add_definitions(-fPIC) +add_definitions( + -DNDEBUG + -D_LINUX_PLATFORM_ + -D_FILE_OFFSET_BITS=64 + -DWXUSINGDLL + -D__WXGTK__ +) + + +# Linker options +execute_process(COMMAND + wx-config --debug=no --libs --unicode=yes + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_3) +set(LINK_OPTIONS ${CL_VAR_3}) + + +if(WIN32) + # Resource options + execute_process(COMMAND + wx-config --rcflags + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(STRIP ${CL_TMP_VAR} CL_VAR_4) + set(RC_OPTIONS ${CL_VAR_4}) +endif(WIN32) + +# Library path +link_directories( + . +") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/sock_wrap.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/CNetOperation.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PSSProxyClient/PSSProxyClientApp.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PSSProxyClient/PSSProxyClientMain.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/thirdparty/Mylog.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -Wall -pthread -fpermissive -fPIC") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(PSSProxyClient ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PSSProxyClient ${LINK_OPTIONS}) + +target_link_libraries(PSSProxyClient + /usr/local/lib/liblog4cplus.so +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/PssSampleClient/PSSProxyClient/Makefile b/PssSampleClient/PSSProxyClient/Makefile new file mode 100644 index 000000000..71e4cdab9 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/Makefile @@ -0,0 +1,142 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PSSProxyClient +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../PssSampleClient/PSSProxyClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PSSProxyClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/thirdparty +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)log4cplus +ArLibs := "liblog4cplus.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -fpermissive -fPIC $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix): ../../ThirdLib/include/CNetOperation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/CNetOperation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix): ../../ThirdLib/include/CNetOperation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) -MM ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix): ../../ThirdLib/include/CNetOperation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix) ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(ObjectSuffix): ./PSSProxyClient/PSSProxyClientApp.cpp $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PSSProxyClient/PSSProxyClientApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(DependSuffix): ./PSSProxyClient/PSSProxyClientApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(DependSuffix) -MM ./PSSProxyClient/PSSProxyClientApp.cpp + +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(PreprocessSuffix): ./PSSProxyClient/PSSProxyClientApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(PreprocessSuffix) ./PSSProxyClient/PSSProxyClientApp.cpp + +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(ObjectSuffix): ./PSSProxyClient/PSSProxyClientMain.cpp $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PSSProxyClient/PSSProxyClientMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(DependSuffix): ./PSSProxyClient/PSSProxyClientMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(DependSuffix) -MM ./PSSProxyClient/PSSProxyClientMain.cpp + +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(PreprocessSuffix): ./PSSProxyClient/PSSProxyClientMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(PreprocessSuffix) ./PSSProxyClient/PSSProxyClientMain.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/Mylog.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/thirdparty/Mylog.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/Mylog.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/Mylog.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient.cbp b/PssSampleClient/PSSProxyClient/PSSProxyClient.cbp new file mode 100644 index 000000000..5d909113d --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient.cbp @@ -0,0 +1,51 @@ + + + + + + diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient.depend b/PssSampleClient/PSSProxyClient/PSSProxyClient.depend new file mode 100644 index 000000000..c23563f52 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient.depend @@ -0,0 +1,1168 @@ +# depslib dependency file v1.0 +1554170049 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/CNetOperation.cpp + "CNetOperation.h" + +1554169960 /data/develop/Lib/Network/PSS-master/ThirdLib/include/CNetOperation.h + + + + + + + + "macro.h" + "sock_wrap.h" + "Mylog.h" + +1553738330 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//macro.h + + + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//sock_wrap.h + + + + + + + + + + +1554169516 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//Mylog.h + + + + + + + + + + + + + + +1554169683 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/Mylog.cpp + "Mylog.h" + +1554169516 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/Mylog.h + + + + + + + + + + + + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp + + + + "sock_wrap.h" + + + + + + + + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.h + + + + + + + + + + +1553678773 source:/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.cpp + "PSSProxyClientApp.h" + "PSSProxyClientMain.h" + + +1553678773 /data/develop/Lib/Network/PSS-master/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.h + + +1536665357 /usr/include/wx-3.0/wx/app.h + "wx/event.h" + "wx/eventfilter.h" + "wx/build.h" + "wx/cmdargs.h" + "wx/init.h" + "wx/intl.h" + "wx/log.h" + "wx/unix/app.h" + "wx/msw/app.h" + "wx/motif/app.h" + "wx/dfb/app.h" + "wx/gtk/app.h" + "wx/gtk1/app.h" + "wx/x11/app.h" + "wx/osx/app.h" + "wx/cocoa/app.h" + "wx/os2/app.h" + "wx/univ/theme.h" + +1536665357 /usr/include/wx-3.0/wx/event.h + "wx/defs.h" + "wx/cpp.h" + "wx/object.h" + "wx/clntdata.h" + "wx/gdicmn.h" + "wx/cursor.h" + "wx/mousestate.h" + "wx/dynarray.h" + "wx/thread.h" + "wx/tracker.h" + "wx/typeinfo.h" + "wx/any.h" + "wx/meta/convertible.h" + "wx/meta/removeref.h" + +1536665357 /usr/include/wx-3.0/wx/defs.h + "wx/platform.h" + "wx/version.h" + "wx/dlimpexp.h" + + "wx/debug.h" + + + "wx/windowid.h" + + "wx/msw/winundef.h" + "wx/features.h" + +1536665357 /usr/include/wx-3.0/wx/platform.h + + + + "wx/osx/config_xcode.h" + "wx/android/config_android.h" + "wx/compiler.h" + "wx/setup.h" + "wx/msw/wince/libraries.h" + "wx/msw/libraries.h" + "wx/msw/gccpriv.h" + + + "wx/chkconf.h" + +1536665357 /usr/include/wx-3.0/wx/compiler.h + +1536665357 /usr/lib/wx/include/gtk2-unicode-3.0/wx/setup.h + +1536665357 /usr/include/wx-3.0/wx/chkconf.h + "wx/msw/wince/chkconf.h" + "wx/msw/chkconf.h" + "wx/gtk/chkconf.h" + "wx/gtk/chkconf.h" + "wx/cocoa/chkconf.h" + "wx/osx/chkconf.h" + "wx/os2/chkconf.h" + "wx/dfb/chkconf.h" + "wx/motif/chkconf.h" + "wx/x11/chkconf.h" + "wx/android/chkconf.h" + "wx/unix/chkconf.h" + "wx/univ/chkconf.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/chkconf.h + +1536665357 /usr/include/wx-3.0/wx/unix/chkconf.h + +1536665357 /usr/include/wx-3.0/wx/version.h + "wx/cpp.h" + +1536665357 /usr/include/wx-3.0/wx/cpp.h + "wx/compiler.h" + +1536665357 /usr/include/wx-3.0/wx/dlimpexp.h + +1536665357 /usr/include/wx-3.0/wx/debug.h + + + "wx/chartype.h" + "wx/cpp.h" + "wx/dlimpexp.h" + +1536665357 /usr/include/wx-3.0/wx/chartype.h + "wx/platform.h" + + + + + + + + + + + + +1536665357 /usr/include/wx-3.0/wx/windowid.h + +1536665357 /usr/include/wx-3.0/wx/features.h + +1536665357 /usr/include/wx-3.0/wx/object.h + "wx/memory.h" + "wx/xti.h" + "wx/rtti.h" + "wx/xti2.h" + "wx/msw/msvcrt.h" + +1536665357 /usr/include/wx-3.0/wx/memory.h + "wx/defs.h" + "wx/string.h" + "wx/msgout.h" + + +1536665357 /usr/include/wx-3.0/wx/string.h + "wx/defs.h" + + + + + + + + + + + "wx/wxcrtbase.h" + "wx/strvararg.h" + "wx/buffer.h" + "wx/strconv.h" + "wx/stringimpl.h" + "wx/stringops.h" + "wx/unichar.h" + "wx/tls.h" + "wx/iosfwrap.h" + "wx/crt.h" + +1536665357 /usr/include/wx-3.0/wx/wxcrtbase.h + "wx/chartype.h" + + + + + + + +1536665357 /usr/include/wx-3.0/wx/strvararg.h + "wx/platform.h" + "wx/cpp.h" + "wx/chartype.h" + "wx/strconv.h" + "wx/buffer.h" + "wx/unichar.h" + + + + "wx/stringimpl.h" + +1536665357 /usr/include/wx-3.0/wx/strconv.h + "wx/defs.h" + "wx/chartype.h" + "wx/buffer.h" + "typeinfo.h" + + "wx/fontenc.h" + +1536665357 /usr/include/wx-3.0/wx/buffer.h + "wx/chartype.h" + "wx/wxcrtbase.h" + + +1536665357 /usr/include/wx-3.0/wx/typeinfo.h + "wx/defs.h" + + + +1536665357 /usr/include/wx-3.0/wx/fontenc.h + +1536665357 /usr/include/wx-3.0/wx/unichar.h + "wx/defs.h" + "wx/chartype.h" + "wx/stringimpl.h" + +1536665357 /usr/include/wx-3.0/wx/stringimpl.h + "wx/defs.h" + "wx/chartype.h" + "wx/wxcrtbase.h" + + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/beforestd.h + +1536665357 /usr/include/wx-3.0/wx/afterstd.h + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/stringops.h + "wx/chartype.h" + "wx/stringimpl.h" + "wx/unichar.h" + "wx/buffer.h" + +1536665357 /usr/include/wx-3.0/wx/tls.h + "wx/defs.h" + "wx/msw/tls.h" + "wx/os2/tls.h" + "wx/unix/tls.h" + + +1536665357 /usr/include/wx-3.0/wx/unix/tls.h + + +1536665357 /usr/include/wx-3.0/wx/iosfwrap.h + + + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/crt.h + "wx/defs.h" + "wx/chartype.h" + "wx/wxcrt.h" + "wx/wxcrtvararg.h" + +1536665357 /usr/include/wx-3.0/wx/wxcrt.h + "wx/wxcrtbase.h" + "wx/string.h" + + +1536665357 /usr/include/wx-3.0/wx/wxcrtvararg.h + "wx/wxcrt.h" + "wx/strvararg.h" + "wx/string.h" + + +1536665357 /usr/include/wx-3.0/wx/msgout.h + "wx/defs.h" + "wx/chartype.h" + "wx/strvararg.h" + +1536665357 /usr/include/wx-3.0/wx/xti.h + "wx/defs.h" + "wx/xtitypes.h" + "wx/xtihandler.h" + +1536665357 /usr/include/wx-3.0/wx/xtitypes.h + "wx/defs.h" + "wx/string.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/flags.h" + "wx/intl.h" + "wx/log.h" + + +1536665357 /usr/include/wx-3.0/wx/hashmap.h + "wx/string.h" + "wx/wxcrt.h" + + + + + + +1536665357 /usr/include/wx-3.0/wx/arrstr.h + "wx/defs.h" + "wx/string.h" + "wx/dynarray.h" + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/dynarray.h + "wx/defs.h" + "wx/beforestd.h" + + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/flags.h + +1536665357 /usr/include/wx-3.0/wx/intl.h + "wx/defs.h" + "wx/string.h" + "wx/translation.h" + "wx/fontenc.h" + "wx/language.h" + +1536665357 /usr/include/wx-3.0/wx/translation.h + "wx/defs.h" + "wx/string.h" + "wx/buffer.h" + "wx/language.h" + "wx/hashmap.h" + "wx/strconv.h" + "wx/scopedptr.h" + +1536665357 /usr/include/wx-3.0/wx/language.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/scopedptr.h + "wx/defs.h" + "wx/checkeddelete.h" + +1536665357 /usr/include/wx-3.0/wx/checkeddelete.h + "wx/cpp.h" + +1536665357 /usr/include/wx-3.0/wx/log.h + "wx/defs.h" + "wx/cpp.h" + "wx/string.h" + "wx/strvararg.h" + "wx/arrstr.h" + + "wx/dynarray.h" + "wx/hashmap.h" + "wx/thread.h" + "wx/iosfwrap.h" + "wx/generic/logg.h" + "wx/cocoa/log.h" + +1536665357 /usr/include/wx-3.0/wx/thread.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/generic/logg.h + +1536665357 /usr/include/wx-3.0/wx/xtihandler.h + "wx/defs.h" + "wx/xti.h" + +1536665357 /usr/include/wx-3.0/wx/rtti.h + "wx/memory.h" + "wx/flags.h" + +1536665357 /usr/include/wx-3.0/wx/xti2.h + "wx/xtiprop.h" + "wx/xtictor.h" + +1536665357 /usr/include/wx-3.0/wx/xtiprop.h + "wx/defs.h" + "wx/xti.h" + "wx/any.h" + +1536665357 /usr/include/wx-3.0/wx/any.h + "wx/defs.h" + + "wx/string.h" + "wx/meta/if.h" + "wx/typeinfo.h" + "wx/list.h" + "wx/datetime.h" + "wx/variant.h" + +1536665357 /usr/include/wx-3.0/wx/meta/if.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/list.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/vector.h" + "wx/beforestd.h" + + + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/vector.h + "wx/defs.h" + + + "wx/scopeguard.h" + "wx/meta/movable.h" + "wx/meta/if.h" + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/scopeguard.h + "wx/defs.h" + "wx/except.h" + +1536665357 /usr/include/wx-3.0/wx/except.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/meta/movable.h + "wx/meta/pod.h" + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/meta/pod.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/datetime.h + "wx/defs.h" + "wx/msw/wince/time.h" + + + "wx/longlong.h" + "wx/anystr.h" + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/longlong.h + "wx/defs.h" + "wx/string.h" + + "wx/iosfwrap.h" + + "wx/strvararg.h" + +1536665357 /usr/include/wx-3.0/wx/anystr.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/variant.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/arrstr.h" + "wx/list.h" + "wx/cpp.h" + "wx/longlong.h" + "wx/datetime.h" + "wx/iosfwrap.h" + "wx/any.h" + +1536665357 /usr/include/wx-3.0/wx/xtictor.h + "wx/defs.h" + "wx/xti.h" + +1536665357 /usr/include/wx-3.0/wx/clntdata.h + "wx/defs.h" + "wx/string.h" + "wx/hashmap.h" + +1536665357 /usr/include/wx-3.0/wx/gdicmn.h + "wx/defs.h" + "wx/list.h" + "wx/string.h" + "wx/fontenc.h" + "wx/hashmap.h" + "wx/math.h" + +1536665357 /usr/include/wx-3.0/wx/math.h + "wx/defs.h" + + + + + +1536665357 /usr/include/wx-3.0/wx/cursor.h + "wx/defs.h" + "wx/msw/cursor.h" + "wx/motif/cursor.h" + "wx/gtk/cursor.h" + "wx/gtk1/cursor.h" + "wx/x11/cursor.h" + "wx/dfb/cursor.h" + "wx/osx/cursor.h" + "wx/cocoa/cursor.h" + "wx/os2/cursor.h" + "wx/utils.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/cursor.h + "wx/gdiobj.h" + "wx/gdicmn.h" + +1536665357 /usr/include/wx-3.0/wx/gdiobj.h + "wx/object.h" + +1536665357 /usr/include/wx-3.0/wx/utils.h + "wx/object.h" + "wx/list.h" + "wx/filefn.h" + "wx/hashmap.h" + "wx/versioninfo.h" + "wx/meta/implicitconversion.h" + "wx/gdicmn.h" + "wx/mousestate.h" + "wx/longlong.h" + "wx/platinfo.h" + + + + + +1536665357 /usr/include/wx-3.0/wx/filefn.h + "wx/list.h" + "wx/arrstr.h" + "wx/msw/wince/time.h" + "wx/msw/private.h" + + + + + "wx/os2/private.h" + + + + + + + + + + + + + + + + + +1536665357 /usr/include/wx-3.0/wx/versioninfo.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/meta/implicitconversion.h + "wx/defs.h" + "wx/meta/if.h" + +1536665357 /usr/include/wx-3.0/wx/mousestate.h + "wx/gdicmn.h" + "wx/kbdstate.h" + +1536665357 /usr/include/wx-3.0/wx/kbdstate.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/platinfo.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/tracker.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/meta/convertible.h + +1536665357 /usr/include/wx-3.0/wx/meta/removeref.h + +1536665357 /usr/include/wx-3.0/wx/eventfilter.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/build.h + "wx/version.h" + +1536665357 /usr/include/wx-3.0/wx/cmdargs.h + "wx/arrstr.h" + +1536665357 /usr/include/wx-3.0/wx/init.h + "wx/defs.h" + "wx/chartype.h" + "wx/msw/init.h" + +1536665357 /usr/include/wx-3.0/wx/unix/app.h + + +1536665357 /usr/include/wx-3.0/wx/gtk/app.h + +1553678773 /data/develop/Lib/Network/PSS-master/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.h + + + + + + + "CNetOperation.h" + +1536665357 /usr/include/wx-3.0/wx/button.h + "wx/defs.h" + "wx/anybutton.h" + "wx/univ/button.h" + "wx/msw/button.h" + "wx/motif/button.h" + "wx/gtk/button.h" + "wx/gtk1/button.h" + "wx/osx/button.h" + "wx/cocoa/button.h" + "wx/os2/button.h" + +1536665357 /usr/include/wx-3.0/wx/anybutton.h + "wx/defs.h" + "wx/bitmap.h" + "wx/control.h" + "wx/univ/anybutton.h" + "wx/msw/anybutton.h" + "wx/gtk/anybutton.h" + "wx/osx/anybutton.h" + +1536665357 /usr/include/wx-3.0/wx/bitmap.h + "wx/string.h" + "wx/gdicmn.h" + "wx/colour.h" + "wx/image.h" + "wx/variant.h" + "wx/msw/bitmap.h" + "wx/x11/bitmap.h" + "wx/gtk/bitmap.h" + "wx/gtk1/bitmap.h" + "wx/x11/bitmap.h" + "wx/dfb/bitmap.h" + "wx/osx/bitmap.h" + "wx/cocoa/bitmap.h" + "wx/os2/bitmap.h" + "wx/generic/mask.h" + +1536665357 /usr/include/wx-3.0/wx/colour.h + "wx/defs.h" + "wx/gdiobj.h" + "wx/variant.h" + "wx/msw/colour.h" + "wx/motif/colour.h" + "wx/gtk/colour.h" + "wx/gtk1/colour.h" + "wx/generic/colour.h" + "wx/x11/colour.h" + "wx/osx/colour.h" + "wx/cocoa/colour.h" + "wx/os2/colour.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/colour.h + +1536665357 /usr/include/wx-3.0/wx/image.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdicmn.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/stream.h" + "wx/variant.h" + "wx/imagbmp.h" + "wx/imagpng.h" + "wx/imaggif.h" + "wx/imagpcx.h" + "wx/imagjpeg.h" + "wx/imagtga.h" + "wx/imagtiff.h" + "wx/imagpnm.h" + "wx/imagxpm.h" + "wx/imagiff.h" + +1536665357 /usr/include/wx-3.0/wx/stream.h + "wx/defs.h" + + "wx/object.h" + "wx/string.h" + "wx/filefn.h" + +1536665357 /usr/include/wx-3.0/wx/imagbmp.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagpng.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imaggif.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagpcx.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagjpeg.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imagtga.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagtiff.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imagpnm.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagxpm.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagiff.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/bitmap.h + +1536665357 /usr/include/wx-3.0/wx/control.h + "wx/defs.h" + "wx/window.h" + "wx/univ/control.h" + "wx/msw/control.h" + "wx/motif/control.h" + "wx/gtk/control.h" + "wx/gtk1/control.h" + "wx/osx/control.h" + "wx/cocoa/control.h" + "wx/os2/control.h" + +1536665357 /usr/include/wx-3.0/wx/window.h + "wx/event.h" + "wx/list.h" + "wx/cursor.h" + "wx/font.h" + "wx/colour.h" + "wx/region.h" + "wx/utils.h" + "wx/intl.h" + "wx/validate.h" + "wx/palette.h" + "wx/accel.h" + "wx/access.h" + "wx/msw/window.h" + "wx/motif/window.h" + "wx/gtk/window.h" + "wx/gtk1/window.h" + "wx/x11/window.h" + "wx/dfb/window.h" + "wx/osx/window.h" + "wx/cocoa/window.h" + "wx/os2/window.h" + "wx/univ/window.h" + +1536665357 /usr/include/wx-3.0/wx/font.h + "wx/defs.h" + "wx/fontenc.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/font.h" + "wx/motif/font.h" + "wx/gtk/font.h" + "wx/gtk1/font.h" + "wx/x11/font.h" + "wx/dfb/font.h" + "wx/osx/font.h" + "wx/cocoa/font.h" + "wx/os2/font.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/font.h + +1536665357 /usr/include/wx-3.0/wx/region.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/region.h" + "wx/gtk/region.h" + "wx/gtk1/region.h" + "wx/x11/region.h" + "wx/dfb/region.h" + "wx/osx/region.h" + "wx/cocoa/region.h" + "wx/os2/region.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/region.h + +1536665357 /usr/include/wx-3.0/wx/validate.h + "wx/defs.h" + "wx/event.h" + +1536665357 /usr/include/wx-3.0/wx/palette.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/msw/palette.h" + "wx/x11/palette.h" + "wx/generic/paletteg.h" + "wx/osx/palette.h" + "wx/os2/palette.h" + +1536665357 /usr/include/wx-3.0/wx/generic/paletteg.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + +1536665357 /usr/include/wx-3.0/wx/accel.h + "wx/defs.h" + "wx/object.h" + "wx/generic/accel.h" + "wx/msw/accel.h" + "wx/motif/accel.h" + "wx/gtk/accel.h" + "wx/gtk1/accel.h" + "wx/osx/accel.h" + "wx/generic/accel.h" + "wx/os2/accel.h" + +1536665357 /usr/include/wx-3.0/wx/generic/accel.h + +1536665357 /usr/include/wx-3.0/wx/gtk/accel.h + "wx/generic/accel.h" + +1536665357 /usr/include/wx-3.0/wx/access.h + "wx/defs.h" + "wx/variant.h" + "wx/msw/ole/access.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/window.h + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/control.h + +1536665357 /usr/include/wx-3.0/wx/gtk/anybutton.h + +1536665357 /usr/include/wx-3.0/wx/gtk/button.h + +1536665357 /usr/include/wx-3.0/wx/frame.h + "wx/toplevel.h" + "wx/statusbr.h" + "wx/univ/frame.h" + "wx/msw/frame.h" + "wx/gtk/frame.h" + "wx/gtk1/frame.h" + "wx/motif/frame.h" + "wx/osx/frame.h" + "wx/cocoa/frame.h" + "wx/os2/frame.h" + +1536665357 /usr/include/wx-3.0/wx/toplevel.h + "wx/nonownedwnd.h" + "wx/iconbndl.h" + "wx/weakref.h" + "wx/msw/toplevel.h" + "wx/gtk/toplevel.h" + "wx/gtk1/toplevel.h" + "wx/x11/toplevel.h" + "wx/dfb/toplevel.h" + "wx/osx/toplevel.h" + "wx/cocoa/toplevel.h" + "wx/os2/toplevel.h" + "wx/motif/toplevel.h" + "wx/univ/toplevel.h" + +1536665357 /usr/include/wx-3.0/wx/nonownedwnd.h + "wx/window.h" + "wx/dfb/nonownedwnd.h" + "wx/gtk/nonownedwnd.h" + "wx/osx/nonownedwnd.h" + "wx/msw/nonownedwnd.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/nonownedwnd.h + +1536665357 /usr/include/wx-3.0/wx/iconbndl.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/icon.h" + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/icon.h + "wx/iconloc.h" + "wx/msw/icon.h" + "wx/motif/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/osx/icon.h" + "wx/generic/icon.h" + "wx/cocoa/icon.h" + "wx/os2/icon.h" + "wx/variant.h" + +1536665357 /usr/include/wx-3.0/wx/iconloc.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/generic/icon.h + "wx/bitmap.h" + +1536665357 /usr/include/wx-3.0/wx/weakref.h + "wx/tracker.h" + "wx/meta/convertible.h" + "wx/meta/int2type.h" + +1536665357 /usr/include/wx-3.0/wx/meta/int2type.h + +1536665357 /usr/include/wx-3.0/wx/gtk/toplevel.h + +1536665357 /usr/include/wx-3.0/wx/statusbr.h + "wx/defs.h" + "wx/control.h" + "wx/list.h" + "wx/dynarray.h" + "wx/univ/statusbr.h" + "wx/msw/statusbar.h" + "wx/generic/statusbr.h" + "wx/osx/statusbr.h" + "wx/generic/statusbr.h" + +1536665357 /usr/include/wx-3.0/wx/generic/statusbr.h + "wx/defs.h" + "wx/pen.h" + "wx/arrstr.h" + +1536665357 /usr/include/wx-3.0/wx/pen.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/pen.h" + "wx/x11/pen.h" + "wx/gtk/pen.h" + "wx/gtk1/pen.h" + "wx/dfb/pen.h" + "wx/osx/pen.h" + "wx/cocoa/pen.h" + "wx/os2/pen.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/pen.h + +1536665357 /usr/include/wx-3.0/wx/gtk/frame.h + +1536665357 /usr/include/wx-3.0/wx/panel.h + "wx/window.h" + "wx/containr.h" + "wx/univ/panel.h" + "wx/msw/panel.h" + "wx/generic/panelg.h" + +1536665357 /usr/include/wx-3.0/wx/containr.h + "wx/defs.h" + "wx/event.h" + +1536665357 /usr/include/wx-3.0/wx/generic/panelg.h + "wx/bitmap.h" + +1536665357 /usr/include/wx-3.0/wx/statbox.h + "wx/defs.h" + "wx/control.h" + "wx/containr.h" + "wx/univ/statbox.h" + "wx/msw/statbox.h" + "wx/motif/statbox.h" + "wx/gtk/statbox.h" + "wx/gtk1/statbox.h" + "wx/osx/statbox.h" + "wx/cocoa/statbox.h" + "wx/os2/statbox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/statbox.h + +1536665357 /usr/include/wx-3.0/wx/stattext.h + "wx/defs.h" + "wx/control.h" + "wx/univ/stattext.h" + "wx/msw/stattext.h" + "wx/motif/stattext.h" + "wx/gtk/stattext.h" + "wx/gtk1/stattext.h" + "wx/osx/stattext.h" + "wx/cocoa/stattext.h" + "wx/os2/stattext.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/stattext.h + +1536665357 /usr/include/wx-3.0/wx/textctrl.h + "wx/defs.h" + "wx/control.h" + "wx/textentry.h" + "wx/dynarray.h" + "wx/gdicmn.h" + "wx/ioswrap.h" + "wx/x11/textctrl.h" + "wx/univ/textctrl.h" + "wx/msw/wince/textctrlce.h" + "wx/msw/textctrl.h" + "wx/motif/textctrl.h" + "wx/gtk/textctrl.h" + "wx/gtk1/textctrl.h" + "wx/osx/textctrl.h" + "wx/cocoa/textctrl.h" + "wx/os2/textctrl.h" + +1536665357 /usr/include/wx-3.0/wx/textentry.h + "wx/filefn.h" + "wx/gdicmn.h" + "wx/gtk/textentry.h" + "wx/osx/textentry.h" + "wx/msw/textentry.h" + "wx/motif/textentry.h" + "wx/os2/textentry.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/textentry.h + +1536665357 /usr/include/wx-3.0/wx/ioswrap.h + "wx/beforestd.h" + + + "wx/afterstd.h" + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/textctrl.h + +1553832615 /data/develop/Lib/Network/PSS-master/ThirdLib/include//CNetOperation.h + + + + + + + + "macro.h" + "sock_wrap.h" + "Mylog.h" + +1553849678 source:/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.cpp + "PSSProxyClientMain.h" + + + + + + + +1536665357 /usr/include/wx-3.0/wx/msgdlg.h + "wx/defs.h" + "wx/dialog.h" + "wx/stockitem.h" + "wx/generic/msgdlgg.h" + "wx/cocoa/msgdlg.h" + "wx/msw/msgdlg.h" + "wx/motif/msgdlg.h" + "wx/gtk/msgdlg.h" + "wx/osx/msgdlg.h" + "wx/os2/msgdlg.h" + +1536665357 /usr/include/wx-3.0/wx/dialog.h + "wx/toplevel.h" + "wx/containr.h" + "wx/sharedptr.h" + "wx/univ/dialog.h" + "wx/msw/dialog.h" + "wx/motif/dialog.h" + "wx/gtk/dialog.h" + "wx/gtk1/dialog.h" + "wx/osx/dialog.h" + "wx/cocoa/dialog.h" + "wx/os2/dialog.h" + +1536665357 /usr/include/wx-3.0/wx/sharedptr.h + "wx/defs.h" + "wx/atomic.h" + +1536665357 /usr/include/wx-3.0/wx/atomic.h + "wx/defs.h" + "wx/msw/wrapwin.h" + "libkern/OSAtomic.h" + + "wx/thread.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/dialog.h + +1536665357 /usr/include/wx-3.0/wx/stockitem.h + "wx/defs.h" + "wx/chartype.h" + "wx/string.h" + "wx/accel.h" + +1536665357 /usr/include/wx-3.0/wx/generic/msgdlgg.h + +1536665357 /usr/include/wx-3.0/wx/gtk/msgdlg.h + diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient.layout b/PssSampleClient/PSSProxyClient/PSSProxyClient.layout new file mode 100644 index 000000000..92adc4e80 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient.mk b/PssSampleClient/PSSProxyClient/PSSProxyClient.mk new file mode 100644 index 000000000..81d2197f0 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient.mk @@ -0,0 +1,142 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PSSProxyClient +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSProxyClient +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox-mulder +Date :=2019年04月02日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PSSProxyClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)../../ThirdLib/thirdparty +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)log4cplus +ArLibs := "liblog4cplus.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) -fpermissive -fPIC $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix): ../../ThirdLib/include/CNetOperation.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/CNetOperation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix): ../../ThirdLib/include/CNetOperation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(DependSuffix) -MM ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix): ../../ThirdLib/include/CNetOperation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_CNetOperation.cpp$(PreprocessSuffix) ../../ThirdLib/include/CNetOperation.cpp + +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(ObjectSuffix): ./PSSProxyClient/PSSProxyClientApp.cpp $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(DependSuffix): ./PSSProxyClient/PSSProxyClientApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(DependSuffix) -MM ./PSSProxyClient/PSSProxyClientApp.cpp + +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(PreprocessSuffix): ./PSSProxyClient/PSSProxyClientApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientApp.cpp$(PreprocessSuffix) ./PSSProxyClient/PSSProxyClientApp.cpp + +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(ObjectSuffix): ./PSSProxyClient/PSSProxyClientMain.cpp $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(DependSuffix): ./PSSProxyClient/PSSProxyClientMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(DependSuffix) -MM ./PSSProxyClient/PSSProxyClientMain.cpp + +$(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(PreprocessSuffix): ./PSSProxyClient/PSSProxyClientMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSSProxyClient_PSSProxyClientMain.cpp$(PreprocessSuffix) ./PSSProxyClient/PSSProxyClientMain.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix): ../../ThirdLib/thirdparty/Mylog.cpp $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/Mylog.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(DependSuffix) -MM ../../ThirdLib/thirdparty/Mylog.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix): ../../ThirdLib/thirdparty/Mylog.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_thirdparty_Mylog.cpp$(PreprocessSuffix) ../../ThirdLib/thirdparty/Mylog.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient.project b/PssSampleClient/PSSProxyClient/PSSProxyClient.project new file mode 100644 index 000000000..5554e531a --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient.project @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient.sln b/PssSampleClient/PSSProxyClient/PSSProxyClient.sln deleted file mode 100644 index ace0a5037..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSSProxyClient", "PSSProxyClient\PSSProxyClient.vcproj", "{E64C1DEC-F9B1-4AD1-8E04-8D36593D05A3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E64C1DEC-F9B1-4AD1-8E04-8D36593D05A3}.Debug|Win32.ActiveCfg = Debug|Win32 - {E64C1DEC-F9B1-4AD1-8E04-8D36593D05A3}.Debug|Win32.Build.0 = Debug|Win32 - {E64C1DEC-F9B1-4AD1-8E04-8D36593D05A3}.Release|Win32.ActiveCfg = Release|Win32 - {E64C1DEC-F9B1-4AD1-8E04-8D36593D05A3}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient.txt b/PssSampleClient/PSSProxyClient/PSSProxyClient.txt new file mode 100644 index 000000000..b969d2d1c --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient.txt @@ -0,0 +1 @@ +/data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_thirdparty_sock_wrap.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_include_CNetOperation.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/PSSProxyClient_PSSProxyClientApp.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/PSSProxyClient_PSSProxyClientMain.cpp.o /data/develop/Lib/Network/PSS-master/Build/Linux/Temp/up_up_ThirdLib_thirdparty_Mylog.cpp.o diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.cpp b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.cpp deleted file mode 100644 index 21ef3b0db..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// PSSProxyClient.cpp : ӦóΪ -// - -#include "stdafx.h" -#include "PSSProxyClient.h" -#include "PSSProxyClientDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CPSSProxyClientApp - -BEGIN_MESSAGE_MAP(CPSSProxyClientApp, CWinApp) - ON_COMMAND(ID_HELP, &CWinApp::OnHelp) -END_MESSAGE_MAP() - - -// CPSSProxyClientApp - -CPSSProxyClientApp::CPSSProxyClientApp() -{ - // TODO: ڴ˴ӹ룬 - // Ҫijʼ InitInstance -} - - -// Ψһһ CPSSProxyClientApp - -CPSSProxyClientApp theApp; - - -// CPSSProxyClientApp ʼ - -BOOL CPSSProxyClientApp::InitInstance() -{ - // һ Windows XP ϵӦó嵥ָҪ - // ʹ ComCtl32.dll 汾 6 ߰汾ÿӻʽ - //Ҫ InitCommonControlsEx()򣬽޷ڡ - INITCOMMONCONTROLSEX InitCtrls; - InitCtrls.dwSize = sizeof(InitCtrls); - // ΪҪӦóʹõ - // ؼࡣ - InitCtrls.dwICC = ICC_WIN95_CLASSES; - InitCommonControlsEx(&InitCtrls); - - CWinApp::InitInstance(); - - AfxEnableControlContainer(); - - // ׼ʼ - // δʹЩܲϣС - // տִļĴСӦƳ - // Ҫضʼ - // ڴ洢õע - // TODO: Ӧʵ޸ĸַ - // ޸Ϊ˾֯ - SetRegistryKey(_T("ӦóɵıӦó")); - - CPSSProxyClientDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: ڴ˷ôʱ - // ȷرնԻĴ - } - else if (nResponse == IDCANCEL) - { - // TODO: ڴ˷ôʱ - // ȡرնԻĴ - } - - // ڶԻѹرգԽ FALSE Ա˳Ӧó - // ӦóϢá - return FALSE; -} diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.h b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.h deleted file mode 100644 index 91283e07f..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.h +++ /dev/null @@ -1,31 +0,0 @@ -// PSSProxyClient.h : PROJECT_NAME Ӧóͷļ -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error "ڰļ֮ǰstdafx.h PCH ļ" -#endif - -#include "resource.h" // - - -// CPSSProxyClientApp: -// йشʵ֣ PSSProxyClient.cpp -// - -class CPSSProxyClientApp : public CWinApp -{ -public: - CPSSProxyClientApp(); - -// д - public: - virtual BOOL InitInstance(); - -// ʵ - - DECLARE_MESSAGE_MAP() -}; - -extern CPSSProxyClientApp theApp; \ No newline at end of file diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.rc b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.rc deleted file mode 100644 index 7f7cbc818..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.rc +++ /dev/null @@ -1,208 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// (л񹲺͹) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -#ifdef _WIN32 -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -#pragma code_page(936) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n" - "LANGUAGE 4, 2\r\n" - "#pragma code_page(936)\r\n" - "#include ""res\\PSSProxyClient.rc2"" // Microsoft Visual C++ ༭Դ\r\n" - "#include ""l.CHS\\afxres.rc"" // ׼\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\PSSProxyClient.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " PSSProxyClient" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,14,14,21,20 - LTEXT "PSSProxyClient1.0 ",IDC_STATIC,42,14,114,8,SS_NOPREFIX - LTEXT "Copyright (C) 2013",IDC_STATIC,42,26,114,8 - DEFPUSHBUTTON "ȷ",IDOK,113,41,50,14,WS_GROUP -END - -IDD_PSSPROXYCLIENT_DIALOG DIALOGEX 0, 0, 320, 200 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "PSSԿͻ" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "",IDC_STATIC,7,7,306,65 - LTEXT "Դ",IDC_STATIC,15,35,31,8 - EDITTEXT IDC_EDIT1,46,33,258,14,ES_AUTOHSCROLL - PUSHBUTTON "ʼԶ",IDC_BUTTON1,15,51,78,14 - LTEXT "IP",IDC_STATIC,15,18,31,8 - EDITTEXT IDC_EDIT2,46,16,45,14,ES_AUTOHSCROLL - LTEXT "Զ˿",IDC_STATIC,105,18,31,8 - EDITTEXT IDC_EDIT3,137,16,45,14,ES_AUTOHSCROLL -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080403a8" - BEGIN - VALUE "CompanyName", "TODO: <˾>" - VALUE "FileDescription", "TODO: <ļ˵>" - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "PSSProxyClient.exe" - VALUE "LegalCopyright", "TODO: (C) <˾>Ȩ" - VALUE "OriginalFilename", "PSSProxyClient.exe" - VALUE "ProductName", "TODO: <Ʒ>" - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x804, 936 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 163 - TOPMARGIN, 7 - BOTTOMMARGIN, 55 - END - - IDD_PSSPROXYCLIENT_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 313 - TOPMARGIN, 7 - BOTTOMMARGIN, 193 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_ABOUTBOX " PSSProxyClient(&A)..." -END - -#endif // (л񹲺͹) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -LANGUAGE 4, 2 -#pragma code_page(936) -#include "res\PSSProxyClient.rc2" // Microsoft Visual C++ ༭Դ -#include "l.CHS\afxres.rc" // ׼ -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.vcproj b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.vcproj deleted file mode 100644 index bb5cfc23b..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClient.vcproj +++ /dev/null @@ -1,273 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.cpp b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.cpp new file mode 100644 index 000000000..1a0edd099 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.cpp @@ -0,0 +1,33 @@ +/*************************************************************** + * Name: PSSProxyClientApp.cpp + * Purpose: Code for Application Class + * Author: smith () + * Created: 2019-02-22 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PSSProxyClientApp.h" + +//(*AppHeaders +#include "PSSProxyClientMain.h" +#include +//*) + +IMPLEMENT_APP(PSSProxyClientApp); + +bool PSSProxyClientApp::OnInit() +{ + //(*AppInitialize + bool wxsOK = true; + wxInitAllImageHandlers(); + if ( wxsOK ) + { + PSSProxyClientFrame* Frame = new PSSProxyClientFrame(0); + Frame->Show(); + SetTopWindow(Frame); + } + //*) + return wxsOK; + +} diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.h b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.h new file mode 100644 index 000000000..e7062f129 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientApp.h @@ -0,0 +1,21 @@ +/*************************************************************** + * Name: PSSProxyClientApp.h + * Purpose: Defines Application Class + * Author: smith () + * Created: 2019-02-22 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSSPROXYCLIENTAPP_H +#define PSSPROXYCLIENTAPP_H + +#include + +class PSSProxyClientApp : public wxApp +{ + public: + virtual bool OnInit(); +}; + +#endif // PSSPROXYCLIENTAPP_H diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientDlg.cpp b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientDlg.cpp deleted file mode 100644 index 423d0b3fa..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientDlg.cpp +++ /dev/null @@ -1,328 +0,0 @@ -// PSSProxyClientDlg.cpp : ʵļ -// - -#include "stdafx.h" -#include "PSSProxyClient.h" -#include "PSSProxyClientDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// Ӧó򡰹ڡ˵ CAboutDlg Ի - -class CAboutDlg : public CDialog -{ -public: - CAboutDlg(); - -// Ի - enum { IDD = IDD_ABOUTBOX }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - -// ʵ -protected: - DECLARE_MESSAGE_MAP() -}; - -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ -} - -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} - -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) -END_MESSAGE_MAP() - - -// CPSSProxyClientDlg Ի - - - - -CPSSProxyClientDlg::CPSSProxyClientDlg(CWnd* pParent /*=NULL*/) - : CDialog(CPSSProxyClientDlg::IDD, pParent) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CPSSProxyClientDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_EDIT2, m_txtServerIP); - DDX_Control(pDX, IDC_EDIT3, m_txtServerPort); - DDX_Control(pDX, IDC_EDIT1, m_txtSendData); -} - -BEGIN_MESSAGE_MAP(CPSSProxyClientDlg, CDialog) - ON_WM_SYSCOMMAND() - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDC_BUTTON1, &CPSSProxyClientDlg::OnBnClickedButton1) -END_MESSAGE_MAP() - - -// CPSSProxyClientDlg Ϣ - -BOOL CPSSProxyClientDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // ...˵ӵϵͳ˵С - - // IDM_ABOUTBOX ϵͳΧڡ - ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); - ASSERT(IDM_ABOUTBOX < 0xF000); - - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - CString strAboutMenu; - strAboutMenu.LoadString(IDS_ABOUTBOX); - if (!strAboutMenu.IsEmpty()) - { - pSysMenu->AppendMenu(MF_SEPARATOR); - pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); - } - } - - // ô˶ԻͼꡣӦóڲǶԻʱܽԶ - // ִд˲ - SetIcon(m_hIcon, TRUE); // ôͼ - SetIcon(m_hIcon, FALSE); // Сͼ - - // TODO: ڴӶijʼ - InitView(); - - return TRUE; // ǽõؼ򷵻 TRUE -} - -void CPSSProxyClientDlg::OnSysCommand(UINT nID, LPARAM lParam) -{ - if ((nID & 0xFFF0) == IDM_ABOUTBOX) - { - CAboutDlg dlgAbout; - dlgAbout.DoModal(); - } - else - { - CDialog::OnSysCommand(nID, lParam); - } -} - -// ԻСťҪĴ -// Ƹͼꡣʹĵ/ͼģ͵ MFC Ӧó -// ⽫ɿԶɡ - -void CPSSProxyClientDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // ڻƵ豸 - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // ʹͼڹо - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // ͼ - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -//û϶Сʱϵͳô˺ȡù -//ʾ -HCURSOR CPSSProxyClientDlg::OnQueryDragIcon() -{ - return static_cast(m_hIcon); -} - - -void CPSSProxyClientDlg::OnBnClickedButton1() -{ - // TODO: ڴӿؼ֪ͨ - CString strData; - m_txtServerIP.GetWindowText(strData); - - char szServerIP[MAX_BUFF_20] = {'\0'}; - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szServerIP, MAX_BUFF_20, NULL,NULL); - szServerIP[nDecLen] = '\0'; - - m_txtServerPort.GetWindowText(strData); - int nServerPort = _ttoi((LPCTSTR)strData); - - m_txtSendData.GetWindowText(strData); - - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); - char* pSendData = new char[nBufferSize]; - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSendData, nBufferSize, NULL,NULL); - pSendData[nDecLen] = '\0'; - - CConvertBuffer objConvertBuffer; - //ҪתݿС - int nBuffSize = objConvertBuffer.GetBufferSize(pSendData, nDecLen); - char* pSendBuff = new char[nBuffSize]; - //ݴתɶƴ - objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), (unsigned char*)pSendBuff, nBuffSize); - delete[] pSendData; - - //ʼ - if(m_sckClient != INVALID_SOCKET) - { - Close(); - } - - if(Connect(szServerIP, nServerPort) == false) - { - return; - } - - Send_Data(pSendBuff, nBuffSize); - - Close(); - - delete[] pSendBuff; -} - -void CPSSProxyClientDlg::InitView() -{ - m_txtServerIP.SetWindowText(_T("127.0.0.1")); - m_txtServerPort.SetWindowText(_T("10002")); - - m_txtSendData.SetWindowText(_T("01 00 30 10 08 00 00 00 46 45 45 45 45 59 45 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 be cd aa 8f 3c 01 00 00")); - - //ʼTCP - WSADATA wsaData; - int nErr = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(nErr != 0) - { - MessageBox(_T("socketʧܣ鱾socket汾"), _T("Ϣ"), MB_OK); - } - - m_sckClient = INVALID_SOCKET; -} - -bool CPSSProxyClientDlg::Connect(const char* pIP, int nPort) -{ - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(nPort); - sockaddr.sin_addr.S_un.S_addr = inet_addr(pIP); - - m_sckClient = socket(AF_INET, SOCK_STREAM, 0); - - DWORD TimeOut = (DWORD)100; - ::setsockopt(m_sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); - - int nErr = connect(m_sckClient, (SOCKADDR*)&sockaddr, sizeof(SOCKADDR)); - if(0 != nErr) - { - //ʧ - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return false; - } - - return true; -} - -void CPSSProxyClientDlg::Close() -{ - closesocket(m_sckClient); - m_sckClient = INVALID_SOCKET; -} - -void CPSSProxyClientDlg::Send_Data( const char* pSendBuff, int nLen ) -{ - int nTotalSendLen = nLen; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(m_sckClient, pSendBuff + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - //Ƚֽڵݰ - char szRecvLength[30] = {'\0'}; - nCurrRecvLen = recv(m_sckClient, (char* )szRecvLength, 30, 0); - if(nCurrRecvLen != 30) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return; - } - - int nRecvLength = 0; - memcpy_s(&nRecvLength, sizeof(int), &szRecvLength[4], sizeof(int)); - char* pRecvBuff = new char[nRecvLength]; - int nRecvBegin = 0; - - while(true) - { - if(nRecvLength - nRecvBegin == 0) - { - break; - } - - //ͳɹˣ - nCurrRecvLen = recv(m_sckClient, (char* )pRecvBuff + nRecvBegin, nRecvLength - nRecvBegin, 0); - if(nCurrRecvLen <= 0) - { - DWORD dwError = GetLastError(); - MessageBox(_T("Զ̷ʧ"), _T("Ϣ"), MB_OK); - return; - } - else - { - nRecvBegin += nCurrRecvLen; - } - } - - MessageBox(_T("ݳɹ"), _T("ʾϢ"), MB_OK); - return; -} diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientDlg.h b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientDlg.h deleted file mode 100644 index 3ade861c3..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientDlg.h +++ /dev/null @@ -1,202 +0,0 @@ -// PSSProxyClientDlg.h : ͷļ -// - -#pragma once -#include "afxwin.h" - -#include - -#define MAX_BUFF_20 20 - -class CConvertBuffer -{ -public: - CConvertBuffer() {}; - ~CConvertBuffer() {}; - int GetBufferSize(const char* pData, int nSrcLen) - { - char szData[3] = {'\0'}; - int nPos = 0; - int nCurrSize = 0; - int nConvertSize = 0; - bool blState = false; //תַǷЧ - bool blSrcState = true; //ԪַǷЧ - unsigned char cData; - - while(nPos < nSrcLen) - { - if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) - { - if(nPos == nSrcLen - 1) - { - szData[nCurrSize++] = pData[nPos]; - } - - szData[nCurrSize] = '\0'; - if(blSrcState == true) - { - blState = ConvertStr2char(szData, cData); - if(blState == true) - { - nConvertSize++; - } - } - nCurrSize = 0; - blSrcState = true; - nPos++; - } - else - { - if(nCurrSize < 2) - { - szData[nCurrSize++] = pData[nPos]; - } - else - { - blSrcState = false; - } - nPos++; - } - } - - return nConvertSize; - }; - - bool Convertstr2charArray(const char* pData, int nSrcLen, unsigned char* pDes, int& nMaxLen) - { - char szData[3] = {'\0'}; - int nPos = 0; - int nCurrSize = 0; - int nConvertSize = 0; - bool blState = false; //תַǷЧ - bool blSrcState = true; //ԪַǷЧ - - while(nPos < nSrcLen) - { - if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) - { - if(nPos == nSrcLen - 1) - { - szData[nCurrSize++] = pData[nPos]; - } - - szData[nCurrSize] = '\0'; - if(nConvertSize < nMaxLen && blSrcState == true) - { - blState = ConvertStr2char(szData, pDes[nConvertSize]); - if(blState == true) - { - nConvertSize++; - } - } - nCurrSize = 0; - blSrcState = true; - nPos++; - } - else - { - if(nCurrSize < 2) - { - szData[nCurrSize++] = pData[nPos]; - } - else - { - blSrcState = false; - } - nPos++; - } - } - - nMaxLen = nConvertSize; - return true; - }; -private: - bool Get_binary_Char(unsigned char cTag, unsigned char& cDes) - { - if(cTag >='A'&& cTag <='F') - { - cDes = cTag - 'A' + 10; - return true; - } - else if(cTag >='a'&& cTag <='f') - { - cDes = cTag - 'a' + 10; - return true; - } - else if(cTag >= '0'&& cTag<= '9') - { - cDes = cTag-'0'; - return true; - } - else - { - return false; - } - } - - bool ConvertStr2char(const char* pData, unsigned char& cData) - { - if(pData == NULL || strlen(pData) != 2) - { - return false; - } - - char cFirst = pData[1]; - unsigned char cTemp = 0; - bool blStste = Get_binary_Char(cFirst, cTemp); - if(false == blStste) - { - return false; - } - cData = cTemp; - char cSecond = pData[0]; - blStste = Get_binary_Char(cSecond, cTemp); - if(false == blStste) - { - return false; - } - cTemp = cTemp << 4; - cData = cData | cTemp; - - return true; - } -}; - -// CPSSProxyClientDlg Ի -class CPSSProxyClientDlg : public CDialog -{ -// -public: - CPSSProxyClientDlg(CWnd* pParent = NULL); // ׼캯 - -// Ի - enum { IDD = IDD_PSSPROXYCLIENT_DIALOG }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - -private: - void InitView(); - bool Connect(const char* pIP, int nPort); - void Close(); - void Send_Data(const char* pSendBuff, int nLen); - -private: - SOCKET m_sckClient; - -// ʵ -protected: - HICON m_hIcon; - - // ɵϢӳ亯 - virtual BOOL OnInitDialog(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - DECLARE_MESSAGE_MAP() -public: - CEdit m_txtServerIP; - CEdit m_txtServerPort; - CEdit m_txtSendData; - afx_msg void OnBnClickedButton1(); -}; diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.cpp b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.cpp new file mode 100644 index 000000000..991f217a2 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.cpp @@ -0,0 +1,201 @@ +/*************************************************************** + * Name: PSSProxyClientMain.cpp + * Purpose: Code for Application Frame + * Author: smith () + * Created: 2019-02-22 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PSSProxyClientMain.h" +#include + +//(*InternalHeaders(PSSProxyClientFrame) +#include +#include +#include +#include +#include +//*) + +//helper functions +enum wxbuildinfoformat { + short_f, long_f }; + +wxString wxbuildinfo(wxbuildinfoformat format) +{ + wxString wxbuild(wxVERSION_STRING); + + if (format == long_f ) + { +#if defined(__WXMSW__) + wxbuild << _T("-Windows"); +#elif defined(__UNIX__) + wxbuild << _T("-Linux"); +#endif + +#if wxUSE_UNICODE + wxbuild << _T("-Unicode build"); +#else + wxbuild << _T("-ANSI build"); +#endif // wxUSE_UNICODE + } + + return wxbuild; +} + +//(*IdInit(PSSProxyClientFrame) +const long PSSProxyClientFrame::ID_STATICBOX1 = wxNewId(); +const long PSSProxyClientFrame::ID_STATICTEXT1 = wxNewId(); +const long PSSProxyClientFrame::ID_STATICTEXT2 = wxNewId(); +const long PSSProxyClientFrame::ID_STATICTEXT3 = wxNewId(); +const long PSSProxyClientFrame::ID_TEXTCTRL1 = wxNewId(); +const long PSSProxyClientFrame::ID_TEXTCTRL2 = wxNewId(); +const long PSSProxyClientFrame::ID_TEXTCTRL3 = wxNewId(); +const long PSSProxyClientFrame::ID_BUTTON1 = wxNewId(); +const long PSSProxyClientFrame::ID_PANEL1 = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(PSSProxyClientFrame,wxFrame) + //(*EventTable(PSSProxyClientFrame) + //*) +END_EVENT_TABLE() + +PSSProxyClientFrame::PSSProxyClientFrame(wxWindow* parent,wxWindowID id) +{ + //(*Initialize(PSSProxyClientFrame) + Create(parent, id, wxT("PSS代理测试客户端"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id")); + SetClientSize(wxSize(532,410)); + { + wxIcon FrameIcon; + FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("./Icon.jpg")))); + SetIcon(FrameIcon); + } + Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(144,96), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1")); + StaticBox1 = new wxStaticBox(Panel1, ID_STATICBOX1, wxT("代理测试"), wxPoint(8,8), wxSize(520,168), 0, _T("ID_STATICBOX1")); + StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, wxT("测试IP"), wxPoint(32,40), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, wxT("测试端口"), wxPoint(256,40), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, wxT("测试代码"), wxPoint(32,88), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + TextCtrl_ServerIP = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxT("127.0.0.1"), wxPoint(88,32), wxSize(160,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); + TextCtrl_ServerIP->SetMaxLength(16); + TextCtrl_ServerPort = new wxTextCtrl(Panel1, ID_TEXTCTRL2, wxT("10002"), wxPoint(328,32), wxSize(-1,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); + TextCtrl_SendData = new wxTextCtrl(Panel1, ID_TEXTCTRL3, wxT("01 00 30 10 08 00 00 00 46 45 45 45 45 59 45 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 be cd aa 8f 3c 01 00 00"), wxPoint(88,80), wxSize(432,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL3")); + Button_StartTest = new wxButton(Panel1, ID_BUTTON1, wxT("开始测试短连接"), wxPoint(32,128), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); + + Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSSProxyClientFrame::OnButton_StartTestClick); + //*) + + +} + +PSSProxyClientFrame::~PSSProxyClientFrame() +{ + //(*Destroy(PSSProxyClientFrame) + //*) + delete pNetOperation; +} + +void PSSProxyClientFrame::OnQuit(wxCommandEvent& event) +{ + pNetOperation->Close(); +} + +void PSSProxyClientFrame::OnAbout(wxCommandEvent& event) +{ + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, wxT("Welcome to...")); +} + + +void PSSProxyClientFrame::Send_Data( const char* pSendBuff, int nLen ) +{ + int nTotalSendLen = nLen; + int nBeginSend = 0; + int nCurrSendLen = 0; + bool blSendFlag = false; + int nBeginRecv = 0; + int nCurrRecvLen = 0; + bool blRecvFlag = false; + + + _LoginInfo objLoginInfo; + const char * CmdPacket =(const char*)pSendBuff + nBeginSend; + pNetOperation->SendPacket(objLoginInfo,CmdPacket,nTotalSendLen); + + int RetPacketLength =30; + char *Cmd_RevBuff =new char[RetPacketLength]; + pNetOperation->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + int nRecvLength = 0; + memcpy(&nRecvLength, &Cmd_RevBuff[4], sizeof(int)); + if (Cmd_RevBuff) delete Cmd_RevBuff; + + char *pRecvBuff = new char[nRecvLength];// = { '\0' }; + pNetOperation->RecvPacket(objLoginInfo,pRecvBuff,nRecvLength); //接收报文 + if (pRecvBuff) delete pRecvBuff; + + wxMessageBox(wxT("接收数据成功"), wxT("提示信息"), wxOK | wxICON_INFORMATION, this); + +} + + +void PSSProxyClientFrame::OnButton_StartTestClick(wxCommandEvent& event) +{ + +// TODO: 在此添加控件通知处理程序代码 + + std::string strServerIP =std::string(this->TextCtrl_ServerIP->GetValue()); + int nPort = wxAtoi(this->TextCtrl_ServerPort->GetValue()); + + if(strServerIP == wxT("") || nPort == 0) + { + wxString msg = wxT("请输入完整的服务器IP地址和端口信息。"); + wxMessageBox(msg, wxT("服务器信息"), wxOK | wxICON_INFORMATION, this); + return; + } + + std::string strSendData =std::string(this->TextCtrl_SendData->GetValue()); + if(strSendData == wxT("") ) + { + wxMessageBox(wxT("测试数据不能为空。"), wxT("测试数据"), wxOK | wxICON_INFORMATION, this); + return; + }; + + + int nDecLen = strSendData.length(); + char* pSendData = new char[nDecLen]; + //nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSendData, nBufferSize, NULL,NULL); + memcpy(pSendData,strSendData.c_str(),strSendData.length()); + pSendData[nDecLen] = '\0'; + + + CConvertBuffer objConvertBuffer; + //获得要转换的数据块大小 + int nBuffSize = objConvertBuffer.GetBufferSize(pSendData, nDecLen); + char* pSendBuff = new char[nBuffSize]; + //将数据串转换成二进制串 + objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), (unsigned char*)pSendBuff, nBuffSize); + delete[] pSendData; + + + + //开始发送数据 + if(strServerIP == wxT("") || nPort == 0) + { + wxMessageBox( wxT("请输入完整的服务器IP地址和端口信息。"), wxT("错误信息"), wxOK | wxICON_INFORMATION, this); + return ; + } + + if(pNetOperation->Conn(strServerIP,nPort,1000) == false) + { + wxMessageBox(wxT("连接远程服务器失败。"), wxT("错误信息"), wxOK | wxICON_INFORMATION, this); + return ; + } + + Send_Data(pSendBuff, nBuffSize); + + Close(); + + delete[] pSendBuff; + +} diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.h b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.h new file mode 100644 index 000000000..3962d0a8b --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient/PSSProxyClientMain.h @@ -0,0 +1,234 @@ +/*************************************************************** + * Name: PSSProxyClientMain.h + * Purpose: Defines Application Frame + * Author: smith () + * Created: 2019-02-22 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSSPROXYCLIENTMAIN_H +#define PSSPROXYCLIENTMAIN_H + +//(*Headers(PSSProxyClientFrame) +#include +#include +#include +#include +#include +#include +//*) + +#include "CNetOperation.h" + + + + + +class CConvertBuffer +{ +public: + CConvertBuffer() {}; + ~CConvertBuffer() {}; + int GetBufferSize(const char* pData, int nSrcLen) + { + char szData[3] = {'\0'}; + int nPos = 0; + int nCurrSize = 0; + int nConvertSize = 0; + bool blState = false; //转换后的字符串是否有效 + bool blSrcState = true; //元字符串是否有效 + unsigned char cData; + + while(nPos < nSrcLen) + { + if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) + { + if(nPos == nSrcLen - 1) + { + szData[nCurrSize++] = pData[nPos]; + } + + szData[nCurrSize] = '\0'; + if(blSrcState == true) + { + blState = ConvertStr2char(szData, cData); + if(blState == true) + { + nConvertSize++; + } + } + nCurrSize = 0; + blSrcState = true; + nPos++; + } + else + { + if(nCurrSize < 2) + { + szData[nCurrSize++] = pData[nPos]; + } + else + { + blSrcState = false; + } + nPos++; + } + } + + return nConvertSize; + }; + + bool Convertstr2charArray(const char* pData, int nSrcLen, unsigned char* pDes, int& nMaxLen) + { + char szData[3] = {'\0'}; + int nPos = 0; + int nCurrSize = 0; + int nConvertSize = 0; + bool blState = false; //转换后的字符串是否有效 + bool blSrcState = true; //元字符串是否有效 + + while(nPos < nSrcLen) + { + if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) + { + if(nPos == nSrcLen - 1) + { + szData[nCurrSize++] = pData[nPos]; + } + + szData[nCurrSize] = '\0'; + if(nConvertSize < nMaxLen && blSrcState == true) + { + blState = ConvertStr2char(szData, pDes[nConvertSize]); + if(blState == true) + { + nConvertSize++; + } + } + nCurrSize = 0; + blSrcState = true; + nPos++; + } + else + { + if(nCurrSize < 2) + { + szData[nCurrSize++] = pData[nPos]; + } + else + { + blSrcState = false; + } + nPos++; + } + } + + nMaxLen = nConvertSize; + return true; + }; +private: + bool Get_binary_Char(unsigned char cTag, unsigned char& cDes) + { + if(cTag >='A'&& cTag <='F') + { + cDes = cTag - 'A' + 10; + return true; + } + else if(cTag >='a'&& cTag <='f') + { + cDes = cTag - 'a' + 10; + return true; + } + else if(cTag >= '0'&& cTag<= '9') + { + cDes = cTag-'0'; + return true; + } + else + { + return false; + } + } + + bool ConvertStr2char(const char* pData, unsigned char& cData) + { + if(pData == NULL || strlen(pData) != 2) + { + return false; + } + + char cFirst = pData[1]; + unsigned char cTemp = 0; + bool blStste = Get_binary_Char(cFirst, cTemp); + if(false == blStste) + { + return false; + } + cData = cTemp; + char cSecond = pData[0]; + blStste = Get_binary_Char(cSecond, cTemp); + if(false == blStste) + { + return false; + } + cTemp = cTemp << 4; + cData = cData | cTemp; + + return true; + } +}; + + +class PSSProxyClientFrame: public wxFrame +{ + public: + + PSSProxyClientFrame(wxWindow* parent,wxWindowID id = -1); + virtual ~PSSProxyClientFrame(); + + + private: + + //(*Handlers(PSSProxyClientFrame) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnButton_StartTestClick(wxCommandEvent& event); + //*) + + //(*Identifiers(PSSProxyClientFrame) + static const long ID_STATICBOX1; + static const long ID_STATICTEXT1; + static const long ID_STATICTEXT2; + static const long ID_STATICTEXT3; + static const long ID_TEXTCTRL1; + static const long ID_TEXTCTRL2; + static const long ID_TEXTCTRL3; + static const long ID_BUTTON1; + static const long ID_PANEL1; + //*) + + //(*Declarations(PSSProxyClientFrame) + wxButton* Button_StartTest; + wxPanel* Panel1; + wxStaticBox* StaticBox1; + wxStaticText* StaticText1; + wxStaticText* StaticText2; + wxStaticText* StaticText3; + wxTextCtrl* TextCtrl_SendData; + wxTextCtrl* TextCtrl_ServerIP; + wxTextCtrl* TextCtrl_ServerPort; + //*) + + DECLARE_EVENT_TABLE() + +private: + + void Send_Data(const char* pSendBuff, int nLen); + +private: + //CSockWrap *m_sckClient; + CNetOperation *pNetOperation; +}; + +#endif // PSSPROXYCLIENTMAIN_H diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/ReadMe.txt b/PssSampleClient/PSSProxyClient/PSSProxyClient/ReadMe.txt deleted file mode 100644 index 895d7810d..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/ReadMe.txt +++ /dev/null @@ -1,73 +0,0 @@ -================================================================================ -MICROSOFT : PSSProxyClient Ŀ -=============================================================================== - -ӦóΪ PSSProxyClient Ӧó򡣴Ӧó򲻽ʾ Microsoft Ļʹ÷ΪдӦó㡣 - -ļҪ PSSProxyClient Ӧóÿļݡ - -PSSProxyClient.vcproj -ʹӦóɵ VC++ ĿĿļ -ɸļ Visual C++ İ汾ϢԼйʹӦóѡƽ̨úĿܵϢ - -PSSProxyClient.h -ӦóҪͷļĿضͷļ( Resource.h) CPSSProxyClientApp Ӧóࡣ - -PSSProxyClient.cpp -ǰӦó CPSSProxyClientApp ҪӦóԴļ - -PSSProxyClient.rc -dzʹõ Microsoft Windows Դб RES Ŀ¼д洢ͼꡢλͼ͹ꡣļֱ Microsoft Visual C++ нб༭ĿԴλ 2052 С - -res\PSSProxyClient.ico -ӦóͼͼļͼҪԴļ PSSProxyClient.rc С - -res\PSSProxyClient.rc2 -ļ Microsoft Visual C++ нб༭ԴӦýԴ༭༭ԴڴļС - - -///////////////////////////////////////////////////////////////////////////// - -Ӧó򵼴һԻ: - -PSSProxyClientDlg.hPSSProxyClientDlg.cpp - Ի -Щļ CPSSProxyClientDlg ࡣඨӦóԻΪöԻģλ PSSProxyClient.rc Уļ Microsoft Visual C++ нб༭ - - -///////////////////////////////////////////////////////////////////////////// - -: - -ActiveX ؼ -Ӧóʹ ActiveX ؼ֧֡ - -ӡӡԤ֧ -Ӧóͨ MFC CView еijԱڴӡӡúʹӡԤĴ롣 - -///////////////////////////////////////////////////////////////////////////// - -׼ļ: - -StdAfx.hStdAfx.cpp -ЩļΪ PSSProxyClient.pch Ԥͷ (PCH) ļΪ StdAfx.obj Ԥļ - -Resource.h -DZ׼ͷļµԴ ID -Microsoft Visual C++ ȡ´ļ - -PSSProxyClient.manifest - Ӧó嵥ļ Windows XP Ӧó - ض汾г򼯵ԡسʹô - Ϣӳ򼯻ʵij򼯻 - Ӧó˽ϢӦó嵥Ϊ·ַΪ - Ӧóִļװͬļеⲿ .manifest ļ - ҲԴʽڸÿִļС -///////////////////////////////////////////////////////////////////////////// - -ע: - -ӦóʹáTODO:ָʾӦӻԶԴ벿֡ - -Ӧóڹ DLL ʹ MFCҪ·Щ MFC DLLӦóõϵͳĵǰòͬҪ·ӦıػԴ MFC90XXX.DLLйĸϢμ MSDN ĵй Redistributing Visual C++ applications (· Visual C++ Ӧó)½ڡ - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/res/PSSProxyClient.ico b/PssSampleClient/PSSProxyClient/PSSProxyClient/res/PSSProxyClient.ico deleted file mode 100644 index 8a84ca3d3..000000000 Binary files a/PssSampleClient/PSSProxyClient/PSSProxyClient/res/PSSProxyClient.ico and /dev/null differ diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/res/PSSProxyClient.rc2 b/PssSampleClient/PSSProxyClient/PSSProxyClient/res/PSSProxyClient.rc2 deleted file mode 100644 index f4a34bfff..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/res/PSSProxyClient.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// PSSProxyClient.RC2 - Microsoft Visual C++ ֱӱ༭Դ -// - -#ifdef APSTUDIO_INVOKED -#error ļ Microsoft Visual C++ ༭ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// ڴ˴ֶ༭Դ... - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/resource.h b/PssSampleClient/PSSProxyClient/PSSProxyClient/resource.h deleted file mode 100644 index 4c17f98ee..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/resource.h +++ /dev/null @@ -1,24 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PSSProxyClient.rc -// -#define IDM_ABOUTBOX 0x0010 -#define IDD_ABOUTBOX 100 -#define IDS_ABOUTBOX 101 -#define IDD_PSSPROXYCLIENT_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDC_EDIT1 1000 -#define IDC_BUTTON1 1001 -#define IDC_EDIT2 1002 -#define IDC_EDIT3 1003 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1002 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/stdafx.cpp b/PssSampleClient/PSSProxyClient/PSSProxyClient/stdafx.cpp deleted file mode 100644 index 085a35173..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/stdafx.cpp +++ /dev/null @@ -1,7 +0,0 @@ -// stdafx.cpp : ֻ׼ļԴļ -// PSSProxyClient.pch ΪԤͷ -// stdafx.obj ԤϢ - -#include "stdafx.h" - - diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/stdafx.h b/PssSampleClient/PSSProxyClient/PSSProxyClient/stdafx.h deleted file mode 100644 index 4d4711a70..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/stdafx.h +++ /dev/null @@ -1,57 +0,0 @@ -// stdafx.h : ׼ϵͳļİļ -// Ǿʹõĵ -// ضĿİļ - -#pragma once - -#ifndef _SECURE_ATL -#define _SECURE_ATL 1 -#endif - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Windows ͷųʹõ -#endif - -#include "targetver.h" - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // ijЩ CString 캯ʽ - -// ر MFC ijЩɷĺԵľϢ -#define _AFX_ALL_WARNINGS - -#include // MFC ͱ׼ -#include // MFC չ - - -#include // MFC Զ - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC Internet Explorer 4 ؼ֧ -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC Windows ؼ֧ -#endif // _AFX_NO_AFXCMN_SUPPORT - - - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_IA64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - - diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/targetver.h b/PssSampleClient/PSSProxyClient/PSSProxyClient/targetver.h deleted file mode 100644 index 93f0450cb..000000000 --- a/PssSampleClient/PSSProxyClient/PSSProxyClient/targetver.h +++ /dev/null @@ -1,26 +0,0 @@ - -#pragma once - -// º궨Ҫƽ̨Ҫƽ̨ -// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ -// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ -// - -// ҪԵָ汾ƽ̨޸ж塣 -// йزͬƽ̨ӦֵϢο MSDN -#ifndef WINVER // ָҪƽ̨ Windows Vista -#define WINVER 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista -#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINDOWS // ָҪƽ̨ Windows 98 -#define _WIN32_WINDOWS 0x0410 // ֵΪʵֵ Windows Me ߰汾 -#endif - -#ifndef _WIN32_IE // ָҪƽ̨ Internet Explorer 7.0 -#define _WIN32_IE 0x0700 // ֵΪӦֵ IE 汾 -#endif - diff --git a/PssSampleClient/PSSProxyClient/PSSProxyClient/wxsmith/PSSProxyClientframe.wxs b/PssSampleClient/PSSProxyClient/PSSProxyClient/wxsmith/PSSProxyClientframe.wxs new file mode 100644 index 000000000..8d2e91bb9 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/PSSProxyClient/wxsmith/PSSProxyClientframe.wxs @@ -0,0 +1,49 @@ + + + + PSS代理测试客户端 + ./Icon.jpg + 532,410 + + 144,96 + + + 8,8 + 520,168 + + + + 32,40 + + + + 256,40 + + + + 32,88 + + + 127.0.0.1 + 16 + 88,32 + 160,35 + + + 10002 + 328,32 + -1,35 + + + 01 00 30 10 08 00 00 00 46 45 45 45 45 59 45 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 be cd aa 8f 3c 01 00 00 + 88,80 + 432,35 + + + + 32,128 + + + + + diff --git a/PssSampleClient/PSSProxyClient/compile_flags.txt b/PssSampleClient/PSSProxyClient/compile_flags.txt new file mode 100644 index 000000000..ab61c09a9 --- /dev/null +++ b/PssSampleClient/PSSProxyClient/compile_flags.txt @@ -0,0 +1,11 @@ +-I/data/develop/Lib/Network/PSS-master/PssSampleClient/PSSProxyClient +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include +-I/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML +-I/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty +-I/usr/lib/wx/include/gtk2-unicode-3.0 +-I/usr/include/wx-3.0 +-D__WXGTK__ +-D_FILE_OFFSET_BITS=64 +-DWXUSINGDLL +-DNDEBUG +-D_LINUX_PLATFORM_ diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager.sln b/PssSampleClient/PSS_ClientManager/PSS_ClientManager.sln deleted file mode 100644 index a010407b4..000000000 --- a/PssSampleClient/PSS_ClientManager/PSS_ClientManager.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSS_ClientManager", "PSS_ClientManager\PSS_ClientManager.vcxproj", "{A14EB494-5775-42B8-B99A-D7570633341D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A14EB494-5775-42B8-B99A-D7570633341D}.Debug|Win32.ActiveCfg = Debug|Win32 - {A14EB494-5775-42B8-B99A-D7570633341D}.Debug|Win32.Build.0 = Debug|Win32 - {A14EB494-5775-42B8-B99A-D7570633341D}.Release|Win32.ActiveCfg = Release|Win32 - {A14EB494-5775-42B8-B99A-D7570633341D}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.vcxproj b/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.vcxproj deleted file mode 100644 index 083357c37..000000000 --- a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.vcxproj +++ /dev/null @@ -1,196 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {A14EB494-5775-42B8-B99A-D7570633341D} - PSS_ClientManager - MFCProj - - - - Application - v140 - Dynamic - Unicode - true - - - Application - v140 - Dynamic - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - .\Windows_Bin\ - $(Configuration)\ - true - - - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - - - - _DEBUG;%(PreprocessorDefinitions) - false - true - - - Disabled - ./XML;%(AdditionalIncludeDirectories) - WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Use - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - 0x0409 - $(IntDir);%(AdditionalIncludeDirectories) - - - ws2_32.lib;%(AdditionalDependencies) - true - Windows - MachineX86 - - - - - NDEBUG;%(PreprocessorDefinitions) - false - true - - - MaxSpeed - true - WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions) - false - MultiThreadedDLL - true - Use - Level3 - ProgramDatabase - - - NDEBUG;%(PreprocessorDefinitions) - 0x0409 - $(IntDir);%(AdditionalIncludeDirectories) - - - true - Windows - true - true - MachineX86 - - - - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - - - - \ No newline at end of file diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/PSS_ClientManager - Shortcut.lnk b/PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/PSS_ClientManager - Shortcut.lnk deleted file mode 100644 index f5640a3d0..000000000 Binary files a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/PSS_ClientManager - Shortcut.lnk and /dev/null differ diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/PSS_ClientManager.exe b/PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/PSS_ClientManager.exe deleted file mode 100644 index 8487aea6a..000000000 Binary files a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/Windows_Bin/PSS_ClientManager.exe and /dev/null differ diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinystr.cpp b/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinystr.cpp deleted file mode 100644 index 066576820..000000000 --- a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinystr.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TIXML_USE_STL - -#include "tinystr.h" - -// Error value for find primitive -const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1); - - -// Null rep. -TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } }; - - -void TiXmlString::reserve (size_type cap) -{ - if (cap > capacity()) - { - TiXmlString tmp; - tmp.init(length(), cap); - memcpy(tmp.start(), data(), length()); - swap(tmp); - } -} - - -TiXmlString& TiXmlString::assign(const char* str, size_type len) -{ - size_type cap = capacity(); - if (len > cap || cap > 3*(len + 8)) - { - TiXmlString tmp; - tmp.init(len); - memcpy(tmp.start(), str, len); - swap(tmp); - } - else - { - memmove(start(), str, len); - set_size(len); - } - return *this; -} - - -TiXmlString& TiXmlString::append(const char* str, size_type len) -{ - size_type newsize = length() + len; - if (newsize > capacity()) - { - reserve (newsize + capacity()); - } - memmove(finish(), str, len); - set_size(newsize); - return *this; -} - - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) -{ - TiXmlString tmp; - tmp.reserve(a.length() + b.length()); - tmp += a; - tmp += b; - return tmp; -} - -TiXmlString operator + (const TiXmlString & a, const char* b) -{ - TiXmlString tmp; - TiXmlString::size_type b_len = static_cast( strlen(b) ); - tmp.reserve(a.length() + b_len); - tmp += a; - tmp.append(b, b_len); - return tmp; -} - -TiXmlString operator + (const char* a, const TiXmlString & b) -{ - TiXmlString tmp; - TiXmlString::size_type a_len = static_cast( strlen(a) ); - tmp.reserve(a_len + b.length()); - tmp.append(a, a_len); - tmp += b; - return tmp; -} - - -#endif // TIXML_USE_STL diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinystr.h b/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinystr.h deleted file mode 100644 index 89cca3341..000000000 --- a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinystr.h +++ /dev/null @@ -1,305 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TIXML_USE_STL - -#ifndef TIXML_STRING_INCLUDED -#define TIXML_STRING_INCLUDED - -#include -#include - -/* The support for explicit isn't that universal, and it isn't really - required - it is used to check that the TiXmlString class isn't incorrectly - used. Be nice to old compilers and macro it here: -*/ -#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - #define TIXML_EXPLICIT explicit -#elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - #define TIXML_EXPLICIT explicit -#else - #define TIXML_EXPLICIT -#endif - - -/* - TiXmlString is an emulation of a subset of the std::string template. - Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. - Only the member functions relevant to the TinyXML project have been implemented. - The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase - a string and there's no more room, we allocate a buffer twice as big as we need. -*/ -class TiXmlString -{ - public : - // The size type used - typedef size_t size_type; - - // Error value for find primitive - static const size_type npos; // = -1; - - - // TiXmlString empty constructor - TiXmlString () : rep_(&nullrep_) - { - } - - // TiXmlString copy constructor - TiXmlString ( const TiXmlString & copy) : rep_(0) - { - init(copy.length()); - memcpy(start(), copy.data(), length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) - { - init( static_cast( strlen(copy) )); - memcpy(start(), copy, length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) - { - init(len); - memcpy(start(), str, len); - } - - // TiXmlString destructor - ~TiXmlString () - { - quit(); - } - - TiXmlString& operator = (const char * copy) - { - return assign( copy, (size_type)strlen(copy)); - } - - TiXmlString& operator = (const TiXmlString & copy) - { - return assign(copy.start(), copy.length()); - } - - - // += operator. Maps to append - TiXmlString& operator += (const char * suffix) - { - return append(suffix, static_cast( strlen(suffix) )); - } - - // += operator. Maps to append - TiXmlString& operator += (char single) - { - return append(&single, 1); - } - - // += operator. Maps to append - TiXmlString& operator += (const TiXmlString & suffix) - { - return append(suffix.data(), suffix.length()); - } - - - // Convert a TiXmlString into a null-terminated char * - const char * c_str () const { return rep_->str; } - - // Convert a TiXmlString into a char * (need not be null terminated). - const char * data () const { return rep_->str; } - - // Return the length of a TiXmlString - size_type length () const { return rep_->size; } - - // Alias for length() - size_type size () const { return rep_->size; } - - // Checks if a TiXmlString is empty - bool empty () const { return rep_->size == 0; } - - // Return capacity of string - size_type capacity () const { return rep_->capacity; } - - - // single char extraction - const char& at (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // [] operator - char& operator [] (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // find a char in a string. Return TiXmlString::npos if not found - size_type find (char lookup) const - { - return find(lookup, 0); - } - - // find a char in a string from an offset. Return TiXmlString::npos if not found - size_type find (char tofind, size_type offset) const - { - if (offset >= length()) return npos; - - for (const char* p = c_str() + offset; *p != '\0'; ++p) - { - if (*p == tofind) return static_cast< size_type >( p - c_str() ); - } - return npos; - } - - void clear () - { - //Lee: - //The original was just too strange, though correct: - // TiXmlString().swap(*this); - //Instead use the quit & re-init: - quit(); - init(0,0); - } - - /* Function to reserve a big amount of data when we know we'll need it. Be aware that this - function DOES NOT clear the content of the TiXmlString if any exists. - */ - void reserve (size_type cap); - - TiXmlString& assign (const char* str, size_type len); - - TiXmlString& append (const char* str, size_type len); - - void swap (TiXmlString& other) - { - Rep* r = rep_; - rep_ = other.rep_; - other.rep_ = r; - } - - private: - - void init(size_type sz) { init(sz, sz); } - void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } - char* start() const { return rep_->str; } - char* finish() const { return rep_->str + rep_->size; } - - struct Rep - { - size_type size, capacity; - char str[1]; - }; - - void init(size_type sz, size_type cap) - { - if (cap) - { - // Lee: the original form: - // rep_ = static_cast(operator new(sizeof(Rep) + cap)); - // doesn't work in some cases of new being overloaded. Switching - // to the normal allocation, although use an 'int' for systems - // that are overly picky about structure alignment. - const size_type bytesNeeded = sizeof(Rep) + cap; - const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); - rep_ = reinterpret_cast( new int[ intsNeeded ] ); - - rep_->str[ rep_->size = sz ] = '\0'; - rep_->capacity = cap; - } - else - { - rep_ = &nullrep_; - } - } - - void quit() - { - if (rep_ != &nullrep_) - { - // The rep_ is really an array of ints. (see the allocator, above). - // Cast it back before delete, so the compiler won't incorrectly call destructors. - delete [] ( reinterpret_cast( rep_ ) ); - } - } - - Rep * rep_; - static Rep nullrep_; - -} ; - - -inline bool operator == (const TiXmlString & a, const TiXmlString & b) -{ - return ( a.length() == b.length() ) // optimization on some platforms - && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare -} -inline bool operator < (const TiXmlString & a, const TiXmlString & b) -{ - return strcmp(a.c_str(), b.c_str()) < 0; -} - -inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } -inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } -inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } -inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } - -inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } -inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } -inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } -inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); -TiXmlString operator + (const TiXmlString & a, const char* b); -TiXmlString operator + (const char* a, const TiXmlString & b); - - -/* - TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. - Only the operators that we need for TinyXML have been developped. -*/ -class TiXmlOutStream : public TiXmlString -{ -public : - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const TiXmlString & in) - { - *this += in; - return *this; - } - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const char * in) - { - *this += in; - return *this; - } - -} ; - -#endif // TIXML_STRING_INCLUDED -#endif // TIXML_USE_STL diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.cpp b/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.cpp deleted file mode 100644 index 9c161dfcb..000000000 --- a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.cpp +++ /dev/null @@ -1,1886 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#include - -#ifdef TIXML_USE_STL -#include -#include -#endif - -#include "tinyxml.h" - -FILE* TiXmlFOpen( const char* filename, const char* mode ); - -bool TiXmlBase::condenseWhiteSpace = true; - -// Microsoft compiler security -FILE* TiXmlFOpen( const char* filename, const char* mode ) -{ - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - FILE* fp = 0; - errno_t err = fopen_s( &fp, filename, mode ); - if ( !err && fp ) - return fp; - return 0; - #else - return fopen( filename, mode ); - #endif -} - -void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) -{ - int i=0; - - while( i<(int)str.length() ) - { - unsigned char c = (unsigned char) str[i]; - - if ( c == '&' - && i < ( (int)str.length() - 2 ) - && str[i+1] == '#' - && str[i+2] == 'x' ) - { - // Hexadecimal character reference. - // Pass through unchanged. - // © -- copyright symbol, for example. - // - // The -1 is a bug fix from Rob Laveaux. It keeps - // an overflow from happening if there is no ';'. - // There are actually 2 ways to exit this loop - - // while fails (error case) and break (semicolon found). - // However, there is no mechanism (currently) for - // this function to return an error. - while ( i<(int)str.length()-1 ) - { - outString->append( str.c_str() + i, 1 ); - ++i; - if ( str[i] == ';' ) - break; - } - } - else if ( c == '&' ) - { - outString->append( entity[0].str, entity[0].strLength ); - ++i; - } - else if ( c == '<' ) - { - outString->append( entity[1].str, entity[1].strLength ); - ++i; - } - else if ( c == '>' ) - { - outString->append( entity[2].str, entity[2].strLength ); - ++i; - } - else if ( c == '\"' ) - { - outString->append( entity[3].str, entity[3].strLength ); - ++i; - } - else if ( c == '\'' ) - { - outString->append( entity[4].str, entity[4].strLength ); - ++i; - } - else if ( c < 32 ) - { - // Easy pass at non-alpha/numeric/symbol - // Below 32 is symbolic. - char buf[ 32 ]; - - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); - #else - sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); - #endif - - //*ME: warning C4267: convert 'size_t' to 'int' - //*ME: Int-Cast to make compiler happy ... - outString->append( buf, (int)strlen( buf ) ); - ++i; - } - else - { - //char realc = (char) c; - //outString->append( &realc, 1 ); - *outString += (char) c; // somewhat more efficient function call. - ++i; - } - } -} - - -TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() -{ - parent = 0; - type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; -} - - -TiXmlNode::~TiXmlNode() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } -} - - -void TiXmlNode::CopyTo( TiXmlNode* target ) const -{ - target->SetValue (value.c_str() ); - target->userData = userData; - target->location = location; -} - - -void TiXmlNode::Clear() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } - - firstChild = 0; - lastChild = 0; -} - - -TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) -{ - assert( node->parent == 0 || node->parent == this ); - assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); - - if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - delete node; - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - node->parent = this; - - node->prev = lastChild; - node->next = 0; - - if ( lastChild ) - lastChild->next = node; - else - firstChild = node; // it was an empty list. - - lastChild = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) -{ - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - - return LinkEndChild( node ); -} - - -TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) -{ - if ( !beforeThis || beforeThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->next = beforeThis; - node->prev = beforeThis->prev; - if ( beforeThis->prev ) - { - beforeThis->prev->next = node; - } - else - { - assert( firstChild == beforeThis ); - firstChild = node; - } - beforeThis->prev = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) -{ - if ( !afterThis || afterThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->prev = afterThis; - node->next = afterThis->next; - if ( afterThis->next ) - { - afterThis->next->prev = node; - } - else - { - assert( lastChild == afterThis ); - lastChild = node; - } - afterThis->next = node; - return node; -} - - -TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) -{ - if ( !replaceThis ) - return 0; - - if ( replaceThis->parent != this ) - return 0; - - if ( withThis.ToDocument() ) { - // A document can never be a child. Thanks to Noam. - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = withThis.Clone(); - if ( !node ) - return 0; - - node->next = replaceThis->next; - node->prev = replaceThis->prev; - - if ( replaceThis->next ) - replaceThis->next->prev = node; - else - lastChild = node; - - if ( replaceThis->prev ) - replaceThis->prev->next = node; - else - firstChild = node; - - delete replaceThis; - node->parent = this; - return node; -} - - -bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) -{ - if ( !removeThis ) { - return false; - } - - if ( removeThis->parent != this ) - { - assert( 0 ); - return false; - } - - if ( removeThis->next ) - removeThis->next->prev = removeThis->prev; - else - lastChild = removeThis->prev; - - if ( removeThis->prev ) - removeThis->prev->next = removeThis->next; - else - firstChild = removeThis->next; - - delete removeThis; - return true; -} - -const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = firstChild; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = lastChild; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild(); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling(); - } -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild( val ); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling( val ); - } -} - - -const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = next; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = prev; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -void TiXmlElement::RemoveAttribute( const char * name ) -{ - #ifdef TIXML_USE_STL - TIXML_STRING str( name ); - TiXmlAttribute* node = attributeSet.Find( str ); - #else - TiXmlAttribute* node = attributeSet.Find( name ); - #endif - if ( node ) - { - attributeSet.Remove( node ); - delete node; - } -} - -const TiXmlElement* TiXmlNode::FirstChildElement() const -{ - const TiXmlNode* node; - - for ( node = FirstChild(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = FirstChild( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement() const -{ - const TiXmlNode* node; - - for ( node = NextSibling(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = NextSibling( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlDocument* TiXmlNode::GetDocument() const -{ - const TiXmlNode* node; - - for( node = this; node; node = node->parent ) - { - if ( node->ToDocument() ) - return node->ToDocument(); - } - return 0; -} - - -TiXmlElement::TiXmlElement (const char * _value) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} - - -#ifdef TIXML_USE_STL -TiXmlElement::TiXmlElement( const std::string& _value ) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} -#endif - - -TiXmlElement::TiXmlElement( const TiXmlElement& copy) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - copy.CopyTo( this ); -} - - -TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base ) -{ - ClearThis(); - base.CopyTo( this ); - return *this; -} - - -TiXmlElement::~TiXmlElement() -{ - ClearThis(); -} - - -void TiXmlElement::ClearThis() -{ - Clear(); - while( attributeSet.First() ) - { - TiXmlAttribute* node = attributeSet.First(); - attributeSet.Remove( node ); - delete node; - } -} - - -const char* TiXmlElement::Attribute( const char* name ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( node ) - return node->Value(); - return 0; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( attrib ) - return &attrib->ValueStr(); - return 0; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) { - result = attrib->Value(); - if ( i ) { - attrib->QueryIntValue( i ); - } - } - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) { - result = &attrib->ValueStr(); - if ( i ) { - attrib->QueryIntValue( i ); - } - } - return result; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) { - result = attrib->Value(); - if ( d ) { - attrib->QueryDoubleValue( d ); - } - } - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) { - result = &attrib->ValueStr(); - if ( d ) { - attrib->QueryDoubleValue( d ); - } - } - return result; -} -#endif - - -int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryIntValue( ival ); -} - - -int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - int ival = 0; - int result = node->QueryIntValue( &ival ); - *value = (unsigned)ival; - return result; -} - - -int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - int result = TIXML_WRONG_TYPE; - if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = true; - result = TIXML_SUCCESS; - } - else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = false; - result = TIXML_SUCCESS; - } - return result; -} - - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryIntValue( ival ); -} -#endif - - -int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryDoubleValue( dval ); -} - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryDoubleValue( dval ); -} -#endif - - -void TiXmlElement::SetAttribute( const char * name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetIntValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetIntValue( val ); - } -} -#endif - - -void TiXmlElement::SetDoubleAttribute( const char * name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetDoubleValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetDoubleValue( val ); - } -} -#endif - - -void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); - if ( attrib ) { - attrib->SetValue( cvalue ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name ); - if ( attrib ) { - attrib->SetValue( _value ); - } -} -#endif - - -void TiXmlElement::Print( FILE* cfile, int depth ) const -{ - int i; - assert( cfile ); - for ( i=0; iNext() ) - { - fprintf( cfile, " " ); - attrib->Print( cfile, depth ); - } - - // There are 3 different formatting approaches: - // 1) An element without children is printed as a node - // 2) An element with only a text child is printed as text - // 3) An element with children is printed on multiple lines. - TiXmlNode* node; - if ( !firstChild ) - { - fprintf( cfile, " />" ); - } - else if ( firstChild == lastChild && firstChild->ToText() ) - { - fprintf( cfile, ">" ); - firstChild->Print( cfile, depth + 1 ); - fprintf( cfile, "", value.c_str() ); - } - else - { - fprintf( cfile, ">" ); - - for ( node = firstChild; node; node=node->NextSibling() ) - { - if ( !node->ToText() ) - { - fprintf( cfile, "\n" ); - } - node->Print( cfile, depth+1 ); - } - fprintf( cfile, "\n" ); - for( i=0; i", value.c_str() ); - } -} - - -void TiXmlElement::CopyTo( TiXmlElement* target ) const -{ - // superclass: - TiXmlNode::CopyTo( target ); - - // Element class: - // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; - for( attribute = attributeSet.First(); - attribute; - attribute = attribute->Next() ) - { - target->SetAttribute( attribute->Name(), attribute->Value() ); - } - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - -bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this, attributeSet.First() ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -TiXmlNode* TiXmlElement::Clone() const -{ - TiXmlElement* clone = new TiXmlElement( Value() ); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -const char* TiXmlElement::GetText() const -{ - const TiXmlNode* child = this->FirstChild(); - if ( child ) { - const TiXmlText* childText = child->ToText(); - if ( childText ) { - return childText->Value(); - } - } - return 0; -} - - -TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - ClearError(); -} - -TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} - - -#ifdef TIXML_USE_STL -TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} -#endif - - -TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) -{ - return LoadFile( Value(), encoding ); -} - - -bool TiXmlDocument::SaveFile() const -{ - return SaveFile( Value() ); -} - -bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) -{ - TIXML_STRING filename( _filename ); - value = filename; - - // reading in binary mode so that tinyxml can normalize the EOL - FILE* file = TiXmlFOpen( value.c_str (), "rb" ); - - if ( file ) - { - bool result = LoadFile( file, encoding ); - fclose( file ); - return result; - } - else - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } -} - -bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) -{ - if ( !file ) - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Delete the existing data: - Clear(); - location.Clear(); - - // Get the file size, so we can pre-allocate the string. HUGE speed impact. - long length = 0; - fseek( file, 0, SEEK_END ); - length = ftell( file ); - fseek( file, 0, SEEK_SET ); - - // Strange case, but good to handle up front. - if ( length <= 0 ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Subtle bug here. TinyXml did use fgets. But from the XML spec: - // 2.11 End-of-Line Handling - // - // - // ...the XML processor MUST behave as if it normalized all line breaks in external - // parsed entities (including the document entity) on input, before parsing, by translating - // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to - // a single #xA character. - // - // - // It is not clear fgets does that, and certainly isn't clear it works cross platform. - // Generally, you expect fgets to translate from the convention of the OS to the c/unix - // convention, and not work generally. - - /* - while( fgets( buf, sizeof(buf), file ) ) - { - data += buf; - } - */ - - char* buf = new char[ length+1 ]; - buf[0] = 0; - - if ( fread( buf, length, 1, file ) != 1 ) { - delete [] buf; - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Process the buffer in place to normalize new lines. (See comment above.) - // Copies from the 'p' to 'q' pointer, where p can advance faster if - // a newline-carriage return is hit. - // - // Wikipedia: - // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or - // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... - // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others - // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS - // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 - - const char* p = buf; // the read head - char* q = buf; // the write head - const char CR = 0x0d; - const char LF = 0x0a; - - buf[length] = 0; - while( *p ) { - assert( p < (buf+length) ); - assert( q <= (buf+length) ); - assert( q <= p ); - - if ( *p == CR ) { - *q++ = LF; - p++; - if ( *p == LF ) { // check for CR+LF (and skip LF) - p++; - } - } - else { - *q++ = *p++; - } - } - assert( q <= (buf+length) ); - *q = 0; - - Parse( buf, 0, encoding ); - - delete [] buf; - return !Error(); -} - - -bool TiXmlDocument::SaveFile( const char * filename ) const -{ - // The old c stuff lives on... - FILE* fp = TiXmlFOpen( filename, "w" ); - if ( fp ) - { - bool result = SaveFile( fp ); - fclose( fp ); - return result; - } - return false; -} - - -bool TiXmlDocument::SaveFile( FILE* fp ) const -{ - if ( useMicrosoftBOM ) - { - const unsigned char TIXML_UTF_LEAD_0 = 0xefU; - const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; - const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - - fputc( TIXML_UTF_LEAD_0, fp ); - fputc( TIXML_UTF_LEAD_1, fp ); - fputc( TIXML_UTF_LEAD_2, fp ); - } - Print( fp, 0 ); - return (ferror(fp) == 0); -} - - -void TiXmlDocument::CopyTo( TiXmlDocument* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->error = error; - target->errorId = errorId; - target->errorDesc = errorDesc; - target->tabsize = tabsize; - target->errorLocation = errorLocation; - target->useMicrosoftBOM = useMicrosoftBOM; - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - - -TiXmlNode* TiXmlDocument::Clone() const -{ - TiXmlDocument* clone = new TiXmlDocument(); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlDocument::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - node->Print( cfile, depth ); - fprintf( cfile, "\n" ); - } -} - - -bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -const TiXmlAttribute* TiXmlAttribute::Next() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} - -/* -TiXmlAttribute* TiXmlAttribute::Next() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} -*/ - -const TiXmlAttribute* TiXmlAttribute::Previous() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} - -/* -TiXmlAttribute* TiXmlAttribute::Previous() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} -*/ - -void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - TIXML_STRING n, v; - - EncodeString( name, &n ); - EncodeString( value, &v ); - - if (value.find ('\"') == TIXML_STRING::npos) { - if ( cfile ) { - fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\""; - } - } - else { - if ( cfile ) { - fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'"; - } - } -} - - -int TiXmlAttribute::QueryIntValue( int* ival ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -int TiXmlAttribute::QueryDoubleValue( double* dval ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -void TiXmlAttribute::SetIntValue( int _value ) -{ - char buf [64]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); - #else - sprintf (buf, "%d", _value); - #endif - SetValue (buf); -} - -void TiXmlAttribute::SetDoubleValue( double _value ) -{ - char buf [256]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); - #else - sprintf (buf, "%g", _value); - #endif - SetValue (buf); -} - -int TiXmlAttribute::IntValue() const -{ - return atoi (value.c_str ()); -} - -double TiXmlAttribute::DoubleValue() const -{ - return atof (value.c_str ()); -} - - -TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base ) -{ - Clear(); - base.CopyTo( this ); - return *this; -} - - -void TiXmlComment::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlComment::CopyTo( TiXmlComment* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlComment::Clone() const -{ - TiXmlComment* clone = new TiXmlComment(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlText::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - if ( cdata ) - { - int i; - fprintf( cfile, "\n" ); - for ( i=0; i\n", value.c_str() ); // unformatted output - } - else - { - TIXML_STRING buffer; - EncodeString( value, &buffer ); - fprintf( cfile, "%s", buffer.c_str() ); - } -} - - -void TiXmlText::CopyTo( TiXmlText* target ) const -{ - TiXmlNode::CopyTo( target ); - target->cdata = cdata; -} - - -bool TiXmlText::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlText::Clone() const -{ - TiXmlText* clone = 0; - clone = new TiXmlText( "" ); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlDeclaration::TiXmlDeclaration( const char * _version, - const char * _encoding, - const char * _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} - - -#ifdef TIXML_USE_STL -TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} -#endif - - -TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - copy.CopyTo( this ); -} - - -TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - if ( cfile ) fprintf( cfile, "" ); - if ( str ) (*str) += "?>"; -} - - -void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->version = version; - target->encoding = encoding; - target->standalone = standalone; -} - - -bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlDeclaration::Clone() const -{ - TiXmlDeclaration* clone = new TiXmlDeclaration(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlUnknown::Print( FILE* cfile, int depth ) const -{ - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlUnknown::Clone() const -{ - TiXmlUnknown* clone = new TiXmlUnknown(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlAttributeSet::TiXmlAttributeSet() -{ - sentinel.next = &sentinel; - sentinel.prev = &sentinel; -} - - -TiXmlAttributeSet::~TiXmlAttributeSet() -{ - assert( sentinel.next == &sentinel ); - assert( sentinel.prev == &sentinel ); -} - - -void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) -{ - #ifdef TIXML_USE_STL - assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. - #else - assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. - #endif - - addMe->next = &sentinel; - addMe->prev = sentinel.prev; - - sentinel.prev->next = addMe; - sentinel.prev = addMe; -} - -void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) -{ - TiXmlAttribute* node; - - for( node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node == removeMe ) - { - node->prev->next = node->next; - node->next->prev = node->prev; - node->next = 0; - node->prev = 0; - return; - } - } - assert( 0 ); // we tried to remove a non-linked attribute. -} - - -#ifdef TIXML_USE_STL -TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node->name == name ) - return node; - } - return 0; -} - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - if ( !attrib ) { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - return attrib; -} -#endif - - -TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( strcmp( node->name.c_str(), name ) == 0 ) - return node; - } - return 0; -} - - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - if ( !attrib ) { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - return attrib; -} - - -#ifdef TIXML_USE_STL -std::istream& operator>> (std::istream & in, TiXmlNode & base) -{ - TIXML_STRING tag; - tag.reserve( 8 * 1000 ); - base.StreamIn( &in, &tag ); - - base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); - return in; -} -#endif - - -#ifdef TIXML_USE_STL -std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out << printer.Str(); - - return out; -} - - -std::string& operator<< (std::string& out, const TiXmlNode& base ) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out.append( printer.Str() ); - - return out; -} -#endif - - -TiXmlHandle TiXmlHandle::FirstChild() const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild( value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement() const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement( value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild(); - for ( i=0; - child && iNextSibling(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild( value ); - for ( i=0; - child && iNextSibling( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement(); - for ( i=0; - child && iNextSiblingElement(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement( value ); - for ( i=0; - child && iNextSiblingElement( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) -{ - DoIndent(); - buffer += "<"; - buffer += element.Value(); - - for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) - { - buffer += " "; - attrib->Print( 0, 0, &buffer ); - } - - if ( !element.FirstChild() ) - { - buffer += " />"; - DoLineBreak(); - } - else - { - buffer += ">"; - if ( element.FirstChild()->ToText() - && element.LastChild() == element.FirstChild() - && element.FirstChild()->ToText()->CDATA() == false ) - { - simpleTextPrint = true; - // no DoLineBreak()! - } - else - { - DoLineBreak(); - } - } - ++depth; - return true; -} - - -bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) -{ - --depth; - if ( !element.FirstChild() ) - { - // nothing. - } - else - { - if ( simpleTextPrint ) - { - simpleTextPrint = false; - } - else - { - DoIndent(); - } - buffer += ""; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlText& text ) -{ - if ( text.CDATA() ) - { - DoIndent(); - buffer += ""; - DoLineBreak(); - } - else if ( simpleTextPrint ) - { - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - } - else - { - DoIndent(); - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) -{ - DoIndent(); - declaration.Print( 0, 0, &buffer ); - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlComment& comment ) -{ - DoIndent(); - buffer += ""; - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) -{ - DoIndent(); - buffer += "<"; - buffer += unknown.Value(); - buffer += ">"; - DoLineBreak(); - return true; -} - diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.h b/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.h deleted file mode 100644 index a3589e5b2..000000000 --- a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.h +++ /dev/null @@ -1,1805 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TINYXML_INCLUDED -#define TINYXML_INCLUDED - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4530 ) -#pragma warning( disable : 4786 ) -#endif - -#include -#include -#include -#include -#include - -// Help out windows: -#if defined( _DEBUG ) && !defined( DEBUG ) -#define DEBUG -#endif - -#ifdef TIXML_USE_STL - #include - #include - #include - #define TIXML_STRING std::string -#else - #include "tinystr.h" - #define TIXML_STRING TiXmlString -#endif - -// Deprecated library function hell. Compilers want to use the -// new safe versions. This probably doesn't fully address the problem, -// but it gets closer. There are too many compilers for me to fully -// test. If you get compilation troubles, undefine TIXML_SAFE -#define TIXML_SAFE - -#ifdef TIXML_SAFE - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - // Microsoft visual studio, version 2005 and higher. - #define TIXML_SNPRINTF _snprintf_s - #define TIXML_SSCANF sscanf_s - #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - //#pragma message( "Using _sn* functions." ) - #define TIXML_SNPRINTF _snprintf - #define TIXML_SSCANF sscanf - #elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #else - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #endif -#endif - -class TiXmlDocument; -class TiXmlElement; -class TiXmlComment; -class TiXmlUnknown; -class TiXmlAttribute; -class TiXmlText; -class TiXmlDeclaration; -class TiXmlParsingData; - -const int TIXML_MAJOR_VERSION = 2; -const int TIXML_MINOR_VERSION = 6; -const int TIXML_PATCH_VERSION = 2; - -/* Internal structure for tracking location of items - in the XML file. -*/ -struct TiXmlCursor -{ - TiXmlCursor() { Clear(); } - void Clear() { row = col = -1; } - - int row; // 0 based. - int col; // 0 based. -}; - - -/** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a TiXmlVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves - are simply called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its sibilings will be Visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. - - You should never change the document from a callback. - - @sa TiXmlNode::Accept() -*/ -class TiXmlVisitor -{ -public: - virtual ~TiXmlVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } - /// Visit a document. - virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } - - /// Visit an element. - virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } - /// Visit an element. - virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } - - /// Visit a declaration - virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } - /// Visit a text node - virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } - /// Visit a comment node - virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } - /// Visit an unknown node - virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } -}; - -// Only used by Attribute::Query functions -enum -{ - TIXML_SUCCESS, - TIXML_NO_ATTRIBUTE, - TIXML_WRONG_TYPE -}; - - -// Used by the parsing routines. -enum TiXmlEncoding -{ - TIXML_ENCODING_UNKNOWN, - TIXML_ENCODING_UTF8, - TIXML_ENCODING_LEGACY -}; - -const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; - -/** TiXmlBase is a base class for every class in TinyXml. - It does little except to establish that TinyXml classes - can be printed and provide some utility functions. - - In XML, the document and elements can contain - other elements and other types of nodes. - - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) - - A Decleration contains: Attributes (not on tree) - @endverbatim -*/ -class TiXmlBase -{ - friend class TiXmlNode; - friend class TiXmlElement; - friend class TiXmlDocument; - -public: - TiXmlBase() : userData(0) {} - virtual ~TiXmlBase() {} - - /** All TinyXml classes can print themselves to a filestream - or the string class (TiXmlString in non-STL mode, std::string - in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert - tabs and newlines. - - (For an unformatted stream, use the << operator.) - */ - virtual void Print( FILE* cfile, int depth ) const = 0; - - /** The world does not agree on whether white space should be kept or - not. In order to make everyone happy, these global, static functions - are provided to set whether or not TinyXml will condense all white space - into a single space or not. The default is to condense. Note changing this - value is not thread safe. - */ - static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } - - /// Return the current white space setting. - static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } - - /** Return the position, in the original source file, of this node or attribute. - The row and column are 1-based. (That is the first row and first column is - 1,1). If the returns values are 0 or less, then the parser does not have - a row and column value. - - Generally, the row and column value will be set when the TiXmlDocument::Load(), - TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set - when the DOM was created from operator>>. - - The values reflect the initial load. Once the DOM is modified programmatically - (by adding or changing nodes and attributes) the new values will NOT update to - reflect changes in the document. - - There is a minor performance cost to computing the row and column. Computation - can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. - - @sa TiXmlDocument::SetTabSize() - */ - int Row() const { return location.row + 1; } - int Column() const { return location.col + 1; } ///< See Row() - - void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. - void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. - const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. - - // Table that returs, for a given lead byte, the total number of bytes - // in the UTF-8 sequence. - static const int utf8ByteTable[256]; - - virtual const char* Parse( const char* p, - TiXmlParsingData* data, - TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; - - /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, - or they will be transformed into entities! - */ - static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); - - enum - { - TIXML_NO_ERROR = 0, - TIXML_ERROR, - TIXML_ERROR_OPENING_FILE, - TIXML_ERROR_PARSING_ELEMENT, - TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, - TIXML_ERROR_READING_ELEMENT_VALUE, - TIXML_ERROR_READING_ATTRIBUTES, - TIXML_ERROR_PARSING_EMPTY, - TIXML_ERROR_READING_END_TAG, - TIXML_ERROR_PARSING_UNKNOWN, - TIXML_ERROR_PARSING_COMMENT, - TIXML_ERROR_PARSING_DECLARATION, - TIXML_ERROR_DOCUMENT_EMPTY, - TIXML_ERROR_EMBEDDED_NULL, - TIXML_ERROR_PARSING_CDATA, - TIXML_ERROR_DOCUMENT_TOP_ONLY, - - TIXML_ERROR_STRING_COUNT - }; - -protected: - - static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); - } - inline static bool IsWhiteSpace( int c ) - { - if ( c < 256 ) - return IsWhiteSpace( (char) c ); - return false; // Again, only truly correct for English/Latin...but usually works. - } - - #ifdef TIXML_USE_STL - static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); - static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); - #endif - - /* Reads an XML name into the string provided. Returns - a pointer just past the last character of the name, - or 0 if the function has an error. - */ - static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); - - /* Reads text. Returns a pointer past the given end tag. - Wickedly complex options, but it keeps the (sensitive) code in one place. - */ - static const char* ReadText( const char* in, // where to start - TIXML_STRING* text, // the string read - bool ignoreWhiteSpace, // whether to keep the white space - const char* endTag, // what ends this text - bool ignoreCase, // whether to ignore case in the end tag - TiXmlEncoding encoding ); // the current encoding - - // If an entity has been found, transform it into a character. - static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); - - // Get a character, while interpreting entities. - // The length can be from 0 to 4 bytes. - inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) - { - assert( p ); - if ( encoding == TIXML_ENCODING_UTF8 ) - { - *length = utf8ByteTable[ *((const unsigned char*)p) ]; - assert( *length >= 0 && *length < 5 ); - } - else - { - *length = 1; - } - - if ( *length == 1 ) - { - if ( *p == '&' ) - return GetEntity( p, _value, length, encoding ); - *_value = *p; - return p+1; - } - else if ( *length ) - { - //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), - // and the null terminator isn't needed - for( int i=0; p[i] && i<*length; ++i ) { - _value[i] = p[i]; - } - return p + (*length); - } - else - { - // Not valid text. - return 0; - } - } - - // Return true if the next characters in the stream are any of the endTag sequences. - // Ignore case only works for english, and should only be relied on when comparing - // to English words: StringEqual( p, "version", true ) is fine. - static bool StringEqual( const char* p, - const char* endTag, - bool ignoreCase, - TiXmlEncoding encoding ); - - static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; - - TiXmlCursor location; - - /// Field containing a generic user pointer - void* userData; - - // None of these methods are reliable for any language except English. - // Good for approximation, not great for accuracy. - static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); - static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); - inline static int ToLower( int v, TiXmlEncoding encoding ) - { - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( v < 128 ) return tolower( v ); - return v; - } - else - { - return tolower( v ); - } - } - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); - -private: - TiXmlBase( const TiXmlBase& ); // not implemented. - void operator=( const TiXmlBase& base ); // not allowed. - - struct Entity - { - const char* str; - unsigned int strLength; - char chr; - }; - enum - { - NUM_ENTITY = 5, - MAX_ENTITY_LENGTH = 6 - - }; - static Entity entity[ NUM_ENTITY ]; - static bool condenseWhiteSpace; -}; - - -/** The parent class for everything in the Document Object Model. - (Except for attributes). - Nodes have siblings, a parent, and children. A node can be - in a document, or stand on its own. The type of a TiXmlNode - can be queried, and it can be cast to its more defined type. -*/ -class TiXmlNode : public TiXmlBase -{ - friend class TiXmlDocument; - friend class TiXmlElement; - -public: - #ifdef TIXML_USE_STL - - /** An input stream operator, for every class. Tolerant of newlines and - formatting, but doesn't expect them. - */ - friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - - /** An output stream operator, for every class. Note that this outputs - without any newlines or formatting, as opposed to Print(), which - includes tabs and new lines. - - The operator<< and operator>> are not completely symmetric. Writing - a node to a stream is very well defined. You'll get a nice stream - of output, without any extra whitespace or newlines. - - But reading is not as well defined. (As it always is.) If you create - a TiXmlElement (for example) and read that from an input stream, - the text needs to define an element or junk will result. This is - true of all input streams, but it's worth keeping in mind. - - A TiXmlDocument will read nodes until it reads a root element, and - all the children of that root element. - */ - friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - - /// Appends the XML node or attribute to a std::string. - friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - - #endif - - /** The types of XML nodes supported by TinyXml. (All the - unsupported types are picked up by UNKNOWN.) - */ - enum NodeType - { - TINYXML_DOCUMENT, - TINYXML_ELEMENT, - TINYXML_COMMENT, - TINYXML_UNKNOWN, - TINYXML_TEXT, - TINYXML_DECLARATION, - TINYXML_TYPECOUNT - }; - - virtual ~TiXmlNode(); - - /** The meaning of 'value' changes for the specific type of - TiXmlNode. - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - - The subclasses will wrap this function. - */ - const char *Value() const { return value.c_str (); } - - #ifdef TIXML_USE_STL - /** Return Value() as a std::string. If you only use STL, - this is more efficient than calling Value(). - Only available in STL mode. - */ - const std::string& ValueStr() const { return value; } - #endif - - const TIXML_STRING& ValueTStr() const { return value; } - - /** Changes the value of the node. Defined as: - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - void SetValue(const char * _value) { value = _value;} - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Delete all the children of this node. Does not affect 'this'. - void Clear(); - - /// One step up the DOM. - TiXmlNode* Parent() { return parent; } - const TiXmlNode* Parent() const { return parent; } - - const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. - TiXmlNode* FirstChild() { return firstChild; } - const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. - /// The first child of this node with the matching 'value'. Will be null if none found. - TiXmlNode* FirstChild( const char * _value ) { - // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) - // call the method, cast the return back to non-const. - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); - } - const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. - TiXmlNode* LastChild() { return lastChild; } - - const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. - TiXmlNode* LastChild( const char * _value ) { - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. - #endif - - /** An alternate way to walk the children of a node. - One way to iterate over nodes is: - @verbatim - for( child = parent->FirstChild(); child; child = child->NextSibling() ) - @endverbatim - - IterateChildren does the same thing with the syntax: - @verbatim - child = 0; - while( child = parent->IterateChildren( child ) ) - @endverbatim - - IterateChildren takes the previous child as input and finds - the next one. If the previous child is null, it returns the - first. IterateChildren will return null when done. - */ - const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); - } - - /// This flavor of IterateChildren searches for children with a particular 'value' - const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - #endif - - /** Add a new node related to this. Adds a child past the LastChild. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); - - - /** Add a new node related to this. Adds a child past the LastChild. - - NOTE: the node to be added is passed by pointer, and will be - henceforth owned (and deleted) by tinyXml. This method is efficient - and avoids an extra copy, but should be used with care as it - uses a different memory model than the other insert functions. - - @sa InsertEndChild - */ - TiXmlNode* LinkEndChild( TiXmlNode* addThis ); - - /** Add a new node related to this. Adds a child before the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); - - /** Add a new node related to this. Adds a child after the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); - - /** Replace a child of this node. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); - - /// Delete a child of this node. - bool RemoveChild( TiXmlNode* removeThis ); - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling() const { return prev; } - TiXmlNode* PreviousSibling() { return prev; } - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling( const char * ) const; - TiXmlNode* PreviousSibling( const char *_prev ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Navigate to a sibling node. - const TiXmlNode* NextSibling() const { return next; } - TiXmlNode* NextSibling() { return next; } - - /// Navigate to a sibling node with the given 'value'. - const TiXmlNode* NextSibling( const char * ) const; - TiXmlNode* NextSibling( const char* _next ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement() const; - TiXmlElement* NextSiblingElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement( const char * ) const; - TiXmlElement* NextSiblingElement( const char *_next ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement() const; - TiXmlElement* FirstChildElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); - } - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement( const char * _value ) const; - TiXmlElement* FirstChildElement( const char * _value ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /** Query the type (as an enumerated value, above) of this node. - The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, - TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION. - */ - int Type() const { return type; } - - /** Return a pointer to the Document this node lives in. - Returns null if not in a document. - */ - const TiXmlDocument* GetDocument() const; - TiXmlDocument* GetDocument() { - return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); - } - - /// Returns true if this node has no children. - bool NoChildren() const { return !firstChild; } - - virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. - */ - virtual TiXmlNode* Clone() const = 0; - - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the TiXmlVisitor interface. - - This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - TiXmlPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( TiXmlVisitor* visitor ) const = 0; - -protected: - TiXmlNode( NodeType _type ); - - // Copy to the allocated object. Shared functionality between Clone, Copy constructor, - // and the assignment operator. - void CopyTo( TiXmlNode* target ) const; - - #ifdef TIXML_USE_STL - // The real work of the input operator. - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; - #endif - - // Figure out what is at *p, and parse it. Returns null if it is not an xml node. - TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); - - TiXmlNode* parent; - NodeType type; - - TiXmlNode* firstChild; - TiXmlNode* lastChild; - - TIXML_STRING value; - - TiXmlNode* prev; - TiXmlNode* next; - -private: - TiXmlNode( const TiXmlNode& ); // not implemented. - void operator=( const TiXmlNode& base ); // not allowed. -}; - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not TiXmlNodes, since they are not - part of the tinyXML document object model. There are other - suggested ways to look at this problem. -*/ -class TiXmlAttribute : public TiXmlBase -{ - friend class TiXmlAttributeSet; - -public: - /// Construct an empty attribute. - TiXmlAttribute() : TiXmlBase() - { - document = 0; - prev = next = 0; - } - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlAttribute( const std::string& _name, const std::string& _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - #endif - - /// Construct an attribute with a name and value. - TiXmlAttribute( const char * _name, const char * _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - - const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. - const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. - #ifdef TIXML_USE_STL - const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. - #endif - int IntValue() const; ///< Return the value of this attribute, converted to an integer. - double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - - // Get the tinyxml string representation - const TIXML_STRING& NameTStr() const { return name; } - - /** QueryIntValue examines the value string. It is an alternative to the - IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. - - A specialized but useful call. Note that for success it returns 0, - which is the opposite of almost all other TinyXml calls. - */ - int QueryIntValue( int* _value ) const; - /// QueryDoubleValue examines the value string. See QueryIntValue(). - int QueryDoubleValue( double* _value ) const; - - void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. - void SetValue( const char* _value ) { value = _value; } ///< Set the value. - - void SetIntValue( int _value ); ///< Set the value from an integer. - void SetDoubleValue( double _value ); ///< Set the value from a double. - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetName( const std::string& _name ) { name = _name; } - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Get the next sibling attribute in the DOM. Returns null at end. - const TiXmlAttribute* Next() const; - TiXmlAttribute* Next() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); - } - - /// Get the previous sibling attribute in the DOM. Returns null at beginning. - const TiXmlAttribute* Previous() const; - TiXmlAttribute* Previous() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); - } - - bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } - bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } - bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } - - /* Attribute parsing starts: first letter of the name - returns: the next char after the value end quote - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - // Prints this Attribute to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - - // [internal use] - // Set the document pointer so the attribute can report errors. - void SetDocument( TiXmlDocument* doc ) { document = doc; } - -private: - TiXmlAttribute( const TiXmlAttribute& ); // not implemented. - void operator=( const TiXmlAttribute& base ); // not allowed. - - TiXmlDocument* document; // A pointer back to a document, for error reporting. - TIXML_STRING name; - TIXML_STRING value; - TiXmlAttribute* prev; - TiXmlAttribute* next; -}; - - -/* A class used to manage a group of attributes. - It is only used internally, both by the ELEMENT and the DECLARATION. - - The set can be changed transparent to the Element and Declaration - classes that use it, but NOT transparent to the Attribute - which has to implement a next() and previous() method. Which makes - it a bit problematic and prevents the use of STL. - - This version is implemented with circular lists because: - - I like circular lists - - it demonstrates some independence from the (typical) doubly linked list. -*/ -class TiXmlAttributeSet -{ -public: - TiXmlAttributeSet(); - ~TiXmlAttributeSet(); - - void Add( TiXmlAttribute* attribute ); - void Remove( TiXmlAttribute* attribute ); - - const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - - TiXmlAttribute* Find( const char* _name ) const; - TiXmlAttribute* FindOrCreate( const char* _name ); - -# ifdef TIXML_USE_STL - TiXmlAttribute* Find( const std::string& _name ) const; - TiXmlAttribute* FindOrCreate( const std::string& _name ); -# endif - - -private: - //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), - //*ME: this class must be also use a hidden/disabled copy-constructor !!! - TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed - void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) - - TiXmlAttribute sentinel; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TiXmlElement : public TiXmlNode -{ -public: - /// Construct an element. - TiXmlElement (const char * in_value); - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlElement( const std::string& _value ); - #endif - - TiXmlElement( const TiXmlElement& ); - - TiXmlElement& operator=( const TiXmlElement& base ); - - virtual ~TiXmlElement(); - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - */ - const char* Attribute( const char* name ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an integer, - the integer value will be put in the return 'i', if 'i' - is non-null. - */ - const char* Attribute( const char* name, int* i ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an double, - the double value will be put in the return 'd', if 'd' - is non-null. - */ - const char* Attribute( const char* name, double* d ) const; - - /** QueryIntAttribute examines the attribute - it is an alternative to the - Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. If the attribute - does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ - int QueryIntAttribute( const char* name, int* _value ) const; - /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute(). - int QueryUnsignedAttribute( const char* name, unsigned* _value ) const; - /** QueryBoolAttribute examines the attribute - see QueryIntAttribute(). - Note that '1', 'true', or 'yes' are considered true, while '0', 'false' - and 'no' are considered false. - */ - int QueryBoolAttribute( const char* name, bool* _value ) const; - /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). - int QueryDoubleAttribute( const char* name, double* _value ) const; - /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). - int QueryFloatAttribute( const char* name, float* _value ) const { - double d; - int result = QueryDoubleAttribute( name, &d ); - if ( result == TIXML_SUCCESS ) { - *_value = (float)d; - } - return result; - } - - #ifdef TIXML_USE_STL - /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). - int QueryStringAttribute( const char* name, std::string* _value ) const { - const char* cstr = Attribute( name ); - if ( cstr ) { - *_value = std::string( cstr ); - return TIXML_SUCCESS; - } - return TIXML_NO_ATTRIBUTE; - } - - /** Template form of the attribute query which will try to read the - attribute into the specified type. Very easy, very powerful, but - be careful to make sure to call this with the correct type. - - NOTE: This method doesn't work correctly for 'string' types that contain spaces. - - @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE - */ - template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - std::stringstream sstream( node->ValueStr() ); - sstream >> *outValue; - if ( !sstream.fail() ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; - } - - int QueryValueAttribute( const std::string& name, std::string* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - *outValue = node->ValueStr(); - return TIXML_SUCCESS; - } - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, const char * _value ); - - #ifdef TIXML_USE_STL - const std::string* Attribute( const std::string& name ) const; - const std::string* Attribute( const std::string& name, int* i ) const; - const std::string* Attribute( const std::string& name, double* d ) const; - int QueryIntAttribute( const std::string& name, int* _value ) const; - int QueryDoubleAttribute( const std::string& name, double* _value ) const; - - /// STL std::string form. - void SetAttribute( const std::string& name, const std::string& _value ); - ///< STL std::string form. - void SetAttribute( const std::string& name, int _value ); - ///< STL std::string form. - void SetDoubleAttribute( const std::string& name, double value ); - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char * name, int value ); - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetDoubleAttribute( const char * name, double value ); - - /** Deletes an attribute with the given name. - */ - void RemoveAttribute( const char * name ); - #ifdef TIXML_USE_STL - void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. - #endif - - const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. - TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } - const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. - TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the TiXmlText child - and accessing it directly. - - If the first child of 'this' is a TiXmlText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are - safe type casts on the referenced node. - */ - const char* GetText() const; - - /// Creates a new Element and returns it - the returned element is a copy. - virtual TiXmlNode* Clone() const; - // Print the Element to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: next char past '<' - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - - void CopyTo( TiXmlElement* target ) const; - void ClearThis(); // like clear, but initializes 'this' object as well - - // Used to be public [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - /* [internal use] - Reads the "value" of the element -- another element, or text. - This should terminate with the current end tag. - */ - const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - -private: - TiXmlAttributeSet attributeSet; -}; - - -/** An XML comment. -*/ -class TiXmlComment : public TiXmlNode -{ -public: - /// Constructs an empty comment. - TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} - /// Construct a comment from text. - TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { - SetValue( _value ); - } - TiXmlComment( const TiXmlComment& ); - TiXmlComment& operator=( const TiXmlComment& base ); - - virtual ~TiXmlComment() {} - - /// Returns a copy of this Comment. - virtual TiXmlNode* Clone() const; - // Write this Comment to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: at the ! of the !-- - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlComment* target ) const; - - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif -// virtual void StreamOut( TIXML_OSTREAM * out ) const; - -private: - -}; - - -/** XML text. A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCDATA() and query it with CDATA(). -*/ -class TiXmlText : public TiXmlNode -{ - friend class TiXmlElement; -public: - /** Constructor for text element. By default, it is treated as - normal, encoded text. If you want it be output as a CDATA text - element, set the parameter _cdata to 'true' - */ - TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - virtual ~TiXmlText() {} - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - #endif - - TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } - TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; } - - // Write this text object to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /// Queries whether this represents text using a CDATA section. - bool CDATA() const { return cdata; } - /// Turns on or off a CDATA representation of text. - void SetCDATA( bool _cdata ) { cdata = _cdata; } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - /// [internal use] Creates a new Element and returns it. - virtual TiXmlNode* Clone() const; - void CopyTo( TiXmlText* target ) const; - - bool Blank() const; // returns true if all white space and new lines - // [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - bool cdata; // true if this should be input and output as a CDATA style text element -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXml will happily read or write files without a declaration, - however. There are 3 possible attributes to the declaration: - version, encoding, and standalone. - - Note: In this version of the code, the attributes are - handled as special cases, not generic attributes, simply - because there can only be at most 3 and they are always the same. -*/ -class TiXmlDeclaration : public TiXmlNode -{ -public: - /// Construct an empty declaration. - TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ); -#endif - - /// Construct. - TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ); - - TiXmlDeclaration( const TiXmlDeclaration& copy ); - TiXmlDeclaration& operator=( const TiXmlDeclaration& copy ); - - virtual ~TiXmlDeclaration() {} - - /// Version. Will return an empty string if none was found. - const char *Version() const { return version.c_str (); } - /// Encoding. Will return an empty string if none was found. - const char *Encoding() const { return encoding.c_str (); } - /// Is this a standalone document? - const char *Standalone() const { return standalone.c_str (); } - - /// Creates a copy of this Declaration and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlDeclaration* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - - TIXML_STRING version; - TIXML_STRING encoding; - TIXML_STRING standalone; -}; - - -/** Any tag that tinyXml doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into TiXmlUnknowns. -*/ -class TiXmlUnknown : public TiXmlNode -{ -public: - TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} - virtual ~TiXmlUnknown() {} - - TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } - TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; } - - /// Creates a copy of this Unknown and returns it. - virtual TiXmlNode* Clone() const; - // Print this Unknown to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected: - void CopyTo( TiXmlUnknown* target ) const; - - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - -}; - - -/** Always the top level node. A document binds together all the - XML pieces. It can be saved, loaded, and printed to the screen. - The 'value' of a document node is the xml file name. -*/ -class TiXmlDocument : public TiXmlNode -{ -public: - /// Create an empty document, that has no name. - TiXmlDocument(); - /// Create a document with a name. The name of the document is also the filename of the xml. - TiXmlDocument( const char * documentName ); - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDocument( const std::string& documentName ); - #endif - - TiXmlDocument( const TiXmlDocument& copy ); - TiXmlDocument& operator=( const TiXmlDocument& copy ); - - virtual ~TiXmlDocument() {} - - /** Load a file using the current document value. - Returns true if successful. Will delete any existing - document data before loading. - */ - bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the current document value. Returns true if successful. - bool SaveFile() const; - /// Load a file using the given filename. Returns true if successful. - bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given filename. Returns true if successful. - bool SaveFile( const char * filename ) const; - /** Load a file using the given FILE*. Returns true if successful. Note that this method - doesn't stream - the entire object pointed at by the FILE* - will be interpreted as an XML file. TinyXML doesn't stream in XML from the current - file location. Streaming may be added in the future. - */ - bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given FILE*. Returns true if successful. - bool SaveFile( FILE* ) const; - - #ifdef TIXML_USE_STL - bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. - { - return LoadFile( filename.c_str(), encoding ); - } - bool SaveFile( const std::string& filename ) const ///< STL std::string version. - { - return SaveFile( filename.c_str() ); - } - #endif - - /** Parse the given null terminated block of xml data. Passing in an encoding to this - method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml - to use that encoding, regardless of what TinyXml might otherwise try to detect. - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** Get the root element -- the only top level element -- of the document. - In well formed XML, there should only be one. TinyXml is tolerant of - multiple elements at the document level. - */ - const TiXmlElement* RootElement() const { return FirstChildElement(); } - TiXmlElement* RootElement() { return FirstChildElement(); } - - /** If an error occurs, Error will be set to true. Also, - - The ErrorId() will contain the integer identifier of the error (not generally useful) - - The ErrorDesc() method will return the name of the error. (very useful) - - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ - bool Error() const { return error; } - - /// Contains a textual (english) description of the error if one occurs. - const char * ErrorDesc() const { return errorDesc.c_str (); } - - /** Generally, you probably want the error string ( ErrorDesc() ). But if you - prefer the ErrorId, this function will fetch it. - */ - int ErrorId() const { return errorId; } - - /** Returns the location (if known) of the error. The first column is column 1, - and the first row is row 1. A value of 0 means the row and column wasn't applicable - (memory errors, for example, have no row/column) or the parser lost the error. (An - error in the error reporting, in that case.) - - @sa SetTabSize, Row, Column - */ - int ErrorRow() const { return errorLocation.row+1; } - int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() - - /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) - to report the correct values for row and column. It does not change the output - or input in any way. - - By calling this method, with a tab size - greater than 0, the row and column of each node and attribute is stored - when the file is loaded. Very useful for tracking the DOM back in to - the source file. - - The tab size is required for calculating the location of nodes. If not - set, the default of 4 is used. The tabsize is set per document. Setting - the tabsize to 0 disables row/column tracking. - - Note that row and column tracking is not supported when using operator>>. - - The tab size needs to be enabled before the parse or load. Correct usage: - @verbatim - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Load( "myfile.xml" ); - @endverbatim - - @sa Row, Column - */ - void SetTabSize( int _tabsize ) { tabsize = _tabsize; } - - int TabSize() const { return tabsize; } - - /** If you have handled the error, it can be reset with this call. The error - state is automatically cleared if you Parse a new XML block. - */ - void ClearError() { error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; - } - - /** Write the document to standard out using formatted printing ("pretty print"). */ - void Print() const { Print( stdout, 0 ); } - - /* Write the document to a string using formatted printing ("pretty print"). This - will allocate a character array (new char[]) and return it as a pointer. The - calling code pust call delete[] on the return char* to avoid a memory leak. - */ - //char* PrintToMemory() const; - - /// Print this Document to a FILE stream. - virtual void Print( FILE* cfile, int depth = 0 ) const; - // [internal use] - void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - - virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - // [internal use] - virtual TiXmlNode* Clone() const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - void CopyTo( TiXmlDocument* target ) const; - - bool error; - int errorId; - TIXML_STRING errorDesc; - int tabsize; - TiXmlCursor errorLocation; - bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. -}; - - -/** - A TiXmlHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - TiXmlElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - TiXmlElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - TiXmlElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - TiXmlElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - TiXmlHandle docHandle( &document ); - TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - TiXmlHandle handleCopy = handle; - @endverbatim - - What they should not be used for is iteration: - - @verbatim - int i=0; - while ( true ) - { - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); - if ( !child ) - break; - // do something - ++i; - } - @endverbatim - - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs - to. Instead, prefer: - - @verbatim - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); - - for( child; child; child=child->NextSiblingElement() ) - { - // do something - } - @endverbatim -*/ -class TiXmlHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } - /// Copy constructor - TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } - TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; } - - /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; - /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild( const char * value ) const; - /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; - /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement( const char * value ) const; - - /** Return a handle to the "index" child with the given name. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( int index ) const; - - #ifdef TIXML_USE_STL - TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } - TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } - - TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } - TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } - #endif - - /** Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* ToNode() const { return node; } - /** Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } - /** Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } - /** Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } - - /** @deprecated use ToNode. - Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* Node() const { return ToNode(); } - /** @deprecated use ToElement. - Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* Element() const { return ToElement(); } - /** @deprecated use ToText() - Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* Text() const { return ToText(); } - /** @deprecated use ToUnknown() - Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* Unknown() const { return ToUnknown(); } - -private: - TiXmlNode* node; -}; - - -/** Print to memory functionality. The TiXmlPrinter is useful when you need to: - - -# Print to memory (especially in non-STL mode) - -# Control formatting (line endings, etc.) - - When constructed, the TiXmlPrinter is in its default "pretty printing" mode. - Before calling Accept() you can call methods to control the printing - of the XML document. After TiXmlNode::Accept() is called, the printed document can - be accessed via the CStr(), Str(), and Size() methods. - - TiXmlPrinter uses the Visitor API. - @verbatim - TiXmlPrinter printer; - printer.SetIndent( "\t" ); - - doc.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - @endverbatim -*/ -class TiXmlPrinter : public TiXmlVisitor -{ -public: - TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), - buffer(), indent( " " ), lineBreak( "\n" ) {} - - virtual bool VisitEnter( const TiXmlDocument& doc ); - virtual bool VisitExit( const TiXmlDocument& doc ); - - virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); - virtual bool VisitExit( const TiXmlElement& element ); - - virtual bool Visit( const TiXmlDeclaration& declaration ); - virtual bool Visit( const TiXmlText& text ); - virtual bool Visit( const TiXmlComment& comment ); - virtual bool Visit( const TiXmlUnknown& unknown ); - - /** Set the indent characters for printing. By default 4 spaces - but tab (\t) is also useful, or null/empty string for no indentation. - */ - void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } - /// Query the indention string. - const char* Indent() { return indent.c_str(); } - /** Set the line breaking string. By default set to newline (\n). - Some operating systems prefer other characters, or can be - set to the null/empty string for no indenation. - */ - void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } - /// Query the current line breaking string. - const char* LineBreak() { return lineBreak.c_str(); } - - /** Switch over to "stream printing" which is the most dense formatting without - linebreaks. Common when the XML is needed for network transmission. - */ - void SetStreamPrinting() { indent = ""; - lineBreak = ""; - } - /// Return the result. - const char* CStr() { return buffer.c_str(); } - /// Return the length of the result string. - size_t Size() { return buffer.size(); } - - #ifdef TIXML_USE_STL - /// Return the result. - const std::string& Str() { return buffer; } - #endif - -private: - void DoIndent() { - for( int i=0; i -#include - -#include "tinyxml.h" - -//#define DEBUG_PARSER -#if defined( DEBUG_PARSER ) -# if defined( DEBUG ) && defined( _MSC_VER ) -# include -# define TIXML_LOG OutputDebugString -# else -# define TIXML_LOG printf -# endif -#endif - -// Note tha "PutString" hardcodes the same list. This -// is less flexible than it appears. Changing the entries -// or order will break putstring. -TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = -{ - { "&", 5, '&' }, - { "<", 4, '<' }, - { ">", 4, '>' }, - { """, 6, '\"' }, - { "'", 6, '\'' } -}; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// Including the basic of this table, which determines the #bytes in the -// sequence from the lead byte. 1 placed for invalid sequences -- -// although the result will be junk, pass it through as much as possible. -// Beware of the non-characters in UTF-8: -// ef bb bf (Microsoft "lead bytes") -// ef bf be -// ef bf bf - -const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - -const int TiXmlBase::utf8ByteTable[256] = -{ - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid -}; - - -void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) - *length = 1; - else if ( input < 0x800 ) - *length = 2; - else if ( input < 0x10000 ) - *length = 3; - else if ( input < 0x200000 ) - *length = 4; - else - { *length = 0; return; } // This code won't covert this correctly anyway. - - output += *length; - - // Scary scary fall throughs. - switch (*length) - { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - } -} - - -/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalpha( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalpha( anyByte ); -// } -} - - -/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalnum( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalnum( anyByte ); -// } -} - - -class TiXmlParsingData -{ - friend class TiXmlDocument; - public: - void Stamp( const char* now, TiXmlEncoding encoding ); - - const TiXmlCursor& Cursor() const { return cursor; } - - private: - // Only used by the document! - TiXmlParsingData( const char* start, int _tabsize, int row, int col ) - { - assert( start ); - stamp = start; - tabsize = _tabsize; - cursor.row = row; - cursor.col = col; - } - - TiXmlCursor cursor; - const char* stamp; - int tabsize; -}; - - -void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) -{ - assert( now ); - - // Do nothing if the tabsize is 0. - if ( tabsize < 1 ) - { - return; - } - - // Get the current row, column. - int row = cursor.row; - int col = cursor.col; - const char* p = stamp; - assert( p ); - - while ( p < now ) - { - // Treat p as unsigned, so we have a happy compiler. - const unsigned char* pU = (const unsigned char*)p; - - // Code contributed by Fletcher Dunn: (modified by lee) - switch (*pU) { - case 0: - // We *should* never get here, but in case we do, don't - // advance past the terminating null character, ever - return; - - case '\r': - // bump down to the next line - ++row; - col = 0; - // Eat the character - ++p; - - // Check for \r\n sequence, and treat this as a single character - if (*p == '\n') { - ++p; - } - break; - - case '\n': - // bump down to the next line - ++row; - col = 0; - - // Eat the character - ++p; - - // Check for \n\r sequence, and treat this as a single - // character. (Yes, this bizarre thing does occur still - // on some arcane platforms...) - if (*p == '\r') { - ++p; - } - break; - - case '\t': - // Eat the character - ++p; - - // Skip to next tab stop - col = (col / tabsize + 1) * tabsize; - break; - - case TIXML_UTF_LEAD_0: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( *(p+1) && *(p+2) ) - { - // In these cases, don't advance the column. These are - // 0-width spaces. - if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; - else - { p +=3; ++col; } // A normal character. - } - } - else - { - ++p; - ++col; - } - break; - - default: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // Eat the 1 to 4 byte utf8 character. - int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; - if ( step == 0 ) - step = 1; // Error case from bad encoding, but handle gracefully. - p += step; - - // Just advance one column, of course. - ++col; - } - else - { - ++p; - ++col; - } - break; - } - } - cursor.row = row; - cursor.col = col; - assert( cursor.row >= -1 ); - assert( cursor.col >= -1 ); - stamp = p; - assert( stamp ); -} - - -const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) -{ - if ( !p || !*p ) - { - return 0; - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - while ( *p ) - { - const unsigned char* pU = (const unsigned char*)p; - - // Skip the stupid Microsoft UTF-8 Byte order marks - if ( *(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==TIXML_UTF_LEAD_1 - && *(pU+2)==TIXML_UTF_LEAD_2 ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbeU ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbfU ) - { - p += 3; - continue; - } - - if ( IsWhiteSpace( *p ) ) // Still using old rules for white space. - ++p; - else - break; - } - } - else - { - while ( *p && IsWhiteSpace( *p ) ) - ++p; - } - - return p; -} - -#ifdef TIXML_USE_STL -/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) -{ - for( ;; ) - { - if ( !in->good() ) return false; - - int c = in->peek(); - // At this scope, we can't get to a document. So fail silently. - if ( !IsWhiteSpace( c ) || c <= 0 ) - return true; - - *tag += (char) in->get(); - } -} - -/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) -{ - //assert( character > 0 && character < 128 ); // else it won't work in utf-8 - while ( in->good() ) - { - int c = in->peek(); - if ( c == character ) - return true; - if ( c <= 0 ) // Silent failure: can't get document at this scope - return false; - - in->get(); - *tag += (char) c; - } - return false; -} -#endif - -// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The -// "assign" optimization removes over 10% of the execution time. -// -const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding ) -{ - // Oddly, not supported on some comilers, - //name->clear(); - // So use this: - *name = ""; - assert( p ); - - // Names start with letters or underscores. - // Of course, in unicode, tinyxml has no idea what a letter *is*. The - // algorithm is generous. - // - // After that, they can be letters, underscores, numbers, - // hyphens, or colons. (Colons are valid ony for namespaces, - // but tinyxml can't tell namespaces from names.) - if ( p && *p - && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) - { - const char* start = p; - while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) - || *p == '_' - || *p == '-' - || *p == '.' - || *p == ':' ) ) - { - //(*name) += *p; // expensive - ++p; - } - if ( p-start > 0 ) { - name->assign( start, p-start ); - } - return p; - } - return 0; -} - -const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) -{ - // Presume an entity, and pull it out. - TIXML_STRING ent; - int i; - *length = 0; - - if ( *(p+1) && *(p+1) == '#' && *(p+2) ) - { - unsigned long ucs = 0; - ptrdiff_t delta = 0; - unsigned mult = 1; - - if ( *(p+2) == 'x' ) - { - // Hexadecimal. - if ( !*(p+3) ) return 0; - - const char* q = p+3; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != 'x' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else if ( *q >= 'a' && *q <= 'f' ) - ucs += mult * (*q - 'a' + 10); - else if ( *q >= 'A' && *q <= 'F' ) - ucs += mult * (*q - 'A' + 10 ); - else - return 0; - mult *= 16; - --q; - } - } - else - { - // Decimal. - if ( !*(p+2) ) return 0; - - const char* q = p+2; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != '#' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else - return 0; - mult *= 10; - --q; - } - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - } - else - { - *value = (char)ucs; - *length = 1; - } - return p + delta + 1; - } - - // Now try to match it. - for( i=0; iappend( cArr, len ); - } - } - else - { - bool whitespace = false; - - // Remove leading white space: - p = SkipWhiteSpace( p, encoding ); - while ( p && *p - && !StringEqual( p, endTag, caseInsensitive, encoding ) ) - { - if ( *p == '\r' || *p == '\n' ) - { - whitespace = true; - ++p; - } - else if ( IsWhiteSpace( *p ) ) - { - whitespace = true; - ++p; - } - else - { - // If we've found whitespace, add it before the - // new character. Any whitespace just becomes a space. - if ( whitespace ) - { - (*text) += ' '; - whitespace = false; - } - int len; - char cArr[4] = { 0, 0, 0, 0 }; - p = GetChar( p, cArr, &len, encoding ); - if ( len == 1 ) - (*text) += cArr[0]; // more efficient - else - text->append( cArr, len ); - } - } - } - if ( p && *p ) - p += strlen( endTag ); - return ( p && *p ) ? p : 0; -} - -#ifdef TIXML_USE_STL - -void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - // The basic issue with a document is that we don't know what we're - // streaming. Read something presumed to be a tag (and hope), then - // identify it, and call the appropriate stream method on the tag. - // - // This "pre-streaming" will never read the closing ">" so the - // sub-tag can orient itself. - - if ( !StreamTo( in, '<', tag ) ) - { - SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - while ( in->good() ) - { - int tagIndex = (int) tag->length(); - while ( in->good() && in->peek() != '>' ) - { - int c = in->get(); - if ( c <= 0 ) - { - SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - break; - } - (*tag) += (char) c; - } - - if ( in->good() ) - { - // We now have something we presume to be a node of - // some sort. Identify it, and call the node to - // continue streaming. - TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); - - if ( node ) - { - node->StreamIn( in, tag ); - bool isElement = node->ToElement() != 0; - delete node; - node = 0; - - // If this is the root element, we're done. Parsing will be - // done by the >> operator. - if ( isElement ) - { - return; - } - } - else - { - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - } - } - // We should have returned sooner. - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); -} - -#endif - -const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) -{ - ClearError(); - - // Parse away, at the document level. Since a document - // contains nothing but other tags, most of what happens - // here is skipping white space. - if ( !p || !*p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - // Note that, for a document, this needs to come - // before the while space skip, so that parsing - // starts from the pointer we are given. - location.Clear(); - if ( prevData ) - { - location.row = prevData->cursor.row; - location.col = prevData->cursor.col; - } - else - { - location.row = 0; - location.col = 0; - } - TiXmlParsingData data( p, TabSize(), location.row, location.col ); - location = data.Cursor(); - - if ( encoding == TIXML_ENCODING_UNKNOWN ) - { - // Check for the Microsoft UTF-8 lead bytes. - const unsigned char* pU = (const unsigned char*)p; - if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 - && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 - && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) - { - encoding = TIXML_ENCODING_UTF8; - useMicrosoftBOM = true; - } - } - - p = SkipWhiteSpace( p, encoding ); - if ( !p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - while ( p && *p ) - { - TiXmlNode* node = Identify( p, encoding ); - if ( node ) - { - p = node->Parse( p, &data, encoding ); - LinkEndChild( node ); - } - else - { - break; - } - - // Did we get encoding info? - if ( encoding == TIXML_ENCODING_UNKNOWN - && node->ToDeclaration() ) - { - TiXmlDeclaration* dec = node->ToDeclaration(); - const char* enc = dec->Encoding(); - assert( enc ); - - if ( *enc == 0 ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - else - encoding = TIXML_ENCODING_LEGACY; - } - - p = SkipWhiteSpace( p, encoding ); - } - - // Was this empty? - if ( !firstChild ) { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); - return 0; - } - - // All is well. - return p; -} - -void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - // The first error in a chain is more accurate - don't set again! - if ( error ) - return; - - assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); - error = true; - errorId = err; - errorDesc = errorString[ errorId ]; - - errorLocation.Clear(); - if ( pError && data ) - { - data->Stamp( pError, encoding ); - errorLocation = data->Cursor(); - } -} - - -TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) -{ - TiXmlNode* returnNode = 0; - - p = SkipWhiteSpace( p, encoding ); - if( !p || !*p || *p != '<' ) - { - return 0; - } - - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p ) - { - return 0; - } - - // What is this thing? - // - Elements start with a letter or underscore, but xml is reserved. - // - Comments: "; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // [ 1475201 ] TinyXML parses entities in comments - // Oops - ReadText doesn't work, because we don't want to parse the entities. - // p = ReadText( p, &value, false, endTag, false, encoding ); - // - // from the XML spec: - /* - [Definition: Comments may appear anywhere in a document outside other markup; in addition, - they may appear within the document type declaration at places allowed by the grammar. - They are not part of the document's character data; an XML processor MAY, but need not, - make it possible for an application to retrieve the text of comments. For compatibility, - the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity - references MUST NOT be recognized within comments. - - An example of a comment: - - - */ - - value = ""; - // Keep all the white space. - while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) - { - value.append( p, 1 ); - ++p; - } - if ( p && *p ) - p += strlen( endTag ); - - return p; -} - - -const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) return 0; - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - // Read the name, the '=' and the value. - const char* pErr = p; - p = ReadName( p, &name, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); - return 0; - } - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p || *p != '=' ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - ++p; // skip '=' - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - const char* end; - const char SINGLE_QUOTE = '\''; - const char DOUBLE_QUOTE = '\"'; - - if ( *p == SINGLE_QUOTE ) - { - ++p; - end = "\'"; // single quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else if ( *p == DOUBLE_QUOTE ) - { - ++p; - end = "\""; // double quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else - { - // All attribute values should be in single or double quotes. - // But this is such a common error that the parser will try - // its best, even without them. - value = ""; - while ( p && *p // existence - && !IsWhiteSpace( *p ) // whitespace - && *p != '/' && *p != '>' ) // tag end - { - if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { - // [ 1451649 ] Attribute values with trailing quotes not handled correctly - // We did not have an opening quote but seem to have a - // closing one. Give up and throw an error. - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - value += *p; - ++p; - } - } - return p; -} - -#ifdef TIXML_USE_STL -void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->peek(); - if ( !cdata && (c == '<' ) ) - { - return; - } - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - (*tag) += (char) c; - in->get(); // "commits" the peek made above - - if ( cdata && c == '>' && tag->size() >= 3 ) { - size_t len = tag->size(); - if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { - // terminator of cdata. - return; - } - } - } -} -#endif - -const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - value = ""; - TiXmlDocument* document = GetDocument(); - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - - const char* const startTag = ""; - - if ( cdata || StringEqual( p, startTag, false, encoding ) ) - { - cdata = true; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // Keep all the white space, ignore the encoding, etc. - while ( p && *p - && !StringEqual( p, endTag, false, encoding ) - ) - { - value += *p; - ++p; - } - - TIXML_STRING dummy; - p = ReadText( p, &dummy, false, endTag, false, encoding ); - return p; - } - else - { - bool ignoreWhite = true; - - const char* end = "<"; - p = ReadText( p, &value, ignoreWhite, end, false, encoding ); - if ( p && *p ) - return p-1; // don't truncate the '<' - return 0; - } -} - -#ifdef TIXML_USE_STL -void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c; - - if ( c == '>' ) - { - // All is well. - return; - } - } -} -#endif - -const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) -{ - p = SkipWhiteSpace( p, _encoding ); - // Find the beginning, find the end, and look for - // the stuff in-between. - TiXmlDocument* document = GetDocument(); - if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); - return 0; - } - if ( data ) - { - data->Stamp( p, _encoding ); - location = data->Cursor(); - } - p += 5; - - version = ""; - encoding = ""; - standalone = ""; - - while ( p && *p ) - { - if ( *p == '>' ) - { - ++p; - return p; - } - - p = SkipWhiteSpace( p, _encoding ); - if ( StringEqual( p, "version", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - version = attrib.Value(); - } - else if ( StringEqual( p, "encoding", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - encoding = attrib.Value(); - } - else if ( StringEqual( p, "standalone", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - standalone = attrib.Value(); - } - else - { - // Read over whatever it is. - while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) - ++p; - } - } - return 0; -} - -bool TiXmlText::Blank() const -{ - for ( unsigned i=0; im_hWnd; - m_isMouseTracking = (0 != TrackMouseEvent(&e)); - } - - // On Windows, mouse events can by-pass the event queue. If there are too many mouse events, - // the event queue may not get processed, preventing other controls from updating. If two mouse - // events are less than 10ms apart, there is a risk of too many mouse events. So we repost the - // mouse event as a timer event that is queued up normally, allowing the queue to get processed. - unsigned int timeBetweenMouseMove = GetTickCount() - m_lastMouseMove; - if ((m_hasDelayedMouseMove && (timeBetweenMouseMove < 250)) || (timeBetweenMouseMove < 10)) - { - m_delayedMouseMoveFlag = nFlags; - m_delayedMouseMovePoint = point; - if (!m_hasDelayedMouseMove) - { - m_hasDelayedMouseMove = true; - SetTimer(DELAYED_MOUSE_MOVE_TIMER, 1, 0); - } - } - else - commitMouseMove(nFlags, point); -} - -// -// The method that actually performs MouseMove event processing -// -void CChartViewer::commitMouseMove(UINT nFlags, CPoint point) -{ - // Cancel the delayed mouse event if any - if (m_hasDelayedMouseMove) - { - KillTimer(DELAYED_MOUSE_MOVE_TIMER); - m_hasDelayedMouseMove = false; - } - - // Remember the mouse coordinates for later use - m_currentMouseX = point.x; - m_currentMouseY = point.y; - - // The chart can be updated more than once during mouse move. For example, it can update due to - // drag to scroll, and also due to drawing track cursor. So we delay updating the display until - // all all events has occured. - m_delayUpdateChart = NEED_DELAY; - m_isInMouseMove = true; - - // Check if mouse is dragging on the plot area - m_isOnPlotArea = m_isPlotAreaMouseDown || inPlotArea(point.x, point.y); - if (m_isPlotAreaMouseDown) - OnPlotAreaMouseDrag(nFlags, point); - - // Send CVN_MouseMoveChart - GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CVN_MouseMoveChart), - (LPARAM)m_hWnd); - - if (inExtendedPlotArea(point.x, point.y)) - { - // Mouse is in extended plot area, send CVN_MouseMovePlotArea - m_isInMouseMovePlotArea = true; - GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CVN_MouseMovePlotArea), - (LPARAM)m_hWnd); - } - else if (m_isInMouseMovePlotArea) - { - // Mouse was in extended plot area, but is not in it now, so send CVN_MouseLeavePlotArea - m_isInMouseMovePlotArea = false; - GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CVN_MouseLeavePlotArea), - (LPARAM)m_hWnd); - applyAutoHide(CVN_MouseLeavePlotArea); - } - - // Can update chart now - commitUpdateChart(); - m_isInMouseMove = false; - - // - // Show hot spot tool tips if necessary - // - if (!m_toolTipHasAttached) - { - m_toolTipHasAttached = true; - - // Connects the CChartViewer to the CToolTipCtrl control - m_ToolTip.AddTool(this); - m_ToolTip.SendMessage(TTM_SETMAXTIPWIDTH, 0, SHRT_MAX); - } - - if (nFlags != 0) - { - // Hide tool tips if mouse button is pressed. - m_ToolTip.UpdateTipText(_T(""), this); - } - else - { - // Use the ChartDirector ImageMapHandler to determine if the mouse is over a hot spot - int hotSpotNo = 0; - if (0 != m_hotSpotTester) - hotSpotNo = m_hotSpotTester->getHotSpot(point.x, point.y); - - // If the mouse is in the same hot spot since the last mouse move event, there is no need - // to update the tool tip. - if (hotSpotNo != m_currentHotSpot) - { - // Hot spot has changed - update tool tip text - m_currentHotSpot = hotSpotNo; - - if (hotSpotNo == 0) - { - // Mouse is not actually on hanlder hot spot - use default tool tip text and reset - // the clickable flag. - m_ToolTip.UpdateTipText(m_defaultToolTip, this); - m_isClickable = false; - } - else - { - // Mouse is on a hot spot. In this implementation, we consider the hot spot as - // clickable if its href ("path") parameter is not empty. - const char *path = m_hotSpotTester->getValue("path"); - m_isClickable = ((0 != path) && (0 != *path)); - - // Use the title attribute as the tool tip. Note that ChartDirector uses UTF8, - // while MFC uses TCHAR, so we use the utility UTF8toTCHAR for conversion. - m_ToolTip.UpdateTipText(UTF8toTCHAR(m_hotSpotTester->getValue("title")), this); - } - } - } - - m_lastMouseMove = GetTickCount(); - CStatic::OnMouseMove(nFlags, point); -} - -// -// Delayed MouseMove event handler -// -void CChartViewer::OnDelayedMouseMove() -{ - if (m_hasDelayedMouseMove) - commitMouseMove(m_delayedMouseMoveFlag, m_delayedMouseMovePoint); -} - -// -// MouseLeave event handler -// -LRESULT CChartViewer::OnMouseLeave(WPARAM wParam, LPARAM lParam) -{ - // Process delayed mouse move, if any - OnDelayedMouseMove(); - - // Mouse tracking is no longer active - m_isMouseTracking = false; - - if (m_isInMouseMovePlotArea) - { - // Mouse was in extended plot area, but is not in it now, so send CVN_MouseLeavePlotArea - m_isInMouseMovePlotArea = false; - GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CVN_MouseLeavePlotArea), - (LPARAM)m_hWnd); - applyAutoHide(CVN_MouseLeavePlotArea); - } - - // Send CVN_MouseLeaveChart - GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CVN_MouseLeaveChart), - (LPARAM)m_hWnd); - applyAutoHide(CVN_MouseLeaveChart); - - return TRUE; -} - -// -// Intercept WM_SETCURSOR to change the mouse cursor. -// -BOOL CChartViewer::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) -{ - if (m_isOnPlotArea) - { - switch (m_mouseUsage) - { - case Chart::MouseUsageZoomIn: - if (canZoomIn(m_zoomDirection)) - ::SetCursor(getZoomInCursor()); - else - ::SetCursor(getNoZoomCursor()); - return TRUE; - case Chart::MouseUsageZoomOut: - if (canZoomOut(m_zoomDirection)) - ::SetCursor(getZoomOutCursor()); - else - ::SetCursor(getNoZoomCursor()); - return TRUE; - } - } - - if (m_isClickable) - { - // Hand cursor = IDC_HAND = 32649 - HCURSOR h = AfxGetApp()->LoadStandardCursor(MAKEINTRESOURCE(32649)); - if (NULL != h) - ::SetCursor(h); - return TRUE; - } - - return CStatic::OnSetCursor(pWnd, nHitTest, message); -} - -// -// Mouse left button down event. -// -void CChartViewer::OnLButtonDown(UINT nFlags, CPoint point) -{ - OnDelayedMouseMove(); - - if (inPlotArea(point.x, point.y) && (m_mouseUsage != Chart::MouseUsageDefault)) - { - // Mouse usage is for drag to zoom/scroll. Capture the mouse to prepare for dragging and - // save the mouse down position to draw the selection rectangle. - SetCapture(); - m_isPlotAreaMouseDown = true; - m_plotAreaMouseDownXPos = point.x; - m_plotAreaMouseDownYPos = point.y; - startDrag(); - } - else - CStatic::OnLButtonDown(nFlags, point); -} - -// -// Mouse left button up event. -// -void CChartViewer::OnLButtonUp(UINT nFlags, CPoint point) -{ - OnDelayedMouseMove(); - - if (m_isPlotAreaMouseDown) - { - // Release the mouse capture. - ReleaseCapture(); - m_isPlotAreaMouseDown = false; - setRectVisible(false); - bool hasUpdate = false; - - switch (m_mouseUsage) - { - case Chart::MouseUsageZoomIn : - if (canZoomIn(m_zoomDirection)) - { - if (isDrag(m_zoomDirection, point)) - // Zoom to the drag selection rectangle. - hasUpdate = zoomTo(m_zoomDirection, - m_plotAreaMouseDownXPos, m_plotAreaMouseDownYPos, point.x, point.y); - else - // User just click on a point. Zoom-in around the mouse cursor position. - hasUpdate = zoomAt(m_zoomDirection, point.x, point.y, m_zoomInRatio); - } - break; - case Chart::MouseUsageZoomOut: - // Zoom out around the mouse cursor position. - if (canZoomOut(m_zoomDirection)) - hasUpdate = zoomAt(m_zoomDirection, point.x, point.y, m_zoomOutRatio); - break; - default : - if (m_isDragScrolling) - // Drag to scroll. We can update the image map now as scrolling has finished. - updateViewPort(false, true); - else - // Is not zooming or scrolling, so is just a normal click event. - GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), BN_CLICKED), (LPARAM)m_hWnd); - break; - } - - m_isDragScrolling = false; - if (hasUpdate) - // View port has changed - update it. - updateViewPort(true, true); - } - else - CStatic::OnLButtonUp(nFlags, point); -} - -// -// Chart hold timer. -// -void CChartViewer::OnTimer(UINT_PTR nIDEvent) -{ - if (nIDEvent == DELAYED_MOUSE_MOVE_TIMER) - { - // Is a delayed mouse move event - OnDelayedMouseMove(); - } - else - { - // Is a delayed view port update - m_holdTimerActive = false; - - // Reset the timer - KillTimer(nIDEvent); - - // If has pending chart view port update request, handles them now. - if (m_needUpdateChart || m_needUpdateImageMap) - updateViewPort(m_needUpdateChart, m_needUpdateImageMap); - } -} - -///////////////////////////////////////////////////////////////////////////// -// CChartViewer overrides - -BOOL CChartViewer::PreTranslateMessage(MSG* pMsg) -{ - // Remember to forward mouse messages to the CToolTipCtrl - BOOL res = CStatic::PreTranslateMessage(pMsg); - m_ToolTip.RelayEvent(pMsg); - return res; -} - -///////////////////////////////////////////////////////////////////////////// -// CChartViewer properties - -// -// Set the chart to the control -// -void CChartViewer::setChart(BaseChart *c) -{ - // In case the user forgets to check the "Notify" check box in the Dialog editor, we set it - // ourselves so the CChartViewer control can receive mouse events. - if ((GetStyle() & SS_NOTIFY) == 0) - ModifyStyle(0, SS_NOTIFY); - - m_currentChart = c; - setImageMap(0); - - if (0 != c) - { - commitPendingSyncAxis(c); - if (m_delayUpdateChart != NO_DELAY) - c->makeChart(); - } - - updateDisplay(); -} - -// -// Get back the same BaseChart pointer provided by the previous setChart call. -// -BaseChart *CChartViewer::getChart() -{ - return m_currentChart; -} - -// -// Set image map used by the chart -// -void CChartViewer::setImageMap(const char *imageMap) -{ - //delete the existing ImageMapHandler - if (0 != m_hotSpotTester) - delete m_hotSpotTester; - m_currentHotSpot = -1; - m_isClickable = false; - - //create a new ImageMapHandler to represent the image map - if ((0 == imageMap) || (0 == *imageMap)) - m_hotSpotTester = 0; - else - m_hotSpotTester = new ImageMapHandler(imageMap); -} - -// -// Get the image map handler for the chart -// -ImageMapHandler *CChartViewer::getImageMapHandler() -{ - return m_hotSpotTester; -} - -// -// Set the default tool tip to use -// -void CChartViewer::setDefaultToolTip(LPCTSTR text) -{ - m_defaultToolTip = text; -} - -// -// Get the CToolTipCtrl for managing tool tips. -// -CToolTipCtrl *CChartViewer::getToolTipCtrl() -{ - return &m_ToolTip; -} - -// -// Set the border width of the selection box -// -void CChartViewer::setSelectionBorderWidth(int width) -{ - m_selectBoxLineWidth = width; -} - -// -// Get the border with of the selection box. -// -int CChartViewer::getSelectionBorderWidth() -{ - return m_selectBoxLineWidth; -} - -// -// Set the border color of the selection box -// -void CChartViewer::setSelectionBorderColor(COLORREF c) -{ - m_selectBoxLineColor = c; - if (m_TopLine.m_hWnd != 0) - { - m_TopLine.SetColor(c); - m_LeftLine.SetColor(c); - m_BottomLine.SetColor(c); - m_RightLine.SetColor(c); - } -} - -// -// Get the border color of the selection box. -// -COLORREF CChartViewer::getSelectionBorderColor() -{ - return m_selectBoxLineColor; -} - -// -// Set the mouse usage mode -// -void CChartViewer::setMouseUsage(int mouseUsage) -{ - m_mouseUsage = mouseUsage; -} - -// -// Get the mouse usage mode -// -int CChartViewer::getMouseUsage() -{ - return m_mouseUsage; -} - -// -// Set the zoom direction -// -void CChartViewer::setZoomDirection(int direction) -{ - m_zoomDirection = direction; -} - -// -// Get the zoom direction -// -int CChartViewer::getZoomDirection() -{ - return m_zoomDirection; -} - -// -// Set the scroll direction -// -void CChartViewer::setScrollDirection(int direction) -{ - m_scrollDirection = direction; -} - -// -// Get the scroll direction -// -int CChartViewer::getScrollDirection() -{ - return m_scrollDirection; -} - -// -// Set the zoom-in ratio for mouse click zoom-in -// -void CChartViewer::setZoomInRatio(double ratio) -{ - m_zoomInRatio = ratio; -} - -// -// Get the zoom-in ratio for mouse click zoom-in -// -double CChartViewer::getZoomInRatio() -{ - return m_zoomInRatio; -} - -// -// Set the zoom-out ratio -// -void CChartViewer::setZoomOutRatio(double ratio) -{ - m_zoomOutRatio = ratio; -} - -// -// Get the zoom-out ratio -// -double CChartViewer::getZoomOutRatio() -{ - return m_zoomOutRatio; -} - -// -// Set the minimum mouse drag before the dragging is considered as real. This is to avoid small -// mouse vibrations triggering a mouse drag. -// -void CChartViewer::setMinimumDrag(int offset) -{ - m_minDragAmount = offset; -} - -// -// Get the minimum mouse drag before the dragging is considered as real. -// -int CChartViewer::getMinimumDrag() -{ - return m_minDragAmount; -} - -// -// Set the minimum interval between ViewPortChanged events. This is to avoid the chart being -// updated too frequently. (Default is 20ms between chart updates.) Multiple update events -// arrived during the interval will be merged into one chart update and executed at the end -// of the interval. -// -void CChartViewer::setUpdateInterval(int interval) -{ - m_updateInterval = interval; -} - -// -// Get the minimum interval between ViewPortChanged events. -// -int CChartViewer::getUpdateInterval() -{ - return m_updateInterval; -} - -// -// Check if there is a pending chart update request. -// -bool CChartViewer::needUpdateChart() -{ - return m_needUpdateChart; -} - -// -// Check if there is a pending image map update request. -// -bool CChartViewer::needUpdateImageMap() -{ - return m_needUpdateImageMap; -} - -// -// Get the current mouse x coordinate when used in a mouse move event handler -// -int CChartViewer::getChartMouseX() -{ - return m_currentMouseX; -} - -// -// Get the current mouse y coordinate when used in a mouse move event handler -// -int CChartViewer::getChartMouseY() -{ - return m_currentMouseY; -} - -// -// Get the current mouse x coordinate bounded to the plot area when used in a mouse event handler -// -int CChartViewer::getPlotAreaMouseX() -{ - int ret = getChartMouseX(); - if (ret < getPlotAreaLeft()) - ret = getPlotAreaLeft(); - if (ret > getPlotAreaLeft() + getPlotAreaWidth()) - ret = getPlotAreaLeft() + getPlotAreaWidth(); - return ret; -} - -// -// Get the current mouse y coordinate bounded to the plot area when used in a mouse event handler -// -int CChartViewer::getPlotAreaMouseY() -{ - int ret = getChartMouseY(); - if (ret < getPlotAreaTop()) - ret = getPlotAreaTop(); - if (ret > getPlotAreaTop() + getPlotAreaHeight()) - ret = getPlotAreaTop() + getPlotAreaHeight(); - return ret; -} - -// -// Check if mouse is on the extended plot area -// -bool CChartViewer::isMouseOnPlotArea() -{ - if (this->m_isMouseTracking) - return inExtendedPlotArea(getChartMouseX(), getChartMouseY()); - else - return false; -} - -// -// Check if is currently processing a mouse move event -// -bool CChartViewer::isInMouseMoveEvent() -{ - return m_isInMouseMove; -} - -///////////////////////////////////////////////////////////////////////////// -// CChartViewer methods - -// -// Update the display -// -void CChartViewer::updateDisplay() -{ - if (m_delayUpdateChart == NO_DELAY) - commitUpdateChart(); - else - { - m_delayUpdateChart = NEED_UPDATE; - delete m_delayedChart; - m_delayedChart = (0 != m_currentChart) ? new BaseChart(m_currentChart) : 0; - } -} - -// -// Commit chart to display -// -void CChartViewer::commitUpdateChart() -{ - if (m_delayUpdateChart == NEED_DELAY) - { - // No actual update occur - m_delayUpdateChart = NO_DELAY; - return; - } - - // Get the HBITMAP and metrics for the chart - BaseChart *c = (m_delayUpdateChart == NEED_UPDATE) ? m_delayedChart : m_currentChart; - HBITMAP chartBMP = 0; - const char *chartMetrics = 0; - - if (0 != c) - { - // Output chart as Device Indpendent Bitmap with file headers - MemBlock m = c->makeChart(Chart::BMP); - - // MFC expects HBITMAP, so convert from DIB to HBITMAP. - CDC *cdc = GetDC(); - chartBMP = CreateDIBitmap( - cdc->m_hDC, - (const struct tagBITMAPINFOHEADER *)(m.data + 14), - CBM_INIT, - m.data + *(int *)(m.data + 10), - (const struct tagBITMAPINFO *)(m.data + 14), - DIB_RGB_COLORS); - ReleaseDC(cdc); - - // Get chart metrics - chartMetrics = c->getChartMetrics(); - } - - // Set the HBITMAP for display - if (0 != (chartBMP = SetBitmap(chartBMP))) - DeleteObject(chartBMP); - - // Set the chart metrics and clear the image map - setChartMetrics(chartMetrics); - - // Remember to update the selection rectangle - if ((0 != m_TopLine.m_hWnd) && m_TopLine.IsWindowVisible()) - { - m_TopLine.Invalidate(); - m_LeftLine.Invalidate(); - m_RightLine.Invalidate(); - m_BottomLine.Invalidate(); - m_TopLine.UpdateWindow(); - m_LeftLine.UpdateWindow(); - m_RightLine.UpdateWindow(); - m_BottomLine.UpdateWindow(); - } - - // Any delayed chart has been committed - m_delayUpdateChart = NO_DELAY; - delete m_delayedChart; - m_delayedChart = 0; -} - -// -// Set the message used to remove the dynamic layer -// -void CChartViewer::removeDynamicLayer(int msg) -{ - m_autoHideMsg = msg; - if (msg == -1) - applyAutoHide(msg); -} - -// -// Attempt to hide the dynamic layer using the specified message -// -void CChartViewer::applyAutoHide(int msg) -{ - if (m_autoHideMsg == msg) - { - if (0 != m_currentChart) - m_currentChart->removeDynamicLayer(); - m_autoHideMsg = 0; - - updateDisplay(); - } -} - -// -// Create the edges for the selection rectangle -// -void CChartViewer::initRect() -{ - m_TopLine.Create(GetParent(), m_selectBoxLineColor); - m_LeftLine.Create(GetParent(), m_selectBoxLineColor); - m_BottomLine.Create(GetParent(), m_selectBoxLineColor); - m_RightLine.Create(GetParent(), m_selectBoxLineColor); -} - -// -// Set selection rectangle position and size -// -void CChartViewer::drawRect(int x, int y, int width, int height) -{ - // Create the edges of the rectangle if not already created - if (m_TopLine.m_hWnd == 0) - initRect(); - - // width < 0 is interpreted as the rectangle extends to the left or x. - // height <0 is interpreted as the rectangle extends to above y. - if (width < 0) - x -= (width = -width); - if (height < 0) - y -= (height = -height); - - // Compute the position of the selection rectangle as relative to the parent window - RECT rect; - rect.left = x; - rect.top = y; - rect.right = x + width; - rect.bottom = y + height; - MapWindowPoints(m_TopLine.GetParent(), &rect); - - // Put the edges along the sides of the rectangle - m_TopLine.MoveWindow(rect.left, rect.top, rect.right - rect.left, m_selectBoxLineWidth); - m_LeftLine.MoveWindow(rect.left, rect.top, m_selectBoxLineWidth, rect.bottom - rect.top); - m_BottomLine.MoveWindow(rect.left, rect.bottom - m_selectBoxLineWidth + 1, - rect.right - rect.left, m_selectBoxLineWidth); - m_RightLine.MoveWindow(rect.right - m_selectBoxLineWidth + 1, rect.top, - m_selectBoxLineWidth, rect.bottom - rect.top); -} - -// -// Show/hide selection rectangle -// -void CChartViewer::setRectVisible(bool b) -{ - // Create the edges of the rectangle if not already created - if (b && (m_TopLine.m_hWnd == 0)) - initRect(); - - // Show/hide the edges - if (m_TopLine.m_hWnd != 0) - { - int state = b ? SW_SHOW : SW_HIDE; - m_TopLine.ShowWindow(state); - m_LeftLine.ShowWindow(state); - m_BottomLine.ShowWindow(state); - m_RightLine.ShowWindow(state); - } -} - -// -// Determines if the mouse is dragging. -// -bool CChartViewer::isDrag(int direction, CPoint point) -{ - // We only consider the mouse is dragging it is has dragged more than m_minDragAmount. This is - // to avoid small mouse vibrations triggering a mouse drag. - int spanX = abs(point.x - m_plotAreaMouseDownXPos); - int spanY = abs(point.y - m_plotAreaMouseDownYPos); - return ((direction != Chart::DirectionVertical) && (spanX >= m_minDragAmount)) || - ((direction != Chart::DirectionHorizontal) && (spanY >= m_minDragAmount)); -} - -// -// Process mouse dragging over the plot area -// -void CChartViewer::OnPlotAreaMouseDrag(UINT /* nFlags */, CPoint point) -{ - switch (m_mouseUsage) - { - case Chart::MouseUsageZoomIn : - { - // - // Mouse is used for zoom in. Draw the selection rectangle if necessary. - // - - bool isDragZoom = canZoomIn(m_zoomDirection) && isDrag(m_zoomDirection, point); - if (isDragZoom) - { - int spanX = m_plotAreaMouseDownXPos - point.x; - int spanY = m_plotAreaMouseDownYPos - point.y; - - switch (m_zoomDirection) - { - case Chart::DirectionHorizontal: - drawRect(point.x, getPlotAreaTop(), spanX, getPlotAreaHeight()); - break; - case Chart::DirectionVertical: - drawRect(getPlotAreaLeft(), point.y, getPlotAreaWidth(), spanY); - break; - default: - drawRect(point.x, point.y, spanX, spanY); - break; - } - } - setRectVisible(isDragZoom); - break; - } - case Chart::MouseUsageScroll : - { - // - // Mouse is used for drag scrolling. Scroll and update the view port. - // - - if (m_isDragScrolling || isDrag(m_scrollDirection, point)) - { - m_isDragScrolling = true; - switch (m_scrollDirection) - { - case Chart::DirectionHorizontal: - ::SetCursor(getNoMoveHorizCursor()); - break; - case Chart::DirectionVertical: - ::SetCursor(getNoMoveVertCursor()); - break; - default : - ::SetCursor(getNoMove2DCursor()); - break; - } - - if (dragTo(m_scrollDirection, - point.x - m_plotAreaMouseDownXPos, point.y - m_plotAreaMouseDownYPos)) - updateViewPort(true, false); - } - } - } -} - -// -// Trigger the ViewPortChanged event -// -void CChartViewer::updateViewPort(bool needUpdateChart, bool needUpdateImageMap) -{ - // Merge the current update requests with any pending requests. - m_needUpdateChart = m_needUpdateChart || needUpdateChart; - m_needUpdateImageMap = needUpdateImageMap; - - // Hold timer has not expired, so do not update chart immediately. Keep the requests pending. - if (m_holdTimerActive) - return; - - // The chart can be updated more than once during mouse move. For example, it can update due to - // drag to scroll, and also due to drawing track cursor. So we delay updating the display until - // all all updates has occured. - int hasDelayUpdate = (m_delayUpdateChart != NO_DELAY); - if (!hasDelayUpdate) - m_delayUpdateChart = NEED_DELAY; - - // Can trigger the ViewPortChanged event. - validateViewPort(); - GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), CVN_ViewPortChanged), - (LPARAM)m_hWnd); - - // Can update chart now - if (!hasDelayUpdate) - commitUpdateChart(); - - // Clear any pending updates. - m_needUpdateChart = false; - m_needUpdateImageMap = false; - - // Set hold timer to prevent multiple chart updates within a short period. - if (m_updateInterval > 0) - { - m_holdTimerActive = true; - SetTimer(UPDATE_VIEW_PORT_TIMER, m_updateInterval, 0); - } -} - -///////////////////////////////////////////////////////////////////////////// -// CRectCtrl -// -// A rectangle with a background color. Use as thick edges for the selection -// rectangle. -// - -// -// Create control with a given color -// -BOOL CRectCtrl::Create(CWnd *pParentWnd, COLORREF c) -{ - SetColor(c); - - RECT r; - r.left = r.top = r.right = r.bottom = 0; - return CStatic::Create(0, WS_CHILD, r, pParentWnd); -} - -BEGIN_MESSAGE_MAP(CRectCtrl, CStatic) - //{{AFX_MSG_MAP(CRectCtrl) - ON_WM_CTLCOLOR_REFLECT() - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CRectCtrl message handlers - -HBRUSH CRectCtrl::CtlColor(CDC* /* pDC */, UINT /* nCtlColor */) -{ - return (HBRUSH)m_Color.m_hObject; -} - -///////////////////////////////////////////////////////////////////////////// -// CRectCtrl proporties - -// -// Set the background color -// -void CRectCtrl::SetColor(COLORREF c) -{ - m_Color.CreateSolidBrush(c); -} - -///////////////////////////////////////////////////////////////////////////// -// Build in mouse cursors for zooming and scrolling support -// - -static const int zoomInCursorA[] = -{ -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xff3ff8ff, -0xff0fe0ff, -0xff07c0ff, -0xff07c0ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff07c0ff, -0xff07c0ff, -0xff01e0ff, -0xff30f8ff, -0x7ff0ffff, -0x3ff8ffff, -0x1ffcffff, -0x0ffeffff, -0x0fffffff, -0x9fffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff -}; - -static const int zoomInCursorB[] = -{ -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00c00700, -0x00f01f00, -0x00f01e00, -0x00f83e00, -0x00f83e00, -0x00183000, -0x00f83e00, -0x00f83e00, -0x00f01e00, -0x00f01f00, -0x00c00700, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000 -}; - -static const int zoomOutCursorA[] = -{ -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xff3ff8ff, -0xff0fe0ff, -0xff07c0ff, -0xff07c0ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff07c0ff, -0xff07c0ff, -0xff01e0ff, -0xff30f8ff, -0x7ff0ffff, -0x3ff8ffff, -0x1ffcffff, -0x0ffeffff, -0x0fffffff, -0x9fffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff -}; - -static const int zoomOutCursorB[] = -{ -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00c00700, -0x00f01f00, -0x00f01f00, -0x00f83f00, -0x00f83f00, -0x00183000, -0x00f83f00, -0x00f83f00, -0x00f01f00, -0x00f01f00, -0x00c00700, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000 -}; - -static const int noZoomCursorA[] = -{ -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xff3ff8ff, -0xff0fe0ff, -0xff07c0ff, -0xff07c0ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff0380ff, -0xff07c0ff, -0xff07c0ff, -0xff01e0ff, -0xff30f8ff, -0x7ff0ffff, -0x3ff8ffff, -0x1ffcffff, -0x0ffeffff, -0x0fffffff, -0x9fffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff -}; - -static const int noZoomCursorB[] = -{ -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00c00700, -0x00f01f00, -0x00f01f00, -0x00f83f00, -0x00f83f00, -0x00f83f00, -0x00f83f00, -0x00f83f00, -0x00f01f00, -0x00f01f00, -0x00c00700, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000 -}; - -static int noMove2DCursorA[] = -{ -0xffffffff, -0xffffffff, -0xffffffff, -0xff7ffeff, -0xff3ffcff, -0xff1ff8ff, -0xff0ff0ff, -0xff07e0ff, -0xff03c0ff, -0xff03c0ff, -0xfffc3fff, -0x7ffc3ffe, -0x3ffc3ffc, -0x1f7c3ef8, -0x0f3c3cf0, -0x071c38e0, -0x071c38e0, -0x0f3c3cf0, -0x1f7c3ef8, -0x3ffc3ffc, -0x7ffc3ffe, -0xfffc3fff, -0xff03c0ff, -0xff03c0ff, -0xff07e0ff, -0xff0ff0ff, -0xff1ff8ff, -0xff3ffcff, -0xff7ffeff, -0xffffffff, -0xffffffff, -0xffffffff -}; - -static int noMove2DCursorB[] = -{ -0x00000000, -0x00000000, -0x00000000, -0x00800100, -0x00400200, -0x00200400, -0x00100800, -0x00081000, -0x00042000, -0x00fc3f00, -0x0003c000, -0x80024001, -0x40024002, -0x20824104, -0x10424208, -0x08224410, -0x08224410, -0x10424208, -0x20824104, -0x40024002, -0x80024001, -0x0003c000, -0x00fc3f00, -0x00042000, -0x00081000, -0x00100800, -0x00200400, -0x00400200, -0x00800100, -0x00000000, -0x00000000, -0x00000000 -}; - -static int noMoveHorizCursorA[] = -{ -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xfffc3fff, -0x7ffc3ffe, -0x3ffc3ffc, -0x1f7c3ef8, -0x0f3c3cf0, -0x071c38e0, -0x071c38e0, -0x0f3c3cf0, -0x1f7c3ef8, -0x3ffc3ffc, -0x7ffc3ffe, -0xfffc3fff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff, -0xffffffff -}; - -static int noMoveHorizCursorB[] = -{ -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x0003c000, -0x80024001, -0x40024002, -0x20824104, -0x10424208, -0x08224410, -0x08224410, -0x10424208, -0x20824104, -0x40024002, -0x80024001, -0x0003c000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000, -0x00000000 -}; - -static int noMoveVertCursorA[] = -{ -0xffffffff, -0xffffffff, -0xffffffff, -0xff7ffeff, -0xff3ffcff, -0xff1ff8ff, -0xff0ff0ff, -0xff07e0ff, -0xff03c0ff, -0xff03c0ff, -0xffffffff, -0xffffffff, -0xffffffff, -0xff7ffeff, -0xff3ffcff, -0xff1ff8ff, -0xff1ff8ff, -0xff3ffcff, -0xff7ffeff, -0xffffffff, -0xffffffff, -0xffffffff, -0xff03c0ff, -0xff03c0ff, -0xff07e0ff, -0xff0ff0ff, -0xff1ff8ff, -0xff3ffcff, -0xff7ffeff, -0xffffffff, -0xffffffff, -0xffffffff -}; - -static int noMoveVertCursorB[] = -{ -0x00000000, -0x00000000, -0x00000000, -0x00800100, -0x00400200, -0x00200400, -0x00100800, -0x00081000, -0x00042000, -0x00fc3f00, -0x00000000, -0x00000000, -0x00000000, -0x00800100, -0x00400200, -0x00200400, -0x00200400, -0x00400200, -0x00800100, -0x00000000, -0x00000000, -0x00000000, -0x00fc3f00, -0x00042000, -0x00081000, -0x00100800, -0x00200400, -0x00400200, -0x00800100, -0x00000000, -0x00000000, -0x00000000 -}; - -static HCURSOR hZoomInCursor = 0; -static HCURSOR hZoomOutCursor = 0; -static HCURSOR hNoZoomCursor = 0; -static HCURSOR hNoMove2DCursor = 0; -static HCURSOR hNoMoveHorizCursor = 0; -static HCURSOR hNoMoveVertCursor = 0; - -class FreeCursors -{ -public: - ~FreeCursors() - { - if (0 != hZoomInCursor) - DestroyCursor(hZoomInCursor); - if (0 != hZoomOutCursor) - DestroyCursor(hZoomOutCursor); - if (0 != hNoZoomCursor) - DestroyCursor(hNoZoomCursor); - if (0 != hNoMove2DCursor) - DestroyCursor(hNoMove2DCursor); - if (0 != hNoMoveHorizCursor) - DestroyCursor(hNoMoveHorizCursor); - if (0 != hNoMoveVertCursor) - DestroyCursor(hNoMoveVertCursor); - } -} dummyFreeCursorObj; - -static HCURSOR getZoomInCursor() -{ - if (0 == hZoomInCursor) - { - hZoomInCursor = CreateCursor(AfxGetApp()->m_hInstance, 15, 15, 32, 32, - zoomInCursorA, zoomInCursorB); - } - return hZoomInCursor; -} - -static HCURSOR getZoomOutCursor() -{ - if (0 == hZoomOutCursor) - { - hZoomOutCursor = CreateCursor(AfxGetApp()->m_hInstance, 15, 15, 32, 32, - zoomOutCursorA, zoomOutCursorB); - } - return hZoomOutCursor; -} - -static HCURSOR getNoZoomCursor() -{ - if (0 == hNoZoomCursor) - { - hNoZoomCursor = CreateCursor(AfxGetApp()->m_hInstance, 15, 15, 32, 32, - noZoomCursorA, noZoomCursorB); - } - return hNoZoomCursor; -} - -static HCURSOR getNoMove2DCursor() -{ - if (0 == hNoMove2DCursor) - { - hNoMove2DCursor = CreateCursor(AfxGetApp()->m_hInstance, 15, 15, 32, 32, - noMove2DCursorA, noMove2DCursorB); - } - return hNoMove2DCursor; -} - -static HCURSOR getNoMoveHorizCursor() -{ - if (0 == hNoMoveHorizCursor) - { - hNoMoveHorizCursor = CreateCursor(AfxGetApp()->m_hInstance, 15, 15, 32, 32, - noMoveHorizCursorA, noMoveHorizCursorB); - } - return hNoMoveHorizCursor; -} - -static HCURSOR getNoMoveVertCursor() -{ - if (0 == hNoMoveVertCursor) - { - hNoMoveVertCursor = CreateCursor(AfxGetApp()->m_hInstance, 15, 15, 32, 32, - noMoveVertCursorA, noMoveVertCursorB); - } - return hNoMoveVertCursor; -} diff --git a/PssSampleClient/PurenessLine/PurenessLine/ChartViewer.h b/PssSampleClient/PurenessLine/PurenessLine/ChartViewer.h deleted file mode 100644 index 45a970ce7..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/ChartViewer.h +++ /dev/null @@ -1,389 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Copyright 2012 Advanced Software Engineering Limited -// -// You may use and modify the code in this file in your application, provided the code and -// its modifications are used only in conjunction with ChartDirector. Usage of this software -// is subjected to the terms and condition of the ChartDirector license. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "chartdir.h" -#include - -// -// Utility to convert from UTF8 string to MFC TCHAR string. -// -class UTF8toTCHAR -{ -public : - UTF8toTCHAR(const char *utf8_string) : t_string(0), needFree(false) - { - if (0 == utf8_string) - t_string = 0; - else if (0 == *utf8_string) - t_string = _T(""); - else if ((sizeof(TCHAR) == sizeof(char)) && isPureAscii(utf8_string)) - // No conversion needed for pure ASCII text - t_string = (TCHAR *)utf8_string; - else - { - // Either TCHAR = Unicode (2 bytes), or utf8_string contains non-ASCII characters. - // Needs conversion - needFree = true; - - // Convert to Unicode (2 bytes) - int string_len = (int)strlen(utf8_string); - wchar_t *buffer = new wchar_t[string_len + 1]; - MultiByteToWideChar(CP_UTF8, 0, utf8_string, -1, buffer, string_len + 1); - buffer[string_len] = 0; - -#ifdef _UNICODE - t_string = buffer; -#else - // TCHAR is MBCS - need to convert back to MBCS - t_string = new char[string_len * 2 + 2]; - WideCharToMultiByte(CP_ACP, 0, buffer, -1, t_string, string_len * 2 + 1, 0, 0); - t_string[string_len * 2 + 1] = 0; - delete[] buffer; -#endif - } - - } - - operator const TCHAR*() - { - return t_string; - } - - ~UTF8toTCHAR() - { - if (needFree) - delete[] t_string; - } - -private : - TCHAR *t_string; - bool needFree; - - // - // helper utility to test if a string contains only ASCII characters - // - bool isPureAscii(const char *s) - { - while (*s != 0) { if (*(s++) & 0x80) return false; } - return true; - } - - //disable assignment - UTF8toTCHAR(const UTF8toTCHAR &rhs); - UTF8toTCHAR &operator=(const UTF8toTCHAR &rhs); -}; - -// -// Utility to convert from MFC TCHAR string to UTF8 string -// -class TCHARtoUTF8 -{ -public : - TCHARtoUTF8(const TCHAR *t_string) : utf8_string(0), needFree(false) - { - if (0 == t_string) - utf8_string = 0; - else if (0 == *t_string) - utf8_string = ""; - else if ((sizeof(TCHAR) == sizeof(char)) && isPureAscii((char *)t_string)) - // No conversion needed for pure ASCII text - utf8_string = (char *)t_string; - else - { - // TCHAR is non-ASCII. Needs conversion. - - needFree = true; - int string_len = (int)_tcslen(t_string); - -#ifndef _UNICODE - // Convert to Unicode if not already in unicode. - wchar_t *w_string = new wchar_t[string_len + 1]; - MultiByteToWideChar(CP_ACP, 0, t_string, -1, w_string, string_len + 1); - w_string[string_len] = 0; -#else - wchar_t *w_string = (wchar_t*)t_string; -#endif - - // Convert from Unicode (2 bytes) to UTF8 - utf8_string = new char[string_len * 3 + 1]; - WideCharToMultiByte(CP_UTF8, 0, w_string, -1, utf8_string, string_len * 3 + 1, 0, 0); - utf8_string[string_len * 3] = 0; - - if (w_string != (wchar_t *)t_string) - delete[] w_string; - } - - } - - operator const char*() - { - return utf8_string; - } - - ~TCHARtoUTF8() - { - if (needFree) - delete[] utf8_string; - } - -private : - char *utf8_string; - bool needFree; - - // - // helper utility to test if a string contains only ASCII characters - // - bool isPureAscii(const char *s) - { - while (*s != 0) { if (*(s++) & 0x80) return false; } - return true; - } - - //disable assignment - TCHARtoUTF8(const TCHARtoUTF8 &rhs); - TCHARtoUTF8 &operator=(const TCHARtoUTF8 &rhs); -}; - -///////////////////////////////////////////////////////////////////////////// -// CRectCtrl window - -// -// A rectangle with a background color. Use as thick edges for the selection -// rectangle. -// - -class CRectCtrl : public CStatic -{ -public: -// Public interface - BOOL Create(CWnd* pParentWnd, COLORREF c); - void SetColor(COLORREF c); - -// ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CRectCtrl) - //}}AFX_VIRTUAL - -protected: -// Generated message map functions - //{{AFX_MSG(CRectCtrl) - afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); - //}}AFX_MSG - - DECLARE_MESSAGE_MAP() - -private : - CBrush m_Color; -}; - -///////////////////////////////////////////////////////////////////////////// -// CChartViewer window - -// -// Mouse usage mode constants -// -namespace Chart -{ - enum - { - MouseUsageDefault = 0, - MouseUsageScroll = 1, - MouseUsageZoomIn = 3, - MouseUsageZoomOut = 4 - }; -} - -// -// Event message ID -// -#define CVN_ViewPortChanged 1000 // View port has changed -#define CVN_MouseMoveChart 1001 // Mouse moves over the chart -#define CVN_MouseLeaveChart 1002 // Mouse leaves the chart -#define CVN_MouseMovePlotArea 1003 // Mouse moves over the extended plot area -#define CVN_MouseLeavePlotArea 1004 // Mouse leaves the extended plot area - - -class CChartViewer : public CStatic, public ViewPortManager -{ -public: - CChartViewer(); - - // - // CChartViewer properties - // - - virtual void setChart(BaseChart *c); - virtual BaseChart *getChart(); - - virtual void setImageMap(const char *imageMap); - virtual ImageMapHandler *getImageMapHandler(); - - virtual void setDefaultToolTip(LPCTSTR text); - virtual CToolTipCtrl *getToolTipCtrl(); - - virtual void setSelectionBorderWidth(int width); - virtual int getSelectionBorderWidth(); - - virtual void setSelectionBorderColor(COLORREF c); - virtual COLORREF getSelectionBorderColor(); - - virtual void setMouseUsage(int mouseUsage); - virtual int getMouseUsage(); - - virtual void setZoomDirection(int direction); - virtual int getZoomDirection(); - - virtual void setScrollDirection(int direction); - virtual int getScrollDirection(); - - virtual void setZoomInRatio(double ratio); - virtual double getZoomInRatio(); - - virtual void setZoomOutRatio(double ratio); - virtual double getZoomOutRatio(); - - virtual void setMinimumDrag(int offset); - virtual int getMinimumDrag(); - - virtual void setUpdateInterval(int interval); - virtual int getUpdateInterval(); - - virtual bool needUpdateChart(); - virtual bool needUpdateImageMap(); - - virtual bool isMouseOnPlotArea(); - virtual bool isInMouseMoveEvent(); - - // - // CChartViewer methods - // - - // Trigger the ViewPortChanged event - virtual void updateViewPort(bool needUpdateChart, bool needUpdateImageMap); - - // Request CChartViewer to redisplay the chart - virtual void updateDisplay(); - - // Set the message used to remove the dynamic layer - virtual void removeDynamicLayer(int msg); - - // Get the mouse coordinates - virtual int getChartMouseX(); - virtual int getChartMouseY(); - - // Get the mouse coordinates bounded to the plot area - virtual int getPlotAreaMouseX(); - virtual int getPlotAreaMouseY(); - - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CChartViewer) - public: - virtual BOOL PreTranslateMessage(MSG* pMsg); - //}}AFX_VIRTUAL - -protected: - - // Generated message map functions - afx_msg void OnMouseMove(UINT nFlags, CPoint point); - afx_msg void OnDelayedMouseMove(); - afx_msg LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam); - afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message); - afx_msg void OnDestroy(); - afx_msg void OnLButtonDown(UINT nFlags, CPoint point); - afx_msg void OnLButtonUp(UINT nFlags, CPoint point); - afx_msg void OnTimer(UINT_PTR nIDEvent); - DECLARE_MESSAGE_MAP() - -private: - - // - // CChartViewer configurable properties - // - - BaseChart *m_currentChart; // Current BaseChart object - ImageMapHandler *m_hotSpotTester; // ImageMapHander representing the image map - CString m_defaultToolTip; // Default tool tip text - CToolTipCtrl m_ToolTip; // CToolTipCtrl for managing tool tips - bool m_toolTipHasAttached; // CToolTipCtrl has attached to CChartViewer - COLORREF m_selectBoxLineColor; // Selectiom box border color - int m_selectBoxLineWidth; // Selectiom box border width - int m_mouseUsage; // Mouse usage mode - int m_zoomDirection; // Zoom direction - int m_scrollDirection; // Scroll direction - double m_zoomInRatio; // Zoom in ratio - double m_zoomOutRatio; // Zoom out ratio - int m_minDragAmount; // Minimum drag amount - int m_updateInterval; // Minimum interval between chart updates - bool m_needUpdateChart; // Has pending chart update request - bool m_needUpdateImageMap; // Has pending image map udpate request - - // - // Keep track of mouse states - // - - int m_currentHotSpot; // The hot spot under the mouse cursor. - bool m_isClickable; // Mouse is over a clickable hot spot. - bool m_isOnPlotArea; // Mouse is over the plot area. - bool m_isPlotAreaMouseDown; // Mouse left button is down in the plot area. - bool m_isDragScrolling; // Is drag scrolling the chart. - bool m_isMouseTracking; // Is tracking mouse leave event. - bool m_isInMouseMove; // Is in mouse moeve event handler - - // - // Dragging support - // - - int m_plotAreaMouseDownXPos; // The starting x coordinate of the mouse drag. - int m_plotAreaMouseDownYPos; // The starting y coordinate of the mouse drag. - bool isDrag(int direction, CPoint point); // Check if mouse is dragging - void OnPlotAreaMouseDrag(UINT nFlags, CPoint point); // Process mouse dragging - - // - // Selection rectangle - // - - CRectCtrl m_LeftLine; // Left edge of selection rectangle - CRectCtrl m_RightLine; // Right edge of selection rectangle - CRectCtrl m_TopLine; // Top edge of selection rectangle - CRectCtrl m_BottomLine; // Bottom edge of selection rectangle - - void initRect(); // Initialize selection rectangle edges - void drawRect(int x, int y, int width, int height); // Draw selection rectangle - void setRectVisible(bool b); // Show/hide selection rectangle - - // - // Chart update rate control - // - - bool m_holdTimerActive; // Delay chart update to limit update frequency - - int m_delayUpdateChart; // Delay chart update until the mouse event is completed - BaseChart *m_delayedChart; - void commitUpdateChart(); // Commit updating the chart. - - unsigned int m_lastMouseMove; // The timestamp of the last mouse move event. - bool m_hasDelayedMouseMove; // Delay the mouse move event to allow other updates - UINT m_delayedMouseMoveFlag; // The mouse key flags of the delayed mouse move event. - CPoint m_delayedMouseMovePoint; // The mouse coordinates of the delayed mouse move event. - void commitMouseMove(UINT nFlags, CPoint point); // Raise the delayed mouse move event. - - // - // Track Cursor support - // - int m_currentMouseX; // Get the mouse x-pixel coordinate - int m_currentMouseY; // Get the mouse y-pixel coordinate - int m_isInMouseMovePlotArea; // flag to indicate if is in a mouse move plot area event. - - // - // Dynamic Layer support - // - int m_autoHideMsg; // The message that will trigger removing the dynamic layer. - void applyAutoHide(int msg); // Attempt to remove the dynamic layer with the given message. -}; - diff --git a/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.cpp b/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.cpp deleted file mode 100644 index 5b7f50577..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.cpp +++ /dev/null @@ -1,79 +0,0 @@ - -// PurenessLine.cpp : ӦóΪ -// - -#include "stdafx.h" -#include "PurenessLine.h" -#include "PurenessLineDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CPurenessLineApp - -BEGIN_MESSAGE_MAP(CPurenessLineApp, CWinAppEx) - ON_COMMAND(ID_HELP, &CWinApp::OnHelp) -END_MESSAGE_MAP() - - -// CPurenessLineApp - -CPurenessLineApp::CPurenessLineApp() -{ - // TODO: ڴ˴ӹ룬 - // Ҫijʼ InitInstance -} - - -// Ψһһ CPurenessLineApp - -CPurenessLineApp theApp; - - -// CPurenessLineApp ʼ - -BOOL CPurenessLineApp::InitInstance() -{ - // һ Windows XP ϵӦó嵥ָҪ - // ʹ ComCtl32.dll 汾 6 ߰汾ÿӻʽ - //Ҫ InitCommonControlsEx()򣬽޷ڡ - INITCOMMONCONTROLSEX InitCtrls; - InitCtrls.dwSize = sizeof(InitCtrls); - // ΪҪӦóʹõ - // ؼࡣ - InitCtrls.dwICC = ICC_WIN95_CLASSES; - InitCommonControlsEx(&InitCtrls); - - CWinAppEx::InitInstance(); - - AfxEnableControlContainer(); - - // ׼ʼ - // δʹЩܲϣС - // տִļĴСӦƳ - // Ҫضʼ - // ڴ洢õע - // TODO: Ӧʵ޸ĸַ - // ޸Ϊ˾֯ - SetRegistryKey(_T("ӦóɵıӦó")); - - CPurenessLineDlg dlg; - m_pMainWnd = &dlg; - INT_PTR nResponse = dlg.DoModal(); - if (nResponse == IDOK) - { - // TODO: ڴ˷ôʱ - // ȷرնԻĴ - } - else if (nResponse == IDCANCEL) - { - // TODO: ڴ˷ôʱ - // ȡرնԻĴ - } - - // ڶԻѹرգԽ FALSE Ա˳Ӧó - // ӦóϢá - return FALSE; -} diff --git a/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.h b/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.h deleted file mode 100644 index 8d2c9a7fe..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.h +++ /dev/null @@ -1,32 +0,0 @@ - -// PurenessLine.h : PROJECT_NAME Ӧóͷļ -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error "ڰļ֮ǰstdafx.h PCH ļ" -#endif - -#include "resource.h" // - - -// CPurenessLineApp: -// йشʵ֣ PurenessLine.cpp -// - -class CPurenessLineApp : public CWinAppEx -{ -public: - CPurenessLineApp(); - -// д - public: - virtual BOOL InitInstance(); - -// ʵ - - DECLARE_MESSAGE_MAP() -}; - -extern CPurenessLineApp theApp; \ No newline at end of file diff --git a/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.rc b/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.rc deleted file mode 100644 index 9fe2516df..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.rc +++ /dev/null @@ -1,180 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#ifndef APSTUDIO_INVOKED -#include "targetver.h" -#endif -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Chinese (P.R.C.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -#ifdef _WIN32 -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -#pragma code_page(936) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#ifndef APSTUDIO_INVOKED\r\n" - "#include ""targetver.h""\r\n" - "#endif\r\n" - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n" - "LANGUAGE 4, 2\r\n" - "#pragma code_page(936)\r\n" - "#include ""res\\PurenessLine.rc2"" // ?? Microsoft Visual C++ ??-|??o???\r\n" - "#include ""l.CHS\\afxres.rc"" // ?o???|?t\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON "res\\PurenessLine.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PURENESSLINE_DIALOG DIALOGEX 0, 0, 461, 276 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "PurenessLine Client" -FONT 9, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "",IDC_CPUVIEW,"Static",SS_BITMAP,15,17,20,20 - GROUPBOX "CPU",IDC_STATIC,7,7,313,122 - GROUPBOX "ڴ",IDC_STATIC,7,133,313,136 - CONTROL "",IDC_MEMORYVIEW,"Static",SS_BITMAP,14,145,13,12 - EDITTEXT IDC_EDIT1,388,7,66,14,ES_AUTOHSCROLL - LTEXT "IPַ",IDC_STATIC,338,9,45,8 - EDITTEXT IDC_EDIT2,388,26,66,14,ES_AUTOHSCROLL - LTEXT "˿",IDC_STATIC,339,29,40,8 - PUSHBUTTON "ʼ",IDC_BUTTON1,339,47,50,14 - PUSHBUTTON "ȡ",IDC_BUTTON2,397,46,50,14 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080403a8" - BEGIN - VALUE "CompanyName", "TODO: <˾>" - VALUE "FileDescription", "TODO: <ļ˵>" - VALUE "FileVersion", "1.0.0.1" - VALUE "InternalName", "PurenessLine.exe" - VALUE "LegalCopyright", "TODO: (C) <˾>Ȩ" - VALUE "OriginalFilename", "PurenessLine.exe" - VALUE "ProductName", "TODO: <Ʒ>" - VALUE "ProductVersion", "1.0.0.1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x804, 936 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_PURENESSLINE_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 454 - TOPMARGIN, 7 - BOTTOMMARGIN, 269 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Chinese (P.R.C.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -LANGUAGE 4, 2 -#pragma code_page(936) -#include "res\PurenessLine.rc2" // ? Microsoft Visual C++ ?-?? -#include "l.CHS\afxres.rc" // ??t -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.vcproj b/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.vcproj deleted file mode 100644 index 633ebe73b..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/PurenessLine.vcproj +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/PssSampleClient/PurenessLine/PurenessLine/PurenessLineDlg.cpp b/PssSampleClient/PurenessLine/PurenessLine/PurenessLineDlg.cpp deleted file mode 100644 index 06ed02f02..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/PurenessLineDlg.cpp +++ /dev/null @@ -1,309 +0,0 @@ - -// PurenessLineDlg.cpp : ʵļ -// - -#include "stdafx.h" -#include "PurenessLine.h" -#include "PurenessLineDlg.h" - -#ifdef _DEBUG -#define new DEBUG_NEW -#endif - - -// CPurenessLineDlg Ի - - - - -CPurenessLineDlg::CPurenessLineDlg(CWnd* pParent /*=NULL*/) - : CDialog(CPurenessLineDlg::IDD, pParent) -{ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); -} - -void CPurenessLineDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_CPUVIEW, m_cvCPU); - DDX_Control(pDX, IDC_MEMORYVIEW, m_cvMemory); - DDX_Control(pDX, IDC_EDIT1, m_txtServerIP); - DDX_Control(pDX, IDC_EDIT2, m_txtServerPort); -} - -BEGIN_MESSAGE_MAP(CPurenessLineDlg, CDialog) - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - ON_CONTROL(CVN_ViewPortChanged, IDC_CPUVIEW, OnViewPortChanged) - //}}AFX_MSG_MAP - ON_WM_CLOSE() - ON_WM_TIMER() - ON_BN_CLICKED(IDC_BUTTON1, &CPurenessLineDlg::OnBnClickedButton1) -END_MESSAGE_MAP() - - -// CPurenessLineDlg Ϣ - -BOOL CPurenessLineDlg::OnInitDialog() -{ - CDialog::OnInitDialog(); - - // ô˶ԻͼꡣӦóڲǶԻʱܽԶ - // ִд˲ - SetIcon(m_hIcon, TRUE); // ôͼ - SetIcon(m_hIcon, FALSE); // Сͼ - - // TODO: ڴӶijʼ - InitView(); - - return TRUE; // ǽõؼ򷵻 TRUE -} - -void CPurenessLineDlg::InitView() -{ - m_blState = FALSE; - AfxSocketInit(); - - //ʼб - for(int i = 0; i < MAX_DATA_COUNT; i++) - { - m_dbCPU[i] = 0.0; - m_dbMemory[i] = 0.0; - } - - // - InitRandom(); - - //ʱ - SetTimer(TIMER_ID, TIMER_INTERVAL, 0); - - //Ӧͼ - drawChart(); -} - -BOOL CPurenessLineDlg::GetServerStateInfo(_ServerRunInfo& objServerRunInfo) -{ - if(m_blState == FALSE) - { - return FALSE; - } - - //ƴӷЭ - char szSendDate[100] = {'\0'}; - char szCommand[100] = {'\0'}; - size_t stSendEnd = 0; - - sprintf_s(szCommand, 100, "ShowCurrProcessInfo -a"); - int nAllLen = (int)strlen(szCommand); - memcpy(&szSendDate[0], (const void*)&nAllLen, sizeof(int)); - memcpy(&szSendDate[4], (const void*)&szCommand, nAllLen); - - // - int nSend = m_sckServer.Send(szSendDate, nAllLen + 4); - if(nSend != nAllLen + 4) - { - return FALSE; - } - - // - char szBuffRecv[200] = {'\0'}; - m_sckServer.Receive(szBuffRecv, 200); - - int nStrLen = 0; - int nPos = 4; - int nClientCount = 0; - //߳ - memcpy(&objServerRunInfo.m_nCPU, &szBuffRecv[nPos], sizeof(int)); - nPos += sizeof(int); - memcpy(&objServerRunInfo.m_nMemorySize, &szBuffRecv[nPos], sizeof(int)); - nPos += sizeof(int); - - return TRUE; -} - -// ԻСťҪĴ -// Ƹͼꡣʹĵ/ͼģ͵ MFC Ӧó -// ⽫ɿԶɡ - -void CPurenessLineDlg::OnViewPortChanged() -{ - _ServerRunInfo objServerRunInfo; - if(GetServerStateInfo(objServerRunInfo) == TRUE) - { - // - double dbData = (double)RandomValue(1, 100); - shiftData(m_dbCPU, MAX_DATA_COUNT, (double)objServerRunInfo.m_nCPU/100.0); - - dbData = (double)RandomValue(1, 100); - shiftData(m_dbMemory, MAX_DATA_COUNT, (double)objServerRunInfo.m_nMemorySize/(1000*1000)); - - //Ӧͼ - drawChart(); - } - else - { - // - double dbData = 0.0; - shiftData(m_dbCPU, MAX_DATA_COUNT, (double)objServerRunInfo.m_nCPU/100.0); - - dbData = 0.0; - shiftData(m_dbMemory, MAX_DATA_COUNT, (double)objServerRunInfo.m_nMemorySize/(1000*1000)); - - //Ӧͼ - drawChart(); - } -} - -void CPurenessLineDlg::OnPaint() -{ - if (IsIconic()) - { - CPaintDC dc(this); // ڻƵ豸 - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // ʹͼڹо - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // ͼ - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } -} - -//û϶Сʱϵͳô˺ȡù -//ʾ -HCURSOR CPurenessLineDlg::OnQueryDragIcon() -{ - return static_cast(m_hIcon); -} - - -void CPurenessLineDlg::OnClose() -{ - // TODO: Add your message handler code here and/or call default - - CDialog::OnClose(); -} - -void CPurenessLineDlg::drawChart() -{ - const char* szLabels[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", - "24"}; - - XYChart* pXYCPU = NULL; - XYChart* pXYMemory = NULL; - - //ĬϴС(CPU) - pXYCPU = new XYChart(410, 220, 0xeeeeff, 0x000000, 1); - pXYCPU->setRoundedFrame(); - - //X± - pXYCPU->xAxis()->setLabels(StringArray(szLabels, (int)(sizeof(szLabels) / sizeof(szLabels[0])))); - - //λ - pXYCPU->setPlotArea(30, 20, 360, 160, 0x000200, -1, -1, 0x337f59); - - //һµ߲ - LineLayer* pLayer = pXYCPU->addLineLayer(); - - if(NULL != pLayer) - { - pLayer->setLineWidth(2); - pLayer->addDataSet(DoubleArray(m_dbCPU, (int)(sizeof(m_dbCPU) / sizeof(m_dbCPU[0]))), 0xff0000, "Server #1"); - } - - //ƶChart󶨸ָؼ - m_cvCPU.setChart(pXYCPU); - delete pXYCPU; - - //ĬϴС(Memory) - pXYMemory = new XYChart(410, 220, 0xeeeeff, 0x000000, 1); - pXYMemory->setRoundedFrame(); - - //X± - pXYMemory->xAxis()->setLabels(StringArray(szLabels, (int)(sizeof(szLabels) / sizeof(szLabels[0])))); - - //λ - pXYMemory->setPlotArea(30, 20, 360, 160, 0x000200, -1, -1, 0x337f59); - - //һµ߲ - pLayer = pXYMemory->addLineLayer(); - - if(NULL != pLayer) - { - pLayer->setLineWidth(2); - pLayer->addDataSet(DoubleArray(m_dbMemory, (int)(sizeof(m_dbMemory) / sizeof(m_dbMemory[0]))), 0xff0000, "Server #1"); - } - - //ƶChart󶨸ָؼ - m_cvMemory.setChart(pXYMemory); - delete pXYMemory; -} - -void CPurenessLineDlg::shiftData(double *data, int len, double newValue) -{ - memmove(data, data + 1, sizeof(*data) * (len - 1)); - data[len - 1] = newValue; -} - -void CPurenessLineDlg::OnTimer(UINT_PTR nIDEvent) -{ - // TODO: Add your message handler code here and/or call default - if(nIDEvent == TIMER_ID); - { - m_cvCPU.updateViewPort(true, true); - } - - CDialog::OnTimer(nIDEvent); -} - -void CPurenessLineDlg::OnBnClickedButton1() -{ - // TODO: Add your control notification handler code here - CString strServerIP; - CString strServerPort; - - int nPort = 0; - - m_txtServerIP.GetWindowText(strServerIP); - m_txtServerPort.GetWindowText(strServerPort); - - if(strServerIP.GetLength() == 0 || strServerPort.GetLength() == 0) - { - MessageBox(_T("ķIPPort"), _T("Ϣ"), MB_OK); - return; - } - - //˿ڵַ - nPort = _wtoi((LPCTSTR)strServerPort); - - m_sckServer.Close(); - - BOOL blFlag = m_sckServer.Create(); - if(FALSE == blFlag) - { - MessageBox(_T("ʼSocketʧܡ"), _T("Ϣ"), MB_OK); - return; - } - - blFlag = m_sckServer.Connect((LPCTSTR)strServerIP, nPort); - if(FALSE == blFlag) - { - wchar_t szError[100] = {'\0'}; - wsprintf(szError, _T("[%s]˿[%d]ʧܣerror[%d]"), (LPCTSTR)strServerIP, nPort, GetLastError()); - MessageBox((LPCTSTR)szError, _T("Ϣ"), MB_OK); - return; - } - - m_blState = TRUE; -} diff --git a/PssSampleClient/PurenessLine/PurenessLine/PurenessLineDlg.h b/PssSampleClient/PurenessLine/PurenessLine/PurenessLineDlg.h deleted file mode 100644 index 24f15fab1..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/PurenessLineDlg.h +++ /dev/null @@ -1,94 +0,0 @@ - -// PurenessLineDlg.h : ͷļ -// - -#pragma once - -#include "ChartViewer.h" -#include -#include -#include "afxwin.h" -#include - -//ʱϢ -struct _ServerRunInfo -{ - int m_nCPU; //ǰCPUռ - int m_nMemorySize; //ǰڴռ - - _ServerRunInfo() - { - m_nCPU = 0; - m_nMemorySize = 0; - } - - _ServerRunInfo& operator = (const _ServerRunInfo& ar) - { - this->m_nCPU = ar.m_nCPU; - this->m_nMemorySize = ar.m_nMemorySize; - return *this; - } -}; - -//һ -inline void InitRandom() -{ - srand((int)time(NULL)); -}; - -//һֵлȡһֵ -inline int RandomValue(int nMin, int nMax) -{ - return nMin + (int) (nMax * (rand() / (RAND_MAX + 1.0))); -}; - -#define TIMER_ID 1 //ʱID -#define TIMER_INTERVAL 1000 //ʱ -#define MAX_DATA_COUNT 25 // - -// CPurenessLineDlg Ի -class CPurenessLineDlg : public CDialog -{ -// -public: - CPurenessLineDlg(CWnd* pParent = NULL); // ׼캯 - -// Ի - enum { IDD = IDD_PURENESSLINE_DIALOG }; - - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - - -// ʵ -protected: - HICON m_hIcon; - - // ɵϢӳ亯 - virtual BOOL OnInitDialog(); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - afx_msg void OnClose(); - afx_msg void OnViewPortChanged(); - afx_msg void OnTimer(UINT_PTR nIDEvent); - DECLARE_MESSAGE_MAP() - - CEdit m_txtServerIP; - CEdit m_txtServerPort; - afx_msg void OnBnClickedButton1(); - -private: - void shiftData(double *data, int len, double newValue); - void drawChart(); - void InitView(); - BOOL GetServerStateInfo(_ServerRunInfo& objServerRunInfo); - -private: - CChartViewer m_cvCPU; //CPUʹ - CChartViewer m_cvMemory; //ڴʹ - double m_dbCPU[MAX_DATA_COUNT]; - double m_dbMemory[MAX_DATA_COUNT]; - CSocket m_sckServer; //ԶServer - bool m_blState; //״̬ - -}; diff --git a/PssSampleClient/PurenessLine/PurenessLine/ReadMe.txt b/PssSampleClient/PurenessLine/PurenessLine/ReadMe.txt deleted file mode 100644 index 07a0d7012..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/ReadMe.txt +++ /dev/null @@ -1,66 +0,0 @@ -================================================================================ - MICROSOFT : PurenessLine Ŀ -=============================================================================== - -ӦóΪ PurenessLine Ӧó򡣴Ӧó򲻽ʾʹ Microsoft Ļ֪ʶҿΪдӦó㡣 - -ļ PurenessLine ӦóĸļժҪ - -PurenessLine.vcproj - ʹӦóɵ VC++ ĿĿļ - йļ Visual C++ 汾ϢԼйʹӦóѡƽ̨úĿܵϢ - -PurenessLine.h - ӦóҪͷļĿضͷļ( Resource.h) CPurenessLineApp Ӧóࡣ - -PurenessLine.cpp - ǰӦó CPurenessLineApp ҪӦóԴļ - -PurenessLine.rc - dzʹõ Microsoft Windows Դб RES Ŀ¼д洢ͼꡢλͼ͹ꡣļֱ Microsoft Visual C++ нб༭ĿԴλ 2052 С - -res\PurenessLine.ico - ӦóͼͼļͼҪԴļ PurenessLine.rc С - -res\PurenessLine.rc2 - ļ Microsoft Visual C++ ༭ԴӦýԴ༭༭ԴڴļС - - -///////////////////////////////////////////////////////////////////////////// - -Ӧó򵼴һԻ: - -PurenessLineDlg.hPurenessLineDlg.cpp - Ի - Щļ CPurenessLineDlg ࡣඨӦóԻΪöԻģλ PurenessLine.rc Уļ Microsoft Visual C++ нб༭ - - -///////////////////////////////////////////////////////////////////////////// - -: - -ActiveX ؼ - Ӧóʹ ActiveX ؼ֧֡ - -///////////////////////////////////////////////////////////////////////////// - -׼ļ: - -StdAfx.h, StdAfx.cpp - ЩļΪ PurenessLine.pch Ԥͷ(PCH)ļΪ StdAfx.obj Ԥļ - -Resource.h - DZ׼ͷļԴ ID - Microsoft Visual C++ ȡ´ļ - -PurenessLine.manifest - Windows XP ʹӦó嵥ļӦó ض汾г򼯵ԡسʹô Ϣӳ򼯻Ӧ򼯻 Ӧó˽ϢӦó嵥Ϊ Ӧóִļװͬһļеⲿ .manifest ļԱ· ҲԴʽڸÿִļС -///////////////////////////////////////////////////////////////////////////// - -ע: - -ӦóʹáTODO:ָʾӦӻԶԴ벿֡ - -Ӧóڹ DLL ʹ MFC,Ҫ· MFC DLLӦóϵͳòͬҲ·ӦıػԴ MFC90XXX.DLL -йϸϢ MSDN ĵй· Visual C++ ӦóIJ֡ - -///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/PssSampleClient/PurenessLine/PurenessLine/include/FinanceChart.h b/PssSampleClient/PurenessLine/PurenessLine/include/FinanceChart.h deleted file mode 100644 index 0fbdb1cd8..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/include/FinanceChart.h +++ /dev/null @@ -1,2369 +0,0 @@ -#ifndef FINANCECHART_HDR -#define FINANCECHART_HDR - -#include "chartdir.h" -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Copyright 2012 Advanced Software Engineering Limited -// -// ChartDirector FinanceChart class library -// - Requires ChartDirector Ver 5.1 or above -// -// You may use and modify the code in this file in your application, provided the code and -// its modifications are used only in conjunction with ChartDirector. Usage of this software -// is subjected to the terms and condition of the ChartDirector license. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4996) -#endif - -/// -/// Represents a Financial Chart -/// -class FinanceChart : public MultiChart -{ - int m_totalWidth; - int m_totalHeight; - bool m_antiAlias; - bool m_logScale; - bool m_axisOnRight; - - int m_leftMargin; - int m_rightMargin; - int m_topMargin; - int m_bottomMargin; - - int m_plotAreaBgColor; - int m_plotAreaBorder; - int m_plotAreaGap; - - int m_majorHGridColor; - int m_minorHGridColor; - int m_majorVGridColor; - int m_minorVGridColor; - - std::string m_legendFont; - double m_legendFontSize; - int m_legendFontColor; - int m_legendBgColor; - - std::string m_yAxisFont; - double m_yAxisFontSize; - int m_yAxisFontColor; - int m_yAxisMargin; - - std::string m_xAxisFont; - double m_xAxisFontSize; - int m_xAxisFontColor; - double m_xAxisFontAngle; - - DoubleArray m_timeStamps; - DoubleArray m_highData; - DoubleArray m_lowData; - DoubleArray m_openData; - DoubleArray m_closeData; - DoubleArray m_volData; - std::string m_volUnit; - int m_extraPoints; - - std::string m_yearFormat; - std::string m_firstMonthFormat; - std::string m_otherMonthFormat; - std::string m_firstDayFormat; - std::string m_otherDayFormat; - std::string m_firstHourFormat; - std::string m_otherHourFormat; - int m_timeLabelSpacing; - - std::string m_generalFormat; - - std::string m_toolTipMonthFormat; - std::string m_toolTipDayFormat; - std::string m_toolTipHourFormat; - - XYChart *m_mainChart; - XYChart *m_currentChart; - std::vector garbage; - - private: void init() - { - m_totalWidth = 0; - m_totalHeight = 0; - m_antiAlias = true; - m_logScale = false; - m_axisOnRight = true; - - m_leftMargin = 40; - m_rightMargin = 40; - m_topMargin = 30; - m_bottomMargin = 35; - - m_plotAreaBgColor = 0xffffff; - m_plotAreaBorder = 0x888888; - m_plotAreaGap = 2; - - m_majorHGridColor = 0xdddddd; - m_minorHGridColor = 0xdddddd; - m_majorVGridColor = 0xdddddd; - m_minorVGridColor = 0xdddddd; - - m_legendFont = "normal"; - m_legendFontSize = 8; - m_legendFontColor = Chart::TextColor; - m_legendBgColor = 0x80cccccc; - - m_yAxisFont = "normal"; - m_yAxisFontSize = 8; - m_yAxisFontColor = Chart::TextColor; - m_yAxisMargin = 14; - - m_xAxisFont = "normal"; - m_xAxisFontSize = 8; - m_xAxisFontColor = Chart::TextColor; - m_xAxisFontAngle = 0; - - m_volUnit = ""; - m_extraPoints = 0; - - m_yearFormat = "{value|yyyy}"; - m_firstMonthFormat = "<*font=bold*>{value|mmm yy}"; - m_otherMonthFormat = "{value|mmm}"; - m_firstDayFormat = "<*font=bold*>{value|d mmm}"; - m_otherDayFormat = "{value|d}"; - m_firstHourFormat = "<*font=bold*>{value|d mmm\nh:nna}"; - m_otherHourFormat = "{value|h:nna}"; - m_timeLabelSpacing = 50; - - m_generalFormat = "P3"; - - m_toolTipMonthFormat = "[{xLabel|mmm yyyy}]"; - m_toolTipDayFormat = "[{xLabel|mmm d, yyyy}]"; - m_toolTipHourFormat = "[{xLabel|mmm d, yyyy hh:nn:ss}]"; - - m_mainChart = 0; - m_currentChart = 0; - } - - /// - /// Create a FinanceChart with a given width. The height will be automatically determined - /// as the chart is built. - /// - /// Width of the chart in pixels - public: FinanceChart(int width): MultiChart(width, 1) - { - init(); - m_totalWidth = width; - setMainChart(this); - } - - // free resources - public: ~FinanceChart() - { - delete[] const_cast(m_timeStamps.data); - delete[] const_cast(m_highData.data); - delete[] const_cast(m_lowData.data); - delete[] const_cast(m_openData.data); - delete[] const_cast(m_closeData.data); - delete[] const_cast(m_volData.data); - - for (int i = 0; i < (int)garbage.size(); ++i) - delete garbage[i]; - } - - // disable copying - private: FinanceChart(const FinanceChart &rhs); - private: FinanceChart &operator=(const FinanceChart &rhs); - - /// - /// Enable/Disable anti-alias. Enabling anti-alias makes the line smoother. Disabling - /// anti-alias make the chart file size smaller, and so can be downloaded faster - /// through the Internet. The default is to enable anti-alias. - /// - /// True to enable anti-alias. False to disable anti-alias. - public: void enableAntiAlias(bool antiAlias) - { - m_antiAlias = antiAlias; - } - - /// - /// Set the margins around the plot area. - /// - /// The distance between the plot area and the chart left edge. - /// The distance between the plot area and the chart top edge. - /// The distance between the plot area and the chart right edge. - /// The distance between the plot area and the chart bottom edge. - public: void setMargins(int leftMargin, int topMargin, int rightMargin, int bottomMargin) - { - m_leftMargin = leftMargin; - m_rightMargin = rightMargin; - m_topMargin = topMargin; - m_bottomMargin = bottomMargin; - } - - /// - /// Add a text title above the plot area. You may add multiple title above the plot area by - /// calling this method multiple times. - /// - /// The alignment with respect to the region that is on top of the - /// plot area. - /// The text to add. - /// The TextBox object representing the text box above the plot area. - public: TextBox* addPlotAreaTitle(int alignment, const char* text) - { - TextBox *ret = addText(m_leftMargin, 0, text, "bold", 10, Chart::TextColor, alignment); - ret->setSize(m_totalWidth - m_leftMargin - m_rightMargin + 1, m_topMargin - 1); - ret->setMargin(0); - return ret; - } - - /// - /// Set the plot area style. The default is to use pale yellow 0xfffff0 as the background, - /// and light grey 0xdddddd as the grid lines. - /// - /// The plot area background color. - /// Major horizontal grid color. - /// Major vertical grid color. - /// Minor horizontal grid color. In current version, minor - /// horizontal grid is not used. - /// Minor vertical grid color. - public: void setPlotAreaStyle(int bgColor, int majorHGridColor, int majorVGridColor, - int minorHGridColor, int minorVGridColor) - { - m_plotAreaBgColor = bgColor; - m_majorHGridColor = majorHGridColor; - m_majorVGridColor = majorVGridColor; - m_minorHGridColor = minorHGridColor; - m_minorVGridColor = minorVGridColor; - } - - /// - /// Set the plot area border style. The default is grey color (888888), with a gap - /// of 2 pixels between charts. - /// - /// The color of the border. - /// The gap between two charts. - public: void setPlotAreaBorder(int borderColor, int borderGap) - { - m_plotAreaBorder = borderColor; - m_plotAreaGap = borderGap; - } - - /// - /// Set legend style. The default is Arial 8 pt black color, with light grey background. - /// - /// The font of the legend text. - /// The font size of the legend text in points. - /// The color of the legend text. - /// The background color of the legend box. - public: void setLegendStyle(const char* font, double fontSize, int fontColor, int bgColor) - { - m_legendFont = font; - m_legendFontSize = fontSize; - m_legendFontColor = fontColor; - m_legendBgColor = bgColor; - } - - /// - /// Set x-axis label style. The default is Arial 8 pt black color no rotation. - /// - /// The font of the axis labels. - /// The font size of the axis labels in points. - /// The color of the axis labels. - /// The rotation of the axis labels. - public: void setXAxisStyle(const char* font, double fontSize, int fontColor, double fontAngle) - { - m_xAxisFont = font; - m_xAxisFontSize = fontSize; - m_xAxisFontColor = fontColor; - m_xAxisFontAngle = fontAngle; - } - - /// - /// Set y-axis label style. The default is Arial 8 pt black color, with 13 pixels margin. - /// - /// The font of the axis labels. - /// The font size of the axis labels in points. - /// The color of the axis labels. - /// The margin at the top of the y-axis in pixels (to leave - /// space for the legend box). - public: void setYAxisStyle(const char* font, double fontSize, int fontColor, int axisMargin) - { - m_yAxisFont = font; - m_yAxisFontSize = fontSize; - m_yAxisFontColor = fontColor; - m_yAxisMargin = axisMargin; - } - - /// - /// Set whether the main y-axis is on right of left side of the plot area. The default is - /// on right. - /// - /// True if the y-axis is on right. False if the y-axis is on left. - public: void setAxisOnRight(bool b) - { - m_axisOnRight = b; - } - - /// - /// Determines if log scale should be used for the main chart. The default is linear scale. - /// - /// True for using log scale. False for using linear scale. - public: void setLogScale(bool b) - { - m_logScale = b; - if (m_mainChart != 0) { - if (m_logScale) { - m_mainChart->yAxis()->setLogScale(); - } else { - m_mainChart->yAxis()->setLinearScale(); - } - } - } - - /// - /// Set the date/time formats to use for the x-axis labels under various cases. - /// - /// The format for displaying labels on an axis with yearly ticks. The - /// default is "yyyy". - /// The format for displaying labels on an axis with monthly ticks. - /// This parameter applies to the first available month of a year (usually January) only, so it can - /// be formatted differently from the other labels. - /// The format for displaying labels on an axis with monthly ticks. - /// This parameter applies to months other than the first available month of a year. - /// The format for displaying labels on an axis with daily ticks. - /// This parameter applies to the first available day of a month only, so it can be formatted - /// differently from the other labels. - /// The format for displaying labels on an axis with daily ticks. - /// This parameter applies to days other than the first available day of a month. - /// The format for displaying labels on an axis with hourly - /// resolution. This parameter applies to the first tick of a day only, so it can be formatted - /// differently from the other labels. - /// The format for displaying labels on an axis with hourly. - /// resolution. This parameter applies to ticks at hourly boundaries, except the first tick - /// of a day. - public: void setDateLabelFormat(const char* yearFormat, const char* firstMonthFormat, - const char* otherMonthFormat, const char* firstDayFormat, const char* otherDayFormat, - const char* firstHourFormat, const char* otherHourFormat) - { - if (yearFormat != 0) { - m_yearFormat = yearFormat; - } - if (firstMonthFormat != 0) { - m_firstMonthFormat = firstMonthFormat; - } - if (otherMonthFormat != 0) { - m_otherMonthFormat = otherMonthFormat; - } - if (firstDayFormat != 0) { - m_firstDayFormat = firstDayFormat; - } - if (otherDayFormat != 0) { - m_otherDayFormat = otherDayFormat; - } - if (firstHourFormat != 0) { - m_firstHourFormat = firstHourFormat; - } - if (otherHourFormat != 0) { - m_otherHourFormat = otherHourFormat; - } - } - - /// - /// Set the minimum label spacing between two labels on the time axis - /// - /// The minimum label spacing in pixels. - public: void setDateLabelSpacing(int labelSpacing) - { - if (labelSpacing > 0) { - m_timeLabelSpacing = labelSpacing; - } else { - m_timeLabelSpacing = 0; - } - } - - /// - /// Set the tool tip formats for display date/time - /// - /// The tool tip format to use if the data point spacing is one - /// or more months (more than 30 days). - /// The tool tip format to use if the data point spacing is 1 day - /// to less than 30 days. - /// The tool tip format to use if the data point spacing is less - /// than 1 day. - public: void setToolTipDateFormat(const char* monthFormat, const char* dayFormat, - const char* hourFormat) - { - if (monthFormat != 0) { - m_toolTipMonthFormat = monthFormat; - } - if (dayFormat != 0) { - m_toolTipDayFormat = dayFormat; - } - if (hourFormat != 0) { - m_toolTipHourFormat = hourFormat; - } - } - - /// - /// Get the tool tip format for display date/time - /// - /// The tool tip format string. - public: const char *getToolTipDateFormat() - { - if (m_timeStamps.len == 0) { - return m_toolTipHourFormat.c_str(); - } - if (m_timeStamps.len <= m_extraPoints) { - return m_toolTipHourFormat.c_str(); - } - double resolution = (m_timeStamps[m_timeStamps.len - 1] - - m_timeStamps[0]) / m_timeStamps.len; - if (resolution >= 30 * 86400) { - return m_toolTipMonthFormat.c_str(); - } else if (resolution >= 86400) { - return m_toolTipDayFormat.c_str(); - } else { - return m_toolTipHourFormat.c_str(); - } - } - - /// - /// Set the number format for use in displaying values in legend keys and tool tips. - /// - /// The default number format. - public: void setNumberLabelFormat(const char* formatString) - { - if (formatString != 0) { - m_generalFormat = formatString; - } - } - - /// - /// A utility function to compute triangular moving averages - /// - /// An array of numbers as input. - /// The moving average period. - /// An array representing the triangular moving average of the input array. - private: ArrayMath computeTriMovingAvg(DoubleArray data, int period) - { - int p = period / 2 + 1; - return ArrayMath(data).movAvg(p).movAvg(p); - } - - /// - /// A utility function to compute weighted moving averages - /// - /// An array of numbers as input. - /// The moving average period. - /// An array representing the weighted moving average of the input array. - private: ArrayMath computeWeightedMovingAvg(DoubleArray data, int period) - { - ArrayMath acc(data); - int i; - for(i = 2; i < period + 1; ++i) { - acc.add(ArrayMath(data).movAvg(i).mul(i)); - } - return acc.div((1 + period) * period / 2); - } - - /// - /// A utility function to obtain the first visible closing price. - /// - /// The first closing price. - /// are cd.NoValue. - private: double firstCloseValue() - { - for(int i = m_extraPoints; i < m_closeData.len; ++i) { - if ((m_closeData[i] != Chart::NoValue) && (m_closeData[i] != 0)) { - return m_closeData[i]; - } - } - return Chart::NoValue; - } - - /// - /// A utility function to obtain the last valid position (that is, position not - /// containing cd.NoValue) of a data series. - /// - /// An array of numbers as input. - /// The last valid position in the input array, or -1 if all positions - /// are cd.NoValue. - private: int lastIndex(DoubleArray data) - { - int i = data.len - 1; - while (i >= 0) { - if (data[i] != Chart::NoValue) { - break; - } - i = i - 1; - } - return i; - } - - //deep copy array - private: void deepCopy(DoubleArray &dest, DoubleArray src) - { - if (src.len > dest.len) - { - delete[] const_cast(dest.data); - dest.data = new double[src.len]; - } - memcpy(const_cast(dest.data), src.data, src.len * sizeof(double)); - dest.len = src.len; - } - - /// - /// Set the data used in the chart. If some of the data are not available, some artifical - /// values should be used. For example, if the high and low values are not available, you - /// may use closeData as highData and lowData. - /// - /// An array of dates/times for the time intervals. - /// The high values in the time intervals. - /// The low values in the time intervals. - /// The open values in the time intervals. - /// The close values in the time intervals. - /// The volume values in the time intervals. - /// The number of leading time intervals that are not - /// displayed in the chart. These intervals are typically used for computing - /// indicators that require extra leading data, such as moving averages. - public: void setData(DoubleArray timeStamps, DoubleArray highData, DoubleArray lowData, - DoubleArray openData, DoubleArray closeData, DoubleArray volData, int extraPoints) - { - deepCopy(m_timeStamps, timeStamps); - deepCopy(m_highData, highData); - deepCopy(m_lowData, lowData); - deepCopy(m_openData, openData); - deepCopy(m_closeData, closeData); - if (extraPoints > 0) { - m_extraPoints = extraPoints; - } else { - m_extraPoints = 0; - } - - ///////////////////////////////////////////////////////////////////////// - // Auto-detect volume units - ///////////////////////////////////////////////////////////////////////// - double maxVol = ArrayMath(volData).maxValue(); - const char *units[] = {"", "K", "M", "B"}; - int unitIndex = sizeof(units) / sizeof(units[0]) - 1; - while ((unitIndex > 0) && (maxVol < pow(1000.0, unitIndex))) { - unitIndex = unitIndex - 1; - } - - deepCopy(m_volData, ArrayMath(volData).div(pow(1000.0, unitIndex))); - m_volUnit = units[unitIndex]; - } - - ////////////////////////////////////////////////////////////////////////////// - // Format x-axis labels - ////////////////////////////////////////////////////////////////////////////// - private: void setXLabels(Axis* a) - { - a->setLabels(m_timeStamps); - if (m_extraPoints < m_timeStamps.len) { - int tickStep = (m_timeStamps.len - m_extraPoints) * - m_timeLabelSpacing / (m_totalWidth - m_leftMargin - m_rightMargin) + 1; - double timeRangeInSeconds = m_timeStamps[m_timeStamps.len - - 1] - m_timeStamps[m_extraPoints]; - double secondsBetweenTicks = timeRangeInSeconds / (m_totalWidth - m_leftMargin - - m_rightMargin) * m_timeLabelSpacing; - - if (secondsBetweenTicks * (m_timeStamps.len - m_extraPoints) <= timeRangeInSeconds) { - tickStep = 1; - if (m_timeStamps.len > 1) - secondsBetweenTicks = m_timeStamps[m_timeStamps.len - 1] - m_timeStamps[m_timeStamps.len - 2]; - else - secondsBetweenTicks = 86400; - } - - if ((secondsBetweenTicks > 360 * 86400) || ((secondsBetweenTicks > 90 * 86400) && (timeRangeInSeconds >= 720 * 86400))) { - //yearly ticks - a->setMultiFormat(Chart::StartOfYearFilter(), m_yearFormat.c_str(), tickStep); - } else if ((secondsBetweenTicks >= 30 * 86400) || ((secondsBetweenTicks > 7 * 86400) && (timeRangeInSeconds >= 60 * 86400))) { - //monthly ticks - int monthBetweenTicks = (int)(secondsBetweenTicks / 31 / 86400) + 1; - a->setMultiFormat(Chart::StartOfYearFilter(), m_firstMonthFormat.c_str(), - Chart::StartOfMonthFilter(monthBetweenTicks), m_otherMonthFormat.c_str()); - a->setMultiFormat(Chart::StartOfMonthFilter(), "-", 1, false); - } else if ((secondsBetweenTicks >= 86400) || ((secondsBetweenTicks > 6 * 3600) & (timeRangeInSeconds >= 86400))) { - //daily ticks - a->setMultiFormat(Chart::StartOfMonthFilter(), m_firstDayFormat.c_str(), - Chart::StartOfDayFilter(1, 0.5), m_otherDayFormat.c_str(), tickStep); - } else { - //hourly ticks - a->setMultiFormat(Chart::StartOfDayFilter(1, 0.5), m_firstHourFormat.c_str(), - Chart::StartOfHourFilter(1, 0.5), m_otherHourFormat.c_str(), tickStep); - } - } - } - - ////////////////////////////////////////////////////////////////////////////// - // Create tool tip format string for showing OHLC data - ////////////////////////////////////////////////////////////////////////////// - private: std::string getHLOCToolTipFormat() - { - char buffer[1024]; - sprintf(buffer, "title='%s Op:{open|%s}, Hi:{high|%s}, Lo:{low|%s}, Cl:{close|%s}'", - getToolTipDateFormat(), m_generalFormat.c_str(), m_generalFormat.c_str(), m_generalFormat.c_str(), - m_generalFormat.c_str()); - return buffer; - } - - /// - /// Add the main chart - the chart that shows the HLOC data. - /// - /// The height of the main chart in pixels. - /// An XYChart object representing the main chart created. - public: XYChart* addMainChart(int height) - { - m_mainChart = addIndicator(height); - m_mainChart->yAxis()->setMargin(2 * m_yAxisMargin); - if (m_logScale) { - m_mainChart->yAxis()->setLogScale(); - } else { - m_mainChart->yAxis()->setLinearScale(); - } - return m_mainChart; - } - - /// - /// Add a candlestick layer to the main chart. - /// - /// The candle color for an up day. - /// The candle color for a down day. - /// The CandleStickLayer created. - public: CandleStickLayer* addCandleStick(int upColor, int downColor) - { - addOHLCLabel(upColor, downColor, true); - CandleStickLayer *ret = m_mainChart->addCandleStickLayer(m_highData, m_lowData, m_openData, - m_closeData, upColor, downColor); - ret->setHTMLImageMap("", "", getHLOCToolTipFormat().c_str()); - if (m_highData.len - m_extraPoints > 60) { - ret->setDataGap(0); - } - - if (m_highData.len > m_extraPoints) { - int expectedWidth = (m_totalWidth - m_leftMargin - m_rightMargin) / (m_highData.len - m_extraPoints); - if (expectedWidth <= 5) - ret->setDataWidth(expectedWidth + 1 - expectedWidth % 2); - } - - return ret; - } - - /// - /// Add a HLOC layer to the main chart. - /// - /// The color of the HLOC symbol for an up day. - /// The color of the HLOC symbol for a down day. - /// The HLOCLayer created. - public: HLOCLayer* addHLOC(int upColor, int downColor) - { - addOHLCLabel(upColor, downColor, false); - HLOCLayer *ret = m_mainChart->addHLOCLayer(m_highData, m_lowData, m_openData, m_closeData); - ret->setColorMethod(Chart::HLOCUpDown, upColor, downColor); - ret->setHTMLImageMap("", "", getHLOCToolTipFormat().c_str()); - ret->setDataGap(0); - return ret; - } - - private: void addOHLCLabel(int upColor, int downColor, bool candleStickMode) - { - int i = lastIndex(m_closeData); - if (i >= 0) { - double openValue = Chart::NoValue; - double closeValue = Chart::NoValue; - double highValue = Chart::NoValue; - double lowValue = Chart::NoValue; - - if (i < m_openData.len) { - openValue = m_openData[i]; - } - if (i < m_closeData.len) { - closeValue = m_closeData[i]; - } - if (i < m_highData.len) { - highValue = m_highData[i]; - } - if (i < m_lowData.len) { - lowValue = m_lowData[i]; - } - - std::string openLabel = ""; - std::string closeLabel = ""; - std::string highLabel = ""; - std::string lowLabel = ""; - const char *delim = ""; - char buffer[1024]; - - if (openValue != Chart::NoValue) { - sprintf(buffer, "Op:%s", formatValue(openValue, m_generalFormat.c_str())); - openLabel = buffer; - delim = ", "; - } - if (highValue != Chart::NoValue) { - sprintf(buffer, "%sHi:%s", delim, formatValue(highValue, m_generalFormat.c_str())); - highLabel = buffer; - delim = ", "; - } - if (lowValue != Chart::NoValue) { - sprintf(buffer, "%sLo:%s", delim, formatValue(lowValue, m_generalFormat.c_str())); - lowLabel = buffer; - delim = ", "; - } - if (closeValue != Chart::NoValue) { - sprintf(buffer, "%sCl:%s", delim, formatValue(closeValue, m_generalFormat.c_str())); - closeLabel = buffer; - delim = ", "; - } - std::string label = openLabel + highLabel + lowLabel + closeLabel; - - bool useUpColor = (closeValue >= openValue); - if (candleStickMode != true) { - ArrayMath closeChanges = ArrayMath(m_closeData).delta(); - int lastChangeIndex = lastIndex(closeChanges); - useUpColor = (lastChangeIndex < 0); - if (useUpColor != true) { - useUpColor = (closeChanges.result()[lastChangeIndex] >= 0); - } - } - - int udcolor = downColor; - if (useUpColor) { - udcolor = upColor; - } - m_mainChart->getLegend()->addKey(label.c_str(), udcolor); - } - } - - /// - /// Add a closing price line on the main chart. - /// - /// The color of the line. - /// The LineLayer object representing the line created. - public: LineLayer* addCloseLine(int color) - { - return addLineIndicator2(m_mainChart, m_closeData, color, "Closing Price"); - } - - /// - /// Add a weight close line on the main chart. - /// - /// The color of the line. - /// The LineLayer object representing the line created. - public: LineLayer* addWeightedClose(int color) - { - return addLineIndicator2(m_mainChart, ArrayMath(m_highData).add(m_lowData).add(m_closeData - ).add(m_closeData).div(4), color, "Weighted Close"); - } - - /// - /// Add a typical price line on the main chart. - /// - /// The color of the line. - /// The LineLayer object representing the line created. - public: LineLayer* addTypicalPrice(int color) - { - return addLineIndicator2(m_mainChart, ArrayMath(m_highData).add(m_lowData).add(m_closeData - ).div(3), color, "Typical Price"); - } - - /// - /// Add a median price line on the main chart. - /// - /// The color of the line. - /// The LineLayer object representing the line created. - public: LineLayer* addMedianPrice(int color) - { - return addLineIndicator2(m_mainChart, ArrayMath(m_highData).add(m_lowData).div(2), color, - "Median Price"); - } - - /// - /// Add a simple moving average line on the main chart. - /// - /// The moving average period - /// The color of the line. - /// The LineLayer object representing the line created. - public: LineLayer* addSimpleMovingAvg(int period, int color) - { - char buffer[1024]; - sprintf(buffer, "SMA (%d)", period); - return addLineIndicator2(m_mainChart, ArrayMath(m_closeData).movAvg(period), color, buffer); - } - - /// - /// Add an exponential moving average line on the main chart. - /// - /// The moving average period - /// The color of the line. - /// The LineLayer object representing the line created. - public: LineLayer* addExpMovingAvg(int period, int color) - { - char buffer[1024]; - sprintf(buffer, "EMA (%d)", period); - return addLineIndicator2(m_mainChart, ArrayMath(m_closeData).expAvg(2.0 / (period + 1)), - color, buffer); - } - - /// - /// Add a triangular moving average line on the main chart. - /// - /// The moving average period - /// The color of the line. - /// The LineLayer object representing the line created. - public: LineLayer* addTriMovingAvg(int period, int color) - { - char buffer[1024]; - sprintf(buffer, "TMA (%d)", period); - return addLineIndicator2(m_mainChart, computeTriMovingAvg(m_closeData, period), - color, buffer); - } - - /// - /// Add a weighted moving average line on the main chart. - /// - /// The moving average period - /// The color of the line. - /// The LineLayer object representing the line created. - public: LineLayer* addWeightedMovingAvg(int period, int color) - { - char buffer[1024]; - sprintf(buffer, "WMA (%d)", period); - return addLineIndicator2(m_mainChart, computeWeightedMovingAvg(m_closeData, period - ), color, buffer); - } - - /// - /// Add a parabolic SAR indicator to the main chart. - /// - /// Initial acceleration factor - /// Acceleration factor increment - /// Maximum acceleration factor - /// The symbol used to plot the parabolic SAR - /// The symbol size in pixels - /// The fill color of the symbol - /// The edge color of the symbol - /// The LineLayer object representing the layer created. - public: LineLayer* addParabolicSAR(double accInitial, double accIncrement, double accMaximum, - int symbolType, int symbolSize, int fillColor, int edgeColor) - { - bool isLong = true; - double acc = accInitial; - double extremePoint = 0; - double *psar = new double[m_lowData.len]; - - int i_1 = -1; - int i_2 = -1; - - for(int i = 0; i < m_lowData.len; ++i) { - psar[i] = Chart::NoValue; - if ((m_lowData[i] != Chart::NoValue) && (m_highData[i] != Chart::NoValue)) { - if ((i_1 >= 0) && (i_2 < 0)) { - if (m_lowData[i_1] <= m_lowData[i]) { - psar[i] = m_lowData[i_1]; - isLong = true; - if (m_highData[i_1] > m_highData[i]) { - extremePoint = m_highData[i_1]; - } else { - extremePoint = m_highData[i]; - } - } else { - extremePoint = m_lowData[i]; - isLong = false; - if (m_highData[i_1] > m_highData[i]) { - psar[i] = m_highData[i_1]; - } else { - psar[i] = m_highData[i]; - } - } - } else if ((i_1 >= 0) && (i_2 >= 0)) { - if (acc > accMaximum) { - acc = accMaximum; - } - - psar[i] = psar[i_1] + acc * (extremePoint - psar[i_1]); - - if (isLong) { - if (m_lowData[i] < psar[i]) { - isLong = false; - psar[i] = extremePoint; - extremePoint = m_lowData[i]; - acc = accInitial; - } else { - if (m_highData[i] > extremePoint) { - extremePoint = m_highData[i]; - acc = acc + accIncrement; - } - - if (m_lowData[i_1] < psar[i]) { - psar[i] = m_lowData[i_1]; - } - if (m_lowData[i_2] < psar[i]) { - psar[i] = m_lowData[i_2]; - } - } - } else { - if (m_highData[i] > psar[i]) { - isLong = true; - psar[i] = extremePoint; - extremePoint = m_highData[i]; - acc = accInitial; - } else { - if (m_lowData[i] < extremePoint) { - extremePoint = m_lowData[i]; - acc = acc + accIncrement; - } - - if (m_highData[i_1] > psar[i]) { - psar[i] = m_highData[i_1]; - } - if (m_highData[i_2] > psar[i]) { - psar[i] = m_highData[i_2]; - } - } - } - } - - i_2 = i_1; - i_1 = i; - } - } - - LineLayer* ret = addLineIndicator2(m_mainChart, DoubleArray(psar, m_lowData.len), - fillColor, "Parabolic SAR"); - ret->setLineWidth(0); - - ret = addLineIndicator2(m_mainChart, DoubleArray(psar, m_lowData.len), fillColor, ""); - ret->setLineWidth(0); - ret->getDataSet(0)->setDataSymbol(symbolType, symbolSize, fillColor, edgeColor); - - delete[] psar; - return ret; - } - - /// - /// Add a comparison line to the main price chart. - /// - /// The data series to compare to - /// The color of the comparison line - /// The name of the comparison line - /// The LineLayer object representing the line layer created. - public: LineLayer* addComparison(DoubleArray data, int color, const char *name) - { - int firstIndex = m_extraPoints; - while ((firstIndex < data.len) && (firstIndex < m_closeData.len)) { - if ((data[firstIndex] != Chart::NoValue) && (m_closeData[firstIndex] != Chart::NoValue - ) && (data[firstIndex] != 0) && (m_closeData[firstIndex] != 0)) { - break; - } - firstIndex = firstIndex + 1; - } - if ((firstIndex >= data.len) || (firstIndex >= m_closeData.len)) { - return 0; - } - - double scaleFactor = m_closeData[firstIndex] / data[firstIndex]; - LineLayer* layer = m_mainChart->addLineLayer(ArrayMath(data).mul(scaleFactor).result( - ), Chart::Transparent); - layer->setHTMLImageMap("{disable}"); - - Axis* a = m_mainChart->addAxis(Chart::Right, 0); - a->setColors(Chart::Transparent, Chart::Transparent); - a->syncAxis(m_mainChart->yAxis(), 1 / scaleFactor, 0); - - LineLayer* ret = addLineIndicator2(m_mainChart, data, color, name); - ret->setUseYAxis(a); - return ret; - } - - /// - /// Display percentage axis scale - /// - /// The Axis object representing the percentage axis. - public: Axis* setPercentageAxis() - { - double firstClose = firstCloseValue(); - if (firstClose == Chart::NoValue) { - return 0; - } - - int axisAlign = Chart::Left; - if (m_axisOnRight) { - axisAlign = Chart::Right; - } - - Axis* ret = m_mainChart->addAxis(axisAlign, 0); - configureYAxis(ret, 300); - ret->syncAxis(m_mainChart->yAxis(), 100 / firstClose); - ret->setRounding(false, false); - ret->setLabelFormat("{={value}-100|@}%"); - m_mainChart->yAxis()->setColors(Chart::Transparent, Chart::Transparent); - m_mainChart->getPlotArea()->setGridAxis(0, ret); - return ret; - } - - /// - /// Add a generic band to the main finance chart. This method is used internally by other methods to add - /// various bands (eg. Bollinger band, Donchian channels, etc). - /// - /// The data series for the upper band line. - /// The data series for the lower band line. - /// The color of the upper and lower band line. - /// The color to fill the region between the upper and lower band lines. - /// The name of the band. - /// An InterLineLayer object representing the filled region. - public: InterLineLayer* addBand(DoubleArray upperLine, DoubleArray lowerLine, int lineColor, - int fillColor, const char* name) - { - int i = upperLine.len - 1; - if (i >= lowerLine.len) { - i = lowerLine.len - 1; - } - - char buffer[1024]; - while (i >= 0) { - if ((upperLine[i] != Chart::NoValue) && (lowerLine[i] != Chart::NoValue)) { - sprintf(buffer, "%s: %s - ", name, formatValue(lowerLine[i], m_generalFormat.c_str())); - name = strcat(buffer, formatValue(upperLine[i], m_generalFormat.c_str())); - break; - } - i = i - 1; - } - - LineLayer *layer = m_mainChart->addLineLayer(); - layer->addDataSet(upperLine, lineColor, name); - layer->addDataSet(lowerLine, lineColor); - return m_mainChart->addInterLineLayer(layer->getLine(0), layer->getLine(1), fillColor); - } - - /// - /// Add a Bollinger band on the main chart. - /// - /// The period to compute the band. - /// The half-width of the band in terms multiples of standard deviation. Typically 2 is used. - /// The color of the lines defining the upper and lower limits. - /// The color to fill the regional within the band. - /// The InterLineLayer object representing the band created. - public: InterLineLayer* addBollingerBand(int period, double bandWidth, int lineColor, - int fillColor) - { - //Bollinger Band is moving avg +/- (width * moving std deviation) - ArrayMath stdDev = ArrayMath(m_closeData).movStdDev(period).mul(bandWidth); - ArrayMath movAvg = ArrayMath(m_closeData).movAvg(period); - char buffer[1024]; - sprintf(buffer, "Bollinger (%d, %g)", period, bandWidth); - return addBand(ArrayMath(movAvg).add(stdDev), ArrayMath(movAvg).sub(stdDev).selectGTZ(), lineColor, - fillColor, buffer); - } - - /// - /// Add a Donchian channel on the main chart. - /// - /// The period to compute the band. - /// The color of the lines defining the upper and lower limits. - /// The color to fill the regional within the band. - /// The InterLineLayer object representing the band created. - public: InterLineLayer* addDonchianChannel(int period, int lineColor, int fillColor) - { - //Donchian Channel is the zone between the moving max and moving min - char buffer[1024]; - sprintf(buffer, "Donchian (%d)", period); - return addBand(ArrayMath(m_highData).movMax(period), ArrayMath(m_lowData).movMin(period), - lineColor, fillColor, buffer); - } - - /// - /// Add a price envelop on the main chart. The price envelop is a defined as a ratio around a - /// moving average. For example, a ratio of 0.2 means 20% above and below the moving average. - /// - /// The period for the moving average. - /// The ratio above and below the moving average. - /// The color of the lines defining the upper and lower limits. - /// The color to fill the regional within the band. - /// The InterLineLayer object representing the band created. - public: InterLineLayer* addEnvelop(int period, double range, int lineColor, int fillColor) - { - //Envelop is moving avg +/- percentage - ArrayMath movAvg = ArrayMath(m_closeData).movAvg(period); - char buffer[1024]; - sprintf(buffer, "Envelop (SMA %d +/- %g%%)", period, range * 100); - return addBand(ArrayMath(movAvg).mul(1 + range), ArrayMath(movAvg).mul(1 - range), - lineColor, fillColor, buffer); - } - - /// - /// Add a volume bar chart layer on the main chart. - /// - /// The height of the bar chart layer in pixels. - /// The color to used on an 'up' day. An 'up' day is a day where - /// the closing price is higher than that of the previous day. - /// The color to used on a 'down' day. A 'down' day is a day - /// where the closing price is lower than that of the previous day. - /// The color to used on a 'flat' day. A 'flat' day is a day - /// where the closing price is the same as that of the previous day. - /// The XYChart object representing the chart created. - public: BarLayer* addVolBars(int height, int upColor, int downColor, int flatColor) - { - return addVolBars2(m_mainChart, height, upColor, downColor, flatColor); - } - - private: BarLayer* addVolBars2(XYChart* c, int height, int upColor, int downColor, int flatColor) - { - BarLayer *barLayer = c->addBarLayer(Chart::Overlay); - barLayer->setBorderColor(Chart::Transparent); - - if (c == m_mainChart) { - configureYAxis(c->yAxis2(), height); - int topMargin = c->getDrawArea()->getHeight() - m_topMargin - m_bottomMargin - height + - m_yAxisMargin; - if (topMargin < 0) { - topMargin = 0; - } - c->yAxis2()->setTopMargin(topMargin); - barLayer->setUseYAxis2(); - } - - Axis *a = c->yAxis2(); - if (c != m_mainChart) { - a = c->yAxis(); - } - - char buffer[1024]; - if (ArrayMath(m_volData).maxValue() < 10) - sprintf(buffer, "{value|1}%s", m_volUnit.c_str()); - else - sprintf(buffer, "{value}%s", m_volUnit.c_str()); - a->setLabelFormat(buffer); - - ArrayMath closeChange = ArrayMath(m_closeData).delta().replace(Chart::NoValue, 0); - DoubleArray closeChangeData = closeChange.result(); - - int i = lastIndex(m_volData); - std::string label = "Vol"; - if (i >= 0) { - sprintf(buffer, "%s: %s%s", label.c_str(), formatValue(m_volData[i], m_generalFormat.c_str()), - m_volUnit.c_str()); - label = buffer; - } - - DataSet* upDS = barLayer->addDataSet(ArrayMath(m_volData).selectGTZ(closeChange).result(), upColor); - DataSet* dnDS = barLayer->addDataSet(ArrayMath(m_volData).selectLTZ(closeChange).result(), downColor); - DataSet* flatDS = barLayer->addDataSet(ArrayMath(m_volData).selectEQZ(closeChange).result(), flatColor); - - if ((i < 0) || (closeChangeData[i] == 0) || (closeChangeData[i] == Chart::NoValue)) { - flatDS->setDataName(label.c_str()); - } else if (closeChangeData[i] > 0) { - upDS->setDataName(label.c_str()); - } else { - dnDS->setDataName(label.c_str()); - } - - return barLayer; - } - - /// - /// Add a blank indicator chart to the finance chart. Used internally to add other indicators. - /// Override to change the default formatting (eg. axis fonts, etc.) of the various indicators. - /// - /// The height of the chart in pixels. - /// The XYChart object representing the chart created. - public: XYChart* addIndicator(int height) - { - //create a new chart object - XYChart *ret = new XYChart(m_totalWidth, height + m_topMargin + m_bottomMargin, - Chart::Transparent); - garbage.push_back(ret); - - ret->setTrimData(m_extraPoints); - - if (m_currentChart != 0) { - //if there is a chart before the newly created chart, disable its x-axis, and copy - //its x-axis labels to the new chart - m_currentChart->xAxis()->setColors(Chart::Transparent, Chart::Transparent); - ret->xAxis()->copyAxis(m_currentChart->xAxis()); - - //add chart to MultiChart and update the total height - addChart(0, m_totalHeight + m_plotAreaGap, ret); - m_totalHeight += height + 1 + m_plotAreaGap; - } else { - //no existing chart - create the x-axis labels from scratch - setXLabels(ret->xAxis()); - - //add chart to MultiChart and update the total height - addChart(0, m_totalHeight, ret); - m_totalHeight += height + 1; - } - - //the newly created chart becomes the current chart - m_currentChart = ret; - - //update the size - setSize(m_totalWidth, m_totalHeight + m_topMargin + m_bottomMargin); - - //configure the plot area - ret->setPlotArea(m_leftMargin, m_topMargin, m_totalWidth - m_leftMargin - m_rightMargin, - height, m_plotAreaBgColor, -1, m_plotAreaBorder)->setGridColor(m_majorHGridColor, - m_majorVGridColor, m_minorHGridColor, m_minorVGridColor); - ret->setAntiAlias(m_antiAlias); - - //configure legend box - if (m_legendFontColor != (int)Chart::Transparent) { - LegendBox *box = ret->addLegend(m_leftMargin, m_topMargin, false, m_legendFont.c_str(), - m_legendFontSize); - box->setFontColor(m_legendFontColor); - box->setBackground(m_legendBgColor); - box->setMargin(5, 0, 2, 1); - box->setSize(m_totalWidth - m_leftMargin - m_rightMargin + 1, 0); - } - - //configure x-axis - Axis *a = ret->xAxis(); - a->setIndent(true); - a->setTickLength(2, 0); - a->setColors(Chart::Transparent, m_xAxisFontColor, m_xAxisFontColor, m_xAxisFontColor); - a->setLabelStyle(m_xAxisFont.c_str(), m_xAxisFontSize, m_xAxisFontColor, m_xAxisFontAngle); - - //configure y-axis - ret->setYAxisOnRight(m_axisOnRight); - configureYAxis(ret->yAxis(), height); - - return ret; - } - - private: void configureYAxis(Axis* a, int height) - { - a->setAutoScale(0, 0.05, 0); - if (height < 100) { - a->setTickDensity(15); - } - a->setMargin(m_yAxisMargin); - a->setLabelStyle(m_yAxisFont.c_str(), m_yAxisFontSize, m_yAxisFontColor, 0); - a->setTickLength(-4, -2); - a->setColors(Chart::Transparent, m_yAxisFontColor, m_yAxisFontColor, m_yAxisFontColor); - } - - /// - /// Add a generic line indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The data series of the indicator line. - /// The color of the indicator line. - /// The name of the indicator. - /// The XYChart object representing the chart created. - public: XYChart* addLineIndicator(int height, DoubleArray data, int color, const char* name) - { - XYChart *c = addIndicator(height); - addLineIndicator2(c, data, color, name); - return c; - } - - /// - /// Add a line to an existing indicator chart. - /// - /// The indicator chart to add the line to. - /// The data series of the indicator line. - /// The color of the indicator line. - /// The name of the indicator. - /// The LineLayer object representing the line created. - public: LineLayer* addLineIndicator2(XYChart* c, DoubleArray data, int color, const char* name) - { - return c->addLineLayer(data, color, formatIndicatorLabel(name, data).c_str()); - } - - /// - /// Add a generic bar indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The data series of the indicator bars. - /// The color of the indicator bars. - /// The name of the indicator. - /// The XYChart object representing the chart created. - public: XYChart* addBarIndicator(int height, DoubleArray data, int color, const char* name) - { - XYChart *c = addIndicator(height); - addBarIndicator2(c, data, color, name); - return c; - } - - /// - /// Add a bar layer to an existing indicator chart. - /// - /// The indicator chart to add the bar layer to. - /// The data series of the indicator bars. - /// The color of the indicator bars. - /// The name of the indicator. - /// The BarLayer object representing the bar layer created. - public: BarLayer* addBarIndicator2(XYChart* c, DoubleArray data, int color, const char* name) - { - BarLayer *layer = c->addBarLayer(data, color, formatIndicatorLabel(name, data).c_str()); - layer->setBorderColor(Chart::Transparent); - return layer; - } - - /// - /// Add an upper/lower threshold range to an existing indicator chart. - /// - /// The indicator chart to add the threshold range to. - /// The line layer that the threshold range applies to. - /// The upper threshold. - /// The color to fill the region of the line that is above the - /// upper threshold. - /// The lower threshold. - /// The color to fill the region of the line that is below - /// the lower threshold. - public: void addThreshold(XYChart* c, LineLayer* layer, double topRange, int topColor, - double bottomRange, int bottomColor) - { - Mark *topMark = c->yAxis()->addMark(topRange, topColor, formatValue(topRange, - m_generalFormat.c_str())); - Mark *bottomMark = c->yAxis()->addMark(bottomRange, bottomColor, formatValue(bottomRange, - m_generalFormat.c_str())); - - c->addInterLineLayer(layer->getLine(), topMark->getLine(), topColor, Chart::Transparent); - c->addInterLineLayer(layer->getLine(), bottomMark->getLine(), Chart::Transparent, - bottomColor); - } - - private: std::string formatIndicatorLabel(const char* name, DoubleArray data) - { - int i = lastIndex(data); - if (name == 0) { - return name; - } - char buffer[1024]; - if ((*name == 0) || (i < 0)) - //still need sprintf to escape the "%" character - sprintf(buffer, "%s", name); - else - sprintf(buffer, "%s: %s", name, formatValue(data[i], m_generalFormat.c_str())); - return buffer; - } - - /// - /// Add an Accumulation/Distribution indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addAccDist(int height, int color) - { - //Close Location Value = ((C - L) - (H - C)) / (H - L) - //Accumulation Distribution Line = Accumulation of CLV * volume - ArrayMath range = ArrayMath(m_highData).sub(m_lowData); - return addLineIndicator(height, ArrayMath(m_closeData).mul(2).sub(m_lowData).sub(m_highData - ).mul(m_volData).financeDiv(range, 0).acc(), color, "Accumulation/Distribution"); - } - - private: ArrayMath computeAroonUp(int period) - { - double *aroonUp = new double[m_highData.len]; - - for(int i = 0; i < m_highData.len; ++i) { - double highValue = m_highData[i]; - if (highValue == Chart::NoValue) { - aroonUp[i] = Chart::NoValue; - } else { - int currentIndex = i; - int highCount = period; - int count = period; - - while ((count > 0) && (currentIndex >= count)) { - currentIndex = currentIndex - 1; - double currentValue = m_highData[currentIndex]; - if (currentValue != Chart::NoValue) { - count = count - 1; - if (currentValue > highValue) { - highValue = currentValue; - highCount = count; - } - } - } - - if (count > 0) { - aroonUp[i] = Chart::NoValue; - } else { - aroonUp[i] = highCount * 100.0 / period; - } - } - } - - ArrayMath ret(DoubleArray(aroonUp, m_highData.len)); - delete[] aroonUp; - return ret; - } - - private: ArrayMath computeAroonDn(int period) - { - double *aroonDn = new double[m_lowData.len]; - - for(int i = 0; i < m_lowData.len; ++i) { - double lowValue = m_lowData[i]; - if (lowValue == Chart::NoValue) { - aroonDn[i] = Chart::NoValue; - } else { - int currentIndex = i; - int lowCount = period; - int count = period; - - while ((count > 0) && (currentIndex >= count)) { - currentIndex = currentIndex - 1; - double currentValue = m_lowData[currentIndex]; - if (currentValue != Chart::NoValue) { - count = count - 1; - if (currentValue < lowValue) { - lowValue = currentValue; - lowCount = count; - } - } - } - - if (count > 0) { - aroonDn[i] = Chart::NoValue; - } else { - aroonDn[i] = lowCount * 100.0 / period; - } - } - } - - ArrayMath ret(DoubleArray(aroonDn, m_lowData.len)); - delete[] aroonDn; - return ret; - } - - /// - /// Add an Aroon Up/Down indicators chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicators. - /// The color of the Aroon Up indicator line. - /// The color of the Aroon Down indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addAroon(int height, int period, int upColor, int downColor) - { - XYChart *c = addIndicator(height); - addLineIndicator2(c, computeAroonUp(period), upColor, "Aroon Up"); - addLineIndicator2(c, computeAroonDn(period), downColor, "Aroon Down"); - c->yAxis()->setLinearScale(0, 100); - return c; - } - - /// - /// Add an Aroon Oscillator indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addAroonOsc(int height, int period, int color) - { - char buffer[1024]; - sprintf(buffer, "Aroon Oscillator (%d)", period); - XYChart *c = addLineIndicator(height, computeAroonUp(period).sub(computeAroonDn( - period)), color, buffer); - c->yAxis()->setLinearScale(-100, 100); - return c; - } - - private: ArrayMath computeTrueRange() - { - ArrayMath previousClose = ArrayMath(m_closeData).shift(); - DoubleArray previousCloseData = previousClose.result(); - ArrayMath range = ArrayMath(m_highData).sub(m_lowData); - DoubleArray rangeData = range.result(); - double temp = 0; - - double *ret = new double[m_highData.len]; - for(int i = 0; i < m_highData.len; ++i) { - ret[i] = rangeData[i]; - if ((ret[i] != Chart::NoValue) && (previousCloseData[i] != Chart::NoValue)) { - temp = fabs(m_highData[i] - previousCloseData[i]); - if (temp > ret[i]) { - ret[i] = temp; - } - temp = fabs(previousCloseData[i] - m_lowData[i]); - if (temp > ret[i]) { - ret[i] = temp; - } - } - } - - ArrayMath ret1(DoubleArray(ret, m_highData.len)); - delete[] ret; - return ret1; - } - - /// - /// Add an Average Directional Index indicators chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the Positive Directional Index line. - /// The color of the Negatuve Directional Index line. - /// The color of the Average Directional Index line. - /// The XYChart object representing the chart created. - public: XYChart* addADX(int height, int period, int posColor, int negColor, int color) - { - //pos/neg directional movement - ArrayMath pos = ArrayMath(m_highData).delta().selectGTZ(); - ArrayMath neg = ArrayMath(m_lowData).delta().mul(-1).selectGTZ(); - ArrayMath delta = ArrayMath(pos).sub(neg); - pos.selectGTZ(delta); - neg.selectLTZ(delta); - - //initial value - DoubleArray posData = pos.result(); - DoubleArray negData = neg.result(); - if ((posData.len > 1) && (posData[1] != Chart::NoValue) && (negData[1] != - Chart::NoValue)) { - const_cast(posData.data)[1] = (posData[1] * 2 + negData[1]) / 3; - const_cast(negData.data)[1] = (negData[1] + posData[1]) / 2; - pos = ArrayMath(posData); - neg = ArrayMath(negData); - } - - //pos/neg directional index - ArrayMath tr = computeTrueRange(); - tr.expAvg(1.0 / period); - pos.expAvg(1.0 / period).financeDiv(tr, 0).mul(100); - neg.expAvg(1.0 / period).financeDiv(tr, 0).mul(100); - - //directional movement index ??? what happen if division by zero??? - ArrayMath totalDM = ArrayMath(pos).add(neg); - ArrayMath dx = ArrayMath(pos).sub(neg).abs().financeDiv(totalDM, - 0).mul(100).expAvg(1.0 / period); - - XYChart *c = addIndicator(height); - char buffer1[1024]; - sprintf(buffer1, "+DI (%d)", period); - char buffer2[1024]; - sprintf(buffer2, "-DI (%d)", period); - char buffer3[1024]; - sprintf(buffer3, "ADX (%d)", period); - addLineIndicator2(c, pos, posColor, buffer1); - addLineIndicator2(c, neg, negColor, buffer2); - addLineIndicator2(c, dx, color, buffer3); - return c; - } - - /// - /// Add an Average True Range indicators chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the True Range line. - /// The color of the Average True Range line. - /// The XYChart object representing the chart created. - public: XYChart* addATR(int height, int period, int color1, int color2) - { - ArrayMath trueRange = computeTrueRange(); - XYChart *c = addLineIndicator(height, trueRange, color1, "True Range"); - char buffer[1024]; - sprintf(buffer, "Average True Range (%d)", period); - addLineIndicator2(c, ArrayMath(trueRange).expAvg(2.0 / (period + 1)), color2, buffer); - return c; - } - - /// - /// Add a Bollinger Band Width indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The band width to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addBollingerWidth(int height, int period, double width, int color) - { - char buffer[1024]; - sprintf(buffer, "Bollinger Width (%d, %g)", period, width); - return addLineIndicator(height, ArrayMath(m_closeData).movStdDev(period).mul(width * 2), color, - buffer); - } - - /// - /// Add a Community Channel Index indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The distance beween the middle line and the upper and lower threshold lines. - /// The fill color when the indicator exceeds the upper threshold line. - /// The fill color when the indicator falls below the lower threshold line. - /// The XYChart object representing the chart created. - public: XYChart* addCCI(int height, int period, int color, double deviation, int upColor, - int downColor) - { - //typical price - ArrayMath tp = ArrayMath(m_highData).add(m_lowData).add(m_closeData).div(3); - DoubleArray tpData = tp.result(); - - //simple moving average of typical price - ArrayMath smvtp = ArrayMath(tp).movAvg(period); - DoubleArray smvtpData = smvtp.result(); - - //compute mean deviation - double *movMeanDev = new double[smvtpData.len]; - - for(int i = 0; i < smvtpData.len; ++i) { - double avg = smvtpData[i]; - if (avg == Chart::NoValue) { - movMeanDev[i] = Chart::NoValue; - } else { - int currentIndex = i; - int count = period - 1; - double acc = 0; - - while ((count >= 0) && (currentIndex >= count)) { - double currentValue = tpData[currentIndex]; - currentIndex = currentIndex - 1; - if (currentValue != Chart::NoValue) { - count = count - 1; - acc = acc + fabs(avg - currentValue); - } - } - - if (count > 0) { - movMeanDev[i] = Chart::NoValue; - } else { - movMeanDev[i] = acc / period; - } - } - } - - XYChart *c = addIndicator(height); - char buffer[1024]; - sprintf(buffer, "CCI (%d)", period); - LineLayer *layer = addLineIndicator2(c, ArrayMath(tp).sub(smvtpData).financeDiv( - DoubleArray(movMeanDev, smvtpData.len), 0).div(0.015), color, buffer); - addThreshold(c, layer, deviation, upColor, -deviation, downColor); - - delete[] movMeanDev; - return c; - } - - /// - /// Add a Chaikin Money Flow indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addChaikinMoneyFlow(int height, int period, int color) - { - ArrayMath range = ArrayMath(m_highData).sub(m_lowData); - ArrayMath volAvg = ArrayMath(m_volData).movAvg(period); - char buffer[1024]; - sprintf(buffer, "Chaikin Money Flow (%d)", period); - return addBarIndicator(height, ArrayMath(m_closeData).mul(2).sub(m_lowData).sub(m_highData - ).mul(m_volData).financeDiv(range, 0).movAvg(period).financeDiv(volAvg, 0), color, buffer - ); - } - - /// - /// Add a Chaikin Oscillator indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addChaikinOscillator(int height, int color) - { - //first compute acc/dist line - ArrayMath range = ArrayMath(m_highData).sub(m_lowData); - ArrayMath accdist = ArrayMath(m_closeData).mul(2).sub(m_lowData).sub(m_highData).mul( - m_volData).financeDiv(range, 0).acc(); - - //chaikin osc = exp3(accdist) - exp10(accdist) - ArrayMath expAvg10 = ArrayMath(accdist).expAvg(2.0 / (10 + 1)); - return addLineIndicator(height, ArrayMath(accdist).expAvg(2.0 / (3 + 1)).sub(expAvg10), color, - "Chaikin Oscillator"); - } - - /// - /// Add a Chaikin Volatility indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to smooth the range. - /// The period to compute the rate of change of the smoothed range. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addChaikinVolatility(int height, int period1, int period2, int color) - { - char buffer[1024]; - sprintf(buffer, "Chaikin Volatility (%d, %d)", period1, period2); - return addLineIndicator(height, ArrayMath(m_highData).sub(m_lowData).expAvg(2.0 / (period1 + - 1)).rate(period2).sub(1).mul(100), color, buffer); - } - - /// - /// Add a Close Location Value indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addCLV(int height, int color) - { - //Close Location Value = ((C - L) - (H - C)) / (H - L) - ArrayMath range = ArrayMath(m_highData).sub(m_lowData); - return addLineIndicator(height, ArrayMath(m_closeData).mul(2).sub(m_lowData).sub(m_highData - ).financeDiv(range, 0), color, "Close Location Value"); - } - - /// - /// Add a Detrended Price Oscillator indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addDPO(int height, int period, int color) - { - char buffer[1024]; - sprintf(buffer, "DPO (%d)", period); - return addLineIndicator(height, ArrayMath(m_closeData).movAvg(period).shift(period / 2 + 1 - ).sub(m_closeData).mul(-1), color, buffer); - } - - /// - /// Add a Donchian Channel Width indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addDonchianWidth(int height, int period, int color) - { - char buffer[1024]; - sprintf(buffer, "Donchian Width (%d)", period); - return addLineIndicator(height, ArrayMath(m_highData).movMax(period).sub(ArrayMath(m_lowData - ).movMin(period)), color, buffer); - } - - /// - /// Add a Ease of Movement indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to smooth the indicator. - /// The color of the indicator line. - /// The color of the smoothed indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addEaseOfMovement(int height, int period, int color1, int color2) - { - ArrayMath boxRatioInverted = ArrayMath(m_highData).sub(m_lowData).financeDiv(m_volData, 0); - ArrayMath result = ArrayMath(m_highData).add(m_lowData).div(2).delta().mul(boxRatioInverted) - ; - - XYChart *c = addLineIndicator(height, result, color1, "EMV"); - char buffer[1024]; - sprintf(buffer, "EMV EMA (%d)", period); - addLineIndicator2(c, ArrayMath(result).movAvg(period), color2, buffer); - return c; - } - - /// - /// Add a Fast Stochastic indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the %K line. - /// The period to compute the %D line. - /// The color of the %K line. - /// The color of the %D line. - /// The XYChart object representing the chart created. - public: XYChart* addFastStochastic(int height, int period1, int period2, int color1, int color2) - { - ArrayMath movLow = ArrayMath(m_lowData).movMin(period1); - ArrayMath movRange = ArrayMath(m_highData).movMax(period1).sub(movLow); - ArrayMath stochastic = ArrayMath(m_closeData).sub(movLow).financeDiv(movRange, 0.5).mul(100) - ; - - char buffer[1024]; - sprintf(buffer, "Fast Stochastic %%K (%d)", period1); - XYChart *c = addLineIndicator(height, stochastic, color1, buffer); - sprintf(buffer, "%%D (%d)", period2); - addLineIndicator2(c, ArrayMath(stochastic).movAvg(period2), color2, buffer); - - c->yAxis()->setLinearScale(0, 100); - return c; - } - - /// - /// Add a MACD indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The first moving average period to compute the indicator. - /// The second moving average period to compute the indicator. - /// The moving average period of the signal line. - /// The color of the indicator line. - /// The color of the signal line. - /// The color of the divergent bars. - /// The XYChart object representing the chart created. - public: XYChart* addMACD(int height, int period1, int period2, int period3, int color, - int signalColor, int divColor) - { - XYChart *c = addIndicator(height); - char buffer[1024]; - - //MACD is defined as the difference between two exponential averages (typically 12/26 days) - ArrayMath expAvg1 = ArrayMath(m_closeData).expAvg(2.0 / (period1 + 1)); - ArrayMath macd = ArrayMath(m_closeData).expAvg(2.0 / (period2 + 1)).sub(expAvg1); - - //Add the MACD line - sprintf(buffer, "MACD (%d, %d)", period1, period2); - addLineIndicator2(c, macd, color, buffer); - - //MACD signal line - ArrayMath macdSignal = ArrayMath(macd).expAvg(2.0 / (period3 + 1)); - sprintf(buffer, "EXP (%d)", period3); - addLineIndicator2(c, macdSignal, signalColor, buffer); - - //Divergence - addBarIndicator2(c, ArrayMath(macd).sub(macdSignal), divColor, "Divergence"); - - return c; - } - - /// - /// Add a Mass Index indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The color of the indicator line. - /// The fill color when the indicator exceeds the upper threshold line. - /// The fill color when the indicator falls below the lower threshold line. - /// The XYChart object representing the chart created. - public: XYChart* addMassIndex(int height, int color, int upColor, int downColor) - { - //Mass Index - double f = 2.0 / (10); - ArrayMath exp9 = ArrayMath(m_highData).sub(m_lowData).expAvg(f); - ArrayMath exp99 = ArrayMath(exp9).expAvg(f); - - XYChart *c = addLineIndicator(height, ArrayMath(exp9).financeDiv(exp99, 1).movAvg(25).mul(25 - ), color, "Mass Index"); - c->yAxis()->addMark(27, upColor); - c->yAxis()->addMark(26.5, downColor); - return c; - } - - /// - /// Add a Money Flow Index indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The distance beween the middle line and the upper and lower threshold lines. - /// The fill color when the indicator exceeds the upper threshold line. - /// The fill color when the indicator falls below the lower threshold line. - /// The XYChart object representing the chart created. - public: XYChart* addMFI(int height, int period, int color, double range, int upColor, - int downColor) - { - //Money Flow Index - ArrayMath typicalPrice = ArrayMath(m_highData).add(m_lowData).add(m_closeData).div(3); - ArrayMath moneyFlow = ArrayMath(typicalPrice).mul(m_volData); - - ArrayMath selector = ArrayMath(typicalPrice).delta(); - ArrayMath posMoneyFlow = ArrayMath(moneyFlow).selectGTZ(selector).movAvg(period); - ArrayMath posNegMoneyFlow = ArrayMath(moneyFlow).selectLTZ(selector).movAvg(period).add( - posMoneyFlow); - - XYChart *c = addIndicator(height); - char buffer[1024]; - sprintf(buffer, "Money Flow Index (%d)", period); - LineLayer *layer = addLineIndicator2(c, ArrayMath(posMoneyFlow).financeDiv(posNegMoneyFlow, - 0.5).mul(100), color, buffer); - addThreshold(c, layer, 50 + range, upColor, 50 - range, downColor); - - c->yAxis()->setLinearScale(0, 100); - return c; - } - - /// - /// Add a Momentum indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addMomentum(int height, int period, int color) - { - char buffer[1024]; - sprintf(buffer, "Momentum (%d)", period); - return addLineIndicator(height, ArrayMath(m_closeData).delta(period), color, buffer); - } - - /// - /// Add a Negative Volume Index indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the signal line. - /// The color of the indicator line. - /// The color of the signal line. - /// The XYChart object representing the chart created. - public: XYChart* addNVI(int height, int period, int color, int signalColor) - { - double *nvi = new double[m_volData.len]; - - double previousNVI = 100; - double previousVol = Chart::NoValue; - double previousClose = Chart::NoValue; - int i; - for(i = 0; i < m_volData.len; ++i) { - if (m_volData[i] == Chart::NoValue) { - nvi[i] = Chart::NoValue; - } else { - if ((previousVol != Chart::NoValue) && (m_volData[i] < previousVol) && ( - previousClose != Chart::NoValue) && (m_closeData[i] != Chart::NoValue)) { - nvi[i] = previousNVI + previousNVI * (m_closeData[i] - previousClose) / - previousClose; - } else { - nvi[i] = previousNVI; - } - - previousNVI = nvi[i]; - previousVol = m_volData[i]; - previousClose = m_closeData[i]; - } - } - - XYChart *c = addLineIndicator(height, DoubleArray(nvi, m_volData.len), color, "NVI"); - if (m_volData.len > period) { - char buffer[1024]; - sprintf(buffer, "NVI SMA (%d)", period); - addLineIndicator2(c, ArrayMath(DoubleArray(nvi, m_volData.len)).movAvg(period), - signalColor, buffer); - } - - delete[] nvi; - return c; - } - - /// - /// Add an On Balance Volume indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addOBV(int height, int color) - { - ArrayMath closeChange = ArrayMath(m_closeData).delta(); - ArrayMath upVolume = ArrayMath(m_volData).selectGTZ(closeChange); - ArrayMath downVolume = ArrayMath(m_volData).selectLTZ(closeChange); - - return addLineIndicator(height, ArrayMath(upVolume).sub(downVolume).acc(), color, "OBV"); - } - - /// - /// Add a Performance indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addPerformance(int height, int color) - { - double closeValue = firstCloseValue(); - if (closeValue != Chart::NoValue) { - return addLineIndicator(height, ArrayMath(m_closeData).mul(100 / closeValue - ).sub(100).result(), color, "Performance"); - } else { - //chart is empty !!! - return addIndicator(height); - } - } - - /// - /// Add a Percentage Price Oscillator indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The first moving average period to compute the indicator. - /// The second moving average period to compute the indicator. - /// The moving average period of the signal line. - /// The color of the indicator line. - /// The color of the signal line. - /// The color of the divergent bars. - /// The XYChart object representing the chart created. - public: XYChart* addPPO(int height, int period1, int period2, int period3, int color, - int signalColor, int divColor) - { - ArrayMath expAvg1 = ArrayMath(m_closeData).expAvg(2.0 / (period1 + 1)); - ArrayMath expAvg2 = ArrayMath(m_closeData).expAvg(2.0 / (period2 + 1)); - ArrayMath ppo = ArrayMath(expAvg2).sub(expAvg1).financeDiv(expAvg2, 0).mul(100); - ArrayMath ppoSignal = ArrayMath(ppo).expAvg(2.0 / (period3 + 1)); - - char buffer[1024]; - sprintf(buffer, "PPO (%d, %d)", period1, period2); - XYChart *c = addLineIndicator(height, ppo, color, buffer); - sprintf(buffer, "EMA (%d)", period3); - addLineIndicator2(c, ppoSignal, signalColor, buffer); - addBarIndicator2(c, ppo.sub(ppoSignal), divColor, "Divergence"); - return c; - } - - /// - /// Add a Positive Volume Index indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the signal line. - /// The color of the indicator line. - /// The color of the signal line. - /// The XYChart object representing the chart created. - public: XYChart* addPVI(int height, int period, int color, int signalColor) - { - //Positive Volume Index - double *pvi = new double[m_volData.len]; - - double previousPVI = 100; - double previousVol = Chart::NoValue; - double previousClose = Chart::NoValue; - int i; - for(i = 0; i < m_volData.len; ++i) { - if (m_volData[i] == Chart::NoValue) { - pvi[i] = Chart::NoValue; - } else { - if ((previousVol != Chart::NoValue) && (m_volData[i] > previousVol) && ( - previousClose != Chart::NoValue) && (m_closeData[i] != Chart::NoValue)) { - pvi[i] = previousPVI + previousPVI * (m_closeData[i] - previousClose) / - previousClose; - } else { - pvi[i] = previousPVI; - } - - previousPVI = pvi[i]; - previousVol = m_volData[i]; - previousClose = m_closeData[i]; - } - } - - XYChart *c = addLineIndicator(height, DoubleArray(pvi, m_volData.len), color, "PVI"); - if (m_volData.len > period) { - char buffer[1024]; - sprintf(buffer, "PVI SMA (%d)", period); - addLineIndicator2(c, ArrayMath(DoubleArray(pvi, m_volData.len)).movAvg(period), - signalColor, buffer); - } - - delete[] pvi; - return c; - } - - /// - /// Add a Percentage Volume Oscillator indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The first moving average period to compute the indicator. - /// The second moving average period to compute the indicator. - /// The moving average period of the signal line. - /// The color of the indicator line. - /// The color of the signal line. - /// The color of the divergent bars. - /// The XYChart object representing the chart created. - public: XYChart* addPVO(int height, int period1, int period2, int period3, int color, - int signalColor, int divColor) - { - ArrayMath expAvg1 = ArrayMath(m_volData).expAvg(2.0 / (period1 + 1)); - ArrayMath expAvg2 = ArrayMath(m_volData).expAvg(2.0 / (period2 + 1)); - ArrayMath pvo = ArrayMath(expAvg2).sub(expAvg1).financeDiv(expAvg2, 0).mul(100); - ArrayMath pvoSignal = ArrayMath(pvo).expAvg(2.0 / (period3 + 1)); - - char buffer[1024]; - sprintf(buffer, "PVO (%d, %d)", period1, period2); - XYChart *c = addLineIndicator(height, pvo, color, buffer); - sprintf(buffer, "EMA (%d)", period3); - addLineIndicator2(c, pvoSignal, signalColor, buffer); - addBarIndicator2(c, pvo.sub(pvoSignal), divColor, "Divergence"); - return c; - } - - /// - /// Add a Price Volumne Trend indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addPVT(int height, int color) - { - return addLineIndicator(height, ArrayMath(m_closeData).rate().sub(1).mul(m_volData).acc(), - color, "PVT"); - } - - /// - /// Add a Rate of Change indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addROC(int height, int period, int color) - { - char buffer[1024]; - sprintf(buffer, "ROC (%d)", period); - return addLineIndicator(height, ArrayMath(m_closeData).rate(period).sub(1).mul(100), color, - buffer); - } - - private: ArrayMath& RSIMovAvg(ArrayMath& dataRef, int period) { - //The "moving average" in classical RSI is based on a formula that mixes simple - //and exponential moving averages. - - if (period <= 0) - period = 1; - - int count = 0; - double acc = 0; - int dataLen = dataRef.result().len; - double *data = const_cast(dataRef.result().data); - - for (int i = 0; i < dataLen; ++i) { - if (fabs(data[i] / Chart::NoValue - 1) > 1e-005) { - ++count; - acc += data[i]; - if (count < period) { - data[i] = Chart::NoValue; - } else { - data[i] = acc / period; - acc = data[i] * (period - 1); - } - } - } - - return dataRef; - } - - private: ArrayMath computeRSI(int period) - { - //RSI is defined as the average up changes for the last 14 days, divided by the - //average absolute changes for the last 14 days, expressed as a percentage. - - return RSIMovAvg(ArrayMath(m_closeData).delta().selectGTZ(), period).financeDiv( - RSIMovAvg(ArrayMath(m_closeData).delta().abs(), period), 0.5).mul(100); - } - - /// - /// Add a Relative Strength Index indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The distance beween the middle line and the upper and lower threshold lines. - /// The fill color when the indicator exceeds the upper threshold line. - /// The fill color when the indicator falls below the lower threshold line. - /// The XYChart object representing the chart created. - public: XYChart* addRSI(int height, int period, int color, double range, int upColor, - int downColor) - { - XYChart *c = addIndicator(height); - char buffer[1024]; - sprintf(buffer, "RSI (%d)", period); - LineLayer *layer = addLineIndicator2(c, computeRSI(period), color, buffer); - - //Add range if given - if ((range > 0) && (range < 50)) { - addThreshold(c, layer, 50 + range, upColor, 50 - range, downColor); - } - c->yAxis()->setLinearScale(0, 100); - return c; - } - - /// - /// Add a Slow Stochastic indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the %K line. - /// The period to compute the %D line. - /// The color of the %K line. - /// The color of the %D line. - /// The XYChart object representing the chart created. - public: XYChart* addSlowStochastic(int height, int period1, int period2, int color1, int color2) - { - ArrayMath movLow = ArrayMath(m_lowData).movMin(period1); - ArrayMath movRange = ArrayMath(m_highData).movMax(period1).sub(movLow); - ArrayMath stochastic = ArrayMath(m_closeData).sub(movLow).financeDiv(movRange, 0.5 - ).mul(100).movAvg(3); - - char buffer[1024]; - sprintf(buffer, "Slow Stochastic %%K (%d)", period1); - XYChart *c = addLineIndicator(height, stochastic, color1, buffer); - sprintf(buffer, "%%D (%d)", period2); - addLineIndicator2(c, stochastic.movAvg(period2), color2, buffer); - - c->yAxis()->setLinearScale(0, 100); - return c; - } - - /// - /// Add a Moving Standard Deviation indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addStdDev(int height, int period, int color) - { - char buffer[1024]; - sprintf(buffer, "Moving StdDev (%d)", period); - return addLineIndicator(height, ArrayMath(m_closeData).movStdDev(period), color, buffer); - } - - /// - /// Add a Stochastic RSI indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The distance beween the middle line and the upper and lower threshold lines. - /// The fill color when the indicator exceeds the upper threshold line. - /// The fill color when the indicator falls below the lower threshold line. - /// The XYChart object representing the chart created. - public: XYChart* addStochRSI(int height, int period, int color, double range, int upColor, - int downColor) - { - ArrayMath rsi = computeRSI(period); - ArrayMath movLow = ArrayMath(rsi).movMin(period); - ArrayMath movRange = ArrayMath(rsi).movMax(period).sub(movLow); - - XYChart *c = addIndicator(height); - char buffer[1024]; - sprintf(buffer, "StochRSI (%d)", period); - LineLayer *layer = addLineIndicator2(c, ArrayMath(rsi).sub(movLow).financeDiv(movRange, 0.5 - ).mul(100), color, buffer); - - //Add range if given - if ((range > 0) && (range < 50)) { - addThreshold(c, layer, 50 + range, upColor, 50 - range, downColor); - } - c->yAxis()->setLinearScale(0, 100); - return c; - } - - /// - /// Add a TRIX indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The XYChart object representing the chart created. - public: XYChart* addTRIX(int height, int period, int color) - { - double f = 2.0 / (period + 1); - char buffer[1024]; - sprintf(buffer, "TRIX (%d)", period); - return addLineIndicator(height, ArrayMath(m_closeData).expAvg(f).expAvg(f).expAvg(f) - .rate().sub(1).mul(100), color, buffer); - } - - private: ArrayMath computeTrueLow() - { - //the lower of today's low or yesterday's close. - ArrayMath previousClose = ArrayMath(m_closeData).shift(); - DoubleArray previousCloseData = previousClose.result(); - double *ret = new double[m_lowData.len]; - - for(int i = 0; i < m_lowData.len; ++i) { - if ((m_lowData[i] != Chart::NoValue) && (previousCloseData[i] != Chart::NoValue)) { - if (m_lowData[i] < previousCloseData[i]) { - ret[i] = m_lowData[i]; - } else { - ret[i] = previousCloseData[i]; - } - } else { - ret[i] = Chart::NoValue; - } - } - - ArrayMath ret1(DoubleArray(ret, m_lowData.len)); - delete[] ret; - return ret1; - } - - /// - /// Add an Ultimate Oscillator indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The first moving average period to compute the indicator. - /// The second moving average period to compute the indicator. - /// The third moving average period to compute the indicator. - /// The color of the indicator line. - /// The distance beween the middle line and the upper and lower threshold lines. - /// The fill color when the indicator exceeds the upper threshold line. - /// The fill color when the indicator falls below the lower threshold line. - /// The XYChart object representing the chart created. - public: XYChart* addUltimateOscillator(int height, int period1, int period2, int period3, - int color, double range, int upColor, int downColor) - { - ArrayMath trueLow = computeTrueLow(); - ArrayMath buyingPressure = ArrayMath(m_closeData).sub(trueLow); - ArrayMath trueRange = computeTrueRange(); - - ArrayMath rawUO1 = ArrayMath(buyingPressure).movAvg(period1).financeDiv(ArrayMath(trueRange - ).movAvg(period1), 0.5).mul(4); - ArrayMath rawUO2 = ArrayMath(buyingPressure).movAvg(period2).financeDiv(ArrayMath(trueRange - ).movAvg(period2), 0.5).mul(2); - ArrayMath rawUO3 = ArrayMath(buyingPressure).movAvg(period3).financeDiv(ArrayMath(trueRange - ).movAvg(period3), 0.5).mul(1); - - XYChart *c = addIndicator(height); - char buffer[1024]; - sprintf(buffer, "Ultimate Oscillator (%d, %d, %d)", period1, period2, period3); - LineLayer *layer = addLineIndicator2(c, ArrayMath(rawUO1).add(rawUO2).add(rawUO3).mul(100.0 - / 7), color, buffer); - addThreshold(c, layer, 50 + range, upColor, 50 - range, downColor); - - c->yAxis()->setLinearScale(0, 100); - return c; - } - - /// - /// Add a Volume indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The color to used on an 'up' day. An 'up' day is a day where - /// the closing price is higher than that of the previous day. - /// The color to used on a 'down' day. A 'down' day is a day - /// where the closing price is lower than that of the previous day. - /// The color to used on a 'flat' day. A 'flat' day is a day - /// where the closing price is the same as that of the previous day. - /// The XYChart object representing the chart created. - public: XYChart* addVolIndicator(int height, int upColor, int downColor, int flatColor) - { - XYChart *c = addIndicator(height); - addVolBars2(c, height, upColor, downColor, flatColor); - return c; - } - - /// - /// Add a William %R indicator chart. - /// - /// The height of the indicator chart in pixels. - /// The period to compute the indicator. - /// The color of the indicator line. - /// The distance beween the middle line and the upper and lower threshold lines. - /// The fill color when the indicator exceeds the upper threshold line. - /// The fill color when the indicator falls below the lower threshold line. - /// The XYChart object representing the chart created. - public: XYChart* addWilliamR(int height, int period, int color, double range, int upColor, - int downColor) - { - ArrayMath movLow = ArrayMath(m_lowData).movMin(period); - ArrayMath movHigh = ArrayMath(m_highData).movMax(period); - ArrayMath movRange = ArrayMath(movHigh).sub(movLow); - - XYChart *c = addIndicator(height); - LineLayer *layer = addLineIndicator2(c, ArrayMath(movHigh).sub(m_closeData).financeDiv( - movRange, 0.5).mul(-100), color, "William %%R"); - addThreshold(c, layer, -50 + range, upColor, -50 - range, downColor); - c->yAxis()->setLinearScale(-100, 0); - return c; - } - -}; - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - -#endif diff --git a/PssSampleClient/PurenessLine/PurenessLine/include/bchartdir.h b/PssSampleClient/PurenessLine/PurenessLine/include/bchartdir.h deleted file mode 100644 index cac1b2ff0..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/include/bchartdir.h +++ /dev/null @@ -1,1250 +0,0 @@ -/* - * Copyright (C) 2012 Advanced Software Engineering Limited. - * - * This file is part of the ChartDirector software. Usage of this file is - * subjected to the ChartDirector license agreement. See the LICENSE.TXT - * file that comes with the ChartDirector software release, or visit - * Advanced Software Engineering's web site at www.advsofteng.com or - * email to support@advsofteng.com for information. - * - */ - -#ifndef BCHARTDIR_HDR -#define BCHARTDIR_HDR - -#ifndef CHARTDIR_DLLAPI -#define CHARTDIR_DLLAPI -#endif - -#if !defined(_WIN32) && !defined(__cdecl) -#define __cdecl -#endif - -extern "C" { - - -//////////////////////////////////////////////////////////////////////////////////////// -// chartdir.h -//////////////////////////////////////////////////////////////////////////////////////// -CHARTDIR_DLLAPI int __cdecl CChart_getVersion(); -CHARTDIR_DLLAPI const char * __cdecl CChart_getDescription(); -CHARTDIR_DLLAPI const char * __cdecl CChart_getCopyright(); -CHARTDIR_DLLAPI void __cdecl CChart_getBootLog(char *buffer); - -CHARTDIR_DLLAPI bool __cdecl CChart_testFont(const char *font, int fontIndex, double fontHeight, - double fontWidth, double angle, char *buffer); -CHARTDIR_DLLAPI void __cdecl CChart_setFontSearchPath(const char *path); - -CHARTDIR_DLLAPI bool __cdecl CChart_isLicensed(); -CHARTDIR_DLLAPI bool __cdecl CChart_getLicenseAttr(const char *key, char *buffer); -CHARTDIR_DLLAPI bool __cdecl CChart_setLicenseFile(const char *filename, char *buffer); -CHARTDIR_DLLAPI bool __cdecl CChart_setLicenseCode(const char *licCode, char *buffer); - -CHARTDIR_DLLAPI double __cdecl CChart_chartTime(int y, int m, int d, int h, int n, int s); -CHARTDIR_DLLAPI double __cdecl CChart_chartTime2(int t); -CHARTDIR_DLLAPI int __cdecl CChart_getChartYMD(double t); - -CHARTDIR_DLLAPI int __cdecl CChart_metalColor(int c, int angle); -CHARTDIR_DLLAPI int __cdecl CChart_encodeFilter(int filterTag, int labelStep, double initialMargin); - -CHARTDIR_DLLAPI int __cdecl CChart_glassEffect(int glareSize, int glareDirection, int raisedEffect); -CHARTDIR_DLLAPI int __cdecl CChart_softLighting(int direction, int raisedEffect); -CHARTDIR_DLLAPI int __cdecl CChart_barLighting(double startBrightness, double endBrightness); -CHARTDIR_DLLAPI int __cdecl CChart_cylinderEffect(int orientation, double ambientIntensity, - double diffuseIntensity, double specularIntensity, int shininess); - -CHARTDIR_DLLAPI double __cdecl CChart_bSearch(const double *a, int len, double v); -CHARTDIR_DLLAPI int __cdecl CChart_ClearTypeMono(double gamma); -CHARTDIR_DLLAPI int __cdecl CChart_ClearTypeColor(double gamma); -CHARTDIR_DLLAPI int __cdecl CChart_phongLighting(double ambientIntensity, double diffuseIntensity, double specularIntensity, int shininess); - - -//////////////////////////////////////////////////////////////////////////////////////// -// libgraphics.h -//////////////////////////////////////////////////////////////////////////////////////// -class TTFTextInternal; -CHARTDIR_DLLAPI void __cdecl CTTFText_destroy(TTFTextInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CTTFText_getWidth(TTFTextInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CTTFText_getHeight(TTFTextInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CTTFText_getLineHeight(TTFTextInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CTTFText_getLineDistance(TTFTextInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CTTFText_draw(TTFTextInternal *ptr, int x, int y, int color, int align); - -class DrawAreaInternal; -CHARTDIR_DLLAPI DrawAreaInternal * __cdecl CDrawArea_create(); -CHARTDIR_DLLAPI void __cdecl CDrawArea_destroy(DrawAreaInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CDrawArea_enableVectorOutput(DrawAreaInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setSize(DrawAreaInternal *ptr, int width, int height, int bgColor); -CHARTDIR_DLLAPI void __cdecl CDrawArea_resize(DrawAreaInternal *ptr, int newWidth, int newHeight, int f, double blur); -CHARTDIR_DLLAPI int __cdecl CDrawArea_getWidth(DrawAreaInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CDrawArea_getHeight(DrawAreaInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setClipRect(DrawAreaInternal *ptr, int left, int top, int right, int bottom); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setBgColor(DrawAreaInternal *ptr, int c); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_move(DrawAreaInternal *ptr, double xOffset, double yOffset, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_rotate(DrawAreaInternal *ptr, double angle, int bgColor, double cx, double cy, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_hFlip(DrawAreaInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CDrawArea_vFlip(DrawAreaInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CDrawArea_clone(DrawAreaInternal *ptr, DrawAreaInternal *d, int x, int y, int align, int newWidth, int newHeight, int ft, double blur); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_pixel(DrawAreaInternal *ptr, int x, int y, int c); -CHARTDIR_DLLAPI int __cdecl CDrawArea_getPixel(DrawAreaInternal *ptr, int x, int y); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_hline(DrawAreaInternal *ptr, int x1, int x2, int y, int c); -CHARTDIR_DLLAPI void __cdecl CDrawArea_vline(DrawAreaInternal *ptr, int y1, int y2, int x, int c); -CHARTDIR_DLLAPI void __cdecl CDrawArea_line(DrawAreaInternal *ptr, double x1, double y1, double x2, double y2, int c, int lineWidth); -CHARTDIR_DLLAPI void __cdecl CDrawArea_arc(DrawAreaInternal *ptr, int cx, int cy, int rx, int ry, double a1, double a2, int c); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_rect(DrawAreaInternal *ptr, int x1, int y1, int x2, int y2, int edgeColor, int fillColor, int raisedEffect); -CHARTDIR_DLLAPI void __cdecl CDrawArea_polygon2(DrawAreaInternal *ptr, const int *xData, int xLen, const int *yData, int yLen, int edgeColor, int fillColor); -CHARTDIR_DLLAPI void __cdecl CDrawArea_polygon(DrawAreaInternal *ptr, const double *xData, int xLen, const double *yData, int yLen, int edgeColor, int fillColor); -CHARTDIR_DLLAPI void __cdecl CDrawArea_surface(DrawAreaInternal *ptr, double x1, double y1, double x2, double y2, int depthX, int depthY, - int edgeColor, int fillColor); -CHARTDIR_DLLAPI void __cdecl CDrawArea_sector(DrawAreaInternal *ptr, int cx, int cy, int rx, int ry, double a1, double a2, int edgeColor, int fillColor); -CHARTDIR_DLLAPI void __cdecl CDrawArea_cylinder(DrawAreaInternal *ptr, int cx, int cy, int rx, int ry, double a1, double a2, - int depthX, int depthY, int edgeColor, int fillColor); -CHARTDIR_DLLAPI void __cdecl CDrawArea_circle(DrawAreaInternal *ptr, int cx, int cy, int rx, int ry, int edgeColor, int fillColor); -CHARTDIR_DLLAPI void __cdecl CDrawArea_ringSector(DrawAreaInternal *ptr, int cx, int cy, int rx, int ry, int rx2, int ry2, double a1, double a2, int edgeColor, int fillColor); -CHARTDIR_DLLAPI void __cdecl CDrawArea_ring(DrawAreaInternal *ptr, int cx, int cy, int rx, int ry, int rx2, int ry2, int edgeColor, int fillColor); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_fill(DrawAreaInternal *ptr, int x, int y, int color); -CHARTDIR_DLLAPI void __cdecl CDrawArea_fill2(DrawAreaInternal *ptr, int x, int y, int color, int borderColor); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_text2(DrawAreaInternal *ptr, const char *str, const char *font, int fontIndex, double fontHeight, double fontWidth, - double angle, bool vertical, int x, int y, int color, int align); -CHARTDIR_DLLAPI void __cdecl CDrawArea_text2w(DrawAreaInternal *ptr, const wchar_t *str, const char *font, int fontIndex, double fontHeight, double fontWidth, - double angle, bool vertical, int x, int y, int color, int align); -CHARTDIR_DLLAPI void __cdecl CDrawArea_text(DrawAreaInternal *ptr, const char *str, const char *font, double fontSize, - int x, int y, int color); -CHARTDIR_DLLAPI void __cdecl CDrawArea_textw(DrawAreaInternal *ptr, const wchar_t *str, const char *font, double fontSize, - int x, int y, int color); -CHARTDIR_DLLAPI TTFTextInternal* __cdecl CDrawArea_text4w(DrawAreaInternal *ptr, const wchar_t *text, const char *font, int fontIndex, - double fontHeight, double fontWidth, double angle, bool vertical); -CHARTDIR_DLLAPI TTFTextInternal* __cdecl CDrawArea_text4(DrawAreaInternal *ptr, const char *text, const char *font, int fontIndex, - double fontHeight, double fontWidth, double angle, bool vertical); -CHARTDIR_DLLAPI TTFTextInternal* __cdecl CDrawArea_text3(DrawAreaInternal *ptr, const char *str, const char *font, double fontSize); -CHARTDIR_DLLAPI TTFTextInternal* __cdecl CDrawArea_text3w(DrawAreaInternal *ptr, const wchar_t *str, const char *font, double fontSize); -CHARTDIR_DLLAPI void __cdecl CDrawArea_close(DrawAreaInternal *ptr, TTFTextInternal *text); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_merge(DrawAreaInternal *ptr, DrawAreaInternal *d, int x, int y, int align, int transparency); -CHARTDIR_DLLAPI void __cdecl CDrawArea_tile(DrawAreaInternal *ptr, DrawAreaInternal *d, int transparency); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_setSearchPath(DrawAreaInternal *ptr, const char *path); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_loadGIF(DrawAreaInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_loadPNG(DrawAreaInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_loadJPG(DrawAreaInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_loadWMP(DrawAreaInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_load(DrawAreaInternal *ptr, const char *filename); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_rAffineTransform(DrawAreaInternal *ptr, double a, double b, double c, double d, double e, double f, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_affineTransform(DrawAreaInternal *ptr, double a, double b, double c, double d, double e, double f, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_sphereTransform(DrawAreaInternal *ptr, int xDiameter, int yDiameter, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_hCylinderTransform(DrawAreaInternal *ptr, int yDiameter, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_vCylinderTransform(DrawAreaInternal *ptr, int xDiameter, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_vTriangleTransform(DrawAreaInternal *ptr, int tHeight, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_hTriangleTransform(DrawAreaInternal *ptr, int tWidth, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_shearTransform(DrawAreaInternal *ptr, double xShear, double yShear, int bgColor, int ft, double blur); -CHARTDIR_DLLAPI void __cdecl CDrawArea_waveTransform(DrawAreaInternal *ptr, int period, double amplitude, double direction, double startAngle, bool longitudinal, int bgColor, int ft, double blur); - -CHARTDIR_DLLAPI bool __cdecl CDrawArea_out(DrawAreaInternal *ptr, const char *filename); - -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outGIF(DrawAreaInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outPNG(DrawAreaInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outJPG(DrawAreaInternal *ptr, const char *filename, int quality); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outWMP(DrawAreaInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outBMP(DrawAreaInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outSVG(DrawAreaInternal *ptr, const char *filename, const char *options); - -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outGIF2(DrawAreaInternal *ptr, const char **data, int *len); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outPNG2(DrawAreaInternal *ptr, const char **data, int *len); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outJPG2(DrawAreaInternal *ptr, const char **data, int *len, int quality); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outWMP2(DrawAreaInternal *ptr, const char **data, int *len); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outBMP2(DrawAreaInternal *ptr, const char **data, int *len); -CHARTDIR_DLLAPI bool __cdecl CDrawArea_outSVG2(DrawAreaInternal *ptr, const char **data, int *len, const char *options); - -CHARTDIR_DLLAPI bool __cdecl CDrawArea_cacheOutput(DrawAreaInternal *ptr, const char *id); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_setPaletteMode(DrawAreaInternal *ptr, int p); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setDitherMethod(DrawAreaInternal *ptr, int m); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setTransparentColor(DrawAreaInternal *ptr, int c); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setAntiAliasText(DrawAreaInternal *ptr, int a); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setAntiAlias(DrawAreaInternal *ptr, bool shapeAntiAlias, int textAntiAlias); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setInterlace(DrawAreaInternal *ptr, bool i); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_setColorTable(DrawAreaInternal *ptr, const int *colors, int noOfColors, int offset); -CHARTDIR_DLLAPI int __cdecl CDrawArea_getARGBColor(DrawAreaInternal *ptr, int c); -CHARTDIR_DLLAPI int __cdecl CDrawArea_halfColor(DrawAreaInternal *ptr, int c); -CHARTDIR_DLLAPI int __cdecl CDrawArea_adjustBrightness(DrawAreaInternal *ptr, int c, double brightness); - -CHARTDIR_DLLAPI int __cdecl CDrawArea_dashLineColor(DrawAreaInternal *ptr, int color, int dashPattern); -CHARTDIR_DLLAPI int __cdecl CDrawArea_patternColor(DrawAreaInternal *ptr, const int *cData, int cLen, int h, int startX, int startY); -CHARTDIR_DLLAPI int __cdecl CDrawArea_patternColor2(DrawAreaInternal *ptr, const char *filename, int startX, int startY); -CHARTDIR_DLLAPI int __cdecl CDrawArea_gradientColor2a(DrawAreaInternal *ptr, const int *c, double angle, double scale, int startX, int startY); -CHARTDIR_DLLAPI int __cdecl CDrawArea_gradientColor2(DrawAreaInternal *ptr, const int *cData, int cLen, double angle, double scale, int startX, int startY); -CHARTDIR_DLLAPI int __cdecl CDrawArea_gradientColor(DrawAreaInternal *ptr, int startX, int startY, int endX, int endY, int startColor, int endColor); -CHARTDIR_DLLAPI int __cdecl CDrawArea_linearGradientColor(DrawAreaInternal *ptr, int startX, int startY, int endX, int endY, int startColor, int endColor, bool periodic); -CHARTDIR_DLLAPI int __cdecl CDrawArea_linearGradientColor2(DrawAreaInternal *ptr, int startX, int startY, int endX, int endY, const int *cData, int cLen, bool periodic); -CHARTDIR_DLLAPI int __cdecl CDrawArea_radialGradientColor(DrawAreaInternal *ptr, int cx, int cy, int rx, int ry, int startColor, int endColor, bool periodic); -CHARTDIR_DLLAPI int __cdecl CDrawArea_radialGradientColor2(DrawAreaInternal *ptr, int cx, int cy, int rx, int ry, const int *cData, int cLen, bool periodic); - -CHARTDIR_DLLAPI int __cdecl CDrawArea_reduceColors(DrawAreaInternal *ptr, int colorCount, bool blackAndWhite); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_setDefaultFonts(DrawAreaInternal *ptr, const char *normal, const char *bold, const char *italic, const char *boldItalic); -CHARTDIR_DLLAPI void __cdecl CDrawArea_setFontTable(DrawAreaInternal *ptr, int index, const char *font); - -CHARTDIR_DLLAPI void __cdecl CDrawArea_initDynamicLayer(DrawAreaInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CDrawArea_removeDynamicLayer(DrawAreaInternal *ptr, bool keepOriginal); - - -//////////////////////////////////////////////////////////////////////////////////////// -// drawobj.h -//////////////////////////////////////////////////////////////////////////////////////// -class DrawObjInternal; -CHARTDIR_DLLAPI void __cdecl CDrawObj_paint(DrawObjInternal *ptr, DrawAreaInternal *d); -CHARTDIR_DLLAPI void __cdecl CDrawObj_setZOrder(DrawObjInternal *ptr, int z); - -class BoxInternal; -CHARTDIR_DLLAPI DrawObjInternal * __cdecl Box2DrawObj(BoxInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CBox_setPos(BoxInternal *ptr, int x, int y); -CHARTDIR_DLLAPI void __cdecl CBox_setSize(BoxInternal *ptr, int w, int h); -CHARTDIR_DLLAPI void __cdecl CBox_setBackground(BoxInternal *ptr, int color, int edgeColor, int raisedEffect); -CHARTDIR_DLLAPI void __cdecl CBox_setRoundedCorners(BoxInternal *ptr, int r1, int r2, int r3, int r4); - -CHARTDIR_DLLAPI int __cdecl CBox_getLeftX(BoxInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CBox_getTopY(BoxInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CBox_getWidth(BoxInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CBox_getHeight(BoxInternal *ptr); -CHARTDIR_DLLAPI const char * __cdecl CBox_getImageCoor(BoxInternal *ptr, int offsetX, int offsetY); - -class TextBoxInternal; -CHARTDIR_DLLAPI BoxInternal * __cdecl TextBox2Box(TextBoxInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CTextBox_setText(TextBoxInternal *ptr, const char *text); -CHARTDIR_DLLAPI void __cdecl CTextBox_setAlignment(TextBoxInternal *ptr, int a); -CHARTDIR_DLLAPI void __cdecl CTextBox_setFontStyle(TextBoxInternal *ptr, const char *font, int fontIndex); -CHARTDIR_DLLAPI void __cdecl CTextBox_setFontSize(TextBoxInternal *ptr, double fontHeight, double fontWidth); -CHARTDIR_DLLAPI void __cdecl CTextBox_setFontAngle(TextBoxInternal *ptr, double angle, bool vertical); -CHARTDIR_DLLAPI void __cdecl CTextBox_setFontColor(TextBoxInternal *ptr, int color); -CHARTDIR_DLLAPI void __cdecl CTextBox_setMargin2(TextBoxInternal *ptr, int leftMargin, int rightMargin, int topMargin, int bottomMargin); -CHARTDIR_DLLAPI void __cdecl CTextBox_setMargin(TextBoxInternal *ptr, int m); -CHARTDIR_DLLAPI void __cdecl CTextBox_setWidth(TextBoxInternal *ptr, int width); -CHARTDIR_DLLAPI void __cdecl CTextBox_setHeight(TextBoxInternal *ptr, int height); -CHARTDIR_DLLAPI void __cdecl CTextBox_setMaxWidth(TextBoxInternal *ptr, int maxWidth); -CHARTDIR_DLLAPI void __cdecl CTextBox_setTruncate(TextBoxInternal *ptr, int maxWidth, int maxLines); - -class LineInternal; -CHARTDIR_DLLAPI DrawObjInternal * __cdecl Line2DrawObj(LineInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CLine_setPos(LineInternal *ptr, int x1, int y1, int x2, int y2); -CHARTDIR_DLLAPI void __cdecl CLine_setColor(LineInternal *ptr, int c); -CHARTDIR_DLLAPI void __cdecl CLine_setWidth(LineInternal *ptr, int w); - -class CDMLTableInternal; -CHARTDIR_DLLAPI DrawObjInternal * __cdecl CDMLTable2DrawObj(CDMLTableInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CCDMLTable_setPos(CDMLTableInternal *ptr, int x, int y, int alignment); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_insertCol(CDMLTableInternal *ptr, int col); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_appendCol(CDMLTableInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CCDMLTable_getColCount(CDMLTableInternal *ptr); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_insertRow(CDMLTableInternal *ptr, int row); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_appendRow(CDMLTableInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CCDMLTable_getRowCount(CDMLTableInternal *ptr); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_setText(CDMLTableInternal *ptr, int col, int row, const char *text); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_setCell(CDMLTableInternal *ptr, int col, int row, int width, int height, const char *text); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_getCell(CDMLTableInternal *ptr, int col, int row); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_getColStyle(CDMLTableInternal *ptr, int col); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_getRowStyle(CDMLTableInternal *ptr, int row); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CCDMLTable_getStyle(CDMLTableInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CCDMLTable_layout(CDMLTableInternal *ptr); - -CHARTDIR_DLLAPI int __cdecl CCDMLTable_getColWidth(CDMLTableInternal *ptr, int col); -CHARTDIR_DLLAPI int __cdecl CCDMLTable_getRowHeight(CDMLTableInternal *ptr, int row); -CHARTDIR_DLLAPI int __cdecl CCDMLTable_getWidth(CDMLTableInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CCDMLTable_getHeight(CDMLTableInternal *ptr); - - -//////////////////////////////////////////////////////////////////////////////////////// -// basechart.h -//////////////////////////////////////////////////////////////////////////////////////// -class LegendBoxInternal; -CHARTDIR_DLLAPI TextBoxInternal * __cdecl LegendBox2TextBox(LegendBoxInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CLegendBox_setCols(LegendBoxInternal *ptr, int noOfCols); -CHARTDIR_DLLAPI void __cdecl CLegendBox_setReverse(LegendBoxInternal *ptr, bool b); - -CHARTDIR_DLLAPI void __cdecl CLegendBox_addKey(LegendBoxInternal *ptr, const char *text, int color, int lineWidth, const DrawAreaInternal *symbol); -CHARTDIR_DLLAPI void __cdecl CLegendBox_addKey2(LegendBoxInternal *ptr, int pos, const char *text, int color, int lineWidth, const DrawAreaInternal *symbol); -CHARTDIR_DLLAPI void __cdecl CLegendBox_setKeySize(LegendBoxInternal *ptr, int width, int height, int gap); -CHARTDIR_DLLAPI void __cdecl CLegendBox_setKeySpacing(LegendBoxInternal *ptr, int keySpacing, int lineSpacing); -CHARTDIR_DLLAPI void __cdecl CLegendBox_setKeyBorder(LegendBoxInternal *ptr, int edgeColor, int raisedEffect); -CHARTDIR_DLLAPI void __cdecl CLegendBox_setLineStyleKey(LegendBoxInternal *ptr, bool b); - -CHARTDIR_DLLAPI const char * __cdecl CLegendBox_getImageCoor(LegendBoxInternal *ptr, int dataItem, int offsetX, int offsetY); -CHARTDIR_DLLAPI const char * __cdecl CLegendBox_getHTMLImageMap(LegendBoxInternal *ptr, const char *url, const char *queryFormat, const char *extraAttr, int offsetX, int offsetY); - -class BaseChartInternal; -CHARTDIR_DLLAPI void __cdecl CBaseChart_destroy(BaseChartInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CBaseChart_enableVectorOutput(BaseChartInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CBaseChart_setSize(BaseChartInternal *ptr, int width, int height); -CHARTDIR_DLLAPI int __cdecl CBaseChart_getWidth(BaseChartInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CBaseChart_getHeight(BaseChartInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setBackground(BaseChartInternal *ptr, int bgColor, int edgeColor, int raisedEffect); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setBorder(BaseChartInternal *ptr, int color); //deprecated - use setBackground -CHARTDIR_DLLAPI void __cdecl CBaseChart_setRoundedFrame(BaseChartInternal *ptr, int extColor, int r1, int r2, int r3, int r4); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setWallpaper(BaseChartInternal *ptr, const char *img); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setBgImage(BaseChartInternal *ptr, const char *img, int align); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setDropShadow(BaseChartInternal *ptr, int color, int offsetX, int offsetY, int blurRadius); - -CHARTDIR_DLLAPI void __cdecl CBaseChart_setTransparentColor(BaseChartInternal *ptr, int c); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setAntiAlias(BaseChartInternal *ptr, bool antiAliasShape, int antiAliasText); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setSearchPath(BaseChartInternal *ptr, const char *path); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CBaseChart_addTitle2(BaseChartInternal *ptr, int alignment, const char *text, const char *font, double fontSize, int fontColor, int bgColor, int edgeColor); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CBaseChart_addTitle(BaseChartInternal *ptr, const char *text, const char *font, double fontSize, int fontColor, int bgColor, int edgeColor); - -CHARTDIR_DLLAPI LegendBoxInternal * __cdecl CBaseChart_addLegend(BaseChartInternal *ptr, int x, int y, bool vertical, const char *font, double fontHeight); -CHARTDIR_DLLAPI LegendBoxInternal * __cdecl CBaseChart_addLegend2(BaseChartInternal *ptr, int x, int y, int noOfCols, const char *font, double fontHeight); -CHARTDIR_DLLAPI LegendBoxInternal * __cdecl CBaseChart_getLegend(BaseChartInternal *ptr); - -CHARTDIR_DLLAPI DrawAreaInternal * __cdecl CBaseChart_getDrawArea(BaseChartInternal *ptr); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CBaseChart_addText(BaseChartInternal *ptr, int x, int y, const char *text, const char *font, double fontSize, int fontColor, int alignment, double angle, bool vertical); -CHARTDIR_DLLAPI LineInternal * __cdecl CBaseChart_addLine(BaseChartInternal *ptr, int x1, int y1, int x2, int y2, int color, int lineWidth); -CHARTDIR_DLLAPI CDMLTableInternal * __cdecl CBaseChart_addTable(BaseChartInternal *ptr, int x, int y, int alignment, int col, int row); -CHARTDIR_DLLAPI void __cdecl CBaseChart_addExtraField(BaseChartInternal *ptr, const char * const * strData, int arrayLen); -CHARTDIR_DLLAPI void __cdecl CBaseChart_addExtraField2(BaseChartInternal *ptr, const double *dblData, int arrayLen); - -CHARTDIR_DLLAPI void __cdecl CBaseChart_setColors(BaseChartInternal *ptr, int paletteEntry, const int *colorsData, int colorsLen); -CHARTDIR_DLLAPI int __cdecl CBaseChart_getColor(BaseChartInternal *ptr, int paletteEntry); -CHARTDIR_DLLAPI int __cdecl CBaseChart_halfColor(BaseChartInternal *ptr, int c); -CHARTDIR_DLLAPI int __cdecl CBaseChart_adjustBrightness(BaseChartInternal *ptr, int c, double brightness); - -CHARTDIR_DLLAPI int __cdecl CBaseChart_dashLineColor(BaseChartInternal *ptr, int color, int patternCode); -CHARTDIR_DLLAPI int __cdecl CBaseChart_patternColor(BaseChartInternal *ptr, const int *cData, int cLen, int h, int startX, int startY); -CHARTDIR_DLLAPI int __cdecl CBaseChart_patternColor2(BaseChartInternal *ptr, const char *filename, int startX, int startY); -CHARTDIR_DLLAPI int __cdecl CBaseChart_gradientColor2a(BaseChartInternal *ptr, const int *c, double angle, double scale, int startX, int startY); -CHARTDIR_DLLAPI int __cdecl CBaseChart_gradientColor2(BaseChartInternal *ptr, const int *cData, int cLen, double angle, double scale, int startX, int startY); -CHARTDIR_DLLAPI int __cdecl CBaseChart_gradientColor(BaseChartInternal *ptr, int startX, int startY, int endX, int endY, int startColor, int endColor); -CHARTDIR_DLLAPI int __cdecl CBaseChart_linearGradientColor(BaseChartInternal *ptr, int startX, int startY, int endX, int endY, int startColor, int endColor, bool periodic); -CHARTDIR_DLLAPI int __cdecl CBaseChart_linearGradientColor2(BaseChartInternal *ptr, int startX, int startY, int endX, int endY, const int *cData, int cLen, bool periodic); -CHARTDIR_DLLAPI int __cdecl CBaseChart_radialGradientColor(BaseChartInternal *ptr, int cx, int cy, int rx, int ry, int startColor, int endColor, bool periodic); -CHARTDIR_DLLAPI int __cdecl CBaseChart_radialGradientColor2(BaseChartInternal *ptr, int cx, int cy, int rx, int ry, const int *cData, int cLen, bool periodic); - -CHARTDIR_DLLAPI void __cdecl CBaseChart_setDefaultFonts(BaseChartInternal *ptr, const char *normal, const char *bold, const char *italic, const char *boldItalic); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setFontTable(BaseChartInternal *ptr, int index, const char *font); - -CHARTDIR_DLLAPI void __cdecl CBaseChart_setNumberFormat(BaseChartInternal *ptr, char thousandSeparator, char decimalPointChar, char signChar); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setMonthNames(BaseChartInternal *ptr, const char * const *namesData, int namesLen); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setWeekDayNames(BaseChartInternal *ptr, const char * const *namesData, int namesLen); -CHARTDIR_DLLAPI void __cdecl CBaseChart_setAMPM(BaseChartInternal *ptr, const char *AM, const char *PM); - -CHARTDIR_DLLAPI const char * __cdecl CBaseChart_formatValue(BaseChartInternal *ptr, double value, const char *formatString); - -CHARTDIR_DLLAPI LegendBoxInternal * __cdecl CBaseChart_layoutLegend(BaseChartInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CBaseChart_layout(BaseChartInternal *ptr); -CHARTDIR_DLLAPI bool __cdecl CBaseChart_makeChart(BaseChartInternal *ptr, const char *filename); -CHARTDIR_DLLAPI bool __cdecl CBaseChart_makeChart2(BaseChartInternal *ptr, int format, const char **data, int *len); -CHARTDIR_DLLAPI DrawAreaInternal * __cdecl CBaseChart_makeChart3(BaseChartInternal *ptr); - -CHARTDIR_DLLAPI const char * __cdecl CBaseChart_getHTMLImageMap(BaseChartInternal *ptr, const char *url, const char *queryFormat, const char *extraAttr, int offsetX, int offsetY); -CHARTDIR_DLLAPI const char * __cdecl CBaseChart_getChartMetrics(BaseChartInternal *ptr); - -class MultiChartInternal; -CHARTDIR_DLLAPI BaseChartInternal * __cdecl MultiChart2BaseChart(MultiChartInternal *ptr); -CHARTDIR_DLLAPI MultiChartInternal * __cdecl CMultiChart_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); -CHARTDIR_DLLAPI void __cdecl CMultiChart_addChart(MultiChartInternal *ptr, int x, int y, BaseChartInternal *c); -CHARTDIR_DLLAPI void __cdecl CMultiChart_setMainChart(MultiChartInternal *ptr, const BaseChartInternal *c); - -CHARTDIR_DLLAPI int __cdecl CBaseChart_getAbsOffsetX(BaseChartInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CBaseChart_getAbsOffsetY(BaseChartInternal *ptr); -CHARTDIR_DLLAPI DrawAreaInternal *__cdecl CBaseChart_initDynamicLayer(BaseChartInternal *ptr) ; -CHARTDIR_DLLAPI void __cdecl CBaseChart_removeDynamicLayer(BaseChartInternal *ptr); -CHARTDIR_DLLAPI const char * __cdecl CBaseChart_getJsChartModel(BaseChartInternal *ptr, const char *options); - - -//////////////////////////////////////////////////////////////////////////////////////// -// piechart.h -//////////////////////////////////////////////////////////////////////////////////////// -class SectorInternal; -CHARTDIR_DLLAPI void __cdecl CSector_setExplode(SectorInternal *ptr, int distance); -CHARTDIR_DLLAPI void __cdecl CSector_setStyle(SectorInternal *ptr, int shadingMethod, int edgeColor, int edgeWidth); -CHARTDIR_DLLAPI void __cdecl CSector_setLabelFormat(SectorInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CSector_setLabelStyle(SectorInternal *ptr, const char *font, double fontSize, int fontColor); -CHARTDIR_DLLAPI void __cdecl CSector_setLabelPos(SectorInternal *ptr, int pos, int joinLineColor); -CHARTDIR_DLLAPI void __cdecl CSector_setLabelLayout(SectorInternal *ptr, int layoutMethod, int pos); -CHARTDIR_DLLAPI void __cdecl CSector_setJoinLine(SectorInternal *ptr, int joinLineColor, int joinLineWidth); -CHARTDIR_DLLAPI void __cdecl CSector_setColor(SectorInternal *ptr, int color, int edgeColor, int joinLineColor); -CHARTDIR_DLLAPI const char * __cdecl CSector_getImageCoor(SectorInternal *ptr, int offsetX, int offsetY); -CHARTDIR_DLLAPI const char * __cdecl CSector_getLabelCoor(SectorInternal *ptr, int offsetX, int offsetY); - -class PieChartInternal; -CHARTDIR_DLLAPI BaseChartInternal * __cdecl PieChart2BaseChart(PieChartInternal *ptr); -CHARTDIR_DLLAPI PieChartInternal * __cdecl CPieChart_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); - -CHARTDIR_DLLAPI void __cdecl CPieChart_setPieSize(PieChartInternal *ptr, int x, int y, int r); -CHARTDIR_DLLAPI void __cdecl CPieChart_setDonutSize(PieChartInternal *ptr, int x, int y, int r, int r2); -CHARTDIR_DLLAPI void __cdecl CPieChart_set3D(PieChartInternal *ptr, int depth, double angle, bool shadowMode); -CHARTDIR_DLLAPI void __cdecl CPieChart_set3D2(PieChartInternal *ptr, const double *depthsData, int depthsLen, double angle, bool shadowMode); -CHARTDIR_DLLAPI void __cdecl CPieChart_setSectorStyle(PieChartInternal *ptr, int shadingMethod, int edgeColor, int edgeWidth); -CHARTDIR_DLLAPI void __cdecl CPieChart_setStartAngle(PieChartInternal *ptr, double startAngle, bool clockWise); -CHARTDIR_DLLAPI void __cdecl CPieChart_setExplode(PieChartInternal *ptr, int sectorNo, int distance); -CHARTDIR_DLLAPI void __cdecl CPieChart_setExplodeGroup(PieChartInternal *ptr, int startSector, int endSector, int distance); - -CHARTDIR_DLLAPI void __cdecl CPieChart_setLabelFormat(PieChartInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPieChart_setLabelStyle(PieChartInternal *ptr, const char *font, double fontSize, int fontColor); -CHARTDIR_DLLAPI void __cdecl CPieChart_setLabelPos(PieChartInternal *ptr, int pos, int joinLineColor); -CHARTDIR_DLLAPI void __cdecl CPieChart_setLabelLayout(PieChartInternal *ptr, int layoutMethod, int pos, int topBound, int bottomBound); -CHARTDIR_DLLAPI void __cdecl CPieChart_setJoinLine(PieChartInternal *ptr, int joinLineColor, int joinLineWidth); -CHARTDIR_DLLAPI void __cdecl CPieChart_setLineColor(PieChartInternal *ptr, int edgeColor, int joinLineColor); - -CHARTDIR_DLLAPI void __cdecl CPieChart_setData(PieChartInternal *ptr, const double *dataData, int dataLen, const char * const * labelsData, int labelsLen); - -CHARTDIR_DLLAPI SectorInternal * __cdecl CPieChart_sector(PieChartInternal *ptr, int sectorNo); - - -//////////////////////////////////////////////////////////////////////////////////////// -// axis.h -//////////////////////////////////////////////////////////////////////////////////////// -class MarkInternal; -class LineObjInternal; -CHARTDIR_DLLAPI TextBoxInternal * __cdecl Mark2TextBox(MarkInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CMark_setValue(MarkInternal *ptr, double value); -CHARTDIR_DLLAPI void __cdecl CMark_setMarkColor(MarkInternal *ptr, int lineColor, int textColor, int tickColor); -CHARTDIR_DLLAPI void __cdecl CMark_setLineWidth(MarkInternal *ptr, int w); -CHARTDIR_DLLAPI void __cdecl CMark_setDrawOnTop(MarkInternal *ptr, bool b); -CHARTDIR_DLLAPI LineObjInternal * __cdecl CMark_getLine(MarkInternal *ptr); - -class AxisInternal; -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CAxis_setLabelStyle(AxisInternal *ptr, const char *font, double fontSize, int fontColor, double fontAngle); -CHARTDIR_DLLAPI void __cdecl CAxis_setLabelFormat(AxisInternal *ptr, const char *formatString); - -CHARTDIR_DLLAPI void __cdecl CAxis_setMultiFormat(AxisInternal *ptr, int filter1, const char *format1, int filter2, const char *format2, int labelSpan, bool promoteFirst); -CHARTDIR_DLLAPI void __cdecl CAxis_setMultiFormat2(AxisInternal *ptr, int filterId, const char *formatString, int labelSpan, bool promoteFirst); -CHARTDIR_DLLAPI void __cdecl CAxis_setFormatCondition(AxisInternal *ptr, const char *condition, double operand); - -CHARTDIR_DLLAPI void __cdecl CAxis_setLabelGap(AxisInternal *ptr, int d); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CAxis_setTitle(AxisInternal *ptr, const char *text, const char *font, double fontSize, int fontColor); -CHARTDIR_DLLAPI void __cdecl CAxis_setTitlePos(AxisInternal *ptr, int alignment, int titleGap); - -CHARTDIR_DLLAPI void __cdecl CAxis_setColors(AxisInternal *ptr, int axisColor, int labelColor, int titleColor, int tickColor); - -CHARTDIR_DLLAPI void __cdecl CAxis_setTickLength(AxisInternal *ptr, int majorTickLen); -CHARTDIR_DLLAPI void __cdecl CAxis_setTickLength2(AxisInternal *ptr, int majorTickLen, int minorTickLen); -CHARTDIR_DLLAPI void __cdecl CAxis_setTickWidth(AxisInternal *ptr, int majorTickWidth, int minorTickWidth); -CHARTDIR_DLLAPI void __cdecl CAxis_setTickColor(AxisInternal *ptr, int majorTickColor, int minorTickColor); - -CHARTDIR_DLLAPI void __cdecl CAxis_setWidth(AxisInternal *ptr, int width); -CHARTDIR_DLLAPI void __cdecl CAxis_setLength(AxisInternal *ptr, int length); -CHARTDIR_DLLAPI void __cdecl CAxis_setOffset(AxisInternal *ptr, int x, int y); -CHARTDIR_DLLAPI void __cdecl CAxis_setAngle(AxisInternal *ptr, double startAngle); -CHARTDIR_DLLAPI void __cdecl CAxis_setMargin(AxisInternal *ptr, int topMargin, int bottomMargin); -CHARTDIR_DLLAPI void __cdecl CAxis_setIndent(AxisInternal *ptr, bool indent); -CHARTDIR_DLLAPI void __cdecl CAxis_setTickOffset(AxisInternal *ptr, double offset); -CHARTDIR_DLLAPI void __cdecl CAxis_setLabelOffset(AxisInternal *ptr, double offset); - -CHARTDIR_DLLAPI void __cdecl CAxis_setAutoScale(AxisInternal *ptr, double topExtension, double bottomExtension, double zeroAffinity); -CHARTDIR_DLLAPI void __cdecl CAxis_setRounding(AxisInternal *ptr, bool roundMin, bool roundMax); -CHARTDIR_DLLAPI void __cdecl CAxis_setTickDensity(AxisInternal *ptr, int majorTickSpacing, int minorTickSpacing); -CHARTDIR_DLLAPI void __cdecl CAxis_setReverse(AxisInternal *ptr, bool b); -CHARTDIR_DLLAPI void __cdecl CAxis_setMinTickInc(AxisInternal *ptr, double inc); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CAxis_setLabels(AxisInternal *ptr, const char * const * labelsData, int labelsLen); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CAxis_setLabels2(AxisInternal *ptr, const double *labelsData, int labelsLen, const char *formatString); - -CHARTDIR_DLLAPI CDMLTableInternal * __cdecl CAxis_makeLabelTable(AxisInternal *ptr); -CHARTDIR_DLLAPI CDMLTableInternal * __cdecl CAxis_getLabelTable(AxisInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CAxis_setLabelStep(AxisInternal *ptr, int majorTickStep, int minorTickStep, int majorTickOffset, int minorTickOffset); - -CHARTDIR_DLLAPI void __cdecl CAxis_setLinearScale3(AxisInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI void __cdecl CAxis_setLinearScale2(AxisInternal *ptr, double lowerLimit, double upperLimit, const char * const * labelsData, int labelsLen); -CHARTDIR_DLLAPI void __cdecl CAxis_setLinearScale(AxisInternal *ptr, double lowerLimit, double upperLimit, double majorTickInc, double minorTickInc); - -CHARTDIR_DLLAPI void __cdecl CAxis_setLogScale3(AxisInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI void __cdecl CAxis_setLogScale2(AxisInternal *ptr, double lowerLimit, double upperLimit, const char * const * labelsData, int labelsLen); -CHARTDIR_DLLAPI void __cdecl CAxis_setLogScale(AxisInternal *ptr, double lowerLimit, double upperLimit, double majorTickInc, double minorTickInc); - -CHARTDIR_DLLAPI void __cdecl CAxis_setDateScale3(AxisInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI void __cdecl CAxis_setDateScale2(AxisInternal *ptr, double lowerLimit, double upperLimit, const char * const * labelsData, int labelsLen); -CHARTDIR_DLLAPI void __cdecl CAxis_setDateScale(AxisInternal *ptr, double lowerLimit, double upperLimit, double majorTickInc, double minorTickInc); - -CHARTDIR_DLLAPI void __cdecl CAxis_syncAxis(AxisInternal *ptr, const AxisInternal *axis, double slope, double intercept); -CHARTDIR_DLLAPI void __cdecl CAxis_copyAxis(AxisInternal *ptr, const AxisInternal *axis); - -CHARTDIR_DLLAPI void __cdecl CAxis_addLabel(AxisInternal *ptr, double pos, const char *label); - -CHARTDIR_DLLAPI MarkInternal * __cdecl CAxis_addMark(AxisInternal *ptr, double value, int lineColor, const char *text, const char *font, double fontSize); -CHARTDIR_DLLAPI void __cdecl CAxis_addZone(AxisInternal *ptr, double startValue, double endValue, int color); - -CHARTDIR_DLLAPI int __cdecl CAxis_getCoor(AxisInternal *ptr, double v); -CHARTDIR_DLLAPI double __cdecl CAxis_getMinValue(AxisInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CAxis_getMaxValue(AxisInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CAxis_getThickness(AxisInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CAxis_getTicks(AxisInternal *ptr, const double **d, int *len); -CHARTDIR_DLLAPI const char * __cdecl CAxis_getLabel(AxisInternal *ptr, double i); - -CHARTDIR_DLLAPI const char * __cdecl CAxis_getAxisImageMap(AxisInternal *ptr, int noOfSegments, int mapWidth, const char *url, const char *queryFormat, const char *extraAttr, int offsetX, int offsetY); -CHARTDIR_DLLAPI const char * __cdecl CAxis_getHTMLImageMap(AxisInternal *ptr, const char *url, const char *queryFormat, const char *extraAttr, int offsetX, int offsetY); - -CHARTDIR_DLLAPI const char * __cdecl CAxis_getFormattedLabel(AxisInternal *ptr, double v, const char *formatString); -CHARTDIR_DLLAPI int __cdecl CAxis_getX(AxisInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CAxis_getY(AxisInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CAxis_getAlignment(AxisInternal *ptr); - -typedef AxisInternal RadialAxisInternal; - -class AngularAxisInternal; -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CAngularAxis_setLabelStyle(AngularAxisInternal *ptr, const char *font, double fontSize, int fontColor, double fontAngle); -CHARTDIR_DLLAPI void __cdecl CAngularAxis_setLabelGap(AngularAxisInternal *ptr, int d); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CAngularAxis_setLabels(AngularAxisInternal *ptr, const char * const * labelsData, int labelsLen); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CAngularAxis_setLabels2(AngularAxisInternal *ptr, const double * labelsData, int labelsLen, const char *formatString); -CHARTDIR_DLLAPI void __cdecl CAngularAxis_addLabel(AngularAxisInternal *ptr, double pos, const char *label); - -CHARTDIR_DLLAPI void __cdecl CAngularAxis_setLinearScale2(AngularAxisInternal *ptr, double lowerLimit, double upperLimit, const char * const * labelsData, int labelsLen); -CHARTDIR_DLLAPI void __cdecl CAngularAxis_setLinearScale(AngularAxisInternal *ptr, double lowerLimit, double upperLimit, double majorTickInc, double minorTickInc); - -CHARTDIR_DLLAPI void __cdecl CAngularAxis_addZone(AngularAxisInternal *ptr, double startValue, double endValue, double startRadius, double endRadius, int fillColor, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CAngularAxis_addZone2(AngularAxisInternal *ptr, double startValue, double endValue, int fillColor, int edgeColor); - -CHARTDIR_DLLAPI const char * __cdecl CAngularAxis_getAxisImageMap(AngularAxisInternal *ptr, int noOfSegments, int mapWidth, const char *url, const char *queryFormat, const char *extraAttr, int offsetX, int offsetY); -CHARTDIR_DLLAPI const char * __cdecl CAngularAxis_getHTMLImageMap(AngularAxisInternal *ptr, const char *url, const char *queryFormat, const char *extraAttr, int offsetX, int offsetY); - -class ColorAxisInternal; -CHARTDIR_DLLAPI AxisInternal * __cdecl ColorAxis2Axis(ColorAxisInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CColorAxis_setColorGradient(ColorAxisInternal *ptr, bool isContinuous, const int *colorsData, int colorsLen, int underflowColor, int overflowColor); -CHARTDIR_DLLAPI void __cdecl CColorAxis_setAxisPos(ColorAxisInternal *ptr, int x, int y, int alignment); -CHARTDIR_DLLAPI void __cdecl CColorAxis_setLevels(ColorAxisInternal *ptr, int maxLevels); -CHARTDIR_DLLAPI void __cdecl CColorAxis_setCompactAxis(ColorAxisInternal *ptr, bool b); -CHARTDIR_DLLAPI void __cdecl CColorAxis_setAxisBorder(ColorAxisInternal *ptr, int edgeColor, int raisedEffect); -CHARTDIR_DLLAPI void __cdecl CColorAxis_setBoundingBox(ColorAxisInternal *ptr, int fillColor, int edgeColor, int raisedEffect); -CHARTDIR_DLLAPI void __cdecl CColorAxis_setBoxMargin(ColorAxisInternal *ptr, int m); -CHARTDIR_DLLAPI void __cdecl CColorAxis_setBoxMargin2(ColorAxisInternal *ptr, int leftMargin, int rightMargin, int topMargin, int bottomMargin); -CHARTDIR_DLLAPI void __cdecl CColorAxis_setRoundedCorners(ColorAxisInternal *ptr, int r1, int r2, int r3, int r4); -CHARTDIR_DLLAPI int __cdecl CColorAxis_getBoxWidth(ColorAxisInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CColorAxis_getBoxHeight(ColorAxisInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CColorAxis_getColor(ColorAxisInternal *ptr, double z); - - -//////////////////////////////////////////////////////////////////////////////////////// -// layer.h -//////////////////////////////////////////////////////////////////////////////////////// -class DataSetInternal; -CHARTDIR_DLLAPI void __cdecl CDataSet_setData(DataSetInternal *ptr, const double *dataData, int dataLen); -CHARTDIR_DLLAPI void __cdecl CDataSet_setDataName(DataSetInternal *ptr, const char *name); -CHARTDIR_DLLAPI void __cdecl CDataSet_setDataColor(DataSetInternal *ptr, int dataColor, int edgeColor, int shadowColor, int shadowEdgeColor); - -CHARTDIR_DLLAPI void __cdecl CDataSet_setDataSymbol2(DataSetInternal *ptr, const char *image); -CHARTDIR_DLLAPI void __cdecl CDataSet_setDataSymbol3(DataSetInternal *ptr, const DrawAreaInternal *image); -CHARTDIR_DLLAPI void __cdecl CDataSet_setDataSymbol(DataSetInternal *ptr, int symbol, int size, int fillColor, int edgeColor, int lineWidth); -CHARTDIR_DLLAPI void __cdecl CDataSet_setDataSymbol4(DataSetInternal *ptr, const int *polygonData, int polygonLen, int size, int fillColor, int edgeColor); - -CHARTDIR_DLLAPI void __cdecl CDataSet_setLineWidth(DataSetInternal *ptr, int w); - -CHARTDIR_DLLAPI void __cdecl CDataSet_setDataLabelFormat(DataSetInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CDataSet_setDataLabelStyle(DataSetInternal *ptr, const char *font, double fontSize, int fontColor, double fontAngle); - -CHARTDIR_DLLAPI void __cdecl CDataSet_setUseYAxis2(DataSetInternal *ptr, bool b); -CHARTDIR_DLLAPI void __cdecl CDataSet_setUseYAxis(DataSetInternal *ptr, const AxisInternal* a); - -CHARTDIR_DLLAPI double __cdecl CDataSet_getValue(DataSetInternal *ptr, int i); -CHARTDIR_DLLAPI double __cdecl CDataSet_getPosition(DataSetInternal *ptr, int i); -CHARTDIR_DLLAPI const char * __cdecl CDataSet_getDataName(DataSetInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CDataSet_getDataColor(DataSetInternal *ptr); -CHARTDIR_DLLAPI const char * __cdecl CDataSet_getLegendIcon(DataSetInternal *ptr); -CHARTDIR_DLLAPI AxisInternal * __cdecl CDataSet_getUseYAxis(DataSetInternal *ptr); - -class LayerInternal; -CHARTDIR_DLLAPI void __cdecl CLayer_moveFront(LayerInternal *ptr, LayerInternal *layer); -CHARTDIR_DLLAPI void __cdecl CLayer_moveBack(LayerInternal *ptr, LayerInternal *layer); - -CHARTDIR_DLLAPI void __cdecl CLayer_set3D(LayerInternal *ptr, int d, int zGap); -CHARTDIR_DLLAPI void __cdecl CLayer_setLineWidth(LayerInternal *ptr, int w); -CHARTDIR_DLLAPI void __cdecl CLayer_setBorderColor(LayerInternal *ptr, int color, int raisedEffect); -CHARTDIR_DLLAPI void __cdecl CLayer_setLegend(LayerInternal *ptr, int m); -CHARTDIR_DLLAPI void __cdecl CLayer_setLegendOrder(LayerInternal *ptr, int dataSetOrder, int layerOrder); -CHARTDIR_DLLAPI const char * __cdecl CLayer_getLegendIcon(LayerInternal *ptr, int dataSetNo); - -CHARTDIR_DLLAPI void __cdecl CLayer_setDataCombineMethod(LayerInternal *ptr, int m); -CHARTDIR_DLLAPI void __cdecl CLayer_setBaseLine(LayerInternal *ptr, double baseLine); - -CHARTDIR_DLLAPI DataSetInternal * __cdecl CLayer_addDataSet(LayerInternal *ptr, const double *dataData, int dataLen, int color, const char *name); -CHARTDIR_DLLAPI void __cdecl CLayer_addDataGroup(LayerInternal *ptr, const char *name); -CHARTDIR_DLLAPI void __cdecl CLayer_addExtraField(LayerInternal *ptr, const char * const * textsData, int textsLen); -CHARTDIR_DLLAPI void __cdecl CLayer_addExtraField2(LayerInternal *ptr, const double *numbersData, int numbersLen); -CHARTDIR_DLLAPI DataSetInternal * __cdecl CLayer_getDataSet(LayerInternal *ptr, int dataSet); -CHARTDIR_DLLAPI void __cdecl CLayer_setUseYAxis2(LayerInternal *ptr, bool b); -CHARTDIR_DLLAPI void __cdecl CLayer_setUseYAxis(LayerInternal *ptr, const AxisInternal* a); - -CHARTDIR_DLLAPI void __cdecl CLayer_setXData(LayerInternal *ptr, const double *xDataData, int xDataLen); -CHARTDIR_DLLAPI void __cdecl CLayer_setXData2(LayerInternal *ptr, double minValue, double maxValue); -CHARTDIR_DLLAPI void __cdecl CLayer_alignLayer(LayerInternal *ptr, const LayerInternal *layer, int dataSet); - -CHARTDIR_DLLAPI int __cdecl CLayer_getXCoor(LayerInternal *ptr, double v); -CHARTDIR_DLLAPI int __cdecl CLayer_getYCoor(LayerInternal *ptr, double v, bool yAxis); -CHARTDIR_DLLAPI int __cdecl CLayer_getYCoor2(LayerInternal *ptr, double v, const AxisInternal *yAxis); -CHARTDIR_DLLAPI int __cdecl CLayer_xZoneColor(LayerInternal *ptr, double threshold, int belowColor, int aboveColor); -CHARTDIR_DLLAPI int __cdecl CLayer_yZoneColor(LayerInternal *ptr, double threshold, int belowColor, int aboveColor, bool mainAxis); -CHARTDIR_DLLAPI int __cdecl CLayer_yZoneColor2(LayerInternal *ptr, double threshold, int belowColor, int aboveColor, const AxisInternal *yAxis); - -CHARTDIR_DLLAPI const char * __cdecl CLayer_getImageCoor(LayerInternal *ptr, int dataSet, int dataItem, int offsetX, int offsetY); -CHARTDIR_DLLAPI const char * __cdecl CLayer_getImageCoor2(LayerInternal *ptr, int dataItem, int offsetX, int offsetY); -CHARTDIR_DLLAPI const char * __cdecl CLayer_getHTMLImageMap(LayerInternal *ptr, const char *url, const char *queryFormat, const char *extraAttr, int offsetX, int offsetY); -CHARTDIR_DLLAPI void __cdecl CLayer_setHTMLImageMap(LayerInternal *ptr, const char *url, const char *queryFormat, const char *extraAttr); - -CHARTDIR_DLLAPI void __cdecl CLayer_setDataLabelFormat(LayerInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CLayer_setDataLabelStyle(LayerInternal *ptr, const char *font, double fontSize, int fontColor, double fontAngle); - -CHARTDIR_DLLAPI void __cdecl CLayer_setAggregateLabelFormat(LayerInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CLayer_setAggregateLabelStyle(LayerInternal *ptr, const char *font, double fontSize, int fontColor, double fontAngle); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CLayer_addCustomDataLabel(LayerInternal *ptr, int dataSet, int dataItem, const char *label, const char *font, double fontSize, int fontColor, double fontAngle); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CLayer_addCustomAggregateLabel(LayerInternal *ptr, int dataItem, const char *label, const char *font, double fontSize, int fontColor, double fontAngle); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CLayer_addCustomGroupLabel(LayerInternal *ptr, int dataGroup, int dataItem, const char *label, const char *font, double fontSize, int fontColor, double fontAngle); - -CHARTDIR_DLLAPI DataSetInternal * __cdecl CLayer_getDataSetByZ(LayerInternal *ptr, int i); -CHARTDIR_DLLAPI int __cdecl CLayer_getDataSetCount(LayerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CLayer_getXPosition(LayerInternal *ptr, int i); -CHARTDIR_DLLAPI double __cdecl CLayer_getNearestXValue(LayerInternal *ptr, double target); -CHARTDIR_DLLAPI int __cdecl CLayer_getXIndexOf(LayerInternal *ptr, double xValue, double tolerance); - -//////////////////////////////////////////////////////////////////////////////////////// -// barlayer.h -//////////////////////////////////////////////////////////////////////////////////////// -class BarLayerInternal; -CHARTDIR_DLLAPI LayerInternal * __cdecl BarLayer2Layer(BarLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CBarLayer_setBarGap(BarLayerInternal *ptr, double barGap, double subBarGap); -CHARTDIR_DLLAPI void __cdecl CBarLayer_setBarWidth(BarLayerInternal *ptr, int barWidth, int subBarWidth); -CHARTDIR_DLLAPI void __cdecl CBarLayer_setMinLabelSize(BarLayerInternal *ptr, int s); -CHARTDIR_DLLAPI void __cdecl CBarLayer_setMinImageMapSize(BarLayerInternal *ptr, int s); -CHARTDIR_DLLAPI void __cdecl CBarLayer_setBarShape(BarLayerInternal *ptr, int shape, int dataGroup, int dataItem); -CHARTDIR_DLLAPI void __cdecl CBarLayer_setBarShape2(BarLayerInternal *ptr, const int *shapeData, int shapeLen, int dataGroup, int dataItem); -CHARTDIR_DLLAPI void __cdecl CBarLayer_setIconSize(BarLayerInternal *ptr, int height, int width); -CHARTDIR_DLLAPI void __cdecl CBarLayer_setOverlapRatio(BarLayerInternal *ptr, double overlapRatio, bool firstOnTop); - - -//////////////////////////////////////////////////////////////////////////////////////// -// linelayer.h -//////////////////////////////////////////////////////////////////////////////////////// -class InterLineLayerInternal; -CHARTDIR_DLLAPI LayerInternal * __cdecl InterLineLayer2Layer(InterLineLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CInterLineLayer_setGapColor(InterLineLayerInternal *ptr, int gapColor12, int gapColor21); - -class LineLayerInternal; -CHARTDIR_DLLAPI LayerInternal * __cdecl LineLayer2Layer(LineLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CLineLayer_setSymbolScale(LineLayerInternal *ptr, const double *zDataXData, int zDataXLen, int scaleTypeX, const double *zDataYData, int zDataYLen, int scaleTypeY); -CHARTDIR_DLLAPI void __cdecl CLineLayer_setGapColor(LineLayerInternal *ptr, int lineColor, int lineWidth); -CHARTDIR_DLLAPI void __cdecl CLineLayer_setImageMapWidth(LineLayerInternal *ptr, int width); -CHARTDIR_DLLAPI LineObjInternal * __cdecl CLineLayer_getLine(LineLayerInternal *ptr, int dataSet); -CHARTDIR_DLLAPI void __cdecl CLineLayer_setFastLineMode(LineLayerInternal *ptr, bool b); - -class SplineLayerInternal; -CHARTDIR_DLLAPI LineLayerInternal * __cdecl SplineLayer2LineLayer(SplineLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CSplineLayer_setTension(SplineLayerInternal *ptr, double tension); -CHARTDIR_DLLAPI void __cdecl CSplineLayer_setMonotonicity(SplineLayerInternal *ptr, int m); - -class StepLineLayerInternal; -CHARTDIR_DLLAPI LineLayerInternal * __cdecl StepLineLayer2LineLayer(StepLineLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CStepLineLayer_setAlignment(StepLineLayerInternal *ptr, int a); - -typedef LineLayerInternal ScatterLayerInternal; - - -//////////////////////////////////////////////////////////////////////////////////////// -// arealayer.h -//////////////////////////////////////////////////////////////////////////////////////// -class AreaLayerInternal; -CHARTDIR_DLLAPI LayerInternal * __cdecl AreaLayer2Layer(AreaLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CAreaLayer_setMinLabelSize(AreaLayerInternal *ptr, int s); -CHARTDIR_DLLAPI void __cdecl CAreaLayer_setGapColor(AreaLayerInternal *ptr, int fillColor); - - -//////////////////////////////////////////////////////////////////////////////////////// -// hloclayer.h -//////////////////////////////////////////////////////////////////////////////////////// -class BaseBoxLayerInternal; -CHARTDIR_DLLAPI LayerInternal * __cdecl BaseBoxLayer2Layer(BaseBoxLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CBaseBoxLayer_setDataGap(BaseBoxLayerInternal *ptr, double gap); -CHARTDIR_DLLAPI void __cdecl CBaseBoxLayer_setDataWidth(BaseBoxLayerInternal *ptr, int width); -CHARTDIR_DLLAPI void __cdecl CBaseBoxLayer_setMinImageMapSize(BaseBoxLayerInternal *ptr, int size); - -class HLOCLayerInternal; -CHARTDIR_DLLAPI BaseBoxLayerInternal * __cdecl HLOCLayer2BaseBoxLayer(HLOCLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CHLOCLayer_setColorMethod(HLOCLayerInternal *ptr, int colorMethod, int riseColor, int fallColor, double leadValue); - -class CandleStickLayerInternal; -CHARTDIR_DLLAPI BaseBoxLayerInternal * __cdecl CandleStickLayer2BaseBoxLayer(CandleStickLayerInternal *ptr); - -class BoxWhiskerLayerInternal; -CHARTDIR_DLLAPI BaseBoxLayerInternal * __cdecl BoxWhiskerLayer2BaseBoxLayer(BoxWhiskerLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CBoxWhiskerLayer_setBoxColors(BoxWhiskerLayerInternal *ptr, const int *colorsData, int colorsLen, const char * const * namesData, int namesLen); -CHARTDIR_DLLAPI void __cdecl CBoxWhiskerLayer_setBoxColor(BoxWhiskerLayerInternal *ptr, int item, int boxColor); -CHARTDIR_DLLAPI void __cdecl CBoxWhiskerLayer_setWhiskerBrightness(BoxWhiskerLayerInternal *ptr, double whiskerBrightness); - - -//////////////////////////////////////////////////////////////////////////////////////// -// trendlayer.h -//////////////////////////////////////////////////////////////////////////////////////// -class TrendLayerInternal; -CHARTDIR_DLLAPI LayerInternal * __cdecl TrendLayer2Layer(TrendLayerInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CTrendLayer_setRegressionType(TrendLayerInternal *ptr, int regressionType); - -CHARTDIR_DLLAPI void __cdecl CTrendLayer_addConfidenceBand(TrendLayerInternal *ptr, double confidence, int upperFillColor, int upperEdgeColor, int upperLineWidth, int lowerFillColor, int lowerEdgeColor, int lowerLineWidth); -CHARTDIR_DLLAPI void __cdecl CTrendLayer_addPredictionBand(TrendLayerInternal *ptr, double confidence, int upperFillColor, int upperEdgeColor, int upperLineWidth, int lowerFillColor, int lowerEdgeColor, int lowerLineWidth); - -CHARTDIR_DLLAPI double __cdecl CTrendLayer_getSlope(TrendLayerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CTrendLayer_getIntercept(TrendLayerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CTrendLayer_getCorrelation(TrendLayerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CTrendLayer_getStdError(TrendLayerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CTrendLayer_getCoefficient(TrendLayerInternal *ptr, int i); - -CHARTDIR_DLLAPI void __cdecl CTrendLayer_setImageMapWidth(TrendLayerInternal *ptr, int width); -CHARTDIR_DLLAPI LineObjInternal * __cdecl CTrendLayer_getLine(TrendLayerInternal *ptr); - - -//////////////////////////////////////////////////////////////////////////////////////// -// vectorlayer.h -//////////////////////////////////////////////////////////////////////////////////////// -class VectorLayerInternal; -CHARTDIR_DLLAPI LayerInternal * __cdecl VectorLayer2Layer(VectorLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CVectorLayer_setVector(VectorLayerInternal *ptr, const double * lengthsData, int lengthsLen, const double *directionsData, int directionsLen, int lengthScale); -CHARTDIR_DLLAPI void __cdecl CVectorLayer_setArrowHead2(VectorLayerInternal *ptr, const int *polygonData, int polygonLen); -CHARTDIR_DLLAPI void __cdecl CVectorLayer_setArrowHead(VectorLayerInternal *ptr, int width, int height); -CHARTDIR_DLLAPI void __cdecl CVectorLayer_setArrowStem(VectorLayerInternal *ptr, const int *polygonData, int polygonLen); -CHARTDIR_DLLAPI void __cdecl CVectorLayer_setArrowAlignment(VectorLayerInternal *ptr, int alignment); -CHARTDIR_DLLAPI void __cdecl CVectorLayer_setIconSize(VectorLayerInternal *ptr, int height, int width); -CHARTDIR_DLLAPI void __cdecl CVectorLayer_setVectorMargin(VectorLayerInternal *ptr, double startMargin, double endMargin); - - -//////////////////////////////////////////////////////////////////////////////////////// -// contourlayer.h -//////////////////////////////////////////////////////////////////////////////////////// -class ContourLayerInternal; -CHARTDIR_DLLAPI LayerInternal * __cdecl ContourLayer2Layer(ContourLayerInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CContourLayer_setZData(ContourLayerInternal *ptr, const double *zDataData, int zDataLen); -CHARTDIR_DLLAPI void __cdecl CContourLayer_setSmoothInterpolation(ContourLayerInternal *ptr, bool b); -CHARTDIR_DLLAPI void __cdecl CContourLayer_setContourColor(ContourLayerInternal *ptr, int contourColor, int minorContourColor); -CHARTDIR_DLLAPI void __cdecl CContourLayer_setContourWidth(ContourLayerInternal *ptr, int contourWidth, int minorContourWidth); -CHARTDIR_DLLAPI ColorAxisInternal * __cdecl CContourLayer_setColorAxis(ContourLayerInternal *ptr, int x, int y, int alignment, int length, int orientation); -CHARTDIR_DLLAPI ColorAxisInternal * __cdecl CContourLayer_colorAxis(ContourLayerInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CContourLayer_setZBounds(ContourLayerInternal *ptr, double minZ, double maxZ); -CHARTDIR_DLLAPI void __cdecl CContourLayer_setExactContour(ContourLayerInternal *ptr, bool contour, bool markContour); - - -//////////////////////////////////////////////////////////////////////////////////////// -// xychart.h -//////////////////////////////////////////////////////////////////////////////////////// -class PlotAreaInternal; -CHARTDIR_DLLAPI void __cdecl CPlotArea_setBackground(PlotAreaInternal *ptr, int color, int altBgColor, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CPlotArea_setBackground2(PlotAreaInternal *ptr, const char *img, int align); -CHARTDIR_DLLAPI void __cdecl CPlotArea_set4QBgColor(PlotAreaInternal *ptr, int Q1Color, int Q2Color, int Q3Color, int Q4Color, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CPlotArea_setAltBgColor(PlotAreaInternal *ptr, bool horizontal, int color1, int color2, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CPlotArea_setGridColor(PlotAreaInternal *ptr, int hGridColor, int vGridColor, int minorHGridColor, int minorVGridColor); -CHARTDIR_DLLAPI void __cdecl CPlotArea_setGridWidth(PlotAreaInternal *ptr, int hGridWidth, int vGridWidth, int minorHGridWidth, int minorVGridWidth); -CHARTDIR_DLLAPI void __cdecl CPlotArea_setGridAxis(PlotAreaInternal *ptr, const AxisInternal *xGridAxis, const AxisInternal *yGridAxis); -CHARTDIR_DLLAPI void __cdecl CPlotArea_moveGridBefore(PlotAreaInternal *ptr, LayerInternal *layer); - -CHARTDIR_DLLAPI int __cdecl CPlotArea_getLeftX(PlotAreaInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CPlotArea_getTopY(PlotAreaInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CPlotArea_getWidth(PlotAreaInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CPlotArea_getHeight(PlotAreaInternal *ptr); - -CHARTDIR_DLLAPI int __cdecl CPlotArea_getRightX(PlotAreaInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CPlotArea_getBottomY(PlotAreaInternal *ptr); - -class XYChartInternal; -CHARTDIR_DLLAPI BaseChartInternal * __cdecl XYChart2BaseChart(XYChartInternal *ptr); -CHARTDIR_DLLAPI XYChartInternal * __cdecl CXYChart_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); - -CHARTDIR_DLLAPI AxisInternal * __cdecl CXYChart_addAxis(XYChartInternal *ptr, int align, int offset); -CHARTDIR_DLLAPI AxisInternal * __cdecl CXYChart_yAxis(XYChartInternal *ptr); -CHARTDIR_DLLAPI AxisInternal * __cdecl CXYChart_yAxis2(XYChartInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CXYChart_syncYAxis(XYChartInternal *ptr, double slope, double intercept); -CHARTDIR_DLLAPI void __cdecl CXYChart_setYAxisOnRight(XYChartInternal *ptr, bool b); -CHARTDIR_DLLAPI AxisInternal * __cdecl CXYChart_xAxis(XYChartInternal *ptr); -CHARTDIR_DLLAPI AxisInternal * __cdecl CXYChart_xAxis2(XYChartInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CXYChart_setXAxisOnTop(XYChartInternal *ptr, bool b); -CHARTDIR_DLLAPI void __cdecl CXYChart_swapXY(XYChartInternal *ptr, bool b); -CHARTDIR_DLLAPI void __cdecl CXYChart_setAxisAtOrigin(XYChartInternal *ptr, int originMode, int symmetryMode); - -CHARTDIR_DLLAPI int __cdecl CXYChart_getXCoor(XYChartInternal *ptr, double v); -CHARTDIR_DLLAPI int __cdecl CXYChart_getYCoor(XYChartInternal *ptr, double v, const AxisInternal *yAxis); -CHARTDIR_DLLAPI int __cdecl CXYChart_xZoneColor(XYChartInternal *ptr, double threshold, int belowColor, int aboveColor); -CHARTDIR_DLLAPI int __cdecl CXYChart_yZoneColor(XYChartInternal *ptr, double threshold, int belowColor, int aboveColor, const AxisInternal *axis); - -CHARTDIR_DLLAPI PlotAreaInternal * __cdecl CXYChart_setPlotArea(XYChartInternal *ptr, int x, int y, int width, int height, int bgColor, int altBgColor, int edgeColor, int hGridColor, int vGridColor); -CHARTDIR_DLLAPI PlotAreaInternal * __cdecl CXYChart_getPlotArea(XYChartInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CXYChart_setClipping(XYChartInternal *ptr, int margin); -CHARTDIR_DLLAPI void __cdecl CXYChart_setTrimData(XYChartInternal *ptr, int startPos, int len); - -CHARTDIR_DLLAPI BarLayerInternal * __cdecl CXYChart_addBarLayer(XYChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name, int depth); -CHARTDIR_DLLAPI BarLayerInternal * __cdecl CXYChart_addBarLayer3(XYChartInternal *ptr, const double *dataData, int dataLen, const int *colorsData, int colorsLen, const char * const *namesData, int namesLen, int depth); -CHARTDIR_DLLAPI BarLayerInternal * __cdecl CXYChart_addBarLayer2(XYChartInternal *ptr, int dataCombineMethod, int depth); - -CHARTDIR_DLLAPI LineLayerInternal * __cdecl CXYChart_addLineLayer(XYChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name, int depth); -CHARTDIR_DLLAPI LineLayerInternal * __cdecl CXYChart_addLineLayer2(XYChartInternal *ptr, int dataCombineMethod, int depth); - -CHARTDIR_DLLAPI AreaLayerInternal * __cdecl CXYChart_addAreaLayer(XYChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name, int depth); -CHARTDIR_DLLAPI AreaLayerInternal * __cdecl CXYChart_addAreaLayer2(XYChartInternal *ptr, int dataCombineMethod, int depth); - -CHARTDIR_DLLAPI HLOCLayerInternal * __cdecl CXYChart_addHLOCLayer2(XYChartInternal *ptr); -CHARTDIR_DLLAPI HLOCLayerInternal * __cdecl CXYChart_addHLOCLayer(XYChartInternal *ptr, const double *highDataData, int highDataLen, - const double *lowDataData, int lowDataLen, const double *openDataData, int openDataLen, - const double *closeDataData, int closeDataLen, int color); -CHARTDIR_DLLAPI HLOCLayerInternal * __cdecl CXYChart_addHLOCLayer3(XYChartInternal *ptr, const double *highDataData, int highDataLen, - const double *lowDataData, int lowDataLen, const double *openDataData, int openDataLen, - const double *closeDataData, int closeDataLen, int upColor, int downColor, int colorMode, double leadValue); - -CHARTDIR_DLLAPI CandleStickLayerInternal * __cdecl CXYChart_addCandleStickLayer(XYChartInternal *ptr, const double *highDataData, int highDataLen, - const double *lowDataData, int lowDataLen, const double *openDataData, int openDataLen, - const double *closeDataData, int closeDataLen, int riseColor, int fallColor, int edgeColor); - -CHARTDIR_DLLAPI BoxWhiskerLayerInternal * __cdecl CXYChart_addBoxWhiskerLayer(XYChartInternal *ptr, const double *boxTopData, int boxTopLen, - const double *boxBottomData, int boxBottomLen, const double *maxDataData, int maxDataLen, - const double *minDataData, int minDataLen, const double *midDataData, int midDataLen, - int fillColor, int whiskerColor, int edgeColor); -CHARTDIR_DLLAPI BoxWhiskerLayerInternal * __cdecl CXYChart_addBoxWhiskerLayer2(XYChartInternal *ptr, const double *boxTopData, int boxTopLen, - const double *boxBottomData, int boxBottomLen, const double *maxDataData, int maxDataLen, - const double *minDataData, int minDataLen, const double *midDataData, int midDataLen, - const int *fillColorsData, int fillColorsLen, double whiskerBrightness, const char * const * namesData, int namesLen); -CHARTDIR_DLLAPI BoxWhiskerLayerInternal * __cdecl CXYChart_addBoxLayer(XYChartInternal *ptr, const double *boxTopData, int boxTopLen, - const double *boxBottomData, int boxBottomLen, int color, const char *name); - -CHARTDIR_DLLAPI ScatterLayerInternal * __cdecl CXYChart_addScatterLayer(XYChartInternal *ptr, const double *xDataData, int xDataLen, const double *yDataData, int yDataLen, const char *name, - int symbol, int symbolSize, int fillColor, int edgeColor); - -CHARTDIR_DLLAPI TrendLayerInternal * __cdecl CXYChart_addTrendLayer(XYChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name, int depth); -CHARTDIR_DLLAPI TrendLayerInternal * __cdecl CXYChart_addTrendLayer2(XYChartInternal *ptr, const double *xDataData, int xDataLen, const double *yDataData, int yDataLen, int color, const char *name, int depth); - -CHARTDIR_DLLAPI SplineLayerInternal * __cdecl CXYChart_addSplineLayer(XYChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name); -CHARTDIR_DLLAPI StepLineLayerInternal * __cdecl CXYChart_addStepLineLayer(XYChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name); - -CHARTDIR_DLLAPI InterLineLayerInternal * __cdecl CXYChart_addInterLineLayer(XYChartInternal *ptr, LineObjInternal *line1, LineObjInternal *line2, int color12, int color21); - -CHARTDIR_DLLAPI VectorLayerInternal * __cdecl CXYChart_addVectorLayer(XYChartInternal *ptr, const double *xDataData, int xDataLen, - const double *yDataData, int yDataLen, const double *lengthsData, int lengthsLen, const double *directionsData, int directionsLen, int lengthScale, int color, const char *name); - -CHARTDIR_DLLAPI ContourLayerInternal * __cdecl CXYChart_addContourLayer(XYChartInternal *ptr, const double *xDataData, int xDataLen, - const double *yDataData, int yDataLen, const double *zDataData, int zDataLen); - -CHARTDIR_DLLAPI void __cdecl CXYChart_layoutAxes(XYChartInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CXYChart_packPlotArea(XYChartInternal *ptr, int leftX, int topY, int rightX, int bottomY, int minWidth, int minHeight); - -CHARTDIR_DLLAPI double __cdecl CXYChart_getXValue(XYChartInternal *ptr, int xCoor); -CHARTDIR_DLLAPI double __cdecl CXYChart_getNearestXValue(XYChartInternal *ptr, double xCoor); -CHARTDIR_DLLAPI double __cdecl CXYChart_getYValue(XYChartInternal *ptr, int yCoor, const AxisInternal *yAxis); -CHARTDIR_DLLAPI LayerInternal * __cdecl CXYChart_getLayer(XYChartInternal *ptr, int i); -CHARTDIR_DLLAPI LayerInternal * __cdecl CXYChart_getLayerByZ(XYChartInternal *ptr, int i); -CHARTDIR_DLLAPI int __cdecl CXYChart_getLayerCount(XYChartInternal *ptr); - - -//////////////////////////////////////////////////////////////////////////////////////// -// surfacechart.h -//////////////////////////////////////////////////////////////////////////////////////// -class ThreeDChartInternal; -CHARTDIR_DLLAPI BaseChartInternal * __cdecl ThreeDChart2BaseChart(ThreeDChartInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CThreeDChart_setPlotRegion(ThreeDChartInternal *ptr, int cx, int cy, int xWidth, int yDepth, int zHeight); -CHARTDIR_DLLAPI void __cdecl CThreeDChart_setViewAngle(ThreeDChartInternal *ptr, double elevation, double rotation, double twist); -CHARTDIR_DLLAPI void __cdecl CThreeDChart_setPerspective(ThreeDChartInternal *ptr, double perspective); - -CHARTDIR_DLLAPI AxisInternal * __cdecl CThreeDChart_xAxis(ThreeDChartInternal *ptr); -CHARTDIR_DLLAPI AxisInternal * __cdecl CThreeDChart_yAxis(ThreeDChartInternal *ptr); -CHARTDIR_DLLAPI AxisInternal * __cdecl CThreeDChart_zAxis(ThreeDChartInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CThreeDChart_setZAxisPos(ThreeDChartInternal *ptr, int pos); - -CHARTDIR_DLLAPI ColorAxisInternal * __cdecl CThreeDChart_setColorAxis(ThreeDChartInternal *ptr, int x, int y, int alignment, int length, int orientation); -CHARTDIR_DLLAPI ColorAxisInternal * __cdecl CThreeDChart_colorAxis(ThreeDChartInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CThreeDChart_setWallVisibility(ThreeDChartInternal *ptr, bool xyVisible, bool yzVisible, bool zxVisible); -CHARTDIR_DLLAPI void __cdecl CThreeDChart_setWallColor(ThreeDChartInternal *ptr, int xyColor, int yzColor, int zxColor, int borderColor); -CHARTDIR_DLLAPI void __cdecl CThreeDChart_setWallThickness(ThreeDChartInternal *ptr, int xyThickness, int yzThickness, int zxThickness); -CHARTDIR_DLLAPI void __cdecl CThreeDChart_setWallGrid(ThreeDChartInternal *ptr, int majorXGridColor, int majorYGridColor, int majorZGridColor, - int minorXGridColor, int minorYGridColor, int minorZGridColor); - -class SurfaceChartInternal; -CHARTDIR_DLLAPI ThreeDChartInternal * __cdecl SurfaceChart2ThreeDChart(SurfaceChartInternal *ptr); -CHARTDIR_DLLAPI SurfaceChartInternal * __cdecl CSurfaceChart_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); - -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setData(SurfaceChartInternal *ptr, const double *xDataData, int xDataLen, - const double *yDataData, int yDataLen, const double *zDataData, int zDataLen); -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setInterpolation(SurfaceChartInternal *ptr, int xSamples, int ySamples, bool isSmooth); - -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setLighting(SurfaceChartInternal *ptr, double ambientIntensity, double diffuseIntensity, double specularIntensity, double shininess); -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setShadingMode(SurfaceChartInternal *ptr, int shadingMode, int wireWidth); - -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setSurfaceAxisGrid(SurfaceChartInternal *ptr, int majorXGridColor, int majorYGridColor, int minorXGridColor, int minorYGridColor); -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setSurfaceDataGrid(SurfaceChartInternal *ptr, int xGridColor, int yGridColor); -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setContourColor(SurfaceChartInternal *ptr, int contourColor, int minorContourColor); - -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setBackSideBrightness(SurfaceChartInternal *ptr, double brightness); -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setBackSideColor(SurfaceChartInternal *ptr, int color); -CHARTDIR_DLLAPI void __cdecl CSurfaceChart_setBackSideLighting(SurfaceChartInternal *ptr, double ambientLight, double diffuseLight, double specularLight, double shininess); - -class ThreeDScatterGroupInternal; -CHARTDIR_DLLAPI void __cdecl CThreeDScatterGroup_setDataSymbol(ThreeDScatterGroupInternal *ptr, int symbol, int size, int fillColor, int edgeColor, int lineWidth); -CHARTDIR_DLLAPI void __cdecl CThreeDScatterGroup_setDataSymbol2(ThreeDScatterGroupInternal *ptr, const char *image); -CHARTDIR_DLLAPI void __cdecl CThreeDScatterGroup_setDataSymbol3(ThreeDScatterGroupInternal *ptr, const DrawAreaInternal *image); -CHARTDIR_DLLAPI void __cdecl CThreeDScatterGroup_setDataSymbol4(ThreeDScatterGroupInternal *ptr, const int *polygonData, int polygonLen, int size, int fillColor, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CThreeDScatterGroup_setDropLine(ThreeDScatterGroupInternal *ptr, int dropLineColor, int dropLineWidth); -CHARTDIR_DLLAPI void __cdecl CThreeDScatterGroup_setLegendIcon(ThreeDScatterGroupInternal *ptr, int width, int height, int color); - -class ThreeDScatterChartInternal; -CHARTDIR_DLLAPI ThreeDChartInternal * __cdecl ThreeDScatterChart2ThreeDChart(ThreeDScatterChartInternal *ptr); -CHARTDIR_DLLAPI ThreeDScatterChartInternal * __cdecl CThreeDScatterChart_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); -CHARTDIR_DLLAPI ThreeDScatterGroupInternal * __cdecl CThreeDScatterChart_addScatterGroup(ThreeDScatterChartInternal *ptr, const double *xData, int xLen, - const double *yData, int yLen, const double *zData, int zLen, const char *name, int symbol, int symbolSize, int fillColor, int edgeColor); - - -//////////////////////////////////////////////////////////////////////////////////////// -// polarchart.h -//////////////////////////////////////////////////////////////////////////////////////// -class PolarLayerInternal; -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setData(PolarLayerInternal *ptr, const double *dataData, int dataLen, int color, const char *name); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setAngles(PolarLayerInternal *ptr, const double *anglesData, int anglesLen); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setBorderColor(PolarLayerInternal *ptr, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setLineWidth(PolarLayerInternal *ptr, int w); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setDataSymbol2(PolarLayerInternal *ptr, const char *image); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setDataSymbol3(PolarLayerInternal *ptr, const DrawAreaInternal *image); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setDataSymbol(PolarLayerInternal *ptr, int symbol, int size, int fillColor, int edgeColor, int lineWidth); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setDataSymbol4(PolarLayerInternal *ptr, const int *polygonData, int polygonLen, int size, int fillColor, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setSymbolScale(PolarLayerInternal *ptr, const double *zDataData, int zDataLen, int scaleType); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setImageMapWidth(PolarLayerInternal *ptr, int width); -CHARTDIR_DLLAPI const char * __cdecl CPolarLayer_getImageCoor(PolarLayerInternal *ptr, int dataItem, int offsetX, int offsetY); -CHARTDIR_DLLAPI const char * __cdecl CPolarLayer_getHTMLImageMap(PolarLayerInternal *ptr, const char *url, const char *queryFormat, const char *extraAttr, int offsetX, int offsetY); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setHTMLImageMap(PolarLayerInternal *ptr, const char *url, const char *queryFormat, const char *extraAttr); -CHARTDIR_DLLAPI void __cdecl CPolarLayer_setDataLabelFormat(PolarLayerInternal *ptr, const char *formatString); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPolarLayer_setDataLabelStyle(PolarLayerInternal *ptr, const char *font, double fontSize, int fontColor, double fontAngle); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPolarLayer_addCustomDataLabel(PolarLayerInternal *ptr, int i, const char *label, const char *font, double fontSize, int fontColor, double fontAngle); - -class PolarAreaLayerInternal; -CHARTDIR_DLLAPI PolarLayerInternal * __cdecl PolarAreaLayer2PolarLayer(PolarAreaLayerInternal *ptr); - -class PolarLineLayerInternal; -CHARTDIR_DLLAPI PolarLayerInternal * __cdecl PolarLineLayer2PolarLayer(PolarLineLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CPolarLineLayer_setCloseLoop(PolarLineLayerInternal *ptr, bool b); -CHARTDIR_DLLAPI void __cdecl CPolarLineLayer_setGapColor(PolarLineLayerInternal *ptr, int lineColor, int lineWidth); - -class PolarSplineLineLayerInternal; -CHARTDIR_DLLAPI PolarLineLayerInternal * __cdecl PolarSplineLineLayer2PolarLineLayer(PolarSplineLineLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CPolarSplineLineLayer_setTension(PolarSplineLineLayerInternal *ptr, double tension); - -class PolarSplineAreaLayerInternal; -CHARTDIR_DLLAPI PolarAreaLayerInternal * __cdecl PolarSplineAreaLayer2PolarAreaLayer(PolarSplineAreaLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CPolarSplineAreaLayer_setTension(PolarSplineAreaLayerInternal *ptr, double tension); - -class PolarVectorLayerInternal; -CHARTDIR_DLLAPI PolarLayerInternal * __cdecl PolarVectorLayer2PolarLayer(PolarVectorLayerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CPolarVectorLayer_setVector(PolarVectorLayerInternal *ptr, const double * lengthsData, int lengthsLen, const double *directionsData, int directionsLen, int lengthScale); -CHARTDIR_DLLAPI void __cdecl CPolarVectorLayer_setArrowHead2(PolarVectorLayerInternal *ptr, const int *polygonData, int polygonLen); -CHARTDIR_DLLAPI void __cdecl CPolarVectorLayer_setArrowHead(PolarVectorLayerInternal *ptr, int width, int height); -CHARTDIR_DLLAPI void __cdecl CPolarVectorLayer_setArrowStem(PolarVectorLayerInternal *ptr, const int *polygonData, int polygonLen); -CHARTDIR_DLLAPI void __cdecl CPolarVectorLayer_setArrowAlignment(PolarVectorLayerInternal *ptr, int alignment); -CHARTDIR_DLLAPI void __cdecl CPolarVectorLayer_setIconSize(PolarVectorLayerInternal *ptr, int height, int width); -CHARTDIR_DLLAPI void __cdecl CPolarVectorLayer_setVectorMargin(PolarVectorLayerInternal *ptr, double startMargin, double endMargin); - -class PolarChartInternal; -CHARTDIR_DLLAPI BaseChartInternal * __cdecl PolarChart2BaseChart(PolarChartInternal *ptr); -CHARTDIR_DLLAPI PolarChartInternal * __cdecl CPolarChart_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); - -CHARTDIR_DLLAPI void __cdecl CPolarChart_setPlotArea(PolarChartInternal *ptr, int x, int y, int r, int bgColor, int edgeColor, int edgeWidth); -CHARTDIR_DLLAPI void __cdecl CPolarChart_setPlotAreaBg(PolarChartInternal *ptr, int bgColor1, int bgColor2, bool altRings); -CHARTDIR_DLLAPI void __cdecl CPolarChart_setGridColor(PolarChartInternal *ptr, int rGridColor, int rGridWidth, int aGridColor, int aGridWidth); -CHARTDIR_DLLAPI void __cdecl CPolarChart_setGridStyle(PolarChartInternal *ptr, bool polygonGrid, bool gridOnTop); -CHARTDIR_DLLAPI void __cdecl CPolarChart_setStartAngle(PolarChartInternal *ptr, double startAngle, bool clockwise); - -CHARTDIR_DLLAPI AngularAxisInternal * __cdecl CPolarChart_angularAxis(PolarChartInternal *ptr); -CHARTDIR_DLLAPI RadialAxisInternal * __cdecl CPolarChart_radialAxis(PolarChartInternal *ptr); - -CHARTDIR_DLLAPI int __cdecl CPolarChart_getXCoor(PolarChartInternal *ptr, double r, double a); -CHARTDIR_DLLAPI int __cdecl CPolarChart_getYCoor(PolarChartInternal *ptr, double r, double a); - -CHARTDIR_DLLAPI PolarAreaLayerInternal * __cdecl CPolarChart_addAreaLayer(PolarChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name); -CHARTDIR_DLLAPI PolarLineLayerInternal * __cdecl CPolarChart_addLineLayer(PolarChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name); -CHARTDIR_DLLAPI PolarSplineLineLayerInternal * __cdecl CPolarChart_addSplineLineLayer(PolarChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name); -CHARTDIR_DLLAPI PolarSplineAreaLayerInternal * __cdecl CPolarChart_addSplineAreaLayer(PolarChartInternal *ptr, const double *dataData, int dataLen, int color, const char *name); -CHARTDIR_DLLAPI PolarVectorLayerInternal * __cdecl CPolarChart_addVectorLayer(PolarChartInternal *ptr, const double *rDataData, int rDataLen, - const double *aDataData, int aDataLen, const double *lengthsData, int lengthsLen, const double *directionsData, int directionsLen, int lengthScale, int color, const char *name); - - -//////////////////////////////////////////////////////////////////////////////////////// -// pyramidchart.h -//////////////////////////////////////////////////////////////////////////////////////// -class PyramidLayerInternal; - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPyramidLayer_setCenterLabel(PyramidLayerInternal *ptr, const char *labelTemplate, const char *font, double fontSize, int fontColor); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPyramidLayer_setRightLabel(PyramidLayerInternal *ptr, const char *labelTemplate, const char *font, double fontSize, int fontColor); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPyramidLayer_setLeftLabel(PyramidLayerInternal *ptr, const char *labelTemplate, const char *font, double fontSize, int fontColor); - -CHARTDIR_DLLAPI void __cdecl CPyramidLayer_setColor(PyramidLayerInternal *ptr, int color); -CHARTDIR_DLLAPI void __cdecl CPyramidLayer_setJoinLine(PyramidLayerInternal *ptr, int color, int width); -CHARTDIR_DLLAPI void __cdecl CPyramidLayer_setJoinLineGap(PyramidLayerInternal *ptr, int pyramidGap, int pyramidMargin, int textGap); -CHARTDIR_DLLAPI void __cdecl CPyramidLayer_setLayerBorder(PyramidLayerInternal *ptr, int color, int width); -CHARTDIR_DLLAPI void __cdecl CPyramidLayer_setLayerGap(PyramidLayerInternal *ptr, double layerGap); - -class PyramidChartInternal; -CHARTDIR_DLLAPI BaseChartInternal * __cdecl PyramidChart2BaseChart(PyramidChartInternal *ptr); -CHARTDIR_DLLAPI PyramidChartInternal * __cdecl CPyramidChart_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); - -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setPyramidSize(PyramidChartInternal *ptr, int cx, int cy, int radius, int height); -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setConeSize(PyramidChartInternal *ptr, int cx, int cy, int radius, int height); -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setFunnelSize(PyramidChartInternal *ptr, int cx, int cy, int radius, int height, double tubeRadius, double tubeHeight); -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setData(PyramidChartInternal *ptr, const double *dataData, int dataLen, const char * const * labelsData, int labelsLen); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPyramidChart_setCenterLabel(PyramidChartInternal *ptr, const char *labelTemplate, const char *font, double fontSize, int fontColor); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPyramidChart_setRightLabel(PyramidChartInternal *ptr, const char *labelTemplate, const char *font, double fontSize, int fontColor); -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CPyramidChart_setLeftLabel(PyramidChartInternal *ptr, const char *labelTemplate, const char *font, double fontSize, int fontColor); - -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setPyramidSides(PyramidChartInternal *ptr, int noOfSides); -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setViewAngle(PyramidChartInternal *ptr, double elevation, double rotation, double twist); - -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setGradientShading(PyramidChartInternal *ptr, double startBrightness, double endBrightness); -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setLighting(PyramidChartInternal *ptr, double ambientIntensity, double diffuseIntensity, double specularIntensity, double shininess); - -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setJoinLine(PyramidChartInternal *ptr, int color, int width); -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setJoinLineGap(PyramidChartInternal *ptr, int pyramidGap, int pyramidMargin, int textGap); -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setLayerBorder(PyramidChartInternal *ptr, int color, int width); -CHARTDIR_DLLAPI void __cdecl CPyramidChart_setLayerGap(PyramidChartInternal *ptr, double layerGap); - -CHARTDIR_DLLAPI PyramidLayerInternal * __cdecl CPyramidChart_getLayer(PyramidChartInternal *ptr, int layerNo); - - -//////////////////////////////////////////////////////////////////////////////////////// -// meterpointer.h -//////////////////////////////////////////////////////////////////////////////////////// -class MeterPointerInternal; -CHARTDIR_DLLAPI DrawObjInternal * __cdecl MeterPointer2DrawObj(MeterPointerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CMeterPointer_setColor(MeterPointerInternal *ptr, int fillColor, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CMeterPointer_setPos(MeterPointerInternal *ptr, double value); -CHARTDIR_DLLAPI void __cdecl CMeterPointer_setShape(MeterPointerInternal *ptr, int pointerType, double lengthRatio, double widthRatio); -CHARTDIR_DLLAPI void __cdecl CMeterPointer_setShape2(MeterPointerInternal *ptr, const int *pointerCoor, int len, double lengthRatio, double widthRatio); - - -//////////////////////////////////////////////////////////////////////////////////////// -// basemeter.h -//////////////////////////////////////////////////////////////////////////////////////// -class BaseMeterInternal; -CHARTDIR_DLLAPI BaseChartInternal * __cdecl BaseMeter2BaseChart(BaseMeterInternal *ptr); -CHARTDIR_DLLAPI MeterPointerInternal * __cdecl CBaseMeter_addPointer(BaseMeterInternal *ptr, double value, int fillColor, int edgeColor); - -CHARTDIR_DLLAPI void __cdecl CBaseMeter_setScale(BaseMeterInternal *ptr, double lowerLimit, double upperLimit, double majorTickInc, double minorTickInc, double microTickInc); -CHARTDIR_DLLAPI void __cdecl CBaseMeter_setScale2(BaseMeterInternal *ptr, double lowerLimit, double upperLimit, const char * const * labels, int len); -CHARTDIR_DLLAPI void __cdecl CBaseMeter_setScale3(BaseMeterInternal *ptr, double lowerLimit, double upperLimit, const double *labels, int len, const char *formatString); - -CHARTDIR_DLLAPI void __cdecl CBaseMeter_addLabel(BaseMeterInternal *ptr, double pos, const char *label); -CHARTDIR_DLLAPI const char * __cdecl CBaseMeter_getLabel(BaseMeterInternal *ptr, double i); -CHARTDIR_DLLAPI void __cdecl CBaseMeter_getTicks(BaseMeterInternal *ptr, const double **d, int *len); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CBaseMeter_setLabelStyle(BaseMeterInternal *ptr, const char *font, double fontSize, int fontColor, double fontAngle); -CHARTDIR_DLLAPI void __cdecl CBaseMeter_setLabelPos(BaseMeterInternal *ptr, bool labelInside, int labelOffset); -CHARTDIR_DLLAPI void __cdecl CBaseMeter_setLabelFormat(BaseMeterInternal *ptr, const char *mainLabelFormat); -CHARTDIR_DLLAPI void __cdecl CBaseMeter_setTickLength(BaseMeterInternal *ptr, int majorLen, int minorLen, int microLen); -CHARTDIR_DLLAPI void __cdecl CBaseMeter_setLineWidth(BaseMeterInternal *ptr, int axisWidth, int majorTickWidth, int minorTickWidth, int microTickWidth); -CHARTDIR_DLLAPI void __cdecl CBaseMeter_setMeterColors(BaseMeterInternal *ptr, int axisColor, int labelColor, int tickColor); - -CHARTDIR_DLLAPI int __cdecl CBaseMeter_getCoor(BaseMeterInternal *ptr, double v); - - -//////////////////////////////////////////////////////////////////////////////////////// -// angularmeter.h -//////////////////////////////////////////////////////////////////////////////////////// -class AngularMeterInternal; -CHARTDIR_DLLAPI BaseMeterInternal * __cdecl AngularMeter2BaseMeter(AngularMeterInternal *ptr); -CHARTDIR_DLLAPI AngularMeterInternal * __cdecl CAngularMeter_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); - -CHARTDIR_DLLAPI void __cdecl CAngularMeter_addRing(AngularMeterInternal *ptr, int startRadius, int endRadius, int fillColor, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CAngularMeter_addRingSector(AngularMeterInternal *ptr, int startRadius, int endRadius, double a1, double a2, int fillColor, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CAngularMeter_setCap(AngularMeterInternal *ptr, int radius, int fillColor, int edgeColor); - -CHARTDIR_DLLAPI void __cdecl CAngularMeter_setMeter(AngularMeterInternal *ptr, int cx, int cy, int radius, double startAngle, double endAngle); - -CHARTDIR_DLLAPI void __cdecl CAngularMeter_addZone(AngularMeterInternal *ptr, double startValue, double endValue, int startRadius, int endRadius, int fillColor, int edgeColor); -CHARTDIR_DLLAPI void __cdecl CAngularMeter_addZone2(AngularMeterInternal *ptr, double startValue, double endValue, int fillColor, int edgeColor); - - -//////////////////////////////////////////////////////////////////////////////////////// -// linearmeter.h -//////////////////////////////////////////////////////////////////////////////////////// -class LinearMeterInternal; -CHARTDIR_DLLAPI BaseMeterInternal * __cdecl LinearMeter2BaseMeter(LinearMeterInternal *ptr); -CHARTDIR_DLLAPI LinearMeterInternal * __cdecl CLinearMeter_create(int width, int height, int bgColor, int edgeColor, int raisedEffect); - -CHARTDIR_DLLAPI void __cdecl CLinearMeter_setMeter(LinearMeterInternal *ptr, int leftX, int topY, int width, int height, int axisPos, bool isReversed); -CHARTDIR_DLLAPI void __cdecl CLinearMeter_setRail(LinearMeterInternal *ptr, int railColor, int railWidth, int railOffset); - -CHARTDIR_DLLAPI TextBoxInternal * __cdecl CLinearMeter_addZone(LinearMeterInternal *ptr, double startValue, double endValue, int color, const char *label); - - -//////////////////////////////////////////////////////////////////////////////////////// -// datafilter.h -//////////////////////////////////////////////////////////////////////////////////////// -class ArrayMathInternal; -CHARTDIR_DLLAPI ArrayMathInternal * __cdecl CArrayMath_create(const double *aData, int aLen); -CHARTDIR_DLLAPI void __cdecl CArrayMath_destroy(ArrayMathInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CArrayMath_add(ArrayMathInternal *ptr, const double *bData, int bLen); -CHARTDIR_DLLAPI void __cdecl CArrayMath_add2(ArrayMathInternal *ptr, double b); -CHARTDIR_DLLAPI void __cdecl CArrayMath_sub(ArrayMathInternal *ptr, const double *bData, int bLen); -CHARTDIR_DLLAPI void __cdecl CArrayMath_sub2(ArrayMathInternal *ptr, double b); -CHARTDIR_DLLAPI void __cdecl CArrayMath_mul(ArrayMathInternal *ptr, const double *bData, int bLen); -CHARTDIR_DLLAPI void __cdecl CArrayMath_mul2(ArrayMathInternal *ptr, double b); -CHARTDIR_DLLAPI void __cdecl CArrayMath_div(ArrayMathInternal *ptr, const double *bData, int bLen); -CHARTDIR_DLLAPI void __cdecl CArrayMath_div2(ArrayMathInternal *ptr, double b); -CHARTDIR_DLLAPI void __cdecl CArrayMath_financeDiv(ArrayMathInternal *ptr, const double *bData, int bLen, double zeroByZeroValue); -CHARTDIR_DLLAPI void __cdecl CArrayMath_shift(ArrayMathInternal *ptr, int offset, double fillValue); -CHARTDIR_DLLAPI void __cdecl CArrayMath_delta(ArrayMathInternal *ptr, int offset); -CHARTDIR_DLLAPI void __cdecl CArrayMath_rate(ArrayMathInternal *ptr, int offset); -CHARTDIR_DLLAPI void __cdecl CArrayMath_abs(ArrayMathInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CArrayMath_acc(ArrayMathInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectGTZ(ArrayMathInternal *ptr, const double *bData, int bLen, double fillValue); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectGEZ(ArrayMathInternal *ptr, const double *bData, int bLen, double fillValue); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectLTZ(ArrayMathInternal *ptr, const double *bData, int bLen, double fillValue); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectLEZ(ArrayMathInternal *ptr, const double *bData, int bLen, double fillValue); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectEQZ(ArrayMathInternal *ptr, const double *bData, int bLen, double fillValue); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectNEZ(ArrayMathInternal *ptr, const double *bData, int bLen, double fillValue); - -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectStartOfHour(ArrayMathInternal *ptr, int majorTickStep, double initialMargin); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectStartOfDay(ArrayMathInternal *ptr, int majorTickStep, double initialMargin); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectStartOfWeek(ArrayMathInternal *ptr, int majorTickStep, double initialMargin); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectStartOfMonth(ArrayMathInternal *ptr, int majorTickStep, double initialMargin); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectStartOfYear(ArrayMathInternal *ptr, int majorTickStep, double initialMargin); -CHARTDIR_DLLAPI void __cdecl CArrayMath_selectRegularSpacing(ArrayMathInternal *ptr, int majorTickStep, int minorTickStep, int initialMargin); - -CHARTDIR_DLLAPI void __cdecl CArrayMath_trim(ArrayMathInternal *ptr, int startIndex, int len); -CHARTDIR_DLLAPI void __cdecl CArrayMath_insert(ArrayMathInternal *ptr, const double *aData, int aLen, int insertPoint); -CHARTDIR_DLLAPI void __cdecl CArrayMath_insert2(ArrayMathInternal *ptr, double c, int len, int insertPoint); -CHARTDIR_DLLAPI void __cdecl CArrayMath_replace(ArrayMathInternal *ptr, double a, double b); - -CHARTDIR_DLLAPI void __cdecl CArrayMath_movAvg(ArrayMathInternal *ptr, int interval); -CHARTDIR_DLLAPI void __cdecl CArrayMath_expAvg(ArrayMathInternal *ptr, double smoothingFactor); -CHARTDIR_DLLAPI void __cdecl CArrayMath_movMed(ArrayMathInternal *ptr, int interval); -CHARTDIR_DLLAPI void __cdecl CArrayMath_movPercentile(ArrayMathInternal *ptr, int interval, double percentile); -CHARTDIR_DLLAPI void __cdecl CArrayMath_movMax(ArrayMathInternal *ptr, int interval); -CHARTDIR_DLLAPI void __cdecl CArrayMath_movMin(ArrayMathInternal *ptr, int interval); -CHARTDIR_DLLAPI void __cdecl CArrayMath_movStdDev(ArrayMathInternal *ptr, int interval); -CHARTDIR_DLLAPI void __cdecl CArrayMath_movCorr(ArrayMathInternal *ptr, int interval, const double *bData, int bLen); -CHARTDIR_DLLAPI void __cdecl CArrayMath_lowess(ArrayMathInternal *ptr, double smoothness, int iteration); -CHARTDIR_DLLAPI void __cdecl CArrayMath_lowess2(ArrayMathInternal *ptr, const double *bData, int bLen, double smoothness, int iteration); - -CHARTDIR_DLLAPI void __cdecl CArrayMath_result(ArrayMathInternal *ptr, const double **ret, int *retLen); -CHARTDIR_DLLAPI double __cdecl CArrayMath_max(ArrayMathInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CArrayMath_min(ArrayMathInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CArrayMath_avg(ArrayMathInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CArrayMath_sum(ArrayMathInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CArrayMath_stdDev(ArrayMathInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CArrayMath_med(ArrayMathInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CArrayMath_percentile(ArrayMathInternal *ptr, double p); -CHARTDIR_DLLAPI int __cdecl CArrayMath_maxIndex(ArrayMathInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CArrayMath_minIndex(ArrayMathInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CArrayMath_aggregate(ArrayMathInternal *ptr, const double *srcData, int srcLen, int aggregateMethod, - double param, const double **ret, int *retLen); - - -//////////////////////////////////////////////////////////////////////////////////////// -// rantable.h -//////////////////////////////////////////////////////////////////////////////////////// -class RanTableInternal; -CHARTDIR_DLLAPI RanTableInternal * __cdecl CRanTable_create(int seed, int noOfCols, int noOfRows); -CHARTDIR_DLLAPI void __cdecl CRanTable_destroy(RanTableInternal *ptr); - -CHARTDIR_DLLAPI void __cdecl CRanTable_setCol(RanTableInternal *ptr, int colNo, double minValue, double maxValue); -CHARTDIR_DLLAPI void __cdecl CRanTable_setCol2(RanTableInternal *ptr, int colNo, double startValue, double minDelta, double maxDelta, - double lowerLimit, double upperLimit); -CHARTDIR_DLLAPI void __cdecl CRanTable_setDateCol(RanTableInternal *ptr, int i, double startTime, double tickInc, bool weekDayOnly); -CHARTDIR_DLLAPI void __cdecl CRanTable_setHLOCCols(RanTableInternal *ptr, int i, double startValue, double minDelta, double maxDelta, - double lowerLimit, double upperLimit); -CHARTDIR_DLLAPI int __cdecl CRanTable_selectDate(RanTableInternal *ptr, int ColNo, double minDate, double maxData); -CHARTDIR_DLLAPI void __cdecl CRanTable_getCol(RanTableInternal *ptr, int i, const double **ret, int *len); - -class RanSeriesInternal; -CHARTDIR_DLLAPI RanSeriesInternal *__cdecl CRanSeries_create(int seed); -CHARTDIR_DLLAPI void __cdecl CRanSeries_destroy(RanSeriesInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CRanSeries_getSeries(RanSeriesInternal *ptr, int len, double minValue, double maxValue, const double **ret, int *retLen); -CHARTDIR_DLLAPI void __cdecl CRanSeries_getSeries2(RanSeriesInternal *ptr, int len, double startValue, double minDelta, double maxDelta, double lowerLimit, double upperLimit, const double **ret, int *retLen); -CHARTDIR_DLLAPI void __cdecl CRanSeries_getDateSeries(RanSeriesInternal *ptr, int len, double startTime, double tickInc, bool weekDayOnly, const double **ret, int *retLen); - -class FinanceSimulatorInternal; -CHARTDIR_DLLAPI FinanceSimulatorInternal * __cdecl CFinanceSimulator_create(int seed, double startTime, double endTime, int resolution); -CHARTDIR_DLLAPI FinanceSimulatorInternal * __cdecl CFinanceSimulator_create2(const char *seed, double startTime, double endTime, int resolution); -CHARTDIR_DLLAPI void __cdecl CFinanceSimulator_destroy(FinanceSimulatorInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CFinanceSimulator_getTimeStamps(FinanceSimulatorInternal *ptr, const double **ret, int *len); -CHARTDIR_DLLAPI void __cdecl CFinanceSimulator_getHighData(FinanceSimulatorInternal *ptr, const double **ret, int *len); -CHARTDIR_DLLAPI void __cdecl CFinanceSimulator_getLowData(FinanceSimulatorInternal *ptr, const double **ret, int *len); -CHARTDIR_DLLAPI void __cdecl CFinanceSimulator_getOpenData(FinanceSimulatorInternal *ptr, const double **ret, int *len); -CHARTDIR_DLLAPI void __cdecl CFinanceSimulator_getCloseData(FinanceSimulatorInternal *ptr, const double **ret, int *len); -CHARTDIR_DLLAPI void __cdecl CFinanceSimulator_getVolData(FinanceSimulatorInternal *ptr, const double **ret, int *len); - - -//////////////////////////////////////////////////////////////////////////////////////// -// imagemaphandler.h -//////////////////////////////////////////////////////////////////////////////////////// -class ImageMapHandlerInternal; -CHARTDIR_DLLAPI ImageMapHandlerInternal * __cdecl CImageMapHandler_create(const char *imageMap); -CHARTDIR_DLLAPI void __cdecl CImageMapHandler_destroy(ImageMapHandlerInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CImageMapHandler_getHotSpot(ImageMapHandlerInternal *ptr, int x, int y); -CHARTDIR_DLLAPI const char * __cdecl CImageMapHandler_getValue(ImageMapHandlerInternal *ptr, const char *key); -CHARTDIR_DLLAPI const char * __cdecl CImageMapHandler_getKey(ImageMapHandlerInternal *ptr, int i); -CHARTDIR_DLLAPI const char * __cdecl CImageMapHandler_getValue2(ImageMapHandlerInternal *ptr, int i); - - -//////////////////////////////////////////////////////////////////////////////////////// -// viewportmanager.h -//////////////////////////////////////////////////////////////////////////////////////// -class ViewPortManagerInternal; -CHARTDIR_DLLAPI ViewPortManagerInternal * __cdecl CViewPortManager_create(); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_destroy(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setChartMetrics(ViewPortManagerInternal *ptr, const char *metrics); -CHARTDIR_DLLAPI int __cdecl CViewPortManager_getPlotAreaLeft(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CViewPortManager_getPlotAreaTop(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CViewPortManager_getPlotAreaWidth(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI int __cdecl CViewPortManager_getPlotAreaHeight(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getViewPortLeft(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getViewPortTop(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getViewPortWidth(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getViewPortHeight(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setViewPortLeft(ViewPortManagerInternal *ptr, double left); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setViewPortTop(ViewPortManagerInternal *ptr, double top); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setViewPortWidth(ViewPortManagerInternal *ptr, double width); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setViewPortHeight(ViewPortManagerInternal *ptr, double height); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getZoomInWidthLimit(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getZoomOutWidthLimit(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setZoomInWidthLimit(ViewPortManagerInternal *ptr, double viewPortWidth); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setZoomOutWidthLimit(ViewPortManagerInternal *ptr, double viewPortWidth); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getZoomInHeightLimit(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getZoomOutHeightLimit(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setZoomInHeightLimit(ViewPortManagerInternal *ptr, double viewPortHeight); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setZoomOutHeightLimit(ViewPortManagerInternal *ptr, double viewPortHeight); - -CHARTDIR_DLLAPI void __cdecl CViewPortManager_validateViewPort(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI bool __cdecl CViewPortManager_inPlotArea(ViewPortManagerInternal *ptr, int x, int y); -CHARTDIR_DLLAPI bool __cdecl CViewPortManager_canZoomIn(ViewPortManagerInternal *ptr, int zoomDirection); -CHARTDIR_DLLAPI bool __cdecl CViewPortManager_canZoomOut(ViewPortManagerInternal *ptr, int zoomDirection); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_startDrag(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI bool __cdecl CViewPortManager_dragTo(ViewPortManagerInternal *ptr, int scrollDirection, int deltaX, int deltaY); -CHARTDIR_DLLAPI bool __cdecl CViewPortManager_zoomAt(ViewPortManagerInternal *ptr, int zoomDirection, int x, int y, double zoomRatio); -CHARTDIR_DLLAPI bool __cdecl CViewPortManager_zoomTo(ViewPortManagerInternal *ptr, int zoomDirection, int x1, int y1, int x2, int y2); - -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setFullRange(ViewPortManagerInternal *ptr, const char *id, double minValue, double maxValue); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_clearAllRanges(ViewPortManagerInternal *ptr); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getValueAtViewPort(ViewPortManagerInternal *ptr, const char *id, double ratio, bool isLogScale); -CHARTDIR_DLLAPI double __cdecl CViewPortManager_getViewPortAtValue(ViewPortManagerInternal *ptr, const char *id, double ratio, bool isLogScale); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_syncLinearAxisWithViewPort(ViewPortManagerInternal *ptr, const char *id, AxisInternal *axis); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_syncLogAxisWithViewPort(ViewPortManagerInternal *ptr, const char *id, AxisInternal *axis); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_syncDateAxisWithViewPort(ViewPortManagerInternal *ptr, const char *id, AxisInternal *axis); -CHARTDIR_DLLAPI void __cdecl CViewPortManager_commitPendingSyncAxis(ViewPortManagerInternal *ptr, BaseChartInternal *c); - -CHARTDIR_DLLAPI void __cdecl CViewPortManager_setPlotAreaMouseMargin(ViewPortManagerInternal *ptr, int leftMargin, int rightMargin, int topMargin, int bottomMargin); -CHARTDIR_DLLAPI bool __cdecl CViewPortManager_inExtendedPlotArea(ViewPortManagerInternal *ptr, int x, int y); - -} - -#endif diff --git a/PssSampleClient/PurenessLine/PurenessLine/include/chartdir.h b/PssSampleClient/PurenessLine/PurenessLine/include/chartdir.h deleted file mode 100644 index 28c8ae618..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/include/chartdir.h +++ /dev/null @@ -1,3214 +0,0 @@ -/* - * Copyright (C) 2012 Advanced Software Engineering Limited. - * - * This file is part of the ChartDirector software. Usage of this file is - * subjected to the ChartDirector license agreement. See the LICENSE.TXT - * file that comes with the ChartDirector software release, or visit - * Advanced Software Engineering's web site at www.advsofteng.com or - * email to support@advsofteng.com for information. - * - */ - -#ifndef CCHARTDIR_HDR -#define CCHARTDIR_HDR - -#include -#include "bchartdir.h" -#include "memblock.h" - -class AutoDestroy -{ -public : - virtual ~AutoDestroy() {} -}; - -class GarbagePtr -{ -private : - AutoDestroy *ptr; -public : - GarbagePtr(AutoDestroy *ptr, GarbagePtr *next) : ptr(ptr), next(next) {} - ~GarbagePtr() { delete ptr; } - GarbagePtr *next; -}; - -class GarbageContainer -{ -private : - GarbagePtr *root; -public : - GarbageContainer() : root(0) {} - virtual ~GarbageContainer() { while (0 != root) { GarbagePtr *temp = root; root = root->next; delete temp; } } - void reg(AutoDestroy *g) { root = new GarbagePtr(g, root); } -}; - -// -// Utility to convert from WCHAR string to UTF8 string -// -class WCHARtoUTF8 -{ -public : - WCHARtoUTF8(const wchar_t *w_string) : utf8_string(0) - { - if (0 == w_string) - utf8_string = 0; - else - { - int string_len = 0; - while (w_string[string_len]) ++string_len; - char *ptr = utf8_string = new char[string_len * 3 + 1]; - for (int w = *w_string; w != 0; w = *(++w_string)) - { - // only support 16 bit unicode - int uw = w & 0xffff; - if (uw < 0x80) - *(ptr++) = (char)uw; - else if (uw < 0x800) - { - *(ptr++) = (char)(0xC0 | (uw >> 6)); - *(ptr++) = (char)(0x80 | (uw & 0x3F)); - } - else - { - *(ptr++) = (char)(0xE0 | (uw >> 12)); - *(ptr++) = (char)(0x80 | ((uw >> 6) & 0x3F)); - *(ptr++) = (char)(0x80 | (uw & 0x3F)); - } - } - *ptr = 0; - } - } - - operator const char*() - { - return utf8_string; - } - - ~WCHARtoUTF8() - { - delete[] utf8_string; - } - -private : - char *utf8_string; - - //disable assignment - WCHARtoUTF8(const WCHARtoUTF8 &rhs); - WCHARtoUTF8 &operator=(const WCHARtoUTF8 &rhs); -}; - -// -// Utility to convert from UTF8 string to WCHAR string -// -class UTF8toWCHAR -{ -public : - UTF8toWCHAR(const char *utf8_string) : w_string(0) - { - if (0 == utf8_string) - w_string = 0; - else - { - int string_len = 0; - while (utf8_string[string_len]) ++string_len; - wchar_t *ptr = w_string = new wchar_t[string_len + 1]; - for (int i = 0; i < string_len; ++i) - { - int c = utf8_string[i]; - if (((c & 0xf0) == 0xe0) && (i + 2 < string_len)) - { - *ptr = ((c & 0xf) << 12) | ((utf8_string[++i] & 0x3f) << 6); - *ptr = (*ptr) | (utf8_string[++i] & 0x3f); - ++ptr; - } - else if (((c & 0xe0) == 0xc0) && (i + 1 < string_len)) - *(ptr++) = ((c & 0x1f) << 6) | ((utf8_string[++i] & 0x3f) << 6); - else - *(ptr++) = c; - } - - *ptr = 0; - } - } - - operator const wchar_t*() - { - return w_string; - } - - ~UTF8toWCHAR() - { - delete[] w_string; - } - -private : - wchar_t *w_string; - - //disable assignment - UTF8toWCHAR(const UTF8toWCHAR &rhs); - UTF8toWCHAR &operator=(const UTF8toWCHAR &rhs); -}; - -/////////////////////////////////////////////////////////////////////////////////////// -// constants -/////////////////////////////////////////////////////////////////////////////////////// - -namespace Chart -{ - static const double NoValue = 1.7e308; - static const double LogTick = 1.6e308; - static const double LinearTick = 1.5e308; - static const double TickInc = 1.0e200; - static const double MinorTickOnly = -1.7e308; - static const double MicroTickOnly = -1.6e308; - enum { AutoGrid = -2 }; - static const double TouchBar = -1.7E-100; - static const double DataBound = -1.7E-100; - - enum Alignment - { - TopLeft = 7, TopCenter = 8, TopRight = 9, - Left = 4, Center = 5, Right = 6, - BottomLeft = 1, BottomCenter = 2, BottomRight = 3, - Top = TopCenter, Bottom = BottomCenter, - TopLeft2 = 10, TopRight2 = 11, - BottomLeft2 = 12, BottomRight2 = 13 - }; - - enum - { - DashLine = 0x0505, - DotLine = 0x0202, - DotDashLine = 0x05050205, - AltDashLine = 0x0A050505 - }; - - static const int goldGradient[] = {0, 0xFFE743, 0x60, 0xFFFFE0, 0xB0, 0xFFF0B0, 0x100, 0xFFE743}; - static const int silverGradient[] = {0, 0xC8C8C8, 0x60, 0xF8F8F8, 0xB0, 0xE0E0E0, 0x100, 0xC8C8C8}; - static const int redMetalGradient[] = {0, 0xE09898, 0x60, 0xFFF0F0, 0xB0, 0xF0D8D8, 0x100, 0xE09898}; - static const int blueMetalGradient[] = {0, 0x9898E0, 0x60, 0xF0F0FF, 0xB0, 0xD8D8F0, 0x100, 0x9898E0}; - static const int greenMetalGradient[] = {0, 0x98E098, 0x60, 0xF0FFF0, 0xB0, 0xD8F0D8, 0x100, 0x98E098}; - - static inline int metalColor(int c, int angle = 90) { return CChart_metalColor(c, angle); } - static inline int goldColor(int angle = 90) { return metalColor(0xffee44, angle); } - static inline int silverColor(int angle = 90) { return metalColor(0xdddddd, angle); } - - static inline int brushedMetalColor(int c, int texture = 2, int angle = 90) { return metalColor(c, angle) | ((texture & 0x3) << 18); } - static inline int brushedSilverColor(int texture = 2, int angle = 90) {return brushedMetalColor(0xdddddd, texture, angle); } - static inline int brushedGoldColor(int texture = 2, int angle = 90) {return brushedMetalColor(0xffee44, texture, angle); } - - enum AntiAliasMode { NoAntiAlias, AntiAlias, AutoAntiAlias, ClearType, CompatAntiAlias = 6 }; - enum PaletteMode { TryPalette, ForcePalette, NoPalette }; - enum DitherMethod { Quantize, OrderedDither, ErrorDiffusion }; - - enum CDFilterType { BoxFilter, LinearFilter, QuadraticFilter, BSplineFilter, HermiteFilter, - CatromFilter, MitchellFilter, SincFilter, LanczosFilter, GaussianFilter, HanningFilter, - HammingFilter, BlackmanFilter, BesselFilter }; - - enum - { - Transparent = 0xff000000, - Palette = 0xffff0000, - BackgroundColor = 0xffff0000, - LineColor = 0xffff0001, - TextColor = 0xffff0002, - DataColor = 0xffff0008, - SameAsMainColor = 0xffff0007 - }; - - enum ImgFormat { PNG, GIF, JPG, WMP, BMP, SVG, SVGZ }; - - static const int oldDefaultPalette[] = - { - 0xffffff, 0x000000, 0x000000, 0x808080, - 0x808080, 0x808080, 0x808080, 0x808080, - 0xff0000, 0x00ff00, 0x0000ff, 0xffff00, - 0xff00ff, 0x66ffff, 0xffcc33, 0xcccccc, - 0x9966ff, 0x339966, 0x999900, 0xcc3300, - 0x99cccc, 0x006600, 0x660066, 0xcc9999, - -1 - }; - - static const int defaultPalette[] = - { - 0xffffff, 0x000000, 0x000000, 0x808080, - 0x808080, 0x808080, 0x808080, 0x808080, - 0xff3333, 0x33ff33, 0x6666ff, 0xffff00, - 0xff66ff, 0x99ffff, 0xffcc33, 0xcccccc, - 0xcc9999, 0x339966, 0x999900, 0xcc3300, - 0x669999, 0x993333, 0x006600, 0x990099, - 0xff9966, 0x99ff99, 0x9999ff, 0xcc6600, - 0x33cc33, 0xcc99ff, 0xff6666, 0x99cc66, - 0x009999, 0xcc3333, 0x9933ff, 0xff0000, - 0x0000ff, 0x00ff00, 0xffcc99, 0x999999, - -1 - }; - - static const int whiteOnBlackPalette[] = - { - 0x000000, 0xffffff, 0xffffff, 0x808080, - 0x808080, 0x808080, 0x808080, 0x808080, - 0xff0000, 0x00ff00, 0x0000ff, 0xffff00, - 0xff00ff, 0x66ffff, 0xffcc33, 0xcccccc, - 0x9966ff, 0x339966, 0x999900, 0xcc3300, - 0x99cccc, 0x006600, 0x660066, 0xcc9999, - 0xff9966, 0x99ff99, 0x9999ff, 0xcc6600, - 0x33cc33, 0xcc99ff, 0xff6666, 0x99cc66, - 0x009999, 0xcc3333, 0x9933ff, 0xff0000, - 0x0000ff, 0x00ff00, 0xffcc99, 0x999999, - -1 - }; - - static const int transparentPalette[] = - { - 0xffffff, 0x000000, 0x000000, 0x808080, - 0x808080, 0x808080, 0x808080, 0x808080, - 0x80ff0000, 0x8000ff00, 0x800000ff, 0x80ffff00, - 0x80ff00ff, 0x8066ffff, 0x80ffcc33, 0x80cccccc, - 0x809966ff, 0x80339966, 0x80999900, 0x80cc3300, - 0x8099cccc, 0x80006600, 0x80660066, 0x80cc9999, - 0x80ff9966, 0x8099ff99, 0x809999ff, 0x80cc6600, - 0x8033cc33, 0x80cc99ff, 0x80ff6666, 0x8099cc66, - 0x80009999, 0x80cc3333, 0x809933ff, 0x80ff0000, - 0x800000ff, 0x8000ff00, 0x80ffcc99, 0x80999999, - -1 - }; - - enum { SideLayout, CircleLayout }; - - enum - { - DefaultShading = 0, - FlatShading = 1, - LocalGradientShading = 2, - GlobalGradientShading = 3, - ConcaveShading = 4, - RoundedEdgeNoGlareShading = 5, - RoundedEdgeShading = 6, - RadialShading = 7, - RingShading = 8 - }; - - enum SymbolType - { - NoSymbol = 0, - SquareSymbol = 1, - DiamondSymbol = 2, - TriangleSymbol = 3, - RightTriangleSymbol = 4, - LeftTriangleSymbol = 5, - InvertedTriangleSymbol = 6, - CircleSymbol = 7, - CrossSymbol = 8, - Cross2Symbol = 9, - ChartDir_PolygonSymbol = 11, - ChartDir_Polygon2Symbol = 12, - ChartDir_StarSymbol = 13, - ChartDir_CustomSymbol = 14 - }; - - enum - { - NoShape = 0, - SquareShape = 1, - DiamondShape = 2, - TriangleShape = 3, - RightTriangleShape = 4, - LeftTriangleShape = 5, - InvertedTriangleShape = 6, - CircleShape = 7, - CircleShapeNoShading = 10, - GlassSphereShape = 15, - GlassSphere2Shape = 16, - SolidSphereShape = 17 - }; - - static inline int CrossShape(double width = 0.5) - { return CrossSymbol | (((int)(((width < 0) ? 0 : ((width > 1) ? 1 : width)) * 4095 + 0.5)) << 12); } - static inline int Cross2Shape(double width = 0.5) - { return Cross2Symbol | (((int)(((width < 0) ? 0 : ((width > 1) ? 1 : width)) * 4095 + 0.5)) << 12); } - static inline int PolygonShape(int side) - { return ChartDir_PolygonSymbol | (((side < 0) ? 0 : ((side > 100) ? 100 : side)) << 12); } - static inline int Polygon2Shape(int side) - { return ChartDir_Polygon2Symbol | (((side < 0) ? 0 : ((side > 100) ? 100 : side)) << 12); } - static inline int StarShape(int side) - { return ChartDir_StarSymbol | (((side < 0) ? 0 : ((side > 100) ? 100 : side)) << 12); } - - enum DataCombineMethod { Overlay, Stack, Depth, Side, Percentage }; - - enum LegendMode { NormalLegend, ReverseLegend, NoLegend }; - - enum ScaleType { PixelScale, XAxisScale, YAxisScale, EndPoints, - AngularAxisScale = XAxisScale, RadialAxisScale = YAxisScale }; - - enum - { - MonotonicNone = 0, - MonotonicX = 1, - MonotonicY = 2, - MonotonicXY = 3, - MonotonicAuto = 4 - }; - - enum - { - ConstrainedLinearRegression = 0, - LinearRegression = 1, - ExponentialRegression = -1, - LogarithmicRegression = -2 - }; - - static inline int PolynomialRegression(int n) { return n; } - - enum { HLOCDefault, HLOCOpenClose, HLOCUpDown }; - - enum { DiamondPointer, TriangularPointer, ArrowPointer, ArrowPointer2, LinePointer, PencilPointer }; - - enum - { - SmoothShading = 0, - TriangularShading = 1, - RectangularShading = 2, - TriangularFrame = 3, - RectangularFrame = 4 - }; - - enum - { - ChartBackZ = 0x100, - ChartFrontZ = 0xffff, - PlotAreaZ = 0x1000, - GridLinesZ = 0x2000 - }; - - enum - { - XAxisSymmetric = 1, - XAxisSymmetricIfNeeded = 2, - YAxisSymmetric = 4, - YAxisSymmetricIfNeeded = 8, - XYAxisSymmetric = 16, - XYAxisSymmetricIfNeeded = 32 - }; - - enum - { - XAxisAtOrigin = 1, - YAxisAtOrigin = 2, - XYAxisAtOrigin = 3 - }; - - enum - { - ChartDir_StartOfHourFilterTag = 1, - ChartDir_StartOfDayFilterTag = 2, - ChartDir_StartOfWeekFilterTag = 3, - ChartDir_StartOfMonthFilterTag = 4, - ChartDir_StartOfYearFilterTag = 5, - ChartDir_RegularSpacingFilterTag = 6, - ChartDir_AllPassFilterTag = 7, - ChartDir_NonePassFilterTag = 8, - ChartDir_SelectItemFilterTag = 9 - }; - - static inline int StartOfHourFilter(int labelStep = 1, double initialMargin = 0.05) - { return CChart_encodeFilter(ChartDir_StartOfHourFilterTag, labelStep, initialMargin); } - static inline int StartOfDayFilter(int labelStep = 1, double initialMargin = 0.05) - { return CChart_encodeFilter(ChartDir_StartOfDayFilterTag, labelStep, initialMargin); } - static inline int StartOfWeekFilter(int labelStep = 1, double initialMargin = 0.05) - { return CChart_encodeFilter(ChartDir_StartOfWeekFilterTag, labelStep, initialMargin); } - static inline int StartOfMonthFilter(int labelStep = 1, double initialMargin = 0.05) - { return CChart_encodeFilter(ChartDir_StartOfMonthFilterTag, labelStep, initialMargin); } - static inline int StartOfYearFilter(int labelStep = 1, double initialMargin = 0.05) - { return CChart_encodeFilter(ChartDir_StartOfYearFilterTag, labelStep, initialMargin); } - static inline int RegularSpacingFilter(int labelStep = 1, int initialMargin = 0) - { return CChart_encodeFilter(ChartDir_RegularSpacingFilterTag, labelStep, initialMargin / 4095.0); } - static inline int AllPassFilter() - { return CChart_encodeFilter(ChartDir_AllPassFilterTag, 0, 0); } - static inline int NonePassFilter() - { return CChart_encodeFilter(ChartDir_NonePassFilterTag, 0, 0); } - static inline int SelectItemFilter(int item) - { return CChart_encodeFilter(ChartDir_SelectItemFilterTag, item, 0); } - - static inline int getVersion() { return CChart_getVersion(); } - static inline const char *getDescription() { return CChart_getDescription(); } - static inline const char *getCopyright() { return CChart_getCopyright(); } - static inline void getBootLog(char *buffer) { CChart_getBootLog(buffer); } - - static inline bool testFont(const char *font, int fontIndex, double fontHeight, - double fontWidth, double angle, char *buffer) - { return CChart_testFont(font, fontIndex, fontHeight, fontWidth, angle, buffer); } - - static inline bool isLicensed() { return CChart_isLicensed(); } - static inline bool getLicenseAttr(const char *key, char *buffer) - { return CChart_getLicenseAttr(key, buffer); } - static inline bool setLicenseFile(const char *filename = 0, char *buffer = 0) - { return CChart_setLicenseFile(filename, buffer); } - static inline bool setLicenseCode(const char *licCode, char *buffer = 0) - { return CChart_setLicenseCode(licCode, buffer); } - - static inline double chartTime(int y, int m, int d, int h = 0, int n = 0, int s = 0) - { return CChart_chartTime(y, m, d, h, n, s); } - static inline double chartTime2(int t) { return CChart_chartTime2(t); } - static inline int getChartYMD(double t) { return CChart_getChartYMD(t); } - static inline int getChartWeekDay(double t) { return ((int)(t / 86400 + 1)) % 7; } - - enum - { - NormalGlare = 3, - ReducedGlare = 2, - NoGlare = 1 - }; - - static inline int glassEffect(int glareSize = Chart::NormalGlare, int glareDirection = Chart::Top, - int raisedEffect = 5) - { return CChart_glassEffect(glareSize, glareDirection, raisedEffect); } - static inline int softLighting(int direction = Chart::Top, int raisedEffect = 4) - { return CChart_softLighting(direction, raisedEffect); } - static inline int barLighting(double startBrightness = 0.75, double endBrightness = 1.5) - { return CChart_barLighting(startBrightness, endBrightness); } - static inline int cylinderEffect(int orientation = Chart::Center, double ambientIntensity = 0.5, - double diffuseIntensity = 0.5, double specularIntensity = 0.75, int shininess = 8) - { return CChart_cylinderEffect(orientation, ambientIntensity, diffuseIntensity, specularIntensity, shininess); } - - enum - { - AggregateSum = 0, - AggregateAvg = 1, - AggregateStdDev = 2, - AggregateMin = 3, - AggregateMed = 4, - AggregateMax = 5, - AggregatePercentile = 6, - AggregateFirst = 7, - AggregateLast = 8, - AggregateCount = 9 - }; - - enum - { - DirectionHorizontal = 0, - DirectionVertical = 1, - DirectionHorizontalVertical = 2 - }; - - // - // Ver 5.1 - // - static inline double bSearch(DoubleArray a, double v) - { return CChart_bSearch(a.data, a.len, v); } - static inline int ClearTypeMono(double gamma = 0) - { return CChart_ClearTypeMono(gamma); } - static inline int ClearTypeColor(double gamma = 0) - { return CChart_ClearTypeColor(gamma); } - static inline int phongLighting(double ambientIntensity = 0.5, double diffuseIntensity = 0.5, - double specularIntensity = 0.75, int shininess = 8) - { return CChart_phongLighting(ambientIntensity, diffuseIntensity, specularIntensity, shininess); } - -} //namespace Chart - - -/////////////////////////////////////////////////////////////////////////////////////// -// Class wrappers -/////////////////////////////////////////////////////////////////////////////////////// - -class TTFText -{ -private : - //disable copying - TTFText(const TTFText &rhs); - TTFText &operator=(const TTFText &rhs); - - TTFTextInternal *ptr; - -public : - //obsoleted - for compatibility only - enum AntiAliasMode { NoAntiAlias, AntiAlias, AutoAntiAlias }; - //obsoleted - for compatibility only - static void destroy(TTFText *t) { t->destroy(); } - - TTFText(TTFTextInternal *ptr) : ptr(ptr) {} - ~TTFText() { CTTFText_destroy(ptr); } - void destroy() { delete this; } - - int getWidth() const { return CTTFText_getWidth(ptr); } - int getHeight() const { return CTTFText_getHeight(ptr); } - int getLineHeight() const { return CTTFText_getLineHeight(ptr); } - int getLineDistance() const { return CTTFText_getLineDistance(ptr); } - - void draw(int x, int y, int color, int alignment = Chart::TopLeft) const - { CTTFText_draw(ptr, x, y, color, alignment); } -}; - - -class DrawArea : public AutoDestroy -{ -private : - //disable copying - DrawArea(const DrawArea &rhs); - DrawArea &operator=(const DrawArea &rhs); - - DrawAreaInternal *ptr; - bool own_this; - -public : - //obsoleted constants - for compatibility only - enum PaletteMode { TryPalette, ForcePalette, NoPalette }; - //obsoleted constants - for compatibility only - enum DitherMethod { Quantize, OrderedDither, ErrorDiffusion }; - - DrawArea() : ptr(CDrawArea_create()), own_this(true) {} - static DrawArea* create() { return new DrawArea(); } - DrawArea(DrawAreaInternal *ptr) : ptr(ptr), own_this(false) {} - ~DrawArea() { if (own_this) CDrawArea_destroy(ptr); } - void destroy() { delete this; } - DrawAreaInternal *getInternalPtr() { return ptr; } - const DrawAreaInternal *getInternalPtr() const { return ptr; } - - void enableVectorOutput() { CDrawArea_enableVectorOutput(ptr); } - - void setSize(int width, int height, int bgColor = 0xffffff) - { CDrawArea_setSize(ptr, width, height, bgColor); } - void resize(int newWidth, int newHeight, int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_resize(ptr, newWidth, newHeight, filter, blur); } - int getWidth() const { return CDrawArea_getWidth(ptr); } - int getHeight() const { return CDrawArea_getHeight(ptr); } - void setClipRect(int left, int top, int right, int bottom) - { CDrawArea_setClipRect(ptr, left, top, right, bottom); } - void setBgColor(int c) { CDrawArea_setBgColor(ptr, c); } - - void move(double xOffset, double yOffset, int bgColor = 0xffffff, int filter = Chart::LinearFilter, - double blur = 1) { CDrawArea_move(ptr, xOffset, yOffset, bgColor, filter, blur); } - void rotate(double angle, int bgColor = 0xffffff, double cx = -1, double cy = -1, - int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_rotate(ptr, angle, bgColor, cx, cy, filter, blur); } - void hFlip() { CDrawArea_hFlip(ptr); } - void vFlip() { CDrawArea_vFlip(ptr); } - void clone(DrawArea *d, int x, int y, int align, int newWidth = -1, int newHeight = -1, - int filter = Chart::LinearFilter, double blur = 1) const - { CDrawArea_clone(ptr, d->ptr, x, y, align, newWidth, newHeight, filter, blur); } - - void pixel(int x, int y, int c) { CDrawArea_pixel(ptr, x, y, c); } - int getPixel(int x, int y) const { return CDrawArea_getPixel(ptr, x, y); } - - void hline(int x1, int x2, int y, int c) { CDrawArea_hline(ptr, x1, x2, y, c); } - void vline(int y1, int y2, int x, int c) { CDrawArea_vline(ptr, y1, y2, x, c); } - void line(double x1, double y1, double x2, double y2, int c, int lineWidth = 1) - { CDrawArea_line(ptr, x1, y1, x2, y2, c, lineWidth); } - void arc(int cx, int cy, int rx, int ry, double a1, double a2, int c) - { CDrawArea_arc(ptr, cx, cy, rx, ry, a1, a2, c); } - - void rect(int x1, int y1, int x2, int y2, int edgeColor, int fillColor, int raisedEffect = 0) - { CDrawArea_rect(ptr, x1, y1, x2, y2, edgeColor, fillColor, raisedEffect); } - void polygon(const int *x, const int *y, int noOfPoints, int edgeColor, int fillColor) - { polygon(IntArray(x, noOfPoints), IntArray(y, noOfPoints), edgeColor, fillColor); } - void polygon(IntArray x, IntArray y, int edgeColor, int fillColor) - { CDrawArea_polygon2(ptr, x.data, x.len, y.data, y.len, edgeColor, fillColor); } - void polygon(DoubleArray x, DoubleArray y, int edgeColor, int fillColor) - { CDrawArea_polygon(ptr, x.data, x.len, y.data, y.len, edgeColor, fillColor); } - void surface(double x1, double y1, double x2, double y2, int depthX, int depthY, - int edgeColor, int fillColor) - { CDrawArea_surface(ptr, x1, y1, x2, y2, depthX, depthY, edgeColor, fillColor); } - void sector(int cx, int cy, int rx, int ry, double a1, double a2, int edgeColor, int fillColor) - { CDrawArea_sector(ptr, cx, cy, rx, ry, a1, a2, edgeColor, fillColor); } - void cylinder(int cx, int cy, int rx, int ry, double a1, double a2, - int depthX, int depthY, int edgeColor, int fillColor) - { CDrawArea_cylinder(ptr, cx, cy, rx, ry, a1, a2, depthX, depthY, edgeColor, fillColor); } - void circle(int cx, int cy, int rx, int ry, int edgeColor, int fillColor) - { CDrawArea_circle(ptr, cx, cy, rx, ry, edgeColor, fillColor); } - void ringSector(int cx, int cy, int rx, int ry, int rx2, int ry2, - double a1, double a2, int edgeColor, int fillColor) - { CDrawArea_ringSector(ptr, cx, cy, rx, ry, rx2, ry2, a1, a2, edgeColor, fillColor); } - void ring(int cx, int cy, int rx, int ry, int rx2, int ry2, int edgeColor, int fillColor) - { CDrawArea_ring(ptr, cx, cy, rx, ry, rx2, ry2, edgeColor, fillColor); } - - void fill(int x, int y, int color) { CDrawArea_fill(ptr, x, y, color); } - void fill(int x, int y, int color, int borderColor) { CDrawArea_fill2(ptr, x, y, color, borderColor); } - - void text(const char *str, const char *font, double fontSize, - int x, int y, int color) - { CDrawArea_text(ptr, str, font, fontSize, x, y, color); } - void text(const wchar_t *str, const char *font, double fontSize, - int x, int y, int color) - { CDrawArea_textw(ptr, str, font, fontSize, x, y, color); } - void text(const char *str, const char *font, int fontIndex, double fontHeight, double fontWidth, - double angle, bool vertical, int x, int y, int color, int alignment = Chart::TopLeft) - { CDrawArea_text2(ptr, str, font, fontIndex, fontHeight, fontWidth, angle, vertical, x, y, color, alignment); } - void text(const wchar_t *str, const char *font, int fontIndex, double fontHeight, double fontWidth, - double angle, bool vertical, int x, int y, int color, int alignment = Chart::TopLeft) - { CDrawArea_text2w(ptr, str, font, fontIndex, fontHeight, fontWidth, angle, vertical, x, y, color, alignment); } - TTFText* text(const char *str, const char *font, double fontSize) - { return new TTFText(CDrawArea_text3(ptr, str, font, fontSize)); } - TTFText* text(const wchar_t *str, const char *font, double fontSize) - { return new TTFText(CDrawArea_text3w(ptr, str, font, fontSize)); } - TTFText* text(const wchar_t *text, const char *font, int fontIndex, - double fontHeight, double fontWidth, double angle, bool vertical) - { return new TTFText(CDrawArea_text4w(ptr, text, font, fontIndex, fontHeight, fontWidth, angle, vertical)); } - TTFText* text(const char *text, const char *font, int fontIndex, - double fontHeight, double fontWidth, double angle, bool vertical) - { return new TTFText(CDrawArea_text4(ptr, text, font, fontIndex, fontHeight, fontWidth, angle, vertical)); } - void close(TTFText *text) { delete text; } - - void merge(const DrawArea *d, int x, int y, int align, int transparency) - { CDrawArea_merge(ptr, d->ptr, x, y, align, transparency); } - void tile(const DrawArea *d, int transparency) - { CDrawArea_tile(ptr, d->ptr, transparency); } - - void setSearchPath(const char *path) { CDrawArea_setSearchPath(ptr, path); } - bool loadGIF(const char *filename) { return CDrawArea_loadGIF(ptr, filename); } - bool loadPNG(const char *filename) { return CDrawArea_loadPNG(ptr, filename); } - bool loadJPG(const char *filename) { return CDrawArea_loadJPG(ptr, filename); } - bool loadWMP(const char *filename) { return CDrawArea_loadWMP(ptr, filename); } - bool load(const char *filename) { return CDrawArea_load(ptr, filename); } - - void rAffineTransform(double a, double b, double c, double d, double e, double f, - int bgColor = 0xffffff, int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_rAffineTransform(ptr, a, b, c, d, e, f, bgColor, filter, blur); } - void affineTransform(double a, double b, double c, double d, double e, double f, - int bgColor = 0xffffff, int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_affineTransform(ptr, a, b, c, d, e, f, bgColor, filter, blur); } - void sphereTransform(int xDiameter, int yDiameter, int bgColor = 0xffffff, - int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_sphereTransform(ptr, xDiameter, yDiameter, bgColor, filter, blur); } - void hCylinderTransform(int yDiameter, int bgColor = 0xffffff, - int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_hCylinderTransform(ptr, yDiameter, bgColor, filter, blur); } - void vCylinderTransform(int xDiameter, int bgColor = 0xffffff, - int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_vCylinderTransform(ptr, xDiameter, bgColor, filter, blur); } - void vTriangleTransform(int tHeight = -1, int bgColor = 0xffffff, - int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_vTriangleTransform(ptr, tHeight, bgColor, filter, blur); } - void hTriangleTransform(int tWidth = -1, int bgColor = 0xffffff, - int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_hTriangleTransform(ptr, tWidth, bgColor, filter, blur); } - void shearTransform(double xShear, double yShear = 0, int bgColor = 0xffffff, - int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_shearTransform(ptr, xShear, yShear, bgColor, filter, blur); } - void waveTransform(int period, double amplitude, double direction = 0, - double startAngle = 0, bool longitudinal = false, int bgColor = 0xffffff, - int filter = Chart::LinearFilter, double blur = 1) - { CDrawArea_waveTransform(ptr, period, amplitude, direction, startAngle, longitudinal, bgColor, filter, blur); } - - bool out(const char *filename) { return CDrawArea_out(ptr, filename); } - - bool outGIF(const char *filename) { return CDrawArea_outGIF(ptr, filename); } - bool outPNG(const char *filename) { return CDrawArea_outPNG(ptr, filename); } - bool outJPG(const char *filename, int quality = 80) { return CDrawArea_outJPG(ptr, filename, quality); } - bool outWMP(const char *filename) { return CDrawArea_outWMP(ptr, filename); } - bool outBMP(const char *filename) { return CDrawArea_outBMP(ptr, filename); } - bool outSVG(const char *filename, const char *options = 0) { return CDrawArea_outSVG(ptr, filename, options); } - - bool outGIF(const char **data, int *len) { return CDrawArea_outGIF2(ptr, data, len); } - bool outPNG(const char **data, int *len) { return CDrawArea_outPNG2(ptr, data, len); } - bool outJPG(const char **data, int *len, int quality = 80) { return CDrawArea_outJPG2(ptr, data, len, quality); } - bool outWMP(const char **data, int *len) { return CDrawArea_outWMP2(ptr, data, len); } - bool outBMP(const char **data, int *len) { return CDrawArea_outBMP2(ptr, data, len); } - - MemBlock outGIF() { const char *data; int len; outGIF(&data, &len); return MemBlock(data, len); } - MemBlock outPNG() { const char *data; int len; outPNG(&data, &len); return MemBlock(data, len); } - MemBlock outJPG(int quality = 80) { const char *data; int len; outJPG(&data, &len, quality); return MemBlock(data, len); } - MemBlock outWMP() { const char *data; int len; outWMP(&data, &len); return MemBlock(data, len); } - MemBlock outBMP() { const char *data; int len; outBMP(&data, &len); return MemBlock(data, len); } - MemBlock outSVG2(const char *options = 0) - { const char *data; int len; CDrawArea_outSVG2(ptr, &data, &len, options); return MemBlock(data, len); } - MemBlock outSVG() { return outSVG2(); } - - void setPaletteMode(int p) { CDrawArea_setPaletteMode(ptr, p); } - void setDitherMethod(int m) { CDrawArea_setDitherMethod(ptr, m); } - void setTransparentColor(int c) { CDrawArea_setTransparentColor(ptr, c); } - void setAntiAliasText(int a) { CDrawArea_setAntiAliasText(ptr, a); } - void setAntiAlias(bool shapeAntiAlias = true, int textAntiAlias = Chart::AutoAntiAlias) - { CDrawArea_setAntiAlias(ptr, shapeAntiAlias, textAntiAlias); } - void setInterlace(bool i) { CDrawArea_setInterlace(ptr, i); } - - void setColorTable(const int *colors, int noOfColors, int offset) - { CDrawArea_setColorTable(ptr, colors, noOfColors, offset); } - void setColorTable(IntArray colors, int offset) - { setColorTable(colors.data, colors.len, offset); } - int getARGBColor(int c) { return CDrawArea_getARGBColor(ptr, c); } - int halfColor(int c) { return CDrawArea_halfColor(ptr, c); } - int adjustBrightness(int c, double brightness) { return CDrawArea_adjustBrightness(ptr, c, brightness); } - - int dashLineColor(int color, int patternCode = Chart::DashLine) - { return CDrawArea_dashLineColor(ptr, color, patternCode); } - int patternColor(const int *c, int w, int h, int startX = 0, int startY = 0) - { return patternColor(IntArray(c, w * h), startX, startY); } - int patternColor(IntArray colorArray, int height, int startX = 0, int startY = 0) - { return CDrawArea_patternColor(ptr, colorArray.data, colorArray.len, height, startX, startY); } - int patternColor(const char *filename, int startX = 0, int startY = 0) - { return CDrawArea_patternColor2(ptr, filename, startX, startY); } - int gradientColor(int startX, int startY, int endX, int endY, int startColor, int endColor) - { return CDrawArea_gradientColor(ptr, startX, startY, endX, endY, startColor, endColor); } - int gradientColor(IntArray colorArray, double angle = 90, double scale = 1.0, int startX = 0, int startY = 0) - { return CDrawArea_gradientColor2(ptr, colorArray.data, colorArray.len, angle, scale, startX, startY); } - int gradientColor(const int *c, double angle = 90, double scale = 1, int startX = 0, int startY = 0) - { return CDrawArea_gradientColor2a(ptr, c, angle, scale, startX, startY); } - int linearGradientColor(int startX, int startY, int endX, int endY, int startColor, int endColor, bool periodic = false) - { return CDrawArea_linearGradientColor(ptr, startX, startY, endX, endY, startColor, endColor, periodic); } - int linearGradientColor(int startX, int startY, int endX, int endY, IntArray c, bool periodic = false) - { return CDrawArea_linearGradientColor2(ptr, startX, startY, endX, endY, c.data, c.len, periodic); } - int radialGradientColor(int cx, int cy, int rx, int ry, int startColor, int endColor, bool periodic = false) - { return CDrawArea_radialGradientColor(ptr, cx, cy, rx, ry, startColor, endColor, periodic); } - int radialGradientColor(int cx, int cy, int rx, int ry, IntArray c, bool periodic = false) - { return CDrawArea_radialGradientColor2(ptr, cx, cy, rx, ry, c.data, c.len, periodic); } - - int reduceColors(int colorCount, bool blackAndWhite = false) - { return CDrawArea_reduceColors(ptr, colorCount, blackAndWhite); } - - void setDefaultFonts(const char *normal, const char *bold = 0, const char *italic = 0, - const char *boldItalic = 0) - { CDrawArea_setDefaultFonts(ptr, normal, bold, italic, boldItalic); } - void setFontTable(int index, const char *font) - { CDrawArea_setFontTable(ptr, index, font); } - - // - // Ver 5.1 - // - void initDynamicLayer() - { CDrawArea_initDynamicLayer(ptr); } - void removeDynamicLayer(bool keepOriginal = false) - { CDrawArea_removeDynamicLayer(ptr, keepOriginal); } -}; - - -class DrawObj : public AutoDestroy -{ -private : - //disable copying - DrawObj(const DrawObj &rhs); - DrawObj &operator=(const DrawObj &rhs); - - DrawObjInternal *ptr; - -public : - DrawObj(DrawObjInternal *ptr) : ptr(ptr) {} - void destroy() { delete this; } - DrawObjInternal *getInternalPtr() { return ptr; } - - void setZOrder(int z) { CDrawObj_setZOrder(ptr, z); } - void paint(DrawArea *d) { CDrawObj_paint(ptr, d->getInternalPtr()); } -}; - - -class Box : public DrawObj -{ -private : - //disable copying - Box(const Box &rhs); - Box &operator=(const Box &rhs); - - BoxInternal *ptr; - -public : - Box(BoxInternal *ptr) : DrawObj(Box2DrawObj(ptr)), ptr(ptr) {} - ~Box() {} - - void setPos(int x, int y) { CBox_setPos(ptr, x, y); } - void setSize(int w, int h) { CBox_setSize(ptr, w, h); } - void setBackground(int color, int edgeColor = -1, int raisedEffect = 0) - { CBox_setBackground(ptr, color, edgeColor, raisedEffect); } - void setRoundedCorners(int r1 = 10, int r2 = -1, int r3 = -1, int r4 = -1) - { CBox_setRoundedCorners(ptr, r1, r2, r3, r4); } - int getLeftX() const { return CBox_getLeftX(ptr); } - int getTopY() const { return CBox_getTopY(ptr); } - int getWidth() const { return CBox_getWidth(ptr); } - int getHeight() const { return CBox_getHeight(ptr); } - const char *getImageCoor(int offsetX = 0, int offsetY = 0) - { return CBox_getImageCoor(ptr, offsetX, offsetY); } -}; - - -class TextBox : public Box -{ -private : - //disable copying - TextBox(const TextBox &rhs); - TextBox &operator=(const TextBox &rhs); - - TextBoxInternal *ptr; - -public : - TextBox(TextBoxInternal *ptr) : Box(TextBox2Box(ptr)), ptr(ptr) {} - ~TextBox() {} - - void setText(const char *text) { CTextBox_setText(ptr, text); } - void setAlignment(int a) { CTextBox_setAlignment(ptr, a); } - void setFontStyle(const char *font, int fontIndex = 0) - { CTextBox_setFontStyle(ptr, font, fontIndex); } - void setFontSize(double fontHeight, double fontWidth = 0) - { CTextBox_setFontSize(ptr, fontHeight, fontWidth); } - void setFontAngle(double angle, bool vertical = false) - { CTextBox_setFontAngle(ptr, angle, vertical); } - void setFontColor(int color) { CTextBox_setFontColor(ptr, color); } - void setMargin(int m) { CTextBox_setMargin(ptr, m); } - void setMargin(int leftMargin, int rightMargin, int topMargin, int bottomMargin) - { CTextBox_setMargin2(ptr, leftMargin, rightMargin, topMargin, bottomMargin); } - void setWidth(int width) { CTextBox_setWidth(ptr, width); } - void setHeight(int height) { CTextBox_setHeight(ptr, height); } - void setMaxWidth(int maxWidth) { CTextBox_setMaxWidth(ptr, maxWidth); } - void setTruncate(int maxWidth, int maxLines = 1) - { CTextBox_setTruncate(ptr, maxWidth, maxLines); } -}; - - -//for compatibility with ChartDirector Ver 1.5 C++ code -typedef TextBox TextStyle; - - -class Line : public DrawObj -{ -private : - //disable copying - Line(const Line &rhs); - Line &operator=(const Line &rhs); - - LineInternal *ptr; - -public : - Line(LineInternal *ptr) : DrawObj(Line2DrawObj(ptr)), ptr(ptr) {} - ~Line() {} - - void setPos(int x1, int y1, int x2, int y2) { CLine_setPos(ptr, x1, y1, x2, y2); } - void setColor(int c) { CLine_setColor(ptr, c); } - void setWidth(int w) { CLine_setWidth(ptr, w); }; -}; - - -class CDMLTable : public DrawObj, protected GarbageContainer -{ -private : - //disable copying - CDMLTable(const CDMLTable &rhs); - CDMLTable &operator=(const CDMLTable &rhs); - - CDMLTableInternal *ptr; - - TextBox *makeTextBox(TextBoxInternal *p) - { if (!p) return 0; TextBox *ret = new TextBox(p); reg(ret); return ret; } - -public : - CDMLTable(CDMLTableInternal *ptr) : DrawObj(CDMLTable2DrawObj(ptr)), ptr(ptr) {} - ~CDMLTable() {} - - void setPos(int x, int y, int alignment = Chart::TopLeft) - { CCDMLTable_setPos(ptr, x, y, alignment); } - - TextBox *insertCol(int col) { return makeTextBox(CCDMLTable_insertCol(ptr, col)); } - TextBox *appendCol() { return makeTextBox(CCDMLTable_appendCol(ptr)); } - int getColCount() const { return CCDMLTable_getColCount(ptr); } - - TextBox *insertRow(int row) { return makeTextBox(CCDMLTable_insertRow(ptr, row)); } - TextBox *appendRow() { return makeTextBox(CCDMLTable_appendRow(ptr)); } - int getRowCount() const { return CCDMLTable_getRowCount(ptr); } - - TextBox *setText(int col, int row, const char *text) - { return makeTextBox(CCDMLTable_setText(ptr, col, row, text)); } - TextBox *setCell(int col, int row, int width, int height, const char *text) - { return makeTextBox(CCDMLTable_setCell(ptr, col, row, width, height, text)); } - TextBox *getCell(int col, int row) - { return makeTextBox(CCDMLTable_getCell(ptr, col, row)); } - - TextBox *getColStyle(int col) { return makeTextBox(CCDMLTable_getColStyle(ptr, col)); } - TextBox *getRowStyle(int row) { return makeTextBox(CCDMLTable_getRowStyle(ptr, row)); } - TextBox *getStyle() { return makeTextBox(CCDMLTable_getStyle(ptr)); } - - void layout() { CCDMLTable_layout(ptr); } - - int getColWidth(int col) const { return CCDMLTable_getColWidth(ptr, col); } - int getRowHeight(int row) const { return CCDMLTable_getRowHeight(ptr, row); } - int getWidth() const { return CCDMLTable_getWidth(ptr); } - int getHeight() const { return CCDMLTable_getHeight(ptr); } -}; - - -class LegendBox : public TextBox -{ -private : - //disable copying - LegendBox(const LegendBox &rhs); - LegendBox &operator=(const LegendBox &rhs); - - LegendBoxInternal *ptr; - -public : - LegendBox(LegendBoxInternal *ptr) : TextBox(LegendBox2TextBox(ptr)), ptr(ptr) {} - ~LegendBox() {} - - void setCols(int noOfCols) { CLegendBox_setCols(ptr, noOfCols); } - void setReverse(bool b = true) { CLegendBox_setReverse(ptr, b); } - void setLineStyleKey(bool b = true) { CLegendBox_setLineStyleKey(ptr, b); } - - void addKey(const char *text, int color, int lineWidth = 0, const DrawArea *drawarea = 0) - { CLegendBox_addKey(ptr, text, color, lineWidth, drawarea ? drawarea->getInternalPtr() : 0); } - void addKey(int pos, const char *text, int color, int lineWidth = 0, const DrawArea *drawarea = 0) - { CLegendBox_addKey2(ptr, pos, text, color, lineWidth, drawarea ? drawarea->getInternalPtr() : 0); } - void setKeySize(int width, int height = -1, int gap = -1) - { CLegendBox_setKeySize(ptr, width, height, gap); } - void setKeySpacing(int keySpacing, int lineSpacing = -1) - { CLegendBox_setKeySpacing(ptr, keySpacing, lineSpacing); } - void setKeyBorder(int edgeColor, int raisedEffect = 0) - { CLegendBox_setKeyBorder(ptr, edgeColor, raisedEffect); } - - const char *getImageCoor(int dataItem, int offsetX = 0, int offsetY = 0) - { return CLegendBox_getImageCoor(ptr, dataItem, offsetX, offsetY); } - const char *getHTMLImageMap(const char *url, const char *queryFormat = 0, const char *extraAttr = 0, - int offsetX = 0, int offsetY = 0) - { return CLegendBox_getHTMLImageMap(ptr, url, queryFormat, extraAttr, offsetX, offsetY); } -}; - - -class BaseChart : protected GarbageContainer -{ -private : - //disable copying - BaseChart(const BaseChart &rhs); - BaseChart &operator=(const BaseChart &rhs); - - BaseChartInternal *ptr; - int *refCount; - DrawArea *dynamicLayerCache; - -public : - //obsoleted constants - for compatibility only - enum ImgFormat {PNG, GIF, JPG, WMP}; - - BaseChart() : ptr(0), refCount(new int), dynamicLayerCache(0) { *refCount = 1; } - BaseChart(BaseChart *rhs) : ptr(rhs->ptr), refCount(rhs->refCount), dynamicLayerCache(0) { ++(*refCount); } - void init(BaseChartInternal *ptr) { this->ptr = ptr; } - ~BaseChart() { if (--(*refCount) == 0) { CBaseChart_destroy(ptr); delete refCount; } } - void destroy() { delete this; } - BaseChartInternal *getInternalPtr() { return ptr; } - const BaseChartInternal *getInternalPtr() const { return ptr; } - - void enableVectorOutput() { CBaseChart_enableVectorOutput(ptr); } - - ////////////////////////////////////////////////////////////////////////////////////// - // set overall chart - ////////////////////////////////////////////////////////////////////////////////////// - void setSize(int width, int height) { CBaseChart_setSize(ptr, width, height); } - int getWidth() const { return CBaseChart_getWidth(ptr); } - int getHeight() const { return CBaseChart_getHeight(ptr); } - void setBackground(int color, int edgeColor = Chart::Transparent, int raisedEffect = 0) - { CBaseChart_setBackground(ptr, color, edgeColor, raisedEffect); } - void setBorder(int color) //deprecated - use setBackground - { CBaseChart_setBorder(ptr, color); } - void setRoundedFrame(int extColor = 0xffffff, int r1 = 10, int r2 = -1, int r3 = -1, int r4 = -1) - { CBaseChart_setRoundedFrame(ptr, extColor, r1, r2, r3, r4); } - void setWallpaper(const char *img) { CBaseChart_setWallpaper(ptr, img); } - void setBgImage(const char *img, int align = Chart::Center) - { CBaseChart_setBgImage(ptr, img, align); } - void setDropShadow(int color = 0xaaaaaa, int offsetX = 5, int offsetY = 0x7fffffff, int blurRadius = 5) - { CBaseChart_setDropShadow(ptr, color, offsetX, offsetY, blurRadius) ; } - void setTransparentColor(int c) - { CBaseChart_setTransparentColor(ptr, c); } - void setAntiAlias(bool shapeAntiAlias = true, int textAntiAlias = Chart::AutoAntiAlias) - { CBaseChart_setAntiAlias(ptr, shapeAntiAlias, textAntiAlias); } - void setSearchPath(const char *path) - { CBaseChart_setSearchPath(ptr, path); } - - TextBox *addTitle(const char *text, const char *font = 0, double fontSize = 12, - int fontColor = Chart::TextColor, int bgColor = Chart::Transparent, int edgeColor = Chart::Transparent) - { TextBox *ret = new TextBox(CBaseChart_addTitle(ptr, text, font, fontSize, fontColor, bgColor, edgeColor)); reg(ret); return ret;} - TextBox *addTitle(int alignment, const char *text, const char *font = 0, double fontSize = 12, - int fontColor = Chart::TextColor, int bgColor = Chart::Transparent, int edgeColor = Chart::Transparent) - { TextBox *ret = new TextBox(CBaseChart_addTitle2(ptr, alignment, text, font, fontSize, fontColor, bgColor, edgeColor)); reg(ret); return ret; } - LegendBox *addLegend(int x, int y, bool vertical = true, const char *font = 0, - double fontSize = 10) - { LegendBox *ret = new LegendBox(CBaseChart_addLegend(ptr, x, y, vertical, font, fontSize)); reg(ret); return ret; } - LegendBox *addLegend2(int x, int y, int noOfCols, const char *font = 0, double fontSize = 10) - { LegendBox *ret = new LegendBox(CBaseChart_addLegend2(ptr, x, y, noOfCols, font, fontSize)); reg(ret); return ret; } - LegendBox *getLegend() { LegendBox *ret = new LegendBox(CBaseChart_getLegend(ptr)); reg(ret); return ret; } - - ////////////////////////////////////////////////////////////////////////////////////// - // drawing primitives - ////////////////////////////////////////////////////////////////////////////////////// - DrawArea *getDrawArea() { DrawArea *ret = new DrawArea(CBaseChart_getDrawArea(ptr)); reg(ret); return ret; } - TextBox *addText(int x, int y, const char *text, const char *font = 0, double fontSize = 8, - int fontColor = Chart::TextColor, int alignment = Chart::TopLeft, double angle = 0, bool vertical = false) - { TextBox *ret = new TextBox(CBaseChart_addText(ptr, x, y, text, font, fontSize, fontColor, alignment, angle, vertical)); reg(ret); return ret; } - Line *addLine(int x1, int y1, int x2, int y2, int color = Chart::LineColor, int lineWidth = 1) - { Line *ret = new Line(CBaseChart_addLine(ptr, x1, y1, x2, y2, color, lineWidth)); reg(ret); return ret; } - CDMLTable *addTable(int x, int y, int alignment, int col, int row) - { CDMLTable *ret = new CDMLTable(CBaseChart_addTable(ptr, x, y, alignment, col, row)); reg(ret); return ret; } - void addExtraField(StringArray texts) { CBaseChart_addExtraField(ptr, texts.data, texts.len); } - void addExtraField(DoubleArray numbers) { CBaseChart_addExtraField2(ptr, numbers.data, numbers.len); } - - ////////////////////////////////////////////////////////////////////////////////////// - // color management methods - ////////////////////////////////////////////////////////////////////////////////////// - void setColor(int paletteEntry, int color) - { setColors(paletteEntry, IntArray(&color, 1)); } - void setColors(int paletteEntry, const int *colors) - { for (int i = 0; i < 0xffff; ++i) if (colors[i] == -1) { setColors(paletteEntry, IntArray(colors, i)); return; } } - void setColors(int paletteEntry, IntArray colors) - { CBaseChart_setColors(ptr, paletteEntry, colors.data, colors.len); } - void setColors(const int *colors) { setColors(0, colors); } - void setColors(IntArray colors) { setColors(0, colors); } - int getColor(int paletteEntry) { return CBaseChart_getColor(ptr, paletteEntry); } - int halfColor(int c) { return CBaseChart_halfColor(ptr, c); } - int adjustBrightness(int c, double brightness) { return CBaseChart_adjustBrightness(ptr, c, brightness); } - - int dashLineColor(int color, int patternCode = Chart::DashLine) - { return CBaseChart_dashLineColor(ptr, color, patternCode); } - int patternColor(const int *c, int w, int h, int startX = 0, int startY = 0) - { return patternColor(IntArray(c, w * h), startX, startY); } - int patternColor(IntArray colorArray, int height, int startX = 0, int startY = 0) - { return CBaseChart_patternColor(ptr, colorArray.data, colorArray.len, height, startX, startY); } - int patternColor(const char *filename, int startX = 0, int startY = 0) - { return CBaseChart_patternColor2(ptr, filename, startX, startY); } - int gradientColor(int startX, int startY, int endX, int endY, int startColor, int endColor) - { return CBaseChart_gradientColor(ptr, startX, startY, endX, endY, startColor, endColor); } - int gradientColor(IntArray colorArray, double angle = 90, double scale = 1.0, int startX = 0, int startY = 0) - { return CBaseChart_gradientColor2(ptr, colorArray.data, colorArray.len, angle, scale, startX, startY); } - int gradientColor(const int *c, double angle = 90, double scale = 1, int startX = 0, int startY = 0) - { return CBaseChart_gradientColor2a(ptr, c, angle, scale, startX, startY); } - int linearGradientColor(int startX, int startY, int endX, int endY, int startColor, int endColor, bool periodic = false) - { return CBaseChart_linearGradientColor(ptr, startX, startY, endX, endY, startColor, endColor, periodic); } - int linearGradientColor(int startX, int startY, int endX, int endY, IntArray c, bool periodic = false) - { return CBaseChart_linearGradientColor2(ptr, startX, startY, endX, endY, c.data, c.len, periodic); } - int radialGradientColor(int cx, int cy, int rx, int ry, int startColor, int endColor, bool periodic = false) - { return CBaseChart_radialGradientColor(ptr, cx, cy, rx, ry, startColor, endColor, periodic); } - int radialGradientColor(int cx, int cy, int rx, int ry, IntArray c, bool periodic = false) - { return CBaseChart_radialGradientColor2(ptr, cx, cy, rx, ry, c.data, c.len, periodic); } - - ////////////////////////////////////////////////////////////////////////////////////// - // locale support - ////////////////////////////////////////////////////////////////////////////////////// - void setDefaultFonts(const char *normal, const char *bold = 0, const char *italic = 0, - const char *boldItalic = 0) - { CBaseChart_setDefaultFonts(ptr, normal, bold, italic, boldItalic); } - void setFontTable(int index, const char *font) - { CBaseChart_setFontTable(ptr, index, font); } - - void setNumberFormat(char thousandSeparator = '~', char decimalPointChar = '.', char signChar = '-') - { CBaseChart_setNumberFormat(ptr, thousandSeparator, decimalPointChar, signChar); } - void setMonthNames(StringArray names) - { CBaseChart_setMonthNames(ptr, names.data, names.len); } - void setWeekDayNames(StringArray names) - { CBaseChart_setWeekDayNames(ptr, names.data, names.len); } - void setAMPM(const char *am, const char *pm) - { CBaseChart_setAMPM(ptr, am, pm); } - const char *formatValue(double value, const char *formatString) - { return CBaseChart_formatValue(ptr, value, formatString); } - - ////////////////////////////////////////////////////////////////////////////////////// - // chart creation methods - ////////////////////////////////////////////////////////////////////////////////////// - LegendBox *layoutLegend() { LegendBox *ret = new LegendBox(CBaseChart_layoutLegend(ptr)); reg(ret); return ret; } - void layout() { CBaseChart_layout(ptr); } - bool makeChart(const char *filename) - { return CBaseChart_makeChart(ptr, filename); } - bool makeChart(int format, const char **data, int *len) - { return CBaseChart_makeChart2(ptr, format, data, len); } - MemBlock makeChart(int format) - { const char *data; int len; makeChart(format, &data, &len); return MemBlock(data, len); } - DrawArea *makeChart() - { DrawArea *ret = new DrawArea(CBaseChart_makeChart3(ptr)); reg(ret); return ret; } - - ////////////////////////////////////////////////////////////////////////////////////// - // image map support - ////////////////////////////////////////////////////////////////////////////////////// - const char *getHTMLImageMap(const char *url, const char *queryFormat = 0, const char *extraAttr = 0, - int offsetX = 0, int offsetY = 0) - { return CBaseChart_getHTMLImageMap(ptr, url, queryFormat, extraAttr, offsetX, offsetY); } - const char *getChartMetrics() { return CBaseChart_getChartMetrics(ptr); } - - // - // Ver 5.1 - // - int getAbsOffsetX() const - { return CBaseChart_getAbsOffsetX(ptr); } - int getAbsOffsetY() const - { return CBaseChart_getAbsOffsetY(ptr); } - - DrawArea *initDynamicLayer() { - DrawAreaInternal *retPtr = CBaseChart_initDynamicLayer(ptr); - if ((0 == dynamicLayerCache) || (retPtr != dynamicLayerCache->getInternalPtr())) { - dynamicLayerCache = new DrawArea(retPtr); reg(dynamicLayerCache); - } - return dynamicLayerCache; - } - void removeDynamicLayer() - { CBaseChart_removeDynamicLayer(ptr); } - - const char *getJsChartModel(const char *options = 0) - { return CBaseChart_getJsChartModel(ptr, options); } -}; - - -class MultiChart : public BaseChart -{ -private : - //disable copying - MultiChart(const MultiChart &rhs); - MultiChart &operator=(const MultiChart &rhs); - - MultiChartInternal *ptr; - - const BaseChart *mainChart; - BaseChart **charts; - int chartCount; - int maxChartCount; - -public : - MultiChart(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) : - mainChart(0), charts(0), chartCount(0), maxChartCount(0) - { ptr = CMultiChart_create(width, height, bgColor, edgeColor, raisedEffect); - init(MultiChart2BaseChart(ptr)); mainChart = 0; } - static MultiChart *create(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { return new MultiChart(width, height, bgColor, edgeColor, raisedEffect); } - ~MultiChart() { delete[] charts; } - void addChart(int x, int y, BaseChart *c) { - if (0 != c) { - CMultiChart_addChart(ptr, x, y, c->getInternalPtr()); - if (chartCount == maxChartCount) { - maxChartCount = (maxChartCount < 10) ? 10 : maxChartCount * 2; - BaseChart **temp = new BaseChart*[maxChartCount]; - for (int i = 0; i < chartCount; ++i) temp[i] = charts[i]; - delete[] charts; charts = temp; - } - charts[chartCount++] = c; - } - } - BaseChart *getChart(int i = 0) { - if (i == -1) - return (BaseChart *)mainChart; - if ((i >= 0) && (i < chartCount)) - return charts[i]; - return 0; - } - int getChartCount() { - return chartCount; - } - void setMainChart(const BaseChart *c) - { CMultiChart_setMainChart(ptr, c->getInternalPtr()); mainChart = c;} -}; - - -class Sector : public AutoDestroy, protected GarbageContainer -{ -private : - //disable copying - Sector(const Sector &rhs); - Sector &operator=(const Sector &rhs); - - SectorInternal *ptr; - -public : - Sector(SectorInternal *ptr) : ptr(ptr) {} - ~Sector() {} - - void setExplode(int distance = -1) - { CSector_setExplode(ptr, distance); } - void setLabelFormat(const char *formatString) - { CSector_setLabelFormat(ptr, formatString); } - TextBox *setLabelStyle(const char *font = 0, double fontSize = 8, - int fontColor = Chart::TextColor) - { TextBox *ret = new TextBox(CSector_setLabelStyle(ptr, font, fontSize, fontColor)); reg(ret); return ret;} - void setLabelPos(int pos, int joinLineColor = -1) - { CSector_setLabelPos(ptr, pos, joinLineColor); } - void setLabelLayout(int layoutMethod, int pos = -1) - { CSector_setLabelLayout(ptr, layoutMethod, pos); } - void setJoinLine(int joinLineColor, int joinLineWidth = 1) - { CSector_setJoinLine(ptr, joinLineColor, joinLineWidth); } - void setColor(int color, int edgeColor = -1, int joinLineColor = -1) - { CSector_setColor(ptr, color, edgeColor, joinLineColor); } - void setStyle(int shadingMethod, int edgeColor = -1, int edgeWidth = -1) - { CSector_setStyle(ptr, shadingMethod, edgeColor, edgeWidth); } - const char *getImageCoor(int offsetX = 0, int offsetY = 0) - { return CSector_getImageCoor(ptr, offsetX, offsetY); } - const char *getLabelCoor(int offsetX = 0, int offsetY = 0) - { return CSector_getLabelCoor(ptr, offsetX, offsetY); } -}; - - -class PieChart : public BaseChart -{ -private : - //disable copying - PieChart(const PieChart &rhs); - PieChart &operator=(const PieChart &rhs); - - PieChartInternal *ptr; - -public : - PieChart(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { ptr = CPieChart_create(width, height, bgColor, edgeColor, raisedEffect); - init(PieChart2BaseChart(ptr)); } - static PieChart *create(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { return new PieChart(width, height, bgColor, edgeColor, raisedEffect); } - - void setPieSize(int x, int y, int r) - { CPieChart_setPieSize(ptr, x, y, r); } - void setDonutSize(int x, int y, int r, int r2) - { CPieChart_setDonutSize(ptr, x, y, r, r2); } - void set3D(int depth = -1, double angle = -1, bool shadowMode = false) - { CPieChart_set3D(ptr, depth, angle, shadowMode); } - void set3D(DoubleArray depths, double angle = 45, bool shadowMode = false) - { CPieChart_set3D2(ptr, depths.data, depths.len, angle, shadowMode); } - void setSectorStyle(int shadingMethod, int edgeColor = -1, int edgeWidth = -1) - { CPieChart_setSectorStyle(ptr, shadingMethod, edgeColor, edgeWidth); } - void setStartAngle(double startAngle, bool clockWise = true) - { CPieChart_setStartAngle(ptr, startAngle, clockWise); } - void setExplode(int sectorNo = -1, int distance = -1) - { CPieChart_setExplode(ptr, sectorNo, distance); } - void setExplodeGroup(int startSector, int endSector, int distance = -1) - { CPieChart_setExplodeGroup(ptr, startSector, endSector, distance); } - - void setLabelFormat(const char *formatString) - { CPieChart_setLabelFormat(ptr, formatString); } - TextBox *setLabelStyle(const char *font = 0, double fontSize = 8, - int fontColor = Chart::TextColor) - { TextBox *ret = new TextBox(CPieChart_setLabelStyle(ptr, font, fontSize, fontColor)); reg(ret); return ret;} - void setLabelPos(int pos, int joinLineColor = -1) - { CPieChart_setLabelPos(ptr, pos, joinLineColor); } - void setLabelLayout(int layoutMethod, int pos = -1, int topBound = -1, int bottomBound = -1) - { CPieChart_setLabelLayout(ptr, layoutMethod, pos, topBound, bottomBound); } - void setJoinLine(int joinLineColor, int joinLineWidth = 1) - { CPieChart_setJoinLine(ptr, joinLineColor, joinLineWidth); } - void setLineColor(int edgeColor, int joinLineColor = -1) - { CPieChart_setLineColor(ptr, edgeColor, joinLineColor); } - - void setData(int noOfPoints, const double *data, const char* const* labels = 0) - { setData(DoubleArray(data, noOfPoints), StringArray(labels, labels ? noOfPoints : 0)); } - void setData(DoubleArray data, StringArray labels = StringArray()) - { CPieChart_setData(ptr, data.data, data.len, labels.data, labels.len); } - - Sector *getSector(int sectorNo) - { SectorInternal *p = CPieChart_sector(ptr, sectorNo); if (!p) return 0; - Sector *ret = new Sector(p); reg(ret); return ret; } - Sector *sector(int sectorNo) { return getSector(sectorNo); } -}; - - -class LineObj; -class Mark : public TextBox -{ -private : - //disable copying - Mark(const Mark &rhs); - Mark &operator=(const Mark &rhs); - - MarkInternal *ptr; - -public : - Mark(MarkInternal *ptr) : TextBox(Mark2TextBox(ptr)), ptr(ptr) {} - ~Mark() {} - - void setValue(double value) { CMark_setValue(ptr, value); } - void setMarkColor(int lineColor, int textColor = -1, int tickColor = -1) - { CMark_setMarkColor(ptr, lineColor, textColor, tickColor); } - void setLineWidth(int w) { CMark_setLineWidth(ptr, w); } - void setDrawOnTop(bool b) { CMark_setDrawOnTop(ptr, b); } - LineObj *getLine() { return (LineObj *)CMark_getLine(ptr); } -}; - - -class Axis : public AutoDestroy, protected GarbageContainer -{ -private : - //disable copying - Axis(const Axis &rhs); - Axis &operator=(const Axis &rhs); - - AxisInternal *ptr; - -public : - Axis(AxisInternal *ptr) : ptr(ptr) {} - ~Axis() {} - AxisInternal *getInternalPtr() { return ptr; } - const AxisInternal *getInternalPtr() const { return ptr; } - - TextBox *setLabelStyle(const char *font = 0, double fontSize = 8, - int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CAxis_setLabelStyle(ptr, font, fontSize, fontColor, fontAngle)); reg(ret); return ret; } - void setLabelFormat(const char *formatString) - { CAxis_setLabelFormat(ptr, formatString); } - void setLabelGap(int d) - { CAxis_setLabelGap(ptr, d); } - - void setMultiFormat(int filter1, const char *format1, int filter2, const char *format2, int labelSpan = 1, bool promoteFirst = true) - { CAxis_setMultiFormat(ptr, filter1, format1, filter2, format2, labelSpan, promoteFirst); } - void setMultiFormat(int filterId, const char *formatString, int labelSpan = 1, bool promoteFirst = true) - { CAxis_setMultiFormat2(ptr, filterId, formatString, labelSpan, promoteFirst); } - void setFormatCondition(const char *condition, double operand = 0) - { CAxis_setFormatCondition(ptr, condition, operand); } - - TextBox *setTitle(const char *text, const char *font = 0, - double fontSize = 8, int fontColor = Chart::TextColor) - { TextBox *ret = new TextBox(CAxis_setTitle(ptr, text, font, fontSize, fontColor)); reg(ret); return ret; } - void setTitlePos(int alignment, int titleGap = 3) - { CAxis_setTitlePos(ptr, alignment, titleGap); } - - void setColors(int axisColor, int labelColor = Chart::TextColor, int titleColor = -1, - int tickColor = -1) - { CAxis_setColors(ptr, axisColor, labelColor, titleColor, tickColor); } - - void setTickLength(int majorTickLen) - { CAxis_setTickLength(ptr, majorTickLen); } - void setTickLength(int majorTickLen, int minorTickLen) - { CAxis_setTickLength2(ptr, majorTickLen, minorTickLen); } - void setTickWidth(int majorTickWidth, int minorTickWidth = -1) - { CAxis_setTickWidth(ptr, majorTickWidth, minorTickWidth); } - void setTickColor(int majorTickColor, int minorTickColor = -1) - { CAxis_setTickColor(ptr, majorTickColor, minorTickColor); } - - void setWidth(int width) { CAxis_setWidth(ptr, width); } - void setLength(int length) { CAxis_setLength(ptr, length); } - void setOffset(int x, int y) { CAxis_setOffset(ptr, x, y); } - - void setAngle(double startAngle) { CAxis_setAngle(ptr, startAngle); } - void setTopMargin(int topMargin) //obsoleted - use setMargin(int, int) - { setMargin(topMargin); } - void setMargin(int topMargin, int bottomMargin = 0) - { CAxis_setMargin(ptr, topMargin, bottomMargin); } - void setIndent(bool indent) { CAxis_setIndent(ptr, indent); } - void setTickOffset(double offset) { CAxis_setTickOffset(ptr, offset); } - void setLabelOffset(double offset) { CAxis_setLabelOffset(ptr, offset); } - - void setAutoScale(double topExtension = 0.1, double bottomExtension = 0.1, double zeroAffinity = 0.8) - { CAxis_setAutoScale(ptr, topExtension, bottomExtension, zeroAffinity); } - void setRounding(bool roundMin, bool roundMax) - { CAxis_setRounding(ptr, roundMin, roundMax); } - void setTickDensity(int majorTickSpacing, int minorTickSpacing = -1) - { CAxis_setTickDensity(ptr, majorTickSpacing, minorTickSpacing); } - void setReverse(bool b = true) - { CAxis_setReverse(ptr, b); } - void setMinTickInc(double inc) { CAxis_setMinTickInc(ptr, inc); } - - TextBox *setLabels(int noOfLabels, const char* const* text) //obsoleted - use setLabels(StringArray) - { return setLabels(StringArray(text, noOfLabels)); } - TextBox *setLabels(StringArray labels) - { TextBox *ret = new TextBox(CAxis_setLabels(ptr, labels.data, labels.len)); reg(ret); return ret; } - TextBox *setLabels(DoubleArray labels, const char *formatString = 0) - { TextBox *ret = new TextBox(CAxis_setLabels2(ptr, labels.data, labels.len, formatString)); reg(ret); return ret; } - CDMLTable *makeLabelTable() - { CDMLTable *ret = new CDMLTable(CAxis_makeLabelTable(ptr)); reg(ret); return ret; } - CDMLTable *getLabelTable() - { CDMLTableInternal *p = CAxis_getLabelTable(ptr); if (!p) return 0; - CDMLTable *ret = new CDMLTable(p); reg(ret); return ret; } - - void setLabelStep(int majorTickStep, int minorTickStep = 0, int majorTickOffset = 0, int minorTickOffset = -0x7fffffff) - { CAxis_setLabelStep(ptr, majorTickStep, minorTickStep, majorTickOffset, minorTickOffset); } - - void setLinearScale(const char *formatString = 0) - { CAxis_setLinearScale3(ptr, formatString); } - void setLinearScale(double lowerLimit, double upperLimit, StringArray labels) - { CAxis_setLinearScale2(ptr, lowerLimit, upperLimit, labels.data, labels.len); } - void setLinearScale(double lowerLimit, double upperLimit, double majorTickInc = 0, double minorTickInc = 0) - { CAxis_setLinearScale(ptr, lowerLimit, upperLimit, majorTickInc, minorTickInc); } - - void setLogScale(bool logScale) //obsoleted - use setLogScale(const char *)/setLinearScale(const char *) - { if (logScale) setLogScale(); else setLinearScale(); } - - void setLogScale(const char *formatString = 0) - { CAxis_setLogScale3(ptr, formatString); } - void setLogScale(double lowerLimit, double upperLimit, StringArray labels) - { CAxis_setLogScale2(ptr, lowerLimit, upperLimit, labels.data, labels.len); } - void setLogScale(double lowerLimit, double upperLimit, double majorTickInc = 0, double minorTickInc = 0) - { CAxis_setLogScale(ptr, lowerLimit, upperLimit, majorTickInc, minorTickInc); } - - void setDateScale(const char *formatString = 0) - { CAxis_setDateScale3(ptr, formatString); } - void setDateScale(double lowerLimit, double upperLimit, StringArray labels) - { CAxis_setDateScale2(ptr, lowerLimit, upperLimit, labels.data, labels.len); } - void setDateScale(double lowerLimit, double upperLimit, double majorTickInc = 0, double minorTickInc = 0) - { CAxis_setDateScale(ptr, lowerLimit, upperLimit, majorTickInc, minorTickInc); } - - void syncAxis(const Axis *axis, double slope = 1, double intercept = 0) - { CAxis_syncAxis(ptr, axis->ptr, slope, intercept); } - void copyAxis(const Axis *axis) - { CAxis_copyAxis(ptr, axis->ptr); } - - void addLabel(double pos, const char *label) - { CAxis_addLabel(ptr, pos, label); } - - Mark *addMark(double value, int lineColor, const char *text = 0, - const char *font = 0, double fontSize = 8) - { Mark *ret = new Mark(CAxis_addMark(ptr, value, lineColor, text, font, fontSize)); reg(ret); return ret; } - void addZone(double startValue, double endValue, int color) - { CAxis_addZone(ptr, startValue, endValue, color); } - - int getCoor(double v) const { return CAxis_getCoor(ptr, v); } - int getX() { return CAxis_getX(ptr); } - int getY() { return CAxis_getY(ptr); } - int getAlignment() { return CAxis_getAlignment(ptr); } - double getMinValue() const { return CAxis_getMinValue(ptr); } - double getMaxValue() const { return CAxis_getMaxValue(ptr); } - int getThickness() const { return CAxis_getThickness(ptr); } - - DoubleArray getTicks() const - { const double *d; int len; CAxis_getTicks(ptr, &d, &len); return DoubleArray(d, len); } - const char *getLabel(double i) const { return CAxis_getLabel(ptr, i); } - const char *getFormattedLabel(double v, const char *formatString = 0) - { return CAxis_getFormattedLabel(ptr, v, formatString); } - - const char *getAxisImageMap(int noOfSegments, int mapWidth, const char *url, const char *queryFormat = 0, - const char *extraAttr = 0, int offsetX = 0, int offsetY = 0) const - { return CAxis_getAxisImageMap(ptr, noOfSegments, mapWidth, url, queryFormat, extraAttr, offsetX, offsetY); } - const char *getHTMLImageMap(const char *url, const char *queryFormat = 0, const char *extraAttr = 0, - int offsetX = 0, int offsetY = 0) const - { return CAxis_getHTMLImageMap(ptr, url, queryFormat, extraAttr, offsetX, offsetY); } -}; - -// -// for compatibility -// -typedef Axis BaseAxis; -typedef BaseAxis XAxis; -typedef BaseAxis YAxis; - -// -// In this version, PolarChart RadialAxis is the same as the XYChart Axis -// -typedef Axis RadialAxis; - -// -// AngularAxis for PolarChart -// -class AngularAxis : public AutoDestroy, protected GarbageContainer -{ -private : - //disable copying - AngularAxis(const AngularAxis &rhs); - AngularAxis &operator=(const AngularAxis &rhs); - - AngularAxisInternal *ptr; - -public : - AngularAxis(AngularAxisInternal *ptr) : ptr(ptr) {} - ~AngularAxis() {} - - TextBox *setLabelStyle(const char *font = "bold", double fontSize = 10, - int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CAngularAxis_setLabelStyle(ptr, font, fontSize, fontColor, fontAngle)); reg(ret); return ret; } - void setLabelGap(int d) { CAngularAxis_setLabelGap(ptr, d); } - - TextBox *setLabels(StringArray labels) - { TextBox *ret = new TextBox(CAngularAxis_setLabels(ptr, labels.data, labels.len)); reg(ret); return ret; } - TextBox *setLabels(DoubleArray labels, const char *formatString = 0) - { TextBox *ret = new TextBox(CAngularAxis_setLabels2(ptr, labels.data, labels.len, formatString)); reg(ret); return ret; } - void addLabel(double pos, const char *label) - { CAngularAxis_addLabel(ptr, pos, label); } - - void setLinearScale(double lowerLimit, double upperLimit, StringArray labels) - { CAngularAxis_setLinearScale2(ptr, lowerLimit, upperLimit, labels.data, labels.len); } - void setLinearScale(double lowerLimit, double upperLimit, double majorTickInc = 0, double minorTickInc = 0) - { CAngularAxis_setLinearScale(ptr, lowerLimit, upperLimit, majorTickInc, minorTickInc); } - - void addZone(double startValue, double endValue, double startRadius, double endRadius, - int fillColor, int edgeColor = -1) - { CAngularAxis_addZone(ptr, startValue, endValue, startRadius, endRadius, fillColor, edgeColor); } - void addZone(double startValue, double endValue, int fillColor, int edgeColor = -1) - { CAngularAxis_addZone2(ptr, startValue, endValue, fillColor, edgeColor); } - - const char *getAxisImageMap(int noOfSegments, int mapWidth, const char *url, const char *queryFormat = 0, - const char *extraAttr = 0, int offsetX = 0, int offsetY = 0) const - { return CAngularAxis_getAxisImageMap(ptr, noOfSegments, mapWidth, url, queryFormat, extraAttr, offsetX, offsetY); } - const char *getHTMLImageMap(const char *url, const char *queryFormat = 0, const char *extraAttr = 0, - int offsetX = 0, int offsetY = 0) const - { return CAngularAxis_getHTMLImageMap(ptr, url, queryFormat, extraAttr, offsetX, offsetY); } -}; - - -class ColorAxis : public Axis -{ -private : - //disable copying - ColorAxis(const ColorAxis &rhs); - ColorAxis &operator=(const ColorAxis &rhs); - - ColorAxisInternal *ptr; - -public : - ColorAxis(ColorAxisInternal *ptr) : Axis(ColorAxis2Axis(ptr)), ptr(ptr) {} - ~ColorAxis() {} - - void setColorGradient(bool isContinuous = true, IntArray colors = IntArray(), int underflowColor = -1, int overflowColor = -1) - { CColorAxis_setColorGradient(ptr, isContinuous, colors.data, colors.len, overflowColor, underflowColor); } - void setAxisPos(int x, int y, int alignment) { CColorAxis_setAxisPos(ptr, x, y, alignment); } - void setLevels(int maxLevels) { CColorAxis_setLevels(ptr, maxLevels); } - void setCompactAxis(bool b = true) { CColorAxis_setCompactAxis(ptr, b); } - void setAxisBorder(int edgeColor, int raisedEffect = 0) { CColorAxis_setAxisBorder(ptr, edgeColor, raisedEffect); } - void setBoundingBox(int fillColor, int edgeColor = Chart::Transparent, int raisedEffect = 0) - { CColorAxis_setBoundingBox(ptr, fillColor, edgeColor, raisedEffect); } - void setBoxMargin(int m) { CColorAxis_setBoxMargin(ptr, m); } - void setBoxMargin(int leftMargin, int rightMargin, int topMargin, int bottomMargin) - { CColorAxis_setBoxMargin2(ptr, leftMargin, rightMargin, topMargin, bottomMargin); } - void setRoundedCorners(int r1 = 10, int r2 = -1, int r3 = -1, int r4 = -1) - { CColorAxis_setRoundedCorners(ptr, r1, r2, r3, r4); } - int getBoxWidth() const { return CColorAxis_getBoxWidth(ptr); } - int getBoxHeight() const { return CColorAxis_getBoxHeight(ptr); } - int getColor(double z) const { return CColorAxis_getColor(ptr, z); } -}; - - -class DataSet : public AutoDestroy, protected GarbageContainer -{ -private : - //disable copying - DataSet(const DataSet &rhs); - DataSet &operator=(const DataSet &rhs); - - DataSetInternal *ptr; - Axis *useYAxisCache; - -public : - DataSet(DataSetInternal *ptr) : ptr(ptr), useYAxisCache(0) {} - ~DataSet() {} - DataSetInternal *getInternalPtr() { return ptr; } - const DataSetInternal *getInternalPtr() const { return ptr; } - - void setData(int noOfPoints, const double *data) - { setData(DoubleArray(data, noOfPoints)); } - void setData(DoubleArray data) - { CDataSet_setData(ptr, data.data, data.len); } - double getValue(int i ) - { return CDataSet_getValue(ptr, i); } - double getPosition(int i ) - { return CDataSet_getPosition(ptr, i); } - - void setDataName(const char *name) - { CDataSet_setDataName(ptr, name); } - const char *getDataName() - { return CDataSet_getDataName(ptr); } - void setDataColor(int dataColor, int edgeColor = -1, - int shadowColor = -1, int shadowEdgeColor = -1) - { CDataSet_setDataColor(ptr, dataColor, edgeColor, shadowColor, shadowEdgeColor); } - int getDataColor() - { return CDataSet_getDataColor(ptr); } - - void setDataSymbol(int symbol, int size = 5, int fillColor = -1, int edgeColor = -1, int lineWidth = 1) - { CDataSet_setDataSymbol(ptr, symbol, size, fillColor, edgeColor, lineWidth); } - void setDataSymbol(const char *image) - { CDataSet_setDataSymbol2(ptr, image); } - void setDataSymbol(const DrawArea *obj) - { CDataSet_setDataSymbol3(ptr, obj->getInternalPtr()); } - void setDataSymbol(IntArray polygon, int size = 11, int fillColor = -1, int edgeColor = -1) - { CDataSet_setDataSymbol4(ptr, polygon.data, polygon.len, size, fillColor, edgeColor); } - void setLineWidth(int w) - { CDataSet_setLineWidth(ptr, w); } - - void setDataLabelFormat(const char *formatString) - { CDataSet_setDataLabelFormat(ptr, formatString); } - TextBox *setDataLabelStyle(const char *font = 0, double fontSize = 8, - int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CDataSet_setDataLabelStyle(ptr, font, fontSize, fontColor, fontAngle)); reg(ret); return ret;} - - void setUseYAxis2(bool b = true) { CDataSet_setUseYAxis2(ptr, b); } - void setUseYAxis(const Axis* a) { CDataSet_setUseYAxis(ptr, a->getInternalPtr()); } - Axis *getUseYAxis() { - AxisInternal *retPtr = CDataSet_getUseYAxis(ptr); - if ((0 == useYAxisCache) || (retPtr != useYAxisCache->getInternalPtr())) { - useYAxisCache = new Axis(retPtr); reg(useYAxisCache); - } - return useYAxisCache; - } - - const char *getLegendIcon() - { return CDataSet_getLegendIcon(ptr); } -}; - - -class Layer : public AutoDestroy, protected GarbageContainer -{ -private : - //disable copying - Layer(const Layer &rhs); - Layer &operator=(const Layer &rhs); - - LayerInternal *ptr; - - DataSet **dataSetCache; - int dataSetCacheCount; - int maxDataSetCacheCount; - - DataSet *regDataSet(DataSetInternal *ptr) { - if (!ptr) return 0; - for (int i = 0; i < dataSetCacheCount; ++i) - if (dataSetCache[i]->getInternalPtr() == ptr) return dataSetCache[i]; - DataSet *ret = new DataSet(ptr); reg(ret); - if (dataSetCacheCount >= maxDataSetCacheCount) { - maxDataSetCacheCount = (maxDataSetCacheCount < 10) ? 10 : maxDataSetCacheCount * 2; - DataSet **temp = new DataSet*[maxDataSetCacheCount]; - for (int i = 0; i < dataSetCacheCount; ++i) temp[i] = dataSetCache[i]; - delete[] dataSetCache; dataSetCache = temp; - } - return dataSetCache[dataSetCacheCount++] = ret; - } - -public : - Layer(LayerInternal *ptr) : ptr(ptr), dataSetCache(0), dataSetCacheCount(0), maxDataSetCacheCount(0) {} - ~Layer() { delete[] dataSetCache; } - LayerInternal *getInternalPtr() { return ptr; } - const LayerInternal *getInternalPtr() const { return ptr; } - - void moveFront(Layer *layer = 0) { CLayer_moveFront(ptr, layer ? layer->ptr : 0); } - void moveBack(Layer *layer = 0) { CLayer_moveBack(ptr, layer ? layer->ptr : 0); } - - void set3D(int d = -1, int zGap = 0) { CLayer_set3D(ptr, d, zGap); } - void setLineWidth(int w) { CLayer_setLineWidth(ptr, w); } - void setBorderColor(int color, int lightingEffect = 0) - { CLayer_setBorderColor(ptr, color, lightingEffect); } - void setLegend(int m) { CLayer_setLegend(ptr, m); } - void setLegendOrder(int dataSetOrder, int layerOrder = -1) - { CLayer_setLegendOrder(ptr, dataSetOrder, layerOrder); } - const char *getLegendIcon(int dataSetNo) const - { return CLayer_getLegendIcon(ptr, dataSetNo); } - - //obsoleted constants - for compatibility only - enum DataCombineMethod { Overlay, Stack, Depth, Side }; - - void setDataCombineMethod(int m) { CLayer_setDataCombineMethod(ptr, m); } - void setBaseLine(double baseLine) { CLayer_setBaseLine(ptr, baseLine); } - - DataSet *addDataSet(int noOfPoints, const double *d, int color = -1, const char *name = 0) - { return addDataSet(DoubleArray(d, noOfPoints), color, name); } - DataSet *addDataSet(DoubleArray data, int color = -1, const char *name = 0) - { return regDataSet(CLayer_addDataSet(ptr, data.data, data.len, color, name)); } - void addDataGroup(const char *name = 0) { CLayer_addDataGroup(ptr, name); } - void addExtraField(StringArray texts) { CLayer_addExtraField(ptr, texts.data, texts.len); } - void addExtraField(DoubleArray numbers) { CLayer_addExtraField2(ptr, numbers.data, numbers.len); } - - DataSet *getDataSet(int i) - { return regDataSet(CLayer_getDataSet(ptr, i)); } - DataSet *getDataSetByZ(int i) - { return regDataSet(CLayer_getDataSetByZ(ptr, i)); } - int getDataSetCount() - { return CLayer_getDataSetCount(ptr); } - - void setUseYAxis2(bool b = true) { CLayer_setUseYAxis2(ptr, b); } - void setUseYAxis(const Axis* a) { CLayer_setUseYAxis(ptr, a->getInternalPtr()); } - - void setXData(DoubleArray xData) { CLayer_setXData(ptr, xData.data, xData.len); } - void setXData(double minValue, double maxValue) { CLayer_setXData2(ptr, minValue, maxValue); } - double getXPosition(int i) - { return CLayer_getXPosition(ptr, i); } - double getNearestXValue(double target) - { return CLayer_getNearestXValue(ptr, target); } - int getXIndexOf(double xValue, double tolerance = 0) - { return CLayer_getXIndexOf(ptr, xValue, tolerance); } - void alignLayer(const Layer *layer, int dataSet) { CLayer_alignLayer(ptr, layer->getInternalPtr(), dataSet); } - - int getXCoor(double v) const { return CLayer_getXCoor(ptr, v); } - int getYCoor(double v, bool yAxis = true) const { return CLayer_getYCoor(ptr, v, yAxis); } - int getYCoor(double v, const Axis *yAxis) const - { if (0 == yAxis) return getYCoor(v); else return CLayer_getYCoor2(ptr, v, yAxis->getInternalPtr()); } - int xZoneColor(double threshold, int belowColor, int aboveColor) - { return CLayer_xZoneColor(ptr, threshold, belowColor, aboveColor); } - int yZoneColor(double threshold, int belowColor, int aboveColor, bool yAxis = true) - { return CLayer_yZoneColor(ptr, threshold, belowColor, aboveColor, yAxis); } - int yZoneColor(double threshold, int belowColor, int aboveColor, const Axis *yAxis) - { if (0 == yAxis) return yZoneColor(threshold, belowColor, aboveColor); - else return CLayer_yZoneColor2(ptr, threshold, belowColor, aboveColor, yAxis->getInternalPtr()); } - - //*** Note ***: The default value -0x7fffffff is maintained for compatibility - const char *getImageCoor(int dataSet, int dataItem = -0x7fffffff, int offsetX = 0, int offsetY = 0) - { return CLayer_getImageCoor(ptr, dataSet, dataItem, offsetX, offsetY); } - const char *getImageCoor2(int dataItem, int offsetX = 0, int offsetY = 0) - { return CLayer_getImageCoor2(ptr, dataItem, offsetX, offsetY); } - const char *getHTMLImageMap(const char *url, const char *queryFormat = 0, - const char *extraAttr = 0, int offsetX = 0, int offsetY = 0) - { return CLayer_getHTMLImageMap(ptr, url, queryFormat, extraAttr, offsetX, offsetY); } - void setHTMLImageMap(const char *url, const char *queryFormat = 0, const char *extraAttr = 0) - { CLayer_setHTMLImageMap(ptr, url, queryFormat, extraAttr); } - - void setDataLabelFormat(const char *formatString) - { CLayer_setDataLabelFormat(ptr, formatString); } - TextBox *setDataLabelStyle(const char *font = 0, double fontSize = 8, - int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CLayer_setDataLabelStyle(ptr, font, fontSize, fontColor, fontAngle)); reg(ret); return ret;} - - void setAggregateLabelFormat(const char *formatString) - { CLayer_setAggregateLabelFormat(ptr, formatString); } - TextBox *setAggregateLabelStyle(const char *font = 0, double fontSize = 8, - int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CLayer_setAggregateLabelStyle(ptr, font, fontSize, fontColor, fontAngle)); reg(ret); return ret;} - - TextBox *addCustomDataLabel(int dataSet, int dataItem, const char *label, - const char *font = 0, double fontSize = 8, int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CLayer_addCustomDataLabel(ptr, dataSet, dataItem, label, font, fontSize, fontColor, fontAngle)); reg(ret); return ret;} - TextBox *addCustomAggregateLabel(int dataItem, const char *label, const char *font = 0, - double fontSize = 8, int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CLayer_addCustomAggregateLabel(ptr, dataItem, label, font, fontSize, fontColor, fontAngle)); reg(ret); return ret;} - TextBox *addCustomGroupLabel(int dataGroup, int dataItem, const char *label, - const char *font = 0, double fontSize = 8, int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CLayer_addCustomGroupLabel(ptr, dataGroup, dataItem, label, font, fontSize, fontColor, fontAngle)); reg(ret); return ret;} -}; - - -class BarLayer : public Layer -{ -private : - //disable copying - BarLayer(const BarLayer &rhs); - BarLayer &operator=(const BarLayer &rhs); - - BarLayerInternal *ptr; - -public : - BarLayer(BarLayerInternal *ptr) : Layer(BarLayer2Layer(ptr)), ptr(ptr) {} - ~BarLayer() {} - - void setBarGap(double barGap, double subBarGap = Chart::NoValue) - { CBarLayer_setBarGap(ptr, barGap, subBarGap); } - void setBarWidth(int barWidth, int subBarWidth = -1) - { CBarLayer_setBarWidth(ptr, barWidth, subBarWidth); } - void setMinLabelSize(int s) - { CBarLayer_setMinLabelSize(ptr, s); } - void setMinImageMapSize(int s) - { CBarLayer_setMinImageMapSize(ptr, s); } - - void setBarShape(int shape, int dataGroup = -1, int dataItem = -1) - { CBarLayer_setBarShape(ptr, shape, dataGroup, dataItem); } - void setBarShape(IntArray shape, int dataGroup = -1, int dataItem = -1) - { CBarLayer_setBarShape2(ptr, shape.data, shape.len, dataGroup, dataItem); } - void setIconSize(int height, int width = -1) - { CBarLayer_setIconSize(ptr, height, width); } - void setOverlapRatio(double overlapRatio, bool firstOnTop = true) - { CBarLayer_setOverlapRatio(ptr, overlapRatio, firstOnTop); } -}; - - -class InterLineLayer : public Layer -{ -private : - //disable copying - InterLineLayer(const InterLineLayer &rhs); - InterLineLayer &operator=(const InterLineLayer &rhs); - - InterLineLayerInternal *ptr; - -public : - InterLineLayer(InterLineLayerInternal *ptr) : Layer(InterLineLayer2Layer(ptr)), ptr(ptr) {} - ~InterLineLayer() {} - - void setGapColor(int gapColor12, int gapColor21 = -1) - { CInterLineLayer_setGapColor(ptr, gapColor12, gapColor21); } -}; - - -class LineLayer : public Layer -{ -private : - //disable copying - LineLayer(const LineLayer &rhs); - LineLayer &operator=(const LineLayer &rhs); - - LineLayerInternal *ptr; - -public : - LineLayer(LineLayerInternal *ptr) : Layer(LineLayer2Layer(ptr)), ptr(ptr) {} - ~LineLayer() {} - - void setSymbolScale(DoubleArray zDataX, int scaleTypeX = Chart::PixelScale, - DoubleArray zDataY = DoubleArray(), int scaleTypeY = Chart::PixelScale) - { CLineLayer_setSymbolScale(ptr, zDataX.data, zDataX.len, scaleTypeX, - zDataY.data, zDataY.len, scaleTypeY); } - - void setGapColor(int lineColor, int lineWidth = -1) - { CLineLayer_setGapColor(ptr, lineColor, lineWidth); } - void setImageMapWidth(int width) - { CLineLayer_setImageMapWidth(ptr, width); } - void setFastLineMode(bool b = true) - { CLineLayer_setFastLineMode(ptr, b); } - LineObj *getLine(int dataSet = 0) - { return (LineObj *)CLineLayer_getLine(ptr, dataSet); } -}; - - -//In the current version, a Scatter chart is implemented as a -//special configuration of a Line chart. -typedef LineLayer ScatterLayer; - -class SplineLayer : public LineLayer -{ -private : - //disable copying - SplineLayer(const SplineLayer &rhs); - SplineLayer &operator=(const SplineLayer &rhs); - - SplineLayerInternal *ptr; - -public : - SplineLayer(SplineLayerInternal *ptr) : LineLayer(SplineLayer2LineLayer(ptr)), ptr(ptr) {} - ~SplineLayer() {} - - void setTension(double tension) { CSplineLayer_setTension(ptr, tension); } - void setMonotonicity(int m) { CSplineLayer_setMonotonicity(ptr, m); } -}; - - -class StepLineLayer : public LineLayer -{ -private : - //disable copying - StepLineLayer(const StepLineLayer &rhs); - StepLineLayer &operator=(const StepLineLayer &rhs); - - StepLineLayerInternal *ptr; - -public : - StepLineLayer(StepLineLayerInternal *ptr) : LineLayer(StepLineLayer2LineLayer(ptr)), ptr(ptr) {} - ~StepLineLayer() {} - - void setAlignment(int a) { CStepLineLayer_setAlignment(ptr, a); } -}; - - -class AreaLayer : public Layer -{ -private : - //disable copying - AreaLayer(const AreaLayer &rhs); - AreaLayer &operator=(const AreaLayer &rhs); - - AreaLayerInternal *ptr; - -public : - AreaLayer(AreaLayerInternal *ptr) : Layer(AreaLayer2Layer(ptr)), ptr(ptr) {} - ~AreaLayer() {} - - void setMinLabelSize(int s) { CAreaLayer_setMinLabelSize(ptr, s); } - void setGapColor(int fillColor) { CAreaLayer_setGapColor(ptr, fillColor); } -}; - - -class BaseBoxLayer : public Layer -{ -private : - //disable copying - BaseBoxLayer(const BaseBoxLayer &rhs); - BaseBoxLayer &operator=(const BaseBoxLayer &rhs); - - BaseBoxLayerInternal *ptr; - -public : - BaseBoxLayer(BaseBoxLayerInternal *ptr) : Layer(BaseBoxLayer2Layer(ptr)), ptr(ptr) {} - ~BaseBoxLayer() {} - - void setDataGap(double gap) { CBaseBoxLayer_setDataGap(ptr, gap); } - void setDataWidth(int width) { CBaseBoxLayer_setDataWidth(ptr, width); } - void setMinImageMapSize(int size) { CBaseBoxLayer_setMinImageMapSize(ptr, size); } -}; - - -class HLOCLayer : public BaseBoxLayer -{ -private : - //disable copying - HLOCLayer(const HLOCLayer &rhs); - HLOCLayer &operator=(const HLOCLayer &rhs); - - HLOCLayerInternal *ptr; - -public : - HLOCLayer(HLOCLayerInternal *ptr) : BaseBoxLayer(HLOCLayer2BaseBoxLayer(ptr)), ptr(ptr) {} - ~HLOCLayer() {} - - void setColorMethod(int colorMethod, int riseColor, int fallColor = -1, - double leadValue = -1.7E308) - { CHLOCLayer_setColorMethod(ptr, colorMethod, riseColor, fallColor, leadValue); } -}; - - -class CandleStickLayer : public BaseBoxLayer -{ -private : - //disable copying - CandleStickLayer(const CandleStickLayer &rhs); - CandleStickLayer &operator=(const CandleStickLayer &rhs); - - CandleStickLayerInternal *ptr; - -public : - CandleStickLayer(CandleStickLayerInternal *ptr) : BaseBoxLayer(CandleStickLayer2BaseBoxLayer(ptr)), ptr(ptr) {} - ~CandleStickLayer() {} -}; - - -class BoxWhiskerLayer : public BaseBoxLayer -{ -private : - //disable copying - BoxWhiskerLayer(const BoxWhiskerLayer &rhs); - BoxWhiskerLayer &operator=(const BoxWhiskerLayer &rhs); - - BoxWhiskerLayerInternal *ptr; - -public : - BoxWhiskerLayer(BoxWhiskerLayerInternal *ptr) : BaseBoxLayer(BoxWhiskerLayer2BaseBoxLayer(ptr)), ptr(ptr) {} - ~BoxWhiskerLayer() {} - - void setBoxColors(IntArray colors, StringArray names = StringArray()) - { CBoxWhiskerLayer_setBoxColors(ptr, colors.data, colors.len, names.data, names.len); } - void setBoxColor(int item, int boxColor) - { CBoxWhiskerLayer_setBoxColor(ptr, item, boxColor); } - void setWhiskerBrightness(double whiskerBrightness) - { CBoxWhiskerLayer_setWhiskerBrightness(ptr, whiskerBrightness); } -}; - - -class TrendLayer : public Layer -{ -private : - //disable copying - TrendLayer(const TrendLayer &rhs); - TrendLayer &operator=(const TrendLayer &rhs); - - TrendLayerInternal *ptr; - -public : - TrendLayer(TrendLayerInternal *ptr) : Layer(TrendLayer2Layer(ptr)), ptr(ptr) {} - ~TrendLayer() {} - - void setRegressionType(int regressionType) { CTrendLayer_setRegressionType(ptr, regressionType); } - - void addConfidenceBand(double confidence, int upperFillColor, int upperEdgeColor = Chart::Transparent, - int upperLineWidth = 1, int lowerFillColor = -1, int lowerEdgeColor = -1, int lowerLineWidth = -1) - { CTrendLayer_addConfidenceBand(ptr, confidence, upperFillColor, upperEdgeColor, - upperLineWidth, lowerFillColor, lowerEdgeColor, lowerLineWidth); } - void addPredictionBand(double confidence, int upperFillColor, int upperEdgeColor = Chart::Transparent, - int upperLineWidth = 1, int lowerFillColor = -1, int lowerEdgeColor = -1, int lowerLineWidth = -1) - { CTrendLayer_addPredictionBand(ptr, confidence, upperFillColor, upperEdgeColor, - upperLineWidth, lowerFillColor, lowerEdgeColor, lowerLineWidth); } - - double getSlope() { return CTrendLayer_getSlope(ptr); } - double getIntercept() { return CTrendLayer_getIntercept(ptr); } - double getCorrelation() { return CTrendLayer_getCorrelation(ptr); } - double getStdError() { return CTrendLayer_getStdError(ptr); } - double getCoefficient(int i) { return CTrendLayer_getCoefficient(ptr, i); } - - void setImageMapWidth(int width) { CTrendLayer_setImageMapWidth(ptr, width); } - LineObj *getLine() { return (LineObj *)CTrendLayer_getLine(ptr); } -}; - - -class VectorLayer : public Layer -{ -private : - //disable copying - VectorLayer(const VectorLayer &rhs); - VectorLayer &operator=(const VectorLayer &rhs); - - VectorLayerInternal *ptr; - -public : - VectorLayer(VectorLayerInternal *ptr) : Layer(VectorLayer2Layer(ptr)), ptr(ptr) {} - ~VectorLayer() {} - - void setVector(DoubleArray lengths, DoubleArray directions, int lengthScale = Chart::PixelScale) - { CVectorLayer_setVector(ptr, lengths.data, lengths.len, directions.data, directions.len, lengthScale); } - void setArrowHead(int width, int height = 0) { CVectorLayer_setArrowHead(ptr, width, height); } - void setArrowHead(IntArray polygon) { CVectorLayer_setArrowHead2(ptr, polygon.data, polygon.len); } - void setArrowStem(IntArray polygon) { CVectorLayer_setArrowStem(ptr, polygon.data, polygon.len); } - void setArrowAlignment(int alignment) { CVectorLayer_setArrowAlignment(ptr, alignment); } - void setIconSize(int height, int width = 0) { CVectorLayer_setIconSize(ptr, height, width); } - void setVectorMargin(double startMargin, double endMargin = Chart::NoValue) - { CVectorLayer_setVectorMargin(ptr, startMargin, endMargin); } -}; - - -class ContourLayer : public Layer -{ -private : - //disable copying - ContourLayer(const ContourLayer &rhs); - ContourLayer &operator=(const ContourLayer &rhs); - - ContourLayerInternal *ptr; - -public : - ContourLayer(ContourLayerInternal *ptr) : Layer(ContourLayer2Layer(ptr)), ptr(ptr) {} - ~ContourLayer() {} - - void setZData(DoubleArray zData) { CContourLayer_setZData(ptr, zData.data, zData.len); } - void setZBounds(double minZ, double maxZ) - { CContourLayer_setZBounds(ptr, minZ, maxZ); } - void setSmoothInterpolation(bool b) { CContourLayer_setSmoothInterpolation(ptr, b); } - void setContourColor(int contourColor, int minorContourColor = -1) - { CContourLayer_setContourColor(ptr, contourColor, minorContourColor); } - void setContourWidth(int contourWidth, int minorContourWidth = -1) - { CContourLayer_setContourWidth(ptr, contourWidth, minorContourWidth); } - void setExactContour(bool contour, bool markContour) - { CContourLayer_setExactContour(ptr, contour, markContour); } - void setExactContour(bool contour = true) - { setExactContour(contour, contour); } - ColorAxis *setColorAxis(int x, int y, int alignment, int length, int orientation) - { ColorAxis *ret = new ColorAxis(CContourLayer_setColorAxis(ptr, x, y, alignment, length, orientation)); reg(ret); return ret; } - ColorAxis *colorAxis() - { ColorAxis *ret = new ColorAxis(CContourLayer_colorAxis(ptr)); reg(ret); return ret; } -}; - - -class PlotArea : public AutoDestroy -{ -private : - //disable copying - PlotArea(const PlotArea &rhs); - PlotArea &operator=(const PlotArea &rhs); - - PlotAreaInternal *ptr; - -public : - PlotArea(PlotAreaInternal *ptr) : ptr(ptr) {} - ~PlotArea() {} - - void setBackground(int color, int altBgColor = -1, int edgeColor = -1) - { CPlotArea_setBackground(ptr, color, altBgColor, edgeColor); } - void setBackground(const char *img, int align = Chart::Center) - { CPlotArea_setBackground2(ptr, img, align); } - void set4QBgColor(int Q1Color, int Q2Color, int Q3Color, int Q4Color, int edgeColor = -1) - { CPlotArea_set4QBgColor(ptr, Q1Color, Q2Color, Q3Color, Q4Color, edgeColor); } - void setAltBgColor(bool horizontal, int color1, int color2, int edgeColor = -1) - { CPlotArea_setAltBgColor(ptr, horizontal, color1, color2, edgeColor); } - void setGridColor(int hGridColor, int vGridColor = Chart::Transparent, - int minorHGridColor = -1, int minorVGridColor = -1) - { CPlotArea_setGridColor(ptr, hGridColor, vGridColor, minorHGridColor, minorVGridColor); } - void setGridWidth(int hGridWidth, int vGridWidth = -1, - int minorHGridWidth = -1, int minorVGridWidth = -1) - { CPlotArea_setGridWidth(ptr, hGridWidth, vGridWidth, minorHGridWidth, minorVGridWidth); } - void setGridAxis(const Axis *xGridAxis, const Axis *yGridAxis) - { CPlotArea_setGridAxis(ptr, xGridAxis ? xGridAxis->getInternalPtr() : 0, yGridAxis ? yGridAxis->getInternalPtr() : 0); } - void moveGridBefore(Layer *layer = 0) { CPlotArea_moveGridBefore(ptr, layer ? layer->getInternalPtr() : 0); } - - int getLeftX() const { return CPlotArea_getLeftX(ptr); } - int getTopY() const { return CPlotArea_getTopY(ptr); } - int getWidth() const { return CPlotArea_getWidth(ptr); } - int getHeight() const { return CPlotArea_getHeight(ptr); } - int getRightX() const { return CPlotArea_getRightX(ptr); } - int getBottomY() const { return CPlotArea_getBottomY(ptr); } -}; - - -class XYChart : public BaseChart -{ -private : - //disable copying - XYChart(const XYChart &rhs); - XYChart &operator=(const XYChart &rhs); - - XYChartInternal *ptr; - - Layer **layerCache; - int layerCacheCount; - int maxLayerCacheCount; - - Layer *regLayer(LayerInternal *ptr) { - if (!ptr) return 0; - for (int i = 0; i < layerCacheCount; ++i) - if (layerCache[i]->getInternalPtr() == ptr) return layerCache[i]; - Layer *ret = new Layer(ptr); reg(ret); - if (layerCacheCount >= maxLayerCacheCount) { - maxLayerCacheCount = (maxLayerCacheCount < 10) ? 10 : maxLayerCacheCount * 2; - Layer **temp = new Layer*[maxLayerCacheCount]; - for (int i = 0; i < layerCacheCount; ++i) temp[i] = layerCache[i]; - delete[] layerCache; layerCache = temp; - } - return layerCache[layerCacheCount++] = ret; - } - -public : - XYChart(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) : - layerCache(0), layerCacheCount(0), maxLayerCacheCount(0) - { ptr = CXYChart_create(width, height, bgColor, edgeColor, raisedEffect); - init(XYChart2BaseChart(ptr)); } - static XYChart *create(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { return new XYChart(width, height, bgColor, edgeColor, raisedEffect); } - ~XYChart() { delete[] layerCache; } - - Axis *addAxis(int align, int offset) { Axis *ret = new Axis(CXYChart_addAxis(ptr, align, offset)); reg(ret); return ret; } - Axis *yAxis() { Axis *ret = new Axis(CXYChart_yAxis(ptr)); reg(ret); return ret; } - Axis *yAxis2() { Axis *ret = new Axis(CXYChart_yAxis2(ptr)); reg(ret); return ret; } - void syncYAxis(double slope = 1, double intercept = 0) - { CXYChart_syncYAxis(ptr, slope, intercept); } - void setYAxisOnRight(bool b = true) { CXYChart_setYAxisOnRight(ptr, b); } - Axis *xAxis() { Axis *ret = new Axis(CXYChart_xAxis(ptr)); reg(ret); return ret; } - Axis *xAxis2() { Axis *ret = new Axis(CXYChart_xAxis2(ptr)); reg(ret); return ret; } - void setXAxisOnTop(bool b = true) { CXYChart_setXAxisOnTop(ptr, b); } - void swapXY(bool b = true) { CXYChart_swapXY(ptr, b); } - void setAxisAtOrigin(int originMode = Chart::XYAxisAtOrigin, int symmetryMode = 0) - { CXYChart_setAxisAtOrigin(ptr, originMode, symmetryMode); } - - int getXCoor(double v) const { return CXYChart_getXCoor(ptr, v); } - int getYCoor(double v, const Axis *yAxis = 0) - { return CXYChart_getYCoor(ptr, v, (0 == yAxis) ? 0 : yAxis->getInternalPtr()); } - double getXValue(int xCoor) - { return CXYChart_getXValue(ptr, xCoor); } - double getNearestXValue(double xCoor) - { return CXYChart_getNearestXValue(ptr, xCoor); } - double getYValue(int yCoor, const Axis *yAxis = 0) - { return CXYChart_getYValue(ptr, yCoor, (0 == yAxis) ? 0 : yAxis->getInternalPtr()); } - - int xZoneColor(double threshold, int belowColor, int aboveColor) - { return CXYChart_xZoneColor(ptr, threshold, belowColor, aboveColor); } - int yZoneColor(double threshold, int belowColor, int aboveColor, const Axis *yAxis = 0) - { return CXYChart_yZoneColor(ptr, threshold, belowColor, aboveColor, (0 == yAxis) ? 0 : yAxis->getInternalPtr()); } - - PlotArea *setPlotArea(int x, int y, int width, int height, - int bgColor = Chart::Transparent, int altBgColor = -1, int edgeColor = -1, - int hGridColor = 0xc0c0c0, int vGridColor = Chart::Transparent) - { PlotArea *ret = new PlotArea(CXYChart_setPlotArea(ptr, x, y, width, height, bgColor, - altBgColor, edgeColor, hGridColor, vGridColor)); reg(ret); return ret; } - PlotArea *getPlotArea() { PlotArea *ret = new PlotArea(CXYChart_getPlotArea(ptr)); reg(ret); return ret; } - void setClipping(int margin = 0) { CXYChart_setClipping(ptr, margin); } - void setTrimData(int startPos, int len = 0x7fffffff) { CXYChart_setTrimData(ptr, startPos, len); } - - BarLayer *addBarLayer(int noOfPoints, const double *data, int color = -1, const char *name = 0, int depth = 0) - { return addBarLayer(DoubleArray(data, noOfPoints), color, name, depth); } - BarLayer *addBarLayer(DoubleArray data, int color = -1, const char *name = 0, int depth = 0) - { BarLayer *ret = new BarLayer(CXYChart_addBarLayer(ptr, data.data, data.len, color, name, depth)); reg(ret); return ret; } - BarLayer *addBarLayer(int noOfPoints, const double *data, const int *colors, const char* const* names = 0, int depth = 0) - { return addBarLayer(DoubleArray(data, noOfPoints), IntArray(colors, colors ? noOfPoints : 0), StringArray(names, names ? noOfPoints : 0), depth); } - BarLayer *addBarLayer(DoubleArray data, IntArray colors, StringArray names = StringArray(), int depth = 0) - { BarLayer *ret = new BarLayer(CXYChart_addBarLayer3(ptr, data.data, data.len, colors.data, colors.len, names.data, names.len, depth)); reg(ret); return ret; } - BarLayer *addBarLayer(int dataCombineMethod = Chart::Side, int depth = 0) - { BarLayer *ret = new BarLayer(CXYChart_addBarLayer2(ptr, dataCombineMethod, depth)); reg(ret); return ret; } - - LineLayer *addLineLayer(int noOfPoints, const double *data, int color = -1, const char *name = 0, int depth = 0) - { return addLineLayer(DoubleArray(data, noOfPoints), color, name, depth); } - LineLayer *addLineLayer(DoubleArray data, int color = -1, const char *name = 0, int depth = 0) - { LineLayer *ret = new LineLayer(CXYChart_addLineLayer(ptr, data.data, data.len, color, name, depth)); reg(ret); return ret; } - LineLayer *addLineLayer(int dataCombineMethod = Chart::Overlay, int depth = 0) - { LineLayer *ret = new LineLayer(CXYChart_addLineLayer2(ptr, dataCombineMethod, depth)); reg(ret); return ret; } - - AreaLayer *addAreaLayer(int noOfPoints, const double *data, int color = -1, const char *name = 0, int depth = 0) - { return addAreaLayer(DoubleArray(data, noOfPoints), color, name, depth); } - AreaLayer *addAreaLayer(DoubleArray data, int color = -1, const char *name = 0, int depth = 0) - { AreaLayer *ret = new AreaLayer(CXYChart_addAreaLayer(ptr, data.data, data.len, color, name, depth)); reg(ret); return ret; } - AreaLayer *addAreaLayer(int dataCombineMethod = Chart::Stack, int depth = 0) - { AreaLayer *ret = new AreaLayer(CXYChart_addAreaLayer2(ptr, dataCombineMethod, depth)); reg(ret); return ret; } - - HLOCLayer *addHLOCLayer() - { HLOCLayer *ret = new HLOCLayer(CXYChart_addHLOCLayer2(ptr)); reg(ret); return ret; } - HLOCLayer *addHLOCLayer(int noOfPoints, const double *highData, const double *lowData, const double *openData = 0, - const double *closeData = 0, int color = -1) - { return addHLOCLayer(DoubleArray(highData, highData ? noOfPoints : 0), DoubleArray(lowData, lowData ? noOfPoints : 0), - DoubleArray(openData, openData ? noOfPoints : 0), DoubleArray(closeData, closeData ? noOfPoints : 0), color); } - HLOCLayer *addHLOCLayer(DoubleArray highData, DoubleArray lowData, DoubleArray openData = DoubleArray(), - DoubleArray closeData = DoubleArray(), int color = -1) - { HLOCLayer *ret = new HLOCLayer(CXYChart_addHLOCLayer(ptr, highData.data, highData.len, - lowData.data, lowData.len, openData.data, openData.len, closeData.data, closeData.len, color)); reg(ret); return ret; } - HLOCLayer *addHLOCLayer(DoubleArray highData, DoubleArray lowData, DoubleArray openData, - DoubleArray closeData, int upColor, int downColor, int colorMode = -1, double leadValue = -1.7E308) - { HLOCLayer *ret = new HLOCLayer(CXYChart_addHLOCLayer3(ptr, highData.data, highData.len, - lowData.data, lowData.len, openData.data, openData.len, closeData.data, closeData.len, - upColor, downColor, colorMode, leadValue)); reg(ret); return ret; } - - CandleStickLayer *addCandleStickLayer( - DoubleArray highData, DoubleArray lowData, DoubleArray openData, DoubleArray closeData, - int riseColor = 0xffffff, int fallColor = 0x0, int edgeColor = Chart::LineColor) - { CandleStickLayer *ret = new CandleStickLayer(CXYChart_addCandleStickLayer(ptr, highData.data, highData.len, - lowData.data, lowData.len, openData.data, openData.len, closeData.data, closeData.len, - riseColor, fallColor, edgeColor)); reg(ret); return ret; } - - BoxWhiskerLayer *addBoxWhiskerLayer( - DoubleArray boxTop, DoubleArray boxBottom, DoubleArray maxData = DoubleArray(), DoubleArray minData = DoubleArray(), - DoubleArray midData = DoubleArray(), int fillColor = -1, int whiskerColor = Chart::LineColor, int edgeColor = -1) - { BoxWhiskerLayer *ret = new BoxWhiskerLayer(CXYChart_addBoxWhiskerLayer(ptr, boxTop.data, boxTop.len, - boxBottom.data, boxBottom.len, maxData.data, maxData.len, minData.data, minData.len, midData.data, midData.len, - fillColor, whiskerColor, edgeColor)); reg(ret); return ret; } - BoxWhiskerLayer *addBoxWhiskerLayer2(DoubleArray boxTop, DoubleArray boxBottom, DoubleArray maxData = DoubleArray(), - DoubleArray minData = DoubleArray(), DoubleArray midData = DoubleArray(), IntArray fillColors = IntArray(), - double whiskerBrightness = 0.5, StringArray names = StringArray()) - { BoxWhiskerLayer *ret = new BoxWhiskerLayer(CXYChart_addBoxWhiskerLayer2(ptr, boxTop.data, boxTop.len, - boxBottom.data, boxBottom.len, maxData.data, maxData.len, minData.data, minData.len, midData.data, midData.len, - fillColors.data, fillColors.len, whiskerBrightness, names.data, names.len)); reg(ret); return ret; } - BoxWhiskerLayer *addBoxLayer(DoubleArray boxTop, DoubleArray boxBottom, int color = -1, const char *name = 0) - { BoxWhiskerLayer *ret = new BoxWhiskerLayer(CXYChart_addBoxLayer(ptr, boxTop.data, boxTop.len, - boxBottom.data, boxBottom.len, color, name)); reg(ret); return ret; } - - ScatterLayer *addScatterLayer(DoubleArray xData, DoubleArray yData, const char *name = 0, - int symbol = Chart::SquareSymbol, int symbolSize = 5, int fillColor = -1, int edgeColor = -1) - { ScatterLayer *ret = new ScatterLayer(CXYChart_addScatterLayer(ptr, xData.data, xData.len, - yData.data, yData.len, name, symbol, symbolSize, fillColor, edgeColor)); reg(ret); return ret; } - - TrendLayer *addTrendLayer(DoubleArray data, int color = -1, const char *name = 0, int depth = 0) - { TrendLayer *ret = new TrendLayer(CXYChart_addTrendLayer(ptr, data.data, data.len, color, name, depth)); reg(ret); return ret; } - TrendLayer *addTrendLayer(DoubleArray xData, DoubleArray yData, int color = -1, const char *name = 0, int depth = 0) - { TrendLayer *ret = new TrendLayer(CXYChart_addTrendLayer2(ptr, xData.data, xData.len, - yData.data, yData.len, color, name, depth)); reg(ret); return ret; } - - SplineLayer *addSplineLayer(DoubleArray data = DoubleArray(), int color = -1, const char *name = 0) - { SplineLayer *ret = new SplineLayer(CXYChart_addSplineLayer(ptr, data.data, data.len, color, name)); reg(ret); return ret; } - StepLineLayer *addStepLineLayer(DoubleArray data = DoubleArray(), int color = -1, const char *name = 0) - { StepLineLayer *ret = new StepLineLayer(CXYChart_addStepLineLayer(ptr, data.data, data.len, color, name)); reg(ret); return ret; } - - InterLineLayer *addInterLineLayer(LineObj *line1, LineObj *line2, int color12, int color21 = -1) - { InterLineLayer *ret = new InterLineLayer(CXYChart_addInterLineLayer(ptr, (LineObjInternal *)line1, (LineObjInternal *)line2, color12, color21)); - reg(ret); return ret; } - - VectorLayer *addVectorLayer(DoubleArray xData, DoubleArray yData, DoubleArray lengths, DoubleArray directions, - int lengthScale = Chart::PixelScale, int color = -1, const char *name = 0) - { VectorLayer *ret = new VectorLayer(CXYChart_addVectorLayer(ptr, xData.data, xData.len, - yData.data, yData.len, lengths.data, lengths.len, directions.data, directions.len, lengthScale, color, name)); - reg(ret); return ret; } - - ContourLayer *addContourLayer(DoubleArray xData, DoubleArray yData, DoubleArray zData) - { ContourLayer *ret = new ContourLayer(CXYChart_addContourLayer(ptr, xData.data, xData.len, yData.data, yData.len, zData.data, zData.len)); - reg(ret); return ret; } - - Layer *getLayer(int i) - { return regLayer(CXYChart_getLayer(ptr, i)); } - Layer *getLayerByZ(int i) - { return regLayer(CXYChart_getLayerByZ(ptr, i)); } - int getLayerCount() - { return CXYChart_getLayerCount(ptr); } - - void layoutAxes() { CXYChart_layoutAxes(ptr); } - void packPlotArea(int leftX, int topY, int rightX, int bottomY, int minWidth = 0, int minHeight = 0) - { CXYChart_packPlotArea(ptr, leftX, topY, rightX, bottomY, minWidth, minHeight); } -}; - - -// -// Ver 5.1 -// -class ThreeDChart : public BaseChart -{ -private : - //disable copying - ThreeDChart(const ThreeDChart &rhs); - ThreeDChart &operator=(const ThreeDChart &rhs); - - ThreeDChartInternal *ptr; - -public : - ThreeDChart() : ptr(0) {} - void init(ThreeDChartInternal *ptr) { this->ptr = ptr; BaseChart::init(ThreeDChart2BaseChart(ptr)); } - - void setPlotRegion(int cx, int cy, int xWidth, int yDepth, int zHeight) - { CThreeDChart_setPlotRegion(ptr, cx, cy, xWidth, yDepth, zHeight); } - void setViewAngle(double elevation, double rotation = 0, double twist = 0) - { CThreeDChart_setViewAngle(ptr, elevation, rotation, twist); } - void setPerspective(double perspective) - { CThreeDChart_setPerspective(ptr, perspective); } - - Axis *xAxis() { Axis *ret = new Axis(CThreeDChart_xAxis(ptr)); reg(ret); return ret; } - Axis *yAxis() { Axis *ret = new Axis(CThreeDChart_yAxis(ptr)); reg(ret); return ret; } - Axis *zAxis() { Axis *ret = new Axis(CThreeDChart_zAxis(ptr)); reg(ret); return ret; } - void setZAxisPos(int pos) { CThreeDChart_setZAxisPos(ptr, pos); } - - ColorAxis *setColorAxis(int x, int y, int alignment, int length, int orientation) - { ColorAxis *ret = new ColorAxis(CThreeDChart_setColorAxis(ptr, x, y, alignment, length, orientation)); reg(ret); return ret; } - ColorAxis *colorAxis() - { ColorAxis *ret = new ColorAxis(CThreeDChart_colorAxis(ptr)); reg(ret); return ret; } - - void setWallVisibility(bool xyVisible, bool yzVisible, bool zxVisible) - { CThreeDChart_setWallVisibility(ptr, xyVisible, yzVisible, zxVisible); } - void setWallColor(int xyColor, int yzColor = -1, int zxColor = -1, int borderColor = -1) - { CThreeDChart_setWallColor(ptr, xyColor, yzColor, zxColor, borderColor); } - void setWallThickness(int xyThickness, int yzThickness = -1, int zxThickness = -1) - { CThreeDChart_setWallThickness(ptr, xyThickness, yzThickness, zxThickness); } - void setWallGrid(int majorXGridColor, int majorYGridColor = -1, int majorZGridColor = -1, - int minorXGridColor = -1, int minorYGridColor = -1, int minorZGridColor = -1) - { CThreeDChart_setWallGrid(ptr, majorXGridColor, majorYGridColor, majorZGridColor, minorXGridColor, minorYGridColor, minorZGridColor); } -}; - - -class SurfaceChart : public ThreeDChart -{ -private : - //disable copying - SurfaceChart(const SurfaceChart &rhs); - SurfaceChart &operator=(const SurfaceChart &rhs); - - SurfaceChartInternal *ptr; - -public : - SurfaceChart(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { ptr = CSurfaceChart_create(width, height, bgColor, edgeColor, raisedEffect); - init(SurfaceChart2ThreeDChart(ptr)); } - - void setData(DoubleArray xData, DoubleArray yData, DoubleArray zData) - { CSurfaceChart_setData(ptr, xData.data, xData.len, yData.data, yData.len, zData.data, zData.len); } - void setInterpolation(int xSamples, int ySamples = -1, bool isSmooth = true) - { CSurfaceChart_setInterpolation(ptr, xSamples, ySamples, isSmooth); } - - void setLighting(double ambientIntensity, double diffuseIntensity, double specularIntensity, double shininess) - { CSurfaceChart_setLighting(ptr, ambientIntensity, diffuseIntensity, specularIntensity, shininess); } - void setShadingMode(int shadingMode, int wireWidth = 1) - { CSurfaceChart_setShadingMode(ptr, shadingMode, wireWidth); } - - void setSurfaceAxisGrid(int majorXGridColor, int majorYGridColor = -1, int minorXGridColor = -1, int minorYGridColor = -1) - { CSurfaceChart_setSurfaceAxisGrid(ptr, majorXGridColor, majorYGridColor, minorXGridColor, minorYGridColor); } - void setSurfaceDataGrid(int xGridColor, int yGridColor = -1) - { CSurfaceChart_setSurfaceDataGrid(ptr, xGridColor, yGridColor); } - void setContourColor(int contourColor, int minorContourColor = -1) - { CSurfaceChart_setContourColor(ptr, contourColor, minorContourColor); } - - void setBackSideBrightness(double brightness) { CSurfaceChart_setBackSideBrightness(ptr, brightness); } - void setBackSideColor(int color) { CSurfaceChart_setBackSideColor(ptr, color); } - void setBackSideLighting(double ambientLight, double diffuseLight, double specularLight, double shininess) - { CSurfaceChart_setBackSideLighting(ptr, ambientLight, diffuseLight, specularLight, shininess); } -}; - -class ThreeDScatterGroup : public AutoDestroy -{ -private : - //disable copying - ThreeDScatterGroup(const ThreeDScatterGroup &rhs); - ThreeDScatterGroup &operator=(const ThreeDScatterGroup &rhs); - - ThreeDScatterGroupInternal *ptr; - -public : - ThreeDScatterGroup(ThreeDScatterGroupInternal *ptr) : ptr(ptr) {} - ~ThreeDScatterGroup() {} - - void setDataSymbol(int symbol, int size = 5, int fillColor = -1, int edgeColor = -1, int lineWidth = 1) - { CThreeDScatterGroup_setDataSymbol(ptr, symbol, size, fillColor, edgeColor, lineWidth); } - void setDataSymbol(const char *image) - { CThreeDScatterGroup_setDataSymbol2(ptr, image); } - void setDataSymbol(const DrawArea *obj) - { CThreeDScatterGroup_setDataSymbol3(ptr, obj->getInternalPtr()); } - void setDataSymbol(IntArray polygon, int size = 11, int fillColor = -1, int edgeColor = -1) - { CThreeDScatterGroup_setDataSymbol4(ptr, polygon.data, polygon.len, size, fillColor, edgeColor); } - - void setDropLine(int dropLineColor = Chart::LineColor, int dropLineWidth = 1) - { CThreeDScatterGroup_setDropLine(ptr, dropLineColor, dropLineWidth); } - void setLegendIcon(int width, int height = -1, int color = -1) - { CThreeDScatterGroup_setLegendIcon(ptr, width, height, color); } -}; - -class ThreeDScatterChart : public ThreeDChart -{ -private : - //disable copying - ThreeDScatterChart(const ThreeDScatterChart &rhs); - ThreeDScatterChart &operator=(const ThreeDScatterChart &rhs); - - ThreeDScatterChartInternal *ptr; - -public : - ThreeDScatterChart(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { ptr = CThreeDScatterChart_create(width, height, bgColor, edgeColor, raisedEffect); - init(ThreeDScatterChart2ThreeDChart(ptr)); } - - ThreeDScatterGroup *addScatterGroup(DoubleArray xData, DoubleArray yData, DoubleArray zData, const char *name = 0, - int symbol = Chart::CircleSymbol, int symbolSize = 5, int fillColor = -1, int edgeColor = -1) { - ThreeDScatterGroup *ret = new ThreeDScatterGroup(CThreeDScatterChart_addScatterGroup(ptr, xData.data, xData.len, - yData.data, yData.len, zData.data, zData.len, name, symbol, symbolSize, fillColor, edgeColor)); - reg(ret); return ret; - } -}; - -class PolarLayer : public AutoDestroy, protected GarbageContainer -{ -private : - //disable copying - PolarLayer(const PolarLayer &rhs); - PolarLayer &operator=(const PolarLayer &rhs); - - PolarLayerInternal *ptr; - -public : - PolarLayer(PolarLayerInternal *ptr) : ptr(ptr) {} - ~PolarLayer() {} - - void setData(DoubleArray data, int color = -1, const char *name = 0) - { CPolarLayer_setData(ptr, data.data, data.len, color, name); } - void setAngles(DoubleArray angles) - { CPolarLayer_setAngles(ptr, angles.data, angles.len); } - - void setBorderColor(int edgeColor) { CPolarLayer_setBorderColor(ptr, edgeColor); } - void setLineWidth(int w) { CPolarLayer_setLineWidth(ptr, w); } - - void setDataSymbol(const char *image) { CPolarLayer_setDataSymbol2(ptr, image); }; - void setDataSymbol(const DrawArea *obj) { CPolarLayer_setDataSymbol3(ptr, obj->getInternalPtr()); }; - void setDataSymbol(int symbol, int size = 7, - int fillColor = -1, int edgeColor = -1, int lineWidth = 1) - { CPolarLayer_setDataSymbol(ptr, symbol, size, fillColor, edgeColor, lineWidth); } - void setDataSymbol(IntArray polygon, int size = 11, int fillColor = -1, - int edgeColor = -1) - { CPolarLayer_setDataSymbol4(ptr, polygon.data, polygon.len, size, fillColor, edgeColor); } - void setSymbolScale(DoubleArray zData, int scaleType = Chart::PixelScale) - { CPolarLayer_setSymbolScale(ptr, zData.data, zData.len, scaleType); } - - void setImageMapWidth(int width) { CPolarLayer_setImageMapWidth(ptr, width); } - const char *getImageCoor(int dataItem, int offsetX = 0, int offsetY = 0) - { return CPolarLayer_getImageCoor(ptr, dataItem, offsetX, offsetY); } - const char *getHTMLImageMap(const char *url, const char *queryFormat = 0, const char *extraAttr = 0, - int offsetX = 0, int offsetY = 0) - { return CPolarLayer_getHTMLImageMap(ptr, url, queryFormat, extraAttr, offsetX, offsetY); } - void setHTMLImageMap(const char *url, const char *queryFormat = 0, const char *extraAttr = 0) - { CPolarLayer_setHTMLImageMap(ptr, url, queryFormat, extraAttr); } - - void setDataLabelFormat(const char *formatString) - { CPolarLayer_setDataLabelFormat(ptr, formatString); } - TextBox *setDataLabelStyle(const char *font = 0, double fontSize = 8, - int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CPolarLayer_setDataLabelStyle(ptr, font, fontSize, fontColor, fontAngle)); reg(ret); return ret;} - TextBox *addCustomDataLabel(int i, const char *label, const char *font = 0, - double fontSize = 8, int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CPolarLayer_addCustomDataLabel(ptr, i, label, font, fontSize, fontColor, fontAngle)); reg(ret); return ret;} -}; - - -class PolarAreaLayer : public PolarLayer -{ -private : - //disable copying - PolarAreaLayer(const PolarAreaLayer &rhs); - PolarAreaLayer &operator=(const PolarAreaLayer &rhs); - -public : - PolarAreaLayer(PolarAreaLayerInternal *ptr) : PolarLayer(PolarAreaLayer2PolarLayer(ptr)) {} - ~PolarAreaLayer() {} -}; - - -class PolarLineLayer : public PolarLayer -{ -private : - //disable copying - PolarLineLayer(const PolarLineLayer &rhs); - PolarLineLayer &operator=(const PolarLineLayer &rhs); - - PolarLineLayerInternal *ptr; - -public : - PolarLineLayer(PolarLineLayerInternal *ptr) : PolarLayer(PolarLineLayer2PolarLayer(ptr)), ptr(ptr) {} - ~PolarLineLayer() {} - - void setCloseLoop(bool b) - { CPolarLineLayer_setCloseLoop(ptr, b); } - void setGapColor(int lineColor, int lineWidth = -1) - { CPolarLineLayer_setGapColor(ptr, lineColor, lineWidth); } -}; - - -class PolarSplineLineLayer : public PolarLineLayer -{ -private : - //disable copying - PolarSplineLineLayer(const PolarSplineLineLayer &rhs); - PolarSplineLineLayer &operator=(const PolarSplineLineLayer &rhs); - - PolarSplineLineLayerInternal *ptr; - -public : - PolarSplineLineLayer(PolarSplineLineLayerInternal *ptr) : PolarLineLayer(PolarSplineLineLayer2PolarLineLayer(ptr)), ptr(ptr) {} - ~PolarSplineLineLayer() {} - - void setTension(double tension) { CPolarSplineLineLayer_setTension(ptr, tension); } -}; - - -class PolarSplineAreaLayer : public PolarAreaLayer -{ -private : - //disable copying - PolarSplineAreaLayer(const PolarSplineAreaLayer &rhs); - PolarSplineAreaLayer &operator=(const PolarSplineAreaLayer &rhs); - - PolarSplineAreaLayerInternal *ptr; - -public : - PolarSplineAreaLayer(PolarSplineAreaLayerInternal *ptr) : PolarAreaLayer(PolarSplineAreaLayer2PolarAreaLayer(ptr)), ptr(ptr) {} - ~PolarSplineAreaLayer() {} - - void setTension(double tension) { CPolarSplineAreaLayer_setTension(ptr, tension); } -}; - - -class PolarVectorLayer : public PolarLayer -{ -private : - //disable copying - PolarVectorLayer(const PolarVectorLayer &rhs); - PolarVectorLayer &operator=(const PolarVectorLayer &rhs); - - PolarVectorLayerInternal *ptr; - -public : - PolarVectorLayer(PolarVectorLayerInternal *ptr) : PolarLayer(PolarVectorLayer2PolarLayer(ptr)), ptr(ptr) {} - ~PolarVectorLayer() {} - - void setVector(DoubleArray lengths, DoubleArray directions, int lengthScale = Chart::PixelScale) - { CPolarVectorLayer_setVector(ptr, lengths.data, lengths.len, directions.data, directions.len, lengthScale); } - void setArrowHead(int width, int height = 0) { CPolarVectorLayer_setArrowHead(ptr, width, height); } - void setArrowHead(IntArray polygon) { CPolarVectorLayer_setArrowHead2(ptr, polygon.data, polygon.len); } - void setArrowStem(IntArray polygon) { CPolarVectorLayer_setArrowStem(ptr, polygon.data, polygon.len); } - void setArrowAlignment(int alignment) { CPolarVectorLayer_setArrowAlignment(ptr, alignment); } - void setIconSize(int height, int width = 0) { CPolarVectorLayer_setIconSize(ptr, height, width); } - void setVectorMargin(double startMargin, double endMargin = Chart::NoValue) - { CPolarVectorLayer_setVectorMargin(ptr, startMargin, endMargin); } -}; - - -class PolarChart : public BaseChart -{ -private : - //disable copying - PolarChart(const PolarChart &rhs); - PolarChart &operator=(const PolarChart &rhs); - - PolarChartInternal *ptr; - -public : - PolarChart(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { ptr = CPolarChart_create(width, height, bgColor, edgeColor, raisedEffect); - init(PolarChart2BaseChart(ptr)); } - static PolarChart *create(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { return new PolarChart(width, height, bgColor, edgeColor, raisedEffect); } - - void setPlotArea(int x, int y, int r, int bgColor = Chart::Transparent, - int edgeColor = Chart::Transparent, int edgeWidth = 1) - { CPolarChart_setPlotArea(ptr, x, y, r, bgColor, edgeColor, edgeWidth); } - void setPlotAreaBg(int bgColor1, int bgColor2 = -1, bool altRings = true) - { CPolarChart_setPlotAreaBg(ptr, bgColor1, bgColor2, altRings); } - void setGridColor(int rGridColor = 0x80000000, int rGridWidth = 1, int aGridColor = 0x80000000, - int aGridWidth = 1) - { CPolarChart_setGridColor(ptr, rGridColor, rGridWidth, aGridColor, aGridWidth); } - void setGridStyle(bool polygonGrid, bool gridOnTop = true) - { CPolarChart_setGridStyle(ptr, polygonGrid, gridOnTop); } - void setStartAngle(double startAngle, bool clockwise = true) - { CPolarChart_setStartAngle(ptr, startAngle, clockwise); } - - AngularAxis *angularAxis() { AngularAxis *ret = new AngularAxis(CPolarChart_angularAxis(ptr)); reg(ret); return ret; } - RadialAxis *radialAxis() { RadialAxis *ret = new RadialAxis(CPolarChart_radialAxis(ptr)); reg(ret); return ret; } - - int getXCoor(double r, double a) const { return CPolarChart_getXCoor(ptr, r, a); } - int getYCoor(double r, double a) const { return CPolarChart_getYCoor(ptr, r, a); } - - PolarAreaLayer *addAreaLayer(DoubleArray data, int color = -1, const char *name = 0) - { PolarAreaLayer *ret = new PolarAreaLayer(CPolarChart_addAreaLayer(ptr, data.data, data.len, color, name)); reg(ret); return ret; } - PolarLineLayer *addLineLayer(DoubleArray data, int color = -1, const char *name = 0) - { PolarLineLayer *ret = new PolarLineLayer(CPolarChart_addLineLayer(ptr, data.data, data.len, color, name)); reg(ret); return ret; } - PolarSplineLineLayer *addSplineLineLayer(DoubleArray data, int color = -1, const char *name = 0) - { PolarSplineLineLayer *ret = new PolarSplineLineLayer(CPolarChart_addSplineLineLayer(ptr, data.data, data.len, color, name)); reg(ret); return ret; } - PolarSplineAreaLayer *addSplineAreaLayer(DoubleArray data, int color = -1, const char *name = 0) - { PolarSplineAreaLayer *ret = new PolarSplineAreaLayer(CPolarChart_addSplineAreaLayer(ptr, data.data, data.len, color, name)); reg(ret); return ret; } - PolarVectorLayer *addVectorLayer(DoubleArray rData, DoubleArray aData, DoubleArray lengths, - DoubleArray directions, int lengthScale = Chart::PixelScale, int color = -1, const char *name = 0) - { PolarVectorLayer *ret = new PolarVectorLayer(CPolarChart_addVectorLayer(ptr, rData.data, rData.len, - aData.data, aData.len, lengths.data, lengths.len, directions.data, directions.len, lengthScale, color, name)); - reg(ret); return ret; } -}; - - -class PyramidLayer : public AutoDestroy, protected GarbageContainer -{ -private : - //disable copying - PyramidLayer(const PyramidLayer &rhs); - PyramidLayer &operator=(const PyramidLayer &rhs); - - PyramidLayerInternal *ptr; - -public : - PyramidLayer(PyramidLayerInternal *ptr) : ptr(ptr) {} - ~PyramidLayer() {} - - TextBox *setCenterLabel(const char *labelTemplate = "{skip}", const char *font = "{skip}", double fontSize = -1, int fontColor = -1) - { TextBox *ret = new TextBox(CPyramidLayer_setCenterLabel(ptr, labelTemplate, font, fontSize, fontColor)); reg(ret); return ret; } - TextBox *setRightLabel(const char *labelTemplate = "{skip}", const char *font = "{skip}", double fontSize = -1, int fontColor = -1) - { TextBox *ret = new TextBox(CPyramidLayer_setRightLabel(ptr, labelTemplate, font, fontSize, fontColor)); reg(ret); return ret; } - TextBox *setLeftLabel(const char *labelTemplate = "{skip}", const char *font = "{skip}", double fontSize = -1, int fontColor = -1) - { TextBox *ret = new TextBox(CPyramidLayer_setLeftLabel(ptr, labelTemplate, font, fontSize, fontColor)); reg(ret); return ret; } - - void setColor(int color) - { CPyramidLayer_setColor(ptr, color); } - void setJoinLine(int color , int width = -1) - { CPyramidLayer_setJoinLine(ptr, color, width); } - void setJoinLineGap(int pyramidGap, int pyramidMargin = -0x7fffffff, int textGap = -0x7fffffff) - { CPyramidLayer_setJoinLineGap(ptr, pyramidGap, pyramidMargin, textGap); } - void setLayerBorder(int color, int width = -1) - { CPyramidLayer_setLayerBorder(ptr, color, width); } - void setLayerGap(double layerGap) - { CPyramidLayer_setLayerGap(ptr, layerGap); } -}; - - -class PyramidChart : public BaseChart -{ -private : - //disable copying - PyramidChart(const PyramidChart &rhs); - PyramidChart &operator=(const PyramidChart &rhs); - - PyramidChartInternal *ptr; - -public : - PyramidChart(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { ptr = CPyramidChart_create(width, height, bgColor, edgeColor, raisedEffect); - init(PyramidChart2BaseChart(ptr)); } - - void setPyramidSize(int cx, int cy, int radius, int height) - { CPyramidChart_setPyramidSize(ptr, cx, cy, radius, height); } - void setConeSize(int cx, int cy, int radius, int height) - { CPyramidChart_setConeSize(ptr, cx, cy, radius, height); } - void setFunnelSize(int cx, int cy, int radius, int height, double tubeRadius = 0.2, double tubeHeight = 0.3) - { CPyramidChart_setFunnelSize(ptr, cx, cy, radius, height, tubeRadius, tubeHeight); } - void setData(DoubleArray data, StringArray labels = StringArray()) - { CPyramidChart_setData(ptr, data.data, data.len, labels.data, labels.len); } - TextBox *setCenterLabel(const char *labelTemplate = "{skip}", const char *font = "{skip}", double fontSize = -1, int fontColor = -1) - { TextBox *ret = new TextBox(CPyramidChart_setCenterLabel(ptr, labelTemplate, font, fontSize, fontColor)); reg(ret); return ret; } - TextBox *setRightLabel(const char *labelTemplate = "{skip}", const char *font = "{skip}", double fontSize = -1, int fontColor = -1) - { TextBox *ret = new TextBox(CPyramidChart_setRightLabel(ptr, labelTemplate, font, fontSize, fontColor)); reg(ret); return ret; } - TextBox *setLeftLabel(const char *labelTemplate = "{skip}", const char *font = "{skip}", double fontSize = -1, int fontColor = -1) - { TextBox *ret = new TextBox(CPyramidChart_setLeftLabel(ptr, labelTemplate, font, fontSize, fontColor)); reg(ret); return ret; } - - void setPyramidSides(int noOfSides) - { CPyramidChart_setPyramidSides(ptr, noOfSides); } - void setViewAngle(double elevation, double rotation = 0, double twist = 0) - { CPyramidChart_setViewAngle(ptr, elevation, rotation, twist); } - - void setGradientShading(double startBrightness, double endBrightness) - { CPyramidChart_setGradientShading(ptr, startBrightness, endBrightness); } - void setLighting(double ambientIntensity = 0.5, double diffuseIntensity = 0.5, double specularIntensity = 1, double shininess = 8) - { CPyramidChart_setLighting(ptr, ambientIntensity, diffuseIntensity, specularIntensity, shininess); } - - void setJoinLine(int color, int width = -1) - { CPyramidChart_setJoinLine(ptr, color, width); } - void setJoinLineGap(int pyramidGap, int pyramidMargin = -0x7fffffff, int textGap = -0x7fffffff) - { CPyramidChart_setJoinLineGap(ptr, pyramidGap, pyramidMargin, textGap); } - void setLayerBorder(int color, int width = -1) - { CPyramidChart_setLayerBorder(ptr, color, width); } - void setLayerGap(double layerGap) - { CPyramidChart_setLayerGap(ptr, layerGap); } - - PyramidLayer *getLayer(int layerNo) - { PyramidLayerInternal *p = CPyramidChart_getLayer(ptr, layerNo); if (!p) return 0; - PyramidLayer *ret = new PyramidLayer(p); reg(ret); return ret; } -}; - - -class MeterPointer : public DrawObj -{ - //disable copying - MeterPointer(const MeterPointer &rhs); - MeterPointer &operator=(const MeterPointer &rhs); - - MeterPointerInternal *ptr; - -public : - MeterPointer(MeterPointerInternal *ptr) : DrawObj(MeterPointer2DrawObj(ptr)), ptr(ptr) {} - void setColor(int fillColor, int edgeColor = -1) - { CMeterPointer_setColor(ptr, fillColor, edgeColor); } - void setPos(double value) { CMeterPointer_setPos(ptr, value); } - void setShape(int pointerType, double lengthRatio = Chart::NoValue, double widthRatio = Chart::NoValue) - { CMeterPointer_setShape(ptr, pointerType, lengthRatio, widthRatio); } - void setShape(IntArray pointerCoor, double lengthRatio = Chart::NoValue, double widthRatio = Chart::NoValue) - { CMeterPointer_setShape2(ptr, pointerCoor.data, pointerCoor.len, lengthRatio, widthRatio); } -}; - - -class BaseMeter : public BaseChart -{ -private : - //disable copying - BaseMeter(const BaseMeter &rhs); - BaseMeter &operator=(const BaseMeter &rhs); - - BaseMeterInternal *ptr; - -public : - BaseMeter() : ptr(0) {} - void init(BaseMeterInternal *ptr) { this->ptr = ptr; BaseChart::init(BaseMeter2BaseChart(ptr)); } - - MeterPointer *addPointer(double value, int fillColor = Chart::LineColor, int edgeColor = -1) - { MeterPointer *ret = new MeterPointer(CBaseMeter_addPointer(ptr, value, fillColor, edgeColor)); reg(ret); return ret; } - - void setScale(double lowerLimit, double upperLimit, double majorTickInc = 0, double minorTickInc = 0, double microTickInc = 0) - { CBaseMeter_setScale(ptr, lowerLimit, upperLimit, majorTickInc, minorTickInc, microTickInc); } - void setScale(double lowerLimit, double upperLimit, StringArray labels) - { CBaseMeter_setScale2(ptr, lowerLimit, upperLimit, labels.data, labels.len); } - void setScale(double lowerLimit, double upperLimit, DoubleArray labels, const char *formatString = 0) - { CBaseMeter_setScale3(ptr, lowerLimit, upperLimit, labels.data, labels.len, formatString); } - - void addLabel(double pos, const char *label) { CBaseMeter_addLabel(ptr, pos, label); } - const char *getLabel(double i) const { return CBaseMeter_getLabel(ptr, i); } - DoubleArray getTicks() const - { const double *d; int len; CBaseMeter_getTicks(ptr, &d, &len); return DoubleArray(d, len); } - - TextBox *setLabelStyle(const char *font = "bold", double fontSize = -1, int fontColor = Chart::TextColor, double fontAngle = 0) - { TextBox *ret = new TextBox(CBaseMeter_setLabelStyle(ptr, font, fontSize, fontColor, fontAngle)); reg(ret); return ret; } - void setLabelPos(bool labelInside, int labelOffset = 0) { CBaseMeter_setLabelPos(ptr, labelInside, labelOffset); } - void setLabelFormat(const char *mainLabelFormat) { CBaseMeter_setLabelFormat(ptr, mainLabelFormat); } - void setTickLength(int majorLen, int minorLen = -0x7fffffff, int microLen = -0x7fffffff) - { CBaseMeter_setTickLength(ptr, majorLen, minorLen, microLen); } - void setLineWidth(int axisWidth, int majorTickWidth = 1, int minorTickWidth = 1, int microTickWidth = 1) - { CBaseMeter_setLineWidth(ptr, axisWidth, majorTickWidth, minorTickWidth, microTickWidth); } - void setMeterColors(int axisColor, int labelColor = -1, int tickColor = -1) - { CBaseMeter_setMeterColors(ptr, axisColor, labelColor, tickColor); } - - int getCoor(double v) const { return CBaseMeter_getCoor(ptr, v); } -}; - - -class AngularMeter : public BaseMeter -{ -private : - //disable copying - AngularMeter(const AngularMeter &rhs); - AngularMeter &operator=(const AngularMeter &rhs); - - AngularMeterInternal *ptr; - -public : - AngularMeter(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { ptr = CAngularMeter_create(width, height, bgColor, edgeColor, raisedEffect); - init(AngularMeter2BaseMeter(ptr)); } - - void addRing(int startRadius, int endRadius, int fillColor, int edgeColor = -1) - { CAngularMeter_addRing(ptr, startRadius, endRadius, fillColor, edgeColor); } - void addRingSector(int startRadius, int endRadius, double a1, double a2, int fillColor, int edgeColor = -1) - { CAngularMeter_addRingSector(ptr, startRadius, endRadius, a1, a2, fillColor, edgeColor); } - void setCap(int radius, int fillColor, int edgeColor = Chart::LineColor) - { CAngularMeter_setCap(ptr, radius, fillColor, edgeColor); } - - void setMeter(int cx, int cy, int radius, double startAngle, double endAngle) - { CAngularMeter_setMeter(ptr, cx, cy, radius, startAngle, endAngle); } - - void addZone(double startValue, double endValue, int startRadius, int endRadius, int fillColor, int edgeColor = -1) - { CAngularMeter_addZone(ptr, startValue, endValue, startRadius, endRadius, fillColor, edgeColor); } - void addZone(double startValue, double endValue, int fillColor, int edgeColor = -1) - { CAngularMeter_addZone2(ptr, startValue, endValue, fillColor, edgeColor); } -}; - - -class LinearMeter : public BaseMeter -{ -private : - //disable copying - LinearMeter(const LinearMeter &rhs); - LinearMeter &operator=(const LinearMeter &rhs); - - LinearMeterInternal *ptr; - -public : - LinearMeter(int width, int height, int bgColor = Chart::BackgroundColor, - int edgeColor = Chart::Transparent, int raisedEffect = 0) - { ptr = CLinearMeter_create(width, height, bgColor, edgeColor, raisedEffect); - init(LinearMeter2BaseMeter(ptr)); } - - void setMeter(int leftX, int topY, int width, int height, int axisPos = Chart::Left, bool isReversed = false) - { CLinearMeter_setMeter(ptr, leftX, topY, width, height, axisPos, isReversed); } - void setRail(int railColor, int railWidth = 2, int railOffset = 6) - { CLinearMeter_setRail(ptr, railColor, railWidth, railOffset); } - - TextBox *addZone(double startValue, double endValue, int color, const char *label = 0) - { TextBox *ret = new TextBox(CLinearMeter_addZone(ptr, startValue, endValue, color, label)); reg(ret); return ret; } -}; - - -class ArrayMath -{ -private : - ArrayMathInternal *ptr; - -public : - ArrayMath(DoubleArray a) : ptr(CArrayMath_create(a.data, a.len)) {} - ~ArrayMath() { CArrayMath_destroy(ptr); } - static ArrayMath *create(DoubleArray a) { return new ArrayMath(a); } - void destroy() { delete this; } - - ArrayMath(const ArrayMath &rhs) { DoubleArray r = rhs; ptr = CArrayMath_create(r.data, r.len); } - ArrayMath &operator=(const ArrayMath &rhs) { CArrayMath_destroy(ptr); DoubleArray r = rhs; ptr = CArrayMath_create(r.data, r.len); return *this;} - operator DoubleArray() const { return result(); } - - ArrayMath& add(DoubleArray b) { CArrayMath_add(ptr, b.data, b.len); return *this; } - ArrayMath& add(double b) { CArrayMath_add2(ptr, b); return *this; } - ArrayMath& sub(DoubleArray b) { CArrayMath_sub(ptr, b.data, b.len); return *this; } - ArrayMath& sub(double b) { CArrayMath_sub2(ptr, b); return *this; } - ArrayMath& mul(DoubleArray b) { CArrayMath_mul(ptr, b.data, b.len); return *this; } - ArrayMath& mul(double b) { CArrayMath_mul2(ptr, b); return *this; } - ArrayMath& div(DoubleArray b) { CArrayMath_div(ptr, b.data, b.len); return *this; } - ArrayMath& div(double b) { CArrayMath_div2(ptr, b); return *this; } - ArrayMath& financeDiv(DoubleArray b, double zeroByZeroValue) { CArrayMath_financeDiv(ptr, b.data, b.len, zeroByZeroValue); return *this; } - ArrayMath& shift(int offset = 1, double fillValue = Chart::NoValue) { CArrayMath_shift(ptr, offset, fillValue); return *this; } - ArrayMath& delta(int offset = 1) { CArrayMath_delta(ptr, offset); return *this; } - ArrayMath& rate(int offset = 1) { CArrayMath_rate(ptr, offset); return *this; } - ArrayMath& abs() { CArrayMath_abs(ptr); return *this; } - ArrayMath& acc() { CArrayMath_acc(ptr); return *this; } - - ArrayMath& selectGTZ(DoubleArray decisionArray = DoubleArray(), double fillValue = 0) - { CArrayMath_selectGTZ(ptr, decisionArray.data, decisionArray.len, fillValue); return *this; } - ArrayMath& selectGEZ(DoubleArray decisionArray = DoubleArray(), double fillValue = 0) - { CArrayMath_selectGEZ(ptr, decisionArray.data, decisionArray.len, fillValue); return *this; } - ArrayMath& selectLTZ(DoubleArray decisionArray = DoubleArray(), double fillValue = 0) - { CArrayMath_selectLTZ(ptr, decisionArray.data, decisionArray.len, fillValue); return *this; } - ArrayMath& selectLEZ(DoubleArray decisionArray = DoubleArray(), double fillValue = 0) - { CArrayMath_selectLEZ(ptr, decisionArray.data, decisionArray.len, fillValue); return *this; } - ArrayMath& selectEQZ(DoubleArray decisionArray = DoubleArray(), double fillValue = 0) - { CArrayMath_selectEQZ(ptr, decisionArray.data, decisionArray.len, fillValue); return *this; } - ArrayMath& selectNEZ(DoubleArray decisionArray = DoubleArray(), double fillValue = 0) - { CArrayMath_selectNEZ(ptr, decisionArray.data, decisionArray.len, fillValue); return *this; } - - ArrayMath& selectStartOfHour(int majorTickStep = 1, double initialMargin = 300) - { CArrayMath_selectStartOfHour(ptr, majorTickStep, initialMargin); return *this; } - ArrayMath& selectStartOfDay(int majorTickStep = 1, double initialMargin = 3 * 3600) - { CArrayMath_selectStartOfDay(ptr, majorTickStep, initialMargin); return *this; } - ArrayMath& selectStartOfWeek(int majorTickStep = 1, double initialMargin = 2 * 86400) - { CArrayMath_selectStartOfWeek(ptr, majorTickStep, initialMargin); return *this; } - ArrayMath& selectStartOfMonth(int majorTickStep = 1, double initialMargin = 5 * 86400) - { CArrayMath_selectStartOfMonth(ptr, majorTickStep, initialMargin); return *this; } - ArrayMath& selectStartOfYear(int majorTickStep = 1, double initialMargin = 60 * 86400) - { CArrayMath_selectStartOfYear(ptr, majorTickStep, initialMargin); return *this; } - ArrayMath& selectRegularSpacing(int majorTickStep, int minorTickStep = 0, int initialMargin = 0) - { CArrayMath_selectRegularSpacing(ptr, majorTickStep, minorTickStep, initialMargin); return *this; } - - ArrayMath& trim(int startIndex = 0, int len = -1) - { CArrayMath_trim(ptr, startIndex, len); return *this; } - ArrayMath& insert(DoubleArray a, int insertPoint = -1) - { CArrayMath_insert(ptr, a.data, a.len, insertPoint); return *this; } - ArrayMath& insert(double c, int len, int insertPoint = -1) - { CArrayMath_insert2(ptr, c, len, insertPoint); return *this; } - ArrayMath& replace(double a, double b) - { CArrayMath_replace(ptr, a, b); return *this; } - - ArrayMath& movAvg(int interval) - { CArrayMath_movAvg(ptr, interval); return *this; } - ArrayMath& expAvg(double smoothingFactor) - { CArrayMath_expAvg(ptr, smoothingFactor); return *this; } - ArrayMath& movMed(int interval) - { CArrayMath_movMed(ptr, interval); return *this; } - ArrayMath& movPercentile(int interval, double percentile) - { CArrayMath_movPercentile(ptr, interval, percentile); return *this; } - ArrayMath& movMax(int interval) - { CArrayMath_movMax(ptr, interval); return *this; } - ArrayMath& movMin(int interval) - { CArrayMath_movMin(ptr, interval); return *this; } - ArrayMath& movStdDev(int interval) - { CArrayMath_movStdDev(ptr, interval); return *this; } - ArrayMath& movCorr(int interval, DoubleArray b = DoubleArray()) - { CArrayMath_movCorr(ptr, interval, b.data, b.len); return *this; } - ArrayMath& lowess(double smoothness = 0.25, int iteration = 0) - { CArrayMath_lowess(ptr, smoothness, iteration); return *this; } - ArrayMath& lowess(DoubleArray b, double smoothness = 0.25, int iteration = 0) - { CArrayMath_lowess2(ptr, b.data, b.len, smoothness, iteration); return *this; } - - DoubleArray result() const { const double *d; int len; CArrayMath_result(ptr, &d, &len); return DoubleArray(d, len); } -#ifndef max - double max() const { return CArrayMath_max(ptr); } -#endif - double maxValue() const { return CArrayMath_max(ptr); } -#ifndef min - double min() const { return CArrayMath_min(ptr); } -#endif - double minValue() const { return CArrayMath_min(ptr); } - double avg() const { return CArrayMath_avg(ptr); } - double sum() const { return CArrayMath_sum(ptr); } - double stdDev() const { return CArrayMath_stdDev(ptr); } - double med() const { return CArrayMath_med(ptr); } - double percentile(double p) const { return CArrayMath_percentile(ptr, p); } - int maxIndex() const { return CArrayMath_maxIndex(ptr); } - int minIndex() const { return CArrayMath_minIndex(ptr); } - - DoubleArray aggregate(DoubleArray srcArray, int aggregateMethod, double param = 50) const - { const double *d; int len; CArrayMath_aggregate(ptr, srcArray.data, srcArray.len, aggregateMethod, param, - &d, &len); return DoubleArray(d, len); } -}; - - -class RanTable -{ -private : - //disable copying - RanTable(const RanTable &rhs); - RanTable &operator=(const RanTable &rhs); - - RanTableInternal *ptr; - -public : - RanTable(int seed, int noOfCols, int noOfRows) : ptr(CRanTable_create(seed, noOfCols, noOfRows)) {} - ~RanTable() { CRanTable_destroy(ptr); } - static RanTable *create(int seed, int noOfCols, int noOfRows) { return new RanTable(seed, noOfCols, noOfRows); } - void destroy() { delete this; } - - void setCol(int colNo, double minValue, double maxValue) - { CRanTable_setCol(ptr, colNo, minValue, maxValue); } - void setCol(int colNo, double startValue, double minDelta, double maxDelta, - double lowerLimit = -1E+308, double upperLimit = 1E+308) - { CRanTable_setCol2(ptr, colNo, startValue, minDelta, maxDelta, lowerLimit, upperLimit); } - void setDateCol(int i, double startTime, double tickInc, bool weekDayOnly = false) - { CRanTable_setDateCol(ptr, i, startTime, tickInc, weekDayOnly); } - void setHLOCCols(int i, double startValue, double minDelta, double maxDelta, - double lowerLimit = 0, double upperLimit = 1E+308) - { CRanTable_setHLOCCols(ptr, i, startValue, minDelta, maxDelta, lowerLimit, upperLimit); } - int selectDate(int colNo, double minDate, double maxDate) - { return CRanTable_selectDate(ptr, colNo, minDate, maxDate); } - DoubleArray getCol(int i) - { const double *d; int len; CRanTable_getCol(ptr, i, &d, &len); return DoubleArray(d, len); } -}; - -class RanSeries -{ -private : - //disable copying - RanSeries(const RanSeries &rhs); - RanSeries &operator=(const RanSeries &rhs); - - RanSeriesInternal *ptr; - -public : - RanSeries(int seed) : ptr(CRanSeries_create(seed)) {} - ~RanSeries() { CRanSeries_destroy(ptr); } - static RanSeries *create(int seed) { return new RanSeries(seed); } - void destroy() { delete this; } - - DoubleArray getSeries(int len, double minValue, double maxValue) - { const double *ret; int retLen; CRanSeries_getSeries(ptr, len, minValue, maxValue, &ret, &retLen); - return DoubleArray(ret, retLen); } - DoubleArray getSeries(int len, double minValue, double maxValue, double maxDelta, - double lowerLimit = -1E+308, double upperLimit = 1E+308) - { const double *ret; int retLen; CRanSeries_getSeries2(ptr, len, minValue, maxValue, maxDelta, - lowerLimit, upperLimit, &ret, &retLen); return DoubleArray(ret, retLen); } - DoubleArray getDateSeries(int len, double startTime, double tickInc, bool weekDayOnly = false) - { const double *ret; int retLen; CRanSeries_getDateSeries(ptr, len, startTime, tickInc, weekDayOnly, - &ret, &retLen); return DoubleArray(ret, retLen); } -}; - -class FinanceSimulator -{ -private : - //disable copying - FinanceSimulator(const FinanceSimulator &rhs); - FinanceSimulator &operator=(const FinanceSimulator &rhs); - - FinanceSimulatorInternal *ptr; - -public : - FinanceSimulator(int seed, double startTime, double endTime, int resolution) : - ptr(CFinanceSimulator_create(seed, startTime, endTime, resolution)) - {} - FinanceSimulator(const char *seed, double startTime, double endTime, int resolution) : - ptr(CFinanceSimulator_create2(seed, startTime, endTime, resolution)) - {} - ~FinanceSimulator() { CFinanceSimulator_destroy(ptr); } - - DoubleArray getTimeStamps() - { const double *d; int len; CFinanceSimulator_getTimeStamps(ptr, &d, &len); return DoubleArray(d, len); } - DoubleArray getHighData() - { const double *d; int len; CFinanceSimulator_getHighData(ptr, &d, &len); return DoubleArray(d, len); } - DoubleArray getLowData() - { const double *d; int len; CFinanceSimulator_getLowData(ptr, &d, &len); return DoubleArray(d, len); } - DoubleArray getOpenData() - { const double *d; int len; CFinanceSimulator_getOpenData(ptr, &d, &len); return DoubleArray(d, len); } - DoubleArray getCloseData() - { const double *d; int len; CFinanceSimulator_getCloseData(ptr, &d, &len); return DoubleArray(d, len); } - DoubleArray getVolData() - { const double *d; int len; CFinanceSimulator_getVolData(ptr, &d, &len); return DoubleArray(d, len); } -}; - -class ImageMapHandler -{ -private : - //disable copying - ImageMapHandler(const ImageMapHandler &rhs); - ImageMapHandler &operator=(const ImageMapHandler &rhs); - - ImageMapHandlerInternal *ptr; - -public : - ImageMapHandler(const char *imageMap) : ptr(CImageMapHandler_create(imageMap)) {} - ~ImageMapHandler() { CImageMapHandler_destroy(ptr); } - - int getHotSpot(int x, int y) - { return CImageMapHandler_getHotSpot(ptr, x, y); } - const char *getValue(const char *key) - { return CImageMapHandler_getValue(ptr, key); } - const char *getKey(int i) - { return CImageMapHandler_getKey(ptr, i); } - const char *getValue(int i) - { return CImageMapHandler_getValue2(ptr, i); } -}; - -class ViewPortManager -{ -private : - //disable copying - ViewPortManager(const ViewPortManager &rhs); - ViewPortManager &operator=(const ViewPortManager &rhs); - - ViewPortManagerInternal *ptr; - -public : - - ViewPortManager() : ptr(CViewPortManager_create()) {} - ~ViewPortManager() { CViewPortManager_destroy(ptr); } - - void setChartMetrics(const char *metrics) { CViewPortManager_setChartMetrics(ptr, metrics); } - int getPlotAreaLeft() { return CViewPortManager_getPlotAreaLeft(ptr); } - int getPlotAreaTop() { return CViewPortManager_getPlotAreaTop(ptr); } - int getPlotAreaWidth() { return CViewPortManager_getPlotAreaWidth(ptr); } - int getPlotAreaHeight() { return CViewPortManager_getPlotAreaHeight(ptr); } - bool inPlotArea(int x, int y) { return CViewPortManager_inPlotArea(ptr, x, y); } - - double getViewPortLeft() { return CViewPortManager_getViewPortLeft(ptr); } - void setViewPortLeft(double left) { CViewPortManager_setViewPortLeft(ptr, left); } - double getViewPortTop() { return CViewPortManager_getViewPortTop(ptr); } - void setViewPortTop(double top) { CViewPortManager_setViewPortTop(ptr, top); } - double getViewPortWidth() { return CViewPortManager_getViewPortWidth(ptr); } - void setViewPortWidth(double width) { CViewPortManager_setViewPortWidth(ptr, width); } - double getViewPortHeight() { return CViewPortManager_getViewPortHeight(ptr); } - void setViewPortHeight(double height) { CViewPortManager_setViewPortHeight(ptr, height); } - void validateViewPort() { CViewPortManager_validateViewPort(ptr); } - - double getZoomInWidthLimit() { return CViewPortManager_getZoomInWidthLimit(ptr); } - void setZoomInWidthLimit(double viewPortWidth) { CViewPortManager_setZoomInWidthLimit(ptr, viewPortWidth); } - double getZoomOutWidthLimit() { return CViewPortManager_getZoomOutWidthLimit(ptr); } - void setZoomOutWidthLimit(double viewPortWidth){ CViewPortManager_setZoomOutWidthLimit(ptr, viewPortWidth); } - double getZoomInHeightLimit() { return CViewPortManager_getZoomInHeightLimit(ptr); } - void setZoomInHeightLimit(double viewPortHeight) { CViewPortManager_setZoomInHeightLimit(ptr, viewPortHeight); } - double getZoomOutHeightLimit() { return CViewPortManager_getZoomOutHeightLimit(ptr); } - void setZoomOutHeightLimit(double viewPortHeight){ CViewPortManager_setZoomOutHeightLimit(ptr, viewPortHeight); } - bool canZoomIn(int zoomDirection) { return CViewPortManager_canZoomIn(ptr, zoomDirection); } - bool canZoomOut(int zoomDirection) { return CViewPortManager_canZoomOut(ptr, zoomDirection); } - bool zoomAt(int zoomDirection, int x, int y, double zoomRatio) - { return CViewPortManager_zoomAt(ptr, zoomDirection, x, y, zoomRatio); } - bool zoomTo(int zoomDirection, int x1, int y1, int x2, int y2) - { return CViewPortManager_zoomTo(ptr, zoomDirection, x1, y1, x2, y2); } - - void startDrag() { CViewPortManager_startDrag(ptr); } - bool dragTo(int scrollDirection, int deltaX, int deltaY) - { return CViewPortManager_dragTo(ptr, scrollDirection, deltaX, deltaY); } - - void setFullRange(const char *id, double minValue, double maxValue) - { CViewPortManager_setFullRange(ptr, id, minValue, maxValue); } - void clearAllRanges() - { CViewPortManager_clearAllRanges(ptr); } - double getValueAtViewPort(const char *id, double ratio, bool isLogScale = false) - { return CViewPortManager_getValueAtViewPort(ptr, id, ratio, isLogScale); } - double getViewPortAtValue(const char *id, double ratio, bool isLogScale = false) - { return CViewPortManager_getViewPortAtValue(ptr, id, ratio, isLogScale); } - void syncLinearAxisWithViewPort(const char *id, Axis *axis) - { CViewPortManager_syncLinearAxisWithViewPort(ptr, id, axis->getInternalPtr()); } - void syncLogAxisWithViewPort(const char *id, Axis *axis) - { CViewPortManager_syncLogAxisWithViewPort(ptr, id, axis->getInternalPtr()); } - void syncDateAxisWithViewPort(const char *id, Axis *axis) - { CViewPortManager_syncDateAxisWithViewPort(ptr, id, axis->getInternalPtr()); } - void commitPendingSyncAxis(BaseChart *c) - { CViewPortManager_commitPendingSyncAxis(ptr, c->getInternalPtr()); } - - void setPlotAreaMouseMargin(int leftMargin, int rightMargin, int topMargin, int bottomMargin) - { CViewPortManager_setPlotAreaMouseMargin(ptr, leftMargin, rightMargin, topMargin, bottomMargin); } - bool inExtendedPlotArea(int x, int y) - { return CViewPortManager_inExtendedPlotArea(ptr, x, y); } -}; - - -#ifndef CHARTDIR_HIDE_OBSOLETE - -////////////////////////////////////////////////////////////////////////////////////// -// This section is obsoleted - retained for compatibility only. -// Global identifiers are now moved into the Chart namespace -////////////////////////////////////////////////////////////////////////////////////// - -static const double LogTick = +1.6e308; -static const double NoValue = +1.7e308; -static const double TouchBar = -1.7E-100; - -enum Alignment -{ - TopLeft = 7, TopCenter = 8, TopRight = 9, - Left = 4, Center = 5, Right = 6, - BottomLeft = 1, BottomCenter = 2, BottomRight = 3, - Top = TopCenter, - Bottom = BottomCenter -}; - -enum -{ - DashLine = 0x0505, - DotLine = 0x0202, - DotDashLine = 0x05050205, - AltDashLine = 0x0A050505 -}; - -static const int *goldGradient = Chart::goldGradient; -static const int *silverGradient = Chart::silverGradient; -static const int *redMetalGradient = Chart::redMetalGradient; -static const int *blueMetalGradient = Chart::blueMetalGradient; -static const int *greenMetalGradient = Chart::greenMetalGradient; - -enum AntiAliasMode { NoAntiAlias, AntiAlias, AutoAntiAlias }; -enum PaletteMode { TryPalette, ForcePalette, NoPalette }; -enum DitherMethod { Quantize, OrderedDither, ErrorDiffusion }; - -enum CDFilterType { BoxFilter, LinearFilter, QuadraticFilter, BSplineFilter, HermiteFilter, - CatromFilter, MitchellFilter, SincFilter, LanczosFilter, GaussianFilter, HanningFilter, - HammingFilter, BlackmanFilter, BesselFilter }; - -enum -{ - Transparent = 0xff000000, - Palette = 0xffff0000, - BackgroundColor = 0xffff0000, - LineColor = 0xffff0001, - TextColor = 0xffff0002, - DataColor = 0xffff0008, - SameAsMainColor = 0xffff0007 -}; - -enum ImgFormat {PNG, GIF, JPG, WMP, BMP}; - -static const int *oldDefaultPalette = Chart::oldDefaultPalette; -static const int *defaultPalette = Chart::defaultPalette; -static const int *whiteOnBlackPalette = Chart::whiteOnBlackPalette; -static const int *transparentPalette = Chart::transparentPalette; - -enum {SideLayout, CircleLayout}; - -enum SymbolType -{ - NoSymbol = 0, - SquareSymbol = 1, - DiamondSymbol = 2, - TriangleSymbol = 3, - RightTriangleSymbol = 4, - LeftTriangleSymbol = 5, - InvertedTriangleSymbol = 6, - CircleSymbol = 7, - CrossSymbol = 8, - Cross2Symbol = 9 -}; - -enum DataCombineMethod { Overlay, Stack, Depth, Side, Percentage }; - -enum LegendMode { NormalLegend, ReverseLegend, NoLegend }; - -enum ScaleType { PixelScale, XAxisScale, YAxisScale, - AngularAxisScale = XAxisScale, RadialAxisScale = YAxisScale }; - -static inline int getVersion() { return Chart::getVersion(); } -static inline const char * getDescription() { return Chart::getDescription(); } -static inline const char * getCopyright() { return Chart::getCopyright(); } - -static inline bool testFont(const char *font, int fontIndex, double fontHeight, - double fontWidth, double angle, char *buffer) -{ return Chart::testFont(font, fontIndex, fontHeight, fontWidth, angle, buffer); } - -static inline bool isLicensed() { return Chart::isLicensed(); } -static inline bool getLicenseAttr(const char *key, char *buffer) -{ return Chart::getLicenseAttr(key, buffer); } -static inline bool setLicenseFile(const char *filename = 0, char *buffer = 0) -{ return Chart::setLicenseFile(filename, buffer); } -static inline bool setLicenseCode(const char *licCode, char *buffer = 0) -{ return Chart::setLicenseCode(licCode, buffer); } - -static inline double chartTime(int y, int m, int d, int h = 0, int n = 0, int s = 0) -{ return Chart::chartTime(y, m, d, h, n, s); } -static inline double chartTime2(int t) -{ return Chart::chartTime2(t); } - -//#ifndef CHARTDIR_HIDE_OBSOLETE -#endif - -//#ifndef CCHARTDIR_HDR -#endif diff --git a/PssSampleClient/PurenessLine/PurenessLine/include/memblock.h b/PssSampleClient/PurenessLine/PurenessLine/include/memblock.h deleted file mode 100644 index d4db43098..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/include/memblock.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2004 Advanced Software Engineering Limited. - * - * This file is part of the ChartDirector software. Usage of this file is - * subjected to the ChartDirector license agreement. See the LICENSE.TXT - * file that comes with the ChartDirector software release, or visit - * Advanced Software Engineering's web site at www.advsofteng.com or - * email to support@advsofteng.com for information. - * - */ - -#ifndef MEMBLOCK_HDR -#define MEMBLOCK_HDR - -class MemBlock -{ -public : - int len; - const char *data; - MemBlock() : len(0), data(0) {} - MemBlock(const char *data, int len) : len(len), data(data) {} - char operator[](int i) const { return data[i]; } -}; - -class StringArray -{ -public : - int len; - const char * const *data; - StringArray() : len(0), data(0) {} - StringArray(const char * const *data, int len) : len(len), data(data) {} - const char *operator[](int i) const { return data[i]; } -}; - -class DoubleArray -{ -public : - int len; - const double *data; - DoubleArray() : len(0), data(0) {} - DoubleArray(const double *data, int len) : len(len), data(data) {} - double operator[](int i) const { return data[i]; } -}; - -class IntArray -{ -public : - int len; - const int *data; - IntArray() : len(0), data(0) {} - IntArray(const int *data, int len) : len(len), data(data) {} - int operator[](int i) const { return data[i]; } -}; - -#endif diff --git a/PssSampleClient/PurenessLine/PurenessLine/lib/chartdir51.lib b/PssSampleClient/PurenessLine/PurenessLine/lib/chartdir51.lib deleted file mode 100644 index ce78a90fe..000000000 Binary files a/PssSampleClient/PurenessLine/PurenessLine/lib/chartdir51.lib and /dev/null differ diff --git a/PssSampleClient/PurenessLine/PurenessLine/res/PurenessLine.ico b/PssSampleClient/PurenessLine/PurenessLine/res/PurenessLine.ico deleted file mode 100644 index d56fbcdfd..000000000 Binary files a/PssSampleClient/PurenessLine/PurenessLine/res/PurenessLine.ico and /dev/null differ diff --git a/PssSampleClient/PurenessLine/PurenessLine/res/PurenessLine.rc2 b/PssSampleClient/PurenessLine/PurenessLine/res/PurenessLine.rc2 deleted file mode 100644 index 86d567580..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/res/PurenessLine.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// PurenessLine.RC2 - Microsoft Visual C++ ֱӱ༭Դ -// - -#ifdef APSTUDIO_INVOKED -#error ļ Microsoft Visual C++ ༭ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// ڴ˴ֶ༭Դ... - -///////////////////////////////////////////////////////////////////////////// diff --git a/PssSampleClient/PurenessLine/PurenessLine/resource.h b/PssSampleClient/PurenessLine/PurenessLine/resource.h deleted file mode 100644 index 9f55c7966..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/resource.h +++ /dev/null @@ -1,23 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PurenessLine.rc -// -#define IDD_PURENESSLINE_DIALOG 102 -#define IDR_MAINFRAME 128 -#define IDC_EDIT1 1000 -#define IDC_EDIT2 1001 -#define IDC_BUTTON1 1002 -#define IDC_BUTTON2 1003 -#define IDC_MEMORYVIEW 1004 -#define IDC_CPUVIEW 1005 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 129 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1006 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/PssSampleClient/PurenessLine/PurenessLine/stdafx.cpp b/PssSampleClient/PurenessLine/PurenessLine/stdafx.cpp deleted file mode 100644 index 48ecce6d3..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -// stdafx.cpp : ֻ׼ļԴļ -// PurenessLine.pch ΪԤͷ -// stdafx.obj ԤϢ - -#include "stdafx.h" - - diff --git a/PssSampleClient/PurenessLine/PurenessLine/stdafx.h b/PssSampleClient/PurenessLine/PurenessLine/stdafx.h deleted file mode 100644 index b41817bea..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/stdafx.h +++ /dev/null @@ -1,61 +0,0 @@ - -// stdafx.h : ׼ϵͳļİļ -// Ǿʹõĵ -// ضĿİļ - -#pragma once - -#ifndef _SECURE_ATL -#define _SECURE_ATL 1 -#endif - -#ifndef VC_EXTRALEAN -#define VC_EXTRALEAN // Windows ͷųʹõ -#endif - -#include "targetver.h" - -#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // ijЩ CString 캯ʽ - -// ر MFC ijЩɷĺԵľϢ -#define _AFX_ALL_WARNINGS - -#include // MFC ͱ׼ -#include // MFC չ - - -#include // MFC Զ - - - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC Internet Explorer 4 ؼ֧ -#endif -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC Windows ؼ֧ -#endif // _AFX_NO_AFXCMN_SUPPORT - -//#include // Ϳؼ MFC ֧ -#define CWinAppEx CWinApp - - - - - - - - - -#ifdef _UNICODE -#if defined _M_IX86 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_IA64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#elif defined _M_X64 -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") -#else -#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -#endif -#endif - - diff --git a/PssSampleClient/PurenessLine/PurenessLine/targetver.h b/PssSampleClient/PurenessLine/PurenessLine/targetver.h deleted file mode 100644 index 93f0450cb..000000000 --- a/PssSampleClient/PurenessLine/PurenessLine/targetver.h +++ /dev/null @@ -1,26 +0,0 @@ - -#pragma once - -// º궨Ҫƽ̨Ҫƽ̨ -// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ -// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ -// - -// ҪԵָ汾ƽ̨޸ж塣 -// йزͬƽ̨ӦֵϢο MSDN -#ifndef WINVER // ָҪƽ̨ Windows Vista -#define WINVER 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista -#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINDOWS // ָҪƽ̨ Windows 98 -#define _WIN32_WINDOWS 0x0410 // ֵΪʵֵ Windows Me ߰汾 -#endif - -#ifndef _WIN32_IE // ָҪƽ̨ Internet Explorer 7.0 -#define _WIN32_IE 0x0700 // ֵΪӦֵ IE 汾 -#endif - diff --git a/README.md b/README.md index fd9f68d75..51bbffd2e 100644 --- a/README.md +++ b/README.md @@ -1,33 +1,39 @@ -English | [简体中文](./README_Chinese.md) +English | [简体中文](./README_Chinese.md)

Current stable version: v1.0.0

-

PSS

+

pss

This is a based plug-in framework that provides cross-platform IO and logically separated plug-in services. - ---------- - [![Build Status](https://travis-ci.org/freeeyes/PSS.svg?branch=master)](https://travis-ci.org/freeeyes/PSS) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![GitHub version](https://badge.fury.io/gh/freeeyes%2FPSS.svg)](https://badge.fury.io/gh/freeeyes%2FPSS) [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=freeeyes&metric=alert_status)](https://sonarcloud.io/dashboard?id=freeeyes) [![Platform](https://img.shields.io/badge/platform-Linux,%20Windows-green.svg?style=flat)](https://github.com/freeeyes/PSS)
- -# OverView + +# OverView + this is a server framework. Support the way developers use plug-ins ( so or dll library). -develop logical services for related TCP and UDP. This service framework is based on ace and can be compiled and run adaptively under windows and Linux. -the purpose of this service framework is to peel off the relationship between network io and logical developers as much as possible, so that the logical developers are more focused on their own business, and the network io is fully implemented by the configuration file. +develop logical services for related TCP and UDP. This service framework is based on ace and can be compiled and run adaptively under windows and Linux. + +the purpose of this service framework is to peel off the relationship between network io and logical developers as much as possible, so that the logical developers are more focused on their own business, and the network io is fully implemented by the configuration file. + operation and maintenance manager can through the auxiliary management tools, to obtain the framework operation status, work thread, data flow status, connection status and other information. -auxiliary operation and maintenance management, troubleshooting. -in addition, developers can also be completely out of the framework, using the tools around the framework, pressure test their logic module, so as to minimize the possible problems before online. -before using the framework, you can use the framework to provide small tools, pressure test performance indicators of the current framework, as a basis for whether to adopt. -example has a special test case, can provide a developer reference. -the goal of this framework is not just a network io plug-in interface, but a complete set of development process, as far as possible to reduce the developer 's pay. -specification development process ( currently available on the SVN framework testing tools, specific functions please refer to other instructions MD ) -hope to be able to step by step with you to improve the system, really do a valuable framework. My goal is, you use cool, is to succeed. And I hope you like it more and more. +auxiliary operation and maintenance management, troubleshooting. + +in addition, developers can also be completely out of the framework, using the tools around the framework, pressure test their logic module, so as to minimize the possible problems before online. + +before using the framework, you can use the framework to provide small tools, pressure test performance indicators of the current framework, as a basis for whether to adopt. + +example has a special test case, can provide a developer reference. + +the goal of this framework is not just a network io plug-in interface, but a complete set of development process, as far as possible to reduce the developer 's pay. + +specification development process ( currently available on the SVN framework testing tools, specific functions please refer to other instructions MD ) +hope to be able to step by step with you to improve the system, really do a valuable framework. My goal is, you use cool, is to succeed. And I hope you like it more and more. ## [How does the PSS framework compile](./Doc/English/Install.md) ## [Pss framework configuration instructions](./Doc/English/Configure.md) @@ -39,18 +45,21 @@ hope to be able to step by step with you to improve the system, really do a valu ![pss frame flow chart](http://on-img.com/chart_image/5a6ae014e4b0d1c5b5b1e6fa.png) ->##Provides several piezometric data ( TCP pass tool available from PSS open source kit ) +> **Provides several piezometric data ( TCP pass tool available from PSS open source kit )** + +---------- + +### Windows + +> Test PSS IP:172.21.1.200, Port:10002. (Windows7 x64 DEBUG) -* * * -> ###Windows -> Test PSS IP:172.21.1.200, Port:10002. (Windows7 x64 DEBUG) * Test IO protocal:TCP * Begin Time: 2013-09-18 11:07:42 * End Time: 2013-09-18 12:06:00 * Thread counts:10 * connect counts:10 * send package counts:11675202 -* recv package counts:11675202 +* recv package counts:11675202 * connect fails:0 * send fails:0 * recv dails:0 @@ -58,9 +67,12 @@ hope to be able to step by step with you to improve the system, really do a valu * send success rote:100.000000% * recv success rote:100.000000% -* * * -> ###Linux +---------- + +### Linux + > Test PSS IP:172.21.1.68, port:10002.(Linux ContOS6 x64 DEBUG) + * Test IO protocal:TCP * Begin Time:: 2013-09-16 09:55:58 * End Time: 2013-09-16 10:38:09 @@ -75,13 +87,10 @@ hope to be able to step by step with you to improve the system, really do a valu * send success rote:100.000000% * recv success rote:100.000000% -* * * - -author: -freeeyes +---------- -thanks: -凹凸man,w1w,乔戈,Bobo,弄香花满衣,崔,kz +Author: freeeyes -QQ group: 260862613 +Thanks: 凹凸man,w1w,乔戈,Bobo,弄香花满衣,崔,kz,Jerry-Larry +QQ group: 260862613 \ No newline at end of file diff --git a/README_Chinese.md b/README_Chinese.md index 9dd5b6495..c705eedfe 100644 --- a/README_Chinese.md +++ b/README_Chinese.md @@ -1,20 +1,19 @@ - [English](./README.md) | 简体中文 +[English](./README.md) | 简体中文

当前稳定版本: v1.0.0

-

PSS

+

pss

这是一个基于网络的插件式框架,提供跨平台的IO和逻辑分离的插件服务. - ---------- - [![Build Status](https://travis-ci.org/freeeyes/PSS.svg?branch=master)](https://travis-ci.org/freeeyes/PSS) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![GitHub version](https://badge.fury.io/gh/freeeyes%2FPSS.svg)](https://badge.fury.io/gh/freeeyes%2FPSS) [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=freeeyes&metric=alert_status)](https://sonarcloud.io/dashboard?id=freeeyes) [![Platform](https://img.shields.io/badge/platform-Linux,%20Windows-green.svg?style=flat)](https://github.com/freeeyes/PSS) - -#介绍 + +# 介绍 + 这是一个服务器框架。支持开发者使用插件(so或者dll)的方式, 开发相关TCP和UDP的逻辑服务。 本服务框架基于ACE,可以在windows和linux下自适应编译运行。 本服务框架的宗旨是尽量剥离网络IO和逻辑开发者之间的关系,让逻辑开发者更专注于自己的业务,而网络IO部分完全由配置文件去实现。 @@ -41,10 +40,14 @@ example下有专门的测试用例,可以提供开发者参考。 ![pss框架流程图](http://on-img.com/chart_image/5a6ae014e4b0d1c5b5b1e6fa.png) ->##提供几个压测数据(TcpPass工具,可从PSS开源工具包中获得) -* * * -> ###Windows平台 -压测IP:172.21.1.200, 压测端口:10002.(Win7 DEBUG) +>##提供几个压测数据(TcpPass工具,可从PSS开源工具包中获得) + +---------- + +### Windows平台 + +压测IP:172.21.1.200, 压测端口:10002 (Win7 DEBUG) + * 压测类型:TCP * 压测开始时间为: 2013-09-18 11:07:42 * 压测结束时间为: 2013-09-18 12:06:00 @@ -59,9 +62,9 @@ example下有专门的测试用例,可以提供开发者参考。 * 发送数据包成功百分比:100.000000% * 接收数据包成功百分比:100.000000% -* * * -> ###Linux平台 -* 压测IP:172.21.1.68, 压测端口:10002.(Linux ContOS6 DEBUG) +### Linux平台 + +* 压测IP:172.21.1.68, 压测端口:10002 (Linux ContOS6 DEBUG) * 压测类型:TCP * 压测开始时间为: 2013-09-16 09:55:58 * 压测结束时间为: 2013-09-16 10:38:09 @@ -76,13 +79,12 @@ example下有专门的测试用例,可以提供开发者参考。 * 发送数据包成功百分比:100.000000% * 接收数据包成功百分比:100.000000% -* * * +---------- 作者: freeeyes 框架贡献者: -凹凸man,w1w,乔戈,Bobo,弄香花满衣,崔,kz - -QQ框架技术讨论群: 260862613 +凹凸man,w1w,乔戈,Bobo,弄香花满衣,崔,kz,Jerry-Larry +QQ框架技术讨论群: 260862613 \ No newline at end of file diff --git a/TestNetworkTool/CMakeLists.txt b/TestNetworkTool/CMakeLists.txt new file mode 100644 index 000000000..3c48feb4e --- /dev/null +++ b/TestNetworkTool/CMakeLists.txt @@ -0,0 +1,134 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PSS_ClientManager) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PSS_ClientManager_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + . + ../ThirdLib/include + ../ThirdLib/include/Lua + ../ThirdLib/src + ../ThirdLib/thirdparty + ../ThirdLib/thirdparty/LuaLib + ../ThirdLib/include/TinyXML + +) + + +# Compiler options +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_1) +execute_process(COMMAND + wx-config --cxxflags --unicode=yes --debug=no + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_2) +add_definitions(${CL_VAR_1}) +add_definitions(${CL_VAR_2}) +add_definitions(-O2) +add_definitions(-Wall) +add_definitions( + -DNDEBUG + -D_LINUX_PLATFORM_ + -D_FILE_OFFSET_BITS=64 + -DWXUSINGDLL + -D__WXGTK__ +) + + +# Linker options +execute_process(COMMAND + wx-config --debug=no --libs --unicode=yes + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) +string(STRIP ${CL_TMP_VAR} CL_VAR_3) +set(LINK_OPTIONS ${CL_VAR_3}) +set(LINK_OPTIONS ${LINK_OPTIONS} -s) + + +if(WIN32) + # Resource options + execute_process(COMMAND + wx-config --rcflags + OUTPUT_VARIABLE + CL_TMP_VAR + OUTPUT_STRIP_TRAILING_WHITESPACE) + string(STRIP ${CL_TMP_VAR} CL_VAR_4) + set(RC_OPTIONS ${CL_VAR_4}) +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../ThirdLib/include/XmlOpeation.cpp + ${CMAKE_CURRENT_LIST_DIR}/PSS_ClientManager/PSS_ClientManagerMain.cpp + ${CMAKE_CURRENT_LIST_DIR}/../ThirdLib/include/TinyXML/tinyxml.cpp + ${CMAKE_CURRENT_LIST_DIR}/PSS_ClientManager/PSS_ClientManagerApp.cpp + ${CMAKE_CURRENT_LIST_DIR}/../ThirdLib/src/TcpClientConnect.cpp + ${CMAKE_CURRENT_LIST_DIR}/../ThirdLib/include/TinyXML/tinyxmlparser.cpp + ${CMAKE_CURRENT_LIST_DIR}/../ThirdLib/include/TinyXML/tinystr.cpp + ${CMAKE_CURRENT_LIST_DIR}/../ThirdLib/include/TinyXML/tinyxmlerror.cpp + ${CMAKE_CURRENT_LIST_DIR}/../ThirdLib/thirdparty/sock_wrap.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -Wall -pthread") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(PSS_ClientManager ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PSS_ClientManager ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/TestNetworkTool/Makefile_PSS_ClientManager b/TestNetworkTool/Makefile_PSS_ClientManager new file mode 100644 index 000000000..db00bf07f --- /dev/null +++ b/TestNetworkTool/Makefile_PSS_ClientManager @@ -0,0 +1,174 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PSS_ClientManager +ConfigurationName :=Release +WorkspacePath :=../Build/Linux +ProjectPath :=./TestNetworkTool +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PSS_ClientManager.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ThirdLib/include $(IncludeSwitch)../ThirdLib/include/Lua $(IncludeSwitch)../ThirdLib/src $(IncludeSwitch)../ThirdLib/thirdparty $(IncludeSwitch)../ThirdLib/thirdparty/LuaLib $(IncludeSwitch)../ThirdLib/include/TinyXML +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix): ../ThirdLib/include/XmlOpeation.cpp $(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix): ../ThirdLib/include/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) -MM ../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix): ../ThirdLib/include/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix) ../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(ObjectSuffix): ../ThirdLib/src/TcpClientConnect.cpp $(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/src/TcpClientConnect.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(DependSuffix): ../ThirdLib/src/TcpClientConnect.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(DependSuffix) -MM ../ThirdLib/src/TcpClientConnect.cpp + +$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(PreprocessSuffix): ../ThirdLib/src/TcpClientConnect.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(PreprocessSuffix) ../ThirdLib/src/TcpClientConnect.cpp + +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(ObjectSuffix): PSS_ClientManager/PSS_ClientManagerApp.cpp $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PSS_ClientManager/PSS_ClientManagerApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(DependSuffix): PSS_ClientManager/PSS_ClientManagerApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(DependSuffix) -MM PSS_ClientManager/PSS_ClientManagerApp.cpp + +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(PreprocessSuffix): PSS_ClientManager/PSS_ClientManagerApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(PreprocessSuffix) PSS_ClientManager/PSS_ClientManagerApp.cpp + +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(ObjectSuffix): PSS_ClientManager/PSS_ClientManagerMain.cpp $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PSS_ClientManager/PSS_ClientManagerMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(DependSuffix): PSS_ClientManager/PSS_ClientManagerMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(DependSuffix) -MM PSS_ClientManager/PSS_ClientManagerMain.cpp + +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(PreprocessSuffix): PSS_ClientManager/PSS_ClientManagerMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(PreprocessSuffix) PSS_ClientManager/PSS_ClientManagerMain.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/TestNetworkTool/Makefile_PassTCP b/TestNetworkTool/Makefile_PassTCP new file mode 100644 index 000000000..5bdb33ca2 --- /dev/null +++ b/TestNetworkTool/Makefile_PassTCP @@ -0,0 +1,482 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PassTCP +ConfigurationName :=Release +WorkspacePath :=../Build/Linux +ProjectPath :=./TestNetworkTool +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PassTCP.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --libs) +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ThirdLib/include $(IncludeSwitch)../ThirdLib/include/Lua $(IncludeSwitch)../ThirdLib/thirdparty $(IncludeSwitch)../ThirdLib/thirdparty/LuaLib $(IncludeSwitch)../ThirdLib/include/TinyXML +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cflags) $(Preprocessors) +CFLAGS := -O2 -Wall $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) \ + $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) \ + $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(ObjectSuffix): PassTCP/ClientTcpSocket.cpp $(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PassTCP/ClientTcpSocket.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(DependSuffix): PassTCP/ClientTcpSocket.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(DependSuffix) -MM PassTCP/ClientTcpSocket.cpp + +$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(PreprocessSuffix): PassTCP/ClientTcpSocket.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(PreprocessSuffix) PassTCP/ClientTcpSocket.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ltablib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/ltablib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ltablib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ltablib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ltablib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ltablib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ltm.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/ltm.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ltm.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ltm.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ltm.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ltm.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lparser.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lparser.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lparser.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lparser.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lparser.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lparser.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lvm.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lvm.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lvm.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lvm.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lvm.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lvm.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lbaselib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lbaselib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lbaselib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lbaselib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lbaselib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lbaselib.c + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lfunc.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lfunc.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lfunc.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lfunc.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lfunc.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lfunc.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lundump.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lundump.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lundump.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lundump.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lundump.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lundump.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/linit.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/linit.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/linit.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/linit.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/linit.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/linit.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/print.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/print.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/print.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/print.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/print.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/print.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_push.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/tolua_push.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_push.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_push.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_push.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_push.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lstrlib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lstrlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lstrlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lstrlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lstrlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lstrlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/toluabind.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/toluabind.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/toluabind.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/toluabind.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/toluabind.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/toluabind.c + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lzio.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lzio.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lzio.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lzio.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lzio.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lzio.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lstate.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lstate.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lstate.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lstate.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lstate.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lstate.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lapi.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lapi.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lapi.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lapi.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lapi.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lapi.c + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ldo.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/ldo.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ldo.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ldo.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ldo.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ldo.c + +$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(ObjectSuffix): PassTCP/PassTCPDlg.cpp $(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PassTCP/PassTCPDlg.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(DependSuffix): PassTCP/PassTCPDlg.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(DependSuffix) -MM PassTCP/PassTCPDlg.cpp + +$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(PreprocessSuffix): PassTCP/PassTCPDlg.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(PreprocessSuffix) PassTCP/PassTCPDlg.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(ObjectSuffix): ../ThirdLib/include/Lua/LuaFn.cpp $(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/Lua/LuaFn.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(DependSuffix): ../ThirdLib/include/Lua/LuaFn.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(DependSuffix) -MM ../ThirdLib/include/Lua/LuaFn.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(PreprocessSuffix): ../ThirdLib/include/Lua/LuaFn.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(PreprocessSuffix) ../ThirdLib/include/Lua/LuaFn.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/loslib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/loslib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/loslib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/loslib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/loslib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/loslib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_map.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/tolua_map.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_map.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_map.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_map.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_map.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_is.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/tolua_is.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_is.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_is.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_is.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_is.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ltable.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/ltable.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ltable.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ltable.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ltable.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ltable.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lstring.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lstring.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lstring.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lstring.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lstring.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lstring.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ldebug.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/ldebug.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ldebug.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ldebug.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ldebug.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ldebug.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lcode.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lcode.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lcode.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lcode.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lcode.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lcode.c + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lmathlib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lmathlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lmathlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lmathlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lmathlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lmathlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lobject.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lobject.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lobject.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lobject.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lobject.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lobject.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lopcodes.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lopcodes.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lopcodes.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lopcodes.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lopcodes.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lopcodes.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/loadlib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/loadlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/loadlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/loadlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/loadlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/loadlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ldblib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/ldblib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ldblib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ldblib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ldblib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ldblib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lmem.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lmem.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lmem.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lmem.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lmem.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lmem.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/llex.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/llex.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/llex.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/llex.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/llex.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/llex.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/liolib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/liolib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/liolib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/liolib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/liolib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/liolib.c + +$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(ObjectSuffix): PassTCP/ClientUdpSocket.cpp $(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PassTCP/ClientUdpSocket.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(DependSuffix): PassTCP/ClientUdpSocket.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(DependSuffix) -MM PassTCP/ClientUdpSocket.cpp + +$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(PreprocessSuffix): PassTCP/ClientUdpSocket.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(PreprocessSuffix) PassTCP/ClientUdpSocket.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_to.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/tolua_to.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_to.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_to.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_to.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_to.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lgc.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lgc.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lgc.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lgc.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lgc.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lgc.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ldump.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/ldump.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ldump.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ldump.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ldump.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ldump.c + +$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(ObjectSuffix): PassTCP/PacketDlg.cpp $(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PassTCP/PacketDlg.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(DependSuffix): PassTCP/PacketDlg.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(DependSuffix) -MM PassTCP/PacketDlg.cpp + +$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(PreprocessSuffix): PassTCP/PacketDlg.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(PreprocessSuffix) PassTCP/PacketDlg.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lauxlib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/lauxlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lauxlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lauxlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lauxlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lauxlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_event.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix) + $(CC) $(SourceSwitch) "../ThirdLib/thirdparty/LuaLib/tolua_event.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_event.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_event.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_event.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_event.c + +$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(ObjectSuffix): PassTCP/PassTCPApp.cpp $(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PassTCP/PassTCPApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(DependSuffix): PassTCP/PassTCPApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(DependSuffix) -MM PassTCP/PassTCPApp.cpp + +$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(PreprocessSuffix): PassTCP/PassTCPApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(PreprocessSuffix) PassTCP/PassTCPApp.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/TestNetworkTool/PSS_ClientManager.cbp b/TestNetworkTool/PSS_ClientManager.cbp new file mode 100644 index 000000000..2e4876bca --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager.cbp @@ -0,0 +1,57 @@ + + + + + + diff --git a/TestNetworkTool/PSS_ClientManager.depend b/TestNetworkTool/PSS_ClientManager.depend new file mode 100644 index 000000000..ad325e6f6 --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager.depend @@ -0,0 +1,1432 @@ +# depslib dependency file v1.0 +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp + "tinystr.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.h + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp + + + + "tinyxml.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.h + + + + + + + + + "tinystr.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp + "tinyxml.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp + + + "tinyxml.h" + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/XmlOpeation.cpp + "XmlOpeation.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/XmlOpeation.h + "tinyxml.h" + "tinystr.h" + "Common.h" + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML//tinyxml.h + + + + + + + + + "tinystr.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML//tinystr.h + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Common.h + + + + "winsock2.h" + + + + + + + + + + +1553737530 source:/data/develop/Lib/Network/PSS-master/ThirdLib/src/TcpClientConnect.cpp + "TcpClientConnect.h" + +1553738109 /data/develop/Lib/Network/PSS-master/ThirdLib/src/TcpClientConnect.h + + + + + + + + + + "sock_wrap.h" + "macro.h" + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//sock_wrap.h + + + + + + + + + + +1553738330 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//macro.h + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp + + + + "sock_wrap.h" + + + + + + + + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.h + + + + + + + + + + +1553747299 source:/data/develop/Lib/Network/PSS-master/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.cpp + "PSS_ClientManagerApp.h" + "../../TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.h" + + +1553654185 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.h + + +1536665357 /usr/include/wx-3.0/wx/app.h + "wx/event.h" + "wx/eventfilter.h" + "wx/build.h" + "wx/cmdargs.h" + "wx/init.h" + "wx/intl.h" + "wx/log.h" + "wx/unix/app.h" + "wx/msw/app.h" + "wx/motif/app.h" + "wx/dfb/app.h" + "wx/gtk/app.h" + "wx/gtk1/app.h" + "wx/x11/app.h" + "wx/osx/app.h" + "wx/cocoa/app.h" + "wx/os2/app.h" + "wx/univ/theme.h" + +1536665357 /usr/include/wx-3.0/wx/event.h + "wx/defs.h" + "wx/cpp.h" + "wx/object.h" + "wx/clntdata.h" + "wx/gdicmn.h" + "wx/cursor.h" + "wx/mousestate.h" + "wx/dynarray.h" + "wx/thread.h" + "wx/tracker.h" + "wx/typeinfo.h" + "wx/any.h" + "wx/meta/convertible.h" + "wx/meta/removeref.h" + +1536665357 /usr/include/wx-3.0/wx/defs.h + "wx/platform.h" + "wx/version.h" + "wx/dlimpexp.h" + + "wx/debug.h" + + + "wx/windowid.h" + + "wx/msw/winundef.h" + "wx/features.h" + +1536665357 /usr/include/wx-3.0/wx/platform.h + + + + "wx/osx/config_xcode.h" + "wx/android/config_android.h" + "wx/compiler.h" + "wx/setup.h" + "wx/msw/wince/libraries.h" + "wx/msw/libraries.h" + "wx/msw/gccpriv.h" + + + "wx/chkconf.h" + +1536665357 /usr/include/wx-3.0/wx/compiler.h + +1536665357 /usr/lib/wx/include/gtk2-unicode-3.0/wx/setup.h + +1536665357 /usr/include/wx-3.0/wx/chkconf.h + "wx/msw/wince/chkconf.h" + "wx/msw/chkconf.h" + "wx/gtk/chkconf.h" + "wx/gtk/chkconf.h" + "wx/cocoa/chkconf.h" + "wx/osx/chkconf.h" + "wx/os2/chkconf.h" + "wx/dfb/chkconf.h" + "wx/motif/chkconf.h" + "wx/x11/chkconf.h" + "wx/android/chkconf.h" + "wx/unix/chkconf.h" + "wx/univ/chkconf.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/chkconf.h + +1536665357 /usr/include/wx-3.0/wx/unix/chkconf.h + +1536665357 /usr/include/wx-3.0/wx/version.h + "wx/cpp.h" + +1536665357 /usr/include/wx-3.0/wx/cpp.h + "wx/compiler.h" + +1536665357 /usr/include/wx-3.0/wx/dlimpexp.h + +1536665357 /usr/include/wx-3.0/wx/debug.h + + + "wx/chartype.h" + "wx/cpp.h" + "wx/dlimpexp.h" + +1536665357 /usr/include/wx-3.0/wx/chartype.h + "wx/platform.h" + + + + + + + + + + + + +1536665357 /usr/include/wx-3.0/wx/windowid.h + +1536665357 /usr/include/wx-3.0/wx/features.h + +1536665357 /usr/include/wx-3.0/wx/object.h + "wx/memory.h" + "wx/xti.h" + "wx/rtti.h" + "wx/xti2.h" + "wx/msw/msvcrt.h" + +1536665357 /usr/include/wx-3.0/wx/memory.h + "wx/defs.h" + "wx/string.h" + "wx/msgout.h" + + +1536665357 /usr/include/wx-3.0/wx/string.h + "wx/defs.h" + + + + + + + + + + + "wx/wxcrtbase.h" + "wx/strvararg.h" + "wx/buffer.h" + "wx/strconv.h" + "wx/stringimpl.h" + "wx/stringops.h" + "wx/unichar.h" + "wx/tls.h" + "wx/iosfwrap.h" + "wx/crt.h" + +1536665357 /usr/include/wx-3.0/wx/wxcrtbase.h + "wx/chartype.h" + + + + + + + +1536665357 /usr/include/wx-3.0/wx/strvararg.h + "wx/platform.h" + "wx/cpp.h" + "wx/chartype.h" + "wx/strconv.h" + "wx/buffer.h" + "wx/unichar.h" + + + + "wx/stringimpl.h" + +1536665357 /usr/include/wx-3.0/wx/strconv.h + "wx/defs.h" + "wx/chartype.h" + "wx/buffer.h" + "typeinfo.h" + + "wx/fontenc.h" + +1536665357 /usr/include/wx-3.0/wx/buffer.h + "wx/chartype.h" + "wx/wxcrtbase.h" + + +1536665357 /usr/include/wx-3.0/wx/typeinfo.h + "wx/defs.h" + + + +1536665357 /usr/include/wx-3.0/wx/fontenc.h + +1536665357 /usr/include/wx-3.0/wx/unichar.h + "wx/defs.h" + "wx/chartype.h" + "wx/stringimpl.h" + +1536665357 /usr/include/wx-3.0/wx/stringimpl.h + "wx/defs.h" + "wx/chartype.h" + "wx/wxcrtbase.h" + + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/beforestd.h + +1536665357 /usr/include/wx-3.0/wx/afterstd.h + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/stringops.h + "wx/chartype.h" + "wx/stringimpl.h" + "wx/unichar.h" + "wx/buffer.h" + +1536665357 /usr/include/wx-3.0/wx/tls.h + "wx/defs.h" + "wx/msw/tls.h" + "wx/os2/tls.h" + "wx/unix/tls.h" + + +1536665357 /usr/include/wx-3.0/wx/unix/tls.h + + +1536665357 /usr/include/wx-3.0/wx/iosfwrap.h + + + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/crt.h + "wx/defs.h" + "wx/chartype.h" + "wx/wxcrt.h" + "wx/wxcrtvararg.h" + +1536665357 /usr/include/wx-3.0/wx/wxcrt.h + "wx/wxcrtbase.h" + "wx/string.h" + + +1536665357 /usr/include/wx-3.0/wx/wxcrtvararg.h + "wx/wxcrt.h" + "wx/strvararg.h" + "wx/string.h" + + +1536665357 /usr/include/wx-3.0/wx/msgout.h + "wx/defs.h" + "wx/chartype.h" + "wx/strvararg.h" + +1536665357 /usr/include/wx-3.0/wx/xti.h + "wx/defs.h" + "wx/xtitypes.h" + "wx/xtihandler.h" + +1536665357 /usr/include/wx-3.0/wx/xtitypes.h + "wx/defs.h" + "wx/string.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/flags.h" + "wx/intl.h" + "wx/log.h" + + +1536665357 /usr/include/wx-3.0/wx/hashmap.h + "wx/string.h" + "wx/wxcrt.h" + + + + + + +1536665357 /usr/include/wx-3.0/wx/arrstr.h + "wx/defs.h" + "wx/string.h" + "wx/dynarray.h" + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/dynarray.h + "wx/defs.h" + "wx/beforestd.h" + + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/flags.h + +1536665357 /usr/include/wx-3.0/wx/intl.h + "wx/defs.h" + "wx/string.h" + "wx/translation.h" + "wx/fontenc.h" + "wx/language.h" + +1536665357 /usr/include/wx-3.0/wx/translation.h + "wx/defs.h" + "wx/string.h" + "wx/buffer.h" + "wx/language.h" + "wx/hashmap.h" + "wx/strconv.h" + "wx/scopedptr.h" + +1536665357 /usr/include/wx-3.0/wx/language.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/scopedptr.h + "wx/defs.h" + "wx/checkeddelete.h" + +1536665357 /usr/include/wx-3.0/wx/checkeddelete.h + "wx/cpp.h" + +1536665357 /usr/include/wx-3.0/wx/log.h + "wx/defs.h" + "wx/cpp.h" + "wx/string.h" + "wx/strvararg.h" + "wx/arrstr.h" + + "wx/dynarray.h" + "wx/hashmap.h" + "wx/thread.h" + "wx/iosfwrap.h" + "wx/generic/logg.h" + "wx/cocoa/log.h" + +1536665357 /usr/include/wx-3.0/wx/thread.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/generic/logg.h + +1536665357 /usr/include/wx-3.0/wx/xtihandler.h + "wx/defs.h" + "wx/xti.h" + +1536665357 /usr/include/wx-3.0/wx/rtti.h + "wx/memory.h" + "wx/flags.h" + +1536665357 /usr/include/wx-3.0/wx/xti2.h + "wx/xtiprop.h" + "wx/xtictor.h" + +1536665357 /usr/include/wx-3.0/wx/xtiprop.h + "wx/defs.h" + "wx/xti.h" + "wx/any.h" + +1536665357 /usr/include/wx-3.0/wx/any.h + "wx/defs.h" + + "wx/string.h" + "wx/meta/if.h" + "wx/typeinfo.h" + "wx/list.h" + "wx/datetime.h" + "wx/variant.h" + +1536665357 /usr/include/wx-3.0/wx/meta/if.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/list.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/vector.h" + "wx/beforestd.h" + + + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/vector.h + "wx/defs.h" + + + "wx/scopeguard.h" + "wx/meta/movable.h" + "wx/meta/if.h" + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/scopeguard.h + "wx/defs.h" + "wx/except.h" + +1536665357 /usr/include/wx-3.0/wx/except.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/meta/movable.h + "wx/meta/pod.h" + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/meta/pod.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/datetime.h + "wx/defs.h" + "wx/msw/wince/time.h" + + + "wx/longlong.h" + "wx/anystr.h" + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/longlong.h + "wx/defs.h" + "wx/string.h" + + "wx/iosfwrap.h" + + "wx/strvararg.h" + +1536665357 /usr/include/wx-3.0/wx/anystr.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/variant.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/arrstr.h" + "wx/list.h" + "wx/cpp.h" + "wx/longlong.h" + "wx/datetime.h" + "wx/iosfwrap.h" + "wx/any.h" + +1536665357 /usr/include/wx-3.0/wx/xtictor.h + "wx/defs.h" + "wx/xti.h" + +1536665357 /usr/include/wx-3.0/wx/clntdata.h + "wx/defs.h" + "wx/string.h" + "wx/hashmap.h" + +1536665357 /usr/include/wx-3.0/wx/gdicmn.h + "wx/defs.h" + "wx/list.h" + "wx/string.h" + "wx/fontenc.h" + "wx/hashmap.h" + "wx/math.h" + +1536665357 /usr/include/wx-3.0/wx/math.h + "wx/defs.h" + + + + + +1536665357 /usr/include/wx-3.0/wx/cursor.h + "wx/defs.h" + "wx/msw/cursor.h" + "wx/motif/cursor.h" + "wx/gtk/cursor.h" + "wx/gtk1/cursor.h" + "wx/x11/cursor.h" + "wx/dfb/cursor.h" + "wx/osx/cursor.h" + "wx/cocoa/cursor.h" + "wx/os2/cursor.h" + "wx/utils.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/cursor.h + "wx/gdiobj.h" + "wx/gdicmn.h" + +1536665357 /usr/include/wx-3.0/wx/gdiobj.h + "wx/object.h" + +1536665357 /usr/include/wx-3.0/wx/utils.h + "wx/object.h" + "wx/list.h" + "wx/filefn.h" + "wx/hashmap.h" + "wx/versioninfo.h" + "wx/meta/implicitconversion.h" + "wx/gdicmn.h" + "wx/mousestate.h" + "wx/longlong.h" + "wx/platinfo.h" + + + + + +1536665357 /usr/include/wx-3.0/wx/filefn.h + "wx/list.h" + "wx/arrstr.h" + "wx/msw/wince/time.h" + "wx/msw/private.h" + + + + + "wx/os2/private.h" + + + + + + + + + + + + + + + + + +1536665357 /usr/include/wx-3.0/wx/versioninfo.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/meta/implicitconversion.h + "wx/defs.h" + "wx/meta/if.h" + +1536665357 /usr/include/wx-3.0/wx/mousestate.h + "wx/gdicmn.h" + "wx/kbdstate.h" + +1536665357 /usr/include/wx-3.0/wx/kbdstate.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/platinfo.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/tracker.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/meta/convertible.h + +1536665357 /usr/include/wx-3.0/wx/meta/removeref.h + +1536665357 /usr/include/wx-3.0/wx/eventfilter.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/build.h + "wx/version.h" + +1536665357 /usr/include/wx-3.0/wx/cmdargs.h + "wx/arrstr.h" + +1536665357 /usr/include/wx-3.0/wx/init.h + "wx/defs.h" + "wx/chartype.h" + "wx/msw/init.h" + +1536665357 /usr/include/wx-3.0/wx/unix/app.h + + +1536665357 /usr/include/wx-3.0/wx/gtk/app.h + +1553748270 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.h + + + + + + + + + + + + + + + + + "XmlOpeation.h" + "macro.h" + "sock_wrap.h" + "ClientDefine.h" + "TcpClientConnect.h" + +1536665357 /usr/include/wx-3.0/wx/button.h + "wx/defs.h" + "wx/anybutton.h" + "wx/univ/button.h" + "wx/msw/button.h" + "wx/motif/button.h" + "wx/gtk/button.h" + "wx/gtk1/button.h" + "wx/osx/button.h" + "wx/cocoa/button.h" + "wx/os2/button.h" + +1536665357 /usr/include/wx-3.0/wx/anybutton.h + "wx/defs.h" + "wx/bitmap.h" + "wx/control.h" + "wx/univ/anybutton.h" + "wx/msw/anybutton.h" + "wx/gtk/anybutton.h" + "wx/osx/anybutton.h" + +1536665357 /usr/include/wx-3.0/wx/bitmap.h + "wx/string.h" + "wx/gdicmn.h" + "wx/colour.h" + "wx/image.h" + "wx/variant.h" + "wx/msw/bitmap.h" + "wx/x11/bitmap.h" + "wx/gtk/bitmap.h" + "wx/gtk1/bitmap.h" + "wx/x11/bitmap.h" + "wx/dfb/bitmap.h" + "wx/osx/bitmap.h" + "wx/cocoa/bitmap.h" + "wx/os2/bitmap.h" + "wx/generic/mask.h" + +1536665357 /usr/include/wx-3.0/wx/colour.h + "wx/defs.h" + "wx/gdiobj.h" + "wx/variant.h" + "wx/msw/colour.h" + "wx/motif/colour.h" + "wx/gtk/colour.h" + "wx/gtk1/colour.h" + "wx/generic/colour.h" + "wx/x11/colour.h" + "wx/osx/colour.h" + "wx/cocoa/colour.h" + "wx/os2/colour.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/colour.h + +1536665357 /usr/include/wx-3.0/wx/image.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdicmn.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/stream.h" + "wx/variant.h" + "wx/imagbmp.h" + "wx/imagpng.h" + "wx/imaggif.h" + "wx/imagpcx.h" + "wx/imagjpeg.h" + "wx/imagtga.h" + "wx/imagtiff.h" + "wx/imagpnm.h" + "wx/imagxpm.h" + "wx/imagiff.h" + +1536665357 /usr/include/wx-3.0/wx/stream.h + "wx/defs.h" + + "wx/object.h" + "wx/string.h" + "wx/filefn.h" + +1536665357 /usr/include/wx-3.0/wx/imagbmp.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagpng.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imaggif.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagpcx.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagjpeg.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imagtga.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagtiff.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imagpnm.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagxpm.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagiff.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/bitmap.h + +1536665357 /usr/include/wx-3.0/wx/control.h + "wx/defs.h" + "wx/window.h" + "wx/univ/control.h" + "wx/msw/control.h" + "wx/motif/control.h" + "wx/gtk/control.h" + "wx/gtk1/control.h" + "wx/osx/control.h" + "wx/cocoa/control.h" + "wx/os2/control.h" + +1536665357 /usr/include/wx-3.0/wx/window.h + "wx/event.h" + "wx/list.h" + "wx/cursor.h" + "wx/font.h" + "wx/colour.h" + "wx/region.h" + "wx/utils.h" + "wx/intl.h" + "wx/validate.h" + "wx/palette.h" + "wx/accel.h" + "wx/access.h" + "wx/msw/window.h" + "wx/motif/window.h" + "wx/gtk/window.h" + "wx/gtk1/window.h" + "wx/x11/window.h" + "wx/dfb/window.h" + "wx/osx/window.h" + "wx/cocoa/window.h" + "wx/os2/window.h" + "wx/univ/window.h" + +1536665357 /usr/include/wx-3.0/wx/font.h + "wx/defs.h" + "wx/fontenc.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/font.h" + "wx/motif/font.h" + "wx/gtk/font.h" + "wx/gtk1/font.h" + "wx/x11/font.h" + "wx/dfb/font.h" + "wx/osx/font.h" + "wx/cocoa/font.h" + "wx/os2/font.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/font.h + +1536665357 /usr/include/wx-3.0/wx/region.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/region.h" + "wx/gtk/region.h" + "wx/gtk1/region.h" + "wx/x11/region.h" + "wx/dfb/region.h" + "wx/osx/region.h" + "wx/cocoa/region.h" + "wx/os2/region.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/region.h + +1536665357 /usr/include/wx-3.0/wx/validate.h + "wx/defs.h" + "wx/event.h" + +1536665357 /usr/include/wx-3.0/wx/palette.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/msw/palette.h" + "wx/x11/palette.h" + "wx/generic/paletteg.h" + "wx/osx/palette.h" + "wx/os2/palette.h" + +1536665357 /usr/include/wx-3.0/wx/generic/paletteg.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + +1536665357 /usr/include/wx-3.0/wx/accel.h + "wx/defs.h" + "wx/object.h" + "wx/generic/accel.h" + "wx/msw/accel.h" + "wx/motif/accel.h" + "wx/gtk/accel.h" + "wx/gtk1/accel.h" + "wx/osx/accel.h" + "wx/generic/accel.h" + "wx/os2/accel.h" + +1536665357 /usr/include/wx-3.0/wx/generic/accel.h + +1536665357 /usr/include/wx-3.0/wx/gtk/accel.h + "wx/generic/accel.h" + +1536665357 /usr/include/wx-3.0/wx/access.h + "wx/defs.h" + "wx/variant.h" + "wx/msw/ole/access.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/window.h + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/control.h + +1536665357 /usr/include/wx-3.0/wx/gtk/anybutton.h + +1536665357 /usr/include/wx-3.0/wx/gtk/button.h + +1536665357 /usr/include/wx-3.0/wx/checkbox.h + "wx/defs.h" + "wx/control.h" + "wx/univ/checkbox.h" + "wx/msw/checkbox.h" + "wx/motif/checkbox.h" + "wx/gtk/checkbox.h" + "wx/gtk1/checkbox.h" + "wx/osx/checkbox.h" + "wx/cocoa/checkbox.h" + "wx/os2/checkbox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/checkbox.h + +1536665357 /usr/include/wx-3.0/wx/combobox.h + "wx/defs.h" + "wx/textctrl.h" + "wx/ctrlsub.h" + "wx/textentry.h" + "wx/univ/combobox.h" + "wx/msw/combobox.h" + "wx/motif/combobox.h" + "wx/gtk/combobox.h" + "wx/gtk1/combobox.h" + "wx/osx/combobox.h" + "wx/cocoa/combobox.h" + "wx/os2/combobox.h" + +1536665357 /usr/include/wx-3.0/wx/textctrl.h + "wx/defs.h" + "wx/control.h" + "wx/textentry.h" + "wx/dynarray.h" + "wx/gdicmn.h" + "wx/ioswrap.h" + "wx/x11/textctrl.h" + "wx/univ/textctrl.h" + "wx/msw/wince/textctrlce.h" + "wx/msw/textctrl.h" + "wx/motif/textctrl.h" + "wx/gtk/textctrl.h" + "wx/gtk1/textctrl.h" + "wx/osx/textctrl.h" + "wx/cocoa/textctrl.h" + "wx/os2/textctrl.h" + +1536665357 /usr/include/wx-3.0/wx/textentry.h + "wx/filefn.h" + "wx/gdicmn.h" + "wx/gtk/textentry.h" + "wx/osx/textentry.h" + "wx/msw/textentry.h" + "wx/motif/textentry.h" + "wx/os2/textentry.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/textentry.h + +1536665357 /usr/include/wx-3.0/wx/ioswrap.h + "wx/beforestd.h" + + + "wx/afterstd.h" + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/textctrl.h + +1536665357 /usr/include/wx-3.0/wx/ctrlsub.h + "wx/defs.h" + "wx/arrstr.h" + "wx/control.h" + "wx/msw/ctrlsub.h" + "wx/motif/ctrlsub.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/combobox.h + "wx/choice.h" + +1536665357 /usr/include/wx-3.0/wx/choice.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/univ/choice.h" + "wx/msw/wince/choicece.h" + "wx/msw/choice.h" + "wx/motif/choice.h" + "wx/gtk/choice.h" + "wx/gtk1/choice.h" + "wx/osx/choice.h" + "wx/cocoa/choice.h" + "wx/os2/choice.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/choice.h + +1536665357 /usr/include/wx-3.0/wx/frame.h + "wx/toplevel.h" + "wx/statusbr.h" + "wx/univ/frame.h" + "wx/msw/frame.h" + "wx/gtk/frame.h" + "wx/gtk1/frame.h" + "wx/motif/frame.h" + "wx/osx/frame.h" + "wx/cocoa/frame.h" + "wx/os2/frame.h" + +1536665357 /usr/include/wx-3.0/wx/toplevel.h + "wx/nonownedwnd.h" + "wx/iconbndl.h" + "wx/weakref.h" + "wx/msw/toplevel.h" + "wx/gtk/toplevel.h" + "wx/gtk1/toplevel.h" + "wx/x11/toplevel.h" + "wx/dfb/toplevel.h" + "wx/osx/toplevel.h" + "wx/cocoa/toplevel.h" + "wx/os2/toplevel.h" + "wx/motif/toplevel.h" + "wx/univ/toplevel.h" + +1536665357 /usr/include/wx-3.0/wx/nonownedwnd.h + "wx/window.h" + "wx/dfb/nonownedwnd.h" + "wx/gtk/nonownedwnd.h" + "wx/osx/nonownedwnd.h" + "wx/msw/nonownedwnd.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/nonownedwnd.h + +1536665357 /usr/include/wx-3.0/wx/iconbndl.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/icon.h" + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/icon.h + "wx/iconloc.h" + "wx/msw/icon.h" + "wx/motif/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/osx/icon.h" + "wx/generic/icon.h" + "wx/cocoa/icon.h" + "wx/os2/icon.h" + "wx/variant.h" + +1536665357 /usr/include/wx-3.0/wx/iconloc.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/generic/icon.h + "wx/bitmap.h" + +1536665357 /usr/include/wx-3.0/wx/weakref.h + "wx/tracker.h" + "wx/meta/convertible.h" + "wx/meta/int2type.h" + +1536665357 /usr/include/wx-3.0/wx/meta/int2type.h + +1536665357 /usr/include/wx-3.0/wx/gtk/toplevel.h + +1536665357 /usr/include/wx-3.0/wx/statusbr.h + "wx/defs.h" + "wx/control.h" + "wx/list.h" + "wx/dynarray.h" + "wx/univ/statusbr.h" + "wx/msw/statusbar.h" + "wx/generic/statusbr.h" + "wx/osx/statusbr.h" + "wx/generic/statusbr.h" + +1536665357 /usr/include/wx-3.0/wx/generic/statusbr.h + "wx/defs.h" + "wx/pen.h" + "wx/arrstr.h" + +1536665357 /usr/include/wx-3.0/wx/pen.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/pen.h" + "wx/x11/pen.h" + "wx/gtk/pen.h" + "wx/gtk1/pen.h" + "wx/dfb/pen.h" + "wx/osx/pen.h" + "wx/cocoa/pen.h" + "wx/os2/pen.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/pen.h + +1536665357 /usr/include/wx-3.0/wx/gtk/frame.h + +1536665357 /usr/include/wx-3.0/wx/listbox.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/univ/listbox.h" + "wx/msw/listbox.h" + "wx/motif/listbox.h" + "wx/gtk/listbox.h" + "wx/gtk1/listbox.h" + "wx/osx/listbox.h" + "wx/os2/listbox.h" + "wx/cocoa/listbox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/listbox.h + +1536665357 /usr/include/wx-3.0/wx/listctrl.h + "wx/defs.h" + "wx/listbase.h" + "wx/msw/listctrl.h" + "wx/osx/listctrl.h" + "wx/generic/listctrl.h" + +1536665357 /usr/include/wx-3.0/wx/listbase.h + "wx/colour.h" + "wx/font.h" + "wx/gdicmn.h" + "wx/event.h" + "wx/control.h" + +1536665357 /usr/include/wx-3.0/wx/generic/listctrl.h + "wx/containr.h" + "wx/scrolwin.h" + "wx/textctrl.h" + +1536665357 /usr/include/wx-3.0/wx/containr.h + "wx/defs.h" + "wx/event.h" + +1536665357 /usr/include/wx-3.0/wx/scrolwin.h + "wx/panel.h" + "wx/gtk/scrolwin.h" + "wx/gtk1/scrolwin.h" + "wx/generic/scrolwin.h" + +1536665357 /usr/include/wx-3.0/wx/panel.h + "wx/window.h" + "wx/containr.h" + "wx/univ/panel.h" + "wx/msw/panel.h" + "wx/generic/panelg.h" + +1536665357 /usr/include/wx-3.0/wx/generic/panelg.h + "wx/bitmap.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/scrolwin.h + +1536665357 /usr/include/wx-3.0/wx/generic/scrolwin.h + +1536665357 /usr/include/wx-3.0/wx/notebook.h + "wx/defs.h" + "wx/bookctrl.h" + "wx/univ/notebook.h" + "wx/msw/notebook.h" + "wx/generic/notebook.h" + "wx/gtk/notebook.h" + "wx/gtk1/notebook.h" + "wx/osx/notebook.h" + "wx/cocoa/notebook.h" + "wx/os2/notebook.h" + +1536665357 /usr/include/wx-3.0/wx/bookctrl.h + "wx/defs.h" + "wx/control.h" + "wx/dynarray.h" + "wx/withimages.h" + "wx/notebook.h" + "wx/choicebk.h" + +1536665357 /usr/include/wx-3.0/wx/withimages.h + "wx/defs.h" + "wx/icon.h" + "wx/imaglist.h" + +1536665357 /usr/include/wx-3.0/wx/imaglist.h + "wx/defs.h" + "wx/generic/imaglist.h" + "wx/msw/imaglist.h" + "wx/osx/imaglist.h" + +1536665357 /usr/include/wx-3.0/wx/generic/imaglist.h + "wx/list.h" + +1536665357 /usr/include/wx-3.0/wx/choicebk.h + "wx/defs.h" + "wx/bookctrl.h" + "wx/choice.h" + "wx/containr.h" + +1536665357 /usr/include/wx-3.0/wx/generic/notebook.h + "wx/event.h" + "wx/control.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/notebook.h + "wx/list.h" + +1536665357 /usr/include/wx-3.0/wx/radiobox.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/dynarray.h" + "wx/univ/radiobox.h" + "wx/msw/radiobox.h" + "wx/motif/radiobox.h" + "wx/gtk/radiobox.h" + "wx/gtk1/radiobox.h" + "wx/osx/radiobox.h" + "wx/cocoa/radiobox.h" + "wx/os2/radiobox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/radiobox.h + "wx/bitmap.h" + "wx/list.h" + +1536665357 /usr/include/wx-3.0/wx/statbox.h + "wx/defs.h" + "wx/control.h" + "wx/containr.h" + "wx/univ/statbox.h" + "wx/msw/statbox.h" + "wx/motif/statbox.h" + "wx/gtk/statbox.h" + "wx/gtk1/statbox.h" + "wx/osx/statbox.h" + "wx/cocoa/statbox.h" + "wx/os2/statbox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/statbox.h + +1536665357 /usr/include/wx-3.0/wx/stattext.h + "wx/defs.h" + "wx/control.h" + "wx/univ/stattext.h" + "wx/msw/stattext.h" + "wx/motif/stattext.h" + "wx/gtk/stattext.h" + "wx/gtk1/stattext.h" + "wx/osx/stattext.h" + "wx/cocoa/stattext.h" + "wx/os2/stattext.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/stattext.h + +1536665357 /usr/include/wx-3.0/wx/timer.h + "wx/defs.h" + "wx/object.h" + "wx/longlong.h" + "wx/event.h" + "wx/stopwatch.h" + "wx/utils.h" + +1536665357 /usr/include/wx-3.0/wx/stopwatch.h + "wx/defs.h" + "wx/longlong.h" + "wx/time.h" + +1536665357 /usr/include/wx-3.0/wx/time.h + "wx/longlong.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include//XmlOpeation.h + "tinyxml.h" + "tinystr.h" + "Common.h" + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include//Common.h + + + + "winsock2.h" + + + + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PSS_ClientManager/ClientDefine.h + +1553738109 /data/develop/Lib/Network/PSS-master/ThirdLib/src//TcpClientConnect.h + + + + + + + + + + "sock_wrap.h" + "macro.h" + +1553748615 source:/data/develop/Lib/Network/PSS-master/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.cpp + "PSS_ClientManagerMain.h" + + + + + + + +1536665357 /usr/include/wx-3.0/wx/msgdlg.h + "wx/defs.h" + "wx/dialog.h" + "wx/stockitem.h" + "wx/generic/msgdlgg.h" + "wx/cocoa/msgdlg.h" + "wx/msw/msgdlg.h" + "wx/motif/msgdlg.h" + "wx/gtk/msgdlg.h" + "wx/osx/msgdlg.h" + "wx/os2/msgdlg.h" + +1536665357 /usr/include/wx-3.0/wx/dialog.h + "wx/toplevel.h" + "wx/containr.h" + "wx/sharedptr.h" + "wx/univ/dialog.h" + "wx/msw/dialog.h" + "wx/motif/dialog.h" + "wx/gtk/dialog.h" + "wx/gtk1/dialog.h" + "wx/osx/dialog.h" + "wx/cocoa/dialog.h" + "wx/os2/dialog.h" + +1536665357 /usr/include/wx-3.0/wx/sharedptr.h + "wx/defs.h" + "wx/atomic.h" + +1536665357 /usr/include/wx-3.0/wx/atomic.h + "wx/defs.h" + "wx/msw/wrapwin.h" + "libkern/OSAtomic.h" + + "wx/thread.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/dialog.h + +1536665357 /usr/include/wx-3.0/wx/stockitem.h + "wx/defs.h" + "wx/chartype.h" + "wx/string.h" + "wx/accel.h" + +1536665357 /usr/include/wx-3.0/wx/generic/msgdlgg.h + +1536665357 /usr/include/wx-3.0/wx/gtk/msgdlg.h + diff --git a/TestNetworkTool/PSS_ClientManager.layout b/TestNetworkTool/PSS_ClientManager.layout new file mode 100644 index 000000000..ba38779cc --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager.layout @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/TestNetworkTool/PSS_ClientManager.mk b/TestNetworkTool/PSS_ClientManager.mk new file mode 100644 index 000000000..7fbad7c27 --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager.mk @@ -0,0 +1,174 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PSS_ClientManager +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/TestNetworkTool +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PSS_ClientManager.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s $(shell wx-config --debug=no --libs --unicode=yes) +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ThirdLib/include $(IncludeSwitch)../ThirdLib/include/Lua $(IncludeSwitch)../ThirdLib/src $(IncludeSwitch)../ThirdLib/thirdparty $(IncludeSwitch)../ThirdLib/thirdparty/LuaLib $(IncludeSwitch)../ThirdLib/include/TinyXML +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +CFLAGS := -O2 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=no) $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(ObjectSuffix) $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix): ../ThirdLib/include/XmlOpeation.cpp $(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix): ../ThirdLib/include/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) -MM ../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix): ../ThirdLib/include/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix) ../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(ObjectSuffix): ../ThirdLib/src/TcpClientConnect.cpp $(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/src/TcpClientConnect.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(DependSuffix): ../ThirdLib/src/TcpClientConnect.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(DependSuffix) -MM ../ThirdLib/src/TcpClientConnect.cpp + +$(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(PreprocessSuffix): ../ThirdLib/src/TcpClientConnect.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_src_TcpClientConnect.cpp$(PreprocessSuffix) ../ThirdLib/src/TcpClientConnect.cpp + +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(ObjectSuffix): PSS_ClientManager/PSS_ClientManagerApp.cpp $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(DependSuffix): PSS_ClientManager/PSS_ClientManagerApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(DependSuffix) -MM PSS_ClientManager/PSS_ClientManagerApp.cpp + +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(PreprocessSuffix): PSS_ClientManager/PSS_ClientManagerApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerApp.cpp$(PreprocessSuffix) PSS_ClientManager/PSS_ClientManagerApp.cpp + +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(ObjectSuffix): PSS_ClientManager/PSS_ClientManagerMain.cpp $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(DependSuffix): PSS_ClientManager/PSS_ClientManagerMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(DependSuffix) -MM PSS_ClientManager/PSS_ClientManagerMain.cpp + +$(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(PreprocessSuffix): PSS_ClientManager/PSS_ClientManagerMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PSS_ClientManager_PSS_ClientManagerMain.cpp$(PreprocessSuffix) PSS_ClientManager/PSS_ClientManagerMain.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/TestNetworkTool/PSS_ClientManager.project b/TestNetworkTool/PSS_ClientManager.project new file mode 100644 index 000000000..aae0f16e7 --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager.project @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + diff --git a/TestNetworkTool/PSS_ClientManager.txt b/TestNetworkTool/PSS_ClientManager.txt new file mode 100644 index 000000000..1a40852ba --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager.txt @@ -0,0 +1 @@ +../Build/Linux/Temp/up_ThirdLib_include_TinyXML_tinystr.cpp.o ../Build/Linux/Temp/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp.o ../Build/Linux/Temp/up_ThirdLib_include_XmlOpeation.cpp.o ../Build/Linux/Temp/up_ThirdLib_include_TinyXML_tinyxml.cpp.o ../Build/Linux/Temp/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_sock_wrap.cpp.o ../Build/Linux/Temp/up_ThirdLib_src_TcpClientConnect.cpp.o ../Build/Linux/Temp/PSS_ClientManager_PSS_ClientManagerApp.cpp.o ../Build/Linux/Temp/PSS_ClientManager_PSS_ClientManagerMain.cpp.o diff --git a/TestNetworkTool/PSS_ClientManager/ClientDefine.h b/TestNetworkTool/PSS_ClientManager/ClientDefine.h new file mode 100644 index 000000000..3e4f7c3cc --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager/ClientDefine.h @@ -0,0 +1,46 @@ +#ifndef _CLIENTDEFINE_H +#define _CLIENTDEFINE_H + +#define MESSAGE_SENDERROR "发送给服务器命令失败" +#define MESSAGE_TITLE_ERROR "错误信息" +#define MESSAGE_TITLE_SUCCESS "服务器信息" +#define MESSAGE_TITLE_CONNECT "设置服务器地址成功" +#define MESSAGE_RESULT_SUCCESS "命令执行成功" +#define MESSAGE_RESULT_FAIL "命令执行失败" +#define MESSAGE_INSERT_NULL "必须输入相关信息才能进行此操作" +#define MESSAGE_TITLE_INFO "提示信息" +#define MESSAGE_IS_CLOSE_SERVER "是否真的关闭服务器?" +#define MESSAGE_IS_CLOSE_OVER "服务器关闭指令已发出" + +struct _ClientConnectInfo +{ + char m_szIP[50]; //IP地址信息 + int m_nConnectID; //链接的ID + int m_nRecvCount; //接收包数量 + int m_nSendCount; //发送包数量 + int m_nAllRecvSize; //接收字节数 + int m_nAllSendSize; //发送字节数 + int m_nBeginTime; //链接建立时间 + int m_nAliveTime; //存活时间秒数 + int m_nRecvQueueCount; //接受逻辑处理包的个数 + long long m_nRecvQueueTimeCost; //接受逻辑处理包总时间消耗 + long long m_nSendQueueTimeCost; //发送数据总时间消耗 + + _ClientConnectInfo() + { + m_szIP[0] = '\0'; + m_nConnectID = 0; + m_nRecvCount = 0; + m_nSendCount = 0; + m_nAllRecvSize = 0; + m_nAllSendSize = 0; + m_nBeginTime = 0; + m_nAliveTime = 0; + m_nRecvQueueCount = 0; + m_nRecvQueueTimeCost = 0; + m_nSendQueueTimeCost = 0; + } +}; + + +#endif diff --git a/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.cpp b/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.cpp new file mode 100644 index 000000000..150445ecd --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.cpp @@ -0,0 +1,33 @@ +/*************************************************************** + * Name: PSS_ClientManagerApp.cpp + * Purpose: Code for Application Class + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PSS_ClientManagerApp.h" + +//(*AppHeaders +#include "../../TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.h" +#include +//*) + +IMPLEMENT_APP(PSS_ClientManagerApp); + +bool PSS_ClientManagerApp::OnInit() +{ + //(*AppInitialize + bool wxsOK = true; + wxInitAllImageHandlers(); + if ( wxsOK ) + { + PSS_ClientManagerFrame* Frame = new PSS_ClientManagerFrame(0); + Frame->Show(); + SetTopWindow(Frame); + } + //*) + return wxsOK; + +} diff --git a/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.h b/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.h new file mode 100644 index 000000000..90b3ac036 --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerApp.h @@ -0,0 +1,21 @@ +/*************************************************************** + * Name: PSS_ClientManagerApp.h + * Purpose: Defines Application Class + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSS_CLIENTMANAGERAPP_H +#define PSS_CLIENTMANAGERAPP_H + +#include + +class PSS_ClientManagerApp : public wxApp +{ +public: + virtual bool OnInit(); +}; + +#endif // PSS_CLIENTMANAGERAPP_H diff --git a/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.cpp b/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.cpp new file mode 100644 index 000000000..f960e641b --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.cpp @@ -0,0 +1,3884 @@ +/*************************************************************** + * Name: PSS_ClientManagerMain.cpp + * Purpose: Code for Application Frame + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PSS_ClientManagerMain.h" +#include + +//(*InternalHeaders(PSS_ClientManagerFrame) +#include +#include +#include +#include +#include +//*) + +//helper functions +enum wxbuildinfoformat +{ + short_f, long_f +}; + +wxString wxbuildinfo(wxbuildinfoformat format) +{ + wxString wxbuild(wxVERSION_STRING); + + if (format == long_f ) + { +#if defined(__WXMSW__) + wxbuild << wxT("-Windows"); +#elif defined(__UNIX__) + wxbuild << wxT("-Linux"); +#endif + +#if wxUSE_UNICODE + wxbuild << wxT("-Unicode build"); +#else + wxbuild << wxT("-ANSI build"); +#endif // wxUSE_UNICODE + } + + return wxbuild; +} + +//(*IdInit(PSS_ClientManagerFrame) +const long PSS_ClientManagerFrame::ID_STATICBOX1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX2 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT2 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL2 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT3 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL3 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON2 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON3 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTBOX1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON4 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON5 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT4 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL4 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT5 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL5 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT6 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL6 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT7 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL7 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON6 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON7 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON8 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL38 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX3 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX4 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON9 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT8 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL8 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT9 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL9 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT10 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL10 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON10 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT11 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL11 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON11 = wxNewId(); +const long PSS_ClientManagerFrame::ID_RADIOBOX1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT12 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL12 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON12 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON13 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT13 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL13 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT14 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL14 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON14 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT15 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL15 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON15 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL2 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL2 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX5 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT16 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL16 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON16 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON17 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT17 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL3 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON18 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON19 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON20 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL4 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL3 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX6 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT18 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL17 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON21 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON22 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL5 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT19 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL18 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON23 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON24 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL6 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL4 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX7 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON25 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL7 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX8 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT20 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL19 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT21 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL20 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT22 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON26 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON27 = wxNewId(); +const long PSS_ClientManagerFrame::ID_CHECKBOX1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL8 = wxNewId(); +const long PSS_ClientManagerFrame::ID_RADIOBOX2 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL9 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON28 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON29 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL5 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX9 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON30 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT23 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL21 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON31 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL10 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL11 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON32 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX10 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT24 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT25 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT26 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL22 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL23 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT27 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL24 = wxNewId(); +const long PSS_ClientManagerFrame::ID_COMBOBOX1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON33 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON34 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL6 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX11 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT28 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL25 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT29 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL26 = wxNewId(); +const long PSS_ClientManagerFrame::ID_RADIOBOX3 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON35 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON36 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON37 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL12 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT30 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT31 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL27 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL28 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON38 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON39 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON40 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL13 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL7 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX12 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL14 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT32 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT33 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL29 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON41 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL30 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL31 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL32 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON42 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON43 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON44 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT35 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT36 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL33 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT37 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL34 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL8 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX13 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICBOX14 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL15 = wxNewId(); +const long PSS_ClientManagerFrame::ID_CHECKBOX2 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT34 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL35 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT38 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT39 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL36 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT40 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT41 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TEXTCTRL37 = wxNewId(); +const long PSS_ClientManagerFrame::ID_STATICTEXT42 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON45 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON46 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL16 = wxNewId(); +const long PSS_ClientManagerFrame::ID_LISTCTRL17 = wxNewId(); +const long PSS_ClientManagerFrame::ID_BUTTON47 = wxNewId(); +const long PSS_ClientManagerFrame::ID_PANEL9 = wxNewId(); +const long PSS_ClientManagerFrame::ID_NOTEBOOK1 = wxNewId(); +const long PSS_ClientManagerFrame::ID_TIMER1 = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(PSS_ClientManagerFrame,wxFrame) + //(*EventTable(PSS_ClientManagerFrame) + //*) +END_EVENT_TABLE() + +PSS_ClientManagerFrame::PSS_ClientManagerFrame(wxWindow* parent,wxWindowID id) +{ + //(*Initialize(PSS_ClientManagerFrame) + Create(parent, wxID_ANY, wxT("PSS_ClientManager"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxMINIMIZE_BOX, _T("wxID_ANY")); + SetClientSize(wxSize(923,506)); + { + wxIcon FrameIcon; + FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("./small.ico")))); + SetIcon(FrameIcon); + } + Notebook1 = new wxNotebook(this, ID_NOTEBOOK1, wxPoint(0,-16), wxSize(1240,506), 0, _T("ID_NOTEBOOK1")); + Panel1 = new wxPanel(Notebook1, ID_PANEL1, wxDefaultPosition, wxSize(899,461), wxTAB_TRAVERSAL, _T("ID_PANEL1")); + StaticBox1 = new wxStaticBox(Panel1, ID_STATICBOX1, wxT("服务器管理接口信息"), wxPoint(8,8), wxSize(832,224), 0, _T("ID_STATICBOX1")); + StaticBox2 = new wxStaticBox(Panel1, ID_STATICBOX2, wxT("模块信息"), wxPoint(8,232), wxSize(832,224), 0, _T("ID_STATICBOX2")); + StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, wxT("服务器IP"), wxPoint(16,40), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, wxT("服务器密钥"), wxPoint(16,80), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + TextCtrl_ServerIP = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxT("127.0.0.1"), wxPoint(88,32), wxSize(114,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); + TextCtrl_ServerIP->SetMaxLength(16); + TextCtrl_ServerKey = new wxTextCtrl(Panel1, ID_TEXTCTRL2, wxT("freeeyes"), wxPoint(88,72), wxSize(114,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); + StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, wxT("服务器端口"), wxPoint(216,40), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + TextCtrl_ServerPort = new wxTextCtrl(Panel1, ID_TEXTCTRL3, wxT("10010"), wxPoint(284,32), wxSize(114,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL3")); + TextCtrl_ServerPort->SetMaxLength(5); + Button_Set = new wxButton(Panel1, ID_BUTTON1, wxT("设置"), wxPoint(400,32), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); + Button_GetServerstate = new wxButton(Panel1, ID_BUTTON2, wxT("获得服务器状态"), wxPoint(496,32), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); + Button_CloseServer = new wxButton(Panel1, ID_BUTTON3, wxT("关闭服务器(远程服务器必须允许关闭才能生效)"), wxPoint(216,72), wxSize(392,35), 0, wxDefaultValidator, _T("ID_BUTTON3")); + ListBox_ConfigList = new wxListBox(Panel1, ID_LISTBOX1, wxPoint(616,72), wxSize(136,152), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1")); + ListBox_ConfigList->SetSelection( ListBox_ConfigList->Append(_("Windows PSS")) ); + ListBox_ConfigList->Append(_("Linux PSS")); + Button_LoadConfigfile = new wxButton(Panel1, ID_BUTTON4, wxT("从配置文件加载"), wxPoint(616,32), wxSize(136,34), 0, wxDefaultValidator, _T("ID_BUTTON4")); + Button_ShowAllModule = new wxButton(Panel1, ID_BUTTON5, wxT("显示所有模块"), wxPoint(24,264), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5")); + StaticText4 = new wxStaticText(Panel1, ID_STATICTEXT4, wxT("模块路径"), wxPoint(136,272), wxDefaultSize, 0, _T("ID_STATICTEXT4")); + TextCtrl_ModulePath = new wxTextCtrl(Panel1, ID_TEXTCTRL4, wxEmptyString, wxPoint(200,264), wxSize(160,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL4")); + StaticText5 = new wxStaticText(Panel1, ID_STATICTEXT5, wxT("文件名称"), wxPoint(368,272), wxDefaultSize, 0, _T("ID_STATICTEXT5")); + TextCtrl_ModuleFilename = new wxTextCtrl(Panel1, ID_TEXTCTRL5, wxEmptyString, wxPoint(432,264), wxSize(210,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL5")); + StaticText6 = new wxStaticText(Panel1, ID_STATICTEXT6, wxT("模块名称"), wxPoint(24,312), wxDefaultSize, 0, _T("ID_STATICTEXT6")); + TextCtrl_ModuleName = new wxTextCtrl(Panel1, ID_TEXTCTRL6, wxEmptyString, wxPoint(88,304), wxSize(168,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL6")); + StaticText7 = new wxStaticText(Panel1, ID_STATICTEXT7, wxT("模块参数"), wxPoint(264,312), wxDefaultSize, 0, _T("ID_STATICTEXT7")); + TextCtrl_ModuleParam = new wxTextCtrl(Panel1, ID_TEXTCTRL7, wxEmptyString, wxPoint(328,304), wxSize(218,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL7")); + Button_LoadModule = new wxButton(Panel1, ID_BUTTON6, wxT("加载"), wxPoint(664,264), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON6")); + Button_UnloadModule = new wxButton(Panel1, ID_BUTTON7, wxT("卸载"), wxPoint(560,304), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON7")); + Button_ReloadModule = new wxButton(Panel1, ID_BUTTON8, wxT("重载"), wxPoint(664,304), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON8")); + ListCtrl_ModuleList = new wxListCtrl(Panel1, ID_LISTCTRL1, wxPoint(16,344), wxSize(736,112), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL1")); + TextCtrl_ServerInfo = new wxTextCtrl(Panel1, ID_TEXTCTRL38, wxEmptyString, wxPoint(16,112), wxSize(592,112), wxTE_MULTILINE|wxTE_RICH|wxTE_RICH2, wxDefaultValidator, _T("ID_TEXTCTRL38")); + Panel2 = new wxPanel(Notebook1, ID_PANEL2, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL2")); + StaticBox3 = new wxStaticBox(Panel2, ID_STATICBOX3, wxT("链接信息历史记录"), wxPoint(16,248), wxSize(808,200), 0, _T("ID_STATICBOX3")); + StaticBox4 = new wxStaticBox(Panel2, ID_STATICBOX4, wxT("链接信息"), wxPoint(16,8), wxSize(808,240), 0, _T("ID_STATICBOX4")); + Button_GetCurrClientCount = new wxButton(Panel2, ID_BUTTON9, wxT("获得当前客户端链接个数"), wxPoint(32,32), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON9")); + StaticText8 = new wxStaticText(Panel2, ID_STATICTEXT8, wxT("当前链接数量"), wxPoint(210,40), wxDefaultSize, 0, _T("ID_STATICTEXT8")); + TextCtrl_CurrClientCount = new wxTextCtrl(Panel2, ID_TEXTCTRL8, wxEmptyString, wxPoint(296,36), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL8")); + TextCtrl_CurrClientCount->Disable(); + StaticText9 = new wxStaticText(Panel2, ID_STATICTEXT9, wxT("当前流量(入)"), wxPoint(416,40), wxDefaultSize, 0, _T("ID_STATICTEXT9")); + TextCtrl_CurrFlowIn = new wxTextCtrl(Panel2, ID_TEXTCTRL9, wxEmptyString, wxPoint(496,36), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL9")); + TextCtrl_CurrFlowIn->Disable(); + StaticText10 = new wxStaticText(Panel2, ID_STATICTEXT10, wxT("当前流量(出)"), wxPoint(616,40), wxDefaultSize, 0, _T("ID_STATICTEXT10")); + TextCtrl_CurrFlowOut = new wxTextCtrl(Panel2, ID_TEXTCTRL10, wxEmptyString, wxPoint(696,36), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL10")); + TextCtrl_CurrFlowOut->Disable(); + Button_SetLinkLimit = new wxButton(Panel2, ID_BUTTON10, wxT("重新设置上限"), wxPoint(32,72), wxSize(152,34), 0, wxDefaultValidator, _T("ID_BUTTON10")); + StaticText11 = new wxStaticText(Panel2, ID_STATICTEXT11, wxT("链接总数上限"), wxPoint(210,80), wxDefaultSize, 0, _T("ID_STATICTEXT11")); + TextCtrl_LinkUpperLimit = new wxTextCtrl(Panel2, ID_TEXTCTRL11, wxEmptyString, wxPoint(296,76), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL11")); + Button_SetDebug = new wxButton(Panel2, ID_BUTTON11, wxT("设置DEBUG"), wxPoint(32,112), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON11")); + wxString __wxRadioBoxChoices_1[2] = + { + _("DEBUG开启"), + _("DEBUG关闭") + }; + RadioBox_DebugState = new wxRadioBox(Panel2, ID_RADIOBOX1, wxEmptyString, wxPoint(144,106), wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, wxRA_VERTICAL|wxBORDER_NONE, wxDefaultValidator, _T("ID_RADIOBOX1")); + RadioBox_DebugState->SetSelection(0); + StaticText12 = new wxStaticText(Panel2, ID_STATICTEXT12, wxT("获得DEBUG状态"), wxPoint(504,120), wxDefaultSize, 0, _T("ID_STATICTEXT12")); + TextCtrl_CurrDebugStat = new wxTextCtrl(Panel2, ID_TEXTCTRL12, wxEmptyString, wxPoint(616,116), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL12")); + TextCtrl_CurrDebugStat->Disable(); + Button_GetDebugState = new wxButton(Panel2, ID_BUTTON12, wxT("获取DEBUG"), wxPoint(400,112), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON12")); + Button_StartFile = new wxButton(Panel2, ID_BUTTON13, wxT("启动文件"), wxPoint(32,160), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON13")); + StaticText13 = new wxStaticText(Panel2, ID_STATICTEXT13, wxT("当前CPU消耗"), wxPoint(40,208), wxDefaultSize, 0, _T("ID_STATICTEXT13")); + TextCtrl_CurrCpuOccupy = new wxTextCtrl(Panel2, ID_TEXTCTRL13, wxEmptyString, wxPoint(136,204), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL13")); + TextCtrl_CurrCpuOccupy->Disable(); + StaticText14 = new wxStaticText(Panel2, ID_STATICTEXT14, wxT("当前内存消耗"), wxPoint(256,208), wxDefaultSize, 0, _T("ID_STATICTEXT14")); + TextCtrl_CurrMemOccupy = new wxTextCtrl(Panel2, ID_TEXTCTRL14, wxEmptyString, wxPoint(360,204), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL14")); + TextCtrl_CurrMemOccupy->Disable(); + Button_StopFile = new wxButton(Panel2, ID_BUTTON14, wxT("停止文件"), wxPoint(136,160), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON14")); + StaticText15 = new wxStaticText(Panel2, ID_STATICTEXT15, wxT("数据包文件路径"), wxPoint(256,168), wxDefaultSize, 0, _T("ID_STATICTEXT15")); + TextCtrl_PacketFile = new wxTextCtrl(Panel2, ID_TEXTCTRL15, wxT("FileTestCfg.xml"), wxPoint(360,160), wxSize(440,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL15")); + Button_GetLinkHistory = new wxButton(Panel2, ID_BUTTON15, wxT("获得当前链接历史"), wxPoint(24,280), wxSize(224,32), 0, wxDefaultValidator, _T("ID_BUTTON15")); + ListCtrl_LinkHistory = new wxListCtrl(Panel2, ID_LISTCTRL2, wxPoint(24,320), wxSize(776,120), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL2")); + Panel3 = new wxPanel(Notebook1, ID_PANEL3, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL3")); + StaticBox5 = new wxStaticBox(Panel3, ID_STATICBOX5, wxT("模块调用信息"), wxPoint(8,8), wxSize(824,448), 0, _T("ID_STATICBOX5")); + StaticText16 = new wxStaticText(Panel3, ID_STATICTEXT16, wxT("命令ID"), wxPoint(24,40), wxDefaultSize, 0, _T("ID_STATICTEXT16")); + TextCtrl_ModuleID = new wxTextCtrl(Panel3, ID_TEXTCTRL16, wxEmptyString, wxPoint(88,36), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL16")); + Button_ShowModuleCmd = new wxButton(Panel3, ID_BUTTON16, wxT("查看命令"), wxPoint(232,32), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON16")); + Button_ShowAllCmd = new wxButton(Panel3, ID_BUTTON17, wxT("查看全部"), wxPoint(360,32), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON17")); + Button_ShowAllCmd->Disable(); + StaticText17 = new wxStaticText(Panel3, ID_STATICTEXT17, wxT("命令ID格式为十六进制,比如0X1000"), wxPoint(456,40), wxDefaultSize, 0, _T("ID_STATICTEXT17")); + ListCtrl_ModuleInfo = new wxListCtrl(Panel3, ID_LISTCTRL3, wxPoint(24,80), wxSize(792,168), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL3")); + Button_ShowTimeoutCmd = new wxButton(Panel3, ID_BUTTON18, wxT("查看超时命令"), wxPoint(40,256), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON18")); + Button_ClearTimeoutCmd = new wxButton(Panel3, ID_BUTTON19, wxT("清除超时命令"), wxPoint(176,256), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON19")); + Button_SaveSmdHistory = new wxButton(Panel3, ID_BUTTON20, wxT("保存命令日志"), wxPoint(312,256), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON20")); + ListCtrl_CommandTimeout = new wxListCtrl(Panel3, ID_LISTCTRL4, wxPoint(24,304), wxSize(792,144), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL4")); + Panel4 = new wxPanel(Notebook1, ID_PANEL4, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL4")); + StaticBox6 = new wxStaticBox(Panel4, ID_STATICBOX6, wxT("链接管理"), wxPoint(8,8), wxSize(824,448), 0, _T("ID_STATICBOX6")); + StaticText18 = new wxStaticText(Panel4, ID_STATICTEXT18, wxT("要停止的客户端链接ID"), wxPoint(24,32), wxDefaultSize, 0, _T("ID_STATICTEXT18")); + TextCtrl_ClientID = new wxTextCtrl(Panel4, ID_TEXTCTRL17, wxEmptyString, wxPoint(168,28), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL17")); + Button_DisconnectClient = new wxButton(Panel4, ID_BUTTON21, wxT("断开链接"), wxPoint(304,24), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON21")); + Button_ShowClient = new wxButton(Panel4, ID_BUTTON22, wxT("查看TCP"), wxPoint(408,24), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON22")); + ListCtrl_ClientTcpInfo = new wxListCtrl(Panel4, ID_LISTCTRL5, wxPoint(24,64), wxSize(792,192), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL5")); + StaticText19 = new wxStaticText(Panel4, ID_STATICTEXT19, wxT("当前日志等级"), wxPoint(16,272), wxDefaultSize, 0, _T("ID_STATICTEXT19")); + TextCtrl_LogLevel = new wxTextCtrl(Panel4, ID_TEXTCTRL18, wxT("1"), wxPoint(112,268), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL18")); + Button_SetLogLevel = new wxButton(Panel4, ID_BUTTON23, wxT("设置日志等级"), wxPoint(232,264), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON23")); + Button_ShowCurrLoginfo = new wxButton(Panel4, ID_BUTTON24, wxT("查看当前日志项"), wxPoint(352,264), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON24")); + ListCtrl_LogInfo = new wxListCtrl(Panel4, ID_LISTCTRL6, wxPoint(24,312), wxSize(792,136), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL6")); + Panel5 = new wxPanel(Notebook1, ID_PANEL5, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL5")); + StaticBox7 = new wxStaticBox(Panel5, ID_STATICBOX7, wxT("工作线程状态"), wxPoint(8,8), wxSize(832,448), 0, _T("ID_STATICBOX7")); + Button_ShowWorkThreadStat = new wxButton(Panel5, ID_BUTTON25, wxT("查看工作线程状态"), wxPoint(24,32), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON25")); + ListCtrl_WorkThreadInfo = new wxListCtrl(Panel5, ID_LISTCTRL7, wxPoint(24,72), wxSize(808,160), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL7")); + StaticBox8 = new wxStaticBox(Panel5, ID_STATICBOX8, wxT("设置监控参数"), wxPoint(16,240), wxSize(816,216), 0, _T("ID_STATICBOX8")); + StaticText20 = new wxStaticText(Panel5, ID_STATICTEXT20, wxT("当前工作线程个数"), wxPoint(20,264), wxDefaultSize, 0, _T("ID_STATICTEXT20")); + TextCtrl_ThreadCount = new wxTextCtrl(Panel5, ID_TEXTCTRL19, wxT("3"), wxPoint(128,260), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL19")); + StaticText21 = new wxStaticText(Panel5, ID_STATICTEXT21, wxT("检查间隔"), wxPoint(244,264), wxDefaultSize, 0, _T("ID_STATICTEXT21")); + TextCtrl_CheckTime = new wxTextCtrl(Panel5, ID_TEXTCTRL20, wxT("60"), wxPoint(304,260), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL20")); + StaticText22 = new wxStaticText(Panel5, ID_STATICTEXT22, wxT("秒"), wxPoint(418,264), wxDefaultSize, 0, _T("ID_STATICTEXT22")); + Button_StartMonitor = new wxButton(Panel5, ID_BUTTON26, wxT("开始监控"), wxPoint(480,256), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON26")); + Button_StopMonitor = new wxButton(Panel5, ID_BUTTON27, wxT("停止监控"), wxPoint(584,256), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON27")); + CheckBox_Voice = new wxCheckBox(Panel5, ID_CHECKBOX1, wxT("开启声音报警"), wxPoint(680,260), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1")); + CheckBox_Voice->SetValue(false); + ListCtrl_CheckLog = new wxListCtrl(Panel5, ID_LISTCTRL8, wxPoint(24,296), wxSize(448,152), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL8")); + wxString __wxRadioBoxChoices_2[2] = + { + _("监控当前服务器"), + _("监控列表服务器") + }; + RadioBox_MonitorServer = new wxRadioBox(Panel5, ID_RADIOBOX2, wxEmptyString, wxPoint(480,282), wxSize(336,48), 2, __wxRadioBoxChoices_2, 1, wxRA_VERTICAL|wxBORDER_NONE, wxDefaultValidator, _T("ID_RADIOBOX2")); + RadioBox_MonitorServer->SetSelection(0); + ListCtrl_ServerList = new wxListCtrl(Panel5, ID_LISTCTRL9, wxPoint(480,336), wxSize(344,72), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL9")); + Button_LoadFile = new wxButton(Panel5, ID_BUTTON28, wxT("从文件中加载"), wxPoint(480,416), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON28")); + Button_ClearLoad = new wxButton(Panel5, ID_BUTTON29, wxT("清除加载"), wxPoint(736,416), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON29")); + Panel6 = new wxPanel(Notebook1, ID_PANEL6, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL6")); + StaticBox9 = new wxStaticBox(Panel6, ID_STATICBOX9, wxT("服务器间链接管理"), wxPoint(0,8), wxSize(856,440), 0, _T("ID_STATICBOX9")); + Button_ShowServerLinkInfo = new wxButton(Panel6, ID_BUTTON30, wxT("查看服务器间链接信息"), wxPoint(16,32), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON30")); + StaticText23 = new wxStaticText(Panel6, ID_STATICTEXT23, wxT("服务器ID"), wxPoint(16,76), wxDefaultSize, 0, _T("ID_STATICTEXT23")); + TextCtrl_ServerID = new wxTextCtrl(Panel6, ID_TEXTCTRL21, wxEmptyString, wxPoint(72,72), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL21")); + Button_ReconnectServer = new wxButton(Panel6, ID_BUTTON31, wxT("重新连接"), wxPoint(200,70), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON31")); + ListCtrl_ServerConnect = new wxListCtrl(Panel6, ID_LISTCTRL10, wxPoint(16,112), wxSize(824,136), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL10")); + ListCtrl_ServerLisen = new wxListCtrl(Panel6, ID_LISTCTRL11, wxPoint(16,296), wxSize(328,136), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL11")); + Button_ShowPSSLisenInfo = new wxButton(Panel6, ID_BUTTON32, wxT("查看PSS监听信息"), wxPoint(8,256), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON32")); + StaticBox10 = new wxStaticBox(Panel6, ID_STATICBOX10, wxT("动态添加和关闭监听端口"), wxPoint(368,256), wxSize(472,184), 0, _T("ID_STATICBOX10")); + StaticText24 = new wxStaticText(Panel6, ID_STATICTEXT24, wxT("监听IP"), wxPoint(392,288), wxDefaultSize, 0, _T("ID_STATICTEXT24")); + StaticText25 = new wxStaticText(Panel6, ID_STATICTEXT25, wxT("监听端口"), wxPoint(392,328), wxDefaultSize, 0, _T("ID_STATICTEXT25")); + StaticText26 = new wxStaticText(Panel6, ID_STATICTEXT26, wxT("IP类型"), wxPoint(392,368), wxDefaultSize, 0, _T("ID_STATICTEXT26")); + TextCtrl_LisenIP = new wxTextCtrl(Panel6, ID_TEXTCTRL22, wxEmptyString, wxPoint(456,284), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL22")); + TextCtrl_LisenIP->SetMaxLength(16); + TextCtrl_LisenPort = new wxTextCtrl(Panel6, ID_TEXTCTRL23, wxT("0"), wxPoint(456,324), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL23")); + TextCtrl_LisenPort->SetMaxLength(5); + StaticText27 = new wxStaticText(Panel6, ID_STATICTEXT27, wxT("解析模块 ID"), wxPoint(600,328), wxDefaultSize, 0, _T("ID_STATICTEXT27")); + TextCtrl_PacketParseID = new wxTextCtrl(Panel6, ID_TEXTCTRL24, wxEmptyString, wxPoint(688,324), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL24")); + ComboBox_ListenType = new wxComboBox(Panel6, ID_COMBOBOX1, wxEmptyString, wxPoint(456,364), wxSize(112,25), 0, 0, 0, wxDefaultValidator, _T("ID_COMBOBOX1")); + ComboBox_ListenType->SetSelection( ComboBox_ListenType->Append(_("IPv4")) ); + ComboBox_ListenType->Append(_("IPv6")); + Button_InsertNewMonitor = new wxButton(Panel6, ID_BUTTON33, wxT("添加新监听"), wxPoint(392,400), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON33")); + Button_DeleteOldMonitor = new wxButton(Panel6, ID_BUTTON34, wxT("停止已有监听"), wxPoint(560,400), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON34")); + Panel7 = new wxPanel(Notebook1, ID_PANEL7, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL7")); + StaticBox11 = new wxStaticBox(Panel7, ID_STATICBOX11, wxT("IP封禁管理"), wxPoint(8,0), wxSize(792,440), 0, _T("ID_STATICBOX11")); + StaticText28 = new wxStaticText(Panel7, ID_STATICTEXT28, wxT("要封禁的IP地址(支持*)"), wxPoint(24,28), wxDefaultSize, 0, _T("ID_STATICTEXT28")); + TextCtrl_ForbidenIP = new wxTextCtrl(Panel7, ID_TEXTCTRL25, wxEmptyString, wxPoint(160,24), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL25")); + TextCtrl_ForbidenIP->SetMaxLength(16); + StaticText29 = new wxStaticText(Panel7, ID_STATICTEXT29, wxT("要封禁的秒数"), wxPoint(312,28), wxDefaultSize, 0, _T("ID_STATICTEXT29")); + TextCtrl_ForbidenSeconds = new wxTextCtrl(Panel7, ID_TEXTCTRL26, wxEmptyString, wxPoint(400,24), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL26")); + wxString __wxRadioBoxChoices_3[2] = + { + _("时段封禁"), + _("永久封禁") + }; + RadioBoxm_TimeForbiden = new wxRadioBox(Panel7, ID_RADIOBOX3, wxEmptyString, wxPoint(536,6), wxSize(240,50), 2, __wxRadioBoxChoices_3, 1, wxRA_VERTICAL|wxBORDER_NONE, wxDefaultValidator, _T("ID_RADIOBOX3")); + RadioBoxm_TimeForbiden->SetSelection(0); + Button_InsertForbiden = new wxButton(Panel7, ID_BUTTON35, wxT("添加封禁"), wxPoint(24,64), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON35")); + Button_ReleaseForbiden = new wxButton(Panel7, ID_BUTTON36, wxT("解除封禁"), wxPoint(144,64), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON36")); + Button_ShowForbiden = new wxButton(Panel7, ID_BUTTON37, wxT("查看列表"), wxPoint(264,64), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON37")); + ListCtrl_ForbidenList = new wxListCtrl(Panel7, ID_LISTCTRL12, wxPoint(24,104), wxSize(768,160), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL12")); + StaticText30 = new wxStaticText(Panel7, ID_STATICTEXT30, wxT("要查看的连接别名"), wxPoint(24,280), wxDefaultSize, 0, _T("ID_STATICTEXT30")); + StaticText31 = new wxStaticText(Panel7, ID_STATICTEXT31, wxT("ConnectID"), wxPoint(24,312), wxDefaultSize, 0, _T("ID_STATICTEXT31")); + TextCtrl_NickName = new wxTextCtrl(Panel7, ID_TEXTCTRL27, wxEmptyString, wxPoint(128,276), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL27")); + TextCtrl_ConnectID = new wxTextCtrl(Panel7, ID_TEXTCTRL28, wxEmptyString, wxPoint(128,308), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL28")); + Button_SearchNickname = new wxButton(Panel7, ID_BUTTON38, wxT("查询别名"), wxPoint(264,272), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON38")); + Button_OpenLog = new wxButton(Panel7, ID_BUTTON39, wxT("打开日志"), wxPoint(264,312), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON39")); + Button_Closelog = new wxButton(Panel7, ID_BUTTON40, wxT("关闭日志"), wxPoint(360,312), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON40")); + ListCtrl_NickInfo = new wxListCtrl(Panel7, ID_LISTCTRL13, wxPoint(24,352), wxSize(768,104), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL13")); + Panel8 = new wxPanel(Notebook1, ID_PANEL8, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL8")); + StaticBox12 = new wxStaticBox(Panel8, ID_STATICBOX12, wxT("设置跟踪的IP"), wxPoint(8,8), wxSize(816,184), 0, _T("ID_STATICBOX12")); + ListCtrl_TrackIPHistory = new wxListCtrl(Panel8, ID_LISTCTRL14, wxPoint(8,200), wxSize(816,256), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL14")); + StaticText32 = new wxStaticText(Panel8, ID_STATICTEXT32, wxT("要查询的ConnectID"), wxPoint(24,40), wxDefaultSize, 0, _T("ID_STATICTEXT32")); + StaticText33 = new wxStaticText(Panel8, ID_STATICTEXT33, wxT("染色的IP地址"), wxPoint(24,80), wxDefaultSize, 0, _T("ID_STATICTEXT33")); + TextCtr_TrackConnectID = new wxTextCtrl(Panel8, ID_TEXTCTRL29, wxEmptyString, wxPoint(152,32), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL29")); + Button_GetTrackSourceIP = new wxButton(Panel8, ID_BUTTON41, wxT("查询IP来源"), wxPoint(304,32), wxSize(96,35), 0, wxDefaultValidator, _T("ID_BUTTON41")); + TextCtrl_IPInfo = new wxTextCtrl(Panel8, ID_TEXTCTRL30, wxEmptyString, wxPoint(408,32), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL30")); + TextCtrl_IPInfo->Disable(); + TextCtr_TrackIP = new wxTextCtrl(Panel8, ID_TEXTCTRL31, wxT("127.0.0.1"), wxPoint(152,72), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL31")); + TextCtrl_TrackIPCount = new wxTextCtrl(Panel8, ID_TEXTCTRL32, wxT("1"), wxPoint(408,72), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL32")); + Button_SetTrackCommandID = new wxButton(Panel8, ID_BUTTON42, wxT("设置CommandID"), wxPoint(560,112), wxSize(128,35), 0, wxDefaultValidator, _T("ID_BUTTON42")); + Button_SetTrackIP = new wxButton(Panel8, ID_BUTTON43, wxT("设置IP"), wxPoint(560,72), wxSize(128,35), 0, wxDefaultValidator, _T("ID_BUTTON43")); + Button_ShowTrackCommandID = new wxButton(Panel8, ID_BUTTON44, wxT("染色的CommandID信息"), wxPoint(16,152), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON44")); + StaticText35 = new wxStaticText(Panel8, ID_STATICTEXT35, wxT("染色数据个数"), wxPoint(312,80), wxDefaultSize, 0, _T("ID_STATICTEXT35")); + StaticText36 = new wxStaticText(Panel8, ID_STATICTEXT36, wxT("染色的CommandID"), wxPoint(24,120), wxDefaultSize, 0, _T("ID_STATICTEXT36")); + TextCtrl_TrackCommandID = new wxTextCtrl(Panel8, ID_TEXTCTRL33, wxT("0x1000"), wxPoint(152,112), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL33")); + StaticText37 = new wxStaticText(Panel8, ID_STATICTEXT37, wxT("染色数据个数"), wxPoint(312,120), wxDefaultSize, 0, _T("ID_STATICTEXT37")); + TextCtrl_TracCommandCount = new wxTextCtrl(Panel8, ID_TEXTCTRL34, wxT("1"), wxPoint(408,112), wxSize(136,35), 0, wxDefaultValidator, _T("ID_TEXTCTRL34")); + Panel9 = new wxPanel(Notebook1, ID_PANEL9, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL9")); + StaticBox13 = new wxStaticBox(Panel9, ID_STATICBOX13, wxT("静态"), wxPoint(8,8), wxSize(864,224), 0, _T("ID_STATICBOX13")); + StaticBox14 = new wxStaticBox(Panel9, ID_STATICBOX14, wxT("静态"), wxPoint(8,240), wxSize(864,216), 0, _T("ID_STATICBOX14")); + ListCtrl_WorkThreadAI = new wxListCtrl(Panel9, ID_LISTCTRL15, wxPoint(16,40), wxSize(600,184), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL15")); + CheckBox_WorkThread = new wxCheckBox(Panel9, ID_CHECKBOX2, wxT("WorkThreadAI是否开启"), wxPoint(632,40), wxSize(184,24), 0, wxDefaultValidator, _T("ID_CHECKBOX2")); + CheckBox_WorkThread->SetValue(false); + StaticText34 = new wxStaticText(Panel9, ID_STATICTEXT34, wxT("超时时间"), wxPoint(632,72), wxDefaultSize, 0, _T("ID_STATICTEXT34")); + TextCtrl_WorkThreadDisposeTime = new wxTextCtrl(Panel9, ID_TEXTCTRL35, wxT("40"), wxPoint(704,64), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL35")); + StaticText38 = new wxStaticText(Panel9, ID_STATICTEXT38, wxT("毫秒"), wxPoint(816,72), wxDefaultSize, 0, _T("ID_STATICTEXT38")); + StaticText39 = new wxStaticText(Panel9, ID_STATICTEXT39, wxT("时间区间"), wxPoint(632,112), wxDefaultSize, 0, _T("ID_STATICTEXT39")); + TextCtrl_WorkThreadCheckTime = new wxTextCtrl(Panel9, ID_TEXTCTRL36, wxT("30"), wxPoint(704,104), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL36")); + StaticText40 = new wxStaticText(Panel9, ID_STATICTEXT40, wxT("秒"), wxPoint(816,112), wxDefaultSize, 0, _T("ID_STATICTEXT40")); + StaticText41 = new wxStaticText(Panel9, ID_STATICTEXT41, wxT("中断时间"), wxPoint(632,152), wxDefaultSize, 0, _T("ID_STATICTEXT41")); + TextCtrl_WorkThreadStopTime = new wxTextCtrl(Panel9, ID_TEXTCTRL37, wxT("30"), wxPoint(704,144), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL37")); + StaticText42 = new wxStaticText(Panel9, ID_STATICTEXT42, wxT("秒"), wxPoint(816,152), wxDefaultSize, 0, _T("ID_STATICTEXT42")); + Button_ResetWorkThread = new wxButton(Panel9, ID_BUTTON45, wxT("重新设置"), wxPoint(632,192), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON45")); + Button_GetWorkThreadParam = new wxButton(Panel9, ID_BUTTON46, wxT("工作线程AI参数"), wxPoint(720,192), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON46")); + ListCtr_WorkThreadTimeout = new wxListCtrl(Panel9, ID_LISTCTRL16, wxPoint(16,264), wxSize(408,184), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL16")); + ListCtrl_WorkThreadForbiden = new wxListCtrl(Panel9, ID_LISTCTRL17, wxPoint(440,264), wxSize(280,184), wxLC_REPORT|wxLC_SINGLE_SEL|wxBORDER_STATIC, wxDefaultValidator, _T("ID_LISTCTRL17")); + Button_GetWorkThreadPool = new wxButton(Panel9, ID_BUTTON47, wxT("查询当前AI数据池"), wxPoint(728,408), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON47")); + Notebook1->AddPage(Panel1, wxT("客户端主模块管理"), false); + Notebook1->AddPage(Panel2, wxT("客户端鏈接管理模块"), false); + Notebook1->AddPage(Panel3, wxT("客户端主模块运行信息"), false); + Notebook1->AddPage(Panel4, wxT("客户端链接管理"), false); + Notebook1->AddPage(Panel5, wxT("工作线程状态"), false); + Notebook1->AddPage(Panel6, wxT("服务器间链接信息"), false); + Notebook1->AddPage(Panel7, wxT("IP封禁管理"), false); + Notebook1->AddPage(Panel8, wxT("数据染色"), false); + Notebook1->AddPage(Panel9, wxT("工作线程AI相关"), false); + Timer_WorkThread.SetOwner(this, ID_TIMER1); + Timer_WorkThread.Start(60000, false); + Center(); + + Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_SetClick); + Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_GetServerstateClick); + Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_CloseServerClick); + Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_SELECTED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnListBox_ConfigListSelect); + Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_LoadConfigfileClick); + Connect(ID_BUTTON5,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowAllModuleClick); + Connect(ID_TEXTCTRL6,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnTextCtrl_ModuleNmaeText); + Connect(ID_BUTTON6,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_LoadModuleClick); + Connect(ID_BUTTON7,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_UnloadModuleClick); + Connect(ID_BUTTON8,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ReloadModuleClick); + Connect(ID_LISTCTRL1,wxEVT_COMMAND_LIST_ITEM_SELECTED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnListCtrl_ModuleListItemSelect); + Connect(ID_BUTTON9,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_GetCurrClientCountClick); + Connect(ID_TEXTCTRL8,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnTextCtrl_CurrLinkCountText); + Connect(ID_BUTTON10,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_SetLinkLimitClick); + Connect(ID_BUTTON11,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_SetDebugClick); + Connect(ID_BUTTON12,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_GetDebugStateClick); + Connect(ID_BUTTON13,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_StartFileClick); + Connect(ID_BUTTON14,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_StopFileClick); + Connect(ID_BUTTON15,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_GetLinkHistoryClick); + Connect(ID_TEXTCTRL16,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnTextCtrl_ModuleIDText); + Connect(ID_BUTTON16,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowModuleCmdClick); + Connect(ID_BUTTON17,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowAllCmdClick); + Connect(ID_BUTTON18,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowTimeoutCmdClick); + Connect(ID_BUTTON19,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ClearTimeoutCmdClick); + Connect(ID_BUTTON20,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_SaveSmdHistoryClick); + Connect(ID_BUTTON21,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_DisconnectClientClick); + Connect(ID_BUTTON22,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowClientClick); + Connect(ID_BUTTON23,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_SetLogLevelClick); + Connect(ID_BUTTON24,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowCurrLoginfoClick); + Connect(ID_BUTTON25,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowWorkThreadStatClick); + Connect(ID_BUTTON26,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_StartMonitorClick); + Connect(ID_BUTTON27,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_StopMonitorClick); + Connect(ID_BUTTON28,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_LoadFileClick); + Connect(ID_BUTTON29,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ClearLoadClick); + Connect(ID_BUTTON30,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowServerLinkInfoClick); + Connect(ID_BUTTON31,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ReconnectServerClick); + Connect(ID_BUTTON32,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowPSSLisenInfoClick); + Connect(ID_BUTTON33,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_InsertNewMonitorClick); + Connect(ID_BUTTON34,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_DeleteOldMonitorClick); + Connect(ID_BUTTON35,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_InsertForbidenClick); + Connect(ID_BUTTON36,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ReleaseForbidenClick); + Connect(ID_BUTTON37,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowForbidenClick); + Connect(ID_BUTTON38,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_SearchNicknameClick); + Connect(ID_BUTTON39,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_OpenLogClick); + Connect(ID_BUTTON40,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_CloselogClick); + Connect(ID_BUTTON41,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_GetTrackSourceIPClick); + Connect(ID_BUTTON42,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_SetTrackCommandIDClick); + Connect(ID_BUTTON43,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_SetTrackIPClick); + Connect(ID_BUTTON44,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ShowTrackCommandIDClick); + Connect(ID_BUTTON45,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_ResetWorkThreadClick); + Connect(ID_BUTTON46,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_GetWorkThreadParamClick); + Connect(ID_BUTTON47,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnButton_GetWorkThreadPoolClick); + Connect(ID_TIMER1,wxEVT_TIMER,(wxObjectEventFunction)&PSS_ClientManagerFrame::OnTimer_WorkThreadTrigger); + //*) + + + + + + this->ListCtrl_ModuleList->InsertColumn(0, wxT("当前已加载模块"), wxLIST_FORMAT_CENTER, 120); + this->ListCtrl_ModuleList->InsertColumn(1, wxT("模块名称"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ModuleList->InsertColumn(2, wxT("模块路径"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ModuleList->InsertColumn(3, wxT("模块参数"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ModuleList->InsertColumn(4, wxT("模块描述"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ModuleList->InsertColumn(5, wxT("加载时间"), wxLIST_FORMAT_CENTER, 150); + this->ListCtrl_ModuleList->InsertColumn(6, wxT("当前状态"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ModuleList->InsertColumn(7, wxT("状态ID"), wxLIST_FORMAT_CENTER, 80); + + + this->ListCtrl_LinkHistory->InsertColumn(0, wxT("IP地址"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_LinkHistory->InsertColumn(1, wxT("单位时间链接次数"), wxLIST_FORMAT_CENTER, 150); + this->ListCtrl_LinkHistory->InsertColumn(2, wxT("总链接数"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_LinkHistory->InsertColumn(3, wxT("最后链接时间"), wxLIST_FORMAT_CENTER, 200); + + + + this->ListCtrl_ModuleInfo->InsertColumn(0, wxT("模块名称"), wxLIST_FORMAT_CENTER, 200); + this->ListCtrl_ModuleInfo->InsertColumn(1, wxT("命令ID"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_ModuleInfo->InsertColumn(2, wxT("调用次数"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_ModuleInfo->InsertColumn(3, wxT("时间消耗"), wxLIST_FORMAT_CENTER, 200); + + this->ListCtrl_CommandTimeout->InsertColumn(0, wxT("命令ID"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_CommandTimeout->InsertColumn(1, wxT("发生时间"), wxLIST_FORMAT_CENTER, 200); + this->ListCtrl_CommandTimeout->InsertColumn(2, wxT("超时时间"), wxLIST_FORMAT_CENTER, 100); + + + + + this->ListCtrl_ClientTcpInfo->InsertColumn(0, wxT("IP地址"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_ClientTcpInfo->InsertColumn(1, wxT("Socketfd"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ClientTcpInfo->InsertColumn(2, wxT("发送包数"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ClientTcpInfo->InsertColumn(3, wxT("接收包数"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ClientTcpInfo->InsertColumn(4, wxT("发送字节"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ClientTcpInfo->InsertColumn(5, wxT("接收字节"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ClientTcpInfo->InsertColumn(6, wxT("创建时间"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ClientTcpInfo->InsertColumn(7, wxT("存活秒数"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ClientTcpInfo->InsertColumn(8, wxT("逻辑处理包数"), wxLIST_FORMAT_CENTER, 120); + + this->ListCtrl_LogInfo->InsertColumn(0, wxT("日志ID"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_LogInfo->InsertColumn(1, wxT("日志前缀"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_LogInfo->InsertColumn(2, wxT("日志名称"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_LogInfo->InsertColumn(3, wxT("打印or写文件"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_LogInfo->InsertColumn(4, wxT("日志等级"), wxLIST_FORMAT_CENTER, 100); + + + + + + this->ListCtrl_WorkThreadInfo->InsertColumn(0, wxT("线程名称"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadInfo->InsertColumn(1, wxT("线程ID"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadInfo->InsertColumn(2, wxT("线程创建时间"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadInfo->InsertColumn(3, wxT("最后执行时间"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadInfo->InsertColumn(4, wxT("处理包数量"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_WorkThreadInfo->InsertColumn(5, wxT("当前处理ID"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_WorkThreadInfo->InsertColumn(6, wxT("平均耗时"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_WorkThreadInfo->InsertColumn(7, wxT("单位处理量"), wxLIST_FORMAT_CENTER, 80); + + + + this->ListCtrl_ServerConnect->InsertColumn(0, wxT("ID"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_ServerConnect->InsertColumn(1, wxT("IP地址"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_ServerConnect->InsertColumn(2, wxT("连接状态"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ServerConnect->InsertColumn(3, wxT("发送包数"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ServerConnect->InsertColumn(4, wxT("接收包数"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ServerConnect->InsertColumn(5, wxT("发送字节"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ServerConnect->InsertColumn(6, wxT("接收字节"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ServerConnect->InsertColumn(7, wxT("创建时间"), wxLIST_FORMAT_CENTER, 80); + this->ListCtrl_ServerConnect->InsertColumn(8, wxT("存活秒数"), wxLIST_FORMAT_CENTER, 80); + + this->ListCtrl_ServerLisen->InsertColumn(0, wxT("监听IP"), wxLIST_FORMAT_CENTER, 200); + this->ListCtrl_ServerLisen->InsertColumn(1, wxT("监听端口"), wxLIST_FORMAT_CENTER, 100); + + + + + + this->ListCtrl_ForbidenList->InsertColumn(0, wxT("IP地址"), wxLIST_FORMAT_CENTER, 150); + this->ListCtrl_ForbidenList->InsertColumn(1, wxT("封禁类型"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_ForbidenList->InsertColumn(2, wxT("封禁开始时间"), wxLIST_FORMAT_CENTER, 200); + this->ListCtrl_ForbidenList->InsertColumn(3, wxT("封禁持续秒数"), wxLIST_FORMAT_CENTER, 100); + + this->ListCtrl_NickInfo->InsertColumn(0, wxT("ConnectID"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_NickInfo->InsertColumn(1, wxT("别名"), wxLIST_FORMAT_CENTER, 150); + this->ListCtrl_NickInfo->InsertColumn(2, wxT("客户端IP"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_NickInfo->InsertColumn(3, wxT("端口"), wxLIST_FORMAT_CENTER, 50); + this->ListCtrl_NickInfo->InsertColumn(4, wxT("日志状态"), wxLIST_FORMAT_CENTER, 50); + + + this->ListCtrl_TrackIPHistory->InsertColumn(0, wxT("命令ID"), wxLIST_FORMAT_CENTER, 150); + this->ListCtrl_TrackIPHistory->InsertColumn(1, wxT("当前已染色包数"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_TrackIPHistory->InsertColumn(2, wxT("最大染色包数"), wxLIST_FORMAT_CENTER, 100); + + + + + + + this->ListCtrl_WorkThreadAI->InsertColumn(0, wxT("线程ID"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadAI->InsertColumn(1, wxT("AI开关"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadAI->InsertColumn(2, wxT("处理超时时间"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadAI->InsertColumn(3, wxT("判断时间区间"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadAI->InsertColumn(4, wxT("区间内超时次数"), wxLIST_FORMAT_CENTER, 100); + this->ListCtrl_WorkThreadAI->InsertColumn(5, wxT("命令中断时间"), wxLIST_FORMAT_CENTER, 100); + + this->ListCtr_WorkThreadTimeout->InsertColumn(0, wxT("线程ID"), wxLIST_FORMAT_CENTER, 50); + this->ListCtr_WorkThreadTimeout->InsertColumn(1, wxT("命令ID"), wxLIST_FORMAT_CENTER, 50); + this->ListCtr_WorkThreadTimeout->InsertColumn(2, wxT("时间"), wxLIST_FORMAT_CENTER, 120); + this->ListCtr_WorkThreadTimeout->InsertColumn(3, wxT("执行时间"), wxLIST_FORMAT_CENTER, 50); + + this->ListCtrl_WorkThreadForbiden->InsertColumn(0, wxT("线程ID"), wxLIST_FORMAT_CENTER, 50); + this->ListCtrl_WorkThreadForbiden->InsertColumn(1, wxT("命令ID"), wxLIST_FORMAT_CENTER, 50); + this->ListCtrl_WorkThreadForbiden->InsertColumn(2, wxT("到期时间"), wxLIST_FORMAT_CENTER, 120); + + this->Init(); + +} + +PSS_ClientManagerFrame::~PSS_ClientManagerFrame() +{ + //(*Destroy(PSS_ClientManagerFrame) + //*) + + delete m_pTcpClientConnect; +} + + +void PSS_ClientManagerFrame::Init() +{ + + + //初始化TCP链接 + + InitializeSocketEnvironment(); + + // m_sckClient =new CSockWrap(SOCK_STREAM); + + this->LoadConfigFile(); + this->ChangeConfigFile(); + + std::string strServerIP =std::string(this->TextCtrl_ServerIP->GetValue()); + std::string strConsoleKey =std::string(this->TextCtrl_ServerKey->GetValue()); + int nPort = wxAtoi(this->TextCtrl_ServerPort->GetValue()); + + m_pTcpClientConnect =new CTcpClientConnect(); + m_pTcpClientConnect->Init(strServerIP.c_str(), nPort, strConsoleKey.c_str()); + + m_blTimeRun = false; + + +} + + +void PSS_ClientManagerFrame::OnQuit(wxCommandEvent& event) +{ + Close(); +} + +void PSS_ClientManagerFrame::OnAbout(wxCommandEvent& event) +{ + wxString msg = wxbuildinfo(long_f); + wxMessageBox(msg, wxT("Welcome to...")); +} + +void PSS_ClientManagerFrame::OnButton_ReloadModuleClick(wxCommandEvent& event) +{ + + //重载模块 + wxCSConv cvGBK( wxT("GBK") ); + std::string strModuleName =std::string( cvGBK.cWX2MB( this->TextCtrl_ModuleName->GetValue().c_str() ) ); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ReLoadModule %s&", m_pTcpClientConnect->GetKey(), strModuleName.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if(nResult == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_RESULT_FAIL), wxOK | wxICON_INFORMATION, this); + } + } + + this->OnButton_ShowAllModuleClick(event); + + +} + +void PSS_ClientManagerFrame::OnButton_UnloadModuleClick(wxCommandEvent& event) +{ + + //卸载模块 + wxCSConv cvGBK( wxT("GBK") ); + std::string strModuleName =std::string( cvGBK.cWX2MB( this->TextCtrl_ModuleName->GetValue().c_str() ) ); + + if(strModuleName.length() == 0) + { + wxMessageBox(wxT(MESSAGE_INSERT_NULL), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s UnLoadModule %s&", m_pTcpClientConnect->GetKey(), strModuleName.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if(nResult == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } + + this->OnButton_ShowAllModuleClick(event); + +} + +void PSS_ClientManagerFrame::OnTextCtrl_ModuleNmaeText(wxCommandEvent& event) +{ +} + +void PSS_ClientManagerFrame::OnButton_CloseServerClick(wxCommandEvent& event) +{ + // TODO: 关闭服务器 + if (wxMessageBox(wxT(MESSAGE_IS_CLOSE_SERVER), wxT(MESSAGE_TITLE_INFO), wxOK | wxICON_INFORMATION, this) == wxOK) + { + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ServerClose -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + wxMessageBox(wxT(MESSAGE_IS_CLOSE_OVER), wxT(MESSAGE_TITLE_INFO), wxOK | wxICON_INFORMATION, this); + } + +} + + + +void PSS_ClientManagerFrame::ChangeConfigFile() +{ + //设置相关属性 + + int nSel = this->ListBox_ConfigList->GetSelection(); + + if ((nSel < 0) || (nSel >= m_vecConfigInfo.size() )) + { + return; + } + + this->TextCtrl_ServerIP->SetValue(wxString(m_vecConfigInfo[nSel].m_szIP)); + this->TextCtrl_ServerPort->SetValue(wxString::Format(wxT("%d"),m_vecConfigInfo[nSel].m_nPort)); + this->TextCtrl_ServerKey->SetValue(wxString(m_vecConfigInfo[nSel].m_szMagicCode)); + +} + + +void PSS_ClientManagerFrame::OnListBox_ConfigListSelect(wxCommandEvent& event) +{ + this->ChangeConfigFile(); + +} + +void PSS_ClientManagerFrame::OnListCtrl_ModuleListItemSelect(wxListEvent& event) +{ + int nIndex = this->ListCtrl_ModuleList->GetNextItem(-1,wxLIST_NEXT_ALL,wxLIST_STATE_SELECTED); + + if(nIndex != -1) + { + this->TextCtrl_ModulePath->SetValue(this->ListCtrl_ModuleList->GetItemText(nIndex, 2)); + this->TextCtrl_ModuleFilename->SetValue(this->ListCtrl_ModuleList->GetItemText(nIndex, 0)); + + this->TextCtrl_ModuleName->SetValue(this->ListCtrl_ModuleList->GetItemText(nIndex, 1)); + this->TextCtrl_ModuleParam->SetValue(this->ListCtrl_ModuleList->GetItemText(nIndex, 3)); + } + +} + +void PSS_ClientManagerFrame::OnButton_GetCurrLinkCountClick(wxCommandEvent& event) +{ +} + +void PSS_ClientManagerFrame::OnButton_SetLinkLimitClick(wxCommandEvent& event) +{ + //重新设置上限 + int nMaxConnectCount = wxAtoi(this->TextCtrl_LinkUpperLimit->GetValue()); + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s SetMaxConnectCount -n %d &", m_pTcpClientConnect->GetKey(), nMaxConnectCount); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nOPState = 0; + memcpy_s(&nOPState, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if(nOPState == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_SetDebugClick(wxCommandEvent& event) +{ + + //设置DEBUG状态 + int nType = this->RadioBox_DebugState->GetSelection(); + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s SetDebug -s %d &", m_pTcpClientConnect->GetKey(), nType); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(int); + + if(nResult == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + this->OnButton_GetDebugStateClick(event); + // OnBnClickedButton5(); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } + + +} + +void PSS_ClientManagerFrame::OnButton_GetDebugStateClick(wxCommandEvent& event) +{ + //获得DEBUG状态 + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ShowDebug -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(int); + + if(nResult == 0) + { + this->TextCtrl_CurrDebugStat->SetValue(wxT("DEBUG日志关闭")); + } + else + { + this->TextCtrl_CurrDebugStat->SetValue(wxT("DEBUG日志打开")); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_StartFileClick(wxCommandEvent& event) +{ + //启动文件 + wxCSConv cvGBK( wxT("GBK") ); + std::string strPacketFileName =std::string( cvGBK.cWX2MB( this->TextCtrl_PacketFile->GetValue().c_str() ) ); + + char szSendMessage[200] = { '\0' }; + char szCommand[100] = { '\0' }; + sprintf_s(szCommand, 100, "%s TestFileStart -f %s&", m_pTcpClientConnect->GetKey(), strPacketFileName.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = { '\0' }; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if (blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nOPState = 0; + memcpy_s(&nOPState, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if (nOPState == 0) + { + wxString strTxt; + int nData = 0; + char szTemp[1024] = { '\0' }; + char szCommandDesc[1024] = { '\0' }; + memcpy_s(&nData, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + sprintf(szTemp, ("TimeInterval:[%d]&"), nData); + strTxt += szTemp; + memcpy_s(&nData, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + sprintf(szTemp, ("ProcolCount:[%d]&"), nData); + strTxt += szTemp; + memcpy_s(&nData, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + int nCount = nData; + + for (int i = 0; i < nCount; i++) + { + memcpy_s(&nData, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&szCommandDesc, nData, &szRecvBuff[nPos], nData); + szCommandDesc[nData] = '\0'; + nPos += nData; + //wchar_t szDesc[1024] = { '\0' }; + + //int nSrcLen = MultiByteToWideChar(CP_UTF8, 0, szCommandDesc, -1, NULL, 0); + //int nDecLen = MultiByteToWideChar(CP_UTF8, 0, szCommandDesc, -1, szDesc, 1024); + + sprintf(szTemp, ("CommandDesc:[%s]&"), szCommandDesc); + strTxt += szTemp; + } + + wxMessageBox(wxString(strTxt), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_StopFileClick(wxCommandEvent& event) +{ + + //停止测试 + char szSendMessage[200] = { '\0' }; + char szCommand[100] = { '\0' }; + sprintf_s(szCommand, 100, "%s TestFileStop -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = { '\0' }; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if (blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nOPState = 0; + memcpy_s(&nOPState, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if (nOPState == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } +} + +void PSS_ClientManagerFrame::OnButton_GetLinkHistoryClick(wxCommandEvent& event) +{ + this->ListCtrl_LinkHistory->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ShowConnectHistory -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + vecIPAccount objvecIPAccount; + + int nStrLen = 0; + int nPos = 0; + int nTCPCount = 0; + memcpy_s(&nTCPCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nTCPCount; i++) + { + //开始还原数据结构 + _IPAccount IPAccount; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(IPAccount.m_szIP, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + IPAccount.m_szIP[nStrLen] = '\0'; + + memcpy_s(&IPAccount.m_nCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&IPAccount.m_nAllCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(IPAccount.m_szDate, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + IPAccount.m_szDate[nStrLen] = '\0'; + + //显示在界面上 + + this->ListCtrl_LinkHistory->InsertItem(i, wxString(IPAccount.m_szIP)); + this->ListCtrl_LinkHistory->InsertItem(i, wxString::Format(wxT("%d"),IPAccount.m_nCount)); + this->ListCtrl_LinkHistory->InsertItem(i, wxString::Format(wxT("%d"),IPAccount.m_nAllCount)); + this->ListCtrl_LinkHistory->InsertItem(i, wxString(IPAccount.m_szDate)); + + objvecIPAccount.push_back(IPAccount); + } + + } + +} + +void PSS_ClientManagerFrame::OnTextCtrl_CurrLinkCountText(wxCommandEvent& event) +{ +} + +void PSS_ClientManagerFrame::OnButton_GetCurrClientCountClick(wxCommandEvent& event) +{ + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ClientCount -cp&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nConnectCount = 0; + int nFreeCount = 0; + int nMaxConnectCount = 0; + memcpy_s(&nConnectCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&nFreeCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&nMaxConnectCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + this->TextCtrl_LinkUpperLimit->SetValue(wxString::Format(wxT("%d"),nMaxConnectCount)); + this->TextCtrl_CurrClientCount->SetValue(wxString::Format(wxT("%d"),nConnectCount)); + + } + + //获得CPU和内存占用量 + sprintf_s(szCommand, 100, "%s ShowCurrProcessInfo -a&", m_pTcpClientConnect->GetKey()); + nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + nRecvLen = 10 * 1024; + blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nCpuRote = 0; + int nMemoryRote = 0; + char cFlow = 0; + int nFlowIn = 0; + int nFlowOut = 0; + + memcpy_s(&nCpuRote, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&nMemoryRote, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&cFlow, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + memcpy_s(&nFlowIn, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&nFlowOut, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + + this->TextCtrl_CurrCpuOccupy->SetValue(wxString::Format(wxT("%f"), (float)nCpuRote/100.0f)); + this->TextCtrl_CurrMemOccupy->SetValue(wxString::Format(wxT("%f"), (float)nMemoryRote/(1000.0f*1000.0f))); + + + + if(cFlow == 0) + { + this->TextCtrl_CurrFlowIn->SetValue(wxString("关闭")); + this->TextCtrl_CurrFlowOut->SetValue(wxString("关闭")); + } + else + { + this->TextCtrl_CurrFlowIn->SetValue(wxString::Format(wxT("%d"), nFlowIn)); + this->TextCtrl_CurrFlowOut->SetValue(wxString::Format(wxT("%d"),nFlowOut)); + } + } + +} + +void PSS_ClientManagerFrame::OnTextCtrl_ModuleIDText(wxCommandEvent& event) +{ +} + +void PSS_ClientManagerFrame::OnButton_ShowModuleCmdClick(wxCommandEvent& event) +{ + //查看指定命令 + wxCSConv cvGBK( wxT("GBK") ); + std::string strCommandID =std::string( cvGBK.cWX2MB( this->TextCtrl_ModuleID->GetValue().c_str() ) ); + + if(strCommandID.length() == 0) + { + wxMessageBox(wxT(MESSAGE_INSERT_NULL), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + this->ListCtrl_ModuleInfo->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s CommandInfo %s&", m_pTcpClientConnect->GetKey(), strCommandID.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + vecCommandInfo objvecCommandInfo; + + int nIndex = 0; + int nStrLen = 0; + int nPos = 0; + int nCommandCount = 0; + int nCommandInfoCount = 0; + memcpy_s(&nCommandCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy(&nCommandInfoCount, &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + for(int i = 0; i < nCommandInfoCount; i++) + { + //开始还原数据结构 + _CommandInfo CommandInfo; + /* + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(CommandInfo.szModuleName, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + CommandInfo.szModuleName[nStrLen] = '\0'; + */ + + int nCommandID = 0; + memcpy_s(&nCommandID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + sprintf_s(CommandInfo.szCommandID, 200, "0x%04x", nCommandID); + + memcpy_s(&CommandInfo.m_nCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&CommandInfo.m_nTimeCost, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + + this->ListCtrl_ModuleInfo->InsertItem(nIndex, wxString(CommandInfo.szModuleName)); + this->ListCtrl_ModuleInfo->SetItem(nIndex, 1, wxString(CommandInfo.szCommandID)); + this->ListCtrl_ModuleInfo->SetItem(nIndex, 2, wxString::Format(wxT("%d"),CommandInfo.m_nCount)); + this->ListCtrl_ModuleInfo->SetItem(nIndex, 3, wxString::Format(wxT("%d"),CommandInfo.m_nTimeCost)); + + + nIndex++; + + objvecCommandInfo.push_back(CommandInfo); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_ShowAllCmdClick(wxCommandEvent& event) +{ + //查看全部 + this->ListCtrl_ModuleInfo->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ShowAllCommand -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + vecCommandInfo objvecCommandInfo; + + int nIndex = 0; + int nStrLen = 0; + int nPos = 0; + int nModuleCount = 0; + int nCommandCount = 0; + memcpy_s(&nModuleCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nModuleCount; i++) + { + + memcpy(&nCommandCount, &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int j = 0; j < nCommandCount; j++) + { + //开始还原数据结构 + _CommandInfo CommandInfo; + /* + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(CommandInfo.szModuleName, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + CommandInfo.szModuleName[nStrLen] = '\0'; + */ + + int nCommandID = 0; + memcpy_s(&nCommandID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + sprintf_s(CommandInfo.szCommandID, 200, "0x%04x", nCommandID); + + memcpy_s(&CommandInfo.m_nCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&CommandInfo.m_nTimeCost, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + this->ListCtrl_ModuleInfo->InsertItem(nIndex, wxString(CommandInfo.szModuleName)); + this->ListCtrl_ModuleInfo->SetItem(nIndex, 1, wxString(CommandInfo.szCommandID)); + this->ListCtrl_ModuleInfo->SetItem(nIndex, 2, wxString::Format(wxT("%d"),CommandInfo.m_nCount)); + this->ListCtrl_ModuleInfo->SetItem(nIndex, 3, wxString::Format(wxT("%d"),CommandInfo.m_nTimeCost)); + + nIndex++; + + objvecCommandInfo.push_back(CommandInfo); + } + } + } +} + +void PSS_ClientManagerFrame::OnButton_ShowTimeoutCmdClick(wxCommandEvent& event) +{ + //查看全部 + this->ListCtrl_CommandTimeout->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + char szCommandID[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s CommandTimeout -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nIndex = 0; + int nStrLen = 0; + int nPos = 0; + int nModuleCount = 0; + + memcpy_s(&nModuleCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nModuleCount; i++) + { + //开始还原数据结构 + _CommandTimeOut objCommandTimeOut; + memcpy_s(&objCommandTimeOut.nCommandID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + sprintf_s(szCommandID, 100, "0x%04x", objCommandTimeOut.nCommandID); + + char szUpdateTime[30] = {'\0'}; + memcpy_s(&objCommandTimeOut.nTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate; + time_t newRawTime = objCommandTimeOut.nTime; + localtime_s(&tmDate, &newRawTime); + sprintf_s(szUpdateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate.tm_mon + 1, + tmDate.tm_mday, + tmDate.tm_hour, + tmDate.tm_min, + tmDate.tm_sec); + + + memcpy_s(&objCommandTimeOut.nTimeOutTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + this->ListCtrl_CommandTimeout->InsertItem(nIndex, wxString(szCommandID)); + this->ListCtrl_CommandTimeout->SetItem(nIndex, 1, wxString(szUpdateTime)); + this->ListCtrl_CommandTimeout->SetItem(nIndex, 2, wxString::Format(wxT("%d"),objCommandTimeOut.nTimeOutTime)); + + + nIndex++; + } + } + +} + +void PSS_ClientManagerFrame::OnButton_ClearTimeoutCmdClick(wxCommandEvent& event) +{ + + //清除所有超时记录 + this->ListCtrl_CommandTimeout->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + char szCommandID[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s CommandTimeoutclr -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + return; + } + +} + +void PSS_ClientManagerFrame::OnButton_SaveSmdHistoryClick(wxCommandEvent& event) +{ + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + char szCommandID[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s CommandDataLog -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + return; + } +} + +void PSS_ClientManagerFrame::OnButton_DisconnectClientClick(wxCommandEvent& event) +{ + + + //断开链接 + int szScoketFD = wxAtoi(this->TextCtrl_ClientID->GetValue()); + + if(szScoketFD == 0) + { + wxMessageBox(wxT(MESSAGE_INSERT_NULL), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s CloseClient %d&", m_pTcpClientConnect->GetKey(), szScoketFD); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nOPState = 0; + memcpy_s(&nOPState, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&nOPState, sizeof(char), &szRecvBuff[4], sizeof(char)); + + if(nOPState == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_ShowClientClick(wxCommandEvent& event) +{ + + //查看TCP + this->ListCtrl_LogInfo->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ConnectClient -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + vecClientConnectInfo objvecClientConnectInfo; + + int nStrLen = 0; + int nPos = 0; + int nTCPCount = 0; + memcpy_s(&nTCPCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nTCPCount; i++) + { + //开始还原数据结构 + _ClientConnectInfo ClientConnectInfo; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ClientConnectInfo.m_szIP, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ClientConnectInfo.m_szIP[nStrLen] = '\0'; + + memcpy_s(&ClientConnectInfo.m_nConnectID, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nRecvCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nSendCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nAllRecvSize, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nAllSendSize, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + char szUpdateTime[30] = {'\0'}; + memcpy_s(&ClientConnectInfo.m_nBeginTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate; + time_t newRawTime = ClientConnectInfo.m_nBeginTime; + localtime_s(&tmDate, &newRawTime); + sprintf_s(szUpdateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate.tm_mon + 1, + tmDate.tm_mday, + tmDate.tm_hour, + tmDate.tm_min, + tmDate.tm_sec); + + memcpy_s(&ClientConnectInfo.m_nAliveTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nRecvQueueCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nRecvQueueTimeCost, sizeof(long long), &szRecvBuff[nPos], sizeof(long long)); + nPos += sizeof(long long); + + memcpy_s(&ClientConnectInfo.m_nSendQueueTimeCost, sizeof(long long), &szRecvBuff[nPos], sizeof(long long)); + nPos += sizeof(long long); + + //显示在界面上 + + this->ListCtrl_LogInfo->InsertItem(i, wxString(ClientConnectInfo.m_szIP)); + this->ListCtrl_LogInfo->SetItem(i, 1, wxString::Format(wxT("%d"), ClientConnectInfo.m_nConnectID)); + this->ListCtrl_LogInfo->SetItem(i, 2, wxString::Format(wxT("%d"), ClientConnectInfo.m_nSendCount)); + this->ListCtrl_LogInfo->SetItem(i, 3, wxString::Format(wxT("%d"), ClientConnectInfo.m_nRecvCount)); + this->ListCtrl_LogInfo->SetItem(i, 4, wxString::Format(wxT("%d"), ClientConnectInfo.m_nAllSendSize)); + this->ListCtrl_LogInfo->SetItem(i, 5, wxString::Format(wxT("%d"), ClientConnectInfo.m_nAllRecvSize)); + this->ListCtrl_LogInfo->SetItem(i, 6, wxString(szUpdateTime)); + this->ListCtrl_LogInfo->SetItem(i, 7, wxString::Format(wxT("%d"), ClientConnectInfo.m_nAliveTime)); + this->ListCtrl_LogInfo->SetItem(i, 8, wxString::Format(wxT("%d"), ClientConnectInfo.m_nRecvQueueCount)); + + objvecClientConnectInfo.push_back(ClientConnectInfo); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_SetLogLevelClick(wxCommandEvent& event) +{ + + //设置当前日志等级 + int nLevel = wxAtoi(this->TextCtrl_LogLevel->GetValue()); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s SetLogLevel -l %d&", m_pTcpClientConnect->GetKey(), nLevel); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nPos = 0; + int nResult = 0; + + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if(nResult == 0) + { + //设置日志等级成功 + wxMessageBox(wxString("设置日志等级成功"), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_ShowCurrLoginfoClick(wxCommandEvent& event) +{ + //查看当前日志项 + this->ListCtrl_LogInfo->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s GetLogInfo -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nTCPCount = 0; + int nLogCount = 0; + int nCurrLogLevel = 0; + + + memcpy_s(&nLogCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&nCurrLogLevel, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + + this->TextCtrl_LogLevel->SetValue(wxString::Format(wxT("%d"), nCurrLogLevel)); + + + for(int i = 0; i < nLogCount; i++) + { + int nLogID = 0; + char szServerName[300] = {'\0'}; + char szLogName[300] = {'\0'}; + int nDisplay = 0; + int nLogLevel = 0; + memcpy_s(&nLogID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(szServerName, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + szServerName[nStrLen] = '\0'; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(szLogName, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + szLogName[nStrLen] = '\0'; + + memcpy_s(&nDisplay, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + //显示在界面上 + this->ListCtrl_LogInfo->InsertItem(i, wxString::Format(wxT("%d"), nLogID)); + this->ListCtrl_LogInfo->SetItem(i, 1, wxString(szServerName)); + this->ListCtrl_LogInfo->SetItem(i, 2, wxString(szLogName)); + + if(nDisplay == 0) + { + this->ListCtrl_LogInfo->SetItem(i, 3, wxString("写文件")); + } + else + { + this->ListCtrl_LogInfo->SetItem(i, 3, wxString("写屏幕")); + } + + memcpy_s(&nLogLevel, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + this->ListCtrl_LogInfo->SetItem(i, 4, wxString::Format(wxT("%d"), nLogLevel)); + } + } + + +} + +void PSS_ClientManagerFrame::OnButton_StartMonitorClick(wxCommandEvent& event) +{ + + //开始监控 + int nCheckThreadCount = wxAtoi(this->TextCtrl_ThreadCount->GetValue()); + int nTimeInterval = wxAtoi(this->TextCtrl_CheckTime->GetValue()); + + if(m_blTimeRun == true) + { + //如果正在监控,先停止上一次的监控 + this->Timer_WorkThread.Stop(); + } + + //开始监控的相关准备工作 + if(this->RadioBox_MonitorServer->GetSelection() ==0) + { + //当前监控 + m_vecCheckServerInfo.clear(); + + _CheckServerInfo* pCheckServerInfo = new _CheckServerInfo(); + + pCheckServerInfo->m_objTcpClientConnect.Init(m_pTcpClientConnect->GetServerIP(), m_pTcpClientConnect->GetServerPort(), m_pTcpClientConnect->GetServerKey()); + pCheckServerInfo->m_nCheckThreadCount = nCheckThreadCount; + pCheckServerInfo->m_pWorkThreadInfo = new _WorkThreadInfo[nCheckThreadCount]; + m_vecCheckServerInfo.push_back(pCheckServerInfo); + } + else + { + //群体监控 + + } + + this->ListCtrl_CheckLog->DeleteAllItems(); + + wxDateTime tm =wxDateTime::Now(); + + this->Timer_WorkThread.Start(nTimeInterval * 1000); + m_blTimeRun = true; + + this->ListCtrl_CheckLog->InsertItem(this->ListCtrl_CheckLog->GetItemCount(),tm.Format(wxString("[%Y-%m-%d %X]"))+ wxT("开始监控...")); + this->ListCtrl_CheckLog->Refresh(); + +} + +void PSS_ClientManagerFrame::OnButton_StopMonitorClick(wxCommandEvent& event) +{ + //停止监控 + this->Timer_WorkThread.Stop(); + m_blTimeRun = false; + + ClearCheckServerInfo(); + + + wxDateTime tm =wxDateTime::Now(); + this->ListCtrl_CheckLog->InsertItem(this->ListCtrl_CheckLog->GetItemCount(),tm.Format(wxString("[%Y-%m-%d %X]"))+ wxT("停止监控...")); + + int nCount = this->ListCtrl_CheckLog->GetItemCount(); + + if (nCount > 0) + { + this->ListCtrl_CheckLog->SetItemState(nCount - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); + } + +} + +void PSS_ClientManagerFrame::OnTimer_WorkThreadTrigger(wxTimerEvent& event) +{ + + + for(int i = 0; i < (int)m_vecCheckServerInfo.size(); i++) + { + CheckWorkThread(m_vecCheckServerInfo[i]); + } + +} + + + + +void PSS_ClientManagerFrame::CheckWorkThread(_CheckServerInfo* pCheckServerInfo) +{ + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s WorkThreadState -s&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = pCheckServerInfo->m_objTcpClientConnect.SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + vecWorkThreadInfo objvecWorkThreadInfo; + + int nStrLen = 0; + int nPos = 0; + int nThreadCount = 0; + memcpy_s(&nThreadCount, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + if(nThreadCount != pCheckServerInfo->m_nCheckThreadCount) + { + char szError[1024] = {'\0'}; + wchar_t szzError[1024] = {'\0'}; + + sprintf_s(szError,1024, "[%s:%d]监控线程数不符,当前服务器线程数[%d],当前监控线程数[%d]", pCheckServerInfo->m_objTcpClientConnect.GetServerIP(), pCheckServerInfo->m_objTcpClientConnect.GetServerPort(), nThreadCount, pCheckServerInfo->m_nCheckThreadCount); + + + this->ListCtrl_CheckLog->InsertItem(this->ListCtrl_CheckLog->GetItemCount(),wxString(szError)); + + int nCount = this->ListCtrl_CheckLog->GetItemCount(); + + if (nCount > 0) + { + this->ListCtrl_CheckLog->SetItemState(nCount - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); + } + + BeepAlarm(); + + return; + } + + //接收到的所有工作线程信息 + for(int i = 0; i < nThreadCount; i++) + { + //开始还原数据结构 + _WorkThreadInfo WorkThreadInfo; + sprintf_s(WorkThreadInfo.m_szThreadName, 50, "工作线程"); + + memcpy_s(&WorkThreadInfo.m_nThreadID, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + char szUpdateTime[30] = {'\0'}; + memcpy_s(&WorkThreadInfo.m_nUpdateTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate; + time_t newRawTime = WorkThreadInfo.m_nUpdateTime; + localtime_s(&tmDate, &newRawTime); + sprintf_s(szUpdateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate.tm_mon + 1, + tmDate.tm_mday, + tmDate.tm_hour, + tmDate.tm_min, + tmDate.tm_sec); + + char szCreateTime[30] = {'\0'}; + memcpy_s(&WorkThreadInfo.m_nCreateTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate1; + time_t newRawTime1 = WorkThreadInfo.m_nCreateTime; + localtime_s(&tmDate1, &newRawTime1); + sprintf_s(szCreateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate1.tm_mon + 1, + tmDate1.tm_mday, + tmDate1.tm_hour, + tmDate1.tm_min, + tmDate1.tm_sec); + + memcpy_s(&WorkThreadInfo.m_nState, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(&WorkThreadInfo.m_nRecvPacketCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&WorkThreadInfo.m_nCommandID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + memcpy_s(&WorkThreadInfo.m_nPacketTime, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + memcpy_s(&WorkThreadInfo.m_nCurrPacketCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + objvecWorkThreadInfo.push_back(WorkThreadInfo); + } + + for(int i = 0; i < pCheckServerInfo->m_nCheckThreadCount; i++) + { + if(pCheckServerInfo->m_pWorkThreadInfo[i].m_nCreateTime == 0) + { + //第一次调用,只拷贝 + pCheckServerInfo->m_pWorkThreadInfo[i] = objvecWorkThreadInfo[i]; + } + else + { + //如果是已有数据,进行比较判定 + if(pCheckServerInfo->m_pWorkThreadInfo[i].m_nCreateTime != objvecWorkThreadInfo[i].m_nCreateTime) + { + char szError[1024] = {'\0'}; + char szThreadTime[100] = {'\0'}; + char szCurrTime[100] = {'\0'}; + wchar_t szzError[1024] = {'\0'}; + + struct tm tmDate; + time_t newRawTime = pCheckServerInfo->m_pWorkThreadInfo[i].m_nCreateTime; + localtime_s(&tmDate, &newRawTime); + sprintf_s(szThreadTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate.tm_mon + 1, + tmDate.tm_mday, + tmDate.tm_hour, + tmDate.tm_min, + tmDate.tm_sec); + + struct tm tmDate1; + time_t newRawTime1 = objvecWorkThreadInfo[i].m_nCreateTime; + localtime_s(&tmDate1, &newRawTime1); + sprintf_s(szCurrTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate1.tm_year + 1900, + tmDate1.tm_mon + 1, + tmDate1.tm_mday, + tmDate1.tm_hour, + tmDate1.tm_min, + tmDate1.tm_sec); + + sprintf_s(szError,1024, "[%s:%d]原线程时间是[%s], 当前线程重启时间[%s]", pCheckServerInfo->m_objTcpClientConnect.GetServerIP(), pCheckServerInfo->m_objTcpClientConnect.GetServerPort(), szThreadTime, szCurrTime); + + this->ListCtrl_CheckLog->InsertItem(this->ListCtrl_CheckLog->GetItemCount(),wxString(szError)); + + int nCount = this->ListCtrl_CheckLog->GetItemCount(); + + if (nCount > 0) + { + this->ListCtrl_CheckLog->SetItemState(nCount - 1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); + } + + + BeepAlarm(); + } + } + } + } +} + + +void PSS_ClientManagerFrame::BeepAlarm() +{ + + if(this->CheckBox_Voice->GetValue() == true) + { + for(int i = 0; i < 5; i++) + { + //Beep(1000, 1000); + } + } +} + + + +void PSS_ClientManagerFrame::OnButton_ShowServerLinkInfoClick(wxCommandEvent& event) +{ + + //查看TCP + this->ListCtrl_ServerConnect->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ServerConnectTCP -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + vecClientConnectInfo objvecClientConnectInfo; + + int nStrLen = 0; + int nPos = 0; + int nTCPCount = 0; + int nState = 0; + memcpy_s(&nTCPCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nTCPCount; i++) + { + //开始还原数据结构 + _ClientConnectInfo ClientConnectInfo; + + memcpy_s(&nState, sizeof(int), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ClientConnectInfo.m_szIP, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ClientConnectInfo.m_szIP[nStrLen] = '\0'; + + memcpy_s(&ClientConnectInfo.m_nConnectID, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nRecvCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nSendCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nAllRecvSize, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nAllSendSize, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + char szUpdateTime[30] = {'\0'}; + memcpy_s(&ClientConnectInfo.m_nBeginTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate; + time_t newRawTime = ClientConnectInfo.m_nBeginTime; + localtime_s(&tmDate, &newRawTime); + sprintf_s(szUpdateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate.tm_mon + 1, + tmDate.tm_mday, + tmDate.tm_hour, + tmDate.tm_min, + tmDate.tm_sec); + + memcpy_s(&ClientConnectInfo.m_nAliveTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nRecvQueueCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //memcpy_s(&ClientConnectInfo.m_nRecvQueueTimeCost, sizeof(long long), &szRecvBuff[nPos], sizeof(long long)); + nPos += sizeof(long long); + + //memcpy_s(&ClientConnectInfo.m_nSendQueueTimeCost, sizeof(long long), &szRecvBuff[nPos], sizeof(long long)); + nPos += sizeof(long long); + + //显示在界面上 + this->ListCtrl_ServerConnect->InsertItem(i, wxString::Format(_T("%d"), ClientConnectInfo.m_nConnectID)); + this->ListCtrl_ServerConnect->SetItem(i, 1, wxString(ClientConnectInfo.m_szIP)); + + if(nState == 0) + { + this->ListCtrl_ServerConnect->SetItem(i, 2, wxT("链接已存在")); + } + else + { + this->ListCtrl_ServerConnect->SetItem(i, 2, wxT("链接不存在")); + } + + this->ListCtrl_ServerConnect->SetItem(i, 3, wxString::Format(_T("%d"), ClientConnectInfo.m_nSendCount)); + this->ListCtrl_ServerConnect->SetItem(i, 4, wxString::Format(_T("%d"), ClientConnectInfo.m_nRecvCount)); + this->ListCtrl_ServerConnect->SetItem(i, 5, wxString::Format(_T("%d"), ClientConnectInfo.m_nAllSendSize)); + this->ListCtrl_ServerConnect->SetItem(i, 6, wxString::Format(_T("%d"), ClientConnectInfo.m_nAllRecvSize)); + this->ListCtrl_ServerConnect->SetItem(i, 7, wxString(szUpdateTime)); + this->ListCtrl_ServerConnect->SetItem(i, 8, wxString::Format(_T("%d"), ClientConnectInfo.m_nAliveTime)); + + objvecClientConnectInfo.push_back(ClientConnectInfo); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_ReconnectServerClick(wxCommandEvent& event) +{ + + std::string strServerID =std::string(this->TextCtrl_ServerID->GetValue()); + + this->ListCtrl_ServerConnect->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ReConnectServer -s %s&", m_pTcpClientConnect->GetKey(), strServerID.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + vecClientConnectInfo objvecClientConnectInfo; + + int nStrLen = 0; + int nPos = 0; + int nTCPCount = 0; + int nState = 0; + memcpy_s(&nTCPCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nTCPCount; i++) + { + //开始还原数据结构 + _ClientConnectInfo ClientConnectInfo; + + memcpy_s(&nState, sizeof(int), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ClientConnectInfo.m_szIP, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ClientConnectInfo.m_szIP[nStrLen] = '\0'; + + memcpy_s(&ClientConnectInfo.m_nConnectID, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nRecvCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nSendCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nAllRecvSize, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nAllSendSize, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + char szUpdateTime[30] = {'\0'}; + memcpy_s(&ClientConnectInfo.m_nBeginTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate; + time_t newRawTime = ClientConnectInfo.m_nBeginTime; + localtime_s(&tmDate, &newRawTime); + sprintf_s(szUpdateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate.tm_mon + 1, + tmDate.tm_mday, + tmDate.tm_hour, + tmDate.tm_min, + tmDate.tm_sec); + + memcpy_s(&ClientConnectInfo.m_nAliveTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&ClientConnectInfo.m_nRecvQueueCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //memcpy_s(&ClientConnectInfo.m_nRecvQueueTimeCost, sizeof(long long), &szRecvBuff[nPos], sizeof(long long)); + nPos += sizeof(long long); + + //memcpy_s(&ClientConnectInfo.m_nSendQueueTimeCost, sizeof(long long), &szRecvBuff[nPos], sizeof(long long)); + nPos += sizeof(long long); + + //显示在界面上 + this->ListCtrl_ServerConnect->InsertItem(i, wxString::Format(_T("%d"), ClientConnectInfo.m_nConnectID)); + this->ListCtrl_ServerConnect->SetItem(i, 1, wxString(ClientConnectInfo.m_szIP)); + + if(nState == 0) + { + this->ListCtrl_ServerConnect->SetItem(i, 2, wxT("链接已存在")); + } + else + { + this->ListCtrl_ServerConnect->SetItem(i, 2, wxT("链接不存在")); + } + + this->ListCtrl_ServerConnect->SetItem(i, 3, wxString::Format(_T("%d"), ClientConnectInfo.m_nSendCount)); + this->ListCtrl_ServerConnect->SetItem(i, 4, wxString::Format(_T("%d"), ClientConnectInfo.m_nRecvCount)); + this->ListCtrl_ServerConnect->SetItem(i, 5, wxString::Format(_T("%d"), ClientConnectInfo.m_nAllSendSize)); + this->ListCtrl_ServerConnect->SetItem(i, 6, wxString::Format(_T("%d"), ClientConnectInfo.m_nAllRecvSize)); + this->ListCtrl_ServerConnect->SetItem(i, 7, wxString(szUpdateTime)); + this->ListCtrl_ServerConnect->SetItem(i, 8, wxString::Format(_T("%d"), ClientConnectInfo.m_nAliveTime)); + + + objvecClientConnectInfo.push_back(ClientConnectInfo); + } + } + + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + +} + +void PSS_ClientManagerFrame::OnButton_ShowPSSLisenInfoClick(wxCommandEvent& event) +{ + //查看所有已有的监听端口信息 + this->ListCtrl_ServerLisen->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ShowListen -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nTCPCount = 0; + int nState = 0; + memcpy_s(&nTCPCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nTCPCount; i++) + { + //开始还原数据结构 + char szListenIP[30] = {'\0'}; + int nIPLen = 0; + int nListenPort = 0; + + memcpy_s(&nIPLen, sizeof(int), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(szListenIP, 30, &szRecvBuff[nPos], sizeof(char)*nIPLen); + nPos += sizeof(char)*nIPLen; + + memcpy_s(&nListenPort, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //显示在界面上 + this->ListCtrl_ServerLisen->InsertItem(i, wxString(szListenIP)); + this->ListCtrl_ServerLisen->SetItem(i, 1, wxString::Format(wxT("%d"), nListenPort)); + } + } + + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + +} + +void PSS_ClientManagerFrame::OnButton_InsertNewMonitorClick(wxCommandEvent& event) +{ + + //添加新监控 + std::string strIP =std::string(this->TextCtrl_LisenIP->GetValue()); + int nPort = wxAtoi(this->TextCtrl_LisenPort->GetValue()); + + int nType = 1; + + if(this->ComboBox_ListenType->GetSelection() == 0) + { + nType = 1; + } + else + { + nType = 2; + } + + int nPacketParseID = wxAtoi(this->TextCtrl_PacketParseID->GetValue()); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s AddListen -i %s -p %d -t %d -n %d&", m_pTcpClientConnect->GetKey(), strIP.c_str(), nPort, nType, nPacketParseID); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + int nState = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if(nResult == 1) + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + + } + +} + +void PSS_ClientManagerFrame::OnButton_DeleteOldMonitorClick(wxCommandEvent& event) +{ + + //删除一个已有监控 + std::string strIP =std::string(this->TextCtrl_LisenIP->GetValue()); + int nPort = wxAtoi(this->TextCtrl_LisenPort->GetValue()); + + int nType = 1; + + if(this->ComboBox_ListenType->GetSelection() == 0) + { + nType = 1; + } + else + { + nType = 2; + } + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s DelListen -i %s -p %d -t %d &", m_pTcpClientConnect->GetKey(), strIP.c_str(), nPort, nType); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + int nState = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if(nResult == 1) + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + + } + +} + +void PSS_ClientManagerFrame::OnButton_ShowWorkThreadStatClick(wxCommandEvent& event) +{ + //查看工作线程信息 + this->ListCtrl_WorkThreadInfo->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s WorkThreadState -s&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + vecWorkThreadInfo objvecWorkThreadInfo; + + int nStrLen = 0; + int nPos = 0; + int nThreadCount = 0; + memcpy_s(&nThreadCount, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + for(int i = 0; i < nThreadCount; i++) + { + //开始还原数据结构 + _WorkThreadInfo WorkThreadInfo; + sprintf_s(WorkThreadInfo.m_szThreadName, 50, "工作线程"); + + memcpy_s(&WorkThreadInfo.m_nThreadID, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + char szUpdateTime[30] = {'\0'}; + memcpy_s(&WorkThreadInfo.m_nUpdateTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate; + time_t newRawTime = WorkThreadInfo.m_nUpdateTime; + localtime_s(&tmDate, &newRawTime); + sprintf_s(szUpdateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate.tm_mon + 1, + tmDate.tm_mday, + tmDate.tm_hour, + tmDate.tm_min, + tmDate.tm_sec); + + char szCreateTime[30] = {'\0'}; + memcpy_s(&WorkThreadInfo.m_nCreateTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate1; + time_t newRawTime1 = WorkThreadInfo.m_nCreateTime; + localtime_s(&tmDate1, &newRawTime1); + sprintf_s(szCreateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate1.tm_mon + 1, + tmDate1.tm_mday, + tmDate1.tm_hour, + tmDate1.tm_min, + tmDate1.tm_sec); + + memcpy_s(&WorkThreadInfo.m_nState, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(&WorkThreadInfo.m_nRecvPacketCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&WorkThreadInfo.m_nCommandID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + memcpy_s(&WorkThreadInfo.m_nPacketTime, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + memcpy_s(&WorkThreadInfo.m_nCurrPacketCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //显示在界面上 + + this->ListCtrl_WorkThreadInfo->InsertItem(i, wxT("工作线程")); + this->ListCtrl_WorkThreadInfo->SetItem(i, 1,wxString::Format(wxT("%d"),WorkThreadInfo.m_nThreadID) ); + this->ListCtrl_WorkThreadInfo->SetItem(i, 2,wxString(szCreateTime) ); + this->ListCtrl_WorkThreadInfo->SetItem(i, 3,wxString(szUpdateTime) ); + this->ListCtrl_WorkThreadInfo->SetItem(i, 4,wxString::Format(wxT("%d"),WorkThreadInfo.m_nRecvPacketCount) ); + this->ListCtrl_WorkThreadInfo->SetItem(i, 5,wxString::Format(wxT("%d"),WorkThreadInfo.m_nCommandID) ); + this->ListCtrl_WorkThreadInfo->SetItem(i, 6,wxString::Format(wxT("%d"),WorkThreadInfo.m_nPacketTime) ); + this->ListCtrl_WorkThreadInfo->SetItem(i, 7,wxString::Format(wxT("%d"),WorkThreadInfo.m_nCurrPacketCount) ); + + + objvecWorkThreadInfo.push_back(WorkThreadInfo); + } + + } +} + + +void PSS_ClientManagerFrame::OnButton_InsertForbidenClick(wxCommandEvent& event) +{ + + + //添加封禁 + std::string strIP =std::string(this->TextCtrl_ForbidenIP->GetValue()); + std::string strSeconds =std::string(this->TextCtrl_ForbidenSeconds->GetValue()); + int nType = RadioBoxm_TimeForbiden->GetSelection(); + + + if(strIP.length() == 0) + { + wxMessageBox(wxT(MESSAGE_INSERT_NULL), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ForbiddenIP -c %s -t %d -s %s &", m_pTcpClientConnect->GetKey(), strIP.c_str(), nType, strSeconds.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + if(nResult == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + this->OnButton_ShowForbidenClick(event); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_ReleaseForbidenClick(wxCommandEvent& event) +{ + //解除封禁 + std::string strIP =std::string(this->TextCtrl_ForbidenIP->GetValue()); + + if(strIP.length() == 0) + { + wxMessageBox(wxT(MESSAGE_INSERT_NULL), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s LiftedIP %s&", m_pTcpClientConnect->GetKey(), strIP.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + if(nResult == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + this->OnButton_ShowForbidenClick(event); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_ShowForbidenClick(wxCommandEvent& event) +{ + + //查看列表 + this->ListCtrl_ForbidenList->DeleteAllItems(); + + vecForbiddenIP objvecForbiddenIP; + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ShowForbiddenIP -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nForbidenCount = 0; + memcpy_s(&nForbidenCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nForbidenCount; i++) + { + //开始还原数据结构 + _ForbiddenIP ForbiddenIP; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ForbiddenIP.m_szIP, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ForbiddenIP.m_szIP[nStrLen] = '\0'; + + memcpy_s(&ForbiddenIP.m_nType, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + char szUpdateTime[30] = {'\0'}; + memcpy_s(&ForbiddenIP.m_nBeginTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + struct tm tmDate; + time_t newRawTime = ForbiddenIP.m_nBeginTime; + localtime_s(&tmDate, &newRawTime); + sprintf_s(szUpdateTime, 30, "%04d-%02d-%02d %02d:%02d:%02d", tmDate.tm_year + 1900, + tmDate.tm_mon + 1, + tmDate.tm_mday, + tmDate.tm_hour, + tmDate.tm_min, + tmDate.tm_sec); + + memcpy_s(&ForbiddenIP.m_nSecond, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //显示在桌面上 + wxString strType; + + if(ForbiddenIP.m_nType == 0) + { + strType = wxT("永久封禁"); + } + else + { + strType = wxT("时段封禁"); + } + + this->ListCtrl_ForbidenList->InsertItem(i, wxString(ForbiddenIP.m_szIP)); + this->ListCtrl_ForbidenList->SetItem(i, 1, strType); + this->ListCtrl_ForbidenList->SetItem(i, 2, wxString(szUpdateTime)); + this->ListCtrl_ForbidenList->SetItem(i, 3, wxString::Format(wxT("%d"),ForbiddenIP.m_nSecond)); + + objvecForbiddenIP.push_back(ForbiddenIP); + } + } + + +} + +void PSS_ClientManagerFrame::OnButton_SearchNicknameClick(wxCommandEvent& event) +{ + + + //查询别名 + this->ListCtrl_NickInfo->DeleteAllItems(); + + std::string strNickName =std::string(this->TextCtrl_NickName->GetValue()); + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s GetNickNameInfo -n %s&", m_pTcpClientConnect->GetKey(), strNickName.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nForbidenCount = 0; + memcpy_s(&nForbidenCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nForbidenCount; i++) + { + //开始还原数据结构 + _ClientNameInfo ClientNameInfo; + + memcpy_s(&ClientNameInfo.m_nConnectID, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ClientNameInfo.m_szClientIP, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ClientNameInfo.m_szClientIP[nStrLen] = '\0'; + + memcpy_s(&ClientNameInfo.m_nPort, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ClientNameInfo.m_szName, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ClientNameInfo.m_szName[nStrLen] = '\0'; + + memcpy_s(&ClientNameInfo.m_nLog, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + //显示在桌面上 + this->ListCtrl_NickInfo->InsertItem(i, wxString::Format(wxT("%d"),ClientNameInfo.m_nConnectID)); + this->ListCtrl_NickInfo->SetItem(i, 1, wxString(ClientNameInfo.m_szName)); + this->ListCtrl_NickInfo->SetItem(i, 2, wxString(ClientNameInfo.m_szClientIP)); + this->ListCtrl_NickInfo->SetItem(i, 3, wxString::Format(wxT("%d"),ClientNameInfo.m_nPort)); + + if(ClientNameInfo.m_nLog == 0) + { + this->ListCtrl_NickInfo->SetItem(i, 4, wxT("未开启")); + } + else + { + this->ListCtrl_NickInfo->SetItem(i, 4, wxT("开启")); + } + } + } + +} + + +bool PSS_ClientManagerFrame::SendSetLog( int nConnectID, bool blFlag ) +{ + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + int nResult = 0; + + if(blFlag == false) + { + sprintf_s(szCommand, 100, "%s SetConnectLog -n %d -f 0 &", m_pTcpClientConnect->GetKey(), nConnectID); + } + else + { + sprintf_s(szCommand, 100, "%s SetConnectLog -n %d -f 1 &", m_pTcpClientConnect->GetKey(), nConnectID); + } + + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return false; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nForbidenCount = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + return true; + } +} + + + +void PSS_ClientManagerFrame::OnButton_OpenLogClick(wxCommandEvent& event) +{ + + //打开日志 + int nConnectID = wxAtoi(this->TextCtrl_ConnectID->GetValue()); + SendSetLog(nConnectID, true); + +} + +void PSS_ClientManagerFrame::OnButton_CloselogClick(wxCommandEvent& event) +{ + //关闭日志 + int nConnectID = wxAtoi(this->TextCtrl_ConnectID->GetValue()); + SendSetLog(nConnectID, false); +} + +void PSS_ClientManagerFrame::OnButton41Click(wxCommandEvent& event) +{ +} + +void PSS_ClientManagerFrame::OnButton_GetTrackSourceIPClick(wxCommandEvent& event) +{ + //根据ConnectID获得相关的数据 + + //得到ConnectID + int nConnectID = wxAtoi(this->TextCtr_TrackConnectID->GetValue()); + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s GetConnectIPInfo -s %d&", m_pTcpClientConnect->GetKey(), nConnectID); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + if(nResult == 1) + { + this->TextCtrl_IPInfo->SetValue(wxT("")); + wxMessageBox(wxString("当前ConnectID无连接信息。"), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + char szIP[20] = {'\0'}; + int nPort = 0; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + //获得IP地址 + memcpy_s(szIP, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + szIP[nStrLen] = '\0'; + + //得到端口 + memcpy_s(&nPort, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + this->TextCtrl_IPInfo->SetValue(wxString::Format(wxT("%s:%d"), szIP, nPort)); + } + + } + + +} + +void PSS_ClientManagerFrame::OnButton_SetTrackIPClick(wxCommandEvent& event) +{ + + //设置IP + std::string strIP =std::string(this->TextCtr_TrackIP->GetValue()); + std::string strIPCount =std::string(this->TextCtrl_TrackIPCount->GetValue()); + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s SetTrackIP -i %s -c %s &", m_pTcpClientConnect->GetKey(), strIP.c_str(), strIPCount.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + if(nResult == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } + +} + + +void PSS_ClientManagerFrame::OnButton_SetTrackCommandIDClick(wxCommandEvent& event) +{ + //设置IP + std::string strCommandID =std::string(this->TextCtrl_TrackCommandID->GetValue()); + std::string strCommandIDCount =std::string(this->TextCtrl_TracCommandCount->GetValue()); + + + if (strCommandID.length() == 0) + { + wxMessageBox(wxT(MESSAGE_INSERT_NULL), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + char szSendMessage[200] = { '\0' }; + char szCommand[100] = { '\0' }; + sprintf_s(szCommand, 100, "%s SetTrackCommand -i %s -c %s &", m_pTcpClientConnect->GetKey(), strCommandID.c_str(), strCommandIDCount.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = { '\0' }; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if (blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + if (nResult == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_ShowTrackCommandIDClick(wxCommandEvent& event) +{ + + //显示命令染色状态 + this->ListCtrl_TrackIPHistory->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s GetTrackCommandInfo -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + int nStrLen = 0; + int nPos = 0; + int nCount = 0; + memcpy_s(&nCount, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + for(int i = 0; i < nCount; i++) + { + //开始还原数据结构 + short nCommandID = 0; + short nCurrCount = 0; + short nMaxCount = 0; + + //获得命令ID + memcpy_s(&nCommandID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + //获得当前已染色包数量 + memcpy_s(&nCurrCount, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + //获得需要染色包总数 + memcpy_s(&nMaxCount, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + //显示在桌面上 + this->ListCtrl_TrackIPHistory->InsertItem(i, wxString("0x")+wxString::Format(wxT("%04x"), nCommandID)); + this->ListCtrl_TrackIPHistory->SetItem(i, 1, wxString::Format(_T("%d"), nCurrCount)); + this->ListCtrl_TrackIPHistory->SetItem(i, 2, wxString::Format(_T("%d"), nMaxCount)); + } + } + +} + +void PSS_ClientManagerFrame::OnButton_GetWorkThreadParamClick(wxCommandEvent& event) +{ + //得到所有工作进程的AI配置 + this->ListCtrl_WorkThreadAI->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s GetWorkThreadAI -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nThreadCount = 0; + memcpy_s(&nThreadCount, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + for(int i = 0; i < nThreadCount; i++) + { + int nThreadID = 0; + int nAI = 0; + int nDisposeTime = 0; + int nWTCheckTime = 0; + int nWTTimeoutCount = 0; + int nWTStopTime = 0; + + memcpy_s(&nThreadID, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&nAI, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + memcpy_s(&nDisposeTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&nWTCheckTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&nWTTimeoutCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + memcpy_s(&nWTStopTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //显示出来 + + this->ListCtrl_WorkThreadAI->InsertItem(i, wxString::Format(wxT("%d"), nThreadID)); + + if(nAI == 0) + { + this->ListCtrl_WorkThreadAI->SetItem(i, 1, wxT("AI关闭")); + } + else + { + this->ListCtrl_WorkThreadAI->SetItem(i, 1, wxT("AI运行中")); + } + + ; + + this->ListCtrl_WorkThreadAI->SetItem(i, 2, wxString::Format(_T("%d"), nDisposeTime)); + + this->ListCtrl_WorkThreadAI->SetItem(i, 3, wxString::Format(_T("%d"), nWTCheckTime)); + + this->ListCtrl_WorkThreadAI->SetItem(i, 4, wxString::Format(_T("%d"), nWTTimeoutCount)); + + this->ListCtrl_WorkThreadAI->SetItem(i, 5, wxString::Format(_T("%d"), nWTStopTime)); + } + } + + +} + + +void PSS_ClientManagerFrame::OnButton_GetWorkThreadPoolClick(wxCommandEvent& event) +{ + + + //查询当前AI池中的数据 + this->ListCtr_WorkThreadTimeout->DeleteAllItems(); + this->ListCtrl_WorkThreadForbiden->DeleteAllItems(); + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s GetWorkThreadTO -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nThreadCount = 0; + memcpy_s(&nThreadCount, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + for(int i = 0; i < nThreadCount; i++) + { + int nThreadID = 0; + int nCommandID = 0; + int nSecond = 0; + int nDisposeTime = 0; + + memcpy_s(&nThreadID, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&nCommandID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + memcpy_s(&nSecond, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&nDisposeTime, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //显示出来 + this->ListCtr_WorkThreadTimeout->InsertItem(i, wxString::Format(_T("%d"), nThreadID)); + this->ListCtr_WorkThreadTimeout->SetItem(i, 1, wxString::Format(_T("0x%04x"), nCommandID)); + time_t time2 = nSecond; + struct tm tm2; + localtime_s(&tm2, &time2); + + this->ListCtr_WorkThreadTimeout->SetItem(i, 2, wxString::Format(_T("%04d-%02d-%02d %02d:%02d:%02d"), tm2.tm_year + 1900, tm2.tm_mon + 1, tm2.tm_mday, tm2.tm_hour, tm2.tm_min, tm2.tm_sec)); + this->ListCtr_WorkThreadTimeout->SetItem(i, 3, wxString::Format(_T("%d"), nDisposeTime)); + } + + //显示封禁的 + memcpy_s(&nThreadCount, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + for(int i = 0; i < nThreadCount; i++) + { + int nThreadID = 0; + int nCommandID = 0; + int nSecond = 0; + + memcpy_s(&nThreadID, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + memcpy_s(&nCommandID, sizeof(short), &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + + memcpy_s(&nSecond, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //显示出来 + this->ListCtrl_WorkThreadForbiden->InsertItem(i, wxString::Format(wxT("%d"), nThreadID)); ; + this->ListCtrl_WorkThreadForbiden->SetItem(i, 1, wxString::Format(wxT("0x%04x"), nCommandID)); + + time_t time2 = nSecond; + struct tm tm2; + localtime_s(&tm2, &time2); + + this->ListCtrl_WorkThreadForbiden->SetItem(i, 2, wxString::Format(wxT("%04d-%02d-%02d %02d:%02d:%02d"), tm2.tm_year + 1900,tm2.tm_mon + 1, tm2.tm_mday, tm2.tm_hour, tm2.tm_min, tm2.tm_sec)); + } + } + + + +} + + + +void PSS_ClientManagerFrame::OnButton_SetClick(wxCommandEvent& event) +{ + + std::string strServerIP =std::string(this->TextCtrl_ServerIP->GetValue()); + std::string strConsoleKey =std::string(this->TextCtrl_ServerKey->GetValue()); + int nPort = wxAtoi(this->TextCtrl_ServerPort->GetValue()); + + if(strServerIP.length() == 0 || strConsoleKey.length() == 0 || nPort == 0) + { + wxMessageBox(wxT(MESSAGE_INSERT_NULL), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + m_pTcpClientConnect->Init(strServerIP.c_str(), nPort, strConsoleKey.c_str()); + + wxMessageBox(wxT(MESSAGE_TITLE_CONNECT), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + + +} + +void PSS_ClientManagerFrame::OnButton_GetServerstateClick(wxCommandEvent& event) +{ + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ShowServerInfo -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + //处理发送的数据 + int nPos = 0; + + int nTempLen = 0; + int nSerevrID = 0; + char szServerName[20] = {'\0'}; + char szServerVersion[20] = {'\0'}; + int nModuleCount = 0; + int nWorkThreadCount = 0; + char szPacketVersion[20] = {'\0'}; + int nCharOrder = 0; + int nByteOrder = 0; + + memcpy_s(&nSerevrID, 2, &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + memcpy_s(&nTempLen, 1, &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + memcpy_s(&szServerName, nTempLen, &szRecvBuff[nPos], nTempLen); + nPos += nTempLen; + memcpy_s(&nTempLen, 1, &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + memcpy_s(&szServerVersion, nTempLen, &szRecvBuff[nPos], nTempLen); + nPos += nTempLen; + memcpy_s(&nModuleCount, 2, &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + memcpy_s(&nWorkThreadCount, 2, &szRecvBuff[nPos], sizeof(short)); + nPos += sizeof(short); + memcpy_s(&nTempLen, 1, &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + memcpy_s(&szPacketVersion, nTempLen, &szRecvBuff[nPos], nTempLen); + nPos += nTempLen; + memcpy_s(&nCharOrder, 1, &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + memcpy_s(&nByteOrder, 1, &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + char szCharOrder[20] = {'\0'}; + + if(nCharOrder == 0) + { + sprintf_s(szCharOrder, 100, "小端"); + } + else + { + sprintf_s(szCharOrder, 100, "大端"); + } + + char szByteOrder[20] = {'\0'}; + + if(nByteOrder == 0) + { + sprintf_s(szByteOrder, 100, "主机字节序"); + } + else + { + sprintf_s(szByteOrder, 100, "网络字节序"); + } + + char szText[2048] = {'\0'}; + sprintf_s(szText,2048, "服务器ID:%d.\r\n服务器名称:%s.\r\n服务器版本:%s.\r\n服务器加载模块数:%d.\r\n服务器工作线程数:%d\r\n服务器包解析版本号:%s\r\n服务器大小端:%s\r\n服务器字符序:%s.", + nSerevrID, szServerName, szServerVersion, nModuleCount, nWorkThreadCount, szPacketVersion, szCharOrder, szByteOrder); + + //显示内容 + + this->TextCtrl_ServerInfo->SetValue(wxString(szText)); + + } + +} + + + +void PSS_ClientManagerFrame::OnButton_ShowAllModuleClick(wxCommandEvent& event) +{ + + this->ListCtrl_ModuleList->DeleteAllItems(); + + vecModuleInfo objvecModuleInfo; + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s ShowModule -a&", m_pTcpClientConnect->GetKey()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nModuleCount = 0; + memcpy_s(&nModuleCount, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + for(int i = 0; i < nModuleCount; i++) + { + //开始还原数据结构 + _ModuleInfo ModuleInfo; + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ModuleInfo.szModuleName, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ModuleInfo.szModuleName[nStrLen] = '\0'; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ModuleInfo.szModuleFile, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ModuleInfo.szModuleFile[nStrLen] = '\0'; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ModuleInfo.szModulePath, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ModuleInfo.szModulePath[nStrLen] = '\0'; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ModuleInfo.szModuleParam, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ModuleInfo.szModuleParam[nStrLen] = '\0'; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ModuleInfo.szModuleDesc, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ModuleInfo.szModuleDesc[nStrLen] = '\0'; + + memcpy_s(&nStrLen, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(ModuleInfo.szModuleCreateDate, nStrLen, &szRecvBuff[nPos], nStrLen); + nPos += nStrLen; + ModuleInfo.szModuleCreateDate[nStrLen] = '\0'; + + memcpy_s(&ModuleInfo.nModuleState, sizeof(char), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(char); + + memcpy_s(&ModuleInfo.nModuleID, sizeof(int), &szRecvBuff[nPos], sizeof(int)); + nPos += sizeof(int); + + //显示在桌面上 + this->ListCtrl_ModuleList->InsertItem(i, ModuleInfo.szModuleFile); + this->ListCtrl_ModuleList->SetItem(i, 1, ModuleInfo.szModuleName); + this->ListCtrl_ModuleList->SetItem(i, 2, ModuleInfo.szModulePath); + this->ListCtrl_ModuleList->SetItem(i, 3, ModuleInfo.szModuleParam); + this->ListCtrl_ModuleList->SetItem(i, 4, ModuleInfo.szModuleDesc); + this->ListCtrl_ModuleList->SetItem(i, 5, ModuleInfo.szModuleCreateDate); + + + if(ModuleInfo.nModuleState == 0) + { + this->ListCtrl_ModuleList->SetItem(i, 6, wxT("正常")); + } + else + { + this->ListCtrl_ModuleList->SetItem(i, 6, wxT("异常")); + } + + this->ListCtrl_ModuleList->SetItem(i, 7, wxString::Format(wxT("%d"),ModuleInfo.nModuleID)); + + objvecModuleInfo.push_back(ModuleInfo); + } + } + + +} + +void PSS_ClientManagerFrame::OnButton_LoadModuleClick(wxCommandEvent& event) +{ + //加载指定模块 + + wxCSConv cvGBK( wxT("GBK") ); + std::string strModulePath =std::string( cvGBK.cWX2MB( this->TextCtrl_ModulePath->GetValue().c_str() ) ); + std::string strModuleFile =std::string( cvGBK.cWX2MB( this->TextCtrl_ModuleFilename->GetValue().c_str() ) ); + std::string strModuleParam =std::string( cvGBK.cWX2MB( this->TextCtrl_ModuleParam->GetValue().c_str() ) ); + + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s LoadModule %s,%s,%s&", m_pTcpClientConnect->GetKey(), strModulePath.c_str(), strModuleFile.c_str(), strModuleParam.c_str()); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[10 * 1024] = {'\0'}; + int nRecvLen = 10 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + int nResult = 0; + memcpy_s(&nResult, sizeof(int), &szRecvBuff[nPos], sizeof(char)); + nPos += sizeof(int); + + if(nResult == 0) + { + wxMessageBox(wxT(MESSAGE_RESULT_SUCCESS), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + } + else + { + wxMessageBox(wxT(MESSAGE_RESULT_FAIL), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + } + } + + //OnBnClickedButton3(); + this->OnButton_ShowAllModuleClick(event); + +} + + + + +void PSS_ClientManagerFrame::LoadConfigFile() +{ + //从配置文件加载 + m_vecConfigInfo.clear(); + + bool blState = m_objXmlOpeation.Init(CONFIG_NAME); + + if(false == blState) + { + wxMessageBox(wxT("读取配置文件错误,请确认当前目录下Config.xml文件存在"), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + TiXmlElement* pNextTiXmlElementName = NULL; + TiXmlElement* pNextTiXmlElementIP = NULL; + TiXmlElement* pNextTiXmlElementPort = NULL; + TiXmlElement* pNextTiXmlElementMagicCode = NULL; + char* pData = NULL; + + while(true) + { + _ConfigInfo objConfigInfo; + + pData = m_objXmlOpeation.GetData("ServerInfo", "servername", pNextTiXmlElementName); + + if(pData != NULL) + { + sprintf_s(objConfigInfo.m_szServerName, sizeof(objConfigInfo.m_szServerName), "%s", pData); + } + else + { + break; + } + + pData = m_objXmlOpeation.GetData("ServerInfo", "sIP", pNextTiXmlElementIP); + + if(pData != NULL) + { + sprintf_s(objConfigInfo.m_szIP, sizeof(objConfigInfo.m_szIP), "%s", pData); + } + else + { + break; + } + + pData = m_objXmlOpeation.GetData("ServerInfo", "sport", pNextTiXmlElementPort); + + if(pData != NULL) + { + objConfigInfo.m_nPort = atoi(pData); + } + else + { + break; + } + + pData = m_objXmlOpeation.GetData("ServerInfo", "MagicCode", pNextTiXmlElementMagicCode); + + if(pData != NULL) + { + sprintf_s(objConfigInfo.m_szMagicCode, sizeof(objConfigInfo.m_szMagicCode), "%s", pData); + } + else + { + break; + } + + m_vecConfigInfo.push_back(objConfigInfo); + } + + m_objXmlOpeation.Close(); + + + ShowConfigList(); + + +} + +void PSS_ClientManagerFrame::OnButton_LoadConfigfileClick(wxCommandEvent& event) +{ + LoadConfigFile(); + ChangeConfigFile(); +} + + +void PSS_ClientManagerFrame::ShowConfigList() +{ + + this->ListBox_ConfigList->Clear(); + //wchar_t szTemp[1024] = {'\0'}; + + for(int i = 0; i < (int)m_vecConfigInfo.size(); i++) + { + //int nSrcLen = MultiByteToWideChar(CP_ACP, 0, m_vecConfigInfo[i].m_szServerName, strlen(m_vecConfigInfo[i].m_szServerName), NULL, 0); + //int nDecLen = MultiByteToWideChar(CP_ACP, 0, m_vecConfigInfo[i].m_szServerName, nSrcLen, szTemp, 1024); + //szTemp[nDecLen] = '\0'; + + //m_lbConfig.InsertString(i, szTemp); + wxString strServerName =wxString(m_vecConfigInfo[i].m_szServerName); + this->ListBox_ConfigList->InsertItems(1,&strServerName,i); + + } + + if (m_vecConfigInfo.size() >0) + { + this->ListBox_ConfigList->SetSelection(0); + } + +} + + + +void PSS_ClientManagerFrame::OnButton_LoadFileClick(wxCommandEvent& event) +{ + + //从XML文件中加载 + m_vecCheckServer.clear(); + + CXmlOpeation objXmlOpeation; + + bool blState = objXmlOpeation.Init(CHECKSERVER_FILE); + + if(false == blState) + { + wxMessageBox(wxString("读取配置文件错误,请确认当前目录下Config.xml文件存在"), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + TiXmlElement* pNextTiXmlElementIP = NULL; + TiXmlElement* pNextTiXmlElementPort = NULL; + TiXmlElement* pNextTiXmlElementMagicCode = NULL; + TiXmlElement* pNextTiXmlElementTCount = NULL; + char* pData = NULL; + + while(true) + { + _CheckServer objCheckServer; + + pData = objXmlOpeation.GetData("ServerInfo", "sIP", pNextTiXmlElementIP); + + if(pData != NULL) + { + sprintf_s(objCheckServer.m_szIP, sizeof(objCheckServer.m_szIP), "%s", pData); + } + else + { + break; + } + + pData = objXmlOpeation.GetData("ServerInfo", "sport", pNextTiXmlElementPort); + + if(pData != NULL) + { + objCheckServer.m_nPort = atoi(pData); + } + else + { + break; + } + + pData = objXmlOpeation.GetData("ServerInfo", "MagicCode", pNextTiXmlElementMagicCode); + + if(pData != NULL) + { + sprintf_s(objCheckServer.m_szMagicCode, sizeof(objCheckServer.m_szMagicCode), "%s", pData); + } + else + { + break; + } + + pData = objXmlOpeation.GetData("ServerInfo", "ThreadCount", pNextTiXmlElementTCount); + + if(pData != NULL) + { + objCheckServer.m_nThreadCount = atoi(pData); + } + else + { + break; + } + + m_vecCheckServer.push_back(objCheckServer); + } + + objXmlOpeation.Close(); + + ShowGroupServerList(); + +} + +void PSS_ClientManagerFrame::OnButton_ClearLoadClick(wxCommandEvent& event) +{ + + //清除加载 + m_vecCheckServer.clear(); + + ShowGroupServerList(); + +} + + +void PSS_ClientManagerFrame::ShowGroupServerList() +{ + this->ListCtrl_ServerList->DeleteAllItems(); + + + for(int i = 0; i < (int)m_vecCheckServer.size(); i++) + { + char szLog[500] = {'\0'}; + sprintf_s(szLog, 500, "[%s:%d]监控线程数[%d]", m_vecCheckServer[i].m_szIP, m_vecCheckServer[i].m_nPort, m_vecCheckServer[i].m_nThreadCount); + + this->ListCtrl_ServerList->InsertItem(this->ListCtrl_ServerList->GetItemCount(),wxString(szLog)); + + } + +} + +void PSS_ClientManagerFrame::ClearCheckServerInfo() +{ + for(int i = 0; i < (int)m_vecCheckServerInfo.size(); i++) + { + _CheckServerInfo* pCheckServerInfo = (_CheckServerInfo*)(m_vecCheckServerInfo[i]); + + if(NULL != pCheckServerInfo) + { + delete pCheckServerInfo; + } + } + + m_vecCheckServerInfo.clear(); +} + +void PSS_ClientManagerFrame::OnButton_ResetWorkThreadClick(wxCommandEvent& event) +{ + //重置工作线程AI参数 + int nDisposeTime = wxAtoi(this->TextCtrl_WorkThreadDisposeTime->GetValue()); + + if(nDisposeTime <= 0) + { + wxMessageBox(wxString("处理时间不能是0"), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + + int nCheckTime = wxAtoi(this->TextCtrl_WorkThreadCheckTime->GetValue()); + + if(nCheckTime <= 0) + { + wxMessageBox(wxString("时间区间不能是0"), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + + int nStopTime = wxAtoi(this->TextCtrl_WorkThreadStopTime->GetValue()); + + if(nStopTime <= 0) + { + wxMessageBox(wxString("暂停时间不能是0"), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + + int nAI = 0; + + if(this->CheckBox_WorkThread->GetValue() == true) + { + nAI = 1; + } + + char szSendMessage[200] = {'\0'}; + char szCommand[100] = {'\0'}; + sprintf_s(szCommand, 100, "%s SetWorkThreadAI -i %d,%d,%d,%d&", m_pTcpClientConnect->GetKey(), nAI, nDisposeTime, nCheckTime, nStopTime); + int nSendLen = (int)strlen(szCommand); + + memcpy_s(&szSendMessage, 200, &szCommand, nSendLen); + + char szRecvBuff[100 * 1024] = {'\0'}; + int nRecvLen = 100 * 1024; + bool blState = m_pTcpClientConnect->SendConsoleMessage(szSendMessage, nSendLen, (char*)szRecvBuff, nRecvLen); + + if(blState == false) + { + wxMessageBox(wxT(MESSAGE_SENDERROR), wxT(MESSAGE_TITLE_ERROR), wxOK | wxICON_INFORMATION, this); + return; + } + else + { + int nStrLen = 0; + int nPos = 0; + + wxMessageBox(wxString("线程AI参数设置成功"), wxT(MESSAGE_TITLE_SUCCESS), wxOK | wxICON_INFORMATION, this); + return; + } + + +} + + +void PSS_ClientManagerFrame::OnTextCtrl_CurrFlowInText(wxCommandEvent& event) +{ +} diff --git a/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.h b/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.h new file mode 100644 index 000000000..b635a4257 --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager/PSS_ClientManagerMain.h @@ -0,0 +1,770 @@ +/*************************************************************** + * Name: PSS_ClientManagerMain.h + * Purpose: Defines Application Frame + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PSS_CLIENTMANAGERMAIN_H +#define PSS_CLIENTMANAGERMAIN_H + +//(*Headers(PSS_ClientManagerFrame) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//*) + +#include + +#include +#include + + +#include "XmlOpeation.h" + +#include "macro.h" +#include "sock_wrap.h" + + +#include "ClientDefine.h" +#include "TcpClientConnect.h" + +using namespace std; + + +struct _IPAccount +{ + char m_szIP[50]; //当前链接地址 + int m_nCount; //当前链接次数 + int m_nAllCount; //指定IP链接次数总和 + int m_nMinute; //当前分钟数 + char m_szDate[50]; //最后更新时间 + + _IPAccount() + { + m_szIP[0] = '\0'; + m_nCount = 0; + m_nAllCount = 0; + m_szDate[0] = '\0'; + } +}; + +typedef vector<_IPAccount> vecIPAccount; +typedef vector<_ClientConnectInfo> vecClientConnectInfo; + + + + + + +#define CONFIG_NAME "./Config.xml" + +//PSS远程服务器配置信息 +struct _ServerInfo +{ + int m_nSerevrID; + char m_szServerName[20]; + char m_szServerVersion[20]; + int m_nModuleCount; + int m_nWorkThreadCount; + char m_szPacketVersion[20]; + + _ServerInfo() + { + m_nSerevrID = 0; + m_szServerName[0] = '\0'; + m_szServerVersion[0] = '\0'; + m_nModuleCount = 0; + m_nWorkThreadCount = 0; + m_szPacketVersion[0] = '\0'; + } +}; + +//PSS模块加载信息 +struct _ModuleInfo +{ + char szModuleName[200]; + char szModuleFile[200]; + char szModulePath[200]; + char szModuleParam[200]; + char szModuleDesc[200]; + char szModuleCreateDate[200]; + int nModuleState; + int nModuleID; + + _ModuleInfo() + { + szModuleName[0] = '\0'; + szModuleFile[0] = '\0'; + szModulePath[0] = '\0'; + szModuleParam[0] = '\0'; + szModuleDesc[0] = '\0'; + szModuleCreateDate[0] = '\0'; + nModuleState = 0; + nModuleID = 0; + } +}; + +//PSS配置文件信息 +struct _ConfigInfo +{ + char m_szServerName[200]; + char m_szIP[50]; + int m_nPort; + char m_szMagicCode[300]; + + _ConfigInfo() + { + m_szServerName[0] = '\0'; + m_szIP[0] = '\0'; + m_nPort = 0; + m_szMagicCode[0] = '\0'; + } +}; + +struct _CommandInfo +{ + char szModuleName[200]; + char szCommandID[200]; + int m_nCount; //当前命令被调用的次数 + int m_nTimeCost; //当前命令总时间消耗 + + _CommandInfo() + { + szModuleName[0] = '\0'; + szCommandID[0] = '\0'; + m_nCount = 0; + m_nTimeCost = 0; + } +}; + +struct _CommandTimeOut +{ + short nCommandID; //命令的ID + int nTime; //发生时间 + int nTimeOutTime; //超时时间 + + _CommandTimeOut() + { + nCommandID = 0; + nTime = 0; + nTimeOutTime = 0; + } +}; + +typedef vector<_CommandInfo> vecCommandInfo; + +typedef vector<_ConfigInfo> vecConfigInfo; + +typedef vector<_ModuleInfo> vecModuleInfo; + + +#define CHECKSERVER_FILE "./CheckServer.xml" + +//监控线程信息 +struct _WorkThreadInfo +{ + char m_szThreadName[50]; //线程名称 + int m_nThreadID; //线程ID + int m_nUpdateTime; //线程最后处理数据的时间 + int m_nCreateTime; //线程最后处理数据的时间 + int m_nState; //0为没有数据正在处理,1为正在处理接受数据。 + int m_nRecvPacketCount; //此线程下接收包的处理个数 + int m_nSendPacketCount; //此线程下发送包的处理个数 + int m_nCommandID; //当前处理的信令ID + int m_nPacketTime; //平均数据包处理时间 + int m_nCurrPacketCount; //单位时间内的包处理数量 + + _WorkThreadInfo() + { + m_nThreadID = 0; + m_nUpdateTime = 0; + m_nCreateTime = 0; + m_nState = 0; + m_nRecvPacketCount = 0; + m_nSendPacketCount = 0; + m_nCommandID = 0; + m_nPacketTime = 0; + m_nCurrPacketCount = 0; + } +}; + +typedef vector<_WorkThreadInfo> vecWorkThreadInfo; + +//监控服务器需要加载的信息 +struct _CheckServerInfo +{ +public: + CTcpClientConnect m_objTcpClientConnect; + int m_nCheckThreadCount; + _WorkThreadInfo* m_pWorkThreadInfo; + + _CheckServerInfo() + { + m_nCheckThreadCount = 0; + m_pWorkThreadInfo = NULL; + } + + ~_CheckServerInfo() + { + if(NULL != m_pWorkThreadInfo) + { + delete[] m_pWorkThreadInfo; + m_pWorkThreadInfo = NULL; + } + } +}; + +typedef vector<_CheckServerInfo*> vecCheckServerInfo; + +//XML中记载的服务器的配置信息 +struct _CheckServer +{ +public: + char m_szIP[50]; + int m_nPort; + char m_szMagicCode[300]; + int m_nThreadCount; + + _CheckServer() + { + m_szIP[0] = '\0'; + m_nPort = 0; + m_szMagicCode[0] = '\0'; + m_nThreadCount = 0; + } +}; + +typedef vector<_CheckServer> vecCheckServer; + +struct _ForbiddenIP +{ + char m_szIP[50]; + int m_nType; + int m_nBeginTime; + int m_nSecond; + + _ForbiddenIP() + { + m_szIP[0] = '\0'; + m_nType = 0; + m_nBeginTime = 0; + m_nSecond = 0; + } +}; + + +//链接别名映射信息(用于PSS_ClientManager管理) +struct _ClientNameInfo +{ + char m_szName[100]; //连接别名 + char m_szClientIP[20]; //客户端的IP地址 + int m_nPort; //客户端的端口 + int m_nConnectID; //连接ID + int m_nLog; //Log标记位 + + _ClientNameInfo() + { + m_szName[0] = '\0'; + m_szClientIP[0] = '\0'; + m_nPort = 0; + m_nConnectID = 0; + m_nLog = 0; + } +}; +typedef vector<_ClientNameInfo> vecClientNameInfo; + +typedef vector<_ForbiddenIP> vecForbiddenIP; +typedef vector<_ClientConnectInfo> vecClientConnectInfo; + + + +using namespace std; + + + +class PSS_ClientManagerFrame: public wxFrame +{ +public: + + PSS_ClientManagerFrame(wxWindow* parent,wxWindowID id = -1); + virtual ~PSS_ClientManagerFrame(); + +private: + + //(*Handlers(PSS_ClientManagerFrame) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnButton_ReloadModuleClick(wxCommandEvent& event); + void OnButton_UnloadModuleClick(wxCommandEvent& event); + void OnTextCtrl_ModuleNmaeText(wxCommandEvent& event); + void OnButton_CloseServerClick(wxCommandEvent& event); + void OnListBox_ConfigListSelect(wxCommandEvent& event); + void OnListCtrl_ModuleListItemSelect(wxListEvent& event); + void OnButton_GetCurrLinkCountClick(wxCommandEvent& event); + void OnButton_SetLinkLimitClick(wxCommandEvent& event); + void OnButton_SetDebugClick(wxCommandEvent& event); + void OnButton_GetDebugStateClick(wxCommandEvent& event); + void OnButton_StartFileClick(wxCommandEvent& event); + void OnButton_StopFileClick(wxCommandEvent& event); + void OnButton_GetLinkHistoryClick(wxCommandEvent& event); + void OnTextCtrl_CurrLinkCountText(wxCommandEvent& event); + void OnButton_GetCurrClientCountClick(wxCommandEvent& event); + void OnTextCtrl_ModuleIDText(wxCommandEvent& event); + void OnButton_ShowModuleCmdClick(wxCommandEvent& event); + void OnButton_ShowAllCmdClick(wxCommandEvent& event); + void OnButton_ShowTimeoutCmdClick(wxCommandEvent& event); + void OnButton_ClearTimeoutCmdClick(wxCommandEvent& event); + void OnButton_SaveSmdHistoryClick(wxCommandEvent& event); + void OnButton_DisconnectClientClick(wxCommandEvent& event); + void OnButton_ShowClientClick(wxCommandEvent& event); + void OnButton_SetLogLevelClick(wxCommandEvent& event); + void OnButton_ShowCurrLoginfoClick(wxCommandEvent& event); + void OnButton_StartMonitorClick(wxCommandEvent& event); + void OnButton_StopMonitorClick(wxCommandEvent& event); + void OnTimer_WorkThreadTrigger(wxTimerEvent& event); + void OnButton_ShowServerLinkInfoClick(wxCommandEvent& event); + void OnButton_ReconnectServerClick(wxCommandEvent& event); + void OnButton_ShowPSSLisenInfoClick(wxCommandEvent& event); + void OnButton_InsertNewMonitorClick(wxCommandEvent& event); + void OnButton_DeleteOldMonitorClick(wxCommandEvent& event); + void OnButton_ShowWorkThreadStatClick(wxCommandEvent& event); + void OnButton_ShowWorkThreadStatClick1(wxCommandEvent& event); + void OnButton_InsertForbidenClick(wxCommandEvent& event); + void OnButton_ReleaseForbidenClick(wxCommandEvent& event); + void OnButton_ShowForbidenClick(wxCommandEvent& event); + void OnButton_SearchNicknameClick(wxCommandEvent& event); + void OnButton_OpenLogClick(wxCommandEvent& event); + void OnButton_CloselogClick(wxCommandEvent& event); + void OnButton41Click(wxCommandEvent& event); + void OnButton_GetTrackSourceIPClick(wxCommandEvent& event); + void OnButton_SetTrackIPClick(wxCommandEvent& event); + void OnButton_SetTrackCommandIDClick(wxCommandEvent& event); + void OnButton_ShowTrackCommandIDClick(wxCommandEvent& event); + void OnButton_GetWorkThreadParamClick(wxCommandEvent& event); + void OnButton_GetWorkThreadPoolClick(wxCommandEvent& event); + void OnListCtrl_CheckLogBeginDrag(wxListEvent& event); + void OnListCtrl_LinkHistoryBeginDrag(wxListEvent& event); + void OnButton_SetClick(wxCommandEvent& event); + void OnButton_GetServerstateClick(wxCommandEvent& event); + void OnButton_ShowAllModuleClick(wxCommandEvent& event); + void OnButton_LoadModuleClick(wxCommandEvent& event); + void OnButton_LoadConfigfileClick(wxCommandEvent& event); + void OnButton_LoadFileClick(wxCommandEvent& event); + void OnButton_ClearLoadClick(wxCommandEvent& event); + void OnButton_ResetWorkThreadClick(wxCommandEvent& event); + void OnNotebook1PageChanged(wxNotebookEvent& event); + void OnListCtrl_WorkThreadInfoBeginDrag(wxListEvent& event); + void OnTextCtrl_CurrFlowInText(wxCommandEvent& event); + //*) + + //(*Identifiers(PSS_ClientManagerFrame) + static const long ID_STATICBOX1; + static const long ID_STATICBOX2; + static const long ID_STATICTEXT1; + static const long ID_STATICTEXT2; + static const long ID_TEXTCTRL1; + static const long ID_TEXTCTRL2; + static const long ID_STATICTEXT3; + static const long ID_TEXTCTRL3; + static const long ID_BUTTON1; + static const long ID_BUTTON2; + static const long ID_BUTTON3; + static const long ID_LISTBOX1; + static const long ID_BUTTON4; + static const long ID_BUTTON5; + static const long ID_STATICTEXT4; + static const long ID_TEXTCTRL4; + static const long ID_STATICTEXT5; + static const long ID_TEXTCTRL5; + static const long ID_STATICTEXT6; + static const long ID_TEXTCTRL6; + static const long ID_STATICTEXT7; + static const long ID_TEXTCTRL7; + static const long ID_BUTTON6; + static const long ID_BUTTON7; + static const long ID_BUTTON8; + static const long ID_LISTCTRL1; + static const long ID_TEXTCTRL38; + static const long ID_PANEL1; + static const long ID_STATICBOX3; + static const long ID_STATICBOX4; + static const long ID_BUTTON9; + static const long ID_STATICTEXT8; + static const long ID_TEXTCTRL8; + static const long ID_STATICTEXT9; + static const long ID_TEXTCTRL9; + static const long ID_STATICTEXT10; + static const long ID_TEXTCTRL10; + static const long ID_BUTTON10; + static const long ID_STATICTEXT11; + static const long ID_TEXTCTRL11; + static const long ID_BUTTON11; + static const long ID_RADIOBOX1; + static const long ID_STATICTEXT12; + static const long ID_TEXTCTRL12; + static const long ID_BUTTON12; + static const long ID_BUTTON13; + static const long ID_STATICTEXT13; + static const long ID_TEXTCTRL13; + static const long ID_STATICTEXT14; + static const long ID_TEXTCTRL14; + static const long ID_BUTTON14; + static const long ID_STATICTEXT15; + static const long ID_TEXTCTRL15; + static const long ID_BUTTON15; + static const long ID_LISTCTRL2; + static const long ID_PANEL2; + static const long ID_STATICBOX5; + static const long ID_STATICTEXT16; + static const long ID_TEXTCTRL16; + static const long ID_BUTTON16; + static const long ID_BUTTON17; + static const long ID_STATICTEXT17; + static const long ID_LISTCTRL3; + static const long ID_BUTTON18; + static const long ID_BUTTON19; + static const long ID_BUTTON20; + static const long ID_LISTCTRL4; + static const long ID_PANEL3; + static const long ID_STATICBOX6; + static const long ID_STATICTEXT18; + static const long ID_TEXTCTRL17; + static const long ID_BUTTON21; + static const long ID_BUTTON22; + static const long ID_LISTCTRL5; + static const long ID_STATICTEXT19; + static const long ID_TEXTCTRL18; + static const long ID_BUTTON23; + static const long ID_BUTTON24; + static const long ID_LISTCTRL6; + static const long ID_PANEL4; + static const long ID_STATICBOX7; + static const long ID_BUTTON25; + static const long ID_LISTCTRL7; + static const long ID_STATICBOX8; + static const long ID_STATICTEXT20; + static const long ID_TEXTCTRL19; + static const long ID_STATICTEXT21; + static const long ID_TEXTCTRL20; + static const long ID_STATICTEXT22; + static const long ID_BUTTON26; + static const long ID_BUTTON27; + static const long ID_CHECKBOX1; + static const long ID_LISTCTRL8; + static const long ID_RADIOBOX2; + static const long ID_LISTCTRL9; + static const long ID_BUTTON28; + static const long ID_BUTTON29; + static const long ID_PANEL5; + static const long ID_STATICBOX9; + static const long ID_BUTTON30; + static const long ID_STATICTEXT23; + static const long ID_TEXTCTRL21; + static const long ID_BUTTON31; + static const long ID_LISTCTRL10; + static const long ID_LISTCTRL11; + static const long ID_BUTTON32; + static const long ID_STATICBOX10; + static const long ID_STATICTEXT24; + static const long ID_STATICTEXT25; + static const long ID_STATICTEXT26; + static const long ID_TEXTCTRL22; + static const long ID_TEXTCTRL23; + static const long ID_STATICTEXT27; + static const long ID_TEXTCTRL24; + static const long ID_COMBOBOX1; + static const long ID_BUTTON33; + static const long ID_BUTTON34; + static const long ID_PANEL6; + static const long ID_STATICBOX11; + static const long ID_STATICTEXT28; + static const long ID_TEXTCTRL25; + static const long ID_STATICTEXT29; + static const long ID_TEXTCTRL26; + static const long ID_RADIOBOX3; + static const long ID_BUTTON35; + static const long ID_BUTTON36; + static const long ID_BUTTON37; + static const long ID_LISTCTRL12; + static const long ID_STATICTEXT30; + static const long ID_STATICTEXT31; + static const long ID_TEXTCTRL27; + static const long ID_TEXTCTRL28; + static const long ID_BUTTON38; + static const long ID_BUTTON39; + static const long ID_BUTTON40; + static const long ID_LISTCTRL13; + static const long ID_PANEL7; + static const long ID_STATICBOX12; + static const long ID_LISTCTRL14; + static const long ID_STATICTEXT32; + static const long ID_STATICTEXT33; + static const long ID_TEXTCTRL29; + static const long ID_BUTTON41; + static const long ID_TEXTCTRL30; + static const long ID_TEXTCTRL31; + static const long ID_TEXTCTRL32; + static const long ID_BUTTON42; + static const long ID_BUTTON43; + static const long ID_BUTTON44; + static const long ID_STATICTEXT35; + static const long ID_STATICTEXT36; + static const long ID_TEXTCTRL33; + static const long ID_STATICTEXT37; + static const long ID_TEXTCTRL34; + static const long ID_PANEL8; + static const long ID_STATICBOX13; + static const long ID_STATICBOX14; + static const long ID_LISTCTRL15; + static const long ID_CHECKBOX2; + static const long ID_STATICTEXT34; + static const long ID_TEXTCTRL35; + static const long ID_STATICTEXT38; + static const long ID_STATICTEXT39; + static const long ID_TEXTCTRL36; + static const long ID_STATICTEXT40; + static const long ID_STATICTEXT41; + static const long ID_TEXTCTRL37; + static const long ID_STATICTEXT42; + static const long ID_BUTTON45; + static const long ID_BUTTON46; + static const long ID_LISTCTRL16; + static const long ID_LISTCTRL17; + static const long ID_BUTTON47; + static const long ID_PANEL9; + static const long ID_NOTEBOOK1; + static const long ID_TIMER1; + //*) + + //(*Declarations(PSS_ClientManagerFrame) + wxButton* Button_ClearLoad; + wxButton* Button_ClearTimeoutCmd; + wxButton* Button_CloseServer; + wxButton* Button_Closelog; + wxButton* Button_DeleteOldMonitor; + wxButton* Button_DisconnectClient; + wxButton* Button_GetCurrClientCount; + wxButton* Button_GetDebugState; + wxButton* Button_GetLinkHistory; + wxButton* Button_GetServerstate; + wxButton* Button_GetTrackSourceIP; + wxButton* Button_GetWorkThreadParam; + wxButton* Button_GetWorkThreadPool; + wxButton* Button_InsertForbiden; + wxButton* Button_InsertNewMonitor; + wxButton* Button_LoadConfigfile; + wxButton* Button_LoadFile; + wxButton* Button_LoadModule; + wxButton* Button_OpenLog; + wxButton* Button_ReconnectServer; + wxButton* Button_ReleaseForbiden; + wxButton* Button_ReloadModule; + wxButton* Button_ResetWorkThread; + wxButton* Button_SaveSmdHistory; + wxButton* Button_SearchNickname; + wxButton* Button_Set; + wxButton* Button_SetDebug; + wxButton* Button_SetLinkLimit; + wxButton* Button_SetLogLevel; + wxButton* Button_SetTrackCommandID; + wxButton* Button_SetTrackIP; + wxButton* Button_ShowAllCmd; + wxButton* Button_ShowAllModule; + wxButton* Button_ShowClient; + wxButton* Button_ShowCurrLoginfo; + wxButton* Button_ShowForbiden; + wxButton* Button_ShowModuleCmd; + wxButton* Button_ShowPSSLisenInfo; + wxButton* Button_ShowServerLinkInfo; + wxButton* Button_ShowTimeoutCmd; + wxButton* Button_ShowTrackCommandID; + wxButton* Button_ShowWorkThreadStat; + wxButton* Button_StartFile; + wxButton* Button_StartMonitor; + wxButton* Button_StopFile; + wxButton* Button_StopMonitor; + wxButton* Button_UnloadModule; + wxCheckBox* CheckBox_Voice; + wxCheckBox* CheckBox_WorkThread; + wxComboBox* ComboBox_ListenType; + wxListBox* ListBox_ConfigList; + wxListCtrl* ListCtr_WorkThreadTimeout; + wxListCtrl* ListCtrl_CheckLog; + wxListCtrl* ListCtrl_ClientTcpInfo; + wxListCtrl* ListCtrl_CommandTimeout; + wxListCtrl* ListCtrl_ForbidenList; + wxListCtrl* ListCtrl_LinkHistory; + wxListCtrl* ListCtrl_LogInfo; + wxListCtrl* ListCtrl_ModuleInfo; + wxListCtrl* ListCtrl_ModuleList; + wxListCtrl* ListCtrl_NickInfo; + wxListCtrl* ListCtrl_ServerConnect; + wxListCtrl* ListCtrl_ServerLisen; + wxListCtrl* ListCtrl_ServerList; + wxListCtrl* ListCtrl_TrackIPHistory; + wxListCtrl* ListCtrl_WorkThreadAI; + wxListCtrl* ListCtrl_WorkThreadForbiden; + wxListCtrl* ListCtrl_WorkThreadInfo; + wxNotebook* Notebook1; + wxPanel* Panel1; + wxPanel* Panel2; + wxPanel* Panel3; + wxPanel* Panel4; + wxPanel* Panel5; + wxPanel* Panel6; + wxPanel* Panel7; + wxPanel* Panel8; + wxPanel* Panel9; + wxRadioBox* RadioBox_DebugState; + wxRadioBox* RadioBox_MonitorServer; + wxRadioBox* RadioBoxm_TimeForbiden; + wxStaticBox* StaticBox10; + wxStaticBox* StaticBox11; + wxStaticBox* StaticBox12; + wxStaticBox* StaticBox13; + wxStaticBox* StaticBox14; + wxStaticBox* StaticBox1; + wxStaticBox* StaticBox2; + wxStaticBox* StaticBox3; + wxStaticBox* StaticBox4; + wxStaticBox* StaticBox5; + wxStaticBox* StaticBox6; + wxStaticBox* StaticBox7; + wxStaticBox* StaticBox8; + wxStaticBox* StaticBox9; + wxStaticText* StaticText10; + wxStaticText* StaticText11; + wxStaticText* StaticText12; + wxStaticText* StaticText13; + wxStaticText* StaticText14; + wxStaticText* StaticText15; + wxStaticText* StaticText16; + wxStaticText* StaticText17; + wxStaticText* StaticText18; + wxStaticText* StaticText19; + wxStaticText* StaticText1; + wxStaticText* StaticText20; + wxStaticText* StaticText21; + wxStaticText* StaticText22; + wxStaticText* StaticText23; + wxStaticText* StaticText24; + wxStaticText* StaticText25; + wxStaticText* StaticText26; + wxStaticText* StaticText27; + wxStaticText* StaticText28; + wxStaticText* StaticText29; + wxStaticText* StaticText2; + wxStaticText* StaticText30; + wxStaticText* StaticText31; + wxStaticText* StaticText32; + wxStaticText* StaticText33; + wxStaticText* StaticText34; + wxStaticText* StaticText35; + wxStaticText* StaticText36; + wxStaticText* StaticText37; + wxStaticText* StaticText38; + wxStaticText* StaticText39; + wxStaticText* StaticText3; + wxStaticText* StaticText40; + wxStaticText* StaticText41; + wxStaticText* StaticText42; + wxStaticText* StaticText4; + wxStaticText* StaticText5; + wxStaticText* StaticText6; + wxStaticText* StaticText7; + wxStaticText* StaticText8; + wxStaticText* StaticText9; + wxTextCtrl* TextCtr_TrackConnectID; + wxTextCtrl* TextCtr_TrackIP; + wxTextCtrl* TextCtrl_CheckTime; + wxTextCtrl* TextCtrl_ClientID; + wxTextCtrl* TextCtrl_ConnectID; + wxTextCtrl* TextCtrl_CurrClientCount; + wxTextCtrl* TextCtrl_CurrCpuOccupy; + wxTextCtrl* TextCtrl_CurrDebugStat; + wxTextCtrl* TextCtrl_CurrFlowIn; + wxTextCtrl* TextCtrl_CurrFlowOut; + wxTextCtrl* TextCtrl_CurrMemOccupy; + wxTextCtrl* TextCtrl_ForbidenIP; + wxTextCtrl* TextCtrl_ForbidenSeconds; + wxTextCtrl* TextCtrl_IPInfo; + wxTextCtrl* TextCtrl_LinkUpperLimit; + wxTextCtrl* TextCtrl_LisenIP; + wxTextCtrl* TextCtrl_LisenPort; + wxTextCtrl* TextCtrl_LogLevel; + wxTextCtrl* TextCtrl_ModuleFilename; + wxTextCtrl* TextCtrl_ModuleID; + wxTextCtrl* TextCtrl_ModuleName; + wxTextCtrl* TextCtrl_ModuleParam; + wxTextCtrl* TextCtrl_ModulePath; + wxTextCtrl* TextCtrl_NickName; + wxTextCtrl* TextCtrl_PacketFile; + wxTextCtrl* TextCtrl_PacketParseID; + wxTextCtrl* TextCtrl_ServerID; + wxTextCtrl* TextCtrl_ServerIP; + wxTextCtrl* TextCtrl_ServerInfo; + wxTextCtrl* TextCtrl_ServerKey; + wxTextCtrl* TextCtrl_ServerPort; + wxTextCtrl* TextCtrl_ThreadCount; + wxTextCtrl* TextCtrl_TracCommandCount; + wxTextCtrl* TextCtrl_TrackCommandID; + wxTextCtrl* TextCtrl_TrackIPCount; + wxTextCtrl* TextCtrl_WorkThreadCheckTime; + wxTextCtrl* TextCtrl_WorkThreadDisposeTime; + wxTextCtrl* TextCtrl_WorkThreadStopTime; + wxTimer Timer_WorkThread; + //*) + + DECLARE_EVENT_TABLE() + +private: + void ChangeConfigFile(); + void LoadConfigFile(); + void ShowConfigList(); + +public: + + void SetTcpClientConnect(CTcpClientConnect* pTcpClientConnect); + void CheckWorkThread(_CheckServerInfo* pCheckServerInfo); + void BeepAlarm(); + void ShowGroupServerList(); + void ClearCheckServerInfo(); + +private: + bool SendSetLog(int nConnectID, bool blFlag); + + +private: + bool m_blTimeRun; + + //集群监控参数 + vecCheckServerInfo m_vecCheckServerInfo; + vecCheckServer m_vecCheckServer; + + +private: + CXmlOpeation m_objXmlOpeation; + vecConfigInfo m_vecConfigInfo; + +private: + void Init(); + + CTcpClientConnect m_TcpClientConnect; + CTcpClientConnect* m_pTcpClientConnect; + +}; + +#endif // PSS_CLIENTMANAGERMAIN_H diff --git a/TestNetworkTool/PSS_ClientManager/PSS_ClientManager_wx.ico b/TestNetworkTool/PSS_ClientManager/PSS_ClientManager_wx.ico new file mode 100644 index 000000000..b3ec03bd6 Binary files /dev/null and b/TestNetworkTool/PSS_ClientManager/PSS_ClientManager_wx.ico differ diff --git a/TestNetworkTool/PSS_ClientManager/small.ico b/TestNetworkTool/PSS_ClientManager/small.ico new file mode 100644 index 000000000..b3ec03bd6 Binary files /dev/null and b/TestNetworkTool/PSS_ClientManager/small.ico differ diff --git a/TestNetworkTool/PSS_ClientManager/wxsmith/PSS_ClientManagerframe.wxs b/TestNetworkTool/PSS_ClientManager/wxsmith/PSS_ClientManagerframe.wxs new file mode 100644 index 000000000..c0b03572c --- /dev/null +++ b/TestNetworkTool/PSS_ClientManager/wxsmith/PSS_ClientManagerframe.wxs @@ -0,0 +1,848 @@ + + + + PSS__ClientManager + 1 + ./small.ico + 923,506 + 0 + + + 0,-16 + 1240,506 + + + 899,461 + + + 8,8 + 832,224 + + + + 8,232 + 832,224 + + + + 16,40 + + + + 16,80 + + + 127.0.0.1 + 16 + 88,32 + 114,35 + + + freeeyes + 88,72 + 114,35 + + + + 216,40 + + + 10010 + 5 + 284,32 + 114,35 + + + + 400,32 + + + + + 496,32 + + + + + 216,72 + 392,35 + + + + + Windows PSS + Linux PSS + + 616,72 + 136,152 + + + + + 616,32 + 136,34 + + + + + 24,264 + + + + + 136,272 + + + 200,264 + 160,35 + + + + 368,272 + + + 432,264 + 210,35 + + + + 24,312 + + + 88,304 + 168,35 + + + + + 264,312 + + + 328,304 + 218,35 + + + + 664,264 + + + + + 560,304 + + + + + 664,304 + + + + 16,344 + 736,112 + + + + + 16,112 + 592,112 + + + + + + + + + + 16,248 + 808,200 + + + + 16,8 + 808,240 + + + + 32,32 + + + + + 210,40 + + + 296,36 + 0 + + + + + 416,40 + + + 496,36 + 0 + + + + 616,40 + + + 696,36 + 0 + + + + 32,72 + 152,34 + + + + + 210,80 + + + 296,76 + + + + 32,112 + + + + + + DEBUG开启 + DEBUG关闭 + + 144,106 + + + + + 504,120 + + + 616,116 + 0 + + + + 400,112 + + + + + 32,160 + + + + + 40,208 + + + 136,204 + 0 + + + + 256,208 + + + 360,204 + 0 + + + + 136,160 + + + + + 256,168 + + + FileTestCfg.xml + 360,160 + 440,35 + + + + 24,280 + 224,32 + + + + 24,320 + 776,120 + + + + + + + + + + 8,8 + 824,448 + + + + 24,40 + + + 88,36 + + + + + 232,32 + + + + + 360,32 + 0 + + + + + 456,40 + + + 24,80 + 792,168 + + + + + 40,256 + + + + + 176,256 + + + + + 312,256 + + + + 24,304 + 792,144 + + + + + + + + + + 8,8 + 824,448 + + + + 24,32 + + + 168,28 + + + + 304,24 + + + + + 408,24 + + + + 24,64 + 792,192 + + + + + 16,272 + + + 1 + 112,268 + + + + 232,264 + + + + + 352,264 + + + + 24,312 + 792,136 + + + + + + + + + + 8,8 + 832,448 + + + + 24,32 + + + + 24,72 + 808,160 + + + + + 16,240 + 816,216 + + + + 20,264 + + + 3 + 128,260 + + + + 244,264 + + + 60 + 304,260 + + + + 418,264 + + + + 480,256 + + + + + 584,256 + + + + + 680,260 + + + 24,296 + 448,152 + + + + + + 监控当前服务器 + 监控列表服务器 + + 480,282 + 336,48 + + + + 480,336 + 344,72 + + + + + 480,416 + + + + + 736,416 + + + + + + + + + + 0,8 + 856,440 + + + + 16,32 + + + + + 16,76 + + + 72,72 + + + + 200,70 + + + + 16,112 + 824,136 + + + + 16,296 + 328,136 + + + + + 8,256 + + + + + 368,256 + 472,184 + + + + 392,288 + + + + 392,328 + + + + 392,368 + + + 16 + 456,284 + + + 0 + 5 + 456,324 + + + + 600,328 + + + 688,324 + + + + IPv4 + IPv6 + + 0 + 456,364 + 112,25 + + + + 392,400 + + + + + 560,400 + + + + + + + + + + 8,0 + 792,440 + + + + 24,28 + + + 16 + 160,24 + + + + 312,28 + + + 400,24 + + + + + 时段封禁 + 永久封禁 + + 536,6 + 240,50 + + + + + 24,64 + + + + + 144,64 + + + + + 264,64 + + + + 24,104 + 768,160 + + + + + 24,280 + + + + 24,312 + + + 128,276 + + + 128,308 + + + + 264,272 + + + + + 264,312 + + + + + 360,312 + + + + 24,352 + 768,104 + + + + + + + + + + 8,8 + 816,184 + + + 8,200 + 816,256 + + + + + 24,40 + + + + 24,80 + + + 152,32 + 136,35 + + + + 304,32 + 96,35 + + + + 408,32 + 136,35 + 0 + + + 127.0.0.1 + 152,72 + 136,35 + + + 1 + 408,72 + 136,35 + + + + 560,112 + 128,35 + + + + + 560,72 + 128,35 + + + + + 16,152 + + + + + 312,80 + + + + 24,120 + + + 0x1000 + 152,112 + 136,35 + + + + 312,120 + + + 1 + 408,112 + 136,35 + + + + + + + + + 8,8 + 864,224 + + + + 8,240 + 864,216 + + + 16,40 + 600,184 + + + + + 632,40 + 184,24 + + + + 632,72 + + + 40 + 704,64 + + + + 816,72 + + + + 632,112 + + + 30 + 704,104 + + + + 816,112 + + + + 632,152 + + + 30 + 704,144 + + + + 816,152 + + + + 632,192 + + + + + 720,192 + + + + 16,264 + 408,184 + + + + 440,264 + 280,184 + + + + + 728,408 + + + + + + + + 60000 + + + + diff --git a/TestNetworkTool/PassTCP.cbp b/TestNetworkTool/PassTCP.cbp new file mode 100644 index 000000000..558e38396 --- /dev/null +++ b/TestNetworkTool/PassTCP.cbp @@ -0,0 +1,198 @@ + + + + + + diff --git a/TestNetworkTool/PassTCP.depend b/TestNetworkTool/PassTCP.depend new file mode 100644 index 000000000..b2e073128 --- /dev/null +++ b/TestNetworkTool/PassTCP.depend @@ -0,0 +1,1882 @@ +# depslib dependency file v1.0 +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp + "tinystr.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.h + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp + + + + "tinyxml.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.h + + + + + + + + + "tinystr.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp + "tinyxml.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp + + + "tinyxml.h" + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp + + + + "sock_wrap.h" + + + + + + + + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.h + + + + + + + + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua/LuaFn.cpp + "LuaFn.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua/LuaFn.h + "LuaFnRegister.h" + "ParamData.h" + + "LuaFn_Tcp.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua/LuaFnRegister.h + "LuaDefine.h" + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua/LuaDefine.h + "lua.h" + "lualib.h" + "lauxlib.h" + "tolua++.h" + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib//lua.h + + + "luaconf.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib//luaconf.h + + + + + + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib//lualib.h + "lua.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib//lauxlib.h + + + "lua.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib//tolua++.h + "lua.h" + "lauxlib.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua/ParamData.h + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua/LuaFn_Tcp.h + "LuaDefine.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lapi.c + + + + + "lua.h" + "lapi.h" + "ldebug.h" + "ldo.h" + "lfunc.h" + "lgc.h" + "lmem.h" + "lobject.h" + "lstate.h" + "lstring.h" + "ltable.h" + "ltm.h" + "lundump.h" + "lvm.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lua.h + + + "luaconf.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/luaconf.h + + + + + + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lapi.h + "lobject.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lobject.h + + "llimits.h" + "lua.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/llimits.h + + + "lua.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldebug.h + "lstate.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstate.h + "lua.h" + "lobject.h" + "ltm.h" + "lzio.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltm.h + "lobject.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lzio.h + "lua.h" + "lmem.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lmem.h + + "llimits.h" + "lua.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldo.h + "lobject.h" + "lstate.h" + "lzio.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lfunc.h + "lobject.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lgc.h + "lobject.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstring.h + "lgc.h" + "lobject.h" + "lstate.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltable.h + "lobject.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lundump.h + "lobject.h" + "lzio.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lvm.h + "ldo.h" + "lobject.h" + "ltm.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lauxlib.c + + + + + + + "lua.h" + "lauxlib.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lauxlib.h + + + "lua.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lbaselib.c + + + + + "lua.h" + "lauxlib.h" + "lualib.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lualib.h + "lua.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lcode.c + + "lua.h" + "lcode.h" + "ldebug.h" + "ldo.h" + "lgc.h" + "llex.h" + "lmem.h" + "lobject.h" + "lopcodes.h" + "lparser.h" + "ltable.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lcode.h + "llex.h" + "lobject.h" + "lopcodes.h" + "lparser.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/llex.h + "lobject.h" + "lzio.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lopcodes.h + "llimits.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lparser.h + "llimits.h" + "lobject.h" + "lzio.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldblib.c + + + + "lua.h" + "lauxlib.h" + "lualib.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldebug.c + + + + "lua.h" + "lapi.h" + "lcode.h" + "ldebug.h" + "ldo.h" + "lfunc.h" + "lobject.h" + "lopcodes.h" + "lstate.h" + "lstring.h" + "ltable.h" + "ltm.h" + "lvm.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldo.c + + + + "lua.h" + "ldebug.h" + "ldo.h" + "lfunc.h" + "lgc.h" + "lmem.h" + "lobject.h" + "lopcodes.h" + "lparser.h" + "lstate.h" + "lstring.h" + "ltable.h" + "ltm.h" + "lundump.h" + "lvm.h" + "lzio.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldump.c + + "lua.h" + "lobject.h" + "lstate.h" + "lundump.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lfunc.c + + "lua.h" + "lfunc.h" + "lgc.h" + "lmem.h" + "lobject.h" + "lstate.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lgc.c + + "lua.h" + "ldebug.h" + "ldo.h" + "lfunc.h" + "lgc.h" + "lmem.h" + "lobject.h" + "lstate.h" + "lstring.h" + "ltable.h" + "ltm.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/linit.c + "lua.h" + "lualib.h" + "lauxlib.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/liolib.c + + + + + "lua.h" + "lauxlib.h" + "lualib.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/llex.c + + + + "lua.h" + "ldo.h" + "llex.h" + "lobject.h" + "lparser.h" + "lstate.h" + "lstring.h" + "ltable.h" + "lzio.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lmathlib.c + + + "lua.h" + "lauxlib.h" + "lualib.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lmem.c + + "lua.h" + "ldebug.h" + "ldo.h" + "lmem.h" + "lobject.h" + "lstate.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/loadlib.c + + + "lua.h" + "lauxlib.h" + "lualib.h" + + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lobject.c + + + + + + "lua.h" + "ldo.h" + "lmem.h" + "lobject.h" + "lstate.h" + "lstring.h" + "lvm.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lopcodes.c + "lopcodes.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/loslib.c + + + + + + "lua.h" + "lauxlib.h" + "lualib.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lparser.c + + "lua.h" + "lcode.h" + "ldebug.h" + "ldo.h" + "lfunc.h" + "llex.h" + "lmem.h" + "lobject.h" + "lopcodes.h" + "lparser.h" + "lstate.h" + "lstring.h" + "ltable.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstate.c + + "lua.h" + "ldebug.h" + "ldo.h" + "lfunc.h" + "lgc.h" + "llex.h" + "lmem.h" + "lstate.h" + "lstring.h" + "ltable.h" + "ltm.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstring.c + + "lua.h" + "lmem.h" + "lobject.h" + "lstate.h" + "lstring.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstrlib.c + + + + + + "lua.h" + "lauxlib.h" + "lualib.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltable.c + + + "lua.h" + "ldebug.h" + "ldo.h" + "lgc.h" + "lmem.h" + "lobject.h" + "lstate.h" + "ltable.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltablib.c + + "lua.h" + "lauxlib.h" + "lualib.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltm.c + + "lua.h" + "lobject.h" + "lstate.h" + "lstring.h" + "ltable.h" + "ltm.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lundump.c + + "lua.h" + "ldebug.h" + "ldo.h" + "lfunc.h" + "lmem.h" + "lobject.h" + "lstring.h" + "lundump.h" + "lzio.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lvm.c + + + + "lua.h" + "ldebug.h" + "ldo.h" + "lfunc.h" + "lgc.h" + "lobject.h" + "lopcodes.h" + "lstate.h" + "lstring.h" + "ltable.h" + "ltm.h" + "lvm.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lzio.c + + "lua.h" + "llimits.h" + "lmem.h" + "lstate.h" + "lzio.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/print.c + + + "ldebug.h" + "lobject.h" + "lopcodes.h" + "lundump.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_event.c + + "tolua++.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua++.h + "lua.h" + "lauxlib.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_is.c + "tolua++.h" + "lauxlib.h" + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_map.c + "tolua++.h" + "tolua_event.h" + "lauxlib.h" + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_event.h + "tolua++.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_push.c + "tolua++.h" + "lauxlib.h" + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_to.c + "tolua++.h" + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/toluabind.c + "stdlib.h" + "string.h" + "tolua++.h" + +1553654185 source:/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/ClientTcpSocket.cpp + "ClientTcpSocket.h" + +1553654185 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/ClientTcpSocket.h + "define.h" + "LuaFn.h" + "sock_wrap.h" + +1553655709 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/define.h + + + + + + + + + + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua//LuaFn.h + "LuaFnRegister.h" + "ParamData.h" + + "LuaFn_Tcp.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua//LuaFnRegister.h + "LuaDefine.h" + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua//LuaDefine.h + "lua.h" + "lualib.h" + "lauxlib.h" + "tolua++.h" + + + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua//ParamData.h + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua//LuaFn_Tcp.h + "LuaDefine.h" + +1553655281 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//sock_wrap.h + + + + + + + + + + +1553654185 source:/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/ClientUdpSocket.cpp + "ClientUdpSocket.h" + +1553654185 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/ClientUdpSocket.h + "define.h" + "LuaFn.h" + "sock_wrap.h" + +1553736512 source:/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PacketDlg.cpp + "tinyxml.h" + + + + + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML//tinyxml.h + + + + + + + + + "tinystr.h" + +1553654185 /data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML//tinystr.h + + + +1536665357 /usr/include/wx-3.0/wx/intl.h + "wx/defs.h" + "wx/string.h" + "wx/translation.h" + "wx/fontenc.h" + "wx/language.h" + +1536665357 /usr/include/wx-3.0/wx/defs.h + "wx/platform.h" + "wx/version.h" + "wx/dlimpexp.h" + + "wx/debug.h" + + + "wx/windowid.h" + + "wx/msw/winundef.h" + "wx/features.h" + +1536665357 /usr/include/wx-3.0/wx/platform.h + + + + "wx/osx/config_xcode.h" + "wx/android/config_android.h" + "wx/compiler.h" + "wx/setup.h" + "wx/msw/wince/libraries.h" + "wx/msw/libraries.h" + "wx/msw/gccpriv.h" + + + "wx/chkconf.h" + +1536665357 /usr/include/wx-3.0/wx/compiler.h + +1536665357 /usr/lib/wx/include/gtk2-unicode-3.0/wx/setup.h + +1536665357 /usr/include/wx-3.0/wx/chkconf.h + "wx/msw/wince/chkconf.h" + "wx/msw/chkconf.h" + "wx/gtk/chkconf.h" + "wx/gtk/chkconf.h" + "wx/cocoa/chkconf.h" + "wx/osx/chkconf.h" + "wx/os2/chkconf.h" + "wx/dfb/chkconf.h" + "wx/motif/chkconf.h" + "wx/x11/chkconf.h" + "wx/android/chkconf.h" + "wx/unix/chkconf.h" + "wx/univ/chkconf.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/chkconf.h + +1536665357 /usr/include/wx-3.0/wx/unix/chkconf.h + +1536665357 /usr/include/wx-3.0/wx/version.h + "wx/cpp.h" + +1536665357 /usr/include/wx-3.0/wx/cpp.h + "wx/compiler.h" + +1536665357 /usr/include/wx-3.0/wx/dlimpexp.h + +1536665357 /usr/include/wx-3.0/wx/debug.h + + + "wx/chartype.h" + "wx/cpp.h" + "wx/dlimpexp.h" + +1536665357 /usr/include/wx-3.0/wx/chartype.h + "wx/platform.h" + + + + + + + + + + + + +1536665357 /usr/include/wx-3.0/wx/windowid.h + +1536665357 /usr/include/wx-3.0/wx/features.h + +1536665357 /usr/include/wx-3.0/wx/string.h + "wx/defs.h" + + + + + + + + + + + "wx/wxcrtbase.h" + "wx/strvararg.h" + "wx/buffer.h" + "wx/strconv.h" + "wx/stringimpl.h" + "wx/stringops.h" + "wx/unichar.h" + "wx/tls.h" + "wx/iosfwrap.h" + "wx/crt.h" + +1536665357 /usr/include/wx-3.0/wx/wxcrtbase.h + "wx/chartype.h" + + + + + + + +1536665357 /usr/include/wx-3.0/wx/strvararg.h + "wx/platform.h" + "wx/cpp.h" + "wx/chartype.h" + "wx/strconv.h" + "wx/buffer.h" + "wx/unichar.h" + + + + "wx/stringimpl.h" + +1536665357 /usr/include/wx-3.0/wx/strconv.h + "wx/defs.h" + "wx/chartype.h" + "wx/buffer.h" + "typeinfo.h" + + "wx/fontenc.h" + +1536665357 /usr/include/wx-3.0/wx/buffer.h + "wx/chartype.h" + "wx/wxcrtbase.h" + + +1536665357 /usr/include/wx-3.0/wx/typeinfo.h + "wx/defs.h" + + + +1536665357 /usr/include/wx-3.0/wx/fontenc.h + +1536665357 /usr/include/wx-3.0/wx/unichar.h + "wx/defs.h" + "wx/chartype.h" + "wx/stringimpl.h" + +1536665357 /usr/include/wx-3.0/wx/stringimpl.h + "wx/defs.h" + "wx/chartype.h" + "wx/wxcrtbase.h" + + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/beforestd.h + +1536665357 /usr/include/wx-3.0/wx/afterstd.h + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/stringops.h + "wx/chartype.h" + "wx/stringimpl.h" + "wx/unichar.h" + "wx/buffer.h" + +1536665357 /usr/include/wx-3.0/wx/tls.h + "wx/defs.h" + "wx/msw/tls.h" + "wx/os2/tls.h" + "wx/unix/tls.h" + + +1536665357 /usr/include/wx-3.0/wx/unix/tls.h + + +1536665357 /usr/include/wx-3.0/wx/iosfwrap.h + + + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/crt.h + "wx/defs.h" + "wx/chartype.h" + "wx/wxcrt.h" + "wx/wxcrtvararg.h" + +1536665357 /usr/include/wx-3.0/wx/wxcrt.h + "wx/wxcrtbase.h" + "wx/string.h" + + +1536665357 /usr/include/wx-3.0/wx/wxcrtvararg.h + "wx/wxcrt.h" + "wx/strvararg.h" + "wx/string.h" + + +1536665357 /usr/include/wx-3.0/wx/translation.h + "wx/defs.h" + "wx/string.h" + "wx/buffer.h" + "wx/language.h" + "wx/hashmap.h" + "wx/strconv.h" + "wx/scopedptr.h" + +1536665357 /usr/include/wx-3.0/wx/language.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/hashmap.h + "wx/string.h" + "wx/wxcrt.h" + + + + + + +1536665357 /usr/include/wx-3.0/wx/scopedptr.h + "wx/defs.h" + "wx/checkeddelete.h" + +1536665357 /usr/include/wx-3.0/wx/checkeddelete.h + "wx/cpp.h" + +1536665357 /usr/include/wx-3.0/wx/msgdlg.h + "wx/defs.h" + "wx/dialog.h" + "wx/stockitem.h" + "wx/generic/msgdlgg.h" + "wx/cocoa/msgdlg.h" + "wx/msw/msgdlg.h" + "wx/motif/msgdlg.h" + "wx/gtk/msgdlg.h" + "wx/osx/msgdlg.h" + "wx/os2/msgdlg.h" + +1536665357 /usr/include/wx-3.0/wx/dialog.h + "wx/toplevel.h" + "wx/containr.h" + "wx/sharedptr.h" + "wx/univ/dialog.h" + "wx/msw/dialog.h" + "wx/motif/dialog.h" + "wx/gtk/dialog.h" + "wx/gtk1/dialog.h" + "wx/osx/dialog.h" + "wx/cocoa/dialog.h" + "wx/os2/dialog.h" + +1536665357 /usr/include/wx-3.0/wx/toplevel.h + "wx/nonownedwnd.h" + "wx/iconbndl.h" + "wx/weakref.h" + "wx/msw/toplevel.h" + "wx/gtk/toplevel.h" + "wx/gtk1/toplevel.h" + "wx/x11/toplevel.h" + "wx/dfb/toplevel.h" + "wx/osx/toplevel.h" + "wx/cocoa/toplevel.h" + "wx/os2/toplevel.h" + "wx/motif/toplevel.h" + "wx/univ/toplevel.h" + +1536665357 /usr/include/wx-3.0/wx/nonownedwnd.h + "wx/window.h" + "wx/dfb/nonownedwnd.h" + "wx/gtk/nonownedwnd.h" + "wx/osx/nonownedwnd.h" + "wx/msw/nonownedwnd.h" + +1536665357 /usr/include/wx-3.0/wx/window.h + "wx/event.h" + "wx/list.h" + "wx/cursor.h" + "wx/font.h" + "wx/colour.h" + "wx/region.h" + "wx/utils.h" + "wx/intl.h" + "wx/validate.h" + "wx/palette.h" + "wx/accel.h" + "wx/access.h" + "wx/msw/window.h" + "wx/motif/window.h" + "wx/gtk/window.h" + "wx/gtk1/window.h" + "wx/x11/window.h" + "wx/dfb/window.h" + "wx/osx/window.h" + "wx/cocoa/window.h" + "wx/os2/window.h" + "wx/univ/window.h" + +1536665357 /usr/include/wx-3.0/wx/event.h + "wx/defs.h" + "wx/cpp.h" + "wx/object.h" + "wx/clntdata.h" + "wx/gdicmn.h" + "wx/cursor.h" + "wx/mousestate.h" + "wx/dynarray.h" + "wx/thread.h" + "wx/tracker.h" + "wx/typeinfo.h" + "wx/any.h" + "wx/meta/convertible.h" + "wx/meta/removeref.h" + +1536665357 /usr/include/wx-3.0/wx/object.h + "wx/memory.h" + "wx/xti.h" + "wx/rtti.h" + "wx/xti2.h" + "wx/msw/msvcrt.h" + +1536665357 /usr/include/wx-3.0/wx/memory.h + "wx/defs.h" + "wx/string.h" + "wx/msgout.h" + + +1536665357 /usr/include/wx-3.0/wx/msgout.h + "wx/defs.h" + "wx/chartype.h" + "wx/strvararg.h" + +1536665357 /usr/include/wx-3.0/wx/xti.h + "wx/defs.h" + "wx/xtitypes.h" + "wx/xtihandler.h" + +1536665357 /usr/include/wx-3.0/wx/xtitypes.h + "wx/defs.h" + "wx/string.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/flags.h" + "wx/intl.h" + "wx/log.h" + + +1536665357 /usr/include/wx-3.0/wx/arrstr.h + "wx/defs.h" + "wx/string.h" + "wx/dynarray.h" + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/dynarray.h + "wx/defs.h" + "wx/beforestd.h" + + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/flags.h + +1536665357 /usr/include/wx-3.0/wx/log.h + "wx/defs.h" + "wx/cpp.h" + "wx/string.h" + "wx/strvararg.h" + "wx/arrstr.h" + + "wx/dynarray.h" + "wx/hashmap.h" + "wx/thread.h" + "wx/iosfwrap.h" + "wx/generic/logg.h" + "wx/cocoa/log.h" + +1536665357 /usr/include/wx-3.0/wx/thread.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/generic/logg.h + +1536665357 /usr/include/wx-3.0/wx/xtihandler.h + "wx/defs.h" + "wx/xti.h" + +1536665357 /usr/include/wx-3.0/wx/rtti.h + "wx/memory.h" + "wx/flags.h" + +1536665357 /usr/include/wx-3.0/wx/xti2.h + "wx/xtiprop.h" + "wx/xtictor.h" + +1536665357 /usr/include/wx-3.0/wx/xtiprop.h + "wx/defs.h" + "wx/xti.h" + "wx/any.h" + +1536665357 /usr/include/wx-3.0/wx/any.h + "wx/defs.h" + + "wx/string.h" + "wx/meta/if.h" + "wx/typeinfo.h" + "wx/list.h" + "wx/datetime.h" + "wx/variant.h" + +1536665357 /usr/include/wx-3.0/wx/meta/if.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/list.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/vector.h" + "wx/beforestd.h" + + + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/vector.h + "wx/defs.h" + + + "wx/scopeguard.h" + "wx/meta/movable.h" + "wx/meta/if.h" + "wx/beforestd.h" + + "wx/afterstd.h" + +1536665357 /usr/include/wx-3.0/wx/scopeguard.h + "wx/defs.h" + "wx/except.h" + +1536665357 /usr/include/wx-3.0/wx/except.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/meta/movable.h + "wx/meta/pod.h" + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/meta/pod.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/datetime.h + "wx/defs.h" + "wx/msw/wince/time.h" + + + "wx/longlong.h" + "wx/anystr.h" + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/longlong.h + "wx/defs.h" + "wx/string.h" + + "wx/iosfwrap.h" + + "wx/strvararg.h" + +1536665357 /usr/include/wx-3.0/wx/anystr.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/variant.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/arrstr.h" + "wx/list.h" + "wx/cpp.h" + "wx/longlong.h" + "wx/datetime.h" + "wx/iosfwrap.h" + "wx/any.h" + +1536665357 /usr/include/wx-3.0/wx/xtictor.h + "wx/defs.h" + "wx/xti.h" + +1536665357 /usr/include/wx-3.0/wx/clntdata.h + "wx/defs.h" + "wx/string.h" + "wx/hashmap.h" + +1536665357 /usr/include/wx-3.0/wx/gdicmn.h + "wx/defs.h" + "wx/list.h" + "wx/string.h" + "wx/fontenc.h" + "wx/hashmap.h" + "wx/math.h" + +1536665357 /usr/include/wx-3.0/wx/math.h + "wx/defs.h" + + + + + +1536665357 /usr/include/wx-3.0/wx/cursor.h + "wx/defs.h" + "wx/msw/cursor.h" + "wx/motif/cursor.h" + "wx/gtk/cursor.h" + "wx/gtk1/cursor.h" + "wx/x11/cursor.h" + "wx/dfb/cursor.h" + "wx/osx/cursor.h" + "wx/cocoa/cursor.h" + "wx/os2/cursor.h" + "wx/utils.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/cursor.h + "wx/gdiobj.h" + "wx/gdicmn.h" + +1536665357 /usr/include/wx-3.0/wx/gdiobj.h + "wx/object.h" + +1536665357 /usr/include/wx-3.0/wx/utils.h + "wx/object.h" + "wx/list.h" + "wx/filefn.h" + "wx/hashmap.h" + "wx/versioninfo.h" + "wx/meta/implicitconversion.h" + "wx/gdicmn.h" + "wx/mousestate.h" + "wx/longlong.h" + "wx/platinfo.h" + + + + + +1536665357 /usr/include/wx-3.0/wx/filefn.h + "wx/list.h" + "wx/arrstr.h" + "wx/msw/wince/time.h" + "wx/msw/private.h" + + + + + "wx/os2/private.h" + + + + + + + + + + + + + + + + + +1536665357 /usr/include/wx-3.0/wx/versioninfo.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/meta/implicitconversion.h + "wx/defs.h" + "wx/meta/if.h" + +1536665357 /usr/include/wx-3.0/wx/mousestate.h + "wx/gdicmn.h" + "wx/kbdstate.h" + +1536665357 /usr/include/wx-3.0/wx/kbdstate.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/platinfo.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/tracker.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/meta/convertible.h + +1536665357 /usr/include/wx-3.0/wx/meta/removeref.h + +1536665357 /usr/include/wx-3.0/wx/font.h + "wx/defs.h" + "wx/fontenc.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/font.h" + "wx/motif/font.h" + "wx/gtk/font.h" + "wx/gtk1/font.h" + "wx/x11/font.h" + "wx/dfb/font.h" + "wx/osx/font.h" + "wx/cocoa/font.h" + "wx/os2/font.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/font.h + +1536665357 /usr/include/wx-3.0/wx/colour.h + "wx/defs.h" + "wx/gdiobj.h" + "wx/variant.h" + "wx/msw/colour.h" + "wx/motif/colour.h" + "wx/gtk/colour.h" + "wx/gtk1/colour.h" + "wx/generic/colour.h" + "wx/x11/colour.h" + "wx/osx/colour.h" + "wx/cocoa/colour.h" + "wx/os2/colour.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/colour.h + +1536665357 /usr/include/wx-3.0/wx/region.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/region.h" + "wx/gtk/region.h" + "wx/gtk1/region.h" + "wx/x11/region.h" + "wx/dfb/region.h" + "wx/osx/region.h" + "wx/cocoa/region.h" + "wx/os2/region.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/region.h + +1536665357 /usr/include/wx-3.0/wx/validate.h + "wx/defs.h" + "wx/event.h" + +1536665357 /usr/include/wx-3.0/wx/palette.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/msw/palette.h" + "wx/x11/palette.h" + "wx/generic/paletteg.h" + "wx/osx/palette.h" + "wx/os2/palette.h" + +1536665357 /usr/include/wx-3.0/wx/generic/paletteg.h + "wx/defs.h" + "wx/object.h" + "wx/gdiobj.h" + "wx/gdicmn.h" + +1536665357 /usr/include/wx-3.0/wx/accel.h + "wx/defs.h" + "wx/object.h" + "wx/generic/accel.h" + "wx/msw/accel.h" + "wx/motif/accel.h" + "wx/gtk/accel.h" + "wx/gtk1/accel.h" + "wx/osx/accel.h" + "wx/generic/accel.h" + "wx/os2/accel.h" + +1536665357 /usr/include/wx-3.0/wx/generic/accel.h + +1536665357 /usr/include/wx-3.0/wx/gtk/accel.h + "wx/generic/accel.h" + +1536665357 /usr/include/wx-3.0/wx/access.h + "wx/defs.h" + "wx/variant.h" + "wx/msw/ole/access.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/window.h + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/nonownedwnd.h + +1536665357 /usr/include/wx-3.0/wx/iconbndl.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/icon.h" + "wx/dynarray.h" + +1536665357 /usr/include/wx-3.0/wx/icon.h + "wx/iconloc.h" + "wx/msw/icon.h" + "wx/motif/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/generic/icon.h" + "wx/osx/icon.h" + "wx/generic/icon.h" + "wx/cocoa/icon.h" + "wx/os2/icon.h" + "wx/variant.h" + +1536665357 /usr/include/wx-3.0/wx/iconloc.h + "wx/string.h" + +1536665357 /usr/include/wx-3.0/wx/generic/icon.h + "wx/bitmap.h" + +1536665357 /usr/include/wx-3.0/wx/bitmap.h + "wx/string.h" + "wx/gdicmn.h" + "wx/colour.h" + "wx/image.h" + "wx/variant.h" + "wx/msw/bitmap.h" + "wx/x11/bitmap.h" + "wx/gtk/bitmap.h" + "wx/gtk1/bitmap.h" + "wx/x11/bitmap.h" + "wx/dfb/bitmap.h" + "wx/osx/bitmap.h" + "wx/cocoa/bitmap.h" + "wx/os2/bitmap.h" + "wx/generic/mask.h" + +1536665357 /usr/include/wx-3.0/wx/image.h + "wx/defs.h" + "wx/object.h" + "wx/string.h" + "wx/gdicmn.h" + "wx/hashmap.h" + "wx/arrstr.h" + "wx/stream.h" + "wx/variant.h" + "wx/imagbmp.h" + "wx/imagpng.h" + "wx/imaggif.h" + "wx/imagpcx.h" + "wx/imagjpeg.h" + "wx/imagtga.h" + "wx/imagtiff.h" + "wx/imagpnm.h" + "wx/imagxpm.h" + "wx/imagiff.h" + +1536665357 /usr/include/wx-3.0/wx/stream.h + "wx/defs.h" + + "wx/object.h" + "wx/string.h" + "wx/filefn.h" + +1536665357 /usr/include/wx-3.0/wx/imagbmp.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagpng.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imaggif.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagpcx.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagjpeg.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imagtga.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagtiff.h + "wx/defs.h" + "wx/image.h" + "wx/versioninfo.h" + +1536665357 /usr/include/wx-3.0/wx/imagpnm.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagxpm.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/imagiff.h + "wx/image.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/bitmap.h + +1536665357 /usr/include/wx-3.0/wx/weakref.h + "wx/tracker.h" + "wx/meta/convertible.h" + "wx/meta/int2type.h" + +1536665357 /usr/include/wx-3.0/wx/meta/int2type.h + +1536665357 /usr/include/wx-3.0/wx/gtk/toplevel.h + +1536665357 /usr/include/wx-3.0/wx/containr.h + "wx/defs.h" + "wx/event.h" + +1536665357 /usr/include/wx-3.0/wx/sharedptr.h + "wx/defs.h" + "wx/atomic.h" + +1536665357 /usr/include/wx-3.0/wx/atomic.h + "wx/defs.h" + "wx/msw/wrapwin.h" + "libkern/OSAtomic.h" + + "wx/thread.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/dialog.h + +1536665357 /usr/include/wx-3.0/wx/stockitem.h + "wx/defs.h" + "wx/chartype.h" + "wx/string.h" + "wx/accel.h" + +1536665357 /usr/include/wx-3.0/wx/generic/msgdlgg.h + +1536665357 /usr/include/wx-3.0/wx/gtk/msgdlg.h + +1553654185 source:/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PassTCPApp.cpp + "PassTCPApp.h" + "PassTCPDlg.h" + + +1553654185 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PassTCPApp.h + + +1536665357 /usr/include/wx-3.0/wx/app.h + "wx/event.h" + "wx/eventfilter.h" + "wx/build.h" + "wx/cmdargs.h" + "wx/init.h" + "wx/intl.h" + "wx/log.h" + "wx/unix/app.h" + "wx/msw/app.h" + "wx/motif/app.h" + "wx/dfb/app.h" + "wx/gtk/app.h" + "wx/gtk1/app.h" + "wx/x11/app.h" + "wx/osx/app.h" + "wx/cocoa/app.h" + "wx/os2/app.h" + "wx/univ/theme.h" + +1536665357 /usr/include/wx-3.0/wx/eventfilter.h + "wx/defs.h" + +1536665357 /usr/include/wx-3.0/wx/build.h + "wx/version.h" + +1536665357 /usr/include/wx-3.0/wx/cmdargs.h + "wx/arrstr.h" + +1536665357 /usr/include/wx-3.0/wx/init.h + "wx/defs.h" + "wx/chartype.h" + "wx/msw/init.h" + +1536665357 /usr/include/wx-3.0/wx/unix/app.h + + +1536665357 /usr/include/wx-3.0/wx/gtk/app.h + +1553654185 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PassTCPDlg.h + + + + + + + + + + + + "ClientTcpSocket.h" + "ClientUdpSocket.h" + +1536665357 /usr/include/wx-3.0/wx/button.h + "wx/defs.h" + "wx/anybutton.h" + "wx/univ/button.h" + "wx/msw/button.h" + "wx/motif/button.h" + "wx/gtk/button.h" + "wx/gtk1/button.h" + "wx/osx/button.h" + "wx/cocoa/button.h" + "wx/os2/button.h" + +1536665357 /usr/include/wx-3.0/wx/anybutton.h + "wx/defs.h" + "wx/bitmap.h" + "wx/control.h" + "wx/univ/anybutton.h" + "wx/msw/anybutton.h" + "wx/gtk/anybutton.h" + "wx/osx/anybutton.h" + +1536665357 /usr/include/wx-3.0/wx/control.h + "wx/defs.h" + "wx/window.h" + "wx/univ/control.h" + "wx/msw/control.h" + "wx/motif/control.h" + "wx/gtk/control.h" + "wx/gtk1/control.h" + "wx/osx/control.h" + "wx/cocoa/control.h" + "wx/os2/control.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/control.h + +1536665357 /usr/include/wx-3.0/wx/gtk/anybutton.h + +1536665357 /usr/include/wx-3.0/wx/gtk/button.h + +1536665357 /usr/include/wx-3.0/wx/checkbox.h + "wx/defs.h" + "wx/control.h" + "wx/univ/checkbox.h" + "wx/msw/checkbox.h" + "wx/motif/checkbox.h" + "wx/gtk/checkbox.h" + "wx/gtk1/checkbox.h" + "wx/osx/checkbox.h" + "wx/cocoa/checkbox.h" + "wx/os2/checkbox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/checkbox.h + +1536665357 /usr/include/wx-3.0/wx/choice.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/univ/choice.h" + "wx/msw/wince/choicece.h" + "wx/msw/choice.h" + "wx/motif/choice.h" + "wx/gtk/choice.h" + "wx/gtk1/choice.h" + "wx/osx/choice.h" + "wx/cocoa/choice.h" + "wx/os2/choice.h" + +1536665357 /usr/include/wx-3.0/wx/ctrlsub.h + "wx/defs.h" + "wx/arrstr.h" + "wx/control.h" + "wx/msw/ctrlsub.h" + "wx/motif/ctrlsub.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/choice.h + +1536665357 /usr/include/wx-3.0/wx/dirdlg.h + "wx/defs.h" + "wx/dialog.h" + "wx/generic/dirdlgg.h" + "wx/generic/dirdlgg.h" + "wx/generic/dirdlgg.h" + "wx/msw/dirdlg.h" + "wx/gtk/dirdlg.h" + "wx/generic/dirdlgg.h" + "wx/osx/dirdlg.h" + "wx/cocoa/dirdlg.h" + "wx/generic/dirdlgg.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/dirdlg.h + +1536665357 /usr/include/wx-3.0/wx/frame.h + "wx/toplevel.h" + "wx/statusbr.h" + "wx/univ/frame.h" + "wx/msw/frame.h" + "wx/gtk/frame.h" + "wx/gtk1/frame.h" + "wx/motif/frame.h" + "wx/osx/frame.h" + "wx/cocoa/frame.h" + "wx/os2/frame.h" + +1536665357 /usr/include/wx-3.0/wx/statusbr.h + "wx/defs.h" + "wx/control.h" + "wx/list.h" + "wx/dynarray.h" + "wx/univ/statusbr.h" + "wx/msw/statusbar.h" + "wx/generic/statusbr.h" + "wx/osx/statusbr.h" + "wx/generic/statusbr.h" + +1536665357 /usr/include/wx-3.0/wx/generic/statusbr.h + "wx/defs.h" + "wx/pen.h" + "wx/arrstr.h" + +1536665357 /usr/include/wx-3.0/wx/pen.h + "wx/gdiobj.h" + "wx/gdicmn.h" + "wx/msw/pen.h" + "wx/x11/pen.h" + "wx/gtk/pen.h" + "wx/gtk1/pen.h" + "wx/dfb/pen.h" + "wx/osx/pen.h" + "wx/cocoa/pen.h" + "wx/os2/pen.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/pen.h + +1536665357 /usr/include/wx-3.0/wx/gtk/frame.h + +1536665357 /usr/include/wx-3.0/wx/panel.h + "wx/window.h" + "wx/containr.h" + "wx/univ/panel.h" + "wx/msw/panel.h" + "wx/generic/panelg.h" + +1536665357 /usr/include/wx-3.0/wx/generic/panelg.h + "wx/bitmap.h" + +1536665357 /usr/include/wx-3.0/wx/radiobox.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/dynarray.h" + "wx/univ/radiobox.h" + "wx/msw/radiobox.h" + "wx/motif/radiobox.h" + "wx/gtk/radiobox.h" + "wx/gtk1/radiobox.h" + "wx/osx/radiobox.h" + "wx/cocoa/radiobox.h" + "wx/os2/radiobox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/radiobox.h + "wx/bitmap.h" + "wx/list.h" + +1536665357 /usr/include/wx-3.0/wx/statbox.h + "wx/defs.h" + "wx/control.h" + "wx/containr.h" + "wx/univ/statbox.h" + "wx/msw/statbox.h" + "wx/motif/statbox.h" + "wx/gtk/statbox.h" + "wx/gtk1/statbox.h" + "wx/osx/statbox.h" + "wx/cocoa/statbox.h" + "wx/os2/statbox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/statbox.h + +1536665357 /usr/include/wx-3.0/wx/stattext.h + "wx/defs.h" + "wx/control.h" + "wx/univ/stattext.h" + "wx/msw/stattext.h" + "wx/motif/stattext.h" + "wx/gtk/stattext.h" + "wx/gtk1/stattext.h" + "wx/osx/stattext.h" + "wx/cocoa/stattext.h" + "wx/os2/stattext.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/stattext.h + +1536665357 /usr/include/wx-3.0/wx/textctrl.h + "wx/defs.h" + "wx/control.h" + "wx/textentry.h" + "wx/dynarray.h" + "wx/gdicmn.h" + "wx/ioswrap.h" + "wx/x11/textctrl.h" + "wx/univ/textctrl.h" + "wx/msw/wince/textctrlce.h" + "wx/msw/textctrl.h" + "wx/motif/textctrl.h" + "wx/gtk/textctrl.h" + "wx/gtk1/textctrl.h" + "wx/osx/textctrl.h" + "wx/cocoa/textctrl.h" + "wx/os2/textctrl.h" + +1536665357 /usr/include/wx-3.0/wx/textentry.h + "wx/filefn.h" + "wx/gdicmn.h" + "wx/gtk/textentry.h" + "wx/osx/textentry.h" + "wx/msw/textentry.h" + "wx/motif/textentry.h" + "wx/os2/textentry.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/textentry.h + +1536665357 /usr/include/wx-3.0/wx/ioswrap.h + "wx/beforestd.h" + + + "wx/afterstd.h" + "wx/msw/winundef.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/textctrl.h + +1536665357 /usr/include/wx-3.0/wx/timer.h + "wx/defs.h" + "wx/object.h" + "wx/longlong.h" + "wx/event.h" + "wx/stopwatch.h" + "wx/utils.h" + +1536665357 /usr/include/wx-3.0/wx/stopwatch.h + "wx/defs.h" + "wx/longlong.h" + "wx/time.h" + +1536665357 /usr/include/wx-3.0/wx/time.h + "wx/longlong.h" + +1553774553 source:/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PassTCPDlg.cpp + "PassTCPDlg.h" + + "macro.h" + "PacketDlg.h" + + + + + + +1553738330 /data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty//macro.h + + + +1553654185 /data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PacketDlg.h + + + + + + + + + "define.h" + +1536665357 /usr/include/wx-3.0/wx/listbox.h + "wx/defs.h" + "wx/ctrlsub.h" + "wx/univ/listbox.h" + "wx/msw/listbox.h" + "wx/motif/listbox.h" + "wx/gtk/listbox.h" + "wx/gtk1/listbox.h" + "wx/osx/listbox.h" + "wx/os2/listbox.h" + "wx/cocoa/listbox.h" + +1536665357 /usr/include/wx-3.0/wx/gtk/listbox.h + diff --git a/TestNetworkTool/PassTCP.layout b/TestNetworkTool/PassTCP.layout new file mode 100644 index 000000000..30b2e4b50 --- /dev/null +++ b/TestNetworkTool/PassTCP.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/TestNetworkTool/PassTCP.mk b/TestNetworkTool/PassTCP.mk new file mode 100644 index 000000000..704ae8c13 --- /dev/null +++ b/TestNetworkTool/PassTCP.mk @@ -0,0 +1,482 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PassTCP +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/TestNetworkTool +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)NDEBUG $(PreprocessorSwitch)_LINUX_PLATFORM_ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PassTCP.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := $(shell wx-config --libs) +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../ThirdLib/include $(IncludeSwitch)../ThirdLib/include/Lua $(IncludeSwitch)../ThirdLib/thirdparty $(IncludeSwitch)../ThirdLib/thirdparty/LuaLib $(IncludeSwitch)../ThirdLib/include/TinyXML +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall $(shell wx-config --cflags) $(Preprocessors) +CFLAGS := -O2 -Wall $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) \ + $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) \ + $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) $(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/sock_wrap.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(DependSuffix) -MM ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix): ../ThirdLib/thirdparty/sock_wrap.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_sock_wrap.cpp$(PreprocessSuffix) ../ThirdLib/thirdparty/sock_wrap.cpp + +$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(ObjectSuffix): PassTCP/ClientTcpSocket.cpp $(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/ClientTcpSocket.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(DependSuffix): PassTCP/ClientTcpSocket.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(DependSuffix) -MM PassTCP/ClientTcpSocket.cpp + +$(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(PreprocessSuffix): PassTCP/ClientTcpSocket.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_ClientTcpSocket.cpp$(PreprocessSuffix) PassTCP/ClientTcpSocket.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ltablib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltablib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ltablib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ltablib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ltablib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltablib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ltablib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ltm.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltm.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ltm.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ltm.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ltm.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltm.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ltm.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lparser.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lparser.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lparser.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lparser.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lparser.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lparser.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lparser.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lvm.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lvm.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lvm.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lvm.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lvm.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lvm.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lvm.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lbaselib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lbaselib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lbaselib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lbaselib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lbaselib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lbaselib.c + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lfunc.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lfunc.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lfunc.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lfunc.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lfunc.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lfunc.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lfunc.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lundump.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lundump.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lundump.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lundump.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lundump.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lundump.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lundump.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/linit.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/linit.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/linit.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/linit.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/linit.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_linit.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/linit.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/print.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/print.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/print.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/print.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/print.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_print.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/print.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_push.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_push.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_push.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_push.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_push.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_push.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lstrlib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstrlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lstrlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lstrlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lstrlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lstrlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/toluabind.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/toluabind.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/toluabind.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/toluabind.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/toluabind.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_toluabind.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/toluabind.c + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lzio.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lzio.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lzio.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lzio.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lzio.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lzio.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lzio.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lstate.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstate.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lstate.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lstate.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lstate.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstate.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lstate.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lapi.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lapi.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lapi.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lapi.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lapi.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lapi.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lapi.c + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ldo.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldo.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ldo.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ldo.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ldo.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldo.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ldo.c + +$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(ObjectSuffix): PassTCP/PassTCPDlg.cpp $(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PassTCPDlg.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(DependSuffix): PassTCP/PassTCPDlg.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(DependSuffix) -MM PassTCP/PassTCPDlg.cpp + +$(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(PreprocessSuffix): PassTCP/PassTCPDlg.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_PassTCPDlg.cpp$(PreprocessSuffix) PassTCP/PassTCPDlg.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(ObjectSuffix): ../ThirdLib/include/Lua/LuaFn.cpp $(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/Lua/LuaFn.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(DependSuffix): ../ThirdLib/include/Lua/LuaFn.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(DependSuffix) -MM ../ThirdLib/include/Lua/LuaFn.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(PreprocessSuffix): ../ThirdLib/include/Lua/LuaFn.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_Lua_LuaFn.cpp$(PreprocessSuffix) ../ThirdLib/include/Lua/LuaFn.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/loslib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/loslib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/loslib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/loslib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/loslib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loslib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/loslib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_map.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_map.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_map.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_map.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_map.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_map.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_is.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_is.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_is.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_is.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_is.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_is.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ltable.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltable.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ltable.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ltable.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ltable.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ltable.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ltable.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lstring.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstring.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lstring.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lstring.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lstring.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lstring.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lstring.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ldebug.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldebug.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ldebug.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ldebug.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ldebug.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldebug.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ldebug.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lcode.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lcode.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lcode.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lcode.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lcode.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lcode.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lcode.c + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lmathlib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lmathlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lmathlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lmathlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lmathlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lmathlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lobject.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lobject.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lobject.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lobject.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lobject.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lobject.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lobject.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lopcodes.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lopcodes.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lopcodes.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lopcodes.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lopcodes.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lopcodes.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/loadlib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/loadlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/loadlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/loadlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/loadlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_loadlib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/loadlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ldblib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldblib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ldblib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ldblib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ldblib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldblib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ldblib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lmem.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lmem.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lmem.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lmem.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lmem.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lmem.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lmem.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/llex.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/llex.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/llex.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/llex.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/llex.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_llex.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/llex.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/liolib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/liolib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/liolib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/liolib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/liolib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_liolib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/liolib.c + +$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(ObjectSuffix): PassTCP/ClientUdpSocket.cpp $(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/ClientUdpSocket.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(DependSuffix): PassTCP/ClientUdpSocket.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(DependSuffix) -MM PassTCP/ClientUdpSocket.cpp + +$(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(PreprocessSuffix): PassTCP/ClientUdpSocket.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_ClientUdpSocket.cpp$(PreprocessSuffix) PassTCP/ClientUdpSocket.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_to.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_to.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_to.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_to.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_to.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_to.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lgc.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lgc.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lgc.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lgc.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lgc.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lgc.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lgc.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/ldump.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldump.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/ldump.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/ldump.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/ldump.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_ldump.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/ldump.c + +$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(ObjectSuffix): PassTCP/PacketDlg.cpp $(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PacketDlg.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(DependSuffix): PassTCP/PacketDlg.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(DependSuffix) -MM PassTCP/PacketDlg.cpp + +$(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(PreprocessSuffix): PassTCP/PacketDlg.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_PacketDlg.cpp$(PreprocessSuffix) PassTCP/PacketDlg.cpp + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/lauxlib.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lauxlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/lauxlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/lauxlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/lauxlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/lauxlib.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_event.c $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_event.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_event.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix) -MM ../ThirdLib/thirdparty/LuaLib/tolua_event.c + +$(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(PreprocessSuffix): ../ThirdLib/thirdparty/LuaLib/tolua_event.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(PreprocessSuffix) ../ThirdLib/thirdparty/LuaLib/tolua_event.c + +$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(ObjectSuffix): PassTCP/PassTCPApp.cpp $(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/TestNetworkTool/PassTCP/PassTCPApp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(DependSuffix): PassTCP/PassTCPApp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(DependSuffix) -MM PassTCP/PassTCPApp.cpp + +$(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(PreprocessSuffix): PassTCP/PassTCPApp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PassTCP_PassTCPApp.cpp$(PreprocessSuffix) PassTCP/PassTCPApp.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/TestNetworkTool/PassTCP.project b/TestNetworkTool/PassTCP.project new file mode 100644 index 000000000..fbb12f8b9 --- /dev/null +++ b/TestNetworkTool/PassTCP.project @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + None + + + + + + + + + + + + + + + diff --git a/TestNetworkTool/PassTCP.txt b/TestNetworkTool/PassTCP.txt new file mode 100644 index 000000000..9967011f5 --- /dev/null +++ b/TestNetworkTool/PassTCP.txt @@ -0,0 +1 @@ +../Build/Linux/Temp/up_ThirdLib_thirdparty_sock_wrap.cpp.o ../Build/Linux/Temp/PassTCP_ClientTcpSocket.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_ltablib.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_ltm.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lparser.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lvm.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lbaselib.c.o ../Build/Linux/Temp/up_ThirdLib_include_TinyXML_tinyxml.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lfunc.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lundump.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_linit.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_print.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_tolua_push.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lstrlib.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_toluabind.c.o ../Build/Linux/Temp/up_ThirdLib_include_TinyXML_tinystr.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lzio.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lstate.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lapi.c.o ../Build/Linux/Temp/up_ThirdLib_include_TinyXML_tinyxmlerror.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_ldo.c.o ../Build/Linux/Temp/PassTCP_PassTCPDlg.cpp.o ../Build/Linux/Temp/up_ThirdLib_include_Lua_LuaFn.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_loslib.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_tolua_map.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_tolua_is.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_ltable.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lstring.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_ldebug.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lcode.c.o ../Build/Linux/Temp/up_ThirdLib_include_TinyXML_tinyxmlparser.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lmathlib.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lobject.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lopcodes.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_loadlib.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_ldblib.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lmem.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_llex.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_liolib.c.o ../Build/Linux/Temp/PassTCP_ClientUdpSocket.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_tolua_to.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lgc.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_ldump.c.o ../Build/Linux/Temp/PassTCP_PacketDlg.cpp.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_lauxlib.c.o ../Build/Linux/Temp/up_ThirdLib_thirdparty_LuaLib_tolua_event.c.o ../Build/Linux/Temp/PassTCP_PassTCPApp.cpp.o diff --git a/TestNetworkTool/PassTCP/ClientTcpSocket.cpp b/TestNetworkTool/PassTCP/ClientTcpSocket.cpp index c8789b996..125f272f2 100644 --- a/TestNetworkTool/PassTCP/ClientTcpSocket.cpp +++ b/TestNetworkTool/PassTCP/ClientTcpSocket.cpp @@ -1,648 +1,669 @@ -#include "StdAfx.h" +//#include "StdAfx.h" #include "ClientTcpSocket.h" CClientTcpSocket::CClientTcpSocket(void) { - m_pSocket_Info = NULL; - m_pSocket_State_Info = NULL; - m_blRun = false; - m_nThreadID = 0; + m_pSocket_Info = NULL; + m_pSocket_State_Info = NULL; + m_blRun = false; + m_nThreadID = 0; } CClientTcpSocket::~CClientTcpSocket(void) { - Close(); + Close(); } void CClientTcpSocket::Close() { - if(NULL != m_pSocket_Info) - { - delete m_pSocket_Info; - m_pSocket_Info = NULL; - } - - if(NULL != m_pSocket_State_Info) - { - delete m_pSocket_State_Info; - m_pSocket_State_Info = NULL; - } + if(NULL != m_pSocket_Info) + { + delete m_pSocket_Info; + m_pSocket_Info = NULL; + } + + if(NULL != m_pSocket_State_Info) + { + delete m_pSocket_State_Info; + m_pSocket_State_Info = NULL; + } } void CClientTcpSocket::SetSocketThread( _Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info ) { - Close(); + Close(); - m_pSocket_Info = pSocket_Info; - m_pSocket_State_Info = pSocket_State_Info; + m_pSocket_Info = pSocket_Info; + m_pSocket_State_Info = pSocket_State_Info; } _Socket_State_Info* CClientTcpSocket::GetStateInfo() { - return m_pSocket_State_Info; + return m_pSocket_State_Info; } void CClientTcpSocket::Stop() { - m_blRun = false; + m_blRun = false; } void CClientTcpSocket::Run() { - int nPacketCount = 1; - m_blRun = true; - SOCKET sckClient; - - //˲ΪLua - //Ϊ˼ٲҪnewdeleteԲ - _ParamData* pSendParam1 = NULL; - _ParamData* pSendParam2 = NULL; - _ParamData* pSendParam3 = NULL; - _ParamData* pSendParam4 = NULL; - _ParamData* pSendParamOut = NULL; - _ParamData* pRecvParam1 = NULL; - _ParamData* pRecvParam2 = NULL; - _ParamData* pRecvParam3 = NULL; - _ParamData* pRecvParam4 = NULL; - _ParamData* pRecvParamOut = NULL; - - int nLuaBufferMaxLength = m_pSocket_Info->m_pLogic->GetSendLength(); - - if(m_pSocket_Info == NULL || m_pSocket_State_Info == NULL) - { - m_blRun = false; - return; - } - - //Ǹ߼ģʽ - if(m_pSocket_Info->m_blLuaAdvance == true) - { - m_objLuaFn.InitClass(); - - bool blState = m_objLuaFn.LoadLuaFile(m_pSocket_Info->m_szLuaFileName); - if(false == blState) - { - printf_s("[Main]Open Lua file error.\n"); - return; - } - - //ʼҪʹõLua - pSendParam1 = new _ParamData(); - pSendParam2 = new _ParamData(); - pSendParam3 = new _ParamData(); - pSendParam4 = new _ParamData(); - pSendParamOut = new _ParamData(); - pRecvParam1 = new _ParamData(); - pRecvParam2 = new _ParamData(); - pRecvParam3 = new _ParamData(); - pRecvParam4 = new _ParamData(); - pRecvParamOut = new _ParamData(); - - } - - //ǷdzӣdzӣֻһΡ - bool blIsConnect = false; - - //socket׼ - struct sockaddr_in sockaddr; - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - sockaddr.sin_port = htons(m_pSocket_Info->m_nPort); - sockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); - - //ʹ - int nSendIndex = 0; - - while(m_blRun) - { - unsigned int tBegin = (unsigned int)GetTickCount(); - if(m_pSocket_Info->m_nSendCount != 0 && m_pSocket_State_Info->m_nSuccessSend >= m_pSocket_Info->m_nSendCount) - { - //ָĿݰ - break; - } - - //鿴Ƿ߼ģʽ - if(m_pSocket_Info->m_blLuaAdvance == true) - { - //û󳤶 - m_pSocket_Info->m_pLogic->SetMaxSendLength(nLuaBufferMaxLength); - - //ʼLuaűȥ֯ݿ - CParamGroup objIn; - CParamGroup objOut; - - objIn.NeedRetrieve(false); - objOut.NeedRetrieve(false); - - int nLuaSendLen = m_pSocket_Info->m_pLogic->GetSendLength(); - pSendParam1->SetParam((char* )m_pSocket_Info->m_pLogic->GetSendData(), "void", sizeof(int)); - pSendParam2->SetParam((char* )&nLuaSendLen, "int", sizeof(int)); - pSendParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); - pSendParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); - - int nSendLength = 0; - pSendParamOut->SetParam((char* )&nSendLength, "int", sizeof(int)); - - objIn.Push(pSendParam1); - objIn.Push(pSendParam2); - objIn.Push(pSendParam3); - objIn.Push(pSendParam4); - objOut.Push(pSendParamOut); - - m_objLuaFn.CallFileFn("PassTcp_CreateSendData", objIn, objOut); - - int* pLength = (int* )pSendParamOut->GetParam(); - m_pSocket_Info->m_pLogic->SetMaxSendLength((int)(*pLength)); - } - - - if(blIsConnect == false) - { - sckClient = socket(AF_INET, SOCK_STREAM, 0); - - DWORD TimeOut = (DWORD)m_pSocket_Info->m_nRecvTimeout; - ::setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); - - DWORD dwSleepTime = (DWORD)m_pSocket_Info->m_nDelaySecond; - if(m_pSocket_Info->m_blIsRadomaDelay == true) - { - //ģ1-1000֮һʱ - dwSleepTime = (DWORD)RandomValue(1, 1000); - } - - if(dwSleepTime > 0) - { - //ָʱ - Sleep(dwSleepTime); - } - - //Զ̷ - int nErr = connect(sckClient, (SOCKADDR*)&sockaddr, sizeof(SOCKADDR)); - if(0 != nErr) - { - //رsocket - closesocket(sckClient); - - DWORD dwError = GetLastError(); - WriteFile_Error("Connect error", (int)dwError); - m_pSocket_State_Info->m_nFailConnect++; - m_pSocket_State_Info->m_nCurrectSocket = 0; - } - else - { - //ɹ - m_pSocket_State_Info->m_nSuccessConnect++; - m_pSocket_State_Info->m_nCurrectSocket = 1; - blIsConnect = true; - nSendIndex = 0; - } - } - - if(blIsConnect == true) - { - // - char szSendBuffData[MAX_BUFF_1024 * 100] = {'\0'}; - char szRecvBuffData[MAX_BUFF_1024 * 100] = {'\0'}; - - char* pSendData = NULL; - int nSendLen = 0; - int nTotalRecvLen = 0; - //Ϊݰ - if(m_pSocket_Info->m_blIsSendCount == true) - { - int nSendCount = RandomValue(1, 10); - - //׷һ߼¼ǰǷƥ䣬ܳǰ - if(m_pSocket_Info->m_nSendCount != 0 && nSendCount + m_pSocket_State_Info->m_nSuccessSend > m_pSocket_Info->m_nSendCount) - { - nSendCount = m_pSocket_Info->m_nSendCount - m_pSocket_State_Info->m_nSuccessSend; - } - - char* pData = m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); - for(int i = 0; i < nSendCount; i++) - { - MEMCOPY_SAFE(&szSendBuffData[i * nSendLen], - pData, - nSendLen); - } - nPacketCount = nSendCount; - - // - pSendData = (char* )szSendBuffData; - nSendLen = nSendLen * nSendCount; - nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength() * nSendCount; - } - else - { - // - pSendData = (char* )m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); - nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength(); - - nPacketCount = 1; - } - - //¼Ӧֽ - int nRecvAllSize = nTotalRecvLen; - - //Ҫ¼־ݼ־ - if(m_pSocket_Info->m_blIsWriteFile == true) - { - WriteFile_SendBuff(pSendData, nSendLen); - } - - int nTotalSendLen = nSendLen; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - nCurrSendLen = send(sckClient, pSendData + nBeginSend, nTotalSendLen, 0); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - WriteFile_Error("send error", (int)dwError); - - m_pSocket_State_Info->m_nFailSend += nPacketCount; - closesocket(sckClient); - m_pSocket_State_Info->m_nCurrectSocket = 0; - blIsConnect = false; - - //жǷԶ - if(m_pSocket_Info->m_blIsBroken == false) - { - return ; - } - - break; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - m_pSocket_State_Info->m_nSuccessSend += nPacketCount; - - //¼ֽ - m_pSocket_State_Info->m_nSendByteCount += nCurrSendLen; - - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - - //¼ֽ - m_pSocket_State_Info->m_nSendByteCount += nCurrSendLen; - } - } - } - nSendIndex++; - - // - if(blSendFlag == true && m_pSocket_Info->m_blIsRecv == true) - { - while(true) - { - //ͳɹˣ - nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); - if(nCurrRecvLen <= 0) - { - DWORD dwError = GetLastError(); - WriteFile_Error("recv error", (int)dwError); - - //õصIPͶ˿ - struct sockaddr_in sockClient; - - memset(&sockClient, 0, sizeof(sockClient)); - int nClientSocketSize = sizeof(sockClient); - - getsockname(sckClient, (struct sockaddr *)&sockClient, &nClientSocketSize); - - char szWData[MAX_BUFF_1024] = {'\0'}; - sprintf_s(szWData, MAX_BUFF_1024, "[%s:%d]SendCount=%d.", inet_ntoa(sockClient.sin_addr), ntohs(sockClient.sin_port), nSendIndex); - WriteFile_Data(szWData); - - m_pSocket_State_Info->m_nFailRecv += nPacketCount; - closesocket(sckClient); - m_pSocket_State_Info->m_nCurrectSocket = 0; - blIsConnect = false; - - //жǷԶ - if(m_pSocket_Info->m_blIsBroken == false) - { - return ; - } - - break; - } - else - { - //Ǹ߼ģʽLuaӿڷ - if(m_pSocket_Info->m_blLuaAdvance == true) - { - m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; - int nState = 0; - - CParamGroup objRecvIn; - CParamGroup objRecvOut; - - objRecvIn.NeedRetrieve(false); - objRecvOut.NeedRetrieve(false); - - pRecvParam1->SetParam((char* )szRecvBuffData, "void", sizeof(int)); - pRecvParam2->SetParam((char* )&nCurrRecvLen, "int", sizeof(int)); - pRecvParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); - pRecvParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); - - pRecvParamOut->SetParam((char* )&nState, "int", sizeof(int)); - - objRecvIn.Push(pRecvParam1); - objRecvIn.Push(pRecvParam2); - objRecvIn.Push(pRecvParam3); - objRecvIn.Push(pRecvParam4); - objRecvOut.Push(pRecvParamOut); - - //ýպ - m_objLuaFn.CallFileFn("PassTcp_GetRecvData", objRecvIn, objRecvOut); - - int* pReturn = (int* )pRecvParamOut->GetParam(); - nState = (int)(*pReturn); - - objRecvIn.Close(false); - objRecvOut.Close(false); - - //жϽűֵ - if(nState == 0) - { - //֤ɹ - m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; - blRecvFlag = true; - - //Ҫ¼־ݼ־ - if(m_pSocket_Info->m_blIsWriteFile == true) - { - WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); - } - - //Сʱʱ - int tTime = (int)((unsigned int)GetTickCount() - tBegin); - if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) - { - m_pSocket_State_Info->m_nMinRecvTime = tTime; - } - else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) - { - m_pSocket_State_Info->m_nMinRecvTime = tTime; - } - - if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) - { - m_pSocket_State_Info->m_nMaxRecvTime = tTime; - } - else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) - { - m_pSocket_State_Info->m_nMaxRecvTime = tTime; - } - - break; - } - else if(nState == 1) - { - // - nBeginRecv += nCurrRecvLen; - } - else - { - //հ֤ʧ - m_pSocket_State_Info->m_nFailRecv += nPacketCount; - blRecvFlag = true; - - //Ҫ¼־ݼ־ - if(m_pSocket_Info->m_blIsWriteFile == true) - { - WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); - } - - break; - } - } - else - { - //Ǹ߼ģʽõж׼ - m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; - nTotalRecvLen -= nCurrRecvLen; - - EM_DATA_RETURN_STATE emState = m_pSocket_Info->m_pLogic->GetRecvData(m_nThreadID, nSendIndex, szRecvBuffData, nCurrRecvLen); - - if(nTotalRecvLen == 0 || emState == DATA_RETURN_STATE_SUCCESS) - { - // - m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; - blRecvFlag = true; - - //Ҫ¼־ݼ־ - if(m_pSocket_Info->m_blIsWriteFile == true) - { - WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); - } - - //Сʱʱ - int tTime = (int)((unsigned int)GetTickCount() - tBegin); - if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) - { - m_pSocket_State_Info->m_nMinRecvTime = tTime; - } - else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) - { - m_pSocket_State_Info->m_nMinRecvTime = tTime; - } - - if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) - { - m_pSocket_State_Info->m_nMaxRecvTime = tTime; - } - else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) - { - m_pSocket_State_Info->m_nMaxRecvTime = tTime; - } - - break; - } - else - { - nBeginRecv += nCurrRecvLen; - } - } - } - } - } - - //ݰsleepָʱ - if(m_pSocket_Info->m_nPacketTimewait > 0) - { - DWORD dwSleepTime = (DWORD)m_pSocket_Info->m_nPacketTimewait; - Sleep(dwSleepTime); - } - - //dzӣ򲻹ر - if(m_pSocket_Info->m_blIsAlwayConnect == false) - { - closesocket(sckClient); - m_pSocket_State_Info->m_nCurrectSocket = 0; - blIsConnect = false; - } - } - - //ֻһΣ˳ - if(m_pSocket_Info->m_blIsSendOne == true) - { - m_blRun = false; - } - } - - //ûϣϿ - if(blIsConnect == true) - { - closesocket(sckClient); - m_pSocket_State_Info->m_nCurrectSocket = 0; - blIsConnect = false; - } - - //еLuaڴ - delete pSendParam1; - delete pSendParam2; - delete pSendParam3; - delete pSendParam4; - delete pSendParamOut; - delete pRecvParam1; - delete pRecvParam2; - delete pRecvParam3; - delete pRecvParam4; - delete pRecvParamOut; + int nPacketCount = 1; + m_blRun = true; + HSocket sckClient; + + //此部分为兼容Lua参数而设计 + //为了减少不必要的new和delete操作,所以参数在这里先声明好 + _ParamData* pSendParam1 = NULL; + _ParamData* pSendParam2 = NULL; + _ParamData* pSendParam3 = NULL; + _ParamData* pSendParam4 = NULL; + _ParamData* pSendParamOut = NULL; + _ParamData* pRecvParam1 = NULL; + _ParamData* pRecvParam2 = NULL; + _ParamData* pRecvParam3 = NULL; + _ParamData* pRecvParam4 = NULL; + _ParamData* pRecvParamOut = NULL; + + int nLuaBufferMaxLength = m_pSocket_Info->m_pLogic->GetSendLength(); + + if(m_pSocket_Info == NULL || m_pSocket_State_Info == NULL) + { + m_blRun = false; + return; + } + + //如果是高级模式 + if(m_pSocket_Info->m_blLuaAdvance == true) + { + m_objLuaFn.InitClass(); + + bool blState = m_objLuaFn.LoadLuaFile(m_pSocket_Info->m_szLuaFileName); + + if(false == blState) + { + printf("[Main]Open Lua file error.\n"); + return; + } + + //初始化所有要使用的Lua参数 + pSendParam1 = new _ParamData(); + pSendParam2 = new _ParamData(); + pSendParam3 = new _ParamData(); + pSendParam4 = new _ParamData(); + pSendParamOut = new _ParamData(); + pRecvParam1 = new _ParamData(); + pRecvParam2 = new _ParamData(); + pRecvParam3 = new _ParamData(); + pRecvParam4 = new _ParamData(); + pRecvParamOut = new _ParamData(); + + } + + //看看是否是长连接,如果是长连接,则只处理一次。 + bool blIsConnect = false; + + //socket创建的准备工作 + struct sockaddr_in sockaddr; + + // memset(&sockaddr, 0, sizeof(sockaddr)); + // sockaddr.sin_family = AF_INET; + // sockaddr.sin_port = htons(m_pSocket_Info->m_nPort); + // sockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + + GetAddressFrom(&sockaddr, m_pSocket_Info->m_szSerevrIP, m_pSocket_Info->m_nPort); + + //发送次数 + int nSendIndex = 0; + + while(m_blRun) + { + unsigned int tBegin = (unsigned int)GetTickCount(); + + if(m_pSocket_Info->m_nSendCount != 0 && m_pSocket_State_Info->m_nSuccessSend >= m_pSocket_Info->m_nSendCount) + { + //发送指定数目的数据包完成 + break; + } + + //查看是否开启高级模式 + if(m_pSocket_Info->m_blLuaAdvance == true) + { + //重置缓冲最大长度 + m_pSocket_Info->m_pLogic->SetMaxSendLength(nLuaBufferMaxLength); + + //开始调用Lua脚本,去组织数据块 + CParamGroup objIn; + CParamGroup objOut; + + objIn.NeedRetrieve(false); + objOut.NeedRetrieve(false); + + int nLuaSendLen = m_pSocket_Info->m_pLogic->GetSendLength(); + pSendParam1->SetParam((char* )m_pSocket_Info->m_pLogic->GetSendData(), "void", sizeof(int)); + pSendParam2->SetParam((char* )&nLuaSendLen, "int", sizeof(int)); + pSendParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); + pSendParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); + + int nSendLength = 0; + pSendParamOut->SetParam((char* )&nSendLength, "int", sizeof(int)); + + objIn.Push(pSendParam1); + objIn.Push(pSendParam2); + objIn.Push(pSendParam3); + objIn.Push(pSendParam4); + objOut.Push(pSendParamOut); + + m_objLuaFn.CallFileFn("PassTcp_CreateSendData", objIn, objOut); + + int* pLength = (int* )pSendParamOut->GetParam(); + m_pSocket_Info->m_pLogic->SetMaxSendLength((int)(*pLength)); + } + + + if(blIsConnect == false) + { + sckClient = socket(AF_INET, SOCK_STREAM, 0); + + int TimeOut = (int)m_pSocket_Info->m_nRecvTimeout; + ::setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char*)&TimeOut, sizeof(TimeOut)); + + int dwSleepTime = (int)m_pSocket_Info->m_nDelaySecond; + + if(m_pSocket_Info->m_blIsRadomaDelay == true) + { + //如果是随机的,则从1-1000之间随机一个时间 + dwSleepTime = (int)RandomValue(1, 1000); + } + + if(dwSleepTime > 0) + { + //挂起指定的时 + std::this_thread::sleep_for(std::chrono::milliseconds(dwSleepTime*1000)); + } + + //连接远程服务器 + int nErr = SocketConnect(sckClient, &sockaddr); + + if(0 != nErr) + { + //关闭socket + SocketClose(sckClient); + + int dwError = GetLastSocketError(); + WriteFile_Error("Connect error", (int)dwError); + m_pSocket_State_Info->m_nFailConnect++; + m_pSocket_State_Info->m_nCurrectSocket = 0; + } + else + { + //成功连接 + m_pSocket_State_Info->m_nSuccessConnect++; + m_pSocket_State_Info->m_nCurrectSocket = 1; + blIsConnect = true; + nSendIndex = 0; + } + } + + if(blIsConnect == true) + { + //发送数据 + char szSendBuffData[MAX_BUFF_1024 * 100] = {'\0'}; + char szRecvBuffData[MAX_BUFF_1024 * 100] = {'\0'}; + + char* pSendData = NULL; + int nSendLen = 0; + int nTotalRecvLen = 0; + + //如果数据为随机数据包 + if(m_pSocket_Info->m_blIsSendCount == true) + { + int nSendCount = RandomValue(1, 10); + + //这里追加一个逻辑,记录当前发包的总数是否匹配,随机数不能超过当前发包总数 + if(m_pSocket_Info->m_nSendCount != 0 && nSendCount + m_pSocket_State_Info->m_nSuccessSend > m_pSocket_Info->m_nSendCount) + { + nSendCount = m_pSocket_Info->m_nSendCount - m_pSocket_State_Info->m_nSuccessSend; + } + + char* pData = m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); + + for(int i = 0; i < nSendCount; i++) + { + MEMCOPY_SAFE(&szSendBuffData[i * nSendLen], + pData, + nSendLen); + } + + nPacketCount = nSendCount; + + //发送数据 + pSendData = (char* )szSendBuffData; + nSendLen = nSendLen * nSendCount; + nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength() * nSendCount; + } + else + { + //发送数据 + pSendData = (char* )m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); + nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength(); + + nPacketCount = 1; + } + + //记录应收字节总数 + int nRecvAllSize = nTotalRecvLen; + + //如果需要记录日志,则将数据计入日志 + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_SendBuff(pSendData, nSendLen); + } + + int nTotalSendLen = nSendLen; + int nBeginSend = 0; + int nCurrSendLen = 0; + bool blSendFlag = false; + int nBeginRecv = 0; + int nCurrRecvLen = 0; + bool blRecvFlag = false; + + while(true) + { + nCurrSendLen = send(sckClient, pSendData + nBeginSend, nTotalSendLen, 0); + + if(nCurrSendLen <= 0) + { + int dwError = GetLastSocketError(); + WriteFile_Error("send error", (int)dwError); + + m_pSocket_State_Info->m_nFailSend += nPacketCount; + SocketClose(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + + //判断是否是自动重连 + if(m_pSocket_Info->m_blIsBroken == false) + { + return ; + } + + break; + } + else + { + nTotalSendLen -= nCurrSendLen; + + if(nTotalSendLen == 0) + { + //发送完成 + m_pSocket_State_Info->m_nSuccessSend += nPacketCount; + + //记录发送字节数 + m_pSocket_State_Info->m_nSendByteCount += nCurrSendLen; + + blSendFlag = true; + break; + } + else + { + nBeginSend += nCurrSendLen; + + //记录发送字节数 + m_pSocket_State_Info->m_nSendByteCount += nCurrSendLen; + } + } + } + + nSendIndex++; + + //接收数据 + if(blSendFlag == true && m_pSocket_Info->m_blIsRecv == true) + { + while(true) + { + //如果发送成功了,则处理接收数据 + nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); + + if(nCurrRecvLen <= 0) + { + int dwError = GetLastSocketError(); + WriteFile_Error("recv error", (int)dwError); + + //得到本地的IP和端口 + struct sockaddr_in sockClient; + + memset(&sockClient, 0, sizeof(sockClient)); + int nClientSocketSize = sizeof(sockClient); + + GetSocketName(sckClient, (struct sockaddr_in*)&sockClient); + + char szWData[MAX_BUFF_1024] = {'\0'}; + sprintf(szWData, "[%s:%d]SendCount=%d.", inet_ntoa(sockClient.sin_addr), ntohs(sockClient.sin_port), nSendIndex); + WriteFile_Data(szWData); + + m_pSocket_State_Info->m_nFailRecv += nPacketCount; + SocketClose(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + + //判断是否是自动重连 + if(m_pSocket_Info->m_blIsBroken == false) + { + return ; + } + + break; + } + else + { + //如果是高级模式,这里调用Lua接口方法 + if(m_pSocket_Info->m_blLuaAdvance == true) + { + m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; + int nState = 0; + + CParamGroup objRecvIn; + CParamGroup objRecvOut; + + objRecvIn.NeedRetrieve(false); + objRecvOut.NeedRetrieve(false); + + pRecvParam1->SetParam((char* )szRecvBuffData, "void", sizeof(int)); + pRecvParam2->SetParam((char* )&nCurrRecvLen, "int", sizeof(int)); + pRecvParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); + pRecvParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); + + pRecvParamOut->SetParam((char* )&nState, "int", sizeof(int)); + + objRecvIn.Push(pRecvParam1); + objRecvIn.Push(pRecvParam2); + objRecvIn.Push(pRecvParam3); + objRecvIn.Push(pRecvParam4); + objRecvOut.Push(pRecvParamOut); + + //调用接收函数 + m_objLuaFn.CallFileFn("PassTcp_GetRecvData", objRecvIn, objRecvOut); + + int* pReturn = (int* )pRecvParamOut->GetParam(); + nState = (int)(*pReturn); + + objRecvIn.Close(false); + objRecvOut.Close(false); + + //判断脚本返回值 + if(nState == 0) + { + //接收验证成功 + m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; + blRecvFlag = true; + + //如果需要记录日志,则将数据计入日志 + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + //计算最小时间和最大时间 + int tTime = (int)((unsigned int)GetTickCount() - tBegin); + + if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + + if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + + break; + } + else if(nState == 1) + { + //继续接收 + nBeginRecv += nCurrRecvLen; + } + else + { + //接收包验证失败 + m_pSocket_State_Info->m_nFailRecv += nPacketCount; + blRecvFlag = true; + + //如果需要记录日志,则将数据计入日志 + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + break; + } + } + else + { + //如果不是高级模式,则采用配置的判定准则 + m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; + nTotalRecvLen -= nCurrRecvLen; + + EM_DATA_RETURN_STATE emState = m_pSocket_Info->m_pLogic->GetRecvData(m_nThreadID, nSendIndex, szRecvBuffData, nCurrRecvLen); + + if(nTotalRecvLen == 0 || emState == DATA_RETURN_STATE_SUCCESS) + { + //接收完成 + m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; + blRecvFlag = true; + + //如果需要记录日志,则将数据计入日志 + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + //计算最小时间和最大时间 + int tTime = (int)((unsigned int)GetTickCount() - tBegin); + + if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + + if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + + break; + } + else + { + nBeginRecv += nCurrRecvLen; + } + } + } + } + } + + //如果有数据包间隔,则sleep指定的时间 + if(m_pSocket_Info->m_nPacketTimewait > 0) + { + int dwSleepTime = (int)m_pSocket_Info->m_nPacketTimewait; + std::this_thread::sleep_for(std::chrono::milliseconds(dwSleepTime*1000)); + } + + //如果是长连接,则不关闭连接 + if(m_pSocket_Info->m_blIsAlwayConnect == false) + { + SocketClose(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + } + } + + //如果只发送一次,在这里退出 + if(m_pSocket_Info->m_blIsSendOne == true) + { + m_blRun = false; + } + } + + //如果连接没断,则断开 + if(blIsConnect == true) + { + SocketClose(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + } + + //回收所有的Lua申请的内存 + delete pSendParam1; + delete pSendParam2; + delete pSendParam3; + delete pSendParam4; + delete pSendParamOut; + delete pRecvParam1; + delete pRecvParam2; + delete pRecvParam3; + delete pRecvParam4; + delete pRecvParamOut; } bool CClientTcpSocket::WriteFile_SendBuff( const char* pData, int nLen ) { - FILE* pFile = NULL; - char szFileName[20]; - sprintf_s(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); - fopen_s(&pFile, szFileName, "a+"); - if(pFile == NULL) - { - return false; - } - - string strLog; - strLog = "[SendBuff]"; - - for(int i = 0; i < nLen; i++) - { - char szChar[20]; - sprintf_s(szChar, 20, " 0x%02X", (unsigned char )pData[i]); - strLog += szChar; - } - - strLog += "\n"; - - fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); - - fclose(pFile); - return true; + FILE* pFile = NULL; + char szFileName[20]; + sprintf(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); + pFile =fopen( szFileName, "a+"); + + if(pFile == NULL) + { + return false; + } + + string strLog; + strLog = "[SendBuff]"; + + for(int i = 0; i < nLen; i++) + { + char szChar[20]; + sprintf(szChar, " 0x%02X", (unsigned char )pData[i]); + strLog += szChar; + } + + strLog += "\n"; + + fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); + + fclose(pFile); + return true; } bool CClientTcpSocket::WriteFile_RecvBuff( const char* pData, int nLen ) { - FILE* pFile = NULL; - char szFileName[20]; - sprintf_s(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); - fopen_s(&pFile, szFileName, "a+"); - if(pFile == NULL) - { - return false; - } - - string strLog; - strLog = "[RecvBuff]"; - - for(int i = 0; i < nLen; i++) - { - char szChar[20]; - sprintf_s(szChar, 20, " 0x%02X", (unsigned char )pData[i]); - strLog += szChar; - } - - strLog += "\n"; - - fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); - - fclose(pFile); - return true; + FILE* pFile = NULL; + char szFileName[20]; + sprintf(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); + pFile =fopen( szFileName, "a+"); + + if(pFile == NULL) + { + return false; + } + + string strLog; + strLog = "[RecvBuff]"; + + for(int i = 0; i < nLen; i++) + { + char szChar[20]; + sprintf(szChar, " 0x%02X", (unsigned char )pData[i]); + strLog += szChar; + } + + strLog += "\n"; + + fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); + + fclose(pFile); + return true; } bool CClientTcpSocket::WriteFile_Error( const char* pError, int nErrorNumber ) { - time_t ttNow = time(NULL); - struct tm tmNow; - localtime_s(&tmNow, &ttNow); - - char szTimeNow[30] = {'\0'}; - sprintf_s(szTimeNow, 30, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); - - //ƴӳ־ - char szError[1024] = {'\0'}; - sprintf_s(szError, 1024, "%s %s, errno=%d.\n", szTimeNow, pError, nErrorNumber); - - FILE* pFile = NULL; - char szFileName[30]; - sprintf_s(szFileName, "StressTest_Error.log"); - fopen_s(&pFile, szFileName, "a+"); - if(pFile == NULL) - { - return false; - } - - fwrite(szError, strlen(szError), sizeof(char), pFile); - - fclose(pFile); - return true; + time_t ttNow = time(NULL); + struct tm tmNow; + tmNow =*(localtime( &ttNow)); + + char szTimeNow[30] = {'\0'}; + sprintf(szTimeNow, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); + + //拼接出错日志输出 + char szError[1024] = {'\0'}; + sprintf(szError, "%s %s, errno=%d.\n", szTimeNow, pError, nErrorNumber); + + FILE* pFile = NULL; + char szFileName[30]; + sprintf(szFileName, "StressTest_Error.log"); + pFile =fopen( szFileName, "a+"); + + if(pFile == NULL) + { + return false; + } + + fwrite(szError, strlen(szError), sizeof(char), pFile); + + fclose(pFile); + return true; } bool CClientTcpSocket::WriteFile_Data( const char* pError) { - time_t ttNow = time(NULL); - struct tm tmNow; - localtime_s(&tmNow, &ttNow); - - char szTimeNow[30] = {'\0'}; - sprintf_s(szTimeNow, 30, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); - - //ƴӳ־ - char szError[1024] = {'\0'}; - sprintf_s(szError, 1024, "%s %s.\n", szTimeNow, pError); - - FILE* pFile = NULL; - char szFileName[30]; - sprintf_s(szFileName, "StressTest_Error.log"); - fopen_s(&pFile, szFileName, "a+"); - if(pFile == NULL) - { - return false; - } - - fwrite(szError, strlen(szError), sizeof(char), pFile); - - fclose(pFile); - return true; + time_t ttNow = time(NULL); + struct tm tmNow; + //localtime(&tmNow, &ttNow); + tmNow =*(localtime( &ttNow)); + + char szTimeNow[30] = {'\0'}; + sprintf(szTimeNow, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); + + //拼接出错日志输出 + char szError[1024] = {'\0'}; + sprintf(szError, "%s %s.\n", szTimeNow, pError); + + FILE* pFile = NULL; + char szFileName[30]; + sprintf(szFileName, "StressTest_Error.log"); + pFile =fopen( szFileName, "a+"); + + if(pFile == NULL) + { + return false; + } + + fwrite(szError, strlen(szError), sizeof(char), pFile); + + fclose(pFile); + return true; } void CClientTcpSocket::SetThreadID(int nThreadID) { - m_nThreadID = nThreadID; -} \ No newline at end of file + m_nThreadID = nThreadID; +} diff --git a/TestNetworkTool/PassTCP/ClientTcpSocket.h b/TestNetworkTool/PassTCP/ClientTcpSocket.h index 523fbd170..a9094f96b 100644 --- a/TestNetworkTool/PassTCP/ClientTcpSocket.h +++ b/TestNetworkTool/PassTCP/ClientTcpSocket.h @@ -1,35 +1,35 @@ -#pragma once +#pragma once -#include #include "define.h" #include "LuaFn.h" +#include "sock_wrap.h" class CClientTcpSocket { public: - CClientTcpSocket(void); - ~CClientTcpSocket(void); + CClientTcpSocket(void); + ~CClientTcpSocket(void); - void Close(); + void Close(); - void Run(); - void Stop(); + void Run(); + void Stop(); - void SetSocketThread(_Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info); - _Socket_State_Info* GetStateInfo(); + void SetSocketThread(_Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info); + _Socket_State_Info* GetStateInfo(); - void SetThreadID(int nThreadID); + void SetThreadID(int nThreadID); private: - bool WriteFile_SendBuff(const char* pData, int nLen); - bool WriteFile_RecvBuff(const char* pData, int nLen); - bool WriteFile_Error(const char* pError, int nErrorNumber); - bool WriteFile_Data( const char* pError); + bool WriteFile_SendBuff(const char* pData, int nLen); + bool WriteFile_RecvBuff(const char* pData, int nLen); + bool WriteFile_Error(const char* pError, int nErrorNumber); + bool WriteFile_Data( const char* pError); private: - _Socket_Info* m_pSocket_Info; - _Socket_State_Info* m_pSocket_State_Info; - bool m_blRun; - CLuaFn m_objLuaFn; - int m_nThreadID; //߳ID + _Socket_Info* m_pSocket_Info; + _Socket_State_Info* m_pSocket_State_Info; + bool m_blRun; + CLuaFn m_objLuaFn; + int m_nThreadID; //线程ID }; diff --git a/TestNetworkTool/PassTCP/ClientUdpSocket.cpp b/TestNetworkTool/PassTCP/ClientUdpSocket.cpp index 232cd99f4..161eb0e47 100644 --- a/TestNetworkTool/PassTCP/ClientUdpSocket.cpp +++ b/TestNetworkTool/PassTCP/ClientUdpSocket.cpp @@ -1,584 +1,611 @@ -#include "StdAfx.h" +//#include "StdAfx.h" #include "ClientUdpSocket.h" CClientUdpSocket::CClientUdpSocket(void) { - m_pSocket_Info = NULL; - m_pSocket_State_Info = NULL; - m_blRun = false; + m_pSocket_Info = NULL; + m_pSocket_State_Info = NULL; + m_blRun = false; } CClientUdpSocket::~CClientUdpSocket(void) { - Close(); + Close(); } void CClientUdpSocket::Close() { - if(NULL != m_pSocket_Info) - { - delete m_pSocket_Info; - m_pSocket_Info = NULL; - } - - if(NULL != m_pSocket_State_Info) - { - delete m_pSocket_State_Info; - m_pSocket_State_Info = NULL; - } + if(NULL != m_pSocket_Info) + { + delete m_pSocket_Info; + m_pSocket_Info = NULL; + } + + if(NULL != m_pSocket_State_Info) + { + delete m_pSocket_State_Info; + m_pSocket_State_Info = NULL; + } } void CClientUdpSocket::Run() { - int nPacketCount = 1; - m_blRun = true; - SOCKET sckClient; - SOCKET sckServer; - - //˲ΪLua - //Ϊ˼ٲҪnewdeleteԲ - _ParamData* pSendParam1 = NULL; - _ParamData* pSendParam2 = NULL; - _ParamData* pSendParam3 = NULL; - _ParamData* pSendParam4 = NULL; - _ParamData* pSendParamOut = NULL; - _ParamData* pRecvParam1 = NULL; - _ParamData* pRecvParam2 = NULL; - _ParamData* pRecvParam3 = NULL; - _ParamData* pRecvParam4 = NULL; - _ParamData* pRecvParamOut = NULL; - - int nLuaBufferMaxLength = m_pSocket_Info->m_pLogic->GetSendLength(); - - if(m_pSocket_Info == NULL || m_pSocket_State_Info == NULL) - { - m_blRun = false; - return; - } - - //Ǹ߼ģʽ - if(m_pSocket_Info->m_blLuaAdvance == true) - { - m_objLuaFn.InitClass(); - - bool blState = m_objLuaFn.LoadLuaFile(m_pSocket_Info->m_szLuaFileName); - if(false == blState) - { - printf_s("[Main]Open Lua file error.\n"); - return; - } - - //ʼҪʹõLua - pSendParam1 = new _ParamData(); - pSendParam2 = new _ParamData(); - pSendParam3 = new _ParamData(); - pSendParam4 = new _ParamData(); - pSendParamOut = new _ParamData(); - pRecvParam1 = new _ParamData(); - pRecvParam2 = new _ParamData(); - pRecvParam3 = new _ParamData(); - pRecvParam4 = new _ParamData(); - pRecvParamOut = new _ParamData(); - - } - - //ǷdzӣdzӣֻһΡ - bool blIsConnect = false; - - //socket׼ - struct sockaddr_in svrsockaddr; - - memset(&svrsockaddr, 0, sizeof(SOCKADDR_IN)); - svrsockaddr.sin_family = AF_INET; - svrsockaddr.sin_port = htons(m_pSocket_Info->m_nPort); - svrsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); - - sckClient = socket(AF_INET, SOCK_DGRAM, 0); - - DWORD TimeOut = (DWORD)m_pSocket_Info->m_nRecvTimeout; - ::setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); - - //ýռ˿ - sckServer = socket(AF_INET, SOCK_DGRAM, 0); - - struct sockaddr_in clientsockaddr; - memset(&clientsockaddr, 0, sizeof(SOCKADDR_IN)); - clientsockaddr.sin_family = AF_INET; - clientsockaddr.sin_port = htons(m_pSocket_Info->m_nUdpClientPort); - clientsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); - - bind(sckServer, (SOCKADDR *) &clientsockaddr, sizeof(clientsockaddr)); - - //ʹ - int nSendIndex = 0; - - while(m_blRun) - { - unsigned int tBegin = (unsigned int)GetTickCount(); - if(m_pSocket_Info->m_nSendCount != 0 && m_pSocket_State_Info->m_nSuccessSend >= m_pSocket_Info->m_nSendCount) - { - //ָĿݰ - break; - } - - //鿴Ƿ߼ģʽ - if(m_pSocket_Info->m_blLuaAdvance == true) - { - //û󳤶 - m_pSocket_Info->m_pLogic->SetMaxSendLength(nLuaBufferMaxLength); - - //ʼLuaűȥ֯ݿ - CParamGroup objIn; - CParamGroup objOut; - - objIn.NeedRetrieve(false); - objOut.NeedRetrieve(false); - - int nLuaSendLen = m_pSocket_Info->m_pLogic->GetSendLength(); - pSendParam1->SetParam((char* )m_pSocket_Info->m_pLogic->GetSendData(), "void", sizeof(int)); - pSendParam2->SetParam((char* )&nLuaSendLen, "int", sizeof(int)); - pSendParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); - pSendParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); - - int nSendLength = 0; - pSendParamOut->SetParam((char* )&nSendLength, "int", sizeof(int)); - - objIn.Push(pSendParam1); - objIn.Push(pSendParam2); - objIn.Push(pSendParam3); - objIn.Push(pSendParam4); - objOut.Push(pSendParamOut); - - m_objLuaFn.CallFileFn("PassTcp_CreateSendData", objIn, objOut); - - int* pLength = (int* )pSendParamOut->GetParam(); - m_pSocket_Info->m_pLogic->SetMaxSendLength((int)(*pLength)); - } - - - if(blIsConnect == false) - { - DWORD dwSleepTime = (DWORD)m_pSocket_Info->m_nDelaySecond; - if(m_pSocket_Info->m_blIsRadomaDelay == true) - { - //ģ1-1000֮һʱ - dwSleepTime = (DWORD)RandomValue(1, 1000); - } - - //ָʱ - Sleep(dwSleepTime); - - m_pSocket_State_Info->m_nSuccessConnect++; - m_pSocket_State_Info->m_nCurrectSocket = 1; - blIsConnect = true; - } - - if(blIsConnect == true) - { - // - char szSendBuffData[MAX_BUFF_1024 * 100] = {'\0'}; - char szRecvBuffData[MAX_BUFF_1024 * 100] = {'\0'}; - - char* pSendData = NULL; - int nSendLen = 0; - int nTotalRecvLen = 0; - //Ϊݰ - if(m_pSocket_Info->m_blIsSendCount == true) - { - int nSendCount = RandomValue(1, 10); - - //׷һ߼¼ǰǷƥ䣬ܳǰ - if(m_pSocket_Info->m_nSendCount != 0 && nSendCount + m_pSocket_State_Info->m_nSuccessSend > m_pSocket_Info->m_nSendCount) - { - nSendCount = m_pSocket_Info->m_nSendCount - m_pSocket_State_Info->m_nSuccessSend; - } - - char* pData = m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); - for(int i = 0; i < nSendCount; i++) - { - MEMCOPY_SAFE(&szSendBuffData[i * nSendLen], - pData, - nSendLen); - } - nPacketCount = nSendCount; - - // - pSendData = (char* )szSendBuffData; - nSendLen = m_pSocket_Info->m_pLogic->GetSendLength() * nSendCount; - nTotalRecvLen = m_pSocket_Info->m_pLogic->GetSendLength() * nSendCount; - } - else - { - // - pSendData = (char* )m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); - nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength(); - } - - //¼Ӧֽ - int nRecvAllSize = nTotalRecvLen; - - //Ҫ¼־ݼ־ - if(m_pSocket_Info->m_blIsWriteFile == true) - { - WriteFile_SendBuff(pSendData, nSendLen); - } - - int nTotalSendLen = nSendLen; - int nBeginSend = 0; - int nCurrSendLen = 0; - bool blSendFlag = false; - int nBeginRecv = 0; - int nCurrRecvLen = 0; - bool blRecvFlag = false; - while(true) - { - //UDP - int nssssSize = sizeof(SOCKADDR); - nCurrSendLen = sendto(sckClient, pSendData + nBeginSend, nTotalSendLen, 0, (sockaddr* )&svrsockaddr, sizeof(SOCKADDR)); - if(nCurrSendLen <= 0) - { - DWORD dwError = GetLastError(); - WriteFile_Error("sendto error", (int)dwError); - m_pSocket_State_Info->m_nFailSend += nPacketCount; - m_pSocket_State_Info->m_nCurrectSocket = 0; - blIsConnect = false; - break; - } - else - { - nTotalSendLen -= nCurrSendLen; - if(nTotalSendLen == 0) - { - // - m_pSocket_State_Info->m_nSuccessSend += nPacketCount; - blSendFlag = true; - break; - } - else - { - nBeginSend += nCurrSendLen; - } - } - } - - // - if(blSendFlag == true && m_pSocket_Info->m_blIsRecv == true) - { - while(true) - { - //ͳɹˣ - int nClientAddrSize = sizeof(SOCKADDR_IN); - - //socket׼ - struct sockaddr_in clientsockaddr1; - /* - struct sockaddr_in clientsockaddr; - - memset(&clientsockaddr, 0, sizeof(SOCKADDR_IN)); - clientsockaddr.sin_family = AF_INET; - clientsockaddr.sin_port = htons(20004); - clientsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); - */ - - nCurrRecvLen = recvfrom(sckServer, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0, (sockaddr* )&clientsockaddr1, &nClientAddrSize); - if(nCurrRecvLen <= 0) - { - DWORD dwError = GetLastError(); - WriteFile_Error("sendto error", (int)dwError); - m_pSocket_State_Info->m_nFailRecv += nPacketCount; - //closesocket(sckClient); - m_pSocket_State_Info->m_nCurrectSocket = 0; - blIsConnect = false; - break; - } - else - { - //Ǹ߼ģʽLuaӿڷ - if(m_pSocket_Info->m_blLuaAdvance == true) - { - m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; - int nState = 0; - - CParamGroup objRecvIn; - CParamGroup objRecvOut; - - objRecvIn.NeedRetrieve(false); - objRecvOut.NeedRetrieve(false); - - pRecvParam1->SetParam((char* )szRecvBuffData, "void", sizeof(int)); - pRecvParam2->SetParam((char* )&nCurrRecvLen, "int", sizeof(int)); - pRecvParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); - pRecvParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); - - pRecvParamOut->SetParam((char* )&nState, "int", sizeof(int)); - - objRecvIn.Push(pRecvParam1); - objRecvIn.Push(pRecvParam2); - objRecvIn.Push(pRecvParam3); - objRecvIn.Push(pRecvParam4); - objRecvOut.Push(pRecvParamOut); - - //ýպ - m_objLuaFn.CallFileFn("PassTcp_GetRecvData", objRecvIn, objRecvOut); - - int* pReturn = (int* )pRecvParamOut->GetParam(); - nState = (int)(*pReturn); - - objRecvIn.Close(false); - objRecvOut.Close(false); - - //жϽűֵ - if(nState == 0) - { - //֤ɹ - m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; - blRecvFlag = true; - - //Ҫ¼־ݼ־ - if(m_pSocket_Info->m_blIsWriteFile == true) - { - WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); - } - - //Сʱʱ - int tTime = (int)((unsigned int)GetTickCount() - tBegin); - if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) - { - m_pSocket_State_Info->m_nMinRecvTime = tTime; - } - else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) - { - m_pSocket_State_Info->m_nMinRecvTime = tTime; - } - - if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) - { - m_pSocket_State_Info->m_nMaxRecvTime = tTime; - } - else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) - { - m_pSocket_State_Info->m_nMaxRecvTime = tTime; - } - - break; - } - else if(nState == 1) - { - // - nBeginRecv += nCurrRecvLen; - } - else - { - //հ֤ʧ - m_pSocket_State_Info->m_nFailRecv += nPacketCount; - blRecvFlag = true; - - //Ҫ¼־ݼ־ - if(m_pSocket_Info->m_blIsWriteFile == true) - { - WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); - } - - break; - } - } - else - { - //Ǹ߼ģʽõж׼ - m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; - nTotalRecvLen -= nCurrRecvLen; - - EM_DATA_RETURN_STATE emState = m_pSocket_Info->m_pLogic->GetRecvData(m_nThreadID, nSendLen, szRecvBuffData, nCurrRecvLen); - if(emState == DATA_RETURN_STATE_SUCCESS) - { - // - m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; - blRecvFlag = true; - - //Ҫ¼־ݼ־ - if(m_pSocket_Info->m_blIsWriteFile == true) - { - WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); - } - - //Сʱʱ - int tTime = (int)((unsigned int)GetTickCount() - tBegin); - if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) - { - m_pSocket_State_Info->m_nMinRecvTime = tTime; - } - else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) - { - m_pSocket_State_Info->m_nMinRecvTime = tTime; - } - - if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) - { - m_pSocket_State_Info->m_nMaxRecvTime = tTime; - } - else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) - { - m_pSocket_State_Info->m_nMaxRecvTime = tTime; - } - - break; - } - else - { - nBeginRecv += nCurrRecvLen; - } - } - } - } - } - - //ݰsleepָʱ - if(m_pSocket_Info->m_nPacketTimewait > 0) - { - DWORD dwSleepTime = (DWORD)m_pSocket_Info->m_nPacketTimewait; - Sleep(dwSleepTime); - } - - //dzӣ򲻹ر - if(m_pSocket_Info->m_blIsAlwayConnect == false) - { - //closesocket(sckClient); - m_pSocket_State_Info->m_nCurrectSocket = 0; - blIsConnect = false; - } - } - - //ֻһΣ˳ - if(m_pSocket_Info->m_blIsSendOne == true) - { - m_blRun = false; - } - } - - //ûϣϿ - closesocket(sckClient); - closesocket(sckServer); - m_pSocket_State_Info->m_nCurrectSocket = 0; - blIsConnect = false; - - //еLuaڴ - delete pSendParam1; - delete pSendParam2; - delete pSendParam3; - delete pSendParam4; - delete pSendParamOut; - delete pRecvParam1; - delete pRecvParam2; - delete pRecvParam3; - delete pRecvParam4; - delete pRecvParamOut; + int nPacketCount = 1; + m_blRun = true; + HSocket sckClient; + HSocket sckServer; + + //此部分为兼容Lua参数而设计 + //为了减少不必要的new和delete操作,所以参数在这里先声明好 + _ParamData* pSendParam1 = NULL; + _ParamData* pSendParam2 = NULL; + _ParamData* pSendParam3 = NULL; + _ParamData* pSendParam4 = NULL; + _ParamData* pSendParamOut = NULL; + _ParamData* pRecvParam1 = NULL; + _ParamData* pRecvParam2 = NULL; + _ParamData* pRecvParam3 = NULL; + _ParamData* pRecvParam4 = NULL; + _ParamData* pRecvParamOut = NULL; + + int nLuaBufferMaxLength = m_pSocket_Info->m_pLogic->GetSendLength(); + + if(m_pSocket_Info == NULL || m_pSocket_State_Info == NULL) + { + m_blRun = false; + return; + } + + //如果是高级模式 + if(m_pSocket_Info->m_blLuaAdvance == true) + { + m_objLuaFn.InitClass(); + + bool blState = m_objLuaFn.LoadLuaFile(m_pSocket_Info->m_szLuaFileName); + + if(false == blState) + { + printf("[Main]Open Lua file error.\n"); + return; + } + + //初始化所有要使用的Lua参数 + pSendParam1 = new _ParamData(); + pSendParam2 = new _ParamData(); + pSendParam3 = new _ParamData(); + pSendParam4 = new _ParamData(); + pSendParamOut = new _ParamData(); + pRecvParam1 = new _ParamData(); + pRecvParam2 = new _ParamData(); + pRecvParam3 = new _ParamData(); + pRecvParam4 = new _ParamData(); + pRecvParamOut = new _ParamData(); + + } + + //看看是否是长连接,如果是长连接,则只处理一次。 + bool blIsConnect = false; + + //socket创建的准备工作 + struct sockaddr_in svrsockaddr; + + // memset(&svrsockaddr, 0, sizeof(sockaddr_in)); + // svrsockaddr.sin_family = AF_INET; + // svrsockaddr.sin_port = htons(m_pSocket_Info->m_nPort); + // svrsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + GetAddressFrom(&svrsockaddr, m_pSocket_Info->m_szSerevrIP, m_pSocket_Info->m_nPort); + + sckClient = SocketOpen( SOCK_DGRAM); + + int TimeOut = (int)m_pSocket_Info->m_nRecvTimeout; + //::setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); + SocketTimeOut(sckClient, TimeOut, -1, -1); + + + //设置接收监听端口 + sckServer = SocketOpen( SOCK_DGRAM); + + struct sockaddr_in clientsockaddr; + //memset(&clientsockaddr, 0, sizeof()); + //clientsockaddr.sin_family = AF_INET; + //clientsockaddr.sin_port = htons(m_pSocket_Info->m_nUdpClientPort); + //clientsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + GetAddressFrom(&svrsockaddr, m_pSocket_Info->m_szSerevrIP, m_pSocket_Info->m_nUdpClientPort); + + + //bind(sckServer, (sockaddr_in *) &clientsockaddr, sizeof(clientsockaddr)); + SocketBind(sckServer, &clientsockaddr); + + + //发送次数 + int nSendIndex = 0; + + while(m_blRun) + { + unsigned int tBegin = (unsigned int)GetTickCount(); + + if(m_pSocket_Info->m_nSendCount != 0 && m_pSocket_State_Info->m_nSuccessSend >= m_pSocket_Info->m_nSendCount) + { + //发送指定数目的数据包完成 + break; + } + + //查看是否开启高级模式 + if(m_pSocket_Info->m_blLuaAdvance == true) + { + //重置缓冲最大长度 + m_pSocket_Info->m_pLogic->SetMaxSendLength(nLuaBufferMaxLength); + + //开始调用Lua脚本,去组织数据块 + CParamGroup objIn; + CParamGroup objOut; + + objIn.NeedRetrieve(false); + objOut.NeedRetrieve(false); + + int nLuaSendLen = m_pSocket_Info->m_pLogic->GetSendLength(); + pSendParam1->SetParam((char* )m_pSocket_Info->m_pLogic->GetSendData(), "void", sizeof(int)); + pSendParam2->SetParam((char* )&nLuaSendLen, "int", sizeof(int)); + pSendParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); + pSendParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); + + int nSendLength = 0; + pSendParamOut->SetParam((char* )&nSendLength, "int", sizeof(int)); + + objIn.Push(pSendParam1); + objIn.Push(pSendParam2); + objIn.Push(pSendParam3); + objIn.Push(pSendParam4); + objOut.Push(pSendParamOut); + + m_objLuaFn.CallFileFn("PassTcp_CreateSendData", objIn, objOut); + + int* pLength = (int* )pSendParamOut->GetParam(); + m_pSocket_Info->m_pLogic->SetMaxSendLength((int)(*pLength)); + } + + + if(blIsConnect == false) + { + int dwSleepTime = (int)m_pSocket_Info->m_nDelaySecond; + + if(m_pSocket_Info->m_blIsRadomaDelay == true) + { + //如果是随机的,则从1-1000之间随机一个时间 + dwSleepTime = (int)RandomValue(1, 1000); + } + + //挂起指定的时间 + //Sleep(dwSleepTime); + std::this_thread::sleep_for(std::chrono::milliseconds(dwSleepTime*1000)); + + m_pSocket_State_Info->m_nSuccessConnect++; + m_pSocket_State_Info->m_nCurrectSocket = 1; + blIsConnect = true; + } + + if(blIsConnect == true) + { + //发送数据 + char szSendBuffData[MAX_BUFF_1024 * 100] = {'\0'}; + char szRecvBuffData[MAX_BUFF_1024 * 100] = {'\0'}; + + char* pSendData = NULL; + int nSendLen = 0; + int nTotalRecvLen = 0; + + //如果数据为随机数据包 + if(m_pSocket_Info->m_blIsSendCount == true) + { + int nSendCount = RandomValue(1, 10); + + //这里追加一个逻辑,记录当前发包的总数是否匹配,随机数不能超过当前发包总数 + if(m_pSocket_Info->m_nSendCount != 0 && nSendCount + m_pSocket_State_Info->m_nSuccessSend > m_pSocket_Info->m_nSendCount) + { + nSendCount = m_pSocket_Info->m_nSendCount - m_pSocket_State_Info->m_nSuccessSend; + } + + char* pData = m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); + + for(int i = 0; i < nSendCount; i++) + { + MEMCOPY_SAFE(&szSendBuffData[i * nSendLen], + pData, + nSendLen); + } + + nPacketCount = nSendCount; + + //发送数据 + pSendData = (char* )szSendBuffData; + nSendLen = m_pSocket_Info->m_pLogic->GetSendLength() * nSendCount; + nTotalRecvLen = m_pSocket_Info->m_pLogic->GetSendLength() * nSendCount; + } + else + { + //发送数据 + pSendData = (char* )m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); + nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength(); + } + + //记录应收字节总数 + int nRecvAllSize = nTotalRecvLen; + + //如果需要记录日志,则将数据计入日志 + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_SendBuff(pSendData, nSendLen); + } + + int nTotalSendLen = nSendLen; + int nBeginSend = 0; + int nCurrSendLen = 0; + bool blSendFlag = false; + int nBeginRecv = 0; + int nCurrRecvLen = 0; + bool blRecvFlag = false; + + while(true) + { + //UDP发送 + int nssssSize = sizeof(sockaddr_in); + nCurrSendLen = sendto(sckClient, pSendData + nBeginSend, nTotalSendLen, 0, (sockaddr* )&svrsockaddr, sizeof(sockaddr_in)); + //void SocketSend(HSocket hs, const char *ptr, int nbytes, transresult_t &rt); + + if(nCurrSendLen <= 0) + { + int dwError = GetLastSocketError(); + WriteFile_Error("sendto error", (int)dwError); + m_pSocket_State_Info->m_nFailSend += nPacketCount; + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + break; + } + else + { + nTotalSendLen -= nCurrSendLen; + + if(nTotalSendLen == 0) + { + //发送完成 + m_pSocket_State_Info->m_nSuccessSend += nPacketCount; + blSendFlag = true; + break; + } + else + { + nBeginSend += nCurrSendLen; + } + } + } + + //接收数据 + if(blSendFlag == true && m_pSocket_Info->m_blIsRecv == true) + { + while(true) + { + //如果发送成功了,则处理接收数据 + int nClientAddrSize = sizeof(sockaddr_in); + + //socket创建的准备工作 + struct sockaddr_in clientsockaddr1; + /* + struct sockaddr_in clientsockaddr; + + memset(&clientsockaddr, 0, sizeof(SOCKADDR_IN)); + clientsockaddr.sin_family = AF_INET; + clientsockaddr.sin_port = htons(20004); + clientsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + */ + + //nCurrRecvLen = recvfrom(sckServer, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0, (sockaddr* )&clientsockaddr1, &nClientAddrSize); + nCurrRecvLen = SockRecvFrom(sckServer, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, &clientsockaddr1); + + if(nCurrRecvLen <= 0) + { + int dwError = GetLastSocketError(); + WriteFile_Error("sendto error", (int)dwError); + m_pSocket_State_Info->m_nFailRecv += nPacketCount; + //closesocket(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + break; + } + else + { + //如果是高级模式,这里调用Lua接口方法 + if(m_pSocket_Info->m_blLuaAdvance == true) + { + m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; + int nState = 0; + + CParamGroup objRecvIn; + CParamGroup objRecvOut; + + objRecvIn.NeedRetrieve(false); + objRecvOut.NeedRetrieve(false); + + pRecvParam1->SetParam((char* )szRecvBuffData, "void", sizeof(int)); + pRecvParam2->SetParam((char* )&nCurrRecvLen, "int", sizeof(int)); + pRecvParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); + pRecvParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); + + pRecvParamOut->SetParam((char* )&nState, "int", sizeof(int)); + + objRecvIn.Push(pRecvParam1); + objRecvIn.Push(pRecvParam2); + objRecvIn.Push(pRecvParam3); + objRecvIn.Push(pRecvParam4); + objRecvOut.Push(pRecvParamOut); + + //调用接收函数 + m_objLuaFn.CallFileFn("PassTcp_GetRecvData", objRecvIn, objRecvOut); + + int* pReturn = (int* )pRecvParamOut->GetParam(); + nState = (int)(*pReturn); + + objRecvIn.Close(false); + objRecvOut.Close(false); + + //判断脚本返回值 + if(nState == 0) + { + //接收验证成功 + m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; + blRecvFlag = true; + + //如果需要记录日志,则将数据计入日志 + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + //计算最小时间和最大时间 + int tTime = (int)((unsigned int)GetTickCount() - tBegin); + + if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + + if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + + break; + } + else if(nState == 1) + { + //继续接收 + nBeginRecv += nCurrRecvLen; + } + else + { + //接收包验证失败 + m_pSocket_State_Info->m_nFailRecv += nPacketCount; + blRecvFlag = true; + + //如果需要记录日志,则将数据计入日志 + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + break; + } + } + else + { + //如果不是高级模式,则采用配置的判定准则 + m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; + nTotalRecvLen -= nCurrRecvLen; + + EM_DATA_RETURN_STATE emState = m_pSocket_Info->m_pLogic->GetRecvData(m_nThreadID, nSendLen, szRecvBuffData, nCurrRecvLen); + + if(emState == DATA_RETURN_STATE_SUCCESS) + { + //接收完成 + m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; + blRecvFlag = true; + + //如果需要记录日志,则将数据计入日志 + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + //计算最小时间和最大时间 + int tTime = (int)((unsigned int)GetTickCount() - tBegin); + + if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + + if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + + break; + } + else + { + nBeginRecv += nCurrRecvLen; + } + } + } + } + } + + //如果有数据包间隔,则sleep指定的时间 + if(m_pSocket_Info->m_nPacketTimewait > 0) + { + int dwSleepTime = (int)m_pSocket_Info->m_nPacketTimewait; + std::this_thread::sleep_for(std::chrono::milliseconds(dwSleepTime*1000)); + } + + //如果是长连接,则不关闭连接 + if(m_pSocket_Info->m_blIsAlwayConnect == false) + { + //closesocket(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + } + } + + //如果只发送一次,在这里退出 + if(m_pSocket_Info->m_blIsSendOne == true) + { + m_blRun = false; + } + } + + //如果连接没断,则断开 + SocketClose(sckClient); + SocketClose(sckServer); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + + //回收所有的Lua申请的内存 + delete pSendParam1; + delete pSendParam2; + delete pSendParam3; + delete pSendParam4; + delete pSendParamOut; + delete pRecvParam1; + delete pRecvParam2; + delete pRecvParam3; + delete pRecvParam4; + delete pRecvParamOut; } void CClientUdpSocket::Stop() { - m_blRun = false; + m_blRun = false; } void CClientUdpSocket::SetSocketThread( _Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info ) { - Close(); + Close(); - m_pSocket_Info = pSocket_Info; - m_pSocket_State_Info = pSocket_State_Info; + m_pSocket_Info = pSocket_Info; + m_pSocket_State_Info = pSocket_State_Info; } _Socket_State_Info* CClientUdpSocket::GetStateInfo() { - return m_pSocket_State_Info; + return m_pSocket_State_Info; } bool CClientUdpSocket::WriteFile_SendBuff( const char* pData, int nLen ) { - FILE* pFile = NULL; - char szFileName[20]; - sprintf_s(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); - fopen_s(&pFile, szFileName, "a+"); - if(pFile == NULL) - { - return false; - } - - string strLog; - strLog = "[SendBuff]"; - - for(int i = 0; i < nLen; i++) - { - char szChar[20]; - sprintf_s(szChar, 20, " 0x%02X", (unsigned char )pData[i]); - strLog += szChar; - } - - strLog += "\n"; - - fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); - - fclose(pFile); - return true; + FILE* pFile = NULL; + char szFileName[20]; + sprintf(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); + pFile =fopen( szFileName, "a+"); + + if(pFile == NULL) + { + return false; + } + + string strLog; + strLog = "[SendBuff]"; + + for(int i = 0; i < nLen; i++) + { + char szChar[20]; + sprintf(szChar, " 0x%02X", (unsigned char )pData[i]); + strLog += szChar; + } + + strLog += "\n"; + + fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); + + fclose(pFile); + return true; } bool CClientUdpSocket::WriteFile_RecvBuff( const char* pData, int nLen ) { - FILE* pFile = NULL; - char szFileName[20]; - sprintf_s(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); - fopen_s(&pFile, szFileName, "a+"); - if(pFile == NULL) - { - return false; - } - - string strLog; - strLog = "[RecvBuff]"; - - for(int i = 0; i < nLen; i++) - { - char szChar[20]; - sprintf_s(szChar, 20, " 0x%02X", (unsigned char )pData[i]); - strLog += szChar; - } - - strLog += "\n"; - - fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); - - fclose(pFile); - return true; + FILE* pFile = NULL; + char szFileName[20]; + sprintf(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); + pFile =fopen( szFileName, "a+"); + + if(pFile == NULL) + { + return false; + } + + string strLog; + strLog = "[RecvBuff]"; + + for(int i = 0; i < nLen; i++) + { + char szChar[20]; + sprintf(szChar, " 0x%02X", (unsigned char )pData[i]); + strLog += szChar; + } + + strLog += "\n"; + + fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); + + fclose(pFile); + return true; } bool CClientUdpSocket::WriteFile_Error( const char* pError, int nErrorNumber ) { - time_t ttNow = time(NULL); - struct tm tmNow; - localtime_s(&tmNow, &ttNow); - - char szTimeNow[30] = {'\0'}; - sprintf_s(szTimeNow, 30, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); - - //ƴӳ־ - char szError[1024] = {'\0'}; - sprintf_s(szError, 1024, "%s %s, errno=%d.\n", szTimeNow, pError, nErrorNumber); - - FILE* pFile = NULL; - char szFileName[30]; - sprintf_s(szFileName, "StressTest_Error.log"); - fopen_s(&pFile, szFileName, "a+"); - if(pFile == NULL) - { - return false; - } - - fwrite(szError, strlen(szError), sizeof(char), pFile); - - fclose(pFile); - return true; + time_t ttNow = time(NULL); + struct tm tmNow; + //localtime(&tmNow, &ttNow); + tmNow =*(localtime( &ttNow)); + + char szTimeNow[30] = {'\0'}; + sprintf(szTimeNow, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); + + //拼接出错日志输出 + char szError[1024] = {'\0'}; + sprintf(szError, "%s %s, errno=%d.\n", szTimeNow, pError, nErrorNumber); + + FILE* pFile = NULL; + char szFileName[30]; + sprintf(szFileName, "StressTest_Error.log"); + pFile = fopen(szFileName, "a+"); + + if(pFile == NULL) + { + return false; + } + + fwrite(szError, strlen(szError), sizeof(char), pFile); + + fclose(pFile); + return true; } void CClientUdpSocket::SetThreadID( int nThreadID ) { - m_nThreadID = nThreadID; -} \ No newline at end of file + m_nThreadID = nThreadID; +} diff --git a/TestNetworkTool/PassTCP/ClientUdpSocket.h b/TestNetworkTool/PassTCP/ClientUdpSocket.h index 6be888dec..5249a762d 100644 --- a/TestNetworkTool/PassTCP/ClientUdpSocket.h +++ b/TestNetworkTool/PassTCP/ClientUdpSocket.h @@ -1,34 +1,34 @@ #pragma once #include "define.h" -#include #include "LuaFn.h" +#include "sock_wrap.h" class CClientUdpSocket { public: - CClientUdpSocket(void); - ~CClientUdpSocket(void); + CClientUdpSocket(void); + ~CClientUdpSocket(void); - void Close(); + void Close(); - void Run(); - void Stop(); + void Run(); + void Stop(); - void SetSocketThread(_Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info); - _Socket_State_Info* GetStateInfo(); + void SetSocketThread(_Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info); + _Socket_State_Info* GetStateInfo(); - void SetThreadID(int nThreadID); + void SetThreadID(int nThreadID); private: - bool WriteFile_SendBuff(const char* pData, int nLen); - bool WriteFile_RecvBuff(const char* pData, int nLen); - bool WriteFile_Error(const char* pError, int nErrorNumber); + bool WriteFile_SendBuff(const char* pData, int nLen); + bool WriteFile_RecvBuff(const char* pData, int nLen); + bool WriteFile_Error(const char* pError, int nErrorNumber); private: - _Socket_Info* m_pSocket_Info; - _Socket_State_Info* m_pSocket_State_Info; - bool m_blRun; - CLuaFn m_objLuaFn; - int m_nThreadID; //߳ID + _Socket_Info* m_pSocket_Info; + _Socket_State_Info* m_pSocket_State_Info; + bool m_blRun; + CLuaFn m_objLuaFn; + int m_nThreadID; //߳ID }; diff --git a/TestNetworkTool/PassTCP/LuaLib/Makefile b/TestNetworkTool/PassTCP/LuaLib/Makefile deleted file mode 100644 index e4a3cd610..000000000 --- a/TestNetworkTool/PassTCP/LuaLib/Makefile +++ /dev/null @@ -1,182 +0,0 @@ -# makefile for building Lua -# see ../INSTALL for installation instructions -# see ../Makefile and luaconf.h for further customization - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -CC= gcc -CFLAGS= -O2 -Wall $(MYCFLAGS) -AR= ar rcu -RANLIB= ranlib -RM= rm -f -LIBS= -lm $(MYLIBS) - -MYCFLAGS= -MYLDFLAGS= -MYLIBS= - -# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE ========= - -PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris - -LUA_A= liblua.a -CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ - lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \ - lundump.o lvm.o lzio.o -LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \ - lstrlib.o loadlib.o linit.o - -LUA_T= lua -LUA_O= lua.o - -LUAC_T= luac -LUAC_O= luac.o print.o - -ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -ALL_A= $(LUA_A) - -default: $(PLAT) - -all: $(ALL_T) - -o: $(ALL_O) - -a: $(ALL_A) - -$(LUA_A): $(CORE_O) $(LIB_O) - $(AR) $@ $? - $(RANLIB) $@ - -$(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - -$(LUAC_T): $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - -clean: - $(RM) $(ALL_T) $(ALL_O) - -depend: - @$(CC) $(CFLAGS) -MM l*.c print.c - -echo: - @echo "PLAT = $(PLAT)" - @echo "CC = $(CC)" - @echo "CFLAGS = $(CFLAGS)" - @echo "AR = $(AR)" - @echo "RANLIB = $(RANLIB)" - @echo "RM = $(RM)" - @echo "MYCFLAGS = $(MYCFLAGS)" - @echo "MYLDFLAGS = $(MYLDFLAGS)" - @echo "MYLIBS = $(MYLIBS)" - -# convenience targets for popular platforms - -none: - @echo "Please choose a platform:" - @echo " $(PLATS)" - -aix: - $(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" - -ansi: - $(MAKE) all MYCFLAGS=-DLUA_ANSI - -bsd: - $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E" - -freebsd: - $(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-Wl,-E -lreadline" - -generic: - $(MAKE) all MYCFLAGS= - -linux: - $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses" - -macosx: - $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-lreadline" -# use this on Mac OS X 10.3- -# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX - -mingw: - $(MAKE) "LUA_A=lua51.dll" "LUA_T=lua.exe" \ - "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ - "MYCFLAGS=-DLUA_BUILD_AS_DLL" "MYLIBS=" "MYLDFLAGS=-s" lua.exe - $(MAKE) "LUAC_T=luac.exe" luac.exe - -posix: - $(MAKE) all MYCFLAGS=-DLUA_USE_POSIX - -solaris: - $(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) default o a clean depend echo none - -# DO NOT DELETE - -lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \ - lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \ - lundump.h lvm.h -lauxlib.o: lauxlib.c lua.h luaconf.h lauxlib.h -lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h -lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ - lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ - ltable.h -ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h -ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \ - llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ - lfunc.h lstring.h lgc.h ltable.h lvm.h -ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ - lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h lstring.h \ - ltable.h lundump.h lvm.h -ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ - lzio.h lmem.h lundump.h -lfunc.o: lfunc.c lua.h luaconf.h lfunc.h lobject.h llimits.h lgc.h lmem.h \ - lstate.h ltm.h lzio.h -lgc.o: lgc.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ - lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h -linit.o: linit.c lua.h luaconf.h lualib.h lauxlib.h -liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h -llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ - lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h -lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h -lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h ldo.h -loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h -lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \ - ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h -lopcodes.o: lopcodes.c lopcodes.h llimits.h lua.h luaconf.h -loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h -lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ - lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ - lfunc.h lstring.h lgc.h ltable.h -lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h -lstring.o: lstring.c lua.h luaconf.h lmem.h llimits.h lobject.h lstate.h \ - ltm.h lzio.h lstring.h lgc.h -lstrlib.o: lstrlib.c lua.h luaconf.h lauxlib.h lualib.h -ltable.o: ltable.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h ldo.h lgc.h ltable.h -ltablib.o: ltablib.c lua.h luaconf.h lauxlib.h lualib.h -ltm.o: ltm.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h lzio.h \ - lmem.h lstring.h lgc.h ltable.h -lua.o: lua.c lua.h luaconf.h lauxlib.h lualib.h -luac.o: luac.c lua.h luaconf.h lauxlib.h ldo.h lobject.h llimits.h \ - lstate.h ltm.h lzio.h lmem.h lfunc.h lopcodes.h lstring.h lgc.h \ - lundump.h -lundump.o: lundump.c lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h lundump.h -lvm.o: lvm.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ - lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h ltable.h lvm.h -lzio.o: lzio.c lua.h luaconf.h llimits.h lmem.h lstate.h lobject.h ltm.h \ - lzio.h -print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \ - ltm.h lzio.h lmem.h lopcodes.h lundump.h - -# (end of Makefile) diff --git a/TestNetworkTool/PassTCP/PacketDlg.cpp b/TestNetworkTool/PassTCP/PacketDlg.cpp index 8d1a852ab..c16927d30 100644 --- a/TestNetworkTool/PassTCP/PacketDlg.cpp +++ b/TestNetworkTool/PassTCP/PacketDlg.cpp @@ -1,293 +1,378 @@ -// CPacketDlg.cpp : ʵļ -// - -#include "stdafx.h" -#include "PassTCP.h" -#include "PacketDlg.h" +#include "PacketDlg.h" #include "tinyxml.h" -// CPacketDlg Ի - -IMPLEMENT_DYNAMIC(CPacketDlg, CDialog) -CPacketDlg::CPacketDlg(CWnd* pParent /*=NULL*/) - : CDialog(CPacketDlg::IDD, pParent) +//(*InternalHeaders(CPacketDlg) +#include +#include +//*) +#include +#include + +#define PACKETDATA_FILENAME "PacketData.xml" + + +//(*IdInit(CPacketDlg) +const long CPacketDlg::ID_STATICBOX1 = wxNewId(); +const long CPacketDlg::ID_STATICBOX2 = wxNewId(); +const long CPacketDlg::ID_STATICTEXT2 = wxNewId(); +const long CPacketDlg::ID_TEXTCTRL_PacketData = wxNewId(); +const long CPacketDlg::ID_BUTTON_AddPacket = wxNewId(); +const long CPacketDlg::ID_RADIOBOX_PacketType = wxNewId(); +const long CPacketDlg::ID_STATICTEXT3 = wxNewId(); +const long CPacketDlg::ID_TEXTCTRL_RecvLength = wxNewId(); +const long CPacketDlg::ID_BUTTON_SavePacketToFile = wxNewId(); +const long CPacketDlg::ID_BUTTON_LoadPacketFile = wxNewId(); +const long CPacketDlg::ID_BUTTON4 = wxNewId(); +const long CPacketDlg::ID_BUTTON_PreviewSendResult = wxNewId(); +const long CPacketDlg::ID_BUTTON_CloseDialog = wxNewId(); +const long CPacketDlg::ID_LISTBOX_PacketList = wxNewId(); +const long CPacketDlg::ID_LISTBOX_PacketPreviewList = wxNewId(); +const long CPacketDlg::ID_PANEL1 = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(CPacketDlg,wxDialog) + //(*EventTable(CPacketDlg) + //*) +END_EVENT_TABLE() + +CPacketDlg::CPacketDlg(wxWindow* parent,wxWindowID id) { - + //(*Initialize(CPacketDlg) + Create(parent, wxID_ANY, wxT("顺序数据包设置"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY")); + SetClientSize(wxSize(581,389)); + Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(0,0), wxSize(584,400), wxTAB_TRAVERSAL, _T("ID_PANEL1")); + StaticBox1 = new wxStaticBox(Panel1, ID_STATICBOX1, wxT("添加数据包"), wxPoint(0,0), wxSize(576,224), 0, _T("ID_STATICBOX1")); + StaticBox2 = new wxStaticBox(Panel1, ID_STATICBOX2, wxT("压测数据包信息"), wxPoint(0,224), wxSize(576,168), 0, _T("ID_STATICBOX2")); + StaticText1 = new wxStaticText(Panel1, wxID_ANY, wxT("NOTE:添加数据包,其中随机数字的部分请用%d来替代,目前只支持文本协议,未来考虑二进制协议的支持,所有的回车换行请用/r/n明文写出,程序会 自动替换这这些字符。二进制数据包暂不支持随机替换.\\\\r\\\n如果发送文本数据包样例格式为:GET / HTTP/1.1\\\\\\\\r\\\\\\\nAccept: */*\\\\\\\\r\\\\\\\nAccept-Language: zh-cn\\\\\\\\r\\\\\\\n\\\\\\\\r\\\\\\\n\\\\r\\\n文本数据包格式为:0a 00 00 00 00 10 be cd aa 8f 3c 01 00 00"), wxPoint(16,24), wxSize(544,112), 0, _T("wxID_ANY")); + StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, wxT("数据包"), wxPoint(16,160), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + TextCtrl_PacketData = new wxTextCtrl(Panel1, ID_TEXTCTRL_PacketData, wxEmptyString, wxPoint(72,144), wxSize(488,48), 0, wxDefaultValidator, _T("ID_TEXTCTRL_PacketData")); + Button_AddPacket = new wxButton(Panel1, ID_BUTTON_AddPacket, wxT("添加数据包"), wxPoint(24,190), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_AddPacket")); + wxString __wxRadioBoxChoices_1[2] = + { + wxT("二进制数据包"), + wxT("文本数据包") + }; + RadioBox_PacketType = new wxRadioBox(Panel1, ID_RADIOBOX_PacketType, wxEmptyString, wxPoint(128,178), wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, wxRA_VERTICAL, wxDefaultValidator, _T("ID_RADIOBOX_PacketType")); + RadioBox_PacketType->SetSelection(0); + StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, wxT("接收字节数"), wxPoint(384,195), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + TextCtrl_RecvLength = new wxTextCtrl(Panel1, ID_TEXTCTRL_RecvLength, wxT("0"), wxPoint(448,192), wxSize(120,25), 0, wxDefaultValidator, _T("ID_TEXTCTRL_RecvLength")); + Button_SavePacketToFile = new wxButton(Panel1, ID_BUTTON_SavePacketToFile, wxT("保存成文件"), wxPoint(16,352), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_SavePacketToFile")); + Button_LoadPacketFile = new wxButton(Panel1, ID_BUTTON_LoadPacketFile, wxT("打开文件"), wxPoint(96,352), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_LoadPacketFile")); + Button_DeletePacketItem = new wxButton(Panel1, ID_BUTTON4, wxT("删除条目"), wxPoint(184,352), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); + Button_PreviewSendResult = new wxButton(Panel1, ID_BUTTON_PreviewSendResult, wxT("预览发送结果"), wxPoint(280,352), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_PreviewSendResult")); + Button_CloseDialog = new wxButton(Panel1, ID_BUTTON_CloseDialog, wxT("设置完成"), wxPoint(480,352), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_CloseDialog")); + ListBox_PacketList = new wxListBox(Panel1, ID_LISTBOX_PacketList, wxPoint(16,248), wxSize(256,104), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX_PacketList")); + ListBox_PacketPreviewList = new wxListBox(Panel1, ID_LISTBOX_PacketPreviewList, wxPoint(280,248), wxSize(288,104), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX_PacketPreviewList")); + + Connect(ID_BUTTON_AddPacket,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPacketDlg::OnButton_AddPacketClick); + Connect(ID_BUTTON_SavePacketToFile,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPacketDlg::OnButton_SavePacketToFileClick); + Connect(ID_BUTTON_LoadPacketFile,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPacketDlg::OnButton_LoadPacketFileClick); + Connect(ID_BUTTON4,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPacketDlg::OnButton_DeletePacketItemClick); + Connect(ID_BUTTON_PreviewSendResult,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPacketDlg::OnButton_PreviewSendResultClick); + Connect(ID_BUTTON_CloseDialog,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPacketDlg::OnButton_CloseDialogClick); + Panel1->Connect(wxEVT_PAINT,(wxObjectEventFunction)&CPacketDlg::OnPanel1Paint,0,this); + //*) } CPacketDlg::~CPacketDlg() { + //(*Destroy(CPacketDlg) + //*) } -void CPacketDlg::DoDataExchange(CDataExchange* pDX) + +void CPacketDlg::OnPanel1Paint(wxPaintEvent& event) { - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_EDIT1, m_txtPacketData); - DDX_Control(pDX, IDC_LIST1, m_lbRondomPacketList); - DDX_Control(pDX, IDC_LIST2, m_lbPreviewList); - DDX_Control(pDX, IDC_EDIT2, m_txtRecvLength); - DDX_Control(pDX, IDC_RADIO1, m_RadioBuffer); } +void CPacketDlg::OnButton_AddPacketClick(wxCommandEvent& event) +{ + //添加数据包 -BEGIN_MESSAGE_MAP(CPacketDlg, CDialog) - ON_BN_CLICKED(IDC_BUTTON1, &CPacketDlg::OnBnClickedButton1) - ON_BN_CLICKED(IDC_BUTTON3, &CPacketDlg::OnBnClickedButton3) - ON_BN_CLICKED(IDC_BUTTON4, &CPacketDlg::OnBnClickedButton4) - ON_BN_CLICKED(IDC_BUTTON5, &CPacketDlg::OnBnClickedButton5) - ON_BN_CLICKED(IDC_BUTTON2, &CPacketDlg::OnBnClickedButton2) - ON_BN_CLICKED(IDC_BUTTON6, &CPacketDlg::OnBnClickedButton6) -END_MESSAGE_MAP() + if(m_pBaseDataLogic == NULL) + { + //MessageBox(_T("必须指定m_pBaseDataLogic指针,指针不能为空。")); + wxString msg =wxT("必须指定m_pBaseDataLogic指针,指针不能为空。"); + wxMessageBox(msg, this->GetTitle(), wxOK | wxICON_INFORMATION, this); -void CPacketDlg::SetBaseDataLogic(CBaseDataLogic* pBaseDataLogic) -{ - m_pBaseDataLogic = pBaseDataLogic; - m_pBaseDataLogic->ClearRandomPacket(); - m_pBaseDataLogic->InitSendSize(MAX_RANDOM_PACKET); -} + return; + } -// CPacketDlg Ϣ + //获得接收字节数 + wxString strData =this->TextCtrl_RecvLength->GetValue(); + int nRecvLength = wxAtoi(strData); -void CPacketDlg::OnBnClickedButton1() -{ - //ݰ - CString strData; - char szPacketData[MAX_RANDOM_PACKET] = {'\0'}; - - if(m_pBaseDataLogic == NULL) - { - MessageBox(_T("ָm_pBaseDataLogicָ룬ָ벻Ϊա")); - return; - } - - m_txtPacketData.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szPacketData, MAX_RANDOM_PACKET, NULL,NULL); - szPacketData[nDecLen] = '\0'; - - //ýֽ - m_txtRecvLength.GetWindowText(strData); - int nRecvLength = _ttoi(strData); - - if(nRecvLength <= 0) - { - MessageBox(_T("ָݰijȣ޷͡")); - return; - } - - if(((CButton *)GetDlgItem(IDC_RADIO1))->GetCheck() == 1) - { - //ģʽ2 - m_pBaseDataLogic->InsertRandomPacket(szPacketData, nDecLen, nRecvLength, 2); - } - else - { - //ıģʽ1 - string strFormatData = (string)szPacketData; - - //滻\r\n - string_replace(strFormatData, "\\r", "\r"); - string_replace(strFormatData, "\\n", "\n"); - - m_pBaseDataLogic->InsertRandomPacket(strFormatData.c_str(), strFormatData.length(), nRecvLength, 1); - } - - ShowPacketList(); + if(nRecvLength <= 0) + { + //MessageBox(_T("必须指定接收数据包的长度,否则无法发送。")); + wxString msg =wxT("必须指定接收数据包的长度,否则无法发送。"); + wxMessageBox(msg, this->GetTitle(), wxOK | wxICON_INFORMATION, this); + + return; + } + + + //wxString strData; + char szPacketData[MAX_RANDOM_PACKET] = {'\0'}; + std::string PacketStrData =std::string(this->TextCtrl_PacketData->GetValue().ToAscii()); + ///m_txtPacketData.GetWindowText(strData); + + //int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); + //int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szPacketData, MAX_RANDOM_PACKET, NULL,NULL); + + strncpy(szPacketData, (const char*)PacketStrData.c_str(), MAX_RANDOM_PACKET); + int nDecLen =PacketStrData.length(); + szPacketData[nDecLen] = '\0'; + + + + if ( this->RadioBox_PacketType->GetSelection() == 0) + { + //二进制模式2 + m_pBaseDataLogic->InsertRandomPacket(szPacketData, nDecLen, nRecvLength, 2); + } + else + { + //文本模式1 + string strFormatData = (string)szPacketData; + + //替换\r\n + string_replace(strFormatData, "\\r", "\r"); + string_replace(strFormatData, "\\n", "\n"); + + m_pBaseDataLogic->InsertRandomPacket(strFormatData.c_str(), strFormatData.length(), nRecvLength, 1); + } + + ShowPacketList(); } -void CPacketDlg::ShowPacketList() +void CPacketDlg::OnButton_SavePacketToFileClick(wxCommandEvent& event) { - //ʾеݰ - m_lbRondomPacketList.ResetContent(); - - if(m_pBaseDataLogic == NULL) - { - return; - } - - for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) - { - _RandomPacketInfo* pRandomPacketInfo = m_pBaseDataLogic->GettRandomPacket(i); - if(NULL != pRandomPacketInfo) - { - wchar_t szTemp[MAX_RANDOM_PACKET] = {'\0'}; - - int nSrcLen = MultiByteToWideChar(CP_ACP, 0, pRandomPacketInfo->szPacket, -1, NULL, 0); - int nDecLen = MultiByteToWideChar(CP_ACP, 0, pRandomPacketInfo->szPacket, -1, szTemp, MAX_RANDOM_PACKET); - szTemp[nDecLen] = '\0'; - - m_lbRondomPacketList.AddString(szTemp); - } - } + //保存成XML文件 + FILE* pFile = NULL; + + char szFileName[20]; + sprintf(szFileName, PACKETDATA_FILENAME); + pFile =fopen( szFileName, "w"); + + if(pFile == NULL) + { + //MessageBox(_T("导出顺序数据包出错,文件不存在"), _T("提示信息"), MB_OK); + wxString msg =wxT("导出顺序数据包出错,文件不存在"); + wxMessageBox(msg, this->GetTitle(), wxOK | wxICON_INFORMATION, this); + + return; + } + + char szLogText[MAX_RANDOM_PACKET] = {'\0'}; + + sprintf(szLogText, "\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) + { + _RandomPacketInfo* pRandomPacketInfo = m_pBaseDataLogic->GettRandomPacket(i); + sprintf(szLogText, "\n" + ,pRandomPacketInfo->nLen + ,pRandomPacketInfo->nType + ,pRandomPacketInfo->nRecdvLength + ,pRandomPacketInfo->szPacket); + + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + } + + sprintf(szLogText, "\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + fclose(pFile); + + //MessageBox(_T("导出顺序数据包成功"), _T("提示信息"), MB_OK); + wxMessageBox(wxT("导出顺序数据包成功"), this->GetTitle(), wxOK | wxICON_INFORMATION, this); + + + + } -void CPacketDlg::OnBnClickedButton3() +void CPacketDlg::OnButton_LoadPacketFileClick(wxCommandEvent& event) { - //Ԥݰ - m_lbPreviewList.ResetContent(); - int nRecvLength = 0; - - char szTemp[MAX_RANDOM_PACKET] = {'\0'}; - for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) - { - int nLen = MAX_RANDOM_PACKET; - m_pBaseDataLogic->GetReview(i, szTemp, nLen, nRecvLength); - if(0 < nLen) - { - wchar_t sszTemp[MAX_RANDOM_PACKET] = {'\0'}; - - int nSrcLen = MultiByteToWideChar(CP_ACP, 0, szTemp, -1, NULL, 0); - int nDecLen = MultiByteToWideChar(CP_ACP, 0, szTemp, -1, sszTemp, MAX_RANDOM_PACKET); - sszTemp[nDecLen] = '\0'; - - m_lbPreviewList.AddString(sszTemp); - } - } + m_pBaseDataLogic->ClearRandomPacket(); + + //读取XML文件 + TiXmlDocument* pDocument = new TiXmlDocument(PACKETDATA_FILENAME); //tstl可以为文件路径或文件名 + pDocument->LoadFile(); + + if(NULL == pDocument) + { + //MessageBox(_T("读取顺序数据包xml文件失败"), _T("提示信息"), MB_OK); + wxMessageBox(wxT("读取顺序数据包xml文件失败"), this->GetTitle(), wxOK | wxICON_INFORMATION, this); + return; + } + + TiXmlElement* Root = pDocument->RootElement();//获取根节点 + TiXmlElement* Particl = NULL; + + int nLen = 0; + int nType = 0; + int nRecvLength = 0; + + for(Particl = Root->FirstChildElement(); Particl != NULL; Particl = Particl->NextSiblingElement()) + { + //得到文档内容 + const char* sztext = Particl->GetText(); + + //得到文档属性 + TiXmlAttribute* pAddrAttr = Particl->FirstAttribute(); + + if(strcmp(pAddrAttr->Name(), "Len") == 0) + { + nLen = atoi(pAddrAttr->Value()); + } + else if(strcmp(pAddrAttr->Name(), "Type") == 0) + { + nType = atoi(pAddrAttr->Value()); + } + else + { + nRecvLength = atoi(pAddrAttr->Value()); + } + + TiXmlAttribute* pAttr1 = pAddrAttr->Next(); + + if(strcmp(pAttr1->Name(), "Len") == 0) + { + nLen = atoi(pAttr1->Value()); + } + else if(strcmp(pAttr1->Name(), "Type") == 0) + { + nType = atoi(pAttr1->Value()); + } + else + { + nRecvLength = atoi(pAttr1->Value()); + } + + TiXmlAttribute* pAttr2 = pAttr1->Next(); + + if(strcmp(pAttr2->Name(), "Len") == 0) + { + nLen = atoi(pAttr2->Value()); + } + else if(strcmp(pAttr2->Name(), "Type") == 0) + { + nType = atoi(pAttr2->Value()); + } + else + { + nRecvLength = atoi(pAttr2->Value()); + } + + //添加类型 + m_pBaseDataLogic->InsertRandomPacket(sztext, nLen, nRecvLength, nType); + } + + ShowPacketList(); + + delete pDocument; + } -void CPacketDlg::OnBnClickedButton4() +void CPacketDlg::OnButton_DeletePacketItemClick(wxCommandEvent& event) { - //ɾѡеĿ - int nIndex = m_lbRondomPacketList.GetCurSel(); - if(nIndex >= 0) - { - m_pBaseDataLogic->DeleteRandomPacket(nIndex); - } + //删除选中的条目 + + int nIndex =this->ListBox_PacketList->GetSelection(); + + if(nIndex >= 0) + { + m_pBaseDataLogic->DeleteRandomPacket(nIndex); + } } -BOOL CPacketDlg::OnInitDialog() +void CPacketDlg::OnButton_PreviewSendResultClick(wxCommandEvent& event) { - CDialog::OnInitDialog(); + //预览数据包 + this->ListBox_PacketPreviewList->Clear(); + //m_lbPreviewList.ResetContent(); + int nRecvLength = 0; + + char szTemp[MAX_RANDOM_PACKET] = {'\0'}; + + for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) + { + int nLen = MAX_RANDOM_PACKET; + m_pBaseDataLogic->GetReview(i, szTemp, nLen, nRecvLength); + + if(0 < nLen) + { + //wxString temp=wxString::FromAscii(szTemp); + + //wchar_t sszTemp[MAX_RANDOM_PACKET] = {'\0'}; + + //int nSrcLen = MultiByteToWideChar(CP_ACP, 0, szTemp, -1, NULL, 0); + //int nDecLen = MultiByteToWideChar(CP_ACP, 0, szTemp, -1, sszTemp, MAX_RANDOM_PACKET); + //sszTemp[nDecLen] = '\0'; + + this->ListBox_PacketPreviewList->Insert(wxString::FromAscii(szTemp),this->ListBox_PacketPreviewList->GetCount()); + } + } - m_RadioBuffer.SetCheck(BST_CHECKED); - m_txtRecvLength.SetWindowText(_T("0")); + this->Destroy(); - return TRUE; } -void CPacketDlg::OnBnClickedButton5() + +void CPacketDlg::OnButton_CloseDialogClick(wxCommandEvent& event) { - //رյǰ - OnOK(); + this->Close(); } -void CPacketDlg::OnBnClickedButton2() -{ - //XMLļ - FILE* pFile = NULL; - char szFileName[20]; - sprintf_s(szFileName, PACKETDATA_FILENAME); - fopen_s(&pFile, szFileName, "w"); - if(pFile == NULL) - { - MessageBox(_T("˳ݰļ"), _T("ʾϢ"), MB_OK); - return; - } - char szLogText[MAX_RANDOM_PACKET] = {'\0'}; - sprintf_s(szLogText, MAX_RANDOM_PACKET, "\n"); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); +void CPacketDlg::SetBaseDataLogic(CBaseDataLogic* pBaseDataLogic) +{ + m_pBaseDataLogic = pBaseDataLogic; + m_pBaseDataLogic->ClearRandomPacket(); + m_pBaseDataLogic->InitSendSize(MAX_RANDOM_PACKET); +} + + +void CPacketDlg::ShowPacketList() +{ + //显示所有的数据包 + //m_lbRondomPacketList.ResetContent(); + this->ListBox_PacketPreviewList->Clear(); + + if(m_pBaseDataLogic == NULL) + { + return; + } - sprintf_s(szLogText, MAX_RANDOM_PACKET, "\n"); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) + { + _RandomPacketInfo* pRandomPacketInfo = m_pBaseDataLogic->GettRandomPacket(i); - for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) - { - _RandomPacketInfo* pRandomPacketInfo = m_pBaseDataLogic->GettRandomPacket(i); - sprintf_s(szLogText, MAX_RANDOM_PACKET, "\n" - ,pRandomPacketInfo->nLen - ,pRandomPacketInfo->nType - ,pRandomPacketInfo->nRecdvLength - ,pRandomPacketInfo->szPacket); + if(NULL != pRandomPacketInfo) + { + //wchar_t szTemp[MAX_RANDOM_PACKET] = {'\0'}; - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - } + //int nSrcLen = MultiByteToWideChar(CP_ACP, 0, pRandomPacketInfo->szPacket, -1, NULL, 0); + //int nDecLen = MultiByteToWideChar(CP_ACP, 0, pRandomPacketInfo->szPacket, -1, szTemp, MAX_RANDOM_PACKET); + //szTemp[nDecLen] = '\0'; - sprintf_s(szLogText, MAX_RANDOM_PACKET, "\n"); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + //m_lbRondomPacketList.AddString(szTemp); + //this->ListBox_PacketPreviewList->Insert(szTemp,this->ListBox_PacketPreviewList->GetCount()); - fclose(pFile); + this->ListBox_PacketPreviewList->Insert(wxString::FromAscii(pRandomPacketInfo->szPacket),this->ListBox_PacketPreviewList->GetCount()); - MessageBox(_T("˳ݰɹ"), _T("ʾϢ"), MB_OK); + } + } } -void CPacketDlg::OnBnClickedButton6() -{ - m_pBaseDataLogic->ClearRandomPacket(); - - //ȡXMLļ - TiXmlDocument * pDocument = new TiXmlDocument(PACKETDATA_FILENAME);//tstlΪļ·ļ - pDocument->LoadFile(); - - if(NULL == pDocument) - { - MessageBox(_T("ȡ˳ݰxmlļʧ"), _T("ʾϢ"), MB_OK); - return; - } - - TiXmlElement *Root = pDocument->RootElement();//ȡڵ - TiXmlElement *Particl = NULL; - - int nLen = 0; - int nType = 0; - int nRecvLength = 0; - - for(Particl = Root->FirstChildElement();Particl != NULL;Particl = Particl->NextSiblingElement()) - { - //õĵ - const char *sztext = Particl->GetText(); - - //õĵ - TiXmlAttribute* pAddrAttr = Particl->FirstAttribute(); - if(strcmp(pAddrAttr->Name(), "Len") == 0) - { - nLen = atoi(pAddrAttr->Value()); - } - else if(strcmp(pAddrAttr->Name(), "Type") == 0) - { - nType = atoi(pAddrAttr->Value()); - } - else - { - nRecvLength = atoi(pAddrAttr->Value()); - } - - TiXmlAttribute *pAttr1 = pAddrAttr->Next(); - if(strcmp(pAttr1->Name(), "Len") == 0) - { - nLen = atoi(pAttr1->Value()); - } - else if(strcmp(pAttr1->Name(), "Type") == 0) - { - nType = atoi(pAttr1->Value()); - } - else - { - nRecvLength = atoi(pAttr1->Value()); - } - - TiXmlAttribute * pAttr2 = pAttr1->Next(); - if(strcmp(pAttr2->Name(), "Len") == 0) - { - nLen = atoi(pAttr2->Value()); - } - else if(strcmp(pAttr2->Name(), "Type") == 0) - { - nType = atoi(pAttr2->Value()); - } - else - { - nRecvLength = atoi(pAttr2->Value()); - } - - // - m_pBaseDataLogic->InsertRandomPacket(sztext, nLen, nRecvLength, nType); - } - - ShowPacketList(); - - delete pDocument; -} + + diff --git a/TestNetworkTool/PassTCP/PacketDlg.h b/TestNetworkTool/PassTCP/PacketDlg.h index 38edd1f7a..d49140a58 100644 --- a/TestNetworkTool/PassTCP/PacketDlg.h +++ b/TestNetworkTool/PassTCP/PacketDlg.h @@ -1,48 +1,94 @@ -#pragma once -#include "afxwin.h" +#ifndef CPACKETDLGG_H +#define CPACKETDLGG_H + +//(*Headers(CPacketDlg) +#include +#include +#include +#include +#include +#include +#include +#include +//*) + + #include "define.h" -// PacketDlg Ի -#define PACKETDATA_FILENAME "PacketData.xml" -class CPacketDlg : public CDialog +class CPacketDlg: public wxDialog { - DECLARE_DYNAMIC(CPacketDlg) - public: - CPacketDlg(CWnd* pParent = NULL); // ׼캯 - virtual ~CPacketDlg(); -// Ի - enum { IDD = IDD_PACKET_DIALOG }; - -public: - void SetBaseDataLogic(CBaseDataLogic* pBaseDataLogic); + CPacketDlg(wxWindow* parent,wxWindowID id=wxID_ANY); + virtual ~CPacketDlg(); -private: - void ShowPacketList(); + //(*Declarations(CPacketDlg) + wxButton* Button_AddPacket; + wxButton* Button_CloseDialog; + wxButton* Button_DeletePacketItem; + wxButton* Button_LoadPacketFile; + wxButton* Button_PreviewSendResult; + wxButton* Button_SavePacketToFile; + wxListBox* ListBox_PacketList; + wxListBox* ListBox_PacketPreviewList; + wxPanel* Panel1; + wxRadioBox* RadioBox_PacketType; + wxStaticBox* StaticBox1; + wxStaticBox* StaticBox2; + wxStaticText* StaticText1; + wxStaticText* StaticText2; + wxStaticText* StaticText3; + wxTextCtrl* TextCtrl_PacketData; + wxTextCtrl* TextCtrl_RecvLength; + //*) protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - virtual BOOL OnInitDialog(); + //(*Identifiers(CPacketDlg) + static const long ID_STATICBOX1; + static const long ID_STATICBOX2; + static const long ID_STATICTEXT2; + static const long ID_TEXTCTRL_PacketData; + static const long ID_BUTTON_AddPacket; + static const long ID_RADIOBOX_PacketType; + static const long ID_STATICTEXT3; + static const long ID_TEXTCTRL_RecvLength; + static const long ID_BUTTON_SavePacketToFile; + static const long ID_BUTTON_LoadPacketFile; + static const long ID_BUTTON4; + static const long ID_BUTTON_PreviewSendResult; + static const long ID_BUTTON_CloseDialog; + static const long ID_LISTBOX_PacketList; + static const long ID_LISTBOX_PacketPreviewList; + static const long ID_PANEL1; + //*) + +private: + + //(*Handlers(CPacketDlg) + void OnPanel1Paint(wxPaintEvent& event); + void OnButton_AddPacketClick(wxCommandEvent& event); + void OnButton_SavePacketToFileClick(wxCommandEvent& event); + void OnButton_LoadPacketFileClick(wxCommandEvent& event); + void OnButton_DeletePacketItemClick(wxCommandEvent& event); + void OnButton_PreviewSendResultClick(wxCommandEvent& event); + void OnButton_CloseDialogClick(wxCommandEvent& event); + //*) + + DECLARE_EVENT_TABLE() + - DECLARE_MESSAGE_MAP() public: - CEdit m_txtPacketData; - CListBox m_lbRondomPacketList; - CListBox m_lbPreviewList; - CEdit m_txtRecvLength; + void SetBaseDataLogic(CBaseDataLogic* pBaseDataLogic); private: - CBaseDataLogic* m_pBaseDataLogic; + void ShowPacketList(); + +private: + CBaseDataLogic* m_pBaseDataLogic; + -public: - afx_msg void OnBnClickedButton1(); - afx_msg void OnBnClickedButton3(); - afx_msg void OnBnClickedButton4(); - CButton m_RadioBuffer; - afx_msg void OnBnClickedButton5(); - afx_msg void OnBnClickedButton2(); - afx_msg void OnBnClickedButton6(); }; + +#endif diff --git a/TestNetworkTool/PassTCP/PassTCPApp.cpp b/TestNetworkTool/PassTCP/PassTCPApp.cpp new file mode 100644 index 000000000..db13c7601 --- /dev/null +++ b/TestNetworkTool/PassTCP/PassTCPApp.cpp @@ -0,0 +1,35 @@ +/*************************************************************** + * Name: PassTCPApp.cpp + * Purpose: Code for Application Class + * Author: smith () + * Created: 2019-02-19 + * Copyright: smith () + * License: + **************************************************************/ + +#include "PassTCPApp.h" + +//(*AppHeaders +#include "PassTCPDlg.h" +#include +//*) + +IMPLEMENT_APP(PassTCPApp); + +bool PassTCPApp::OnInit() +{ + //(*AppInitialize + bool wxsOK = true; + wxInitAllImageHandlers(); + + if ( wxsOK ) + { + CPassTCPDlg* Frame = new CPassTCPDlg(0); + Frame->Show(); + SetTopWindow(Frame); + } + + //*) + return wxsOK; + +} diff --git a/TestNetworkTool/PassTCP/PassTCPApp.h b/TestNetworkTool/PassTCP/PassTCPApp.h new file mode 100644 index 000000000..1c9274079 --- /dev/null +++ b/TestNetworkTool/PassTCP/PassTCPApp.h @@ -0,0 +1,21 @@ +/*************************************************************** + * Name: PassTCPApp.h + * Purpose: Defines Application Class + * Author: smith () + * Created: 2019-02-19 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef PASSTCPAPP_H +#define PASSTCPAPP_H + +#include + +class PassTCPApp : public wxApp +{ +public: + virtual bool OnInit(); +}; + +#endif // PASSTCPAPP_H diff --git a/TestNetworkTool/PassTCP/PassTCPDlg.cpp b/TestNetworkTool/PassTCP/PassTCPDlg.cpp index 0c7e7d877..3885744a5 100644 --- a/TestNetworkTool/PassTCP/PassTCPDlg.cpp +++ b/TestNetworkTool/PassTCP/PassTCPDlg.cpp @@ -1,1202 +1,1193 @@ +/*************************************************************** + * Name: PassTCPDlg.cpp + * Purpose: Code for Application Frame + * Author: Smith () + * Created: 2019-02-17 + * Copyright: Smith () + * License: + **************************************************************/ -// PassTCPDlg.cpp : ʵļ -// - -#include "stdafx.h" -#include "PassTCP.h" #include "PassTCPDlg.h" +#include -#ifdef _DEBUG -#define new DEBUG_NEW -#endif +#include "macro.h" +#include "PacketDlg.h" -// Ӧó򡰹ڡ˵ CAboutDlg Ի -//ִ߳ -DWORD WINAPI ThreadProc(LPVOID argv) -{ +//(*InternalHeaders(CPassTCPDlg) +#include +#include +#include +#include +#include +//*) - CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )argv; - pClientTcpSocket->Run(); - return 0; -} -DWORD WINAPI ThreadUDPProc(LPVOID argv) + +//线程执行 +int ThreadProc(void* argv) { - CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )argv; - pClientUdpSocket->Run(); + CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )argv; + pClientTcpSocket->Run(); - return 0; + return 0; } - -class CAboutDlg : public CDialog +int ThreadUDPProc(void* argv) { -public: - CAboutDlg(); - - // Ի - enum { IDD = IDD_ABOUTBOX }; - -protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ - // ʵ -protected: - DECLARE_MESSAGE_MAP() -}; + CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )argv; + pClientUdpSocket->Run(); -CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) -{ + return 0; } -void CAboutDlg::DoDataExchange(CDataExchange* pDX) -{ - CDialog::DoDataExchange(pDX); -} -BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) -END_MESSAGE_MAP() -// CPassTCPDlg Ի +//helper functions +enum wxbuildinfoformat +{ + short_f, long_f +}; +wxString wxbuildinfo(wxbuildinfoformat format) +{ + wxString wxbuild(wxVERSION_STRING); + + if (format == long_f ) + { +#if defined(__WXMSW__) + wxbuild << _T("-Windows"); +#elif defined(__UNIX__) + wxbuild << _T("-Linux"); +#endif +#if wxUSE_UNICODE + wxbuild << _T("-Unicode build"); +#else + wxbuild << _T("-ANSI build"); +#endif // wxUSE_UNICODE + } + return wxbuild; +} -CPassTCPDlg::CPassTCPDlg(CWnd* pParent /*=NULL*/) -: CDialog(CPassTCPDlg::IDD, pParent) -, m_nRadio(0) +//(*IdInit(CPassTCPDlg) +const long CPassTCPDlg::ID_STATICBOX1 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT1 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT2 = wxNewId(); +const long CPassTCPDlg::ID_STATICBOX2 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT3 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT4 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT5 = wxNewId(); +const long CPassTCPDlg::ID_STATICBOX3 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT6 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL1 = wxNewId(); +const long CPassTCPDlg::ID_CHECKBOX1 = wxNewId(); +const long CPassTCPDlg::ID_BUTTON_LuaAdvance = wxNewId(); +const long CPassTCPDlg::ID_BUTTON_StatTest = wxNewId(); +const long CPassTCPDlg::ID_BUTTON_StopTest = wxNewId(); +const long CPassTCPDlg::ID_BUTTON_ExportTestData = wxNewId(); +const long CPassTCPDlg::ID_BUTTON_SetRadomPacket = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL2 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL3 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL4 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL5 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL6 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT7 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT8 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT9 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT10 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL7 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL8 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL9 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL10 = wxNewId(); +const long CPassTCPDlg::ID_CHECKBOX2 = wxNewId(); +const long CPassTCPDlg::ID_CHECKBOX3 = wxNewId(); +const long CPassTCPDlg::ID_CHECKBOX4 = wxNewId(); +const long CPassTCPDlg::ID_CHECKBOX5 = wxNewId(); +const long CPassTCPDlg::ID_CHECKBOX6 = wxNewId(); +const long CPassTCPDlg::ID_CHECKBOX7 = wxNewId(); +const long CPassTCPDlg::ID_CHECKBOX8 = wxNewId(); +const long CPassTCPDlg::ID_RADIOBOX1 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT11 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT12 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT13 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT14 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT15 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT16 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL11 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL12 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL13 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL14 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL15 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL16 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT17 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT18 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT19 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL17 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL18 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL19 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT20 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL20 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT21 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL21 = wxNewId(); +const long CPassTCPDlg::ID_STATICTEXT22 = wxNewId(); +const long CPassTCPDlg::ID_CHOICE1 = wxNewId(); +const long CPassTCPDlg::ID_TEXTCTRL22 = wxNewId(); +const long CPassTCPDlg::ID_PANEL1 = wxNewId(); +const long CPassTCPDlg::ID_TIMER_Test = wxNewId(); +//*) + +BEGIN_EVENT_TABLE(CPassTCPDlg,wxFrame) + //(*EventTable(CPassTCPDlg) + //*) +END_EVENT_TABLE() + +CPassTCPDlg::CPassTCPDlg(wxWindow* parent,wxWindowID id) { - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + //(*Initialize(CPassTCPDlg) + Create(parent, id, wxT("TCP压力测试通用工具"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id")); + SetClientSize(wxSize(769,510)); + { + wxIcon FrameIcon; + FrameIcon.CopyFromBitmap(wxBitmap(wxImage(_T("./small.ico")))); + SetIcon(FrameIcon); + } + Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(224,216), wxSize(752,514), wxTAB_TRAVERSAL, _T("ID_PANEL1")); + StaticBox1 = new wxStaticBox(Panel1, ID_STATICBOX1, wxT("参数配置"), wxPoint(0,0), wxSize(768,296), 0, _T("ID_STATICBOX1")); + StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, wxT("服务器IP"), wxPoint(24,22), wxDefaultSize, 0, _T("ID_STATICTEXT1")); + StaticText2 = new wxStaticText(Panel1, ID_STATICTEXT2, wxT("压测线程数"), wxPoint(24,52), wxDefaultSize, 0, _T("ID_STATICTEXT2")); + StaticBox2 = new wxStaticBox(Panel1, ID_STATICBOX2, wxT("压力测试参数"), wxPoint(8,288), wxSize(760,232), 0, _T("ID_STATICBOX2")); + StaticText3 = new wxStaticText(Panel1, ID_STATICTEXT3, wxT("连接间延迟毫秒"), wxPoint(24,80), wxDefaultSize, 0, _T("ID_STATICTEXT3")); + StaticText4 = new wxStaticText(Panel1, ID_STATICTEXT4, wxT("数据包间隔"), wxPoint(24,108), wxDefaultSize, 0, _T("ID_STATICTEXT4")); + StaticText5 = new wxStaticText(Panel1, ID_STATICTEXT5, wxT("设置发包总数,如果无限设置为零"), wxPoint(24,140), wxDefaultSize, 0, _T("ID_STATICTEXT5")); + StaticBox3 = new wxStaticBox(Panel1, ID_STATICBOX3, wxT("高级模式(LUA文件控制模式)"), wxPoint(16,160), wxSize(736,88), 0, _T("ID_STATICBOX3")); + StaticText6 = new wxStaticText(Panel1, ID_STATICTEXT6, wxT("Lua控制文件路径"), wxPoint(32,188), wxDefaultSize, 0, _T("ID_STATICTEXT6")); + TextCtrl_LuaControlFilePath = new wxTextCtrl(Panel1, ID_TEXTCTRL1, wxEmptyString, wxPoint(144,184), wxSize(576,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); + CheckBoxLuaAdvance = new wxCheckBox(Panel1, ID_CHECKBOX1, wxT("启用高级模式"), wxPoint(32,216), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1")); + CheckBoxLuaAdvance->SetValue(false); + Button_LuaAdvance = new wxButton(Panel1, ID_BUTTON_LuaAdvance, wxT("打开文件夹"), wxPoint(144,208), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_LuaAdvance")); + Button_StatTest = new wxButton(Panel1, ID_BUTTON_StatTest, wxT("开始压测"), wxPoint(32,252), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_StatTest")); + Button_StopTest = new wxButton(Panel1, ID_BUTTON_StopTest, wxT("停止压测"), wxPoint(200,252), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_StopTest")); + Button_ExportTestData = new wxButton(Panel1, ID_BUTTON_ExportTestData, wxT("导出压测数据文档"), wxPoint(352,252), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_ExportTestData")); + Button_SetRadomPacket = new wxButton(Panel1, ID_BUTTON_SetRadomPacket, wxT("设置随机数据包序列"), wxPoint(528,252), wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON_SetRadomPacket")); + TextCtrl_ServerIP = new wxTextCtrl(Panel1, ID_TEXTCTRL2, wxT("127.0.0.1"), wxPoint(120,20), wxSize(-1,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); + TextCtrl_ServerIP->SetMaxLength(15); + TextCtrl_TestThreadCount = new wxTextCtrl(Panel1, ID_TEXTCTRL3, wxT("1"), wxPoint(120,48), wxSize(-1,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL3")); + TextCtrl_SocketInterval = new wxTextCtrl(Panel1, ID_TEXTCTRL4, wxT("0"), wxPoint(120,76), wxSize(-1,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL4")); + TextCtrl_PacketTimewait = new wxTextCtrl(Panel1, ID_TEXTCTRL5, wxT("0"), wxPoint(120,104), wxSize(-1,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL5")); + TextCtrl_PacketSendMax = new wxTextCtrl(Panel1, ID_TEXTCTRL6, wxT("0"), wxPoint(232,136), wxSize(184,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL6")); + StaticText7 = new wxStaticText(Panel1, ID_STATICTEXT7, wxT("服务器端口"), wxPoint(232,22), wxDefaultSize, 0, _T("ID_STATICTEXT7")); + StaticText8 = new wxStaticText(Panel1, ID_STATICTEXT8, wxT("接收超时秒数"), wxPoint(232,48), wxDefaultSize, 0, _T("ID_STATICTEXT8")); + StaticText9 = new wxStaticText(Panel1, ID_STATICTEXT9, wxT("接收字节限定"), wxPoint(232,72), wxDefaultSize, 0, _T("ID_STATICTEXT9")); + StaticText10 = new wxStaticText(Panel1, ID_STATICTEXT10, wxT("UDP接收端口"), wxPoint(236,104), wxDefaultSize, 0, _T("ID_STATICTEXT10")); + TextCtrl_ServerPort = new wxTextCtrl(Panel1, ID_TEXTCTRL7, wxT("10002"), wxPoint(320,20), wxSize(-1,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL7")); + TextCtrl_ServerPort->SetMaxLength(5); + TextCtrl_RecvTimeOut = new wxTextCtrl(Panel1, ID_TEXTCTRL8, wxT("1000"), wxPoint(320,48), wxSize(-1,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL8")); + TextCtrl_RecvLength = new wxTextCtrl(Panel1, ID_TEXTCTRL9, wxT("12"), wxPoint(320,76), wxSize(-1,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL9")); + TextCtrl_ClientUdpPort = new wxTextCtrl(Panel1, ID_TEXTCTRL10, wxT("20002"), wxPoint(320,104), wxSize(-1,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL10")); + CheckBox_IsAlwayConnect = new wxCheckBox(Panel1, ID_CHECKBOX2, wxT("是否开启长连接"), wxPoint(448,22), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2")); + CheckBox_IsAlwayConnect->SetValue(false); + CheckBox_RadomaDelay = new wxCheckBox(Panel1, ID_CHECKBOX3, wxT("是否开启随机延时"), wxPoint(600,22), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX3")); + CheckBox_RadomaDelay->SetValue(false); + CheckBox_IsRecv = new wxCheckBox(Panel1, ID_CHECKBOX4, wxT("是否接收应答包"), wxPoint(448,48), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX4")); + CheckBox_IsRecv->SetValue(true); + CheckBox_IsBroken = new wxCheckBox(Panel1, ID_CHECKBOX5, wxT("是否开启断线自动重连"), wxPoint(600,48), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX5")); + CheckBox_IsBroken->SetValue(true); + CheckBox_RadomSendCount = new wxCheckBox(Panel1, ID_CHECKBOX6, wxT("是否启用随机数据包数(随机1-10个数据包)"), wxPoint(448,72), wxSize(256,17), 0, wxDefaultValidator, _T("ID_CHECKBOX6")); + CheckBox_RadomSendCount->SetValue(false); + CheckBoxIsWriteLog = new wxCheckBox(Panel1, ID_CHECKBOX7, wxT("是否记录数据日志"), wxPoint(448,96), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX7")); + CheckBoxIsWriteLog->SetValue(false); + CheckBox_SendOne = new wxCheckBox(Panel1, ID_CHECKBOX8, wxT("只发送一个包"), wxPoint(600,96), wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX8")); + CheckBox_SendOne->SetValue(false); + wxString __wxRadioBoxChoices_1[3] = + { + wxT("TCP链接"), + wxT("UDP链接"), + wxT("WebSocket链接") + }; + RadioBox_nRadio = new wxRadioBox(Panel1, ID_RADIOBOX1, wxEmptyString, wxPoint(448,112), wxSize(312,48), 3, __wxRadioBoxChoices_1, 1, wxRA_VERTICAL|wxFULL_REPAINT_ON_RESIZE, wxDefaultValidator, _T("ID_RADIOBOX1")); + StaticText11 = new wxStaticText(Panel1, ID_STATICTEXT11, wxT("连接成功数"), wxPoint(32,312), wxDefaultSize, 0, _T("ID_STATICTEXT11")); + StaticText12 = new wxStaticText(Panel1, ID_STATICTEXT12, wxT("发送成功数"), wxPoint(32,344), wxDefaultSize, 0, _T("ID_STATICTEXT12")); + StaticText13 = new wxStaticText(Panel1, ID_STATICTEXT13, wxT("接收成功数"), wxPoint(32,376), wxDefaultSize, 0, _T("ID_STATICTEXT13")); + StaticText14 = new wxStaticText(Panel1, ID_STATICTEXT14, wxT("当前连接数"), wxPoint(32,406), wxDefaultSize, 0, _T("ID_STATICTEXT14")); + StaticText15 = new wxStaticText(Panel1, ID_STATICTEXT15, wxT("最小响应时间"), wxPoint(32,436), wxDefaultSize, 0, _T("ID_STATICTEXT15")); + StaticText16 = new wxStaticText(Panel1, ID_STATICTEXT16, wxT("发送字节数"), wxPoint(32,466), wxDefaultSize, 0, _T("ID_STATICTEXT16")); + TextCtrl_SuccessConnect = new wxTextCtrl(Panel1, ID_TEXTCTRL11, wxEmptyString, wxPoint(112,308), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL11")); + TextCtrl_SuccessSend = new wxTextCtrl(Panel1, ID_TEXTCTRL12, wxEmptyString, wxPoint(112,340), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL12")); + TextCtrl_SuccessRecv = new wxTextCtrl(Panel1, ID_TEXTCTRL13, wxEmptyString, wxPoint(112,372), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL13")); + TextCtrl_CurrConnect = new wxTextCtrl(Panel1, ID_TEXTCTRL14, wxEmptyString, wxPoint(112,402), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL14")); + TextCtrl_MinTime = new wxTextCtrl(Panel1, ID_TEXTCTRL15, wxEmptyString, wxPoint(112,432), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL15")); + TextCtrl_SendByteCount = new wxTextCtrl(Panel1, ID_TEXTCTRL16, wxEmptyString, wxPoint(112,464), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL16")); + StaticText17 = new wxStaticText(Panel1, ID_STATICTEXT17, wxT("连接失败数"), wxPoint(240,312), wxDefaultSize, 0, _T("ID_STATICTEXT17")); + StaticText18 = new wxStaticText(Panel1, ID_STATICTEXT18, wxT("发送失败数"), wxPoint(240,344), wxDefaultSize, 0, _T("ID_STATICTEXT18")); + StaticText19 = new wxStaticText(Panel1, ID_STATICTEXT19, wxT("接收失败数"), wxPoint(240,376), wxDefaultSize, 0, _T("ID_STATICTEXT19")); + TextCtrl_FailConnect = new wxTextCtrl(Panel1, ID_TEXTCTRL17, wxEmptyString, wxPoint(320,308), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL17")); + TextCtrl_FailSend = new wxTextCtrl(Panel1, ID_TEXTCTRL18, wxEmptyString, wxPoint(320,340), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL18")); + TextCtrl_FailRecv = new wxTextCtrl(Panel1, ID_TEXTCTRL19, wxEmptyString, wxPoint(320,372), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL19")); + StaticText20 = new wxStaticText(Panel1, ID_STATICTEXT20, wxT("最大响应时间"), wxPoint(240,436), wxDefaultSize, 0, _T("ID_STATICTEXT20")); + TextCtrl_MaxTime = new wxTextCtrl(Panel1, ID_TEXTCTRL20, wxEmptyString, wxPoint(320,432), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL20")); + StaticText21 = new wxStaticText(Panel1, ID_STATICTEXT21, wxT("接收字节数"), wxPoint(240,466), wxDefaultSize, 0, _T("ID_STATICTEXT21")); + TextCtrl_RecvByteCount = new wxTextCtrl(Panel1, ID_TEXTCTRL21, wxEmptyString, wxPoint(320,464), wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL21")); + StaticText22 = new wxStaticText(Panel1, ID_STATICTEXT22, wxT("压测发送二进制串"), wxPoint(448,312), wxDefaultSize, 0, _T("ID_STATICTEXT22")); + Choice_SendBuffStyle = new wxChoice(Panel1, ID_CHOICE1, wxPoint(560,308), wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1")); + Choice_SendBuffStyle->SetSelection( Choice_SendBuffStyle->Append(wxT("二进制模式")) ); + Choice_SendBuffStyle->Append(wxT("文本模式")); + TextCtrl_SendText = new wxTextCtrl(Panel1, ID_TEXTCTRL22, wxEmptyString, wxPoint(448,336), wxSize(288,152), wxTE_MULTILINE, wxDefaultValidator, _T("ID_TEXTCTRL22")); + DirDialog_Lua = new wxDirDialog(this, wxT("打开目录"), wxEmptyString, wxDD_DEFAULT_STYLE|wxDD_DIR_MUST_EXIST|wxDD_CHANGE_DIR, wxDefaultPosition, wxDefaultSize, _T("wxDirDialog")); + Timer_Test.SetOwner(this, ID_TIMER_Test); + Timer_Test.Start(1000, false); + + Connect(ID_BUTTON_LuaAdvance,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPassTCPDlg::OnButton_LuaAdvanceClick); + Connect(ID_BUTTON_StatTest,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPassTCPDlg::OnButton_StatTestClick); + Connect(ID_BUTTON_StopTest,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPassTCPDlg::OnButton_StopTestClick); + Connect(ID_BUTTON_ExportTestData,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPassTCPDlg::OnButton_ExportTestDataClick); + Connect(ID_BUTTON_SetRadomPacket,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CPassTCPDlg::OnButton_SetRadomPacketClick); + Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&CPassTCPDlg::OnTextCtrl_ServerIPText); + Connect(ID_CHOICE1,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&CPassTCPDlg::OnChoice_SendBuffStyleSelect); + Connect(ID_TIMER_Test,wxEVT_TIMER,(wxObjectEventFunction)&CPassTCPDlg::OnTimer_TestTrigger); + Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&CPassTCPDlg::OnClose); + //*) } -void CPassTCPDlg::DoDataExchange(CDataExchange* pDX) +CPassTCPDlg::~CPassTCPDlg() { - CDialog::DoDataExchange(pDX); - DDX_Control(pDX, IDC_EDIT1, m_txtServerIP); - DDX_Control(pDX, IDC_EDIT2, m_txtPort); - DDX_Control(pDX, IDC_EDIT3, m_txtThreadCount); - DDX_Control(pDX, IDC_EDIT13, m_txtRecvTimeout); - DDX_Control(pDX, IDC_EDIT4, m_txtSocketInterval); - DDX_Control(pDX, IDC_CHECK1, m_chkIsAlwayConnect); - DDX_Control(pDX, IDC_CHECK3, m_chkRadomaDelay); - DDX_Control(pDX, IDC_CHECK2, m_chkIsRecv); - DDX_Control(pDX, IDC_CHECK4, m_ChkIsBroken); - DDX_Control(pDX, IDC_EDIT6, m_txtSuccessConnect); - DDX_Control(pDX, IDC_EDIT7, m_txtSuccessSend); - DDX_Control(pDX, IDC_EDIT8, m_txtSuccessRecv); - DDX_Control(pDX, IDC_EDIT9, m_txtCurrConnect); - DDX_Control(pDX, IDC_EDIT10, m_txtFailConnect); - DDX_Control(pDX, IDC_EDIT11, m_txtFailSend); - DDX_Control(pDX, IDC_EDIT12, m_txtFailRecv); - DDX_Control(pDX, IDC_EDIT14, m_txtRecvLength); - DDX_Control(pDX, IDC_CHECK5, m_chkRadomSendCount); - DDX_Control(pDX, IDC_CHECK6, m_chkIsWriteLog); - DDX_Control(pDX, IDC_CHECK7, m_chkSendOne); - DDX_Radio(pDX, IDC_RADIO1, m_nRadio); - DDX_Control(pDX, IDC_EDIT15, m_txtClientUdpPort); - DDX_Control(pDX, IDC_EDIT16, m_txtPacketTimewait); - DDX_Control(pDX, IDC_EDIT17, m_txtSendByteCount); - DDX_Control(pDX, IDC_EDIT18, m_txtRecvByteCount); - DDX_Control(pDX, IDC_COMBO1, m_cbSendBuffStyle); - DDX_Control(pDX, IDC_RICHEDIT21, m_reSendText); - //DDX_Control(pDX, IDC_EDIT5, m_reSendText); - DDX_Control(pDX, IDC_EDIT19, m_txtLuaFilePath); - DDX_Control(pDX, IDC_CHECK8, m_chkLuaAdvance); - DDX_Control(pDX, IDC_EDIT20, m_txtSendCount); - DDX_Control(pDX, IDC_EDIT21, m_txtMinTime); - DDX_Control(pDX, IDC_EDIT22, m_txtMaxTime); + //(*Destroy(CPassTCPDlg) + //*) } -BEGIN_MESSAGE_MAP(CPassTCPDlg, CDialog) - ON_WM_SYSCOMMAND() - ON_WM_PAINT() - ON_WM_QUERYDRAGICON() - //}}AFX_MSG_MAP - ON_BN_CLICKED(IDC_BUTTON1, &CPassTCPDlg::OnBnClickedButton1) - ON_WM_CLOSE() - ON_BN_CLICKED(IDC_BUTTON2, &CPassTCPDlg::OnBnClickedButton2) - ON_WM_TIMER() - ON_BN_CLICKED(IDC_BUTTON3, &CPassTCPDlg::OnBnClickedButton3) - ON_CBN_SELCHANGE(IDC_COMBO1, &CPassTCPDlg::OnCbnSelchangeCombo1) - ON_BN_CLICKED(IDC_BUTTON4, &CPassTCPDlg::OnBnClickedButton4) - ON_BN_CLICKED(IDC_BUTTON5, &CPassTCPDlg::OnBnClickedButton5) -END_MESSAGE_MAP() - - -// CPassTCPDlg Ϣ - -BOOL CPassTCPDlg::OnInitDialog() +void CPassTCPDlg::OnQuit(wxCommandEvent& event) { - CDialog::OnInitDialog(); - - // ...˵ӵϵͳ˵С - - // IDM_ABOUTBOX ϵͳΧڡ - ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); - ASSERT(IDM_ABOUTBOX < 0xF000); - - CMenu* pSysMenu = GetSystemMenu(FALSE); - if (pSysMenu != NULL) - { - BOOL bNameValid; - CString strAboutMenu; - bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); - ASSERT(bNameValid); - if (!strAboutMenu.IsEmpty()) - { - pSysMenu->AppendMenu(MF_SEPARATOR); - pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); - } - } - - // ô˶ԻͼꡣӦóڲǶԻʱܽԶ - // ִд˲ - SetIcon(m_hIcon, TRUE); // ôͼ - SetIcon(m_hIcon, FALSE); // Сͼ - - SetTimer(1, 1000, NULL); - InitRandom(); - - // TODO: ڴӶijʼ - InitView(); - - return TRUE; // ǽõؼ򷵻 TRUE + Close(); } -void CPassTCPDlg::OnSysCommand(UINT nID, LPARAM lParam) +void CPassTCPDlg::OnAbout(wxCommandEvent& event) { - if ((nID & 0xFFF0) == IDM_ABOUTBOX) - { - CAboutDlg dlgAbout; - dlgAbout.DoModal(); - } - else - { - CDialog::OnSysCommand(nID, lParam); - } -} + wxString msg = wxT("PassTCP,1.0 版,压力测试工具\r\nCopyright freeeeyes (C) 2013\r\n"); + wxMessageBox(msg, wxT("关于 PassTCP"), wxOK | wxICON_INFORMATION, this); -// ԻСťҪĴ -// Ƹͼꡣʹĵ/ͼģ͵ MFC Ӧó -// ⽫ɿԶɡ +} -void CPassTCPDlg::OnPaint() +void CPassTCPDlg::OnButton_LuaAdvanceClick(wxCommandEvent& event) { - if (IsIconic()) - { - CPaintDC dc(this); // ڻƵ豸 - - SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); - - // ʹͼڹо - int cxIcon = GetSystemMetrics(SM_CXICON); - int cyIcon = GetSystemMetrics(SM_CYICON); - CRect rect; - GetClientRect(&rect); - int x = (rect.Width() - cxIcon + 1) / 2; - int y = (rect.Height() - cyIcon + 1) / 2; - - // ͼ - dc.DrawIcon(x, y, m_hIcon); - } - else - { - CDialog::OnPaint(); - } + //打开Lua文件夹 + //首先判断高级选项是否已经打开 + + if(this->CheckBoxLuaAdvance->IsChecked() ==false) + { + wxString msg = wxT("请先选择启用高级模式开关。"); + wxMessageBox(msg, wxT("关于 PassTCP"), wxOK | wxICON_INFORMATION, this); + return; + } + + if (this->DirDialog_Lua->ShowModal() ==wxID_OK) + { + wxString LuaDirPath =this->DirDialog_Lua->GetPath(); + this->TextCtrl_LuaControlFilePath->SetValue(LuaDirPath); + } + } -//û϶Сʱϵͳô˺ȡù -//ʾ -HCURSOR CPassTCPDlg::OnQueryDragIcon() +void CPassTCPDlg::OnButton_StatTestClick(wxCommandEvent& event) { - return static_cast(m_hIcon); + //开始压测代码在这里 + char* pSendData = NULL; + ClearResult(); + Close(); + + + //m_txtThreadCount.GetWindowText(strData); + int nThreadCount = wxAtoi(this->TextCtrl_TestThreadCount->GetValue()); + //m_txtSendCount.GetWindowText(strData); + int nAllSendCount = wxAtoi(this->TextCtrl_PacketSendMax->GetValue()); + + //根据线程数计算发送量 + int nThreadSendCount = nAllSendCount / nThreadCount; + + for(int i = 0; i < nThreadCount; i++) + { + //读取线程信息 + _Socket_Info* pSocket_Info = new _Socket_Info(); + _Socket_State_Info* pSocket_State_Info = new _Socket_State_Info(); + + ENUM_TYPE_PROTOCOL emType = ENUM_PROTOCOL_TCP; + //默认TCP类型,0是TCP,1是UDP + + + + switch(this->RadioBox_nRadio->GetSelection()) + { + case 0: //TCP + { + pSocket_Info->m_nConnectType = 0; + emType = ENUM_PROTOCOL_TCP; + + if(m_pLogic == NULL) + { + CNomalLogic* pNomalLogic = new CNomalLogic(); + m_pLogic = (CBaseDataLogic* )pNomalLogic; + pSocket_Info->m_pLogic = m_pLogic; + } + else + { + pSocket_Info->m_pLogic = m_pLogic; + } + + break; + } + + case 1: //UDP + { + pSocket_Info->m_nConnectType = 1; + emType = ENUM_PROTOCOL_UDP; + + if(m_pLogic == NULL) + { + CNomalLogic* pNomalLogic = new CNomalLogic(); + m_pLogic = (CBaseDataLogic* )pNomalLogic; + pSocket_Info->m_pLogic = m_pLogic; + } + else + { + pSocket_Info->m_pLogic = m_pLogic; + } + + break; + } + + case 2: //WebSocket + { + pSocket_Info->m_nConnectType = 0; + emType = ENUM_PROTOCOL_WEBSOCKET; + + if(m_pLogic == NULL) + { + CWebSocketLogic* pWebSocketLogic = new CWebSocketLogic(); + pSocket_Info->m_pLogic = (CBaseDataLogic* )pWebSocketLogic; + } + else + { + pSocket_Info->m_pLogic = m_pLogic; + } + + break; + } + } + + + //std::string stlstring = std::string(strData.mb_str()); + wxString m_szSerevrIP =this->TextCtrl_ServerIP->GetValue(); + strncpy(pSocket_Info->m_szSerevrIP, (const char*)m_szSerevrIP.mb_str(), 16); + int nDecLen =this->TextCtrl_ServerIP->GetValue().length(); + pSocket_Info->m_szSerevrIP[nDecLen] = '\0'; + + pSocket_Info->m_nPort = wxAtoi(this->TextCtrl_ServerPort->GetValue()); + pSocket_Info->m_nRecvTimeout = wxAtoi(this->TextCtrl_RecvTimeOut->GetValue()); + pSocket_Info->m_nDelaySecond = wxAtoi(this->TextCtrl_SocketInterval->GetValue()); + pSocket_Info->m_pLogic->SetRecvLength(wxAtoi(this->TextCtrl_RecvLength->GetValue())); + pSocket_Info->m_nUdpClientPort = wxAtoi(this->TextCtrl_ClientUdpPort->GetValue()); + pSocket_Info->m_nPacketTimewait = wxAtoi(this->TextCtrl_PacketTimewait->GetValue()); + + + if(nThreadSendCount > 0) + { + if(i == nThreadCount - 1 && nThreadCount > 1) + { + pSocket_Info->m_nSendCount = nThreadSendCount + ( nAllSendCount % nThreadSendCount); + } + else + { + pSocket_Info->m_nSendCount = nThreadSendCount; + } + } + + if(this->CheckBoxLuaAdvance->IsChecked() == true) + { + //如果是Lua文件模式,直接初始化一个100k的数据块 + //然后根据脚本去组织发送数据 + pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); + } + else + { + + std::string SendText =std::string(this->TextCtrl_SendText->GetValue()); + int nBufferSize =SendText.length(); + pSendData = new char[nBufferSize]; + strncpy(pSendData, (const char*)SendText.c_str(), nBufferSize); + + pSendData[nBufferSize] = '\0'; + + + + if(this->Choice_SendBuffStyle->GetSelection() == 0) + { + if(emType != ENUM_PROTOCOL_WEBSOCKET) + { + //如果是二进制模式 + CConvertBuffer objConvertBuffer; + //获得要转换的数据块大小 + pSocket_Info->m_pLogic->InitSendSize(objConvertBuffer.GetBufferSize(pSendData, nDecLen)); + //将数据串转换成二进制串 + int nSendLen = nDecLen; + objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), + (unsigned char*)pSocket_Info->m_pLogic->GetSendData(), nSendLen); + } + else + { + //如果是webSocket模式 + char szOriData[100 * MAX_BUFF_1024] = {'\0'}; + //如果是二进制模式 + CConvertBuffer objConvertBuffer; + //获得要转换的数据块大小 + pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); + //将数据串转换成二进制串 + int nSendLen = 100 * MAX_BUFF_1024; + objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), + (unsigned char*)szOriData, nSendLen); + + pSocket_Info->m_pLogic->SetSendBuff(szOriData, nSendLen); + } + } + else + { + if(emType != ENUM_PROTOCOL_WEBSOCKET) + { + //如果是文本模式 + pSocket_Info->m_pLogic->InitSendSize(nDecLen); + memcpy(pSocket_Info->m_pLogic->GetSendData(), pSendData, nDecLen); + } + else + { + //如果是webSocket模式 + pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); + pSocket_Info->m_pLogic->SetSendBuff(pSendData, nDecLen); + } + } + + delete[] pSendData; + + } + + pSocket_Info->m_blIsAlwayConnect = this->CheckBox_IsAlwayConnect->IsChecked(); + + pSocket_Info->m_blIsRadomaDelay = this->CheckBox_RadomaDelay->IsChecked(); + pSocket_Info->m_blIsRecv = this->CheckBox_IsRecv->IsChecked(); + + pSocket_Info->m_blIsBroken = this->CheckBox_IsBroken->IsChecked(); + + pSocket_Info->m_blIsSendCount = this->CheckBox_RadomSendCount->IsChecked(); + pSocket_Info->m_blIsWriteFile = this->CheckBoxIsWriteLog->IsChecked(); + pSocket_Info->m_blIsSendOne = this->CheckBox_SendOne->IsChecked(); + pSocket_Info->m_blLuaAdvance = this->CheckBoxLuaAdvance->IsChecked(); + + //是否开启高级模式 + if(this->CheckBoxLuaAdvance->IsChecked() == true) + { + //如果打开高级模式,则读取文件 + + wxString m_txtLuaFilePath =this->TextCtrl_LuaControlFilePath->GetValue(); + + if(m_txtLuaFilePath.length() == 0) + { + wxMessageBox(wxT("您已经开启了高级模式,必须设置必要的Lua文件名。"), this->GetTitle(), wxOK | wxICON_INFORMATION, this); + delete pSocket_Info; + delete pSocket_State_Info; + return; + } + + std::string LuaFilePathText =std::string(m_txtLuaFilePath); + int nBufferSize =LuaFilePathText.length(); + strncpy(pSocket_Info->m_szLuaFileName, (const char*)LuaFilePathText.c_str(), nBufferSize); + pSocket_Info->m_szLuaFileName[nDecLen] = '\0'; + + } + + + if(pSocket_Info->m_nConnectType == 0) + { + //TCP发送 + CClientTcpSocket* pClientTcpSocket = new CClientTcpSocket(); + pClientTcpSocket->SetSocketThread(pSocket_Info, pSocket_State_Info); + pClientTcpSocket->SetThreadID(i); + + + std::thread thread_tcp(ThreadProc, pClientTcpSocket); + + //DWORD ThreadID = 0; + //CreateThread(NULL, NULL, ThreadProc, (LPVOID)pClientTcpSocket, NULL, &ThreadID); + + m_vecClientTcpSocket.push_back(pClientTcpSocket); + } + else + { + //UDP发送 + CClientUdpSocket* pClientUdpSocket = new CClientUdpSocket(); + pClientUdpSocket->SetSocketThread(pSocket_Info, pSocket_State_Info); + + //DWORD ThreadID = 0; + //CreateThread(NULL, NULL, ThreadUDPProc, (LPVOID)pClientUdpSocket, NULL, &ThreadID); + + std::thread thread_udp(ThreadUDPProc, pClientUdpSocket); + + m_vecClientUdpSocket.push_back(pClientUdpSocket); + } + + m_tmBegin = wxDateTime::Now (); + m_blIsRun = true; + } } - -void CPassTCPDlg::OnBnClickedButton1() +void CPassTCPDlg::OnButton_StopTestClick(wxCommandEvent& event) { - //ʼѹ - char* pSendData = NULL; - ClearResult(); - Close(); - - CString strData; - - m_txtThreadCount.GetWindowText(strData); - int nThreadCount = _ttoi((LPCTSTR)strData); - m_txtSendCount.GetWindowText(strData); - int nAllSendCount = _ttoi((LPCTSTR)strData); - - //߳㷢 - int nThreadSendCount = nAllSendCount / nThreadCount; - - for(int i = 0; i < nThreadCount; i++) - { - //ȡ߳Ϣ - _Socket_Info* pSocket_Info = new _Socket_Info(); - _Socket_State_Info* pSocket_State_Info = new _Socket_State_Info(); - - ENUM_TYPE_PROTOCOL emType = ENUM_PROTOCOL_TCP; - //ĬTCPͣ0TCP1UDP - switch(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3)) - { - case IDC_RADIO1: - { - pSocket_Info->m_nConnectType = 0; - emType = ENUM_PROTOCOL_TCP; - if(m_pLogic == NULL) - { - CNomalLogic* pNomalLogic = new CNomalLogic(); - m_pLogic = (CBaseDataLogic* )pNomalLogic; - pSocket_Info->m_pLogic = m_pLogic; - } - else - { - pSocket_Info->m_pLogic = m_pLogic; - } - break; - } - case IDC_RADIO2: - { - pSocket_Info->m_nConnectType = 1; - emType = ENUM_PROTOCOL_UDP; - if(m_pLogic == NULL) - { - CNomalLogic* pNomalLogic = new CNomalLogic(); - m_pLogic = (CBaseDataLogic* )pNomalLogic; - pSocket_Info->m_pLogic = m_pLogic; - } - else - { - pSocket_Info->m_pLogic = m_pLogic; - } - break; - } - case IDC_RADIO3: - { - pSocket_Info->m_nConnectType = 0; - emType = ENUM_PROTOCOL_WEBSOCKET; - if(m_pLogic == NULL) - { - CWebSocketLogic* pWebSocketLogic = new CWebSocketLogic(); - pSocket_Info->m_pLogic = (CBaseDataLogic* )pWebSocketLogic; - } - else - { - pSocket_Info->m_pLogic = m_pLogic; - } - break; - } - } - - m_txtServerIP.GetWindowText(strData); - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSocket_Info->m_szSerevrIP, MAX_BUFF_20, NULL,NULL); - pSocket_Info->m_szSerevrIP[nDecLen] = '\0'; - - m_txtPort.GetWindowText(strData); - pSocket_Info->m_nPort = _ttoi((LPCTSTR)strData); - m_txtRecvTimeout.GetWindowText(strData); - pSocket_Info->m_nRecvTimeout = _ttoi((LPCTSTR)strData); - m_txtSocketInterval.GetWindowText(strData); - pSocket_Info->m_nDelaySecond = _ttoi((LPCTSTR)strData); - m_txtRecvLength.GetWindowText(strData); - pSocket_Info->m_pLogic->SetRecvLength(_ttoi((LPCTSTR)strData)); - m_txtClientUdpPort.GetWindowText(strData); - pSocket_Info->m_nUdpClientPort = _ttoi((LPCTSTR)strData); - m_txtPacketTimewait.GetWindowText(strData); - pSocket_Info->m_nPacketTimewait = _ttoi((LPCTSTR)strData); - - if(nThreadSendCount > 0) - { - if(i == nThreadCount - 1 && nThreadCount > 1) - { - pSocket_Info->m_nSendCount = nThreadSendCount + ( nAllSendCount % nThreadSendCount); - } - else - { - pSocket_Info->m_nSendCount = nThreadSendCount; - } - } - - m_reSendText.GetWindowText(strData); - - - int nBufferSize = 0; - if(m_chkLuaAdvance.GetCheck() == BST_CHECKED) - { - //Luaļģʽֱӳʼһ100kݿ - //Ȼݽűȥ֯ - pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); - } - else - { - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); - pSendData = new char[nBufferSize]; - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSendData, nBufferSize, NULL,NULL); - pSendData[nDecLen] = '\0'; - - if(m_cbSendBuffStyle.GetCurSel() == 0) - { - if(emType != ENUM_PROTOCOL_WEBSOCKET) - { - //Ƕģʽ - CConvertBuffer objConvertBuffer; - //ҪתݿС - pSocket_Info->m_pLogic->InitSendSize(objConvertBuffer.GetBufferSize(pSendData, nDecLen)); - //ݴתɶƴ - int nSendLen = nDecLen; - objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), - (unsigned char*)pSocket_Info->m_pLogic->GetSendData(), nSendLen); - } - else - { - //webSocketģʽ - char szOriData[100 * MAX_BUFF_1024] = {'\0'}; - //Ƕģʽ - CConvertBuffer objConvertBuffer; - //ҪתݿС - pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); - //ݴתɶƴ - int nSendLen = 100 * MAX_BUFF_1024; - objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), - (unsigned char*)szOriData, nSendLen); - - pSocket_Info->m_pLogic->SetSendBuff(szOriData, nSendLen); - } - } - else - { - if(emType != ENUM_PROTOCOL_WEBSOCKET) - { - //ıģʽ - pSocket_Info->m_pLogic->InitSendSize(nDecLen); - memcpy_s(pSocket_Info->m_pLogic->GetSendData(), nDecLen, pSendData, nDecLen); - } - else - { - //webSocketģʽ - pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); - pSocket_Info->m_pLogic->SetSendBuff(pSendData, nDecLen); - } - } - - delete[] pSendData; - - } - - if(m_chkIsAlwayConnect.GetCheck() == BST_CHECKED) - { - pSocket_Info->m_blIsAlwayConnect = true; - } - else - { - pSocket_Info->m_blIsAlwayConnect = false; - } - - if(m_chkRadomaDelay.GetCheck() == BST_CHECKED) - { - pSocket_Info->m_blIsRadomaDelay = true; - } - else - { - pSocket_Info->m_blIsRadomaDelay = false; - } - - if(m_chkIsRecv.GetCheck() == BST_CHECKED) - { - pSocket_Info->m_blIsRecv = true; - } - else - { - pSocket_Info->m_blIsRecv = false; - } - - if(m_ChkIsBroken.GetCheck() == BST_CHECKED) - { - pSocket_Info->m_blIsBroken = true; - } - else - { - pSocket_Info->m_blIsBroken = false; - } - - if(m_chkRadomSendCount.GetCheck() == BST_CHECKED) - { - pSocket_Info->m_blIsSendCount = true; - } - else - { - pSocket_Info->m_blIsSendCount = false; - } - - if(m_chkIsWriteLog.GetCheck() == BST_CHECKED) - { - pSocket_Info->m_blIsWriteFile = true; - } - else - { - pSocket_Info->m_blIsWriteFile = false; - } - - if(m_chkSendOne.GetCheck() == BST_CHECKED) - { - pSocket_Info->m_blIsSendOne = true; - } - else - { - pSocket_Info->m_blIsSendOne = false; - } - - //Ƿ߼ģʽ - if(m_chkLuaAdvance.GetCheck() == BST_CHECKED) - { - pSocket_Info->m_blLuaAdvance = true; - - //򿪸߼ģʽȡļ - m_txtLuaFilePath.GetWindowText(strData); - - if(strData == "") - { - MessageBox(_T("Ѿ˸߼ģʽñҪLuaļ")); - delete pSocket_Info; - delete pSocket_State_Info; - return; - } - - nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); - nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSocket_Info->m_szLuaFileName, nBufferSize, NULL,NULL); - pSocket_Info->m_szLuaFileName[nDecLen] = '\0'; - } - else - { - pSocket_Info->m_blLuaAdvance = false; - } - - if(pSocket_Info->m_nConnectType == 0) - { - //TCP - CClientTcpSocket* pClientTcpSocket = new CClientTcpSocket(); - pClientTcpSocket->SetSocketThread(pSocket_Info, pSocket_State_Info); - pClientTcpSocket->SetThreadID(i); - - DWORD ThreadID = 0; - CreateThread(NULL, NULL, ThreadProc, (LPVOID)pClientTcpSocket, NULL, &ThreadID); - - m_vecClientTcpSocket.push_back(pClientTcpSocket); - } - else - { - //UDP - CClientUdpSocket* pClientUdpSocket = new CClientUdpSocket(); - pClientUdpSocket->SetSocketThread(pSocket_Info, pSocket_State_Info); - - DWORD ThreadID = 0; - CreateThread(NULL, NULL, ThreadUDPProc, (LPVOID)pClientUdpSocket, NULL, &ThreadID); - - m_vecClientUdpSocket.push_back(pClientUdpSocket); - } - - m_tmBegin = CTime::GetCurrentTime(); - m_blIsRun = true; - } + //停止压测 + int nCount = (int)m_vecClientUdpSocket.size(); + + for(int i = 0; i < nCount; i++) + { + CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; + + if(NULL != pClientUdpSocket) + { + pClientUdpSocket->Stop(); + } + } + + nCount = (int)m_vecClientTcpSocket.size(); + + for(int i = 0; i < nCount; i++) + { + CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; + + if(NULL != pClientTcpSocket) + { + pClientTcpSocket->Stop(); + } + } + + m_tmEnd = wxDateTime::Now (); + m_blIsRun = false; + } -void CPassTCPDlg::InitView() + + +void CPassTCPDlg::OnButton_ExportTestDataClick(wxCommandEvent& event) { - m_chkIsRecv.SetCheck(BST_CHECKED); - m_ChkIsBroken.SetCheck(BST_CHECKED); + //写入压测报告 + FILE* pFile = NULL; + char szFileName[20]; + sprintf(szFileName, "StressTest.log"); + pFile =fopen( szFileName, "a+"); - m_reSendText.SetOptions(ECOOP_XOR, ECO_WANTRETURN); + if(pFile == NULL) + { + wxMessageBox(wxT("导出压测报告失败,文件不存"), this->GetTitle(), wxOK | wxICON_INFORMATION, this); + return; + } - SetRichTextColor(COLOR_TEXT_BULE); + char szLogText[1024] = {'\0'}; - m_pLogic = NULL; + sprintf(szLogText, "=============================================\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - m_txtServerIP.SetWindowText(_T("127.0.0.1")); - m_txtPort.SetWindowText(_T("10002")); - m_txtThreadCount.SetWindowText(_T("1")); - m_txtRecvTimeout.SetWindowText(_T("1000")); - m_txtPacketTimewait.SetWindowText(_T("0")); - m_txtSocketInterval.SetWindowText(_T("0")); - m_txtRecvLength.SetWindowText(_T("12")); - m_reSendText.SetWindowText(_T("01 00 00 10 08 00 00 00 46 45 45 45 45 59 45 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 be cd aa 8f 3c 01 00 00")); - m_txtClientUdpPort.SetWindowText(_T("20002")); + //默认TCP类型,0是TCP,1是UDP - m_txtSendByteCount.SetWindowText(_T("0")); - m_txtRecvByteCount.SetWindowText(_T("0")); + switch(this->RadioBox_nRadio->GetSelection()) + { + case 0: + sprintf(szLogText, "压测类型:TCP\n"); + break; - m_txtSendCount.SetWindowText(_T("0")); - m_txtMinTime.SetWindowText(_T("0")); - m_txtMaxTime.SetWindowText(_T("0")); + case 1: + sprintf(szLogText, "压测类型:UDP\n"); + break; - m_nRadio = 1; + case 2: + sprintf(szLogText, "压测类型:WebSocket\n"); + break; + } - m_cbSendBuffStyle.InsertString(0, _T("ģʽ")); - m_cbSendBuffStyle.InsertString(1, _T("ıģʽ")); - m_cbSendBuffStyle.SetCurSel(0); - m_nCurrTextStyle = 0; + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - ClearResult(); - //ʼTCP - WSADATA wsaData; - int nErr = WSAStartup(MAKEWORD(2, 2), &wsaData); - if(nErr != 0) - { - MessageBox(_T("socketʧܣ鱾socket汾"), _T("Ϣ"), MB_OK); - } -} + std::string m_szSerevrIP =std::string(this->TextCtrl_ServerIP->GetValue()); + int m_nPort =wxAtoi(this->TextCtrl_ServerPort->GetValue()); -void CPassTCPDlg::ClearResult() -{ - m_txtSuccessConnect.SetWindowText(_T("0")); - m_txtSuccessSend.SetWindowText(_T("0")); - m_txtSuccessRecv.SetWindowText(_T("0")); - m_txtCurrConnect.SetWindowText(_T("0")); - m_txtFailConnect.SetWindowText(_T("0")); - m_txtFailSend.SetWindowText(_T("0")); - m_txtFailRecv.SetWindowText(_T("0")); - - m_txtSendByteCount.SetWindowText(_T("0")); - m_txtRecvByteCount.SetWindowText(_T("0")); -} + sprintf(szLogText, "压测IP:%s, 压测端口:%d.\n", m_szSerevrIP.c_str(), m_nPort); -void CPassTCPDlg::Close(bool blClose) -{ - int nCount = m_vecClientUdpSocket.size(); - for(int i = 0; i < nCount; i++) - { - CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; - if(NULL != pClientUdpSocket) - { - pClientUdpSocket->Stop(); - - DWORD dwSleep = 100; - Sleep(dwSleep); - - delete pClientUdpSocket; - pClientUdpSocket = NULL; - } - } - m_vecClientUdpSocket.clear(); - - nCount = m_vecClientTcpSocket.size(); - for(int i = 0; i < nCount; i++) - { - CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; - if(NULL != pClientTcpSocket) - { - pClientTcpSocket->Stop(); - - DWORD dwSleep = 100; - Sleep(dwSleep); - - delete pClientTcpSocket; - pClientTcpSocket = NULL; - } - } - - m_vecClientTcpSocket.clear(); - - if(blClose == true && m_pLogic != NULL) - { - if(m_pLogic->m_nClassTye == 1) - { - delete (CNomalLogic* )m_pLogic; - } - else - { - delete (CWebSocketLogic* )m_pLogic; - } - } -} -void CPassTCPDlg::OnClose() -{ - Close(true); - WSACleanup(); - CDialog::OnClose(); + //CString strBeginTime = m_tmBegin.Format("%Y-%m-%d %H:%M:%S"); + sprintf(szLogText, "压测开始时间为: %04d-%02d-%02d %02d:%02d:%02d\n", m_tmBegin.GetYear(), m_tmBegin.GetMonth(), m_tmBegin.GetDay(), m_tmBegin.GetHour(), m_tmBegin.GetMinute(), m_tmBegin.GetSecond()); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + if(m_blIsRun == true) + { + wxDateTime tmNow = wxDateTime::Now(); + + //CString strNowTime = tmNow.Format("%Y-%m-%d %H:%M:%S"); + sprintf(szLogText, "压测结束时间为: %04d-%02d-%02d %02d:%02d:%02d\n", tmNow.GetYear(), tmNow.GetMonth(), tmNow.GetDay(), tmNow.GetHour(), tmNow.GetMinute(), tmNow.GetSecond()); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + } + else + { + //CString strEndTime = m_tmEnd.Format("%Y-%m-%d %H:%M:%S"); + sprintf(szLogText, "压测结束时间为: %04d-%02d-%02d %02d:%02d:%02d\n", m_tmEnd.GetYear(), m_tmEnd.GetMonth(), m_tmEnd.GetDay(), m_tmEnd.GetHour(), m_tmEnd.GetMinute(), m_tmEnd.GetSecond()); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + } + + + int m_txtThreadCount = wxAtoi(this->TextCtrl_TestThreadCount->GetValue()); + int m_txtSuccessConnect = wxAtoi(this->TextCtrl_SuccessConnect->GetValue()); + int m_txtSuccessSend = wxAtoi(this->TextCtrl_SuccessSend->GetValue()); + int m_txtSuccessRecv = wxAtoi(this->TextCtrl_SuccessRecv->GetValue()); + int m_txtSendByteCount = wxAtoi(this->TextCtrl_SendByteCount->GetValue()); + int m_txtRecvByteCount = wxAtoi(this->TextCtrl_RecvByteCount->GetValue()); + int m_txtFailConnect =wxAtoi(this->TextCtrl_FailConnect->GetValue()); + int m_txtFailSend = wxAtoi(this->TextCtrl_FailSend->GetValue()); + int m_txtFailRecv = wxAtoi(this->TextCtrl_FailRecv->GetValue()); + int m_txtMinTime = wxAtoi(this->TextCtrl_MinTime->GetValue()); + int m_txtMaxTime = wxAtoi(this->TextCtrl_MaxTime->GetValue()); + + + sprintf(szLogText, "压测线程数:%d\n", m_txtThreadCount); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "创建成功连接数:%d\n",m_txtSuccessConnect); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "成功发送数据包数:%d\n", m_txtSuccessSend); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "成功接收数据包数:%d\n", m_txtSuccessRecv); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "发送字节数:%d\n", m_txtSendByteCount); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "接收字节数:%d\n", m_txtRecvByteCount); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + + sprintf(szLogText, "连接失败数:%d\n",m_txtFailConnect); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "发送失败数据包数:%d\n", m_txtFailSend); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "接收失败数据包数:%d\n", m_txtFailRecv); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "最小单包响应时间:%d毫秒\n", m_txtFailRecv); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "最大单包响应时间:%d毫秒\n", m_txtMaxTime); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + + //连接成功百分比 + float fRote = 0.0f; + int nSucccess = wxAtoi(this->TextCtrl_SuccessConnect->GetValue()); + int nFail = wxAtoi(this->TextCtrl_FailConnect->GetValue()); + + + if(nSucccess + nFail == 0) + { + fRote = 0.0f; + } + else + { + fRote = (float)nSucccess/(nSucccess + nFail); + } + + sprintf(szLogText, "连接成功百分比:%f%%\n", fRote*100.0); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + //发送成功百分比 + nSucccess = wxAtoi(this->TextCtrl_SuccessSend->GetValue()); + nFail = wxAtoi(this->TextCtrl_FailSend->GetValue()); + + if(nSucccess + nFail == 0) + { + fRote = 0.0f; + } + else + { + fRote = (float)nSucccess/(nSucccess + nFail); + } + + sprintf(szLogText, "发送数据包成功百分比:%f%%\n", fRote*100.0); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + //接收成功百分比 + nSucccess = wxAtoi(this->TextCtrl_SuccessRecv->GetValue()); + nFail = wxAtoi(this->TextCtrl_FailRecv->GetValue()); + + if(nSucccess + nFail == 0) + { + fRote = 0.0f; + } + else + { + fRote = (float)nSucccess/(nSucccess + nFail); + } + + sprintf(szLogText, "接收数据包成功百分比:%f%%\n", fRote*100.0); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf(szLogText, "=============================================\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + fclose(pFile); + + wxMessageBox(wxT("导出压测报告成功"), this->GetTitle(), wxOK | wxICON_INFORMATION, this); + } -void CPassTCPDlg::OnBnClickedButton2() +void CPassTCPDlg::OnButton_SetRadomPacketClick(wxCommandEvent& event) { - //ֹͣѹ - int nCount = (int)m_vecClientUdpSocket.size(); - for(int i = 0; i < nCount; i++) - { - CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; - if(NULL != pClientUdpSocket) - { - pClientUdpSocket->Stop(); - } - } - - nCount = (int)m_vecClientTcpSocket.size(); - for(int i = 0; i < nCount; i++) - { - CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; - if(NULL != pClientTcpSocket) - { - pClientTcpSocket->Stop(); - } - } - - m_tmEnd = CTime::GetCurrentTime(); - m_blIsRun = false; + //设置随机数据包序列 + CPacketDlg* objPacketDlg; + objPacketDlg =new CPacketDlg(this); + + + switch(this->RadioBox_nRadio->GetSelection ()) + { + case 0: + { + if(m_pLogic != NULL) + { + delete m_pLogic; + } + + CNomalLogic* pNomalLogic = new CNomalLogic(); + m_pLogic = (CBaseDataLogic* )pNomalLogic; + break; + } + + case 1: + { + if(m_pLogic != NULL) + { + delete m_pLogic; + } + + CNomalLogic* pNomalLogic = new CNomalLogic(); + m_pLogic = (CBaseDataLogic* )pNomalLogic; + break; + } + + case 2: + { + if(m_pLogic != NULL) + { + delete m_pLogic; + } + + CWebSocketLogic* pWebSocketLogic = new CWebSocketLogic(); + m_pLogic = (CBaseDataLogic* )pWebSocketLogic; + break; + } + } + + objPacketDlg->SetBaseDataLogic(m_pLogic); + + objPacketDlg->ShowModal(); + + } -void CPassTCPDlg::OnTimer(UINT_PTR nIDEvent) + + + + + + + + +void CPassTCPDlg::ClearResult() { - if(nIDEvent == 1) - { - int nSuccessConnect = 0; - int nSuccessSend = 0; - int nSuccessRecv = 0; - int ntCurrConnect = 0; - int nFailConnect = 0; - int nFailSend = 0; - int nFailRecv = 0; - int nCurrConnect = 0; - int nSendByteCount = 0; - int nRecvByteCount = 0; - int nMinTime = 0; - int nMaxTime = 0; - - int nConnectType = 0; - switch(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3)) - { - case IDC_RADIO1: - nConnectType = 0; - break; - case IDC_RADIO2: - nConnectType = 1; - break; - case IDC_RADIO3: - nConnectType = 0; - break; - } - - if(nConnectType == 0) - { - for(int i = 0; i < (int)m_vecClientTcpSocket.size(); i++) - { - CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; - if(NULL != pClientTcpSocket) - { - _Socket_State_Info* pSocket_State_Info = pClientTcpSocket->GetStateInfo(); - if(NULL != pSocket_State_Info) - { - nSuccessConnect += pSocket_State_Info->m_nSuccessConnect; - nSuccessSend += pSocket_State_Info->m_nSuccessSend; - nSuccessRecv += pSocket_State_Info->m_nSuccessRecv; - nFailConnect += pSocket_State_Info->m_nFailConnect; - nFailSend += pSocket_State_Info->m_nFailSend; - nFailRecv += pSocket_State_Info->m_nFailRecv; - nCurrConnect += pSocket_State_Info->m_nCurrectSocket; - nSendByteCount += pSocket_State_Info->m_nSendByteCount; - nRecvByteCount += pSocket_State_Info->m_nRecvByteCount; - - if(i == 0) - { - nMinTime = pSocket_State_Info->m_nMinRecvTime; - nMaxTime = pSocket_State_Info->m_nMaxRecvTime; - } - else - { - if(nMinTime > pSocket_State_Info->m_nMinRecvTime) - { - nMinTime = pSocket_State_Info->m_nMinRecvTime; - } - - if(nMaxTime < pSocket_State_Info->m_nMaxRecvTime) - { - nMaxTime = pSocket_State_Info->m_nMaxRecvTime; - } - } - } - } - } - - //ʾ - CString strData; - strData.Format(_T("%d"), nSuccessConnect); - m_txtSuccessConnect.SetWindowText(strData); - strData.Format(_T("%d"), nSuccessSend); - m_txtSuccessSend.SetWindowText(strData); - strData.Format(_T("%d"), nSuccessRecv); - m_txtSuccessRecv.SetWindowText(strData); - strData.Format(_T("%d"), nFailConnect); - m_txtFailConnect.SetWindowText(strData); - strData.Format(_T("%d"), nFailSend); - m_txtFailSend.SetWindowText(strData); - strData.Format(_T("%d"), nFailRecv); - m_txtFailRecv.SetWindowText(strData); - strData.Format(_T("%d"), nCurrConnect); - m_txtCurrConnect.SetWindowText(strData); - strData.Format(_T("%d"), nSendByteCount); - m_txtSendByteCount.SetWindowText(strData); - strData.Format(_T("%d"), nRecvByteCount); - m_txtRecvByteCount.SetWindowText(strData); - strData.Format(_T("%d"), nMinTime); - m_txtMinTime.SetWindowText(strData); - strData.Format(_T("%d"), nMaxTime); - m_txtMaxTime.SetWindowText(strData); - } - else - { - for(int i = 0; i < (int)m_vecClientUdpSocket.size(); i++) - { - CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; - if(NULL != pClientUdpSocket) - { - _Socket_State_Info* pSocket_State_Info = pClientUdpSocket->GetStateInfo(); - if(NULL != pSocket_State_Info) - { - nSuccessConnect += pSocket_State_Info->m_nSuccessConnect; - nSuccessSend += pSocket_State_Info->m_nSuccessSend; - nSuccessRecv += pSocket_State_Info->m_nSuccessRecv; - nFailConnect += pSocket_State_Info->m_nFailConnect; - nFailSend += pSocket_State_Info->m_nFailSend; - nFailRecv += pSocket_State_Info->m_nFailRecv; - nCurrConnect += pSocket_State_Info->m_nCurrectSocket; - } - - if(i == 0) - { - nMinTime = pSocket_State_Info->m_nMinRecvTime; - nMaxTime = pSocket_State_Info->m_nMaxRecvTime; - } - else - { - if(nMinTime > pSocket_State_Info->m_nMinRecvTime) - { - nMinTime = pSocket_State_Info->m_nMinRecvTime; - } - - if(nMaxTime < pSocket_State_Info->m_nMaxRecvTime) - { - nMaxTime = pSocket_State_Info->m_nMaxRecvTime; - } - } - } - } - - //ʾ - CString strData; - strData.Format(_T("%d"), nSuccessConnect); - m_txtSuccessConnect.SetWindowText(strData); - strData.Format(_T("%d"), nSuccessSend); - m_txtSuccessSend.SetWindowText(strData); - strData.Format(_T("%d"), nSuccessRecv); - m_txtSuccessRecv.SetWindowText(strData); - strData.Format(_T("%d"), nFailConnect); - m_txtFailConnect.SetWindowText(strData); - strData.Format(_T("%d"), nFailSend); - m_txtFailSend.SetWindowText(strData); - strData.Format(_T("%d"), nFailRecv); - m_txtFailRecv.SetWindowText(strData); - strData.Format(_T("%d"), nCurrConnect); - m_txtCurrConnect.SetWindowText(strData); - strData.Format(_T("%d"), nMinTime); - m_txtMinTime.SetWindowText(strData); - strData.Format(_T("%d"), nMaxTime); - m_txtMaxTime.SetWindowText(strData); - } - } - - CDialog::OnTimer(nIDEvent); + + this->TextCtrl_SuccessConnect->SetValue(wxT("0")); + this->TextCtrl_SuccessSend->SetValue(wxT("0")); + this->TextCtrl_SuccessRecv->SetValue(wxT("0")); + this->TextCtrl_CurrConnect->SetValue(wxT("0")); + this->TextCtrl_FailConnect->SetValue(wxT("0")); + this->TextCtrl_FailRecv->SetValue(wxT("0")); + this->TextCtrl_FailSend->SetValue(wxT("0")); + this->TextCtrl_FailConnect->SetValue(wxT("0")); + this->TextCtrl_SendByteCount->SetValue(wxT("0")); + this->TextCtrl_RecvByteCount->SetValue(wxT("0")); + } -void CPassTCPDlg::OnBnClickedButton3() + + + +void CPassTCPDlg::OnClose(wxCloseEvent& event) { - //дѹⱨ - FILE* pFile = NULL; - char szFileName[20]; - sprintf_s(szFileName, "StressTest.log"); - fopen_s(&pFile, szFileName, "a+"); - if(pFile == NULL) - { - MessageBox(_T("ѹⱨʧܣļ"), _T("ʾϢ"), MB_OK); - return; - } - - char szLogText[1024] = {'\0'}; - - sprintf_s(szLogText, 1024, "=============================================\n"); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - //ĬTCPͣ0TCP1UDP - switch(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3)) - { - case IDC_RADIO1: - sprintf_s(szLogText, 1024, "ѹ:TCP\n"); - break; - case IDC_RADIO2: - sprintf_s(szLogText, 1024, "ѹ:UDP\n"); - break; - case IDC_RADIO3: - sprintf_s(szLogText, 1024, "ѹ:WebSocket\n"); - break; - } - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - CString strData; - CString strDataPort; - m_txtServerIP.GetWindowText(strData); - - char szServerIP[MAX_BUFF_20] = {'\0'}; - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szServerIP, MAX_BUFF_20, NULL,NULL); - szServerIP[nDecLen] = '\0'; - - m_txtPort.GetWindowText(strDataPort); - sprintf_s(szLogText, 1024, "ѹIP:%s, ѹ˿:%d.\n", szServerIP, _ttoi((LPCTSTR)strDataPort)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - //CString strBeginTime = m_tmBegin.Format("%Y-%m-%d %H:%M:%S"); - sprintf_s(szLogText, 1024, "ѹ⿪ʼʱΪ: %04d-%02d-%02d %02d:%02d:%02d\n", m_tmBegin.GetYear(), m_tmBegin.GetMonth(), m_tmBegin.GetDay(), m_tmBegin.GetHour(), m_tmBegin.GetMinute(), m_tmBegin.GetSecond()); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - if(m_blIsRun == true) - { - CTime tmNow = CTime::GetCurrentTime(); - - //CString strNowTime = tmNow.Format("%Y-%m-%d %H:%M:%S"); - sprintf_s(szLogText, 1024, "ѹʱΪ: %04d-%02d-%02d %02d:%02d:%02d\n", tmNow.GetYear(), tmNow.GetMonth(), tmNow.GetDay(), tmNow.GetHour(), tmNow.GetMinute(), tmNow.GetSecond()); - - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - } - else - { - //CString strEndTime = m_tmEnd.Format("%Y-%m-%d %H:%M:%S"); - sprintf_s(szLogText, 1024, "ѹʱΪ: %04d-%02d-%02d %02d:%02d:%02d\n", m_tmEnd.GetYear(), m_tmEnd.GetMonth(), m_tmEnd.GetDay(), m_tmEnd.GetHour(), m_tmEnd.GetMinute(), m_tmEnd.GetSecond()); - - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - } - - - m_txtThreadCount.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ѹ߳:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtSuccessConnect.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ɹ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtSuccessSend.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ɹݰ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtSuccessRecv.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ɹݰ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtSendByteCount.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ֽ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtRecvByteCount.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ֽ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtFailConnect.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ʧ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtFailSend.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ʧݰ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtFailRecv.GetWindowText(strData); - sprintf_s(szLogText, 1024, "ʧݰ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtMinTime.GetWindowText(strData); - sprintf_s(szLogText, 1024, "СӦʱ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - m_txtMaxTime.GetWindowText(strData); - sprintf_s(szLogText, 1024, "󵥰Ӧʱ:%d\n", _ttoi((LPCTSTR)strData)); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - //ӳɹٷֱ - float fRote = 0.0f; - m_txtSuccessConnect.GetWindowText(strData); - int nSucccess = _ttoi((LPCTSTR)strData); - m_txtFailConnect.GetWindowText(strData); - int nFail = _ttoi((LPCTSTR)strData); - if(nSucccess + nFail == 0) - { - fRote = 0.0f; - } - else - { - fRote = (float)nSucccess/(nSucccess + nFail); - } - - sprintf_s(szLogText, 1024, "ӳɹٷֱ:%f%%\n", fRote*100.0); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - //ͳɹٷֱ - m_txtSuccessSend.GetWindowText(strData); - nSucccess = _ttoi((LPCTSTR)strData); - m_txtFailSend.GetWindowText(strData); - nFail = _ttoi((LPCTSTR)strData); - if(nSucccess + nFail == 0) - { - fRote = 0.0f; - } - else - { - fRote = (float)nSucccess/(nSucccess + nFail); - } - sprintf_s(szLogText, 1024, "ݰɹٷֱ:%f%%\n", fRote*100.0); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - //ճɹٷֱ - m_txtSuccessRecv.GetWindowText(strData); - nSucccess = _ttoi((LPCTSTR)strData); - m_txtFailRecv.GetWindowText(strData); - nFail = _ttoi((LPCTSTR)strData); - if(nSucccess + nFail == 0) - { - fRote = 0.0f; - } - else - { - fRote = (float)nSucccess/(nSucccess + nFail); - } - sprintf_s(szLogText, 1024, "ݰɹٷֱ:%f%%\n", fRote*100.0); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - sprintf_s(szLogText, 1024, "=============================================\n"); - fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); - - fclose(pFile); - - MessageBox(_T("ѹⱨɹ"), _T("ʾϢ"), MB_OK); + int nCount = m_vecClientUdpSocket.size(); + + for(int i = 0; i < nCount; i++) + { + CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; + + if(NULL != pClientUdpSocket) + { + pClientUdpSocket->Stop(); + + int dwSleep = 100; + //Sleep(dwSleep); + std::this_thread::sleep_for(std::chrono::milliseconds(dwSleep*1000)); + + + delete pClientUdpSocket; + pClientUdpSocket = NULL; + } + } + + m_vecClientUdpSocket.clear(); + + nCount = m_vecClientTcpSocket.size(); + + for(int i = 0; i < nCount; i++) + { + CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; + + if(NULL != pClientTcpSocket) + { + pClientTcpSocket->Stop(); + + + int dwSleep = 100; + //Sleep(dwSleep); + std::this_thread::sleep_for(std::chrono::milliseconds(dwSleep*1000)); + + delete pClientTcpSocket; + pClientTcpSocket = NULL; + } + } + + m_vecClientTcpSocket.clear(); + + if( m_pLogic != NULL) + { + if(m_pLogic->m_nClassTye == 1) + { + delete (CNomalLogic* )m_pLogic; + } + else + { + delete (CWebSocketLogic* )m_pLogic; + } + } + + this->Destroy(); } -void CPassTCPDlg::OnCbnSelchangeCombo1() +void CPassTCPDlg::OnTimer_TestTrigger(wxTimerEvent& event) { - //ıģʽûѡ仯ı - int nCurrTextStyle = m_cbSendBuffStyle.GetCurSel(); - if(nCurrTextStyle != m_nCurrTextStyle) - { - if(nCurrTextStyle == 0) //ıתΪ - { - //ıʱ仯 - CString strData; - m_reSendText.GetWindowText(strData); - - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); - char* pSendData = new char[nBufferSize + 1]; - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSendData, nBufferSize, NULL,NULL); - pSendData[nDecLen] = '\0'; - - if(nDecLen <= 0) - { - //ûݾͲת - m_nCurrTextStyle = nCurrTextStyle; - SetRichTextColor(COLOR_TEXT_BULE); - return; - } - - //תַ - int nConvertSize = (nBufferSize + 1)*4; - char* pErSendBuff = new char[nConvertSize]; - memset(pErSendBuff, 0, nConvertSize); - - for(int i = 0; i < nDecLen; i++) - { - char szLog[4] = {'\0'}; - if( i != nDecLen - 1) - { - sprintf_s(szLog, 4, "%02X ", (unsigned char)pSendData[i]); - } - else - { - sprintf_s(szLog, 4, "%02X", (unsigned char)pSendData[i]); - } - - if(i == 0) - { - sprintf_s(pErSendBuff, nConvertSize, "%s%s", pErSendBuff, szLog); - } - else - { - sprintf_s(pErSendBuff, nConvertSize, "%s %s", pErSendBuff, szLog); - } - } - - //תĶƣʾı - wchar_t *pwText = new wchar_t[nConvertSize]; - - nSrcLen = MultiByteToWideChar (CP_ACP, 0, pErSendBuff, -1, NULL, 0); - nBufferSize = MultiByteToWideChar (CP_ACP, 0, pErSendBuff, -1, pwText, nSrcLen); - pwText[nBufferSize] = '\0'; - - m_reSendText.SetWindowText(pwText); - - delete[] pwText; - delete[] pSendData; - delete[] pErSendBuff; - - SetRichTextColor(COLOR_TEXT_BULE); - } - else - { - //תı - CString strData; - m_reSendText.GetWindowText(strData); - - int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); - int nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); - char* pSendData = new char[nBufferSize + 1]; - int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSendData, nBufferSize, NULL,NULL); - pSendData[nDecLen] = '\0'; - - if(nDecLen <= 0) - { - //ûݾͲת - m_nCurrTextStyle = nCurrTextStyle; - SetRichTextColor(COLOR_TEXT_RED); - return; - } - - int nTextSize = 0; - if(nDecLen % 3 != 0) - { - nTextSize = nDecLen / 3 + 2; - } - else - { - nTextSize = nDecLen / 3 + 1; - } - - char* pTextData = new char[nTextSize]; - memset(pTextData, 0, nTextSize); - - CConvertBuffer objConvertBuffer; - //ݴתɶƴ - objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), (unsigned char*)pTextData, nTextSize); - - //תĶƣʾı - wchar_t *pwText = new wchar_t[nTextSize + 2]; - - nSrcLen = MultiByteToWideChar (CP_ACP, 0, pTextData, -1, NULL, 0); - nBufferSize = MultiByteToWideChar (CP_ACP, 0, pTextData, -1, pwText, nSrcLen); - pwText[nBufferSize] = '\0'; - - m_reSendText.SetWindowText(pwText); - - delete[] pwText; - delete[] pSendData; - delete[] pTextData; - - SetRichTextColor(COLOR_TEXT_RED); - } - - m_nCurrTextStyle = nCurrTextStyle; - - } + //if(nIDEvent == 1) + { + int nSuccessConnect = 0; + int nSuccessSend = 0; + int nSuccessRecv = 0; + int ntCurrConnect = 0; + int nFailConnect = 0; + int nFailSend = 0; + int nFailRecv = 0; + int nCurrConnect = 0; + int nSendByteCount = 0; + int nRecvByteCount = 0; + int nMinTime = 0; + int nMaxTime = 0; + + int nConnectType = 0; + + switch(this->RadioBox_nRadio->GetSelection ()) + { + case 0: + nConnectType = 0; + break; + + case 1: + nConnectType = 1; + break; + + case 2: + nConnectType = 0; + break; + } + + if(nConnectType == 0) + { + for(int i = 0; i < (int)m_vecClientTcpSocket.size(); i++) + { + CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; + + if(NULL != pClientTcpSocket) + { + _Socket_State_Info* pSocket_State_Info = pClientTcpSocket->GetStateInfo(); + + if(NULL != pSocket_State_Info) + { + nSuccessConnect += pSocket_State_Info->m_nSuccessConnect; + nSuccessSend += pSocket_State_Info->m_nSuccessSend; + nSuccessRecv += pSocket_State_Info->m_nSuccessRecv; + nFailConnect += pSocket_State_Info->m_nFailConnect; + nFailSend += pSocket_State_Info->m_nFailSend; + nFailRecv += pSocket_State_Info->m_nFailRecv; + nCurrConnect += pSocket_State_Info->m_nCurrectSocket; + nSendByteCount += pSocket_State_Info->m_nSendByteCount; + nRecvByteCount += pSocket_State_Info->m_nRecvByteCount; + + if(i == 0) + { + nMinTime = pSocket_State_Info->m_nMinRecvTime; + nMaxTime = pSocket_State_Info->m_nMaxRecvTime; + } + else + { + if(nMinTime > pSocket_State_Info->m_nMinRecvTime) + { + nMinTime = pSocket_State_Info->m_nMinRecvTime; + } + + if(nMaxTime < pSocket_State_Info->m_nMaxRecvTime) + { + nMaxTime = pSocket_State_Info->m_nMaxRecvTime; + } + } + } + } + } + + //显示相关数据 + + this->TextCtrl_SuccessConnect->SetValue( wxString::Format(wxT("%i"),nSuccessConnect)); + this->TextCtrl_SuccessSend->SetValue( wxString::Format(wxT("%i"),nSuccessSend)); + this->TextCtrl_SuccessRecv->SetValue( wxString::Format(wxT("%i"),nSuccessRecv)); + this->TextCtrl_CurrConnect->SetValue( wxString::Format(wxT("%i"),ntCurrConnect)); + this->TextCtrl_FailConnect->SetValue( wxString::Format(wxT("%i"),nFailConnect)); + this->TextCtrl_FailRecv->SetValue( wxString::Format(wxT("%i"),nFailRecv)); + this->TextCtrl_FailSend->SetValue( wxString::Format(wxT("%i"),nFailSend)); + this->TextCtrl_SendByteCount->SetValue( wxString::Format(wxT("%i"),nSendByteCount)); + this->TextCtrl_RecvByteCount->SetValue( wxString::Format(wxT("%i"),nRecvByteCount)); + + this->TextCtrl_MinTime->SetValue( wxString::Format(wxT("%i"),nMinTime)); + this->TextCtrl_MaxTime->SetValue( wxString::Format(wxT("%i"),nMaxTime)); + + } + else + { + for(int i = 0; i < (int)m_vecClientUdpSocket.size(); i++) + { + CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; + + if(NULL != pClientUdpSocket) + { + _Socket_State_Info* pSocket_State_Info = pClientUdpSocket->GetStateInfo(); + + if(NULL != pSocket_State_Info) + { + nSuccessConnect += pSocket_State_Info->m_nSuccessConnect; + nSuccessSend += pSocket_State_Info->m_nSuccessSend; + nSuccessRecv += pSocket_State_Info->m_nSuccessRecv; + nFailConnect += pSocket_State_Info->m_nFailConnect; + nFailSend += pSocket_State_Info->m_nFailSend; + nFailRecv += pSocket_State_Info->m_nFailRecv; + nCurrConnect += pSocket_State_Info->m_nCurrectSocket; + } + + if(i == 0) + { + nMinTime = pSocket_State_Info->m_nMinRecvTime; + nMaxTime = pSocket_State_Info->m_nMaxRecvTime; + } + else + { + if(nMinTime > pSocket_State_Info->m_nMinRecvTime) + { + nMinTime = pSocket_State_Info->m_nMinRecvTime; + } + + if(nMaxTime < pSocket_State_Info->m_nMaxRecvTime) + { + nMaxTime = pSocket_State_Info->m_nMaxRecvTime; + } + } + } + } + + //显示相关数据 + + this->TextCtrl_SuccessConnect->SetValue( wxString::Format(wxT("%i"),nSuccessConnect)); + this->TextCtrl_SuccessSend->SetValue( wxString::Format(wxT("%i"),nSuccessSend)); + this->TextCtrl_SuccessRecv->SetValue( wxString::Format(wxT("%i"),nSuccessRecv)); + this->TextCtrl_CurrConnect->SetValue( wxString::Format(wxT("%i"),ntCurrConnect)); + this->TextCtrl_FailConnect->SetValue( wxString::Format(wxT("%i"),nFailConnect)); + this->TextCtrl_FailRecv->SetValue( wxString::Format(wxT("%i"),nFailRecv)); + this->TextCtrl_FailSend->SetValue( wxString::Format(wxT("%i"),nFailSend)); + + this->TextCtrl_MinTime->SetValue( wxString::Format(wxT("%i"),nMinTime)); + this->TextCtrl_MaxTime->SetValue( wxString::Format(wxT("%i"),nMaxTime)); + + + } + } + + //event.Skip(); + + + } -void CPassTCPDlg::SetRichTextColor(int nColor) +void CPassTCPDlg::OnChoice_SendBuffStyleSelect(wxCommandEvent& event) { - ::CHARFORMAT2 cf; - memset(&cf, 0x00, sizeof(cf)); - cf.cbSize = sizeof(cf); - if(nColor == COLOR_TEXT_BULE) - { - cf.crTextColor = RGB(0, 0, 255); - } - else if(nColor == COLOR_TEXT_RED) - { - cf.crTextColor = RGB(255, 0, 0); - } - cf.dwMask = CFM_COLOR; - - m_reSendText.SetDefaultCharFormat(cf);//ַ + //文本编制模式,根据用户的选项,变化文本的内容 + + int nCurrTextStyle = this->Choice_SendBuffStyle->GetSelection(); + + if(nCurrTextStyle != m_nCurrTextStyle) + { + if(nCurrTextStyle == 0) //讲文本转化为二进制 + { + //当风格发生改变的时候变化 + + std::string m_reSendText =std::string(this->TextCtrl_SendText->GetValue()); + ///m_txtPacketData.GetWindowText(strData); + int nSrcLen = m_reSendText.length(); + int nBufferSize = nSrcLen; + int nDecLen = nSrcLen ; + + char* pSendData = new char[nBufferSize + 1]; + strncpy(pSendData, (const char*)m_reSendText.c_str(), nBufferSize); + pSendData[nBufferSize] = '\0'; + + + if(nDecLen <= 0) + { + //如果没有内容就不转换 + m_nCurrTextStyle = nCurrTextStyle; + //SetRichTextColor(COLOR_TEXT_BULE); + return; + } + + //转化后的字符串 + int nConvertSize = (nBufferSize + 1)*4; + char* pErSendBuff = new char[nConvertSize]; + memset(pErSendBuff, 0, nConvertSize); + + for(int i = 0; i < nDecLen; i++) + { + char szLog[4] = {'\0'}; + + if( i != nDecLen - 1) + { + sprintf(szLog, "%02X ", (unsigned char)pSendData[i]); + } + else + { + sprintf(szLog, "%02X", (unsigned char)pSendData[i]); + } + + if(i == 0) + { + sprintf(pErSendBuff, "%s%s", pErSendBuff, szLog); + } + else + { + sprintf(pErSendBuff, "%s %s", pErSendBuff, szLog); + } + } + + //将转换后的二进制,显示在文本框内 + // wchar_t *pwText = new wchar_t[nConvertSize]; + // + // nSrcLen = MultiByteToWideChar (CP_ACP, 0, pErSendBuff, -1, NULL, 0); + // nBufferSize = MultiByteToWideChar (CP_ACP, 0, pErSendBuff, -1, pwText, nSrcLen); + // pwText[nBufferSize] = '\0'; + // + // m_reSendText.SetWindowText(pwText); + // + + this->TextCtrl_SendText->SetValue(wxString(pErSendBuff )); + + + + delete[] pSendData; + delete[] pErSendBuff; + + //SetRichTextColor(COLOR_TEXT_BULE); + } + else + { + //将二进制转化成文本 + + std::string m_reSendText =std::string(this->TextCtrl_SendText->GetValue()); + ///m_txtPacketData.GetWindowText(strData); + int nSrcLen = m_reSendText.length(); + int nBufferSize = nSrcLen; + + char* pSendData = new char[nBufferSize + 1]; + strncpy(pSendData, (const char*)m_reSendText.c_str(), nBufferSize); + pSendData[nBufferSize] = '\0'; + + int nDecLen = nSrcLen ; + + if(nDecLen <= 0) + { + //如果没有内容就不转换 + m_nCurrTextStyle = nCurrTextStyle; + //SetRichTextColor(COLOR_TEXT_RED); + return; + } + + int nTextSize = 0; + + if(nDecLen % 3 != 0) + { + nTextSize = nDecLen / 3 + 2; + } + else + { + nTextSize = nDecLen / 3 + 1; + } + + char* pTextData = new char[nTextSize]; + memset(pTextData, 0, nTextSize); + + CConvertBuffer objConvertBuffer; + //将数据串转换成二进制串 + objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), (unsigned char*)pTextData, nTextSize); + + //将转换后的二进制,显示在文本框内 + + this->TextCtrl_SendText->SetValue(wxString(pTextData )); + + + delete[] pSendData; + delete[] pTextData; + + //SetRichTextColor(COLOR_TEXT_RED); + } + + m_nCurrTextStyle = nCurrTextStyle; + + } + + } -void CPassTCPDlg::OnBnClickedButton4() +void CPassTCPDlg::OnButton1Click(wxCommandEvent& event) { - //Luaļ - //жϸ߼ѡǷѾ - if(m_chkLuaAdvance.GetCheck() != BST_CHECKED) - { - MessageBox(_T("ѡø߼ģʽء"), _T("ʾϢ"), MB_OK); - return; - } - - //򿪵ǰ· - TCHAR szBuffer[2048] = {'\0'}; - GetCurrentDirectory(2048, szBuffer); - - CFileDialog dlgFile(TRUE, _T( "*lua" ), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, _T("Luaļ(*.lua)|*.lua|")); - dlgFile.m_ofn.lpstrInitialDir = szBuffer; - - if (dlgFile.DoModal() == IDOK) - { - CString strLuaFile = dlgFile.GetPathName(); - m_txtLuaFilePath.SetWindowText(strLuaFile); - } } -void CPassTCPDlg::OnBnClickedButton5() +void CPassTCPDlg::OnTextCtrl_ServerIPText(wxCommandEvent& event) { - //ݰ - CPacketDlg objPacketDlg; - - switch(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3)) - { - case IDC_RADIO1: - { - if(m_pLogic != NULL) - { - delete m_pLogic; - } - - CNomalLogic* pNomalLogic = new CNomalLogic(); - m_pLogic = (CBaseDataLogic* )pNomalLogic; - break; - } - case IDC_RADIO2: - { - if(m_pLogic != NULL) - { - delete m_pLogic; - } - - CNomalLogic* pNomalLogic = new CNomalLogic(); - m_pLogic = (CBaseDataLogic* )pNomalLogic; - break; - } - case IDC_RADIO3: - { - if(m_pLogic != NULL) - { - delete m_pLogic; - } - - CWebSocketLogic* pWebSocketLogic = new CWebSocketLogic(); - m_pLogic = (CBaseDataLogic* )pWebSocketLogic; - break; - } - } - - objPacketDlg.SetBaseDataLogic(m_pLogic); - - objPacketDlg.DoModal(); } diff --git a/TestNetworkTool/PassTCP/PassTCPDlg.h b/TestNetworkTool/PassTCP/PassTCPDlg.h index 4745bd03e..52cd9f9b6 100644 --- a/TestNetworkTool/PassTCP/PassTCPDlg.h +++ b/TestNetworkTool/PassTCP/PassTCPDlg.h @@ -1,106 +1,218 @@ +/*************************************************************** + * Name: PassTCPDlg.h + * Purpose: Defines Application Frame + * Author: Smith () + * Created: 2019-02-17 + * Copyright: Smith () + * License: + **************************************************************/ + +#ifndef CPASSTCPDLG_H +#define CPASSTCPDLG_H + +//(*Headers(CPassTCPDlg) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//*) + -// PassTCPDlg.h : ͷļ -// -#pragma once -#include "afxcmn.h" #include "ClientTcpSocket.h" #include "ClientUdpSocket.h" -#include "afxwin.h" -#include -#include "PacketDlg.h" using namespace std; typedef vector vecClientTcpSocket; typedef vector vecClientUdpSocket; -#define COLOR_TEXT_BULE 1 -#define COLOR_TEXT_RED 2 -// CPassTCPDlg Ի -class CPassTCPDlg : public CDialog + +class CPassTCPDlg: public wxFrame { -// public: - CPassTCPDlg(CWnd* pParent = NULL); // ׼캯 - -// Ի - enum { IDD = IDD_PASSTCP_DIALOG }; - protected: - virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ + CPassTCPDlg(wxWindow* parent,wxWindowID id = -1); + virtual ~CPassTCPDlg(); +private: -// ʵ -protected: - HICON m_hIcon; + //(*Handlers(CPassTCPDlg) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnButton_LuaAdvanceClick(wxCommandEvent& event); + void OnButton_StatTestClick(wxCommandEvent& event); + void OnButton_StopTestClick(wxCommandEvent& event); + void OnButton_ExportTestDataClick(wxCommandEvent& event); + void OnButton_SetRadomPacketClick(wxCommandEvent& event); + void OnClose(wxCloseEvent& event); + void OnTimer_TestTrigger(wxTimerEvent& event); + void OnChoice_SendBuffStyleSelect(wxCommandEvent& event); + void OnButton1Click(wxCommandEvent& event); + void OnTextCtrl_ServerIPText(wxCommandEvent& event); + //*) + + //(*Identifiers(CPassTCPDlg) + static const long ID_STATICBOX1; + static const long ID_STATICTEXT1; + static const long ID_STATICTEXT2; + static const long ID_STATICBOX2; + static const long ID_STATICTEXT3; + static const long ID_STATICTEXT4; + static const long ID_STATICTEXT5; + static const long ID_STATICBOX3; + static const long ID_STATICTEXT6; + static const long ID_TEXTCTRL1; + static const long ID_CHECKBOX1; + static const long ID_BUTTON_LuaAdvance; + static const long ID_BUTTON_StatTest; + static const long ID_BUTTON_StopTest; + static const long ID_BUTTON_ExportTestData; + static const long ID_BUTTON_SetRadomPacket; + static const long ID_TEXTCTRL2; + static const long ID_TEXTCTRL3; + static const long ID_TEXTCTRL4; + static const long ID_TEXTCTRL5; + static const long ID_TEXTCTRL6; + static const long ID_STATICTEXT7; + static const long ID_STATICTEXT8; + static const long ID_STATICTEXT9; + static const long ID_STATICTEXT10; + static const long ID_TEXTCTRL7; + static const long ID_TEXTCTRL8; + static const long ID_TEXTCTRL9; + static const long ID_TEXTCTRL10; + static const long ID_CHECKBOX2; + static const long ID_CHECKBOX3; + static const long ID_CHECKBOX4; + static const long ID_CHECKBOX5; + static const long ID_CHECKBOX6; + static const long ID_CHECKBOX7; + static const long ID_CHECKBOX8; + static const long ID_RADIOBOX1; + static const long ID_STATICTEXT11; + static const long ID_STATICTEXT12; + static const long ID_STATICTEXT13; + static const long ID_STATICTEXT14; + static const long ID_STATICTEXT15; + static const long ID_STATICTEXT16; + static const long ID_TEXTCTRL11; + static const long ID_TEXTCTRL12; + static const long ID_TEXTCTRL13; + static const long ID_TEXTCTRL14; + static const long ID_TEXTCTRL15; + static const long ID_TEXTCTRL16; + static const long ID_STATICTEXT17; + static const long ID_STATICTEXT18; + static const long ID_STATICTEXT19; + static const long ID_TEXTCTRL17; + static const long ID_TEXTCTRL18; + static const long ID_TEXTCTRL19; + static const long ID_STATICTEXT20; + static const long ID_TEXTCTRL20; + static const long ID_STATICTEXT21; + static const long ID_TEXTCTRL21; + static const long ID_STATICTEXT22; + static const long ID_CHOICE1; + static const long ID_TEXTCTRL22; + static const long ID_PANEL1; + static const long ID_TIMER_Test; + //*) + + //(*Declarations(CPassTCPDlg) + wxButton* Button_ExportTestData; + wxButton* Button_LuaAdvance; + wxButton* Button_SetRadomPacket; + wxButton* Button_StatTest; + wxButton* Button_StopTest; + wxCheckBox* CheckBoxIsWriteLog; + wxCheckBox* CheckBoxLuaAdvance; + wxCheckBox* CheckBox_IsAlwayConnect; + wxCheckBox* CheckBox_IsBroken; + wxCheckBox* CheckBox_IsRecv; + wxCheckBox* CheckBox_RadomSendCount; + wxCheckBox* CheckBox_RadomaDelay; + wxCheckBox* CheckBox_SendOne; + wxChoice* Choice_SendBuffStyle; + wxDirDialog* DirDialog_Lua; + wxPanel* Panel1; + wxRadioBox* RadioBox_nRadio; + wxStaticBox* StaticBox1; + wxStaticBox* StaticBox2; + wxStaticBox* StaticBox3; + wxStaticText* StaticText10; + wxStaticText* StaticText11; + wxStaticText* StaticText12; + wxStaticText* StaticText13; + wxStaticText* StaticText14; + wxStaticText* StaticText15; + wxStaticText* StaticText16; + wxStaticText* StaticText17; + wxStaticText* StaticText18; + wxStaticText* StaticText19; + wxStaticText* StaticText1; + wxStaticText* StaticText20; + wxStaticText* StaticText21; + wxStaticText* StaticText22; + wxStaticText* StaticText2; + wxStaticText* StaticText3; + wxStaticText* StaticText4; + wxStaticText* StaticText5; + wxStaticText* StaticText6; + wxStaticText* StaticText7; + wxStaticText* StaticText8; + wxStaticText* StaticText9; + wxTextCtrl* TextCtrl_ClientUdpPort; + wxTextCtrl* TextCtrl_CurrConnect; + wxTextCtrl* TextCtrl_FailConnect; + wxTextCtrl* TextCtrl_FailRecv; + wxTextCtrl* TextCtrl_FailSend; + wxTextCtrl* TextCtrl_LuaControlFilePath; + wxTextCtrl* TextCtrl_MaxTime; + wxTextCtrl* TextCtrl_MinTime; + wxTextCtrl* TextCtrl_PacketSendMax; + wxTextCtrl* TextCtrl_PacketTimewait; + wxTextCtrl* TextCtrl_RecvByteCount; + wxTextCtrl* TextCtrl_RecvLength; + wxTextCtrl* TextCtrl_RecvTimeOut; + wxTextCtrl* TextCtrl_SendByteCount; + wxTextCtrl* TextCtrl_SendText; + wxTextCtrl* TextCtrl_ServerIP; + wxTextCtrl* TextCtrl_ServerPort; + wxTextCtrl* TextCtrl_SocketInterval; + wxTextCtrl* TextCtrl_SuccessConnect; + wxTextCtrl* TextCtrl_SuccessRecv; + wxTextCtrl* TextCtrl_SuccessSend; + wxTextCtrl* TextCtrl_TestThreadCount; + wxTimer Timer_Test; + //*) + + DECLARE_EVENT_TABLE() - // ɵϢӳ亯 - virtual BOOL OnInitDialog(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnPaint(); - afx_msg HCURSOR OnQueryDragIcon(); - DECLARE_MESSAGE_MAP() +private: + void ClearResult(); private: - void InitView(); - void ClearResult(); - void Close(bool blClose = false); - void SetRichTextColor(int nColor); + vecClientTcpSocket m_vecClientTcpSocket; + vecClientUdpSocket m_vecClientUdpSocket; -private: - CTime m_tmBegin; //ѹ⿪ʼʱ - bool m_blIsRun; //ѹǷڽ - CTime m_tmEnd; //ѹֹͣʱ - int m_nCurrTextStyle; //ǰı - CBaseDataLogic* m_pLogic; //Ƿµ߼ + wxDateTime m_tmBegin; //压测开始时间 + wxDateTime m_tmEnd; //压测停止时间 + + bool m_blIsRun; //压测是否在进行 + int m_nCurrTextStyle; //当前文本风格 + CBaseDataLogic* m_pLogic; //是否设置了最新的逻辑包 -public: - CEdit m_txtServerIP; - CEdit m_txtPort; - CEdit m_txtThreadCount; - CEdit m_txtRecvTimeout; - CEdit m_txtSocketInterval; - CEdit m_txtRecvLength; - CButton m_chkIsAlwayConnect; - CButton m_chkRadomaDelay; - CButton m_chkIsRecv; - CButton m_ChkIsBroken; - CButton m_chkRadomSendCount; - CButton m_chkIsWriteLog; - CButton m_chkSendOne; - CButton m_chkLuaAdvance; - CEdit m_txtSuccessConnect; - CEdit m_txtSuccessSend; - CEdit m_txtSuccessRecv; - CEdit m_txtCurrConnect; - CEdit m_txtFailConnect; - CEdit m_txtFailSend; - CEdit m_txtFailRecv; - CEdit m_txtClientUdpPort; - CEdit m_txtPacketTimewait; - CEdit m_txtSendByteCount; - CEdit m_txtRecvByteCount; - CEdit m_txtLuaFilePath; - CEdit m_txtSendCount; - CEdit m_txtMinTime; - CEdit m_txtMaxTime; - CComboBox m_cbSendBuffStyle; - CRichEditCtrl m_reSendText; - int m_nRadio; - - vecClientTcpSocket m_vecClientTcpSocket; - vecClientUdpSocket m_vecClientUdpSocket; - afx_msg void OnClose(); - afx_msg void OnBnClickedButton2(); - afx_msg void OnTimer(UINT_PTR nIDEvent); - afx_msg void OnBnClickedButton3(); - afx_msg void OnCbnSelchangeCombo1(); - afx_msg void OnBnClickedButton1(); - afx_msg void OnBnClickedButton4(); - - afx_msg void OnBnClickedButton5(); }; + +#endif // CPassTCPDlg_H diff --git a/TestNetworkTool/PassTCP/TinyXML/tinystr.cpp b/TestNetworkTool/PassTCP/TinyXML/tinystr.cpp deleted file mode 100644 index 066576820..000000000 --- a/TestNetworkTool/PassTCP/TinyXML/tinystr.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TIXML_USE_STL - -#include "tinystr.h" - -// Error value for find primitive -const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1); - - -// Null rep. -TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } }; - - -void TiXmlString::reserve (size_type cap) -{ - if (cap > capacity()) - { - TiXmlString tmp; - tmp.init(length(), cap); - memcpy(tmp.start(), data(), length()); - swap(tmp); - } -} - - -TiXmlString& TiXmlString::assign(const char* str, size_type len) -{ - size_type cap = capacity(); - if (len > cap || cap > 3*(len + 8)) - { - TiXmlString tmp; - tmp.init(len); - memcpy(tmp.start(), str, len); - swap(tmp); - } - else - { - memmove(start(), str, len); - set_size(len); - } - return *this; -} - - -TiXmlString& TiXmlString::append(const char* str, size_type len) -{ - size_type newsize = length() + len; - if (newsize > capacity()) - { - reserve (newsize + capacity()); - } - memmove(finish(), str, len); - set_size(newsize); - return *this; -} - - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) -{ - TiXmlString tmp; - tmp.reserve(a.length() + b.length()); - tmp += a; - tmp += b; - return tmp; -} - -TiXmlString operator + (const TiXmlString & a, const char* b) -{ - TiXmlString tmp; - TiXmlString::size_type b_len = static_cast( strlen(b) ); - tmp.reserve(a.length() + b_len); - tmp += a; - tmp.append(b, b_len); - return tmp; -} - -TiXmlString operator + (const char* a, const TiXmlString & b) -{ - TiXmlString tmp; - TiXmlString::size_type a_len = static_cast( strlen(a) ); - tmp.reserve(a_len + b.length()); - tmp.append(a, a_len); - tmp += b; - return tmp; -} - - -#endif // TIXML_USE_STL diff --git a/TestNetworkTool/PassTCP/TinyXML/tinystr.h b/TestNetworkTool/PassTCP/TinyXML/tinystr.h deleted file mode 100644 index 89cca3341..000000000 --- a/TestNetworkTool/PassTCP/TinyXML/tinystr.h +++ /dev/null @@ -1,305 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TIXML_USE_STL - -#ifndef TIXML_STRING_INCLUDED -#define TIXML_STRING_INCLUDED - -#include -#include - -/* The support for explicit isn't that universal, and it isn't really - required - it is used to check that the TiXmlString class isn't incorrectly - used. Be nice to old compilers and macro it here: -*/ -#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - #define TIXML_EXPLICIT explicit -#elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - #define TIXML_EXPLICIT explicit -#else - #define TIXML_EXPLICIT -#endif - - -/* - TiXmlString is an emulation of a subset of the std::string template. - Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. - Only the member functions relevant to the TinyXML project have been implemented. - The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase - a string and there's no more room, we allocate a buffer twice as big as we need. -*/ -class TiXmlString -{ - public : - // The size type used - typedef size_t size_type; - - // Error value for find primitive - static const size_type npos; // = -1; - - - // TiXmlString empty constructor - TiXmlString () : rep_(&nullrep_) - { - } - - // TiXmlString copy constructor - TiXmlString ( const TiXmlString & copy) : rep_(0) - { - init(copy.length()); - memcpy(start(), copy.data(), length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) - { - init( static_cast( strlen(copy) )); - memcpy(start(), copy, length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) - { - init(len); - memcpy(start(), str, len); - } - - // TiXmlString destructor - ~TiXmlString () - { - quit(); - } - - TiXmlString& operator = (const char * copy) - { - return assign( copy, (size_type)strlen(copy)); - } - - TiXmlString& operator = (const TiXmlString & copy) - { - return assign(copy.start(), copy.length()); - } - - - // += operator. Maps to append - TiXmlString& operator += (const char * suffix) - { - return append(suffix, static_cast( strlen(suffix) )); - } - - // += operator. Maps to append - TiXmlString& operator += (char single) - { - return append(&single, 1); - } - - // += operator. Maps to append - TiXmlString& operator += (const TiXmlString & suffix) - { - return append(suffix.data(), suffix.length()); - } - - - // Convert a TiXmlString into a null-terminated char * - const char * c_str () const { return rep_->str; } - - // Convert a TiXmlString into a char * (need not be null terminated). - const char * data () const { return rep_->str; } - - // Return the length of a TiXmlString - size_type length () const { return rep_->size; } - - // Alias for length() - size_type size () const { return rep_->size; } - - // Checks if a TiXmlString is empty - bool empty () const { return rep_->size == 0; } - - // Return capacity of string - size_type capacity () const { return rep_->capacity; } - - - // single char extraction - const char& at (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // [] operator - char& operator [] (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // find a char in a string. Return TiXmlString::npos if not found - size_type find (char lookup) const - { - return find(lookup, 0); - } - - // find a char in a string from an offset. Return TiXmlString::npos if not found - size_type find (char tofind, size_type offset) const - { - if (offset >= length()) return npos; - - for (const char* p = c_str() + offset; *p != '\0'; ++p) - { - if (*p == tofind) return static_cast< size_type >( p - c_str() ); - } - return npos; - } - - void clear () - { - //Lee: - //The original was just too strange, though correct: - // TiXmlString().swap(*this); - //Instead use the quit & re-init: - quit(); - init(0,0); - } - - /* Function to reserve a big amount of data when we know we'll need it. Be aware that this - function DOES NOT clear the content of the TiXmlString if any exists. - */ - void reserve (size_type cap); - - TiXmlString& assign (const char* str, size_type len); - - TiXmlString& append (const char* str, size_type len); - - void swap (TiXmlString& other) - { - Rep* r = rep_; - rep_ = other.rep_; - other.rep_ = r; - } - - private: - - void init(size_type sz) { init(sz, sz); } - void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } - char* start() const { return rep_->str; } - char* finish() const { return rep_->str + rep_->size; } - - struct Rep - { - size_type size, capacity; - char str[1]; - }; - - void init(size_type sz, size_type cap) - { - if (cap) - { - // Lee: the original form: - // rep_ = static_cast(operator new(sizeof(Rep) + cap)); - // doesn't work in some cases of new being overloaded. Switching - // to the normal allocation, although use an 'int' for systems - // that are overly picky about structure alignment. - const size_type bytesNeeded = sizeof(Rep) + cap; - const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); - rep_ = reinterpret_cast( new int[ intsNeeded ] ); - - rep_->str[ rep_->size = sz ] = '\0'; - rep_->capacity = cap; - } - else - { - rep_ = &nullrep_; - } - } - - void quit() - { - if (rep_ != &nullrep_) - { - // The rep_ is really an array of ints. (see the allocator, above). - // Cast it back before delete, so the compiler won't incorrectly call destructors. - delete [] ( reinterpret_cast( rep_ ) ); - } - } - - Rep * rep_; - static Rep nullrep_; - -} ; - - -inline bool operator == (const TiXmlString & a, const TiXmlString & b) -{ - return ( a.length() == b.length() ) // optimization on some platforms - && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare -} -inline bool operator < (const TiXmlString & a, const TiXmlString & b) -{ - return strcmp(a.c_str(), b.c_str()) < 0; -} - -inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } -inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } -inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } -inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } - -inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } -inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } -inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } -inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); -TiXmlString operator + (const TiXmlString & a, const char* b); -TiXmlString operator + (const char* a, const TiXmlString & b); - - -/* - TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. - Only the operators that we need for TinyXML have been developped. -*/ -class TiXmlOutStream : public TiXmlString -{ -public : - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const TiXmlString & in) - { - *this += in; - return *this; - } - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const char * in) - { - *this += in; - return *this; - } - -} ; - -#endif // TIXML_STRING_INCLUDED -#endif // TIXML_USE_STL diff --git a/TestNetworkTool/PassTCP/TinyXML/tinyxml.cpp b/TestNetworkTool/PassTCP/TinyXML/tinyxml.cpp deleted file mode 100644 index 9c161dfcb..000000000 --- a/TestNetworkTool/PassTCP/TinyXML/tinyxml.cpp +++ /dev/null @@ -1,1886 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#include - -#ifdef TIXML_USE_STL -#include -#include -#endif - -#include "tinyxml.h" - -FILE* TiXmlFOpen( const char* filename, const char* mode ); - -bool TiXmlBase::condenseWhiteSpace = true; - -// Microsoft compiler security -FILE* TiXmlFOpen( const char* filename, const char* mode ) -{ - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - FILE* fp = 0; - errno_t err = fopen_s( &fp, filename, mode ); - if ( !err && fp ) - return fp; - return 0; - #else - return fopen( filename, mode ); - #endif -} - -void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) -{ - int i=0; - - while( i<(int)str.length() ) - { - unsigned char c = (unsigned char) str[i]; - - if ( c == '&' - && i < ( (int)str.length() - 2 ) - && str[i+1] == '#' - && str[i+2] == 'x' ) - { - // Hexadecimal character reference. - // Pass through unchanged. - // © -- copyright symbol, for example. - // - // The -1 is a bug fix from Rob Laveaux. It keeps - // an overflow from happening if there is no ';'. - // There are actually 2 ways to exit this loop - - // while fails (error case) and break (semicolon found). - // However, there is no mechanism (currently) for - // this function to return an error. - while ( i<(int)str.length()-1 ) - { - outString->append( str.c_str() + i, 1 ); - ++i; - if ( str[i] == ';' ) - break; - } - } - else if ( c == '&' ) - { - outString->append( entity[0].str, entity[0].strLength ); - ++i; - } - else if ( c == '<' ) - { - outString->append( entity[1].str, entity[1].strLength ); - ++i; - } - else if ( c == '>' ) - { - outString->append( entity[2].str, entity[2].strLength ); - ++i; - } - else if ( c == '\"' ) - { - outString->append( entity[3].str, entity[3].strLength ); - ++i; - } - else if ( c == '\'' ) - { - outString->append( entity[4].str, entity[4].strLength ); - ++i; - } - else if ( c < 32 ) - { - // Easy pass at non-alpha/numeric/symbol - // Below 32 is symbolic. - char buf[ 32 ]; - - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); - #else - sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); - #endif - - //*ME: warning C4267: convert 'size_t' to 'int' - //*ME: Int-Cast to make compiler happy ... - outString->append( buf, (int)strlen( buf ) ); - ++i; - } - else - { - //char realc = (char) c; - //outString->append( &realc, 1 ); - *outString += (char) c; // somewhat more efficient function call. - ++i; - } - } -} - - -TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() -{ - parent = 0; - type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; -} - - -TiXmlNode::~TiXmlNode() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } -} - - -void TiXmlNode::CopyTo( TiXmlNode* target ) const -{ - target->SetValue (value.c_str() ); - target->userData = userData; - target->location = location; -} - - -void TiXmlNode::Clear() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } - - firstChild = 0; - lastChild = 0; -} - - -TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) -{ - assert( node->parent == 0 || node->parent == this ); - assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); - - if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - delete node; - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - node->parent = this; - - node->prev = lastChild; - node->next = 0; - - if ( lastChild ) - lastChild->next = node; - else - firstChild = node; // it was an empty list. - - lastChild = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) -{ - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - - return LinkEndChild( node ); -} - - -TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) -{ - if ( !beforeThis || beforeThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->next = beforeThis; - node->prev = beforeThis->prev; - if ( beforeThis->prev ) - { - beforeThis->prev->next = node; - } - else - { - assert( firstChild == beforeThis ); - firstChild = node; - } - beforeThis->prev = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) -{ - if ( !afterThis || afterThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->prev = afterThis; - node->next = afterThis->next; - if ( afterThis->next ) - { - afterThis->next->prev = node; - } - else - { - assert( lastChild == afterThis ); - lastChild = node; - } - afterThis->next = node; - return node; -} - - -TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) -{ - if ( !replaceThis ) - return 0; - - if ( replaceThis->parent != this ) - return 0; - - if ( withThis.ToDocument() ) { - // A document can never be a child. Thanks to Noam. - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = withThis.Clone(); - if ( !node ) - return 0; - - node->next = replaceThis->next; - node->prev = replaceThis->prev; - - if ( replaceThis->next ) - replaceThis->next->prev = node; - else - lastChild = node; - - if ( replaceThis->prev ) - replaceThis->prev->next = node; - else - firstChild = node; - - delete replaceThis; - node->parent = this; - return node; -} - - -bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) -{ - if ( !removeThis ) { - return false; - } - - if ( removeThis->parent != this ) - { - assert( 0 ); - return false; - } - - if ( removeThis->next ) - removeThis->next->prev = removeThis->prev; - else - lastChild = removeThis->prev; - - if ( removeThis->prev ) - removeThis->prev->next = removeThis->next; - else - firstChild = removeThis->next; - - delete removeThis; - return true; -} - -const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = firstChild; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = lastChild; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild(); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling(); - } -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild( val ); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling( val ); - } -} - - -const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = next; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = prev; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -void TiXmlElement::RemoveAttribute( const char * name ) -{ - #ifdef TIXML_USE_STL - TIXML_STRING str( name ); - TiXmlAttribute* node = attributeSet.Find( str ); - #else - TiXmlAttribute* node = attributeSet.Find( name ); - #endif - if ( node ) - { - attributeSet.Remove( node ); - delete node; - } -} - -const TiXmlElement* TiXmlNode::FirstChildElement() const -{ - const TiXmlNode* node; - - for ( node = FirstChild(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = FirstChild( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement() const -{ - const TiXmlNode* node; - - for ( node = NextSibling(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = NextSibling( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlDocument* TiXmlNode::GetDocument() const -{ - const TiXmlNode* node; - - for( node = this; node; node = node->parent ) - { - if ( node->ToDocument() ) - return node->ToDocument(); - } - return 0; -} - - -TiXmlElement::TiXmlElement (const char * _value) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} - - -#ifdef TIXML_USE_STL -TiXmlElement::TiXmlElement( const std::string& _value ) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} -#endif - - -TiXmlElement::TiXmlElement( const TiXmlElement& copy) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - copy.CopyTo( this ); -} - - -TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base ) -{ - ClearThis(); - base.CopyTo( this ); - return *this; -} - - -TiXmlElement::~TiXmlElement() -{ - ClearThis(); -} - - -void TiXmlElement::ClearThis() -{ - Clear(); - while( attributeSet.First() ) - { - TiXmlAttribute* node = attributeSet.First(); - attributeSet.Remove( node ); - delete node; - } -} - - -const char* TiXmlElement::Attribute( const char* name ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( node ) - return node->Value(); - return 0; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( attrib ) - return &attrib->ValueStr(); - return 0; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) { - result = attrib->Value(); - if ( i ) { - attrib->QueryIntValue( i ); - } - } - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) { - result = &attrib->ValueStr(); - if ( i ) { - attrib->QueryIntValue( i ); - } - } - return result; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) { - result = attrib->Value(); - if ( d ) { - attrib->QueryDoubleValue( d ); - } - } - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) { - result = &attrib->ValueStr(); - if ( d ) { - attrib->QueryDoubleValue( d ); - } - } - return result; -} -#endif - - -int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryIntValue( ival ); -} - - -int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - int ival = 0; - int result = node->QueryIntValue( &ival ); - *value = (unsigned)ival; - return result; -} - - -int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - int result = TIXML_WRONG_TYPE; - if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = true; - result = TIXML_SUCCESS; - } - else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = false; - result = TIXML_SUCCESS; - } - return result; -} - - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryIntValue( ival ); -} -#endif - - -int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryDoubleValue( dval ); -} - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryDoubleValue( dval ); -} -#endif - - -void TiXmlElement::SetAttribute( const char * name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetIntValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetIntValue( val ); - } -} -#endif - - -void TiXmlElement::SetDoubleAttribute( const char * name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetDoubleValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetDoubleValue( val ); - } -} -#endif - - -void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); - if ( attrib ) { - attrib->SetValue( cvalue ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name ); - if ( attrib ) { - attrib->SetValue( _value ); - } -} -#endif - - -void TiXmlElement::Print( FILE* cfile, int depth ) const -{ - int i; - assert( cfile ); - for ( i=0; iNext() ) - { - fprintf( cfile, " " ); - attrib->Print( cfile, depth ); - } - - // There are 3 different formatting approaches: - // 1) An element without children is printed as a node - // 2) An element with only a text child is printed as text - // 3) An element with children is printed on multiple lines. - TiXmlNode* node; - if ( !firstChild ) - { - fprintf( cfile, " />" ); - } - else if ( firstChild == lastChild && firstChild->ToText() ) - { - fprintf( cfile, ">" ); - firstChild->Print( cfile, depth + 1 ); - fprintf( cfile, "", value.c_str() ); - } - else - { - fprintf( cfile, ">" ); - - for ( node = firstChild; node; node=node->NextSibling() ) - { - if ( !node->ToText() ) - { - fprintf( cfile, "\n" ); - } - node->Print( cfile, depth+1 ); - } - fprintf( cfile, "\n" ); - for( i=0; i", value.c_str() ); - } -} - - -void TiXmlElement::CopyTo( TiXmlElement* target ) const -{ - // superclass: - TiXmlNode::CopyTo( target ); - - // Element class: - // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; - for( attribute = attributeSet.First(); - attribute; - attribute = attribute->Next() ) - { - target->SetAttribute( attribute->Name(), attribute->Value() ); - } - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - -bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this, attributeSet.First() ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -TiXmlNode* TiXmlElement::Clone() const -{ - TiXmlElement* clone = new TiXmlElement( Value() ); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -const char* TiXmlElement::GetText() const -{ - const TiXmlNode* child = this->FirstChild(); - if ( child ) { - const TiXmlText* childText = child->ToText(); - if ( childText ) { - return childText->Value(); - } - } - return 0; -} - - -TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - ClearError(); -} - -TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} - - -#ifdef TIXML_USE_STL -TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} -#endif - - -TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) -{ - return LoadFile( Value(), encoding ); -} - - -bool TiXmlDocument::SaveFile() const -{ - return SaveFile( Value() ); -} - -bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) -{ - TIXML_STRING filename( _filename ); - value = filename; - - // reading in binary mode so that tinyxml can normalize the EOL - FILE* file = TiXmlFOpen( value.c_str (), "rb" ); - - if ( file ) - { - bool result = LoadFile( file, encoding ); - fclose( file ); - return result; - } - else - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } -} - -bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) -{ - if ( !file ) - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Delete the existing data: - Clear(); - location.Clear(); - - // Get the file size, so we can pre-allocate the string. HUGE speed impact. - long length = 0; - fseek( file, 0, SEEK_END ); - length = ftell( file ); - fseek( file, 0, SEEK_SET ); - - // Strange case, but good to handle up front. - if ( length <= 0 ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Subtle bug here. TinyXml did use fgets. But from the XML spec: - // 2.11 End-of-Line Handling - // - // - // ...the XML processor MUST behave as if it normalized all line breaks in external - // parsed entities (including the document entity) on input, before parsing, by translating - // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to - // a single #xA character. - // - // - // It is not clear fgets does that, and certainly isn't clear it works cross platform. - // Generally, you expect fgets to translate from the convention of the OS to the c/unix - // convention, and not work generally. - - /* - while( fgets( buf, sizeof(buf), file ) ) - { - data += buf; - } - */ - - char* buf = new char[ length+1 ]; - buf[0] = 0; - - if ( fread( buf, length, 1, file ) != 1 ) { - delete [] buf; - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Process the buffer in place to normalize new lines. (See comment above.) - // Copies from the 'p' to 'q' pointer, where p can advance faster if - // a newline-carriage return is hit. - // - // Wikipedia: - // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or - // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... - // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others - // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS - // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 - - const char* p = buf; // the read head - char* q = buf; // the write head - const char CR = 0x0d; - const char LF = 0x0a; - - buf[length] = 0; - while( *p ) { - assert( p < (buf+length) ); - assert( q <= (buf+length) ); - assert( q <= p ); - - if ( *p == CR ) { - *q++ = LF; - p++; - if ( *p == LF ) { // check for CR+LF (and skip LF) - p++; - } - } - else { - *q++ = *p++; - } - } - assert( q <= (buf+length) ); - *q = 0; - - Parse( buf, 0, encoding ); - - delete [] buf; - return !Error(); -} - - -bool TiXmlDocument::SaveFile( const char * filename ) const -{ - // The old c stuff lives on... - FILE* fp = TiXmlFOpen( filename, "w" ); - if ( fp ) - { - bool result = SaveFile( fp ); - fclose( fp ); - return result; - } - return false; -} - - -bool TiXmlDocument::SaveFile( FILE* fp ) const -{ - if ( useMicrosoftBOM ) - { - const unsigned char TIXML_UTF_LEAD_0 = 0xefU; - const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; - const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - - fputc( TIXML_UTF_LEAD_0, fp ); - fputc( TIXML_UTF_LEAD_1, fp ); - fputc( TIXML_UTF_LEAD_2, fp ); - } - Print( fp, 0 ); - return (ferror(fp) == 0); -} - - -void TiXmlDocument::CopyTo( TiXmlDocument* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->error = error; - target->errorId = errorId; - target->errorDesc = errorDesc; - target->tabsize = tabsize; - target->errorLocation = errorLocation; - target->useMicrosoftBOM = useMicrosoftBOM; - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - - -TiXmlNode* TiXmlDocument::Clone() const -{ - TiXmlDocument* clone = new TiXmlDocument(); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlDocument::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - node->Print( cfile, depth ); - fprintf( cfile, "\n" ); - } -} - - -bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -const TiXmlAttribute* TiXmlAttribute::Next() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} - -/* -TiXmlAttribute* TiXmlAttribute::Next() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} -*/ - -const TiXmlAttribute* TiXmlAttribute::Previous() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} - -/* -TiXmlAttribute* TiXmlAttribute::Previous() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} -*/ - -void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - TIXML_STRING n, v; - - EncodeString( name, &n ); - EncodeString( value, &v ); - - if (value.find ('\"') == TIXML_STRING::npos) { - if ( cfile ) { - fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\""; - } - } - else { - if ( cfile ) { - fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'"; - } - } -} - - -int TiXmlAttribute::QueryIntValue( int* ival ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -int TiXmlAttribute::QueryDoubleValue( double* dval ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -void TiXmlAttribute::SetIntValue( int _value ) -{ - char buf [64]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); - #else - sprintf (buf, "%d", _value); - #endif - SetValue (buf); -} - -void TiXmlAttribute::SetDoubleValue( double _value ) -{ - char buf [256]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); - #else - sprintf (buf, "%g", _value); - #endif - SetValue (buf); -} - -int TiXmlAttribute::IntValue() const -{ - return atoi (value.c_str ()); -} - -double TiXmlAttribute::DoubleValue() const -{ - return atof (value.c_str ()); -} - - -TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base ) -{ - Clear(); - base.CopyTo( this ); - return *this; -} - - -void TiXmlComment::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlComment::CopyTo( TiXmlComment* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlComment::Clone() const -{ - TiXmlComment* clone = new TiXmlComment(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlText::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - if ( cdata ) - { - int i; - fprintf( cfile, "\n" ); - for ( i=0; i\n", value.c_str() ); // unformatted output - } - else - { - TIXML_STRING buffer; - EncodeString( value, &buffer ); - fprintf( cfile, "%s", buffer.c_str() ); - } -} - - -void TiXmlText::CopyTo( TiXmlText* target ) const -{ - TiXmlNode::CopyTo( target ); - target->cdata = cdata; -} - - -bool TiXmlText::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlText::Clone() const -{ - TiXmlText* clone = 0; - clone = new TiXmlText( "" ); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlDeclaration::TiXmlDeclaration( const char * _version, - const char * _encoding, - const char * _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} - - -#ifdef TIXML_USE_STL -TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} -#endif - - -TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - copy.CopyTo( this ); -} - - -TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - if ( cfile ) fprintf( cfile, "" ); - if ( str ) (*str) += "?>"; -} - - -void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->version = version; - target->encoding = encoding; - target->standalone = standalone; -} - - -bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlDeclaration::Clone() const -{ - TiXmlDeclaration* clone = new TiXmlDeclaration(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlUnknown::Print( FILE* cfile, int depth ) const -{ - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlUnknown::Clone() const -{ - TiXmlUnknown* clone = new TiXmlUnknown(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlAttributeSet::TiXmlAttributeSet() -{ - sentinel.next = &sentinel; - sentinel.prev = &sentinel; -} - - -TiXmlAttributeSet::~TiXmlAttributeSet() -{ - assert( sentinel.next == &sentinel ); - assert( sentinel.prev == &sentinel ); -} - - -void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) -{ - #ifdef TIXML_USE_STL - assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. - #else - assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. - #endif - - addMe->next = &sentinel; - addMe->prev = sentinel.prev; - - sentinel.prev->next = addMe; - sentinel.prev = addMe; -} - -void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) -{ - TiXmlAttribute* node; - - for( node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node == removeMe ) - { - node->prev->next = node->next; - node->next->prev = node->prev; - node->next = 0; - node->prev = 0; - return; - } - } - assert( 0 ); // we tried to remove a non-linked attribute. -} - - -#ifdef TIXML_USE_STL -TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node->name == name ) - return node; - } - return 0; -} - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - if ( !attrib ) { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - return attrib; -} -#endif - - -TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( strcmp( node->name.c_str(), name ) == 0 ) - return node; - } - return 0; -} - - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - if ( !attrib ) { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - return attrib; -} - - -#ifdef TIXML_USE_STL -std::istream& operator>> (std::istream & in, TiXmlNode & base) -{ - TIXML_STRING tag; - tag.reserve( 8 * 1000 ); - base.StreamIn( &in, &tag ); - - base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); - return in; -} -#endif - - -#ifdef TIXML_USE_STL -std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out << printer.Str(); - - return out; -} - - -std::string& operator<< (std::string& out, const TiXmlNode& base ) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out.append( printer.Str() ); - - return out; -} -#endif - - -TiXmlHandle TiXmlHandle::FirstChild() const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild( value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement() const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement( value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild(); - for ( i=0; - child && iNextSibling(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild( value ); - for ( i=0; - child && iNextSibling( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement(); - for ( i=0; - child && iNextSiblingElement(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement( value ); - for ( i=0; - child && iNextSiblingElement( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) -{ - DoIndent(); - buffer += "<"; - buffer += element.Value(); - - for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) - { - buffer += " "; - attrib->Print( 0, 0, &buffer ); - } - - if ( !element.FirstChild() ) - { - buffer += " />"; - DoLineBreak(); - } - else - { - buffer += ">"; - if ( element.FirstChild()->ToText() - && element.LastChild() == element.FirstChild() - && element.FirstChild()->ToText()->CDATA() == false ) - { - simpleTextPrint = true; - // no DoLineBreak()! - } - else - { - DoLineBreak(); - } - } - ++depth; - return true; -} - - -bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) -{ - --depth; - if ( !element.FirstChild() ) - { - // nothing. - } - else - { - if ( simpleTextPrint ) - { - simpleTextPrint = false; - } - else - { - DoIndent(); - } - buffer += ""; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlText& text ) -{ - if ( text.CDATA() ) - { - DoIndent(); - buffer += ""; - DoLineBreak(); - } - else if ( simpleTextPrint ) - { - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - } - else - { - DoIndent(); - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) -{ - DoIndent(); - declaration.Print( 0, 0, &buffer ); - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlComment& comment ) -{ - DoIndent(); - buffer += ""; - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) -{ - DoIndent(); - buffer += "<"; - buffer += unknown.Value(); - buffer += ">"; - DoLineBreak(); - return true; -} - diff --git a/TestNetworkTool/PassTCP/TinyXML/tinyxml.h b/TestNetworkTool/PassTCP/TinyXML/tinyxml.h deleted file mode 100644 index a3589e5b2..000000000 --- a/TestNetworkTool/PassTCP/TinyXML/tinyxml.h +++ /dev/null @@ -1,1805 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TINYXML_INCLUDED -#define TINYXML_INCLUDED - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4530 ) -#pragma warning( disable : 4786 ) -#endif - -#include -#include -#include -#include -#include - -// Help out windows: -#if defined( _DEBUG ) && !defined( DEBUG ) -#define DEBUG -#endif - -#ifdef TIXML_USE_STL - #include - #include - #include - #define TIXML_STRING std::string -#else - #include "tinystr.h" - #define TIXML_STRING TiXmlString -#endif - -// Deprecated library function hell. Compilers want to use the -// new safe versions. This probably doesn't fully address the problem, -// but it gets closer. There are too many compilers for me to fully -// test. If you get compilation troubles, undefine TIXML_SAFE -#define TIXML_SAFE - -#ifdef TIXML_SAFE - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - // Microsoft visual studio, version 2005 and higher. - #define TIXML_SNPRINTF _snprintf_s - #define TIXML_SSCANF sscanf_s - #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - //#pragma message( "Using _sn* functions." ) - #define TIXML_SNPRINTF _snprintf - #define TIXML_SSCANF sscanf - #elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #else - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #endif -#endif - -class TiXmlDocument; -class TiXmlElement; -class TiXmlComment; -class TiXmlUnknown; -class TiXmlAttribute; -class TiXmlText; -class TiXmlDeclaration; -class TiXmlParsingData; - -const int TIXML_MAJOR_VERSION = 2; -const int TIXML_MINOR_VERSION = 6; -const int TIXML_PATCH_VERSION = 2; - -/* Internal structure for tracking location of items - in the XML file. -*/ -struct TiXmlCursor -{ - TiXmlCursor() { Clear(); } - void Clear() { row = col = -1; } - - int row; // 0 based. - int col; // 0 based. -}; - - -/** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a TiXmlVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves - are simply called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its sibilings will be Visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. - - You should never change the document from a callback. - - @sa TiXmlNode::Accept() -*/ -class TiXmlVisitor -{ -public: - virtual ~TiXmlVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } - /// Visit a document. - virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } - - /// Visit an element. - virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } - /// Visit an element. - virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } - - /// Visit a declaration - virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } - /// Visit a text node - virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } - /// Visit a comment node - virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } - /// Visit an unknown node - virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } -}; - -// Only used by Attribute::Query functions -enum -{ - TIXML_SUCCESS, - TIXML_NO_ATTRIBUTE, - TIXML_WRONG_TYPE -}; - - -// Used by the parsing routines. -enum TiXmlEncoding -{ - TIXML_ENCODING_UNKNOWN, - TIXML_ENCODING_UTF8, - TIXML_ENCODING_LEGACY -}; - -const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; - -/** TiXmlBase is a base class for every class in TinyXml. - It does little except to establish that TinyXml classes - can be printed and provide some utility functions. - - In XML, the document and elements can contain - other elements and other types of nodes. - - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) - - A Decleration contains: Attributes (not on tree) - @endverbatim -*/ -class TiXmlBase -{ - friend class TiXmlNode; - friend class TiXmlElement; - friend class TiXmlDocument; - -public: - TiXmlBase() : userData(0) {} - virtual ~TiXmlBase() {} - - /** All TinyXml classes can print themselves to a filestream - or the string class (TiXmlString in non-STL mode, std::string - in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert - tabs and newlines. - - (For an unformatted stream, use the << operator.) - */ - virtual void Print( FILE* cfile, int depth ) const = 0; - - /** The world does not agree on whether white space should be kept or - not. In order to make everyone happy, these global, static functions - are provided to set whether or not TinyXml will condense all white space - into a single space or not. The default is to condense. Note changing this - value is not thread safe. - */ - static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } - - /// Return the current white space setting. - static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } - - /** Return the position, in the original source file, of this node or attribute. - The row and column are 1-based. (That is the first row and first column is - 1,1). If the returns values are 0 or less, then the parser does not have - a row and column value. - - Generally, the row and column value will be set when the TiXmlDocument::Load(), - TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set - when the DOM was created from operator>>. - - The values reflect the initial load. Once the DOM is modified programmatically - (by adding or changing nodes and attributes) the new values will NOT update to - reflect changes in the document. - - There is a minor performance cost to computing the row and column. Computation - can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. - - @sa TiXmlDocument::SetTabSize() - */ - int Row() const { return location.row + 1; } - int Column() const { return location.col + 1; } ///< See Row() - - void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. - void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. - const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. - - // Table that returs, for a given lead byte, the total number of bytes - // in the UTF-8 sequence. - static const int utf8ByteTable[256]; - - virtual const char* Parse( const char* p, - TiXmlParsingData* data, - TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; - - /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, - or they will be transformed into entities! - */ - static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); - - enum - { - TIXML_NO_ERROR = 0, - TIXML_ERROR, - TIXML_ERROR_OPENING_FILE, - TIXML_ERROR_PARSING_ELEMENT, - TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, - TIXML_ERROR_READING_ELEMENT_VALUE, - TIXML_ERROR_READING_ATTRIBUTES, - TIXML_ERROR_PARSING_EMPTY, - TIXML_ERROR_READING_END_TAG, - TIXML_ERROR_PARSING_UNKNOWN, - TIXML_ERROR_PARSING_COMMENT, - TIXML_ERROR_PARSING_DECLARATION, - TIXML_ERROR_DOCUMENT_EMPTY, - TIXML_ERROR_EMBEDDED_NULL, - TIXML_ERROR_PARSING_CDATA, - TIXML_ERROR_DOCUMENT_TOP_ONLY, - - TIXML_ERROR_STRING_COUNT - }; - -protected: - - static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); - } - inline static bool IsWhiteSpace( int c ) - { - if ( c < 256 ) - return IsWhiteSpace( (char) c ); - return false; // Again, only truly correct for English/Latin...but usually works. - } - - #ifdef TIXML_USE_STL - static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); - static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); - #endif - - /* Reads an XML name into the string provided. Returns - a pointer just past the last character of the name, - or 0 if the function has an error. - */ - static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); - - /* Reads text. Returns a pointer past the given end tag. - Wickedly complex options, but it keeps the (sensitive) code in one place. - */ - static const char* ReadText( const char* in, // where to start - TIXML_STRING* text, // the string read - bool ignoreWhiteSpace, // whether to keep the white space - const char* endTag, // what ends this text - bool ignoreCase, // whether to ignore case in the end tag - TiXmlEncoding encoding ); // the current encoding - - // If an entity has been found, transform it into a character. - static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); - - // Get a character, while interpreting entities. - // The length can be from 0 to 4 bytes. - inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) - { - assert( p ); - if ( encoding == TIXML_ENCODING_UTF8 ) - { - *length = utf8ByteTable[ *((const unsigned char*)p) ]; - assert( *length >= 0 && *length < 5 ); - } - else - { - *length = 1; - } - - if ( *length == 1 ) - { - if ( *p == '&' ) - return GetEntity( p, _value, length, encoding ); - *_value = *p; - return p+1; - } - else if ( *length ) - { - //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), - // and the null terminator isn't needed - for( int i=0; p[i] && i<*length; ++i ) { - _value[i] = p[i]; - } - return p + (*length); - } - else - { - // Not valid text. - return 0; - } - } - - // Return true if the next characters in the stream are any of the endTag sequences. - // Ignore case only works for english, and should only be relied on when comparing - // to English words: StringEqual( p, "version", true ) is fine. - static bool StringEqual( const char* p, - const char* endTag, - bool ignoreCase, - TiXmlEncoding encoding ); - - static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; - - TiXmlCursor location; - - /// Field containing a generic user pointer - void* userData; - - // None of these methods are reliable for any language except English. - // Good for approximation, not great for accuracy. - static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); - static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); - inline static int ToLower( int v, TiXmlEncoding encoding ) - { - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( v < 128 ) return tolower( v ); - return v; - } - else - { - return tolower( v ); - } - } - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); - -private: - TiXmlBase( const TiXmlBase& ); // not implemented. - void operator=( const TiXmlBase& base ); // not allowed. - - struct Entity - { - const char* str; - unsigned int strLength; - char chr; - }; - enum - { - NUM_ENTITY = 5, - MAX_ENTITY_LENGTH = 6 - - }; - static Entity entity[ NUM_ENTITY ]; - static bool condenseWhiteSpace; -}; - - -/** The parent class for everything in the Document Object Model. - (Except for attributes). - Nodes have siblings, a parent, and children. A node can be - in a document, or stand on its own. The type of a TiXmlNode - can be queried, and it can be cast to its more defined type. -*/ -class TiXmlNode : public TiXmlBase -{ - friend class TiXmlDocument; - friend class TiXmlElement; - -public: - #ifdef TIXML_USE_STL - - /** An input stream operator, for every class. Tolerant of newlines and - formatting, but doesn't expect them. - */ - friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - - /** An output stream operator, for every class. Note that this outputs - without any newlines or formatting, as opposed to Print(), which - includes tabs and new lines. - - The operator<< and operator>> are not completely symmetric. Writing - a node to a stream is very well defined. You'll get a nice stream - of output, without any extra whitespace or newlines. - - But reading is not as well defined. (As it always is.) If you create - a TiXmlElement (for example) and read that from an input stream, - the text needs to define an element or junk will result. This is - true of all input streams, but it's worth keeping in mind. - - A TiXmlDocument will read nodes until it reads a root element, and - all the children of that root element. - */ - friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - - /// Appends the XML node or attribute to a std::string. - friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - - #endif - - /** The types of XML nodes supported by TinyXml. (All the - unsupported types are picked up by UNKNOWN.) - */ - enum NodeType - { - TINYXML_DOCUMENT, - TINYXML_ELEMENT, - TINYXML_COMMENT, - TINYXML_UNKNOWN, - TINYXML_TEXT, - TINYXML_DECLARATION, - TINYXML_TYPECOUNT - }; - - virtual ~TiXmlNode(); - - /** The meaning of 'value' changes for the specific type of - TiXmlNode. - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - - The subclasses will wrap this function. - */ - const char *Value() const { return value.c_str (); } - - #ifdef TIXML_USE_STL - /** Return Value() as a std::string. If you only use STL, - this is more efficient than calling Value(). - Only available in STL mode. - */ - const std::string& ValueStr() const { return value; } - #endif - - const TIXML_STRING& ValueTStr() const { return value; } - - /** Changes the value of the node. Defined as: - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - void SetValue(const char * _value) { value = _value;} - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Delete all the children of this node. Does not affect 'this'. - void Clear(); - - /// One step up the DOM. - TiXmlNode* Parent() { return parent; } - const TiXmlNode* Parent() const { return parent; } - - const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. - TiXmlNode* FirstChild() { return firstChild; } - const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. - /// The first child of this node with the matching 'value'. Will be null if none found. - TiXmlNode* FirstChild( const char * _value ) { - // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) - // call the method, cast the return back to non-const. - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); - } - const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. - TiXmlNode* LastChild() { return lastChild; } - - const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. - TiXmlNode* LastChild( const char * _value ) { - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. - #endif - - /** An alternate way to walk the children of a node. - One way to iterate over nodes is: - @verbatim - for( child = parent->FirstChild(); child; child = child->NextSibling() ) - @endverbatim - - IterateChildren does the same thing with the syntax: - @verbatim - child = 0; - while( child = parent->IterateChildren( child ) ) - @endverbatim - - IterateChildren takes the previous child as input and finds - the next one. If the previous child is null, it returns the - first. IterateChildren will return null when done. - */ - const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); - } - - /// This flavor of IterateChildren searches for children with a particular 'value' - const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - #endif - - /** Add a new node related to this. Adds a child past the LastChild. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); - - - /** Add a new node related to this. Adds a child past the LastChild. - - NOTE: the node to be added is passed by pointer, and will be - henceforth owned (and deleted) by tinyXml. This method is efficient - and avoids an extra copy, but should be used with care as it - uses a different memory model than the other insert functions. - - @sa InsertEndChild - */ - TiXmlNode* LinkEndChild( TiXmlNode* addThis ); - - /** Add a new node related to this. Adds a child before the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); - - /** Add a new node related to this. Adds a child after the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); - - /** Replace a child of this node. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); - - /// Delete a child of this node. - bool RemoveChild( TiXmlNode* removeThis ); - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling() const { return prev; } - TiXmlNode* PreviousSibling() { return prev; } - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling( const char * ) const; - TiXmlNode* PreviousSibling( const char *_prev ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Navigate to a sibling node. - const TiXmlNode* NextSibling() const { return next; } - TiXmlNode* NextSibling() { return next; } - - /// Navigate to a sibling node with the given 'value'. - const TiXmlNode* NextSibling( const char * ) const; - TiXmlNode* NextSibling( const char* _next ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement() const; - TiXmlElement* NextSiblingElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement( const char * ) const; - TiXmlElement* NextSiblingElement( const char *_next ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement() const; - TiXmlElement* FirstChildElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); - } - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement( const char * _value ) const; - TiXmlElement* FirstChildElement( const char * _value ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /** Query the type (as an enumerated value, above) of this node. - The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, - TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION. - */ - int Type() const { return type; } - - /** Return a pointer to the Document this node lives in. - Returns null if not in a document. - */ - const TiXmlDocument* GetDocument() const; - TiXmlDocument* GetDocument() { - return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); - } - - /// Returns true if this node has no children. - bool NoChildren() const { return !firstChild; } - - virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. - */ - virtual TiXmlNode* Clone() const = 0; - - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the TiXmlVisitor interface. - - This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - TiXmlPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( TiXmlVisitor* visitor ) const = 0; - -protected: - TiXmlNode( NodeType _type ); - - // Copy to the allocated object. Shared functionality between Clone, Copy constructor, - // and the assignment operator. - void CopyTo( TiXmlNode* target ) const; - - #ifdef TIXML_USE_STL - // The real work of the input operator. - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; - #endif - - // Figure out what is at *p, and parse it. Returns null if it is not an xml node. - TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); - - TiXmlNode* parent; - NodeType type; - - TiXmlNode* firstChild; - TiXmlNode* lastChild; - - TIXML_STRING value; - - TiXmlNode* prev; - TiXmlNode* next; - -private: - TiXmlNode( const TiXmlNode& ); // not implemented. - void operator=( const TiXmlNode& base ); // not allowed. -}; - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not TiXmlNodes, since they are not - part of the tinyXML document object model. There are other - suggested ways to look at this problem. -*/ -class TiXmlAttribute : public TiXmlBase -{ - friend class TiXmlAttributeSet; - -public: - /// Construct an empty attribute. - TiXmlAttribute() : TiXmlBase() - { - document = 0; - prev = next = 0; - } - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlAttribute( const std::string& _name, const std::string& _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - #endif - - /// Construct an attribute with a name and value. - TiXmlAttribute( const char * _name, const char * _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - - const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. - const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. - #ifdef TIXML_USE_STL - const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. - #endif - int IntValue() const; ///< Return the value of this attribute, converted to an integer. - double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - - // Get the tinyxml string representation - const TIXML_STRING& NameTStr() const { return name; } - - /** QueryIntValue examines the value string. It is an alternative to the - IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. - - A specialized but useful call. Note that for success it returns 0, - which is the opposite of almost all other TinyXml calls. - */ - int QueryIntValue( int* _value ) const; - /// QueryDoubleValue examines the value string. See QueryIntValue(). - int QueryDoubleValue( double* _value ) const; - - void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. - void SetValue( const char* _value ) { value = _value; } ///< Set the value. - - void SetIntValue( int _value ); ///< Set the value from an integer. - void SetDoubleValue( double _value ); ///< Set the value from a double. - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetName( const std::string& _name ) { name = _name; } - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Get the next sibling attribute in the DOM. Returns null at end. - const TiXmlAttribute* Next() const; - TiXmlAttribute* Next() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); - } - - /// Get the previous sibling attribute in the DOM. Returns null at beginning. - const TiXmlAttribute* Previous() const; - TiXmlAttribute* Previous() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); - } - - bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } - bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } - bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } - - /* Attribute parsing starts: first letter of the name - returns: the next char after the value end quote - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - // Prints this Attribute to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - - // [internal use] - // Set the document pointer so the attribute can report errors. - void SetDocument( TiXmlDocument* doc ) { document = doc; } - -private: - TiXmlAttribute( const TiXmlAttribute& ); // not implemented. - void operator=( const TiXmlAttribute& base ); // not allowed. - - TiXmlDocument* document; // A pointer back to a document, for error reporting. - TIXML_STRING name; - TIXML_STRING value; - TiXmlAttribute* prev; - TiXmlAttribute* next; -}; - - -/* A class used to manage a group of attributes. - It is only used internally, both by the ELEMENT and the DECLARATION. - - The set can be changed transparent to the Element and Declaration - classes that use it, but NOT transparent to the Attribute - which has to implement a next() and previous() method. Which makes - it a bit problematic and prevents the use of STL. - - This version is implemented with circular lists because: - - I like circular lists - - it demonstrates some independence from the (typical) doubly linked list. -*/ -class TiXmlAttributeSet -{ -public: - TiXmlAttributeSet(); - ~TiXmlAttributeSet(); - - void Add( TiXmlAttribute* attribute ); - void Remove( TiXmlAttribute* attribute ); - - const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - - TiXmlAttribute* Find( const char* _name ) const; - TiXmlAttribute* FindOrCreate( const char* _name ); - -# ifdef TIXML_USE_STL - TiXmlAttribute* Find( const std::string& _name ) const; - TiXmlAttribute* FindOrCreate( const std::string& _name ); -# endif - - -private: - //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), - //*ME: this class must be also use a hidden/disabled copy-constructor !!! - TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed - void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) - - TiXmlAttribute sentinel; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TiXmlElement : public TiXmlNode -{ -public: - /// Construct an element. - TiXmlElement (const char * in_value); - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlElement( const std::string& _value ); - #endif - - TiXmlElement( const TiXmlElement& ); - - TiXmlElement& operator=( const TiXmlElement& base ); - - virtual ~TiXmlElement(); - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - */ - const char* Attribute( const char* name ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an integer, - the integer value will be put in the return 'i', if 'i' - is non-null. - */ - const char* Attribute( const char* name, int* i ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an double, - the double value will be put in the return 'd', if 'd' - is non-null. - */ - const char* Attribute( const char* name, double* d ) const; - - /** QueryIntAttribute examines the attribute - it is an alternative to the - Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. If the attribute - does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ - int QueryIntAttribute( const char* name, int* _value ) const; - /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute(). - int QueryUnsignedAttribute( const char* name, unsigned* _value ) const; - /** QueryBoolAttribute examines the attribute - see QueryIntAttribute(). - Note that '1', 'true', or 'yes' are considered true, while '0', 'false' - and 'no' are considered false. - */ - int QueryBoolAttribute( const char* name, bool* _value ) const; - /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). - int QueryDoubleAttribute( const char* name, double* _value ) const; - /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). - int QueryFloatAttribute( const char* name, float* _value ) const { - double d; - int result = QueryDoubleAttribute( name, &d ); - if ( result == TIXML_SUCCESS ) { - *_value = (float)d; - } - return result; - } - - #ifdef TIXML_USE_STL - /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). - int QueryStringAttribute( const char* name, std::string* _value ) const { - const char* cstr = Attribute( name ); - if ( cstr ) { - *_value = std::string( cstr ); - return TIXML_SUCCESS; - } - return TIXML_NO_ATTRIBUTE; - } - - /** Template form of the attribute query which will try to read the - attribute into the specified type. Very easy, very powerful, but - be careful to make sure to call this with the correct type. - - NOTE: This method doesn't work correctly for 'string' types that contain spaces. - - @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE - */ - template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - std::stringstream sstream( node->ValueStr() ); - sstream >> *outValue; - if ( !sstream.fail() ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; - } - - int QueryValueAttribute( const std::string& name, std::string* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - *outValue = node->ValueStr(); - return TIXML_SUCCESS; - } - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, const char * _value ); - - #ifdef TIXML_USE_STL - const std::string* Attribute( const std::string& name ) const; - const std::string* Attribute( const std::string& name, int* i ) const; - const std::string* Attribute( const std::string& name, double* d ) const; - int QueryIntAttribute( const std::string& name, int* _value ) const; - int QueryDoubleAttribute( const std::string& name, double* _value ) const; - - /// STL std::string form. - void SetAttribute( const std::string& name, const std::string& _value ); - ///< STL std::string form. - void SetAttribute( const std::string& name, int _value ); - ///< STL std::string form. - void SetDoubleAttribute( const std::string& name, double value ); - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char * name, int value ); - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetDoubleAttribute( const char * name, double value ); - - /** Deletes an attribute with the given name. - */ - void RemoveAttribute( const char * name ); - #ifdef TIXML_USE_STL - void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. - #endif - - const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. - TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } - const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. - TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the TiXmlText child - and accessing it directly. - - If the first child of 'this' is a TiXmlText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are - safe type casts on the referenced node. - */ - const char* GetText() const; - - /// Creates a new Element and returns it - the returned element is a copy. - virtual TiXmlNode* Clone() const; - // Print the Element to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: next char past '<' - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - - void CopyTo( TiXmlElement* target ) const; - void ClearThis(); // like clear, but initializes 'this' object as well - - // Used to be public [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - /* [internal use] - Reads the "value" of the element -- another element, or text. - This should terminate with the current end tag. - */ - const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - -private: - TiXmlAttributeSet attributeSet; -}; - - -/** An XML comment. -*/ -class TiXmlComment : public TiXmlNode -{ -public: - /// Constructs an empty comment. - TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} - /// Construct a comment from text. - TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { - SetValue( _value ); - } - TiXmlComment( const TiXmlComment& ); - TiXmlComment& operator=( const TiXmlComment& base ); - - virtual ~TiXmlComment() {} - - /// Returns a copy of this Comment. - virtual TiXmlNode* Clone() const; - // Write this Comment to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: at the ! of the !-- - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlComment* target ) const; - - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif -// virtual void StreamOut( TIXML_OSTREAM * out ) const; - -private: - -}; - - -/** XML text. A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCDATA() and query it with CDATA(). -*/ -class TiXmlText : public TiXmlNode -{ - friend class TiXmlElement; -public: - /** Constructor for text element. By default, it is treated as - normal, encoded text. If you want it be output as a CDATA text - element, set the parameter _cdata to 'true' - */ - TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - virtual ~TiXmlText() {} - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - #endif - - TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } - TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; } - - // Write this text object to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /// Queries whether this represents text using a CDATA section. - bool CDATA() const { return cdata; } - /// Turns on or off a CDATA representation of text. - void SetCDATA( bool _cdata ) { cdata = _cdata; } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - /// [internal use] Creates a new Element and returns it. - virtual TiXmlNode* Clone() const; - void CopyTo( TiXmlText* target ) const; - - bool Blank() const; // returns true if all white space and new lines - // [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - bool cdata; // true if this should be input and output as a CDATA style text element -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXml will happily read or write files without a declaration, - however. There are 3 possible attributes to the declaration: - version, encoding, and standalone. - - Note: In this version of the code, the attributes are - handled as special cases, not generic attributes, simply - because there can only be at most 3 and they are always the same. -*/ -class TiXmlDeclaration : public TiXmlNode -{ -public: - /// Construct an empty declaration. - TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ); -#endif - - /// Construct. - TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ); - - TiXmlDeclaration( const TiXmlDeclaration& copy ); - TiXmlDeclaration& operator=( const TiXmlDeclaration& copy ); - - virtual ~TiXmlDeclaration() {} - - /// Version. Will return an empty string if none was found. - const char *Version() const { return version.c_str (); } - /// Encoding. Will return an empty string if none was found. - const char *Encoding() const { return encoding.c_str (); } - /// Is this a standalone document? - const char *Standalone() const { return standalone.c_str (); } - - /// Creates a copy of this Declaration and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlDeclaration* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - - TIXML_STRING version; - TIXML_STRING encoding; - TIXML_STRING standalone; -}; - - -/** Any tag that tinyXml doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into TiXmlUnknowns. -*/ -class TiXmlUnknown : public TiXmlNode -{ -public: - TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} - virtual ~TiXmlUnknown() {} - - TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } - TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; } - - /// Creates a copy of this Unknown and returns it. - virtual TiXmlNode* Clone() const; - // Print this Unknown to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected: - void CopyTo( TiXmlUnknown* target ) const; - - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - -}; - - -/** Always the top level node. A document binds together all the - XML pieces. It can be saved, loaded, and printed to the screen. - The 'value' of a document node is the xml file name. -*/ -class TiXmlDocument : public TiXmlNode -{ -public: - /// Create an empty document, that has no name. - TiXmlDocument(); - /// Create a document with a name. The name of the document is also the filename of the xml. - TiXmlDocument( const char * documentName ); - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDocument( const std::string& documentName ); - #endif - - TiXmlDocument( const TiXmlDocument& copy ); - TiXmlDocument& operator=( const TiXmlDocument& copy ); - - virtual ~TiXmlDocument() {} - - /** Load a file using the current document value. - Returns true if successful. Will delete any existing - document data before loading. - */ - bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the current document value. Returns true if successful. - bool SaveFile() const; - /// Load a file using the given filename. Returns true if successful. - bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given filename. Returns true if successful. - bool SaveFile( const char * filename ) const; - /** Load a file using the given FILE*. Returns true if successful. Note that this method - doesn't stream - the entire object pointed at by the FILE* - will be interpreted as an XML file. TinyXML doesn't stream in XML from the current - file location. Streaming may be added in the future. - */ - bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given FILE*. Returns true if successful. - bool SaveFile( FILE* ) const; - - #ifdef TIXML_USE_STL - bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. - { - return LoadFile( filename.c_str(), encoding ); - } - bool SaveFile( const std::string& filename ) const ///< STL std::string version. - { - return SaveFile( filename.c_str() ); - } - #endif - - /** Parse the given null terminated block of xml data. Passing in an encoding to this - method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml - to use that encoding, regardless of what TinyXml might otherwise try to detect. - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** Get the root element -- the only top level element -- of the document. - In well formed XML, there should only be one. TinyXml is tolerant of - multiple elements at the document level. - */ - const TiXmlElement* RootElement() const { return FirstChildElement(); } - TiXmlElement* RootElement() { return FirstChildElement(); } - - /** If an error occurs, Error will be set to true. Also, - - The ErrorId() will contain the integer identifier of the error (not generally useful) - - The ErrorDesc() method will return the name of the error. (very useful) - - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ - bool Error() const { return error; } - - /// Contains a textual (english) description of the error if one occurs. - const char * ErrorDesc() const { return errorDesc.c_str (); } - - /** Generally, you probably want the error string ( ErrorDesc() ). But if you - prefer the ErrorId, this function will fetch it. - */ - int ErrorId() const { return errorId; } - - /** Returns the location (if known) of the error. The first column is column 1, - and the first row is row 1. A value of 0 means the row and column wasn't applicable - (memory errors, for example, have no row/column) or the parser lost the error. (An - error in the error reporting, in that case.) - - @sa SetTabSize, Row, Column - */ - int ErrorRow() const { return errorLocation.row+1; } - int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() - - /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) - to report the correct values for row and column. It does not change the output - or input in any way. - - By calling this method, with a tab size - greater than 0, the row and column of each node and attribute is stored - when the file is loaded. Very useful for tracking the DOM back in to - the source file. - - The tab size is required for calculating the location of nodes. If not - set, the default of 4 is used. The tabsize is set per document. Setting - the tabsize to 0 disables row/column tracking. - - Note that row and column tracking is not supported when using operator>>. - - The tab size needs to be enabled before the parse or load. Correct usage: - @verbatim - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Load( "myfile.xml" ); - @endverbatim - - @sa Row, Column - */ - void SetTabSize( int _tabsize ) { tabsize = _tabsize; } - - int TabSize() const { return tabsize; } - - /** If you have handled the error, it can be reset with this call. The error - state is automatically cleared if you Parse a new XML block. - */ - void ClearError() { error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; - } - - /** Write the document to standard out using formatted printing ("pretty print"). */ - void Print() const { Print( stdout, 0 ); } - - /* Write the document to a string using formatted printing ("pretty print"). This - will allocate a character array (new char[]) and return it as a pointer. The - calling code pust call delete[] on the return char* to avoid a memory leak. - */ - //char* PrintToMemory() const; - - /// Print this Document to a FILE stream. - virtual void Print( FILE* cfile, int depth = 0 ) const; - // [internal use] - void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - - virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - // [internal use] - virtual TiXmlNode* Clone() const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - void CopyTo( TiXmlDocument* target ) const; - - bool error; - int errorId; - TIXML_STRING errorDesc; - int tabsize; - TiXmlCursor errorLocation; - bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. -}; - - -/** - A TiXmlHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - TiXmlElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - TiXmlElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - TiXmlElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - TiXmlElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - TiXmlHandle docHandle( &document ); - TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - TiXmlHandle handleCopy = handle; - @endverbatim - - What they should not be used for is iteration: - - @verbatim - int i=0; - while ( true ) - { - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); - if ( !child ) - break; - // do something - ++i; - } - @endverbatim - - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs - to. Instead, prefer: - - @verbatim - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); - - for( child; child; child=child->NextSiblingElement() ) - { - // do something - } - @endverbatim -*/ -class TiXmlHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } - /// Copy constructor - TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } - TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; } - - /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; - /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild( const char * value ) const; - /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; - /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement( const char * value ) const; - - /** Return a handle to the "index" child with the given name. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( int index ) const; - - #ifdef TIXML_USE_STL - TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } - TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } - - TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } - TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } - #endif - - /** Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* ToNode() const { return node; } - /** Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } - /** Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } - /** Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } - - /** @deprecated use ToNode. - Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* Node() const { return ToNode(); } - /** @deprecated use ToElement. - Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* Element() const { return ToElement(); } - /** @deprecated use ToText() - Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* Text() const { return ToText(); } - /** @deprecated use ToUnknown() - Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* Unknown() const { return ToUnknown(); } - -private: - TiXmlNode* node; -}; - - -/** Print to memory functionality. The TiXmlPrinter is useful when you need to: - - -# Print to memory (especially in non-STL mode) - -# Control formatting (line endings, etc.) - - When constructed, the TiXmlPrinter is in its default "pretty printing" mode. - Before calling Accept() you can call methods to control the printing - of the XML document. After TiXmlNode::Accept() is called, the printed document can - be accessed via the CStr(), Str(), and Size() methods. - - TiXmlPrinter uses the Visitor API. - @verbatim - TiXmlPrinter printer; - printer.SetIndent( "\t" ); - - doc.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - @endverbatim -*/ -class TiXmlPrinter : public TiXmlVisitor -{ -public: - TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), - buffer(), indent( " " ), lineBreak( "\n" ) {} - - virtual bool VisitEnter( const TiXmlDocument& doc ); - virtual bool VisitExit( const TiXmlDocument& doc ); - - virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); - virtual bool VisitExit( const TiXmlElement& element ); - - virtual bool Visit( const TiXmlDeclaration& declaration ); - virtual bool Visit( const TiXmlText& text ); - virtual bool Visit( const TiXmlComment& comment ); - virtual bool Visit( const TiXmlUnknown& unknown ); - - /** Set the indent characters for printing. By default 4 spaces - but tab (\t) is also useful, or null/empty string for no indentation. - */ - void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } - /// Query the indention string. - const char* Indent() { return indent.c_str(); } - /** Set the line breaking string. By default set to newline (\n). - Some operating systems prefer other characters, or can be - set to the null/empty string for no indenation. - */ - void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } - /// Query the current line breaking string. - const char* LineBreak() { return lineBreak.c_str(); } - - /** Switch over to "stream printing" which is the most dense formatting without - linebreaks. Common when the XML is needed for network transmission. - */ - void SetStreamPrinting() { indent = ""; - lineBreak = ""; - } - /// Return the result. - const char* CStr() { return buffer.c_str(); } - /// Return the length of the result string. - size_t Size() { return buffer.size(); } - - #ifdef TIXML_USE_STL - /// Return the result. - const std::string& Str() { return buffer; } - #endif - -private: - void DoIndent() { - for( int i=0; i -#include - -#include "tinyxml.h" - -//#define DEBUG_PARSER -#if defined( DEBUG_PARSER ) -# if defined( DEBUG ) && defined( _MSC_VER ) -# include -# define TIXML_LOG OutputDebugString -# else -# define TIXML_LOG printf -# endif -#endif - -// Note tha "PutString" hardcodes the same list. This -// is less flexible than it appears. Changing the entries -// or order will break putstring. -TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = -{ - { "&", 5, '&' }, - { "<", 4, '<' }, - { ">", 4, '>' }, - { """, 6, '\"' }, - { "'", 6, '\'' } -}; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// Including the basic of this table, which determines the #bytes in the -// sequence from the lead byte. 1 placed for invalid sequences -- -// although the result will be junk, pass it through as much as possible. -// Beware of the non-characters in UTF-8: -// ef bb bf (Microsoft "lead bytes") -// ef bf be -// ef bf bf - -const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - -const int TiXmlBase::utf8ByteTable[256] = -{ - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid -}; - - -void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) - *length = 1; - else if ( input < 0x800 ) - *length = 2; - else if ( input < 0x10000 ) - *length = 3; - else if ( input < 0x200000 ) - *length = 4; - else - { *length = 0; return; } // This code won't covert this correctly anyway. - - output += *length; - - // Scary scary fall throughs. - switch (*length) - { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - } -} - - -/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalpha( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalpha( anyByte ); -// } -} - - -/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalnum( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalnum( anyByte ); -// } -} - - -class TiXmlParsingData -{ - friend class TiXmlDocument; - public: - void Stamp( const char* now, TiXmlEncoding encoding ); - - const TiXmlCursor& Cursor() const { return cursor; } - - private: - // Only used by the document! - TiXmlParsingData( const char* start, int _tabsize, int row, int col ) - { - assert( start ); - stamp = start; - tabsize = _tabsize; - cursor.row = row; - cursor.col = col; - } - - TiXmlCursor cursor; - const char* stamp; - int tabsize; -}; - - -void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) -{ - assert( now ); - - // Do nothing if the tabsize is 0. - if ( tabsize < 1 ) - { - return; - } - - // Get the current row, column. - int row = cursor.row; - int col = cursor.col; - const char* p = stamp; - assert( p ); - - while ( p < now ) - { - // Treat p as unsigned, so we have a happy compiler. - const unsigned char* pU = (const unsigned char*)p; - - // Code contributed by Fletcher Dunn: (modified by lee) - switch (*pU) { - case 0: - // We *should* never get here, but in case we do, don't - // advance past the terminating null character, ever - return; - - case '\r': - // bump down to the next line - ++row; - col = 0; - // Eat the character - ++p; - - // Check for \r\n sequence, and treat this as a single character - if (*p == '\n') { - ++p; - } - break; - - case '\n': - // bump down to the next line - ++row; - col = 0; - - // Eat the character - ++p; - - // Check for \n\r sequence, and treat this as a single - // character. (Yes, this bizarre thing does occur still - // on some arcane platforms...) - if (*p == '\r') { - ++p; - } - break; - - case '\t': - // Eat the character - ++p; - - // Skip to next tab stop - col = (col / tabsize + 1) * tabsize; - break; - - case TIXML_UTF_LEAD_0: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( *(p+1) && *(p+2) ) - { - // In these cases, don't advance the column. These are - // 0-width spaces. - if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; - else - { p +=3; ++col; } // A normal character. - } - } - else - { - ++p; - ++col; - } - break; - - default: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // Eat the 1 to 4 byte utf8 character. - int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; - if ( step == 0 ) - step = 1; // Error case from bad encoding, but handle gracefully. - p += step; - - // Just advance one column, of course. - ++col; - } - else - { - ++p; - ++col; - } - break; - } - } - cursor.row = row; - cursor.col = col; - assert( cursor.row >= -1 ); - assert( cursor.col >= -1 ); - stamp = p; - assert( stamp ); -} - - -const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) -{ - if ( !p || !*p ) - { - return 0; - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - while ( *p ) - { - const unsigned char* pU = (const unsigned char*)p; - - // Skip the stupid Microsoft UTF-8 Byte order marks - if ( *(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==TIXML_UTF_LEAD_1 - && *(pU+2)==TIXML_UTF_LEAD_2 ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbeU ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbfU ) - { - p += 3; - continue; - } - - if ( IsWhiteSpace( *p ) ) // Still using old rules for white space. - ++p; - else - break; - } - } - else - { - while ( *p && IsWhiteSpace( *p ) ) - ++p; - } - - return p; -} - -#ifdef TIXML_USE_STL -/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) -{ - for( ;; ) - { - if ( !in->good() ) return false; - - int c = in->peek(); - // At this scope, we can't get to a document. So fail silently. - if ( !IsWhiteSpace( c ) || c <= 0 ) - return true; - - *tag += (char) in->get(); - } -} - -/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) -{ - //assert( character > 0 && character < 128 ); // else it won't work in utf-8 - while ( in->good() ) - { - int c = in->peek(); - if ( c == character ) - return true; - if ( c <= 0 ) // Silent failure: can't get document at this scope - return false; - - in->get(); - *tag += (char) c; - } - return false; -} -#endif - -// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The -// "assign" optimization removes over 10% of the execution time. -// -const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding ) -{ - // Oddly, not supported on some comilers, - //name->clear(); - // So use this: - *name = ""; - assert( p ); - - // Names start with letters or underscores. - // Of course, in unicode, tinyxml has no idea what a letter *is*. The - // algorithm is generous. - // - // After that, they can be letters, underscores, numbers, - // hyphens, or colons. (Colons are valid ony for namespaces, - // but tinyxml can't tell namespaces from names.) - if ( p && *p - && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) - { - const char* start = p; - while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) - || *p == '_' - || *p == '-' - || *p == '.' - || *p == ':' ) ) - { - //(*name) += *p; // expensive - ++p; - } - if ( p-start > 0 ) { - name->assign( start, p-start ); - } - return p; - } - return 0; -} - -const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) -{ - // Presume an entity, and pull it out. - TIXML_STRING ent; - int i; - *length = 0; - - if ( *(p+1) && *(p+1) == '#' && *(p+2) ) - { - unsigned long ucs = 0; - ptrdiff_t delta = 0; - unsigned mult = 1; - - if ( *(p+2) == 'x' ) - { - // Hexadecimal. - if ( !*(p+3) ) return 0; - - const char* q = p+3; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != 'x' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else if ( *q >= 'a' && *q <= 'f' ) - ucs += mult * (*q - 'a' + 10); - else if ( *q >= 'A' && *q <= 'F' ) - ucs += mult * (*q - 'A' + 10 ); - else - return 0; - mult *= 16; - --q; - } - } - else - { - // Decimal. - if ( !*(p+2) ) return 0; - - const char* q = p+2; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != '#' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else - return 0; - mult *= 10; - --q; - } - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - } - else - { - *value = (char)ucs; - *length = 1; - } - return p + delta + 1; - } - - // Now try to match it. - for( i=0; iappend( cArr, len ); - } - } - else - { - bool whitespace = false; - - // Remove leading white space: - p = SkipWhiteSpace( p, encoding ); - while ( p && *p - && !StringEqual( p, endTag, caseInsensitive, encoding ) ) - { - if ( *p == '\r' || *p == '\n' ) - { - whitespace = true; - ++p; - } - else if ( IsWhiteSpace( *p ) ) - { - whitespace = true; - ++p; - } - else - { - // If we've found whitespace, add it before the - // new character. Any whitespace just becomes a space. - if ( whitespace ) - { - (*text) += ' '; - whitespace = false; - } - int len; - char cArr[4] = { 0, 0, 0, 0 }; - p = GetChar( p, cArr, &len, encoding ); - if ( len == 1 ) - (*text) += cArr[0]; // more efficient - else - text->append( cArr, len ); - } - } - } - if ( p && *p ) - p += strlen( endTag ); - return ( p && *p ) ? p : 0; -} - -#ifdef TIXML_USE_STL - -void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - // The basic issue with a document is that we don't know what we're - // streaming. Read something presumed to be a tag (and hope), then - // identify it, and call the appropriate stream method on the tag. - // - // This "pre-streaming" will never read the closing ">" so the - // sub-tag can orient itself. - - if ( !StreamTo( in, '<', tag ) ) - { - SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - while ( in->good() ) - { - int tagIndex = (int) tag->length(); - while ( in->good() && in->peek() != '>' ) - { - int c = in->get(); - if ( c <= 0 ) - { - SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - break; - } - (*tag) += (char) c; - } - - if ( in->good() ) - { - // We now have something we presume to be a node of - // some sort. Identify it, and call the node to - // continue streaming. - TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); - - if ( node ) - { - node->StreamIn( in, tag ); - bool isElement = node->ToElement() != 0; - delete node; - node = 0; - - // If this is the root element, we're done. Parsing will be - // done by the >> operator. - if ( isElement ) - { - return; - } - } - else - { - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - } - } - // We should have returned sooner. - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); -} - -#endif - -const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) -{ - ClearError(); - - // Parse away, at the document level. Since a document - // contains nothing but other tags, most of what happens - // here is skipping white space. - if ( !p || !*p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - // Note that, for a document, this needs to come - // before the while space skip, so that parsing - // starts from the pointer we are given. - location.Clear(); - if ( prevData ) - { - location.row = prevData->cursor.row; - location.col = prevData->cursor.col; - } - else - { - location.row = 0; - location.col = 0; - } - TiXmlParsingData data( p, TabSize(), location.row, location.col ); - location = data.Cursor(); - - if ( encoding == TIXML_ENCODING_UNKNOWN ) - { - // Check for the Microsoft UTF-8 lead bytes. - const unsigned char* pU = (const unsigned char*)p; - if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 - && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 - && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) - { - encoding = TIXML_ENCODING_UTF8; - useMicrosoftBOM = true; - } - } - - p = SkipWhiteSpace( p, encoding ); - if ( !p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - while ( p && *p ) - { - TiXmlNode* node = Identify( p, encoding ); - if ( node ) - { - p = node->Parse( p, &data, encoding ); - LinkEndChild( node ); - } - else - { - break; - } - - // Did we get encoding info? - if ( encoding == TIXML_ENCODING_UNKNOWN - && node->ToDeclaration() ) - { - TiXmlDeclaration* dec = node->ToDeclaration(); - const char* enc = dec->Encoding(); - assert( enc ); - - if ( *enc == 0 ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - else - encoding = TIXML_ENCODING_LEGACY; - } - - p = SkipWhiteSpace( p, encoding ); - } - - // Was this empty? - if ( !firstChild ) { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); - return 0; - } - - // All is well. - return p; -} - -void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - // The first error in a chain is more accurate - don't set again! - if ( error ) - return; - - assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); - error = true; - errorId = err; - errorDesc = errorString[ errorId ]; - - errorLocation.Clear(); - if ( pError && data ) - { - data->Stamp( pError, encoding ); - errorLocation = data->Cursor(); - } -} - - -TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) -{ - TiXmlNode* returnNode = 0; - - p = SkipWhiteSpace( p, encoding ); - if( !p || !*p || *p != '<' ) - { - return 0; - } - - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p ) - { - return 0; - } - - // What is this thing? - // - Elements start with a letter or underscore, but xml is reserved. - // - Comments: "; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // [ 1475201 ] TinyXML parses entities in comments - // Oops - ReadText doesn't work, because we don't want to parse the entities. - // p = ReadText( p, &value, false, endTag, false, encoding ); - // - // from the XML spec: - /* - [Definition: Comments may appear anywhere in a document outside other markup; in addition, - they may appear within the document type declaration at places allowed by the grammar. - They are not part of the document's character data; an XML processor MAY, but need not, - make it possible for an application to retrieve the text of comments. For compatibility, - the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity - references MUST NOT be recognized within comments. - - An example of a comment: - - - */ - - value = ""; - // Keep all the white space. - while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) - { - value.append( p, 1 ); - ++p; - } - if ( p && *p ) - p += strlen( endTag ); - - return p; -} - - -const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) return 0; - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - // Read the name, the '=' and the value. - const char* pErr = p; - p = ReadName( p, &name, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); - return 0; - } - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p || *p != '=' ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - ++p; // skip '=' - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - const char* end; - const char SINGLE_QUOTE = '\''; - const char DOUBLE_QUOTE = '\"'; - - if ( *p == SINGLE_QUOTE ) - { - ++p; - end = "\'"; // single quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else if ( *p == DOUBLE_QUOTE ) - { - ++p; - end = "\""; // double quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else - { - // All attribute values should be in single or double quotes. - // But this is such a common error that the parser will try - // its best, even without them. - value = ""; - while ( p && *p // existence - && !IsWhiteSpace( *p ) // whitespace - && *p != '/' && *p != '>' ) // tag end - { - if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { - // [ 1451649 ] Attribute values with trailing quotes not handled correctly - // We did not have an opening quote but seem to have a - // closing one. Give up and throw an error. - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - value += *p; - ++p; - } - } - return p; -} - -#ifdef TIXML_USE_STL -void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->peek(); - if ( !cdata && (c == '<' ) ) - { - return; - } - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - (*tag) += (char) c; - in->get(); // "commits" the peek made above - - if ( cdata && c == '>' && tag->size() >= 3 ) { - size_t len = tag->size(); - if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { - // terminator of cdata. - return; - } - } - } -} -#endif - -const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - value = ""; - TiXmlDocument* document = GetDocument(); - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - - const char* const startTag = ""; - - if ( cdata || StringEqual( p, startTag, false, encoding ) ) - { - cdata = true; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // Keep all the white space, ignore the encoding, etc. - while ( p && *p - && !StringEqual( p, endTag, false, encoding ) - ) - { - value += *p; - ++p; - } - - TIXML_STRING dummy; - p = ReadText( p, &dummy, false, endTag, false, encoding ); - return p; - } - else - { - bool ignoreWhite = true; - - const char* end = "<"; - p = ReadText( p, &value, ignoreWhite, end, false, encoding ); - if ( p && *p ) - return p-1; // don't truncate the '<' - return 0; - } -} - -#ifdef TIXML_USE_STL -void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c; - - if ( c == '>' ) - { - // All is well. - return; - } - } -} -#endif - -const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) -{ - p = SkipWhiteSpace( p, _encoding ); - // Find the beginning, find the end, and look for - // the stuff in-between. - TiXmlDocument* document = GetDocument(); - if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); - return 0; - } - if ( data ) - { - data->Stamp( p, _encoding ); - location = data->Cursor(); - } - p += 5; - - version = ""; - encoding = ""; - standalone = ""; - - while ( p && *p ) - { - if ( *p == '>' ) - { - ++p; - return p; - } - - p = SkipWhiteSpace( p, _encoding ); - if ( StringEqual( p, "version", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - version = attrib.Value(); - } - else if ( StringEqual( p, "encoding", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - encoding = attrib.Value(); - } - else if ( StringEqual( p, "standalone", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - standalone = attrib.Value(); - } - else - { - // Read over whatever it is. - while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) - ++p; - } - } - return 0; -} - -bool TiXmlText::Blank() const -{ - for ( unsigned i=0; i +#include +#include +#pragma comment(lib,"ws2_32.lib") + +#else +#include +#include +#include +#include +#include +#include +#include +#endif +#include #include #include #include +#include using namespace std; @@ -14,830 +30,854 @@ using namespace std; #define MAX_RANDOM_PACKET 5*1024 -//ַ滻 -inline void string_replace( string&s1,const string&s2,const string&s3 ) -{ - string::size_type pos = 0; - string::size_type a = s2.size(); - string::size_type b = s3.size(); - while((pos=s1.find(s2,pos))!=string::npos) - { - s1.replace(pos,a,s3); - pos += b; - } +//字符串替换函数 +inline void string_replace( string& s1,const string& s2,const string& s3 ) +{ + string::size_type pos = 0; + string::size_type a = s2.size(); + string::size_type b = s3.size(); + + while((pos=s1.find(s2,pos))!=string::npos) + { + s1.replace(pos,a,s3); + pos += b; + } } -//ݰϢ +//随机数据包信息 struct _RandomPacketInfo { - char szPacket[MAX_RANDOM_PACKET]; //ݰ - int nLen; //ݰ - int nType; //ͣĬıı12 - int nRecdvLength; //ַij - - _RandomPacketInfo() - { - szPacket[0] = '\0'; - nLen = 0; - nType = 1; - nRecdvLength = 0; - } + char szPacket[MAX_RANDOM_PACKET]; //保存随机数据包 + int nLen; //随机数据包长度 + int nType; //数据类型,默认是文本,文本1,二进制2 + int nRecdvLength; //接收字符串的长度 + + _RandomPacketInfo() + { + szPacket[0] = '\0'; + nLen = 0; + nType = 1; + nRecdvLength = 0; + } }; -//ݰ +//保存随机数据包序列 typedef vector<_RandomPacketInfo> vecRandomPacketInfo; -//һ +//设置一个随机种子 inline void InitRandom() { - srand((int)time(NULL)); + srand((int)time(NULL)); }; -//һֵлȡһֵ +//从一个值域中获取一个随机值 inline int RandomValue(int nMin, int nMax) { - return nMin + (int) ((nMax - nMin) * (rand() / (RAND_MAX + 1.0))); + return nMin + (int) ((nMax - nMin) * (rand() / (RAND_MAX + 1.0))); }; -//WebSocket㷨 +//WebSocket加密算法 inline void WebSocketSendData(const char* pData, int nLen, char* pSendData, int& nSendLen) { - //Ŀǰֻ֧С64Kݰ - char szMark[4] = {'\0'}; - int nPos = 0; - - if(nSendLen < nLen + 8) - { - //峤Ȳ - return; - } - - if(nLen <= 125) - { - pSendData[nPos] = -127; - nPos++; - - //ֳ - pSendData[nPos] = (char)(nLen & 0x7F); - nPos++; - - //4ֽڵmark - memcpy_s((char* )szMark, 4, &nLen, 4); - memcpy_s((char* )&pSendData[nPos], 4, szMark, 4); - nPos += 4; - - //λ - for(int i = 0; i < nLen; i++) - { - char szTemp = pData[i] ^ (szMark[i % 4]); - pSendData[nPos] = szTemp; - nPos++; - } - } - else - { - pSendData[nPos] = -127; - nPos++; - - //ֳ - pSendData[nPos] = 126; - nPos++; - - //ʵʳȡ65535 - //ת - short sDataLen = htons((short)nLen); - memcpy_s((char* )&pSendData[nPos], 2, (char* )&sDataLen, 2); - nPos += 2; - - //4ֽڵmark - memcpy_s((char* )szMark, 4, &nLen, 4); - memcpy_s((char* )&pSendData[nPos], 4, szMark, 4); - nPos += 4; - - //λ - for(int i = 0; i < nLen; i++) - { - char szTemp = pData[i] ^ (szMark[i % 4]); - pSendData[nPos] = szTemp; - nPos++; - } - } - - - nSendLen = nPos; + //目前这个函数只支持小于64K的数据包 + char szMark[4] = {'\0'}; + int nPos = 0; + + if(nSendLen < nLen + 8) + { + //缓冲长度不够 + return; + } + + if(nLen <= 125) + { + pSendData[nPos] = -127; + nPos++; + + //发送数字长度 + pSendData[nPos] = (char)(nLen & 0x7F); + nPos++; + + //4字节的mark + memcpy((char* )szMark, &nLen, 4); + memcpy((char* )&pSendData[nPos], szMark, 4); + nPos += 4; + + //按位加密 + for(int i = 0; i < nLen; i++) + { + char szTemp = pData[i] ^ (szMark[i % 4]); + pSendData[nPos] = szTemp; + nPos++; + } + } + else + { + pSendData[nPos] = -127; + nPos++; + + //发送数字长度 + pSendData[nPos] = 126; + nPos++; + + //数据实际长度。最大65535 + //转换成网络字序 + // u_short sDataLen = ::htons((u_short)nLen); + u_short sDataLen = 10; + memcpy((char* )&pSendData[nPos], (char* )&sDataLen, 2); + nPos += 2; + + //4字节的mark + memcpy((char* )szMark, &nLen, 4); + memcpy((char* )&pSendData[nPos], szMark, 4); + nPos += 4; + + //按位加密 + for(int i = 0; i < nLen; i++) + { + char szTemp = pData[i] ^ (szMark[i % 4]); + pSendData[nPos] = szTemp; + nPos++; + } + } + + + nSendLen = nPos; } -// +//类型 enum ENUM_TYPE_PROTOCOL { - ENUM_PROTOCOL_TCP = 0, - ENUM_PROTOCOL_UDP, - ENUM_PROTOCOL_WEBSOCKET, + ENUM_PROTOCOL_TCP = 0, + ENUM_PROTOCOL_UDP, + ENUM_PROTOCOL_WEBSOCKET, }; -//ƺַ໥ת +//二进制和字符串相互转换类 class CConvertBuffer { public: - CConvertBuffer() {}; - ~CConvertBuffer() {}; - int GetBufferSize(const char* pData, int nSrcLen) - { - char szData[3] = {'\0'}; - int nPos = 0; - int nCurrSize = 0; - int nConvertSize = 0; - bool blState = false; //תַǷЧ - bool blSrcState = true; //ԪַǷЧ - unsigned char cData; - - while(nPos < nSrcLen) - { - if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) - { - if(nPos == nSrcLen - 1) - { - szData[nCurrSize++] = pData[nPos]; - } - - szData[nCurrSize] = '\0'; - if(blSrcState == true) - { - blState = ConvertStr2char(szData, cData); - if(blState == true) - { - nConvertSize++; - } - } - nCurrSize = 0; - blSrcState = true; - nPos++; - } - else - { - if(nCurrSize < 2) - { - szData[nCurrSize++] = pData[nPos]; - } - else - { - blSrcState = false; - } - nPos++; - } - } - - return nConvertSize; - }; - - bool Convertstr2charArray(const char* pData, int nSrcLen, unsigned char* pDes, int& nMaxLen) - { - char szData[3] = {'\0'}; - int nPos = 0; - int nCurrSize = 0; - int nConvertSize = 0; - bool blState = false; //תַǷЧ - bool blSrcState = true; //ԪַǷЧ - - while(nPos < nSrcLen) - { - if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) - { - if(nPos == nSrcLen - 1) - { - szData[nCurrSize++] = pData[nPos]; - } - - szData[nCurrSize] = '\0'; - if(nConvertSize < nMaxLen && blSrcState == true) - { - blState = ConvertStr2char(szData, pDes[nConvertSize]); - if(blState == true) - { - nConvertSize++; - } - } - nCurrSize = 0; - blSrcState = true; - nPos++; - } - else - { - if(nCurrSize < 2) - { - szData[nCurrSize++] = pData[nPos]; - } - else - { - blSrcState = false; - } - nPos++; - } - } - - nMaxLen = nConvertSize; - return true; - }; + CConvertBuffer() {}; + ~CConvertBuffer() {}; + int GetBufferSize(const char* pData, int nSrcLen) + { + char szData[3] = {'\0'}; + int nPos = 0; + int nCurrSize = 0; + int nConvertSize = 0; + bool blState = false; //转换后的字符串是否有效 + bool blSrcState = true; //元字符串是否有效 + unsigned char cData; + + while(nPos < nSrcLen) + { + if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) + { + if(nPos == nSrcLen - 1) + { + szData[nCurrSize++] = pData[nPos]; + } + + szData[nCurrSize] = '\0'; + + if(blSrcState == true) + { + blState = ConvertStr2char(szData, cData); + + if(blState == true) + { + nConvertSize++; + } + } + + nCurrSize = 0; + blSrcState = true; + nPos++; + } + else + { + if(nCurrSize < 2) + { + szData[nCurrSize++] = pData[nPos]; + } + else + { + blSrcState = false; + } + + nPos++; + } + } + + return nConvertSize; + }; + + bool Convertstr2charArray(const char* pData, int nSrcLen, unsigned char* pDes, int& nMaxLen) + { + char szData[3] = {'\0'}; + int nPos = 0; + int nCurrSize = 0; + int nConvertSize = 0; + bool blState = false; //转换后的字符串是否有效 + bool blSrcState = true; //元字符串是否有效 + + while(nPos < nSrcLen) + { + if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) + { + if(nPos == nSrcLen - 1) + { + szData[nCurrSize++] = pData[nPos]; + } + + szData[nCurrSize] = '\0'; + + if(nConvertSize < nMaxLen && blSrcState == true) + { + blState = ConvertStr2char(szData, pDes[nConvertSize]); + + if(blState == true) + { + nConvertSize++; + } + } + + nCurrSize = 0; + blSrcState = true; + nPos++; + } + else + { + if(nCurrSize < 2) + { + szData[nCurrSize++] = pData[nPos]; + } + else + { + blSrcState = false; + } + + nPos++; + } + } + + nMaxLen = nConvertSize; + return true; + }; private: - bool Get_binary_Char(unsigned char cTag, unsigned char& cDes) - { - if(cTag >='A'&& cTag <='F') - { - cDes = cTag - 'A' + 10; - return true; - } - else if(cTag >='a'&& cTag <='f') - { - cDes = cTag - 'a' + 10; - return true; - } - else if(cTag >= '0'&& cTag<= '9') - { - cDes = cTag-'0'; - return true; - } - else - { - return false; - } - } - - bool ConvertStr2char(const char* pData, unsigned char& cData) - { - if(pData == NULL || strlen(pData) != 2) - { - return false; - } - - char cFirst = pData[1]; - unsigned char cTemp = 0; - bool blStste = Get_binary_Char(cFirst, cTemp); - if(false == blStste) - { - return false; - } - cData = cTemp; - char cSecond = pData[0]; - blStste = Get_binary_Char(cSecond, cTemp); - if(false == blStste) - { - return false; - } - cTemp = cTemp << 4; - cData = cData | cTemp; - - return true; - } + bool Get_binary_Char(unsigned char cTag, unsigned char& cDes) + { + if(cTag >='A'&& cTag <='F') + { + cDes = cTag - 'A' + 10; + return true; + } + else if(cTag >='a'&& cTag <='f') + { + cDes = cTag - 'a' + 10; + return true; + } + else if(cTag >= '0'&& cTag<= '9') + { + cDes = cTag-'0'; + return true; + } + else + { + return false; + } + } + + bool ConvertStr2char(const char* pData, unsigned char& cData) + { + if(pData == NULL || strlen(pData) != 2) + { + return false; + } + + char cFirst = pData[1]; + unsigned char cTemp = 0; + bool blStste = Get_binary_Char(cFirst, cTemp); + + if(false == blStste) + { + return false; + } + + cData = cTemp; + char cSecond = pData[0]; + blStste = Get_binary_Char(cSecond, cTemp); + + if(false == blStste) + { + return false; + } + + cTemp = cTemp << 4; + cData = cData | cTemp; + + return true; + } }; enum EM_DATA_RETURN_STATE { - DATA_RETURN_STATE_SUCCESS = 0, - DATA_RETURN_STATE_ERROR, - DATA_RETURN_STATE_CONTINUE, + DATA_RETURN_STATE_SUCCESS = 0, + DATA_RETURN_STATE_ERROR, + DATA_RETURN_STATE_CONTINUE, }; -//һ࣬ʽݷͺͽյIJ߼ +//声明一个基类,来负责格式化数据发送和接收的部分逻辑 class CBaseDataLogic { public: - CBaseDataLogic() - { - m_blRandomPacket = false; - m_nClassTye = 1; - } - - void ClearRandomPacket() - { - m_vecRandomPacketInfo.clear(); - } - - void DeleteRandomPacket(int nIndex) - { - if(nIndex >= 0 && nIndex < (int)m_vecRandomPacketInfo.size()) - { - int nPos = 0; - //ɾָ - for(vecRandomPacketInfo::iterator b = m_vecRandomPacketInfo.begin();b != m_vecRandomPacketInfo.end(); b++) - { - if(nIndex == nPos) - { - m_vecRandomPacketInfo.erase(b); - break; - } - } - } - } - - //ָ - bool InsertRandomPacket(const char* pData, int nLen, int nRecvLength, int nType) - { - _RandomPacketInfo objRandomPacketInfo; - - if(nLen >= MAX_RANDOM_PACKET || nLen <= 0) - { - return false; - } - - memcpy_s(objRandomPacketInfo.szPacket, nLen, pData, nLen); - objRandomPacketInfo.szPacket[nLen] = '\0'; - objRandomPacketInfo.nLen = nLen; - objRandomPacketInfo.nRecdvLength = nRecvLength; - objRandomPacketInfo.nType = nType; - - m_vecRandomPacketInfo.push_back(objRandomPacketInfo); - - if(m_blRandomPacket == false) - { - m_blRandomPacket = true; - } - - return true; - }; - - //õĸ - int GetRandomPacketCount() - { - return (int)m_vecRandomPacketInfo.size(); - }; - - _RandomPacketInfo* GettRandomPacket(int nIndex) - { - if(nIndex >= (int)m_vecRandomPacketInfo.size() || nIndex < 0) - { - return NULL; - } - else - { - return (_RandomPacketInfo* )&m_vecRandomPacketInfo[nIndex]; - } - }; - - //õݵľϢ - bool GetRandomSend(int nIndex, char* pData, int& nLen, int& nRecvLength) - { - int nPos = nIndex % (int)m_vecRandomPacketInfo.size(); - - _RandomPacketInfo* pRandomPacketInfo = GettRandomPacket(nPos); - if(NULL == pRandomPacketInfo) - { - return false; - } - - if(nLen < pRandomPacketInfo->nLen) - { - return false; - } - - if(pRandomPacketInfo->nType == 1) - { - //ֻıģʽʱ滻 - string strData = (string)pRandomPacketInfo->szPacket; - - ReplaceNumber(strData, (string)"%01d", 1); - ReplaceNumber(strData, (string)"%02d", 2); - ReplaceNumber(strData, (string)"%03d", 3); - ReplaceNumber(strData, (string)"%04d", 4); - - memcpy_s(pData, strData.length(), strData.c_str(), strData.length()); - pData[strData.length()] = '\0'; - nLen = strData.length(); - nRecvLength = pRandomPacketInfo->nRecdvLength; - } - else - { - //жת - CConvertBuffer objConvertBuffer; - - // - objConvertBuffer.Convertstr2charArray(pRandomPacketInfo->szPacket, pRandomPacketInfo->nLen, - (unsigned char*)pData, nLen); - nRecvLength = pRandomPacketInfo->nRecdvLength; - } - - return true; - } - - //ʾԤ - bool GetReview(int nIndex, char* pData, int& nLen, int& nRecvLength) - { - int nPos = nIndex % (int)m_vecRandomPacketInfo.size(); - - _RandomPacketInfo* pRandomPacketInfo = GettRandomPacket(nPos); - if(NULL == pRandomPacketInfo) - { - return false; - } - - if(nLen < pRandomPacketInfo->nLen) - { - return false; - } - - if(pRandomPacketInfo->nType == 1) - { - //ֻıģʽʱ滻 - string strData = (string)pRandomPacketInfo->szPacket; - - ReplaceNumber(strData, (string)"%01d", 1); - ReplaceNumber(strData, (string)"%02d", 2); - ReplaceNumber(strData, (string)"%03d", 3); - ReplaceNumber(strData, (string)"%04d", 4); - - memcpy_s(pData, strData.length(), strData.c_str(), strData.length()); - pData[strData.length()] = '\0'; - nLen = strData.length(); - nRecvLength = pRandomPacketInfo->nRecdvLength; - } - else - { - // - memcpy_s(pData, pRandomPacketInfo->nLen, pRandomPacketInfo->szPacket, pRandomPacketInfo->nLen); - nLen = pRandomPacketInfo->nLen; - nRecvLength = pRandomPacketInfo->nRecdvLength; - } - - return true; - } - - //õǷΪݰ - bool GetRandomType() - { - return m_blRandomPacket; - } - - //ָ - virtual bool InitSendSize(int nSendLen) = 0; - virtual char* GetSendData() = 0; - virtual char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) = 0; - virtual int GetSendLength() = 0; - virtual int GetRecvLength() = 0; - virtual void SetRecvLength(int nRecvLen) = 0; - virtual void SetMaxSendLength(int nMaxLength) = 0; - virtual void SetSendBuff(const char* pData, int nLen) = 0; - virtual EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) = 0; + CBaseDataLogic() + { + m_blRandomPacket = false; + m_nClassTye = 1; + } + + void ClearRandomPacket() + { + m_vecRandomPacketInfo.clear(); + } + + void DeleteRandomPacket(int nIndex) + { + if(nIndex >= 0 && nIndex < (int)m_vecRandomPacketInfo.size()) + { + int nPos = 0; + + //删除指定数据 + for(vecRandomPacketInfo::iterator b = m_vecRandomPacketInfo.begin(); b != m_vecRandomPacketInfo.end(); b++) + { + if(nIndex == nPos) + { + m_vecRandomPacketInfo.erase(b); + break; + } + } + } + } + + //随机包指令集 + bool InsertRandomPacket(const char* pData, int nLen, int nRecvLength, int nType) + { + _RandomPacketInfo objRandomPacketInfo; + + if(nLen >= MAX_RANDOM_PACKET || nLen <= 0) + { + return false; + } + + memcpy(objRandomPacketInfo.szPacket, pData, nLen); + objRandomPacketInfo.szPacket[nLen] = '\0'; + objRandomPacketInfo.nLen = nLen; + objRandomPacketInfo.nRecdvLength = nRecvLength; + objRandomPacketInfo.nType = nType; + + m_vecRandomPacketInfo.push_back(objRandomPacketInfo); + + if(m_blRandomPacket == false) + { + m_blRandomPacket = true; + } + + return true; + }; + + //得到随机命令包的个数 + int GetRandomPacketCount() + { + return (int)m_vecRandomPacketInfo.size(); + }; + + _RandomPacketInfo* GettRandomPacket(int nIndex) + { + if(nIndex >= (int)m_vecRandomPacketInfo.size() || nIndex < 0) + { + return NULL; + } + else + { + return (_RandomPacketInfo* )&m_vecRandomPacketInfo[nIndex]; + } + }; + + //得到发送数据的具体信息 + bool GetRandomSend(int nIndex, char* pData, int& nLen, int& nRecvLength) + { + int nPos = nIndex % (int)m_vecRandomPacketInfo.size(); + + _RandomPacketInfo* pRandomPacketInfo = GettRandomPacket(nPos); + + if(NULL == pRandomPacketInfo) + { + return false; + } + + if(nLen < pRandomPacketInfo->nLen) + { + return false; + } + + if(pRandomPacketInfo->nType == 1) + { + //只有文本模式的是时候进行数字替换 + string strData = (string)pRandomPacketInfo->szPacket; + + ReplaceNumber(strData, (string)"%01d", 1); + ReplaceNumber(strData, (string)"%02d", 2); + ReplaceNumber(strData, (string)"%03d", 3); + ReplaceNumber(strData, (string)"%04d", 4); + + memcpy(pData, strData.c_str(), strData.length()); + pData[strData.length()] = '\0'; + nLen = (int)strData.length(); + nRecvLength = pRandomPacketInfo->nRecdvLength; + } + else + { + //进行二进制转换 + CConvertBuffer objConvertBuffer; + + //存入数据 + objConvertBuffer.Convertstr2charArray(pRandomPacketInfo->szPacket, pRandomPacketInfo->nLen, + (unsigned char*)pData, nLen); + nRecvLength = pRandomPacketInfo->nRecdvLength; + } + + return true; + } + + //显示预览 + bool GetReview(int nIndex, char* pData, int& nLen, int& nRecvLength) + { + int nPos = nIndex % (int)m_vecRandomPacketInfo.size(); + + _RandomPacketInfo* pRandomPacketInfo = GettRandomPacket(nPos); + + if(NULL == pRandomPacketInfo) + { + return false; + } + + if(nLen < pRandomPacketInfo->nLen) + { + return false; + } + + if(pRandomPacketInfo->nType == 1) + { + //只有文本模式的是时候进行数字替换 + string strData = (string)pRandomPacketInfo->szPacket; + + ReplaceNumber(strData, (string)"%01d", 1); + ReplaceNumber(strData, (string)"%02d", 2); + ReplaceNumber(strData, (string)"%03d", 3); + ReplaceNumber(strData, (string)"%04d", 4); + + memcpy(pData, strData.c_str(), strData.length()); + pData[strData.length()] = '\0'; + nLen = (int)strData.length(); + nRecvLength = pRandomPacketInfo->nRecdvLength; + } + else + { + //存入数据 + memcpy(pData, pRandomPacketInfo->szPacket, pRandomPacketInfo->nLen); + nLen = pRandomPacketInfo->nLen; + nRecvLength = pRandomPacketInfo->nRecdvLength; + } + + return true; + } + + //得到是否为随机数据包 + bool GetRandomType() + { + return m_blRandomPacket; + } + + //正常指令集 + virtual bool InitSendSize(int nSendLen) = 0; + virtual char* GetSendData() = 0; + virtual char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) = 0; + virtual int GetSendLength() = 0; + virtual int GetRecvLength() = 0; + virtual void SetRecvLength(int nRecvLen) = 0; + virtual void SetMaxSendLength(int nMaxLength) = 0; + virtual void SetSendBuff(const char* pData, int nLen) = 0; + virtual EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) = 0; private: - void ReplaceNumber(string& strData, string strTag, int nStep) - { - if(nStep == 1) - { - char szNumber[20] = {'\0'}; - int nNumber = RandomValue(0, 9); - sprintf_s(szNumber, 20, "%d", nNumber); - string_replace(strData, strTag, (string)szNumber); - } - else if(nStep == 2) - { - char szNumber[20] = {'\0'}; - int nNumber = RandomValue(0, 99); - sprintf_s(szNumber, 20, "%d", nNumber); - string_replace(strData, strTag, (string)szNumber); - } - else if(nStep == 3) - { - char szNumber[20] = {'\0'}; - int nNumber = RandomValue(0, 999); - sprintf_s(szNumber, 20, "%d", nNumber); - string_replace(strData, strTag, (string)szNumber); - } - else if(nStep == 4) - { - char szNumber[20] = {'\0'}; - int nNumber = RandomValue(0, 9999); - sprintf_s(szNumber, 20, "%d", nNumber); - string_replace(strData, strTag, (string)szNumber); - } - } + void ReplaceNumber(string& strData, string strTag, int nStep) + { + if(nStep == 1) + { + char szNumber[20] = {'\0'}; + int nNumber = RandomValue(0, 9); + sprintf(szNumber, "%d", nNumber); + string_replace(strData, strTag, (string)szNumber); + } + else if(nStep == 2) + { + char szNumber[20] = {'\0'}; + int nNumber = RandomValue(0, 99); + sprintf(szNumber, "%d", nNumber); + string_replace(strData, strTag, (string)szNumber); + } + else if(nStep == 3) + { + char szNumber[20] = {'\0'}; + int nNumber = RandomValue(0, 999); + sprintf(szNumber, "%d", nNumber); + string_replace(strData, strTag, (string)szNumber); + } + else if(nStep == 4) + { + char szNumber[20] = {'\0'}; + int nNumber = RandomValue(0, 9999); + sprintf(szNumber, "%d", nNumber); + string_replace(strData, strTag, (string)szNumber); + } + } private: - bool m_blRandomPacket; //ǷУfalaseΪtrueΪ - vecRandomPacketInfo m_vecRandomPacketInfo; + bool m_blRandomPacket; //是否包含随机包列,falase为不包含,true为包含 + vecRandomPacketInfo m_vecRandomPacketInfo; public: - int m_nClassTye; //1ΪCNomalLogic2ΪWebSocketLogic + int m_nClassTye; //1为CNomalLogic,2为WebSocketLogic }; -//ͨTCPշϢ߼ -//Ϊ˼һЩЭ飬websocketԼhttp -//շݲǵһָ룬һ̳CBaseDataLogic +//普通的TCP收发相关信息处理逻辑 +//为了兼容一些特殊协议,比如websocket以及http +//收发数据不再是单独的一个指针,而是一个继承CBaseDataLogic的类 class CNomalLogic : public CBaseDataLogic { public: - CNomalLogic() - { - m_pSendData = NULL; - m_nSendLen = 0; - m_nRecvLen = 0; - m_nCurrRecvLen = 0; - m_nClassTye = 1; - }; - - ~CNomalLogic() { Close(); }; - - void Close() - { - if(NULL != m_pSendData) - { - delete[] m_pSendData; - m_pSendData = NULL; - } - } - - bool InitSendSize(int nSendLen = MAX_RANDOM_PACKET) - { - Close(); - - m_pSendData = new char[nSendLen]; - m_nSendLen = nSendLen; - - return true; - } - - void SetRecvLength(int nRecvLen) - { - m_nRecvLen = nRecvLen; - } - - void SetMaxSendLength(int nMaxLength) - { - m_nSendLen = nMaxLength; - } - - //طBuff - void SetSendBuff(const char* pData, int nLen) - { - memcpy_s(m_pSendData, nLen, pData, nLen); - m_nSendLen = nLen; - } - - char* GetSendData() - { - return m_pSendData; - } - - char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) - { - if(GetRandomType() == false) - { - //һݰ - nSendDataLen = m_nSendLen; - return m_pSendData; - } - else - { - //˳ݰ - nSendDataLen = MAX_RANDOM_PACKET; - GetRandomSend(nCurrIndex, m_pSendData, nSendDataLen, m_nRecvLen); - return m_pSendData; - } - } - - int GetSendLength() - { - return m_nSendLen; - } - - int GetRecvLength() - { - return m_nRecvLen; - } - - EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) - { - m_nCurrRecvLen += nLen; - if(m_nCurrRecvLen == m_nRecvLen) - { - m_nCurrRecvLen = 0; - //ȫϣȷ - return DATA_RETURN_STATE_SUCCESS; - } - else if(nLen < m_nRecvLen) - { - //ûнȫ - return DATA_RETURN_STATE_CONTINUE; - } - - m_nCurrRecvLen = 0; - return DATA_RETURN_STATE_ERROR; - } + CNomalLogic() + { + m_pSendData = NULL; + m_nSendLen = 0; + m_nRecvLen = 0; + m_nCurrRecvLen = 0; + m_nClassTye = 1; + }; + + ~CNomalLogic() + { + Close(); + }; + + void Close() + { + if(NULL != m_pSendData) + { + delete[] m_pSendData; + m_pSendData = NULL; + } + } + + bool InitSendSize(int nSendLen = MAX_RANDOM_PACKET) + { + Close(); + + m_pSendData = new char[nSendLen]; + m_nSendLen = nSendLen; + + return true; + } + + void SetRecvLength(int nRecvLen) + { + m_nRecvLen = nRecvLen; + } + + void SetMaxSendLength(int nMaxLength) + { + m_nSendLen = nMaxLength; + } + + //设置相关发送Buff + void SetSendBuff(const char* pData, int nLen) + { + memcpy(m_pSendData, pData, nLen); + m_nSendLen = nLen; + } + + char* GetSendData() + { + return m_pSendData; + } + + char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) + { + if(GetRandomType() == false) + { + //单一数据包 + nSendDataLen = m_nSendLen; + return m_pSendData; + } + else + { + //顺序数据包 + nSendDataLen = MAX_RANDOM_PACKET; + GetRandomSend(nCurrIndex, m_pSendData, nSendDataLen, m_nRecvLen); + return m_pSendData; + } + } + + int GetSendLength() + { + return m_nSendLen; + } + + int GetRecvLength() + { + return m_nRecvLen; + } + + EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) + { + m_nCurrRecvLen += nLen; + + if(m_nCurrRecvLen == m_nRecvLen) + { + m_nCurrRecvLen = 0; + //全部接收完毕,返回正确 + return DATA_RETURN_STATE_SUCCESS; + } + else if(nLen < m_nRecvLen) + { + //没有接收完全,继续接收 + return DATA_RETURN_STATE_CONTINUE; + } + + m_nCurrRecvLen = 0; + return DATA_RETURN_STATE_ERROR; + } private: - char* m_pSendData; - int m_nSendLen; - int m_nRecvLen; - int m_nCurrRecvLen; + char* m_pSendData; + int m_nSendLen; + int m_nRecvLen; + int m_nCurrRecvLen; }; -//websocketЭ߼ +//websocket协议逻辑包 class CWebSocketLogic : public CBaseDataLogic { public: - CWebSocketLogic() - { - m_pHandInData = NULL; - m_pSendData = NULL; - m_nSendLen = 0; - m_nRecvLen = 0; - m_nCurrRecvLen = 0; - m_nClassTye = 2; - }; - - ~CWebSocketLogic() { Close(); }; - - void Close() - { - if(NULL != m_pHandInData) - { - delete[] m_pHandInData; - m_pHandInData = NULL; - } - - if(NULL != m_pSendData) - { - delete[] m_pSendData; - m_pSendData = NULL; - } - } - - bool InitSendSize(int nSendLen = MAX_RANDOM_PACKET) - { - Close(); - - m_pHandInData = new char[300]; - sprintf_s(m_pHandInData, 300, "GET / HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: 127.0.0.1:10002\r\nSec-WebSocket-Key: cfMpieGIwzS7+4+nIqv5fA==\r\nSec-WebSocket-Version: 13\r\n\r\n"); - - m_pSendData = new char[nSendLen]; - m_nSendLen = nSendLen; - - return true; - } - - void SetRecvLength(int nRecvLen) - { - m_nRecvLen = nRecvLen; - } - - void SetMaxSendLength(int nMaxLength) - { - m_nSendLen = nMaxLength; - } - - //طBuff - void SetSendBuff(const char* pData, int nLen) - { - //WebSocket - WebSocketSendData(pData, nLen, m_pSendData, m_nSendLen); - } - - char* GetSendData() - { - return m_pSendData; - } - - char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) - { - //websocketƷ - if(nCurrIndex == 0) - { - //ǵһηݣְ - nSendDataLen = strlen(m_pHandInData); - return m_pHandInData; - } - else - { - if(GetRandomType() == false) - { - //һݰ - nSendDataLen = m_nSendLen; - return m_pSendData; - } - else - { - //˳ݰ - nSendDataLen = MAX_RANDOM_PACKET; - GetRandomSend(nCurrIndex - 1, m_pSendData, nSendDataLen, m_nRecvLen); - return m_pSendData; - } - } - } - - int GetSendLength() - { - return m_nSendLen; - } - - int GetRecvLength() - { - return m_nRecvLen; - } - - EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) - { - return DATA_RETURN_STATE_SUCCESS; - } + CWebSocketLogic() + { + m_pHandInData = NULL; + m_pSendData = NULL; + m_nSendLen = 0; + m_nRecvLen = 0; + m_nCurrRecvLen = 0; + m_nClassTye = 2; + }; + + ~CWebSocketLogic() + { + Close(); + }; + + void Close() + { + if(NULL != m_pHandInData) + { + delete[] m_pHandInData; + m_pHandInData = NULL; + } + + if(NULL != m_pSendData) + { + delete[] m_pSendData; + m_pSendData = NULL; + } + } + + bool InitSendSize(int nSendLen = MAX_RANDOM_PACKET) + { + Close(); + + m_pHandInData = new char[300]; + sprintf(m_pHandInData, "GET / HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: 127.0.0.1:10002\r\nSec-WebSocket-Key: cfMpieGIwzS7+4+nIqv5fA==\r\nSec-WebSocket-Version: 13\r\n\r\n"); + + m_pSendData = new char[nSendLen]; + m_nSendLen = nSendLen; + + return true; + } + + void SetRecvLength(int nRecvLen) + { + m_nRecvLen = nRecvLen; + } + + void SetMaxSendLength(int nMaxLength) + { + m_nSendLen = nMaxLength; + } + + //设置相关发送Buff + void SetSendBuff(const char* pData, int nLen) + { + //WebSocket加密数据 + WebSocketSendData(pData, nLen, m_pSendData, m_nSendLen); + } + + char* GetSendData() + { + return m_pSendData; + } + + char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) + { + //这里添加websocket加密善法 + if(nCurrIndex == 0) + { + //如果是第一次发送数据,则发送握手包 + nSendDataLen = (int)strlen(m_pHandInData); + return m_pHandInData; + } + else + { + if(GetRandomType() == false) + { + //单一数据包 + nSendDataLen = m_nSendLen; + return m_pSendData; + } + else + { + //顺序数据包 + nSendDataLen = MAX_RANDOM_PACKET; + GetRandomSend(nCurrIndex - 1, m_pSendData, nSendDataLen, m_nRecvLen); + return m_pSendData; + } + } + } + + int GetSendLength() + { + return m_nSendLen; + } + + int GetRecvLength() + { + return m_nRecvLen; + } + + EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) + { + return DATA_RETURN_STATE_SUCCESS; + } private: - char* m_pHandInData; - char* m_pSendData; - int m_nSendLen; - int m_nRecvLen; - int m_nCurrRecvLen; + char* m_pHandInData; + char* m_pSendData; + int m_nSendLen; + int m_nRecvLen; + int m_nCurrRecvLen; }; -//߳Ϣ +//线程连接信息 class _Socket_Info { public: - char m_szSerevrIP[MAX_BUFF_20]; //Զ̷IP - int m_nPort; //Զ̷Ķ˿ - int m_nThreadID; //߳ID - int m_nRecvTimeout; //ݳʱʱ䣨λǺ룩 - int m_nDelaySecond; //ӼʱλǺ룩 - int m_nPacketTimewait; //ݰͼ(λǺ) - //int m_nSendLength; //ַ - //int m_nRecvLength; //ַ޶ - //char* m_pSendBuff; //ݳ - bool m_blIsAlwayConnect; //Ƿ - bool m_blIsRadomaDelay; //Ƿʱ - bool m_blIsRecv; //ǷջӦ - bool m_blIsBroken; //Ƿ - bool m_blIsSendCount; //Ƿݰ - bool m_blIsWriteFile; //Ƿдļ - bool m_blIsSendOne; //Ƿֻһ - bool m_blLuaAdvance; //ǷLua߼ģʽ - int m_nConnectType; //ͣ0TCP1UDP - int m_nUdpClientPort; //UDPͻ˽ݶ˿ - int m_nSendCount; //ݰ - char m_szLuaFileName[MAX_BUFF_1024]; //߼ģʽLuaļ - CBaseDataLogic* m_pLogic; //ݶ - - _Socket_Info() - { - m_szSerevrIP[0] = '\0'; - m_nPort = 0; - m_nThreadID = 0; - m_nRecvTimeout = 0; - m_nPacketTimewait = 0; - m_nDelaySecond = 0; - //m_nSendLength = 0; - //m_nRecvLength = 0; - m_nSendCount = 0; - //m_pSendBuff = NULL; - m_blIsAlwayConnect = false; - m_blIsRadomaDelay = false; - m_blIsRecv = true; - m_blIsBroken = true; - m_blIsSendCount = false; - m_blIsWriteFile = false; - m_blIsSendOne = false; - m_blLuaAdvance = false; - m_nConnectType = 0; - m_nUdpClientPort = 0; - m_szLuaFileName[0] = '\0'; - m_pLogic = NULL; - } - - ~_Socket_Info() - { - //ﲻٹͷţϲ - //if(m_pLogic != NULL) - //{ - // delete m_pLogic; - //} - } + char m_szSerevrIP[MAX_BUFF_20]; //远程服务器的IP + int m_nPort; //远程服务器的端口 + int m_nThreadID; //线程ID + int m_nRecvTimeout; //接收数据超时时间(单位是毫秒) + int m_nDelaySecond; //短连接间延时(单位是毫秒) + int m_nPacketTimewait; //数据包发送间隔(单位是毫秒) + //int m_nSendLength; //发送字符串长度 + //int m_nRecvLength; //接收字符串长度限定 + //char* m_pSendBuff; //发送数据长度 + bool m_blIsAlwayConnect; //是否长连接 + bool m_blIsRadomaDelay; //是否随机延时 + bool m_blIsRecv; //是否接收回应包 + bool m_blIsBroken; //是否断线重连 + bool m_blIsSendCount; //是否随机数据包数 + bool m_blIsWriteFile; //是否写入文件 + bool m_blIsSendOne; //是否只发一次 + bool m_blLuaAdvance; //是否启动Lua高级模式 + int m_nConnectType; //链接类型,0是TCP,1是UDP + int m_nUdpClientPort; //UDP客户端接收数据端口 + int m_nSendCount; //发送总数据包数 + char m_szLuaFileName[MAX_BUFF_1024]; //高级模式的Lua文件名 + CBaseDataLogic* m_pLogic; //数据对象 + + _Socket_Info() + { + m_szSerevrIP[0] = '\0'; + m_nPort = 0; + m_nThreadID = 0; + m_nRecvTimeout = 0; + m_nPacketTimewait = 0; + m_nDelaySecond = 0; + //m_nSendLength = 0; + //m_nRecvLength = 0; + m_nSendCount = 0; + //m_pSendBuff = NULL; + m_blIsAlwayConnect = false; + m_blIsRadomaDelay = false; + m_blIsRecv = true; + m_blIsBroken = true; + m_blIsSendCount = false; + m_blIsWriteFile = false; + m_blIsSendOne = false; + m_blLuaAdvance = false; + m_nConnectType = 0; + m_nUdpClientPort = 0; + m_szLuaFileName[0] = '\0'; + m_pLogic = NULL; + } + + ~_Socket_Info() + { + //这里不再管释放,交由上层解决 + //if(m_pLogic != NULL) + //{ + // delete m_pLogic; + //} + } }; -//߳״̬Ϣ +//线程运行状态信息 struct _Socket_State_Info { - int m_nSuccessConnect; //ӳɹ - int m_nSuccessSend; //ͳɹ - int m_nSuccessRecv; //ճɹ - int m_nCurrectSocket; //ǰ - int m_nFailConnect; //ʧ - int m_nFailSend; //ʧ - int m_nFailRecv; //ʧ - int m_nSendByteCount; //ֽ - int m_nRecvByteCount; //ֽ - int m_nMinRecvTime; //Сʱ - int m_nMaxRecvTime; //ʱ - - _Socket_State_Info() - { - m_nSuccessConnect = 0; - m_nSuccessSend = 0; - m_nSuccessRecv = 0; - m_nCurrectSocket = 0; - m_nFailConnect = 0; - m_nFailSend = 0; - m_nFailRecv = 0; - m_nSendByteCount = 0; - m_nRecvByteCount = 0; - m_nMinRecvTime = 0; - m_nMaxRecvTime = 0; - } + int m_nSuccessConnect; //连接成功数 + int m_nSuccessSend; //发送成功数 + int m_nSuccessRecv; //接收成功数 + int m_nCurrectSocket; //当前链接数 + int m_nFailConnect; //连接失败数 + int m_nFailSend; //发送失败数 + int m_nFailRecv; //接收失败数 + int m_nSendByteCount; //发送字节数 + int m_nRecvByteCount; //接收字节数 + int m_nMinRecvTime; //最小接收时间 + int m_nMaxRecvTime; //最大接收时间 + + _Socket_State_Info() + { + m_nSuccessConnect = 0; + m_nSuccessSend = 0; + m_nSuccessRecv = 0; + m_nCurrectSocket = 0; + m_nFailConnect = 0; + m_nFailSend = 0; + m_nFailRecv = 0; + m_nSendByteCount = 0; + m_nRecvByteCount = 0; + m_nMinRecvTime = 0; + m_nMaxRecvTime = 0; + } }; diff --git a/TestNetworkTool/PassTCP/targetver.h b/TestNetworkTool/PassTCP/targetver.h deleted file mode 100644 index 93f0450cb..000000000 --- a/TestNetworkTool/PassTCP/targetver.h +++ /dev/null @@ -1,26 +0,0 @@ - -#pragma once - -// º궨Ҫƽ̨Ҫƽ̨ -// ǾӦó蹦ܵ WindowsInternet Explorer ȲƷ -// 汾ָͨ汾Ͱ汾ƽ̨пõĹܣ -// - -// ҪԵָ汾ƽ̨޸ж塣 -// йزͬƽ̨ӦֵϢο MSDN -#ifndef WINVER // ָҪƽ̨ Windows Vista -#define WINVER 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINNT // ָҪƽ̨ Windows Vista -#define _WIN32_WINNT 0x0600 // ֵΪӦֵ Windows 汾 -#endif - -#ifndef _WIN32_WINDOWS // ָҪƽ̨ Windows 98 -#define _WIN32_WINDOWS 0x0410 // ֵΪʵֵ Windows Me ߰汾 -#endif - -#ifndef _WIN32_IE // ָҪƽ̨ Internet Explorer 7.0 -#define _WIN32_IE 0x0700 // ֵΪӦֵ IE 汾 -#endif - diff --git a/TestNetworkTool/PassTCP/wxsmith/CPacketDlg.wxs b/TestNetworkTool/PassTCP/wxsmith/CPacketDlg.wxs new file mode 100644 index 000000000..3ccef462d --- /dev/null +++ b/TestNetworkTool/PassTCP/wxsmith/CPacketDlg.wxs @@ -0,0 +1,94 @@ + + + + 顺序数据包设置 + 581,389 + 0 + + 0,0 + 584,400 + + + + 0,0 + 576,224 + + + + 0,224 + 576,168 + + + + 16,24 + 544,112 + + + + 16,160 + + + 72,144 + 488,48 + + + + 24,190 + + + + + + 二进制数据包 + 文本数据包 + + 128,178 + + + + + 384,195 + + + 0 + 448,192 + 120,25 + + + + 16,352 + + + + + 96,352 + + + + + 184,352 + + + + + 280,352 + + + + + 480,352 + + + + -1 + 16,248 + 256,104 + + + -1 + 280,248 + 288,104 + + + + diff --git a/TestNetworkTool/PassTCP/wxsmith/CPassTCPDlg.wxcp b/TestNetworkTool/PassTCP/wxsmith/CPassTCPDlg.wxcp new file mode 100644 index 000000000..9e2a5095c --- /dev/null +++ b/TestNetworkTool/PassTCP/wxsmith/CPassTCPDlg.wxcp @@ -0,0 +1,5018 @@ +{ + "metadata": { + "m_generatedFilesDir": ".", + "m_objCounter": 0, + "m_includeFiles": [], + "m_bitmapFunction": "wxCrafterY3GJGKInitBitmapResources", + "m_bitmapsFile": "", + "m_GenerateCodeTypes": 1, + "m_outputFileName": "", + "m_firstWindowId": 10000, + "m_useEnum": true, + "m_useUnderscoreMacro": true, + "m_addHandlers": true + }, + "windows": [{ + "m_type": 4402, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "string", + "m_label": "大小:", + "m_value": "769,510" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "CPassTCPDlg" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Enable Window Persistency:", + "m_value": true + }, { + "type": "string", + "m_label": "标题:", + "m_value": "TCP压力测试通用工具" + }, { + "type": "virtualFolderPicker", + "m_label": "Virtual Folder:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Centre:", + "m_selection": 1, + "m_options": ["", "wxBOTH", "wxVERTICAL", "wxHORIZONTAL"] + }, { + "type": "string", + "m_label": "Inherited Class", + "m_value": "" + }, { + "type": "string", + "m_label": "文件:", + "m_value": "" + }, { + "type": "string", + "m_label": "Class Decorator", + "m_value": "" + }, { + "type": "choice", + "m_label": "wxFrame Type", + "m_selection": 0, + "m_options": ["wxFrame", "wxDocMDIParentFrame", "wxDocMDIChildFrame", "wxDocParentFrame", "wxDocChildFrame", "wxMiniFrame"] + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (16x16) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (32x32) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (64x64) :", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (128x128):", + "m_path": "" + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File (256x256):", + "m_path": "" + }], + "m_events": [{ + "m_eventName": "wxEVT_CLOSE_WINDOW", + "m_eventClass": "wxCloseEvent", + "m_eventHandler": "wxCloseEventHandler", + "m_functionNameAndSignature": "OnClose(wxCloseEvent& event)", + "m_description": "Process a close event. This event applies to wxFrame and wxDialog classes", + "m_noBody": false + }], + "m_children": [{ + "m_type": 4408, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": ["wxTAB_TRAVERSAL"], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "752,514" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_PANEL1" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }], + "m_events": [], + "m_children": [{ + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT1" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "服务器IP" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT2" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "压测线程数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT3" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "连接间延迟毫秒" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT4" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "数据包间隔" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT5" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "设置发包总数,如果无限设置为零" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT6" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "Lua控制文件路径" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "576,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL1" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4415, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHECKBOX1" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "启用高级模式" + }, { + "type": "bool", + "m_label": "Value:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_BUTTON_LuaAdvance" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "打开文件夹" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnButton_LuaAdvanceClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_BUTTON_StatTest" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "开始压测" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnButton_StatTestClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_BUTTON_StopTest" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "停止压测" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnButton_StopTestClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_BUTTON_ExportTestData" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "导出压测数据文档" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnButton_ExportTestDataClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4400, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_BUTTON_SetRadomPacket" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "设置随机数据包序列" + }, { + "type": "bool", + "m_label": "Default Button", + "m_value": false + }, { + "type": "bitmapPicker", + "m_label": "Bitmap File:", + "m_path": "" + }, { + "type": "choice", + "m_label": "Direction", + "m_selection": 0, + "m_options": ["wxLEFT", "wxRIGHT", "wxTOP", "wxBOTTOM"] + }, { + "type": "string", + "m_label": "Margins:", + "m_value": "2,2" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_BUTTON_CLICKED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnButton_SetRadomPacketClick(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL2" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "127.0.0.1" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "15" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_TEXT_UPDATED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnTextCtrl_ServerIPText(wxCommandEvent& event)", + "m_description": "Respond to a wxEVT_COMMAND_TEXT_UPDATED event, generated when the text changes.\nNotice that this event will be sent when the text controls contents changes\n - whether this is due to user input or comes from the program itself\n(for example, if SetValue() is called); see ChangeValue() for a function which does not send this event.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL3" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "1" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL4" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "0" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL5" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "0" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "184,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL6" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "0" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT7" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "服务器端口" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT8" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "接收超时秒数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT9" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "接收字节限定" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT10" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "UDP接收端口" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL7" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "10002" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "5" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL8" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "1000" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL9" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "12" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,24" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL10" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "20002" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4415, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHECKBOX2" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "是否开启长连接" + }, { + "type": "bool", + "m_label": "Value:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4415, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHECKBOX3" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "是否开启随机延时" + }, { + "type": "bool", + "m_label": "Value:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4415, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHECKBOX4" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "是否接收应答包" + }, { + "type": "bool", + "m_label": "Value:", + "m_value": true + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4415, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHECKBOX5" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "是否开启断线自动重连" + }, { + "type": "bool", + "m_label": "Value:", + "m_value": true + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4415, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "256,17" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHECKBOX6" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "是否启用随机数据包数(随机1-10个数据包)" + }, { + "type": "bool", + "m_label": "Value:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4415, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHECKBOX7" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "是否记录数据日志" + }, { + "type": "bool", + "m_label": "Value:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4415, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHECKBOX8" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "只发送一个包" + }, { + "type": "bool", + "m_label": "Value:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4416, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": ["wxFULL_REPAINT_ON_RESIZE"], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "312,48" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_RADIOBOX1" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Label:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Choices:", + "m_value": "TCP链接;UDP链接;WebSocket链接" + }, { + "type": "string", + "m_label": "Selection:", + "m_value": "-1" + }, { + "type": "string", + "m_label": "Major Dimension:", + "m_value": "1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT11" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "连接成功数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT12" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "发送成功数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT13" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "接收成功数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT14" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "当前连接数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT15" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "最小响应时间" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT16" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "发送字节数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL11" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL12" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL13" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL14" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL15" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL16" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT17" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "连接失败数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT18" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "发送失败数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT19" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "接收失败数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL17" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL18" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL19" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT20" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "最大响应时间" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL20" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT21" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "接收字节数" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL21" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4405, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_STATICTEXT22" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Label:", + "m_value": "压测发送二进制串" + }, { + "type": "string", + "m_label": "Wrap:", + "m_value": "-1" + }], + "m_events": [], + "m_children": [] + }, { + "m_type": 4411, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": [], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_CHOICE1" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "multi-string", + "m_label": "Choices:", + "m_value": "二进制模式;文本模式" + }, { + "type": "string", + "m_label": "Selection:", + "m_value": "0" + }], + "m_events": [{ + "m_eventName": "wxEVT_COMMAND_CHOICE_SELECTED", + "m_eventClass": "wxCommandEvent", + "m_eventHandler": "wxCommandEventHandler", + "m_functionNameAndSignature": "OnChoice_SendBuffStyleSelect(wxCommandEvent& event)", + "m_description": "Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the list is selected.", + "m_noBody": false + }], + "m_children": [] + }, { + "m_type": 4406, + "proportion": 0, + "border": 0, + "gbSpan": "", + "gbPosition": "", + "m_styles": ["wxTE_MULTILINE"], + "m_sizerFlags": [], + "m_properties": [{ + "type": "winid", + "m_label": "ID:", + "m_winid": "wxID_ANY" + }, { + "type": "string", + "m_label": "大小:", + "m_value": "288,152" + }, { + "type": "string", + "m_label": "Minimum Size:", + "m_value": "-1,-1" + }, { + "type": "string", + "m_label": "名称:", + "m_value": "ID_TEXTCTRL22" + }, { + "type": "multi-string", + "m_label": "Tooltip:", + "m_value": "" + }, { + "type": "colour", + "m_label": "Bg Colour:", + "colour": "" + }, { + "type": "colour", + "m_label": "Fg Colour:", + "colour": "" + }, { + "type": "font", + "m_label": "字体:", + "m_value": "" + }, { + "type": "bool", + "m_label": "Hidden", + "m_value": false + }, { + "type": "bool", + "m_label": "已禁用", + "m_value": false + }, { + "type": "bool", + "m_label": "Focused", + "m_value": false + }, { + "type": "string", + "m_label": "类名称:", + "m_value": "" + }, { + "type": "string", + "m_label": "Include File:", + "m_value": "" + }, { + "type": "string", + "m_label": "样式:", + "m_value": "" + }, { + "type": "string", + "m_label": "Value:", + "m_value": "" + }, { + "type": "string", + "m_label": "Text Hint", + "m_value": "" + }, { + "type": "string", + "m_label": "Max Length:", + "m_value": "0" + }, { + "type": "bool", + "m_label": "Auto Complete Directories:", + "m_value": false + }, { + "type": "bool", + "m_label": "Auto Complete Files:", + "m_value": false + }], + "m_events": [], + "m_children": [] + }] + }] + }] +} \ No newline at end of file diff --git a/TestNetworkTool/PassTCP/wxsmith/CPassTCPDlg.wxs b/TestNetworkTool/PassTCP/wxsmith/CPassTCPDlg.wxs new file mode 100644 index 000000000..0f9b91262 --- /dev/null +++ b/TestNetworkTool/PassTCP/wxsmith/CPassTCPDlg.wxs @@ -0,0 +1,296 @@ + + + + TCP压力测试通用工具 + ./small.ico + 769,510 + + + + 224,216 + 752,514 + + + 0,0 + 768,296 + + + + 24,22 + + + + 24,52 + + + + 8,288 + 760,232 + + + + 24,80 + + + + 24,108 + + + + 24,140 + + + + 16,160 + 736,88 + + + + 32,188 + + + 144,184 + 576,24 + + + + 32,216 + + + + 144,208 + + + + + 32,252 + + + + + 200,252 + + + + + 352,252 + + + + + 528,252 + + + + 127.0.0.1 + 15 + 120,20 + -1,24 + + + + 1 + 120,48 + -1,24 + + + 0 + 120,76 + -1,24 + + + 0 + 120,104 + -1,24 + + + 0 + 232,136 + 184,24 + + + + 232,22 + + + + 232,48 + + + + 232,72 + + + + 236,104 + + + 10002 + 5 + 320,20 + -1,24 + + + 1000 + 320,48 + -1,24 + + + 12 + 320,76 + -1,24 + + + 20002 + 320,104 + -1,24 + + + + 448,22 + + + + 600,22 + + + + 1 + 448,48 + + + + 1 + 600,48 + + + + 448,72 + 256,17 + + + + 448,96 + + + + 600,96 + + + + + TCP链接 + UDP链接 + WebSocket链接 + + -1 + 448,112 + 312,48 + + + + + 32,312 + + + + 32,344 + + + + 32,376 + + + + 32,406 + + + + 32,436 + + + + 32,466 + + + 112,308 + + + 112,340 + + + 112,372 + + + 112,402 + + + 112,432 + + + 112,464 + + + + 240,312 + + + + 240,344 + + + + 240,376 + + + 320,308 + + + 320,340 + + + 320,372 + + + + 240,436 + + + 320,432 + + + + 240,466 + + + 320,464 + + + + 448,312 + + + + 二进制模式 + 文本模式 + + 0 + 560,308 + + + + 448,336 + 288,152 + + + + + 打开目录 + + + + 1000 + + + + diff --git a/PssSampleClient/PSS_ClientManager/Main.jpg b/TestNetworkTool/backup/PSS_ClientManager/Main.jpg similarity index 100% rename from PssSampleClient/PSS_ClientManager/Main.jpg rename to TestNetworkTool/backup/PSS_ClientManager/Main.jpg diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/ClientDefine.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/ClientDefine.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/ClientDefine.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/ClientDefine.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientConnect.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientConnect.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientConnect.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientConnect.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientConnect.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientConnect.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientConnect.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientConnect.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientConnectM.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientConnectM.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientConnectM.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientConnectM.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientConnectM.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientConnectM.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientConnectM.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientConnectM.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientMain.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientMain.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientMain.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientMain.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientMain.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientMain.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientMain.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientMain.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientModule.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientModule.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientModule.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientModule.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientModule.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientModule.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientModule.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientModule.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientModule.htm b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientModule.htm similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientModule.htm rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientModule.htm diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientWorkThread.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientWorkThread.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientWorkThread.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientWorkThread.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientWorkThread.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientWorkThread.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgClientWorkThread.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgClientWorkThread.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgForbidenIP.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgForbidenIP.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgForbidenIP.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgForbidenIP.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgForbidenIP.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgForbidenIP.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgForbidenIP.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgForbidenIP.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgServerConnect.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgServerConnect.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgServerConnect.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgServerConnect.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgServerConnect.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgServerConnect.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgServerConnect.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgServerConnect.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgTrackIP.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgTrackIP.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgTrackIP.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgTrackIP.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgTrackIP.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgTrackIP.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgTrackIP.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgTrackIP.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgWorkThreadAI.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgWorkThreadAI.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgWorkThreadAI.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgWorkThreadAI.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgWorkThreadAI.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgWorkThreadAI.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/DlgWorkThreadAI.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/DlgWorkThreadAI.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.rc b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.rc similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.rc rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.rc diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.vcproj b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.vcproj similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.vcproj rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManager.vcproj diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManagerDlg.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManagerDlg.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManagerDlg.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManagerDlg.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManagerDlg.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManagerDlg.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/PSS_ClientManagerDlg.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/PSS_ClientManagerDlg.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/ReadMe.txt b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/ReadMe.txt similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/ReadMe.txt rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/ReadMe.txt diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/TcpClientConnect.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/TcpClientConnect.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/TcpClientConnect.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/TcpClientConnect.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/TcpClientConnect.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/TcpClientConnect.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/TcpClientConnect.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/TcpClientConnect.h diff --git a/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/Windows_Bin/CheckServer.xml b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/Windows_Bin/CheckServer.xml new file mode 100644 index 000000000..0560c292f --- /dev/null +++ b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/Windows_Bin/CheckServer.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/Windows_Bin/Config.xml b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/Windows_Bin/Config.xml new file mode 100644 index 000000000..37e2b7e84 --- /dev/null +++ b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/Windows_Bin/Config.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/PluginMaker/XML2CPP/XML2CPP/TinyXML/tinystr.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinystr.cpp similarity index 100% rename from PluginMaker/XML2CPP/XML2CPP/TinyXML/tinystr.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinystr.cpp diff --git a/PluginMaker/XML2CPP/XML2CPP/TinyXML/tinystr.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinystr.h similarity index 100% rename from PluginMaker/XML2CPP/XML2CPP/TinyXML/tinystr.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinystr.h diff --git a/PluginMaker/XML2CPP/XML2CPP/TinyXML/tinyxml.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.cpp similarity index 100% rename from PluginMaker/XML2CPP/XML2CPP/TinyXML/tinyxml.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.cpp diff --git a/PluginMaker/XML2CPP/XML2CPP/TinyXML/tinyxml.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.h similarity index 100% rename from PluginMaker/XML2CPP/XML2CPP/TinyXML/tinyxml.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinyxml.h diff --git a/PluginMaker/XML2CPP/XML2CPP/TinyXML/tinyxmlerror.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinyxmlerror.cpp similarity index 100% rename from PluginMaker/XML2CPP/XML2CPP/TinyXML/tinyxmlerror.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinyxmlerror.cpp diff --git a/PluginMaker/XML2CPP/XML2CPP/TinyXML/tinyxmlparser.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinyxmlparser.cpp similarity index 100% rename from PluginMaker/XML2CPP/XML2CPP/TinyXML/tinyxmlparser.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XML/tinyxmlparser.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XmlOpeation.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XmlOpeation.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/XmlOpeation.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XmlOpeation.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/XmlOpeation.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XmlOpeation.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/XmlOpeation.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/XmlOpeation.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/res/PSS_ClientManager.ico b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/res/PSS_ClientManager.ico similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/res/PSS_ClientManager.ico rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/res/PSS_ClientManager.ico diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/res/PSS_ClientManager.rc2 b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/res/PSS_ClientManager.rc2 similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/res/PSS_ClientManager.rc2 rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/res/PSS_ClientManager.rc2 diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/resource.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/resource.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/resource.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/resource.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/stdafx.cpp b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/stdafx.cpp similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/stdafx.cpp rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/stdafx.cpp diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/stdafx.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/stdafx.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/stdafx.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/stdafx.h diff --git a/PssSampleClient/PSS_ClientManager/PSS_ClientManager/targetver.h b/TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/targetver.h similarity index 100% rename from PssSampleClient/PSS_ClientManager/PSS_ClientManager/targetver.h rename to TestNetworkTool/backup/PSS_ClientManager/PSS_ClientManager/targetver.h diff --git a/PssSampleClient/PSS_ClientManager/Readme.md b/TestNetworkTool/backup/PSS_ClientManager/Readme.md similarity index 100% rename from PssSampleClient/PSS_ClientManager/Readme.md rename to TestNetworkTool/backup/PSS_ClientManager/Readme.md diff --git "a/PssSampleClient/PSS_ClientManager/\345\205\210\350\257\273\346\210\221.txt" "b/TestNetworkTool/backup/PSS_ClientManager/\345\205\210\350\257\273\346\210\221.txt" similarity index 100% rename from "PssSampleClient/PSS_ClientManager/\345\205\210\350\257\273\346\210\221.txt" rename to "TestNetworkTool/backup/PSS_ClientManager/\345\205\210\350\257\273\346\210\221.txt" diff --git a/TestNetworkTool/backup/PassTCP/ClientTcpSocket.cpp b/TestNetworkTool/backup/PassTCP/ClientTcpSocket.cpp new file mode 100644 index 000000000..c8789b996 --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/ClientTcpSocket.cpp @@ -0,0 +1,648 @@ +#include "StdAfx.h" +#include "ClientTcpSocket.h" + +CClientTcpSocket::CClientTcpSocket(void) +{ + m_pSocket_Info = NULL; + m_pSocket_State_Info = NULL; + m_blRun = false; + m_nThreadID = 0; +} + +CClientTcpSocket::~CClientTcpSocket(void) +{ + Close(); +} + +void CClientTcpSocket::Close() +{ + if(NULL != m_pSocket_Info) + { + delete m_pSocket_Info; + m_pSocket_Info = NULL; + } + + if(NULL != m_pSocket_State_Info) + { + delete m_pSocket_State_Info; + m_pSocket_State_Info = NULL; + } +} + +void CClientTcpSocket::SetSocketThread( _Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info ) +{ + Close(); + + m_pSocket_Info = pSocket_Info; + m_pSocket_State_Info = pSocket_State_Info; +} + +_Socket_State_Info* CClientTcpSocket::GetStateInfo() +{ + return m_pSocket_State_Info; +} + +void CClientTcpSocket::Stop() +{ + m_blRun = false; +} + +void CClientTcpSocket::Run() +{ + int nPacketCount = 1; + m_blRun = true; + SOCKET sckClient; + + //˲ΪLua + //Ϊ˼ٲҪnewdeleteԲ + _ParamData* pSendParam1 = NULL; + _ParamData* pSendParam2 = NULL; + _ParamData* pSendParam3 = NULL; + _ParamData* pSendParam4 = NULL; + _ParamData* pSendParamOut = NULL; + _ParamData* pRecvParam1 = NULL; + _ParamData* pRecvParam2 = NULL; + _ParamData* pRecvParam3 = NULL; + _ParamData* pRecvParam4 = NULL; + _ParamData* pRecvParamOut = NULL; + + int nLuaBufferMaxLength = m_pSocket_Info->m_pLogic->GetSendLength(); + + if(m_pSocket_Info == NULL || m_pSocket_State_Info == NULL) + { + m_blRun = false; + return; + } + + //Ǹ߼ģʽ + if(m_pSocket_Info->m_blLuaAdvance == true) + { + m_objLuaFn.InitClass(); + + bool blState = m_objLuaFn.LoadLuaFile(m_pSocket_Info->m_szLuaFileName); + if(false == blState) + { + printf_s("[Main]Open Lua file error.\n"); + return; + } + + //ʼҪʹõLua + pSendParam1 = new _ParamData(); + pSendParam2 = new _ParamData(); + pSendParam3 = new _ParamData(); + pSendParam4 = new _ParamData(); + pSendParamOut = new _ParamData(); + pRecvParam1 = new _ParamData(); + pRecvParam2 = new _ParamData(); + pRecvParam3 = new _ParamData(); + pRecvParam4 = new _ParamData(); + pRecvParamOut = new _ParamData(); + + } + + //ǷdzӣdzӣֻһΡ + bool blIsConnect = false; + + //socket׼ + struct sockaddr_in sockaddr; + + memset(&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sin_family = AF_INET; + sockaddr.sin_port = htons(m_pSocket_Info->m_nPort); + sockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + + //ʹ + int nSendIndex = 0; + + while(m_blRun) + { + unsigned int tBegin = (unsigned int)GetTickCount(); + if(m_pSocket_Info->m_nSendCount != 0 && m_pSocket_State_Info->m_nSuccessSend >= m_pSocket_Info->m_nSendCount) + { + //ָĿݰ + break; + } + + //鿴Ƿ߼ģʽ + if(m_pSocket_Info->m_blLuaAdvance == true) + { + //û󳤶 + m_pSocket_Info->m_pLogic->SetMaxSendLength(nLuaBufferMaxLength); + + //ʼLuaűȥ֯ݿ + CParamGroup objIn; + CParamGroup objOut; + + objIn.NeedRetrieve(false); + objOut.NeedRetrieve(false); + + int nLuaSendLen = m_pSocket_Info->m_pLogic->GetSendLength(); + pSendParam1->SetParam((char* )m_pSocket_Info->m_pLogic->GetSendData(), "void", sizeof(int)); + pSendParam2->SetParam((char* )&nLuaSendLen, "int", sizeof(int)); + pSendParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); + pSendParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); + + int nSendLength = 0; + pSendParamOut->SetParam((char* )&nSendLength, "int", sizeof(int)); + + objIn.Push(pSendParam1); + objIn.Push(pSendParam2); + objIn.Push(pSendParam3); + objIn.Push(pSendParam4); + objOut.Push(pSendParamOut); + + m_objLuaFn.CallFileFn("PassTcp_CreateSendData", objIn, objOut); + + int* pLength = (int* )pSendParamOut->GetParam(); + m_pSocket_Info->m_pLogic->SetMaxSendLength((int)(*pLength)); + } + + + if(blIsConnect == false) + { + sckClient = socket(AF_INET, SOCK_STREAM, 0); + + DWORD TimeOut = (DWORD)m_pSocket_Info->m_nRecvTimeout; + ::setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); + + DWORD dwSleepTime = (DWORD)m_pSocket_Info->m_nDelaySecond; + if(m_pSocket_Info->m_blIsRadomaDelay == true) + { + //ģ1-1000֮һʱ + dwSleepTime = (DWORD)RandomValue(1, 1000); + } + + if(dwSleepTime > 0) + { + //ָʱ + Sleep(dwSleepTime); + } + + //Զ̷ + int nErr = connect(sckClient, (SOCKADDR*)&sockaddr, sizeof(SOCKADDR)); + if(0 != nErr) + { + //رsocket + closesocket(sckClient); + + DWORD dwError = GetLastError(); + WriteFile_Error("Connect error", (int)dwError); + m_pSocket_State_Info->m_nFailConnect++; + m_pSocket_State_Info->m_nCurrectSocket = 0; + } + else + { + //ɹ + m_pSocket_State_Info->m_nSuccessConnect++; + m_pSocket_State_Info->m_nCurrectSocket = 1; + blIsConnect = true; + nSendIndex = 0; + } + } + + if(blIsConnect == true) + { + // + char szSendBuffData[MAX_BUFF_1024 * 100] = {'\0'}; + char szRecvBuffData[MAX_BUFF_1024 * 100] = {'\0'}; + + char* pSendData = NULL; + int nSendLen = 0; + int nTotalRecvLen = 0; + //Ϊݰ + if(m_pSocket_Info->m_blIsSendCount == true) + { + int nSendCount = RandomValue(1, 10); + + //׷һ߼¼ǰǷƥ䣬ܳǰ + if(m_pSocket_Info->m_nSendCount != 0 && nSendCount + m_pSocket_State_Info->m_nSuccessSend > m_pSocket_Info->m_nSendCount) + { + nSendCount = m_pSocket_Info->m_nSendCount - m_pSocket_State_Info->m_nSuccessSend; + } + + char* pData = m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); + for(int i = 0; i < nSendCount; i++) + { + MEMCOPY_SAFE(&szSendBuffData[i * nSendLen], + pData, + nSendLen); + } + nPacketCount = nSendCount; + + // + pSendData = (char* )szSendBuffData; + nSendLen = nSendLen * nSendCount; + nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength() * nSendCount; + } + else + { + // + pSendData = (char* )m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); + nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength(); + + nPacketCount = 1; + } + + //¼Ӧֽ + int nRecvAllSize = nTotalRecvLen; + + //Ҫ¼־ݼ־ + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_SendBuff(pSendData, nSendLen); + } + + int nTotalSendLen = nSendLen; + int nBeginSend = 0; + int nCurrSendLen = 0; + bool blSendFlag = false; + int nBeginRecv = 0; + int nCurrRecvLen = 0; + bool blRecvFlag = false; + while(true) + { + nCurrSendLen = send(sckClient, pSendData + nBeginSend, nTotalSendLen, 0); + if(nCurrSendLen <= 0) + { + DWORD dwError = GetLastError(); + WriteFile_Error("send error", (int)dwError); + + m_pSocket_State_Info->m_nFailSend += nPacketCount; + closesocket(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + + //жǷԶ + if(m_pSocket_Info->m_blIsBroken == false) + { + return ; + } + + break; + } + else + { + nTotalSendLen -= nCurrSendLen; + if(nTotalSendLen == 0) + { + // + m_pSocket_State_Info->m_nSuccessSend += nPacketCount; + + //¼ֽ + m_pSocket_State_Info->m_nSendByteCount += nCurrSendLen; + + blSendFlag = true; + break; + } + else + { + nBeginSend += nCurrSendLen; + + //¼ֽ + m_pSocket_State_Info->m_nSendByteCount += nCurrSendLen; + } + } + } + nSendIndex++; + + // + if(blSendFlag == true && m_pSocket_Info->m_blIsRecv == true) + { + while(true) + { + //ͳɹˣ + nCurrRecvLen = recv(sckClient, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0); + if(nCurrRecvLen <= 0) + { + DWORD dwError = GetLastError(); + WriteFile_Error("recv error", (int)dwError); + + //õصIPͶ˿ + struct sockaddr_in sockClient; + + memset(&sockClient, 0, sizeof(sockClient)); + int nClientSocketSize = sizeof(sockClient); + + getsockname(sckClient, (struct sockaddr *)&sockClient, &nClientSocketSize); + + char szWData[MAX_BUFF_1024] = {'\0'}; + sprintf_s(szWData, MAX_BUFF_1024, "[%s:%d]SendCount=%d.", inet_ntoa(sockClient.sin_addr), ntohs(sockClient.sin_port), nSendIndex); + WriteFile_Data(szWData); + + m_pSocket_State_Info->m_nFailRecv += nPacketCount; + closesocket(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + + //жǷԶ + if(m_pSocket_Info->m_blIsBroken == false) + { + return ; + } + + break; + } + else + { + //Ǹ߼ģʽLuaӿڷ + if(m_pSocket_Info->m_blLuaAdvance == true) + { + m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; + int nState = 0; + + CParamGroup objRecvIn; + CParamGroup objRecvOut; + + objRecvIn.NeedRetrieve(false); + objRecvOut.NeedRetrieve(false); + + pRecvParam1->SetParam((char* )szRecvBuffData, "void", sizeof(int)); + pRecvParam2->SetParam((char* )&nCurrRecvLen, "int", sizeof(int)); + pRecvParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); + pRecvParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); + + pRecvParamOut->SetParam((char* )&nState, "int", sizeof(int)); + + objRecvIn.Push(pRecvParam1); + objRecvIn.Push(pRecvParam2); + objRecvIn.Push(pRecvParam3); + objRecvIn.Push(pRecvParam4); + objRecvOut.Push(pRecvParamOut); + + //ýպ + m_objLuaFn.CallFileFn("PassTcp_GetRecvData", objRecvIn, objRecvOut); + + int* pReturn = (int* )pRecvParamOut->GetParam(); + nState = (int)(*pReturn); + + objRecvIn.Close(false); + objRecvOut.Close(false); + + //жϽűֵ + if(nState == 0) + { + //֤ɹ + m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; + blRecvFlag = true; + + //Ҫ¼־ݼ־ + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + //Сʱʱ + int tTime = (int)((unsigned int)GetTickCount() - tBegin); + if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + + if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + + break; + } + else if(nState == 1) + { + // + nBeginRecv += nCurrRecvLen; + } + else + { + //հ֤ʧ + m_pSocket_State_Info->m_nFailRecv += nPacketCount; + blRecvFlag = true; + + //Ҫ¼־ݼ־ + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + break; + } + } + else + { + //Ǹ߼ģʽõж׼ + m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; + nTotalRecvLen -= nCurrRecvLen; + + EM_DATA_RETURN_STATE emState = m_pSocket_Info->m_pLogic->GetRecvData(m_nThreadID, nSendIndex, szRecvBuffData, nCurrRecvLen); + + if(nTotalRecvLen == 0 || emState == DATA_RETURN_STATE_SUCCESS) + { + // + m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; + blRecvFlag = true; + + //Ҫ¼־ݼ־ + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + //Сʱʱ + int tTime = (int)((unsigned int)GetTickCount() - tBegin); + if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + + if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + + break; + } + else + { + nBeginRecv += nCurrRecvLen; + } + } + } + } + } + + //ݰsleepָʱ + if(m_pSocket_Info->m_nPacketTimewait > 0) + { + DWORD dwSleepTime = (DWORD)m_pSocket_Info->m_nPacketTimewait; + Sleep(dwSleepTime); + } + + //dzӣ򲻹ر + if(m_pSocket_Info->m_blIsAlwayConnect == false) + { + closesocket(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + } + } + + //ֻһΣ˳ + if(m_pSocket_Info->m_blIsSendOne == true) + { + m_blRun = false; + } + } + + //ûϣϿ + if(blIsConnect == true) + { + closesocket(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + } + + //еLuaڴ + delete pSendParam1; + delete pSendParam2; + delete pSendParam3; + delete pSendParam4; + delete pSendParamOut; + delete pRecvParam1; + delete pRecvParam2; + delete pRecvParam3; + delete pRecvParam4; + delete pRecvParamOut; +} + +bool CClientTcpSocket::WriteFile_SendBuff( const char* pData, int nLen ) +{ + FILE* pFile = NULL; + char szFileName[20]; + sprintf_s(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); + fopen_s(&pFile, szFileName, "a+"); + if(pFile == NULL) + { + return false; + } + + string strLog; + strLog = "[SendBuff]"; + + for(int i = 0; i < nLen; i++) + { + char szChar[20]; + sprintf_s(szChar, 20, " 0x%02X", (unsigned char )pData[i]); + strLog += szChar; + } + + strLog += "\n"; + + fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); + + fclose(pFile); + return true; +} + +bool CClientTcpSocket::WriteFile_RecvBuff( const char* pData, int nLen ) +{ + FILE* pFile = NULL; + char szFileName[20]; + sprintf_s(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); + fopen_s(&pFile, szFileName, "a+"); + if(pFile == NULL) + { + return false; + } + + string strLog; + strLog = "[RecvBuff]"; + + for(int i = 0; i < nLen; i++) + { + char szChar[20]; + sprintf_s(szChar, 20, " 0x%02X", (unsigned char )pData[i]); + strLog += szChar; + } + + strLog += "\n"; + + fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); + + fclose(pFile); + return true; +} + +bool CClientTcpSocket::WriteFile_Error( const char* pError, int nErrorNumber ) +{ + time_t ttNow = time(NULL); + struct tm tmNow; + localtime_s(&tmNow, &ttNow); + + char szTimeNow[30] = {'\0'}; + sprintf_s(szTimeNow, 30, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); + + //ƴӳ־ + char szError[1024] = {'\0'}; + sprintf_s(szError, 1024, "%s %s, errno=%d.\n", szTimeNow, pError, nErrorNumber); + + FILE* pFile = NULL; + char szFileName[30]; + sprintf_s(szFileName, "StressTest_Error.log"); + fopen_s(&pFile, szFileName, "a+"); + if(pFile == NULL) + { + return false; + } + + fwrite(szError, strlen(szError), sizeof(char), pFile); + + fclose(pFile); + return true; +} + +bool CClientTcpSocket::WriteFile_Data( const char* pError) +{ + time_t ttNow = time(NULL); + struct tm tmNow; + localtime_s(&tmNow, &ttNow); + + char szTimeNow[30] = {'\0'}; + sprintf_s(szTimeNow, 30, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); + + //ƴӳ־ + char szError[1024] = {'\0'}; + sprintf_s(szError, 1024, "%s %s.\n", szTimeNow, pError); + + FILE* pFile = NULL; + char szFileName[30]; + sprintf_s(szFileName, "StressTest_Error.log"); + fopen_s(&pFile, szFileName, "a+"); + if(pFile == NULL) + { + return false; + } + + fwrite(szError, strlen(szError), sizeof(char), pFile); + + fclose(pFile); + return true; +} + +void CClientTcpSocket::SetThreadID(int nThreadID) +{ + m_nThreadID = nThreadID; +} \ No newline at end of file diff --git a/TestNetworkTool/backup/PassTCP/ClientTcpSocket.h b/TestNetworkTool/backup/PassTCP/ClientTcpSocket.h new file mode 100644 index 000000000..523fbd170 --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/ClientTcpSocket.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include "define.h" +#include "LuaFn.h" + +class CClientTcpSocket +{ +public: + CClientTcpSocket(void); + ~CClientTcpSocket(void); + + void Close(); + + void Run(); + void Stop(); + + void SetSocketThread(_Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info); + _Socket_State_Info* GetStateInfo(); + + void SetThreadID(int nThreadID); + +private: + bool WriteFile_SendBuff(const char* pData, int nLen); + bool WriteFile_RecvBuff(const char* pData, int nLen); + bool WriteFile_Error(const char* pError, int nErrorNumber); + bool WriteFile_Data( const char* pError); + +private: + _Socket_Info* m_pSocket_Info; + _Socket_State_Info* m_pSocket_State_Info; + bool m_blRun; + CLuaFn m_objLuaFn; + int m_nThreadID; //߳ID +}; diff --git a/TestNetworkTool/backup/PassTCP/ClientUdpSocket.cpp b/TestNetworkTool/backup/PassTCP/ClientUdpSocket.cpp new file mode 100644 index 000000000..232cd99f4 --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/ClientUdpSocket.cpp @@ -0,0 +1,584 @@ +#include "StdAfx.h" +#include "ClientUdpSocket.h" + +CClientUdpSocket::CClientUdpSocket(void) +{ + m_pSocket_Info = NULL; + m_pSocket_State_Info = NULL; + m_blRun = false; +} + +CClientUdpSocket::~CClientUdpSocket(void) +{ + Close(); +} + +void CClientUdpSocket::Close() +{ + if(NULL != m_pSocket_Info) + { + delete m_pSocket_Info; + m_pSocket_Info = NULL; + } + + if(NULL != m_pSocket_State_Info) + { + delete m_pSocket_State_Info; + m_pSocket_State_Info = NULL; + } +} + +void CClientUdpSocket::Run() +{ + int nPacketCount = 1; + m_blRun = true; + SOCKET sckClient; + SOCKET sckServer; + + //˲ΪLua + //Ϊ˼ٲҪnewdeleteԲ + _ParamData* pSendParam1 = NULL; + _ParamData* pSendParam2 = NULL; + _ParamData* pSendParam3 = NULL; + _ParamData* pSendParam4 = NULL; + _ParamData* pSendParamOut = NULL; + _ParamData* pRecvParam1 = NULL; + _ParamData* pRecvParam2 = NULL; + _ParamData* pRecvParam3 = NULL; + _ParamData* pRecvParam4 = NULL; + _ParamData* pRecvParamOut = NULL; + + int nLuaBufferMaxLength = m_pSocket_Info->m_pLogic->GetSendLength(); + + if(m_pSocket_Info == NULL || m_pSocket_State_Info == NULL) + { + m_blRun = false; + return; + } + + //Ǹ߼ģʽ + if(m_pSocket_Info->m_blLuaAdvance == true) + { + m_objLuaFn.InitClass(); + + bool blState = m_objLuaFn.LoadLuaFile(m_pSocket_Info->m_szLuaFileName); + if(false == blState) + { + printf_s("[Main]Open Lua file error.\n"); + return; + } + + //ʼҪʹõLua + pSendParam1 = new _ParamData(); + pSendParam2 = new _ParamData(); + pSendParam3 = new _ParamData(); + pSendParam4 = new _ParamData(); + pSendParamOut = new _ParamData(); + pRecvParam1 = new _ParamData(); + pRecvParam2 = new _ParamData(); + pRecvParam3 = new _ParamData(); + pRecvParam4 = new _ParamData(); + pRecvParamOut = new _ParamData(); + + } + + //ǷdzӣdzӣֻһΡ + bool blIsConnect = false; + + //socket׼ + struct sockaddr_in svrsockaddr; + + memset(&svrsockaddr, 0, sizeof(SOCKADDR_IN)); + svrsockaddr.sin_family = AF_INET; + svrsockaddr.sin_port = htons(m_pSocket_Info->m_nPort); + svrsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + + sckClient = socket(AF_INET, SOCK_DGRAM, 0); + + DWORD TimeOut = (DWORD)m_pSocket_Info->m_nRecvTimeout; + ::setsockopt(sckClient, SOL_SOCKET, SO_RCVTIMEO, (char *)&TimeOut, sizeof(TimeOut)); + + //ýռ˿ + sckServer = socket(AF_INET, SOCK_DGRAM, 0); + + struct sockaddr_in clientsockaddr; + memset(&clientsockaddr, 0, sizeof(SOCKADDR_IN)); + clientsockaddr.sin_family = AF_INET; + clientsockaddr.sin_port = htons(m_pSocket_Info->m_nUdpClientPort); + clientsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + + bind(sckServer, (SOCKADDR *) &clientsockaddr, sizeof(clientsockaddr)); + + //ʹ + int nSendIndex = 0; + + while(m_blRun) + { + unsigned int tBegin = (unsigned int)GetTickCount(); + if(m_pSocket_Info->m_nSendCount != 0 && m_pSocket_State_Info->m_nSuccessSend >= m_pSocket_Info->m_nSendCount) + { + //ָĿݰ + break; + } + + //鿴Ƿ߼ģʽ + if(m_pSocket_Info->m_blLuaAdvance == true) + { + //û󳤶 + m_pSocket_Info->m_pLogic->SetMaxSendLength(nLuaBufferMaxLength); + + //ʼLuaűȥ֯ݿ + CParamGroup objIn; + CParamGroup objOut; + + objIn.NeedRetrieve(false); + objOut.NeedRetrieve(false); + + int nLuaSendLen = m_pSocket_Info->m_pLogic->GetSendLength(); + pSendParam1->SetParam((char* )m_pSocket_Info->m_pLogic->GetSendData(), "void", sizeof(int)); + pSendParam2->SetParam((char* )&nLuaSendLen, "int", sizeof(int)); + pSendParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); + pSendParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); + + int nSendLength = 0; + pSendParamOut->SetParam((char* )&nSendLength, "int", sizeof(int)); + + objIn.Push(pSendParam1); + objIn.Push(pSendParam2); + objIn.Push(pSendParam3); + objIn.Push(pSendParam4); + objOut.Push(pSendParamOut); + + m_objLuaFn.CallFileFn("PassTcp_CreateSendData", objIn, objOut); + + int* pLength = (int* )pSendParamOut->GetParam(); + m_pSocket_Info->m_pLogic->SetMaxSendLength((int)(*pLength)); + } + + + if(blIsConnect == false) + { + DWORD dwSleepTime = (DWORD)m_pSocket_Info->m_nDelaySecond; + if(m_pSocket_Info->m_blIsRadomaDelay == true) + { + //ģ1-1000֮һʱ + dwSleepTime = (DWORD)RandomValue(1, 1000); + } + + //ָʱ + Sleep(dwSleepTime); + + m_pSocket_State_Info->m_nSuccessConnect++; + m_pSocket_State_Info->m_nCurrectSocket = 1; + blIsConnect = true; + } + + if(blIsConnect == true) + { + // + char szSendBuffData[MAX_BUFF_1024 * 100] = {'\0'}; + char szRecvBuffData[MAX_BUFF_1024 * 100] = {'\0'}; + + char* pSendData = NULL; + int nSendLen = 0; + int nTotalRecvLen = 0; + //Ϊݰ + if(m_pSocket_Info->m_blIsSendCount == true) + { + int nSendCount = RandomValue(1, 10); + + //׷һ߼¼ǰǷƥ䣬ܳǰ + if(m_pSocket_Info->m_nSendCount != 0 && nSendCount + m_pSocket_State_Info->m_nSuccessSend > m_pSocket_Info->m_nSendCount) + { + nSendCount = m_pSocket_Info->m_nSendCount - m_pSocket_State_Info->m_nSuccessSend; + } + + char* pData = m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); + for(int i = 0; i < nSendCount; i++) + { + MEMCOPY_SAFE(&szSendBuffData[i * nSendLen], + pData, + nSendLen); + } + nPacketCount = nSendCount; + + // + pSendData = (char* )szSendBuffData; + nSendLen = m_pSocket_Info->m_pLogic->GetSendLength() * nSendCount; + nTotalRecvLen = m_pSocket_Info->m_pLogic->GetSendLength() * nSendCount; + } + else + { + // + pSendData = (char* )m_pSocket_Info->m_pLogic->GetSendData(m_pSocket_Info->m_nThreadID, nSendIndex, nSendLen); + nTotalRecvLen = m_pSocket_Info->m_pLogic->GetRecvLength(); + } + + //¼Ӧֽ + int nRecvAllSize = nTotalRecvLen; + + //Ҫ¼־ݼ־ + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_SendBuff(pSendData, nSendLen); + } + + int nTotalSendLen = nSendLen; + int nBeginSend = 0; + int nCurrSendLen = 0; + bool blSendFlag = false; + int nBeginRecv = 0; + int nCurrRecvLen = 0; + bool blRecvFlag = false; + while(true) + { + //UDP + int nssssSize = sizeof(SOCKADDR); + nCurrSendLen = sendto(sckClient, pSendData + nBeginSend, nTotalSendLen, 0, (sockaddr* )&svrsockaddr, sizeof(SOCKADDR)); + if(nCurrSendLen <= 0) + { + DWORD dwError = GetLastError(); + WriteFile_Error("sendto error", (int)dwError); + m_pSocket_State_Info->m_nFailSend += nPacketCount; + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + break; + } + else + { + nTotalSendLen -= nCurrSendLen; + if(nTotalSendLen == 0) + { + // + m_pSocket_State_Info->m_nSuccessSend += nPacketCount; + blSendFlag = true; + break; + } + else + { + nBeginSend += nCurrSendLen; + } + } + } + + // + if(blSendFlag == true && m_pSocket_Info->m_blIsRecv == true) + { + while(true) + { + //ͳɹˣ + int nClientAddrSize = sizeof(SOCKADDR_IN); + + //socket׼ + struct sockaddr_in clientsockaddr1; + /* + struct sockaddr_in clientsockaddr; + + memset(&clientsockaddr, 0, sizeof(SOCKADDR_IN)); + clientsockaddr.sin_family = AF_INET; + clientsockaddr.sin_port = htons(20004); + clientsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + */ + + nCurrRecvLen = recvfrom(sckServer, (char* )szRecvBuffData + nBeginRecv, nTotalRecvLen, 0, (sockaddr* )&clientsockaddr1, &nClientAddrSize); + if(nCurrRecvLen <= 0) + { + DWORD dwError = GetLastError(); + WriteFile_Error("sendto error", (int)dwError); + m_pSocket_State_Info->m_nFailRecv += nPacketCount; + //closesocket(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + break; + } + else + { + //Ǹ߼ģʽLuaӿڷ + if(m_pSocket_Info->m_blLuaAdvance == true) + { + m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; + int nState = 0; + + CParamGroup objRecvIn; + CParamGroup objRecvOut; + + objRecvIn.NeedRetrieve(false); + objRecvOut.NeedRetrieve(false); + + pRecvParam1->SetParam((char* )szRecvBuffData, "void", sizeof(int)); + pRecvParam2->SetParam((char* )&nCurrRecvLen, "int", sizeof(int)); + pRecvParam3->SetParam((char* )&m_nThreadID, "int", sizeof(int)); + pRecvParam4->SetParam((char* )&nSendIndex, "int", sizeof(int)); + + pRecvParamOut->SetParam((char* )&nState, "int", sizeof(int)); + + objRecvIn.Push(pRecvParam1); + objRecvIn.Push(pRecvParam2); + objRecvIn.Push(pRecvParam3); + objRecvIn.Push(pRecvParam4); + objRecvOut.Push(pRecvParamOut); + + //ýպ + m_objLuaFn.CallFileFn("PassTcp_GetRecvData", objRecvIn, objRecvOut); + + int* pReturn = (int* )pRecvParamOut->GetParam(); + nState = (int)(*pReturn); + + objRecvIn.Close(false); + objRecvOut.Close(false); + + //жϽűֵ + if(nState == 0) + { + //֤ɹ + m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; + blRecvFlag = true; + + //Ҫ¼־ݼ־ + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + //Сʱʱ + int tTime = (int)((unsigned int)GetTickCount() - tBegin); + if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + + if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + + break; + } + else if(nState == 1) + { + // + nBeginRecv += nCurrRecvLen; + } + else + { + //հ֤ʧ + m_pSocket_State_Info->m_nFailRecv += nPacketCount; + blRecvFlag = true; + + //Ҫ¼־ݼ־ + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + break; + } + } + else + { + //Ǹ߼ģʽõж׼ + m_pSocket_State_Info->m_nRecvByteCount += nCurrRecvLen; + nTotalRecvLen -= nCurrRecvLen; + + EM_DATA_RETURN_STATE emState = m_pSocket_Info->m_pLogic->GetRecvData(m_nThreadID, nSendLen, szRecvBuffData, nCurrRecvLen); + if(emState == DATA_RETURN_STATE_SUCCESS) + { + // + m_pSocket_State_Info->m_nSuccessRecv += nPacketCount; + blRecvFlag = true; + + //Ҫ¼־ݼ־ + if(m_pSocket_Info->m_blIsWriteFile == true) + { + WriteFile_RecvBuff(szRecvBuffData, nRecvAllSize); + } + + //Сʱʱ + int tTime = (int)((unsigned int)GetTickCount() - tBegin); + if(tTime > 0 && m_pSocket_State_Info->m_nMinRecvTime == 0) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + else if(tTime < m_pSocket_State_Info->m_nMinRecvTime) + { + m_pSocket_State_Info->m_nMinRecvTime = tTime; + } + + if(tTime > 0 && m_pSocket_State_Info->m_nMaxRecvTime == 0) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + else if(tTime > m_pSocket_State_Info->m_nMaxRecvTime) + { + m_pSocket_State_Info->m_nMaxRecvTime = tTime; + } + + break; + } + else + { + nBeginRecv += nCurrRecvLen; + } + } + } + } + } + + //ݰsleepָʱ + if(m_pSocket_Info->m_nPacketTimewait > 0) + { + DWORD dwSleepTime = (DWORD)m_pSocket_Info->m_nPacketTimewait; + Sleep(dwSleepTime); + } + + //dzӣ򲻹ر + if(m_pSocket_Info->m_blIsAlwayConnect == false) + { + //closesocket(sckClient); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + } + } + + //ֻһΣ˳ + if(m_pSocket_Info->m_blIsSendOne == true) + { + m_blRun = false; + } + } + + //ûϣϿ + closesocket(sckClient); + closesocket(sckServer); + m_pSocket_State_Info->m_nCurrectSocket = 0; + blIsConnect = false; + + //еLuaڴ + delete pSendParam1; + delete pSendParam2; + delete pSendParam3; + delete pSendParam4; + delete pSendParamOut; + delete pRecvParam1; + delete pRecvParam2; + delete pRecvParam3; + delete pRecvParam4; + delete pRecvParamOut; +} + +void CClientUdpSocket::Stop() +{ + m_blRun = false; +} + +void CClientUdpSocket::SetSocketThread( _Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info ) +{ + Close(); + + m_pSocket_Info = pSocket_Info; + m_pSocket_State_Info = pSocket_State_Info; +} + +_Socket_State_Info* CClientUdpSocket::GetStateInfo() +{ + return m_pSocket_State_Info; +} + +bool CClientUdpSocket::WriteFile_SendBuff( const char* pData, int nLen ) +{ + FILE* pFile = NULL; + char szFileName[20]; + sprintf_s(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); + fopen_s(&pFile, szFileName, "a+"); + if(pFile == NULL) + { + return false; + } + + string strLog; + strLog = "[SendBuff]"; + + for(int i = 0; i < nLen; i++) + { + char szChar[20]; + sprintf_s(szChar, 20, " 0x%02X", (unsigned char )pData[i]); + strLog += szChar; + } + + strLog += "\n"; + + fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); + + fclose(pFile); + return true; +} + +bool CClientUdpSocket::WriteFile_RecvBuff( const char* pData, int nLen ) +{ + FILE* pFile = NULL; + char szFileName[20]; + sprintf_s(szFileName, "Thread%d.log", m_pSocket_Info->m_nThreadID); + fopen_s(&pFile, szFileName, "a+"); + if(pFile == NULL) + { + return false; + } + + string strLog; + strLog = "[RecvBuff]"; + + for(int i = 0; i < nLen; i++) + { + char szChar[20]; + sprintf_s(szChar, 20, " 0x%02X", (unsigned char )pData[i]); + strLog += szChar; + } + + strLog += "\n"; + + fwrite(strLog.c_str(), strLog.length(), sizeof(char), pFile); + + fclose(pFile); + return true; +} + +bool CClientUdpSocket::WriteFile_Error( const char* pError, int nErrorNumber ) +{ + time_t ttNow = time(NULL); + struct tm tmNow; + localtime_s(&tmNow, &ttNow); + + char szTimeNow[30] = {'\0'}; + sprintf_s(szTimeNow, 30, "[%04d-%02d-%02d %02d:%02d:%02d]", tmNow.tm_year + 1900, tmNow.tm_mon + 1, tmNow.tm_mday, tmNow.tm_hour, tmNow.tm_min, tmNow.tm_sec); + + //ƴӳ־ + char szError[1024] = {'\0'}; + sprintf_s(szError, 1024, "%s %s, errno=%d.\n", szTimeNow, pError, nErrorNumber); + + FILE* pFile = NULL; + char szFileName[30]; + sprintf_s(szFileName, "StressTest_Error.log"); + fopen_s(&pFile, szFileName, "a+"); + if(pFile == NULL) + { + return false; + } + + fwrite(szError, strlen(szError), sizeof(char), pFile); + + fclose(pFile); + return true; +} + +void CClientUdpSocket::SetThreadID( int nThreadID ) +{ + m_nThreadID = nThreadID; +} \ No newline at end of file diff --git a/TestNetworkTool/backup/PassTCP/ClientUdpSocket.h b/TestNetworkTool/backup/PassTCP/ClientUdpSocket.h new file mode 100644 index 000000000..6be888dec --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/ClientUdpSocket.h @@ -0,0 +1,34 @@ +#pragma once + +#include "define.h" +#include +#include "LuaFn.h" + +class CClientUdpSocket +{ +public: + CClientUdpSocket(void); + ~CClientUdpSocket(void); + + void Close(); + + void Run(); + void Stop(); + + void SetSocketThread(_Socket_Info* pSocket_Info, _Socket_State_Info* pSocket_State_Info); + _Socket_State_Info* GetStateInfo(); + + void SetThreadID(int nThreadID); + +private: + bool WriteFile_SendBuff(const char* pData, int nLen); + bool WriteFile_RecvBuff(const char* pData, int nLen); + bool WriteFile_Error(const char* pError, int nErrorNumber); + +private: + _Socket_Info* m_pSocket_Info; + _Socket_State_Info* m_pSocket_State_Info; + bool m_blRun; + CLuaFn m_objLuaFn; + int m_nThreadID; //߳ID +}; diff --git a/TestNetworkTool/PassTCP/Lua/LuaDefine.h b/TestNetworkTool/backup/PassTCP/Lua/LuaDefine.h similarity index 100% rename from TestNetworkTool/PassTCP/Lua/LuaDefine.h rename to TestNetworkTool/backup/PassTCP/Lua/LuaDefine.h diff --git a/TestNetworkTool/PassTCP/Lua/LuaFn.cpp b/TestNetworkTool/backup/PassTCP/Lua/LuaFn.cpp similarity index 100% rename from TestNetworkTool/PassTCP/Lua/LuaFn.cpp rename to TestNetworkTool/backup/PassTCP/Lua/LuaFn.cpp diff --git a/TestNetworkTool/PassTCP/Lua/LuaFn.h b/TestNetworkTool/backup/PassTCP/Lua/LuaFn.h similarity index 100% rename from TestNetworkTool/PassTCP/Lua/LuaFn.h rename to TestNetworkTool/backup/PassTCP/Lua/LuaFn.h diff --git a/TestNetworkTool/PassTCP/Lua/LuaFnRegister.h b/TestNetworkTool/backup/PassTCP/Lua/LuaFnRegister.h similarity index 100% rename from TestNetworkTool/PassTCP/Lua/LuaFnRegister.h rename to TestNetworkTool/backup/PassTCP/Lua/LuaFnRegister.h diff --git a/TestNetworkTool/PassTCP/Lua/LuaFn_Tcp.h b/TestNetworkTool/backup/PassTCP/Lua/LuaFn_Tcp.h similarity index 100% rename from TestNetworkTool/PassTCP/Lua/LuaFn_Tcp.h rename to TestNetworkTool/backup/PassTCP/Lua/LuaFn_Tcp.h diff --git a/TestNetworkTool/PassTCP/Lua/ParamData.h b/TestNetworkTool/backup/PassTCP/Lua/ParamData.h similarity index 100% rename from TestNetworkTool/PassTCP/Lua/ParamData.h rename to TestNetworkTool/backup/PassTCP/Lua/ParamData.h diff --git a/TestNetworkTool/PassTCP/LuaLib/Lua.vcproj b/TestNetworkTool/backup/PassTCP/LuaLib/Lua.vcproj similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/Lua.vcproj rename to TestNetworkTool/backup/PassTCP/LuaLib/Lua.vcproj diff --git a/TestNetworkTool/PassTCP/LuaLib/Lua.vcproj.8.00.old b/TestNetworkTool/backup/PassTCP/LuaLib/Lua.vcproj.8.00.old similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/Lua.vcproj.8.00.old rename to TestNetworkTool/backup/PassTCP/LuaLib/Lua.vcproj.8.00.old diff --git a/TestNetworkTool/PassTCP/LuaLib/ReadMe.txt b/TestNetworkTool/backup/PassTCP/LuaLib/ReadMe.txt similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ReadMe.txt rename to TestNetworkTool/backup/PassTCP/LuaLib/ReadMe.txt diff --git a/TestNetworkTool/PassTCP/LuaLib/lapi.c b/TestNetworkTool/backup/PassTCP/LuaLib/lapi.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lapi.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lapi.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lapi.h b/TestNetworkTool/backup/PassTCP/LuaLib/lapi.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lapi.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lapi.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lauxlib.c b/TestNetworkTool/backup/PassTCP/LuaLib/lauxlib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lauxlib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lauxlib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lauxlib.h b/TestNetworkTool/backup/PassTCP/LuaLib/lauxlib.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lauxlib.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lauxlib.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lbaselib.c b/TestNetworkTool/backup/PassTCP/LuaLib/lbaselib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lbaselib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lbaselib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lcode.c b/TestNetworkTool/backup/PassTCP/LuaLib/lcode.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lcode.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lcode.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lcode.h b/TestNetworkTool/backup/PassTCP/LuaLib/lcode.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lcode.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lcode.h diff --git a/TestNetworkTool/PassTCP/LuaLib/ldblib.c b/TestNetworkTool/backup/PassTCP/LuaLib/ldblib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ldblib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/ldblib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/ldebug.c b/TestNetworkTool/backup/PassTCP/LuaLib/ldebug.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ldebug.c rename to TestNetworkTool/backup/PassTCP/LuaLib/ldebug.c diff --git a/TestNetworkTool/PassTCP/LuaLib/ldebug.h b/TestNetworkTool/backup/PassTCP/LuaLib/ldebug.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ldebug.h rename to TestNetworkTool/backup/PassTCP/LuaLib/ldebug.h diff --git a/TestNetworkTool/PassTCP/LuaLib/ldo.c b/TestNetworkTool/backup/PassTCP/LuaLib/ldo.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ldo.c rename to TestNetworkTool/backup/PassTCP/LuaLib/ldo.c diff --git a/TestNetworkTool/PassTCP/LuaLib/ldo.h b/TestNetworkTool/backup/PassTCP/LuaLib/ldo.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ldo.h rename to TestNetworkTool/backup/PassTCP/LuaLib/ldo.h diff --git a/TestNetworkTool/PassTCP/LuaLib/ldump.c b/TestNetworkTool/backup/PassTCP/LuaLib/ldump.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ldump.c rename to TestNetworkTool/backup/PassTCP/LuaLib/ldump.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lfunc.c b/TestNetworkTool/backup/PassTCP/LuaLib/lfunc.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lfunc.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lfunc.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lfunc.h b/TestNetworkTool/backup/PassTCP/LuaLib/lfunc.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lfunc.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lfunc.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lgc.c b/TestNetworkTool/backup/PassTCP/LuaLib/lgc.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lgc.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lgc.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lgc.h b/TestNetworkTool/backup/PassTCP/LuaLib/lgc.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lgc.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lgc.h diff --git a/TestNetworkTool/PassTCP/LuaLib/linit.c b/TestNetworkTool/backup/PassTCP/LuaLib/linit.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/linit.c rename to TestNetworkTool/backup/PassTCP/LuaLib/linit.c diff --git a/TestNetworkTool/PassTCP/LuaLib/liolib.c b/TestNetworkTool/backup/PassTCP/LuaLib/liolib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/liolib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/liolib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/llex.c b/TestNetworkTool/backup/PassTCP/LuaLib/llex.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/llex.c rename to TestNetworkTool/backup/PassTCP/LuaLib/llex.c diff --git a/TestNetworkTool/PassTCP/LuaLib/llex.h b/TestNetworkTool/backup/PassTCP/LuaLib/llex.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/llex.h rename to TestNetworkTool/backup/PassTCP/LuaLib/llex.h diff --git a/TestNetworkTool/PassTCP/LuaLib/llimits.h b/TestNetworkTool/backup/PassTCP/LuaLib/llimits.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/llimits.h rename to TestNetworkTool/backup/PassTCP/LuaLib/llimits.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lmathlib.c b/TestNetworkTool/backup/PassTCP/LuaLib/lmathlib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lmathlib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lmathlib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lmem.c b/TestNetworkTool/backup/PassTCP/LuaLib/lmem.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lmem.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lmem.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lmem.h b/TestNetworkTool/backup/PassTCP/LuaLib/lmem.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lmem.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lmem.h diff --git a/TestNetworkTool/PassTCP/LuaLib/loadlib.c b/TestNetworkTool/backup/PassTCP/LuaLib/loadlib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/loadlib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/loadlib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lobject.c b/TestNetworkTool/backup/PassTCP/LuaLib/lobject.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lobject.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lobject.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lobject.h b/TestNetworkTool/backup/PassTCP/LuaLib/lobject.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lobject.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lobject.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lopcodes.c b/TestNetworkTool/backup/PassTCP/LuaLib/lopcodes.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lopcodes.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lopcodes.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lopcodes.h b/TestNetworkTool/backup/PassTCP/LuaLib/lopcodes.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lopcodes.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lopcodes.h diff --git a/TestNetworkTool/PassTCP/LuaLib/loslib.c b/TestNetworkTool/backup/PassTCP/LuaLib/loslib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/loslib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/loslib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lparser.c b/TestNetworkTool/backup/PassTCP/LuaLib/lparser.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lparser.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lparser.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lparser.h b/TestNetworkTool/backup/PassTCP/LuaLib/lparser.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lparser.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lparser.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lstate.c b/TestNetworkTool/backup/PassTCP/LuaLib/lstate.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lstate.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lstate.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lstate.h b/TestNetworkTool/backup/PassTCP/LuaLib/lstate.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lstate.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lstate.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lstring.c b/TestNetworkTool/backup/PassTCP/LuaLib/lstring.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lstring.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lstring.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lstring.h b/TestNetworkTool/backup/PassTCP/LuaLib/lstring.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lstring.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lstring.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lstrlib.c b/TestNetworkTool/backup/PassTCP/LuaLib/lstrlib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lstrlib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lstrlib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/ltable.c b/TestNetworkTool/backup/PassTCP/LuaLib/ltable.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ltable.c rename to TestNetworkTool/backup/PassTCP/LuaLib/ltable.c diff --git a/TestNetworkTool/PassTCP/LuaLib/ltable.h b/TestNetworkTool/backup/PassTCP/LuaLib/ltable.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ltable.h rename to TestNetworkTool/backup/PassTCP/LuaLib/ltable.h diff --git a/TestNetworkTool/PassTCP/LuaLib/ltablib.c b/TestNetworkTool/backup/PassTCP/LuaLib/ltablib.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ltablib.c rename to TestNetworkTool/backup/PassTCP/LuaLib/ltablib.c diff --git a/TestNetworkTool/PassTCP/LuaLib/ltm.c b/TestNetworkTool/backup/PassTCP/LuaLib/ltm.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ltm.c rename to TestNetworkTool/backup/PassTCP/LuaLib/ltm.c diff --git a/TestNetworkTool/PassTCP/LuaLib/ltm.h b/TestNetworkTool/backup/PassTCP/LuaLib/ltm.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/ltm.h rename to TestNetworkTool/backup/PassTCP/LuaLib/ltm.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lua.c b/TestNetworkTool/backup/PassTCP/LuaLib/lua.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lua.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lua.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lua.h b/TestNetworkTool/backup/PassTCP/LuaLib/lua.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lua.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lua.h diff --git a/TestNetworkTool/PassTCP/LuaLib/luac.c b/TestNetworkTool/backup/PassTCP/LuaLib/luac.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/luac.c rename to TestNetworkTool/backup/PassTCP/LuaLib/luac.c diff --git a/TestNetworkTool/PassTCP/LuaLib/luaconf.h b/TestNetworkTool/backup/PassTCP/LuaLib/luaconf.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/luaconf.h rename to TestNetworkTool/backup/PassTCP/LuaLib/luaconf.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lualib.h b/TestNetworkTool/backup/PassTCP/LuaLib/lualib.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lualib.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lualib.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lundump.c b/TestNetworkTool/backup/PassTCP/LuaLib/lundump.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lundump.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lundump.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lundump.h b/TestNetworkTool/backup/PassTCP/LuaLib/lundump.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lundump.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lundump.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lvm.c b/TestNetworkTool/backup/PassTCP/LuaLib/lvm.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lvm.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lvm.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lvm.h b/TestNetworkTool/backup/PassTCP/LuaLib/lvm.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lvm.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lvm.h diff --git a/TestNetworkTool/PassTCP/LuaLib/lzio.c b/TestNetworkTool/backup/PassTCP/LuaLib/lzio.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lzio.c rename to TestNetworkTool/backup/PassTCP/LuaLib/lzio.c diff --git a/TestNetworkTool/PassTCP/LuaLib/lzio.h b/TestNetworkTool/backup/PassTCP/LuaLib/lzio.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/lzio.h rename to TestNetworkTool/backup/PassTCP/LuaLib/lzio.h diff --git a/TestNetworkTool/PassTCP/LuaLib/print.c b/TestNetworkTool/backup/PassTCP/LuaLib/print.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/print.c rename to TestNetworkTool/backup/PassTCP/LuaLib/print.c diff --git a/TestNetworkTool/PassTCP/LuaLib/tolua++.h b/TestNetworkTool/backup/PassTCP/LuaLib/tolua++.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/tolua++.h rename to TestNetworkTool/backup/PassTCP/LuaLib/tolua++.h diff --git a/TestNetworkTool/PassTCP/LuaLib/tolua.c b/TestNetworkTool/backup/PassTCP/LuaLib/tolua.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/tolua.c rename to TestNetworkTool/backup/PassTCP/LuaLib/tolua.c diff --git a/TestNetworkTool/PassTCP/LuaLib/tolua_event.c b/TestNetworkTool/backup/PassTCP/LuaLib/tolua_event.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/tolua_event.c rename to TestNetworkTool/backup/PassTCP/LuaLib/tolua_event.c diff --git a/TestNetworkTool/PassTCP/LuaLib/tolua_event.h b/TestNetworkTool/backup/PassTCP/LuaLib/tolua_event.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/tolua_event.h rename to TestNetworkTool/backup/PassTCP/LuaLib/tolua_event.h diff --git a/TestNetworkTool/PassTCP/LuaLib/tolua_is.c b/TestNetworkTool/backup/PassTCP/LuaLib/tolua_is.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/tolua_is.c rename to TestNetworkTool/backup/PassTCP/LuaLib/tolua_is.c diff --git a/TestNetworkTool/PassTCP/LuaLib/tolua_map.c b/TestNetworkTool/backup/PassTCP/LuaLib/tolua_map.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/tolua_map.c rename to TestNetworkTool/backup/PassTCP/LuaLib/tolua_map.c diff --git a/TestNetworkTool/PassTCP/LuaLib/tolua_push.c b/TestNetworkTool/backup/PassTCP/LuaLib/tolua_push.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/tolua_push.c rename to TestNetworkTool/backup/PassTCP/LuaLib/tolua_push.c diff --git a/TestNetworkTool/PassTCP/LuaLib/tolua_to.c b/TestNetworkTool/backup/PassTCP/LuaLib/tolua_to.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/tolua_to.c rename to TestNetworkTool/backup/PassTCP/LuaLib/tolua_to.c diff --git a/TestNetworkTool/PassTCP/LuaLib/toluabind.c b/TestNetworkTool/backup/PassTCP/LuaLib/toluabind.c similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/toluabind.c rename to TestNetworkTool/backup/PassTCP/LuaLib/toluabind.c diff --git a/TestNetworkTool/PassTCP/LuaLib/toluabind.h b/TestNetworkTool/backup/PassTCP/LuaLib/toluabind.h similarity index 100% rename from TestNetworkTool/PassTCP/LuaLib/toluabind.h rename to TestNetworkTool/backup/PassTCP/LuaLib/toluabind.h diff --git a/TestNetworkTool/backup/PassTCP/PacketDlg.cpp b/TestNetworkTool/backup/PassTCP/PacketDlg.cpp new file mode 100644 index 000000000..8d1a852ab --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/PacketDlg.cpp @@ -0,0 +1,293 @@ +// CPacketDlg.cpp : ʵļ +// + +#include "stdafx.h" +#include "PassTCP.h" +#include "PacketDlg.h" +#include "tinyxml.h" + +// CPacketDlg Ի + +IMPLEMENT_DYNAMIC(CPacketDlg, CDialog) + +CPacketDlg::CPacketDlg(CWnd* pParent /*=NULL*/) + : CDialog(CPacketDlg::IDD, pParent) +{ + +} + +CPacketDlg::~CPacketDlg() +{ +} + +void CPacketDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_EDIT1, m_txtPacketData); + DDX_Control(pDX, IDC_LIST1, m_lbRondomPacketList); + DDX_Control(pDX, IDC_LIST2, m_lbPreviewList); + DDX_Control(pDX, IDC_EDIT2, m_txtRecvLength); + DDX_Control(pDX, IDC_RADIO1, m_RadioBuffer); +} + + +BEGIN_MESSAGE_MAP(CPacketDlg, CDialog) + ON_BN_CLICKED(IDC_BUTTON1, &CPacketDlg::OnBnClickedButton1) + ON_BN_CLICKED(IDC_BUTTON3, &CPacketDlg::OnBnClickedButton3) + ON_BN_CLICKED(IDC_BUTTON4, &CPacketDlg::OnBnClickedButton4) + ON_BN_CLICKED(IDC_BUTTON5, &CPacketDlg::OnBnClickedButton5) + ON_BN_CLICKED(IDC_BUTTON2, &CPacketDlg::OnBnClickedButton2) + ON_BN_CLICKED(IDC_BUTTON6, &CPacketDlg::OnBnClickedButton6) +END_MESSAGE_MAP() + +void CPacketDlg::SetBaseDataLogic(CBaseDataLogic* pBaseDataLogic) +{ + m_pBaseDataLogic = pBaseDataLogic; + m_pBaseDataLogic->ClearRandomPacket(); + m_pBaseDataLogic->InitSendSize(MAX_RANDOM_PACKET); +} + +// CPacketDlg Ϣ + +void CPacketDlg::OnBnClickedButton1() +{ + //ݰ + CString strData; + char szPacketData[MAX_RANDOM_PACKET] = {'\0'}; + + if(m_pBaseDataLogic == NULL) + { + MessageBox(_T("ָm_pBaseDataLogicָ룬ָ벻Ϊա")); + return; + } + + m_txtPacketData.GetWindowText(strData); + int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); + int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szPacketData, MAX_RANDOM_PACKET, NULL,NULL); + szPacketData[nDecLen] = '\0'; + + //ýֽ + m_txtRecvLength.GetWindowText(strData); + int nRecvLength = _ttoi(strData); + + if(nRecvLength <= 0) + { + MessageBox(_T("ָݰijȣ޷͡")); + return; + } + + if(((CButton *)GetDlgItem(IDC_RADIO1))->GetCheck() == 1) + { + //ģʽ2 + m_pBaseDataLogic->InsertRandomPacket(szPacketData, nDecLen, nRecvLength, 2); + } + else + { + //ıģʽ1 + string strFormatData = (string)szPacketData; + + //滻\r\n + string_replace(strFormatData, "\\r", "\r"); + string_replace(strFormatData, "\\n", "\n"); + + m_pBaseDataLogic->InsertRandomPacket(strFormatData.c_str(), strFormatData.length(), nRecvLength, 1); + } + + ShowPacketList(); +} + +void CPacketDlg::ShowPacketList() +{ + //ʾеݰ + m_lbRondomPacketList.ResetContent(); + + if(m_pBaseDataLogic == NULL) + { + return; + } + + for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) + { + _RandomPacketInfo* pRandomPacketInfo = m_pBaseDataLogic->GettRandomPacket(i); + if(NULL != pRandomPacketInfo) + { + wchar_t szTemp[MAX_RANDOM_PACKET] = {'\0'}; + + int nSrcLen = MultiByteToWideChar(CP_ACP, 0, pRandomPacketInfo->szPacket, -1, NULL, 0); + int nDecLen = MultiByteToWideChar(CP_ACP, 0, pRandomPacketInfo->szPacket, -1, szTemp, MAX_RANDOM_PACKET); + szTemp[nDecLen] = '\0'; + + m_lbRondomPacketList.AddString(szTemp); + } + } +} + +void CPacketDlg::OnBnClickedButton3() +{ + //Ԥݰ + m_lbPreviewList.ResetContent(); + int nRecvLength = 0; + + char szTemp[MAX_RANDOM_PACKET] = {'\0'}; + for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) + { + int nLen = MAX_RANDOM_PACKET; + m_pBaseDataLogic->GetReview(i, szTemp, nLen, nRecvLength); + if(0 < nLen) + { + wchar_t sszTemp[MAX_RANDOM_PACKET] = {'\0'}; + + int nSrcLen = MultiByteToWideChar(CP_ACP, 0, szTemp, -1, NULL, 0); + int nDecLen = MultiByteToWideChar(CP_ACP, 0, szTemp, -1, sszTemp, MAX_RANDOM_PACKET); + sszTemp[nDecLen] = '\0'; + + m_lbPreviewList.AddString(sszTemp); + } + } +} + +void CPacketDlg::OnBnClickedButton4() +{ + //ɾѡеĿ + int nIndex = m_lbRondomPacketList.GetCurSel(); + if(nIndex >= 0) + { + m_pBaseDataLogic->DeleteRandomPacket(nIndex); + } +} + +BOOL CPacketDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + m_RadioBuffer.SetCheck(BST_CHECKED); + m_txtRecvLength.SetWindowText(_T("0")); + + return TRUE; +} +void CPacketDlg::OnBnClickedButton5() +{ + //رյǰ + OnOK(); +} + +void CPacketDlg::OnBnClickedButton2() +{ + //XMLļ + FILE* pFile = NULL; + + char szFileName[20]; + sprintf_s(szFileName, PACKETDATA_FILENAME); + fopen_s(&pFile, szFileName, "w"); + + if(pFile == NULL) + { + MessageBox(_T("˳ݰļ"), _T("ʾϢ"), MB_OK); + return; + } + + char szLogText[MAX_RANDOM_PACKET] = {'\0'}; + + sprintf_s(szLogText, MAX_RANDOM_PACKET, "\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf_s(szLogText, MAX_RANDOM_PACKET, "\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + for(int i = 0; i < m_pBaseDataLogic->GetRandomPacketCount(); i++) + { + _RandomPacketInfo* pRandomPacketInfo = m_pBaseDataLogic->GettRandomPacket(i); + sprintf_s(szLogText, MAX_RANDOM_PACKET, "\n" + ,pRandomPacketInfo->nLen + ,pRandomPacketInfo->nType + ,pRandomPacketInfo->nRecdvLength + ,pRandomPacketInfo->szPacket); + + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + } + + sprintf_s(szLogText, MAX_RANDOM_PACKET, "\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + fclose(pFile); + + MessageBox(_T("˳ݰɹ"), _T("ʾϢ"), MB_OK); +} + +void CPacketDlg::OnBnClickedButton6() +{ + m_pBaseDataLogic->ClearRandomPacket(); + + //ȡXMLļ + TiXmlDocument * pDocument = new TiXmlDocument(PACKETDATA_FILENAME);//tstlΪļ·ļ + pDocument->LoadFile(); + + if(NULL == pDocument) + { + MessageBox(_T("ȡ˳ݰxmlļʧ"), _T("ʾϢ"), MB_OK); + return; + } + + TiXmlElement *Root = pDocument->RootElement();//ȡڵ + TiXmlElement *Particl = NULL; + + int nLen = 0; + int nType = 0; + int nRecvLength = 0; + + for(Particl = Root->FirstChildElement();Particl != NULL;Particl = Particl->NextSiblingElement()) + { + //õĵ + const char *sztext = Particl->GetText(); + + //õĵ + TiXmlAttribute* pAddrAttr = Particl->FirstAttribute(); + if(strcmp(pAddrAttr->Name(), "Len") == 0) + { + nLen = atoi(pAddrAttr->Value()); + } + else if(strcmp(pAddrAttr->Name(), "Type") == 0) + { + nType = atoi(pAddrAttr->Value()); + } + else + { + nRecvLength = atoi(pAddrAttr->Value()); + } + + TiXmlAttribute *pAttr1 = pAddrAttr->Next(); + if(strcmp(pAttr1->Name(), "Len") == 0) + { + nLen = atoi(pAttr1->Value()); + } + else if(strcmp(pAttr1->Name(), "Type") == 0) + { + nType = atoi(pAttr1->Value()); + } + else + { + nRecvLength = atoi(pAttr1->Value()); + } + + TiXmlAttribute * pAttr2 = pAttr1->Next(); + if(strcmp(pAttr2->Name(), "Len") == 0) + { + nLen = atoi(pAttr2->Value()); + } + else if(strcmp(pAttr2->Name(), "Type") == 0) + { + nType = atoi(pAttr2->Value()); + } + else + { + nRecvLength = atoi(pAttr2->Value()); + } + + // + m_pBaseDataLogic->InsertRandomPacket(sztext, nLen, nRecvLength, nType); + } + + ShowPacketList(); + + delete pDocument; +} diff --git a/TestNetworkTool/backup/PassTCP/PacketDlg.h b/TestNetworkTool/backup/PassTCP/PacketDlg.h new file mode 100644 index 000000000..38edd1f7a --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/PacketDlg.h @@ -0,0 +1,48 @@ +#pragma once +#include "afxwin.h" +#include "define.h" + +// PacketDlg Ի +#define PACKETDATA_FILENAME "PacketData.xml" + +class CPacketDlg : public CDialog +{ + DECLARE_DYNAMIC(CPacketDlg) + +public: + CPacketDlg(CWnd* pParent = NULL); // ׼캯 + virtual ~CPacketDlg(); + +// Ի + enum { IDD = IDD_PACKET_DIALOG }; + +public: + void SetBaseDataLogic(CBaseDataLogic* pBaseDataLogic); + +private: + void ShowPacketList(); + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ + + virtual BOOL OnInitDialog(); + + DECLARE_MESSAGE_MAP() +public: + CEdit m_txtPacketData; + CListBox m_lbRondomPacketList; + CListBox m_lbPreviewList; + CEdit m_txtRecvLength; + +private: + CBaseDataLogic* m_pBaseDataLogic; + +public: + afx_msg void OnBnClickedButton1(); + afx_msg void OnBnClickedButton3(); + afx_msg void OnBnClickedButton4(); + CButton m_RadioBuffer; + afx_msg void OnBnClickedButton5(); + afx_msg void OnBnClickedButton2(); + afx_msg void OnBnClickedButton6(); +}; diff --git a/TestNetworkTool/PassTCP/PassTCP.cpp b/TestNetworkTool/backup/PassTCP/PassTCP.cpp similarity index 100% rename from TestNetworkTool/PassTCP/PassTCP.cpp rename to TestNetworkTool/backup/PassTCP/PassTCP.cpp diff --git a/TestNetworkTool/PassTCP/PassTCP.h b/TestNetworkTool/backup/PassTCP/PassTCP.h similarity index 100% rename from TestNetworkTool/PassTCP/PassTCP.h rename to TestNetworkTool/backup/PassTCP/PassTCP.h diff --git a/TestNetworkTool/PassTCP/PassTCP.rc b/TestNetworkTool/backup/PassTCP/PassTCP.rc similarity index 100% rename from TestNetworkTool/PassTCP/PassTCP.rc rename to TestNetworkTool/backup/PassTCP/PassTCP.rc diff --git a/TestNetworkTool/PassTCP/PassTCP.vcproj b/TestNetworkTool/backup/PassTCP/PassTCP.vcproj similarity index 100% rename from TestNetworkTool/PassTCP/PassTCP.vcproj rename to TestNetworkTool/backup/PassTCP/PassTCP.vcproj diff --git a/TestNetworkTool/backup/PassTCP/PassTCPDlg.cpp b/TestNetworkTool/backup/PassTCP/PassTCPDlg.cpp new file mode 100644 index 000000000..0c7e7d877 --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/PassTCPDlg.cpp @@ -0,0 +1,1202 @@ + +// PassTCPDlg.cpp : ʵļ +// + +#include "stdafx.h" +#include "PassTCP.h" +#include "PassTCPDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// Ӧó򡰹ڡ˵ CAboutDlg Ի + +//ִ߳ +DWORD WINAPI ThreadProc(LPVOID argv) +{ + + CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )argv; + pClientTcpSocket->Run(); + + return 0; +} + +DWORD WINAPI ThreadUDPProc(LPVOID argv) +{ + + CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )argv; + pClientUdpSocket->Run(); + + return 0; +} + + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + + // Ի + enum { IDD = IDD_ABOUTBOX }; + +protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ + + // ʵ +protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) +END_MESSAGE_MAP() + + +// CPassTCPDlg Ի + + + + +CPassTCPDlg::CPassTCPDlg(CWnd* pParent /*=NULL*/) +: CDialog(CPassTCPDlg::IDD, pParent) +, m_nRadio(0) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); +} + +void CPassTCPDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + DDX_Control(pDX, IDC_EDIT1, m_txtServerIP); + DDX_Control(pDX, IDC_EDIT2, m_txtPort); + DDX_Control(pDX, IDC_EDIT3, m_txtThreadCount); + DDX_Control(pDX, IDC_EDIT13, m_txtRecvTimeout); + DDX_Control(pDX, IDC_EDIT4, m_txtSocketInterval); + DDX_Control(pDX, IDC_CHECK1, m_chkIsAlwayConnect); + DDX_Control(pDX, IDC_CHECK3, m_chkRadomaDelay); + DDX_Control(pDX, IDC_CHECK2, m_chkIsRecv); + DDX_Control(pDX, IDC_CHECK4, m_ChkIsBroken); + DDX_Control(pDX, IDC_EDIT6, m_txtSuccessConnect); + DDX_Control(pDX, IDC_EDIT7, m_txtSuccessSend); + DDX_Control(pDX, IDC_EDIT8, m_txtSuccessRecv); + DDX_Control(pDX, IDC_EDIT9, m_txtCurrConnect); + DDX_Control(pDX, IDC_EDIT10, m_txtFailConnect); + DDX_Control(pDX, IDC_EDIT11, m_txtFailSend); + DDX_Control(pDX, IDC_EDIT12, m_txtFailRecv); + DDX_Control(pDX, IDC_EDIT14, m_txtRecvLength); + DDX_Control(pDX, IDC_CHECK5, m_chkRadomSendCount); + DDX_Control(pDX, IDC_CHECK6, m_chkIsWriteLog); + DDX_Control(pDX, IDC_CHECK7, m_chkSendOne); + DDX_Radio(pDX, IDC_RADIO1, m_nRadio); + DDX_Control(pDX, IDC_EDIT15, m_txtClientUdpPort); + DDX_Control(pDX, IDC_EDIT16, m_txtPacketTimewait); + DDX_Control(pDX, IDC_EDIT17, m_txtSendByteCount); + DDX_Control(pDX, IDC_EDIT18, m_txtRecvByteCount); + DDX_Control(pDX, IDC_COMBO1, m_cbSendBuffStyle); + DDX_Control(pDX, IDC_RICHEDIT21, m_reSendText); + //DDX_Control(pDX, IDC_EDIT5, m_reSendText); + DDX_Control(pDX, IDC_EDIT19, m_txtLuaFilePath); + DDX_Control(pDX, IDC_CHECK8, m_chkLuaAdvance); + DDX_Control(pDX, IDC_EDIT20, m_txtSendCount); + DDX_Control(pDX, IDC_EDIT21, m_txtMinTime); + DDX_Control(pDX, IDC_EDIT22, m_txtMaxTime); +} + +BEGIN_MESSAGE_MAP(CPassTCPDlg, CDialog) + ON_WM_SYSCOMMAND() + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + //}}AFX_MSG_MAP + ON_BN_CLICKED(IDC_BUTTON1, &CPassTCPDlg::OnBnClickedButton1) + ON_WM_CLOSE() + ON_BN_CLICKED(IDC_BUTTON2, &CPassTCPDlg::OnBnClickedButton2) + ON_WM_TIMER() + ON_BN_CLICKED(IDC_BUTTON3, &CPassTCPDlg::OnBnClickedButton3) + ON_CBN_SELCHANGE(IDC_COMBO1, &CPassTCPDlg::OnCbnSelchangeCombo1) + ON_BN_CLICKED(IDC_BUTTON4, &CPassTCPDlg::OnBnClickedButton4) + ON_BN_CLICKED(IDC_BUTTON5, &CPassTCPDlg::OnBnClickedButton5) +END_MESSAGE_MAP() + + +// CPassTCPDlg Ϣ + +BOOL CPassTCPDlg::OnInitDialog() +{ + CDialog::OnInitDialog(); + + // ...˵ӵϵͳ˵С + + // IDM_ABOUTBOX ϵͳΧڡ + ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); + ASSERT(IDM_ABOUTBOX < 0xF000); + + CMenu* pSysMenu = GetSystemMenu(FALSE); + if (pSysMenu != NULL) + { + BOOL bNameValid; + CString strAboutMenu; + bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX); + ASSERT(bNameValid); + if (!strAboutMenu.IsEmpty()) + { + pSysMenu->AppendMenu(MF_SEPARATOR); + pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); + } + } + + // ô˶ԻͼꡣӦóڲǶԻʱܽԶ + // ִд˲ + SetIcon(m_hIcon, TRUE); // ôͼ + SetIcon(m_hIcon, FALSE); // Сͼ + + SetTimer(1, 1000, NULL); + InitRandom(); + + // TODO: ڴӶijʼ + InitView(); + + return TRUE; // ǽõؼ򷵻 TRUE +} + +void CPassTCPDlg::OnSysCommand(UINT nID, LPARAM lParam) +{ + if ((nID & 0xFFF0) == IDM_ABOUTBOX) + { + CAboutDlg dlgAbout; + dlgAbout.DoModal(); + } + else + { + CDialog::OnSysCommand(nID, lParam); + } +} + +// ԻСťҪĴ +// Ƹͼꡣʹĵ/ͼģ͵ MFC Ӧó +// ⽫ɿԶɡ + +void CPassTCPDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // ڻƵ豸 + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(dc.GetSafeHdc()), 0); + + // ʹͼڹо + int cxIcon = GetSystemMetrics(SM_CXICON); + int cyIcon = GetSystemMetrics(SM_CYICON); + CRect rect; + GetClientRect(&rect); + int x = (rect.Width() - cxIcon + 1) / 2; + int y = (rect.Height() - cyIcon + 1) / 2; + + // ͼ + dc.DrawIcon(x, y, m_hIcon); + } + else + { + CDialog::OnPaint(); + } +} + +//û϶Сʱϵͳô˺ȡù +//ʾ +HCURSOR CPassTCPDlg::OnQueryDragIcon() +{ + return static_cast(m_hIcon); +} + + +void CPassTCPDlg::OnBnClickedButton1() +{ + //ʼѹ + char* pSendData = NULL; + ClearResult(); + Close(); + + CString strData; + + m_txtThreadCount.GetWindowText(strData); + int nThreadCount = _ttoi((LPCTSTR)strData); + m_txtSendCount.GetWindowText(strData); + int nAllSendCount = _ttoi((LPCTSTR)strData); + + //߳㷢 + int nThreadSendCount = nAllSendCount / nThreadCount; + + for(int i = 0; i < nThreadCount; i++) + { + //ȡ߳Ϣ + _Socket_Info* pSocket_Info = new _Socket_Info(); + _Socket_State_Info* pSocket_State_Info = new _Socket_State_Info(); + + ENUM_TYPE_PROTOCOL emType = ENUM_PROTOCOL_TCP; + //ĬTCPͣ0TCP1UDP + switch(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3)) + { + case IDC_RADIO1: + { + pSocket_Info->m_nConnectType = 0; + emType = ENUM_PROTOCOL_TCP; + if(m_pLogic == NULL) + { + CNomalLogic* pNomalLogic = new CNomalLogic(); + m_pLogic = (CBaseDataLogic* )pNomalLogic; + pSocket_Info->m_pLogic = m_pLogic; + } + else + { + pSocket_Info->m_pLogic = m_pLogic; + } + break; + } + case IDC_RADIO2: + { + pSocket_Info->m_nConnectType = 1; + emType = ENUM_PROTOCOL_UDP; + if(m_pLogic == NULL) + { + CNomalLogic* pNomalLogic = new CNomalLogic(); + m_pLogic = (CBaseDataLogic* )pNomalLogic; + pSocket_Info->m_pLogic = m_pLogic; + } + else + { + pSocket_Info->m_pLogic = m_pLogic; + } + break; + } + case IDC_RADIO3: + { + pSocket_Info->m_nConnectType = 0; + emType = ENUM_PROTOCOL_WEBSOCKET; + if(m_pLogic == NULL) + { + CWebSocketLogic* pWebSocketLogic = new CWebSocketLogic(); + pSocket_Info->m_pLogic = (CBaseDataLogic* )pWebSocketLogic; + } + else + { + pSocket_Info->m_pLogic = m_pLogic; + } + break; + } + } + + m_txtServerIP.GetWindowText(strData); + int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); + int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSocket_Info->m_szSerevrIP, MAX_BUFF_20, NULL,NULL); + pSocket_Info->m_szSerevrIP[nDecLen] = '\0'; + + m_txtPort.GetWindowText(strData); + pSocket_Info->m_nPort = _ttoi((LPCTSTR)strData); + m_txtRecvTimeout.GetWindowText(strData); + pSocket_Info->m_nRecvTimeout = _ttoi((LPCTSTR)strData); + m_txtSocketInterval.GetWindowText(strData); + pSocket_Info->m_nDelaySecond = _ttoi((LPCTSTR)strData); + m_txtRecvLength.GetWindowText(strData); + pSocket_Info->m_pLogic->SetRecvLength(_ttoi((LPCTSTR)strData)); + m_txtClientUdpPort.GetWindowText(strData); + pSocket_Info->m_nUdpClientPort = _ttoi((LPCTSTR)strData); + m_txtPacketTimewait.GetWindowText(strData); + pSocket_Info->m_nPacketTimewait = _ttoi((LPCTSTR)strData); + + if(nThreadSendCount > 0) + { + if(i == nThreadCount - 1 && nThreadCount > 1) + { + pSocket_Info->m_nSendCount = nThreadSendCount + ( nAllSendCount % nThreadSendCount); + } + else + { + pSocket_Info->m_nSendCount = nThreadSendCount; + } + } + + m_reSendText.GetWindowText(strData); + + + int nBufferSize = 0; + if(m_chkLuaAdvance.GetCheck() == BST_CHECKED) + { + //Luaļģʽֱӳʼһ100kݿ + //Ȼݽűȥ֯ + pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); + } + else + { + nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); + nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); + pSendData = new char[nBufferSize]; + nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSendData, nBufferSize, NULL,NULL); + pSendData[nDecLen] = '\0'; + + if(m_cbSendBuffStyle.GetCurSel() == 0) + { + if(emType != ENUM_PROTOCOL_WEBSOCKET) + { + //Ƕģʽ + CConvertBuffer objConvertBuffer; + //ҪתݿС + pSocket_Info->m_pLogic->InitSendSize(objConvertBuffer.GetBufferSize(pSendData, nDecLen)); + //ݴתɶƴ + int nSendLen = nDecLen; + objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), + (unsigned char*)pSocket_Info->m_pLogic->GetSendData(), nSendLen); + } + else + { + //webSocketģʽ + char szOriData[100 * MAX_BUFF_1024] = {'\0'}; + //Ƕģʽ + CConvertBuffer objConvertBuffer; + //ҪתݿС + pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); + //ݴתɶƴ + int nSendLen = 100 * MAX_BUFF_1024; + objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), + (unsigned char*)szOriData, nSendLen); + + pSocket_Info->m_pLogic->SetSendBuff(szOriData, nSendLen); + } + } + else + { + if(emType != ENUM_PROTOCOL_WEBSOCKET) + { + //ıģʽ + pSocket_Info->m_pLogic->InitSendSize(nDecLen); + memcpy_s(pSocket_Info->m_pLogic->GetSendData(), nDecLen, pSendData, nDecLen); + } + else + { + //webSocketģʽ + pSocket_Info->m_pLogic->InitSendSize(100 * MAX_BUFF_1024); + pSocket_Info->m_pLogic->SetSendBuff(pSendData, nDecLen); + } + } + + delete[] pSendData; + + } + + if(m_chkIsAlwayConnect.GetCheck() == BST_CHECKED) + { + pSocket_Info->m_blIsAlwayConnect = true; + } + else + { + pSocket_Info->m_blIsAlwayConnect = false; + } + + if(m_chkRadomaDelay.GetCheck() == BST_CHECKED) + { + pSocket_Info->m_blIsRadomaDelay = true; + } + else + { + pSocket_Info->m_blIsRadomaDelay = false; + } + + if(m_chkIsRecv.GetCheck() == BST_CHECKED) + { + pSocket_Info->m_blIsRecv = true; + } + else + { + pSocket_Info->m_blIsRecv = false; + } + + if(m_ChkIsBroken.GetCheck() == BST_CHECKED) + { + pSocket_Info->m_blIsBroken = true; + } + else + { + pSocket_Info->m_blIsBroken = false; + } + + if(m_chkRadomSendCount.GetCheck() == BST_CHECKED) + { + pSocket_Info->m_blIsSendCount = true; + } + else + { + pSocket_Info->m_blIsSendCount = false; + } + + if(m_chkIsWriteLog.GetCheck() == BST_CHECKED) + { + pSocket_Info->m_blIsWriteFile = true; + } + else + { + pSocket_Info->m_blIsWriteFile = false; + } + + if(m_chkSendOne.GetCheck() == BST_CHECKED) + { + pSocket_Info->m_blIsSendOne = true; + } + else + { + pSocket_Info->m_blIsSendOne = false; + } + + //Ƿ߼ģʽ + if(m_chkLuaAdvance.GetCheck() == BST_CHECKED) + { + pSocket_Info->m_blLuaAdvance = true; + + //򿪸߼ģʽȡļ + m_txtLuaFilePath.GetWindowText(strData); + + if(strData == "") + { + MessageBox(_T("Ѿ˸߼ģʽñҪLuaļ")); + delete pSocket_Info; + delete pSocket_State_Info; + return; + } + + nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); + int nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); + nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSocket_Info->m_szLuaFileName, nBufferSize, NULL,NULL); + pSocket_Info->m_szLuaFileName[nDecLen] = '\0'; + } + else + { + pSocket_Info->m_blLuaAdvance = false; + } + + if(pSocket_Info->m_nConnectType == 0) + { + //TCP + CClientTcpSocket* pClientTcpSocket = new CClientTcpSocket(); + pClientTcpSocket->SetSocketThread(pSocket_Info, pSocket_State_Info); + pClientTcpSocket->SetThreadID(i); + + DWORD ThreadID = 0; + CreateThread(NULL, NULL, ThreadProc, (LPVOID)pClientTcpSocket, NULL, &ThreadID); + + m_vecClientTcpSocket.push_back(pClientTcpSocket); + } + else + { + //UDP + CClientUdpSocket* pClientUdpSocket = new CClientUdpSocket(); + pClientUdpSocket->SetSocketThread(pSocket_Info, pSocket_State_Info); + + DWORD ThreadID = 0; + CreateThread(NULL, NULL, ThreadUDPProc, (LPVOID)pClientUdpSocket, NULL, &ThreadID); + + m_vecClientUdpSocket.push_back(pClientUdpSocket); + } + + m_tmBegin = CTime::GetCurrentTime(); + m_blIsRun = true; + } +} + +void CPassTCPDlg::InitView() +{ + m_chkIsRecv.SetCheck(BST_CHECKED); + m_ChkIsBroken.SetCheck(BST_CHECKED); + + m_reSendText.SetOptions(ECOOP_XOR, ECO_WANTRETURN); + + SetRichTextColor(COLOR_TEXT_BULE); + + m_pLogic = NULL; + + m_txtServerIP.SetWindowText(_T("127.0.0.1")); + m_txtPort.SetWindowText(_T("10002")); + m_txtThreadCount.SetWindowText(_T("1")); + m_txtRecvTimeout.SetWindowText(_T("1000")); + m_txtPacketTimewait.SetWindowText(_T("0")); + m_txtSocketInterval.SetWindowText(_T("0")); + m_txtRecvLength.SetWindowText(_T("12")); + m_reSendText.SetWindowText(_T("01 00 00 10 08 00 00 00 46 45 45 45 45 59 45 53 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 be cd aa 8f 3c 01 00 00")); + m_txtClientUdpPort.SetWindowText(_T("20002")); + + m_txtSendByteCount.SetWindowText(_T("0")); + m_txtRecvByteCount.SetWindowText(_T("0")); + + m_txtSendCount.SetWindowText(_T("0")); + m_txtMinTime.SetWindowText(_T("0")); + m_txtMaxTime.SetWindowText(_T("0")); + + m_nRadio = 1; + + m_cbSendBuffStyle.InsertString(0, _T("ģʽ")); + m_cbSendBuffStyle.InsertString(1, _T("ıģʽ")); + m_cbSendBuffStyle.SetCurSel(0); + m_nCurrTextStyle = 0; + + ClearResult(); + + //ʼTCP + WSADATA wsaData; + int nErr = WSAStartup(MAKEWORD(2, 2), &wsaData); + if(nErr != 0) + { + MessageBox(_T("socketʧܣ鱾socket汾"), _T("Ϣ"), MB_OK); + } +} + +void CPassTCPDlg::ClearResult() +{ + m_txtSuccessConnect.SetWindowText(_T("0")); + m_txtSuccessSend.SetWindowText(_T("0")); + m_txtSuccessRecv.SetWindowText(_T("0")); + m_txtCurrConnect.SetWindowText(_T("0")); + m_txtFailConnect.SetWindowText(_T("0")); + m_txtFailSend.SetWindowText(_T("0")); + m_txtFailRecv.SetWindowText(_T("0")); + + m_txtSendByteCount.SetWindowText(_T("0")); + m_txtRecvByteCount.SetWindowText(_T("0")); +} + +void CPassTCPDlg::Close(bool blClose) +{ + int nCount = m_vecClientUdpSocket.size(); + for(int i = 0; i < nCount; i++) + { + CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; + if(NULL != pClientUdpSocket) + { + pClientUdpSocket->Stop(); + + DWORD dwSleep = 100; + Sleep(dwSleep); + + delete pClientUdpSocket; + pClientUdpSocket = NULL; + } + } + m_vecClientUdpSocket.clear(); + + nCount = m_vecClientTcpSocket.size(); + for(int i = 0; i < nCount; i++) + { + CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; + if(NULL != pClientTcpSocket) + { + pClientTcpSocket->Stop(); + + DWORD dwSleep = 100; + Sleep(dwSleep); + + delete pClientTcpSocket; + pClientTcpSocket = NULL; + } + } + + m_vecClientTcpSocket.clear(); + + if(blClose == true && m_pLogic != NULL) + { + if(m_pLogic->m_nClassTye == 1) + { + delete (CNomalLogic* )m_pLogic; + } + else + { + delete (CWebSocketLogic* )m_pLogic; + } + } +} + +void CPassTCPDlg::OnClose() +{ + Close(true); + WSACleanup(); + CDialog::OnClose(); +} + +void CPassTCPDlg::OnBnClickedButton2() +{ + //ֹͣѹ + int nCount = (int)m_vecClientUdpSocket.size(); + for(int i = 0; i < nCount; i++) + { + CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; + if(NULL != pClientUdpSocket) + { + pClientUdpSocket->Stop(); + } + } + + nCount = (int)m_vecClientTcpSocket.size(); + for(int i = 0; i < nCount; i++) + { + CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; + if(NULL != pClientTcpSocket) + { + pClientTcpSocket->Stop(); + } + } + + m_tmEnd = CTime::GetCurrentTime(); + m_blIsRun = false; +} + +void CPassTCPDlg::OnTimer(UINT_PTR nIDEvent) +{ + if(nIDEvent == 1) + { + int nSuccessConnect = 0; + int nSuccessSend = 0; + int nSuccessRecv = 0; + int ntCurrConnect = 0; + int nFailConnect = 0; + int nFailSend = 0; + int nFailRecv = 0; + int nCurrConnect = 0; + int nSendByteCount = 0; + int nRecvByteCount = 0; + int nMinTime = 0; + int nMaxTime = 0; + + int nConnectType = 0; + switch(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3)) + { + case IDC_RADIO1: + nConnectType = 0; + break; + case IDC_RADIO2: + nConnectType = 1; + break; + case IDC_RADIO3: + nConnectType = 0; + break; + } + + if(nConnectType == 0) + { + for(int i = 0; i < (int)m_vecClientTcpSocket.size(); i++) + { + CClientTcpSocket* pClientTcpSocket = (CClientTcpSocket* )m_vecClientTcpSocket[i]; + if(NULL != pClientTcpSocket) + { + _Socket_State_Info* pSocket_State_Info = pClientTcpSocket->GetStateInfo(); + if(NULL != pSocket_State_Info) + { + nSuccessConnect += pSocket_State_Info->m_nSuccessConnect; + nSuccessSend += pSocket_State_Info->m_nSuccessSend; + nSuccessRecv += pSocket_State_Info->m_nSuccessRecv; + nFailConnect += pSocket_State_Info->m_nFailConnect; + nFailSend += pSocket_State_Info->m_nFailSend; + nFailRecv += pSocket_State_Info->m_nFailRecv; + nCurrConnect += pSocket_State_Info->m_nCurrectSocket; + nSendByteCount += pSocket_State_Info->m_nSendByteCount; + nRecvByteCount += pSocket_State_Info->m_nRecvByteCount; + + if(i == 0) + { + nMinTime = pSocket_State_Info->m_nMinRecvTime; + nMaxTime = pSocket_State_Info->m_nMaxRecvTime; + } + else + { + if(nMinTime > pSocket_State_Info->m_nMinRecvTime) + { + nMinTime = pSocket_State_Info->m_nMinRecvTime; + } + + if(nMaxTime < pSocket_State_Info->m_nMaxRecvTime) + { + nMaxTime = pSocket_State_Info->m_nMaxRecvTime; + } + } + } + } + } + + //ʾ + CString strData; + strData.Format(_T("%d"), nSuccessConnect); + m_txtSuccessConnect.SetWindowText(strData); + strData.Format(_T("%d"), nSuccessSend); + m_txtSuccessSend.SetWindowText(strData); + strData.Format(_T("%d"), nSuccessRecv); + m_txtSuccessRecv.SetWindowText(strData); + strData.Format(_T("%d"), nFailConnect); + m_txtFailConnect.SetWindowText(strData); + strData.Format(_T("%d"), nFailSend); + m_txtFailSend.SetWindowText(strData); + strData.Format(_T("%d"), nFailRecv); + m_txtFailRecv.SetWindowText(strData); + strData.Format(_T("%d"), nCurrConnect); + m_txtCurrConnect.SetWindowText(strData); + strData.Format(_T("%d"), nSendByteCount); + m_txtSendByteCount.SetWindowText(strData); + strData.Format(_T("%d"), nRecvByteCount); + m_txtRecvByteCount.SetWindowText(strData); + strData.Format(_T("%d"), nMinTime); + m_txtMinTime.SetWindowText(strData); + strData.Format(_T("%d"), nMaxTime); + m_txtMaxTime.SetWindowText(strData); + } + else + { + for(int i = 0; i < (int)m_vecClientUdpSocket.size(); i++) + { + CClientUdpSocket* pClientUdpSocket = (CClientUdpSocket* )m_vecClientUdpSocket[i]; + if(NULL != pClientUdpSocket) + { + _Socket_State_Info* pSocket_State_Info = pClientUdpSocket->GetStateInfo(); + if(NULL != pSocket_State_Info) + { + nSuccessConnect += pSocket_State_Info->m_nSuccessConnect; + nSuccessSend += pSocket_State_Info->m_nSuccessSend; + nSuccessRecv += pSocket_State_Info->m_nSuccessRecv; + nFailConnect += pSocket_State_Info->m_nFailConnect; + nFailSend += pSocket_State_Info->m_nFailSend; + nFailRecv += pSocket_State_Info->m_nFailRecv; + nCurrConnect += pSocket_State_Info->m_nCurrectSocket; + } + + if(i == 0) + { + nMinTime = pSocket_State_Info->m_nMinRecvTime; + nMaxTime = pSocket_State_Info->m_nMaxRecvTime; + } + else + { + if(nMinTime > pSocket_State_Info->m_nMinRecvTime) + { + nMinTime = pSocket_State_Info->m_nMinRecvTime; + } + + if(nMaxTime < pSocket_State_Info->m_nMaxRecvTime) + { + nMaxTime = pSocket_State_Info->m_nMaxRecvTime; + } + } + } + } + + //ʾ + CString strData; + strData.Format(_T("%d"), nSuccessConnect); + m_txtSuccessConnect.SetWindowText(strData); + strData.Format(_T("%d"), nSuccessSend); + m_txtSuccessSend.SetWindowText(strData); + strData.Format(_T("%d"), nSuccessRecv); + m_txtSuccessRecv.SetWindowText(strData); + strData.Format(_T("%d"), nFailConnect); + m_txtFailConnect.SetWindowText(strData); + strData.Format(_T("%d"), nFailSend); + m_txtFailSend.SetWindowText(strData); + strData.Format(_T("%d"), nFailRecv); + m_txtFailRecv.SetWindowText(strData); + strData.Format(_T("%d"), nCurrConnect); + m_txtCurrConnect.SetWindowText(strData); + strData.Format(_T("%d"), nMinTime); + m_txtMinTime.SetWindowText(strData); + strData.Format(_T("%d"), nMaxTime); + m_txtMaxTime.SetWindowText(strData); + } + } + + CDialog::OnTimer(nIDEvent); +} + +void CPassTCPDlg::OnBnClickedButton3() +{ + //дѹⱨ + FILE* pFile = NULL; + char szFileName[20]; + sprintf_s(szFileName, "StressTest.log"); + fopen_s(&pFile, szFileName, "a+"); + if(pFile == NULL) + { + MessageBox(_T("ѹⱨʧܣļ"), _T("ʾϢ"), MB_OK); + return; + } + + char szLogText[1024] = {'\0'}; + + sprintf_s(szLogText, 1024, "=============================================\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + //ĬTCPͣ0TCP1UDP + switch(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3)) + { + case IDC_RADIO1: + sprintf_s(szLogText, 1024, "ѹ:TCP\n"); + break; + case IDC_RADIO2: + sprintf_s(szLogText, 1024, "ѹ:UDP\n"); + break; + case IDC_RADIO3: + sprintf_s(szLogText, 1024, "ѹ:WebSocket\n"); + break; + } + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + CString strData; + CString strDataPort; + m_txtServerIP.GetWindowText(strData); + + char szServerIP[MAX_BUFF_20] = {'\0'}; + int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); + int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, szServerIP, MAX_BUFF_20, NULL,NULL); + szServerIP[nDecLen] = '\0'; + + m_txtPort.GetWindowText(strDataPort); + sprintf_s(szLogText, 1024, "ѹIP:%s, ѹ˿:%d.\n", szServerIP, _ttoi((LPCTSTR)strDataPort)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + //CString strBeginTime = m_tmBegin.Format("%Y-%m-%d %H:%M:%S"); + sprintf_s(szLogText, 1024, "ѹ⿪ʼʱΪ: %04d-%02d-%02d %02d:%02d:%02d\n", m_tmBegin.GetYear(), m_tmBegin.GetMonth(), m_tmBegin.GetDay(), m_tmBegin.GetHour(), m_tmBegin.GetMinute(), m_tmBegin.GetSecond()); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + if(m_blIsRun == true) + { + CTime tmNow = CTime::GetCurrentTime(); + + //CString strNowTime = tmNow.Format("%Y-%m-%d %H:%M:%S"); + sprintf_s(szLogText, 1024, "ѹʱΪ: %04d-%02d-%02d %02d:%02d:%02d\n", tmNow.GetYear(), tmNow.GetMonth(), tmNow.GetDay(), tmNow.GetHour(), tmNow.GetMinute(), tmNow.GetSecond()); + + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + } + else + { + //CString strEndTime = m_tmEnd.Format("%Y-%m-%d %H:%M:%S"); + sprintf_s(szLogText, 1024, "ѹʱΪ: %04d-%02d-%02d %02d:%02d:%02d\n", m_tmEnd.GetYear(), m_tmEnd.GetMonth(), m_tmEnd.GetDay(), m_tmEnd.GetHour(), m_tmEnd.GetMinute(), m_tmEnd.GetSecond()); + + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + } + + + m_txtThreadCount.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ѹ߳:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtSuccessConnect.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ɹ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtSuccessSend.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ɹݰ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtSuccessRecv.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ɹݰ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtSendByteCount.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ֽ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtRecvByteCount.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ֽ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtFailConnect.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ʧ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtFailSend.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ʧݰ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtFailRecv.GetWindowText(strData); + sprintf_s(szLogText, 1024, "ʧݰ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtMinTime.GetWindowText(strData); + sprintf_s(szLogText, 1024, "СӦʱ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + m_txtMaxTime.GetWindowText(strData); + sprintf_s(szLogText, 1024, "󵥰Ӧʱ:%d\n", _ttoi((LPCTSTR)strData)); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + //ӳɹٷֱ + float fRote = 0.0f; + m_txtSuccessConnect.GetWindowText(strData); + int nSucccess = _ttoi((LPCTSTR)strData); + m_txtFailConnect.GetWindowText(strData); + int nFail = _ttoi((LPCTSTR)strData); + if(nSucccess + nFail == 0) + { + fRote = 0.0f; + } + else + { + fRote = (float)nSucccess/(nSucccess + nFail); + } + + sprintf_s(szLogText, 1024, "ӳɹٷֱ:%f%%\n", fRote*100.0); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + //ͳɹٷֱ + m_txtSuccessSend.GetWindowText(strData); + nSucccess = _ttoi((LPCTSTR)strData); + m_txtFailSend.GetWindowText(strData); + nFail = _ttoi((LPCTSTR)strData); + if(nSucccess + nFail == 0) + { + fRote = 0.0f; + } + else + { + fRote = (float)nSucccess/(nSucccess + nFail); + } + sprintf_s(szLogText, 1024, "ݰɹٷֱ:%f%%\n", fRote*100.0); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + //ճɹٷֱ + m_txtSuccessRecv.GetWindowText(strData); + nSucccess = _ttoi((LPCTSTR)strData); + m_txtFailRecv.GetWindowText(strData); + nFail = _ttoi((LPCTSTR)strData); + if(nSucccess + nFail == 0) + { + fRote = 0.0f; + } + else + { + fRote = (float)nSucccess/(nSucccess + nFail); + } + sprintf_s(szLogText, 1024, "ݰɹٷֱ:%f%%\n", fRote*100.0); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + sprintf_s(szLogText, 1024, "=============================================\n"); + fwrite(szLogText, strlen(szLogText), sizeof(char), pFile); + + fclose(pFile); + + MessageBox(_T("ѹⱨɹ"), _T("ʾϢ"), MB_OK); + +} + +void CPassTCPDlg::OnCbnSelchangeCombo1() +{ + //ıģʽûѡ仯ı + int nCurrTextStyle = m_cbSendBuffStyle.GetCurSel(); + if(nCurrTextStyle != m_nCurrTextStyle) + { + if(nCurrTextStyle == 0) //ıתΪ + { + //ıʱ仯 + CString strData; + m_reSendText.GetWindowText(strData); + + int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); + int nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); + char* pSendData = new char[nBufferSize + 1]; + int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSendData, nBufferSize, NULL,NULL); + pSendData[nDecLen] = '\0'; + + if(nDecLen <= 0) + { + //ûݾͲת + m_nCurrTextStyle = nCurrTextStyle; + SetRichTextColor(COLOR_TEXT_BULE); + return; + } + + //תַ + int nConvertSize = (nBufferSize + 1)*4; + char* pErSendBuff = new char[nConvertSize]; + memset(pErSendBuff, 0, nConvertSize); + + for(int i = 0; i < nDecLen; i++) + { + char szLog[4] = {'\0'}; + if( i != nDecLen - 1) + { + sprintf_s(szLog, 4, "%02X ", (unsigned char)pSendData[i]); + } + else + { + sprintf_s(szLog, 4, "%02X", (unsigned char)pSendData[i]); + } + + if(i == 0) + { + sprintf_s(pErSendBuff, nConvertSize, "%s%s", pErSendBuff, szLog); + } + else + { + sprintf_s(pErSendBuff, nConvertSize, "%s %s", pErSendBuff, szLog); + } + } + + //תĶƣʾı + wchar_t *pwText = new wchar_t[nConvertSize]; + + nSrcLen = MultiByteToWideChar (CP_ACP, 0, pErSendBuff, -1, NULL, 0); + nBufferSize = MultiByteToWideChar (CP_ACP, 0, pErSendBuff, -1, pwText, nSrcLen); + pwText[nBufferSize] = '\0'; + + m_reSendText.SetWindowText(pwText); + + delete[] pwText; + delete[] pSendData; + delete[] pErSendBuff; + + SetRichTextColor(COLOR_TEXT_BULE); + } + else + { + //תı + CString strData; + m_reSendText.GetWindowText(strData); + + int nSrcLen = WideCharToMultiByte(CP_ACP, 0, strData, strData.GetLength(), NULL, 0, NULL, NULL); + int nBufferSize = WideCharToMultiByte(CP_ACP, 0, strData, -1, NULL, 0, NULL, NULL); + char* pSendData = new char[nBufferSize + 1]; + int nDecLen = WideCharToMultiByte(CP_ACP, 0, strData, nSrcLen, pSendData, nBufferSize, NULL,NULL); + pSendData[nDecLen] = '\0'; + + if(nDecLen <= 0) + { + //ûݾͲת + m_nCurrTextStyle = nCurrTextStyle; + SetRichTextColor(COLOR_TEXT_RED); + return; + } + + int nTextSize = 0; + if(nDecLen % 3 != 0) + { + nTextSize = nDecLen / 3 + 2; + } + else + { + nTextSize = nDecLen / 3 + 1; + } + + char* pTextData = new char[nTextSize]; + memset(pTextData, 0, nTextSize); + + CConvertBuffer objConvertBuffer; + //ݴתɶƴ + objConvertBuffer.Convertstr2charArray(pSendData, strlen(pSendData), (unsigned char*)pTextData, nTextSize); + + //תĶƣʾı + wchar_t *pwText = new wchar_t[nTextSize + 2]; + + nSrcLen = MultiByteToWideChar (CP_ACP, 0, pTextData, -1, NULL, 0); + nBufferSize = MultiByteToWideChar (CP_ACP, 0, pTextData, -1, pwText, nSrcLen); + pwText[nBufferSize] = '\0'; + + m_reSendText.SetWindowText(pwText); + + delete[] pwText; + delete[] pSendData; + delete[] pTextData; + + SetRichTextColor(COLOR_TEXT_RED); + } + + m_nCurrTextStyle = nCurrTextStyle; + + } +} + +void CPassTCPDlg::SetRichTextColor(int nColor) +{ + ::CHARFORMAT2 cf; + memset(&cf, 0x00, sizeof(cf)); + cf.cbSize = sizeof(cf); + if(nColor == COLOR_TEXT_BULE) + { + cf.crTextColor = RGB(0, 0, 255); + } + else if(nColor == COLOR_TEXT_RED) + { + cf.crTextColor = RGB(255, 0, 0); + } + cf.dwMask = CFM_COLOR; + + m_reSendText.SetDefaultCharFormat(cf);//ַ +} + +void CPassTCPDlg::OnBnClickedButton4() +{ + //Luaļ + //жϸ߼ѡǷѾ + if(m_chkLuaAdvance.GetCheck() != BST_CHECKED) + { + MessageBox(_T("ѡø߼ģʽء"), _T("ʾϢ"), MB_OK); + return; + } + + //򿪵ǰ· + TCHAR szBuffer[2048] = {'\0'}; + GetCurrentDirectory(2048, szBuffer); + + CFileDialog dlgFile(TRUE, _T( "*lua" ), NULL, OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, _T("Luaļ(*.lua)|*.lua|")); + dlgFile.m_ofn.lpstrInitialDir = szBuffer; + + if (dlgFile.DoModal() == IDOK) + { + CString strLuaFile = dlgFile.GetPathName(); + m_txtLuaFilePath.SetWindowText(strLuaFile); + } +} + +void CPassTCPDlg::OnBnClickedButton5() +{ + //ݰ + CPacketDlg objPacketDlg; + + switch(GetCheckedRadioButton(IDC_RADIO1, IDC_RADIO3)) + { + case IDC_RADIO1: + { + if(m_pLogic != NULL) + { + delete m_pLogic; + } + + CNomalLogic* pNomalLogic = new CNomalLogic(); + m_pLogic = (CBaseDataLogic* )pNomalLogic; + break; + } + case IDC_RADIO2: + { + if(m_pLogic != NULL) + { + delete m_pLogic; + } + + CNomalLogic* pNomalLogic = new CNomalLogic(); + m_pLogic = (CBaseDataLogic* )pNomalLogic; + break; + } + case IDC_RADIO3: + { + if(m_pLogic != NULL) + { + delete m_pLogic; + } + + CWebSocketLogic* pWebSocketLogic = new CWebSocketLogic(); + m_pLogic = (CBaseDataLogic* )pWebSocketLogic; + break; + } + } + + objPacketDlg.SetBaseDataLogic(m_pLogic); + + objPacketDlg.DoModal(); +} diff --git a/TestNetworkTool/backup/PassTCP/PassTCPDlg.h b/TestNetworkTool/backup/PassTCP/PassTCPDlg.h new file mode 100644 index 000000000..4745bd03e --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/PassTCPDlg.h @@ -0,0 +1,106 @@ + +// PassTCPDlg.h : ͷļ +// + +#pragma once +#include "afxcmn.h" +#include "ClientTcpSocket.h" +#include "ClientUdpSocket.h" +#include "afxwin.h" +#include + +#include "PacketDlg.h" + +using namespace std; + +typedef vector vecClientTcpSocket; +typedef vector vecClientUdpSocket; + +#define COLOR_TEXT_BULE 1 +#define COLOR_TEXT_RED 2 + +// CPassTCPDlg Ի +class CPassTCPDlg : public CDialog +{ +// +public: + CPassTCPDlg(CWnd* pParent = NULL); // ׼캯 + +// Ի + enum { IDD = IDD_PASSTCP_DIALOG }; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ + + +// ʵ +protected: + HICON m_hIcon; + + // ɵϢӳ亯 + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + DECLARE_MESSAGE_MAP() + +private: + void InitView(); + void ClearResult(); + void Close(bool blClose = false); + + void SetRichTextColor(int nColor); + +private: + CTime m_tmBegin; //ѹ⿪ʼʱ + bool m_blIsRun; //ѹǷڽ + CTime m_tmEnd; //ѹֹͣʱ + int m_nCurrTextStyle; //ǰı + CBaseDataLogic* m_pLogic; //Ƿµ߼ + +public: + CEdit m_txtServerIP; + CEdit m_txtPort; + CEdit m_txtThreadCount; + CEdit m_txtRecvTimeout; + CEdit m_txtSocketInterval; + CEdit m_txtRecvLength; + CButton m_chkIsAlwayConnect; + CButton m_chkRadomaDelay; + CButton m_chkIsRecv; + CButton m_ChkIsBroken; + CButton m_chkRadomSendCount; + CButton m_chkIsWriteLog; + CButton m_chkSendOne; + CButton m_chkLuaAdvance; + CEdit m_txtSuccessConnect; + CEdit m_txtSuccessSend; + CEdit m_txtSuccessRecv; + CEdit m_txtCurrConnect; + CEdit m_txtFailConnect; + CEdit m_txtFailSend; + CEdit m_txtFailRecv; + CEdit m_txtClientUdpPort; + CEdit m_txtPacketTimewait; + CEdit m_txtSendByteCount; + CEdit m_txtRecvByteCount; + CEdit m_txtLuaFilePath; + CEdit m_txtSendCount; + CEdit m_txtMinTime; + CEdit m_txtMaxTime; + CComboBox m_cbSendBuffStyle; + CRichEditCtrl m_reSendText; + int m_nRadio; + + vecClientTcpSocket m_vecClientTcpSocket; + vecClientUdpSocket m_vecClientUdpSocket; + afx_msg void OnClose(); + afx_msg void OnBnClickedButton2(); + afx_msg void OnTimer(UINT_PTR nIDEvent); + afx_msg void OnBnClickedButton3(); + afx_msg void OnCbnSelchangeCombo1(); + afx_msg void OnBnClickedButton1(); + afx_msg void OnBnClickedButton4(); + + afx_msg void OnBnClickedButton5(); +}; diff --git a/TestNetworkTool/PassTCP/ReadMe.txt b/TestNetworkTool/backup/PassTCP/ReadMe.txt similarity index 100% rename from TestNetworkTool/PassTCP/ReadMe.txt rename to TestNetworkTool/backup/PassTCP/ReadMe.txt diff --git a/TestNetworkTool/PassTCP/Readme.md b/TestNetworkTool/backup/PassTCP/Readme.md similarity index 100% rename from TestNetworkTool/PassTCP/Readme.md rename to TestNetworkTool/backup/PassTCP/Readme.md diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinystr.cpp b/TestNetworkTool/backup/PassTCP/TinyXML/tinystr.cpp similarity index 100% rename from PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinystr.cpp rename to TestNetworkTool/backup/PassTCP/TinyXML/tinystr.cpp diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinystr.h b/TestNetworkTool/backup/PassTCP/TinyXML/tinystr.h similarity index 100% rename from PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinystr.h rename to TestNetworkTool/backup/PassTCP/TinyXML/tinystr.h diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinyxml.cpp b/TestNetworkTool/backup/PassTCP/TinyXML/tinyxml.cpp similarity index 100% rename from PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinyxml.cpp rename to TestNetworkTool/backup/PassTCP/TinyXML/tinyxml.cpp diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinyxml.h b/TestNetworkTool/backup/PassTCP/TinyXML/tinyxml.h similarity index 100% rename from PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinyxml.h rename to TestNetworkTool/backup/PassTCP/TinyXML/tinyxml.h diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinyxmlerror.cpp b/TestNetworkTool/backup/PassTCP/TinyXML/tinyxmlerror.cpp similarity index 100% rename from PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinyxmlerror.cpp rename to TestNetworkTool/backup/PassTCP/TinyXML/tinyxmlerror.cpp diff --git a/PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinyxmlparser.cpp b/TestNetworkTool/backup/PassTCP/TinyXML/tinyxmlparser.cpp similarity index 100% rename from PssSampleClient/AutoTestClient/AutoTestClient/TinyXML/tinyxmlparser.cpp rename to TestNetworkTool/backup/PassTCP/TinyXML/tinyxmlparser.cpp diff --git a/TestNetworkTool/PassTCP/Windows_bin/PassTcp.lua b/TestNetworkTool/backup/PassTCP/Windows_bin/PassTcp.lua similarity index 100% rename from TestNetworkTool/PassTCP/Windows_bin/PassTcp.lua rename to TestNetworkTool/backup/PassTCP/Windows_bin/PassTcp.lua diff --git a/TestNetworkTool/backup/PassTCP/define.h b/TestNetworkTool/backup/PassTCP/define.h new file mode 100644 index 000000000..38944467c --- /dev/null +++ b/TestNetworkTool/backup/PassTCP/define.h @@ -0,0 +1,844 @@ +#ifndef _DEFINE_H +#define _DEFINE_H + +#include +#include +#include +#include + +using namespace std; + +#define MAX_BUFF_20 20 +#define MAX_BUFF_100 100 +#define MAX_BUFF_1024 1024 + +#define MAX_RANDOM_PACKET 5*1024 + +//ַ滻 +inline void string_replace( string&s1,const string&s2,const string&s3 ) +{ + string::size_type pos = 0; + string::size_type a = s2.size(); + string::size_type b = s3.size(); + while((pos=s1.find(s2,pos))!=string::npos) + { + s1.replace(pos,a,s3); + pos += b; + } +} + +//ݰϢ +struct _RandomPacketInfo +{ + char szPacket[MAX_RANDOM_PACKET]; //ݰ + int nLen; //ݰ + int nType; //ͣĬıı12 + int nRecdvLength; //ַij + + _RandomPacketInfo() + { + szPacket[0] = '\0'; + nLen = 0; + nType = 1; + nRecdvLength = 0; + } +}; + +//ݰ +typedef vector<_RandomPacketInfo> vecRandomPacketInfo; + +//һ +inline void InitRandom() +{ + srand((int)time(NULL)); +}; + +//һֵлȡһֵ +inline int RandomValue(int nMin, int nMax) +{ + return nMin + (int) ((nMax - nMin) * (rand() / (RAND_MAX + 1.0))); +}; + +//WebSocket㷨 +inline void WebSocketSendData(const char* pData, int nLen, char* pSendData, int& nSendLen) +{ + //Ŀǰֻ֧С64Kݰ + char szMark[4] = {'\0'}; + int nPos = 0; + + if(nSendLen < nLen + 8) + { + //峤Ȳ + return; + } + + if(nLen <= 125) + { + pSendData[nPos] = -127; + nPos++; + + //ֳ + pSendData[nPos] = (char)(nLen & 0x7F); + nPos++; + + //4ֽڵmark + memcpy_s((char* )szMark, 4, &nLen, 4); + memcpy_s((char* )&pSendData[nPos], 4, szMark, 4); + nPos += 4; + + //λ + for(int i = 0; i < nLen; i++) + { + char szTemp = pData[i] ^ (szMark[i % 4]); + pSendData[nPos] = szTemp; + nPos++; + } + } + else + { + pSendData[nPos] = -127; + nPos++; + + //ֳ + pSendData[nPos] = 126; + nPos++; + + //ʵʳȡ65535 + //ת + short sDataLen = htons((short)nLen); + memcpy_s((char* )&pSendData[nPos], 2, (char* )&sDataLen, 2); + nPos += 2; + + //4ֽڵmark + memcpy_s((char* )szMark, 4, &nLen, 4); + memcpy_s((char* )&pSendData[nPos], 4, szMark, 4); + nPos += 4; + + //λ + for(int i = 0; i < nLen; i++) + { + char szTemp = pData[i] ^ (szMark[i % 4]); + pSendData[nPos] = szTemp; + nPos++; + } + } + + + nSendLen = nPos; +} + +// +enum ENUM_TYPE_PROTOCOL +{ + ENUM_PROTOCOL_TCP = 0, + ENUM_PROTOCOL_UDP, + ENUM_PROTOCOL_WEBSOCKET, +}; + +//ƺַ໥ת +class CConvertBuffer +{ +public: + CConvertBuffer() {}; + ~CConvertBuffer() {}; + int GetBufferSize(const char* pData, int nSrcLen) + { + char szData[3] = {'\0'}; + int nPos = 0; + int nCurrSize = 0; + int nConvertSize = 0; + bool blState = false; //תַǷЧ + bool blSrcState = true; //ԪַǷЧ + unsigned char cData; + + while(nPos < nSrcLen) + { + if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) + { + if(nPos == nSrcLen - 1) + { + szData[nCurrSize++] = pData[nPos]; + } + + szData[nCurrSize] = '\0'; + if(blSrcState == true) + { + blState = ConvertStr2char(szData, cData); + if(blState == true) + { + nConvertSize++; + } + } + nCurrSize = 0; + blSrcState = true; + nPos++; + } + else + { + if(nCurrSize < 2) + { + szData[nCurrSize++] = pData[nPos]; + } + else + { + blSrcState = false; + } + nPos++; + } + } + + return nConvertSize; + }; + + bool Convertstr2charArray(const char* pData, int nSrcLen, unsigned char* pDes, int& nMaxLen) + { + char szData[3] = {'\0'}; + int nPos = 0; + int nCurrSize = 0; + int nConvertSize = 0; + bool blState = false; //תַǷЧ + bool blSrcState = true; //ԪַǷЧ + + while(nPos < nSrcLen) + { + if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) + { + if(nPos == nSrcLen - 1) + { + szData[nCurrSize++] = pData[nPos]; + } + + szData[nCurrSize] = '\0'; + if(nConvertSize < nMaxLen && blSrcState == true) + { + blState = ConvertStr2char(szData, pDes[nConvertSize]); + if(blState == true) + { + nConvertSize++; + } + } + nCurrSize = 0; + blSrcState = true; + nPos++; + } + else + { + if(nCurrSize < 2) + { + szData[nCurrSize++] = pData[nPos]; + } + else + { + blSrcState = false; + } + nPos++; + } + } + + nMaxLen = nConvertSize; + return true; + }; +private: + bool Get_binary_Char(unsigned char cTag, unsigned char& cDes) + { + if(cTag >='A'&& cTag <='F') + { + cDes = cTag - 'A' + 10; + return true; + } + else if(cTag >='a'&& cTag <='f') + { + cDes = cTag - 'a' + 10; + return true; + } + else if(cTag >= '0'&& cTag<= '9') + { + cDes = cTag-'0'; + return true; + } + else + { + return false; + } + } + + bool ConvertStr2char(const char* pData, unsigned char& cData) + { + if(pData == NULL || strlen(pData) != 2) + { + return false; + } + + char cFirst = pData[1]; + unsigned char cTemp = 0; + bool blStste = Get_binary_Char(cFirst, cTemp); + if(false == blStste) + { + return false; + } + cData = cTemp; + char cSecond = pData[0]; + blStste = Get_binary_Char(cSecond, cTemp); + if(false == blStste) + { + return false; + } + cTemp = cTemp << 4; + cData = cData | cTemp; + + return true; + } +}; + +enum EM_DATA_RETURN_STATE +{ + DATA_RETURN_STATE_SUCCESS = 0, + DATA_RETURN_STATE_ERROR, + DATA_RETURN_STATE_CONTINUE, +}; + +//һ࣬ʽݷͺͽյIJ߼ +class CBaseDataLogic +{ +public: + CBaseDataLogic() + { + m_blRandomPacket = false; + m_nClassTye = 1; + } + + void ClearRandomPacket() + { + m_vecRandomPacketInfo.clear(); + } + + void DeleteRandomPacket(int nIndex) + { + if(nIndex >= 0 && nIndex < (int)m_vecRandomPacketInfo.size()) + { + int nPos = 0; + //ɾָ + for(vecRandomPacketInfo::iterator b = m_vecRandomPacketInfo.begin();b != m_vecRandomPacketInfo.end(); b++) + { + if(nIndex == nPos) + { + m_vecRandomPacketInfo.erase(b); + break; + } + } + } + } + + //ָ + bool InsertRandomPacket(const char* pData, int nLen, int nRecvLength, int nType) + { + _RandomPacketInfo objRandomPacketInfo; + + if(nLen >= MAX_RANDOM_PACKET || nLen <= 0) + { + return false; + } + + memcpy_s(objRandomPacketInfo.szPacket, nLen, pData, nLen); + objRandomPacketInfo.szPacket[nLen] = '\0'; + objRandomPacketInfo.nLen = nLen; + objRandomPacketInfo.nRecdvLength = nRecvLength; + objRandomPacketInfo.nType = nType; + + m_vecRandomPacketInfo.push_back(objRandomPacketInfo); + + if(m_blRandomPacket == false) + { + m_blRandomPacket = true; + } + + return true; + }; + + //õĸ + int GetRandomPacketCount() + { + return (int)m_vecRandomPacketInfo.size(); + }; + + _RandomPacketInfo* GettRandomPacket(int nIndex) + { + if(nIndex >= (int)m_vecRandomPacketInfo.size() || nIndex < 0) + { + return NULL; + } + else + { + return (_RandomPacketInfo* )&m_vecRandomPacketInfo[nIndex]; + } + }; + + //õݵľϢ + bool GetRandomSend(int nIndex, char* pData, int& nLen, int& nRecvLength) + { + int nPos = nIndex % (int)m_vecRandomPacketInfo.size(); + + _RandomPacketInfo* pRandomPacketInfo = GettRandomPacket(nPos); + if(NULL == pRandomPacketInfo) + { + return false; + } + + if(nLen < pRandomPacketInfo->nLen) + { + return false; + } + + if(pRandomPacketInfo->nType == 1) + { + //ֻıģʽʱ滻 + string strData = (string)pRandomPacketInfo->szPacket; + + ReplaceNumber(strData, (string)"%01d", 1); + ReplaceNumber(strData, (string)"%02d", 2); + ReplaceNumber(strData, (string)"%03d", 3); + ReplaceNumber(strData, (string)"%04d", 4); + + memcpy_s(pData, strData.length(), strData.c_str(), strData.length()); + pData[strData.length()] = '\0'; + nLen = strData.length(); + nRecvLength = pRandomPacketInfo->nRecdvLength; + } + else + { + //жת + CConvertBuffer objConvertBuffer; + + // + objConvertBuffer.Convertstr2charArray(pRandomPacketInfo->szPacket, pRandomPacketInfo->nLen, + (unsigned char*)pData, nLen); + nRecvLength = pRandomPacketInfo->nRecdvLength; + } + + return true; + } + + //ʾԤ + bool GetReview(int nIndex, char* pData, int& nLen, int& nRecvLength) + { + int nPos = nIndex % (int)m_vecRandomPacketInfo.size(); + + _RandomPacketInfo* pRandomPacketInfo = GettRandomPacket(nPos); + if(NULL == pRandomPacketInfo) + { + return false; + } + + if(nLen < pRandomPacketInfo->nLen) + { + return false; + } + + if(pRandomPacketInfo->nType == 1) + { + //ֻıģʽʱ滻 + string strData = (string)pRandomPacketInfo->szPacket; + + ReplaceNumber(strData, (string)"%01d", 1); + ReplaceNumber(strData, (string)"%02d", 2); + ReplaceNumber(strData, (string)"%03d", 3); + ReplaceNumber(strData, (string)"%04d", 4); + + memcpy_s(pData, strData.length(), strData.c_str(), strData.length()); + pData[strData.length()] = '\0'; + nLen = strData.length(); + nRecvLength = pRandomPacketInfo->nRecdvLength; + } + else + { + // + memcpy_s(pData, pRandomPacketInfo->nLen, pRandomPacketInfo->szPacket, pRandomPacketInfo->nLen); + nLen = pRandomPacketInfo->nLen; + nRecvLength = pRandomPacketInfo->nRecdvLength; + } + + return true; + } + + //õǷΪݰ + bool GetRandomType() + { + return m_blRandomPacket; + } + + //ָ + virtual bool InitSendSize(int nSendLen) = 0; + virtual char* GetSendData() = 0; + virtual char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) = 0; + virtual int GetSendLength() = 0; + virtual int GetRecvLength() = 0; + virtual void SetRecvLength(int nRecvLen) = 0; + virtual void SetMaxSendLength(int nMaxLength) = 0; + virtual void SetSendBuff(const char* pData, int nLen) = 0; + virtual EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) = 0; + +private: + void ReplaceNumber(string& strData, string strTag, int nStep) + { + if(nStep == 1) + { + char szNumber[20] = {'\0'}; + int nNumber = RandomValue(0, 9); + sprintf_s(szNumber, 20, "%d", nNumber); + string_replace(strData, strTag, (string)szNumber); + } + else if(nStep == 2) + { + char szNumber[20] = {'\0'}; + int nNumber = RandomValue(0, 99); + sprintf_s(szNumber, 20, "%d", nNumber); + string_replace(strData, strTag, (string)szNumber); + } + else if(nStep == 3) + { + char szNumber[20] = {'\0'}; + int nNumber = RandomValue(0, 999); + sprintf_s(szNumber, 20, "%d", nNumber); + string_replace(strData, strTag, (string)szNumber); + } + else if(nStep == 4) + { + char szNumber[20] = {'\0'}; + int nNumber = RandomValue(0, 9999); + sprintf_s(szNumber, 20, "%d", nNumber); + string_replace(strData, strTag, (string)szNumber); + } + } + +private: + bool m_blRandomPacket; //ǷУfalaseΪtrueΪ + vecRandomPacketInfo m_vecRandomPacketInfo; + +public: + int m_nClassTye; //1ΪCNomalLogic2ΪWebSocketLogic +}; + +//ͨTCPշϢ߼ +//Ϊ˼һЩЭ飬websocketԼhttp +//շݲǵһָ룬һ̳CBaseDataLogic +class CNomalLogic : public CBaseDataLogic +{ +public: + CNomalLogic() + { + m_pSendData = NULL; + m_nSendLen = 0; + m_nRecvLen = 0; + m_nCurrRecvLen = 0; + m_nClassTye = 1; + }; + + ~CNomalLogic() { Close(); }; + + void Close() + { + if(NULL != m_pSendData) + { + delete[] m_pSendData; + m_pSendData = NULL; + } + } + + bool InitSendSize(int nSendLen = MAX_RANDOM_PACKET) + { + Close(); + + m_pSendData = new char[nSendLen]; + m_nSendLen = nSendLen; + + return true; + } + + void SetRecvLength(int nRecvLen) + { + m_nRecvLen = nRecvLen; + } + + void SetMaxSendLength(int nMaxLength) + { + m_nSendLen = nMaxLength; + } + + //طBuff + void SetSendBuff(const char* pData, int nLen) + { + memcpy_s(m_pSendData, nLen, pData, nLen); + m_nSendLen = nLen; + } + + char* GetSendData() + { + return m_pSendData; + } + + char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) + { + if(GetRandomType() == false) + { + //һݰ + nSendDataLen = m_nSendLen; + return m_pSendData; + } + else + { + //˳ݰ + nSendDataLen = MAX_RANDOM_PACKET; + GetRandomSend(nCurrIndex, m_pSendData, nSendDataLen, m_nRecvLen); + return m_pSendData; + } + } + + int GetSendLength() + { + return m_nSendLen; + } + + int GetRecvLength() + { + return m_nRecvLen; + } + + EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) + { + m_nCurrRecvLen += nLen; + if(m_nCurrRecvLen == m_nRecvLen) + { + m_nCurrRecvLen = 0; + //ȫϣȷ + return DATA_RETURN_STATE_SUCCESS; + } + else if(nLen < m_nRecvLen) + { + //ûнȫ + return DATA_RETURN_STATE_CONTINUE; + } + + m_nCurrRecvLen = 0; + return DATA_RETURN_STATE_ERROR; + } + +private: + char* m_pSendData; + int m_nSendLen; + int m_nRecvLen; + int m_nCurrRecvLen; +}; + +//websocketЭ߼ +class CWebSocketLogic : public CBaseDataLogic +{ +public: + CWebSocketLogic() + { + m_pHandInData = NULL; + m_pSendData = NULL; + m_nSendLen = 0; + m_nRecvLen = 0; + m_nCurrRecvLen = 0; + m_nClassTye = 2; + }; + + ~CWebSocketLogic() { Close(); }; + + void Close() + { + if(NULL != m_pHandInData) + { + delete[] m_pHandInData; + m_pHandInData = NULL; + } + + if(NULL != m_pSendData) + { + delete[] m_pSendData; + m_pSendData = NULL; + } + } + + bool InitSendSize(int nSendLen = MAX_RANDOM_PACKET) + { + Close(); + + m_pHandInData = new char[300]; + sprintf_s(m_pHandInData, 300, "GET / HTTP/1.1\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nHost: 127.0.0.1:10002\r\nSec-WebSocket-Key: cfMpieGIwzS7+4+nIqv5fA==\r\nSec-WebSocket-Version: 13\r\n\r\n"); + + m_pSendData = new char[nSendLen]; + m_nSendLen = nSendLen; + + return true; + } + + void SetRecvLength(int nRecvLen) + { + m_nRecvLen = nRecvLen; + } + + void SetMaxSendLength(int nMaxLength) + { + m_nSendLen = nMaxLength; + } + + //طBuff + void SetSendBuff(const char* pData, int nLen) + { + //WebSocket + WebSocketSendData(pData, nLen, m_pSendData, m_nSendLen); + } + + char* GetSendData() + { + return m_pSendData; + } + + char* GetSendData(int nThreadID, int nCurrIndex, int& nSendDataLen) + { + //websocketƷ + if(nCurrIndex == 0) + { + //ǵһηݣְ + nSendDataLen = strlen(m_pHandInData); + return m_pHandInData; + } + else + { + if(GetRandomType() == false) + { + //һݰ + nSendDataLen = m_nSendLen; + return m_pSendData; + } + else + { + //˳ݰ + nSendDataLen = MAX_RANDOM_PACKET; + GetRandomSend(nCurrIndex - 1, m_pSendData, nSendDataLen, m_nRecvLen); + return m_pSendData; + } + } + } + + int GetSendLength() + { + return m_nSendLen; + } + + int GetRecvLength() + { + return m_nRecvLen; + } + + EM_DATA_RETURN_STATE GetRecvData(int nThreadID, int nCurrIndex, char* pData, int nLen) + { + return DATA_RETURN_STATE_SUCCESS; + } + +private: + char* m_pHandInData; + char* m_pSendData; + int m_nSendLen; + int m_nRecvLen; + int m_nCurrRecvLen; +}; + +//߳Ϣ +class _Socket_Info +{ +public: + char m_szSerevrIP[MAX_BUFF_20]; //Զ̷IP + int m_nPort; //Զ̷Ķ˿ + int m_nThreadID; //߳ID + int m_nRecvTimeout; //ݳʱʱ䣨λǺ룩 + int m_nDelaySecond; //ӼʱλǺ룩 + int m_nPacketTimewait; //ݰͼ(λǺ) + //int m_nSendLength; //ַ + //int m_nRecvLength; //ַ޶ + //char* m_pSendBuff; //ݳ + bool m_blIsAlwayConnect; //Ƿ + bool m_blIsRadomaDelay; //Ƿʱ + bool m_blIsRecv; //ǷջӦ + bool m_blIsBroken; //Ƿ + bool m_blIsSendCount; //Ƿݰ + bool m_blIsWriteFile; //Ƿдļ + bool m_blIsSendOne; //Ƿֻһ + bool m_blLuaAdvance; //ǷLua߼ģʽ + int m_nConnectType; //ͣ0TCP1UDP + int m_nUdpClientPort; //UDPͻ˽ݶ˿ + int m_nSendCount; //ݰ + char m_szLuaFileName[MAX_BUFF_1024]; //߼ģʽLuaļ + CBaseDataLogic* m_pLogic; //ݶ + + _Socket_Info() + { + m_szSerevrIP[0] = '\0'; + m_nPort = 0; + m_nThreadID = 0; + m_nRecvTimeout = 0; + m_nPacketTimewait = 0; + m_nDelaySecond = 0; + //m_nSendLength = 0; + //m_nRecvLength = 0; + m_nSendCount = 0; + //m_pSendBuff = NULL; + m_blIsAlwayConnect = false; + m_blIsRadomaDelay = false; + m_blIsRecv = true; + m_blIsBroken = true; + m_blIsSendCount = false; + m_blIsWriteFile = false; + m_blIsSendOne = false; + m_blLuaAdvance = false; + m_nConnectType = 0; + m_nUdpClientPort = 0; + m_szLuaFileName[0] = '\0'; + m_pLogic = NULL; + } + + ~_Socket_Info() + { + //ﲻٹͷţϲ + //if(m_pLogic != NULL) + //{ + // delete m_pLogic; + //} + } + +}; + +//߳״̬Ϣ +struct _Socket_State_Info +{ + int m_nSuccessConnect; //ӳɹ + int m_nSuccessSend; //ͳɹ + int m_nSuccessRecv; //ճɹ + int m_nCurrectSocket; //ǰ + int m_nFailConnect; //ʧ + int m_nFailSend; //ʧ + int m_nFailRecv; //ʧ + int m_nSendByteCount; //ֽ + int m_nRecvByteCount; //ֽ + int m_nMinRecvTime; //Сʱ + int m_nMaxRecvTime; //ʱ + + _Socket_State_Info() + { + m_nSuccessConnect = 0; + m_nSuccessSend = 0; + m_nSuccessRecv = 0; + m_nCurrectSocket = 0; + m_nFailConnect = 0; + m_nFailSend = 0; + m_nFailRecv = 0; + m_nSendByteCount = 0; + m_nRecvByteCount = 0; + m_nMinRecvTime = 0; + m_nMaxRecvTime = 0; + } +}; + + +#endif diff --git "a/TestNetworkTool/PassTCP/pss\346\265\213\350\257\225\345\214\205.txt" "b/TestNetworkTool/backup/PassTCP/pss\346\265\213\350\257\225\345\214\205.txt" similarity index 100% rename from "TestNetworkTool/PassTCP/pss\346\265\213\350\257\225\345\214\205.txt" rename to "TestNetworkTool/backup/PassTCP/pss\346\265\213\350\257\225\345\214\205.txt" diff --git a/TestNetworkTool/PassTCP/res/PassTCP.ico b/TestNetworkTool/backup/PassTCP/res/PassTCP.ico similarity index 100% rename from TestNetworkTool/PassTCP/res/PassTCP.ico rename to TestNetworkTool/backup/PassTCP/res/PassTCP.ico diff --git a/TestNetworkTool/PassTCP/res/PassTCP.rc2 b/TestNetworkTool/backup/PassTCP/res/PassTCP.rc2 similarity index 100% rename from TestNetworkTool/PassTCP/res/PassTCP.rc2 rename to TestNetworkTool/backup/PassTCP/res/PassTCP.rc2 diff --git a/TestNetworkTool/PassTCP/resource.h b/TestNetworkTool/backup/PassTCP/resource.h similarity index 100% rename from TestNetworkTool/PassTCP/resource.h rename to TestNetworkTool/backup/PassTCP/resource.h diff --git a/TestNetworkTool/PassTCP/stdafx.cpp b/TestNetworkTool/backup/PassTCP/stdafx.cpp similarity index 100% rename from TestNetworkTool/PassTCP/stdafx.cpp rename to TestNetworkTool/backup/PassTCP/stdafx.cpp diff --git a/TestNetworkTool/PassTCP/stdafx.h b/TestNetworkTool/backup/PassTCP/stdafx.h similarity index 100% rename from TestNetworkTool/PassTCP/stdafx.h rename to TestNetworkTool/backup/PassTCP/stdafx.h diff --git a/PssSampleClient/PSSFtpClient/PssFtpClient/targetver.h b/TestNetworkTool/backup/PassTCP/targetver.h similarity index 100% rename from PssSampleClient/PSSFtpClient/PssFtpClient/targetver.h rename to TestNetworkTool/backup/PassTCP/targetver.h diff --git "a/TestNetworkTool/PassTCP/\345\205\210\350\257\273\346\210\221.txt" "b/TestNetworkTool/backup/PassTCP/\345\205\210\350\257\273\346\210\221.txt" similarity index 100% rename from "TestNetworkTool/PassTCP/\345\205\210\350\257\273\346\210\221.txt" rename to "TestNetworkTool/backup/PassTCP/\345\205\210\350\257\273\346\210\221.txt" diff --git a/ThirdLib/include/CNetOperation.cpp b/ThirdLib/include/CNetOperation.cpp new file mode 100644 index 000000000..65f9cf97d --- /dev/null +++ b/ThirdLib/include/CNetOperation.cpp @@ -0,0 +1,717 @@ +/*************************************************************** + * Name: CNetOperation.cpp + * Purpose: Code for Application Frame + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#include "CNetOperation.h" + +#define _LOG2FILE_ +#include "Mylog.h" + + + +CNetOperation::CNetOperation(int tcpudp ) +{ + this->Init(tcpudp); +} + +CNetOperation::~CNetOperation( ) +{ + this->Deinit(); +} +void CNetOperation::Init(int tcpudp) +{ + //CLog2File::Initialize(); + m_log.InitLogFile("Mylog.log"); + + //初始化TCP链接 + InitializeSocketEnvironment(); + this->m_sckClient =new CSockWrap(tcpudp); +} + +void CNetOperation::Deinit() +{ + //初始化TCP链接 + FreeSocketEnvironment(); + this->Close(); +} + +void CNetOperation::Close() +{ + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + this->m_sckClient->Close(); + } +} + +bool CNetOperation::Conn(const std::string &ParamServerIP,const int &ParamServerPort,const int &ParamTimeout) +{ + //socket创建的准备工作 + + m_sckClient->SetAddress(ParamServerIP.c_str(), ParamServerPort); + m_sckClient->SetTimeOut(ParamTimeout,-1,-1); + + m_sckClient->Reopen(true); + return (GetLastSocketError() !=0); + +} + + + +bool CNetOperation::SendPacket(_LoginInfo& objLoginInfo,const char* ParamPacketBuff,const int &PacketLength) //发送报文 +{ + int nTotalSendLen = PacketLength; + int nBeginSend = 0; + int nCurrSendLen = 0; + + while(true) + { + transresult_t rt =this->m_sckClient->Send((void*)(ParamPacketBuff + nBeginSend), nTotalSendLen); + nCurrSendLen =rt.nbytes; + if(nCurrSendLen <= 0) + { + int dwError = GetLastSocketError(); + logError("向远程服务器发送数据失败!!!"); + objLoginInfo.m_nServerFail++; + return false; + } + else + { + nTotalSendLen -= nCurrSendLen; + if(nTotalSendLen == 0) + { + //发送完成 + logDebug("向远程服务器发送数据完成!!!"); + break; + } + else + { + nBeginSend += nCurrSendLen; + } + } + } + objLoginInfo.m_nSendCount++; + return true; + +} + +bool CNetOperation::RecvPacket(_LoginInfo& objLoginInfo,const char* ParamPacketBuff,const int &PacketLength) //接收报文 +{ + int nRecvLength = PacketLength; + int nRecvBegin = 0; + int nCurrRecvLen = 0; + + while(true) + { + if(nRecvLength - nRecvBegin == 0) + { + break; + } + + transresult_t rt =m_sckClient->Recv((char*)(ParamPacketBuff + nRecvBegin), nRecvLength - nRecvBegin); + nCurrRecvLen =rt.nbytes; + + if(nCurrRecvLen <= 0) + { + int dwError = GetLastSocketError(); + logError("接收远程服务器数据失败!!!"); + objLoginInfo.m_nServerFail++; + return false; + } + else + { + nRecvBegin += nCurrRecvLen; + } + } + return true; +} + + +bool CNetOperation::GetRecvPktLength(const int &ParamPacketLength) //获得需要接收的下一个报文的长度 +{ + _LoginInfo objLoginInfo; + bool Ret =this->RecvPacket(objLoginInfo,reinterpret_cast (&ParamPacketLength),sizeof(const int)); + return Ret; +} + + + +void CNetOperation::GetCmdRetInfo(const char* ParamPacketBuff,short &ParamCommandID,const int &ParamCmdRet) //获得接收到的命令ID以及执行返回结果 +{ + memcpy_s((void*)(&ParamCommandID), sizeof(short), reinterpret_cast (&ParamPacketBuff), sizeof(short)); + memcpy_s((void*)(&ParamCmdRet), sizeof(int), reinterpret_cast (&ParamPacketBuff[sizeof(short)]), sizeof(int)); +} + + + +bool CNetOperation::Send_Login(_LoginInfo& objLoginInfo,const int &ParamCmdID,const std::string &ParamSvrUserName,const std::string &ParamSvrUserPass) +{ + + Cmd_Packet.CmdVersion =1; + Cmd_Packet.CmdBuffPos =0; + Cmd_Packet.CmdID = ParamCmdID; + Cmd_Packet.CmdBuffPos =0; + sprintf_s(Cmd_Packet.CmdSession, 32, "FREEEYES"); + + Cmd_Packet.SetCmdHead(); + Cmd_Packet.SetCmdPayload( ParamSvrUserName ); + Cmd_Packet.SetCmdPayload( ParamSvrUserPass ); + Cmd_Packet.SetCmdPayloadLen(); + + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + return false; + }; + + const char * CmdPacket =Cmd_Packet.CmdBuff; + this->SendPacket(objLoginInfo,CmdPacket,Cmd_Packet.CmdBuffPos); + + + int RetPacketLength =0; + this->GetRecvPktLength(RetPacketLength); + + //Cmd_Packet.CmdBuffPos =0; + char *Cmd_RevBuff =new char[RetPacketLength]; + + this->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + short RecvCommandID = 0; + int CmdRet = 0; + this->GetCmdRetInfo(Cmd_RevBuff, RecvCommandID,CmdRet); //获得接收到的命令ID以及执行返回结果 + if (Cmd_RevBuff) delete Cmd_RevBuff; + + if(CmdRet == LOGIN_FAIL_NOEXIST) + { + logError("用户名不存在!!!"); + return false; + } + else if(CmdRet == LOGIN_FAIL_ONLINE) + { + logError("此用户正在线,不能登录!!!"); + return false; + } + else if(CmdRet == LOGIN_FAIL_PASSWORD) + { + logError("密码错误!!!"); + return false; + } + + + if(CmdRet == LOGIN_SUCCESS) + { + objLoginInfo.m_nServerSuccess++; + } + else + { + objLoginInfo.m_nServerFail++; + } + + + return true; +} + +bool CNetOperation::Send_Logout(_LoginInfo& objLoginInfo,const int &ParamCmdID,const std::string &ParamSvrUserName) +{ + Cmd_Packet.CmdVersion =1; + Cmd_Packet.CmdBuffPos =0; + Cmd_Packet.CmdID = ParamCmdID; + Cmd_Packet.CmdBuffPos =0; + sprintf_s(Cmd_Packet.CmdSession, 32, "FREEEYES"); + + Cmd_Packet.SetCmdHead(); + Cmd_Packet.SetCmdPayload( ParamSvrUserName ); + Cmd_Packet.SetCmdPayloadLen(); + + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + return false; + }; + + const char * CmdPacket =Cmd_Packet.CmdBuff; + this->SendPacket(objLoginInfo,CmdPacket,Cmd_Packet.CmdBuffPos); + + + int RetPacketLength =0; + this->GetRecvPktLength(RetPacketLength); + + //Cmd_Packet.CmdBuffPos =0; + + char *Cmd_RevBuff = new char[RetPacketLength]; + + this->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + short RecvCommandID = 0; + int CmdRet = 0; + this->GetCmdRetInfo(Cmd_RevBuff, RecvCommandID,CmdRet); //获得接收到的命令ID以及执行返回结果 + + if (Cmd_RevBuff) delete Cmd_RevBuff; + + return true; +} + + +auto GetBuffValue(const char* ParamDesc, const int ParamSize, const char* ParamSrc,int ParamBufPos) +{ + memcpy_s((void*)ParamDesc, ParamSize, ParamSrc, ParamSize); + ParamBufPos += ParamSize; +} + + +bool CNetOperation::Send_FileList(const std::string &ParamSvrUserName,const std::string &ParamRemotePath) +{ + + Cmd_Packet.CmdVersion =1; + Cmd_Packet.CmdBuffPos =0; + Cmd_Packet.CmdID = COMMAND_FTP_FILELIST; + Cmd_Packet.CmdBuffPos =0; + sprintf_s(Cmd_Packet.CmdSession, 32, "FREEEYES"); + + Cmd_Packet.SetCmdHead(); + Cmd_Packet.SetCmdPayload( ParamSvrUserName ); + Cmd_Packet.SetCmdPayload( ParamRemotePath ); + + Cmd_Packet.SetCmdPayloadLen(); + + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + return false; + }; + + _LoginInfo objLoginInfo; + const char * CmdPacket =Cmd_Packet.CmdBuff; + this->SendPacket(objLoginInfo,CmdPacket,Cmd_Packet.CmdBuffPos); + + + + int RetPacketLength =0; + this->GetRecvPktLength(RetPacketLength); + + //Cmd_Packet.CmdBuffPos =0; + + + char *Cmd_RevBuff = new char[RetPacketLength]; + + int Cmd_RevBuff_Pos =0; + this->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + short RecvCommandID = 0; + int CmdRet = 0; + this->GetCmdRetInfo(Cmd_RevBuff, RecvCommandID,CmdRet); //获得接收到的命令ID以及执行返回结果 + Cmd_RevBuff_Pos =sizeof(short)+sizeof(int); + + + + if(CmdRet == OP_OK) + { + int FileCount =0; + GetBuffValue(reinterpret_cast (&FileCount), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]),Cmd_RevBuff_Pos); + + this->FileList.clear(); + + for(int i = 0; i < FileCount; i++) + { + int nFileNameLen = 0; + char szFileName[MAX_BUFF_500] = {'\0'}; + int nFileType = IS_FILE; + int nFileSize = 0; + + GetBuffValue(reinterpret_cast (&nFileNameLen), sizeof(char), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + GetBuffValue(reinterpret_cast (&szFileName), nFileNameLen, reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + GetBuffValue(reinterpret_cast (&nFileType), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + GetBuffValue(reinterpret_cast (&nFileSize), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + + + this->FileList.push_back({szFileName,nFileType,nFileSize}); + + } + } + if (Cmd_RevBuff) delete Cmd_RevBuff; + + return true; +} + +bool CNetOperation::Send_Download(const std::string &ParamSvrUserName,const std::string &ParamRemotePath ,const std::string &ParamLocalPath, const std::string &ParamFileName, int nIndex, int nSize, int& nBockCount) +{ + + Cmd_Packet.CmdVersion =1; + Cmd_Packet.CmdBuffPos =0; + Cmd_Packet.CmdID = COMMAND_FTP_FILE_DOWNLOAD; + Cmd_Packet.CmdBuffPos =0; + sprintf_s(Cmd_Packet.CmdSession, 32, "FREEEYES"); + + + Cmd_Packet.SetCmdHead(); + Cmd_Packet.SetCmdPayload( ParamSvrUserName ); + Cmd_Packet.SetCmdPayload( ParamRemotePath ); + Cmd_Packet.SetCmdPayload( nSize ); + Cmd_Packet.SetCmdPayload( nIndex ); + Cmd_Packet.SetCmdPayloadLen(); + + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + return false; + }; + + _LoginInfo objLoginInfo; + const char * CmdPacket =Cmd_Packet.CmdBuff; + this->SendPacket(objLoginInfo,CmdPacket,Cmd_Packet.CmdBuffPos); + + + + int RetPacketLength =0; + this->GetRecvPktLength(RetPacketLength); + + + char *Cmd_RevBuff = new char[RetPacketLength]; + + int Cmd_RevBuff_Pos =0; + this->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + short RecvCommandID = 0; + int CmdRet = 0; + this->GetCmdRetInfo(Cmd_RevBuff, RecvCommandID,CmdRet); //获得接收到的命令ID以及执行返回结果 + Cmd_RevBuff_Pos =sizeof(short)+sizeof(int); + + + if(CmdRet == OP_OK) + { + //得到文件块,并写入文件 + char* pBuffer = new char[nSize]; + int nFileBlockCount = 0; + int nFileCurrIndex = 0; + int nFileCurrBufferSize = 0; + + GetBuffValue(reinterpret_cast (&nBockCount), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + GetBuffValue(reinterpret_cast (&nFileCurrIndex), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + GetBuffValue(reinterpret_cast (&nFileCurrBufferSize), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + GetBuffValue(reinterpret_cast (&pBuffer), nFileCurrBufferSize, reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + + + std::string szLocalFilePath =ParamLocalPath+ParamFileName; + + //写入文件 + if(nFileCurrIndex == 0) + { + //如果是初始包,则删除当前文件。 + remove(szLocalFilePath.c_str()); + } + + FILE* pFile = NULL; + fopen_s(&pFile, szLocalFilePath.c_str(), "ab+"); + if(pFile == NULL) + { + logError("打开写入文件失败!!!"); + delete[] pBuffer; + return false; + } + if (Cmd_RevBuff) delete Cmd_RevBuff; + + fwrite(pBuffer, sizeof(char), nFileCurrBufferSize, pFile); + fclose(pFile); + delete[] pBuffer; + } + else + { + logError("获取远程文件失败!!!"); + return false; + } + + return true; +} + + + +bool CNetOperation::OpenLocalFile(const std::string& ParamLocalPath, const std::string& ParamFileName) //打开需要发送的本地文件 +{ + localfile.open(ParamLocalPath+ParamFileName,std::iostream::in|std::iostream::binary|std::iostream::ate); + + LocalFileSize =localfile.tellg(); + + FileBlockSize =MAX_BUFF_10240; + + if(LocalFileSize % FileBlockSize != 0) + { + FileBlockCount = LocalFileSize / FileBlockSize + 1; + LastBlockSize = LocalFileSize % FileBlockSize; + } + else + { + FileBlockCount = LocalFileSize / FileBlockSize; + LastBlockSize = FileBlockSize; + } + return true; +} + +void CNetOperation::closeLocalFile() +{ + localfile.close(); +} + +long int CNetOperation::GetFileSize() +{ + return LocalFileSize; +} + +int CNetOperation::GetFileBlockCount(const int &ParamBufferSize) +{ + return FileBlockCount; +} + +int CNetOperation::GetFileLastBlockSize(const int &ParamBufferSize) +{ + return LastBlockSize; +} + +void CNetOperation::ReadFileBlock(const int& ParamBlockIndex, char* ParamFileBuffer) +{ + + if(ParamBlockIndex != FileBlockCount - 1) + { + //如果不是最后一个块 + localfile.seekg( (long)(ParamBlockIndex * FileBlockSize) ); + localfile.read( ParamFileBuffer, FileBlockSize ); + } + else + { + //如果是最后一个块 + localfile.seekg( (long)(ParamBlockIndex * FileBlockSize) ); + localfile.read( ParamFileBuffer, LastBlockSize ); + } + +} + + + +bool CNetOperation::Send_Upload(const std::string &ParamSvrUserName,const std::string &ParamRemotePath ,const std::string &ParamLocalPath, const std::string &ParamFileName ) +{ + + for(int i = 0; i < FileBlockCount; i++) + { + Cmd_Packet.CmdVersion =1; + Cmd_Packet.CmdBuffPos =0; + Cmd_Packet.CmdID = COMMAND_FTP_FILE_DOWNLOAD; + Cmd_Packet.CmdBuffPos =0; + sprintf_s(Cmd_Packet.CmdSession, 32, "FREEEYES"); + + this->ReadFileBlock(i,this->FileBuffer); + + Cmd_Packet.SetCmdHead(); + Cmd_Packet.SetCmdPayload( ParamSvrUserName ); + Cmd_Packet.SetCmdPayload( ParamRemotePath ); + + if(i != FileBlockCount - 1) + { + //如果不是最后一个块 + ////CmdPacket =Cmd_Packet.SetCmdHead(sizeof(char), ParamSvrUserName.c_str(),sizeof(short),ParamRemotePath); + + Cmd_Packet.SetCmdPayload( FileBlockSize ); + Cmd_Packet.SetCmdPayload( i ); + Cmd_Packet.SetCmdPayload( FileBlockSize ); + Cmd_Packet.SetCmdPayload( FileBlockSize,this->FileBuffer ); + } + else + { + //如果是最后一个块 + // CmdPacket =Cmd_Packet.SetCmdHead(sizeof(char), ParamSvrUserName.c_str(),sizeof(short),ParamRemotePath); + + Cmd_Packet.SetCmdPayload( LastBlockSize ); + Cmd_Packet.SetCmdPayload( i ); + Cmd_Packet.SetCmdPayload( LastBlockSize ); + Cmd_Packet.SetCmdPayload( LastBlockSize,this->FileBuffer ); + + } + + + + Cmd_Packet.SetCmdPayloadLen(); + + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + return false; + }; + + _LoginInfo objLoginInfo; + const char * CmdPacket =Cmd_Packet.CmdBuff; + this->SendPacket(objLoginInfo,CmdPacket,Cmd_Packet.CmdBuffPos); + + + + + int RetPacketLength =0; + this->GetRecvPktLength(RetPacketLength); + + //Cmd_Packet.CmdBuffPos =0; + char *Cmd_RevBuff = new char[RetPacketLength]; + + this->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + short RecvCommandID = 0; + int CmdRet = 0; + this->GetCmdRetInfo(Cmd_RevBuff, RecvCommandID,CmdRet); //获得接收到的命令ID以及执行返回结果 + + + if(CmdRet == OP_OK) + { + int dwError = GetLastSocketError(); + logError("远程服务器接收数据失败!!!"); + return false; + } + + if (Cmd_RevBuff) delete Cmd_RevBuff; + } + + logInfo("上传文件成功!!!"); + + return true; +} + + + + + +bool CNetOperation::Send_UserInfo(const int &ParamUserID ,int &ParamReUserID,int &ParamLife,int &ParamMagic) +{ + Cmd_Packet.CmdVersion =1; + Cmd_Packet.CmdBuffPos =0; + Cmd_Packet.CmdID = COMMAND_LOGINCLIENT_USERINFO; + Cmd_Packet.CmdBuffPos =0; + sprintf_s(Cmd_Packet.CmdSession, 32, "FREEEYES"); + + Cmd_Packet.SetCmdHead(); + Cmd_Packet.SetCmdPayload( ParamUserID ); + Cmd_Packet.SetCmdPayloadLen(); + + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + return false; + }; + + _LoginInfo objLoginInfo; + const char * CmdPacket =Cmd_Packet.CmdBuff; + this->SendPacket(objLoginInfo,CmdPacket,Cmd_Packet.CmdBuffPos); + + + int RetPacketLength =0; + this->GetRecvPktLength(RetPacketLength); + + //Cmd_Packet.CmdBuffPos =0; + char *Cmd_RevBuff = new char[RetPacketLength]; + + int Cmd_RevBuff_Pos =0; + this->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + short RecvCommandID = 0; + int CmdRet = 0; + this->GetCmdRetInfo(Cmd_RevBuff, RecvCommandID,CmdRet); //获得接收到的命令ID以及执行返回结果 + Cmd_RevBuff_Pos =sizeof(short)+sizeof(int); + + GetBuffValue(reinterpret_cast (&ParamReUserID), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + GetBuffValue(reinterpret_cast (&ParamLife), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + GetBuffValue(reinterpret_cast (&ParamMagic), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + + if (Cmd_RevBuff) delete Cmd_RevBuff; + + return true; +} + +bool CNetOperation::Send_SetUserInfo( int nUserID, int nLife, int nMagic ) +{ + + Cmd_Packet.CmdVersion =1; + Cmd_Packet.CmdBuffPos =0; + Cmd_Packet.CmdID = COMMAND_LOGINCLIENT_SET_USERINFO; + Cmd_Packet.CmdBuffPos =0; + sprintf_s(Cmd_Packet.CmdSession, 32, "FREEEYES"); + + + Cmd_Packet.SetCmdHead(); + Cmd_Packet.SetCmdPayload( nUserID ); + Cmd_Packet.SetCmdPayload( nLife ); + Cmd_Packet.SetCmdPayload( nMagic ); + Cmd_Packet.SetCmdPayloadLen(); + + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + return false; + }; + + _LoginInfo objLoginInfo; + const char * CmdPacket =Cmd_Packet.CmdBuff; + this->SendPacket(objLoginInfo,CmdPacket,Cmd_Packet.CmdBuffPos); + + + + int RetPacketLength =0; + this->GetRecvPktLength(RetPacketLength); + + char *Cmd_RevBuff = new char[RetPacketLength]; + + int Cmd_RevBuff_Pos =0; + this->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + short RecvCommandID = 0; + int CmdRet = 0; + this->GetCmdRetInfo(Cmd_RevBuff, RecvCommandID,CmdRet); //获得接收到的命令ID以及执行返回结果 + Cmd_RevBuff_Pos =sizeof(short)+sizeof(int); + + if (Cmd_RevBuff) delete Cmd_RevBuff; + + if(CmdRet == LOGIN_SUCCESS) + { + logInfo("设置用户信息成功!!!"); + } + else + { + logError("设置用户信息失败!!!"); + } + + return true; +} + + + + +bool CNetOperation::Send_Plug(const char* ParamText ,short &ParamReCmdID,int &ParamRetB,int &ParamRetA) +{ + + Cmd_Packet.CmdVersion =1; + Cmd_Packet.CmdBuffPos =0; + Cmd_Packet.CmdID = COMMAND_PLUGA; + Cmd_Packet.CmdBuffPos =0; + sprintf_s(Cmd_Packet.CmdSession, 32, "FREEEYES"); + + Cmd_Packet.SetCmdHead(); + Cmd_Packet.SetCmdPayload( ParamText ); + Cmd_Packet.SetCmdPayloadLen(); + + if(IsValidSocketHandle(m_sckClient->GetHandle()) ) + { + return false; + }; + + _LoginInfo objLoginInfo; + const char * CmdPacket =Cmd_Packet.CmdBuff; + this->SendPacket(objLoginInfo,CmdPacket,Cmd_Packet.CmdBuffPos); + + + int RetPacketLength =0; + this->GetRecvPktLength(RetPacketLength); + + //Cmd_Packet.CmdBuffPos =0; + char *Cmd_RevBuff = new char[RetPacketLength]; + + int Cmd_RevBuff_Pos =0; + this->RecvPacket(objLoginInfo,Cmd_RevBuff,RetPacketLength); //接收报文 + + this->GetCmdRetInfo(Cmd_RevBuff, ParamReCmdID,ParamRetB); //获得接收到的命令ID以及执行返回结果 + Cmd_RevBuff_Pos =sizeof(short)+sizeof(int); + + GetBuffValue(reinterpret_cast (&ParamRetA), sizeof(int), reinterpret_cast (&Cmd_RevBuff[Cmd_RevBuff_Pos]), Cmd_RevBuff_Pos); + + if (Cmd_RevBuff) delete Cmd_RevBuff; + return true; +} diff --git a/ThirdLib/include/CNetOperation.h b/ThirdLib/include/CNetOperation.h new file mode 100644 index 000000000..f8660f07e --- /dev/null +++ b/ThirdLib/include/CNetOperation.h @@ -0,0 +1,290 @@ +/*************************************************************** + * Name: CNetOperation.h + * Purpose: Defines Application Frame + * Author: smith () + * Created: 2019-02-21 + * Copyright: smith () + * License: + **************************************************************/ + +#ifndef CNETOPERATION_H +#define CNETOPERATION_H + + +#include +#include +#include +#include +#include +#include +#include + + + + +#include "macro.h" +#include "sock_wrap.h" + + + +using namespace std; + + +#define MAX_BUFF_20 20 + +#define MAX_BUFF_50 50 +#define MAX_BUFF_500 500 +#define MAX_BUFF_10240 10240 +#define MAX_BUFF_200 200 + + +#define COMMAND_FTP_LOGIN 0x2000 //登陆 +#define COMMAND_FTP_LOGOUT 0x2001 //退出 +#define COMMAND_FTP_FILELIST 0x2002 //文件,文件夹列表 +#define COMMAND_FTP_FILE_DOWNLOAD 0x2003 //文件下载 +#define COMMAND_FTP_FILE_UPLOAD 0x2004 //文件上传 +#define COMMAND_FTP_RETURN_LOGIN 0xe000 //登陆应答 +#define COMMAND_FTP_RETURN_LOGOUT 0xe001 //登出应答 +#define COMMAND_FTP_RETURN_FILELIST 0xe002 //文件,文件夹列表应答 +#define COMMAND_FTP_RETURN_FILE_DOWNLOAD 0xe003 //文件下载 +#define COMMAND_FTP_RETURN_FILE_UPLOAD 0xe004 //文件上传 + + +#define COMMAND_LOGINCLIENT_LOGIN 0x2100 //登陆 +#define COMMAND_LOGINCLIENT_LOGOUT 0x2101 //退出 +#define COMMAND_LOGINCLIENT_USERINFO 0x2102 //获得玩家信息 +#define COMMAND_LOGINCLIENT_SET_USERINFO 0x2103 //设置用户信息 + + + + +#define LOGIN_SUCCESS 0 +#define LOGIN_FAIL_NOEXIST 1 +#define LOGIN_FAIL_ONLINE 2 +#define LOGIN_FAIL_PASSWORD 3 + +#define OP_OK 0 +#define OP_FAIL 1 + +#define IS_FILE 0 +#define IS_DIRRNT 1 + +struct FileInfo { + std::string FileName; + int FileType; + int FileSize; +}; + +struct Cmd_Packet_Info { + short CmdVersion; //命令版本号 + short CmdID; //命令编码 + int CmdPayloadLen; //为实际载荷长度 + char CmdSession[32] = { '\0' }; // Session名称 + char CmdBuff[MAX_BUFF_500] = { '\0' }; //用于存储序列化和反序列化后的字节流Buff + int CmdBuffPos = 0; + //以上为头部信息 + Cmd_Packet_Info() + { + CmdVersion = 1; + CmdID = 0x2000; + CmdPayloadLen = 0; + // CmdSession =; + } + + auto SetBuffValue(const char* ParamDesc, const int ParamSize, const char* ParamSrc) + { + memcpy_s((void*)ParamDesc, ParamSize, ParamSrc, ParamSize); + CmdBuffPos += ParamSize; + + } +/* + auto GetBuffValue(const char* ParamDesc, const int ParamSize, const char* ParamSrc) + { + memcpy_s(ParamDesc, ParamSize, ParamSrc, ParamSize); + CmdBuffPos += ParamSize; + } + */ + + template + auto SetCmdPayload(const std::string& ParamValue) + { + int ParamLength =(int)ParamValue.length(); + SetBuffValue(&CmdBuff[CmdBuffPos], sizeof(ParamType), reinterpret_cast(&ParamLength)); + SetBuffValue(&CmdBuff[CmdBuffPos], ParamLength, reinterpret_cast(ParamValue.c_str())); + CmdPayloadLen =CmdPayloadLen+sizeof(ParamType)+ParamLength; + } + + auto SetCmdPayload(const int &ParamLength,const char* ParamValue) + { + SetBuffValue(&CmdBuff[CmdBuffPos], ParamLength, ParamValue); + CmdPayloadLen =CmdPayloadLen+ParamLength; + } + + template auto SetCmdPayload(const T& ParamValue) + { + SetBuffValue(&CmdBuff[CmdBuffPos], sizeof(ParamValue), reinterpret_cast(&ParamValue)); + CmdPayloadLen =CmdPayloadLen+sizeof(ParamValue); + } + + auto SetCmdHead() + { + + CmdBuffPos = 0; + + SetBuffValue(&CmdBuff[CmdBuffPos], sizeof(short), reinterpret_cast(&CmdVersion)); + SetBuffValue(&CmdBuff[CmdBuffPos], sizeof(short), reinterpret_cast(&CmdID)); + SetBuffValue(&CmdBuff[CmdBuffPos], sizeof(int), reinterpret_cast(&CmdPayloadLen)); + SetBuffValue(&CmdBuff[CmdBuffPos], sizeof(char) * 32, reinterpret_cast(&CmdSession)); + + CmdPayloadLen =0; + } + void SetCmdPayloadLen() + { + memcpy_s(&CmdBuff[sizeof(short)+sizeof(short)], sizeof(int), reinterpret_cast(&CmdPayloadLen), sizeof(int)); + } + + + + + +}; + + + + +struct _LoginInfo +{ + char m_szUserName[MAX_BUFF_50]; + char m_szUserPass[MAX_BUFF_50]; + int m_nSendCount; + int m_nServerSuccess; + int m_nServerFail; + + _LoginInfo() + { + m_szUserName[0] = '\0'; + m_szUserPass[0] = '\0'; + m_nSendCount = 0; + m_nServerSuccess = 0; + m_nServerFail = 0; + } +}; + +struct _ServerInfo +{ + char m_szServerIP[MAX_BUFF_50]; + int m_nServerPort; + + _ServerInfo() + { + m_szServerIP[0] = '\0'; + m_nServerPort = 0; + } +}; + +struct _LoginClient +{ + char m_szUserName[MAX_BUFF_50]; + char m_szUserPass[MAX_BUFF_50]; + int m_nUserIDFrom; + int m_nUserIDTo; + + _LoginClient() + { + m_szUserName[0] = '\0'; + m_szUserPass[0] = '\0'; + m_nUserIDFrom = 0; + m_nUserIDTo = 0; + } +}; + +typedef vector<_LoginInfo> vecLoginInfo; + + +#define COMMAND_PLUGA 0x2201 + + +struct _PassTest +{ + int m_nSendCount; //压测发送数据包数 + int m_nRecvCount; //压测接收数据包数 + + _PassTest() + { + Init(); + } + + void Init() + { + m_nSendCount = 0; + m_nRecvCount = 0; + } +}; + + +//注册有关命令结构信息,从字节流解码为实际命令,将命令编码为字节流用于发送 + +class CNetOperation +{ +public: + CNetOperation(int tcpudp); + virtual ~CNetOperation(); + +public: + void Init(int tcpudp); //初始化网络环境 + void Deinit(); //销毁网络 + void Close(); //关闭网络 + bool Conn(const std::string& ParamServerIP, const int& ParamServerPort, const int& ParamTimeout); //连接网络 + + bool SendPacket(_LoginInfo& objLoginInfo,const char* ParamPacketBuff, const int& PacketLength); //发送报文 + bool RecvPacket(_LoginInfo& objLoginInfo,const char* ParamPacketBuff, const int& PacketLength); //接收报文 + + bool GetRecvPktLength(const int& ParamPacketLength); //获得需要接收的下一个报文的长度 + void GetCmdRetInfo(const char* ParamPacketBuff, short& ParamCommandID, const int& ParamCmdRet); //获得接收到的命令ID以及执行返回结果 + +private: + Cmd_Packet_Info Cmd_Packet; + +public: + bool Send_Login(_LoginInfo& objLoginInfo,const int &ParamCmdID,const std::string& ParamSvrUserName, const std::string& ParamSvrUserPass); + bool Send_Logout(_LoginInfo& objLoginInfo,const int &ParamCmdID,const std::string& ParamSvrUserName); + +public: + bool Send_FileList(const std::string& ParamSvrUserName, const std::string& ParamRemotePath); + bool Send_Download(const std::string& ParamSvrUserName, const std::string& ParamRemotePath, const std::string& ParamLocalPath, + const std::string& ParamFileName, int nIndex, int nSize, int& nBockCount); + + bool Send_Upload(const std::string& ParamSvrUserName, + const std::string& ParamRemotePath, + const std::string& ParamLocalPath, + const std::string& ParamFileName); + +public: + bool Send_UserInfo(const int &ParamUserID ,int &ParamReUserID,int &ParamLife,int &ParamMagic); + bool Send_SetUserInfo(int nUserID, int nLife, int nMagic); + +public: + bool Send_Plug(const char* ParamText ,short &ParamReCmdID,int &ParamRetB,int &ParamRetA ); + +private: + bool OpenLocalFile(const std::string& ParamLocalPath, const std::string& ParamFileName); //打开需要发送的本地文件 + void closeLocalFile(); + long int GetFileSize(); + int GetFileBlockCount(const int &ParamBufferSize);//计算需要发送的本地文件的数据块数量 + int GetFileLastBlockSize(const int &ParamBufferSize);//计算需要发送的本地文件的数据块数量 + void ReadFileBlock(const int& ParamBlockIndex, char* ParamFileBuffer); + + char FileBuffer[MAX_BUFF_10240] = {'\0'}; + std::ifstream localfile; + int LocalFileSize; + int FileBlockSize; + int FileBlockCount; + int LastBlockSize; + +private: + CSockWrap* m_sckClient; + std::vector FileList; +}; + +#endif // CNetOperation + diff --git a/ThirdLib/include/Common.h b/ThirdLib/include/Common.h new file mode 100644 index 000000000..d5d9b7e64 --- /dev/null +++ b/ThirdLib/include/Common.h @@ -0,0 +1,711 @@ +#ifndef COMMON_H +#define COMMON_H + +#include +#include +#ifdef _WIN32 +#include +#include "winsock2.h" +#else +#include +#include +#include +#include +#include +#include +#endif + +#include +#include +#include + +using namespace std; + +#define MAX_CODE_LINE_SIZE 1024 + +//֧memcpyı߽ +inline bool memcpy_safe(char* pSrc, int nSrcLen, char* pDes, int nDesLen) +{ + if(nSrcLen > nDesLen) + { + return false; + } + else + { +#ifdef WIN32 + memcpy_s((void* )pDes, nDesLen, (void* )pSrc, (size_t)nSrcLen); +#else + memcpy((void* )pDes, (void* )pSrc, (size_t)nSrcLen); +#endif + return true; + } +} + +static unsigned long GetSystemTickCount() +{ +#ifdef WIN32 + return GetTickCount(); +#else + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + + return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000); +#endif +} + +//sprintf +static void sprintf_safe(char* szText, int nLen, const char* fmt ...) +{ + if(szText == NULL) + { + return; + } + + va_list ap; + va_start(ap, fmt); + + vsnprintf(szText, nLen, fmt, ap); + szText[nLen - 1] = '\0'; + + va_end(ap); +}; + +static void To_Upper_String(const char* pSrc, char* pRet) +{ + int nLen = (int)strlen(pSrc); + + for(int i = 0; i < nLen; i++) + { + pRet[i] = toupper(pSrc[i]); + } + + pRet[nLen] = '\0'; +} + +//ַתΪ +static int Char2Number(const char* pData) +{ + if(pData[0] == '0' && pData[1] == 'x') + { + //ʮת + return (int)strtol(pData, NULL, 16); + } + else + { + //ʮת + return (int)atoi(pData); + } +} + +//ַתAPI +static bool Get_binary_Char(unsigned char cTag, unsigned char& cDes) +{ + if(cTag >='A'&& cTag <='F') + { + cDes = cTag - 'A' + 10; + return true; + } + else if(cTag >='a'&& cTag <='f') + { + cDes = cTag - 'a' + 10; + return true; + } + else if(cTag >= '0'&& cTag<= '9') + { + cDes = cTag-'0'; + return true; + } + else + { + return false; + } +} + +static bool ConvertStr2char(const char* pData, unsigned char& cData) +{ + if(pData == NULL || strlen(pData) != 2) + { + return false; + } + + char cFirst = pData[1]; + unsigned char cTemp = 0; + bool blStste = Get_binary_Char(cFirst, cTemp); + if(false == blStste) + { + return false; + } + cData = cTemp; + char cSecond = pData[0]; + blStste = Get_binary_Char(cSecond, cTemp); + if(false == blStste) + { + return false; + } + cTemp = cTemp << 4; + cData = cData | cTemp; + + return true; +} + +//õתַ +static int GetBufferSize(const char* pData, int nSrcLen) +{ + char szData[3] = {'\0'}; + int nPos = 0; + int nCurrSize = 0; + int nConvertSize = 0; + bool blState = false; //תַǷЧ + bool blSrcState = true; //ԪַǷЧ + unsigned char cData; + + while(nPos < nSrcLen) + { + if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) + { + if(nPos == nSrcLen - 1) + { + szData[nCurrSize++] = pData[nPos]; + } + + szData[nCurrSize] = '\0'; + if(blSrcState == true) + { + blState = ConvertStr2char(szData, cData); + if(blState == true) + { + nConvertSize++; + } + } + nCurrSize = 0; + blSrcState = true; + nPos++; + } + else + { + if(nCurrSize < 2) + { + szData[nCurrSize++] = pData[nPos]; + } + else + { + blSrcState = false; + } + nPos++; + } + } + + return nConvertSize; +}; + +//ַתΪƴĴ +static bool Convertstr2charArray(const char* pData, int nSrcLen, unsigned char* pDes, int& nMaxLen) +{ + char szData[3] = {'\0'}; + int nPos = 0; + int nCurrSize = 0; + int nConvertSize = 0; + bool blState = false; //תַǷЧ + bool blSrcState = true; //ԪַǷЧ + + while(nPos < nSrcLen) + { + if(pData[nPos] == '\r' || pData[nPos] == '\n' || pData[nPos] == ' ' || nPos == nSrcLen - 1) + { + if(nPos == nSrcLen - 1) + { + szData[nCurrSize++] = pData[nPos]; + } + + szData[nCurrSize] = '\0'; + if(nConvertSize < nMaxLen && blSrcState == true) + { + blState = ConvertStr2char(szData, pDes[nConvertSize]); + if(blState == true) + { + nConvertSize++; + } + } + nCurrSize = 0; + blSrcState = true; + nPos++; + } + else + { + if(nCurrSize < 2) + { + szData[nCurrSize++] = pData[nPos]; + } + else + { + blSrcState = false; + } + nPos++; + } + } + + nMaxLen = nConvertSize; + return true; +}; + +typedef vector vec_Xml_File_Name; + +#define MAX_BUFF_50 50 +#define MAX_BUFF_100 100 +#define MAX_BUFF_500 500 + +//ݸʽ +struct _Data_Info +{ + char m_szDataName[MAX_BUFF_50]; + char m_szDataType[MAX_BUFF_50]; + int m_nLength; + bool m_blIsString; + string m_strValue; + + _Data_Info() + { + m_szDataName[0] = '\0'; + m_szDataType[0] = '\0'; + m_nLength = 0; + m_blIsString = true; + m_strValue = ""; + } +}; +typedef vector<_Data_Info> vec_Data_Info; + +struct _Packet_Send +{ + vec_Data_Info m_obj_Data_Info_List; + + int Get_Length() + { + int nSize = 0; + for(int i = 0; i < (int)m_obj_Data_Info_List.size(); i++) + { + if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "short") == 0) + { + nSize += 2; + } + else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "int") == 0) + { + nSize += 4; + } + else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "char") == 0) + { + if(m_obj_Data_Info_List[i].m_nLength > 0) + { + nSize += m_obj_Data_Info_List[i].m_nLength; + } + else + { + nSize += (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()); + } + } + } + + return nSize; + } + + // + void In_Stream(char* pData, int nLen, short sOrder) + { + int nPos = 0; + for(int i = 0; i < (int)m_obj_Data_Info_List.size(); i++) + { + if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "short") == 0) + { + short sData = (short)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str()); + if(sOrder == 1) + { + // + sData = htons(sData); + } + memcpy_safe((char* )&sData, 2, &pData[nPos], nLen - nPos); + nPos += 2; + } + else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "int") == 0) + { + int nData = (int)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str()); + if(sOrder == 1) + { + // + nData = htonl(nData); + } + memcpy_safe((char* )&nData, 4, &pData[nPos], nLen - nPos); + nPos += 4; + } + else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "char") == 0) + { + if(m_obj_Data_Info_List[i].m_nLength > 0) + { + if(m_obj_Data_Info_List[i].m_blIsString == true) + { + memcpy_safe((char* )m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_nLength, &pData[nPos], nLen - nPos); + nPos += m_obj_Data_Info_List[i].m_nLength; + } + else + { + //ƴװ + int nValueLen = GetBufferSize((char*)m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_strValue.length()); + char* pValue = new char[nValueLen]; + Convertstr2charArray(m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_strValue.length(), (unsigned char* )pValue, nValueLen); + memcpy_safe(pValue, nValueLen, &pData[nPos], nLen - nPos); + delete pValue; + nPos += m_obj_Data_Info_List[i].m_nLength; + } + } + else if(m_obj_Data_Info_List[i].m_nLength == 1) + { + short sData = (short)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str()); + memcpy_safe((char* )&sData, 1, &pData[nPos], nLen - nPos); + nPos += m_obj_Data_Info_List[i].m_nLength; + } + else + { + if(m_obj_Data_Info_List[i].m_blIsString == true) + { + memcpy_safe((char* )m_obj_Data_Info_List[i].m_strValue.c_str(), (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()), &pData[nPos], nLen - nPos); + nPos += (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()); + } + else + { + //ƴװ + int nValueLen = GetBufferSize((char*)m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_strValue.length()); + char* pValue = new char[nValueLen]; + Convertstr2charArray(m_obj_Data_Info_List[i].m_strValue.c_str(), m_obj_Data_Info_List[i].m_strValue.length(), (unsigned char* )pValue, nValueLen); + memcpy_safe(pValue, nValueLen, &pData[nPos], nLen - nPos); + delete pValue; + nPos += nValueLen; + } + } + } + } + } +}; + +struct _Packet_Recv +{ + vec_Data_Info m_obj_Data_Info_List; + + int Get_Length() + { + int nSize = 0; + for(int i = 0; i < (int)m_obj_Data_Info_List.size(); i++) + { + if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "short") == 0) + { + nSize += 2; + } + else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "int") == 0) + { + nSize += 4; + } + else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "char") == 0) + { + if(m_obj_Data_Info_List[i].m_nLength > 0) + { + nSize += m_obj_Data_Info_List[i].m_nLength; + } + else + { + nSize += (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()); + } + } + + } + return nSize; + } + + string Check_Stream(char* pData, int nLen, short sOrder, bool& blIsError) + { + string strRet = "ݰɹ"; + int nPos = 0; + for(int i = 0; i < (int)m_obj_Data_Info_List.size(); i++) + { + if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "short") == 0) + { + short sData = 0; + memcpy_safe(&pData[nPos], 2, (char* )&sData, 2); + if(sOrder == 1) + { + // + sData = ntohs(sData); + } + if(sData != (short)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str())) + { + char szError[MAX_BUFF_50] = {'\0'}; + ::sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%d],ʵֵ[%d]", + m_obj_Data_Info_List[i].m_szDataName, + (short)atoi(m_obj_Data_Info_List[i].m_strValue.c_str()), + sData); + blIsError = true; + return strRet; + } + nPos += 2; + } + else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "int") == 0) + { + int nData = 0; + memcpy_safe(&pData[nPos], 4, (char* )&nData, 4); + if(sOrder == 1) + { + // + nData = ntohl(nData); + } + if(nData != (int)Char2Number(m_obj_Data_Info_List[i].m_strValue.c_str())) + { + char szError[MAX_BUFF_50] = {'\0'}; + ::sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%d],ʵֵ[%d]", + m_obj_Data_Info_List[i].m_szDataName, + (int)atoi(m_obj_Data_Info_List[i].m_strValue.c_str()), + nData); + blIsError = true; + return strRet; + } + nPos += 4; + } + else if(strcmp(m_obj_Data_Info_List[i].m_szDataType, "char") == 0) + { + if(m_obj_Data_Info_List[i].m_nLength > 1) + { + char* pObjectData = new char[m_obj_Data_Info_List[i].m_nLength + 1]; + memcpy_safe(&pData[nPos], m_obj_Data_Info_List[i].m_nLength, (char* )pObjectData, m_obj_Data_Info_List[i].m_nLength); + pObjectData[m_obj_Data_Info_List[i].m_nLength] = '\0'; + if(strcmp(pObjectData, m_obj_Data_Info_List[i].m_strValue.c_str()) != 0) + { + char szError[MAX_BUFF_500] = {'\0'}; + ::sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%s],ʵֵ[%s]", + m_obj_Data_Info_List[i].m_szDataName, + m_obj_Data_Info_List[i].m_strValue.c_str(), + pObjectData); + delete pObjectData; + blIsError = true; + return strRet; + } + + delete pObjectData; + nPos += m_obj_Data_Info_List[i].m_nLength; + } + else if(m_obj_Data_Info_List[i].m_nLength == 1) + { + //һֽڣֱΪ + char* pObjectData = new char[m_obj_Data_Info_List[i].m_nLength + 1]; + memcpy_safe(&pData[nPos], m_obj_Data_Info_List[i].m_nLength, (char* )pObjectData, m_obj_Data_Info_List[i].m_nLength); + pObjectData[m_obj_Data_Info_List[i].m_nLength] = '\0'; + if(atoi(pObjectData) != atoi(m_obj_Data_Info_List[i].m_strValue.c_str())) + { + char szError[MAX_BUFF_500] = {'\0'}; + ::sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%s],ʵֵ[%s]", + m_obj_Data_Info_List[i].m_szDataName, + m_obj_Data_Info_List[i].m_strValue.c_str(), + pObjectData); + delete pObjectData; + blIsError = true; + return strRet; + } + delete pObjectData; + nPos += m_obj_Data_Info_List[i].m_nLength; + } + else + { + char* pObjectData = new char[nLen - nPos + 1]; + memcpy_safe(&pData[nPos], nLen - nPos, (char* )pObjectData, nLen - nPos); + pObjectData[nLen - nPos] = '\0'; + if(strcmp(pObjectData, m_obj_Data_Info_List[i].m_strValue.c_str()) != 0) + { + char szError[MAX_BUFF_500] = {'\0'}; + ::sprintf_safe(szError, MAX_BUFF_50, "ֶ[%s],ڴֵ[%s],ʵֵ[%s]", + m_obj_Data_Info_List[i].m_szDataName, + m_obj_Data_Info_List[i].m_strValue.c_str(), + pObjectData); + delete pObjectData; + blIsError = true; + return strRet; + } + + delete pObjectData; + nPos += (int)strlen(m_obj_Data_Info_List[i].m_strValue.c_str()); + } + } + + } + + blIsError = false; + return strRet; + } +}; + +struct _Command_Info +{ + char m_szCommandName[MAX_BUFF_50]; + int m_nCount; + int m_nTimeCost; //λǺ + int m_nThreadCount; //߳ + _Packet_Send m_obj_Packet_Send; + _Packet_Recv m_obj_Packet_Recv; + + _Command_Info() + { + m_szCommandName[0] = '\0'; + m_nCount = 1; + m_nTimeCost = 100; + m_nThreadCount = 1; + } +}; +typedef vector<_Command_Info> vec_Command_Info; + +struct _Test_Assemble +{ + char m_szTestAssembleName[MAX_BUFF_50]; + char m_szDesc[MAX_BUFF_100]; + char m_szIP[MAX_BUFF_50]; + char m_szOrder[MAX_BUFF_50]; + int m_nPort; + vec_Command_Info m_obj_Command_Info_List; + + _Test_Assemble() + { + m_szTestAssembleName[0] = '\0'; + m_szDesc[0] = '\0'; + m_szIP[0] = '\0'; + m_nPort = 0; + ::sprintf_safe(m_szOrder, MAX_BUFF_50,"HOST"); + } +}; +typedef vector<_Test_Assemble> vec_Test_Assemble; + +//ָĿ¼XMLļ +static bool Read_Xml_Folder( string folderPath, vec_Xml_File_Name& obj_vec_Xml_File_Name) +{ +#ifdef WIN32 + _finddata_t FileInfo; + string strfind = folderPath + "\\*"; + long Handle = _findfirst(strfind.c_str(), &FileInfo); + + if (Handle == -1L) + { + return false; + } + do + { + //жǷĿ¼ + if (FileInfo.attrib & _A_SUBDIR) + { + //Ҫ + if( (strcmp(FileInfo.name,".") != 0 ) &&(strcmp(FileInfo.name,"..") != 0)) + { + //֧Ŀ¼ + //string newPath = folderPath + "\\" + FileInfo.name; + //dfsFolder(newPath); + } + } + else + { + string filename = folderPath + "\\" + FileInfo.name; + obj_vec_Xml_File_Name.push_back(filename); + } + } while (_findnext(Handle, &FileInfo) == 0); + + _findclose(Handle); +#else + DIR *dp; + struct dirent *entry; + struct stat statbuf; + if((dp = opendir(folderPath.c_str())) == NULL) + { + printf("cannot open directory: %s\n", folderPath.c_str()); + return false; + } + chdir(folderPath.c_str()); + while((entry = readdir(dp)) != NULL) + { + lstat(entry->d_name,&statbuf); + if(S_ISDIR(statbuf.st_mode)) + { + if(strcmp(".",entry->d_name) == 0 || strcmp("..",entry->d_name) == 0) + continue; + //Ҫ֧Ŀ¼ + //printf("%*s%s/\n",depth,"",entry->d_name); + //dfsFolder(entry->d_name,depth+4); + } + else + { + string filename = folderPath + "/" + entry->d_name; + obj_vec_Xml_File_Name.push_back(filename); + } + } + chdir(".."); + closedir(dp); +#endif + return true; +} + +static void Create_HTML_Begin(FILE* pFile) +{ + char szTemp[MAX_BUFF_500] = {'\0'}; + + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + fflush(pFile); +} + +static void Create_TD_Title(FILE* pFile, const char* pAssemableName, const char* pDesc, const char* pIP, int nPort) +{ + char szTemp[MAX_BUFF_500] = {'\0'}; + + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n", pAssemableName, pDesc, pIP, nPort); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + fflush(pFile); +} + +static void Create_TD_Content(FILE* pFile, const char* pCssName, const char* pCommandName, const char* pContent, const char* pTime) +{ + char szTemp[MAX_BUFF_500] = {'\0'}; + + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n", pCssName, pCommandName); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n", pCssName, pContent); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n", pCssName, pTime); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + fflush(pFile); +} + +static void Create_HTML_End(FILE* pFile) +{ + char szTemp[MAX_BUFF_500] = {'\0'}; + ::sprintf_safe(szTemp, MAX_BUFF_500, "
%s:%s(%s:%d)
%s%s%s
\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + ::sprintf_safe(szTemp, MAX_BUFF_500, "\n"); + fwrite(szTemp, strlen(szTemp), sizeof(char), pFile); + fflush(pFile); +} + +#endif + +class sprintf_safe; diff --git a/purenessscopeserver/example-Module/MonitorServer/EncodeConvert/GBKtoUTF8.cpp b/ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/EncodeConvert/GBKtoUTF8.cpp rename to ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp diff --git a/purenessscopeserver/example-Module/MonitorServer/EncodeConvert/GBKtoUTF8.h b/ThirdLib/include/EncodeConvert/GBKtoUTF8.h similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/EncodeConvert/GBKtoUTF8.h rename to ThirdLib/include/EncodeConvert/GBKtoUTF8.h diff --git a/purenessscopeserver/example-Module/MonitorServer/EncodeConvert/GBKtoUTF8.inl b/ThirdLib/include/EncodeConvert/GBKtoUTF8.inl similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/EncodeConvert/GBKtoUTF8.inl rename to ThirdLib/include/EncodeConvert/GBKtoUTF8.inl diff --git a/purenessscopeserver/example-Module/LuaTest/Lua/LuaDefine.h b/ThirdLib/include/Lua/LuaDefine.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/Lua/LuaDefine.h rename to ThirdLib/include/Lua/LuaDefine.h diff --git a/purenessscopeserver/example-Module/LuaTest/Lua/LuaFn.cpp b/ThirdLib/include/Lua/LuaFn.cpp similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/Lua/LuaFn.cpp rename to ThirdLib/include/Lua/LuaFn.cpp diff --git a/purenessscopeserver/example-Module/LuaTest/Lua/LuaFn.h b/ThirdLib/include/Lua/LuaFn.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/Lua/LuaFn.h rename to ThirdLib/include/Lua/LuaFn.h diff --git a/purenessscopeserver/example-Module/LuaTest/Lua/LuaFnRegister.h b/ThirdLib/include/Lua/LuaFnRegister.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/Lua/LuaFnRegister.h rename to ThirdLib/include/Lua/LuaFnRegister.h diff --git a/purenessscopeserver/example-Module/LuaTest/Lua/LuaFn_Tcp.h b/ThirdLib/include/Lua/LuaFn_Tcp.h similarity index 99% rename from purenessscopeserver/example-Module/LuaTest/Lua/LuaFn_Tcp.h rename to ThirdLib/include/Lua/LuaFn_Tcp.h index 635ec5746..eb230f4e0 100644 --- a/purenessscopeserver/example-Module/LuaTest/Lua/LuaFn_Tcp.h +++ b/ThirdLib/include/Lua/LuaFn_Tcp.h @@ -9,7 +9,7 @@ static int LuaFn_Tcp_Print(lua_State* pState) int nLen = (int)lua_tonumber(pState, 2); char* pData = (char* )lua_tostring(pState, 1); -#if WIN32 +#if _WIN32_PLATFORM_ printf_s("[LuaFn_Tcp_Print]nLen=%d.\n", nLen); #else printf("[LuaFn_Tcp_Print]nLen=%d.\n", nLen); diff --git a/purenessscopeserver/example-Module/LuaTest/Lua/ParamData.h b/ThirdLib/include/Lua/ParamData.h similarity index 99% rename from purenessscopeserver/example-Module/LuaTest/Lua/ParamData.h rename to ThirdLib/include/Lua/ParamData.h index 0e407729a..07997f285 100644 --- a/purenessscopeserver/example-Module/LuaTest/Lua/ParamData.h +++ b/ThirdLib/include/Lua/ParamData.h @@ -32,7 +32,7 @@ struct _ParamData void SetParam(void* pParam, const char* szType, int nTypeLen) { m_pParam = pParam; -#if WIN32 +#if _WIN32_PLATFORM_ sprintf_s(m_szType, MAX_PARAM_200, "%s", szType); #else sprintf(m_szType, "%s", szType); @@ -98,7 +98,7 @@ class CParamGroup { m_blIsDelete = true; } - + ~CParamGroup() { if(m_blIsDelete == true) diff --git a/ThirdLib/include/TcpSocketClient.cpp b/ThirdLib/include/TcpSocketClient.cpp new file mode 100644 index 000000000..1663c9043 --- /dev/null +++ b/ThirdLib/include/TcpSocketClient.cpp @@ -0,0 +1,107 @@ +/* + * Source file about portable socket class. + * + * design:odison + * e-mail:odison@126.com> + * + */ + +#include "TcpSocketClient.h" + + + +ODSocket::ODSocket(SOCKET sock) +{ + // m_sock = sock; +} + +ODSocket::~ODSocket() +{ +} + + + +bool ODSocket::Connect(const char* ip, unsigned short port,int timeout) +{ + remote_addr_(port,hostname); + ACE_DEBUG ((LM_DEBUG, "(%P|%t) Starting connect to %s:%dn", remote_addr_.get_host_name(),remote_addr_.get_port_number())); + + ACE_Time_Value ace_timeout(timeout,0); + + if (connector_.connect (client_stream_, remote_addr_,&ace_timeout) == -1) + { + ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) %pn","connection failed"),-1); + } + else + { + ACE_DEBUG ((LM_DEBUG,"(%P|%t) connected to %sn", remote_addr_.get_host_name ())); + } + + +} + +int ODSocket::Send(const char* buf, int len, int flags) +{ + + + int Send_Count = 0; + while(true) + { + + Send_Count = client_stream_.send_n (buf, ACE_OS::strlen(buf)+1); + if ( Send_Count == -1) + { + ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) %pn","send_n"),0); + break; + } + } + + return Send_Count; + +} + +int ODSocket::Recv(char* buf, int len, int flags) +{ + // return (recv(m_sock, buf, len, flags)); + + int Recv_Count = 0; + Recv_Count=client_stream_.recv_n (buf, len ); + if( Recv_Count ==-1) + { + ACE_ERROR ((LM_ERROR, "%pn", "Error in recv")); + } + else + { + // data_buf_[byte_count]=0; + ACE_DEBUG((LM_DEBUG,"Server received: %sn",buf)); + } + + return Recv_Count; + +} + +int ODSocket::Close() +{ + if (client_stream_.close () == -1) + ACE_ERROR_RETURN ((LM_ERROR,"(%P|%t) %pn","close"),-1); + else + return 0; +} + + + +bool ODSocket::DnsParse(const char* domain, char* ip) +{ + struct hostent* p; + if ( (p = gethostbyname(domain)) == NULL ) + return false; + + sprintf(ip, + "%u.%u.%u.%u", + (unsigned char)p->h_addr_list[0][0], + (unsigned char)p->h_addr_list[0][1], + (unsigned char)p->h_addr_list[0][2], + (unsigned char)p->h_addr_list[0][3]); + + return true; +} diff --git a/ThirdLib/include/TcpSocketClient.h b/ThirdLib/include/TcpSocketClient.h new file mode 100644 index 000000000..1c89b5190 --- /dev/null +++ b/ThirdLib/include/TcpSocketClient.h @@ -0,0 +1,47 @@ + + +#ifndef _ODSOCKET_H_ +#define _ODSOCKET_H_ + +#include "ace/SOCK_Connector.h" +#include "ace/INET_Addr.h" +#include "ace/Log_Msg.h" +#include "ace/OS_NS_stdio.h" +#include "ace/OS_NS_string.h" + +#define SIZE_BUF 128 +#define NO_ITERATIONS 1 + + + + +class ODSocket { + +public: + ODSocket(SOCKET sock = INVALID_SOCKET); + ~ODSocket(); + + // Connect socket + bool Connect(const char* ip, unsigned short port,int timeout = 0); + + // Send socket + int Send(const char* buf, int len, int flags = 0); + + // Recv socket + int Recv(char* buf, int len, int flags = 0); + + // Close socket + int Close(); + + + // Domain parse + static bool DnsParse(const char* domain, char* ip); + + +protected: + ACE_SOCK_Stream client_stream_; + ACE_INET_Addr remote_addr_; + ACE_SOCK_Connector connector_; + +}; +#endif diff --git a/purenessscopeserver/example-Module/MonitorServer/TinyXML/tinystr.cpp b/ThirdLib/include/TinyXML/tinystr.cpp similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/TinyXML/tinystr.cpp rename to ThirdLib/include/TinyXML/tinystr.cpp diff --git a/purenessscopeserver/example-Module/MonitorServer/TinyXML/tinystr.h b/ThirdLib/include/TinyXML/tinystr.h similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/TinyXML/tinystr.h rename to ThirdLib/include/TinyXML/tinystr.h diff --git a/ThirdLib/include/TinyXML/tinyxml.cpp b/ThirdLib/include/TinyXML/tinyxml.cpp new file mode 100644 index 000000000..db3935f9c --- /dev/null +++ b/ThirdLib/include/TinyXML/tinyxml.cpp @@ -0,0 +1,2231 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +#include + +#ifdef TIXML_USE_STL +#include +#include +#endif + +#include "tinyxml.h" + +FILE* TiXmlFOpen( const char* filename, const char* mode ); + +bool TiXmlBase::condenseWhiteSpace = true; + +// Microsoft compiler security +FILE* TiXmlFOpen( const char* filename, const char* mode ) +{ +#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) + FILE* fp = 0; + errno_t err = fopen_s( &fp, filename, mode ); + + if ( !err && fp ) + { + return fp; + } + + return 0; +#else + return fopen( filename, mode ); +#endif +} + +void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) +{ + int i=0; + + while( i<(int)str.length() ) + { + unsigned char c = (unsigned char) str[i]; + + if ( c == '&' + && i < ( (int)str.length() - 2 ) + && str[i+1] == '#' + && str[i+2] == 'x' ) + { + // Hexadecimal character reference. + // Pass through unchanged. + // © -- copyright symbol, for example. + // + // The -1 is a bug fix from Rob Laveaux. It keeps + // an overflow from happening if there is no ';'. + // There are actually 2 ways to exit this loop - + // while fails (error case) and break (semicolon found). + // However, there is no mechanism (currently) for + // this function to return an error. + while ( i<(int)str.length()-1 ) + { + outString->append( str.c_str() + i, 1 ); + ++i; + + if ( str[i] == ';' ) + { + break; + } + } + } + else if ( c == '&' ) + { + outString->append( entity[0].str, entity[0].strLength ); + ++i; + } + else if ( c == '<' ) + { + outString->append( entity[1].str, entity[1].strLength ); + ++i; + } + else if ( c == '>' ) + { + outString->append( entity[2].str, entity[2].strLength ); + ++i; + } + else if ( c == '\"' ) + { + outString->append( entity[3].str, entity[3].strLength ); + ++i; + } + else if ( c == '\'' ) + { + outString->append( entity[4].str, entity[4].strLength ); + ++i; + } + else if ( c < 32 ) + { + // Easy pass at non-alpha/numeric/symbol + // Below 32 is symbolic. + char buf[ 32 ]; + +#if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); +#else + sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); +#endif + + //*ME: warning C4267: convert 'size_t' to 'int' + //*ME: Int-Cast to make compiler happy ... + outString->append( buf, (int)strlen( buf ) ); + ++i; + } + else + { + //char realc = (char) c; + //outString->append( &realc, 1 ); + *outString += (char) c; // somewhat more efficient function call. + ++i; + } + } +} + + +TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() +{ + parent = 0; + type = _type; + firstChild = 0; + lastChild = 0; + prev = 0; + next = 0; +} + + +TiXmlNode::~TiXmlNode() +{ + TiXmlNode* node = firstChild; + TiXmlNode* temp = 0; + + while ( node ) + { + temp = node; + node = node->next; + delete temp; + } +} + + +void TiXmlNode::CopyTo( TiXmlNode* target ) const +{ + target->SetValue (value.c_str() ); + target->userData = userData; + target->location = location; +} + + +void TiXmlNode::Clear() +{ + TiXmlNode* node = firstChild; + TiXmlNode* temp = 0; + + while ( node ) + { + temp = node; + node = node->next; + delete temp; + } + + firstChild = 0; + lastChild = 0; +} + + +TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) +{ + assert( node->parent == 0 || node->parent == this ); + assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); + + if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + delete node; + + if ( GetDocument() ) + { + GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + } + + return 0; + } + + node->parent = this; + + node->prev = lastChild; + node->next = 0; + + if ( lastChild ) + { + lastChild->next = node; + } + else + { + firstChild = node; // it was an empty list. + } + + lastChild = node; + return node; +} + + +TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) +{ + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) + { + GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + } + + return 0; + } + + TiXmlNode* node = addThis.Clone(); + + if ( !node ) + { + return 0; + } + + return LinkEndChild( node ); +} + + +TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) +{ + if ( !beforeThis || beforeThis->parent != this ) + { + return 0; + } + + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) + { + GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + } + + return 0; + } + + TiXmlNode* node = addThis.Clone(); + + if ( !node ) + { + return 0; + } + + node->parent = this; + + node->next = beforeThis; + node->prev = beforeThis->prev; + + if ( beforeThis->prev ) + { + beforeThis->prev->next = node; + } + else + { + assert( firstChild == beforeThis ); + firstChild = node; + } + + beforeThis->prev = node; + return node; +} + + +TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) +{ + if ( !afterThis || afterThis->parent != this ) + { + return 0; + } + + if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) + { + if ( GetDocument() ) + { + GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + } + + return 0; + } + + TiXmlNode* node = addThis.Clone(); + + if ( !node ) + { + return 0; + } + + node->parent = this; + + node->prev = afterThis; + node->next = afterThis->next; + + if ( afterThis->next ) + { + afterThis->next->prev = node; + } + else + { + assert( lastChild == afterThis ); + lastChild = node; + } + + afterThis->next = node; + return node; +} + + +TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) +{ + if ( !replaceThis ) + { + return 0; + } + + if ( replaceThis->parent != this ) + { + return 0; + } + + if ( withThis.ToDocument() ) + { + // A document can never be a child. Thanks to Noam. + TiXmlDocument* document = GetDocument(); + + if ( document ) + { + document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); + } + + return 0; + } + + TiXmlNode* node = withThis.Clone(); + + if ( !node ) + { + return 0; + } + + node->next = replaceThis->next; + node->prev = replaceThis->prev; + + if ( replaceThis->next ) + { + replaceThis->next->prev = node; + } + else + { + lastChild = node; + } + + if ( replaceThis->prev ) + { + replaceThis->prev->next = node; + } + else + { + firstChild = node; + } + + delete replaceThis; + node->parent = this; + return node; +} + + +bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) +{ + if ( !removeThis ) + { + return false; + } + + if ( removeThis->parent != this ) + { + assert( 0 ); + return false; + } + + if ( removeThis->next ) + { + removeThis->next->prev = removeThis->prev; + } + else + { + lastChild = removeThis->prev; + } + + if ( removeThis->prev ) + { + removeThis->prev->next = removeThis->next; + } + else + { + firstChild = removeThis->next; + } + + delete removeThis; + return true; +} + +const TiXmlNode* TiXmlNode::FirstChild( const char* _value ) const +{ + const TiXmlNode* node; + + for ( node = firstChild; node; node = node->next ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + { + return node; + } + } + + return 0; +} + + +const TiXmlNode* TiXmlNode::LastChild( const char* _value ) const +{ + const TiXmlNode* node; + + for ( node = lastChild; node; node = node->prev ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + { + return node; + } + } + + return 0; +} + + +const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const +{ + if ( !previous ) + { + return FirstChild(); + } + else + { + assert( previous->parent == this ); + return previous->NextSibling(); + } +} + + +const TiXmlNode* TiXmlNode::IterateChildren( const char* val, const TiXmlNode* previous ) const +{ + if ( !previous ) + { + return FirstChild( val ); + } + else + { + assert( previous->parent == this ); + return previous->NextSibling( val ); + } +} + + +const TiXmlNode* TiXmlNode::NextSibling( const char* _value ) const +{ + const TiXmlNode* node; + + for ( node = next; node; node = node->next ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + { + return node; + } + } + + return 0; +} + + +const TiXmlNode* TiXmlNode::PreviousSibling( const char* _value ) const +{ + const TiXmlNode* node; + + for ( node = prev; node; node = node->prev ) + { + if ( strcmp( node->Value(), _value ) == 0 ) + { + return node; + } + } + + return 0; +} + + +void TiXmlElement::RemoveAttribute( const char* name ) +{ +#ifdef TIXML_USE_STL + TIXML_STRING str( name ); + TiXmlAttribute* node = attributeSet.Find( str ); +#else + TiXmlAttribute* node = attributeSet.Find( name ); +#endif + + if ( node ) + { + attributeSet.Remove( node ); + delete node; + } +} + +const TiXmlElement* TiXmlNode::FirstChildElement() const +{ + const TiXmlNode* node; + + for ( node = FirstChild(); + node; + node = node->NextSibling() ) + { + if ( node->ToElement() ) + { + return node->ToElement(); + } + } + + return 0; +} + + +const TiXmlElement* TiXmlNode::FirstChildElement( const char* _value ) const +{ + const TiXmlNode* node; + + for ( node = FirstChild( _value ); + node; + node = node->NextSibling( _value ) ) + { + if ( node->ToElement() ) + { + return node->ToElement(); + } + } + + return 0; +} + + +const TiXmlElement* TiXmlNode::NextSiblingElement() const +{ + const TiXmlNode* node; + + for ( node = NextSibling(); + node; + node = node->NextSibling() ) + { + if ( node->ToElement() ) + { + return node->ToElement(); + } + } + + return 0; +} + + +const TiXmlElement* TiXmlNode::NextSiblingElement( const char* _value ) const +{ + const TiXmlNode* node; + + for ( node = NextSibling( _value ); + node; + node = node->NextSibling( _value ) ) + { + if ( node->ToElement() ) + { + return node->ToElement(); + } + } + + return 0; +} + + +const TiXmlDocument* TiXmlNode::GetDocument() const +{ + const TiXmlNode* node; + + for( node = this; node; node = node->parent ) + { + if ( node->ToDocument() ) + { + return node->ToDocument(); + } + } + + return 0; +} + + +TiXmlElement::TiXmlElement (const char* _value) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + value = _value; +} + + +#ifdef TIXML_USE_STL +TiXmlElement::TiXmlElement( const std::string& _value ) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + value = _value; +} +#endif + + +TiXmlElement::TiXmlElement( const TiXmlElement& copy) + : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) +{ + firstChild = lastChild = 0; + copy.CopyTo( this ); +} + + +TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base ) +{ + if (&base == this) + { + return *this; + } + + ClearThis(); + base.CopyTo( this ); + return *this; +} + + +TiXmlElement::~TiXmlElement() +{ + ClearThis(); +} + + +void TiXmlElement::ClearThis() +{ + Clear(); + + while( attributeSet.First() ) + { + TiXmlAttribute* node = attributeSet.First(); + attributeSet.Remove( node ); + delete node; + } +} + + +const char* TiXmlElement::Attribute( const char* name ) const +{ + const TiXmlAttribute* node = attributeSet.Find( name ); + + if ( node ) + { + return node->Value(); + } + + return 0; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + + if ( attrib ) + { + return &attrib->ValueStr(); + } + + return 0; +} +#endif + + +const char* TiXmlElement::Attribute( const char* name, int* i ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const char* result = 0; + + if ( attrib ) + { + result = attrib->Value(); + + if ( i ) + { + attrib->QueryIntValue( i ); + } + } + + return result; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const std::string* result = 0; + + if ( attrib ) + { + result = &attrib->ValueStr(); + + if ( i ) + { + attrib->QueryIntValue( i ); + } + } + + return result; +} +#endif + + +const char* TiXmlElement::Attribute( const char* name, double* d ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const char* result = 0; + + if ( attrib ) + { + result = attrib->Value(); + + if ( d ) + { + attrib->QueryDoubleValue( d ); + } + } + + return result; +} + + +#ifdef TIXML_USE_STL +const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + const std::string* result = 0; + + if ( attrib ) + { + result = &attrib->ValueStr(); + + if ( d ) + { + attrib->QueryDoubleValue( d ); + } + } + + return result; +} +#endif + + +int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + + if ( !attrib ) + { + return TIXML_NO_ATTRIBUTE; + } + + return attrib->QueryIntValue( ival ); +} + + +int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const +{ + const TiXmlAttribute* node = attributeSet.Find( name ); + + if ( !node ) + { + return TIXML_NO_ATTRIBUTE; + } + + int ival = 0; + int result = node->QueryIntValue( &ival ); + *value = (unsigned)ival; + return result; +} + + +int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const +{ + const TiXmlAttribute* node = attributeSet.Find( name ); + + if ( !node ) + { + return TIXML_NO_ATTRIBUTE; + } + + int result = TIXML_WRONG_TYPE; + + if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN ) + || StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN ) + || StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) ) + { + *bval = true; + result = TIXML_SUCCESS; + } + else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN ) + || StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN ) + || StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) ) + { + *bval = false; + result = TIXML_SUCCESS; + } + + return result; +} + + + +#ifdef TIXML_USE_STL +int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + + if ( !attrib ) + { + return TIXML_NO_ATTRIBUTE; + } + + return attrib->QueryIntValue( ival ); +} +#endif + + +int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + + if ( !attrib ) + { + return TIXML_NO_ATTRIBUTE; + } + + return attrib->QueryDoubleValue( dval ); +} + + +#ifdef TIXML_USE_STL +int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const +{ + const TiXmlAttribute* attrib = attributeSet.Find( name ); + + if ( !attrib ) + { + return TIXML_NO_ATTRIBUTE; + } + + return attrib->QueryDoubleValue( dval ); +} +#endif + + +void TiXmlElement::SetAttribute( const char* name, int val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + + if ( attrib ) + { + attrib->SetIntValue( val ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetAttribute( const std::string& name, int val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + + if ( attrib ) + { + attrib->SetIntValue( val ); + } +} +#endif + + +void TiXmlElement::SetDoubleAttribute( const char* name, double val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + + if ( attrib ) + { + attrib->SetDoubleValue( val ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); + + if ( attrib ) + { + attrib->SetDoubleValue( val ); + } +} +#endif + + +void TiXmlElement::SetAttribute( const char* cname, const char* cvalue ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); + + if ( attrib ) + { + attrib->SetValue( cvalue ); + } +} + + +#ifdef TIXML_USE_STL +void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value ) +{ + TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name ); + + if ( attrib ) + { + attrib->SetValue( _value ); + } +} +#endif + + +void TiXmlElement::Print( FILE* cfile, int depth ) const +{ + int i; + assert( cfile ); + + for ( i=0; iNext() ) + { + fprintf( cfile, " " ); + attrib->Print( cfile, depth ); + } + + // There are 3 different formatting approaches: + // 1) An element without children is printed as a node + // 2) An element with only a text child is printed as text + // 3) An element with children is printed on multiple lines. + TiXmlNode* node; + + if ( !firstChild ) + { + fprintf( cfile, " />" ); + } + else if ( firstChild == lastChild && firstChild->ToText() ) + { + fprintf( cfile, ">" ); + firstChild->Print( cfile, depth + 1 ); + fprintf( cfile, "", value.c_str() ); + } + else + { + fprintf( cfile, ">" ); + + for ( node = firstChild; node; node=node->NextSibling() ) + { + if ( !node->ToText() ) + { + fprintf( cfile, "\n" ); + } + + node->Print( cfile, depth+1 ); + } + + fprintf( cfile, "\n" ); + + for( i=0; i", value.c_str() ); + } +} + + +void TiXmlElement::CopyTo( TiXmlElement* target ) const +{ + // superclass: + TiXmlNode::CopyTo( target ); + + // Element class: + // Clone the attributes, then clone the children. + const TiXmlAttribute* attribute = 0; + + for( attribute = attributeSet.First(); + attribute; + attribute = attribute->Next() ) + { + target->SetAttribute( attribute->Name(), attribute->Value() ); + } + + TiXmlNode* node = 0; + + for ( node = firstChild; node; node = node->NextSibling() ) + { + target->LinkEndChild( node->Clone() ); + } +} + +bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const +{ + if ( visitor->VisitEnter( *this, attributeSet.First() ) ) + { + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + if ( !node->Accept( visitor ) ) + { + break; + } + } + } + + return visitor->VisitExit( *this ); +} + + +TiXmlNode* TiXmlElement::Clone() const +{ + TiXmlElement* clone = new TiXmlElement( Value() ); + + CopyTo( clone ); + return clone; +} + + +const char* TiXmlElement::GetText() const +{ + const TiXmlNode* child = this->FirstChild(); + + if ( child ) + { + const TiXmlText* childText = child->ToText(); + + if ( childText ) + { + return childText->Value(); + } + } + + return 0; +} + + +TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = false; + ClearError(); +} + +TiXmlDocument::TiXmlDocument( const char* documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = false; + value = documentName; + ClearError(); +} + + +#ifdef TIXML_USE_STL +TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + tabsize = 4; + useMicrosoftBOM = false; + value = documentName; + ClearError(); +} +#endif + + +TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) +{ + copy.CopyTo( this ); +} + + +TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy ) +{ + if (© == this) + { + return *this; + } + + Clear(); + copy.CopyTo( this ); + return *this; +} + + +bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) +{ + return LoadFile( Value(), encoding ); +} + + +bool TiXmlDocument::SaveFile() const +{ + return SaveFile( Value() ); +} + +bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) +{ + TIXML_STRING filename( _filename ); + value = filename; + + // reading in binary mode so that tinyxml can normalize the EOL + FILE* file = TiXmlFOpen( value.c_str (), "rb" ); + + if ( file ) + { + bool result = LoadFile( file, encoding ); + fclose( file ); + return result; + } + else + { + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } +} + +bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) +{ + if ( !file ) + { + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Delete the existing data: + Clear(); + location.Clear(); + + // Get the file size, so we can pre-allocate the string. HUGE speed impact. + long length = 0; + fseek( file, 0, SEEK_END ); + length = ftell( file ); + fseek( file, 0, SEEK_SET ); + + // Strange case, but good to handle up front. + if ( length <= 0 ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Subtle bug here. TinyXml did use fgets. But from the XML spec: + // 2.11 End-of-Line Handling + // + // + // ...the XML processor MUST behave as if it normalized all line breaks in external + // parsed entities (including the document entity) on input, before parsing, by translating + // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to + // a single #xA character. + // + // + // It is not clear fgets does that, and certainly isn't clear it works cross platform. + // Generally, you expect fgets to translate from the convention of the OS to the c/unix + // convention, and not work generally. + + /* + while( fgets( buf, sizeof(buf), file ) ) + { + data += buf; + } + */ + + char* buf = new char[ length+1 ]; + buf[0] = 0; + + if ( fread( buf, length, 1, file ) != 1 ) + { + delete [] buf; + SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); + return false; + } + + // Process the buffer in place to normalize new lines. (See comment above.) + // Copies from the 'p' to 'q' pointer, where p can advance faster if + // a newline-carriage return is hit. + // + // Wikipedia: + // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or + // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... + // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others + // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS + // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 + + const char* p = buf; // the read head + char* q = buf; // the write head + const char CR = 0x0d; + const char LF = 0x0a; + + buf[length] = 0; + + while( *p ) + { + assert( p < (buf+length) ); + assert( q <= (buf+length) ); + assert( q <= p ); + + if ( *p == CR ) + { + *q++ = LF; + p++; + + if ( *p == LF ) // check for CR+LF (and skip LF) + { + p++; + } + } + else + { + *q++ = *p++; + } + } + + assert( q <= (buf+length) ); + *q = 0; + + Parse( buf, 0, encoding ); + + delete [] buf; + return !Error(); +} + + +bool TiXmlDocument::SaveFile( const char* filename ) const +{ + // The old c stuff lives on... + FILE* fp = TiXmlFOpen( filename, "w" ); + + if ( fp ) + { + bool result = SaveFile( fp ); + fclose( fp ); + return result; + } + + return false; +} + + +bool TiXmlDocument::SaveFile( FILE* fp ) const +{ + if ( useMicrosoftBOM ) + { + const unsigned char TIXML_UTF_LEAD_0 = 0xefU; + const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; + const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + + fputc( TIXML_UTF_LEAD_0, fp ); + fputc( TIXML_UTF_LEAD_1, fp ); + fputc( TIXML_UTF_LEAD_2, fp ); + } + + Print( fp, 0 ); + return (ferror(fp) == 0); +} + + +void TiXmlDocument::CopyTo( TiXmlDocument* target ) const +{ + TiXmlNode::CopyTo( target ); + + target->error = error; + target->errorId = errorId; + target->errorDesc = errorDesc; + target->tabsize = tabsize; + target->errorLocation = errorLocation; + target->useMicrosoftBOM = useMicrosoftBOM; + + TiXmlNode* node = 0; + + for ( node = firstChild; node; node = node->NextSibling() ) + { + target->LinkEndChild( node->Clone() ); + } +} + + +TiXmlNode* TiXmlDocument::Clone() const +{ + TiXmlDocument* clone = new TiXmlDocument(); + + CopyTo( clone ); + return clone; +} + + +void TiXmlDocument::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + node->Print( cfile, depth ); + fprintf( cfile, "\n" ); + } +} + + +bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const +{ + if ( visitor->VisitEnter( *this ) ) + { + for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) + { + if ( !node->Accept( visitor ) ) + { + break; + } + } + } + + return visitor->VisitExit( *this ); +} + + +const TiXmlAttribute* TiXmlAttribute::Next() const +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( next->value.empty() && next->name.empty() ) + { + return 0; + } + + return next; +} + +/* +TiXmlAttribute* TiXmlAttribute::Next() +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( next->value.empty() && next->name.empty() ) + return 0; + return next; +} +*/ + +const TiXmlAttribute* TiXmlAttribute::Previous() const +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( prev->value.empty() && prev->name.empty() ) + { + return 0; + } + + return prev; +} + +/* +TiXmlAttribute* TiXmlAttribute::Previous() +{ + // We are using knowledge of the sentinel. The sentinel + // have a value or name. + if ( prev->value.empty() && prev->name.empty() ) + return 0; + return prev; +} +*/ + +void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const +{ + TIXML_STRING n, v; + + EncodeString( name, &n ); + EncodeString( value, &v ); + + if (value.find ('\"') == TIXML_STRING::npos) + { + if ( cfile ) + { + fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); + } + + if ( str ) + { + (*str) += n; + (*str) += "=\""; + (*str) += v; + (*str) += "\""; + } + } + else + { + if ( cfile ) + { + fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); + } + + if ( str ) + { + (*str) += n; + (*str) += "='"; + (*str) += v; + (*str) += "'"; + } + } +} + + +int TiXmlAttribute::QueryIntValue( int* ival ) const +{ + if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) + { + return TIXML_SUCCESS; + } + + return TIXML_WRONG_TYPE; +} + +int TiXmlAttribute::QueryDoubleValue( double* dval ) const +{ + if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) + { + return TIXML_SUCCESS; + } + + return TIXML_WRONG_TYPE; +} + +void TiXmlAttribute::SetIntValue( int _value ) +{ + char buf [64]; +#if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); +#else + sprintf (buf, "%d", _value); +#endif + SetValue (buf); +} + +void TiXmlAttribute::SetDoubleValue( double _value ) +{ + char buf [256]; +#if defined(TIXML_SNPRINTF) + TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); +#else + sprintf (buf, "%g", _value); +#endif + SetValue (buf); +} + +int TiXmlAttribute::IntValue() const +{ + return atoi (value.c_str ()); +} + +double TiXmlAttribute::DoubleValue() const +{ + return atof (value.c_str ()); +} + + +TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) +{ + if (© != this) + { + copy.CopyTo(this); + } +} + + +TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base ) +{ + if (&base == this) + { + return *this; + } + + Clear(); + base.CopyTo( this ); + return *this; +} + + +void TiXmlComment::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + + for ( int i=0; i", value.c_str() ); +} + + +void TiXmlComment::CopyTo( TiXmlComment* target ) const +{ + TiXmlNode::CopyTo( target ); +} + + +bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlComment::Clone() const +{ + TiXmlComment* clone = new TiXmlComment(); + + CopyTo( clone ); + return clone; +} + + +void TiXmlText::Print( FILE* cfile, int depth ) const +{ + assert( cfile ); + + if ( cdata ) + { + int i; + fprintf( cfile, "\n" ); + + for ( i=0; i\n", value.c_str() ); // unformatted output + } + else + { + TIXML_STRING buffer; + EncodeString( value, &buffer ); + fprintf( cfile, "%s", buffer.c_str() ); + } +} + + +void TiXmlText::CopyTo( TiXmlText* target ) const +{ + TiXmlNode::CopyTo( target ); + target->cdata = cdata; +} + + +bool TiXmlText::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlText::Clone() const +{ + TiXmlText* clone = 0; + clone = new TiXmlText( "" ); + + CopyTo( clone ); + return clone; +} + + +TiXmlDeclaration::TiXmlDeclaration( const char* _version, + const char* _encoding, + const char* _standalone ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + version = _version; + encoding = _encoding; + standalone = _standalone; +} + + +#ifdef TIXML_USE_STL +TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, + const std::string& _encoding, + const std::string& _standalone ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + version = _version; + encoding = _encoding; + standalone = _standalone; +} +#endif + + +TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) + : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) +{ + copy.CopyTo( this ); +} + + +TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) +{ + if (© == this) + { + return *this; + } + + Clear(); + copy.CopyTo( this ); + return *this; +} + + +void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const +{ + if ( cfile ) + { + fprintf( cfile, "" ); + } + + if ( str ) + { + (*str) += "?>"; + } +} + + +void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const +{ + TiXmlNode::CopyTo( target ); + + target->version = version; + target->encoding = encoding; + target->standalone = standalone; +} + + +bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlDeclaration::Clone() const +{ + TiXmlDeclaration* clone = new TiXmlDeclaration(); + + CopyTo( clone ); + return clone; +} + + +void TiXmlUnknown::Print( FILE* cfile, int depth ) const +{ + for ( int i=0; i", value.c_str() ); +} + + +void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const +{ + TiXmlNode::CopyTo( target ); +} + + +bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const +{ + return visitor->Visit( *this ); +} + + +TiXmlNode* TiXmlUnknown::Clone() const +{ + TiXmlUnknown* clone = new TiXmlUnknown(); + + CopyTo( clone ); + return clone; +} + + +TiXmlAttributeSet::TiXmlAttributeSet() +{ + sentinel.next = &sentinel; + sentinel.prev = &sentinel; +} + + +TiXmlAttributeSet::~TiXmlAttributeSet() +{ + assert( sentinel.next == &sentinel ); + assert( sentinel.prev == &sentinel ); +} + + +void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) +{ +#ifdef TIXML_USE_STL + assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. +#else + assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. +#endif + + addMe->next = &sentinel; + addMe->prev = sentinel.prev; + + sentinel.prev->next = addMe; + sentinel.prev = addMe; +} + +void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) +{ + TiXmlAttribute* node; + + for( node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( node == removeMe ) + { + node->prev->next = node->next; + node->next->prev = node->prev; + node->next = 0; + node->prev = 0; + return; + } + } + + assert( 0 ); // we tried to remove a non-linked attribute. +} + + +#ifdef TIXML_USE_STL +TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const +{ + for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( node->name == name ) + { + return node; + } + } + + return 0; +} + +TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name ) +{ + TiXmlAttribute* attrib = Find( _name ); + + if ( !attrib ) + { + attrib = new TiXmlAttribute(); + Add( attrib ); + attrib->SetName( _name ); + } + + return attrib; +} +#endif + + +TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const +{ + for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) + { + if ( strcmp( node->name.c_str(), name ) == 0 ) + { + return node; + } + } + + return 0; +} + + +TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) +{ + TiXmlAttribute* attrib = Find( _name ); + + if ( !attrib ) + { + attrib = new TiXmlAttribute(); + Add( attrib ); + attrib->SetName( _name ); + } + + return attrib; +} + + +#ifdef TIXML_USE_STL +std::istream& operator>> (std::istream& in, TiXmlNode& base) +{ + TIXML_STRING tag; + tag.reserve( 8 * 1000 ); + base.StreamIn( &in, &tag ); + + base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); + return in; +} +#endif + + +#ifdef TIXML_USE_STL +std::ostream& operator<< (std::ostream& out, const TiXmlNode& base) +{ + TiXmlPrinter printer; + printer.SetStreamPrinting(); + base.Accept( &printer ); + out << printer.Str(); + + return out; +} + + +std::string& operator<< (std::string& out, const TiXmlNode& base ) +{ + TiXmlPrinter printer; + printer.SetStreamPrinting(); + base.Accept( &printer ); + out.append( printer.Str() ); + + return out; +} +#endif + + +TiXmlHandle TiXmlHandle::FirstChild() const +{ + if ( node ) + { + TiXmlNode* child = node->FirstChild(); + + if ( child ) + { + return TiXmlHandle( child ); + } + } + + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChild( const char* value ) const +{ + if ( node ) + { + TiXmlNode* child = node->FirstChild( value ); + + if ( child ) + { + return TiXmlHandle( child ); + } + } + + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChildElement() const +{ + if ( node ) + { + TiXmlElement* child = node->FirstChildElement(); + + if ( child ) + { + return TiXmlHandle( child ); + } + } + + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::FirstChildElement( const char* value ) const +{ + if ( node ) + { + TiXmlElement* child = node->FirstChildElement( value ); + + if ( child ) + { + return TiXmlHandle( child ); + } + } + + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::Child( int count ) const +{ + if ( node ) + { + int i; + TiXmlNode* child = node->FirstChild(); + + for ( i=0; + child && iNextSibling(), ++i ) + { + // nothing + } + + if ( child ) + { + return TiXmlHandle( child ); + } + } + + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const +{ + if ( node ) + { + int i; + TiXmlNode* child = node->FirstChild( value ); + + for ( i=0; + child && iNextSibling( value ), ++i ) + { + // nothing + } + + if ( child ) + { + return TiXmlHandle( child ); + } + } + + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::ChildElement( int count ) const +{ + if ( node ) + { + int i; + TiXmlElement* child = node->FirstChildElement(); + + for ( i=0; + child && iNextSiblingElement(), ++i ) + { + // nothing + } + + if ( child ) + { + return TiXmlHandle( child ); + } + } + + return TiXmlHandle( 0 ); +} + + +TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const +{ + if ( node ) + { + int i; + TiXmlElement* child = node->FirstChildElement( value ); + + for ( i=0; + child && iNextSiblingElement( value ), ++i ) + { + // nothing + } + + if ( child ) + { + return TiXmlHandle( child ); + } + } + + return TiXmlHandle( 0 ); +} + + +bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) +{ + return true; +} + +bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) +{ + return true; +} + +bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) +{ + DoIndent(); + buffer += "<"; + buffer += element.Value(); + + for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) + { + buffer += " "; + attrib->Print( 0, 0, &buffer ); + } + + if ( !element.FirstChild() ) + { + buffer += " />"; + DoLineBreak(); + } + else + { + buffer += ">"; + + if ( element.FirstChild()->ToText() + && element.LastChild() == element.FirstChild() + && element.FirstChild()->ToText()->CDATA() == false ) + { + simpleTextPrint = true; + // no DoLineBreak()! + } + else + { + DoLineBreak(); + } + } + + ++depth; + return true; +} + + +bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) +{ + --depth; + + if ( !element.FirstChild() ) + { + // nothing. + } + else + { + if ( simpleTextPrint ) + { + simpleTextPrint = false; + } + else + { + DoIndent(); + } + + buffer += ""; + DoLineBreak(); + } + + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlText& text ) +{ + if ( text.CDATA() ) + { + DoIndent(); + buffer += ""; + DoLineBreak(); + } + else if ( simpleTextPrint ) + { + TIXML_STRING str; + TiXmlBase::EncodeString( text.ValueTStr(), &str ); + buffer += str; + } + else + { + DoIndent(); + TIXML_STRING str; + TiXmlBase::EncodeString( text.ValueTStr(), &str ); + buffer += str; + DoLineBreak(); + } + + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) +{ + DoIndent(); + declaration.Print( 0, 0, &buffer ); + DoLineBreak(); + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlComment& comment ) +{ + DoIndent(); + buffer += ""; + DoLineBreak(); + return true; +} + + +bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) +{ + DoIndent(); + buffer += "<"; + buffer += unknown.Value(); + buffer += ">"; + DoLineBreak(); + return true; +} + diff --git a/ThirdLib/include/TinyXML/tinyxml.h b/ThirdLib/include/TinyXML/tinyxml.h new file mode 100644 index 000000000..fc217a40a --- /dev/null +++ b/ThirdLib/include/TinyXML/tinyxml.h @@ -0,0 +1,2270 @@ +/* +www.sourceforge.net/projects/tinyxml +Original code by Lee Thomason (www.grinninglizard.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + + +#ifndef TINYXML_INCLUDED +#define TINYXML_INCLUDED + +#ifdef _MSC_VER +#pragma warning( push ) +#pragma warning( disable : 4530 ) +#pragma warning( disable : 4786 ) +#endif + +#include +#include +#include +#include +#include + +// Help out windows: +#if defined( _DEBUG ) && !defined( DEBUG ) +#define DEBUG +#endif + +#ifdef TIXML_USE_STL +#include +#include +#include +#define TIXML_STRING std::string +#else +#include "tinystr.h" +#define TIXML_STRING TiXmlString +#endif + +// Deprecated library function hell. Compilers want to use the +// new safe versions. This probably doesn't fully address the problem, +// but it gets closer. There are too many compilers for me to fully +// test. If you get compilation troubles, undefine TIXML_SAFE +#define TIXML_SAFE + +#ifdef TIXML_SAFE +#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) +// Microsoft visual studio, version 2005 and higher. +#define TIXML_SNPRINTF _snprintf_s +#define TIXML_SSCANF sscanf_s +#elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) +// Microsoft visual studio, version 6 and higher. +//#pragma message( "Using _sn* functions." ) +#define TIXML_SNPRINTF _snprintf +#define TIXML_SSCANF sscanf +#elif defined(__GNUC__) && (__GNUC__ >= 3 ) +// GCC version 3 and higher.s +//#warning( "Using sn* functions." ) +#define TIXML_SNPRINTF snprintf +#define TIXML_SSCANF sscanf +#else +#define TIXML_SNPRINTF snprintf +#define TIXML_SSCANF sscanf +#endif +#endif + +class TiXmlDocument; +class TiXmlElement; +class TiXmlComment; +class TiXmlUnknown; +class TiXmlAttribute; +class TiXmlText; +class TiXmlDeclaration; +class TiXmlParsingData; + +const int TIXML_MAJOR_VERSION = 2; +const int TIXML_MINOR_VERSION = 6; +const int TIXML_PATCH_VERSION = 2; + +/* Internal structure for tracking location of items + in the XML file. +*/ +struct TiXmlCursor +{ + TiXmlCursor() + { + Clear(); + } + void Clear() + { + row = col = -1; + } + + int row; // 0 based. + int col; // 0 based. +}; + + +/** + Implements the interface to the "Visitor pattern" (see the Accept() method.) + If you call the Accept() method, it requires being passed a TiXmlVisitor + class to handle callbacks. For nodes that contain other nodes (Document, Element) + you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves + are simply called with Visit(). + + If you return 'true' from a Visit method, recursive parsing will continue. If you return + false, no children of this node or its sibilings will be Visited. + + All flavors of Visit methods have a default implementation that returns 'true' (continue + visiting). You need to only override methods that are interesting to you. + + Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. + + You should never change the document from a callback. + + @sa TiXmlNode::Accept() +*/ +class TiXmlVisitor +{ +public: + virtual ~TiXmlVisitor() {} + + /// Visit a document. + virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) + { + return true; + } + /// Visit a document. + virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) + { + return true; + } + + /// Visit an element. + virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) + { + return true; + } + /// Visit an element. + virtual bool VisitExit( const TiXmlElement& /*element*/ ) + { + return true; + } + + /// Visit a declaration + virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) + { + return true; + } + /// Visit a text node + virtual bool Visit( const TiXmlText& /*text*/ ) + { + return true; + } + /// Visit a comment node + virtual bool Visit( const TiXmlComment& /*comment*/ ) + { + return true; + } + /// Visit an unknown node + virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) + { + return true; + } +}; + +// Only used by Attribute::Query functions +enum +{ + TIXML_SUCCESS, + TIXML_NO_ATTRIBUTE, + TIXML_WRONG_TYPE +}; + + +// Used by the parsing routines. +enum TiXmlEncoding +{ + TIXML_ENCODING_UNKNOWN, + TIXML_ENCODING_UTF8, + TIXML_ENCODING_LEGACY +}; + +const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; + +/** TiXmlBase is a base class for every class in TinyXml. + It does little except to establish that TinyXml classes + can be printed and provide some utility functions. + + In XML, the document and elements can contain + other elements and other types of nodes. + + @verbatim + A Document can contain: Element (container or leaf) + Comment (leaf) + Unknown (leaf) + Declaration( leaf ) + + An Element can contain: Element (container or leaf) + Text (leaf) + Attributes (not on tree) + Comment (leaf) + Unknown (leaf) + + A Decleration contains: Attributes (not on tree) + @endverbatim +*/ +class TiXmlBase +{ + friend class TiXmlNode; + friend class TiXmlElement; + friend class TiXmlDocument; + +public: + TiXmlBase() : userData(0) {} + virtual ~TiXmlBase() {} + + /** All TinyXml classes can print themselves to a filestream + or the string class (TiXmlString in non-STL mode, std::string + in STL mode.) Either or both cfile and str can be null. + + This is a formatted print, and will insert + tabs and newlines. + + (For an unformatted stream, use the << operator.) + */ + virtual void Print( FILE* cfile, int depth ) const = 0; + + /** The world does not agree on whether white space should be kept or + not. In order to make everyone happy, these global, static functions + are provided to set whether or not TinyXml will condense all white space + into a single space or not. The default is to condense. Note changing this + value is not thread safe. + */ + static void SetCondenseWhiteSpace( bool condense ) + { + condenseWhiteSpace = condense; + } + + /// Return the current white space setting. + static bool IsWhiteSpaceCondensed() + { + return condenseWhiteSpace; + } + + /** Return the position, in the original source file, of this node or attribute. + The row and column are 1-based. (That is the first row and first column is + 1,1). If the returns values are 0 or less, then the parser does not have + a row and column value. + + Generally, the row and column value will be set when the TiXmlDocument::Load(), + TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set + when the DOM was created from operator>>. + + The values reflect the initial load. Once the DOM is modified programmatically + (by adding or changing nodes and attributes) the new values will NOT update to + reflect changes in the document. + + There is a minor performance cost to computing the row and column. Computation + can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. + + @sa TiXmlDocument::SetTabSize() + */ + int Row() const + { + return location.row + 1; + } + int Column() const + { + return location.col + 1; ///< See Row() + } + + void SetUserData( void* user ) + { + userData = user; ///< Set a pointer to arbitrary user data. + } + void* GetUserData() + { + return userData; ///< Get a pointer to arbitrary user data. + } + const void* GetUserData() const + { + return userData; ///< Get a pointer to arbitrary user data. + } + + // Table that returs, for a given lead byte, the total number of bytes + // in the UTF-8 sequence. + static const int utf8ByteTable[256]; + + virtual const char* Parse( const char* p, + TiXmlParsingData* data, + TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; + + /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, + or they will be transformed into entities! + */ + static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); + + enum + { + TIXML_NO_ERROR = 0, + TIXML_ERROR, + TIXML_ERROR_OPENING_FILE, + TIXML_ERROR_PARSING_ELEMENT, + TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, + TIXML_ERROR_READING_ELEMENT_VALUE, + TIXML_ERROR_READING_ATTRIBUTES, + TIXML_ERROR_PARSING_EMPTY, + TIXML_ERROR_READING_END_TAG, + TIXML_ERROR_PARSING_UNKNOWN, + TIXML_ERROR_PARSING_COMMENT, + TIXML_ERROR_PARSING_DECLARATION, + TIXML_ERROR_DOCUMENT_EMPTY, + TIXML_ERROR_EMBEDDED_NULL, + TIXML_ERROR_PARSING_CDATA, + TIXML_ERROR_DOCUMENT_TOP_ONLY, + + TIXML_ERROR_STRING_COUNT + }; + +protected: + + static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); + + inline static bool IsWhiteSpace( char c ) + { + return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); + } + inline static bool IsWhiteSpace( int c ) + { + if ( c < 256 ) + { + return IsWhiteSpace( (char) c ); + } + + return false; // Again, only truly correct for English/Latin...but usually works. + } + +#ifdef TIXML_USE_STL + static bool StreamWhiteSpace( std::istream* in, TIXML_STRING* tag ); + static bool StreamTo( std::istream* in, int character, TIXML_STRING* tag ); +#endif + + /* Reads an XML name into the string provided. Returns + a pointer just past the last character of the name, + or 0 if the function has an error. + */ + static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); + + /* Reads text. Returns a pointer past the given end tag. + Wickedly complex options, but it keeps the (sensitive) code in one place. + */ + static const char* ReadText( const char* in, // where to start + TIXML_STRING* text, // the string read + bool ignoreWhiteSpace, // whether to keep the white space + const char* endTag, // what ends this text + bool ignoreCase, // whether to ignore case in the end tag + TiXmlEncoding encoding ); // the current encoding + + // If an entity has been found, transform it into a character. + static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); + + // Get a character, while interpreting entities. + // The length can be from 0 to 4 bytes. + inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) + { + assert( p ); + + if ( encoding == TIXML_ENCODING_UTF8 ) + { + *length = utf8ByteTable[ *((const unsigned char*)p) ]; + assert( *length >= 0 && *length < 5 ); + } + else + { + *length = 1; + } + + if ( *length == 1 ) + { + if ( *p == '&' ) + { + return GetEntity( p, _value, length, encoding ); + } + + *_value = *p; + return p+1; + } + else if ( *length ) + { + //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), + // and the null terminator isn't needed + for( int i=0; i < (*length) && p[i]; ++i ) + { + _value[i] = p[i]; + } + + return p + (*length); + } + else + { + // Not valid text. + return 0; + } + } + + // Return true if the next characters in the stream are any of the endTag sequences. + // Ignore case only works for english, and should only be relied on when comparing + // to English words: StringEqual( p, "version", true ) is fine. + static bool StringEqual( const char* p, + const char* endTag, + bool ignoreCase, + TiXmlEncoding encoding ); + + static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; + + TiXmlCursor location; + + /// Field containing a generic user pointer + void* userData; + + // None of these methods are reliable for any language except English. + // Good for approximation, not great for accuracy. + static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); + static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); + inline static int ToLower( int v, TiXmlEncoding encoding ) + { + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( v < 128 ) + { + return tolower( v ); + } + + return v; + } + else + { + return tolower( v ); + } + } + static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); + +private: + TiXmlBase( const TiXmlBase& ); // not implemented. + void operator=( const TiXmlBase& base ); // not allowed. + + struct Entity + { + const char* str; + unsigned int strLength; + char chr; + }; + enum + { + NUM_ENTITY = 5, + MAX_ENTITY_LENGTH = 6 + + }; + static Entity entity[ NUM_ENTITY ]; + static bool condenseWhiteSpace; +}; + + +/** The parent class for everything in the Document Object Model. + (Except for attributes). + Nodes have siblings, a parent, and children. A node can be + in a document, or stand on its own. The type of a TiXmlNode + can be queried, and it can be cast to its more defined type. +*/ +class TiXmlNode : public TiXmlBase +{ + friend class TiXmlDocument; + friend class TiXmlElement; + +public: +#ifdef TIXML_USE_STL + + /** An input stream operator, for every class. Tolerant of newlines and + formatting, but doesn't expect them. + */ + friend std::istream& operator >> (std::istream& in, TiXmlNode& base); + + /** An output stream operator, for every class. Note that this outputs + without any newlines or formatting, as opposed to Print(), which + includes tabs and new lines. + + The operator<< and operator>> are not completely symmetric. Writing + a node to a stream is very well defined. You'll get a nice stream + of output, without any extra whitespace or newlines. + + But reading is not as well defined. (As it always is.) If you create + a TiXmlElement (for example) and read that from an input stream, + the text needs to define an element or junk will result. This is + true of all input streams, but it's worth keeping in mind. + + A TiXmlDocument will read nodes until it reads a root element, and + all the children of that root element. + */ + friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); + + /// Appends the XML node or attribute to a std::string. + friend std::string& operator<< (std::string& out, const TiXmlNode& base ); + +#endif + + /** The types of XML nodes supported by TinyXml. (All the + unsupported types are picked up by UNKNOWN.) + */ + enum NodeType + { + TINYXML_DOCUMENT, + TINYXML_ELEMENT, + TINYXML_COMMENT, + TINYXML_UNKNOWN, + TINYXML_TEXT, + TINYXML_DECLARATION, + TINYXML_TYPECOUNT + }; + + virtual ~TiXmlNode(); + + /** The meaning of 'value' changes for the specific type of + TiXmlNode. + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + + The subclasses will wrap this function. + */ + const char* Value() const + { + return value.c_str (); + } + +#ifdef TIXML_USE_STL + /** Return Value() as a std::string. If you only use STL, + this is more efficient than calling Value(). + Only available in STL mode. + */ + const std::string& ValueStr() const + { + return value; + } +#endif + + const TIXML_STRING& ValueTStr() const + { + return value; + } + + /** Changes the value of the node. Defined as: + @verbatim + Document: filename of the xml file + Element: name of the element + Comment: the comment text + Unknown: the tag contents + Text: the text string + @endverbatim + */ + void SetValue(const char* _value) + { + value = _value; + } + +#ifdef TIXML_USE_STL + /// STL std::string form. + void SetValue( const std::string& _value ) + { + value = _value; + } +#endif + + /// Delete all the children of this node. Does not affect 'this'. + void Clear(); + + /// One step up the DOM. + TiXmlNode* Parent() + { + return parent; + } + const TiXmlNode* Parent() const + { + return parent; + } + + const TiXmlNode* FirstChild() const + { + return firstChild; ///< The first child of this node. Will be null if there are no children. + } + TiXmlNode* FirstChild() + { + return firstChild; + } + const TiXmlNode* FirstChild( const char* value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. + /// The first child of this node with the matching 'value'. Will be null if none found. + TiXmlNode* FirstChild( const char* _value ) + { + // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) + // call the method, cast the return back to non-const. + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); + } + const TiXmlNode* LastChild() const + { + return lastChild; /// The last child of this node. Will be null if there are no children. + } + TiXmlNode* LastChild() + { + return lastChild; + } + + const TiXmlNode* LastChild( const char* value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. + TiXmlNode* LastChild( const char* _value ) + { + return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); + } + +#ifdef TIXML_USE_STL + const TiXmlNode* FirstChild( const std::string& _value ) const + { + return FirstChild (_value.c_str ()); ///< STL std::string form. + } + TiXmlNode* FirstChild( const std::string& _value ) + { + return FirstChild (_value.c_str ()); ///< STL std::string form. + } + const TiXmlNode* LastChild( const std::string& _value ) const + { + return LastChild (_value.c_str ()); ///< STL std::string form. + } + TiXmlNode* LastChild( const std::string& _value ) + { + return LastChild (_value.c_str ()); ///< STL std::string form. + } +#endif + + /** An alternate way to walk the children of a node. + One way to iterate over nodes is: + @verbatim + for( child = parent->FirstChild(); child; child = child->NextSibling() ) + @endverbatim + + IterateChildren does the same thing with the syntax: + @verbatim + child = 0; + while( child = parent->IterateChildren( child ) ) + @endverbatim + + IterateChildren takes the previous child as input and finds + the next one. If the previous child is null, it returns the + first. IterateChildren will return null when done. + */ + const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const TiXmlNode* previous ) + { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); + } + + /// This flavor of IterateChildren searches for children with a particular 'value' + const TiXmlNode* IterateChildren( const char* value, const TiXmlNode* previous ) const; + TiXmlNode* IterateChildren( const char* _value, const TiXmlNode* previous ) + { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); + } + +#ifdef TIXML_USE_STL + const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const + { + return IterateChildren (_value.c_str (), previous); ///< STL std::string form. + } + TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) + { + return IterateChildren (_value.c_str (), previous); ///< STL std::string form. + } +#endif + + /** Add a new node related to this. Adds a child past the LastChild. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); + + + /** Add a new node related to this. Adds a child past the LastChild. + + NOTE: the node to be added is passed by pointer, and will be + henceforth owned (and deleted) by tinyXml. This method is efficient + and avoids an extra copy, but should be used with care as it + uses a different memory model than the other insert functions. + + @sa InsertEndChild + */ + TiXmlNode* LinkEndChild( TiXmlNode* addThis ); + + /** Add a new node related to this. Adds a child before the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); + + /** Add a new node related to this. Adds a child after the specified child. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); + + /** Replace a child of this node. + Returns a pointer to the new object or NULL if an error occured. + */ + TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); + + /// Delete a child of this node. + bool RemoveChild( TiXmlNode* removeThis ); + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling() const + { + return prev; + } + TiXmlNode* PreviousSibling() + { + return prev; + } + + /// Navigate to a sibling node. + const TiXmlNode* PreviousSibling( const char* ) const; + TiXmlNode* PreviousSibling( const char* _prev ) + { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); + } + +#ifdef TIXML_USE_STL + const TiXmlNode* PreviousSibling( const std::string& _value ) const + { + return PreviousSibling (_value.c_str ()); ///< STL std::string form. + } + TiXmlNode* PreviousSibling( const std::string& _value ) + { + return PreviousSibling (_value.c_str ()); ///< STL std::string form. + } + const TiXmlNode* NextSibling( const std::string& _value) const + { + return NextSibling (_value.c_str ()); ///< STL std::string form. + } + TiXmlNode* NextSibling( const std::string& _value) + { + return NextSibling (_value.c_str ()); ///< STL std::string form. + } +#endif + + /// Navigate to a sibling node. + const TiXmlNode* NextSibling() const + { + return next; + } + TiXmlNode* NextSibling() + { + return next; + } + + /// Navigate to a sibling node with the given 'value'. + const TiXmlNode* NextSibling( const char* ) const; + TiXmlNode* NextSibling( const char* _next ) + { + return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement() const; + TiXmlElement* NextSiblingElement() + { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); + } + + /** Convenience function to get through elements. + Calls NextSibling and ToElement. Will skip all non-Element + nodes. Returns 0 if there is not another element. + */ + const TiXmlElement* NextSiblingElement( const char* ) const; + TiXmlElement* NextSiblingElement( const char* _next ) + { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); + } + +#ifdef TIXML_USE_STL + const TiXmlElement* NextSiblingElement( const std::string& _value) const + { + return NextSiblingElement (_value.c_str ()); ///< STL std::string form. + } + TiXmlElement* NextSiblingElement( const std::string& _value) + { + return NextSiblingElement (_value.c_str ()); ///< STL std::string form. + } +#endif + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement() const; + TiXmlElement* FirstChildElement() + { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); + } + + /// Convenience function to get through elements. + const TiXmlElement* FirstChildElement( const char* _value ) const; + TiXmlElement* FirstChildElement( const char* _value ) + { + return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); + } + +#ifdef TIXML_USE_STL + const TiXmlElement* FirstChildElement( const std::string& _value ) const + { + return FirstChildElement (_value.c_str ()); ///< STL std::string form. + } + TiXmlElement* FirstChildElement( const std::string& _value ) + { + return FirstChildElement (_value.c_str ()); ///< STL std::string form. + } +#endif + + /** Query the type (as an enumerated value, above) of this node. + The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, + TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION. + */ + int Type() const + { + return type; + } + + /** Return a pointer to the Document this node lives in. + Returns null if not in a document. + */ + const TiXmlDocument* GetDocument() const; + TiXmlDocument* GetDocument() + { + return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); + } + + /// Returns true if this node has no children. + bool NoChildren() const + { + return !firstChild; + } + + virtual const TiXmlDocument* ToDocument() const + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual const TiXmlElement* ToElement() const + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual const TiXmlComment* ToComment() const + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual const TiXmlUnknown* ToUnknown() const + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual const TiXmlText* ToText() const + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual const TiXmlDeclaration* ToDeclaration() const + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + + virtual TiXmlDocument* ToDocument() + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual TiXmlElement* ToElement() + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual TiXmlComment* ToComment() + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual TiXmlUnknown* ToUnknown() + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual TiXmlText* ToText() + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + virtual TiXmlDeclaration* ToDeclaration() + { + return 0; ///< Cast to a more defined type. Will return null if not of the requested type. + } + + /** Create an exact duplicate of this node and return it. The memory must be deleted + by the caller. + */ + virtual TiXmlNode* Clone() const = 0; + + /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the + XML tree will be conditionally visited and the host will be called back + via the TiXmlVisitor interface. + + This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse + the XML for the callbacks, so the performance of TinyXML is unchanged by using this + interface versus any other.) + + The interface has been based on ideas from: + + - http://www.saxproject.org/ + - http://c2.com/cgi/wiki?HierarchicalVisitorPattern + + Which are both good references for "visiting". + + An example of using Accept(): + @verbatim + TiXmlPrinter printer; + tinyxmlDoc.Accept( &printer ); + const char* xmlcstr = printer.CStr(); + @endverbatim + */ + virtual bool Accept( TiXmlVisitor* visitor ) const = 0; + +protected: + TiXmlNode( NodeType _type ); + + // Copy to the allocated object. Shared functionality between Clone, Copy constructor, + // and the assignment operator. + void CopyTo( TiXmlNode* target ) const; + +#ifdef TIXML_USE_STL + // The real work of the input operator. + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; +#endif + + // Figure out what is at *p, and parse it. Returns null if it is not an xml node. + TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); + + TiXmlNode* parent; + NodeType type; + + TiXmlNode* firstChild; + TiXmlNode* lastChild; + + TIXML_STRING value; + + TiXmlNode* prev; + TiXmlNode* next; + +private: + TiXmlNode( const TiXmlNode& ); // not implemented. + void operator=( const TiXmlNode& base ); // not allowed. +}; + + +/** An attribute is a name-value pair. Elements have an arbitrary + number of attributes, each with a unique name. + + @note The attributes are not TiXmlNodes, since they are not + part of the tinyXML document object model. There are other + suggested ways to look at this problem. +*/ +class TiXmlAttribute : public TiXmlBase +{ + friend class TiXmlAttributeSet; + +public: + /// Construct an empty attribute. + TiXmlAttribute() : TiXmlBase() + { + document = 0; + prev = next = 0; + } + +#ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlAttribute( const std::string& _name, const std::string& _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } +#endif + + /// Construct an attribute with a name and value. + TiXmlAttribute( const char* _name, const char* _value ) + { + name = _name; + value = _value; + document = 0; + prev = next = 0; + } + + const char* Name() const + { + return name.c_str(); ///< Return the name of this attribute. + } + const char* Value() const + { + return value.c_str(); ///< Return the value of this attribute. + } +#ifdef TIXML_USE_STL + const std::string& ValueStr() const + { + return value; ///< Return the value of this attribute. + } +#endif + int IntValue() const; ///< Return the value of this attribute, converted to an integer. + double DoubleValue() const; ///< Return the value of this attribute, converted to a double. + + // Get the tinyxml string representation + const TIXML_STRING& NameTStr() const + { + return name; + } + + /** QueryIntValue examines the value string. It is an alternative to the + IntValue() method with richer error checking. + If the value is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. + + A specialized but useful call. Note that for success it returns 0, + which is the opposite of almost all other TinyXml calls. + */ + int QueryIntValue( int* _value ) const; + /// QueryDoubleValue examines the value string. See QueryIntValue(). + int QueryDoubleValue( double* _value ) const; + + void SetName( const char* _name ) + { + name = _name; ///< Set the name of this attribute. + } + void SetValue( const char* _value ) + { + value = _value; ///< Set the value. + } + + void SetIntValue( int _value ); ///< Set the value from an integer. + void SetDoubleValue( double _value ); ///< Set the value from a double. + +#ifdef TIXML_USE_STL + /// STL std::string form. + void SetName( const std::string& _name ) + { + name = _name; + } + /// STL std::string form. + void SetValue( const std::string& _value ) + { + value = _value; + } +#endif + + /// Get the next sibling attribute in the DOM. Returns null at end. + const TiXmlAttribute* Next() const; + TiXmlAttribute* Next() + { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); + } + + /// Get the previous sibling attribute in the DOM. Returns null at beginning. + const TiXmlAttribute* Previous() const; + TiXmlAttribute* Previous() + { + return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); + } + + bool operator==( const TiXmlAttribute& rhs ) const + { + return rhs.name == name; + } + bool operator<( const TiXmlAttribute& rhs ) const + { + return name < rhs.name; + } + bool operator>( const TiXmlAttribute& rhs ) const + { + return name > rhs.name; + } + + /* Attribute parsing starts: first letter of the name + returns: the next char after the value end quote + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + // Prints this Attribute to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const + { + Print( cfile, depth, 0 ); + } + void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + + // [internal use] + // Set the document pointer so the attribute can report errors. + void SetDocument( TiXmlDocument* doc ) + { + document = doc; + } + +private: + TiXmlAttribute( const TiXmlAttribute& ); // not implemented. + void operator=( const TiXmlAttribute& base ); // not allowed. + + TiXmlDocument* document; // A pointer back to a document, for error reporting. + TIXML_STRING name; + TIXML_STRING value; + TiXmlAttribute* prev; + TiXmlAttribute* next; +}; + + +/* A class used to manage a group of attributes. + It is only used internally, both by the ELEMENT and the DECLARATION. + + The set can be changed transparent to the Element and Declaration + classes that use it, but NOT transparent to the Attribute + which has to implement a next() and previous() method. Which makes + it a bit problematic and prevents the use of STL. + + This version is implemented with circular lists because: + - I like circular lists + - it demonstrates some independence from the (typical) doubly linked list. +*/ +class TiXmlAttributeSet +{ +public: + TiXmlAttributeSet(); + ~TiXmlAttributeSet(); + + void Add( TiXmlAttribute* attribute ); + void Remove( TiXmlAttribute* attribute ); + + const TiXmlAttribute* First() const + { + return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; + } + TiXmlAttribute* First() + { + return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; + } + const TiXmlAttribute* Last() const + { + return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; + } + TiXmlAttribute* Last() + { + return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; + } + + TiXmlAttribute* Find( const char* _name ) const; + TiXmlAttribute* FindOrCreate( const char* _name ); + +# ifdef TIXML_USE_STL + TiXmlAttribute* Find( const std::string& _name ) const; + TiXmlAttribute* FindOrCreate( const std::string& _name ); +# endif + + +private: + //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), + //*ME: this class must be also use a hidden/disabled copy-constructor !!! + TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed + void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) + + TiXmlAttribute sentinel; +}; + + +/** The element is a container class. It has a value, the element name, + and can contain other elements, text, comments, and unknowns. + Elements also contain an arbitrary number of attributes. +*/ +class TiXmlElement : public TiXmlNode +{ +public: + /// Construct an element. + TiXmlElement (const char* in_value); + +#ifdef TIXML_USE_STL + /// std::string constructor. + TiXmlElement( const std::string& _value ); +#endif + + TiXmlElement( const TiXmlElement& ); + + TiXmlElement& operator=( const TiXmlElement& base ); + + virtual ~TiXmlElement(); + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + */ + const char* Attribute( const char* name ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an integer, + the integer value will be put in the return 'i', if 'i' + is non-null. + */ + const char* Attribute( const char* name, int* i ) const; + + /** Given an attribute name, Attribute() returns the value + for the attribute of that name, or null if none exists. + If the attribute exists and can be converted to an double, + the double value will be put in the return 'd', if 'd' + is non-null. + */ + const char* Attribute( const char* name, double* d ) const; + + /** QueryIntAttribute examines the attribute - it is an alternative to the + Attribute() method with richer error checking. + If the attribute is an integer, it is stored in 'value' and + the call returns TIXML_SUCCESS. If it is not + an integer, it returns TIXML_WRONG_TYPE. If the attribute + does not exist, then TIXML_NO_ATTRIBUTE is returned. + */ + int QueryIntAttribute( const char* name, int* _value ) const; + /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute(). + int QueryUnsignedAttribute( const char* name, unsigned* _value ) const; + /** QueryBoolAttribute examines the attribute - see QueryIntAttribute(). + Note that '1', 'true', or 'yes' are considered true, while '0', 'false' + and 'no' are considered false. + */ + int QueryBoolAttribute( const char* name, bool* _value ) const; + /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). + int QueryDoubleAttribute( const char* name, double* _value ) const; + /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). + int QueryFloatAttribute( const char* name, float* _value ) const + { + double d; + int result = QueryDoubleAttribute( name, &d ); + + if ( result == TIXML_SUCCESS ) + { + *_value = (float)d; + } + + return result; + } + +#ifdef TIXML_USE_STL + /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). + int QueryStringAttribute( const char* name, std::string* _value ) const + { + const char* cstr = Attribute( name ); + + if ( cstr ) + { + *_value = std::string( cstr ); + return TIXML_SUCCESS; + } + + return TIXML_NO_ATTRIBUTE; + } + + /** Template form of the attribute query which will try to read the + attribute into the specified type. Very easy, very powerful, but + be careful to make sure to call this with the correct type. + + NOTE: This method doesn't work correctly for 'string' types that contain spaces. + + @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE + */ + template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + + if ( !node ) + { + return TIXML_NO_ATTRIBUTE; + } + + std::stringstream sstream( node->ValueStr() ); + sstream >> *outValue; + + if ( !sstream.fail() ) + { + return TIXML_SUCCESS; + } + + return TIXML_WRONG_TYPE; + } + + int QueryValueAttribute( const std::string& name, std::string* outValue ) const + { + const TiXmlAttribute* node = attributeSet.Find( name ); + + if ( !node ) + { + return TIXML_NO_ATTRIBUTE; + } + + *outValue = node->ValueStr(); + return TIXML_SUCCESS; + } +#endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, const char* _value ); + +#ifdef TIXML_USE_STL + const std::string* Attribute( const std::string& name ) const; + const std::string* Attribute( const std::string& name, int* i ) const; + const std::string* Attribute( const std::string& name, double* d ) const; + int QueryIntAttribute( const std::string& name, int* _value ) const; + int QueryDoubleAttribute( const std::string& name, double* _value ) const; + + /// STL std::string form. + void SetAttribute( const std::string& name, const std::string& _value ); + ///< STL std::string form. + void SetAttribute( const std::string& name, int _value ); + ///< STL std::string form. + void SetDoubleAttribute( const std::string& name, double value ); +#endif + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetAttribute( const char* name, int value ); + + /** Sets an attribute of name to a given value. The attribute + will be created if it does not exist, or changed if it does. + */ + void SetDoubleAttribute( const char* name, double value ); + + /** Deletes an attribute with the given name. + */ + void RemoveAttribute( const char* name ); +#ifdef TIXML_USE_STL + void RemoveAttribute( const std::string& name ) + { + RemoveAttribute (name.c_str ()); ///< STL std::string form. + } +#endif + + const TiXmlAttribute* FirstAttribute() const + { + return attributeSet.First(); ///< Access the first attribute in this element. + } + TiXmlAttribute* FirstAttribute() + { + return attributeSet.First(); + } + const TiXmlAttribute* LastAttribute() const + { + return attributeSet.Last(); ///< Access the last attribute in this element. + } + TiXmlAttribute* LastAttribute() + { + return attributeSet.Last(); + } + + /** Convenience function for easy access to the text inside an element. Although easy + and concise, GetText() is limited compared to getting the TiXmlText child + and accessing it directly. + + If the first child of 'this' is a TiXmlText, the GetText() + returns the character string of the Text node, else null is returned. + + This is a convenient method for getting the text of simple contained text: + @verbatim + This is text + const char* str = fooElement->GetText(); + @endverbatim + + 'str' will be a pointer to "This is text". + + Note that this function can be misleading. If the element foo was created from + this XML: + @verbatim + This is text + @endverbatim + + then the value of str would be null. The first child node isn't a text node, it is + another element. From this XML: + @verbatim + This is text + @endverbatim + GetText() will return "This is ". + + WARNING: GetText() accesses a child node - don't become confused with the + similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are + safe type casts on the referenced node. + */ + const char* GetText() const; + + /// Creates a new Element and returns it - the returned element is a copy. + virtual TiXmlNode* Clone() const; + // Print the Element to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: next char past '<' + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlElement* ToElement() const + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + virtual TiXmlElement* ToElement() + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + + void CopyTo( TiXmlElement* target ) const; + void ClearThis(); // like clear, but initializes 'this' object as well + + // Used to be public [internal use] +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif + /* [internal use] + Reads the "value" of the element -- another element, or text. + This should terminate with the current end tag. + */ + const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + +private: + TiXmlAttributeSet attributeSet; +}; + + +/** An XML comment. +*/ +class TiXmlComment : public TiXmlNode +{ +public: + /// Constructs an empty comment. + TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} + /// Construct a comment from text. + TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) + { + SetValue( _value ); + } + TiXmlComment( const TiXmlComment& ); + TiXmlComment& operator=( const TiXmlComment& base ); + + virtual ~TiXmlComment() {} + + /// Returns a copy of this Comment. + virtual TiXmlNode* Clone() const; + // Write this Comment to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /* Attribtue parsing starts: at the ! of the !-- + returns: next char past '>' + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlComment* ToComment() const + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + virtual TiXmlComment* ToComment() + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + void CopyTo( TiXmlComment* target ) const; + + // used to be public +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif + // virtual void StreamOut( TIXML_OSTREAM * out ) const; + +private: + +}; + + +/** XML text. A text node can have 2 ways to output the next. "normal" output + and CDATA. It will default to the mode it was parsed from the XML file and + you generally want to leave it alone, but you can change the output mode with + SetCDATA() and query it with CDATA(). +*/ +class TiXmlText : public TiXmlNode +{ + friend class TiXmlElement; +public: + /** Constructor for text element. By default, it is treated as + normal, encoded text. If you want it be output as a CDATA text + element, set the parameter _cdata to 'true' + */ + TiXmlText (const char* initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } + virtual ~TiXmlText() {} + +#ifdef TIXML_USE_STL + /// Constructor. + TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) + { + SetValue( initValue ); + cdata = false; + } +#endif + + TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) + { + copy.CopyTo( this ); + } + TiXmlText& operator=( const TiXmlText& base ) + { + base.CopyTo( this ); + return *this; + } + + // Write this text object to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + /// Queries whether this represents text using a CDATA section. + bool CDATA() const + { + return cdata; + } + /// Turns on or off a CDATA representation of text. + void SetCDATA( bool _cdata ) + { + cdata = _cdata; + } + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlText* ToText() const + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + virtual TiXmlText* ToText() + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected : + /// [internal use] Creates a new Element and returns it. + virtual TiXmlNode* Clone() const; + void CopyTo( TiXmlText* target ) const; + + bool Blank() const; // returns true if all white space and new lines + // [internal use] +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif + +private: + bool cdata; // true if this should be input and output as a CDATA style text element +}; + + +/** In correct XML the declaration is the first entry in the file. + @verbatim + + @endverbatim + + TinyXml will happily read or write files without a declaration, + however. There are 3 possible attributes to the declaration: + version, encoding, and standalone. + + Note: In this version of the code, the attributes are + handled as special cases, not generic attributes, simply + because there can only be at most 3 and they are always the same. +*/ +class TiXmlDeclaration : public TiXmlNode +{ +public: + /// Construct an empty declaration. + TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} + +#ifdef TIXML_USE_STL + /// Constructor. + TiXmlDeclaration( const std::string& _version, + const std::string& _encoding, + const std::string& _standalone ); +#endif + + /// Construct. + TiXmlDeclaration( const char* _version, + const char* _encoding, + const char* _standalone ); + + TiXmlDeclaration( const TiXmlDeclaration& copy ); + TiXmlDeclaration& operator=( const TiXmlDeclaration& copy ); + + virtual ~TiXmlDeclaration() {} + + /// Version. Will return an empty string if none was found. + const char* Version() const + { + return version.c_str (); + } + /// Encoding. Will return an empty string if none was found. + const char* Encoding() const + { + return encoding.c_str (); + } + /// Is this a standalone document? + const char* Standalone() const + { + return standalone.c_str (); + } + + /// Creates a copy of this Declaration and returns it. + virtual TiXmlNode* Clone() const; + // Print this declaration to a FILE stream. + virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; + virtual void Print( FILE* cfile, int depth ) const + { + Print( cfile, depth, 0 ); + } + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlDeclaration* ToDeclaration() const + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + virtual TiXmlDeclaration* ToDeclaration() + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* visitor ) const; + +protected: + void CopyTo( TiXmlDeclaration* target ) const; + // used to be public +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif + +private: + + TIXML_STRING version; + TIXML_STRING encoding; + TIXML_STRING standalone; +}; + + +/** Any tag that tinyXml doesn't recognize is saved as an + unknown. It is a tag of text, but should not be modified. + It will be written back to the XML, unchanged, when the file + is saved. + + DTD tags get thrown into TiXmlUnknowns. +*/ +class TiXmlUnknown : public TiXmlNode +{ +public: + TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} + virtual ~TiXmlUnknown() {} + + TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) + { + copy.CopyTo( this ); + } + TiXmlUnknown& operator=( const TiXmlUnknown& copy ) + { + copy.CopyTo( this ); + return *this; + } + + /// Creates a copy of this Unknown and returns it. + virtual TiXmlNode* Clone() const; + // Print this Unknown to a FILE stream. + virtual void Print( FILE* cfile, int depth ) const; + + virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); + + virtual const TiXmlUnknown* ToUnknown() const + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + virtual TiXmlUnknown* ToUnknown() + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected: + void CopyTo( TiXmlUnknown* target ) const; + +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif + +private: + +}; + + +/** Always the top level node. A document binds together all the + XML pieces. It can be saved, loaded, and printed to the screen. + The 'value' of a document node is the xml file name. +*/ +class TiXmlDocument : public TiXmlNode +{ +public: + /// Create an empty document, that has no name. + TiXmlDocument(); + /// Create a document with a name. The name of the document is also the filename of the xml. + TiXmlDocument( const char* documentName ); + +#ifdef TIXML_USE_STL + /// Constructor. + TiXmlDocument( const std::string& documentName ); +#endif + + TiXmlDocument( const TiXmlDocument& copy ); + TiXmlDocument& operator=( const TiXmlDocument& copy ); + + virtual ~TiXmlDocument() {} + + /** Load a file using the current document value. + Returns true if successful. Will delete any existing + document data before loading. + */ + bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the current document value. Returns true if successful. + bool SaveFile() const; + /// Load a file using the given filename. Returns true if successful. + bool LoadFile( const char* filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given filename. Returns true if successful. + bool SaveFile( const char* filename ) const; + /** Load a file using the given FILE*. Returns true if successful. Note that this method + doesn't stream - the entire object pointed at by the FILE* + will be interpreted as an XML file. TinyXML doesn't stream in XML from the current + file location. Streaming may be added in the future. + */ + bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + /// Save a file using the given FILE*. Returns true if successful. + bool SaveFile( FILE* ) const; + +#ifdef TIXML_USE_STL + bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. + { + return LoadFile( filename.c_str(), encoding ); + } + bool SaveFile( const std::string& filename ) const ///< STL std::string version. + { + return SaveFile( filename.c_str() ); + } +#endif + + /** Parse the given null terminated block of xml data. Passing in an encoding to this + method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml + to use that encoding, regardless of what TinyXml might otherwise try to detect. + */ + virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); + + /** Get the root element -- the only top level element -- of the document. + In well formed XML, there should only be one. TinyXml is tolerant of + multiple elements at the document level. + */ + const TiXmlElement* RootElement() const + { + return FirstChildElement(); + } + TiXmlElement* RootElement() + { + return FirstChildElement(); + } + + /** If an error occurs, Error will be set to true. Also, + - The ErrorId() will contain the integer identifier of the error (not generally useful) + - The ErrorDesc() method will return the name of the error. (very useful) + - The ErrorRow() and ErrorCol() will return the location of the error (if known) + */ + bool Error() const + { + return error; + } + + /// Contains a textual (english) description of the error if one occurs. + const char* ErrorDesc() const + { + return errorDesc.c_str (); + } + + /** Generally, you probably want the error string ( ErrorDesc() ). But if you + prefer the ErrorId, this function will fetch it. + */ + int ErrorId() const + { + return errorId; + } + + /** Returns the location (if known) of the error. The first column is column 1, + and the first row is row 1. A value of 0 means the row and column wasn't applicable + (memory errors, for example, have no row/column) or the parser lost the error. (An + error in the error reporting, in that case.) + + @sa SetTabSize, Row, Column + */ + int ErrorRow() const + { + return errorLocation.row+1; + } + int ErrorCol() const + { + return errorLocation.col+1; ///< The column where the error occured. See ErrorRow() + } + + /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) + to report the correct values for row and column. It does not change the output + or input in any way. + + By calling this method, with a tab size + greater than 0, the row and column of each node and attribute is stored + when the file is loaded. Very useful for tracking the DOM back in to + the source file. + + The tab size is required for calculating the location of nodes. If not + set, the default of 4 is used. The tabsize is set per document. Setting + the tabsize to 0 disables row/column tracking. + + Note that row and column tracking is not supported when using operator>>. + + The tab size needs to be enabled before the parse or load. Correct usage: + @verbatim + TiXmlDocument doc; + doc.SetTabSize( 8 ); + doc.Load( "myfile.xml" ); + @endverbatim + + @sa Row, Column + */ + void SetTabSize( int _tabsize ) + { + tabsize = _tabsize; + } + + int TabSize() const + { + return tabsize; + } + + /** If you have handled the error, it can be reset with this call. The error + state is automatically cleared if you Parse a new XML block. + */ + void ClearError() + { + error = false; + errorId = 0; + errorDesc = ""; + errorLocation.row = errorLocation.col = 0; + //errorLocation.last = 0; + } + + /** Write the document to standard out using formatted printing ("pretty print"). */ + void Print() const + { + Print( stdout, 0 ); + } + + /* Write the document to a string using formatted printing ("pretty print"). This + will allocate a character array (new char[]) and return it as a pointer. The + calling code pust call delete[] on the return char* to avoid a memory leak. + */ + //char* PrintToMemory() const; + + /// Print this Document to a FILE stream. + virtual void Print( FILE* cfile, int depth = 0 ) const; + // [internal use] + void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); + + virtual const TiXmlDocument* ToDocument() const + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + virtual TiXmlDocument* ToDocument() + { + return this; ///< Cast to a more defined type. Will return null not of the requested type. + } + + /** Walk the XML tree visiting this node and all of its children. + */ + virtual bool Accept( TiXmlVisitor* content ) const; + +protected : + // [internal use] + virtual TiXmlNode* Clone() const; +#ifdef TIXML_USE_STL + virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); +#endif + +private: + void CopyTo( TiXmlDocument* target ) const; + + bool error; + int errorId; + TIXML_STRING errorDesc; + int tabsize; + TiXmlCursor errorLocation; + bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. +}; + + +/** + A TiXmlHandle is a class that wraps a node pointer with null checks; this is + an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml + DOM structure. It is a separate utility class. + + Take an example: + @verbatim + + + + + + + @endverbatim + + Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very + easy to write a *lot* of code that looks like: + + @verbatim + TiXmlElement* root = document.FirstChildElement( "Document" ); + if ( root ) + { + TiXmlElement* element = root->FirstChildElement( "Element" ); + if ( element ) + { + TiXmlElement* child = element->FirstChildElement( "Child" ); + if ( child ) + { + TiXmlElement* child2 = child->NextSiblingElement( "Child" ); + if ( child2 ) + { + // Finally do something useful. + @endverbatim + + And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity + of such code. A TiXmlHandle checks for null pointers so it is perfectly safe + and correct to use: + + @verbatim + TiXmlHandle docHandle( &document ); + TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); + if ( child2 ) + { + // do something useful + @endverbatim + + Which is MUCH more concise and useful. + + It is also safe to copy handles - internally they are nothing more than node pointers. + @verbatim + TiXmlHandle handleCopy = handle; + @endverbatim + + What they should not be used for is iteration: + + @verbatim + int i=0; + while ( true ) + { + TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); + if ( !child ) + break; + // do something + ++i; + } + @endverbatim + + It seems reasonable, but it is in fact two embedded while loops. The Child method is + a linear walk to find the element, so this code would iterate much more than it needs + to. Instead, prefer: + + @verbatim + TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); + + for( child; child; child=child->NextSiblingElement() ) + { + // do something + } + @endverbatim +*/ +class TiXmlHandle +{ +public: + /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. + TiXmlHandle( TiXmlNode* _node ) + { + this->node = _node; + } + /// Copy constructor + TiXmlHandle( const TiXmlHandle& ref ) + { + this->node = ref.node; + } + TiXmlHandle operator=( const TiXmlHandle& ref ) + { + if ( &ref != this ) + { + this->node = ref.node; + } + + return *this; + } + + /// Return a handle to the first child node. + TiXmlHandle FirstChild() const; + /// Return a handle to the first child node with the given name. + TiXmlHandle FirstChild( const char* value ) const; + /// Return a handle to the first child element. + TiXmlHandle FirstChildElement() const; + /// Return a handle to the first child element with the given name. + TiXmlHandle FirstChildElement( const char* value ) const; + + /** Return a handle to the "index" child with the given name. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( const char* value, int index ) const; + /** Return a handle to the "index" child. + The first child is 0, the second 1, etc. + */ + TiXmlHandle Child( int index ) const; + /** Return a handle to the "index" child element with the given name. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( const char* value, int index ) const; + /** Return a handle to the "index" child element. + The first child element is 0, the second 1, etc. Note that only TiXmlElements + are indexed: other types are not counted. + */ + TiXmlHandle ChildElement( int index ) const; + +#ifdef TIXML_USE_STL + TiXmlHandle FirstChild( const std::string& _value ) const + { + return FirstChild( _value.c_str() ); + } + TiXmlHandle FirstChildElement( const std::string& _value ) const + { + return FirstChildElement( _value.c_str() ); + } + + TiXmlHandle Child( const std::string& _value, int index ) const + { + return Child( _value.c_str(), index ); + } + TiXmlHandle ChildElement( const std::string& _value, int index ) const + { + return ChildElement( _value.c_str(), index ); + } +#endif + + /** Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* ToNode() const + { + return node; + } + /** Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* ToElement() const + { + return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); + } + /** Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* ToText() const + { + return ( ( node && node->ToText() ) ? node->ToText() : 0 ); + } + /** Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* ToUnknown() const + { + return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); + } + + /** @deprecated use ToNode. + Return the handle as a TiXmlNode. This may return null. + */ + TiXmlNode* Node() const + { + return ToNode(); + } + /** @deprecated use ToElement. + Return the handle as a TiXmlElement. This may return null. + */ + TiXmlElement* Element() const + { + return ToElement(); + } + /** @deprecated use ToText() + Return the handle as a TiXmlText. This may return null. + */ + TiXmlText* Text() const + { + return ToText(); + } + /** @deprecated use ToUnknown() + Return the handle as a TiXmlUnknown. This may return null. + */ + TiXmlUnknown* Unknown() const + { + return ToUnknown(); + } + +private: + TiXmlNode* node; +}; + + +/** Print to memory functionality. The TiXmlPrinter is useful when you need to: + + -# Print to memory (especially in non-STL mode) + -# Control formatting (line endings, etc.) + + When constructed, the TiXmlPrinter is in its default "pretty printing" mode. + Before calling Accept() you can call methods to control the printing + of the XML document. After TiXmlNode::Accept() is called, the printed document can + be accessed via the CStr(), Str(), and Size() methods. + + TiXmlPrinter uses the Visitor API. + @verbatim + TiXmlPrinter printer; + printer.SetIndent( "\t" ); + + doc.Accept( &printer ); + fprintf( stdout, "%s", printer.CStr() ); + @endverbatim +*/ +class TiXmlPrinter : public TiXmlVisitor +{ +public: + TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), + buffer(), indent( " " ), lineBreak( "\n" ) {} + + virtual bool VisitEnter( const TiXmlDocument& doc ); + virtual bool VisitExit( const TiXmlDocument& doc ); + + virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); + virtual bool VisitExit( const TiXmlElement& element ); + + virtual bool Visit( const TiXmlDeclaration& declaration ); + virtual bool Visit( const TiXmlText& text ); + virtual bool Visit( const TiXmlComment& comment ); + virtual bool Visit( const TiXmlUnknown& unknown ); + + /** Set the indent characters for printing. By default 4 spaces + but tab (\t) is also useful, or null/empty string for no indentation. + */ + void SetIndent( const char* _indent ) + { + indent = _indent ? _indent : "" ; + } + /// Query the indention string. + const char* Indent() + { + return indent.c_str(); + } + /** Set the line breaking string. By default set to newline (\n). + Some operating systems prefer other characters, or can be + set to the null/empty string for no indenation. + */ + void SetLineBreak( const char* _lineBreak ) + { + lineBreak = _lineBreak ? _lineBreak : ""; + } + /// Query the current line breaking string. + const char* LineBreak() + { + return lineBreak.c_str(); + } + + /** Switch over to "stream printing" which is the most dense formatting without + linebreaks. Common when the XML is needed for network transmission. + */ + void SetStreamPrinting() + { + indent = ""; + lineBreak = ""; + } + /// Return the result. + const char* CStr() + { + return buffer.c_str(); + } + /// Return the length of the result string. + size_t Size() + { + return buffer.size(); + } + +#ifdef TIXML_USE_STL + /// Return the result. + const std::string& Str() + { + return buffer; + } +#endif + +private: + void DoIndent() + { + for( int i=0; i +#include + +#include "tinyxml.h" + +//#define DEBUG_PARSER +#if defined( DEBUG_PARSER ) +# if defined( DEBUG ) && defined( _MSC_VER ) +# include +# define TIXML_LOG OutputDebugString +# else +# define TIXML_LOG printf +# endif +#endif + +// Note tha "PutString" hardcodes the same list. This +// is less flexible than it appears. Changing the entries +// or order will break putstring. +TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = +{ + { "&", 5, '&' }, + { "<", 4, '<' }, + { ">", 4, '>' }, + { """, 6, '\"' }, + { "'", 6, '\'' } +}; + +// Bunch of unicode info at: +// http://www.unicode.org/faq/utf_bom.html +// Including the basic of this table, which determines the #bytes in the +// sequence from the lead byte. 1 placed for invalid sequences -- +// although the result will be junk, pass it through as much as possible. +// Beware of the non-characters in UTF-8: +// ef bb bf (Microsoft "lead bytes") +// ef bf be +// ef bf bf + +const unsigned char TIXML_UTF_LEAD_0 = 0xefU; +const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; +const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; + +const int TiXmlBase::utf8ByteTable[256] = +{ + // 0 1 2 3 4 5 6 7 8 9 a b c d e f + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 + 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte + 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid +}; + + +void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) +{ + const unsigned long BYTE_MASK = 0xBF; + const unsigned long BYTE_MARK = 0x80; + const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; + + if (input < 0x80) + { + *length = 1; + } + else if ( input < 0x800 ) + { + *length = 2; + } + else if ( input < 0x10000 ) + { + *length = 3; + } + else if ( input < 0x200000 ) + { + *length = 4; + } + else + { + *length = 0; // This code won't covert this correctly anyway. + return; + } + + output += *length; + + // Scary scary fall throughs. + switch (*length) + { + case 4: + { + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + break; + } + + case 3: + { + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + break; + } + + case 2: + { + --output; + *output = (char)((input | BYTE_MARK) & BYTE_MASK); + input >>= 6; + break; + } + + case 1: + { + --output; + *output = (char)(input | FIRST_BYTE_MARK[*length]); + break; + } + } +} + + +/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) +{ + // This will only work for low-ascii, everything else is assumed to be a valid + // letter. I'm not sure this is the best approach, but it is quite tricky trying + // to figure out alhabetical vs. not across encoding. So take a very + // conservative approach. + + // if ( encoding == TIXML_ENCODING_UTF8 ) + // { + if ( anyByte < 127 ) + { + return isalpha( anyByte ); + } + else + { + return 1; // What else to do? The unicode set is huge...get the english ones right. + } + + // } + // else + // { + // return isalpha( anyByte ); + // } +} + + +/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) +{ + // This will only work for low-ascii, everything else is assumed to be a valid + // letter. I'm not sure this is the best approach, but it is quite tricky trying + // to figure out alhabetical vs. not across encoding. So take a very + // conservative approach. + + // if ( encoding == TIXML_ENCODING_UTF8 ) + // { + if ( anyByte < 127 ) + { + return isalnum( anyByte ); + } + else + { + return 1; // What else to do? The unicode set is huge...get the english ones right. + } + + // } + // else + // { + // return isalnum( anyByte ); + // } +} + + +class TiXmlParsingData +{ + friend class TiXmlDocument; +public: + void Stamp( const char* now, TiXmlEncoding encoding ); + + const TiXmlCursor& Cursor() const + { + return cursor; + } + +private: + // Only used by the document! + TiXmlParsingData( const char* start, int _tabsize, int row, int col ) + { + assert( start ); + stamp = start; + tabsize = _tabsize; + cursor.row = row; + cursor.col = col; + } + + TiXmlCursor cursor; + const char* stamp; + int tabsize; +}; + + +void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) +{ + assert( now ); + + // Do nothing if the tabsize is 0. + if ( tabsize < 1 ) + { + return; + } + + // Get the current row, column. + int row = cursor.row; + int col = cursor.col; + const char* p = stamp; + assert( p ); + + while ( p < now ) + { + // Treat p as unsigned, so we have a happy compiler. + const unsigned char* pU = (const unsigned char*)p; + + // Code contributed by Fletcher Dunn: (modified by lee) + switch (*pU) + { + case 0: + // We *should* never get here, but in case we do, don't + // advance past the terminating null character, ever + return; + + case '\r': + // bump down to the next line + ++row; + col = 0; + // Eat the character + ++p; + + // Check for \r\n sequence, and treat this as a single character + if (*p == '\n') + { + ++p; + } + + break; + + case '\n': + // bump down to the next line + ++row; + col = 0; + + // Eat the character + ++p; + + // Check for \n\r sequence, and treat this as a single + // character. (Yes, this bizarre thing does occur still + // on some arcane platforms...) + if (*p == '\r') + { + ++p; + } + + break; + + case '\t': + // Eat the character + ++p; + + // Skip to next tab stop + col = (col / tabsize + 1) * tabsize; + break; + + case TIXML_UTF_LEAD_0: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + if ( *(p+1) && *(p+2) ) + { + // In these cases, don't advance the column. These are + // 0-width spaces. + if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) + { + p += 3; + } + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) + { + p += 3; + } + else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) + { + p += 3; + } + else + { + p +=3; // A normal character. + ++col; + } + } + } + else + { + ++p; + ++col; + } + + break; + + default: + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // Eat the 1 to 4 byte utf8 character. + int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; + + if ( step == 0 ) + { + step = 1; // Error case from bad encoding, but handle gracefully. + } + + p += step; + + // Just advance one column, of course. + ++col; + } + else + { + ++p; + ++col; + } + + break; + } + } + + cursor.row = row; + cursor.col = col; + assert( cursor.row >= -1 ); + assert( cursor.col >= -1 ); + stamp = p; + assert( stamp ); +} + + +const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) +{ + if ( !p || !*p ) + { + return 0; + } + + if ( encoding == TIXML_ENCODING_UTF8 ) + { + while ( *p ) + { + const unsigned char* pU = (const unsigned char*)p; + + // Skip the stupid Microsoft UTF-8 Byte order marks + if ( *(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==TIXML_UTF_LEAD_1 + && *(pU+2)==TIXML_UTF_LEAD_2 ) + { + p += 3; + continue; + } + else if(*(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==0xbfU + && *(pU+2)==0xbeU ) + { + p += 3; + continue; + } + else if(*(pU+0)==TIXML_UTF_LEAD_0 + && *(pU+1)==0xbfU + && *(pU+2)==0xbfU ) + { + p += 3; + continue; + } + + if ( IsWhiteSpace( *p ) ) // Still using old rules for white space. + { + ++p; + } + else + { + break; + } + } + } + else + { + while ( *p && IsWhiteSpace( *p ) ) + { + ++p; + } + } + + return p; +} + +#ifdef TIXML_USE_STL +/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream* in, TIXML_STRING* tag ) +{ + for( ;; ) + { + if ( !in->good() ) + { + return false; + } + + int c = in->peek(); + + // At this scope, we can't get to a document. So fail silently. + if ( !IsWhiteSpace( c ) || c <= 0 ) + { + return true; + } + + *tag += (char) in->get(); + } +} + +/*static*/ bool TiXmlBase::StreamTo( std::istream* in, int character, TIXML_STRING* tag ) +{ + //assert( character > 0 && character < 128 ); // else it won't work in utf-8 + while ( in->good() ) + { + int c = in->peek(); + + if ( c == character ) + { + return true; + } + + if ( c <= 0 ) // Silent failure: can't get document at this scope + { + return false; + } + + in->get(); + *tag += (char) c; + } + + return false; +} +#endif + +// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The +// "assign" optimization removes over 10% of the execution time. +// +const char* TiXmlBase::ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ) +{ + // Oddly, not supported on some comilers, + //name->clear(); + // So use this: + *name = ""; + assert( p ); + + // Names start with letters or underscores. + // Of course, in unicode, tinyxml has no idea what a letter *is*. The + // algorithm is generous. + // + // After that, they can be letters, underscores, numbers, + // hyphens, or colons. (Colons are valid ony for namespaces, + // but tinyxml can't tell namespaces from names.) + if ( p && *p + && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) + { + const char* start = p; + + while( p && *p + && ( IsAlphaNum( (unsigned char ) *p, encoding ) + || *p == '_' + || *p == '-' + || *p == '.' + || *p == ':' ) ) + { + //(*name) += *p; // expensive + ++p; + } + + if ( p-start > 0 ) + { + name->assign( start, p-start ); + } + + return p; + } + + return 0; +} + +const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) +{ + // Presume an entity, and pull it out. + TIXML_STRING ent; + int i; + *length = 0; + + if ( *(p+1) && *(p+1) == '#' && *(p+2) ) + { + unsigned long ucs = 0; + ptrdiff_t delta = 0; + unsigned mult = 1; + + if ( *(p+2) == 'x' ) + { + // Hexadecimal. + if ( !*(p+3) ) + { + return 0; + } + + const char* q = p+3; + q = strchr( q, ';' ); + + if ( !q || !*q ) + { + return 0; + } + + delta = q-p; + --q; + + while ( *q != 'x' ) + { + if ( *q >= '0' && *q <= '9' ) + { + ucs += mult * (*q - '0'); + } + else if ( *q >= 'a' && *q <= 'f' ) + { + ucs += mult * (*q - 'a' + 10); + } + else if ( *q >= 'A' && *q <= 'F' ) + { + ucs += mult * (*q - 'A' + 10 ); + } + else + { + return 0; + } + + mult *= 16; + --q; + } + } + else + { + // Decimal. + if ( !*(p+2) ) + { + return 0; + } + + const char* q = p+2; + q = strchr( q, ';' ); + + if ( !q || !*q ) + { + return 0; + } + + delta = q-p; + --q; + + while ( *q != '#' ) + { + if ( *q >= '0' && *q <= '9' ) + { + ucs += mult * (*q - '0'); + } + else + { + return 0; + } + + mult *= 10; + --q; + } + } + + if ( encoding == TIXML_ENCODING_UTF8 ) + { + // convert the UCS to UTF-8 + ConvertUTF32ToUTF8( ucs, value, length ); + } + else + { + *value = (char)ucs; + *length = 1; + } + + return p + delta + 1; + } + + // Now try to match it. + for( i=0; iappend( cArr, len ); + } + } + else + { + bool whitespace = false; + + // Remove leading white space: + p = SkipWhiteSpace( p, encoding ); + + while ( p && *p + && !StringEqual( p, endTag, caseInsensitive, encoding ) ) + { + if ( *p == '\r' || *p == '\n' ) + { + whitespace = true; + ++p; + } + else if ( IsWhiteSpace( *p ) ) + { + whitespace = true; + ++p; + } + else + { + // If we've found whitespace, add it before the + // new character. Any whitespace just becomes a space. + if ( whitespace ) + { + (*text) += ' '; + whitespace = false; + } + + int len; + char cArr[4] = { 0, 0, 0, 0 }; + p = GetChar( p, cArr, &len, encoding ); + + if ( len == 1 ) + { + (*text) += cArr[0]; // more efficient + } + else + { + text->append( cArr, len ); + } + } + } + } + + if ( p && *p ) + { + p += strlen( endTag ); + } + + return ( p && *p ) ? p : 0; +} + +#ifdef TIXML_USE_STL + +void TiXmlDocument::StreamIn( std::istream* in, TIXML_STRING* tag ) +{ + // The basic issue with a document is that we don't know what we're + // streaming. Read something presumed to be a tag (and hope), then + // identify it, and call the appropriate stream method on the tag. + // + // This "pre-streaming" will never read the closing ">" so the + // sub-tag can orient itself. + + if ( !StreamTo( in, '<', tag ) ) + { + SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + + while ( in->good() ) + { + int tagIndex = (int) tag->length(); + + while ( in->good() && in->peek() != '>' ) + { + int c = in->get(); + + if ( c <= 0 ) + { + SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + break; + } + + (*tag) += (char) c; + } + + if ( in->good() ) + { + // We now have something we presume to be a node of + // some sort. Identify it, and call the node to + // continue streaming. + TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); + + if ( node ) + { + node->StreamIn( in, tag ); + bool isElement = node->ToElement() != 0; + delete node; + node = 0; + + // If this is the root element, we're done. Parsing will be + // done by the >> operator. + if ( isElement ) + { + return; + } + } + else + { + SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); + return; + } + } + } + + // We should have returned sooner. + SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); +} + +#endif + +const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) +{ + ClearError(); + + // Parse away, at the document level. Since a document + // contains nothing but other tags, most of what happens + // here is skipping white space. + if ( !p || !*p ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + // Note that, for a document, this needs to come + // before the while space skip, so that parsing + // starts from the pointer we are given. + location.Clear(); + + if ( prevData ) + { + location.row = prevData->cursor.row; + location.col = prevData->cursor.col; + } + else + { + location.row = 0; + location.col = 0; + } + + TiXmlParsingData data( p, TabSize(), location.row, location.col ); + location = data.Cursor(); + + if ( encoding == TIXML_ENCODING_UNKNOWN ) + { + // Check for the Microsoft UTF-8 lead bytes. + const unsigned char* pU = (const unsigned char*)p; + + if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 + && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 + && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) + { + encoding = TIXML_ENCODING_UTF8; + useMicrosoftBOM = true; + } + } + + p = SkipWhiteSpace( p, encoding ); + + if ( !p ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); + return 0; + } + + while ( p && *p ) + { + TiXmlNode* node = Identify( p, encoding ); + + if ( node ) + { + p = node->Parse( p, &data, encoding ); + LinkEndChild( node ); + } + else + { + break; + } + + // Did we get encoding info? + if ( encoding == TIXML_ENCODING_UNKNOWN + && node->ToDeclaration() ) + { + TiXmlDeclaration* dec = node->ToDeclaration(); + const char* enc = dec->Encoding(); + assert( enc ); + + if ( *enc == 0 ) + { + encoding = TIXML_ENCODING_UTF8; + } + else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) + { + encoding = TIXML_ENCODING_UTF8; + } + else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) + { + encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice + } + else + { + encoding = TIXML_ENCODING_LEGACY; + } + } + + p = SkipWhiteSpace( p, encoding ); + } + + // Was this empty? + if ( !firstChild ) + { + SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); + return 0; + } + + // All is well. + return p; +} + +void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + // The first error in a chain is more accurate - don't set again! + if ( error ) + { + return; + } + + assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); + error = true; + errorId = err; + errorDesc = errorString[ errorId ]; + + errorLocation.Clear(); + + if ( pError && data ) + { + data->Stamp( pError, encoding ); + errorLocation = data->Cursor(); + } +} + + +TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) +{ + TiXmlNode* returnNode = 0; + + p = SkipWhiteSpace( p, encoding ); + + if( !p || !*p || *p != '<' ) + { + return 0; + } + + p = SkipWhiteSpace( p, encoding ); + + if ( !p || !*p ) + { + return 0; + } + + // What is this thing? + // - Elements start with a letter or underscore, but xml is reserved. + // - Comments: "; + + if ( !StringEqual( p, startTag, false, encoding ) ) + { + if ( document ) + { + document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); + } + + return 0; + } + + p += strlen( startTag ); + + // [ 1475201 ] TinyXML parses entities in comments + // Oops - ReadText doesn't work, because we don't want to parse the entities. + // p = ReadText( p, &value, false, endTag, false, encoding ); + // + // from the XML spec: + /* + [Definition: Comments may appear anywhere in a document outside other markup; in addition, + they may appear within the document type declaration at places allowed by the grammar. + They are not part of the document's character data; an XML processor MAY, but need not, + make it possible for an application to retrieve the text of comments. For compatibility, + the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity + references MUST NOT be recognized within comments. + + An example of a comment: + + + */ + + value = ""; + + // Keep all the white space. + while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) + { + value.append( p, 1 ); + ++p; + } + + if ( p && *p ) + { + p += strlen( endTag ); + } + + return p; +} + + +const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + p = SkipWhiteSpace( p, encoding ); + + if ( !p || !*p ) + { + return 0; + } + + if ( data ) + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } + + // Read the name, the '=' and the value. + const char* pErr = p; + p = ReadName( p, &name, encoding ); + + if ( !p || !*p ) + { + if ( document ) + { + document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); + } + + return 0; + } + + p = SkipWhiteSpace( p, encoding ); + + if ( !p || !*p || *p != '=' ) + { + if ( document ) + { + document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + } + + return 0; + } + + ++p; // skip '=' + p = SkipWhiteSpace( p, encoding ); + + if ( !p || !*p ) + { + if ( document ) + { + document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + } + + return 0; + } + + const char* end; + const char SINGLE_QUOTE = '\''; + const char DOUBLE_QUOTE = '\"'; + + if ( *p == SINGLE_QUOTE ) + { + ++p; + end = "\'"; // single quote in string + p = ReadText( p, &value, false, end, false, encoding ); + } + else if ( *p == DOUBLE_QUOTE ) + { + ++p; + end = "\""; // double quote in string + p = ReadText( p, &value, false, end, false, encoding ); + } + else + { + // All attribute values should be in single or double quotes. + // But this is such a common error that the parser will try + // its best, even without them. + value = ""; + + while ( p && *p // existence + && !IsWhiteSpace( *p ) // whitespace + && *p != '/' && *p != '>' ) // tag end + { + if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) + { + // [ 1451649 ] Attribute values with trailing quotes not handled correctly + // We did not have an opening quote but seem to have a + // closing one. Give up and throw an error. + if ( document ) + { + document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); + } + + return 0; + } + + value += *p; + ++p; + } + } + + return p; +} + +#ifdef TIXML_USE_STL +void TiXmlText::StreamIn( std::istream* in, TIXML_STRING* tag ) +{ + while ( in->good() ) + { + int c = in->peek(); + + if ( !cdata && (c == '<' ) ) + { + return; + } + + if ( c <= 0 ) + { + TiXmlDocument* document = GetDocument(); + + if ( document ) + { + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + } + + return; + } + + (*tag) += (char) c; + in->get(); // "commits" the peek made above + + if ( cdata && c == '>' && tag->size() >= 3 ) + { + size_t len = tag->size(); + + if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) + { + // terminator of cdata. + return; + } + } + } +} +#endif + +const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) +{ + value = ""; + TiXmlDocument* document = GetDocument(); + + if ( data ) + { + data->Stamp( p, encoding ); + location = data->Cursor(); + } + + const char* const startTag = ""; + + if ( cdata || StringEqual( p, startTag, false, encoding ) ) + { + cdata = true; + + if ( !StringEqual( p, startTag, false, encoding ) ) + { + if ( document ) + { + document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); + } + + return 0; + } + + p += strlen( startTag ); + + // Keep all the white space, ignore the encoding, etc. + while ( p && *p + && !StringEqual( p, endTag, false, encoding ) + ) + { + value += *p; + ++p; + } + + TIXML_STRING dummy; + p = ReadText( p, &dummy, false, endTag, false, encoding ); + return p; + } + else + { + bool ignoreWhite = true; + + const char* end = "<"; + p = ReadText( p, &value, ignoreWhite, end, false, encoding ); + + if ( p && *p ) + { + return p-1; // don't truncate the '<' + } + + return 0; + } +} + +#ifdef TIXML_USE_STL +void TiXmlDeclaration::StreamIn( std::istream* in, TIXML_STRING* tag ) +{ + while ( in->good() ) + { + int c = in->get(); + + if ( c <= 0 ) + { + TiXmlDocument* document = GetDocument(); + + if ( document ) + { + document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); + } + + return; + } + + (*tag) += (char) c; + + if ( c == '>' ) + { + // All is well. + return; + } + } +} +#endif + +const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) +{ + p = SkipWhiteSpace( p, _encoding ); + // Find the beginning, find the end, and look for + // the stuff in-between. + TiXmlDocument* document = GetDocument(); + + if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); + } + + return 0; + } + + if ( data ) + { + data->Stamp( p, _encoding ); + location = data->Cursor(); + } + + p += 5; + + version = ""; + encoding = ""; + standalone = ""; + + while ( p && *p ) + { + if ( *p == '>' ) + { + ++p; + return p; + } + + p = SkipWhiteSpace( p, _encoding ); + + if ( StringEqual( p, "version", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + version = attrib.Value(); + } + else if ( StringEqual( p, "encoding", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + encoding = attrib.Value(); + } + else if ( StringEqual( p, "standalone", true, _encoding ) ) + { + TiXmlAttribute attrib; + p = attrib.Parse( p, data, _encoding ); + standalone = attrib.Value(); + } + else + { + // Read over whatever it is. + while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) + { + ++p; + } + } + } + + return 0; +} + +bool TiXmlText::Blank() const +{ + for ( unsigned i=0; iLoadFile()) + { + return false; + } + + //øԪ + m_pRootElement = m_pTiXmlDocument->RootElement(); + + return true; +} + +bool CXmlOpeation::Init_String(const char* pXMLText) +{ + //ַ + Close(); + m_pTiXmlDocument = new TiXmlDocument(); + m_pTiXmlDocument->Parse(pXMLText, 0, TIXML_DEFAULT_ENCODING); + + //øԪ + m_pRootElement = m_pTiXmlDocument->RootElement(); + + return true; +} + +void CXmlOpeation::Close() +{ + if(NULL != m_pTiXmlDocument) + { + delete m_pTiXmlDocument; + m_pTiXmlDocument = NULL; + m_pRootElement = NULL; + } +} + +char* CXmlOpeation::GetData(const char* pName, const char* pAttrName) +{ + if(m_pRootElement == NULL) + { + return NULL; + } + + TiXmlElement* pTiXmlElement = m_pRootElement->FirstChildElement(pName); + if(NULL != pTiXmlElement) + { + return (char* )pTiXmlElement->Attribute(pAttrName); + } + + return NULL; +} + +char* CXmlOpeation::GetData(const char* pName, const char* pAttrName, TiXmlElement*& pNextTiXmlElement) +{ + if(m_pRootElement == NULL) + { + return NULL; + } + + TiXmlElement* pTiXmlElement = NULL; + if(NULL == pNextTiXmlElement) + { + pTiXmlElement = m_pRootElement->FirstChildElement(pName); + pNextTiXmlElement = pTiXmlElement; + } + else + { + pTiXmlElement = pNextTiXmlElement->NextSiblingElement(); + pNextTiXmlElement = pTiXmlElement; + } + + if(NULL != pTiXmlElement) + { + return (char* )pTiXmlElement->Attribute(pAttrName); + } + + return NULL; +} + +char* CXmlOpeation::GetData_Text(const char* pName) +{ + if(m_pRootElement == NULL) + { + return NULL; + } + + TiXmlElement* pTiXmlElement = m_pRootElement->FirstChildElement(pName); + if(NULL != pTiXmlElement) + { + return (char* )pTiXmlElement->GetText(); + } + + return NULL; +} + +char* CXmlOpeation::GetData_Text(const char* pName, TiXmlElement*& pNextTiXmlElement) +{ + if(m_pRootElement == NULL) + { + return NULL; + } + + TiXmlElement* pTiXmlElement = NULL; + if(NULL == pNextTiXmlElement) + { + pTiXmlElement = m_pRootElement->FirstChildElement(pName); + pNextTiXmlElement = pTiXmlElement; + } + else + { + pTiXmlElement = pNextTiXmlElement->NextSiblingElement(); + pNextTiXmlElement = pTiXmlElement; + } + + if(NULL != pTiXmlElement) + { + return (char* )pTiXmlElement->GetText(); + } + + return NULL; +} + + + +bool CXmlOpeation::Parse_XML_Test_Assemble(const char* pFileName, _Test_Assemble& obj_Test_Assemble) +{ + Close(); + m_pTiXmlDocument = new TiXmlDocument(pFileName); + if(NULL == m_pTiXmlDocument) + { + return false; + } + + if(false == m_pTiXmlDocument->LoadFile()) + { + return false; + } + + TiXmlNode* pMainNode = NULL; + TiXmlNode* pSecondNode = NULL; + TiXmlNode* pThreeNode = NULL; + TiXmlNode* pColumnNode = NULL; + + //øԪ + m_pRootElement = m_pTiXmlDocument->RootElement(); + + if(NULL == m_pRootElement) + { + return false; + } + + //òԼϢ + sprintf_safe(obj_Test_Assemble.m_szTestAssembleName, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("Name")); + sprintf_safe(obj_Test_Assemble.m_szDesc, MAX_BUFF_100, "%s", (char* )m_pRootElement->Attribute("desc")); + sprintf_safe(obj_Test_Assemble.m_szIP, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("IP")); + sprintf_safe(obj_Test_Assemble.m_szOrder, MAX_BUFF_50, "%s", (char* )m_pRootElement->Attribute("ORDER")); + obj_Test_Assemble.m_nPort = atoi((char* )m_pRootElement->Attribute("Port")); + + //ѭȡԤϢ + for(pMainNode = m_pRootElement->FirstChildElement();pMainNode;pMainNode = pMainNode->NextSiblingElement()) + { + _Command_Info obj_Command_Info; + + int nMainType = pMainNode->Type(); + + if(nMainType != TiXmlText::TINYXML_ELEMENT) + { + continue; + } + + TiXmlElement* pMainElement = pMainNode->ToElement(); + sprintf_safe(obj_Command_Info.m_szCommandName, MAX_BUFF_50, "%s", (char* )pMainElement->Attribute("CommandName")); + obj_Command_Info.m_nCount = atoi((char* )pMainElement->Attribute("Count")); + obj_Command_Info.m_nTimeCost = atoi((char* )pMainElement->Attribute("TimeCost")); + if(pMainElement->Attribute("ThreadCount") != NULL) + { + obj_Command_Info.m_nThreadCount = atoi((char* )pMainElement->Attribute("ThreadCount")); + } + + for(pSecondNode = pMainElement->FirstChildElement();pSecondNode;pSecondNode = pSecondNode->NextSiblingElement()) + { + int nMainType = pMainNode->Type(); + + if(nMainType != TiXmlText::TINYXML_ELEMENT) + { + continue; + } + + TiXmlElement* pSecondElement = pSecondNode->ToElement(); + if(strcmp("Packet_Send", pSecondElement->Value()) == 0) + { + //ԪϢ + for(pThreeNode = pSecondElement->FirstChildElement();pThreeNode;pThreeNode = pThreeNode->NextSiblingElement()) + { + TiXmlElement* pThreeElement = pThreeNode->ToElement(); + _Data_Info obj_Data_Info; + sprintf_safe(obj_Data_Info.m_szDataType, MAX_BUFF_50, "%s", (char* )pThreeElement->Value()); + sprintf_safe(obj_Data_Info.m_szDataName, MAX_BUFF_50, "%s", (char* )pThreeElement->Attribute("name")); + if(NULL != pThreeElement->Attribute("length")) + { + obj_Data_Info.m_nLength = atoi((char* )pThreeElement->Attribute("length")); + } + if(NULL != pThreeElement->Attribute("IsString")) + { + if(strcmp("1", pThreeElement->Attribute("IsString")) == 0) + { + obj_Data_Info.m_blIsString = true; + } + else + { + obj_Data_Info.m_blIsString = false; + } + } + if(NULL != (char* )pThreeElement->GetText()) + { + obj_Data_Info.m_strValue = (string)pThreeElement->GetText(); + } + obj_Command_Info.m_obj_Packet_Send.m_obj_Data_Info_List.push_back(obj_Data_Info); + } + } + else if(strcmp("Packet_Recv", pSecondElement->Value()) == 0) + { + //ԪϢ + for(pThreeNode = pSecondElement->FirstChildElement();pThreeNode;pThreeNode = pThreeNode->NextSiblingElement()) + { + TiXmlElement* pThreeElement = pThreeNode->ToElement(); + _Data_Info obj_Data_Info; + sprintf_safe(obj_Data_Info.m_szDataType, MAX_BUFF_50, "%s", (char* )pThreeElement->Value()); + sprintf_safe(obj_Data_Info.m_szDataName, MAX_BUFF_50, "%s", (char* )pThreeElement->Attribute("name")); + if(NULL != pThreeElement->Attribute("length")) + { + obj_Data_Info.m_nLength = atoi((char* )pThreeElement->Attribute("length")); + } + if(NULL != pThreeElement->Attribute("IsString")) + { + if(strcmp("1", pThreeElement->Attribute("IsString")) == 0) + { + obj_Data_Info.m_blIsString = true; + } + else + { + obj_Data_Info.m_blIsString = false; + } + } + if(NULL != (char* )pThreeElement->GetText()) + { + obj_Data_Info.m_strValue = (string)((char* )pThreeElement->GetText()); + } + obj_Command_Info.m_obj_Packet_Recv.m_obj_Data_Info_List.push_back(obj_Data_Info); + } + } + } + + obj_Test_Assemble.m_obj_Command_Info_List.push_back(obj_Command_Info); + } + + delete m_pTiXmlDocument; + m_pTiXmlDocument = NULL; + return true; +} + +bool CXmlOpeation::Parse_Class_File(const char* pFileName, vecClassInfo& objvecClassInfo) +{ + Close(); + m_pTiXmlDocument = new TiXmlDocument(pFileName); + if(NULL == m_pTiXmlDocument) + { + return false; + } + + if(false == m_pTiXmlDocument->LoadFile()) + { + Close(); + return false; + } + + TiXmlNode* pMainNode = NULL; + //øԪ + m_pRootElement = m_pTiXmlDocument->RootElement(); + + //ѭӡÿһ + if(NULL == m_pRootElement) + { + return false; + } + + //øԪصԪ + for(pMainNode = m_pRootElement->FirstChildElement();pMainNode;pMainNode=pMainNode->NextSiblingElement()) + { + _Class_Info objClassInfo; + + int nMainType = pMainNode->Type(); + + if(nMainType != TiXmlText::TINYXML_ELEMENT) + { + continue; + } + + TiXmlElement* pMainElement = pMainNode->ToElement(); + + //Ԫص + sprintf_safe(objClassInfo.m_szXMLName, 60, pMainElement->Value()); + sprintf_safe(objClassInfo.m_szDesc, 100, "%s", pMainElement->Attribute("desc")); + + //printf("Root=%s.\n", m_pRootElement->Value()); + + TiXmlNode* pNode = NULL; + + for(pNode = pMainElement->FirstChildElement();pNode;pNode=pNode->NextSiblingElement()) + { + int nType = pNode->Type(); + if(nType == TiXmlText::TINYXML_ELEMENT) + { + //printf("Name=%s,Values=%s.\n", pNode->Value(), pNode->ToElement()->GetText()); + _Property objProperty; + sprintf_safe(objProperty.m_szPropertyName, 50, "%s", pNode->Value()); + if(strcmp(pNode->ToElement()->GetText(), "char") == 0) + { + objProperty.m_emType = PROPERTY_CHAR; + + //ͬʱַ󳤶 + char* pLength = (char* )pNode->ToElement()->Attribute("length"); + if(NULL != pLength) + { + objProperty.m_nLength = (int)atoi(pLength); + } + + //Streamָ + char* pStreamLength = (char* )pNode->ToElement()->Attribute("StreamLength"); + if(NULL != pStreamLength) + { + sprintf_safe(objProperty.m_szStreamLength, 10, "%s", pStreamLength); + } + } + else if(strcmp(pNode->ToElement()->GetText(), "string") == 0) + { + objProperty.m_emType = PROPERTY_STRING; + } + else if(strcmp(pNode->ToElement()->GetText(), "uint8") == 0) + { + objProperty.m_emType = PROPERTY_UINT8; + } + else if(strcmp(pNode->ToElement()->GetText(), "uint16") == 0) + { + objProperty.m_emType = PROPERTY_UINT16; + } + else if(strcmp(pNode->ToElement()->GetText(), "uint32") == 0) + { + objProperty.m_emType = PROPERTY_UINT32; + } + else if(strcmp(pNode->ToElement()->GetText(), "uint64") == 0) + { + objProperty.m_emType = PROPERTY_UINT64; + } + else if(strcmp(pNode->ToElement()->GetText(), "int8") == 0) + { + objProperty.m_emType = PROPERTY_INT8; + } + else if(strcmp(pNode->ToElement()->GetText(), "int16") == 0) + { + objProperty.m_emType = PROPERTY_INT16; + } + else if(strcmp(pNode->ToElement()->GetText(), "int32") == 0) + { + objProperty.m_emType = PROPERTY_INT32; + } + else if(strcmp(pNode->ToElement()->GetText(), "float32") == 0) + { + objProperty.m_emType = PROPERTY_FLOAT32; + } + else if(strcmp(pNode->ToElement()->GetText(), "float64") == 0) + { + objProperty.m_emType = PROPERTY_FLOAT64; + } + else + { + //ǻͣ + objProperty.m_emType = PROPERTY_UNKNOW; + sprintf_safe(objProperty.m_szClassName, 100, "%s", pNode->ToElement()->GetText()); + } + + //鿴 + if(NULL != pNode->ToElement()->Attribute("class")) + { + if(strcmp(pNode->ToElement()->Attribute("class"), "vector") == 0) + { + objProperty.m_emClass = CLASS_VECTOR; + } + else if(strcmp(pNode->ToElement()->Attribute("class"), "map") == 0) + { + objProperty.m_emClass = CLASS_MAP; + + //map 鿴keyNamekeyType + sprintf_safe(objProperty.m_szKeyName, 100, "%s", pNode->ToElement()->Attribute("keyName")); + + if(strcmp(pNode->ToElement()->Attribute("KeyClass"), "string") == 0) + { + objProperty.m_emKeyType = PROPERTY_STRING; + } + else if(strcmp(pNode->ToElement()->Attribute("KeyClass"), "uint16") == 0) + { + objProperty.m_emKeyType = PROPERTY_UINT16; + } + else if(strcmp(pNode->ToElement()->Attribute("KeyClass"), "uint32") == 0) + { + objProperty.m_emKeyType = PROPERTY_UINT32; + } + } + } + + //õϢ + sprintf_safe(objProperty.m_szDesc, 100, "%s", pNode->ToElement()->Attribute("desc")); + objClassInfo.m_vecProperty.push_back(objProperty); + } + } + + objvecClassInfo.push_back(objClassInfo); + } + + Close(); + return true; +} + +bool CXmlOpeation::Parse_Plug_In_Project(const char* pFileName, _Project_Info& objProjectInfo) +{ + Close(); + m_pTiXmlDocument = new TiXmlDocument(pFileName); + if(NULL == m_pTiXmlDocument) + { + return false; + } + + if(false == m_pTiXmlDocument->LoadFile()) + { + Close(); + return false; + } + + TiXmlNode* pMainNode = NULL; + //øԪ + m_pRootElement = m_pTiXmlDocument->RootElement(); + + //ѭӡÿһ + if(NULL == m_pRootElement) + { + return false; + } + + //ͷԪ + char* pName = (char* )m_pRootElement->Attribute("Name"); + if(NULL != pName) + { + sprintf_safe(objProjectInfo.m_szProjectName, 100, "%s", pName); + } + + char* pDesc = (char* )m_pRootElement->Attribute("desc"); + if(NULL != pDesc) + { + sprintf_safe(objProjectInfo.m_szProjectDesc, 200, "%s", pDesc); + } + + char* pKeyID = (char* )m_pRootElement->Attribute("keyID"); + if(NULL != pKeyID) + { + sprintf_safe(objProjectInfo.m_szProjectKey, 100, "%s", pKeyID); + } + + //е + TiXmlNode* pNode = NULL; + for(pNode = m_pRootElement->FirstChildElement();pNode;pNode=pNode->NextSiblingElement()) + { + TiXmlElement* pSecondElement = pNode->ToElement(); + if(strcmp(pSecondElement->Value(), "Define") == 0) + { + _Define_Info obj_Define_Info; + char* pTemp = (char* )pSecondElement->Attribute("DefName"); + if(NULL != pTemp) + { + sprintf_safe(obj_Define_Info.m_szDefineName, 100, "%s", pTemp); + } + pTemp = (char* )pSecondElement->Attribute("type"); + if(NULL != pTemp) + { + sprintf_safe(obj_Define_Info.m_szType, 20, "%s", pTemp); + } + pTemp = (char* )pSecondElement->Attribute("DefValue"); + if(NULL != pTemp) + { + sprintf_safe(obj_Define_Info.m_szDefineValue, 100, "%s", pTemp); + } + objProjectInfo.m_objDefineInfoList.push_back(obj_Define_Info); + } + else if(strcmp(pSecondElement->Value(), "Command") == 0) + { + _Command_Info_Func obj_Command_Info; + char* pTemp = (char* )pSecondElement->Attribute("CommandIn"); + if(NULL != pTemp) + { + sprintf_safe(obj_Command_Info.m_szCommandInID, 50, "%s", pTemp); + } + pTemp = (char* )pSecondElement->Attribute("CommandOut"); + if(NULL != pTemp) + { + sprintf_safe(obj_Command_Info.m_szCommandOutID, 50, "%s", pTemp); + } + pTemp = (char* )pSecondElement->Attribute("FuncName"); + if(NULL != pTemp) + { + sprintf_safe(obj_Command_Info.m_szCommandFuncName, 100, "%s", pTemp); + } + + TiXmlNode* pObjectNode = NULL; + for(pObjectNode = pSecondElement->FirstChildElement();pObjectNode;pObjectNode=pObjectNode->NextSiblingElement()) + { + _Object_Info obj_Object_Info; + TiXmlElement* pThreeElement = pObjectNode->ToElement(); + + pTemp = (char* )pThreeElement->Attribute("class"); + if(NULL != pTemp) + { + sprintf_safe(obj_Object_Info.m_szClassName, 50, "%s", pTemp); + } + pTemp = (char* )pThreeElement->Attribute("PacketType"); + if(NULL != pTemp) + { + if(strcmp(pTemp, "HEAD") == 0) + { + obj_Object_Info.m_emPacketType = PACKET_TYPE_HEAD; + } + else if(strcmp(pTemp, "BODY") == 0) + { + obj_Object_Info.m_emPacketType = PACKET_TYPE_BODY; + } + else if(strcmp(pTemp, "RETURN") == 0) + { + obj_Object_Info.m_emPacketType = PACKET_TYPE_RETURN; + } + } + + obj_Command_Info.m_vecObjectInfo.push_back(obj_Object_Info); + } + + objProjectInfo.m_objCommandList.push_back(obj_Command_Info); + } + } + + Close(); + return true; +} diff --git a/ThirdLib/include/XmlOpeation.h b/ThirdLib/include/XmlOpeation.h new file mode 100644 index 000000000..47afae097 --- /dev/null +++ b/ThirdLib/include/XmlOpeation.h @@ -0,0 +1,241 @@ +#ifndef _XMLOPRATION_H +#define _XMLOPRATION_H + +#include "tinyxml.h" +#include "tinystr.h" + +#include "Common.h" +#include +#include +#include +#include +#include +#include + +using namespace std; + +//XMLתΪMAPṹ +//add by freeeyes + +//֧ +enum PROPERTY_TYPE +{ + PROPERTY_UNKNOW, + PROPERTY_CHAR, + PROPERTY_STRING, + PROPERTY_UINT8, + PROPERTY_UINT16, + PROPERTY_UINT32, + PROPERTY_UINT64, + PROPERTY_INT8, + PROPERTY_INT16, + PROPERTY_INT32, + PROPERTY_FLOAT32, + PROPERTY_FLOAT64, +}; + +enum PROPERTY_CLASS +{ + CLASS_SINGLE, + CLASS_VECTOR, + CLASS_MAP, +}; + +enum COMMAND_TYPE +{ + COMMAND_NONE, + COMMAND_IN, + COMMAND_OUT, +}; + +enum STREAM_TYPE +{ + STREAM_TYPE_STRING = 0, + STREAM_TYPE_CHAR, + STREAM_TYPE_ALL, +}; + +enum PACKET_TYPE +{ + PACKET_TYPE_HEAD = 0, + PACKET_TYPE_BODY, + PACKET_TYPE_RETURN, +}; + +//õStream +struct _Stream_Type_Info +{ + STREAM_TYPE m_emType; + int m_nLength; + + _Stream_Type_Info() + { + m_emType = STREAM_TYPE_STRING; + m_nLength = 0; + } +}; + +//Ԥṹ +struct _Define_Info +{ + char m_szDefineName[100]; + char m_szType[20]; + char m_szDefineValue[100]; + + _Define_Info() + { + m_szDefineName[0] = '\0'; + m_szType[0] = '\0'; + m_szDefineValue[0] = '\0'; + } +}; +typedef vector<_Define_Info> vecDefineInfo; + + +//Ϣ +struct _Property +{ + char m_szPropertyName[50]; // + char m_szClassName[50]; // + char m_szDesc[100]; //Ϣ + char m_szStreamLength[10]; //ݳ + PROPERTY_TYPE m_emType; // + PROPERTY_CLASS m_emClass; // + int m_nLength; // + int m_nNeedHeadLength; //ǷҪԶ׷ݳ 0׷ӣ1׷ + char m_szKeyName[50]; //KeyName + PROPERTY_TYPE m_emKeyType; //key + + _Property() + { + m_szPropertyName[0] = '\0'; + m_szClassName[0] = '\0'; + m_szDesc[0] = '\0'; + m_szKeyName[0] = '\0'; + m_emType = PROPERTY_UNKNOW; + m_emKeyType = PROPERTY_UNKNOW; + m_emClass = CLASS_SINGLE; + m_nLength = 0; + m_nNeedHeadLength = 0; + + ::sprintf_safe(m_szStreamLength, 10, "0"); + } + + _Stream_Type_Info Get_Stream_Info() + { + _Stream_Type_Info obj_Stream_Type_Info; + if(strcmp(m_szStreamLength, "all") == 0) + { + obj_Stream_Type_Info.m_emType = STREAM_TYPE_ALL; + obj_Stream_Type_Info.m_nLength = 0; + return obj_Stream_Type_Info; + } + else + { + int n_Stream_Length = atoi(m_szStreamLength); + if(0 == n_Stream_Length) + { + obj_Stream_Type_Info.m_emType = STREAM_TYPE_STRING; + obj_Stream_Type_Info.m_nLength = 0; + return obj_Stream_Type_Info; + } + else + { + obj_Stream_Type_Info.m_emType = STREAM_TYPE_CHAR; + obj_Stream_Type_Info.m_nLength = n_Stream_Length; + return obj_Stream_Type_Info; + } + } + } +}; +typedef vector<_Property> vecProperty; + +//Ϣ +struct _Class_Info +{ + char m_szXMLName[60]; + char m_szDesc[100]; + vecProperty m_vecProperty; + + _Class_Info() + { + m_szXMLName[0] = '\0'; + m_szDesc[0] = '\0'; + } +}; +typedef vector<_Class_Info> vecClassInfo; + +struct _Object_Info +{ + char m_szClassName[50]; + PACKET_TYPE m_emPacketType; + + _Object_Info() + { + m_szClassName[0] = '\0'; + m_emPacketType = PACKET_TYPE_HEAD; + } +}; +typedef vector<_Object_Info> vecObjectInfo; + +struct _Command_Info_Func +{ + char m_szCommandFuncName[100]; + char m_szCommandInID[50]; + char m_szCommandOutID[50]; + + vecObjectInfo m_vecObjectInfo; + + _Command_Info_Func() + { + m_szCommandFuncName[0] = '\0'; + m_szCommandInID[0] = '\0'; + m_szCommandOutID[0] = '\0'; + } +}; +typedef vector<_Command_Info_Func> vecCommandRelationinfo; + +struct _Project_Info +{ + char m_szProjectName[100]; // + char m_szProjectDesc[200]; // + char m_szProjectKey[100]; //key + + vecCommandRelationinfo m_objCommandList; //ϵ + vecDefineInfo m_objDefineInfoList; //ԤϢ + + _Project_Info() + { + m_szProjectName[0] = '\0'; + m_szProjectDesc[0] = '\0'; + m_szProjectKey[0] = '\0'; + } +}; + +class CXmlOpeation +{ +public: + CXmlOpeation(void); + ~CXmlOpeation(void); + + bool Init(const char* pFileName); + bool Init_String(const char* pXMLText); + + char* GetData(const char* pName, const char* pAttrName); + char* GetData(const char* pName, const char* pAttrName, TiXmlElement*& pNextTiXmlElement); + + char* GetData_Text(const char* pName); + char* GetData_Text(const char* pName, TiXmlElement*& pNextTiXmlElement); + + bool Parse_XML_Test_Assemble(const char* pFileName, _Test_Assemble& obj_Test_Assemble); + + bool Parse_Class_File(const char* pFileName, vecClassInfo& objvecClassInfo); + bool Parse_Plug_In_Project(const char* pFileName, _Project_Info& objProjectInfo); + + void Close(); + +private: + TiXmlDocument* m_pTiXmlDocument; + TiXmlElement* m_pRootElement; +}; +#endif diff --git a/ThirdLib/src/TcpClientConnect.cpp b/ThirdLib/src/TcpClientConnect.cpp new file mode 100644 index 000000000..bc6d3b218 --- /dev/null +++ b/ThirdLib/src/TcpClientConnect.cpp @@ -0,0 +1,183 @@ +#include "TcpClientConnect.h" + +CTcpClientConnect::CTcpClientConnect(void) +{ +} + +CTcpClientConnect::~CTcpClientConnect(void) +{ +} + +void CTcpClientConnect::Init(const char* pIp, int nPort, const char* pKey) +{ + sprintf(m_szServerIP, "%s", pIp); + sprintf(m_szConsoleKey, "%s", pKey); + m_nServerPort = nPort; +} + +bool CTcpClientConnect::SendConsoleMessage(const char* pMessage, int nMessageLen, char* pRevBuff, int& nRecvLen) +{ + + char szBodyBuff[10 * 1024] = { '\0' }; + int nPacketLen = 0; + + //socket׼ + + char szSendData[500] = { '\0' }; + sprintf(szSendData, "b %s", pMessage); + int nSendDataLen = strlen(szSendData); + + struct sockaddr_in sockaddr; + HSocket sckClient = SocketOpen(SOCK_STREAM); + GetAddressFrom(&sockaddr,m_szServerIP, m_nServerPort); + + + + + //Զ̷ + int nErr = SocketConnect(sckClient, &sockaddr); + + if (0 != nErr) + { + SocketClose(sckClient); + return false; + } + + int nTotalRecvLen = nRecvLen; + int nTotalSendLen = nSendDataLen; + int nBeginSend = 0; + int nCurrSendLen = 0; + int nFinishRecv = 0; + bool blSendFlag = false; + + while (true) + { + transresult_t rt; + SocketSend(sckClient, szSendData + nBeginSend, nSendDataLen - nBeginSend, rt); + nCurrSendLen =rt.nbytes; + + if (nCurrSendLen <= 0) + { + SocketClose(sckClient); + return false; + } + else + { + nTotalSendLen -= nCurrSendLen; + + if (nTotalSendLen == 0) + { + // + blSendFlag = true; + break; + } + else + { + nBeginSend += nCurrSendLen; + } + } + } + + int nCurrRecvLen = 0; + int nBodyLen = 0; + + // + if (blSendFlag == true) + { + //Ƚֽͷ + char szHeadData[6] = { '\0' }; + int nHeadLen = sizeof(int) + sizeof(short); + + while (true) + { + transresult_t rt; + SocketRecv(sckClient, (char*)&szHeadData[nCurrRecvLen], nHeadLen - nCurrRecvLen, rt); + int nLen =rt.nbytes; + + if (nLen <= 0) + { + SocketClose(sckClient); + return false; + } + else + { + if (nLen + nCurrRecvLen >= nHeadLen) + { + break; + } + else + { + //δɣ + nCurrRecvLen += nLen; + } + } + } + + //ݰ + memcpy_s(&nBodyLen, sizeof(int), szHeadData, sizeof(int)); + + if (nBodyLen <= 0 || nBodyLen >= 1024 * 1024) + { + SocketClose(sckClient); + return false; + } + + //ȥͷ2ֽڵ CommandID + nBodyLen = nBodyLen - 2; + + //ʼ + nCurrRecvLen = 0; + + while (true) + { + transresult_t rt; + SocketRecv(sckClient, (char*)&szHeadData[nCurrRecvLen], nBodyLen - nCurrRecvLen, rt); + int nLen =rt.nbytes; + + if (nLen <= 0) + { + SocketClose(sckClient); + return false; + } + else + { + if (nLen + nCurrRecvLen >= nBodyLen) + { + break; + } + else + { + //δɣ + nCurrRecvLen += nLen; + } + } + } + + } + + memcpy_s(pRevBuff, nBodyLen, szBodyBuff, nBodyLen); + nRecvLen = nBodyLen; + + SocketClose(sckClient); + return true; +} + +char* CTcpClientConnect::GetKey() +{ + return m_szConsoleKey; +} + +char* CTcpClientConnect::GetServerIP() +{ + return m_szServerIP; +} + +int CTcpClientConnect::GetServerPort() +{ + return m_nServerPort; +} + +char* CTcpClientConnect::GetServerKey() +{ + return m_szConsoleKey; +} diff --git a/ThirdLib/src/TcpClientConnect.h b/ThirdLib/src/TcpClientConnect.h new file mode 100644 index 000000000..e77f03c54 --- /dev/null +++ b/ThirdLib/src/TcpClientConnect.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#if defined(_WIN32_PLATFORM_) +#include +#else +#include +#include +#include +#include +#include +#include +#endif + +#include + +#include "sock_wrap.h" +#include "macro.h" + +class CTcpClientConnect +{ +public: + CTcpClientConnect(void); + ~CTcpClientConnect(void); + + void Init(const char* pIp, int nPort, const char* pKey); + char* GetKey(); + + bool SendConsoleMessage(const char* pMessage, int nMessageLen, char* pRevBuff, int& nRecvLen); + + char* GetServerIP(); + int GetServerPort(); + char* GetServerKey(); + +private: + char m_szServerIP[20]; + int m_nServerPort; + char m_szConsoleKey[50]; +}; diff --git a/ThirdLib/thirdparty/LuaLib/Lua.vcproj b/ThirdLib/thirdparty/LuaLib/Lua.vcproj new file mode 100644 index 000000000..dac62f050 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/Lua.vcproj @@ -0,0 +1,439 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ThirdLib/thirdparty/LuaLib/Lua.vcproj.8.00.old b/ThirdLib/thirdparty/LuaLib/Lua.vcproj.8.00.old new file mode 100644 index 000000000..db7b9e500 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/Lua.vcproj.8.00.old @@ -0,0 +1,445 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ThirdLib/thirdparty/LuaLib/ReadMe.txt b/ThirdLib/thirdparty/LuaLib/ReadMe.txt new file mode 100644 index 000000000..5562c87a8 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/ReadMe.txt @@ -0,0 +1,19 @@ +======================================================================== +̬⣺Lua Ŀ +======================================================================== + +ӦóΪ˴ Lua Ŀ + +ûΪĿԴļ + + +Lua.vcproj +ʹӦóɵ VC++ ĿĿļ +ɸļ Visual C++ İ汾ϢԼйʹӦóѡƽ̨úĿܵϢ + +///////////////////////////////////////////////////////////////////////////// +עͣ + +ӦóʹáTODO:ָʾӦӻԶԴ벿֡ + +///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/ThirdLib/thirdparty/LuaLib/lapi.c b/ThirdLib/thirdparty/LuaLib/lapi.c new file mode 100644 index 000000000..5d5145d2e --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lapi.c @@ -0,0 +1,1087 @@ +/* +** $Id: lapi.c,v 2.55.1.5 2008/07/04 18:41:18 roberto Exp $ +** Lua API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define lapi_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" + + + +const char lua_ident[] = + "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n" + "$Authors: " LUA_AUTHORS " $\n" + "$URL: www.lua.org $\n"; + + + +#define api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base)) + +#define api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject) + +#define api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;} + + + +static TValue *index2adr (lua_State *L, int idx) { + if (idx > 0) { + TValue *o = L->base + (idx - 1); + api_check(L, idx <= L->ci->top - L->base); + if (o >= L->top) return cast(TValue *, luaO_nilobject); + else return o; + } + else if (idx > LUA_REGISTRYINDEX) { + api_check(L, idx != 0 && -idx <= L->top - L->base); + return L->top + idx; + } + else switch (idx) { /* pseudo-indices */ + case LUA_REGISTRYINDEX: return registry(L); + case LUA_ENVIRONINDEX: { + Closure *func = curr_func(L); + sethvalue(L, &L->env, func->c.env); + return &L->env; + } + case LUA_GLOBALSINDEX: return gt(L); + default: { + Closure *func = curr_func(L); + idx = LUA_GLOBALSINDEX - idx; + return (idx <= func->c.nupvalues) + ? &func->c.upvalue[idx-1] + : cast(TValue *, luaO_nilobject); + } + } +} + + +static Table *getcurrenv (lua_State *L) { + if (L->ci == L->base_ci) /* no enclosing function? */ + return hvalue(gt(L)); /* use global table as environment */ + else { + Closure *func = curr_func(L); + return func->c.env; + } +} + + +void luaA_pushobject (lua_State *L, const TValue *o) { + setobj2s(L, L->top, o); + api_incr_top(L); +} + + +LUA_API int lua_checkstack (lua_State *L, int size) { + int res = 1; + lua_lock(L); + if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) + res = 0; /* stack overflow */ + else if (size > 0) { + luaD_checkstack(L, size); + if (L->ci->top < L->top + size) + L->ci->top = L->top + size; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { + int i; + if (from == to) return; + lua_lock(to); + api_checknelems(from, n); + api_check(from, G(from) == G(to)); + api_check(from, to->ci->top - to->top >= n); + from->top -= n; + for (i = 0; i < n; i++) { + setobj2s(to, to->top++, from->top + i); + } + lua_unlock(to); +} + + +LUA_API void lua_setlevel (lua_State *from, lua_State *to) { + to->nCcalls = from->nCcalls; +} + + +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { + lua_CFunction old; + lua_lock(L); + old = G(L)->panic; + G(L)->panic = panicf; + lua_unlock(L); + return old; +} + + +LUA_API lua_State *lua_newthread (lua_State *L) { + lua_State *L1; + lua_lock(L); + luaC_checkGC(L); + L1 = luaE_newthread(L); + setthvalue(L, L->top, L1); + api_incr_top(L); + lua_unlock(L); + luai_userstatethread(L, L1); + return L1; +} + + + +/* +** basic stack manipulation +*/ + + +LUA_API int lua_gettop (lua_State *L) { + return cast_int(L->top - L->base); +} + + +LUA_API void lua_settop (lua_State *L, int idx) { + lua_lock(L); + if (idx >= 0) { + api_check(L, idx <= L->stack_last - L->base); + while (L->top < L->base + idx) + setnilvalue(L->top++); + L->top = L->base + idx; + } + else { + api_check(L, -(idx+1) <= (L->top - L->base)); + L->top += idx+1; /* `subtract' index (index is negative) */ + } + lua_unlock(L); +} + + +LUA_API void lua_remove (lua_State *L, int idx) { + StkId p; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + while (++p < L->top) setobjs2s(L, p-1, p); + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_insert (lua_State *L, int idx) { + StkId p; + StkId q; + lua_lock(L); + p = index2adr(L, idx); + api_checkvalidindex(L, p); + for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); + setobjs2s(L, p, L->top); + lua_unlock(L); +} + + +LUA_API void lua_replace (lua_State *L, int idx) { + StkId o; + lua_lock(L); + /* explicit test for incompatible code */ + if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) + luaG_runerror(L, "no calling environment"); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + if (idx == LUA_ENVIRONINDEX) { + Closure *func = curr_func(L); + api_check(L, ttistable(L->top - 1)); + func->c.env = hvalue(L->top - 1); + luaC_barrier(L, func, L->top - 1); + } + else { + setobj(L, o, L->top - 1); + if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ + luaC_barrier(L, curr_func(L), L->top - 1); + } + L->top--; + lua_unlock(L); +} + + +LUA_API void lua_pushvalue (lua_State *L, int idx) { + lua_lock(L); + setobj2s(L, L->top, index2adr(L, idx)); + api_incr_top(L); + lua_unlock(L); +} + + + +/* +** access functions (stack -> C) +*/ + + +LUA_API int lua_type (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); +} + + +LUA_API const char *lua_typename (lua_State *L, int t) { + UNUSED(L); + return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; +} + + +LUA_API int lua_iscfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return iscfunction(o); +} + + +LUA_API int lua_isnumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + return tonumber(o, &n); +} + + +LUA_API int lua_isstring (lua_State *L, int idx) { + int t = lua_type(L, idx); + return (t == LUA_TSTRING || t == LUA_TNUMBER); +} + + +LUA_API int lua_isuserdata (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return (ttisuserdata(o) || ttislightuserdata(o)); +} + + +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { + StkId o1 = index2adr(L, index1); + StkId o2 = index2adr(L, index2); + return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaO_rawequalObj(o1, o2); +} + + +LUA_API int lua_equal (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 : equalobj(L, o1, o2); + lua_unlock(L); + return i; +} + + +LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { + StkId o1, o2; + int i; + lua_lock(L); /* may call tag method */ + o1 = index2adr(L, index1); + o2 = index2adr(L, index2); + i = (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 + : luaV_lessthan(L, o1, o2); + lua_unlock(L); + return i; +} + + + +LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) + return nvalue(o); + else + return 0; +} + + +LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { + TValue n; + const TValue *o = index2adr(L, idx); + if (tonumber(o, &n)) { + lua_Integer res; + lua_Number num = nvalue(o); + lua_number2integer(res, num); + return res; + } + else + return 0; +} + + +LUA_API int lua_toboolean (lua_State *L, int idx) { + const TValue *o = index2adr(L, idx); + return !l_isfalse(o); +} + + +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { + StkId o = index2adr(L, idx); + if (!ttisstring(o)) { + lua_lock(L); /* `luaV_tostring' may create a new string */ + if (!luaV_tostring(L, o)) { /* conversion failed? */ + if (len != NULL) *len = 0; + lua_unlock(L); + return NULL; + } + luaC_checkGC(L); + o = index2adr(L, idx); /* previous call may reallocate the stack */ + lua_unlock(L); + } + if (len != NULL) *len = tsvalue(o)->len; + return svalue(o); +} + + +LUA_API size_t lua_objlen (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TSTRING: return tsvalue(o)->len; + case LUA_TUSERDATA: return uvalue(o)->len; + case LUA_TTABLE: return luaH_getn(hvalue(o)); + case LUA_TNUMBER: { + size_t l; + lua_lock(L); /* `luaV_tostring' may create a new string */ + l = (luaV_tostring(L, o) ? tsvalue(o)->len : 0); + lua_unlock(L); + return l; + } + default: return 0; + } +} + + +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; +} + + +LUA_API void *lua_touserdata (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TUSERDATA: return (rawuvalue(o) + 1); + case LUA_TLIGHTUSERDATA: return pvalue(o); + default: return NULL; + } +} + + +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + return (!ttisthread(o)) ? NULL : thvalue(o); +} + + +LUA_API const void *lua_topointer (lua_State *L, int idx) { + StkId o = index2adr(L, idx); + switch (ttype(o)) { + case LUA_TTABLE: return hvalue(o); + case LUA_TFUNCTION: return clvalue(o); + case LUA_TTHREAD: return thvalue(o); + case LUA_TUSERDATA: + case LUA_TLIGHTUSERDATA: + return lua_touserdata(L, idx); + default: return NULL; + } +} + + + +/* +** push functions (C -> stack) +*/ + + +LUA_API void lua_pushnil (lua_State *L) { + lua_lock(L); + setnilvalue(L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { + lua_lock(L); + setnvalue(L->top, n); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { + lua_lock(L); + setnvalue(L->top, cast_num(n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { + lua_lock(L); + luaC_checkGC(L); + setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushstring (lua_State *L, const char *s) { + if (s == NULL) + lua_pushnil(L); + else + lua_pushlstring(L, s, strlen(s)); +} + + +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, + va_list argp) { + const char *ret; + lua_lock(L); + luaC_checkGC(L); + ret = luaO_pushvfstring(L, fmt, argp); + lua_unlock(L); + return ret; +} + + +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { + const char *ret; + va_list argp; + lua_lock(L); + luaC_checkGC(L); + va_start(argp, fmt); + ret = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + lua_unlock(L); + return ret; +} + + +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { + Closure *cl; + lua_lock(L); + luaC_checkGC(L); + api_checknelems(L, n); + cl = luaF_newCclosure(L, n, getcurrenv(L)); + cl->c.f = fn; + L->top -= n; + while (n--) + setobj2n(L, &cl->c.upvalue[n], L->top+n); + setclvalue(L, L->top, cl); + lua_assert(iswhite(obj2gco(cl))); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushboolean (lua_State *L, int b) { + lua_lock(L); + setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { + lua_lock(L); + setpvalue(L->top, p); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_pushthread (lua_State *L) { + lua_lock(L); + setthvalue(L, L->top, L); + api_incr_top(L); + lua_unlock(L); + return (G(L)->mainthread == L); +} + + + +/* +** get functions (Lua -> stack) +*/ + + +LUA_API void lua_gettable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_gettable(L, t, L->top - 1, L->top - 1); + lua_unlock(L); +} + + +LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_gettable(L, t, &key, L->top); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_rawget (lua_State *L, int idx) { + StkId t; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); + lua_unlock(L); +} + + +LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { + lua_lock(L); + luaC_checkGC(L); + sethvalue(L, L->top, luaH_new(L, narray, nrec)); + api_incr_top(L); + lua_unlock(L); +} + + +LUA_API int lua_getmetatable (lua_State *L, int objindex) { + const TValue *obj; + Table *mt = NULL; + int res; + lua_lock(L); + obj = index2adr(L, objindex); + switch (ttype(obj)) { + case LUA_TTABLE: + mt = hvalue(obj)->metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(obj)->metatable; + break; + default: + mt = G(L)->mt[ttype(obj)]; + break; + } + if (mt == NULL) + res = 0; + else { + sethvalue(L, L->top, mt); + api_incr_top(L); + res = 1; + } + lua_unlock(L); + return res; +} + + +LUA_API void lua_getfenv (lua_State *L, int idx) { + StkId o; + lua_lock(L); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + switch (ttype(o)) { + case LUA_TFUNCTION: + sethvalue(L, L->top, clvalue(o)->c.env); + break; + case LUA_TUSERDATA: + sethvalue(L, L->top, uvalue(o)->env); + break; + case LUA_TTHREAD: + setobj2s(L, L->top, gt(thvalue(o))); + break; + default: + setnilvalue(L->top); + break; + } + api_incr_top(L); + lua_unlock(L); +} + + +/* +** set functions (stack -> Lua) +*/ + + +LUA_API void lua_settable (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + luaV_settable(L, t, L->top - 2, L->top - 1); + L->top -= 2; /* pop index and value */ + lua_unlock(L); +} + + +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { + StkId t; + TValue key; + lua_lock(L); + api_checknelems(L, 1); + t = index2adr(L, idx); + api_checkvalidindex(L, t); + setsvalue(L, &key, luaS_new(L, k)); + luaV_settable(L, t, &key, L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); +} + + +LUA_API void lua_rawset (lua_State *L, int idx) { + StkId t; + lua_lock(L); + api_checknelems(L, 2); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); + luaC_barriert(L, hvalue(t), L->top-1); + L->top -= 2; + lua_unlock(L); +} + + +LUA_API void lua_rawseti (lua_State *L, int idx, int n) { + StkId o; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_check(L, ttistable(o)); + setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); + luaC_barriert(L, hvalue(o), L->top-1); + L->top--; + lua_unlock(L); +} + + +LUA_API int lua_setmetatable (lua_State *L, int objindex) { + TValue *obj; + Table *mt; + lua_lock(L); + api_checknelems(L, 1); + obj = index2adr(L, objindex); + api_checkvalidindex(L, obj); + if (ttisnil(L->top - 1)) + mt = NULL; + else { + api_check(L, ttistable(L->top - 1)); + mt = hvalue(L->top - 1); + } + switch (ttype(obj)) { + case LUA_TTABLE: { + hvalue(obj)->metatable = mt; + if (mt) + luaC_objbarriert(L, hvalue(obj), mt); + break; + } + case LUA_TUSERDATA: { + uvalue(obj)->metatable = mt; + if (mt) + luaC_objbarrier(L, rawuvalue(obj), mt); + break; + } + default: { + G(L)->mt[ttype(obj)] = mt; + break; + } + } + L->top--; + lua_unlock(L); + return 1; +} + + +LUA_API int lua_setfenv (lua_State *L, int idx) { + StkId o; + int res = 1; + lua_lock(L); + api_checknelems(L, 1); + o = index2adr(L, idx); + api_checkvalidindex(L, o); + api_check(L, ttistable(L->top - 1)); + switch (ttype(o)) { + case LUA_TFUNCTION: + clvalue(o)->c.env = hvalue(L->top - 1); + break; + case LUA_TUSERDATA: + uvalue(o)->env = hvalue(L->top - 1); + break; + case LUA_TTHREAD: + sethvalue(L, gt(thvalue(o)), hvalue(L->top - 1)); + break; + default: + res = 0; + break; + } + if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); + L->top--; + lua_unlock(L); + return res; +} + + +/* +** `load' and `call' functions (run Lua code) +*/ + + +#define adjustresults(L,nres) \ + { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; } + + +#define checkresults(L,na,nr) \ + api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) + + +LUA_API void lua_call (lua_State *L, int nargs, int nresults) { + StkId func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + func = L->top - (nargs+1); + luaD_call(L, func, nresults); + adjustresults(L, nresults); + lua_unlock(L); +} + + + +/* +** Execute a protected call. +*/ +struct CallS { /* data to `f_call' */ + StkId func; + int nresults; +}; + + +static void f_call (lua_State *L, void *ud) { + struct CallS *c = cast(struct CallS *, ud); + luaD_call(L, c->func, c->nresults); +} + + + +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { + struct CallS c; + int status; + ptrdiff_t func; + lua_lock(L); + api_checknelems(L, nargs+1); + checkresults(L, nargs, nresults); + if (errfunc == 0) + func = 0; + else { + StkId o = index2adr(L, errfunc); + api_checkvalidindex(L, o); + func = savestack(L, o); + } + c.func = L->top - (nargs+1); /* function to be called */ + c.nresults = nresults; + status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); + adjustresults(L, nresults); + lua_unlock(L); + return status; +} + + +/* +** Execute a protected C call. +*/ +struct CCallS { /* data to `f_Ccall' */ + lua_CFunction func; + void *ud; +}; + + +static void f_Ccall (lua_State *L, void *ud) { + struct CCallS *c = cast(struct CCallS *, ud); + Closure *cl; + cl = luaF_newCclosure(L, 0, getcurrenv(L)); + cl->c.f = c->func; + setclvalue(L, L->top, cl); /* push function */ + api_incr_top(L); + setpvalue(L->top, c->ud); /* push only argument */ + api_incr_top(L); + luaD_call(L, L->top - 2, 0); +} + + +LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { + struct CCallS c; + int status; + lua_lock(L); + c.func = func; + c.ud = ud; + status = luaD_pcall(L, f_Ccall, &c, savestack(L, L->top), 0); + lua_unlock(L); + return status; +} + + +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, + const char *chunkname) { + ZIO z; + int status; + lua_lock(L); + if (!chunkname) chunkname = "?"; + luaZ_init(L, &z, reader, data); + status = luaD_protectedparser(L, &z, chunkname); + lua_unlock(L); + return status; +} + + +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { + int status; + TValue *o; + lua_lock(L); + api_checknelems(L, 1); + o = L->top - 1; + if (isLfunction(o)) + status = luaU_dump(L, clvalue(o)->l.p, writer, data, 0); + else + status = 1; + lua_unlock(L); + return status; +} + + +LUA_API int lua_status (lua_State *L) { + return L->status; +} + + +/* +** Garbage-collection function +*/ + +LUA_API int lua_gc (lua_State *L, int what, int data) { + int res = 0; + global_State *g; + lua_lock(L); + g = G(L); + switch (what) { + case LUA_GCSTOP: { + g->GCthreshold = MAX_LUMEM; + break; + } + case LUA_GCRESTART: { + g->GCthreshold = g->totalbytes; + break; + } + case LUA_GCCOLLECT: { + luaC_fullgc(L); + break; + } + case LUA_GCCOUNT: { + /* GC values are expressed in Kbytes: #bytes/2^10 */ + res = cast_int(g->totalbytes >> 10); + break; + } + case LUA_GCCOUNTB: { + res = cast_int(g->totalbytes & 0x3ff); + break; + } + case LUA_GCSTEP: { + lu_mem a = (cast(lu_mem, data) << 10); + if (a <= g->totalbytes) + g->GCthreshold = g->totalbytes - a; + else + g->GCthreshold = 0; + while (g->GCthreshold <= g->totalbytes) { + luaC_step(L); + if (g->gcstate == GCSpause) { /* end of cycle? */ + res = 1; /* signal it */ + break; + } + } + break; + } + case LUA_GCSETPAUSE: { + res = g->gcpause; + g->gcpause = data; + break; + } + case LUA_GCSETSTEPMUL: { + res = g->gcstepmul; + g->gcstepmul = data; + break; + } + default: res = -1; /* invalid option */ + } + lua_unlock(L); + return res; +} + + + +/* +** miscellaneous functions +*/ + + +LUA_API int lua_error (lua_State *L) { + lua_lock(L); + api_checknelems(L, 1); + luaG_errormsg(L); + lua_unlock(L); + return 0; /* to avoid warnings */ +} + + +LUA_API int lua_next (lua_State *L, int idx) { + StkId t; + int more; + lua_lock(L); + t = index2adr(L, idx); + api_check(L, ttistable(t)); + more = luaH_next(L, hvalue(t), L->top - 1); + if (more) { + api_incr_top(L); + } + else /* no more elements */ + L->top -= 1; /* remove key */ + lua_unlock(L); + return more; +} + + +LUA_API void lua_concat (lua_State *L, int n) { + lua_lock(L); + api_checknelems(L, n); + if (n >= 2) { + luaC_checkGC(L); + luaV_concat(L, n, cast_int(L->top - L->base) - 1); + L->top -= (n-1); + } + else if (n == 0) { /* push empty string */ + setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); + api_incr_top(L); + } + /* else n == 1; nothing to do */ + lua_unlock(L); +} + + +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { + lua_Alloc f; + lua_lock(L); + if (ud) *ud = G(L)->ud; + f = G(L)->frealloc; + lua_unlock(L); + return f; +} + + +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { + lua_lock(L); + G(L)->ud = ud; + G(L)->frealloc = f; + lua_unlock(L); +} + + +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { + Udata *u; + lua_lock(L); + luaC_checkGC(L); + u = luaS_newudata(L, size, getcurrenv(L)); + setuvalue(L, L->top, u); + api_incr_top(L); + lua_unlock(L); + return u + 1; +} + + + + +static const char *aux_upvalue (StkId fi, int n, TValue **val) { + Closure *f; + if (!ttisfunction(fi)) return NULL; + f = clvalue(fi); + if (f->c.isC) { + if (!(1 <= n && n <= f->c.nupvalues)) return NULL; + *val = &f->c.upvalue[n-1]; + return ""; + } + else { + Proto *p = f->l.p; + if (!(1 <= n && n <= p->sizeupvalues)) return NULL; + *val = f->l.upvals[n-1]->v; + return getstr(p->upvalues[n-1]); + } +} + + +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + lua_lock(L); + name = aux_upvalue(index2adr(L, funcindex), n, &val); + if (name) { + setobj2s(L, L->top, val); + api_incr_top(L); + } + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { + const char *name; + TValue *val; + StkId fi; + lua_lock(L); + fi = index2adr(L, funcindex); + api_checknelems(L, 1); + name = aux_upvalue(fi, n, &val); + if (name) { + L->top--; + setobj(L, val, L->top); + luaC_barrier(L, clvalue(fi), L->top); + } + lua_unlock(L); + return name; +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lapi.h b/ThirdLib/thirdparty/LuaLib/lapi.h similarity index 75% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lapi.h rename to ThirdLib/thirdparty/LuaLib/lapi.h index c4a0bab08..2c3fab244 100644 --- a/purenessscopeserver/example-Module/LuaTest/LuaBase/lapi.h +++ b/ThirdLib/thirdparty/LuaLib/lapi.h @@ -11,6 +11,6 @@ #include "lobject.h" -LUAI_FUNC void luaA_pushobject (lua_State* L, const TValue* o); +LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o); #endif diff --git a/ThirdLib/thirdparty/LuaLib/lauxlib.c b/ThirdLib/thirdparty/LuaLib/lauxlib.c new file mode 100644 index 000000000..10f14e2c0 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lauxlib.c @@ -0,0 +1,652 @@ +/* +** $Id: lauxlib.c,v 1.159.1.3 2008/01/21 13:20:51 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include +#include + + +/* This file uses only the official API of Lua. +** Any function declared here could be written as an application function. +*/ + +#define lauxlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" + + +#define FREELIST_REF 0 /* free list of references */ + + +/* convert a stack index to positive */ +#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : \ + lua_gettop(L) + (i) + 1) + + +/* +** {====================================================== +** Error-report functions +** ======================================================= +*/ + + +LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { + lua_Debug ar; + if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ + return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); + lua_getinfo(L, "n", &ar); + if (strcmp(ar.namewhat, "method") == 0) { + narg--; /* do not count `self' */ + if (narg == 0) /* error is in the self argument itself? */ + return luaL_error(L, "calling " LUA_QS " on bad self (%s)", + ar.name, extramsg); + } + if (ar.name == NULL) + ar.name = "?"; + return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)", + narg, ar.name, extramsg); +} + + +LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { + const char *msg = lua_pushfstring(L, "%s expected, got %s", + tname, luaL_typename(L, narg)); + return luaL_argerror(L, narg, msg); +} + + +static void tag_error (lua_State *L, int narg, int tag) { + luaL_typerror(L, narg, lua_typename(L, tag)); +} + + +LUALIB_API void luaL_where (lua_State *L, int level) { + lua_Debug ar; + if (lua_getstack(L, level, &ar)) { /* check function at level */ + lua_getinfo(L, "Sl", &ar); /* get info about it */ + if (ar.currentline > 0) { /* is there info? */ + lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); + return; + } + } + lua_pushliteral(L, ""); /* else, no information available... */ +} + + +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + luaL_where(L, 1); + lua_pushvfstring(L, fmt, argp); + va_end(argp); + lua_concat(L, 2); + return lua_error(L); +} + +/* }====================================================== */ + + +LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, + const char *const lst[]) { + const char *name = (def) ? luaL_optstring(L, narg, def) : + luaL_checkstring(L, narg); + int i; + for (i=0; lst[i]; i++) + if (strcmp(lst[i], name) == 0) + return i; + return luaL_argerror(L, narg, + lua_pushfstring(L, "invalid option " LUA_QS, name)); +} + + +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ + if (!lua_isnil(L, -1)) /* name already in use? */ + return 0; /* leave previous value on top, but return 0 */ + lua_pop(L, 1); + lua_newtable(L); /* create metatable */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ + return 1; +} + + +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { + void *p = lua_touserdata(L, ud); + if (p != NULL) { /* value is a userdata? */ + if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ + lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ + if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */ + lua_pop(L, 2); /* remove both metatables */ + return p; + } + } + } + luaL_typerror(L, ud, tname); /* else error */ + return NULL; /* to avoid warnings */ +} + + +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { + if (!lua_checkstack(L, space)) + luaL_error(L, "stack overflow (%s)", mes); +} + + +LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { + if (lua_type(L, narg) != t) + tag_error(L, narg, t); +} + + +LUALIB_API void luaL_checkany (lua_State *L, int narg) { + if (lua_type(L, narg) == LUA_TNONE) + luaL_argerror(L, narg, "value expected"); +} + + +LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { + const char *s = lua_tolstring(L, narg, len); + if (!s) tag_error(L, narg, LUA_TSTRING); + return s; +} + + +LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, + const char *def, size_t *len) { + if (lua_isnoneornil(L, narg)) { + if (len) + *len = (def ? strlen(def) : 0); + return def; + } + else return luaL_checklstring(L, narg, len); +} + + +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { + lua_Number d = lua_tonumber(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { + return luaL_opt(L, luaL_checknumber, narg, def); +} + + +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { + lua_Integer d = lua_tointeger(L, narg); + if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ + tag_error(L, narg, LUA_TNUMBER); + return d; +} + + +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, + lua_Integer def) { + return luaL_opt(L, luaL_checkinteger, narg, def); +} + + +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { + if (!lua_getmetatable(L, obj)) /* no metatable? */ + return 0; + lua_pushstring(L, event); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { + lua_pop(L, 2); /* remove metatable and metafield */ + return 0; + } + else { + lua_remove(L, -2); /* remove only metatable */ + return 1; + } +} + + +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { + obj = abs_index(L, obj); + if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ + return 0; + lua_pushvalue(L, obj); + lua_call(L, 1, 1); + return 1; +} + + +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l) { + luaI_openlib(L, libname, l, 0); +} + + +static int libsize (const luaL_Reg *l) { + int size = 0; + for (; l->name; l++) size++; + return size; +} + + +LUALIB_API void luaI_openlib (lua_State *L, const char *libname, + const luaL_Reg *l, int nup) { + if (libname) { + int size = libsize(l); + /* check whether lib already exists */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); + lua_getfield(L, -1, libname); /* get _LOADED[libname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, libname, size) != NULL) + luaL_error(L, "name conflict for module " LUA_QS, libname); + lua_pushvalue(L, -1); + lua_setfield(L, -3, libname); /* _LOADED[libname] = new table */ + } + lua_remove(L, -2); /* remove _LOADED table */ + lua_insert(L, -(nup+1)); /* move library table to below upvalues */ + } + for (; l->name; l++) { + int i; + for (i=0; ifunc, nup); + lua_setfield(L, -(nup+2), l->name); + } + lua_pop(L, nup); /* remove upvalues */ +} + + + +/* +** {====================================================== +** getn-setn: size for arrays +** ======================================================= +*/ + +#if defined(LUA_COMPAT_GETN) + +static int checkint (lua_State *L, int topop) { + int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; + lua_pop(L, topop); + return n; +} + + +static void getsizes (lua_State *L) { + lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); + if (lua_isnil(L, -1)) { /* no `size' table? */ + lua_pop(L, 1); /* remove nil */ + lua_newtable(L); /* create it */ + lua_pushvalue(L, -1); /* `size' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(N).__mode = "kv" */ + lua_pushvalue(L, -1); + lua_setfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); /* store in register */ + } +} + + +LUALIB_API void luaL_setn (lua_State *L, int t, int n) { + t = abs_index(L, t); + lua_pushliteral(L, "n"); + lua_rawget(L, t); + if (checkint(L, 1) >= 0) { /* is there a numeric field `n'? */ + lua_pushliteral(L, "n"); /* use it */ + lua_pushinteger(L, n); + lua_rawset(L, t); + } + else { /* use `sizes' */ + getsizes(L); + lua_pushvalue(L, t); + lua_pushinteger(L, n); + lua_rawset(L, -3); /* sizes[t] = n */ + lua_pop(L, 1); /* remove `sizes' */ + } +} + + +LUALIB_API int luaL_getn (lua_State *L, int t) { + int n; + t = abs_index(L, t); + lua_pushliteral(L, "n"); /* try t.n */ + lua_rawget(L, t); + if ((n = checkint(L, 1)) >= 0) return n; + getsizes(L); /* else try sizes[t] */ + lua_pushvalue(L, t); + lua_rawget(L, -2); + if ((n = checkint(L, 2)) >= 0) return n; + return (int)lua_objlen(L, t); +} + +#endif + +/* }====================================================== */ + + + +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, + const char *r) { + const char *wild; + size_t l = strlen(p); + luaL_Buffer b; + luaL_buffinit(L, &b); + while ((wild = strstr(s, p)) != NULL) { + luaL_addlstring(&b, s, wild - s); /* push prefix */ + luaL_addstring(&b, r); /* push replacement in place of pattern */ + s = wild + l; /* continue after `p' */ + } + luaL_addstring(&b, s); /* push last suffix */ + luaL_pushresult(&b); + return lua_tostring(L, -1); +} + + +LUALIB_API const char *luaL_findtable (lua_State *L, int idx, + const char *fname, int szhint) { + const char *e; + lua_pushvalue(L, idx); + do { + e = strchr(fname, '.'); + if (e == NULL) e = fname + strlen(fname); + lua_pushlstring(L, fname, e - fname); + lua_rawget(L, -2); + if (lua_isnil(L, -1)) { /* no such field? */ + lua_pop(L, 1); /* remove this nil */ + lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ + lua_pushlstring(L, fname, e - fname); + lua_pushvalue(L, -2); + lua_settable(L, -4); /* set new table into field */ + } + else if (!lua_istable(L, -1)) { /* field has a non-table value? */ + lua_pop(L, 2); /* remove table and value */ + return fname; /* return problematic part of the name */ + } + lua_remove(L, -2); /* remove previous table */ + fname = e + 1; + } while (*e == '.'); + return NULL; +} + + + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + +#define bufflen(B) ((B)->p - (B)->buffer) +#define bufffree(B) ((size_t)(LUAL_BUFFERSIZE - bufflen(B))) + +#define LIMIT (LUA_MINSTACK/2) + + +static int emptybuffer (luaL_Buffer *B) { + size_t l = bufflen(B); + if (l == 0) return 0; /* put nothing on stack */ + else { + lua_pushlstring(B->L, B->buffer, l); + B->p = B->buffer; + B->lvl++; + return 1; + } +} + + +static void adjuststack (luaL_Buffer *B) { + if (B->lvl > 1) { + lua_State *L = B->L; + int toget = 1; /* number of levels to concat */ + size_t toplen = lua_strlen(L, -1); + do { + size_t l = lua_strlen(L, -(toget+1)); + if (B->lvl - toget + 1 >= LIMIT || toplen > l) { + toplen += l; + toget++; + } + else break; + } while (toget < B->lvl); + lua_concat(L, toget); + B->lvl = B->lvl - toget + 1; + } +} + + +LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { + if (emptybuffer(B)) + adjuststack(B); + return B->buffer; +} + + +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { + while (l--) + luaL_addchar(B, *s++); +} + + +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { + luaL_addlstring(B, s, strlen(s)); +} + + +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { + emptybuffer(B); + lua_concat(B->L, B->lvl); + B->lvl = 1; +} + + +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { + lua_State *L = B->L; + size_t vl; + const char *s = lua_tolstring(L, -1, &vl); + if (vl <= bufffree(B)) { /* fit into buffer? */ + memcpy(B->p, s, vl); /* put it there */ + B->p += vl; + lua_pop(L, 1); /* remove from stack */ + } + else { + if (emptybuffer(B)) + lua_insert(L, -2); /* put buffer before new value */ + B->lvl++; /* add new value into B stack */ + adjuststack(B); + } +} + + +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { + B->L = L; + B->p = B->buffer; + B->lvl = 0; +} + +/* }====================================================== */ + + +LUALIB_API int luaL_ref (lua_State *L, int t) { + int ref; + t = abs_index(L, t); + if (lua_isnil(L, -1)) { + lua_pop(L, 1); /* remove from stack */ + return LUA_REFNIL; /* `nil' has a unique fixed reference */ + } + lua_rawgeti(L, t, FREELIST_REF); /* get first free element */ + ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */ + lua_pop(L, 1); /* remove it from stack */ + if (ref != 0) { /* any free element? */ + lua_rawgeti(L, t, ref); /* remove it from list */ + lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ + } + else { /* no free elements */ + ref = (int)lua_objlen(L, t); + ref++; /* create new reference */ + } + lua_rawseti(L, t, ref); + return ref; +} + + +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { + if (ref >= 0) { + t = abs_index(L, t); + lua_rawgeti(L, t, FREELIST_REF); + lua_rawseti(L, t, ref); /* t[ref] = t[FREELIST_REF] */ + lua_pushinteger(L, ref); + lua_rawseti(L, t, FREELIST_REF); /* t[FREELIST_REF] = ref */ + } +} + + + +/* +** {====================================================== +** Load functions +** ======================================================= +*/ + +typedef struct LoadF { + int extraline; + FILE *f; + char buff[LUAL_BUFFERSIZE]; +} LoadF; + + +static const char *getF (lua_State *L, void *ud, size_t *size) { + LoadF *lf = (LoadF *)ud; + (void)L; + if (lf->extraline) { + lf->extraline = 0; + *size = 1; + return "\n"; + } + if (feof(lf->f)) return NULL; + *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); + return (*size > 0) ? lf->buff : NULL; +} + + +static int errfile (lua_State *L, const char *what, int fnameindex) { + const char *serr = strerror(errno); + const char *filename = lua_tostring(L, fnameindex) + 1; + lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); + lua_remove(L, fnameindex); + return LUA_ERRFILE; +} + + +LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { + LoadF lf; + int status, readstatus; + int c; + int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ + lf.extraline = 0; + if (filename == NULL) { + lua_pushliteral(L, "=stdin"); + lf.f = stdin; + } + else { + lua_pushfstring(L, "@%s", filename); + lf.f = fopen(filename, "r"); + if (lf.f == NULL) return errfile(L, "open", fnameindex); + } + c = getc(lf.f); + if (c == '#') { /* Unix exec. file? */ + lf.extraline = 1; + while ((c = getc(lf.f)) != EOF && c != '\n') ; /* skip first line */ + if (c == '\n') c = getc(lf.f); + } + if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ + lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ + if (lf.f == NULL) return errfile(L, "reopen", fnameindex); + /* skip eventual `#!...' */ + while ((c = getc(lf.f)) != EOF && c != LUA_SIGNATURE[0]) ; + lf.extraline = 0; + } + ungetc(c, lf.f); + status = lua_load(L, getF, &lf, lua_tostring(L, -1)); + readstatus = ferror(lf.f); + if (filename) fclose(lf.f); /* close file (even in case of errors) */ + if (readstatus) { + lua_settop(L, fnameindex); /* ignore results from `lua_load' */ + return errfile(L, "read", fnameindex); + } + lua_remove(L, fnameindex); + return status; +} + + +typedef struct LoadS { + const char *s; + size_t size; +} LoadS; + + +static const char *getS (lua_State *L, void *ud, size_t *size) { + LoadS *ls = (LoadS *)ud; + (void)L; + if (ls->size == 0) return NULL; + *size = ls->size; + ls->size = 0; + return ls->s; +} + + +LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, + const char *name) { + LoadS ls; + ls.s = buff; + ls.size = size; + return lua_load(L, getS, &ls, name); +} + + +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) { + return luaL_loadbuffer(L, s, strlen(s), s); +} + + + +/* }====================================================== */ + + +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { + (void)ud; + (void)osize; + if (nsize == 0) { + free(ptr); + return NULL; + } + else + return realloc(ptr, nsize); +} + + +static int panic (lua_State *L) { + (void)L; /* to avoid warnings */ + fprintf(stderr, "PANIC: unprotected error in call to Lua API (%s)\n", + lua_tostring(L, -1)); + return 0; +} + + +LUALIB_API lua_State *luaL_newstate (void) { + lua_State *L = lua_newstate(l_alloc, NULL); + if (L) lua_atpanic(L, &panic); + return L; +} + diff --git a/ThirdLib/thirdparty/LuaLib/lauxlib.h b/ThirdLib/thirdparty/LuaLib/lauxlib.h new file mode 100644 index 000000000..34258235d --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lauxlib.h @@ -0,0 +1,174 @@ +/* +** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice in lua.h +*/ + + +#ifndef lauxlib_h +#define lauxlib_h + + +#include +#include + +#include "lua.h" + + +#if defined(LUA_COMPAT_GETN) +LUALIB_API int (luaL_getn) (lua_State *L, int t); +LUALIB_API void (luaL_setn) (lua_State *L, int t, int n); +#else +#define luaL_getn(L,i) ((int)lua_objlen(L, i)) +#define luaL_setn(L,i,j) ((void)0) /* no op! */ +#endif + +#if defined(LUA_COMPAT_OPENLIB) +#define luaI_openlib luaL_openlib +#endif + + +/* extra error code for `luaL_load' */ +#define LUA_ERRFILE (LUA_ERRERR+1) + + +typedef struct luaL_Reg { + const char *name; + lua_CFunction func; +} luaL_Reg; + + + +LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname, + const luaL_Reg *l, int nup); +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, + const luaL_Reg *l); +LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); +LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname); +LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg); +LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg, + size_t *l); +LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg, + const char *def, size_t *l); +LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg); +LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def); + +LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg); +LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg, + lua_Integer def); + +LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); +LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t); +LUALIB_API void (luaL_checkany) (lua_State *L, int narg); + +LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); +LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); + +LUALIB_API void (luaL_where) (lua_State *L, int lvl); +LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); + +LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def, + const char *const lst[]); + +LUALIB_API int (luaL_ref) (lua_State *L, int t); +LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); + +LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename); +LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz, + const char *name); +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); + +LUALIB_API lua_State *(luaL_newstate) (void); + + +LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, + const char *r); + +LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, + const char *fname, int szhint); + + + + +/* +** =============================================================== +** some useful macros +** =============================================================== +*/ + +#define luaL_argcheck(L, cond,numarg,extramsg) \ + ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) +#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) +#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) + +#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) + +#define luaL_dofile(L, fn) \ + (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_dostring(L, s) \ + (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) + +#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) + +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) + +/* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*/ + + + +typedef struct luaL_Buffer { + char *p; /* current position in buffer */ + int lvl; /* number of strings in the stack (level) */ + lua_State *L; + char buffer[LUAL_BUFFERSIZE]; +} luaL_Buffer; + +#define luaL_addchar(B,c) \ + ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ + (*(B)->p++ = (char)(c))) + +/* compatibility only */ +#define luaL_putchar(B,c) luaL_addchar(B,c) + +#define luaL_addsize(B,n) ((B)->p += (n)) + +LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); +LUALIB_API char *(luaL_prepbuffer) (luaL_Buffer *B); +LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); +LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); +LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); +LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); + + +/* }====================================================== */ + + +/* compatibility with ref system */ + +/* pre-defined references */ +#define LUA_NOREF (-2) +#define LUA_REFNIL (-1) + +#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ + (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) + +#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) + +#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) + + +#define luaL_reg luaL_Reg + +#endif + + diff --git a/ThirdLib/thirdparty/LuaLib/lbaselib.c b/ThirdLib/thirdparty/LuaLib/lbaselib.c new file mode 100644 index 000000000..2a4c079d3 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lbaselib.c @@ -0,0 +1,653 @@ +/* +** $Id: lbaselib.c,v 1.191.1.6 2008/02/14 16:46:22 roberto Exp $ +** Basic library +** See Copyright Notice in lua.h +*/ + + + +#include +#include +#include +#include + +#define lbaselib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + + +/* +** If your system does not support `stdout', you can just remove this function. +** If you need, you can define your own `print' function, following this +** model but changing `fputs' to put the strings at a proper place +** (a console window or a log file, for instance). +*/ +static int luaB_print (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + int i; + lua_getglobal(L, "tostring"); + for (i=1; i<=n; i++) { + const char *s; + lua_pushvalue(L, -1); /* function to be called */ + lua_pushvalue(L, i); /* value to print */ + lua_call(L, 1, 1); + s = lua_tostring(L, -1); /* get result */ + if (s == NULL) + return luaL_error(L, LUA_QL("tostring") " must return a string to " + LUA_QL("print")); + if (i>1) fputs("\t", stdout); + fputs(s, stdout); + lua_pop(L, 1); /* pop result */ + } + fputs("\n", stdout); + return 0; +} + + +static int luaB_tonumber (lua_State *L) { + int base = luaL_optint(L, 2, 10); + if (base == 10) { /* standard conversion */ + luaL_checkany(L, 1); + if (lua_isnumber(L, 1)) { + lua_pushnumber(L, lua_tonumber(L, 1)); + return 1; + } + } + else { + const char *s1 = luaL_checkstring(L, 1); + char *s2; + unsigned long n; + luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); + n = strtoul(s1, &s2, base); + if (s1 != s2) { /* at least one valid digit? */ + while (isspace((unsigned char)(*s2))) s2++; /* skip trailing spaces */ + if (*s2 == '\0') { /* no invalid trailing characters? */ + lua_pushnumber(L, (lua_Number)n); + return 1; + } + } + } + lua_pushnil(L); /* else not a number */ + return 1; +} + + +static int luaB_error (lua_State *L) { + int level = luaL_optint(L, 2, 1); + lua_settop(L, 1); + if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ + luaL_where(L, level); + lua_pushvalue(L, 1); + lua_concat(L, 2); + } + return lua_error(L); +} + + +static int luaB_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); + return 1; /* no metatable */ + } + luaL_getmetafield(L, 1, "__metatable"); + return 1; /* returns either __metatable field (if present) or metatable */ +} + + +static int luaB_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + if (luaL_getmetafield(L, 1, "__metatable")) + luaL_error(L, "cannot change a protected metatable"); + lua_settop(L, 2); + lua_setmetatable(L, 1); + return 1; +} + + +static void getfunc (lua_State *L, int opt) { + if (lua_isfunction(L, 1)) lua_pushvalue(L, 1); + else { + lua_Debug ar; + int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1); + luaL_argcheck(L, level >= 0, 1, "level must be non-negative"); + if (lua_getstack(L, level, &ar) == 0) + luaL_argerror(L, 1, "invalid level"); + lua_getinfo(L, "f", &ar); + if (lua_isnil(L, -1)) + luaL_error(L, "no function environment for tail call at level %d", + level); + } +} + + +static int luaB_getfenv (lua_State *L) { + getfunc(L, 1); + if (lua_iscfunction(L, -1)) /* is a C function? */ + lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */ + else + lua_getfenv(L, -1); + return 1; +} + + +static int luaB_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + getfunc(L, 0); + lua_pushvalue(L, 2); + if (lua_isnumber(L, 1) && lua_tonumber(L, 1) == 0) { + /* change environment of current thread */ + lua_pushthread(L); + lua_insert(L, -2); + lua_setfenv(L, -2); + return 0; + } + else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0) + luaL_error(L, + LUA_QL("setfenv") " cannot change environment of given object"); + return 1; +} + + +static int luaB_rawequal (lua_State *L) { + luaL_checkany(L, 1); + luaL_checkany(L, 2); + lua_pushboolean(L, lua_rawequal(L, 1, 2)); + return 1; +} + + +static int luaB_rawget (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_rawget(L, 1); + return 1; +} + +static int luaB_rawset (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checkany(L, 2); + luaL_checkany(L, 3); + lua_settop(L, 3); + lua_rawset(L, 1); + return 1; +} + + +static int luaB_gcinfo (lua_State *L) { + lua_pushinteger(L, lua_getgccount(L)); + return 1; +} + + +static int luaB_collectgarbage (lua_State *L) { + static const char *const opts[] = {"stop", "restart", "collect", + "count", "step", "setpause", "setstepmul", NULL}; + static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, + LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL}; + int o = luaL_checkoption(L, 1, "collect", opts); + int ex = luaL_optint(L, 2, 0); + int res = lua_gc(L, optsnum[o], ex); + switch (optsnum[o]) { + case LUA_GCCOUNT: { + int b = lua_gc(L, LUA_GCCOUNTB, 0); + lua_pushnumber(L, res + ((lua_Number)b/1024)); + return 1; + } + case LUA_GCSTEP: { + lua_pushboolean(L, res); + return 1; + } + default: { + lua_pushnumber(L, res); + return 1; + } + } +} + + +static int luaB_type (lua_State *L) { + luaL_checkany(L, 1); + lua_pushstring(L, luaL_typename(L, 1)); + return 1; +} + + +static int luaB_next (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 2); /* create a 2nd argument if there isn't one */ + if (lua_next(L, 1)) + return 2; + else { + lua_pushnil(L); + return 1; + } +} + + +static int luaB_pairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushnil(L); /* and initial value */ + return 3; +} + + +static int ipairsaux (lua_State *L) { + int i = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TTABLE); + i++; /* next value */ + lua_pushinteger(L, i); + lua_rawgeti(L, 1, i); + return (lua_isnil(L, -1)) ? 0 : 2; +} + + +static int luaB_ipairs (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ + lua_pushvalue(L, 1); /* state, */ + lua_pushinteger(L, 0); /* and initial value */ + return 3; +} + + +static int load_aux (lua_State *L, int status) { + if (status == 0) /* OK? */ + return 1; + else { + lua_pushnil(L); + lua_insert(L, -2); /* put before error message */ + return 2; /* return nil plus error message */ + } +} + + +static int luaB_loadstring (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + const char *chunkname = luaL_optstring(L, 2, s); + return load_aux(L, luaL_loadbuffer(L, s, l, chunkname)); +} + + +static int luaB_loadfile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + return load_aux(L, luaL_loadfile(L, fname)); +} + + +/* +** Reader for generic `load' function: `lua_load' uses the +** stack for internal stuff, so the reader cannot change the +** stack top. Instead, it keeps its resulting string in a +** reserved slot inside the stack. +*/ +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { + (void)ud; /* to avoid warnings */ + luaL_checkstack(L, 2, "too many nested functions"); + lua_pushvalue(L, 1); /* get function */ + lua_call(L, 0, 1); /* call it */ + if (lua_isnil(L, -1)) { + *size = 0; + return NULL; + } + else if (lua_isstring(L, -1)) { + lua_replace(L, 3); /* save string in a reserved stack slot */ + return lua_tolstring(L, 3, size); + } + else luaL_error(L, "reader function must return a string"); + return NULL; /* to avoid warnings */ +} + + +static int luaB_load (lua_State *L) { + int status; + const char *cname = luaL_optstring(L, 2, "=(load)"); + luaL_checktype(L, 1, LUA_TFUNCTION); + lua_settop(L, 3); /* function, eventual name, plus one reserved slot */ + status = lua_load(L, generic_reader, NULL, cname); + return load_aux(L, status); +} + + +static int luaB_dofile (lua_State *L) { + const char *fname = luaL_optstring(L, 1, NULL); + int n = lua_gettop(L); + if (luaL_loadfile(L, fname) != 0) lua_error(L); + lua_call(L, 0, LUA_MULTRET); + return lua_gettop(L) - n; +} + + +static int luaB_assert (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_toboolean(L, 1)) + return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); + return lua_gettop(L); +} + + +static int luaB_unpack (lua_State *L) { + int i, e, n; + luaL_checktype(L, 1, LUA_TTABLE); + i = luaL_optint(L, 2, 1); + e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1)); + if (i > e) return 0; /* empty range */ + n = e - i + 1; /* number of elements */ + if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */ + return luaL_error(L, "too many results to unpack"); + lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */ + while (i++ < e) /* push arg[i + 1...e] */ + lua_rawgeti(L, 1, i); + return n; +} + + +static int luaB_select (lua_State *L) { + int n = lua_gettop(L); + if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { + lua_pushinteger(L, n-1); + return 1; + } + else { + int i = luaL_checkint(L, 1); + if (i < 0) i = n + i; + else if (i > n) i = n; + luaL_argcheck(L, 1 <= i, 1, "index out of range"); + return n - i; + } +} + + +static int luaB_pcall (lua_State *L) { + int status; + luaL_checkany(L, 1); + status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0); + lua_pushboolean(L, (status == 0)); + lua_insert(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_xpcall (lua_State *L) { + int status; + luaL_checkany(L, 2); + lua_settop(L, 2); + lua_insert(L, 1); /* put error function under function to be called */ + status = lua_pcall(L, 0, LUA_MULTRET, 1); + lua_pushboolean(L, (status == 0)); + lua_replace(L, 1); + return lua_gettop(L); /* return status + all results */ +} + + +static int luaB_tostring (lua_State *L) { + luaL_checkany(L, 1); + if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ + return 1; /* use its value */ + switch (lua_type(L, 1)) { + case LUA_TNUMBER: + lua_pushstring(L, lua_tostring(L, 1)); + break; + case LUA_TSTRING: + lua_pushvalue(L, 1); + break; + case LUA_TBOOLEAN: + lua_pushstring(L, (lua_toboolean(L, 1) ? "true" : "false")); + break; + case LUA_TNIL: + lua_pushliteral(L, "nil"); + break; + default: + lua_pushfstring(L, "%s: %p", luaL_typename(L, 1), lua_topointer(L, 1)); + break; + } + return 1; +} + + +static int luaB_newproxy (lua_State *L) { + lua_settop(L, 1); + lua_newuserdata(L, 0); /* create proxy */ + if (lua_toboolean(L, 1) == 0) + return 1; /* no metatable */ + else if (lua_isboolean(L, 1)) { + lua_newtable(L); /* create a new metatable `m' ... */ + lua_pushvalue(L, -1); /* ... and mark `m' as a valid metatable */ + lua_pushboolean(L, 1); + lua_rawset(L, lua_upvalueindex(1)); /* weaktable[m] = true */ + } + else { + int validproxy = 0; /* to check if weaktable[metatable(u)] == true */ + if (lua_getmetatable(L, 1)) { + lua_rawget(L, lua_upvalueindex(1)); + validproxy = lua_toboolean(L, -1); + lua_pop(L, 1); /* remove value */ + } + luaL_argcheck(L, validproxy, 1, "boolean or proxy expected"); + lua_getmetatable(L, 1); /* metatable is valid; get it */ + } + lua_setmetatable(L, 2); + return 1; +} + + +static const luaL_Reg base_funcs[] = { + {"assert", luaB_assert}, + {"collectgarbage", luaB_collectgarbage}, + {"dofile", luaB_dofile}, + {"error", luaB_error}, + {"gcinfo", luaB_gcinfo}, + {"getfenv", luaB_getfenv}, + {"getmetatable", luaB_getmetatable}, + {"loadfile", luaB_loadfile}, + {"load", luaB_load}, + {"loadstring", luaB_loadstring}, + {"next", luaB_next}, + {"pcall", luaB_pcall}, + {"print", luaB_print}, + {"rawequal", luaB_rawequal}, + {"rawget", luaB_rawget}, + {"rawset", luaB_rawset}, + {"select", luaB_select}, + {"setfenv", luaB_setfenv}, + {"setmetatable", luaB_setmetatable}, + {"tonumber", luaB_tonumber}, + {"tostring", luaB_tostring}, + {"type", luaB_type}, + {"unpack", luaB_unpack}, + {"xpcall", luaB_xpcall}, + {NULL, NULL} +}; + + +/* +** {====================================================== +** Coroutine library +** ======================================================= +*/ + +#define CO_RUN 0 /* running */ +#define CO_SUS 1 /* suspended */ +#define CO_NOR 2 /* 'normal' (it resumed another coroutine) */ +#define CO_DEAD 3 + +static const char *const statnames[] = + {"running", "suspended", "normal", "dead"}; + +static int costatus (lua_State *L, lua_State *co) { + if (L == co) return CO_RUN; + switch (lua_status(co)) { + case LUA_YIELD: + return CO_SUS; + case 0: { + lua_Debug ar; + if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ + return CO_NOR; /* it is running */ + else if (lua_gettop(co) == 0) + return CO_DEAD; + else + return CO_SUS; /* initial state */ + } + default: /* some error occured */ + return CO_DEAD; + } +} + + +static int luaB_costatus (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + luaL_argcheck(L, co, 1, "coroutine expected"); + lua_pushstring(L, statnames[costatus(L, co)]); + return 1; +} + + +static int auxresume (lua_State *L, lua_State *co, int narg) { + int status = costatus(L, co); + if (!lua_checkstack(co, narg)) + luaL_error(L, "too many arguments to resume"); + if (status != CO_SUS) { + lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]); + return -1; /* error flag */ + } + lua_xmove(L, co, narg); + lua_setlevel(L, co); + status = lua_resume(co, narg); + if (status == 0 || status == LUA_YIELD) { + int nres = lua_gettop(co); + if (!lua_checkstack(L, nres + 1)) + luaL_error(L, "too many results to resume"); + lua_xmove(co, L, nres); /* move yielded values */ + return nres; + } + else { + lua_xmove(co, L, 1); /* move error message */ + return -1; /* error flag */ + } +} + + +static int luaB_coresume (lua_State *L) { + lua_State *co = lua_tothread(L, 1); + int r; + luaL_argcheck(L, co, 1, "coroutine expected"); + r = auxresume(L, co, lua_gettop(L) - 1); + if (r < 0) { + lua_pushboolean(L, 0); + lua_insert(L, -2); + return 2; /* return false + error message */ + } + else { + lua_pushboolean(L, 1); + lua_insert(L, -(r + 1)); + return r + 1; /* return true + `resume' returns */ + } +} + + +static int luaB_auxwrap (lua_State *L) { + lua_State *co = lua_tothread(L, lua_upvalueindex(1)); + int r = auxresume(L, co, lua_gettop(L)); + if (r < 0) { + if (lua_isstring(L, -1)) { /* error object is a string? */ + luaL_where(L, 1); /* add extra info */ + lua_insert(L, -2); + lua_concat(L, 2); + } + lua_error(L); /* propagate error */ + } + return r; +} + + +static int luaB_cocreate (lua_State *L) { + lua_State *NL = lua_newthread(L); + luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1, + "Lua function expected"); + lua_pushvalue(L, 1); /* move function to top */ + lua_xmove(L, NL, 1); /* move function from L to NL */ + return 1; +} + + +static int luaB_cowrap (lua_State *L) { + luaB_cocreate(L); + lua_pushcclosure(L, luaB_auxwrap, 1); + return 1; +} + + +static int luaB_yield (lua_State *L) { + return lua_yield(L, lua_gettop(L)); +} + + +static int luaB_corunning (lua_State *L) { + if (lua_pushthread(L)) + lua_pushnil(L); /* main thread is not a coroutine */ + return 1; +} + + +static const luaL_Reg co_funcs[] = { + {"create", luaB_cocreate}, + {"resume", luaB_coresume}, + {"running", luaB_corunning}, + {"status", luaB_costatus}, + {"wrap", luaB_cowrap}, + {"yield", luaB_yield}, + {NULL, NULL} +}; + +/* }====================================================== */ + + +static void auxopen (lua_State *L, const char *name, + lua_CFunction f, lua_CFunction u) { + lua_pushcfunction(L, u); + lua_pushcclosure(L, f, 1); + lua_setfield(L, -2, name); +} + + +static void base_open (lua_State *L) { + /* set global _G */ + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setglobal(L, "_G"); + /* open lib into global table */ + luaL_register(L, "_G", base_funcs); + lua_pushliteral(L, LUA_VERSION); + lua_setglobal(L, "_VERSION"); /* set global _VERSION */ + /* `ipairs' and `pairs' need auxliliary functions as upvalues */ + auxopen(L, "ipairs", luaB_ipairs, ipairsaux); + auxopen(L, "pairs", luaB_pairs, luaB_next); + /* `newproxy' needs a weaktable as upvalue */ + lua_createtable(L, 0, 1); /* new table `w' */ + lua_pushvalue(L, -1); /* `w' will be its own metatable */ + lua_setmetatable(L, -2); + lua_pushliteral(L, "kv"); + lua_setfield(L, -2, "__mode"); /* metatable(w).__mode = "kv" */ + lua_pushcclosure(L, luaB_newproxy, 1); + lua_setglobal(L, "newproxy"); /* set global `newproxy' */ +} + + +LUALIB_API int luaopen_base (lua_State *L) { + base_open(L); + luaL_register(L, LUA_COLIBNAME, co_funcs); + return 2; +} + diff --git a/ThirdLib/thirdparty/LuaLib/lcode.c b/ThirdLib/thirdparty/LuaLib/lcode.c new file mode 100644 index 000000000..cff626b7f --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lcode.c @@ -0,0 +1,839 @@ +/* +** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + + +#include + +#define lcode_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "ltable.h" + + +#define hasjumps(e) ((e)->t != (e)->f) + + +static int isnumeral(expdesc *e) { + return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); +} + + +void luaK_nil (FuncState *fs, int from, int n) { + Instruction *previous; + if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ + if (fs->pc == 0) { /* function start? */ + if (from >= fs->nactvar) + return; /* positions are already clean */ + } + else { + previous = &fs->f->code[fs->pc-1]; + if (GET_OPCODE(*previous) == OP_LOADNIL) { + int pfrom = GETARG_A(*previous); + int pto = GETARG_B(*previous); + if (pfrom <= from && from <= pto+1) { /* can connect both? */ + if (from+n-1 > pto) + SETARG_B(*previous, from+n-1); + return; + } + } + } + } + luaK_codeABC(fs, OP_LOADNIL, from, from+n-1, 0); /* else no optimization */ +} + + +int luaK_jump (FuncState *fs) { + int jpc = fs->jpc; /* save list of jumps to here */ + int j; + fs->jpc = NO_JUMP; + j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); + luaK_concat(fs, &j, jpc); /* keep them on hold */ + return j; +} + + +void luaK_ret (FuncState *fs, int first, int nret) { + luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); +} + + +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { + luaK_codeABC(fs, op, A, B, C); + return luaK_jump(fs); +} + + +static void fixjump (FuncState *fs, int pc, int dest) { + Instruction *jmp = &fs->f->code[pc]; + int offset = dest-(pc+1); + lua_assert(dest != NO_JUMP); + if (abs(offset) > MAXARG_sBx) + luaX_syntaxerror(fs->ls, "control structure too long"); + SETARG_sBx(*jmp, offset); +} + + +/* +** returns current `pc' and marks it as a jump target (to avoid wrong +** optimizations with consecutive instructions not in the same basic block). +*/ +int luaK_getlabel (FuncState *fs) { + fs->lasttarget = fs->pc; + return fs->pc; +} + + +static int getjump (FuncState *fs, int pc) { + int offset = GETARG_sBx(fs->f->code[pc]); + if (offset == NO_JUMP) /* point to itself represents end of list */ + return NO_JUMP; /* end of list */ + else + return (pc+1)+offset; /* turn offset into absolute position */ +} + + +static Instruction *getjumpcontrol (FuncState *fs, int pc) { + Instruction *pi = &fs->f->code[pc]; + if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) + return pi-1; + else + return pi; +} + + +/* +** check whether list has any jump that do not produce a value +** (or produce an inverted value) +*/ +static int need_value (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) { + Instruction i = *getjumpcontrol(fs, list); + if (GET_OPCODE(i) != OP_TESTSET) return 1; + } + return 0; /* not found */ +} + + +static int patchtestreg (FuncState *fs, int node, int reg) { + Instruction *i = getjumpcontrol(fs, node); + if (GET_OPCODE(*i) != OP_TESTSET) + return 0; /* cannot patch other instructions */ + if (reg != NO_REG && reg != GETARG_B(*i)) + SETARG_A(*i, reg); + else /* no register to put value or register already has the value */ + *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); + + return 1; +} + + +static void removevalues (FuncState *fs, int list) { + for (; list != NO_JUMP; list = getjump(fs, list)) + patchtestreg(fs, list, NO_REG); +} + + +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, + int dtarget) { + while (list != NO_JUMP) { + int next = getjump(fs, list); + if (patchtestreg(fs, list, reg)) + fixjump(fs, list, vtarget); + else + fixjump(fs, list, dtarget); /* jump to default target */ + list = next; + } +} + + +static void dischargejpc (FuncState *fs) { + patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); + fs->jpc = NO_JUMP; +} + + +void luaK_patchlist (FuncState *fs, int list, int target) { + if (target == fs->pc) + luaK_patchtohere(fs, list); + else { + lua_assert(target < fs->pc); + patchlistaux(fs, list, target, NO_REG, target); + } +} + + +void luaK_patchtohere (FuncState *fs, int list) { + luaK_getlabel(fs); + luaK_concat(fs, &fs->jpc, list); +} + + +void luaK_concat (FuncState *fs, int *l1, int l2) { + if (l2 == NO_JUMP) return; + else if (*l1 == NO_JUMP) + *l1 = l2; + else { + int list = *l1; + int next; + while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ + list = next; + fixjump(fs, list, l2); + } +} + + +void luaK_checkstack (FuncState *fs, int n) { + int newstack = fs->freereg + n; + if (newstack > fs->f->maxstacksize) { + if (newstack >= MAXSTACK) + luaX_syntaxerror(fs->ls, "function or expression too complex"); + fs->f->maxstacksize = cast_byte(newstack); + } +} + + +void luaK_reserveregs (FuncState *fs, int n) { + luaK_checkstack(fs, n); + fs->freereg += n; +} + + +static void freereg (FuncState *fs, int reg) { + if (!ISK(reg) && reg >= fs->nactvar) { + fs->freereg--; + lua_assert(reg == fs->freereg); + } +} + + +static void freeexp (FuncState *fs, expdesc *e) { + if (e->k == VNONRELOC) + freereg(fs, e->u.s.info); +} + + +static int addk (FuncState *fs, TValue *k, TValue *v) { + lua_State *L = fs->L; + TValue *idx = luaH_set(L, fs->h, k); + Proto *f = fs->f; + int oldsize = f->sizek; + if (ttisnumber(idx)) { + lua_assert(luaO_rawequalObj(&fs->f->k[cast_int(nvalue(idx))], v)); + return cast_int(nvalue(idx)); + } + else { /* constant not found; create a new entry */ + setnvalue(idx, cast_num(fs->nk)); + luaM_growvector(L, f->k, fs->nk, f->sizek, TValue, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); + setobj(L, &f->k[fs->nk], v); + luaC_barrier(L, f, v); + return fs->nk++; + } +} + + +int luaK_stringK (FuncState *fs, TString *s) { + TValue o; + setsvalue(fs->L, &o, s); + return addk(fs, &o, &o); +} + + +int luaK_numberK (FuncState *fs, lua_Number r) { + TValue o; + setnvalue(&o, r); + return addk(fs, &o, &o); +} + + +static int boolK (FuncState *fs, int b) { + TValue o; + setbvalue(&o, b); + return addk(fs, &o, &o); +} + + +static int nilK (FuncState *fs) { + TValue k, v; + setnilvalue(&v); + /* cannot use nil as key; instead use table itself to represent nil */ + sethvalue(fs->L, &k, fs->h); + return addk(fs, &k, &v); +} + + +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { + if (e->k == VCALL) { /* expression is an open function call? */ + SETARG_C(getcode(fs, e), nresults+1); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), nresults+1); + SETARG_A(getcode(fs, e), fs->freereg); + luaK_reserveregs(fs, 1); + } +} + + +void luaK_setoneret (FuncState *fs, expdesc *e) { + if (e->k == VCALL) { /* expression is an open function call? */ + e->k = VNONRELOC; + e->u.s.info = GETARG_A(getcode(fs, e)); + } + else if (e->k == VVARARG) { + SETARG_B(getcode(fs, e), 2); + e->k = VRELOCABLE; /* can relocate its simple result */ + } +} + + +void luaK_dischargevars (FuncState *fs, expdesc *e) { + switch (e->k) { + case VLOCAL: { + e->k = VNONRELOC; + break; + } + case VUPVAL: { + e->u.s.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + case VGLOBAL: { + e->u.s.info = luaK_codeABx(fs, OP_GETGLOBAL, 0, e->u.s.info); + e->k = VRELOCABLE; + break; + } + case VINDEXED: { + freereg(fs, e->u.s.aux); + freereg(fs, e->u.s.info); + e->u.s.info = luaK_codeABC(fs, OP_GETTABLE, 0, e->u.s.info, e->u.s.aux); + e->k = VRELOCABLE; + break; + } + case VVARARG: + case VCALL: { + luaK_setoneret(fs, e); + break; + } + default: break; /* there is one value available (somewhere) */ + } +} + + +static int code_label (FuncState *fs, int A, int b, int jump) { + luaK_getlabel(fs); /* those instructions may be jump targets */ + return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); +} + + +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: { + luaK_nil(fs, reg, 1); + break; + } + case VFALSE: case VTRUE: { + luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); + break; + } + case VK: { + luaK_codeABx(fs, OP_LOADK, reg, e->u.s.info); + break; + } + case VKNUM: { + luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval)); + break; + } + case VRELOCABLE: { + Instruction *pc = &getcode(fs, e); + SETARG_A(*pc, reg); + break; + } + case VNONRELOC: { + if (reg != e->u.s.info) + luaK_codeABC(fs, OP_MOVE, reg, e->u.s.info, 0); + break; + } + default: { + lua_assert(e->k == VVOID || e->k == VJMP); + return; /* nothing to do... */ + } + } + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +static void discharge2anyreg (FuncState *fs, expdesc *e) { + if (e->k != VNONRELOC) { + luaK_reserveregs(fs, 1); + discharge2reg(fs, e, fs->freereg-1); + } +} + + +static void exp2reg (FuncState *fs, expdesc *e, int reg) { + discharge2reg(fs, e, reg); + if (e->k == VJMP) + luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ + if (hasjumps(e)) { + int final; /* position after whole expression */ + int p_f = NO_JUMP; /* position of an eventual LOAD false */ + int p_t = NO_JUMP; /* position of an eventual LOAD true */ + if (need_value(fs, e->t) || need_value(fs, e->f)) { + int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); + p_f = code_label(fs, reg, 0, 1); + p_t = code_label(fs, reg, 1, 0); + luaK_patchtohere(fs, fj); + } + final = luaK_getlabel(fs); + patchlistaux(fs, e->f, final, reg, p_f); + patchlistaux(fs, e->t, final, reg, p_t); + } + e->f = e->t = NO_JUMP; + e->u.s.info = reg; + e->k = VNONRELOC; +} + + +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + freeexp(fs, e); + luaK_reserveregs(fs, 1); + exp2reg(fs, e, fs->freereg - 1); +} + + +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + if (e->k == VNONRELOC) { + if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */ + if (e->u.s.info >= fs->nactvar) { /* reg. is not a local? */ + exp2reg(fs, e, e->u.s.info); /* put value on it */ + return e->u.s.info; + } + } + luaK_exp2nextreg(fs, e); /* default */ + return e->u.s.info; +} + + +void luaK_exp2val (FuncState *fs, expdesc *e) { + if (hasjumps(e)) + luaK_exp2anyreg(fs, e); + else + luaK_dischargevars(fs, e); +} + + +int luaK_exp2RK (FuncState *fs, expdesc *e) { + luaK_exp2val(fs, e); + switch (e->k) { + case VKNUM: + case VTRUE: + case VFALSE: + case VNIL: { + if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */ + e->u.s.info = (e->k == VNIL) ? nilK(fs) : + (e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) : + boolK(fs, (e->k == VTRUE)); + e->k = VK; + return RKASK(e->u.s.info); + } + else break; + } + case VK: { + if (e->u.s.info <= MAXINDEXRK) /* constant fit in argC? */ + return RKASK(e->u.s.info); + else break; + } + default: break; + } + /* not a constant in the right range: put it in a register */ + return luaK_exp2anyreg(fs, e); +} + + +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { + switch (var->k) { + case VLOCAL: { + freeexp(fs, ex); + exp2reg(fs, ex, var->u.s.info); + return; + } + case VUPVAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABC(fs, OP_SETUPVAL, e, var->u.s.info, 0); + break; + } + case VGLOBAL: { + int e = luaK_exp2anyreg(fs, ex); + luaK_codeABx(fs, OP_SETGLOBAL, e, var->u.s.info); + break; + } + case VINDEXED: { + int e = luaK_exp2RK(fs, ex); + luaK_codeABC(fs, OP_SETTABLE, var->u.s.info, var->u.s.aux, e); + break; + } + default: { + lua_assert(0); /* invalid var kind to store */ + break; + } + } + freeexp(fs, ex); +} + + +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { + int func; + luaK_exp2anyreg(fs, e); + freeexp(fs, e); + func = fs->freereg; + luaK_reserveregs(fs, 2); + luaK_codeABC(fs, OP_SELF, func, e->u.s.info, luaK_exp2RK(fs, key)); + freeexp(fs, key); + e->u.s.info = func; + e->k = VNONRELOC; +} + + +static void invertjump (FuncState *fs, expdesc *e) { + Instruction *pc = getjumpcontrol(fs, e->u.s.info); + lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && + GET_OPCODE(*pc) != OP_TEST); + SETARG_A(*pc, !(GETARG_A(*pc))); +} + + +static int jumponcond (FuncState *fs, expdesc *e, int cond) { + if (e->k == VRELOCABLE) { + Instruction ie = getcode(fs, e); + if (GET_OPCODE(ie) == OP_NOT) { + fs->pc--; /* remove previous OP_NOT */ + return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); + } + /* else go through */ + } + discharge2anyreg(fs, e); + freeexp(fs, e); + return condjump(fs, OP_TESTSET, NO_REG, e->u.s.info, cond); +} + + +void luaK_goiftrue (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VK: case VKNUM: case VTRUE: { + pc = NO_JUMP; /* always true; do nothing */ + break; + } + case VFALSE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + invertjump(fs, e); + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 0); + break; + } + } + luaK_concat(fs, &e->f, pc); /* insert last jump in `f' list */ + luaK_patchtohere(fs, e->t); + e->t = NO_JUMP; +} + + +static void luaK_goiffalse (FuncState *fs, expdesc *e) { + int pc; /* pc of last jump */ + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + pc = NO_JUMP; /* always false; do nothing */ + break; + } + case VTRUE: { + pc = luaK_jump(fs); /* always jump */ + break; + } + case VJMP: { + pc = e->u.s.info; + break; + } + default: { + pc = jumponcond(fs, e, 1); + break; + } + } + luaK_concat(fs, &e->t, pc); /* insert last jump in `t' list */ + luaK_patchtohere(fs, e->f); + e->f = NO_JUMP; +} + + +static void codenot (FuncState *fs, expdesc *e) { + luaK_dischargevars(fs, e); + switch (e->k) { + case VNIL: case VFALSE: { + e->k = VTRUE; + break; + } + case VK: case VKNUM: case VTRUE: { + e->k = VFALSE; + break; + } + case VJMP: { + invertjump(fs, e); + break; + } + case VRELOCABLE: + case VNONRELOC: { + discharge2anyreg(fs, e); + freeexp(fs, e); + e->u.s.info = luaK_codeABC(fs, OP_NOT, 0, e->u.s.info, 0); + e->k = VRELOCABLE; + break; + } + default: { + lua_assert(0); /* cannot happen */ + break; + } + } + /* interchange true and false lists */ + { int temp = e->f; e->f = e->t; e->t = temp; } + removevalues(fs, e->f); + removevalues(fs, e->t); +} + + +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { + t->u.s.aux = luaK_exp2RK(fs, k); + t->k = VINDEXED; +} + + +static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { + lua_Number v1, v2, r; + if (!isnumeral(e1) || !isnumeral(e2)) return 0; + v1 = e1->u.nval; + v2 = e2->u.nval; + switch (op) { + case OP_ADD: r = luai_numadd(v1, v2); break; + case OP_SUB: r = luai_numsub(v1, v2); break; + case OP_MUL: r = luai_nummul(v1, v2); break; + case OP_DIV: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_numdiv(v1, v2); break; + case OP_MOD: + if (v2 == 0) return 0; /* do not attempt to divide by 0 */ + r = luai_nummod(v1, v2); break; + case OP_POW: r = luai_numpow(v1, v2); break; + case OP_UNM: r = luai_numunm(v1); break; + case OP_LEN: return 0; /* no constant folding for 'len' */ + default: lua_assert(0); r = 0; break; + } + if (luai_numisnan(r)) return 0; /* do not attempt to produce NaN */ + e1->u.nval = r; + return 1; +} + + +static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { + if (constfolding(op, e1, e2)) + return; + else { + int o2 = (op != OP_UNM && op != OP_LEN) ? luaK_exp2RK(fs, e2) : 0; + int o1 = luaK_exp2RK(fs, e1); + if (o1 > o2) { + freeexp(fs, e1); + freeexp(fs, e2); + } + else { + freeexp(fs, e2); + freeexp(fs, e1); + } + e1->u.s.info = luaK_codeABC(fs, op, 0, o1, o2); + e1->k = VRELOCABLE; + } +} + + +static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, + expdesc *e2) { + int o1 = luaK_exp2RK(fs, e1); + int o2 = luaK_exp2RK(fs, e2); + freeexp(fs, e2); + freeexp(fs, e1); + if (cond == 0 && op != OP_EQ) { + int temp; /* exchange args to replace by `<' or `<=' */ + temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ + cond = 1; + } + e1->u.s.info = condjump(fs, op, cond, o1, o2); + e1->k = VJMP; +} + + +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { + expdesc e2; + e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; + switch (op) { + case OPR_MINUS: { + if (!isnumeral(e)) + luaK_exp2anyreg(fs, e); /* cannot operate on non-numeric constants */ + codearith(fs, OP_UNM, e, &e2); + break; + } + case OPR_NOT: codenot(fs, e); break; + case OPR_LEN: { + luaK_exp2anyreg(fs, e); /* cannot operate on constants */ + codearith(fs, OP_LEN, e, &e2); + break; + } + default: lua_assert(0); + } +} + + +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { + switch (op) { + case OPR_AND: { + luaK_goiftrue(fs, v); + break; + } + case OPR_OR: { + luaK_goiffalse(fs, v); + break; + } + case OPR_CONCAT: { + luaK_exp2nextreg(fs, v); /* operand must be on the `stack' */ + break; + } + case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: + case OPR_MOD: case OPR_POW: { + if (!isnumeral(v)) luaK_exp2RK(fs, v); + break; + } + default: { + luaK_exp2RK(fs, v); + break; + } + } +} + + +void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { + switch (op) { + case OPR_AND: { + lua_assert(e1->t == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->f, e1->f); + *e1 = *e2; + break; + } + case OPR_OR: { + lua_assert(e1->f == NO_JUMP); /* list must be closed */ + luaK_dischargevars(fs, e2); + luaK_concat(fs, &e2->t, e1->t); + *e1 = *e2; + break; + } + case OPR_CONCAT: { + luaK_exp2val(fs, e2); + if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { + lua_assert(e1->u.s.info == GETARG_B(getcode(fs, e2))-1); + freeexp(fs, e1); + SETARG_B(getcode(fs, e2), e1->u.s.info); + e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; + } + else { + luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ + codearith(fs, OP_CONCAT, e1, e2); + } + break; + } + case OPR_ADD: codearith(fs, OP_ADD, e1, e2); break; + case OPR_SUB: codearith(fs, OP_SUB, e1, e2); break; + case OPR_MUL: codearith(fs, OP_MUL, e1, e2); break; + case OPR_DIV: codearith(fs, OP_DIV, e1, e2); break; + case OPR_MOD: codearith(fs, OP_MOD, e1, e2); break; + case OPR_POW: codearith(fs, OP_POW, e1, e2); break; + case OPR_EQ: codecomp(fs, OP_EQ, 1, e1, e2); break; + case OPR_NE: codecomp(fs, OP_EQ, 0, e1, e2); break; + case OPR_LT: codecomp(fs, OP_LT, 1, e1, e2); break; + case OPR_LE: codecomp(fs, OP_LE, 1, e1, e2); break; + case OPR_GT: codecomp(fs, OP_LT, 0, e1, e2); break; + case OPR_GE: codecomp(fs, OP_LE, 0, e1, e2); break; + default: lua_assert(0); + } +} + + +void luaK_fixline (FuncState *fs, int line) { + fs->f->lineinfo[fs->pc - 1] = line; +} + + +static int luaK_code (FuncState *fs, Instruction i, int line) { + Proto *f = fs->f; + dischargejpc(fs); /* `pc' will change */ + /* put new instruction in code array */ + luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction, + MAX_INT, "code size overflow"); + f->code[fs->pc] = i; + /* save corresponding line information */ + luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int, + MAX_INT, "code size overflow"); + f->lineinfo[fs->pc] = line; + return fs->pc++; +} + + +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { + lua_assert(getOpMode(o) == iABC); + lua_assert(getBMode(o) != OpArgN || b == 0); + lua_assert(getCMode(o) != OpArgN || c == 0); + return luaK_code(fs, CREATE_ABC(o, a, b, c), fs->ls->lastline); +} + + +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { + lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); + lua_assert(getCMode(o) == OpArgN); + return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); +} + + +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { + int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; + int b = (tostore == LUA_MULTRET) ? 0 : tostore; + lua_assert(tostore != 0); + if (c <= MAXARG_C) + luaK_codeABC(fs, OP_SETLIST, base, b, c); + else { + luaK_codeABC(fs, OP_SETLIST, base, b, 0); + luaK_code(fs, cast(Instruction, c), fs->ls->lastline); + } + fs->freereg = base + 1; /* free registers with list values */ +} + diff --git a/ThirdLib/thirdparty/LuaLib/lcode.h b/ThirdLib/thirdparty/LuaLib/lcode.h new file mode 100644 index 000000000..b941c6072 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lcode.h @@ -0,0 +1,76 @@ +/* +** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ +** Code generator for Lua +** See Copyright Notice in lua.h +*/ + +#ifndef lcode_h +#define lcode_h + +#include "llex.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" + + +/* +** Marks the end of a patch list. It is an invalid value both as an absolute +** address, and as a list link (would link an element to itself). +*/ +#define NO_JUMP (-1) + + +/* +** grep "ORDER OPR" if you change these enums +*/ +typedef enum BinOpr { + OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, + OPR_CONCAT, + OPR_NE, OPR_EQ, + OPR_LT, OPR_LE, OPR_GT, OPR_GE, + OPR_AND, OPR_OR, + OPR_NOBINOPR +} BinOpr; + + +typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; + + +#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) + +#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) + +#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) + +LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); +LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); +LUAI_FUNC void luaK_fixline (FuncState *fs, int line); +LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); +LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); +LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); +LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); +LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r); +LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); +LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); +LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); +LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); +LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); +LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); +LUAI_FUNC int luaK_jump (FuncState *fs); +LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); +LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); +LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); +LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); +LUAI_FUNC int luaK_getlabel (FuncState *fs); +LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v); +LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); +LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2); +LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); + + +#endif diff --git a/ThirdLib/thirdparty/LuaLib/ldblib.c b/ThirdLib/thirdparty/LuaLib/ldblib.c new file mode 100644 index 000000000..67de1222a --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/ldblib.c @@ -0,0 +1,397 @@ +/* +** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $ +** Interface from Lua to its debug API +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldblib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +static int db_getregistry (lua_State *L) { + lua_pushvalue(L, LUA_REGISTRYINDEX); + return 1; +} + + +static int db_getmetatable (lua_State *L) { + luaL_checkany(L, 1); + if (!lua_getmetatable(L, 1)) { + lua_pushnil(L); /* no metatable */ + } + return 1; +} + + +static int db_setmetatable (lua_State *L) { + int t = lua_type(L, 2); + luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, + "nil or table expected"); + lua_settop(L, 2); + lua_pushboolean(L, lua_setmetatable(L, 1)); + return 1; +} + + +static int db_getfenv (lua_State *L) { + lua_getfenv(L, 1); + return 1; +} + + +static int db_setfenv (lua_State *L) { + luaL_checktype(L, 2, LUA_TTABLE); + lua_settop(L, 2); + if (lua_setfenv(L, 1) == 0) + luaL_error(L, LUA_QL("setfenv") + " cannot change environment of given object"); + return 1; +} + + +static void settabss (lua_State *L, const char *i, const char *v) { + lua_pushstring(L, v); + lua_setfield(L, -2, i); +} + + +static void settabsi (lua_State *L, const char *i, int v) { + lua_pushinteger(L, v); + lua_setfield(L, -2, i); +} + + +static lua_State *getthread (lua_State *L, int *arg) { + if (lua_isthread(L, 1)) { + *arg = 1; + return lua_tothread(L, 1); + } + else { + *arg = 0; + return L; + } +} + + +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { + if (L == L1) { + lua_pushvalue(L, -2); + lua_remove(L, -3); + } + else + lua_xmove(L1, L, 1); + lua_setfield(L, -2, fname); +} + + +static int db_getinfo (lua_State *L) { + lua_Debug ar; + int arg; + lua_State *L1 = getthread(L, &arg); + const char *options = luaL_optstring(L, arg+2, "flnSu"); + if (lua_isnumber(L, arg+1)) { + if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) { + lua_pushnil(L); /* level out of range */ + return 1; + } + } + else if (lua_isfunction(L, arg+1)) { + lua_pushfstring(L, ">%s", options); + options = lua_tostring(L, -1); + lua_pushvalue(L, arg+1); + lua_xmove(L, L1, 1); + } + else + return luaL_argerror(L, arg+1, "function or level expected"); + if (!lua_getinfo(L1, options, &ar)) + return luaL_argerror(L, arg+2, "invalid option"); + lua_createtable(L, 0, 2); + if (strchr(options, 'S')) { + settabss(L, "source", ar.source); + settabss(L, "short_src", ar.short_src); + settabsi(L, "linedefined", ar.linedefined); + settabsi(L, "lastlinedefined", ar.lastlinedefined); + settabss(L, "what", ar.what); + } + if (strchr(options, 'l')) + settabsi(L, "currentline", ar.currentline); + if (strchr(options, 'u')) + settabsi(L, "nups", ar.nups); + if (strchr(options, 'n')) { + settabss(L, "name", ar.name); + settabss(L, "namewhat", ar.namewhat); + } + if (strchr(options, 'L')) + treatstackoption(L, L1, "activelines"); + if (strchr(options, 'f')) + treatstackoption(L, L1, "func"); + return 1; /* return table */ +} + + +static int db_getlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + const char *name; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2)); + if (name) { + lua_xmove(L1, L, 1); + lua_pushstring(L, name); + lua_pushvalue(L, -2); + return 2; + } + else { + lua_pushnil(L); + return 1; + } +} + + +static int db_setlocal (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */ + return luaL_argerror(L, arg+1, "level out of range"); + luaL_checkany(L, arg+3); + lua_settop(L, arg+3); + lua_xmove(L, L1, 1); + lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2))); + return 1; +} + + +static int auxupvalue (lua_State *L, int get) { + const char *name; + int n = luaL_checkint(L, 2); + luaL_checktype(L, 1, LUA_TFUNCTION); + if (lua_iscfunction(L, 1)) return 0; /* cannot touch C upvalues from Lua */ + name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); + if (name == NULL) return 0; + lua_pushstring(L, name); + lua_insert(L, -(get+1)); + return get + 1; +} + + +static int db_getupvalue (lua_State *L) { + return auxupvalue(L, 1); +} + + +static int db_setupvalue (lua_State *L) { + luaL_checkany(L, 3); + return auxupvalue(L, 0); +} + + + +static const char KEY_HOOK = 'h'; + + +static void hookf (lua_State *L, lua_Debug *ar) { + static const char *const hooknames[] = + {"call", "return", "line", "count", "tail return"}; + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, L); + lua_rawget(L, -2); + if (lua_isfunction(L, -1)) { + lua_pushstring(L, hooknames[(int)ar->event]); + if (ar->currentline >= 0) + lua_pushinteger(L, ar->currentline); + else lua_pushnil(L); + lua_assert(lua_getinfo(L, "lS", ar)); + lua_call(L, 2, 0); + } +} + + +static int makemask (const char *smask, int count) { + int mask = 0; + if (strchr(smask, 'c')) mask |= LUA_MASKCALL; + if (strchr(smask, 'r')) mask |= LUA_MASKRET; + if (strchr(smask, 'l')) mask |= LUA_MASKLINE; + if (count > 0) mask |= LUA_MASKCOUNT; + return mask; +} + + +static char *unmakemask (int mask, char *smask) { + int i = 0; + if (mask & LUA_MASKCALL) smask[i++] = 'c'; + if (mask & LUA_MASKRET) smask[i++] = 'r'; + if (mask & LUA_MASKLINE) smask[i++] = 'l'; + smask[i] = '\0'; + return smask; +} + + +static void gethooktable (lua_State *L) { + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_rawget(L, LUA_REGISTRYINDEX); + if (!lua_istable(L, -1)) { + lua_pop(L, 1); + lua_createtable(L, 0, 1); + lua_pushlightuserdata(L, (void *)&KEY_HOOK); + lua_pushvalue(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + } +} + + +static int db_sethook (lua_State *L) { + int arg, mask, count; + lua_Hook func; + lua_State *L1 = getthread(L, &arg); + if (lua_isnoneornil(L, arg+1)) { + lua_settop(L, arg+1); + func = NULL; mask = 0; count = 0; /* turn off hooks */ + } + else { + const char *smask = luaL_checkstring(L, arg+2); + luaL_checktype(L, arg+1, LUA_TFUNCTION); + count = luaL_optint(L, arg+3, 0); + func = hookf; mask = makemask(smask, count); + } + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_pushvalue(L, arg+1); + lua_rawset(L, -3); /* set new hook */ + lua_pop(L, 1); /* remove hook table */ + lua_sethook(L1, func, mask, count); /* set hooks */ + return 0; +} + + +static int db_gethook (lua_State *L) { + int arg; + lua_State *L1 = getthread(L, &arg); + char buff[5]; + int mask = lua_gethookmask(L1); + lua_Hook hook = lua_gethook(L1); + if (hook != NULL && hook != hookf) /* external hook? */ + lua_pushliteral(L, "external hook"); + else { + gethooktable(L); + lua_pushlightuserdata(L, L1); + lua_rawget(L, -2); /* get hook */ + lua_remove(L, -2); /* remove hook table */ + } + lua_pushstring(L, unmakemask(mask, buff)); + lua_pushinteger(L, lua_gethookcount(L1)); + return 3; +} + + +static int db_debug (lua_State *L) { + for (;;) { + char buffer[250]; + fputs("lua_debug> ", stderr); + if (fgets(buffer, sizeof(buffer), stdin) == 0 || + strcmp(buffer, "cont\n") == 0) + return 0; + if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || + lua_pcall(L, 0, 0, 0)) { + fputs(lua_tostring(L, -1), stderr); + fputs("\n", stderr); + } + lua_settop(L, 0); /* remove eventual returns */ + } +} + + +#define LEVELS1 12 /* size of the first part of the stack */ +#define LEVELS2 10 /* size of the second part of the stack */ + +static int db_errorfb (lua_State *L) { + int level; + int firstpart = 1; /* still before eventual `...' */ + int arg; + lua_State *L1 = getthread(L, &arg); + lua_Debug ar; + if (lua_isnumber(L, arg+2)) { + level = (int)lua_tointeger(L, arg+2); + lua_pop(L, 1); + } + else + level = (L == L1) ? 1 : 0; /* level 0 may be this own function */ + if (lua_gettop(L) == arg) + lua_pushliteral(L, ""); + else if (!lua_isstring(L, arg+1)) return 1; /* message is not a string */ + else lua_pushliteral(L, "\n"); + lua_pushliteral(L, "stack traceback:"); + while (lua_getstack(L1, level++, &ar)) { + if (level > LEVELS1 && firstpart) { + /* no more than `LEVELS2' more levels? */ + if (!lua_getstack(L1, level+LEVELS2, &ar)) + level--; /* keep going */ + else { + lua_pushliteral(L, "\n\t..."); /* too many levels */ + while (lua_getstack(L1, level+LEVELS2, &ar)) /* find last levels */ + level++; + } + firstpart = 0; + continue; + } + lua_pushliteral(L, "\n\t"); + lua_getinfo(L1, "Snl", &ar); + lua_pushfstring(L, "%s:", ar.short_src); + if (ar.currentline > 0) + lua_pushfstring(L, "%d:", ar.currentline); + if (*ar.namewhat != '\0') /* is there a name? */ + lua_pushfstring(L, " in function " LUA_QS, ar.name); + else { + if (*ar.what == 'm') /* main? */ + lua_pushfstring(L, " in main chunk"); + else if (*ar.what == 'C' || *ar.what == 't') + lua_pushliteral(L, " ?"); /* C function or tail call */ + else + lua_pushfstring(L, " in function <%s:%d>", + ar.short_src, ar.linedefined); + } + lua_concat(L, lua_gettop(L) - arg); + } + lua_concat(L, lua_gettop(L) - arg); + return 1; +} + + +static const luaL_Reg dblib[] = { + {"debug", db_debug}, + {"getfenv", db_getfenv}, + {"gethook", db_gethook}, + {"getinfo", db_getinfo}, + {"getlocal", db_getlocal}, + {"getregistry", db_getregistry}, + {"getmetatable", db_getmetatable}, + {"getupvalue", db_getupvalue}, + {"setfenv", db_setfenv}, + {"sethook", db_sethook}, + {"setlocal", db_setlocal}, + {"setmetatable", db_setmetatable}, + {"setupvalue", db_setupvalue}, + {"traceback", db_errorfb}, + {NULL, NULL} +}; + + +LUALIB_API int luaopen_debug (lua_State *L) { + luaL_register(L, LUA_DBLIBNAME, dblib); + return 1; +} + diff --git a/ThirdLib/thirdparty/LuaLib/ldebug.c b/ThirdLib/thirdparty/LuaLib/ldebug.c new file mode 100644 index 000000000..50ad3d380 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/ldebug.c @@ -0,0 +1,638 @@ +/* +** $Id: ldebug.c,v 2.29.1.6 2008/05/08 16:56:26 roberto Exp $ +** Debug Interface +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + + +#define ldebug_c +#define LUA_CORE + +#include "lua.h" + +#include "lapi.h" +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); + + +static int currentpc (lua_State *L, CallInfo *ci) { + if (!isLua(ci)) return -1; /* function is not a Lua function? */ + if (ci == L->ci) + ci->savedpc = L->savedpc; + return pcRel(ci->savedpc, ci_func(ci)->l.p); +} + + +static int currentline (lua_State *L, CallInfo *ci) { + int pc = currentpc(L, ci); + if (pc < 0) + return -1; /* only active lua functions have current-line information */ + else + return getline(ci_func(ci)->l.p, pc); +} + + +/* +** this function can be called asynchronous (e.g. during a signal) +*/ +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { + if (func == NULL || mask == 0) { /* turn off hooks? */ + mask = 0; + func = NULL; + } + L->hook = func; + L->basehookcount = count; + resethookcount(L); + L->hookmask = cast_byte(mask); + return 1; +} + + +LUA_API lua_Hook lua_gethook (lua_State *L) { + return L->hook; +} + + +LUA_API int lua_gethookmask (lua_State *L) { + return L->hookmask; +} + + +LUA_API int lua_gethookcount (lua_State *L) { + return L->basehookcount; +} + + +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { + int status; + CallInfo *ci; + lua_lock(L); + for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) { + level--; + if (f_isLua(ci)) /* Lua function? */ + level -= ci->tailcalls; /* skip lost tail calls */ + } + if (level == 0 && ci > L->base_ci) { /* level found? */ + status = 1; + ar->i_ci = cast_int(ci - L->base_ci); + } + else if (level < 0) { /* level is of a lost tail call? */ + status = 1; + ar->i_ci = 0; + } + else status = 0; /* no such level */ + lua_unlock(L); + return status; +} + + +static Proto *getluaproto (CallInfo *ci) { + return (isLua(ci) ? ci_func(ci)->l.p : NULL); +} + + +static const char *findlocal (lua_State *L, CallInfo *ci, int n) { + const char *name; + Proto *fp = getluaproto(ci); + if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) + return name; /* is a local variable in a Lua function */ + else { + StkId limit = (ci == L->ci) ? L->top : (ci+1)->func; + if (limit - ci->base >= n && n > 0) /* is 'n' inside 'ci' stack? */ + return "(*temporary)"; + else + return NULL; + } +} + + +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + luaA_pushobject(L, ci->base + (n - 1)); + lua_unlock(L); + return name; +} + + +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { + CallInfo *ci = L->base_ci + ar->i_ci; + const char *name = findlocal(L, ci, n); + lua_lock(L); + if (name) + setobjs2s(L, ci->base + (n - 1), L->top - 1); + L->top--; /* pop value */ + lua_unlock(L); + return name; +} + + +static void funcinfo (lua_Debug *ar, Closure *cl) { + if (cl->c.isC) { + ar->source = "=[C]"; + ar->linedefined = -1; + ar->lastlinedefined = -1; + ar->what = "C"; + } + else { + ar->source = getstr(cl->l.p->source); + ar->linedefined = cl->l.p->linedefined; + ar->lastlinedefined = cl->l.p->lastlinedefined; + ar->what = (ar->linedefined == 0) ? "main" : "Lua"; + } + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); +} + + +static void info_tailcall (lua_Debug *ar) { + ar->name = ar->namewhat = ""; + ar->what = "tail"; + ar->lastlinedefined = ar->linedefined = ar->currentline = -1; + ar->source = "=(tail call)"; + luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); + ar->nups = 0; +} + + +static void collectvalidlines (lua_State *L, Closure *f) { + if (f == NULL || f->c.isC) { + setnilvalue(L->top); + } + else { + Table *t = luaH_new(L, 0, 0); + int *lineinfo = f->l.p->lineinfo; + int i; + for (i=0; il.p->sizelineinfo; i++) + setbvalue(luaH_setnum(L, t, lineinfo[i]), 1); + sethvalue(L, L->top, t); + } + incr_top(L); +} + + +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, + Closure *f, CallInfo *ci) { + int status = 1; + if (f == NULL) { + info_tailcall(ar); + return status; + } + for (; *what; what++) { + switch (*what) { + case 'S': { + funcinfo(ar, f); + break; + } + case 'l': { + ar->currentline = (ci) ? currentline(L, ci) : -1; + break; + } + case 'u': { + ar->nups = f->c.nupvalues; + break; + } + case 'n': { + ar->namewhat = (ci) ? getfuncname(L, ci, &ar->name) : NULL; + if (ar->namewhat == NULL) { + ar->namewhat = ""; /* not found */ + ar->name = NULL; + } + break; + } + case 'L': + case 'f': /* handled by lua_getinfo */ + break; + default: status = 0; /* invalid option */ + } + } + return status; +} + + +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { + int status; + Closure *f = NULL; + CallInfo *ci = NULL; + lua_lock(L); + if (*what == '>') { + StkId func = L->top - 1; + luai_apicheck(L, ttisfunction(func)); + what++; /* skip the '>' */ + f = clvalue(func); + L->top--; /* pop function */ + } + else if (ar->i_ci != 0) { /* no tail call? */ + ci = L->base_ci + ar->i_ci; + lua_assert(ttisfunction(ci->func)); + f = clvalue(ci->func); + } + status = auxgetinfo(L, what, ar, f, ci); + if (strchr(what, 'f')) { + if (f == NULL) setnilvalue(L->top); + else setclvalue(L, L->top, f); + incr_top(L); + } + if (strchr(what, 'L')) + collectvalidlines(L, f); + lua_unlock(L); + return status; +} + + +/* +** {====================================================== +** Symbolic Execution and code checker +** ======================================================= +*/ + +#define check(x) if (!(x)) return 0; + +#define checkjump(pt,pc) check(0 <= pc && pc < pt->sizecode) + +#define checkreg(pt,reg) check((reg) < (pt)->maxstacksize) + + + +static int precheck (const Proto *pt) { + check(pt->maxstacksize <= MAXSTACK); + check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize); + check(!(pt->is_vararg & VARARG_NEEDSARG) || + (pt->is_vararg & VARARG_HASARG)); + check(pt->sizeupvalues <= pt->nups); + check(pt->sizelineinfo == pt->sizecode || pt->sizelineinfo == 0); + check(pt->sizecode > 0 && GET_OPCODE(pt->code[pt->sizecode-1]) == OP_RETURN); + return 1; +} + + +#define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) + +int luaG_checkopenop (Instruction i) { + switch (GET_OPCODE(i)) { + case OP_CALL: + case OP_TAILCALL: + case OP_RETURN: + case OP_SETLIST: { + check(GETARG_B(i) == 0); + return 1; + } + default: return 0; /* invalid instruction after an open call */ + } +} + + +static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { + switch (mode) { + case OpArgN: check(r == 0); break; + case OpArgU: break; + case OpArgR: checkreg(pt, r); break; + case OpArgK: + check(ISK(r) ? INDEXK(r) < pt->sizek : r < pt->maxstacksize); + break; + } + return 1; +} + + +static Instruction symbexec (const Proto *pt, int lastpc, int reg) { + int pc; + int last; /* stores position of last instruction that changed `reg' */ + last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ + check(precheck(pt)); + for (pc = 0; pc < lastpc; pc++) { + Instruction i = pt->code[pc]; + OpCode op = GET_OPCODE(i); + int a = GETARG_A(i); + int b = 0; + int c = 0; + check(op < NUM_OPCODES); + checkreg(pt, a); + switch (getOpMode(op)) { + case iABC: { + b = GETARG_B(i); + c = GETARG_C(i); + check(checkArgMode(pt, b, getBMode(op))); + check(checkArgMode(pt, c, getCMode(op))); + break; + } + case iABx: { + b = GETARG_Bx(i); + if (getBMode(op) == OpArgK) check(b < pt->sizek); + break; + } + case iAsBx: { + b = GETARG_sBx(i); + if (getBMode(op) == OpArgR) { + int dest = pc+1+b; + check(0 <= dest && dest < pt->sizecode); + if (dest > 0) { + int j; + /* check that it does not jump to a setlist count; this + is tricky, because the count from a previous setlist may + have the same value of an invalid setlist; so, we must + go all the way back to the first of them (if any) */ + for (j = 0; j < dest; j++) { + Instruction d = pt->code[dest-1-j]; + if (!(GET_OPCODE(d) == OP_SETLIST && GETARG_C(d) == 0)) break; + } + /* if 'j' is even, previous value is not a setlist (even if + it looks like one) */ + check((j&1) == 0); + } + } + break; + } + } + if (testAMode(op)) { + if (a == reg) last = pc; /* change register `a' */ + } + if (testTMode(op)) { + check(pc+2 < pt->sizecode); /* check skip */ + check(GET_OPCODE(pt->code[pc+1]) == OP_JMP); + } + switch (op) { + case OP_LOADBOOL: { + if (c == 1) { /* does it jump? */ + check(pc+2 < pt->sizecode); /* check its jump */ + check(GET_OPCODE(pt->code[pc+1]) != OP_SETLIST || + GETARG_C(pt->code[pc+1]) != 0); + } + break; + } + case OP_LOADNIL: { + if (a <= reg && reg <= b) + last = pc; /* set registers from `a' to `b' */ + break; + } + case OP_GETUPVAL: + case OP_SETUPVAL: { + check(b < pt->nups); + break; + } + case OP_GETGLOBAL: + case OP_SETGLOBAL: { + check(ttisstring(&pt->k[b])); + break; + } + case OP_SELF: { + checkreg(pt, a+1); + if (reg == a+1) last = pc; + break; + } + case OP_CONCAT: { + check(b < c); /* at least two operands */ + break; + } + case OP_TFORLOOP: { + check(c >= 1); /* at least one result (control variable) */ + checkreg(pt, a+2+c); /* space for results */ + if (reg >= a+2) last = pc; /* affect all regs above its base */ + break; + } + case OP_FORLOOP: + case OP_FORPREP: + checkreg(pt, a+3); + /* go through */ + case OP_JMP: { + int dest = pc+1+b; + /* not full check and jump is forward and do not skip `lastpc'? */ + if (reg != NO_REG && pc < dest && dest <= lastpc) + pc += b; /* do the jump */ + break; + } + case OP_CALL: + case OP_TAILCALL: { + if (b != 0) { + checkreg(pt, a+b-1); + } + c--; /* c = num. returns */ + if (c == LUA_MULTRET) { + check(checkopenop(pt, pc)); + } + else if (c != 0) + checkreg(pt, a+c-1); + if (reg >= a) last = pc; /* affect all registers above base */ + break; + } + case OP_RETURN: { + b--; /* b = num. returns */ + if (b > 0) checkreg(pt, a+b-1); + break; + } + case OP_SETLIST: { + if (b > 0) checkreg(pt, a + b); + if (c == 0) { + pc++; + check(pc < pt->sizecode - 1); + } + break; + } + case OP_CLOSURE: { + int nup, j; + check(b < pt->sizep); + nup = pt->p[b]->nups; + check(pc + nup < pt->sizecode); + for (j = 1; j <= nup; j++) { + OpCode op1 = GET_OPCODE(pt->code[pc + j]); + check(op1 == OP_GETUPVAL || op1 == OP_MOVE); + } + if (reg != NO_REG) /* tracing? */ + pc += nup; /* do not 'execute' these pseudo-instructions */ + break; + } + case OP_VARARG: { + check((pt->is_vararg & VARARG_ISVARARG) && + !(pt->is_vararg & VARARG_NEEDSARG)); + b--; + if (b == LUA_MULTRET) check(checkopenop(pt, pc)); + checkreg(pt, a+b-1); + break; + } + default: break; + } + } + return pt->code[last]; +} + +#undef check +#undef checkjump +#undef checkreg + +/* }====================================================== */ + + +int luaG_checkcode (const Proto *pt) { + return (symbexec(pt, pt->sizecode, NO_REG) != 0); +} + + +static const char *kname (Proto *p, int c) { + if (ISK(c) && ttisstring(&p->k[INDEXK(c)])) + return svalue(&p->k[INDEXK(c)]); + else + return "?"; +} + + +static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, + const char **name) { + if (isLua(ci)) { /* a Lua function? */ + Proto *p = ci_func(ci)->l.p; + int pc = currentpc(L, ci); + Instruction i; + *name = luaF_getlocalname(p, stackpos+1, pc); + if (*name) /* is a local? */ + return "local"; + i = symbexec(p, pc, stackpos); /* try symbolic execution */ + lua_assert(pc != -1); + switch (GET_OPCODE(i)) { + case OP_GETGLOBAL: { + int g = GETARG_Bx(i); /* global index */ + lua_assert(ttisstring(&p->k[g])); + *name = svalue(&p->k[g]); + return "global"; + } + case OP_MOVE: { + int a = GETARG_A(i); + int b = GETARG_B(i); /* move from `b' to `a' */ + if (b < a) + return getobjname(L, ci, b, name); /* get name for `b' */ + break; + } + case OP_GETTABLE: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "field"; + } + case OP_GETUPVAL: { + int u = GETARG_B(i); /* upvalue index */ + *name = p->upvalues ? getstr(p->upvalues[u]) : "?"; + return "upvalue"; + } + case OP_SELF: { + int k = GETARG_C(i); /* key index */ + *name = kname(p, k); + return "method"; + } + default: break; + } + } + return NULL; /* no useful name found */ +} + + +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { + Instruction i; + if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) + return NULL; /* calling function is not Lua (or is unknown) */ + ci--; /* calling function */ + i = ci_func(ci)->l.p->code[currentpc(L, ci)]; + if (GET_OPCODE(i) == OP_CALL || GET_OPCODE(i) == OP_TAILCALL || + GET_OPCODE(i) == OP_TFORLOOP) + return getobjname(L, ci, GETARG_A(i), name); + else + return NULL; /* no useful name can be found */ +} + + +/* only ANSI way to check whether a pointer points to an array */ +static int isinstack (CallInfo *ci, const TValue *o) { + StkId p; + for (p = ci->base; p < ci->top; p++) + if (o == p) return 1; + return 0; +} + + +void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { + const char *name = NULL; + const char *t = luaT_typenames[ttype(o)]; + const char *kind = (isinstack(L->ci, o)) ? + getobjname(L, L->ci, cast_int(o - L->base), &name) : + NULL; + if (kind) + luaG_runerror(L, "attempt to %s %s " LUA_QS " (a %s value)", + op, kind, name, t); + else + luaG_runerror(L, "attempt to %s a %s value", op, t); +} + + +void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { + if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; + lua_assert(!ttisstring(p1) && !ttisnumber(p1)); + luaG_typeerror(L, p1, "concatenate"); +} + + +void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { + TValue temp; + if (luaV_tonumber(p1, &temp) == NULL) + p2 = p1; /* first operand is wrong */ + luaG_typeerror(L, p2, "perform arithmetic on"); +} + + +int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { + const char *t1 = luaT_typenames[ttype(p1)]; + const char *t2 = luaT_typenames[ttype(p2)]; + if (t1[2] == t2[2]) + luaG_runerror(L, "attempt to compare two %s values", t1); + else + luaG_runerror(L, "attempt to compare %s with %s", t1, t2); + return 0; +} + + +static void addinfo (lua_State *L, const char *msg) { + CallInfo *ci = L->ci; + if (isLua(ci)) { /* is Lua code? */ + char buff[LUA_IDSIZE]; /* add file:line information */ + int line = currentline(L, ci); + luaO_chunkid(buff, getstr(getluaproto(ci)->source), LUA_IDSIZE); + luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); + } +} + + +void luaG_errormsg (lua_State *L) { + if (L->errfunc != 0) { /* is there an error handling function? */ + StkId errfunc = restorestack(L, L->errfunc); + if (!ttisfunction(errfunc)) luaD_throw(L, LUA_ERRERR); + setobjs2s(L, L->top, L->top - 1); /* move argument */ + setobjs2s(L, L->top - 1, errfunc); /* push function */ + incr_top(L); + luaD_call(L, L->top - 2, 1); /* call it */ + } + luaD_throw(L, LUA_ERRRUN); +} + + +void luaG_runerror (lua_State *L, const char *fmt, ...) { + va_list argp; + va_start(argp, fmt); + addinfo(L, luaO_pushvfstring(L, fmt, argp)); + va_end(argp); + luaG_errormsg(L); +} + diff --git a/ThirdLib/thirdparty/LuaLib/ldebug.h b/ThirdLib/thirdparty/LuaLib/ldebug.h new file mode 100644 index 000000000..ba28a9724 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/ldebug.h @@ -0,0 +1,33 @@ +/* +** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ +** Auxiliary functions from Debug Interface module +** See Copyright Notice in lua.h +*/ + +#ifndef ldebug_h +#define ldebug_h + + +#include "lstate.h" + + +#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) + +#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) + +#define resethookcount(L) (L->hookcount = L->basehookcount) + + +LUAI_FUNC void luaG_typeerror (lua_State *L, const TValue *o, + const char *opname); +LUAI_FUNC void luaG_concaterror (lua_State *L, StkId p1, StkId p2); +LUAI_FUNC void luaG_aritherror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC int luaG_ordererror (lua_State *L, const TValue *p1, + const TValue *p2); +LUAI_FUNC void luaG_runerror (lua_State *L, const char *fmt, ...); +LUAI_FUNC void luaG_errormsg (lua_State *L); +LUAI_FUNC int luaG_checkcode (const Proto *pt); +LUAI_FUNC int luaG_checkopenop (Instruction i); + +#endif diff --git a/ThirdLib/thirdparty/LuaLib/ldo.c b/ThirdLib/thirdparty/LuaLib/ldo.c new file mode 100644 index 000000000..8de05f728 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/ldo.c @@ -0,0 +1,518 @@ +/* +** $Id: ldo.c,v 2.38.1.3 2008/01/18 22:31:22 roberto Exp $ +** Stack and Call structure of Lua +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define ldo_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lundump.h" +#include "lvm.h" +#include "lzio.h" + + + + +/* +** {====================================================== +** Error-recovery functions +** ======================================================= +*/ + + +/* chain list of long jump buffers */ +struct lua_longjmp { + struct lua_longjmp *previous; + luai_jmpbuf b; + volatile int status; /* error code */ +}; + + +void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { + switch (errcode) { + case LUA_ERRMEM: { + setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); + break; + } + case LUA_ERRERR: { + setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); + break; + } + case LUA_ERRSYNTAX: + case LUA_ERRRUN: { + setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ + break; + } + } + L->top = oldtop + 1; +} + + +static void restore_stack_limit (lua_State *L) { + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ + int inuse = cast_int(L->ci - L->base_ci); + if (inuse + 1 < LUAI_MAXCALLS) /* can `undo' overflow? */ + luaD_reallocCI(L, LUAI_MAXCALLS); + } +} + + +static void resetstack (lua_State *L, int status) { + L->ci = L->base_ci; + L->base = L->ci->base; + luaF_close(L, L->base); /* close eventual pending closures */ + luaD_seterrorobj(L, status, L->base); + L->nCcalls = L->baseCcalls; + L->allowhook = 1; + restore_stack_limit(L); + L->errfunc = 0; + L->errorJmp = NULL; +} + + +void luaD_throw (lua_State *L, int errcode) { + if (L->errorJmp) { + L->errorJmp->status = errcode; + LUAI_THROW(L, L->errorJmp); + } + else { + L->status = cast_byte(errcode); + if (G(L)->panic) { + resetstack(L, errcode); + lua_unlock(L); + G(L)->panic(L); + } + exit(EXIT_FAILURE); + } +} + + +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { + struct lua_longjmp lj; + lj.status = 0; + lj.previous = L->errorJmp; /* chain new error handler */ + L->errorJmp = &lj; + LUAI_TRY(L, &lj, + (*f)(L, ud); + ); + L->errorJmp = lj.previous; /* restore old error handler */ + return lj.status; +} + +/* }====================================================== */ + + +static void correctstack (lua_State *L, TValue *oldstack) { + CallInfo *ci; + GCObject *up; + L->top = (L->top - oldstack) + L->stack; + for (up = L->openupval; up != NULL; up = up->gch.next) + gco2uv(up)->v = (gco2uv(up)->v - oldstack) + L->stack; + for (ci = L->base_ci; ci <= L->ci; ci++) { + ci->top = (ci->top - oldstack) + L->stack; + ci->base = (ci->base - oldstack) + L->stack; + ci->func = (ci->func - oldstack) + L->stack; + } + L->base = (L->base - oldstack) + L->stack; +} + + +void luaD_reallocstack (lua_State *L, int newsize) { + TValue *oldstack = L->stack; + int realsize = newsize + 1 + EXTRA_STACK; + lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); + luaM_reallocvector(L, L->stack, L->stacksize, realsize, TValue); + L->stacksize = realsize; + L->stack_last = L->stack+newsize; + correctstack(L, oldstack); +} + + +void luaD_reallocCI (lua_State *L, int newsize) { + CallInfo *oldci = L->base_ci; + luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo); + L->size_ci = newsize; + L->ci = (L->ci - oldci) + L->base_ci; + L->end_ci = L->base_ci + L->size_ci - 1; +} + + +void luaD_growstack (lua_State *L, int n) { + if (n <= L->stacksize) /* double size is enough? */ + luaD_reallocstack(L, 2*L->stacksize); + else + luaD_reallocstack(L, L->stacksize + n); +} + + +static CallInfo *growCI (lua_State *L) { + if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ + luaD_throw(L, LUA_ERRERR); + else { + luaD_reallocCI(L, 2*L->size_ci); + if (L->size_ci > LUAI_MAXCALLS) + luaG_runerror(L, "stack overflow"); + } + return ++L->ci; +} + + +void luaD_callhook (lua_State *L, int event, int line) { + lua_Hook hook = L->hook; + if (hook && L->allowhook) { + ptrdiff_t top = savestack(L, L->top); + ptrdiff_t ci_top = savestack(L, L->ci->top); + lua_Debug ar; + ar.event = event; + ar.currentline = line; + if (event == LUA_HOOKTAILRET) + ar.i_ci = 0; /* tail call; no debug information about it */ + else + ar.i_ci = cast_int(L->ci - L->base_ci); + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + L->ci->top = L->top + LUA_MINSTACK; + lua_assert(L->ci->top <= L->stack_last); + L->allowhook = 0; /* cannot call hooks inside a hook */ + lua_unlock(L); + (*hook)(L, &ar); + lua_lock(L); + lua_assert(!L->allowhook); + L->allowhook = 1; + L->ci->top = restorestack(L, ci_top); + L->top = restorestack(L, top); + } +} + + +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { + int i; + int nfixargs = p->numparams; + Table *htab = NULL; + StkId base, fixed; + for (; actual < nfixargs; ++actual) + setnilvalue(L->top++); +#if defined(LUA_COMPAT_VARARG) + if (p->is_vararg & VARARG_NEEDSARG) { /* compat. with old-style vararg? */ + int nvar = actual - nfixargs; /* number of extra arguments */ + lua_assert(p->is_vararg & VARARG_HASARG); + luaC_checkGC(L); + htab = luaH_new(L, nvar, 1); /* create `arg' table */ + for (i=0; itop - nvar + i); + /* store counter in field `n' */ + setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, "n")), cast_num(nvar)); + } +#endif + /* move fixed parameters to final position */ + fixed = L->top - actual; /* first fixed argument */ + base = L->top; /* final position of first argument */ + for (i=0; itop++, fixed+i); + setnilvalue(fixed+i); + } + /* add `arg' parameter */ + if (htab) { + sethvalue(L, L->top++, htab); + lua_assert(iswhite(obj2gco(htab))); + } + return base; +} + + +static StkId tryfuncTM (lua_State *L, StkId func) { + const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); + StkId p; + ptrdiff_t funcr = savestack(L, func); + if (!ttisfunction(tm)) + luaG_typeerror(L, func, "call"); + /* Open a hole inside the stack at `func' */ + for (p = L->top; p > func; p--) setobjs2s(L, p, p-1); + incr_top(L); + func = restorestack(L, funcr); /* previous call may change stack */ + setobj2s(L, func, tm); /* tag method is the new function to be called */ + return func; +} + + + +#define inc_ci(L) \ + ((L->ci == L->end_ci) ? growCI(L) : \ + (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) + + +int luaD_precall (lua_State *L, StkId func, int nresults) { + LClosure *cl; + ptrdiff_t funcr; + if (!ttisfunction(func)) /* `func' is not a function? */ + func = tryfuncTM(L, func); /* check the `function' tag method */ + funcr = savestack(L, func); + cl = &clvalue(func)->l; + L->ci->savedpc = L->savedpc; + if (!cl->isC) { /* Lua function? prepare its call */ + CallInfo *ci; + StkId st, base; + Proto *p = cl->p; + luaD_checkstack(L, p->maxstacksize); + func = restorestack(L, funcr); + if (!p->is_vararg) { /* no varargs? */ + base = func + 1; + if (L->top > base + p->numparams) + L->top = base + p->numparams; + } + else { /* vararg function */ + int nargs = cast_int(L->top - func) - 1; + base = adjust_varargs(L, p, nargs); + func = restorestack(L, funcr); /* previous call may change the stack */ + } + ci = inc_ci(L); /* now `enter' new function */ + ci->func = func; + L->base = ci->base = base; + ci->top = L->base + p->maxstacksize; + lua_assert(ci->top <= L->stack_last); + L->savedpc = p->code; /* starting point */ + ci->tailcalls = 0; + ci->nresults = nresults; + for (st = L->top; st < ci->top; st++) + setnilvalue(st); + L->top = ci->top; + if (L->hookmask & LUA_MASKCALL) { + L->savedpc++; /* hooks assume 'pc' is already incremented */ + luaD_callhook(L, LUA_HOOKCALL, -1); + L->savedpc--; /* correct 'pc' */ + } + return PCRLUA; + } + else { /* if is a C function, call it */ + CallInfo *ci; + int n; + luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ + ci = inc_ci(L); /* now `enter' new function */ + ci->func = restorestack(L, funcr); + L->base = ci->base = ci->func + 1; + ci->top = L->top + LUA_MINSTACK; + lua_assert(ci->top <= L->stack_last); + ci->nresults = nresults; + if (L->hookmask & LUA_MASKCALL) + luaD_callhook(L, LUA_HOOKCALL, -1); + lua_unlock(L); + n = (*curr_func(L)->c.f)(L); /* do the actual call */ + lua_lock(L); + if (n < 0) /* yielding? */ + return PCRYIELD; + else { + luaD_poscall(L, L->top - n); + return PCRC; + } + } +} + + +static StkId callrethooks (lua_State *L, StkId firstResult) { + ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ + luaD_callhook(L, LUA_HOOKRET, -1); + if (f_isLua(L->ci)) { /* Lua function? */ + while ((L->hookmask & LUA_MASKRET) && L->ci->tailcalls--) /* tail calls */ + luaD_callhook(L, LUA_HOOKTAILRET, -1); + } + return restorestack(L, fr); +} + + +int luaD_poscall (lua_State *L, StkId firstResult) { + StkId res; + int wanted, i; + CallInfo *ci; + if (L->hookmask & LUA_MASKRET) + firstResult = callrethooks(L, firstResult); + ci = L->ci--; + res = ci->func; /* res == final position of 1st result */ + wanted = ci->nresults; + L->base = (ci - 1)->base; /* restore base */ + L->savedpc = (ci - 1)->savedpc; /* restore savedpc */ + /* move results to correct place */ + for (i = wanted; i != 0 && firstResult < L->top; i--) + setobjs2s(L, res++, firstResult++); + while (i-- > 0) + setnilvalue(res++); + L->top = res; + return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ +} + + +/* +** Call a function (C or Lua). The function to be called is at *func. +** The arguments are on the stack, right after the function. +** When returns, all the results are on the stack, starting at the original +** function position. +*/ +void luaD_call (lua_State *L, StkId func, int nResults) { + if (++L->nCcalls >= LUAI_MAXCCALLS) { + if (L->nCcalls == LUAI_MAXCCALLS) + luaG_runerror(L, "C stack overflow"); + else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) + luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ + } + if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */ + luaV_execute(L, 1); /* call it */ + L->nCcalls--; + luaC_checkGC(L); +} + + +static void resume (lua_State *L, void *ud) { + StkId firstArg = cast(StkId, ud); + CallInfo *ci = L->ci; + if (L->status == 0) { /* start coroutine? */ + lua_assert(ci == L->base_ci && firstArg > L->base); + if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) + return; + } + else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = 0; + if (!f_isLua(ci)) { /* `common' yield? */ + /* finish interrupted execution of `OP_CALL' */ + lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL || + GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL); + if (luaD_poscall(L, firstArg)) /* complete it... */ + L->top = L->ci->top; /* and correct top if not multiple results */ + } + else /* yielded inside a hook: just continue its execution */ + L->base = L->ci->base; + } + luaV_execute(L, cast_int(L->ci - L->base_ci)); +} + + +static int resume_error (lua_State *L, const char *msg) { + L->top = L->ci->base; + setsvalue2s(L, L->top, luaS_new(L, msg)); + incr_top(L); + lua_unlock(L); + return LUA_ERRRUN; +} + + +LUA_API int lua_resume (lua_State *L, int nargs) { + int status; + lua_lock(L); + if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) + return resume_error(L, "cannot resume non-suspended coroutine"); + if (L->nCcalls >= LUAI_MAXCCALLS) + return resume_error(L, "C stack overflow"); + luai_userstateresume(L, nargs); + lua_assert(L->errfunc == 0); + L->baseCcalls = ++L->nCcalls; + status = luaD_rawrunprotected(L, resume, L->top - nargs); + if (status != 0) { /* error? */ + L->status = cast_byte(status); /* mark thread as `dead' */ + luaD_seterrorobj(L, status, L->top); + L->ci->top = L->top; + } + else { + lua_assert(L->nCcalls == L->baseCcalls); + status = L->status; + } + --L->nCcalls; + lua_unlock(L); + return status; +} + + +LUA_API int lua_yield (lua_State *L, int nresults) { + luai_userstateyield(L, nresults); + lua_lock(L); + if (L->nCcalls > L->baseCcalls) + luaG_runerror(L, "attempt to yield across metamethod/C-call boundary"); + L->base = L->top - nresults; /* protect stack slots below */ + L->status = LUA_YIELD; + lua_unlock(L); + return -1; +} + + +int luaD_pcall (lua_State *L, Pfunc func, void *u, + ptrdiff_t old_top, ptrdiff_t ef) { + int status; + unsigned short oldnCcalls = L->nCcalls; + ptrdiff_t old_ci = saveci(L, L->ci); + lu_byte old_allowhooks = L->allowhook; + ptrdiff_t old_errfunc = L->errfunc; + L->errfunc = ef; + status = luaD_rawrunprotected(L, func, u); + if (status != 0) { /* an error occurred? */ + StkId oldtop = restorestack(L, old_top); + luaF_close(L, oldtop); /* close eventual pending closures */ + luaD_seterrorobj(L, status, oldtop); + L->nCcalls = oldnCcalls; + L->ci = restoreci(L, old_ci); + L->base = L->ci->base; + L->savedpc = L->ci->savedpc; + L->allowhook = old_allowhooks; + restore_stack_limit(L); + } + L->errfunc = old_errfunc; + return status; +} + + + +/* +** Execute a protected parser. +*/ +struct SParser { /* data to `f_parser' */ + ZIO *z; + Mbuffer buff; /* buffer to be used by the scanner */ + const char *name; +}; + +static void f_parser (lua_State *L, void *ud) { + int i; + Proto *tf; + Closure *cl; + struct SParser *p = cast(struct SParser *, ud); + int c = luaZ_lookahead(p->z); + luaC_checkGC(L); + tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z, + &p->buff, p->name); + cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L))); + cl->l.p = tf; + for (i = 0; i < tf->nups; i++) /* initialize eventual upvalues */ + cl->l.upvals[i] = luaF_newupval(L); + setclvalue(L, L->top, cl); + incr_top(L); +} + + +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { + struct SParser p; + int status; + p.z = z; p.name = name; + luaZ_initbuffer(L, &p.buff); + status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); + luaZ_freebuffer(L, &p.buff); + return status; +} + + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/ldo.h b/ThirdLib/thirdparty/LuaLib/ldo.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/ldo.h rename to ThirdLib/thirdparty/LuaLib/ldo.h diff --git a/ThirdLib/thirdparty/LuaLib/ldump.c b/ThirdLib/thirdparty/LuaLib/ldump.c new file mode 100644 index 000000000..c9d3d4870 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/ldump.c @@ -0,0 +1,164 @@ +/* +** $Id: ldump.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** save precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define ldump_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lundump.h" + +typedef struct { + lua_State* L; + lua_Writer writer; + void* data; + int strip; + int status; +} DumpState; + +#define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) +#define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) + +static void DumpBlock(const void* b, size_t size, DumpState* D) +{ + if (D->status==0) + { + lua_unlock(D->L); + D->status=(*D->writer)(D->L,b,size,D->data); + lua_lock(D->L); + } +} + +static void DumpChar(int y, DumpState* D) +{ + char x=(char)y; + DumpVar(x,D); +} + +static void DumpInt(int x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpNumber(lua_Number x, DumpState* D) +{ + DumpVar(x,D); +} + +static void DumpVector(const void* b, int n, size_t size, DumpState* D) +{ + DumpInt(n,D); + DumpMem(b,n,size,D); +} + +static void DumpString(const TString* s, DumpState* D) +{ + if (s==NULL || getstr(s)==NULL) + { + size_t size=0; + DumpVar(size,D); + } + else + { + size_t size=s->tsv.len+1; /* include trailing '\0' */ + DumpVar(size,D); + DumpBlock(getstr(s),size,D); + } +} + +#define DumpCode(f,D) DumpVector(f->code,f->sizecode,sizeof(Instruction),D) + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D); + +static void DumpConstants(const Proto* f, DumpState* D) +{ + int i,n=f->sizek; + DumpInt(n,D); + for (i=0; ik[i]; + DumpChar(ttype(o),D); + switch (ttype(o)) + { + case LUA_TNIL: + break; + case LUA_TBOOLEAN: + DumpChar(bvalue(o),D); + break; + case LUA_TNUMBER: + DumpNumber(nvalue(o),D); + break; + case LUA_TSTRING: + DumpString(rawtsvalue(o),D); + break; + default: + lua_assert(0); /* cannot happen */ + break; + } + } + n=f->sizep; + DumpInt(n,D); + for (i=0; ip[i],f->source,D); +} + +static void DumpDebug(const Proto* f, DumpState* D) +{ + int i,n; + n= (D->strip) ? 0 : f->sizelineinfo; + DumpVector(f->lineinfo,n,sizeof(int),D); + n= (D->strip) ? 0 : f->sizelocvars; + DumpInt(n,D); + for (i=0; ilocvars[i].varname,D); + DumpInt(f->locvars[i].startpc,D); + DumpInt(f->locvars[i].endpc,D); + } + n= (D->strip) ? 0 : f->sizeupvalues; + DumpInt(n,D); + for (i=0; iupvalues[i],D); +} + +static void DumpFunction(const Proto* f, const TString* p, DumpState* D) +{ + DumpString((f->source==p || D->strip) ? NULL : f->source,D); + DumpInt(f->linedefined,D); + DumpInt(f->lastlinedefined,D); + DumpChar(f->nups,D); + DumpChar(f->numparams,D); + DumpChar(f->is_vararg,D); + DumpChar(f->maxstacksize,D); + DumpCode(f,D); + DumpConstants(f,D); + DumpDebug(f,D); +} + +static void DumpHeader(DumpState* D) +{ + char h[LUAC_HEADERSIZE]; + luaU_header(h); + DumpBlock(h,LUAC_HEADERSIZE,D); +} + +/* +** dump Lua function as precompiled chunk +*/ +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) +{ + DumpState D; + D.L=L; + D.writer=w; + D.data=data; + D.strip=strip; + D.status=0; + DumpHeader(&D); + DumpFunction(f,NULL,&D); + return D.status; +} diff --git a/ThirdLib/thirdparty/LuaLib/lfunc.c b/ThirdLib/thirdparty/LuaLib/lfunc.c new file mode 100644 index 000000000..813e88f58 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lfunc.c @@ -0,0 +1,174 @@ +/* +** $Id: lfunc.c,v 2.12.1.2 2007/12/28 14:58:43 roberto Exp $ +** Auxiliary functions to manipulate prototypes and closures +** See Copyright Notice in lua.h +*/ + + +#include + +#define lfunc_c +#define LUA_CORE + +#include "lua.h" + +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->c.isC = 1; + c->c.env = e; + c->c.nupvalues = cast_byte(nelems); + return c; +} + + +Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) { + Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems))); + luaC_link(L, obj2gco(c), LUA_TFUNCTION); + c->l.isC = 0; + c->l.env = e; + c->l.nupvalues = cast_byte(nelems); + while (nelems--) c->l.upvals[nelems] = NULL; + return c; +} + + +UpVal *luaF_newupval (lua_State *L) { + UpVal *uv = luaM_new(L, UpVal); + luaC_link(L, obj2gco(uv), LUA_TUPVAL); + uv->v = &uv->u.value; + setnilvalue(uv->v); + return uv; +} + + +UpVal *luaF_findupval (lua_State *L, StkId level) { + global_State *g = G(L); + GCObject **pp = &L->openupval; + UpVal *p; + UpVal *uv; + while (*pp != NULL && (p = ngcotouv(*pp))->v >= level) { + lua_assert(p->v != &p->u.value); + if (p->v == level) { /* found a corresponding upvalue? */ + if (isdead(g, obj2gco(p))) /* is it dead? */ + changewhite(obj2gco(p)); /* ressurect it */ + return p; + } + pp = &p->next; + } + uv = luaM_new(L, UpVal); /* not found: create a new one */ + uv->tt = LUA_TUPVAL; + uv->marked = luaC_white(g); + uv->v = level; /* current value lives in the stack */ + uv->next = *pp; /* chain it in the proper position */ + *pp = obj2gco(uv); + uv->u.l.prev = &g->uvhead; /* double link it in `uvhead' list */ + uv->u.l.next = g->uvhead.u.l.next; + uv->u.l.next->u.l.prev = uv; + g->uvhead.u.l.next = uv; + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + return uv; +} + + +static void unlinkupval (UpVal *uv) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ + uv->u.l.prev->u.l.next = uv->u.l.next; +} + + +void luaF_freeupval (lua_State *L, UpVal *uv) { + if (uv->v != &uv->u.value) /* is it open? */ + unlinkupval(uv); /* remove from open list */ + luaM_free(L, uv); /* free upvalue */ +} + + +void luaF_close (lua_State *L, StkId level) { + UpVal *uv; + global_State *g = G(L); + while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { + GCObject *o = obj2gco(uv); + lua_assert(!isblack(o) && uv->v != &uv->u.value); + L->openupval = uv->next; /* remove from `open' list */ + if (isdead(g, o)) + luaF_freeupval(L, uv); /* free upvalue */ + else { + unlinkupval(uv); + setobj(L, &uv->u.value, uv->v); + uv->v = &uv->u.value; /* now current value lives here */ + luaC_linkupval(L, uv); /* link upvalue into `gcroot' list */ + } + } +} + + +Proto *luaF_newproto (lua_State *L) { + Proto *f = luaM_new(L, Proto); + luaC_link(L, obj2gco(f), LUA_TPROTO); + f->k = NULL; + f->sizek = 0; + f->p = NULL; + f->sizep = 0; + f->code = NULL; + f->sizecode = 0; + f->sizelineinfo = 0; + f->sizeupvalues = 0; + f->nups = 0; + f->upvalues = NULL; + f->numparams = 0; + f->is_vararg = 0; + f->maxstacksize = 0; + f->lineinfo = NULL; + f->sizelocvars = 0; + f->locvars = NULL; + f->linedefined = 0; + f->lastlinedefined = 0; + f->source = NULL; + return f; +} + + +void luaF_freeproto (lua_State *L, Proto *f) { + luaM_freearray(L, f->code, f->sizecode, Instruction); + luaM_freearray(L, f->p, f->sizep, Proto *); + luaM_freearray(L, f->k, f->sizek, TValue); + luaM_freearray(L, f->lineinfo, f->sizelineinfo, int); + luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); + luaM_freearray(L, f->upvalues, f->sizeupvalues, TString *); + luaM_free(L, f); +} + + +void luaF_freeclosure (lua_State *L, Closure *c) { + int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : + sizeLclosure(c->l.nupvalues); + luaM_freemem(L, c, size); +} + + +/* +** Look for n-th local variable at line `line' in function `func'. +** Returns NULL if not found. +*/ +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { + int i; + for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { + if (pc < f->locvars[i].endpc) { /* is variable active? */ + local_number--; + if (local_number == 0) + return getstr(f->locvars[i].varname); + } + } + return NULL; /* not found */ +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lfunc.h b/ThirdLib/thirdparty/LuaLib/lfunc.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lfunc.h rename to ThirdLib/thirdparty/LuaLib/lfunc.h diff --git a/ThirdLib/thirdparty/LuaLib/lgc.c b/ThirdLib/thirdparty/LuaLib/lgc.c new file mode 100644 index 000000000..d9e0b7829 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lgc.c @@ -0,0 +1,711 @@ +/* +** $Id: lgc.c,v 2.38.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#include + +#define lgc_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define GCSTEPSIZE 1024u +#define GCSWEEPMAX 40 +#define GCSWEEPCOST 10 +#define GCFINALIZECOST 100 + + +#define maskmarks cast_byte(~(bitmask(BLACKBIT)|WHITEBITS)) + +#define makewhite(g,x) \ + ((x)->gch.marked = cast_byte(((x)->gch.marked & maskmarks) | luaC_white(g))) + +#define white2gray(x) reset2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define black2gray(x) resetbit((x)->gch.marked, BLACKBIT) + +#define stringmark(s) reset2bits((s)->tsv.marked, WHITE0BIT, WHITE1BIT) + + +#define isfinalized(u) testbit((u)->marked, FINALIZEDBIT) +#define markfinalized(u) l_setbit((u)->marked, FINALIZEDBIT) + + +#define KEYWEAK bitmask(KEYWEAKBIT) +#define VALUEWEAK bitmask(VALUEWEAKBIT) + + + +#define markvalue(g,o) { checkconsistency(o); \ + if (iscollectable(o) && iswhite(gcvalue(o))) reallymarkobject(g,gcvalue(o)); } + +#define markobject(g,t) { if (iswhite(obj2gco(t))) \ + reallymarkobject(g, obj2gco(t)); } + + +#define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) + + +static void removeentry (Node *n) { + lua_assert(ttisnil(gval(n))); + if (iscollectable(gkey(n))) + setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */ +} + + +static void reallymarkobject (global_State *g, GCObject *o) { + lua_assert(iswhite(o) && !isdead(g, o)); + white2gray(o); + switch (o->gch.tt) { + case LUA_TSTRING: { + return; + } + case LUA_TUSERDATA: { + Table *mt = gco2u(o)->metatable; + gray2black(o); /* udata are never gray */ + if (mt) markobject(g, mt); + markobject(g, gco2u(o)->env); + return; + } + case LUA_TUPVAL: { + UpVal *uv = gco2uv(o); + markvalue(g, uv->v); + if (uv->v == &uv->u.value) /* closed? */ + gray2black(o); /* open upvalues are never black */ + return; + } + case LUA_TFUNCTION: { + gco2cl(o)->c.gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTABLE: { + gco2h(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TTHREAD: { + gco2th(o)->gclist = g->gray; + g->gray = o; + break; + } + case LUA_TPROTO: { + gco2p(o)->gclist = g->gray; + g->gray = o; + break; + } + default: lua_assert(0); + } +} + + +static void marktmu (global_State *g) { + GCObject *u = g->tmudata; + if (u) { + do { + u = u->gch.next; + makewhite(g, u); /* may be marked, if left from previous GC */ + reallymarkobject(g, u); + } while (u != g->tmudata); + } +} + + +/* move `dead' udata that need finalization to list `tmudata' */ +size_t luaC_separateudata (lua_State *L, int all) { + global_State *g = G(L); + size_t deadmem = 0; + GCObject **p = &g->mainthread->next; + GCObject *curr; + while ((curr = *p) != NULL) { + if (!(iswhite(curr) || all) || isfinalized(gco2u(curr))) + p = &curr->gch.next; /* don't bother with them */ + else if (fasttm(L, gco2u(curr)->metatable, TM_GC) == NULL) { + markfinalized(gco2u(curr)); /* don't need finalization */ + p = &curr->gch.next; + } + else { /* must call its gc method */ + deadmem += sizeudata(gco2u(curr)); + markfinalized(gco2u(curr)); + *p = curr->gch.next; + /* link `curr' at the end of `tmudata' list */ + if (g->tmudata == NULL) /* list is empty? */ + g->tmudata = curr->gch.next = curr; /* creates a circular list */ + else { + curr->gch.next = g->tmudata->gch.next; + g->tmudata->gch.next = curr; + g->tmudata = curr; + } + } + } + return deadmem; +} + + +static int traversetable (global_State *g, Table *h) { + int i; + int weakkey = 0; + int weakvalue = 0; + const TValue *mode; + if (h->metatable) + markobject(g, h->metatable); + mode = gfasttm(g, h->metatable, TM_MODE); + if (mode && ttisstring(mode)) { /* is there a weak mode? */ + weakkey = (strchr(svalue(mode), 'k') != NULL); + weakvalue = (strchr(svalue(mode), 'v') != NULL); + if (weakkey || weakvalue) { /* is really weak? */ + h->marked &= ~(KEYWEAK | VALUEWEAK); /* clear bits */ + h->marked |= cast_byte((weakkey << KEYWEAKBIT) | + (weakvalue << VALUEWEAKBIT)); + h->gclist = g->weak; /* must be cleared after GC, ... */ + g->weak = obj2gco(h); /* ... so put in the appropriate list */ + } + } + if (weakkey && weakvalue) return 1; + if (!weakvalue) { + i = h->sizearray; + while (i--) + markvalue(g, &h->array[i]); + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + lua_assert(ttype(gkey(n)) != LUA_TDEADKEY || ttisnil(gval(n))); + if (ttisnil(gval(n))) + removeentry(n); /* remove empty entries */ + else { + lua_assert(!ttisnil(gkey(n))); + if (!weakkey) markvalue(g, gkey(n)); + if (!weakvalue) markvalue(g, gval(n)); + } + } + return weakkey || weakvalue; +} + + +/* +** All marks are conditional because a GC may happen while the +** prototype is still being created +*/ +static void traverseproto (global_State *g, Proto *f) { + int i; + if (f->source) stringmark(f->source); + for (i=0; isizek; i++) /* mark literals */ + markvalue(g, &f->k[i]); + for (i=0; isizeupvalues; i++) { /* mark upvalue names */ + if (f->upvalues[i]) + stringmark(f->upvalues[i]); + } + for (i=0; isizep; i++) { /* mark nested protos */ + if (f->p[i]) + markobject(g, f->p[i]); + } + for (i=0; isizelocvars; i++) { /* mark local-variable names */ + if (f->locvars[i].varname) + stringmark(f->locvars[i].varname); + } +} + + + +static void traverseclosure (global_State *g, Closure *cl) { + markobject(g, cl->c.env); + if (cl->c.isC) { + int i; + for (i=0; ic.nupvalues; i++) /* mark its upvalues */ + markvalue(g, &cl->c.upvalue[i]); + } + else { + int i; + lua_assert(cl->l.nupvalues == cl->l.p->nups); + markobject(g, cl->l.p); + for (i=0; il.nupvalues; i++) /* mark its upvalues */ + markobject(g, cl->l.upvals[i]); + } +} + + +static void checkstacksizes (lua_State *L, StkId max) { + int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ + int s_used = cast_int(max - L->stack); /* part of stack in use */ + if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ + return; /* do not touch the stacks */ + if (4*ci_used < L->size_ci && 2*BASIC_CI_SIZE < L->size_ci) + luaD_reallocCI(L, L->size_ci/2); /* still big enough... */ + condhardstacktests(luaD_reallocCI(L, ci_used + 1)); + if (4*s_used < L->stacksize && + 2*(BASIC_STACK_SIZE+EXTRA_STACK) < L->stacksize) + luaD_reallocstack(L, L->stacksize/2); /* still big enough... */ + condhardstacktests(luaD_reallocstack(L, s_used)); +} + + +static void traversestack (global_State *g, lua_State *l) { + StkId o, lim; + CallInfo *ci; + markvalue(g, gt(l)); + lim = l->top; + for (ci = l->base_ci; ci <= l->ci; ci++) { + lua_assert(ci->top <= l->stack_last); + if (lim < ci->top) lim = ci->top; + } + for (o = l->stack; o < l->top; o++) + markvalue(g, o); + for (; o <= lim; o++) + setnilvalue(o); + checkstacksizes(l, lim); +} + + +/* +** traverse one gray object, turning it to black. +** Returns `quantity' traversed. +*/ +static l_mem propagatemark (global_State *g) { + GCObject *o = g->gray; + lua_assert(isgray(o)); + gray2black(o); + switch (o->gch.tt) { + case LUA_TTABLE: { + Table *h = gco2h(o); + g->gray = h->gclist; + if (traversetable(g, h)) /* table is weak? */ + black2gray(o); /* keep it gray */ + return sizeof(Table) + sizeof(TValue) * h->sizearray + + sizeof(Node) * sizenode(h); + } + case LUA_TFUNCTION: { + Closure *cl = gco2cl(o); + g->gray = cl->c.gclist; + traverseclosure(g, cl); + return (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) : + sizeLclosure(cl->l.nupvalues); + } + case LUA_TTHREAD: { + lua_State *th = gco2th(o); + g->gray = th->gclist; + th->gclist = g->grayagain; + g->grayagain = o; + black2gray(o); + traversestack(g, th); + return sizeof(lua_State) + sizeof(TValue) * th->stacksize + + sizeof(CallInfo) * th->size_ci; + } + case LUA_TPROTO: { + Proto *p = gco2p(o); + g->gray = p->gclist; + traverseproto(g, p); + return sizeof(Proto) + sizeof(Instruction) * p->sizecode + + sizeof(Proto *) * p->sizep + + sizeof(TValue) * p->sizek + + sizeof(int) * p->sizelineinfo + + sizeof(LocVar) * p->sizelocvars + + sizeof(TString *) * p->sizeupvalues; + } + default: lua_assert(0); return 0; + } +} + + +static size_t propagateall (global_State *g) { + size_t m = 0; + while (g->gray) m += propagatemark(g); + return m; +} + + +/* +** The next function tells whether a key or value can be cleared from +** a weak table. Non-collectable objects are never removed from weak +** tables. Strings behave as `values', so are never removed too. for +** other objects: if really collected, cannot keep them; for userdata +** being finalized, keep them in keys, but not in values +*/ +static int iscleared (const TValue *o, int iskey) { + if (!iscollectable(o)) return 0; + if (ttisstring(o)) { + stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ + return 0; + } + return iswhite(gcvalue(o)) || + (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); +} + + +/* +** clear collected entries from weaktables +*/ +static void cleartable (GCObject *l) { + while (l) { + Table *h = gco2h(l); + int i = h->sizearray; + lua_assert(testbit(h->marked, VALUEWEAKBIT) || + testbit(h->marked, KEYWEAKBIT)); + if (testbit(h->marked, VALUEWEAKBIT)) { + while (i--) { + TValue *o = &h->array[i]; + if (iscleared(o, 0)) /* value was collected? */ + setnilvalue(o); /* remove value */ + } + } + i = sizenode(h); + while (i--) { + Node *n = gnode(h, i); + if (!ttisnil(gval(n)) && /* non-empty entry? */ + (iscleared(key2tval(n), 1) || iscleared(gval(n), 0))) { + setnilvalue(gval(n)); /* remove value ... */ + removeentry(n); /* remove entry from table */ + } + } + l = h->gclist; + } +} + + +static void freeobj (lua_State *L, GCObject *o) { + switch (o->gch.tt) { + case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; + case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; + case LUA_TUPVAL: luaF_freeupval(L, gco2uv(o)); break; + case LUA_TTABLE: luaH_free(L, gco2h(o)); break; + case LUA_TTHREAD: { + lua_assert(gco2th(o) != L && gco2th(o) != G(L)->mainthread); + luaE_freethread(L, gco2th(o)); + break; + } + case LUA_TSTRING: { + G(L)->strt.nuse--; + luaM_freemem(L, o, sizestring(gco2ts(o))); + break; + } + case LUA_TUSERDATA: { + luaM_freemem(L, o, sizeudata(gco2u(o))); + break; + } + default: lua_assert(0); + } +} + + + +#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) + + +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { + GCObject *curr; + global_State *g = G(L); + int deadmask = otherwhite(g); + while ((curr = *p) != NULL && count-- > 0) { + if (curr->gch.tt == LUA_TTHREAD) /* sweep open upvalues of each thread */ + sweepwholelist(L, &gco2th(curr)->openupval); + if ((curr->gch.marked ^ WHITEBITS) & deadmask) { /* not dead? */ + lua_assert(!isdead(g, curr) || testbit(curr->gch.marked, FIXEDBIT)); + makewhite(g, curr); /* make it white (for next cycle) */ + p = &curr->gch.next; + } + else { /* must erase `curr' */ + lua_assert(isdead(g, curr) || deadmask == bitmask(SFIXEDBIT)); + *p = curr->gch.next; + if (curr == g->rootgc) /* is the first element of the list? */ + g->rootgc = curr->gch.next; /* adjust first */ + freeobj(L, curr); + } + } + return p; +} + + +static void checkSizes (lua_State *L) { + global_State *g = G(L); + /* check size of string hash */ + if (g->strt.nuse < cast(lu_int32, g->strt.size/4) && + g->strt.size > MINSTRTABSIZE*2) + luaS_resize(L, g->strt.size/2); /* table is too big */ + /* check size of buffer */ + if (luaZ_sizebuffer(&g->buff) > LUA_MINBUFFER*2) { /* buffer too big? */ + size_t newsize = luaZ_sizebuffer(&g->buff) / 2; + luaZ_resizebuffer(L, &g->buff, newsize); + } +} + + +static void GCTM (lua_State *L) { + global_State *g = G(L); + GCObject *o = g->tmudata->gch.next; /* get first element */ + Udata *udata = rawgco2u(o); + const TValue *tm; + /* remove udata from `tmudata' */ + if (o == g->tmudata) /* last element? */ + g->tmudata = NULL; + else + g->tmudata->gch.next = udata->uv.next; + udata->uv.next = g->mainthread->next; /* return it to `root' list */ + g->mainthread->next = o; + makewhite(g, o); + tm = fasttm(L, udata->uv.metatable, TM_GC); + if (tm != NULL) { + lu_byte oldah = L->allowhook; + lu_mem oldt = g->GCthreshold; + L->allowhook = 0; /* stop debug hooks during GC tag method */ + g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */ + setobj2s(L, L->top, tm); + setuvalue(L, L->top+1, udata); + L->top += 2; + luaD_call(L, L->top - 2, 0); + L->allowhook = oldah; /* restore hooks */ + g->GCthreshold = oldt; /* restore threshold */ + } +} + + +/* +** Call all GC tag methods +*/ +void luaC_callGCTM (lua_State *L) { + while (G(L)->tmudata) + GCTM(L); +} + + +void luaC_freeall (lua_State *L) { + global_State *g = G(L); + int i; + g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */ + sweepwholelist(L, &g->rootgc); + for (i = 0; i < g->strt.size; i++) /* free all string lists */ + sweepwholelist(L, &g->strt.hash[i]); +} + + +static void markmt (global_State *g) { + int i; + for (i=0; imt[i]) markobject(g, g->mt[i]); +} + + +/* mark root set */ +static void markroot (lua_State *L) { + global_State *g = G(L); + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + markobject(g, g->mainthread); + /* make global table be traversed before main stack */ + markvalue(g, gt(g->mainthread)); + markvalue(g, registry(L)); + markmt(g); + g->gcstate = GCSpropagate; +} + + +static void remarkupvals (global_State *g) { + UpVal *uv; + for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { + lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); + if (isgray(obj2gco(uv))) + markvalue(g, uv->v); + } +} + + +static void atomic (lua_State *L) { + global_State *g = G(L); + size_t udsize; /* total size of userdata to be finalized */ + /* remark occasional upvalues of (maybe) dead threads */ + remarkupvals(g); + /* traverse objects cautch by write barrier and by 'remarkupvals' */ + propagateall(g); + /* remark weak tables */ + g->gray = g->weak; + g->weak = NULL; + lua_assert(!iswhite(obj2gco(g->mainthread))); + markobject(g, L); /* mark running thread */ + markmt(g); /* mark basic metatables (again) */ + propagateall(g); + /* remark gray again */ + g->gray = g->grayagain; + g->grayagain = NULL; + propagateall(g); + udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ + marktmu(g); /* mark `preserved' userdata */ + udsize += propagateall(g); /* remark, to propagate `preserveness' */ + cleartable(g->weak); /* remove collected objects from weak tables */ + /* flip current white */ + g->currentwhite = cast_byte(otherwhite(g)); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gcstate = GCSsweepstring; + g->estimate = g->totalbytes - udsize; /* first estimate */ +} + + +static l_mem singlestep (lua_State *L) { + global_State *g = G(L); + /*lua_checkmemory(L);*/ + switch (g->gcstate) { + case GCSpause: { + markroot(L); /* start a new collection */ + return 0; + } + case GCSpropagate: { + if (g->gray) + return propagatemark(g); + else { /* no more `gray' objects */ + atomic(L); /* finish mark phase */ + return 0; + } + } + case GCSsweepstring: { + lu_mem old = g->totalbytes; + sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); + if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */ + g->gcstate = GCSsweep; /* end sweep-string phase */ + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPCOST; + } + case GCSsweep: { + lu_mem old = g->totalbytes; + g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); + if (*g->sweepgc == NULL) { /* nothing more to sweep? */ + checkSizes(L); + g->gcstate = GCSfinalize; /* end sweep phase */ + } + lua_assert(old >= g->totalbytes); + g->estimate -= old - g->totalbytes; + return GCSWEEPMAX*GCSWEEPCOST; + } + case GCSfinalize: { + if (g->tmudata) { + GCTM(L); + if (g->estimate > GCFINALIZECOST) + g->estimate -= GCFINALIZECOST; + return GCFINALIZECOST; + } + else { + g->gcstate = GCSpause; /* end collection */ + g->gcdept = 0; + return 0; + } + } + default: lua_assert(0); return 0; + } +} + + +void luaC_step (lua_State *L) { + global_State *g = G(L); + l_mem lim = (GCSTEPSIZE/100) * g->gcstepmul; + if (lim == 0) + lim = (MAX_LUMEM-1)/2; /* no limit */ + g->gcdept += g->totalbytes - g->GCthreshold; + do { + lim -= singlestep(L); + if (g->gcstate == GCSpause) + break; + } while (lim > 0); + if (g->gcstate != GCSpause) { + if (g->gcdept < GCSTEPSIZE) + g->GCthreshold = g->totalbytes + GCSTEPSIZE; /* - lim/g->gcstepmul;*/ + else { + g->gcdept -= GCSTEPSIZE; + g->GCthreshold = g->totalbytes; + } + } + else { + lua_assert(g->totalbytes >= g->estimate); + setthreshold(g); + } +} + + +void luaC_fullgc (lua_State *L) { + global_State *g = G(L); + if (g->gcstate <= GCSpropagate) { + /* reset sweep marks to sweep all elements (returning them to white) */ + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + /* reset other collector lists */ + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->gcstate = GCSsweepstring; + } + lua_assert(g->gcstate != GCSpause && g->gcstate != GCSpropagate); + /* finish any pending sweep phase */ + while (g->gcstate != GCSfinalize) { + lua_assert(g->gcstate == GCSsweepstring || g->gcstate == GCSsweep); + singlestep(L); + } + markroot(L); + while (g->gcstate != GCSpause) { + singlestep(L); + } + setthreshold(g); +} + + +void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { + global_State *g = G(L); + lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + lua_assert(ttype(&o->gch) != LUA_TTABLE); + /* must keep invariant? */ + if (g->gcstate == GCSpropagate) + reallymarkobject(g, v); /* restore invariant */ + else /* don't mind */ + makewhite(g, o); /* mark as white just to avoid other barriers */ +} + + +void luaC_barrierback (lua_State *L, Table *t) { + global_State *g = G(L); + GCObject *o = obj2gco(t); + lua_assert(isblack(o) && !isdead(g, o)); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + black2gray(o); /* make table gray (again) */ + t->gclist = g->grayagain; + g->grayagain = o; +} + + +void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { + global_State *g = G(L); + o->gch.next = g->rootgc; + g->rootgc = o; + o->gch.marked = luaC_white(g); + o->gch.tt = tt; +} + + +void luaC_linkupval (lua_State *L, UpVal *uv) { + global_State *g = G(L); + GCObject *o = obj2gco(uv); + o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ + g->rootgc = o; + if (isgray(o)) { + if (g->gcstate == GCSpropagate) { + gray2black(o); /* closed upvalues need barrier */ + luaC_barrier(L, uv, uv->v); + } + else { /* sweep phase: sweep it (turning it into white) */ + makewhite(g, o); + lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); + } + } +} + diff --git a/ThirdLib/thirdparty/LuaLib/lgc.h b/ThirdLib/thirdparty/LuaLib/lgc.h new file mode 100644 index 000000000..5a8dc605b --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lgc.h @@ -0,0 +1,110 @@ +/* +** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ +** Garbage Collector +** See Copyright Notice in lua.h +*/ + +#ifndef lgc_h +#define lgc_h + + +#include "lobject.h" + + +/* +** Possible states of the Garbage Collector +*/ +#define GCSpause 0 +#define GCSpropagate 1 +#define GCSsweepstring 2 +#define GCSsweep 3 +#define GCSfinalize 4 + + +/* +** some userful bit tricks +*/ +#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) +#define setbits(x,m) ((x) |= (m)) +#define testbits(x,m) ((x) & (m)) +#define bitmask(b) (1<<(b)) +#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) +#define l_setbit(x,b) setbits(x, bitmask(b)) +#define resetbit(x,b) resetbits(x, bitmask(b)) +#define testbit(x,b) testbits(x, bitmask(b)) +#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) +#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) +#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) + + + +/* +** Layout for bit use in `marked' field: +** bit 0 - object is white (type 0) +** bit 1 - object is white (type 1) +** bit 2 - object is black +** bit 3 - for userdata: has been finalized +** bit 3 - for tables: has weak keys +** bit 4 - for tables: has weak values +** bit 5 - object is fixed (should not be collected) +** bit 6 - object is "super" fixed (only the main thread) +*/ + + +#define WHITE0BIT 0 +#define WHITE1BIT 1 +#define BLACKBIT 2 +#define FINALIZEDBIT 3 +#define KEYWEAKBIT 3 +#define VALUEWEAKBIT 4 +#define FIXEDBIT 5 +#define SFIXEDBIT 6 +#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) + + +#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) +#define isblack(x) testbit((x)->gch.marked, BLACKBIT) +#define isgray(x) (!isblack(x) && !iswhite(x)) + +#define otherwhite(g) (g->currentwhite ^ WHITEBITS) +#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) + +#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) +#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) + +#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) + +#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) + + +#define luaC_checkGC(L) { \ + condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ + if (G(L)->totalbytes >= G(L)->GCthreshold) \ + luaC_step(L); } + + +#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),gcvalue(v)); } + +#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ + luaC_barrierback(L,t); } + +#define luaC_objbarrier(L,p,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ + luaC_barrierf(L,obj2gco(p),obj2gco(o)); } + +#define luaC_objbarriert(L,t,o) \ + { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } + +LUAI_FUNC size_t luaC_separateudata (lua_State *L, int all); +LUAI_FUNC void luaC_callGCTM (lua_State *L); +LUAI_FUNC void luaC_freeall (lua_State *L); +LUAI_FUNC void luaC_step (lua_State *L); +LUAI_FUNC void luaC_fullgc (lua_State *L); +LUAI_FUNC void luaC_link (lua_State *L, GCObject *o, lu_byte tt); +LUAI_FUNC void luaC_linkupval (lua_State *L, UpVal *uv); +LUAI_FUNC void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v); +LUAI_FUNC void luaC_barrierback (lua_State *L, Table *t); + + +#endif diff --git a/ThirdLib/thirdparty/LuaLib/linit.c b/ThirdLib/thirdparty/LuaLib/linit.c new file mode 100644 index 000000000..c1f90dfab --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/linit.c @@ -0,0 +1,38 @@ +/* +** $Id: linit.c,v 1.14.1.1 2007/12/27 13:02:25 roberto Exp $ +** Initialization of libraries for lua.c +** See Copyright Notice in lua.h +*/ + + +#define linit_c +#define LUA_LIB + +#include "lua.h" + +#include "lualib.h" +#include "lauxlib.h" + + +static const luaL_Reg lualibs[] = { + {"", luaopen_base}, + {LUA_LOADLIBNAME, luaopen_package}, + {LUA_TABLIBNAME, luaopen_table}, + {LUA_IOLIBNAME, luaopen_io}, + {LUA_OSLIBNAME, luaopen_os}, + {LUA_STRLIBNAME, luaopen_string}, + {LUA_MATHLIBNAME, luaopen_math}, + {LUA_DBLIBNAME, luaopen_debug}, + {NULL, NULL} +}; + + +LUALIB_API void luaL_openlibs (lua_State *L) { + const luaL_Reg *lib = lualibs; + for (; lib->func; lib++) { + lua_pushcfunction(L, lib->func); + lua_pushstring(L, lib->name); + lua_call(L, 1, 0); + } +} + diff --git a/ThirdLib/thirdparty/LuaLib/liolib.c b/ThirdLib/thirdparty/LuaLib/liolib.c new file mode 100644 index 000000000..e79ed1cb2 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/liolib.c @@ -0,0 +1,553 @@ +/* +** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $ +** Standard I/O (and system) library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include + +#define liolib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + + +#define IO_INPUT 1 +#define IO_OUTPUT 2 + + +static const char *const fnames[] = {"input", "output"}; + + +static int pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + if (filename) + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + else + lua_pushfstring(L, "%s", strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static void fileerror (lua_State *L, int arg, const char *filename) { + lua_pushfstring(L, "%s: %s", filename, strerror(errno)); + luaL_argerror(L, arg, lua_tostring(L, -1)); +} + + +#define tofilep(L) ((FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE)) + + +static int io_type (lua_State *L) { + void *ud; + luaL_checkany(L, 1); + ud = lua_touserdata(L, 1); + lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE); + if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1)) + lua_pushnil(L); /* not a file */ + else if (*((FILE **)ud) == NULL) + lua_pushliteral(L, "closed file"); + else + lua_pushliteral(L, "file"); + return 1; +} + + +static FILE *tofile (lua_State *L) { + FILE **f = tofilep(L); + if (*f == NULL) + luaL_error(L, "attempt to use a closed file"); + return *f; +} + + + +/* +** When creating file handles, always creates a `closed' file handle +** before opening the actual file; so, if there is a memory error, the +** file is not left opened. +*/ +static FILE **newfile (lua_State *L) { + FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *)); + *pf = NULL; /* file handle is currently `closed' */ + luaL_getmetatable(L, LUA_FILEHANDLE); + lua_setmetatable(L, -2); + return pf; +} + + +/* +** function to (not) close the standard files stdin, stdout, and stderr +*/ +static int io_noclose (lua_State *L) { + lua_pushnil(L); + lua_pushliteral(L, "cannot close standard file"); + return 2; +} + + +/* +** function to close 'popen' files +*/ +static int io_pclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = lua_pclose(L, *p); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +/* +** function to close regular files +*/ +static int io_fclose (lua_State *L) { + FILE **p = tofilep(L); + int ok = (fclose(*p) == 0); + *p = NULL; + return pushresult(L, ok, NULL); +} + + +static int aux_close (lua_State *L) { + lua_getfenv(L, 1); + lua_getfield(L, -1, "__close"); + return (lua_tocfunction(L, -1))(L); +} + + +static int io_close (lua_State *L) { + if (lua_isnone(L, 1)) + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_OUTPUT); + tofile(L); /* make sure argument is a file */ + return aux_close(L); +} + + +static int io_gc (lua_State *L) { + FILE *f = *tofilep(L); + /* ignore closed files */ + if (f != NULL) + aux_close(L); + return 0; +} + + +static int io_tostring (lua_State *L) { + FILE *f = *tofilep(L); + if (f == NULL) + lua_pushliteral(L, "file (closed)"); + else + lua_pushfstring(L, "file (%p)", f); + return 1; +} + + +static int io_open (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +/* +** this function has a separated environment, which defines the +** correct __close for 'popen' files +*/ +static int io_popen (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + const char *mode = luaL_optstring(L, 2, "r"); + FILE **pf = newfile(L); + *pf = lua_popen(L, filename, mode); + return (*pf == NULL) ? pushresult(L, 0, filename) : 1; +} + + +static int io_tmpfile (lua_State *L) { + FILE **pf = newfile(L); + *pf = tmpfile(); + return (*pf == NULL) ? pushresult(L, 0, NULL) : 1; +} + + +static FILE *getiofile (lua_State *L, int findex) { + FILE *f; + lua_rawgeti(L, LUA_ENVIRONINDEX, findex); + f = *(FILE **)lua_touserdata(L, -1); + if (f == NULL) + luaL_error(L, "standard %s file is closed", fnames[findex - 1]); + return f; +} + + +static int g_iofile (lua_State *L, int f, const char *mode) { + if (!lua_isnoneornil(L, 1)) { + const char *filename = lua_tostring(L, 1); + if (filename) { + FILE **pf = newfile(L); + *pf = fopen(filename, mode); + if (*pf == NULL) + fileerror(L, 1, filename); + } + else { + tofile(L); /* check that it's a valid file handle */ + lua_pushvalue(L, 1); + } + lua_rawseti(L, LUA_ENVIRONINDEX, f); + } + /* return current value */ + lua_rawgeti(L, LUA_ENVIRONINDEX, f); + return 1; +} + + +static int io_input (lua_State *L) { + return g_iofile(L, IO_INPUT, "r"); +} + + +static int io_output (lua_State *L) { + return g_iofile(L, IO_OUTPUT, "w"); +} + + +static int io_readline (lua_State *L); + + +static void aux_lines (lua_State *L, int idx, int toclose) { + lua_pushvalue(L, idx); + lua_pushboolean(L, toclose); /* close/not close file when finished */ + lua_pushcclosure(L, io_readline, 2); +} + + +static int f_lines (lua_State *L) { + tofile(L); /* check that it's a valid file handle */ + aux_lines(L, 1, 0); + return 1; +} + + +static int io_lines (lua_State *L) { + if (lua_isnoneornil(L, 1)) { /* no arguments? */ + /* will iterate over default input */ + lua_rawgeti(L, LUA_ENVIRONINDEX, IO_INPUT); + return f_lines(L); + } + else { + const char *filename = luaL_checkstring(L, 1); + FILE **pf = newfile(L); + *pf = fopen(filename, "r"); + if (*pf == NULL) + fileerror(L, 1, filename); + aux_lines(L, lua_gettop(L), 1); + return 1; + } +} + + +/* +** {====================================================== +** READ +** ======================================================= +*/ + + +static int read_number (lua_State *L, FILE *f) { + lua_Number d; + if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) { + lua_pushnumber(L, d); + return 1; + } + else return 0; /* read fails */ +} + + +static int test_eof (lua_State *L, FILE *f) { + int c = getc(f); + ungetc(c, f); + lua_pushlstring(L, NULL, 0); + return (c != EOF); +} + + +static int read_line (lua_State *L, FILE *f) { + luaL_Buffer b; + luaL_buffinit(L, &b); + for (;;) { + size_t l; + char *p = luaL_prepbuffer(&b); + if (fgets(p, LUAL_BUFFERSIZE, f) == NULL) { /* eof? */ + luaL_pushresult(&b); /* close buffer */ + return (lua_objlen(L, -1) > 0); /* check whether read something */ + } + l = strlen(p); + if (l == 0 || p[l-1] != '\n') + luaL_addsize(&b, l); + else { + luaL_addsize(&b, l - 1); /* do not include `eol' */ + luaL_pushresult(&b); /* close buffer */ + return 1; /* read at least an `eol' */ + } + } +} + + +static int read_chars (lua_State *L, FILE *f, size_t n) { + size_t rlen; /* how much to read */ + size_t nr; /* number of chars actually read */ + luaL_Buffer b; + luaL_buffinit(L, &b); + rlen = LUAL_BUFFERSIZE; /* try to read that much each time */ + do { + char *p = luaL_prepbuffer(&b); + if (rlen > n) rlen = n; /* cannot read more than asked */ + nr = fread(p, sizeof(char), rlen, f); + luaL_addsize(&b, nr); + n -= nr; /* still have to read `n' chars */ + } while (n > 0 && nr == rlen); /* until end of count or eof */ + luaL_pushresult(&b); /* close buffer */ + return (n == 0 || lua_objlen(L, -1) > 0); +} + + +static int g_read (lua_State *L, FILE *f, int first) { + int nargs = lua_gettop(L) - 1; + int success; + int n; + clearerr(f); + if (nargs == 0) { /* no arguments? */ + success = read_line(L, f); + n = first+1; /* to return 1 result */ + } + else { /* ensure stack space for all results and for auxlib's buffer */ + luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); + success = 1; + for (n = first; nargs-- && success; n++) { + if (lua_type(L, n) == LUA_TNUMBER) { + size_t l = (size_t)lua_tointeger(L, n); + success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); + } + else { + const char *p = lua_tostring(L, n); + luaL_argcheck(L, p && p[0] == '*', n, "invalid option"); + switch (p[1]) { + case 'n': /* number */ + success = read_number(L, f); + break; + case 'l': /* line */ + success = read_line(L, f); + break; + case 'a': /* file */ + read_chars(L, f, ~((size_t)0)); /* read MAX_SIZE_T chars */ + success = 1; /* always success */ + break; + default: + return luaL_argerror(L, n, "invalid format"); + } + } + } + } + if (ferror(f)) + return pushresult(L, 0, NULL); + if (!success) { + lua_pop(L, 1); /* remove last result */ + lua_pushnil(L); /* push nil instead */ + } + return n - first; +} + + +static int io_read (lua_State *L) { + return g_read(L, getiofile(L, IO_INPUT), 1); +} + + +static int f_read (lua_State *L) { + return g_read(L, tofile(L), 2); +} + + +static int io_readline (lua_State *L) { + FILE *f = *(FILE **)lua_touserdata(L, lua_upvalueindex(1)); + int sucess; + if (f == NULL) /* file is already closed? */ + luaL_error(L, "file is already closed"); + sucess = read_line(L, f); + if (ferror(f)) + return luaL_error(L, "%s", strerror(errno)); + if (sucess) return 1; + else { /* EOF */ + if (lua_toboolean(L, lua_upvalueindex(2))) { /* generator created file? */ + lua_settop(L, 0); + lua_pushvalue(L, lua_upvalueindex(1)); + aux_close(L); /* close it */ + } + return 0; + } +} + +/* }====================================================== */ + + +static int g_write (lua_State *L, FILE *f, int arg) { + int nargs = lua_gettop(L) - 1; + int status = 1; + for (; nargs--; arg++) { + if (lua_type(L, arg) == LUA_TNUMBER) { + /* optimization: could be done exactly as for strings */ + status = status && + fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) > 0; + } + else { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + status = status && (fwrite(s, sizeof(char), l, f) == l); + } + } + return pushresult(L, status, NULL); +} + + +static int io_write (lua_State *L) { + return g_write(L, getiofile(L, IO_OUTPUT), 1); +} + + +static int f_write (lua_State *L) { + return g_write(L, tofile(L), 2); +} + + +static int f_seek (lua_State *L) { + static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; + static const char *const modenames[] = {"set", "cur", "end", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, "cur", modenames); + long offset = luaL_optlong(L, 3, 0); + op = fseek(f, offset, mode[op]); + if (op) + return pushresult(L, 0, NULL); /* error */ + else { + lua_pushinteger(L, ftell(f)); + return 1; + } +} + + +static int f_setvbuf (lua_State *L) { + static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; + static const char *const modenames[] = {"no", "full", "line", NULL}; + FILE *f = tofile(L); + int op = luaL_checkoption(L, 2, NULL, modenames); + lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); + int res = setvbuf(f, NULL, mode[op], sz); + return pushresult(L, res == 0, NULL); +} + + + +static int io_flush (lua_State *L) { + return pushresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); +} + + +static int f_flush (lua_State *L) { + return pushresult(L, fflush(tofile(L)) == 0, NULL); +} + + +static const luaL_Reg iolib[] = { + {"close", io_close}, + {"flush", io_flush}, + {"input", io_input}, + {"lines", io_lines}, + {"open", io_open}, + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, + {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +}; + + +static const luaL_Reg flib[] = { + {"close", io_close}, + {"flush", f_flush}, + {"lines", f_lines}, + {"read", f_read}, + {"seek", f_seek}, + {"setvbuf", f_setvbuf}, + {"write", f_write}, + {"__gc", io_gc}, + {"__tostring", io_tostring}, + {NULL, NULL} +}; + + +static void createmeta (lua_State *L) { + luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ + lua_pushvalue(L, -1); /* push metatable */ + lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ + luaL_register(L, NULL, flib); /* file methods */ +} + + +static void createstdfile (lua_State *L, FILE *f, int k, const char *fname) { + *newfile(L) = f; + if (k > 0) { + lua_pushvalue(L, -1); + lua_rawseti(L, LUA_ENVIRONINDEX, k); + } + lua_pushvalue(L, -2); /* copy environment */ + lua_setfenv(L, -2); /* set it */ + lua_setfield(L, -3, fname); +} + + +static void newfenv (lua_State *L, lua_CFunction cls) { + lua_createtable(L, 0, 1); + lua_pushcfunction(L, cls); + lua_setfield(L, -2, "__close"); +} + + +LUALIB_API int luaopen_io (lua_State *L) { + createmeta(L); + /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ + newfenv(L, io_fclose); + lua_replace(L, LUA_ENVIRONINDEX); + /* open library */ + luaL_register(L, LUA_IOLIBNAME, iolib); + /* create (and set) default files */ + newfenv(L, io_noclose); /* close function for default files */ + createstdfile(L, stdin, IO_INPUT, "stdin"); + createstdfile(L, stdout, IO_OUTPUT, "stdout"); + createstdfile(L, stderr, 0, "stderr"); + lua_pop(L, 1); /* pop environment for default files */ + lua_getfield(L, -1, "popen"); + newfenv(L, io_pclose); /* create environment for 'popen' */ + lua_setfenv(L, -2); /* set fenv for 'popen' */ + lua_pop(L, 1); /* pop 'popen' */ + return 1; +} + diff --git a/ThirdLib/thirdparty/LuaLib/llex.c b/ThirdLib/thirdparty/LuaLib/llex.c new file mode 100644 index 000000000..6dc319358 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/llex.c @@ -0,0 +1,461 @@ +/* +** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $ +** Lexical Analyzer +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define llex_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "llex.h" +#include "lobject.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "lzio.h" + + + +#define next(ls) (ls->current = zgetc(ls->z)) + + + + +#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') + + +/* ORDER RESERVED */ +const char *const luaX_tokens [] = { + "and", "break", "do", "else", "elseif", + "end", "false", "for", "function", "if", + "in", "local", "nil", "not", "or", "repeat", + "return", "then", "true", "until", "while", + "..", "...", "==", ">=", "<=", "~=", + "", "", "", "", + NULL +}; + + +#define save_and_next(ls) (save(ls, ls->current), next(ls)) + + +static void save (LexState *ls, int c) { + Mbuffer *b = ls->buff; + if (b->n + 1 > b->buffsize) { + size_t newsize; + if (b->buffsize >= MAX_SIZET/2) + luaX_lexerror(ls, "lexical element too long", 0); + newsize = b->buffsize * 2; + luaZ_resizebuffer(ls->L, b, newsize); + } + b->buffer[b->n++] = cast(char, c); +} + + +void luaX_init (lua_State *L) { + int i; + for (i=0; itsv.reserved = cast_byte(i+1); /* reserved word */ + } +} + + +#define MAXSRC 80 + + +const char *luaX_token2str (LexState *ls, int token) { + if (token < FIRST_RESERVED) { + lua_assert(token == cast(unsigned char, token)); + return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) : + luaO_pushfstring(ls->L, "%c", token); + } + else + return luaX_tokens[token-FIRST_RESERVED]; +} + + +static const char *txtToken (LexState *ls, int token) { + switch (token) { + case TK_NAME: + case TK_STRING: + case TK_NUMBER: + save(ls, '\0'); + return luaZ_buffer(ls->buff); + default: + return luaX_token2str(ls, token); + } +} + + +void luaX_lexerror (LexState *ls, const char *msg, int token) { + char buff[MAXSRC]; + luaO_chunkid(buff, getstr(ls->source), MAXSRC); + msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); + if (token) + luaO_pushfstring(ls->L, "%s near " LUA_QS, msg, txtToken(ls, token)); + luaD_throw(ls->L, LUA_ERRSYNTAX); +} + + +void luaX_syntaxerror (LexState *ls, const char *msg) { + luaX_lexerror(ls, msg, ls->t.token); +} + + +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { + lua_State *L = ls->L; + TString *ts = luaS_newlstr(L, str, l); + TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ + if (ttisnil(o)) + setbvalue(o, 1); /* make sure `str' will not be collected */ + return ts; +} + + +static void inclinenumber (LexState *ls) { + int old = ls->current; + lua_assert(currIsNewline(ls)); + next(ls); /* skip `\n' or `\r' */ + if (currIsNewline(ls) && ls->current != old) + next(ls); /* skip `\n\r' or `\r\n' */ + if (++ls->linenumber >= MAX_INT) + luaX_syntaxerror(ls, "chunk has too many lines"); +} + + +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { + ls->decpoint = '.'; + ls->L = L; + ls->lookahead.token = TK_EOS; /* no look-ahead token */ + ls->z = z; + ls->fs = NULL; + ls->linenumber = 1; + ls->lastline = 1; + ls->source = source; + luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ + next(ls); /* read first char */ +} + + + +/* +** ======================================================= +** LEXICAL ANALYZER +** ======================================================= +*/ + + + +static int check_next (LexState *ls, const char *set) { + if (!strchr(set, ls->current)) + return 0; + save_and_next(ls); + return 1; +} + + +static void buffreplace (LexState *ls, char from, char to) { + size_t n = luaZ_bufflen(ls->buff); + char *p = luaZ_buffer(ls->buff); + while (n--) + if (p[n] == from) p[n] = to; +} + + +static void trydecpoint (LexState *ls, SemInfo *seminfo) { + /* format error: try to update decimal point separator */ + struct lconv *cv = localeconv(); + char old = ls->decpoint; + ls->decpoint = (cv ? cv->decimal_point[0] : '.'); + buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) { + /* format error with correct decimal point: no more options */ + buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ + luaX_lexerror(ls, "malformed number", TK_NUMBER); + } +} + + +/* LUA_NUMBER */ +static void read_numeral (LexState *ls, SemInfo *seminfo) { + lua_assert(isdigit(ls->current)); + do { + save_and_next(ls); + } while (isdigit(ls->current) || ls->current == '.'); + if (check_next(ls, "Ee")) /* `E'? */ + check_next(ls, "+-"); /* optional exponent sign */ + while (isalnum(ls->current) || ls->current == '_') + save_and_next(ls); + save(ls, '\0'); + buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ + if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) /* format error? */ + trydecpoint(ls, seminfo); /* try to update decimal point separator */ +} + + +static int skip_sep (LexState *ls) { + int count = 0; + int s = ls->current; + lua_assert(s == '[' || s == ']'); + save_and_next(ls); + while (ls->current == '=') { + save_and_next(ls); + count++; + } + return (ls->current == s) ? count : (-count) - 1; +} + + +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { + int cont = 0; + (void)(cont); /* avoid warnings when `cont' is not used */ + save_and_next(ls); /* skip 2nd `[' */ + if (currIsNewline(ls)) /* string starts with a newline? */ + inclinenumber(ls); /* skip it */ + for (;;) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, (seminfo) ? "unfinished long string" : + "unfinished long comment", TK_EOS); + break; /* to avoid warnings */ +#if defined(LUA_COMPAT_LSTR) + case '[': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `[' */ + cont++; +#if LUA_COMPAT_LSTR == 1 + if (sep == 0) + luaX_lexerror(ls, "nesting of [[...]] is deprecated", '['); +#endif + } + break; + } +#endif + case ']': { + if (skip_sep(ls) == sep) { + save_and_next(ls); /* skip 2nd `]' */ +#if defined(LUA_COMPAT_LSTR) && LUA_COMPAT_LSTR == 2 + cont--; + if (sep == 0 && cont >= 0) break; +#endif + goto endloop; + } + break; + } + case '\n': + case '\r': { + save(ls, '\n'); + inclinenumber(ls); + if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ + break; + } + default: { + if (seminfo) save_and_next(ls); + else next(ls); + } + } + } endloop: + if (seminfo) + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), + luaZ_bufflen(ls->buff) - 2*(2 + sep)); +} + + +static void read_string (LexState *ls, int del, SemInfo *seminfo) { + save_and_next(ls); + while (ls->current != del) { + switch (ls->current) { + case EOZ: + luaX_lexerror(ls, "unfinished string", TK_EOS); + continue; /* to avoid warnings */ + case '\n': + case '\r': + luaX_lexerror(ls, "unfinished string", TK_STRING); + continue; /* to avoid warnings */ + case '\\': { + int c; + next(ls); /* do not save the `\' */ + switch (ls->current) { + case 'a': c = '\a'; break; + case 'b': c = '\b'; break; + case 'f': c = '\f'; break; + case 'n': c = '\n'; break; + case 'r': c = '\r'; break; + case 't': c = '\t'; break; + case 'v': c = '\v'; break; + case '\n': /* go through */ + case '\r': save(ls, '\n'); inclinenumber(ls); continue; + case EOZ: continue; /* will raise an error next loop */ + default: { + if (!isdigit(ls->current)) + save_and_next(ls); /* handles \\, \", \', and \? */ + else { /* \xxx */ + int i = 0; + c = 0; + do { + c = 10*c + (ls->current-'0'); + next(ls); + } while (++i<3 && isdigit(ls->current)); + if (c > UCHAR_MAX) + luaX_lexerror(ls, "escape sequence too large", TK_STRING); + save(ls, c); + } + continue; + } + } + save(ls, c); + next(ls); + continue; + } + default: + save_and_next(ls); + } + } + save_and_next(ls); /* skip delimiter */ + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, + luaZ_bufflen(ls->buff) - 2); +} + + +static int llex (LexState *ls, SemInfo *seminfo) { + luaZ_resetbuffer(ls->buff); + for (;;) { + switch (ls->current) { + case '\n': + case '\r': { + inclinenumber(ls); + continue; + } + case '-': { + next(ls); + if (ls->current != '-') return '-'; + /* else is a comment */ + next(ls); + if (ls->current == '[') { + int sep = skip_sep(ls); + luaZ_resetbuffer(ls->buff); /* `skip_sep' may dirty the buffer */ + if (sep >= 0) { + read_long_string(ls, NULL, sep); /* long comment */ + luaZ_resetbuffer(ls->buff); + continue; + } + } + /* else short comment */ + while (!currIsNewline(ls) && ls->current != EOZ) + next(ls); + continue; + } + case '[': { + int sep = skip_sep(ls); + if (sep >= 0) { + read_long_string(ls, seminfo, sep); + return TK_STRING; + } + else if (sep == -1) return '['; + else luaX_lexerror(ls, "invalid long string delimiter", TK_STRING); + } + case '=': { + next(ls); + if (ls->current != '=') return '='; + else { next(ls); return TK_EQ; } + } + case '<': { + next(ls); + if (ls->current != '=') return '<'; + else { next(ls); return TK_LE; } + } + case '>': { + next(ls); + if (ls->current != '=') return '>'; + else { next(ls); return TK_GE; } + } + case '~': { + next(ls); + if (ls->current != '=') return '~'; + else { next(ls); return TK_NE; } + } + case '"': + case '\'': { + read_string(ls, ls->current, seminfo); + return TK_STRING; + } + case '.': { + save_and_next(ls); + if (check_next(ls, ".")) { + if (check_next(ls, ".")) + return TK_DOTS; /* ... */ + else return TK_CONCAT; /* .. */ + } + else if (!isdigit(ls->current)) return '.'; + else { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + } + case EOZ: { + return TK_EOS; + } + default: { + if (isspace(ls->current)) { + lua_assert(!currIsNewline(ls)); + next(ls); + continue; + } + else if (isdigit(ls->current)) { + read_numeral(ls, seminfo); + return TK_NUMBER; + } + else if (isalpha(ls->current) || ls->current == '_') { + /* identifier or reserved word */ + TString *ts; + do { + save_and_next(ls); + } while (isalnum(ls->current) || ls->current == '_'); + ts = luaX_newstring(ls, luaZ_buffer(ls->buff), + luaZ_bufflen(ls->buff)); + if (ts->tsv.reserved > 0) /* reserved word? */ + return ts->tsv.reserved - 1 + FIRST_RESERVED; + else { + seminfo->ts = ts; + return TK_NAME; + } + } + else { + int c = ls->current; + next(ls); + return c; /* single-char tokens (+ - / ...) */ + } + } + } + } +} + + +void luaX_next (LexState *ls) { + ls->lastline = ls->linenumber; + if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ + ls->t = ls->lookahead; /* use this one */ + ls->lookahead.token = TK_EOS; /* and discharge it */ + } + else + ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ +} + + +void luaX_lookahead (LexState *ls) { + lua_assert(ls->lookahead.token == TK_EOS); + ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/llex.h b/ThirdLib/thirdparty/LuaLib/llex.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/llex.h rename to ThirdLib/thirdparty/LuaLib/llex.h diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/llimits.h b/ThirdLib/thirdparty/LuaLib/llimits.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/llimits.h rename to ThirdLib/thirdparty/LuaLib/llimits.h diff --git a/ThirdLib/thirdparty/LuaLib/lmathlib.c b/ThirdLib/thirdparty/LuaLib/lmathlib.c new file mode 100644 index 000000000..441fbf736 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lmathlib.c @@ -0,0 +1,263 @@ +/* +** $Id: lmathlib.c,v 1.67.1.1 2007/12/27 13:02:25 roberto Exp $ +** Standard mathematical library +** See Copyright Notice in lua.h +*/ + + +#include +#include + +#define lmathlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#undef PI +#define PI (3.14159265358979323846) +#define RADIANS_PER_DEGREE (PI/180.0) + + + +static int math_abs (lua_State *L) { + lua_pushnumber(L, fabs(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sin (lua_State *L) { + lua_pushnumber(L, sin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_sinh (lua_State *L) { + lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cos (lua_State *L) { + lua_pushnumber(L, cos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_cosh (lua_State *L) { + lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tan (lua_State *L) { + lua_pushnumber(L, tan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_tanh (lua_State *L) { + lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); + return 1; +} + +static int math_asin (lua_State *L) { + lua_pushnumber(L, asin(luaL_checknumber(L, 1))); + return 1; +} + +static int math_acos (lua_State *L) { + lua_pushnumber(L, acos(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan (lua_State *L) { + lua_pushnumber(L, atan(luaL_checknumber(L, 1))); + return 1; +} + +static int math_atan2 (lua_State *L) { + lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_ceil (lua_State *L) { + lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); + return 1; +} + +static int math_floor (lua_State *L) { + lua_pushnumber(L, floor(luaL_checknumber(L, 1))); + return 1; +} + +static int math_fmod (lua_State *L) { + lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_modf (lua_State *L) { + double ip; + double fp = modf(luaL_checknumber(L, 1), &ip); + lua_pushnumber(L, ip); + lua_pushnumber(L, fp); + return 2; +} + +static int math_sqrt (lua_State *L) { + lua_pushnumber(L, sqrt(luaL_checknumber(L, 1))); + return 1; +} + +static int math_pow (lua_State *L) { + lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); + return 1; +} + +static int math_log (lua_State *L) { + lua_pushnumber(L, log(luaL_checknumber(L, 1))); + return 1; +} + +static int math_log10 (lua_State *L) { + lua_pushnumber(L, log10(luaL_checknumber(L, 1))); + return 1; +} + +static int math_exp (lua_State *L) { + lua_pushnumber(L, exp(luaL_checknumber(L, 1))); + return 1; +} + +static int math_deg (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); + return 1; +} + +static int math_rad (lua_State *L) { + lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); + return 1; +} + +static int math_frexp (lua_State *L) { + int e; + lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); + lua_pushinteger(L, e); + return 2; +} + +static int math_ldexp (lua_State *L) { + lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); + return 1; +} + + + +static int math_min (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmin = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d < dmin) + dmin = d; + } + lua_pushnumber(L, dmin); + return 1; +} + + +static int math_max (lua_State *L) { + int n = lua_gettop(L); /* number of arguments */ + lua_Number dmax = luaL_checknumber(L, 1); + int i; + for (i=2; i<=n; i++) { + lua_Number d = luaL_checknumber(L, i); + if (d > dmax) + dmax = d; + } + lua_pushnumber(L, dmax); + return 1; +} + + +static int math_random (lua_State *L) { + /* the `%' avoids the (rare) case of r==1, and is needed also because on + some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ + lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; + switch (lua_gettop(L)) { /* check number of arguments */ + case 0: { /* no arguments */ + lua_pushnumber(L, r); /* Number between 0 and 1 */ + break; + } + case 1: { /* only upper limit */ + int u = luaL_checkint(L, 1); + luaL_argcheck(L, 1<=u, 1, "interval is empty"); + lua_pushnumber(L, floor(r*u)+1); /* int between 1 and `u' */ + break; + } + case 2: { /* lower and upper limits */ + int l = luaL_checkint(L, 1); + int u = luaL_checkint(L, 2); + luaL_argcheck(L, l<=u, 2, "interval is empty"); + lua_pushnumber(L, floor(r*(u-l+1))+l); /* int between `l' and `u' */ + break; + } + default: return luaL_error(L, "wrong number of arguments"); + } + return 1; +} + + +static int math_randomseed (lua_State *L) { + srand(luaL_checkint(L, 1)); + return 0; +} + + +static const luaL_Reg mathlib[] = { + {"abs", math_abs}, + {"acos", math_acos}, + {"asin", math_asin}, + {"atan2", math_atan2}, + {"atan", math_atan}, + {"ceil", math_ceil}, + {"cosh", math_cosh}, + {"cos", math_cos}, + {"deg", math_deg}, + {"exp", math_exp}, + {"floor", math_floor}, + {"fmod", math_fmod}, + {"frexp", math_frexp}, + {"ldexp", math_ldexp}, + {"log10", math_log10}, + {"log", math_log}, + {"max", math_max}, + {"min", math_min}, + {"modf", math_modf}, + {"pow", math_pow}, + {"rad", math_rad}, + {"random", math_random}, + {"randomseed", math_randomseed}, + {"sinh", math_sinh}, + {"sin", math_sin}, + {"sqrt", math_sqrt}, + {"tanh", math_tanh}, + {"tan", math_tan}, + {NULL, NULL} +}; + + +/* +** Open math library +*/ +LUALIB_API int luaopen_math (lua_State *L) { + luaL_register(L, LUA_MATHLIBNAME, mathlib); + lua_pushnumber(L, PI); + lua_setfield(L, -2, "pi"); + lua_pushnumber(L, HUGE_VAL); + lua_setfield(L, -2, "huge"); +#if defined(LUA_COMPAT_MOD) + lua_getfield(L, -1, "fmod"); + lua_setfield(L, -2, "mod"); +#endif + return 1; +} + diff --git a/ThirdLib/thirdparty/LuaLib/lmem.c b/ThirdLib/thirdparty/LuaLib/lmem.c new file mode 100644 index 000000000..ae7d8c965 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lmem.c @@ -0,0 +1,86 @@ +/* +** $Id: lmem.c,v 1.70.1.1 2007/12/27 13:02:25 roberto Exp $ +** Interface to Memory Manager +** See Copyright Notice in lua.h +*/ + + +#include + +#define lmem_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" + + + +/* +** About the realloc function: +** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); +** (`osize' is the old size, `nsize' is the new size) +** +** Lua ensures that (ptr == NULL) iff (osize == 0). +** +** * frealloc(ud, NULL, 0, x) creates a new block of size `x' +** +** * frealloc(ud, p, x, 0) frees the block `p' +** (in this specific case, frealloc must return NULL). +** particularly, frealloc(ud, NULL, 0, 0) does nothing +** (which is equivalent to free(NULL) in ANSI C) +** +** frealloc returns NULL if it cannot create or reallocate the area +** (any reallocation to an equal or smaller size cannot fail!) +*/ + + + +#define MINSIZEARRAY 4 + + +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, + int limit, const char *errormsg) { + void *newblock; + int newsize; + if (*size >= limit/2) { /* cannot double it? */ + if (*size >= limit) /* cannot grow even a little? */ + luaG_runerror(L, errormsg); + newsize = limit; /* still have at least one free place */ + } + else { + newsize = (*size)*2; + if (newsize < MINSIZEARRAY) + newsize = MINSIZEARRAY; /* minimum size */ + } + newblock = luaM_reallocv(L, block, *size, newsize, size_elems); + *size = newsize; /* update only when everything else is OK */ + return newblock; +} + + +void *luaM_toobig (lua_State *L) { + luaG_runerror(L, "memory allocation error: block too big"); + return NULL; /* to avoid warnings */ +} + + + +/* +** generic allocation routine. +*/ +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { + global_State *g = G(L); + lua_assert((osize == 0) == (block == NULL)); + block = (*g->frealloc)(g->ud, block, osize, nsize); + if (block == NULL && nsize > 0) + luaD_throw(L, LUA_ERRMEM); + lua_assert((nsize == 0) == (block == NULL)); + g->totalbytes = (g->totalbytes - osize) + nsize; + return block; +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lmem.h b/ThirdLib/thirdparty/LuaLib/lmem.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lmem.h rename to ThirdLib/thirdparty/LuaLib/lmem.h diff --git a/ThirdLib/thirdparty/LuaLib/loadlib.c b/ThirdLib/thirdparty/LuaLib/loadlib.c new file mode 100644 index 000000000..0d401eba1 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/loadlib.c @@ -0,0 +1,666 @@ +/* +** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $ +** Dynamic library loader for Lua +** See Copyright Notice in lua.h +** +** This module contains an implementation of loadlib for Unix systems +** that have dlfcn, an implementation for Darwin (Mac OS X), an +** implementation for Windows, and a stub for other systems. +*/ + + +#include +#include + + +#define loadlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* prefix for open functions in C libraries */ +#define LUA_POF "luaopen_" + +/* separator for open functions in C libraries */ +#define LUA_OFSEP "_" + + +#define LIBPREFIX "LOADLIB: " + +#define POF LUA_POF +#define LIB_FAIL "open" + + +/* error codes for ll_loadfunc */ +#define ERRLIB 1 +#define ERRFUNC 2 + +#define setprogdir(L) ((void)0) + + +static void ll_unloadlib (void *lib); +static void *ll_load (lua_State *L, const char *path); +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym); + + + +#if defined(LUA_DL_DLOPEN) +/* +** {======================================================================== +** This is an implementation of loadlib based on the dlfcn interface. +** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, +** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least +** as an emulation layer on top of native functions. +** ========================================================================= +*/ + +#include + +static void ll_unloadlib (void *lib) { + dlclose(lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + void *lib = dlopen(path, RTLD_NOW); + if (lib == NULL) lua_pushstring(L, dlerror()); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)dlsym(lib, sym); + if (f == NULL) lua_pushstring(L, dlerror()); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DLL) +/* +** {====================================================================== +** This is an implementation of loadlib for Windows using native functions. +** ======================================================================= +*/ + +#include + + +#undef setprogdir + +static void setprogdir (lua_State *L) { + char buff[MAX_PATH + 1]; + char *lb; + DWORD nsize = sizeof(buff)/sizeof(char); + DWORD n = GetModuleFileNameA(NULL, buff, nsize); + if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) + luaL_error(L, "unable to get ModuleFileName"); + else { + *lb = '\0'; + luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, buff); + lua_remove(L, -2); /* remove original string */ + } +} + + +static void pusherror (lua_State *L) { + int error = GetLastError(); + char buffer[128]; + if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, error, 0, buffer, sizeof(buffer), NULL)) + lua_pushstring(L, buffer); + else + lua_pushfstring(L, "system error %d\n", error); +} + +static void ll_unloadlib (void *lib) { + FreeLibrary((HINSTANCE)lib); +} + + +static void *ll_load (lua_State *L, const char *path) { + HINSTANCE lib = LoadLibraryA(path); + if (lib == NULL) pusherror(L); + return lib; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + lua_CFunction f = (lua_CFunction)GetProcAddress((HINSTANCE)lib, sym); + if (f == NULL) pusherror(L); + return f; +} + +/* }====================================================== */ + + + +#elif defined(LUA_DL_DYLD) +/* +** {====================================================================== +** Native Mac OS X / Darwin Implementation +** ======================================================================= +*/ + +#include + + +/* Mac appends a `_' before C function names */ +#undef POF +#define POF "_" LUA_POF + + +static void pusherror (lua_State *L) { + const char *err_str; + const char *err_file; + NSLinkEditErrors err; + int err_num; + NSLinkEditError(&err, &err_num, &err_file, &err_str); + lua_pushstring(L, err_str); +} + + +static const char *errorfromcode (NSObjectFileImageReturnCode ret) { + switch (ret) { + case NSObjectFileImageInappropriateFile: + return "file is not a bundle"; + case NSObjectFileImageArch: + return "library is for wrong CPU type"; + case NSObjectFileImageFormat: + return "bad format"; + case NSObjectFileImageAccess: + return "cannot access file"; + case NSObjectFileImageFailure: + default: + return "unable to load library"; + } +} + + +static void ll_unloadlib (void *lib) { + NSUnLinkModule((NSModule)lib, NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES); +} + + +static void *ll_load (lua_State *L, const char *path) { + NSObjectFileImage img; + NSObjectFileImageReturnCode ret; + /* this would be a rare case, but prevents crashing if it happens */ + if(!_dyld_present()) { + lua_pushliteral(L, "dyld not present"); + return NULL; + } + ret = NSCreateObjectFileImageFromFile(path, &img); + if (ret == NSObjectFileImageSuccess) { + NSModule mod = NSLinkModule(img, path, NSLINKMODULE_OPTION_PRIVATE | + NSLINKMODULE_OPTION_RETURN_ON_ERROR); + NSDestroyObjectFileImage(img); + if (mod == NULL) pusherror(L); + return mod; + } + lua_pushstring(L, errorfromcode(ret)); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + NSSymbol nss = NSLookupSymbolInModule((NSModule)lib, sym); + if (nss == NULL) { + lua_pushfstring(L, "symbol " LUA_QS " not found", sym); + return NULL; + } + return (lua_CFunction)NSAddressOfSymbol(nss); +} + +/* }====================================================== */ + + + +#else +/* +** {====================================================== +** Fallback for other systems +** ======================================================= +*/ + +#undef LIB_FAIL +#define LIB_FAIL "absent" + + +#define DLMSG "dynamic libraries not enabled; check your Lua installation" + + +static void ll_unloadlib (void *lib) { + (void)lib; /* to avoid warnings */ +} + + +static void *ll_load (lua_State *L, const char *path) { + (void)path; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + + +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { + (void)lib; (void)sym; /* to avoid warnings */ + lua_pushliteral(L, DLMSG); + return NULL; +} + +/* }====================================================== */ +#endif + + + +static void **ll_register (lua_State *L, const char *path) { + void **plib; + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ + if (!lua_isnil(L, -1)) /* is there an entry? */ + plib = (void **)lua_touserdata(L, -1); + else { /* no entry yet; create one */ + lua_pop(L, 1); + plib = (void **)lua_newuserdata(L, sizeof(const void *)); + *plib = NULL; + luaL_getmetatable(L, "_LOADLIB"); + lua_setmetatable(L, -2); + lua_pushfstring(L, "%s%s", LIBPREFIX, path); + lua_pushvalue(L, -2); + lua_settable(L, LUA_REGISTRYINDEX); + } + return plib; +} + + +/* +** __gc tag method: calls library's `ll_unloadlib' function with the lib +** handle +*/ +static int gctm (lua_State *L) { + void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); + if (*lib) ll_unloadlib(*lib); + *lib = NULL; /* mark library as closed */ + return 0; +} + + +static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { + void **reg = ll_register(L, path); + if (*reg == NULL) *reg = ll_load(L, path); + if (*reg == NULL) + return ERRLIB; /* unable to load library */ + else { + lua_CFunction f = ll_sym(L, *reg, sym); + if (f == NULL) + return ERRFUNC; /* unable to find function */ + lua_pushcfunction(L, f); + return 0; /* return function */ + } +} + + +static int ll_loadlib (lua_State *L) { + const char *path = luaL_checkstring(L, 1); + const char *init = luaL_checkstring(L, 2); + int stat = ll_loadfunc(L, path, init); + if (stat == 0) /* no errors? */ + return 1; /* return the loaded function */ + else { /* error; error message is on stack top */ + lua_pushnil(L); + lua_insert(L, -2); + lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); + return 3; /* return nil, error message, and where */ + } +} + + + +/* +** {====================================================== +** 'require' function +** ======================================================= +*/ + + +static int readable (const char *filename) { + FILE *f = fopen(filename, "r"); /* try to open file */ + if (f == NULL) return 0; /* open failed */ + fclose(f); + return 1; +} + + +static const char *pushnexttemplate (lua_State *L, const char *path) { + const char *l; + while (*path == *LUA_PATHSEP) path++; /* skip separators */ + if (*path == '\0') return NULL; /* no more templates */ + l = strchr(path, *LUA_PATHSEP); /* find next separator */ + if (l == NULL) l = path + strlen(path); + lua_pushlstring(L, path, l - path); /* template */ + return l; +} + + +static const char *findfile (lua_State *L, const char *name, + const char *pname) { + const char *path; + name = luaL_gsub(L, name, ".", LUA_DIRSEP); + lua_getfield(L, LUA_ENVIRONINDEX, pname); + path = lua_tostring(L, -1); + if (path == NULL) + luaL_error(L, LUA_QL("package.%s") " must be a string", pname); + lua_pushliteral(L, ""); /* error accumulator */ + while ((path = pushnexttemplate(L, path)) != NULL) { + const char *filename; + filename = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); + lua_remove(L, -2); /* remove path template */ + if (readable(filename)) /* does file exist and is readable? */ + return filename; /* return that file name */ + lua_pushfstring(L, "\n\tno file " LUA_QS, filename); + lua_remove(L, -2); /* remove file name */ + lua_concat(L, 2); /* add entry to possible error message */ + } + return NULL; /* not found */ +} + + +static void loaderror (lua_State *L, const char *filename) { + luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", + lua_tostring(L, 1), filename, lua_tostring(L, -1)); +} + + +static int loader_Lua (lua_State *L) { + const char *filename; + const char *name = luaL_checkstring(L, 1); + filename = findfile(L, name, "path"); + if (filename == NULL) return 1; /* library not found in this path */ + if (luaL_loadfile(L, filename) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static const char *mkfuncname (lua_State *L, const char *modname) { + const char *funcname; + const char *mark = strchr(modname, *LUA_IGMARK); + if (mark) modname = mark + 1; + funcname = luaL_gsub(L, modname, ".", LUA_OFSEP); + funcname = lua_pushfstring(L, POF"%s", funcname); + lua_remove(L, -2); /* remove 'gsub' result */ + return funcname; +} + + +static int loader_C (lua_State *L) { + const char *funcname; + const char *name = luaL_checkstring(L, 1); + const char *filename = findfile(L, name, "cpath"); + if (filename == NULL) return 1; /* library not found in this path */ + funcname = mkfuncname(L, name); + if (ll_loadfunc(L, filename, funcname) != 0) + loaderror(L, filename); + return 1; /* library loaded successfully */ +} + + +static int loader_Croot (lua_State *L) { + const char *funcname; + const char *filename; + const char *name = luaL_checkstring(L, 1); + const char *p = strchr(name, '.'); + int stat; + if (p == NULL) return 0; /* is root */ + lua_pushlstring(L, name, p - name); + filename = findfile(L, lua_tostring(L, -1), "cpath"); + if (filename == NULL) return 1; /* root not found */ + funcname = mkfuncname(L, name); + if ((stat = ll_loadfunc(L, filename, funcname)) != 0) { + if (stat != ERRFUNC) loaderror(L, filename); /* real error */ + lua_pushfstring(L, "\n\tno module " LUA_QS " in file " LUA_QS, + name, filename); + return 1; /* function not found */ + } + return 1; +} + + +static int loader_preload (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + lua_getfield(L, LUA_ENVIRONINDEX, "preload"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.preload") " must be a table"); + lua_getfield(L, -1, name); + if (lua_isnil(L, -1)) /* not found? */ + lua_pushfstring(L, "\n\tno field package.preload['%s']", name); + return 1; +} + + +static const int sentinel_ = 0; +#define sentinel ((void *)&sentinel_) + + +static int ll_require (lua_State *L) { + const char *name = luaL_checkstring(L, 1); + int i; + lua_settop(L, 1); /* _LOADED table will be at index 2 */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, 2, name); + if (lua_toboolean(L, -1)) { /* is it there? */ + if (lua_touserdata(L, -1) == sentinel) /* check loops */ + luaL_error(L, "loop or previous error loading module " LUA_QS, name); + return 1; /* package is already loaded */ + } + /* else must load it; iterate over available loaders */ + lua_getfield(L, LUA_ENVIRONINDEX, "loaders"); + if (!lua_istable(L, -1)) + luaL_error(L, LUA_QL("package.loaders") " must be a table"); + lua_pushliteral(L, ""); /* error message accumulator */ + for (i=1; ; i++) { + lua_rawgeti(L, -2, i); /* get a loader */ + if (lua_isnil(L, -1)) + luaL_error(L, "module " LUA_QS " not found:%s", + name, lua_tostring(L, -2)); + lua_pushstring(L, name); + lua_call(L, 1, 1); /* call it */ + if (lua_isfunction(L, -1)) /* did it find module? */ + break; /* module loaded successfully */ + else if (lua_isstring(L, -1)) /* loader returned error message? */ + lua_concat(L, 2); /* accumulate it */ + else + lua_pop(L, 1); + } + lua_pushlightuserdata(L, sentinel); + lua_setfield(L, 2, name); /* _LOADED[name] = sentinel */ + lua_pushstring(L, name); /* pass name as argument to module */ + lua_call(L, 1, 1); /* run loaded module */ + if (!lua_isnil(L, -1)) /* non-nil return? */ + lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ + lua_getfield(L, 2, name); + if (lua_touserdata(L, -1) == sentinel) { /* module did not set a value? */ + lua_pushboolean(L, 1); /* use true as result */ + lua_pushvalue(L, -1); /* extra copy to be returned */ + lua_setfield(L, 2, name); /* _LOADED[name] = true */ + } + return 1; +} + +/* }====================================================== */ + + + +/* +** {====================================================== +** 'module' function +** ======================================================= +*/ + + +static void setfenv (lua_State *L) { + lua_Debug ar; + if (lua_getstack(L, 1, &ar) == 0 || + lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ + lua_iscfunction(L, -1)) + luaL_error(L, LUA_QL("module") " not called from a Lua function"); + lua_pushvalue(L, -2); + lua_setfenv(L, -2); + lua_pop(L, 1); +} + + +static void dooptions (lua_State *L, int n) { + int i; + for (i = 2; i <= n; i++) { + lua_pushvalue(L, i); /* get option (a function) */ + lua_pushvalue(L, -2); /* module */ + lua_call(L, 1, 0); + } +} + + +static void modinit (lua_State *L, const char *modname) { + const char *dot; + lua_pushvalue(L, -1); + lua_setfield(L, -2, "_M"); /* module._M = module */ + lua_pushstring(L, modname); + lua_setfield(L, -2, "_NAME"); + dot = strrchr(modname, '.'); /* look for last dot in module name */ + if (dot == NULL) dot = modname; + else dot++; + /* set _PACKAGE as package name (full module name minus last part) */ + lua_pushlstring(L, modname, dot - modname); + lua_setfield(L, -2, "_PACKAGE"); +} + + +static int ll_module (lua_State *L) { + const char *modname = luaL_checkstring(L, 1); + int loaded = lua_gettop(L) + 1; /* index of _LOADED table */ + lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); + lua_getfield(L, loaded, modname); /* get _LOADED[modname] */ + if (!lua_istable(L, -1)) { /* not found? */ + lua_pop(L, 1); /* remove previous result */ + /* try global variable (and create one if it does not exist) */ + if (luaL_findtable(L, LUA_GLOBALSINDEX, modname, 1) != NULL) + return luaL_error(L, "name conflict for module " LUA_QS, modname); + lua_pushvalue(L, -1); + lua_setfield(L, loaded, modname); /* _LOADED[modname] = new table */ + } + /* check whether table already has a _NAME field */ + lua_getfield(L, -1, "_NAME"); + if (!lua_isnil(L, -1)) /* is table an initialized module? */ + lua_pop(L, 1); + else { /* no; initialize it */ + lua_pop(L, 1); + modinit(L, modname); + } + lua_pushvalue(L, -1); + setfenv(L); + dooptions(L, loaded - 1); + return 0; +} + + +static int ll_seeall (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + if (!lua_getmetatable(L, 1)) { + lua_createtable(L, 0, 1); /* create new metatable */ + lua_pushvalue(L, -1); + lua_setmetatable(L, 1); + } + lua_pushvalue(L, LUA_GLOBALSINDEX); + lua_setfield(L, -2, "__index"); /* mt.__index = _G */ + return 0; +} + + +/* }====================================================== */ + + + +/* auxiliary mark (for internal use) */ +#define AUXMARK "\1" + +static void setpath (lua_State *L, const char *fieldname, const char *envname, + const char *def) { + const char *path = getenv(envname); + if (path == NULL) /* no environment variable? */ + lua_pushstring(L, def); /* use default */ + else { + /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ + path = luaL_gsub(L, path, LUA_PATHSEP LUA_PATHSEP, + LUA_PATHSEP AUXMARK LUA_PATHSEP); + luaL_gsub(L, path, AUXMARK, def); + lua_remove(L, -2); + } + setprogdir(L); + lua_setfield(L, -2, fieldname); +} + + +static const luaL_Reg pk_funcs[] = { + {"loadlib", ll_loadlib}, + {"seeall", ll_seeall}, + {NULL, NULL} +}; + + +static const luaL_Reg ll_funcs[] = { + {"module", ll_module}, + {"require", ll_require}, + {NULL, NULL} +}; + + +static const lua_CFunction loaders[] = + {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}; + + +LUALIB_API int luaopen_package (lua_State *L) { + int i; + /* create new type _LOADLIB */ + luaL_newmetatable(L, "_LOADLIB"); + lua_pushcfunction(L, gctm); + lua_setfield(L, -2, "__gc"); + /* create `package' table */ + luaL_register(L, LUA_LOADLIBNAME, pk_funcs); +#if defined(LUA_COMPAT_LOADLIB) + lua_getfield(L, -1, "loadlib"); + lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); +#endif + lua_pushvalue(L, -1); + lua_replace(L, LUA_ENVIRONINDEX); + /* create `loaders' table */ + lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1); + /* fill it with pre-defined loaders */ + for (i=0; loaders[i] != NULL; i++) { + lua_pushcfunction(L, loaders[i]); + lua_rawseti(L, -2, i+1); + } + lua_setfield(L, -2, "loaders"); /* put it in field `loaders' */ + setpath(L, "path", LUA_PATH, LUA_PATH_DEFAULT); /* set field `path' */ + setpath(L, "cpath", LUA_CPATH, LUA_CPATH_DEFAULT); /* set field `cpath' */ + /* store config information */ + lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" + LUA_EXECDIR "\n" LUA_IGMARK); + lua_setfield(L, -2, "config"); + /* set field `loaded' */ + luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 2); + lua_setfield(L, -2, "loaded"); + /* set field `preload' */ + lua_newtable(L); + lua_setfield(L, -2, "preload"); + lua_pushvalue(L, LUA_GLOBALSINDEX); + luaL_register(L, NULL, ll_funcs); /* open lib into global table */ + lua_pop(L, 1); + return 1; /* return 'package' table */ +} + diff --git a/ThirdLib/thirdparty/LuaLib/lobject.c b/ThirdLib/thirdparty/LuaLib/lobject.c new file mode 100644 index 000000000..4ff50732a --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lobject.c @@ -0,0 +1,214 @@ +/* +** $Id: lobject.c,v 2.22.1.1 2007/12/27 13:02:25 roberto Exp $ +** Some generic functions over Lua objects +** See Copyright Notice in lua.h +*/ + +#include +#include +#include +#include +#include + +#define lobject_c +#define LUA_CORE + +#include "lua.h" + +#include "ldo.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "lvm.h" + + + +const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL}; + + +/* +** converts an integer to a "floating point byte", represented as +** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if +** eeeee != 0 and (xxx) otherwise. +*/ +int luaO_int2fb (unsigned int x) { + int e = 0; /* expoent */ + while (x >= 16) { + x = (x+1) >> 1; + e++; + } + if (x < 8) return x; + else return ((e+1) << 3) | (cast_int(x) - 8); +} + + +/* converts back */ +int luaO_fb2int (int x) { + int e = (x >> 3) & 31; + if (e == 0) return x; + else return ((x & 7)+8) << (e - 1); +} + + +int luaO_log2 (unsigned int x) { + static const lu_byte log_2[256] = { + 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, + 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, + 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 + }; + int l = -1; + while (x >= 256) { l += 8; x >>= 8; } + return l + log_2[x]; + +} + + +int luaO_rawequalObj (const TValue *t1, const TValue *t2) { + if (ttype(t1) != ttype(t2)) return 0; + else switch (ttype(t1)) { + case LUA_TNIL: + return 1; + case LUA_TNUMBER: + return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: + return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */ + case LUA_TLIGHTUSERDATA: + return pvalue(t1) == pvalue(t2); + default: + lua_assert(iscollectable(t1)); + return gcvalue(t1) == gcvalue(t2); + } +} + + +int luaO_str2d (const char *s, lua_Number *result) { + char *endptr; + *result = lua_str2number(s, &endptr); + if (endptr == s) return 0; /* conversion failed */ + if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ + *result = cast_num(strtoul(s, &endptr, 16)); + if (*endptr == '\0') return 1; /* most common case */ + while (isspace(cast(unsigned char, *endptr))) endptr++; + if (*endptr != '\0') return 0; /* invalid trailing characters? */ + return 1; +} + + + +static void pushstr (lua_State *L, const char *str) { + setsvalue2s(L, L->top, luaS_new(L, str)); + incr_top(L); +} + + +/* this function handles only `%d', `%c', %f, %p, and `%s' formats */ +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { + int n = 1; + pushstr(L, ""); + for (;;) { + const char *e = strchr(fmt, '%'); + if (e == NULL) break; + setsvalue2s(L, L->top, luaS_newlstr(L, fmt, e-fmt)); + incr_top(L); + switch (*(e+1)) { + case 's': { + const char *s = va_arg(argp, char *); + if (s == NULL) s = "(null)"; + pushstr(L, s); + break; + } + case 'c': { + char buff[2]; + buff[0] = cast(char, va_arg(argp, int)); + buff[1] = '\0'; + pushstr(L, buff); + break; + } + case 'd': { + setnvalue(L->top, cast_num(va_arg(argp, int))); + incr_top(L); + break; + } + case 'f': { + setnvalue(L->top, cast_num(va_arg(argp, l_uacNumber))); + incr_top(L); + break; + } + case 'p': { + char buff[4*sizeof(void *) + 8]; /* should be enough space for a `%p' */ + sprintf(buff, "%p", va_arg(argp, void *)); + pushstr(L, buff); + break; + } + case '%': { + pushstr(L, "%"); + break; + } + default: { + char buff[3]; + buff[0] = '%'; + buff[1] = *(e+1); + buff[2] = '\0'; + pushstr(L, buff); + break; + } + } + n += 2; + fmt = e+2; + } + pushstr(L, fmt); + luaV_concat(L, n+1, cast_int(L->top - L->base) - 1); + L->top -= n; + return svalue(L->top - 1); +} + + +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { + const char *msg; + va_list argp; + va_start(argp, fmt); + msg = luaO_pushvfstring(L, fmt, argp); + va_end(argp); + return msg; +} + + +void luaO_chunkid (char *out, const char *source, size_t bufflen) { + if (*source == '=') { + strncpy(out, source+1, bufflen); /* remove first char */ + out[bufflen-1] = '\0'; /* ensures null termination */ + } + else { /* out = "source", or "...source" */ + if (*source == '@') { + size_t l; + source++; /* skip the `@' */ + bufflen -= sizeof(" '...' "); + l = strlen(source); + strcpy(out, ""); + if (l > bufflen) { + source += (l-bufflen); /* get last part of file name */ + strcat(out, "..."); + } + strcat(out, source); + } + else { /* out = [string "string"] */ + size_t len = strcspn(source, "\n\r"); /* stop at first newline */ + bufflen -= sizeof(" [string \"...\"] "); + if (len > bufflen) len = bufflen; + strcpy(out, "[string \""); + if (source[len] != '\0') { /* must truncate? */ + strncat(out, source, len); + strcat(out, "..."); + } + else + strcat(out, source); + strcat(out, "\"]"); + } + } +} diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lobject.h b/ThirdLib/thirdparty/LuaLib/lobject.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lobject.h rename to ThirdLib/thirdparty/LuaLib/lobject.h diff --git a/ThirdLib/thirdparty/LuaLib/lopcodes.c b/ThirdLib/thirdparty/LuaLib/lopcodes.c new file mode 100644 index 000000000..4cc745230 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lopcodes.c @@ -0,0 +1,102 @@ +/* +** $Id: lopcodes.c,v 1.37.1.1 2007/12/27 13:02:25 roberto Exp $ +** See Copyright Notice in lua.h +*/ + + +#define lopcodes_c +#define LUA_CORE + + +#include "lopcodes.h" + + +/* ORDER OP */ + +const char *const luaP_opnames[NUM_OPCODES+1] = { + "MOVE", + "LOADK", + "LOADBOOL", + "LOADNIL", + "GETUPVAL", + "GETGLOBAL", + "GETTABLE", + "SETGLOBAL", + "SETUPVAL", + "SETTABLE", + "NEWTABLE", + "SELF", + "ADD", + "SUB", + "MUL", + "DIV", + "MOD", + "POW", + "UNM", + "NOT", + "LEN", + "CONCAT", + "JMP", + "EQ", + "LT", + "LE", + "TEST", + "TESTSET", + "CALL", + "TAILCALL", + "RETURN", + "FORLOOP", + "FORPREP", + "TFORLOOP", + "SETLIST", + "CLOSE", + "CLOSURE", + "VARARG", + NULL +}; + + +#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) + +const lu_byte luaP_opmodes[NUM_OPCODES] = { +/* T A B C mode opcode */ + opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LOADNIL */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ + ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_GETGLOBAL */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, OpArgK, OpArgN, iABx) /* OP_SETGLOBAL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ + ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ + ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ + ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ + ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ + ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TEST */ + ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ + ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ + ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ + ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */ + ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ + ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ + ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ + ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ +}; + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lopcodes.h b/ThirdLib/thirdparty/LuaLib/lopcodes.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lopcodes.h rename to ThirdLib/thirdparty/LuaLib/lopcodes.h diff --git a/ThirdLib/thirdparty/LuaLib/loslib.c b/ThirdLib/thirdparty/LuaLib/loslib.c new file mode 100644 index 000000000..da06a572a --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/loslib.c @@ -0,0 +1,243 @@ +/* +** $Id: loslib.c,v 1.19.1.3 2008/01/18 16:38:18 roberto Exp $ +** Standard Operating System library +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define loslib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +static int os_pushresult (lua_State *L, int i, const char *filename) { + int en = errno; /* calls to Lua API may change this value */ + if (i) { + lua_pushboolean(L, 1); + return 1; + } + else { + lua_pushnil(L); + lua_pushfstring(L, "%s: %s", filename, strerror(en)); + lua_pushinteger(L, en); + return 3; + } +} + + +static int os_execute (lua_State *L) { + lua_pushinteger(L, system(luaL_optstring(L, 1, NULL))); + return 1; +} + + +static int os_remove (lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return os_pushresult(L, remove(filename) == 0, filename); +} + + +static int os_rename (lua_State *L) { + const char *fromname = luaL_checkstring(L, 1); + const char *toname = luaL_checkstring(L, 2); + return os_pushresult(L, rename(fromname, toname) == 0, fromname); +} + + +static int os_tmpname (lua_State *L) { + char buff[LUA_TMPNAMBUFSIZE]; + int err; + lua_tmpnam(buff, err); + if (err) + return luaL_error(L, "unable to generate a unique filename"); + lua_pushstring(L, buff); + return 1; +} + + +static int os_getenv (lua_State *L) { + lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ + return 1; +} + + +static int os_clock (lua_State *L) { + lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); + return 1; +} + + +/* +** {====================================================== +** Time/Date operations +** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, +** wday=%w+1, yday=%j, isdst=? } +** ======================================================= +*/ + +static void setfield (lua_State *L, const char *key, int value) { + lua_pushinteger(L, value); + lua_setfield(L, -2, key); +} + +static void setboolfield (lua_State *L, const char *key, int value) { + if (value < 0) /* undefined? */ + return; /* does not set field */ + lua_pushboolean(L, value); + lua_setfield(L, -2, key); +} + +static int getboolfield (lua_State *L, const char *key) { + int res; + lua_getfield(L, -1, key); + res = lua_isnil(L, -1) ? -1 : lua_toboolean(L, -1); + lua_pop(L, 1); + return res; +} + + +static int getfield (lua_State *L, const char *key, int d) { + int res; + lua_getfield(L, -1, key); + if (lua_isnumber(L, -1)) + res = (int)lua_tointeger(L, -1); + else { + if (d < 0) + return luaL_error(L, "field " LUA_QS " missing in date table", key); + res = d; + } + lua_pop(L, 1); + return res; +} + + +static int os_date (lua_State *L) { + const char *s = luaL_optstring(L, 1, "%c"); + time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); + struct tm *stm; + if (*s == '!') { /* UTC? */ + stm = gmtime(&t); + s++; /* skip `!' */ + } + else + stm = localtime(&t); + if (stm == NULL) /* invalid date? */ + lua_pushnil(L); + else if (strcmp(s, "*t") == 0) { + lua_createtable(L, 0, 9); /* 9 = number of fields */ + setfield(L, "sec", stm->tm_sec); + setfield(L, "min", stm->tm_min); + setfield(L, "hour", stm->tm_hour); + setfield(L, "day", stm->tm_mday); + setfield(L, "month", stm->tm_mon+1); + setfield(L, "year", stm->tm_year+1900); + setfield(L, "wday", stm->tm_wday+1); + setfield(L, "yday", stm->tm_yday+1); + setboolfield(L, "isdst", stm->tm_isdst); + } + else { + char cc[3]; + luaL_Buffer b; + cc[0] = '%'; cc[2] = '\0'; + luaL_buffinit(L, &b); + for (; *s; s++) { + if (*s != '%' || *(s + 1) == '\0') /* no conversion specifier? */ + luaL_addchar(&b, *s); + else { + size_t reslen; + char buff[200]; /* should be big enough for any conversion result */ + cc[1] = *(++s); + reslen = strftime(buff, sizeof(buff), cc, stm); + luaL_addlstring(&b, buff, reslen); + } + } + luaL_pushresult(&b); + } + return 1; +} + + +static int os_time (lua_State *L) { + time_t t; + if (lua_isnoneornil(L, 1)) /* called without args? */ + t = time(NULL); /* get current time */ + else { + struct tm ts; + luaL_checktype(L, 1, LUA_TTABLE); + lua_settop(L, 1); /* make sure table is at the top */ + ts.tm_sec = getfield(L, "sec", 0); + ts.tm_min = getfield(L, "min", 0); + ts.tm_hour = getfield(L, "hour", 12); + ts.tm_mday = getfield(L, "day", -1); + ts.tm_mon = getfield(L, "month", -1) - 1; + ts.tm_year = getfield(L, "year", -1) - 1900; + ts.tm_isdst = getboolfield(L, "isdst"); + t = mktime(&ts); + } + if (t == (time_t)(-1)) + lua_pushnil(L); + else + lua_pushnumber(L, (lua_Number)t); + return 1; +} + + +static int os_difftime (lua_State *L) { + lua_pushnumber(L, difftime((time_t)(luaL_checknumber(L, 1)), + (time_t)(luaL_optnumber(L, 2, 0)))); + return 1; +} + +/* }====================================================== */ + + +static int os_setlocale (lua_State *L) { + static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, + LC_NUMERIC, LC_TIME}; + static const char *const catnames[] = {"all", "collate", "ctype", "monetary", + "numeric", "time", NULL}; + const char *l = luaL_optstring(L, 1, NULL); + int op = luaL_checkoption(L, 2, "all", catnames); + lua_pushstring(L, setlocale(cat[op], l)); + return 1; +} + + +static int os_exit (lua_State *L) { + exit(luaL_optint(L, 1, EXIT_SUCCESS)); +} + +static const luaL_Reg syslib[] = { + {"clock", os_clock}, + {"date", os_date}, + {"difftime", os_difftime}, + {"execute", os_execute}, + {"exit", os_exit}, + {"getenv", os_getenv}, + {"remove", os_remove}, + {"rename", os_rename}, + {"setlocale", os_setlocale}, + {"time", os_time}, + {"tmpname", os_tmpname}, + {NULL, NULL} +}; + +/* }====================================================== */ + + + +LUALIB_API int luaopen_os (lua_State *L) { + luaL_register(L, LUA_OSLIBNAME, syslib); + return 1; +} + diff --git a/ThirdLib/thirdparty/LuaLib/lparser.c b/ThirdLib/thirdparty/LuaLib/lparser.c new file mode 100644 index 000000000..1e2a9a88b --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lparser.c @@ -0,0 +1,1339 @@ +/* +** $Id: lparser.c,v 2.42.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua Parser +** See Copyright Notice in lua.h +*/ + + +#include + +#define lparser_c +#define LUA_CORE + +#include "lua.h" + +#include "lcode.h" +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "llex.h" +#include "lmem.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lparser.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" + + + +#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) + +#define getlocvar(fs, i) ((fs)->f->locvars[(fs)->actvar[i]]) + +#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m) + + +/* +** nodes for block list (list of active blocks) +*/ +typedef struct BlockCnt { + struct BlockCnt *previous; /* chain */ + int breaklist; /* list of jumps out of this loop */ + lu_byte nactvar; /* # active locals outside the breakable structure */ + lu_byte upval; /* true if some variable in the block is an upvalue */ + lu_byte isbreakable; /* true if `block' is a loop */ +} BlockCnt; + + + +/* +** prototypes for recursive non-terminal functions +*/ +static void chunk (LexState *ls); +static void expr (LexState *ls, expdesc *v); + + +static void anchor_token (LexState *ls) { + if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { + TString *ts = ls->t.seminfo.ts; + luaX_newstring(ls, getstr(ts), ts->tsv.len); + } +} + + +static void error_expected (LexState *ls, int token) { + luaX_syntaxerror(ls, + luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); +} + + +static void errorlimit (FuncState *fs, int limit, const char *what) { + const char *msg = (fs->f->linedefined == 0) ? + luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : + luaO_pushfstring(fs->L, "function at line %d has more than %d %s", + fs->f->linedefined, limit, what); + luaX_lexerror(fs->ls, msg, 0); +} + + +static int testnext (LexState *ls, int c) { + if (ls->t.token == c) { + luaX_next(ls); + return 1; + } + else return 0; +} + + +static void check (LexState *ls, int c) { + if (ls->t.token != c) + error_expected(ls, c); +} + +static void checknext (LexState *ls, int c) { + check(ls, c); + luaX_next(ls); +} + + +#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } + + + +static void check_match (LexState *ls, int what, int who, int where) { + if (!testnext(ls, what)) { + if (where == ls->linenumber) + error_expected(ls, what); + else { + luaX_syntaxerror(ls, luaO_pushfstring(ls->L, + LUA_QS " expected (to close " LUA_QS " at line %d)", + luaX_token2str(ls, what), luaX_token2str(ls, who), where)); + } + } +} + + +static TString *str_checkname (LexState *ls) { + TString *ts; + check(ls, TK_NAME); + ts = ls->t.seminfo.ts; + luaX_next(ls); + return ts; +} + + +static void init_exp (expdesc *e, expkind k, int i) { + e->f = e->t = NO_JUMP; + e->k = k; + e->u.s.info = i; +} + + +static void codestring (LexState *ls, expdesc *e, TString *s) { + init_exp(e, VK, luaK_stringK(ls->fs, s)); +} + + +static void checkname(LexState *ls, expdesc *e) { + codestring(ls, e, str_checkname(ls)); +} + + +static int registerlocalvar (LexState *ls, TString *varname) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizelocvars; + luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, + LocVar, SHRT_MAX, "too many local variables"); + while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; + f->locvars[fs->nlocvars].varname = varname; + luaC_objbarrier(ls->L, f, varname); + return fs->nlocvars++; +} + + +#define new_localvarliteral(ls,v,n) \ + new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n) + + +static void new_localvar (LexState *ls, TString *name, int n) { + FuncState *fs = ls->fs; + luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables"); + fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); +} + + +static void adjustlocalvars (LexState *ls, int nvars) { + FuncState *fs = ls->fs; + fs->nactvar = cast_byte(fs->nactvar + nvars); + for (; nvars; nvars--) { + getlocvar(fs, fs->nactvar - nvars).startpc = fs->pc; + } +} + + +static void removevars (LexState *ls, int tolevel) { + FuncState *fs = ls->fs; + while (fs->nactvar > tolevel) + getlocvar(fs, --fs->nactvar).endpc = fs->pc; +} + + +static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { + int i; + Proto *f = fs->f; + int oldsize = f->sizeupvalues; + for (i=0; inups; i++) { + if (fs->upvalues[i].k == v->k && fs->upvalues[i].info == v->u.s.info) { + lua_assert(f->upvalues[i] == name); + return i; + } + } + /* new one */ + luaY_checklimit(fs, f->nups + 1, LUAI_MAXUPVALUES, "upvalues"); + luaM_growvector(fs->L, f->upvalues, f->nups, f->sizeupvalues, + TString *, MAX_INT, ""); + while (oldsize < f->sizeupvalues) f->upvalues[oldsize++] = NULL; + f->upvalues[f->nups] = name; + luaC_objbarrier(fs->L, f, name); + lua_assert(v->k == VLOCAL || v->k == VUPVAL); + fs->upvalues[f->nups].k = cast_byte(v->k); + fs->upvalues[f->nups].info = cast_byte(v->u.s.info); + return f->nups++; +} + + +static int searchvar (FuncState *fs, TString *n) { + int i; + for (i=fs->nactvar-1; i >= 0; i--) { + if (n == getlocvar(fs, i).varname) + return i; + } + return -1; /* not found */ +} + + +static void markupval (FuncState *fs, int level) { + BlockCnt *bl = fs->bl; + while (bl && bl->nactvar > level) bl = bl->previous; + if (bl) bl->upval = 1; +} + + +static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { + if (fs == NULL) { /* no more levels? */ + init_exp(var, VGLOBAL, NO_REG); /* default is global variable */ + return VGLOBAL; + } + else { + int v = searchvar(fs, n); /* look up at current level */ + if (v >= 0) { + init_exp(var, VLOCAL, v); + if (!base) + markupval(fs, v); /* local will be used as an upval */ + return VLOCAL; + } + else { /* not found at current level; try upper one */ + if (singlevaraux(fs->prev, n, var, 0) == VGLOBAL) + return VGLOBAL; + var->u.s.info = indexupvalue(fs, n, var); /* else was LOCAL or UPVAL */ + var->k = VUPVAL; /* upvalue in this level */ + return VUPVAL; + } + } +} + + +static void singlevar (LexState *ls, expdesc *var) { + TString *varname = str_checkname(ls); + FuncState *fs = ls->fs; + if (singlevaraux(fs, varname, var, 1) == VGLOBAL) + var->u.s.info = luaK_stringK(fs, varname); /* info points to global name */ +} + + +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { + FuncState *fs = ls->fs; + int extra = nvars - nexps; + if (hasmultret(e->k)) { + extra++; /* includes call itself */ + if (extra < 0) extra = 0; + luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ + if (extra > 1) luaK_reserveregs(fs, extra-1); + } + else { + if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ + if (extra > 0) { + int reg = fs->freereg; + luaK_reserveregs(fs, extra); + luaK_nil(fs, reg, extra); + } + } +} + + +static void enterlevel (LexState *ls) { + if (++ls->L->nCcalls > LUAI_MAXCCALLS) + luaX_lexerror(ls, "chunk has too many syntax levels", 0); +} + + +#define leavelevel(ls) ((ls)->L->nCcalls--) + + +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { + bl->breaklist = NO_JUMP; + bl->isbreakable = isbreakable; + bl->nactvar = fs->nactvar; + bl->upval = 0; + bl->previous = fs->bl; + fs->bl = bl; + lua_assert(fs->freereg == fs->nactvar); +} + + +static void leaveblock (FuncState *fs) { + BlockCnt *bl = fs->bl; + fs->bl = bl->previous; + removevars(fs->ls, bl->nactvar); + if (bl->upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + /* a block either controls scope or breaks (never both) */ + lua_assert(!bl->isbreakable || !bl->upval); + lua_assert(bl->nactvar == fs->nactvar); + fs->freereg = fs->nactvar; /* free registers */ + luaK_patchtohere(fs, bl->breaklist); +} + + +static void pushclosure (LexState *ls, FuncState *func, expdesc *v) { + FuncState *fs = ls->fs; + Proto *f = fs->f; + int oldsize = f->sizep; + int i; + luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *, + MAXARG_Bx, "constant table overflow"); + while (oldsize < f->sizep) f->p[oldsize++] = NULL; + f->p[fs->np++] = func->f; + luaC_objbarrier(ls->L, f, func->f); + init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np-1)); + for (i=0; if->nups; i++) { + OpCode o = (func->upvalues[i].k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; + luaK_codeABC(fs, o, 0, func->upvalues[i].info, 0); + } +} + + +static void open_func (LexState *ls, FuncState *fs) { + lua_State *L = ls->L; + Proto *f = luaF_newproto(L); + fs->f = f; + fs->prev = ls->fs; /* linked list of funcstates */ + fs->ls = ls; + fs->L = L; + ls->fs = fs; + fs->pc = 0; + fs->lasttarget = -1; + fs->jpc = NO_JUMP; + fs->freereg = 0; + fs->nk = 0; + fs->np = 0; + fs->nlocvars = 0; + fs->nactvar = 0; + fs->bl = NULL; + f->source = ls->source; + f->maxstacksize = 2; /* registers 0/1 are always valid */ + fs->h = luaH_new(L, 0, 0); + /* anchor table of constants and prototype (to avoid being collected) */ + sethvalue2s(L, L->top, fs->h); + incr_top(L); + setptvalue2s(L, L->top, f); + incr_top(L); +} + + +static void close_func (LexState *ls) { + lua_State *L = ls->L; + FuncState *fs = ls->fs; + Proto *f = fs->f; + removevars(ls, 0); + luaK_ret(fs, 0, 0); /* final return */ + luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); + f->sizecode = fs->pc; + luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); + f->sizelineinfo = fs->pc; + luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); + f->sizek = fs->nk; + luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); + f->sizep = fs->np; + luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); + f->sizelocvars = fs->nlocvars; + luaM_reallocvector(L, f->upvalues, f->sizeupvalues, f->nups, TString *); + f->sizeupvalues = f->nups; + lua_assert(luaG_checkcode(f)); + lua_assert(fs->bl == NULL); + ls->fs = fs->prev; + L->top -= 2; /* remove table and prototype from the stack */ + /* last token read was anchored in defunct function; must reanchor it */ + if (fs) anchor_token(ls); +} + + +Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { + struct LexState lexstate; + struct FuncState funcstate; + lexstate.buff = buff; + luaX_setinput(L, &lexstate, z, luaS_new(L, name)); + open_func(&lexstate, &funcstate); + funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ + luaX_next(&lexstate); /* read first token */ + chunk(&lexstate); + check(&lexstate, TK_EOS); + close_func(&lexstate); + lua_assert(funcstate.prev == NULL); + lua_assert(funcstate.f->nups == 0); + lua_assert(lexstate.fs == NULL); + return funcstate.f; +} + + + +/*============================================================*/ +/* GRAMMAR RULES */ +/*============================================================*/ + + +static void field (LexState *ls, expdesc *v) { + /* field -> ['.' | ':'] NAME */ + FuncState *fs = ls->fs; + expdesc key; + luaK_exp2anyreg(fs, v); + luaX_next(ls); /* skip the dot or colon */ + checkname(ls, &key); + luaK_indexed(fs, v, &key); +} + + +static void yindex (LexState *ls, expdesc *v) { + /* index -> '[' expr ']' */ + luaX_next(ls); /* skip the '[' */ + expr(ls, v); + luaK_exp2val(ls->fs, v); + checknext(ls, ']'); +} + + +/* +** {====================================================================== +** Rules for Constructors +** ======================================================================= +*/ + + +struct ConsControl { + expdesc v; /* last list item read */ + expdesc *t; /* table descriptor */ + int nh; /* total number of `record' elements */ + int na; /* total number of array elements */ + int tostore; /* number of array elements pending to be stored */ +}; + + +static void recfield (LexState *ls, struct ConsControl *cc) { + /* recfield -> (NAME | `['exp1`]') = exp1 */ + FuncState *fs = ls->fs; + int reg = ls->fs->freereg; + expdesc key, val; + int rkkey; + if (ls->t.token == TK_NAME) { + luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); + checkname(ls, &key); + } + else /* ls->t.token == '[' */ + yindex(ls, &key); + cc->nh++; + checknext(ls, '='); + rkkey = luaK_exp2RK(fs, &key); + expr(ls, &val); + luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); + fs->freereg = reg; /* free registers */ +} + + +static void closelistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->v.k == VVOID) return; /* there is no list item */ + luaK_exp2nextreg(fs, &cc->v); + cc->v.k = VVOID; + if (cc->tostore == LFIELDS_PER_FLUSH) { + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); /* flush */ + cc->tostore = 0; /* no more items pending */ + } +} + + +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { + if (cc->tostore == 0) return; + if (hasmultret(cc->v.k)) { + luaK_setmultret(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, LUA_MULTRET); + cc->na--; /* do not count last expression (unknown number of elements) */ + } + else { + if (cc->v.k != VVOID) + luaK_exp2nextreg(fs, &cc->v); + luaK_setlist(fs, cc->t->u.s.info, cc->na, cc->tostore); + } +} + + +static void listfield (LexState *ls, struct ConsControl *cc) { + expr(ls, &cc->v); + luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); + cc->na++; + cc->tostore++; +} + + +static void constructor (LexState *ls, expdesc *t) { + /* constructor -> ?? */ + FuncState *fs = ls->fs; + int line = ls->linenumber; + int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); + struct ConsControl cc; + cc.na = cc.nh = cc.tostore = 0; + cc.t = t; + init_exp(t, VRELOCABLE, pc); + init_exp(&cc.v, VVOID, 0); /* no value (yet) */ + luaK_exp2nextreg(ls->fs, t); /* fix it at stack top (for gc) */ + checknext(ls, '{'); + do { + lua_assert(cc.v.k == VVOID || cc.tostore > 0); + if (ls->t.token == '}') break; + closelistfield(fs, &cc); + switch(ls->t.token) { + case TK_NAME: { /* may be listfields or recfields */ + luaX_lookahead(ls); + if (ls->lookahead.token != '=') /* expression? */ + listfield(ls, &cc); + else + recfield(ls, &cc); + break; + } + case '[': { /* constructor_item -> recfield */ + recfield(ls, &cc); + break; + } + default: { /* constructor_part -> listfield */ + listfield(ls, &cc); + break; + } + } + } while (testnext(ls, ',') || testnext(ls, ';')); + check_match(ls, '}', '{', line); + lastlistfield(fs, &cc); + SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ + SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ +} + +/* }====================================================================== */ + + + +static void parlist (LexState *ls) { + /* parlist -> [ param { `,' param } ] */ + FuncState *fs = ls->fs; + Proto *f = fs->f; + int nparams = 0; + f->is_vararg = 0; + if (ls->t.token != ')') { /* is `parlist' not empty? */ + do { + switch (ls->t.token) { + case TK_NAME: { /* param -> NAME */ + new_localvar(ls, str_checkname(ls), nparams++); + break; + } + case TK_DOTS: { /* param -> `...' */ + luaX_next(ls); +#if defined(LUA_COMPAT_VARARG) + /* use `arg' as default name */ + new_localvarliteral(ls, "arg", nparams++); + f->is_vararg = VARARG_HASARG | VARARG_NEEDSARG; +#endif + f->is_vararg |= VARARG_ISVARARG; + break; + } + default: luaX_syntaxerror(ls, " or " LUA_QL("...") " expected"); + } + } while (!f->is_vararg && testnext(ls, ',')); + } + adjustlocalvars(ls, nparams); + f->numparams = cast_byte(fs->nactvar - (f->is_vararg & VARARG_HASARG)); + luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ +} + + +static void body (LexState *ls, expdesc *e, int needself, int line) { + /* body -> `(' parlist `)' chunk END */ + FuncState new_fs; + open_func(ls, &new_fs); + new_fs.f->linedefined = line; + checknext(ls, '('); + if (needself) { + new_localvarliteral(ls, "self", 0); + adjustlocalvars(ls, 1); + } + parlist(ls); + checknext(ls, ')'); + chunk(ls); + new_fs.f->lastlinedefined = ls->linenumber; + check_match(ls, TK_END, TK_FUNCTION, line); + close_func(ls); + pushclosure(ls, &new_fs, e); +} + + +static int explist1 (LexState *ls, expdesc *v) { + /* explist1 -> expr { `,' expr } */ + int n = 1; /* at least one expression */ + expr(ls, v); + while (testnext(ls, ',')) { + luaK_exp2nextreg(ls->fs, v); + expr(ls, v); + n++; + } + return n; +} + + +static void funcargs (LexState *ls, expdesc *f) { + FuncState *fs = ls->fs; + expdesc args; + int base, nparams; + int line = ls->linenumber; + switch (ls->t.token) { + case '(': { /* funcargs -> `(' [ explist1 ] `)' */ + if (line != ls->lastline) + luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)"); + luaX_next(ls); + if (ls->t.token == ')') /* arg list is empty? */ + args.k = VVOID; + else { + explist1(ls, &args); + luaK_setmultret(fs, &args); + } + check_match(ls, ')', '(', line); + break; + } + case '{': { /* funcargs -> constructor */ + constructor(ls, &args); + break; + } + case TK_STRING: { /* funcargs -> STRING */ + codestring(ls, &args, ls->t.seminfo.ts); + luaX_next(ls); /* must use `seminfo' before `next' */ + break; + } + default: { + luaX_syntaxerror(ls, "function arguments expected"); + return; + } + } + lua_assert(f->k == VNONRELOC); + base = f->u.s.info; /* base register for call */ + if (hasmultret(args.k)) + nparams = LUA_MULTRET; /* open call */ + else { + if (args.k != VVOID) + luaK_exp2nextreg(fs, &args); /* close last argument */ + nparams = fs->freereg - (base+1); + } + init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); + luaK_fixline(fs, line); + fs->freereg = base+1; /* call remove function and arguments and leaves + (unless changed) one result */ +} + + + + +/* +** {====================================================================== +** Expression parsing +** ======================================================================= +*/ + + +static void prefixexp (LexState *ls, expdesc *v) { + /* prefixexp -> NAME | '(' expr ')' */ + switch (ls->t.token) { + case '(': { + int line = ls->linenumber; + luaX_next(ls); + expr(ls, v); + check_match(ls, ')', '(', line); + luaK_dischargevars(ls->fs, v); + return; + } + case TK_NAME: { + singlevar(ls, v); + return; + } + default: { + luaX_syntaxerror(ls, "unexpected symbol"); + return; + } + } +} + + +static void primaryexp (LexState *ls, expdesc *v) { + /* primaryexp -> + prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ + FuncState *fs = ls->fs; + prefixexp(ls, v); + for (;;) { + switch (ls->t.token) { + case '.': { /* field */ + field(ls, v); + break; + } + case '[': { /* `[' exp1 `]' */ + expdesc key; + luaK_exp2anyreg(fs, v); + yindex(ls, &key); + luaK_indexed(fs, v, &key); + break; + } + case ':': { /* `:' NAME funcargs */ + expdesc key; + luaX_next(ls); + checkname(ls, &key); + luaK_self(fs, v, &key); + funcargs(ls, v); + break; + } + case '(': case TK_STRING: case '{': { /* funcargs */ + luaK_exp2nextreg(fs, v); + funcargs(ls, v); + break; + } + default: return; + } + } +} + + +static void simpleexp (LexState *ls, expdesc *v) { + /* simpleexp -> NUMBER | STRING | NIL | true | false | ... | + constructor | FUNCTION body | primaryexp */ + switch (ls->t.token) { + case TK_NUMBER: { + init_exp(v, VKNUM, 0); + v->u.nval = ls->t.seminfo.r; + break; + } + case TK_STRING: { + codestring(ls, v, ls->t.seminfo.ts); + break; + } + case TK_NIL: { + init_exp(v, VNIL, 0); + break; + } + case TK_TRUE: { + init_exp(v, VTRUE, 0); + break; + } + case TK_FALSE: { + init_exp(v, VFALSE, 0); + break; + } + case TK_DOTS: { /* vararg */ + FuncState *fs = ls->fs; + check_condition(ls, fs->f->is_vararg, + "cannot use " LUA_QL("...") " outside a vararg function"); + fs->f->is_vararg &= ~VARARG_NEEDSARG; /* don't need 'arg' */ + init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); + break; + } + case '{': { /* constructor */ + constructor(ls, v); + return; + } + case TK_FUNCTION: { + luaX_next(ls); + body(ls, v, 0, ls->linenumber); + return; + } + default: { + primaryexp(ls, v); + return; + } + } + luaX_next(ls); +} + + +static UnOpr getunopr (int op) { + switch (op) { + case TK_NOT: return OPR_NOT; + case '-': return OPR_MINUS; + case '#': return OPR_LEN; + default: return OPR_NOUNOPR; + } +} + + +static BinOpr getbinopr (int op) { + switch (op) { + case '+': return OPR_ADD; + case '-': return OPR_SUB; + case '*': return OPR_MUL; + case '/': return OPR_DIV; + case '%': return OPR_MOD; + case '^': return OPR_POW; + case TK_CONCAT: return OPR_CONCAT; + case TK_NE: return OPR_NE; + case TK_EQ: return OPR_EQ; + case '<': return OPR_LT; + case TK_LE: return OPR_LE; + case '>': return OPR_GT; + case TK_GE: return OPR_GE; + case TK_AND: return OPR_AND; + case TK_OR: return OPR_OR; + default: return OPR_NOBINOPR; + } +} + + +static const struct { + lu_byte left; /* left priority for each binary operator */ + lu_byte right; /* right priority */ +} priority[] = { /* ORDER OPR */ + {6, 6}, {6, 6}, {7, 7}, {7, 7}, {7, 7}, /* `+' `-' `/' `%' */ + {10, 9}, {5, 4}, /* power and concat (right associative) */ + {3, 3}, {3, 3}, /* equality and inequality */ + {3, 3}, {3, 3}, {3, 3}, {3, 3}, /* order */ + {2, 2}, {1, 1} /* logical (and/or) */ +}; + +#define UNARY_PRIORITY 8 /* priority for unary operators */ + + +/* +** subexpr -> (simpleexp | unop subexpr) { binop subexpr } +** where `binop' is any binary operator with a priority higher than `limit' +*/ +static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { + BinOpr op; + UnOpr uop; + enterlevel(ls); + uop = getunopr(ls->t.token); + if (uop != OPR_NOUNOPR) { + luaX_next(ls); + subexpr(ls, v, UNARY_PRIORITY); + luaK_prefix(ls->fs, uop, v); + } + else simpleexp(ls, v); + /* expand while operators have priorities higher than `limit' */ + op = getbinopr(ls->t.token); + while (op != OPR_NOBINOPR && priority[op].left > limit) { + expdesc v2; + BinOpr nextop; + luaX_next(ls); + luaK_infix(ls->fs, op, v); + /* read sub-expression with higher priority */ + nextop = subexpr(ls, &v2, priority[op].right); + luaK_posfix(ls->fs, op, v, &v2); + op = nextop; + } + leavelevel(ls); + return op; /* return first untreated operator */ +} + + +static void expr (LexState *ls, expdesc *v) { + subexpr(ls, v, 0); +} + +/* }==================================================================== */ + + + +/* +** {====================================================================== +** Rules for Statements +** ======================================================================= +*/ + + +static int block_follow (int token) { + switch (token) { + case TK_ELSE: case TK_ELSEIF: case TK_END: + case TK_UNTIL: case TK_EOS: + return 1; + default: return 0; + } +} + + +static void block (LexState *ls) { + /* block -> chunk */ + FuncState *fs = ls->fs; + BlockCnt bl; + enterblock(fs, &bl, 0); + chunk(ls); + lua_assert(bl.breaklist == NO_JUMP); + leaveblock(fs); +} + + +/* +** structure to chain all variables in the left-hand side of an +** assignment +*/ +struct LHS_assign { + struct LHS_assign *prev; + expdesc v; /* variable (global, local, upvalue, or indexed) */ +}; + + +/* +** check whether, in an assignment to a local variable, the local variable +** is needed in a previous assignment (to a table). If so, save original +** local value in a safe place and use this safe copy in the previous +** assignment. +*/ +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { + FuncState *fs = ls->fs; + int extra = fs->freereg; /* eventual position to save local variable */ + int conflict = 0; + for (; lh; lh = lh->prev) { + if (lh->v.k == VINDEXED) { + if (lh->v.u.s.info == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.info = extra; /* previous assignment will use safe copy */ + } + if (lh->v.u.s.aux == v->u.s.info) { /* conflict? */ + conflict = 1; + lh->v.u.s.aux = extra; /* previous assignment will use safe copy */ + } + } + } + if (conflict) { + luaK_codeABC(fs, OP_MOVE, fs->freereg, v->u.s.info, 0); /* make copy */ + luaK_reserveregs(fs, 1); + } +} + + +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { + expdesc e; + check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED, + "syntax error"); + if (testnext(ls, ',')) { /* assignment -> `,' primaryexp assignment */ + struct LHS_assign nv; + nv.prev = lh; + primaryexp(ls, &nv.v); + if (nv.v.k == VLOCAL) + check_conflict(ls, lh, &nv.v); + luaY_checklimit(ls->fs, nvars, LUAI_MAXCCALLS - ls->L->nCcalls, + "variables in assignment"); + assignment(ls, &nv, nvars+1); + } + else { /* assignment -> `=' explist1 */ + int nexps; + checknext(ls, '='); + nexps = explist1(ls, &e); + if (nexps != nvars) { + adjust_assign(ls, nvars, nexps, &e); + if (nexps > nvars) + ls->fs->freereg -= nexps - nvars; /* remove extra values */ + } + else { + luaK_setoneret(ls->fs, &e); /* close last expression */ + luaK_storevar(ls->fs, &lh->v, &e); + return; /* avoid default */ + } + } + init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ + luaK_storevar(ls->fs, &lh->v, &e); +} + + +static int cond (LexState *ls) { + /* cond -> exp */ + expdesc v; + expr(ls, &v); /* read condition */ + if (v.k == VNIL) v.k = VFALSE; /* `falses' are all equal here */ + luaK_goiftrue(ls->fs, &v); + return v.f; +} + + +static void breakstat (LexState *ls) { + FuncState *fs = ls->fs; + BlockCnt *bl = fs->bl; + int upval = 0; + while (bl && !bl->isbreakable) { + upval |= bl->upval; + bl = bl->previous; + } + if (!bl) + luaX_syntaxerror(ls, "no loop to break"); + if (upval) + luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + luaK_concat(fs, &bl->breaklist, luaK_jump(fs)); +} + + +static void whilestat (LexState *ls, int line) { + /* whilestat -> WHILE cond DO block END */ + FuncState *fs = ls->fs; + int whileinit; + int condexit; + BlockCnt bl; + luaX_next(ls); /* skip WHILE */ + whileinit = luaK_getlabel(fs); + condexit = cond(ls); + enterblock(fs, &bl, 1); + checknext(ls, TK_DO); + block(ls); + luaK_patchlist(fs, luaK_jump(fs), whileinit); + check_match(ls, TK_END, TK_WHILE, line); + leaveblock(fs); + luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ +} + + +static void repeatstat (LexState *ls, int line) { + /* repeatstat -> REPEAT block UNTIL cond */ + int condexit; + FuncState *fs = ls->fs; + int repeat_init = luaK_getlabel(fs); + BlockCnt bl1, bl2; + enterblock(fs, &bl1, 1); /* loop block */ + enterblock(fs, &bl2, 0); /* scope block */ + luaX_next(ls); /* skip REPEAT */ + chunk(ls); + check_match(ls, TK_UNTIL, TK_REPEAT, line); + condexit = cond(ls); /* read condition (inside scope block) */ + if (!bl2.upval) { /* no upvalues? */ + leaveblock(fs); /* finish scope */ + luaK_patchlist(ls->fs, condexit, repeat_init); /* close the loop */ + } + else { /* complete semantics when there are upvalues */ + breakstat(ls); /* if condition then break */ + luaK_patchtohere(ls->fs, condexit); /* else... */ + leaveblock(fs); /* finish scope... */ + luaK_patchlist(ls->fs, luaK_jump(fs), repeat_init); /* and repeat */ + } + leaveblock(fs); /* finish loop */ +} + + +static int exp1 (LexState *ls) { + expdesc e; + int k; + expr(ls, &e); + k = e.k; + luaK_exp2nextreg(ls->fs, &e); + return k; +} + + +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { + /* forbody -> DO block */ + BlockCnt bl; + FuncState *fs = ls->fs; + int prep, endfor; + adjustlocalvars(ls, 3); /* control variables */ + checknext(ls, TK_DO); + prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); + enterblock(fs, &bl, 0); /* scope for declared variables */ + adjustlocalvars(ls, nvars); + luaK_reserveregs(fs, nvars); + block(ls); + leaveblock(fs); /* end of scope for declared variables */ + luaK_patchtohere(fs, prep); + endfor = (isnum) ? luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP) : + luaK_codeABC(fs, OP_TFORLOOP, base, 0, nvars); + luaK_fixline(fs, line); /* pretend that `OP_FOR' starts the loop */ + luaK_patchlist(fs, (isnum ? endfor : luaK_jump(fs)), prep + 1); +} + + +static void fornum (LexState *ls, TString *varname, int line) { + /* fornum -> NAME = exp1,exp1[,exp1] forbody */ + FuncState *fs = ls->fs; + int base = fs->freereg; + new_localvarliteral(ls, "(for index)", 0); + new_localvarliteral(ls, "(for limit)", 1); + new_localvarliteral(ls, "(for step)", 2); + new_localvar(ls, varname, 3); + checknext(ls, '='); + exp1(ls); /* initial value */ + checknext(ls, ','); + exp1(ls); /* limit */ + if (testnext(ls, ',')) + exp1(ls); /* optional step */ + else { /* default step = 1 */ + luaK_codeABx(fs, OP_LOADK, fs->freereg, luaK_numberK(fs, 1)); + luaK_reserveregs(fs, 1); + } + forbody(ls, base, line, 1, 1); +} + + +static void forlist (LexState *ls, TString *indexname) { + /* forlist -> NAME {,NAME} IN explist1 forbody */ + FuncState *fs = ls->fs; + expdesc e; + int nvars = 0; + int line; + int base = fs->freereg; + /* create control variables */ + new_localvarliteral(ls, "(for generator)", nvars++); + new_localvarliteral(ls, "(for state)", nvars++); + new_localvarliteral(ls, "(for control)", nvars++); + /* create declared variables */ + new_localvar(ls, indexname, nvars++); + while (testnext(ls, ',')) + new_localvar(ls, str_checkname(ls), nvars++); + checknext(ls, TK_IN); + line = ls->linenumber; + adjust_assign(ls, 3, explist1(ls, &e), &e); + luaK_checkstack(fs, 3); /* extra space to call generator */ + forbody(ls, base, line, nvars - 3, 0); +} + + +static void forstat (LexState *ls, int line) { + /* forstat -> FOR (fornum | forlist) END */ + FuncState *fs = ls->fs; + TString *varname; + BlockCnt bl; + enterblock(fs, &bl, 1); /* scope for loop and control variables */ + luaX_next(ls); /* skip `for' */ + varname = str_checkname(ls); /* first variable name */ + switch (ls->t.token) { + case '=': fornum(ls, varname, line); break; + case ',': case TK_IN: forlist(ls, varname); break; + default: luaX_syntaxerror(ls, LUA_QL("=") " or " LUA_QL("in") " expected"); + } + check_match(ls, TK_END, TK_FOR, line); + leaveblock(fs); /* loop scope (`break' jumps to this point) */ +} + + +static int test_then_block (LexState *ls) { + /* test_then_block -> [IF | ELSEIF] cond THEN block */ + int condexit; + luaX_next(ls); /* skip IF or ELSEIF */ + condexit = cond(ls); + checknext(ls, TK_THEN); + block(ls); /* `then' part */ + return condexit; +} + + +static void ifstat (LexState *ls, int line) { + /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ + FuncState *fs = ls->fs; + int flist; + int escapelist = NO_JUMP; + flist = test_then_block(ls); /* IF cond THEN block */ + while (ls->t.token == TK_ELSEIF) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + flist = test_then_block(ls); /* ELSEIF cond THEN block */ + } + if (ls->t.token == TK_ELSE) { + luaK_concat(fs, &escapelist, luaK_jump(fs)); + luaK_patchtohere(fs, flist); + luaX_next(ls); /* skip ELSE (after patch, for correct line info) */ + block(ls); /* `else' part */ + } + else + luaK_concat(fs, &escapelist, flist); + luaK_patchtohere(fs, escapelist); + check_match(ls, TK_END, TK_IF, line); +} + + +static void localfunc (LexState *ls) { + expdesc v, b; + FuncState *fs = ls->fs; + new_localvar(ls, str_checkname(ls), 0); + init_exp(&v, VLOCAL, fs->freereg); + luaK_reserveregs(fs, 1); + adjustlocalvars(ls, 1); + body(ls, &b, 0, ls->linenumber); + luaK_storevar(fs, &v, &b); + /* debug information will only see the variable after this point! */ + getlocvar(fs, fs->nactvar - 1).startpc = fs->pc; +} + + +static void localstat (LexState *ls) { + /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ + int nvars = 0; + int nexps; + expdesc e; + do { + new_localvar(ls, str_checkname(ls), nvars++); + } while (testnext(ls, ',')); + if (testnext(ls, '=')) + nexps = explist1(ls, &e); + else { + e.k = VVOID; + nexps = 0; + } + adjust_assign(ls, nvars, nexps, &e); + adjustlocalvars(ls, nvars); +} + + +static int funcname (LexState *ls, expdesc *v) { + /* funcname -> NAME {field} [`:' NAME] */ + int needself = 0; + singlevar(ls, v); + while (ls->t.token == '.') + field(ls, v); + if (ls->t.token == ':') { + needself = 1; + field(ls, v); + } + return needself; +} + + +static void funcstat (LexState *ls, int line) { + /* funcstat -> FUNCTION funcname body */ + int needself; + expdesc v, b; + luaX_next(ls); /* skip FUNCTION */ + needself = funcname(ls, &v); + body(ls, &b, needself, line); + luaK_storevar(ls->fs, &v, &b); + luaK_fixline(ls->fs, line); /* definition `happens' in the first line */ +} + + +static void exprstat (LexState *ls) { + /* stat -> func | assignment */ + FuncState *fs = ls->fs; + struct LHS_assign v; + primaryexp(ls, &v.v); + if (v.v.k == VCALL) /* stat -> func */ + SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ + else { /* stat -> assignment */ + v.prev = NULL; + assignment(ls, &v, 1); + } +} + + +static void retstat (LexState *ls) { + /* stat -> RETURN explist */ + FuncState *fs = ls->fs; + expdesc e; + int first, nret; /* registers with returned values */ + luaX_next(ls); /* skip RETURN */ + if (block_follow(ls->t.token) || ls->t.token == ';') + first = nret = 0; /* return no values */ + else { + nret = explist1(ls, &e); /* optional return values */ + if (hasmultret(e.k)) { + luaK_setmultret(fs, &e); + if (e.k == VCALL && nret == 1) { /* tail call? */ + SET_OPCODE(getcode(fs,&e), OP_TAILCALL); + lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); + } + first = fs->nactvar; + nret = LUA_MULTRET; /* return all values */ + } + else { + if (nret == 1) /* only one single value? */ + first = luaK_exp2anyreg(fs, &e); + else { + luaK_exp2nextreg(fs, &e); /* values must go to the `stack' */ + first = fs->nactvar; /* return all `active' values */ + lua_assert(nret == fs->freereg - first); + } + } + } + luaK_ret(fs, first, nret); +} + + +static int statement (LexState *ls) { + int line = ls->linenumber; /* may be needed for error messages */ + switch (ls->t.token) { + case TK_IF: { /* stat -> ifstat */ + ifstat(ls, line); + return 0; + } + case TK_WHILE: { /* stat -> whilestat */ + whilestat(ls, line); + return 0; + } + case TK_DO: { /* stat -> DO block END */ + luaX_next(ls); /* skip DO */ + block(ls); + check_match(ls, TK_END, TK_DO, line); + return 0; + } + case TK_FOR: { /* stat -> forstat */ + forstat(ls, line); + return 0; + } + case TK_REPEAT: { /* stat -> repeatstat */ + repeatstat(ls, line); + return 0; + } + case TK_FUNCTION: { + funcstat(ls, line); /* stat -> funcstat */ + return 0; + } + case TK_LOCAL: { /* stat -> localstat */ + luaX_next(ls); /* skip LOCAL */ + if (testnext(ls, TK_FUNCTION)) /* local function? */ + localfunc(ls); + else + localstat(ls); + return 0; + } + case TK_RETURN: { /* stat -> retstat */ + retstat(ls); + return 1; /* must be last statement */ + } + case TK_BREAK: { /* stat -> breakstat */ + luaX_next(ls); /* skip BREAK */ + breakstat(ls); + return 1; /* must be last statement */ + } + default: { + exprstat(ls); + return 0; /* to avoid warnings */ + } + } +} + + +static void chunk (LexState *ls) { + /* chunk -> { stat [`;'] } */ + int islast = 0; + enterlevel(ls); + while (!islast && !block_follow(ls->t.token)) { + islast = statement(ls); + testnext(ls, ';'); + lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && + ls->fs->freereg >= ls->fs->nactvar); + ls->fs->freereg = ls->fs->nactvar; /* free registers */ + } + leavelevel(ls); +} + +/* }====================================================================== */ diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lparser.h b/ThirdLib/thirdparty/LuaLib/lparser.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lparser.h rename to ThirdLib/thirdparty/LuaLib/lparser.h diff --git a/ThirdLib/thirdparty/LuaLib/lstate.c b/ThirdLib/thirdparty/LuaLib/lstate.c new file mode 100644 index 000000000..4313b83a0 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lstate.c @@ -0,0 +1,214 @@ +/* +** $Id: lstate.c,v 2.36.1.2 2008/01/03 15:20:39 roberto Exp $ +** Global State +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstate_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "llex.h" +#include "lmem.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + +#define state_size(x) (sizeof(x) + LUAI_EXTRASPACE) +#define fromstate(l) (cast(lu_byte *, (l)) - LUAI_EXTRASPACE) +#define tostate(l) (cast(lua_State *, cast(lu_byte *, l) + LUAI_EXTRASPACE)) + + +/* +** Main thread combines a thread state and the global state +*/ +typedef struct LG { + lua_State l; + global_State g; +} LG; + + + +static void stack_init (lua_State *L1, lua_State *L) { + /* initialize CallInfo array */ + L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo); + L1->ci = L1->base_ci; + L1->size_ci = BASIC_CI_SIZE; + L1->end_ci = L1->base_ci + L1->size_ci - 1; + /* initialize stack array */ + L1->stack = luaM_newvector(L, BASIC_STACK_SIZE + EXTRA_STACK, TValue); + L1->stacksize = BASIC_STACK_SIZE + EXTRA_STACK; + L1->top = L1->stack; + L1->stack_last = L1->stack+(L1->stacksize - EXTRA_STACK)-1; + /* initialize first ci */ + L1->ci->func = L1->top; + setnilvalue(L1->top++); /* `function' entry for this `ci' */ + L1->base = L1->ci->base = L1->top; + L1->ci->top = L1->top + LUA_MINSTACK; +} + + +static void freestack (lua_State *L, lua_State *L1) { + luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo); + luaM_freearray(L, L1->stack, L1->stacksize, TValue); +} + + +/* +** open parts that may cause memory-allocation errors +*/ +static void f_luaopen (lua_State *L, void *ud) { + global_State *g = G(L); + UNUSED(ud); + stack_init(L, L); /* init stack */ + sethvalue(L, gt(L), luaH_new(L, 0, 2)); /* table of globals */ + sethvalue(L, registry(L), luaH_new(L, 0, 2)); /* registry */ + luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ + luaT_init(L); + luaX_init(L); + luaS_fix(luaS_newliteral(L, MEMERRMSG)); + g->GCthreshold = 4*g->totalbytes; +} + + +static void preinit_state (lua_State *L, global_State *g) { + G(L) = g; + L->stack = NULL; + L->stacksize = 0; + L->errorJmp = NULL; + L->hook = NULL; + L->hookmask = 0; + L->basehookcount = 0; + L->allowhook = 1; + resethookcount(L); + L->openupval = NULL; + L->size_ci = 0; + L->nCcalls = L->baseCcalls = 0; + L->status = 0; + L->base_ci = L->ci = NULL; + L->savedpc = NULL; + L->errfunc = 0; + setnilvalue(gt(L)); +} + + +static void close_state (lua_State *L) { + global_State *g = G(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_freeall(L); /* collect all objects */ + lua_assert(g->rootgc == obj2gco(L)); + lua_assert(g->strt.nuse == 0); + luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size, TString *); + luaZ_freebuffer(L, &g->buff); + freestack(L, L); + lua_assert(g->totalbytes == sizeof(LG)); + (*g->frealloc)(g->ud, fromstate(L), state_size(LG), 0); +} + + +lua_State *luaE_newthread (lua_State *L) { + lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); + luaC_link(L, obj2gco(L1), LUA_TTHREAD); + preinit_state(L1, G(L)); + stack_init(L1, L); /* init stack */ + setobj2n(L, gt(L1), gt(L)); /* share table of globals */ + L1->hookmask = L->hookmask; + L1->basehookcount = L->basehookcount; + L1->hook = L->hook; + resethookcount(L1); + lua_assert(iswhite(obj2gco(L1))); + return L1; +} + + +void luaE_freethread (lua_State *L, lua_State *L1) { + luaF_close(L1, L1->stack); /* close all upvalues for this thread */ + lua_assert(L1->openupval == NULL); + luai_userstatefree(L1); + freestack(L, L1); + luaM_freemem(L, fromstate(L1), state_size(lua_State)); +} + + +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { + int i; + lua_State *L; + global_State *g; + void *l = (*f)(ud, NULL, 0, state_size(LG)); + if (l == NULL) return NULL; + L = tostate(l); + g = &((LG *)L)->g; + L->next = NULL; + L->tt = LUA_TTHREAD; + g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); + L->marked = luaC_white(g); + set2bits(L->marked, FIXEDBIT, SFIXEDBIT); + preinit_state(L, g); + g->frealloc = f; + g->ud = ud; + g->mainthread = L; + g->uvhead.u.l.prev = &g->uvhead; + g->uvhead.u.l.next = &g->uvhead; + g->GCthreshold = 0; /* mark it as unfinished state */ + g->strt.size = 0; + g->strt.nuse = 0; + g->strt.hash = NULL; + setnilvalue(registry(L)); + luaZ_initbuffer(L, &g->buff); + g->panic = NULL; + g->gcstate = GCSpause; + g->rootgc = obj2gco(L); + g->sweepstrgc = 0; + g->sweepgc = &g->rootgc; + g->gray = NULL; + g->grayagain = NULL; + g->weak = NULL; + g->tmudata = NULL; + g->totalbytes = sizeof(LG); + g->gcpause = LUAI_GCPAUSE; + g->gcstepmul = LUAI_GCMUL; + g->gcdept = 0; + for (i=0; imt[i] = NULL; + if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { + /* memory allocation error: free partial state */ + close_state(L); + L = NULL; + } + else + luai_userstateopen(L); + return L; +} + + +static void callallgcTM (lua_State *L, void *ud) { + UNUSED(ud); + luaC_callGCTM(L); /* call GC metamethods for all udata */ +} + + +LUA_API void lua_close (lua_State *L) { + L = G(L)->mainthread; /* only the main thread can be closed */ + lua_lock(L); + luaF_close(L, L->stack); /* close all upvalues for this thread */ + luaC_separateudata(L, 1); /* separate udata that have GC metamethods */ + L->errfunc = 0; /* no error function during GC metamethods */ + do { /* repeat until no more errors */ + L->ci = L->base_ci; + L->base = L->top = L->ci->base; + L->nCcalls = L->baseCcalls = 0; + } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); + lua_assert(G(L)->tmudata == NULL); + luai_userstateclose(L); + close_state(L); +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lstate.h b/ThirdLib/thirdparty/LuaLib/lstate.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lstate.h rename to ThirdLib/thirdparty/LuaLib/lstate.h diff --git a/ThirdLib/thirdparty/LuaLib/lstring.c b/ThirdLib/thirdparty/LuaLib/lstring.c new file mode 100644 index 000000000..49113151c --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lstring.c @@ -0,0 +1,111 @@ +/* +** $Id: lstring.c,v 2.8.1.1 2007/12/27 13:02:25 roberto Exp $ +** String table (keeps all strings handled by Lua) +** See Copyright Notice in lua.h +*/ + + +#include + +#define lstring_c +#define LUA_CORE + +#include "lua.h" + +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" + + + +void luaS_resize (lua_State *L, int newsize) { + GCObject **newhash; + stringtable *tb; + int i; + if (G(L)->gcstate == GCSsweepstring) + return; /* cannot resize during GC traverse */ + newhash = luaM_newvector(L, newsize, GCObject *); + tb = &G(L)->strt; + for (i=0; isize; i++) { + GCObject *p = tb->hash[i]; + while (p) { /* for each node in the list */ + GCObject *next = p->gch.next; /* save next */ + unsigned int h = gco2ts(p)->hash; + int h1 = lmod(h, newsize); /* new position */ + lua_assert(cast_int(h%newsize) == lmod(h, newsize)); + p->gch.next = newhash[h1]; /* chain it */ + newhash[h1] = p; + p = next; + } + } + luaM_freearray(L, tb->hash, tb->size, TString *); + tb->size = newsize; + tb->hash = newhash; +} + + +static TString *newlstr (lua_State *L, const char *str, size_t l, + unsigned int h) { + TString *ts; + stringtable *tb; + if (l+1 > (MAX_SIZET - sizeof(TString))/sizeof(char)) + luaM_toobig(L); + ts = cast(TString *, luaM_malloc(L, (l+1)*sizeof(char)+sizeof(TString))); + ts->tsv.len = l; + ts->tsv.hash = h; + ts->tsv.marked = luaC_white(G(L)); + ts->tsv.tt = LUA_TSTRING; + ts->tsv.reserved = 0; + memcpy(ts+1, str, l*sizeof(char)); + ((char *)(ts+1))[l] = '\0'; /* ending 0 */ + tb = &G(L)->strt; + h = lmod(h, tb->size); + ts->tsv.next = tb->hash[h]; /* chain new entry */ + tb->hash[h] = obj2gco(ts); + tb->nuse++; + if (tb->nuse > cast(lu_int32, tb->size) && tb->size <= MAX_INT/2) + luaS_resize(L, tb->size*2); /* too crowded */ + return ts; +} + + +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { + GCObject *o; + unsigned int h = cast(unsigned int, l); /* seed */ + size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ + size_t l1; + for (l1=l; l1>=step; l1-=step) /* compute hash */ + h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1])); + for (o = G(L)->strt.hash[lmod(h, G(L)->strt.size)]; + o != NULL; + o = o->gch.next) { + TString *ts = rawgco2ts(o); + if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) { + /* string may be dead */ + if (isdead(G(L), o)) changewhite(o); + return ts; + } + } + return newlstr(L, str, l, h); /* not found */ +} + + +Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { + Udata *u; + if (s > MAX_SIZET - sizeof(Udata)) + luaM_toobig(L); + u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata))); + u->uv.marked = luaC_white(G(L)); /* is not finalized */ + u->uv.tt = LUA_TUSERDATA; + u->uv.len = s; + u->uv.metatable = NULL; + u->uv.env = e; + /* chain it on udata list (after main thread) */ + u->uv.next = G(L)->mainthread->next; + G(L)->mainthread->next = obj2gco(u); + return u; +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lstring.h b/ThirdLib/thirdparty/LuaLib/lstring.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lstring.h rename to ThirdLib/thirdparty/LuaLib/lstring.h diff --git a/ThirdLib/thirdparty/LuaLib/lstrlib.c b/ThirdLib/thirdparty/LuaLib/lstrlib.c new file mode 100644 index 000000000..1b4763d4e --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lstrlib.c @@ -0,0 +1,869 @@ +/* +** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $ +** Standard library for string operations and pattern-matching +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include +#include +#include + +#define lstrlib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +/* macro to `unsign' a character */ +#define uchar(c) ((unsigned char)(c)) + + + +static int str_len (lua_State *L) { + size_t l; + luaL_checklstring(L, 1, &l); + lua_pushinteger(L, l); + return 1; +} + + +static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { + /* relative string position: negative means back from end */ + if (pos < 0) pos += (ptrdiff_t)len + 1; + return (pos >= 0) ? pos : 0; +} + + +static int str_sub (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l); + ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l); + if (start < 1) start = 1; + if (end > (ptrdiff_t)l) end = (ptrdiff_t)l; + if (start <= end) + lua_pushlstring(L, s+start-1, end-start+1); + else lua_pushliteral(L, ""); + return 1; +} + + +static int str_reverse (lua_State *L) { + size_t l; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + while (l--) luaL_addchar(&b, s[l]); + luaL_pushresult(&b); + return 1; +} + + +static int str_lower (lua_State *L) { + size_t l; + size_t i; + luaL_Buffer b; + const char *s = luaL_checklstring(L, 1, &l); + luaL_buffinit(L, &b); + for (i=0; i 0) + luaL_addlstring(&b, s, l); + luaL_pushresult(&b); + return 1; +} + + +static int str_byte (lua_State *L) { + size_t l; + const char *s = luaL_checklstring(L, 1, &l); + ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l); + ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l); + int n, i; + if (posi <= 0) posi = 1; + if ((size_t)pose > l) pose = l; + if (posi > pose) return 0; /* empty interval; return no values */ + n = (int)(pose - posi + 1); + if (posi + n <= pose) /* overflow? */ + luaL_error(L, "string slice too long"); + luaL_checkstack(L, n, "string slice too long"); + for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) + return luaL_error(ms->L, "invalid capture index"); + return l; +} + + +static int capture_to_close (MatchState *ms) { + int level = ms->level; + for (level--; level>=0; level--) + if (ms->capture[level].len == CAP_UNFINISHED) return level; + return luaL_error(ms->L, "invalid pattern capture"); +} + + +static const char *classend (MatchState *ms, const char *p) { + switch (*p++) { + case L_ESC: { + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")"); + return p+1; + } + case '[': { + if (*p == '^') p++; + do { /* look for a `]' */ + if (*p == '\0') + luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")"); + if (*(p++) == L_ESC && *p != '\0') + p++; /* skip escapes (e.g. `%]') */ + } while (*p != ']'); + return p+1; + } + default: { + return p; + } + } +} + + +static int match_class (int c, int cl) { + int res; + switch (tolower(cl)) { + case 'a' : res = isalpha(c); break; + case 'c' : res = iscntrl(c); break; + case 'd' : res = isdigit(c); break; + case 'l' : res = islower(c); break; + case 'p' : res = ispunct(c); break; + case 's' : res = isspace(c); break; + case 'u' : res = isupper(c); break; + case 'w' : res = isalnum(c); break; + case 'x' : res = isxdigit(c); break; + case 'z' : res = (c == 0); break; + default: return (cl == c); + } + return (islower(cl) ? res : !res); +} + + +static int matchbracketclass (int c, const char *p, const char *ec) { + int sig = 1; + if (*(p+1) == '^') { + sig = 0; + p++; /* skip the `^' */ + } + while (++p < ec) { + if (*p == L_ESC) { + p++; + if (match_class(c, uchar(*p))) + return sig; + } + else if ((*(p+1) == '-') && (p+2 < ec)) { + p+=2; + if (uchar(*(p-2)) <= c && c <= uchar(*p)) + return sig; + } + else if (uchar(*p) == c) return sig; + } + return !sig; +} + + +static int singlematch (int c, const char *p, const char *ep) { + switch (*p) { + case '.': return 1; /* matches any char */ + case L_ESC: return match_class(c, uchar(*(p+1))); + case '[': return matchbracketclass(c, p, ep-1); + default: return (uchar(*p) == c); + } +} + + +static const char *match (MatchState *ms, const char *s, const char *p); + + +static const char *matchbalance (MatchState *ms, const char *s, + const char *p) { + if (*p == 0 || *(p+1) == 0) + luaL_error(ms->L, "unbalanced pattern"); + if (*s != *p) return NULL; + else { + int b = *p; + int e = *(p+1); + int cont = 1; + while (++s < ms->src_end) { + if (*s == e) { + if (--cont == 0) return s+1; + } + else if (*s == b) cont++; + } + } + return NULL; /* string ends out of balance */ +} + + +static const char *max_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + ptrdiff_t i = 0; /* counts maximum expand for item */ + while ((s+i)src_end && singlematch(uchar(*(s+i)), p, ep)) + i++; + /* keeps trying to match with the maximum repetitions */ + while (i>=0) { + const char *res = match(ms, (s+i), ep+1); + if (res) return res; + i--; /* else didn't match; reduce 1 repetition to try again */ + } + return NULL; +} + + +static const char *min_expand (MatchState *ms, const char *s, + const char *p, const char *ep) { + for (;;) { + const char *res = match(ms, s, ep+1); + if (res != NULL) + return res; + else if (ssrc_end && singlematch(uchar(*s), p, ep)) + s++; /* try with one more repetition */ + else return NULL; + } +} + + +static const char *start_capture (MatchState *ms, const char *s, + const char *p, int what) { + const char *res; + int level = ms->level; + if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); + ms->capture[level].init = s; + ms->capture[level].len = what; + ms->level = level+1; + if ((res=match(ms, s, p)) == NULL) /* match failed? */ + ms->level--; /* undo capture */ + return res; +} + + +static const char *end_capture (MatchState *ms, const char *s, + const char *p) { + int l = capture_to_close(ms); + const char *res; + ms->capture[l].len = s - ms->capture[l].init; /* close capture */ + if ((res = match(ms, s, p)) == NULL) /* match failed? */ + ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ + return res; +} + + +static const char *match_capture (MatchState *ms, const char *s, int l) { + size_t len; + l = check_capture(ms, l); + len = ms->capture[l].len; + if ((size_t)(ms->src_end-s) >= len && + memcmp(ms->capture[l].init, s, len) == 0) + return s+len; + else return NULL; +} + + +static const char *match (MatchState *ms, const char *s, const char *p) { + init: /* using goto's to optimize tail recursion */ + switch (*p) { + case '(': { /* start capture */ + if (*(p+1) == ')') /* position capture? */ + return start_capture(ms, s, p+2, CAP_POSITION); + else + return start_capture(ms, s, p+1, CAP_UNFINISHED); + } + case ')': { /* end capture */ + return end_capture(ms, s, p+1); + } + case L_ESC: { + switch (*(p+1)) { + case 'b': { /* balanced string? */ + s = matchbalance(ms, s, p+2); + if (s == NULL) return NULL; + p+=4; goto init; /* else return match(ms, s, p+4); */ + } + case 'f': { /* frontier? */ + const char *ep; char previous; + p += 2; + if (*p != '[') + luaL_error(ms->L, "missing " LUA_QL("[") " after " + LUA_QL("%%f") " in pattern"); + ep = classend(ms, p); /* points to what is next */ + previous = (s == ms->src_init) ? '\0' : *(s-1); + if (matchbracketclass(uchar(previous), p, ep-1) || + !matchbracketclass(uchar(*s), p, ep-1)) return NULL; + p=ep; goto init; /* else return match(ms, s, ep); */ + } + default: { + if (isdigit(uchar(*(p+1)))) { /* capture results (%0-%9)? */ + s = match_capture(ms, s, uchar(*(p+1))); + if (s == NULL) return NULL; + p+=2; goto init; /* else return match(ms, s, p+2) */ + } + goto dflt; /* case default */ + } + } + } + case '\0': { /* end of pattern */ + return s; /* match succeeded */ + } + case '$': { + if (*(p+1) == '\0') /* is the `$' the last char in pattern? */ + return (s == ms->src_end) ? s : NULL; /* check end of string */ + else goto dflt; + } + default: dflt: { /* it is a pattern item */ + const char *ep = classend(ms, p); /* points to what is next */ + int m = ssrc_end && singlematch(uchar(*s), p, ep); + switch (*ep) { + case '?': { /* optional */ + const char *res; + if (m && ((res=match(ms, s+1, ep+1)) != NULL)) + return res; + p=ep+1; goto init; /* else return match(ms, s, ep+1); */ + } + case '*': { /* 0 or more repetitions */ + return max_expand(ms, s, p, ep); + } + case '+': { /* 1 or more repetitions */ + return (m ? max_expand(ms, s+1, p, ep) : NULL); + } + case '-': { /* 0 or more repetitions (minimum) */ + return min_expand(ms, s, p, ep); + } + default: { + if (!m) return NULL; + s++; p=ep; goto init; /* else return match(ms, s+1, ep); */ + } + } + } + } +} + + + +static const char *lmemfind (const char *s1, size_t l1, + const char *s2, size_t l2) { + if (l2 == 0) return s1; /* empty strings are everywhere */ + else if (l2 > l1) return NULL; /* avoids a negative `l1' */ + else { + const char *init; /* to search for a `*s2' inside `s1' */ + l2--; /* 1st char will be checked by `memchr' */ + l1 = l1-l2; /* `s2' cannot be found after that */ + while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { + init++; /* 1st char is already checked */ + if (memcmp(init, s2+1, l2) == 0) + return init-1; + else { /* correct `l1' and `s1' to try again */ + l1 -= init-s1; + s1 = init; + } + } + return NULL; /* not found */ + } +} + + +static void push_onecapture (MatchState *ms, int i, const char *s, + const char *e) { + if (i >= ms->level) { + if (i == 0) /* ms->level == 0, too */ + lua_pushlstring(ms->L, s, e - s); /* add whole match */ + else + luaL_error(ms->L, "invalid capture index"); + } + else { + ptrdiff_t l = ms->capture[i].len; + if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); + if (l == CAP_POSITION) + lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1); + else + lua_pushlstring(ms->L, ms->capture[i].init, l); + } +} + + +static int push_captures (MatchState *ms, const char *s, const char *e) { + int i; + int nlevels = (ms->level == 0 && s) ? 1 : ms->level; + luaL_checkstack(ms->L, nlevels, "too many captures"); + for (i = 0; i < nlevels; i++) + push_onecapture(ms, i, s, e); + return nlevels; /* number of strings pushed */ +} + + +static int str_find_aux (lua_State *L, int find) { + size_t l1, l2; + const char *s = luaL_checklstring(L, 1, &l1); + const char *p = luaL_checklstring(L, 2, &l2); + ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1; + if (init < 0) init = 0; + else if ((size_t)(init) > l1) init = (ptrdiff_t)l1; + if (find && (lua_toboolean(L, 4) || /* explicit request? */ + strpbrk(p, SPECIALS) == NULL)) { /* or no special characters? */ + /* do a plain search */ + const char *s2 = lmemfind(s+init, l1-init, p, l2); + if (s2) { + lua_pushinteger(L, s2-s+1); + lua_pushinteger(L, s2-s+l2); + return 2; + } + } + else { + MatchState ms; + int anchor = (*p == '^') ? (p++, 1) : 0; + const char *s1=s+init; + ms.L = L; + ms.src_init = s; + ms.src_end = s+l1; + do { + const char *res; + ms.level = 0; + if ((res=match(&ms, s1, p)) != NULL) { + if (find) { + lua_pushinteger(L, s1-s+1); /* start */ + lua_pushinteger(L, res-s); /* end */ + return push_captures(&ms, NULL, 0) + 2; + } + else + return push_captures(&ms, s1, res); + } + } while (s1++ < ms.src_end && !anchor); + } + lua_pushnil(L); /* not found */ + return 1; +} + + +static int str_find (lua_State *L) { + return str_find_aux(L, 1); +} + + +static int str_match (lua_State *L) { + return str_find_aux(L, 0); +} + + +static int gmatch_aux (lua_State *L) { + MatchState ms; + size_t ls; + const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); + const char *p = lua_tostring(L, lua_upvalueindex(2)); + const char *src; + ms.L = L; + ms.src_init = s; + ms.src_end = s+ls; + for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); + src <= ms.src_end; + src++) { + const char *e; + ms.level = 0; + if ((e = match(&ms, src, p)) != NULL) { + lua_Integer newstart = e-s; + if (e == src) newstart++; /* empty match? go at least one position */ + lua_pushinteger(L, newstart); + lua_replace(L, lua_upvalueindex(3)); + return push_captures(&ms, src, e); + } + } + return 0; /* not found */ +} + + +static int gmatch (lua_State *L) { + luaL_checkstring(L, 1); + luaL_checkstring(L, 2); + lua_settop(L, 2); + lua_pushinteger(L, 0); + lua_pushcclosure(L, gmatch_aux, 3); + return 1; +} + + +static int gfind_nodef (lua_State *L) { + return luaL_error(L, LUA_QL("string.gfind") " was renamed to " + LUA_QL("string.gmatch")); +} + + +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + size_t l, i; + const char *news = lua_tolstring(ms->L, 3, &l); + for (i = 0; i < l; i++) { + if (news[i] != L_ESC) + luaL_addchar(b, news[i]); + else { + i++; /* skip ESC */ + if (!isdigit(uchar(news[i]))) + luaL_addchar(b, news[i]); + else if (news[i] == '0') + luaL_addlstring(b, s, e - s); + else { + push_onecapture(ms, news[i] - '1', s, e); + luaL_addvalue(b); /* add capture to accumulated result */ + } + } + } +} + + +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, + const char *e) { + lua_State *L = ms->L; + switch (lua_type(L, 3)) { + case LUA_TNUMBER: + case LUA_TSTRING: { + add_s(ms, b, s, e); + return; + } + case LUA_TFUNCTION: { + int n; + lua_pushvalue(L, 3); + n = push_captures(ms, s, e); + lua_call(L, n, 1); + break; + } + case LUA_TTABLE: { + push_onecapture(ms, 0, s, e); + lua_gettable(L, 3); + break; + } + } + if (!lua_toboolean(L, -1)) { /* nil or false? */ + lua_pop(L, 1); + lua_pushlstring(L, s, e - s); /* keep original text */ + } + else if (!lua_isstring(L, -1)) + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_addvalue(b); /* add result to accumulator */ +} + + +static int str_gsub (lua_State *L) { + size_t srcl; + const char *src = luaL_checklstring(L, 1, &srcl); + const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); + int max_s = luaL_optint(L, 4, srcl+1); + int anchor = (*p == '^') ? (p++, 1) : 0; + int n = 0; + MatchState ms; + luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); + luaL_buffinit(L, &b); + ms.L = L; + ms.src_init = src; + ms.src_end = src+srcl; + while (n < max_s) { + const char *e; + ms.level = 0; + e = match(&ms, src, p); + if (e) { + n++; + add_value(&ms, &b, src, e); + } + if (e && e>src) /* non empty match? */ + src = e; /* skip it */ + else if (src < ms.src_end) + luaL_addchar(&b, *src++); + else break; + if (anchor) break; + } + luaL_addlstring(&b, src, ms.src_end-src); + luaL_pushresult(&b); + lua_pushinteger(L, n); /* number of substitutions */ + return 2; +} + +/* }====================================================== */ + + +/* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */ +#define MAX_ITEM 512 +/* valid flags in a format specification */ +#define FLAGS "-+ #0" +/* +** maximum size of each format specification (such as '%-099.99d') +** (+10 accounts for %99.99x plus margin of error) +*/ +#define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) + + +static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + luaL_addchar(b, '"'); + while (l--) { + switch (*s) { + case '"': case '\\': case '\n': { + luaL_addchar(b, '\\'); + luaL_addchar(b, *s); + break; + } + case '\r': { + luaL_addlstring(b, "\\r", 2); + break; + } + case '\0': { + luaL_addlstring(b, "\\000", 4); + break; + } + default: { + luaL_addchar(b, *s); + break; + } + } + s++; + } + luaL_addchar(b, '"'); +} + +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { + const char *p = strfrmt; + while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ + if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) + luaL_error(L, "invalid format (repeated flags)"); + if (isdigit(uchar(*p))) p++; /* skip width */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + if (*p == '.') { + p++; + if (isdigit(uchar(*p))) p++; /* skip precision */ + if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ + } + if (isdigit(uchar(*p))) + luaL_error(L, "invalid format (width or precision too long)"); + *(form++) = '%'; + strncpy(form, strfrmt, p - strfrmt + 1); + form += p - strfrmt + 1; + *form = '\0'; + return p; +} + + +static void addintlen (char *form) { + size_t l = strlen(form); + char spec = form[l - 1]; + strcpy(form + l - 1, LUA_INTFRMLEN); + form[l + sizeof(LUA_INTFRMLEN) - 2] = spec; + form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0'; +} + + +static int str_format (lua_State *L) { + int arg = 1; + size_t sfl; + const char *strfrmt = luaL_checklstring(L, arg, &sfl); + const char *strfrmt_end = strfrmt+sfl; + luaL_Buffer b; + luaL_buffinit(L, &b); + while (strfrmt < strfrmt_end) { + if (*strfrmt != L_ESC) + luaL_addchar(&b, *strfrmt++); + else if (*++strfrmt == L_ESC) + luaL_addchar(&b, *strfrmt++); /* %% */ + else { /* format item */ + char form[MAX_FORMAT]; /* to store the format (`%...') */ + char buff[MAX_ITEM]; /* to store the formatted item */ + arg++; + strfrmt = scanformat(L, strfrmt, form); + switch (*strfrmt++) { + case 'c': { + sprintf(buff, form, (int)luaL_checknumber(L, arg)); + break; + } + case 'd': case 'i': { + addintlen(form); + sprintf(buff, form, (LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'o': case 'u': case 'x': case 'X': { + addintlen(form); + sprintf(buff, form, (unsigned LUA_INTFRM_T)luaL_checknumber(L, arg)); + break; + } + case 'e': case 'E': case 'f': + case 'g': case 'G': { + sprintf(buff, form, (double)luaL_checknumber(L, arg)); + break; + } + case 'q': { + addquoted(L, &b, arg); + continue; /* skip the 'addsize' at the end */ + } + case 's': { + size_t l; + const char *s = luaL_checklstring(L, arg, &l); + if (!strchr(form, '.') && l >= 100) { + /* no precision and string is too long to be formatted; + keep original string */ + lua_pushvalue(L, arg); + luaL_addvalue(&b); + continue; /* skip the `addsize' at the end */ + } + else { + sprintf(buff, form, s); + break; + } + } + default: { /* also treat cases `pnLlh' */ + return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " + LUA_QL("format"), *(strfrmt - 1)); + } + } + luaL_addlstring(&b, buff, strlen(buff)); + } + } + luaL_pushresult(&b); + return 1; +} + + +static const luaL_Reg strlib[] = { + {"byte", str_byte}, + {"char", str_char}, + {"dump", str_dump}, + {"find", str_find}, + {"format", str_format}, + {"gfind", gfind_nodef}, + {"gmatch", gmatch}, + {"gsub", str_gsub}, + {"len", str_len}, + {"lower", str_lower}, + {"match", str_match}, + {"rep", str_rep}, + {"reverse", str_reverse}, + {"sub", str_sub}, + {"upper", str_upper}, + {NULL, NULL} +}; + + +static void createmetatable (lua_State *L) { + lua_createtable(L, 0, 1); /* create metatable for strings */ + lua_pushliteral(L, ""); /* dummy string */ + lua_pushvalue(L, -2); + lua_setmetatable(L, -2); /* set string metatable */ + lua_pop(L, 1); /* pop dummy string */ + lua_pushvalue(L, -2); /* string library... */ + lua_setfield(L, -2, "__index"); /* ...is the __index metamethod */ + lua_pop(L, 1); /* pop metatable */ +} + + +/* +** Open string library +*/ +LUALIB_API int luaopen_string (lua_State *L) { + luaL_register(L, LUA_STRLIBNAME, strlib); +#if defined(LUA_COMPAT_GFIND) + lua_getfield(L, -1, "gmatch"); + lua_setfield(L, -2, "gfind"); +#endif + createmetatable(L); + return 1; +} + diff --git a/ThirdLib/thirdparty/LuaLib/ltable.c b/ThirdLib/thirdparty/LuaLib/ltable.c new file mode 100644 index 000000000..ec84f4fab --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/ltable.c @@ -0,0 +1,588 @@ +/* +** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $ +** Lua tables (hash) +** See Copyright Notice in lua.h +*/ + + +/* +** Implementation of tables (aka arrays, objects, or hash tables). +** Tables keep its elements in two parts: an array part and a hash part. +** Non-negative integer keys are all candidates to be kept in the array +** part. The actual size of the array is the largest `n' such that at +** least half the slots between 0 and n are in use. +** Hash uses a mix of chained scatter table with Brent's variation. +** A main invariant of these tables is that, if an element is not +** in its main position (i.e. the `original' position that its hash gives +** to it), then the colliding element is in its own main position. +** Hence even when the load factor reaches 100%, performance remains good. +*/ + +#include +#include + +#define ltable_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lgc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstate.h" +#include "ltable.h" + + +/* +** max size of array part is 2^MAXBITS +*/ +#if LUAI_BITSINT > 26 +#define MAXBITS 26 +#else +#define MAXBITS (LUAI_BITSINT-2) +#endif + +#define MAXASIZE (1 << MAXBITS) + + +#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) + +#define hashstr(t,str) hashpow2(t, (str)->tsv.hash) +#define hashboolean(t,p) hashpow2(t, p) + + +/* +** for some types, it is better to avoid modulus by power of 2, as +** they tend to have many 2 factors. +*/ +#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) + + +#define hashpointer(t,p) hashmod(t, IntPoint(p)) + + +/* +** number of ints inside a lua_Number +*/ +#define numints cast_int(sizeof(lua_Number)/sizeof(int)) + + + +#define dummynode (&dummynode_) + +static const Node dummynode_ = { + {{NULL}, LUA_TNIL}, /* value */ + {{{NULL}, LUA_TNIL, NULL}} /* key */ +}; + + +/* +** hash for lua_Numbers +*/ +static Node *hashnum (const Table *t, lua_Number n) { + unsigned int a[numints]; + int i; + if (luai_numeq(n, 0)) /* avoid problems with -0 */ + return gnode(t, 0); + memcpy(a, &n, sizeof(a)); + for (i = 1; i < numints; i++) a[0] += a[i]; + return hashmod(t, a[0]); +} + + + +/* +** returns the `main' position of an element in a table (that is, the index +** of its hash value) +*/ +static Node *mainposition (const Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNUMBER: + return hashnum(t, nvalue(key)); + case LUA_TSTRING: + return hashstr(t, rawtsvalue(key)); + case LUA_TBOOLEAN: + return hashboolean(t, bvalue(key)); + case LUA_TLIGHTUSERDATA: + return hashpointer(t, pvalue(key)); + default: + return hashpointer(t, gcvalue(key)); + } +} + + +/* +** returns the index for `key' if `key' is an appropriate key to live in +** the array part of the table, -1 otherwise. +*/ +static int arrayindex (const TValue *key) { + if (ttisnumber(key)) { + lua_Number n = nvalue(key); + int k; + lua_number2int(k, n); + if (luai_numeq(cast_num(k), n)) + return k; + } + return -1; /* `key' did not match some condition */ +} + + +/* +** returns the index of a `key' for table traversals. First goes all +** elements in the array part, then elements in the hash part. The +** beginning of a traversal is signalled by -1. +*/ +static int findindex (lua_State *L, Table *t, StkId key) { + int i; + if (ttisnil(key)) return -1; /* first iteration */ + i = arrayindex(key); + if (0 < i && i <= t->sizearray) /* is `key' inside array part? */ + return i-1; /* yes; that's the index (corrected to C) */ + else { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + /* key may be dead already, but it is ok to use it in `next' */ + if (luaO_rawequalObj(key2tval(n), key) || + (ttype(gkey(n)) == LUA_TDEADKEY && iscollectable(key) && + gcvalue(gkey(n)) == gcvalue(key))) { + i = cast_int(n - gnode(t, 0)); /* key index in hash table */ + /* hash elements are numbered after array ones */ + return i + t->sizearray; + } + else n = gnext(n); + } while (n); + luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ + return 0; /* to avoid warnings */ + } +} + + +int luaH_next (lua_State *L, Table *t, StkId key) { + int i = findindex(L, t, key); /* find original element */ + for (i++; i < t->sizearray; i++) { /* try first array part */ + if (!ttisnil(&t->array[i])) { /* a non-nil value? */ + setnvalue(key, cast_num(i+1)); + setobj2s(L, key+1, &t->array[i]); + return 1; + } + } + for (i -= t->sizearray; i < sizenode(t); i++) { /* then hash part */ + if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ + setobj2s(L, key, key2tval(gnode(t, i))); + setobj2s(L, key+1, gval(gnode(t, i))); + return 1; + } + } + return 0; /* no more elements */ +} + + +/* +** {============================================================= +** Rehash +** ============================================================== +*/ + + +static int computesizes (int nums[], int *narray) { + int i; + int twotoi; /* 2^i */ + int a = 0; /* number of elements smaller than 2^i */ + int na = 0; /* number of elements to go to array part */ + int n = 0; /* optimal size for array part */ + for (i = 0, twotoi = 1; twotoi/2 < *narray; i++, twotoi *= 2) { + if (nums[i] > 0) { + a += nums[i]; + if (a > twotoi/2) { /* more than half elements present? */ + n = twotoi; /* optimal size (till now) */ + na = a; /* all elements smaller than n will go to array part */ + } + } + if (a == *narray) break; /* all elements already counted */ + } + *narray = n; + lua_assert(*narray/2 <= na && na <= *narray); + return na; +} + + +static int countint (const TValue *key, int *nums) { + int k = arrayindex(key); + if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ + nums[ceillog2(k)]++; /* count as such */ + return 1; + } + else + return 0; +} + + +static int numusearray (const Table *t, int *nums) { + int lg; + int ttlg; /* 2^lg */ + int ause = 0; /* summation of `nums' */ + int i = 1; /* count to traverse all array keys */ + for (lg=0, ttlg=1; lg<=MAXBITS; lg++, ttlg*=2) { /* for each slice */ + int lc = 0; /* counter */ + int lim = ttlg; + if (lim > t->sizearray) { + lim = t->sizearray; /* adjust upper limit */ + if (i > lim) + break; /* no more elements to count */ + } + /* count elements in range (2^(lg-1), 2^lg] */ + for (; i <= lim; i++) { + if (!ttisnil(&t->array[i-1])) + lc++; + } + nums[lg] += lc; + ause += lc; + } + return ause; +} + + +static int numusehash (const Table *t, int *nums, int *pnasize) { + int totaluse = 0; /* total number of elements */ + int ause = 0; /* summation of `nums' */ + int i = sizenode(t); + while (i--) { + Node *n = &t->node[i]; + if (!ttisnil(gval(n))) { + ause += countint(key2tval(n), nums); + totaluse++; + } + } + *pnasize += ause; + return totaluse; +} + + +static void setarrayvector (lua_State *L, Table *t, int size) { + int i; + luaM_reallocvector(L, t->array, t->sizearray, size, TValue); + for (i=t->sizearray; iarray[i]); + t->sizearray = size; +} + + +static void setnodevector (lua_State *L, Table *t, int size) { + int lsize; + if (size == 0) { /* no elements to hash part? */ + t->node = cast(Node *, dummynode); /* use common `dummynode' */ + lsize = 0; + } + else { + int i; + lsize = ceillog2(size); + if (lsize > MAXBITS) + luaG_runerror(L, "table overflow"); + size = twoto(lsize); + t->node = luaM_newvector(L, size, Node); + for (i=0; ilsizenode = cast_byte(lsize); + t->lastfree = gnode(t, size); /* all positions are free */ +} + + +static void resize (lua_State *L, Table *t, int nasize, int nhsize) { + int i; + int oldasize = t->sizearray; + int oldhsize = t->lsizenode; + Node *nold = t->node; /* save old hash ... */ + if (nasize > oldasize) /* array part must grow? */ + setarrayvector(L, t, nasize); + /* create new hash part with appropriate size */ + setnodevector(L, t, nhsize); + if (nasize < oldasize) { /* array part must shrink? */ + t->sizearray = nasize; + /* re-insert elements from vanishing slice */ + for (i=nasize; iarray[i])) + setobjt2t(L, luaH_setnum(L, t, i+1), &t->array[i]); + } + /* shrink array */ + luaM_reallocvector(L, t->array, oldasize, nasize, TValue); + } + /* re-insert elements from hash part */ + for (i = twoto(oldhsize) - 1; i >= 0; i--) { + Node *old = nold+i; + if (!ttisnil(gval(old))) + setobjt2t(L, luaH_set(L, t, key2tval(old)), gval(old)); + } + if (nold != dummynode) + luaM_freearray(L, nold, twoto(oldhsize), Node); /* free old array */ +} + + +void luaH_resizearray (lua_State *L, Table *t, int nasize) { + int nsize = (t->node == dummynode) ? 0 : sizenode(t); + resize(L, t, nasize, nsize); +} + + +static void rehash (lua_State *L, Table *t, const TValue *ek) { + int nasize, na; + int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */ + int i; + int totaluse; + for (i=0; i<=MAXBITS; i++) nums[i] = 0; /* reset counts */ + nasize = numusearray(t, nums); /* count keys in array part */ + totaluse = nasize; /* all those keys are integer keys */ + totaluse += numusehash(t, nums, &nasize); /* count keys in hash part */ + /* count extra key */ + nasize += countint(ek, nums); + totaluse++; + /* compute new size for array part */ + na = computesizes(nums, &nasize); + /* resize the table to new computed sizes */ + resize(L, t, nasize, totaluse - na); +} + + + +/* +** }============================================================= +*/ + + +Table *luaH_new (lua_State *L, int narray, int nhash) { + Table *t = luaM_new(L, Table); + luaC_link(L, obj2gco(t), LUA_TTABLE); + t->metatable = NULL; + t->flags = cast_byte(~0); + /* temporary values (kept only if some malloc fails) */ + t->array = NULL; + t->sizearray = 0; + t->lsizenode = 0; + t->node = cast(Node *, dummynode); + setarrayvector(L, t, narray); + setnodevector(L, t, nhash); + return t; +} + + +void luaH_free (lua_State *L, Table *t) { + if (t->node != dummynode) + luaM_freearray(L, t->node, sizenode(t), Node); + luaM_freearray(L, t->array, t->sizearray, TValue); + luaM_free(L, t); +} + + +static Node *getfreepos (Table *t) { + while (t->lastfree-- > t->node) { + if (ttisnil(gkey(t->lastfree))) + return t->lastfree; + } + return NULL; /* could not find a free place */ +} + + + +/* +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. +*/ +static TValue *newkey (lua_State *L, Table *t, const TValue *key) { + Node *mp = mainposition(t, key); + if (!ttisnil(gval(mp)) || mp == dummynode) { + Node *othern; + Node *n = getfreepos(t); /* get a free place */ + if (n == NULL) { /* cannot find a free place? */ + rehash(L, t, key); /* grow table */ + return luaH_set(L, t, key); /* re-insert key into grown table */ + } + lua_assert(n != dummynode); + othern = mainposition(t, key2tval(mp)); + if (othern != mp) { /* is colliding node out of its main position? */ + /* yes; move colliding node into free position */ + while (gnext(othern) != mp) othern = gnext(othern); /* find previous */ + gnext(othern) = n; /* redo the chain with `n' in place of `mp' */ + *n = *mp; /* copy colliding node into free pos. (mp->next also goes) */ + gnext(mp) = NULL; /* now `mp' is free */ + setnilvalue(gval(mp)); + } + else { /* colliding node is in its own main position */ + /* new node will go into free position */ + gnext(n) = gnext(mp); /* chain new position */ + gnext(mp) = n; + mp = n; + } + } + gkey(mp)->value = key->value; gkey(mp)->tt = key->tt; + luaC_barriert(L, t, key); + lua_assert(ttisnil(gval(mp))); + return gval(mp); +} + + +/* +** search function for integers +*/ +const TValue *luaH_getnum (Table *t, int key) { + /* (1 <= key && key <= t->sizearray) */ + if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) + return &t->array[key-1]; + else { + lua_Number nk = cast_num(key); + Node *n = hashnum(t, nk); + do { /* check whether `key' is somewhere in the chain */ + if (ttisnumber(gkey(n)) && luai_numeq(nvalue(gkey(n)), nk)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } +} + + +/* +** search function for strings +*/ +const TValue *luaH_getstr (Table *t, TString *key) { + Node *n = hashstr(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; +} + + +/* +** main search function +*/ +const TValue *luaH_get (Table *t, const TValue *key) { + switch (ttype(key)) { + case LUA_TNIL: return luaO_nilobject; + case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); + case LUA_TNUMBER: { + int k; + lua_Number n = nvalue(key); + lua_number2int(k, n); + if (luai_numeq(cast_num(k), nvalue(key))) /* index is int? */ + return luaH_getnum(t, k); /* use specialized version */ + /* else go through */ + } + default: { + Node *n = mainposition(t, key); + do { /* check whether `key' is somewhere in the chain */ + if (luaO_rawequalObj(key2tval(n), key)) + return gval(n); /* that's it */ + else n = gnext(n); + } while (n); + return luaO_nilobject; + } + } +} + + +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { + const TValue *p = luaH_get(t, key); + t->flags = 0; + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + if (ttisnil(key)) luaG_runerror(L, "table index is nil"); + else if (ttisnumber(key) && luai_numisnan(nvalue(key))) + luaG_runerror(L, "table index is NaN"); + return newkey(L, t, key); + } +} + + +TValue *luaH_setnum (lua_State *L, Table *t, int key) { + const TValue *p = luaH_getnum(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setnvalue(&k, cast_num(key)); + return newkey(L, t, &k); + } +} + + +TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { + const TValue *p = luaH_getstr(t, key); + if (p != luaO_nilobject) + return cast(TValue *, p); + else { + TValue k; + setsvalue(L, &k, key); + return newkey(L, t, &k); + } +} + + +static int unbound_search (Table *t, unsigned int j) { + unsigned int i = j; /* i is zero or a present index */ + j++; + /* find `i' and `j' such that i is present and j is not */ + while (!ttisnil(luaH_getnum(t, j))) { + i = j; + j *= 2; + if (j > cast(unsigned int, MAX_INT)) { /* overflow? */ + /* table was built with bad purposes: resort to linear search */ + i = 1; + while (!ttisnil(luaH_getnum(t, i))) i++; + return i - 1; + } + } + /* now do a binary search between them */ + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(luaH_getnum(t, m))) j = m; + else i = m; + } + return i; +} + + +/* +** Try to find a boundary in table `t'. A `boundary' is an integer index +** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). +*/ +int luaH_getn (Table *t) { + unsigned int j = t->sizearray; + if (j > 0 && ttisnil(&t->array[j - 1])) { + /* there is a boundary in the array part: (binary) search for it */ + unsigned int i = 0; + while (j - i > 1) { + unsigned int m = (i+j)/2; + if (ttisnil(&t->array[m - 1])) j = m; + else i = m; + } + return i; + } + /* else must find a boundary in hash part */ + else if (t->node == dummynode) /* hash part is empty? */ + return j; /* that is easy... */ + else return unbound_search(t, j); +} + + + +#if defined(LUA_DEBUG) + +Node *luaH_mainposition (const Table *t, const TValue *key) { + return mainposition(t, key); +} + +int luaH_isdummy (Node *n) { return n == dummynode; } + +#endif diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/ltable.h b/ThirdLib/thirdparty/LuaLib/ltable.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/ltable.h rename to ThirdLib/thirdparty/LuaLib/ltable.h diff --git a/ThirdLib/thirdparty/LuaLib/ltablib.c b/ThirdLib/thirdparty/LuaLib/ltablib.c new file mode 100644 index 000000000..b6d9cb4ac --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/ltablib.c @@ -0,0 +1,287 @@ +/* +** $Id: ltablib.c,v 1.38.1.3 2008/02/14 16:46:58 roberto Exp $ +** Library for Table Manipulation +** See Copyright Notice in lua.h +*/ + + +#include + +#define ltablib_c +#define LUA_LIB + +#include "lua.h" + +#include "lauxlib.h" +#include "lualib.h" + + +#define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) + + +static int foreachi (lua_State *L) { + int i; + int n = aux_getn(L, 1); + luaL_checktype(L, 2, LUA_TFUNCTION); + for (i=1; i <= n; i++) { + lua_pushvalue(L, 2); /* function */ + lua_pushinteger(L, i); /* 1st argument */ + lua_rawgeti(L, 1, i); /* 2nd argument */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 1); /* remove nil result */ + } + return 0; +} + + +static int foreach (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); + luaL_checktype(L, 2, LUA_TFUNCTION); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pushvalue(L, 2); /* function */ + lua_pushvalue(L, -3); /* key */ + lua_pushvalue(L, -3); /* value */ + lua_call(L, 2, 1); + if (!lua_isnil(L, -1)) + return 1; + lua_pop(L, 2); /* remove value and result */ + } + return 0; +} + + +static int maxn (lua_State *L) { + lua_Number max = 0; + luaL_checktype(L, 1, LUA_TTABLE); + lua_pushnil(L); /* first key */ + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ + if (lua_type(L, -1) == LUA_TNUMBER) { + lua_Number v = lua_tonumber(L, -1); + if (v > max) max = v; + } + } + lua_pushnumber(L, max); + return 1; +} + + +static int getn (lua_State *L) { + lua_pushinteger(L, aux_getn(L, 1)); + return 1; +} + + +static int setn (lua_State *L) { + luaL_checktype(L, 1, LUA_TTABLE); +#ifndef luaL_setn + luaL_setn(L, 1, luaL_checkint(L, 2)); +#else + luaL_error(L, LUA_QL("setn") " is obsolete"); +#endif + lua_pushvalue(L, 1); + return 1; +} + + +static int tinsert (lua_State *L) { + int e = aux_getn(L, 1) + 1; /* first empty element */ + int pos; /* where to insert new element */ + switch (lua_gettop(L)) { + case 2: { /* called with only 2 arguments */ + pos = e; /* insert new element at the end */ + break; + } + case 3: { + int i; + pos = luaL_checkint(L, 2); /* 2nd argument is the position */ + if (pos > e) e = pos; /* `grow' array if necessary */ + for (i = e; i > pos; i--) { /* move up elements */ + lua_rawgeti(L, 1, i-1); + lua_rawseti(L, 1, i); /* t[i] = t[i-1] */ + } + break; + } + default: { + return luaL_error(L, "wrong number of arguments to " LUA_QL("insert")); + } + } + luaL_setn(L, 1, e); /* new size */ + lua_rawseti(L, 1, pos); /* t[pos] = v */ + return 0; +} + + +static int tremove (lua_State *L) { + int e = aux_getn(L, 1); + int pos = luaL_optint(L, 2, e); + if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ + return 0; /* nothing to remove */ + luaL_setn(L, 1, e - 1); /* t.n = n-1 */ + lua_rawgeti(L, 1, pos); /* result = t[pos] */ + for ( ;pos= P */ + while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) { + if (i>u) luaL_error(L, "invalid order function for sorting"); + lua_pop(L, 1); /* remove a[i] */ + } + /* repeat --j until a[j] <= P */ + while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) { + if (j + +#define ltm_c +#define LUA_CORE + +#include "lua.h" + +#include "lobject.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" + + + +const char *const luaT_typenames[] = { + "nil", "boolean", "userdata", "number", + "string", "table", "function", "userdata", "thread", + "proto", "upval" +}; + + +void luaT_init (lua_State *L) { + static const char *const luaT_eventname[] = { /* ORDER TM */ + "__index", "__newindex", + "__gc", "__mode", "__eq", + "__add", "__sub", "__mul", "__div", "__mod", + "__pow", "__unm", "__len", "__lt", "__le", + "__concat", "__call" + }; + int i; + for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); + luaS_fix(G(L)->tmname[i]); /* never collect these names */ + } +} + + +/* +** function to be used with macro "fasttm": optimized for absence of +** tag methods +*/ +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { + const TValue *tm = luaH_getstr(events, ename); + lua_assert(event <= TM_EQ); + if (ttisnil(tm)) { /* no tag method? */ + events->flags |= cast_byte(1u<metatable; + break; + case LUA_TUSERDATA: + mt = uvalue(o)->metatable; + break; + default: + mt = G(L)->mt[ttype(o)]; + } + return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/ltm.h b/ThirdLib/thirdparty/LuaLib/ltm.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/ltm.h rename to ThirdLib/thirdparty/LuaLib/ltm.h diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lua.h b/ThirdLib/thirdparty/LuaLib/lua.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lua.h rename to ThirdLib/thirdparty/LuaLib/lua.h diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/luaconf.h b/ThirdLib/thirdparty/LuaLib/luaconf.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/luaconf.h rename to ThirdLib/thirdparty/LuaLib/luaconf.h diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lualib.h b/ThirdLib/thirdparty/LuaLib/lualib.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lualib.h rename to ThirdLib/thirdparty/LuaLib/lualib.h diff --git a/ThirdLib/thirdparty/LuaLib/lundump.c b/ThirdLib/thirdparty/LuaLib/lundump.c new file mode 100644 index 000000000..8010a4579 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lundump.c @@ -0,0 +1,227 @@ +/* +** $Id: lundump.c,v 2.7.1.4 2008/04/04 19:51:41 roberto Exp $ +** load precompiled Lua chunks +** See Copyright Notice in lua.h +*/ + +#include + +#define lundump_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lmem.h" +#include "lobject.h" +#include "lstring.h" +#include "lundump.h" +#include "lzio.h" + +typedef struct { + lua_State* L; + ZIO* Z; + Mbuffer* b; + const char* name; +} LoadState; + +#ifdef LUAC_TRUST_BINARIES +#define IF(c,s) +#define error(S,s) +#else +#define IF(c,s) if (c) error(S,s) + +static void error(LoadState* S, const char* why) +{ + luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why); + luaD_throw(S->L,LUA_ERRSYNTAX); +} +#endif + +#define LoadMem(S,b,n,size) LoadBlock(S,b,(n)*(size)) +#define LoadByte(S) (lu_byte)LoadChar(S) +#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) +#define LoadVector(S,b,n,size) LoadMem(S,b,n,size) + +static void LoadBlock(LoadState* S, void* b, size_t size) +{ + size_t r=luaZ_read(S->Z,b,size); + IF (r!=0, "unexpected end"); +} + +static int LoadChar(LoadState* S) +{ + char x; + LoadVar(S,x); + return x; +} + +static int LoadInt(LoadState* S) +{ + int x; + LoadVar(S,x); + IF (x<0, "bad integer"); + return x; +} + +static lua_Number LoadNumber(LoadState* S) +{ + lua_Number x; + LoadVar(S,x); + return x; +} + +static TString* LoadString(LoadState* S) +{ + size_t size; + LoadVar(S,size); + if (size==0) + return NULL; + else + { + char* s=luaZ_openspace(S->L,S->b,size); + LoadBlock(S,s,size); + return luaS_newlstr(S->L,s,size-1); /* remove trailing '\0' */ + } +} + +static void LoadCode(LoadState* S, Proto* f) +{ + int n=LoadInt(S); + f->code=luaM_newvector(S->L,n,Instruction); + f->sizecode=n; + LoadVector(S,f->code,n,sizeof(Instruction)); +} + +static Proto* LoadFunction(LoadState* S, TString* p); + +static void LoadConstants(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->k=luaM_newvector(S->L,n,TValue); + f->sizek=n; + for (i=0; ik[i]); + for (i=0; ik[i]; + int t=LoadChar(S); + switch (t) + { + case LUA_TNIL: + setnilvalue(o); + break; + case LUA_TBOOLEAN: + setbvalue(o,LoadChar(S)!=0); + break; + case LUA_TNUMBER: + setnvalue(o,LoadNumber(S)); + break; + case LUA_TSTRING: + setsvalue2n(S->L,o,LoadString(S)); + break; + default: + error(S,"bad constant"); + break; + } + } + n=LoadInt(S); + f->p=luaM_newvector(S->L,n,Proto*); + f->sizep=n; + for (i=0; ip[i]=NULL; + for (i=0; ip[i]=LoadFunction(S,f->source); +} + +static void LoadDebug(LoadState* S, Proto* f) +{ + int i,n; + n=LoadInt(S); + f->lineinfo=luaM_newvector(S->L,n,int); + f->sizelineinfo=n; + LoadVector(S,f->lineinfo,n,sizeof(int)); + n=LoadInt(S); + f->locvars=luaM_newvector(S->L,n,LocVar); + f->sizelocvars=n; + for (i=0; ilocvars[i].varname=NULL; + for (i=0; ilocvars[i].varname=LoadString(S); + f->locvars[i].startpc=LoadInt(S); + f->locvars[i].endpc=LoadInt(S); + } + n=LoadInt(S); + f->upvalues=luaM_newvector(S->L,n,TString*); + f->sizeupvalues=n; + for (i=0; iupvalues[i]=NULL; + for (i=0; iupvalues[i]=LoadString(S); +} + +static Proto* LoadFunction(LoadState* S, TString* p) +{ + Proto* f; + if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep"); + f=luaF_newproto(S->L); + setptvalue2s(S->L,S->L->top,f); incr_top(S->L); + f->source=LoadString(S); if (f->source==NULL) f->source=p; + f->linedefined=LoadInt(S); + f->lastlinedefined=LoadInt(S); + f->nups=LoadByte(S); + f->numparams=LoadByte(S); + f->is_vararg=LoadByte(S); + f->maxstacksize=LoadByte(S); + LoadCode(S,f); + LoadConstants(S,f); + LoadDebug(S,f); + IF (!luaG_checkcode(f), "bad code"); + S->L->top--; + S->L->nCcalls--; + return f; +} + +static void LoadHeader(LoadState* S) +{ + char h[LUAC_HEADERSIZE]; + char s[LUAC_HEADERSIZE]; + luaU_header(h); + LoadBlock(S,s,LUAC_HEADERSIZE); + IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header"); +} + +/* +** load precompiled chunk +*/ +Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) +{ + LoadState S; + if (*name=='@' || *name=='=') + S.name=name+1; + else if (*name==LUA_SIGNATURE[0]) + S.name="binary string"; + else + S.name=name; + S.L=L; + S.Z=Z; + S.b=buff; + LoadHeader(&S); + return LoadFunction(&S,luaS_newliteral(L,"=?")); +} + +/* +* make header +*/ +void luaU_header (char* h) +{ + int x=1; + memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); + h+=sizeof(LUA_SIGNATURE)-1; + *h++=(char)LUAC_VERSION; + *h++=(char)LUAC_FORMAT; + *h++=(char)*(char*)&x; /* endianness */ + *h++=(char)sizeof(int); + *h++=(char)sizeof(size_t); + *h++=(char)sizeof(Instruction); + *h++=(char)sizeof(lua_Number); + *h++=(char)(((lua_Number)0.5)==0); /* is lua_Number integral? */ +} diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lundump.h b/ThirdLib/thirdparty/LuaLib/lundump.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lundump.h rename to ThirdLib/thirdparty/LuaLib/lundump.h diff --git a/ThirdLib/thirdparty/LuaLib/lvm.c b/ThirdLib/thirdparty/LuaLib/lvm.c new file mode 100644 index 000000000..ee3256ab9 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lvm.c @@ -0,0 +1,763 @@ +/* +** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $ +** Lua virtual machine +** See Copyright Notice in lua.h +*/ + + +#include +#include +#include + +#define lvm_c +#define LUA_CORE + +#include "lua.h" + +#include "ldebug.h" +#include "ldo.h" +#include "lfunc.h" +#include "lgc.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lstate.h" +#include "lstring.h" +#include "ltable.h" +#include "ltm.h" +#include "lvm.h" + + + +/* limit for table tag-method chains (to avoid loops) */ +#define MAXTAGLOOP 100 + + +const TValue *luaV_tonumber (const TValue *obj, TValue *n) { + lua_Number num; + if (ttisnumber(obj)) return obj; + if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) { + setnvalue(n, num); + return n; + } + else + return NULL; +} + + +int luaV_tostring (lua_State *L, StkId obj) { + if (!ttisnumber(obj)) + return 0; + else { + char s[LUAI_MAXNUMBER2STR]; + lua_Number n = nvalue(obj); + lua_number2str(s, n); + setsvalue2s(L, obj, luaS_new(L, s)); + return 1; + } +} + + +static void traceexec (lua_State *L, const Instruction *pc) { + lu_byte mask = L->hookmask; + const Instruction *oldpc = L->savedpc; + L->savedpc = pc; + if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { + resethookcount(L); + luaD_callhook(L, LUA_HOOKCOUNT, -1); + } + if (mask & LUA_MASKLINE) { + Proto *p = ci_func(L->ci)->l.p; + int npc = pcRel(pc, p); + int newline = getline(p, npc); + /* call linehook when enter a new function, when jump back (loop), + or when enter a new line */ + if (npc == 0 || pc <= oldpc || newline != getline(p, pcRel(oldpc, p))) + luaD_callhook(L, LUA_HOOKLINE, newline); + } +} + + +static void callTMres (lua_State *L, StkId res, const TValue *f, + const TValue *p1, const TValue *p2) { + ptrdiff_t result = savestack(L, res); + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + luaD_checkstack(L, 3); + L->top += 3; + luaD_call(L, L->top - 3, 1); + res = restorestack(L, result); + L->top--; + setobjs2s(L, res, L->top); +} + + + +static void callTM (lua_State *L, const TValue *f, const TValue *p1, + const TValue *p2, const TValue *p3) { + setobj2s(L, L->top, f); /* push function */ + setobj2s(L, L->top+1, p1); /* 1st argument */ + setobj2s(L, L->top+2, p2); /* 2nd argument */ + setobj2s(L, L->top+3, p3); /* 3th argument */ + luaD_checkstack(L, 4); + L->top += 4; + luaD_call(L, L->top - 4, 0); +} + + +void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + const TValue *res = luaH_get(h, key); /* do a primitive get */ + if (!ttisnil(res) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ + setobj2s(L, val, res); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTMres(L, val, tm, t, key); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in gettable"); +} + + +void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { + int loop; + for (loop = 0; loop < MAXTAGLOOP; loop++) { + const TValue *tm; + if (ttistable(t)) { /* `t' is a table? */ + Table *h = hvalue(t); + TValue *oldval = luaH_set(L, h, key); /* do a primitive set */ + if (!ttisnil(oldval) || /* result is no nil? */ + (tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL) { /* or no TM? */ + setobj2t(L, oldval, val); + luaC_barriert(L, h, val); + return; + } + /* else will try the tag method */ + } + else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) + luaG_typeerror(L, t, "index"); + if (ttisfunction(tm)) { + callTM(L, tm, t, key, val); + return; + } + t = tm; /* else repeat with `tm' */ + } + luaG_runerror(L, "loop in settable"); +} + + +static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, + StkId res, TMS event) { + const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ + if (ttisnil(tm)) + tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ + if (ttisnil(tm)) return 0; + callTMres(L, res, tm, p1, p2); + return 1; +} + + +static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2, + TMS event) { + const TValue *tm1 = fasttm(L, mt1, event); + const TValue *tm2; + if (tm1 == NULL) return NULL; /* no metamethod */ + if (mt1 == mt2) return tm1; /* same metatables => same metamethods */ + tm2 = fasttm(L, mt2, event); + if (tm2 == NULL) return NULL; /* no metamethod */ + if (luaO_rawequalObj(tm1, tm2)) /* same metamethods? */ + return tm1; + return NULL; +} + + +static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, + TMS event) { + const TValue *tm1 = luaT_gettmbyobj(L, p1, event); + const TValue *tm2; + if (ttisnil(tm1)) return -1; /* no metamethod? */ + tm2 = luaT_gettmbyobj(L, p2, event); + if (!luaO_rawequalObj(tm1, tm2)) /* different metamethods? */ + return -1; + callTMres(L, L->top, tm1, p1, p2); + return !l_isfalse(L->top); +} + + +static int l_strcmp (const TString *ls, const TString *rs) { + const char *l = getstr(ls); + size_t ll = ls->tsv.len; + const char *r = getstr(rs); + size_t lr = rs->tsv.len; + for (;;) { + int temp = strcoll(l, r); + if (temp != 0) return temp; + else { /* strings are equal up to a `\0' */ + size_t len = strlen(l); /* index of first `\0' in both strings */ + if (len == lr) /* r is finished? */ + return (len == ll) ? 0 : 1; + else if (len == ll) /* l is finished? */ + return -1; /* l is smaller than r (because r is not finished) */ + /* both strings longer than `len'; go on comparing (after the `\0') */ + len++; + l += len; ll -= len; r += len; lr -= len; + } + } +} + + +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numlt(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; + else if ((res = call_orderTM(L, l, r, TM_LT)) != -1) + return res; + return luaG_ordererror(L, l, r); +} + + +static int lessequal (lua_State *L, const TValue *l, const TValue *r) { + int res; + if (ttype(l) != ttype(r)) + return luaG_ordererror(L, l, r); + else if (ttisnumber(l)) + return luai_numle(nvalue(l), nvalue(r)); + else if (ttisstring(l)) + return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; + else if ((res = call_orderTM(L, l, r, TM_LE)) != -1) /* first try `le' */ + return res; + else if ((res = call_orderTM(L, r, l, TM_LT)) != -1) /* else try `lt' */ + return !res; + return luaG_ordererror(L, l, r); +} + + +int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { + const TValue *tm; + lua_assert(ttype(t1) == ttype(t2)); + switch (ttype(t1)) { + case LUA_TNIL: return 1; + case LUA_TNUMBER: return luai_numeq(nvalue(t1), nvalue(t2)); + case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ + case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); + case LUA_TUSERDATA: { + if (uvalue(t1) == uvalue(t2)) return 1; + tm = get_compTM(L, uvalue(t1)->metatable, uvalue(t2)->metatable, + TM_EQ); + break; /* will try TM */ + } + case LUA_TTABLE: { + if (hvalue(t1) == hvalue(t2)) return 1; + tm = get_compTM(L, hvalue(t1)->metatable, hvalue(t2)->metatable, TM_EQ); + break; /* will try TM */ + } + default: return gcvalue(t1) == gcvalue(t2); + } + if (tm == NULL) return 0; /* no TM? */ + callTMres(L, L->top, tm, t1, t2); /* call TM */ + return !l_isfalse(L->top); +} + + +void luaV_concat (lua_State *L, int total, int last) { + do { + StkId top = L->base + last + 1; + int n = 2; /* number of elements handled in this pass (at least 2) */ + if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) { + if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT)) + luaG_concaterror(L, top-2, top-1); + } else if (tsvalue(top-1)->len == 0) /* second op is empty? */ + (void)tostring(L, top - 2); /* result is first op (as string) */ + else { + /* at least two string values; get as many as possible */ + size_t tl = tsvalue(top-1)->len; + char *buffer; + int i; + /* collect total length */ + for (n = 1; n < total && tostring(L, top-n-1); n++) { + size_t l = tsvalue(top-n-1)->len; + if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow"); + tl += l; + } + buffer = luaZ_openspace(L, &G(L)->buff, tl); + tl = 0; + for (i=n; i>0; i--) { /* concat all strings */ + size_t l = tsvalue(top-i)->len; + memcpy(buffer+tl, svalue(top-i), l); + tl += l; + } + setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); + } + total -= n-1; /* got `n' strings to create 1 new */ + last -= n-1; + } while (total > 1); /* repeat until only 1 result left */ +} + + +static void Arith (lua_State *L, StkId ra, const TValue *rb, + const TValue *rc, TMS op) { + TValue tempb, tempc; + const TValue *b, *c; + if ((b = luaV_tonumber(rb, &tempb)) != NULL && + (c = luaV_tonumber(rc, &tempc)) != NULL) { + lua_Number nb = nvalue(b), nc = nvalue(c); + switch (op) { + case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break; + case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break; + case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break; + case TM_DIV: setnvalue(ra, luai_numdiv(nb, nc)); break; + case TM_MOD: setnvalue(ra, luai_nummod(nb, nc)); break; + case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break; + case TM_UNM: setnvalue(ra, luai_numunm(nb)); break; + default: lua_assert(0); break; + } + } + else if (!call_binTM(L, rb, rc, ra, op)) + luaG_aritherror(L, rb, rc); +} + + + +/* +** some macros for common tasks in `luaV_execute' +*/ + +#define runtime_check(L, c) { if (!(c)) break; } + +#define RA(i) (base+GETARG_A(i)) +/* to be used after possible stack reallocation */ +#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) +#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) +#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) +#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ + ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) +#define KBx(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i)) + + +#define dojump(L,pc,i) {(pc) += (i); luai_threadyield(L);} + + +#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; } + + +#define arith_op(op,tm) { \ + TValue *rb = RKB(i); \ + TValue *rc = RKC(i); \ + if (ttisnumber(rb) && ttisnumber(rc)) { \ + lua_Number nb = nvalue(rb), nc = nvalue(rc); \ + setnvalue(ra, op(nb, nc)); \ + } \ + else \ + Protect(Arith(L, ra, rb, rc, tm)); \ + } + + + +void luaV_execute (lua_State *L, int nexeccalls) { + LClosure *cl; + StkId base; + TValue *k; + const Instruction *pc; + reentry: /* entry point */ + lua_assert(isLua(L->ci)); + pc = L->savedpc; + cl = &clvalue(L->ci->func)->l; + base = L->base; + k = cl->p->k; + /* main loop of interpreter */ + for (;;) { + const Instruction i = *pc++; + StkId ra; + if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && + (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { + traceexec(L, pc); + if (L->status == LUA_YIELD) { /* did hook yield? */ + L->savedpc = pc - 1; + return; + } + base = L->base; + } + /* warning!! several calls may realloc the stack and invalidate `ra' */ + ra = RA(i); + lua_assert(base == L->base && L->base == L->ci->base); + lua_assert(base <= L->top && L->top <= L->stack + L->stacksize); + lua_assert(L->top == L->ci->top || luaG_checkopenop(i)); + switch (GET_OPCODE(i)) { + case OP_MOVE: { + setobjs2s(L, ra, RB(i)); + continue; + } + case OP_LOADK: { + setobj2s(L, ra, KBx(i)); + continue; + } + case OP_LOADBOOL: { + setbvalue(ra, GETARG_B(i)); + if (GETARG_C(i)) pc++; /* skip next instruction (if C) */ + continue; + } + case OP_LOADNIL: { + TValue *rb = RB(i); + do { + setnilvalue(rb--); + } while (rb >= ra); + continue; + } + case OP_GETUPVAL: { + int b = GETARG_B(i); + setobj2s(L, ra, cl->upvals[b]->v); + continue; + } + case OP_GETGLOBAL: { + TValue g; + TValue *rb = KBx(i); + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(rb)); + Protect(luaV_gettable(L, &g, rb, ra)); + continue; + } + case OP_GETTABLE: { + Protect(luaV_gettable(L, RB(i), RKC(i), ra)); + continue; + } + case OP_SETGLOBAL: { + TValue g; + sethvalue(L, &g, cl->env); + lua_assert(ttisstring(KBx(i))); + Protect(luaV_settable(L, &g, KBx(i), ra)); + continue; + } + case OP_SETUPVAL: { + UpVal *uv = cl->upvals[GETARG_B(i)]; + setobj(L, uv->v, ra); + luaC_barrier(L, uv, ra); + continue; + } + case OP_SETTABLE: { + Protect(luaV_settable(L, ra, RKB(i), RKC(i))); + continue; + } + case OP_NEWTABLE: { + int b = GETARG_B(i); + int c = GETARG_C(i); + sethvalue(L, ra, luaH_new(L, luaO_fb2int(b), luaO_fb2int(c))); + Protect(luaC_checkGC(L)); + continue; + } + case OP_SELF: { + StkId rb = RB(i); + setobjs2s(L, ra+1, rb); + Protect(luaV_gettable(L, rb, RKC(i), ra)); + continue; + } + case OP_ADD: { + arith_op(luai_numadd, TM_ADD); + continue; + } + case OP_SUB: { + arith_op(luai_numsub, TM_SUB); + continue; + } + case OP_MUL: { + arith_op(luai_nummul, TM_MUL); + continue; + } + case OP_DIV: { + arith_op(luai_numdiv, TM_DIV); + continue; + } + case OP_MOD: { + arith_op(luai_nummod, TM_MOD); + continue; + } + case OP_POW: { + arith_op(luai_numpow, TM_POW); + continue; + } + case OP_UNM: { + TValue *rb = RB(i); + if (ttisnumber(rb)) { + lua_Number nb = nvalue(rb); + setnvalue(ra, luai_numunm(nb)); + } + else { + Protect(Arith(L, ra, rb, rb, TM_UNM)); + } + continue; + } + case OP_NOT: { + int res = l_isfalse(RB(i)); /* next assignment may change this value */ + setbvalue(ra, res); + continue; + } + case OP_LEN: { + const TValue *rb = RB(i); + switch (ttype(rb)) { + case LUA_TTABLE: { + setnvalue(ra, cast_num(luaH_getn(hvalue(rb)))); + break; + } + case LUA_TSTRING: { + setnvalue(ra, cast_num(tsvalue(rb)->len)); + break; + } + default: { /* try metamethod */ + Protect( + if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)) + luaG_typeerror(L, rb, "get length of"); + ) + } + } + continue; + } + case OP_CONCAT: { + int b = GETARG_B(i); + int c = GETARG_C(i); + Protect(luaV_concat(L, c-b+1, c); luaC_checkGC(L)); + setobjs2s(L, RA(i), base+b); + continue; + } + case OP_JMP: { + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_EQ: { + TValue *rb = RKB(i); + TValue *rc = RKC(i); + Protect( + if (equalobj(L, rb, rc) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LT: { + Protect( + if (luaV_lessthan(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_LE: { + Protect( + if (lessequal(L, RKB(i), RKC(i)) == GETARG_A(i)) + dojump(L, pc, GETARG_sBx(*pc)); + ) + pc++; + continue; + } + case OP_TEST: { + if (l_isfalse(ra) != GETARG_C(i)) + dojump(L, pc, GETARG_sBx(*pc)); + pc++; + continue; + } + case OP_TESTSET: { + TValue *rb = RB(i); + if (l_isfalse(rb) != GETARG_C(i)) { + setobjs2s(L, ra, rb); + dojump(L, pc, GETARG_sBx(*pc)); + } + pc++; + continue; + } + case OP_CALL: { + int b = GETARG_B(i); + int nresults = GETARG_C(i) - 1; + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + switch (luaD_precall(L, ra, nresults)) { + case PCRLUA: { + nexeccalls++; + goto reentry; /* restart luaV_execute over new Lua function */ + } + case PCRC: { + /* it was a C function (`precall' called it); adjust results */ + if (nresults >= 0) L->top = L->ci->top; + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_TAILCALL: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b; /* else previous instruction set top */ + L->savedpc = pc; + lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); + switch (luaD_precall(L, ra, LUA_MULTRET)) { + case PCRLUA: { + /* tail call: put new frame in place of previous one */ + CallInfo *ci = L->ci - 1; /* previous frame */ + int aux; + StkId func = ci->func; + StkId pfunc = (ci+1)->func; /* previous function index */ + if (L->openupval) luaF_close(L, ci->base); + L->base = ci->base = ci->func + ((ci+1)->base - pfunc); + for (aux = 0; pfunc+aux < L->top; aux++) /* move frame down */ + setobjs2s(L, func+aux, pfunc+aux); + ci->top = L->top = func+aux; /* correct top */ + lua_assert(L->top == L->base + clvalue(func)->l.p->maxstacksize); + ci->savedpc = L->savedpc; + ci->tailcalls++; /* one more call lost */ + L->ci--; /* remove new frame */ + goto reentry; + } + case PCRC: { /* it was a C function (`precall' called it) */ + base = L->base; + continue; + } + default: { + return; /* yield */ + } + } + } + case OP_RETURN: { + int b = GETARG_B(i); + if (b != 0) L->top = ra+b-1; + if (L->openupval) luaF_close(L, base); + L->savedpc = pc; + b = luaD_poscall(L, ra); + if (--nexeccalls == 0) /* was previous function running `here'? */ + return; /* no: return */ + else { /* yes: continue its execution */ + if (b) L->top = L->ci->top; + lua_assert(isLua(L->ci)); + lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL); + goto reentry; + } + } + case OP_FORLOOP: { + lua_Number step = nvalue(ra+2); + lua_Number idx = luai_numadd(nvalue(ra), step); /* increment index */ + lua_Number limit = nvalue(ra+1); + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { + dojump(L, pc, GETARG_sBx(i)); /* jump back */ + setnvalue(ra, idx); /* update internal index... */ + setnvalue(ra+3, idx); /* ...and external index */ + } + continue; + } + case OP_FORPREP: { + const TValue *init = ra; + const TValue *plimit = ra+1; + const TValue *pstep = ra+2; + L->savedpc = pc; /* next steps may throw errors */ + if (!tonumber(init, ra)) + luaG_runerror(L, LUA_QL("for") " initial value must be a number"); + else if (!tonumber(plimit, ra+1)) + luaG_runerror(L, LUA_QL("for") " limit must be a number"); + else if (!tonumber(pstep, ra+2)) + luaG_runerror(L, LUA_QL("for") " step must be a number"); + setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep))); + dojump(L, pc, GETARG_sBx(i)); + continue; + } + case OP_TFORLOOP: { + StkId cb = ra + 3; /* call base */ + setobjs2s(L, cb+2, ra+2); + setobjs2s(L, cb+1, ra+1); + setobjs2s(L, cb, ra); + L->top = cb+3; /* func. + 2 args (state and index) */ + Protect(luaD_call(L, cb, GETARG_C(i))); + L->top = L->ci->top; + cb = RA(i) + 3; /* previous call may change the stack */ + if (!ttisnil(cb)) { /* continue loop? */ + setobjs2s(L, cb-1, cb); /* save control variable */ + dojump(L, pc, GETARG_sBx(*pc)); /* jump back */ + } + pc++; + continue; + } + case OP_SETLIST: { + int n = GETARG_B(i); + int c = GETARG_C(i); + int last; + Table *h; + if (n == 0) { + n = cast_int(L->top - ra) - 1; + L->top = L->ci->top; + } + if (c == 0) c = cast_int(*pc++); + runtime_check(L, ttistable(ra)); + h = hvalue(ra); + last = ((c-1)*LFIELDS_PER_FLUSH) + n; + if (last > h->sizearray) /* needs more space? */ + luaH_resizearray(L, h, last); /* pre-alloc it at once */ + for (; n > 0; n--) { + TValue *val = ra+n; + setobj2t(L, luaH_setnum(L, h, last--), val); + luaC_barriert(L, h, val); + } + continue; + } + case OP_CLOSE: { + luaF_close(L, ra); + continue; + } + case OP_CLOSURE: { + Proto *p; + Closure *ncl; + int nup, j; + p = cl->p->p[GETARG_Bx(i)]; + nup = p->nups; + ncl = luaF_newLclosure(L, nup, cl->env); + ncl->l.p = p; + for (j=0; jl.upvals[j] = cl->upvals[GETARG_B(*pc)]; + else { + lua_assert(GET_OPCODE(*pc) == OP_MOVE); + ncl->l.upvals[j] = luaF_findupval(L, base + GETARG_B(*pc)); + } + } + setclvalue(L, ra, ncl); + Protect(luaC_checkGC(L)); + continue; + } + case OP_VARARG: { + int b = GETARG_B(i) - 1; + int j; + CallInfo *ci = L->ci; + int n = cast_int(ci->base - ci->func) - cl->p->numparams - 1; + if (b == LUA_MULTRET) { + Protect(luaD_checkstack(L, n)); + ra = RA(i); /* previous call may change the stack */ + b = n; + L->top = ra + n; + } + for (j = 0; j < b; j++) { + if (j < n) { + setobjs2s(L, ra + j, ci->base - n + j); + } + else { + setnilvalue(ra + j); + } + } + continue; + } + } + } +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lvm.h b/ThirdLib/thirdparty/LuaLib/lvm.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lvm.h rename to ThirdLib/thirdparty/LuaLib/lvm.h diff --git a/ThirdLib/thirdparty/LuaLib/lzio.c b/ThirdLib/thirdparty/LuaLib/lzio.c new file mode 100644 index 000000000..293edd59b --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/lzio.c @@ -0,0 +1,82 @@ +/* +** $Id: lzio.c,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $ +** a generic input stream interface +** See Copyright Notice in lua.h +*/ + + +#include + +#define lzio_c +#define LUA_CORE + +#include "lua.h" + +#include "llimits.h" +#include "lmem.h" +#include "lstate.h" +#include "lzio.h" + + +int luaZ_fill (ZIO *z) { + size_t size; + lua_State *L = z->L; + const char *buff; + lua_unlock(L); + buff = z->reader(L, z->data, &size); + lua_lock(L); + if (buff == NULL || size == 0) return EOZ; + z->n = size - 1; + z->p = buff; + return char2int(*(z->p++)); +} + + +int luaZ_lookahead (ZIO *z) { + if (z->n == 0) { + if (luaZ_fill(z) == EOZ) + return EOZ; + else { + z->n++; /* luaZ_fill removed first byte; put back it */ + z->p--; + } + } + return char2int(*z->p); +} + + +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { + z->L = L; + z->reader = reader; + z->data = data; + z->n = 0; + z->p = NULL; +} + + +/* --------------------------------------------------------------- read --- */ +size_t luaZ_read (ZIO *z, void *b, size_t n) { + while (n) { + size_t m; + if (luaZ_lookahead(z) == EOZ) + return n; /* return number of missing bytes */ + m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ + memcpy(b, z->p, m); + z->n -= m; + z->p += m; + b = (char *)b + m; + n -= m; + } + return 0; +} + +/* ------------------------------------------------------------------------ */ +char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { + if (n > buff->buffsize) { + if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; + luaZ_resizebuffer(L, buff, n); + } + return buff->buffer; +} + + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lzio.h b/ThirdLib/thirdparty/LuaLib/lzio.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/lzio.h rename to ThirdLib/thirdparty/LuaLib/lzio.h diff --git a/ThirdLib/thirdparty/LuaLib/print.c b/ThirdLib/thirdparty/LuaLib/print.c new file mode 100644 index 000000000..e240cfc3c --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/print.c @@ -0,0 +1,227 @@ +/* +** $Id: print.c,v 1.55a 2006/05/31 13:30:05 lhf Exp $ +** print bytecodes +** See Copyright Notice in lua.h +*/ + +#include +#include + +#define luac_c +#define LUA_CORE + +#include "ldebug.h" +#include "lobject.h" +#include "lopcodes.h" +#include "lundump.h" + +#define PrintFunction luaU_print + +#define Sizeof(x) ((int)sizeof(x)) +#define VOID(p) ((const void*)(p)) + +static void PrintString(const TString* ts) +{ + const char* s=getstr(ts); + size_t i,n=ts->tsv.len; + putchar('"'); + for (i=0; ik[i]; + switch (ttype(o)) + { + case LUA_TNIL: + printf("nil"); + break; + case LUA_TBOOLEAN: + printf(bvalue(o) ? "true" : "false"); + break; + case LUA_TNUMBER: + printf(LUA_NUMBER_FMT,nvalue(o)); + break; + case LUA_TSTRING: + PrintString(rawtsvalue(o)); + break; + default: /* cannot happen */ + printf("? type=%d",ttype(o)); + break; + } +} + +static void PrintCode(const Proto* f) +{ + const Instruction* code=f->code; + int pc,n=f->sizecode; + for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); + printf("%-9s\t",luaP_opnames[o]); + switch (getOpMode(o)) + { + case iABC: + printf("%d",a); + if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (-1-INDEXK(b)) : b); + if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (-1-INDEXK(c)) : c); + break; + case iABx: + if (getBMode(o)==OpArgK) printf("%d %d",a,-1-bx); else printf("%d %d",a,bx); + break; + case iAsBx: + if (o==OP_JMP) printf("%d",sbx); else printf("%d %d",a,sbx); + break; + } + switch (o) + { + case OP_LOADK: + printf("\t; "); PrintConstant(f,bx); + break; + case OP_GETUPVAL: + case OP_SETUPVAL: + printf("\t; %s", (f->sizeupvalues>0) ? getstr(f->upvalues[b]) : "-"); + break; + case OP_GETGLOBAL: + case OP_SETGLOBAL: + printf("\t; %s",svalue(&f->k[bx])); + break; + case OP_GETTABLE: + case OP_SELF: + if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } + break; + case OP_SETTABLE: + case OP_ADD: + case OP_SUB: + case OP_MUL: + case OP_DIV: + case OP_POW: + case OP_EQ: + case OP_LT: + case OP_LE: + if (ISK(b) || ISK(c)) + { + printf("\t; "); + if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); + printf(" "); + if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); + } + break; + case OP_JMP: + case OP_FORLOOP: + case OP_FORPREP: + printf("\t; to %d",sbx+pc+2); + break; + case OP_CLOSURE: + printf("\t; %p",VOID(f->p[bx])); + break; + case OP_SETLIST: + if (c==0) printf("\t; %d",(int)code[++pc]); + else printf("\t; %d",c); + break; + default: + break; + } + printf("\n"); + } +} + +#define SS(x) (x==1)?"":"s" +#define S(x) x,SS(x) + +static void PrintHeader(const Proto* f) +{ + const char* s=getstr(f->source); + if (*s=='@' || *s=='=') + s++; + else if (*s==LUA_SIGNATURE[0]) + s="(bstring)"; + else + s="(string)"; + printf("\n%s <%s:%d,%d> (%d instruction%s, %d bytes at %p)\n", + (f->linedefined==0)?"main":"function",s, + f->linedefined,f->lastlinedefined, + S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f)); + printf("%d%s param%s, %d slot%s, %d upvalue%s, ", + f->numparams,f->is_vararg?"+":"",SS(f->numparams), + S(f->maxstacksize),S(f->nups)); + printf("%d local%s, %d constant%s, %d function%s\n", + S(f->sizelocvars),S(f->sizek),S(f->sizep)); +} + +static void PrintConstants(const Proto* f) +{ + int i,n=f->sizek; + printf("constants (%d) for %p:\n",n,VOID(f)); + for (i=0; isizelocvars; + printf("locals (%d) for %p:\n",n,VOID(f)); + for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); + } +} + +static void PrintUpvalues(const Proto* f) +{ + int i,n=f->sizeupvalues; + printf("upvalues (%d) for %p:\n",n,VOID(f)); + if (f->upvalues==NULL) return; + for (i=0; iupvalues[i])); + } +} + +void PrintFunction(const Proto* f, int full) +{ + int i,n=f->sizep; + PrintHeader(f); + PrintCode(f); + if (full) + { + PrintConstants(f); + PrintLocals(f); + PrintUpvalues(f); + } + for (i=0; ip[i],full); +} diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/tolua++.h b/ThirdLib/thirdparty/LuaLib/tolua++.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/tolua++.h rename to ThirdLib/thirdparty/LuaLib/tolua++.h diff --git a/ThirdLib/thirdparty/LuaLib/tolua_event.c b/ThirdLib/thirdparty/LuaLib/tolua_event.c new file mode 100644 index 000000000..8258867b4 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/tolua_event.c @@ -0,0 +1,536 @@ +/* tolua: event functions +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include + +#include "tolua++.h" + +/* Store at ubox + * It stores, creating the corresponding table if needed, + * the pair key/value in the corresponding ubox table +*/ +static void storeatubox (lua_State* L, int lo) +{ + #ifdef LUA_VERSION_NUM + lua_getfenv(L, lo); + if (lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pop(L, 1); + lua_newtable(L); + lua_pushvalue(L, -1); + lua_setfenv(L, lo); /* stack: k,v,table */ + }; + lua_insert(L, -3); + lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */ + lua_pop(L, 1); + #else + /* stack: key value (to be stored) */ + lua_pushstring(L,"tolua_peers"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: k v ubox */ + lua_pushvalue(L,lo); + lua_rawget(L,-2); /* stack: k v ubox ubox[u] */ + if (!lua_istable(L,-1)) + { + lua_pop(L,1); /* stack: k v ubox */ + lua_newtable(L); /* stack: k v ubox table */ + lua_pushvalue(L,1); + lua_pushvalue(L,-2); /* stack: k v ubox table u table */ + lua_rawset(L,-4); /* stack: k v ubox ubox[u]=table */ + } + lua_insert(L,-4); /* put table before k */ + lua_pop(L,1); /* pop ubox */ + lua_rawset(L,-3); /* store at table */ + lua_pop(L,1); /* pop ubox[u] */ + #endif +} + +/* Module index function +*/ +static int module_index_event (lua_State* L) +{ + lua_pushstring(L,".get"); + lua_rawget(L,-3); + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { + lua_call(L,0,1); + return 1; + } + else if (lua_istable(L,-1)) + return 1; + } + /* call old index meta event */ + if (lua_getmetatable(L,1)) + { + lua_pushstring(L,"__index"); + lua_rawget(L,-2); + lua_pushvalue(L,1); + lua_pushvalue(L,2); + if (lua_isfunction(L,-1)) + { + lua_call(L,2,1); + return 1; + } + else if (lua_istable(L,-1)) + { + lua_gettable(L,-3); + return 1; + } + } + lua_pushnil(L); + return 1; +} + +/* Module newindex function +*/ +static int module_newindex_event (lua_State* L) +{ + lua_pushstring(L,".set"); + lua_rawget(L,-4); + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); /* only to be compatible with non-static vars */ + lua_pushvalue(L,3); /* value */ + lua_call(L,2,0); + return 0; + } + } + /* call old newindex meta event */ + if (lua_getmetatable(L,1) && lua_getmetatable(L,-1)) + { + lua_pushstring(L,"__newindex"); + lua_rawget(L,-2); + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_pushvalue(L,3); + lua_call(L,3,0); + } + } + lua_settop(L,3); + lua_rawset(L,-3); + return 0; +} + +/* Class index function + * If the object is a userdata (ie, an object), it searches the field in + * the alternative table stored in the corresponding "ubox" table. +*/ +static int class_index_event (lua_State* L) +{ + int t = lua_type(L,1); + if (t == LUA_TUSERDATA) + { + /* Access alternative table */ + #ifdef LUA_VERSION_NUM /* new macro on version 5.1 */ + lua_getfenv(L,1); + if (!lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pushvalue(L, 2); /* key */ + lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */ + if (!lua_isnil(L, -1)) + return 1; + }; + #else + lua_pushstring(L,"tolua_peers"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: obj key ubox */ + lua_pushvalue(L,1); + lua_rawget(L,-2); /* stack: obj key ubox ubox[u] */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* stack: obj key ubox ubox[u] value */ + if (!lua_isnil(L,-1)) + return 1; + } + #endif + lua_settop(L,2); /* stack: obj key */ + /* Try metatables */ + lua_pushvalue(L,1); /* stack: obj key obj */ + while (lua_getmetatable(L,-1)) + { /* stack: obj key obj mt */ + lua_remove(L,-2); /* stack: obj key mt */ + if (lua_isnumber(L,2)) /* check if key is a numeric value */ + { + /* try operator[] */ + lua_pushstring(L,".geti"); + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + } + else + { + lua_pushvalue(L,2); /* stack: obj key mt key */ + lua_rawget(L,-2); /* stack: obj key mt value */ + if (!lua_isnil(L,-1)) + return 1; + else + lua_pop(L,1); + /* try C/C++ variable */ + lua_pushstring(L,".get"); + lua_rawget(L,-2); /* stack: obj key mt tget */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); + lua_rawget(L,-2); /* stack: obj key mt value */ + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + else if (lua_istable(L,-1)) + { + /* deal with array: create table to be returned and cache it in ubox */ + void* u = *((void**)lua_touserdata(L,1)); + lua_newtable(L); /* stack: obj key mt value table */ + lua_pushstring(L,".self"); + lua_pushlightuserdata(L,u); + lua_rawset(L,-3); /* store usertype in ".self" */ + lua_insert(L,-2); /* stack: obj key mt table value */ + lua_setmetatable(L,-2); /* set stored value as metatable */ + lua_pushvalue(L,-1); /* stack: obj key met table table */ + lua_pushvalue(L,2); /* stack: obj key mt table table key */ + lua_insert(L,-2); /* stack: obj key mt table key table */ + storeatubox(L,1); /* stack: obj key mt table */ + return 1; + } + } + } + lua_settop(L,3); + } + lua_pushnil(L); + return 1; + } + else if (t== LUA_TTABLE) + { + module_index_event(L); + return 1; + } + lua_pushnil(L); + return 1; +} + +/* Newindex function + * It first searches for a C/C++ varaible to be set. + * Then, it either stores it in the alternative ubox table (in the case it is + * an object) or in the own table (that represents the class or module). +*/ +static int class_newindex_event (lua_State* L) +{ + int t = lua_type(L,1); + if (t == LUA_TUSERDATA) + { + /* Try accessing a C/C++ variable to be set */ + lua_getmetatable(L,1); + while (lua_istable(L,-1)) /* stack: t k v mt */ + { + if (lua_isnumber(L,2)) /* check if key is a numeric value */ + { + /* try operator[] */ + lua_pushstring(L,".seti"); + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_pushvalue(L,3); + lua_call(L,3,0); + return 0; + } + } + else + { + lua_pushstring(L,".set"); + lua_rawget(L,-2); /* stack: t k v mt tset */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); + lua_rawget(L,-2); /* stack: t k v mt tset func */ + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,3); + lua_call(L,2,0); + return 0; + } + lua_pop(L,1); /* stack: t k v mt tset */ + } + lua_pop(L,1); /* stack: t k v mt */ + if (!lua_getmetatable(L,-1)) /* stack: t k v mt mt */ + lua_pushnil(L); + lua_remove(L,-2); /* stack: t k v mt */ + } + } + lua_settop(L,3); /* stack: t k v */ + + /* then, store as a new field */ + storeatubox(L,1); + } + else if (t== LUA_TTABLE) + { + module_newindex_event(L); + } + return 0; +} + +static int class_call_event(lua_State* L) { + + if (lua_istable(L, 1)) { + lua_pushstring(L, ".call"); + lua_rawget(L, 1); + if (lua_isfunction(L, -1)) { + + lua_insert(L, 1); + lua_call(L, lua_gettop(L)-1, 1); + + return 1; + }; + }; + tolua_error(L,"Attempt to call a non-callable object.",NULL); + return 0; +}; + +static int do_operator (lua_State* L, const char* op) +{ + if (lua_isuserdata(L,1)) + { + /* Try metatables */ + lua_pushvalue(L,1); /* stack: op1 op2 */ + while (lua_getmetatable(L,-1)) + { /* stack: op1 op2 op1 mt */ + lua_remove(L,-2); /* stack: op1 op2 mt */ + lua_pushstring(L,op); /* stack: op1 op2 mt key */ + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + lua_settop(L,3); + } + } + tolua_error(L,"Attempt to perform operation on an invalid operand",NULL); + return 0; +} + +static int class_add_event (lua_State* L) +{ + return do_operator(L,".add"); +} + +static int class_sub_event (lua_State* L) +{ + return do_operator(L,".sub"); +} + +static int class_mul_event (lua_State* L) +{ + return do_operator(L,".mul"); +} + +static int class_div_event (lua_State* L) +{ + return do_operator(L,".div"); +} + +static int class_lt_event (lua_State* L) +{ + return do_operator(L,".lt"); +} + +static int class_le_event (lua_State* L) +{ + return do_operator(L,".le"); +} + +static int class_eq_event (lua_State* L) +{ + /* copying code from do_operator here to return false when no operator is found */ + if (lua_isuserdata(L,1)) + { + /* Try metatables */ + lua_pushvalue(L,1); /* stack: op1 op2 */ + while (lua_getmetatable(L,-1)) + { /* stack: op1 op2 op1 mt */ + lua_remove(L,-2); /* stack: op1 op2 mt */ + lua_pushstring(L,".eq"); /* stack: op1 op2 mt key */ + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + lua_settop(L,3); + } + } + + lua_settop(L, 3); + lua_pushboolean(L, 0); + return 1; +} + +/* +static int class_gc_event (lua_State* L) +{ + void* u = *((void**)lua_touserdata(L,1)); + fprintf(stderr, "collecting: looking at %p\n", u); + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_call(L,1,0); + lua_pushlightuserdata(L,u); + lua_pushnil(L); + lua_rawset(L,-3); + } + lua_pop(L,2); + return 0; +} +*/ +TOLUA_API int class_gc_event (lua_State* L) +{ + void* u = *((void**)lua_touserdata(L,1)); + int top; + /*fprintf(stderr, "collecting: looking at %p\n", u);*/ + /* + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + */ + lua_pushvalue(L, lua_upvalueindex(1)); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); /* stack: gc umt */ + lua_getmetatable(L,1); /* stack: gc umt mt */ + /*fprintf(stderr, "checking type\n");*/ + top = lua_gettop(L); + if (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */ + { + /*fprintf(stderr, "Found type!\n");*/ + /* get gc function */ + lua_pushliteral(L,".collector"); + lua_rawget(L,-2); /* stack: gc umt mt collector */ + if (lua_isfunction(L,-1)) { + /*fprintf(stderr, "Found .collector!\n");*/ + } + else { + lua_pop(L,1); + /*fprintf(stderr, "Using default cleanup\n");*/ + lua_pushcfunction(L,tolua_default_collect); + } + + lua_pushvalue(L,1); /* stack: gc umt mt collector u */ + lua_call(L,1,0); + + lua_pushlightuserdata(L,u); /* stack: gc umt mt u */ + lua_pushnil(L); /* stack: gc umt mt u nil */ + lua_rawset(L,-5); /* stack: gc umt mt */ + } + lua_pop(L,3); + return 0; +} + + +/* Register module events + * It expects the metatable on the top of the stack +*/ +TOLUA_API void tolua_moduleevents (lua_State* L) +{ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,module_index_event); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,module_newindex_event); + lua_rawset(L,-3); +} + +/* Check if the object on the top has a module metatable +*/ +TOLUA_API int tolua_ismodulemetatable (lua_State* L) +{ + int r = 0; + if (lua_getmetatable(L,-1)) + { + lua_pushstring(L,"__index"); + lua_rawget(L,-2); + r = (lua_tocfunction(L,-1) == module_index_event); + lua_pop(L,2); + } + return r; +} + +/* Register class events + * It expects the metatable on the top of the stack +*/ +TOLUA_API void tolua_classevents (lua_State* L) +{ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,class_index_event); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,class_newindex_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__add"); + lua_pushcfunction(L,class_add_event); + lua_rawset(L,-3); + lua_pushstring(L,"__sub"); + lua_pushcfunction(L,class_sub_event); + lua_rawset(L,-3); + lua_pushstring(L,"__mul"); + lua_pushcfunction(L,class_mul_event); + lua_rawset(L,-3); + lua_pushstring(L,"__div"); + lua_pushcfunction(L,class_div_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__lt"); + lua_pushcfunction(L,class_lt_event); + lua_rawset(L,-3); + lua_pushstring(L,"__le"); + lua_pushcfunction(L,class_le_event); + lua_rawset(L,-3); + lua_pushstring(L,"__eq"); + lua_pushcfunction(L,class_eq_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__call"); + lua_pushcfunction(L,class_call_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__gc"); + lua_pushstring(L, "tolua_gc_event"); + lua_rawget(L, LUA_REGISTRYINDEX); + /*lua_pushcfunction(L,class_gc_event);*/ + lua_rawset(L,-3); +} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/tolua_event.h b/ThirdLib/thirdparty/LuaLib/tolua_event.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/tolua_event.h rename to ThirdLib/thirdparty/LuaLib/tolua_event.h diff --git a/ThirdLib/thirdparty/LuaLib/tolua_is.c b/ThirdLib/thirdparty/LuaLib/tolua_is.c new file mode 100644 index 000000000..add337d19 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/tolua_is.c @@ -0,0 +1,621 @@ +/* tolua: functions to check types. +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "lauxlib.h" + +#include +#include + +/* a fast check if a is b, without parameter validation + i.e. if b is equal to a or a superclass of a. */ +TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index) +{ + int result; + if (lua_rawequal(L,mt_indexa,mt_indexb)) + result = 1; + else + { + if (super_index) { + lua_pushvalue(L, super_index); + } else { + lua_pushliteral(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ + }; + lua_pushvalue(L,mt_indexa); /* stack: super mta */ + lua_rawget(L,-2); /* stack: super super[mta] */ + lua_pushvalue(L,mt_indexb); /* stack: super super[mta] mtb */ + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super super[mta] typenameB */ + lua_rawget(L,-2); /* stack: super super[mta] bool */ + result = lua_toboolean(L,-1); + lua_pop(L,3); + } + return result; +} + +/* Push and returns the corresponding object typename */ +TOLUA_API const char* tolua_typename (lua_State* L, int lo) +{ + int tag = lua_type(L,lo); + if (tag == LUA_TNONE) + lua_pushstring(L,"[no object]"); + else if (tag != LUA_TUSERDATA && tag != LUA_TTABLE) + lua_pushstring(L,lua_typename(L,tag)); + else if (tag == LUA_TUSERDATA) + { + if (!lua_getmetatable(L,lo)) + lua_pushstring(L,lua_typename(L,tag)); + else + { + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isstring(L,-1)) + { + lua_pop(L,1); + lua_pushstring(L,"[undefined]"); + } + } + } + else /* is table */ + { + lua_pushvalue(L,lo); + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isstring(L,-1)) + { + lua_pop(L,1); + lua_pushstring(L,"table"); + } + else + { + lua_pushstring(L,"class "); + lua_insert(L,-2); + lua_concat(L,2); + } + } + return lua_tostring(L,-1); +} + +TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err) +{ + if (msg[0] == '#') + { + const char* expected = err->type; + const char* provided = tolua_typename(L,err->index); + if (msg[1]=='f') + { + int narg = err->index; + if (err->array) + luaL_error(L,"%s\n argument #%d is array of '%s'; array of '%s' expected.\n", + msg+2,narg,provided,expected); + else + luaL_error(L,"%s\n argument #%d is '%s'; '%s' expected.\n", + msg+2,narg,provided,expected); + } + else if (msg[1]=='v') + { + if (err->array) + luaL_error(L,"%s\n value is array of '%s'; array of '%s' expected.\n", + msg+2,provided,expected); + else + luaL_error(L,"%s\n value is '%s'; '%s' expected.\n", + msg+2,provided,expected); + } + } + else + luaL_error(L,msg); +} + +/* the equivalent of lua_is* for usertable */ +static int lua_isusertable (lua_State* L, int lo, const const char* type) +{ + int r = 0; + if (lo < 0) lo = lua_gettop(L)+lo+1; + lua_pushvalue(L,lo); + lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[t] */ + if (lua_isstring(L,-1)) + { + r = strcmp(lua_tostring(L,-1),type)==0; + if (!r) + { + /* try const */ + lua_pushstring(L,"const "); + lua_insert(L,-2); + lua_concat(L,2); + r = lua_isstring(L,-1) && strcmp(lua_tostring(L,-1),type)==0; + } + } + lua_pop(L, 1); + return r; +} + +int push_table_instance(lua_State* L, int lo) { + + if (lua_istable(L, lo)) { + + lua_pushstring(L, ".c_instance"); + lua_gettable(L, lo); + if (lua_isuserdata(L, -1)) { + + lua_replace(L, lo); + return 1; + } else { + + lua_pop(L, 1); + return 0; + }; + } else { + return 0; + }; + + return 0; +}; + +/* the equivalent of lua_is* for usertype */ +static int lua_isusertype (lua_State* L, int lo, const char* type) +{ + if (!lua_isuserdata(L,lo)) { + if (!push_table_instance(L, lo)) { + return 0; + }; + }; + { + /* check if it is of the same type */ + int r; + const char *tn; + if (lua_getmetatable(L,lo)) /* if metatable? */ + { + lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[mt] */ + tn = lua_tostring(L,-1); + r = tn && (strcmp(tn,type) == 0); + lua_pop(L, 1); + if (r) + return 1; + else + { + /* check if it is a specialized class */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* get super */ + lua_getmetatable(L,lo); + lua_rawget(L,-2); /* get super[mt] */ + if (lua_istable(L,-1)) + { + int b; + lua_pushstring(L,type); + lua_rawget(L,-2); /* get super[mt][type] */ + b = lua_toboolean(L,-1); + lua_pop(L,3); + if (b) + return 1; + } + } + } + } + return 0; +} + +TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err) +{ + if (lua_gettop(L)index = lo; + err->array = 0; + err->type = "[no object]"; + return 0; +} + +TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "boolean"; + return 0; +} + +TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "number"; + return 0; +} + +TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "string"; + return 0; +} + +TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "table"; + return 0; +} + +TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = type; + return 0; +} + + +TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = "userdata"; + return 0; +} + +TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err) { + + if (lua_gettop(L)index = lo; + err->array = 0; + err->type = "value"; + return 1; +}; + +TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def || abs(lo)<=lua_gettop(L)) /* any valid index */ + return 1; + err->index = lo; + err->array = 0; + err->type = "value"; + return 0; +} + +TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)index = lo; + err->array = 0; + err->type = type; + return 0; +} + +TOLUA_API int tolua_isvaluearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + return 1; +} + +TOLUA_API int tolua_isbooleanarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "boolean"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isnumberarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!lua_isnumber(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "number"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isstringarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "string"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_istablearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (! lua_istable(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "table"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isuserdataarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "userdata"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isusertypearray + (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->type = type; + err->array = 1; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +#if 0 +int tolua_isbooleanfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "boolean"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isnumberfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!lua_isnumber(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "number"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isstringfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "string"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_istablefield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i+1); + lua_gettable(L,lo); + if (! lua_istable(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "table"; + return 0; + } + lua_pop(L,1); +} + +int tolua_isusertablefield + (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (! lua_isusertable(L,-1,type) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = type; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isuserdatafield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "userdata"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isusertypefield + (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isusertype(L,-1,type)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->type = type; + err->array = 1; + return 0; + } + lua_pop(L,1); + return 1; +} + +#endif diff --git a/ThirdLib/thirdparty/LuaLib/tolua_map.c b/ThirdLib/thirdparty/LuaLib/tolua_map.c new file mode 100644 index 000000000..d00e7069b --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/tolua_map.c @@ -0,0 +1,704 @@ +/* tolua: functions to map features +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "tolua_event.h" +#include "lauxlib.h" + +#include +#include +#include +#include + + +/* Create metatable + * Create and register new metatable +*/ +static int tolua_newmetatable (lua_State* L, char* name) +{ + int r = luaL_newmetatable(L,name); + + #ifdef LUA_VERSION_NUM /* only lua 5.1 */ + if (r) { + lua_pushvalue(L, -1); + lua_pushstring(L, name); + lua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */ + }; + #endif + + if (r) + tolua_classevents(L); /* set meta events */ + lua_pop(L,1); + return r; +} + +/* Map super classes + * It sets 'name' as being also a 'base', mapping all super classes of 'base' in 'name' +*/ +static void mapsuper (lua_State* L, const char* name, const char* base) +{ + /* push registry.super */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ + luaL_getmetatable(L,name); /* stack: super mt */ + lua_rawget(L,-2); /* stack: super table */ + if (lua_isnil(L,-1)) + { + /* create table */ + lua_pop(L,1); + lua_newtable(L); /* stack: super table */ + luaL_getmetatable(L,name); /* stack: super table mt */ + lua_pushvalue(L,-2); /* stack: super table mt table */ + lua_rawset(L,-4); /* stack: super table */ + } + + /* set base as super class */ + lua_pushstring(L,base); + lua_pushboolean(L,1); + lua_rawset(L,-3); /* stack: super table */ + + /* set all super class of base as super class of name */ + luaL_getmetatable(L,base); /* stack: super table base_mt */ + lua_rawget(L,-3); /* stack: super table base_table */ + if (lua_istable(L,-1)) + { + /* traverse base table */ + lua_pushnil(L); /* first key */ + while (lua_next(L,-2) != 0) + { + /* stack: ... base_table key value */ + lua_pushvalue(L,-2); /* stack: ... base_table key value key */ + lua_insert(L,-2); /* stack: ... base_table key key value */ + lua_rawset(L,-5); /* stack: ... base_table key */ + } + } + lua_pop(L,3); /* stack: */ +} + +/* creates a 'tolua_ubox' table for base clases, and +// expects the metatable and base metatable on the stack */ +static void set_ubox(lua_State* L) { + + /* mt basemt */ + if (!lua_isnil(L, -1)) { + lua_pushstring(L, "tolua_ubox"); + lua_rawget(L,-2); + } else { + lua_pushnil(L); + }; + /* mt basemt base_ubox */ + if (!lua_isnil(L,-1)) { + lua_pushstring(L, "tolua_ubox"); + lua_insert(L, -2); + /* mt basemt key ubox */ + lua_rawset(L,-4); + /* (mt with ubox) basemt */ + } else { + /* mt basemt nil */ + lua_pop(L, 1); + lua_pushstring(L,"tolua_ubox"); lua_newtable(L); + /* make weak value metatable for ubox table to allow userdata to be + garbage-collected */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ + lua_setmetatable(L, -2); /* stack:mt basemt string ubox */ + lua_rawset(L,-4); + }; + +}; + +/* Map inheritance + * It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name' +*/ +static void mapinheritance (lua_State* L, const char* name, const char* base) +{ + /* set metatable inheritance */ + luaL_getmetatable(L,name); + + if (base && *base) + luaL_getmetatable(L,base); + else { + + if (lua_getmetatable(L, -1)) { /* already has a mt, we don't overwrite it */ + lua_pop(L, 2); + return; + }; + luaL_getmetatable(L,"tolua_commonclass"); + }; + + set_ubox(L); + + lua_setmetatable(L,-2); + lua_pop(L,1); +} + +/* Object type +*/ +static int tolua_bnd_type (lua_State* L) +{ + tolua_typename(L,lua_gettop(L)); + return 1; +} + +/* Take ownership +*/ +static int tolua_bnd_takeownership (lua_State* L) +{ + int success = 0; + if (lua_isuserdata(L,1)) + { + if (lua_getmetatable(L,1)) /* if metatable? */ + { + lua_pop(L,1); /* clear metatable off stack */ + /* force garbage collection to avoid C to reuse a to-be-collected address */ + #ifdef LUA_VERSION_NUM + lua_gc(L, LUA_GCCOLLECT, 0); + #else + lua_setgcthreshold(L,0); + #endif + + success = tolua_register_gc(L,1); + } + } + lua_pushboolean(L,success!=0); + return 1; +} + +/* Release ownership +*/ +static int tolua_bnd_releaseownership (lua_State* L) +{ + int done = 0; + if (lua_isuserdata(L,1)) + { + void* u = *((void**)lua_touserdata(L,1)); + /* force garbage collection to avoid releasing a to-be-collected address */ + #ifdef LUA_VERSION_NUM + lua_gc(L, LUA_GCCOLLECT, 0); + #else + lua_setgcthreshold(L,0); + #endif + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); + lua_getmetatable(L,1); + if (lua_rawequal(L,-1,-2)) /* check that we are releasing the correct type */ + { + lua_pushlightuserdata(L,u); + lua_pushnil(L); + lua_rawset(L,-5); + done = 1; + } + } + lua_pushboolean(L,done!=0); + return 1; +} + +/* Type casting +*/ +static int tolua_bnd_cast (lua_State* L) +{ + +/* // old code + void* v = tolua_tousertype(L,1,NULL); + const char* s = tolua_tostring(L,2,NULL); + if (v && s) + tolua_pushusertype(L,v,s); + else + lua_pushnil(L); + return 1; +*/ + + void* v; + const char* s; + if (lua_islightuserdata(L, 1)) { + v = tolua_touserdata(L, 1, NULL); + } else { + v = tolua_tousertype(L, 1, 0); + }; + + s = tolua_tostring(L,2,NULL); + if (v && s) + tolua_pushusertype(L,v,s); + else + lua_pushnil(L); + return 1; +} + +/* Inheritance +*/ +static int tolua_bnd_inherit (lua_State* L) { + + /* stack: lua object, c object */ + lua_pushstring(L, ".c_instance"); + lua_pushvalue(L, -2); + lua_rawset(L, -4); + /* l_obj[".c_instance"] = c_obj */ + + return 0; +}; + +#ifdef LUA_VERSION_NUM /* lua 5.1 */ +static int tolua_bnd_setpeer(lua_State* L) { + + /* stack: userdata, table */ + if (!lua_isuserdata(L, -2)) { + lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected."); + lua_error(L); + }; + + if (lua_isnil(L, -1)) { + + lua_pop(L, 1); + lua_pushvalue(L, TOLUA_NOPEER); + }; + lua_setfenv(L, -2); + + return 0; +}; + +static int tolua_bnd_getpeer(lua_State* L) { + + /* stack: userdata */ + lua_getfenv(L, -1); + if (lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pop(L, 1); + lua_pushnil(L); + }; + return 1; +}; +#endif + +/* static int class_gc_event (lua_State* L); */ + +TOLUA_API void tolua_open (lua_State* L) +{ + int top = lua_gettop(L); + lua_pushstring(L,"tolua_opened"); + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isboolean(L,-1)) + { + lua_pushstring(L,"tolua_opened"); lua_pushboolean(L,1); lua_rawset(L,LUA_REGISTRYINDEX); + + #ifndef LUA_VERSION_NUM /* only prior to lua 5.1 */ + /* create peer object table */ + lua_pushstring(L, "tolua_peers"); lua_newtable(L); + /* make weak key metatable for peers indexed by userdata object */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "k"); lua_rawset(L, -3); /* stack: string peers mt */ + lua_setmetatable(L, -2); /* stack: string peers */ + lua_rawset(L,LUA_REGISTRYINDEX); + #endif + + /* create object ptr -> udata mapping table */ + lua_pushstring(L,"tolua_ubox"); lua_newtable(L); + /* make weak value metatable for ubox table to allow userdata to be + garbage-collected */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ + lua_setmetatable(L, -2); /* stack: string ubox */ + lua_rawset(L,LUA_REGISTRYINDEX); + + lua_pushstring(L,"tolua_super"); lua_newtable(L); lua_rawset(L,LUA_REGISTRYINDEX); + lua_pushstring(L,"tolua_gc"); lua_newtable(L);lua_rawset(L,LUA_REGISTRYINDEX); + + /* create gc_event closure */ + lua_pushstring(L, "tolua_gc_event"); + lua_pushstring(L, "tolua_gc"); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushstring(L, "tolua_super"); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushcclosure(L, class_gc_event, 2); + lua_rawset(L, LUA_REGISTRYINDEX); + + tolua_newmetatable(L,"tolua_commonclass"); + + tolua_module(L,NULL,0); + tolua_beginmodule(L,NULL); + tolua_module(L,"tolua",0); + tolua_beginmodule(L,"tolua"); + tolua_function(L,"type",tolua_bnd_type); + tolua_function(L,"takeownership",tolua_bnd_takeownership); + tolua_function(L,"releaseownership",tolua_bnd_releaseownership); + tolua_function(L,"cast",tolua_bnd_cast); + tolua_function(L,"inherit", tolua_bnd_inherit); + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + tolua_function(L, "setpeer", tolua_bnd_setpeer); + tolua_function(L, "getpeer", tolua_bnd_getpeer); + #endif + + tolua_endmodule(L); + tolua_endmodule(L); + } + lua_settop(L,top); +} + +/* Copy a C object +*/ +TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size) +{ + void* clone = (void*)malloc(size); + if (clone) + memcpy(clone,value,size); + else + tolua_error(L,"insuficient memory",NULL); + return clone; +} + +/* Default collect function +*/ +TOLUA_API int tolua_default_collect (lua_State* tolua_S) +{ + void* self = tolua_tousertype(tolua_S,1,0); + free(self); + return 0; +} + +/* Do clone +*/ +TOLUA_API int tolua_register_gc (lua_State* L, int lo) +{ + int success = 1; + void *value = *(void **)lua_touserdata(L,lo); + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,value); + lua_rawget(L,-2); + if (!lua_isnil(L,-1)) /* make sure that object is not already owned */ + success = 0; + else + { + lua_pushlightuserdata(L,value); + lua_getmetatable(L,lo); + lua_rawset(L,-4); + } + lua_pop(L,2); + return success; +} + +/* Register a usertype + * It creates the correspoding metatable in the registry, for both 'type' and 'const type'. + * It maps 'const type' as being also a 'type' +*/ +TOLUA_API void tolua_usertype (lua_State* L, const char* type) +{ + char ctype[128] = "const "; + strncat(ctype,type,120); + + /* create both metatables */ + if (tolua_newmetatable(L,ctype) && tolua_newmetatable(L,type)) + mapsuper(L,type,ctype); /* 'type' is also a 'const type' */ +} + + +/* Begin module + * It pushes the module (or class) table on the stack +*/ +TOLUA_API void tolua_beginmodule (lua_State* L, const char* name) +{ + if (name) + { + lua_pushstring(L,name); + lua_rawget(L,-2); + } + else + lua_pushvalue(L,LUA_GLOBALSINDEX); +} + +/* End module + * It pops the module (or class) from the stack +*/ +TOLUA_API void tolua_endmodule (lua_State* L) +{ + lua_pop(L,1); +} + +/* Map module + * It creates a new module +*/ +#if 1 +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) +{ + if (name) + { + /* tolua module */ + lua_pushstring(L,name); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) /* check if module already exists */ + { + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,name); + lua_pushvalue(L,-2); + lua_rawset(L,-4); /* assing module into module */ + } + } + else + { + /* global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + } + if (hasvar) + { + if (!tolua_ismodulemetatable(L)) /* check if it already has a module metatable */ + { + /* create metatable to get/set C/C++ variable */ + lua_newtable(L); + tolua_moduleevents(L); + if (lua_getmetatable(L,-2)) + lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ + lua_setmetatable(L,-2); + } + } + lua_pop(L,1); /* pop module */ +} +#else +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) +{ + if (name) + { + /* tolua module */ + lua_pushstring(L,name); + lua_newtable(L); + } + else + { + /* global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + } + if (hasvar) + { + /* create metatable to get/set C/C++ variable */ + lua_newtable(L); + tolua_moduleevents(L); + if (lua_getmetatable(L,-2)) + lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ + lua_setmetatable(L,-2); + } + if (name) + lua_rawset(L,-3); /* assing module into module */ + else + lua_pop(L,1); /* pop global table */ +} +#endif + +static void push_collector(lua_State* L, const char* type, lua_CFunction col) { + + /* push collector function, but only if it's not NULL, or if there's no + collector already */ + if (!col) return; + luaL_getmetatable(L,type); + lua_pushstring(L,".collector"); + /* + if (!col) { + lua_pushvalue(L, -1); + lua_rawget(L, -3); + if (!lua_isnil(L, -1)) { + lua_pop(L, 3); + return; + }; + lua_pop(L, 1); + }; + // */ + lua_pushcfunction(L,col); + + lua_rawset(L,-3); + lua_pop(L, 1); +}; + +/* Map C class + * It maps a C class, setting the appropriate inheritance and super classes. +*/ +TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col) +{ + char cname[128] = "const "; + char cbase[128] = "const "; + strncat(cname,name,120); + strncat(cbase,base,120); + + mapinheritance(L,name,base); + mapinheritance(L,cname,name); + + mapsuper(L,cname,cbase); + mapsuper(L,name,base); + + lua_pushstring(L,lname); + + push_collector(L, name, col); + /* + luaL_getmetatable(L,name); + lua_pushstring(L,".collector"); + lua_pushcfunction(L,col); + + lua_rawset(L,-3); + */ + + luaL_getmetatable(L,name); + lua_rawset(L,-3); /* assign class metatable to module */ + + /* now we also need to store the collector table for the const + instances of the class */ + push_collector(L, cname, col); + /* + luaL_getmetatable(L,cname); + lua_pushstring(L,".collector"); + lua_pushcfunction(L,col); + lua_rawset(L,-3); + lua_pop(L,1); + */ + + +} + +/* Add base + * It adds additional base classes to a class (for multiple inheritance) + * (not for now) +TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) { + + char cname[128] = "const "; + char cbase[128] = "const "; + strncat(cname,name,120); + strncat(cbase,base,120); + + mapsuper(L,cname,cbase); + mapsuper(L,name,base); +}; +*/ + +/* Map function + * It assigns a function into the current module (or class) +*/ +TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func) +{ + lua_pushstring(L,name); + lua_pushcfunction(L,func); + lua_rawset(L,-3); +} + +/* sets the __call event for the class (expects the class' main table on top) */ +/* never really worked :( +TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type) { + + lua_getmetatable(L, -1); + //luaL_getmetatable(L, type); + lua_pushstring(L,"__call"); + lua_pushcfunction(L,func); + lua_rawset(L,-3); + lua_pop(L, 1); +}; +*/ + +/* Map constant number + * It assigns a constant number into the current module (or class) +*/ +TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value) +{ + lua_pushstring(L,name); + tolua_pushnumber(L,value); + lua_rawset(L,-3); +} + + +/* Map variable + * It assigns a variable into the current module (or class) +*/ +TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) +{ + /* get func */ + lua_pushstring(L,".get"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .get table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".get"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + lua_pushcfunction(L,get); + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .get table */ + + /* set func */ + if (set) + { + lua_pushstring(L,".set"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .set table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".set"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + lua_pushcfunction(L,set); + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .set table */ + } +} + +/* Access const array + * It reports an error when trying to write into a const array +*/ +static int const_array (lua_State* L) +{ + luaL_error(L,"value of const array cannot be changed"); + return 0; +} + +/* Map an array + * It assigns an array into the current module (or class) +*/ +TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) +{ + lua_pushstring(L,".get"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .get table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".get"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + + lua_newtable(L); /* create array metatable */ + lua_pushvalue(L,-1); + lua_setmetatable(L,-2); /* set the own table as metatable (for modules) */ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,get); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,set?set:const_array); + lua_rawset(L,-3); + + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .get table */ +} + + +TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name) { + + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + luaL_loadbuffer(L, B, size, name) || lua_pcall(L, 0, 0, 0); + #else + lua_dobuffer(L, B, size, name); + #endif +}; + diff --git a/ThirdLib/thirdparty/LuaLib/tolua_push.c b/ThirdLib/thirdparty/LuaLib/tolua_push.c new file mode 100644 index 000000000..639414755 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/tolua_push.c @@ -0,0 +1,171 @@ +/* tolua: functions to push C values. +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" +#include "lauxlib.h" + +#include + +TOLUA_API void tolua_pushvalue (lua_State* L, int lo) +{ + lua_pushvalue(L,lo); +} + +TOLUA_API void tolua_pushboolean (lua_State* L, int value) +{ + lua_pushboolean(L,value); +} + +TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value) +{ + lua_pushnumber(L,value); +} + +TOLUA_API void tolua_pushstring (lua_State* L, const char* value) +{ + if (value == NULL) + lua_pushnil(L); + else + lua_pushstring(L,value); +} + +TOLUA_API void tolua_pushuserdata (lua_State* L, void* value) +{ + if (value == NULL) + lua_pushnil(L); + else + lua_pushlightuserdata(L,value); +} + +TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type) +{ + if (value == NULL) + lua_pushnil(L); + else + { + luaL_getmetatable(L, type); + lua_pushstring(L,"tolua_ubox"); + lua_rawget(L,-2); /* stack: mt ubox */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); + lua_pushstring(L, "tolua_ubox"); + lua_rawget(L, LUA_REGISTRYINDEX); + }; + lua_pushlightuserdata(L,value); + lua_rawget(L,-2); /* stack: mt ubox ubox[u] */ + if (lua_isnil(L,-1)) + { + lua_pop(L,1); /* stack: mt ubox */ + lua_pushlightuserdata(L,value); + *(void**)lua_newuserdata(L,sizeof(void *)) = value; /* stack: mt ubox u newud */ + lua_pushvalue(L,-1); /* stack: mt ubox u newud newud */ + lua_insert(L,-4); /* stack: mt newud ubox u newud */ + lua_rawset(L,-3); /* stack: mt newud ubox */ + lua_pop(L,1); /* stack: mt newud */ + /*luaL_getmetatable(L,type);*/ + lua_pushvalue(L, -2); /* stack: mt newud mt */ + lua_setmetatable(L,-2); /* stack: mt newud */ + + #ifdef LUA_VERSION_NUM + lua_pushvalue(L, TOLUA_NOPEER); + lua_setfenv(L, -2); + #endif + } + else + { + /* check the need of updating the metatable to a more specialized class */ + lua_insert(L,-2); /* stack: mt ubox[u] ubox */ + lua_pop(L,1); /* stack: mt ubox[u] */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: mt ubox[u] super */ + lua_getmetatable(L,-2); /* stack: mt ubox[u] super mt */ + lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] */ + if (lua_istable(L,-1)) + { + lua_pushstring(L,type); /* stack: mt ubox[u] super super[mt] type */ + lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] flag */ + if (lua_toboolean(L,-1) == 1) /* if true */ + { + lua_pop(L,3); /* mt ubox[u]*/ + lua_remove(L, -2); + return; + } + } + /* type represents a more specilized type */ + /*luaL_getmetatable(L,type); // stack: mt ubox[u] super super[mt] flag mt */ + lua_pushvalue(L, -5); /* stack: mt ubox[u] super super[mt] flag mt */ + lua_setmetatable(L,-5); /* stack: mt ubox[u] super super[mt] flag */ + lua_pop(L,3); /* stack: mt ubox[u] */ + } + lua_remove(L, -2); /* stack: ubox[u]*/ + } +} + +TOLUA_API void tolua_pushusertype_and_takeownership (lua_State* L, void* value, const char* type) +{ + tolua_pushusertype(L,value,type); + tolua_register_gc(L,lua_gettop(L)); +} + +TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v) +{ + lua_pushnumber(L,index); + lua_pushvalue(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v) +{ + lua_pushnumber(L,index); + lua_pushboolean(L,v); + lua_settable(L,lo); +} + + +TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v) +{ + lua_pushnumber(L,index); + tolua_pushnumber(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v) +{ + lua_pushnumber(L,index); + tolua_pushstring(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v) +{ + lua_pushnumber(L,index); + tolua_pushuserdata(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type) +{ + lua_pushnumber(L,index); + tolua_pushusertype(L,v,type); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type) +{ + lua_pushnumber(L,index); + tolua_pushusertype(L,v,type); + tolua_register_gc(L,lua_gettop(L)); + lua_settable(L,lo); +} + diff --git a/ThirdLib/thirdparty/LuaLib/tolua_to.c b/ThirdLib/thirdparty/LuaLib/tolua_to.c new file mode 100644 index 000000000..542ca67d1 --- /dev/null +++ b/ThirdLib/thirdparty/LuaLib/tolua_to.c @@ -0,0 +1,133 @@ +/* tolua: funcitons to convert to C types +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "tolua++.h" + +#include +#include + +TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def) +{ + return lua_gettop(L)= 501 + TOLUA_API int luaopen_tolua (lua_State* tolua_S) { + return tolua_tolua_open(tolua_S); +}; +#endif + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/toluabind.h b/ThirdLib/thirdparty/LuaLib/toluabind.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaBase/toluabind.h rename to ThirdLib/thirdparty/LuaLib/toluabind.h diff --git a/ThirdLib/thirdparty/Mylog.cpp b/ThirdLib/thirdparty/Mylog.cpp new file mode 100644 index 000000000..0c9ea6bdf --- /dev/null +++ b/ThirdLib/thirdparty/Mylog.cpp @@ -0,0 +1,58 @@ +#include "Mylog.h" + + +CLog2File* CLog2File::pInstance = NULL; + +CLog2File& CLog2File::Initialize( ) +{ + if (NULL == pInstance) + { + pInstance = new CLog2File(); + //pInstance->InitLogFile(strLogFile); + } + return *pInstance; +} + + +CLog2File::CLog2File() +{ + +} + +CLog2File::~CLog2File(void) +{ +} + + +bool CLog2File::InitLogFile(const std::string &szFileName) +{ + m_FileName =szFileName; + m_LogFile.open(m_FileName.c_str(), ios_base::out | ios_base::app); + if (!m_LogFile) + { + return false; + } + + return true; +} + + +void CLog2File::CloseLogFile() +{ + if (m_LogFile.is_open()) + { + m_LogFile.close(); + } +} + + +void CLog2File::WriteLog( const std::string &x) +{ + if (m_LogFile.is_open()) + { + m_LogFile.seekp(ios::end); + m_LogFile << x < +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +using namespace std; + +inline std::string getCurrentSystemTime() +{ + auto time_now = std::chrono::system_clock::now(); + auto tt = std::chrono::system_clock::to_time_t(time_now); + auto duration_in_ms = std::chrono::duration_cast(time_now.time_since_epoch()); + auto duration_in_s = std::chrono::duration_cast(time_now.time_since_epoch()); + int theMs = duration_in_ms.count() - duration_in_s.count() * 1000; + struct tm* ptm = localtime(&tt); + char date[60] = { 0 }; + sprintf(date, "%d-%02d-%02d-%02d.%02d.%02d.%03d", (int)ptm->tm_year + 1900, (int)ptm->tm_mon + 1, (int)ptm->tm_mday, (int)ptm->tm_hour, (int)ptm->tm_min, (int)ptm->tm_sec, theMs); + return std::string(date); +} + + +//整数类型文件行号 ->转换为string类型 +inline std::string int2string(int line) +{ + std::ostringstream oss; + oss << line; + return oss.str(); +} + + +//定义一个在日志后添加 文件名 函数名 行号 的宏定义 +#define suffix_debug(msg) std::string(getCurrentSystemTime()).append(" [")\ + .append("DEBUG] ").append(__FILE__).append(":").append(__func__)\ + .append(":").append(int2string(__LINE__))\ + .append(" ").append(msg).append(" ") + +#define suffix_warn(msg) std::string(getCurrentSystemTime()).append(" [")\ + .append("WARNING] ").append(__FILE__).append(":").append(__func__)\ + .append(":").append(int2string(__LINE__))\ + .append(" ").append(msg).append(" ") + +#define suffix_info(msg) std::string(getCurrentSystemTime()).append(" [")\ + .append("INFO] ").append(__FILE__).append(":").append(__func__)\ + .append(":").append(int2string(__LINE__))\ + .append(" ").append(msg).append(" ") + +#define suffix_error(msg) std::string(getCurrentSystemTime()).append(" [")\ + .append("ERROR] ").append(__FILE__).append(":").append(__func__)\ + .append(":").append(int2string(__LINE__))\ + .append(" ").append(msg).append(" ") + + + +/* + * 功能:log日志类,输入信息到文件 +*/ +class CLog2File +{ +public: + static CLog2File& Initialize( ); + ~CLog2File(void); + +private: + CLog2File( ); + static CLog2File* pInstance ; + +public: + //初始化log,设置文件名(文件路径),打开文件 + bool InitLogFile(const std::string &szFileName); + + //停止log,关闭文件 + void CloseLogFile(); + + void WriteLog(const std::string &x); + +private: + std::string m_FileName; //文件名称 + std::ofstream m_LogFile; + + +}; + + +#ifdef _LOG2FILE_ +CLog2File &m_log = CLog2File::Initialize(); +#else +extern CLog2File &m_log; +#endif + + +//缩短并简化函数调用形式 +#define logError(msg) m_log.WriteLog( suffix_error(msg)) +#define logWarn(msg) m_log.WriteLog( suffix_warn(msg)) +#define logInfo(msg) m_log.WriteLog( suffix_info(msg)) +#define logDebug(msg) m_log.WriteLog( suffix_debug(msg)) + + + + + +#endif //__LOG2FILE_H_ + diff --git a/ThirdLib/thirdparty/macro.h b/ThirdLib/thirdparty/macro.h new file mode 100644 index 000000000..3be48596f --- /dev/null +++ b/ThirdLib/thirdparty/macro.h @@ -0,0 +1,52 @@ + +#ifndef _MACRO_H +#define _MACRO_H + + +#ifdef _LINUX_PLATFORM_ + + +#include +#include + + +static int sprintf_s( + char *buffer, + size_t sizeOfBuffer, + const char *format,...) +{ + va_list ap; + + va_start(ap, format); + int res = vsprintf(buffer, format, ap); + va_end(ap); + return res; +} + +static int printf_s( + const char *format,...) +{ + va_list ap; + + va_start(ap, format); + int res = vprintf(format, ap); + va_end(ap); + return res; +} + +#define memcpy_s(dest,num,src,count) memcpy(dest,src,count) +#define fprintf_s fprintf +#define _strdate_s(buf,num) _strdate(buf) +#define strcat_s(dest,num,src) strcat(dest,src) +#define fopen_s(pf,name,mode) *pf=fopen(name,mode) +#define strncpy_s(dest,num,src,count) strncpy(dest,src,count) +#define localtime_s(tm,time) *tm=*localtime(time) +#define _strdup strdup + + +#endif + +#endif //_MACRO_H + + + diff --git a/ThirdLib/thirdparty/sock_wrap.cpp b/ThirdLib/thirdparty/sock_wrap.cpp new file mode 100644 index 000000000..869a46905 --- /dev/null +++ b/ThirdLib/thirdparty/sock_wrap.cpp @@ -0,0 +1,685 @@ +//#include "platform.h" + +#include +#include +#include + +#include "sock_wrap.h" + + +#define INVALIDSOCKHANDLE INVALID_SOCKET + +#if defined(_WIN32_PLATFORM_) +#include +#define ISSOCKHANDLE(x) (x!=INVALID_SOCKET) +#define BLOCKREADWRITE 0 +#define NONBLOCKREADWRITE 0 +#define SENDNOSIGNAL 0 +#define ETRYAGAIN(x) (x==WSAEWOULDBLOCK||x==WSAETIMEDOUT) +#define gxsprintf sprintf_s + +#endif + + +#if defined(_LINUX_PLATFORM_) +#include +#include +#include +#include +#include +#include +#define ISSOCKHANDLE(x) (x>0) +#define BLOCKREADWRITE MSG_WAITALL +#define NONBLOCKREADWRITE MSG_DONTWAIT +#define SENDNOSIGNAL MSG_NOSIGNAL +#define ETRYAGAIN(x) (x==EAGAIN||x==EWOULDBLOCK) +#define gxsprintf snprintf + +#endif + + +CMyTimeSpan::CMyTimeSpan() +{ + getCurrentTimeLong(&m_start); +} +void CMyTimeSpan::Reset() +{ + getCurrentTimeLong(&m_start); +} +unsigned int CMyTimeSpan::GetSpaninMilliseconds() +{ + return (unsigned int)(GetSpaninMicroseconds()/1000LL); +} +unsigned int CMyTimeSpan::GetSpaninSeconds() +{ + return (unsigned int)(GetSpaninMicroseconds()/1000000LL); +} +unsigned long long CMyTimeSpan::GetSpaninMicroseconds() +{ + timelong_t end; + getCurrentTimeLong(&end); +#if defined(_WIN32_PLATFORM_) + return (end.QuadPart - m_start.QuadPart)/10; +#endif +#if defined(_LINUX_PLATFORM_) + return 1000000LL * ( end.tv_sec - m_start.tv_sec ) + end.tv_usec - m_start.tv_usec; +#endif + +} +void CMyTimeSpan::getCurrentTimeLong(timelong_t* tl) +{ +#if defined(_WIN32_PLATFORM_) + FILETIME ft; + GetSystemTimeAsFileTime(&ft); + tl->HighPart= ft.dwHighDateTime; + tl->LowPart = ft.dwLowDateTime; +#endif +#if defined(_LINUX_PLATFORM_) + gettimeofday( tl, NULL); +#endif +} + +#if defined(_LINUX_PLATFORM_) +// 返回自系统开机以来的毫秒数(tick) +unsigned long GetTickCount() +{ + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + + return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000); +} +#endif + + + + +void GetAddressFrom(sockaddr_in* addr, const char* ip, int port) +{ + memset(addr, 0, sizeof(sockaddr_in)); + addr->sin_family = AF_INET; /*地址类型为AF_INET*/ + + if(ip) + { + addr->sin_addr.s_addr = inet_addr(ip); + } + else + { + /*网络地址为INADDR_ANY,这个宏表示本地的任意IP地址,因为服务器可能有多个网卡,每个网卡也可能绑定多个IP地址, + 这样设置可以在所有的IP地址上监听,直到与某个客户端建立了连接时才确定下来到底用哪个IP地址*/ + addr->sin_addr.s_addr = htonl(INADDR_ANY); + } + + addr->sin_port = htons(port); /*端口号*/ +} +void GetIpAddress(char* ip, sockaddr_in* addr) +{ + unsigned char* p =(unsigned char*)( &(addr->sin_addr)); + gxsprintf(ip, 17, "%u.%u.%u.%u", *p,*(p+1), *(p+2), *(p+3) ); +} + +int GetLastSocketError() +{ +#if defined(_WIN32_PLATFORM_) + return WSAGetLastError(); +#endif + +#if defined(_LINUX_PLATFORM_) + return errno; +#endif +} + +bool IsValidSocketHandle(HSocket handle) +{ + return ISSOCKHANDLE(handle); +} + +void SocketClose(HSocket& handle) +{ + if(ISSOCKHANDLE(handle)) + { +#if defined(_WIN32_PLATFORM_) + closesocket(handle); +#endif + +#if defined(_LINUX_PLATFORM_) + close(handle); +#endif + handle = INVALIDSOCKHANDLE; + } +} + +HSocket SocketOpen(int tcpudp) +{ + int protocol = 0; + HSocket hs; +#if defined(_WIN32_PLATFORM_) + + if(tcpudp== SOCK_STREAM) + { + protocol=IPPROTO_TCP; + } + else if (tcpudp== SOCK_DGRAM) + { + protocol = IPPROTO_UDP; + } + +#endif + hs = socket(AF_INET, tcpudp, protocol); + return hs; +} + + +int SocketConnect(HSocket hs, sockaddr_in* paddr) +{ + return connect(hs, (struct sockaddr*)paddr, sizeof(sockaddr_in)); +} + +int GetSocketName(HSocket hs, sockaddr_in* paddr) +{ + int SocketSize =0; +#if defined(_WIN32_PLATFORM_) + return getsockname(hs, (struct sockaddr*)paddr, &SocketSize); +#else + return getsockname(hs, (struct sockaddr*)paddr, (socklen_t*)&SocketSize); +#endif +} + +int GetPeerName(HSocket hs, sockaddr_in* paddr) +{ + int SocketSize =0; +#if defined(_WIN32_PLATFORM_) + return getpeername(hs, (struct sockaddr*)paddr, &SocketSize); +#else + return getpeername(hs, (struct sockaddr*)paddr, (socklen_t*)&SocketSize); +#endif +} + + +int SocketBind(HSocket hs, sockaddr_in* paddr) +{ + return bind(hs, (struct sockaddr*)paddr, sizeof(sockaddr_in)); +} +int SocketListen(HSocket hs, int maxconn) +{ + return listen(hs,maxconn); +} +HSocket SocketAccept(HSocket hs, sockaddr_in* paddr) +{ +#if defined(_WIN32_PLATFORM_) + int cliaddr_len = sizeof(sockaddr_in); +#endif +#if defined(_LINUX_PLATFORM_) + socklen_t cliaddr_len = sizeof(sockaddr_in); +#endif + return accept(hs, (struct sockaddr*)paddr, &cliaddr_len); +} +// +// if timeout occurs, nbytes=-1, nresult=1 +// if socket error, nbyte=-1, nresult=-1 +// if the other side has disconnected in either block mode or nonblock mode, nbytes=0, nresult=-1 +// otherwise nbytes= the count of bytes sent , nresult=0 +void SocketSend(HSocket hs, const char* ptr, int nbytes, transresult_t& rt) +{ + rt.nbytes = 0; + rt.nresult = 0; + + if(!ptr|| nbytes<1) + { + return; + } + + //Linux: flag can be MSG_DONTWAIT, MSG_WAITALL, 使用MSG_WAITALL的时候, socket 必须是处于阻塞模式下,否则WAITALL不能起作用 + rt.nbytes = send(hs, ptr, nbytes, BLOCKREADWRITE|SENDNOSIGNAL); + + if(rt.nbytes>0) + { + rt.nresult = (rt.nbytes == nbytes)?0:1; + } + else if(rt.nbytes==0) + { + rt.nresult=-1; + } + else + { + rt.nresult = GetLastSocketError(); + rt.nresult = ETRYAGAIN(rt.nresult)? 1:-1; + } +} + + + +// if timeout occurs, nbytes=-1, nresult=1 +// if socket error, nbyte=-1, nresult=-1 +// if the other side has disconnected in either block mode or nonblock mode, nbytes=0, nresult=-1 +void SocketRecv(HSocket hs, char* ptr, int nbytes, transresult_t& rt) +{ + rt.nbytes = 0; + rt.nresult = 0; + + if(!ptr|| nbytes<1) + { + return; + } + + rt.nbytes = recv(hs, ptr, nbytes, BLOCKREADWRITE); + + if(rt.nbytes>0) + { + return; + } + else if(rt.nbytes==0) + { + rt.nresult=-1; + } + else + { + rt.nresult = GetLastSocketError(); + rt.nresult = ETRYAGAIN(rt.nresult)? 1:-1; + } + +} + + + +int SockSendTo (HSocket hs, const char* ptr, int len, const struct sockaddr_in* to) +{ + //int nssssSize = sizeof(sockaddr_in); + return sendto(hs, ptr, len, 0, (sockaddr* )to, sizeof(sockaddr_in)); + +} + +int SockRecvFrom(HSocket hs, const char* ptr, int len, struct sockaddr_in* from) +{ + int nClientAddrSize = sizeof(sockaddr_in); + + //socket创建的准备工作 + //struct sockaddr_in clientsockaddr1; + /* + struct sockaddr_in clientsockaddr; + + memset(&clientsockaddr, 0, sizeof(SOCKADDR_IN)); + clientsockaddr.sin_family = AF_INET; + clientsockaddr.sin_port = htons(20004); + clientsockaddr.sin_addr.S_un.S_addr = inet_addr(m_pSocket_Info->m_szSerevrIP); + */ +#if defined(_WIN32_PLATFORM_) + return recvfrom(hs, (char*)ptr, len, 0, (sockaddr*)from, &nClientAddrSize); +#else + return recvfrom(hs, (void*)ptr, len, 0, (sockaddr* )from, (socklen_t*)&nClientAddrSize); +#endif +} + + + + + +// nbytes= the count of bytes sent +// if timeout occurs, nresult=1 +// if socket error, nresult=-1, +// if the other side has disconnected in either block mode or nonblock mode, nresult=-2 + +void SocketTrySend(HSocket hs, const char* ptr, int nbytes, int milliseconds, transresult_t& rt) +{ + rt.nbytes = 0; + rt.nresult = 0; + + if(!ptr|| nbytes<1) + { + return; + } + + + int n; + CMyTimeSpan start; + + while(1) + { + n = send(hs, ptr+rt.nbytes, nbytes, NONBLOCKREADWRITE|SENDNOSIGNAL); + + if(n>0) + { + rt.nbytes += n; + nbytes -= n; + + if(rt.nbytes >= nbytes) + { + rt.nresult = 0; + break; + } + } + else if( n==0) + { + rt.nresult= -2; + break; + } + else + { + n = GetLastSocketError(); + + if(ETRYAGAIN(n)) + { + // CLightThread::DiscardTimeSlice(); + int dwSleep=20; + std::this_thread::sleep_for(std::chrono::milliseconds(dwSleep*1000)); + } + else + { + rt.nresult = -1; + break; + } + } + + if(start.GetSpaninMilliseconds() > (unsigned int)milliseconds) + { + rt.nresult= 1; + break; + } + } +} +// if timeout occurs, nbytes=-1, nresult=1 +// if socket error, nbyte=-1, nresult=-1 +// if the other side has disconnected in either block mode or nonblock mode, nbytes=0, nresult=-1 +void SocketTryRecv(HSocket hs, char* ptr, int nbytes, int milliseconds, transresult_t& rt) +{ + rt.nbytes = 0; + rt.nresult = 0; + + if(!ptr|| nbytes<1) + { + return; + } + + if(milliseconds>2) + { + CMyTimeSpan start; + + while(1) + { + rt.nbytes = recv(hs, ptr, nbytes, NONBLOCKREADWRITE); + + if(rt.nbytes>0) + { + break; + } + else if(rt.nbytes==0) + { + rt.nresult = -1; + break; + } + else + { + rt.nresult = GetLastSocketError(); + + if( ETRYAGAIN(rt.nresult)) + { + if(start.GetSpaninMilliseconds() > (unsigned int)milliseconds) + { + rt.nresult= 1; + break; + } + + //CLightThread::DiscardTimeSlice(); + int dwSleep=20; + std::this_thread::sleep_for(std::chrono::milliseconds(dwSleep*1000)); + } + else + { + rt.nresult = -1; + break; + } + } + + } + } + else + { + SocketRecv(hs, ptr, nbytes, rt); + } +} + + + +void SocketClearRecvBuffer(HSocket hs) +{ +#if defined(_WIN32_PLATFORM_) + struct timeval tmOut; + tmOut.tv_sec = 0; + tmOut.tv_usec = 0; + fd_set fds; + FD_ZERO(&fds); + FD_SET(hs, &fds); + int nRet = 1; + char tmp[100]; + + while(nRet>0) + { + nRet= select(FD_SETSIZE, &fds, NULL, NULL, &tmOut); + + if(nRet>0) + { + nRet = recv(hs, tmp, 100,0); + } + } + +#endif + +#if defined(_LINUX_PLATFORM_) + char tmp[100]; + + while(recv(hs, tmp, 100, NONBLOCKREADWRITE)> 0); + +#endif +} + +int SocketBlock(HSocket hs, bool bblock) +{ + unsigned long mode; + + if( ISSOCKHANDLE(hs)) + { +#if defined(_WIN32_PLATFORM_) + mode = bblock?0:1; + return ioctlsocket(hs,FIONBIO,&mode); +#endif + +#if defined(_LINUX_PLATFORM_) + mode = fcntl(hs, F_GETFL, 0); //获取文件的flags值。 + //设置成阻塞模式 非阻塞模式 + return bblock?fcntl(hs,F_SETFL, mode&~O_NONBLOCK): fcntl(hs, F_SETFL, mode | O_NONBLOCK); +#endif + } + + return -1; +} + +int SocketTimeOut(HSocket hs, int recvtimeout, int sendtimeout, int lingertimeout) //in milliseconds +{ + int rt=-1; + + if (ISSOCKHANDLE(hs) ) + { + rt=0; +#if defined(_WIN32_PLATFORM_) + + if(lingertimeout>-1) + { + struct linger lin; + lin.l_onoff = lingertimeout; + lin.l_linger = lingertimeout ; + rt = setsockopt(hs,SOL_SOCKET,SO_DONTLINGER,(const char*)&lin,sizeof(linger)) == 0 ? 0:0x1; + } + + if(recvtimeout>0 && rt == 0) + { + rt = rt | (setsockopt(hs,SOL_SOCKET,SO_RCVTIMEO,(char*)&recvtimeout,sizeof(int))==0?0:0x2); + } + + if(sendtimeout>0 && rt == 0) + { + rt = rt | (setsockopt(hs,SOL_SOCKET, SO_SNDTIMEO, (char*)&sendtimeout,sizeof(int))==0?0:0x4); + } + +#endif + +#if defined(_LINUX_PLATFORM_) + struct timeval timeout; + + if(lingertimeout>-1) + { + struct linger lin; + lin.l_onoff = lingertimeout>0?1:0; + lin.l_linger = lingertimeout/1000 ; + rt = setsockopt(hs,SOL_SOCKET,SO_LINGER,(const char*)&lin,sizeof(linger)) == 0 ? 0:0x1; + } + + if(recvtimeout>0 && rt == 0) + { + timeout.tv_sec = recvtimeout/1000; + timeout.tv_usec = (recvtimeout % 1000)*1000; + rt = rt | (setsockopt(hs,SOL_SOCKET,SO_RCVTIMEO,&timeout,sizeof(timeout))==0?0:0x2); + } + + if(sendtimeout>0 && rt == 0) + { + timeout.tv_sec = sendtimeout/1000; + timeout.tv_usec = (sendtimeout % 1000)*1000; + rt = rt | (setsockopt(hs,SOL_SOCKET, SO_SNDTIMEO, &timeout,sizeof(timeout))==0?0:0x4); + } + +#endif + } + + return rt; +} + + +int InitializeSocketEnvironment() +{ +#if defined(_WIN32_PLATFORM_) + WSADATA Ws; + + //Init Windows Socket + if ( WSAStartup(MAKEWORD(2,2), &Ws) != 0 ) + { + return -1; + } + +#endif + return 0; +} +void FreeSocketEnvironment() +{ +#if defined(_WIN32_PLATFORM_) + WSACleanup(); +#endif +} +//============================================================================================================== +//================================================================================================================ +CSockWrap::CSockWrap(int tcpudp) +{ + memset(&m_stAddr, 0, sizeof(sockaddr_in)); + m_tcpudp = tcpudp; + m_hSocket = INVALIDSOCKHANDLE; + Reopen(false); +} + + +CSockWrap::~CSockWrap() +{ + SocketClose(m_hSocket); +} + +void CSockWrap::Close() +{ + SocketClose(m_hSocket); +} + + +void CSockWrap::Reopen(bool bForceClose) +{ + + if (ISSOCKHANDLE(m_hSocket) && bForceClose) + { + SocketClose(m_hSocket); + } + + if (!ISSOCKHANDLE(m_hSocket) ) + { + m_hSocket=SocketOpen(m_tcpudp); + } + +} +void CSockWrap::SetAddress(const char* ip, int port) +{ + GetAddressFrom(&m_stAddr, ip, port); +} +void CSockWrap::SetAddress(sockaddr_in* addr) +{ + memcpy(&m_stAddr, addr, sizeof(sockaddr_in)); +} + +int CSockWrap::SetTimeOut(int recvtimeout, int sendtimeout, int lingertimeout) //in milliseconds +{ + return SocketTimeOut(m_hSocket, recvtimeout, sendtimeout, lingertimeout); +} + +int CSockWrap::SetBufferSize(int recvbuffersize, int sendbuffersize) //in bytes +{ + int rt=-1; + + if (ISSOCKHANDLE(m_hSocket) ) + { +#if defined(_WIN32_PLATFORM_) + + if(recvbuffersize>-1) + { + rt = setsockopt( m_hSocket, SOL_SOCKET, SO_RCVBUF, ( const char* )&recvbuffersize, sizeof( int ) ); + } + + if(sendbuffersize>-1) + { + rt = rt | (setsockopt(m_hSocket,SOL_SOCKET,SO_SNDBUF,(char*)&sendbuffersize,sizeof(int))==0?0:0x2); + } + +#endif + } + + return rt; +} + +int CSockWrap::SetBlock(bool bblock) +{ + return SocketBlock(m_hSocket, bblock); +} +transresult_t CSockWrap::Send(void* ptr, int nbytes) +{ + transresult_t rt; + SocketSend(m_hSocket, (const char*)ptr, nbytes,rt); + return rt; +} +transresult_t CSockWrap::Recv(void* ptr, int nbytes ) +{ + transresult_t rt; + SocketRecv(m_hSocket, (char*)ptr, nbytes,rt); + return rt; +} + +transresult_t CSockWrap::TrySend(void* ptr, int nbytes, int milliseconds) +{ + transresult_t rt; + SocketTrySend(m_hSocket, (const char*)ptr, nbytes,milliseconds, rt); + return rt; +} +transresult_t CSockWrap::TryRecv(void* ptr, int nbytes, int milliseconds ) +{ + transresult_t rt; + SocketTryRecv(m_hSocket, (char*)ptr, nbytes,milliseconds, rt); + return rt; +} + + +void CSockWrap::ClearRecvBuffer() +{ + SocketClearRecvBuffer(m_hSocket); +} diff --git a/ThirdLib/thirdparty/sock_wrap.h b/ThirdLib/thirdparty/sock_wrap.h new file mode 100644 index 000000000..e687be4a3 --- /dev/null +++ b/ThirdLib/thirdparty/sock_wrap.h @@ -0,0 +1,135 @@ +#ifndef _SOCK_WRAP_H_ +#define _SOCK_WRAP_H_ + +//#include "platform.h" + + +#if defined(_WIN32_PLATFORM_) + +#include +//#include +#include +#define timelong_t ULARGE_INTEGER +typedef SOCKET HSocket; +#endif + +#if defined(_LINUX_PLATFORM_) +#include +#include +#include +#include +#include +#include +#define timelong_t struct timeval + + +typedef int HSocket; +#define SOCKET_ERROR (-1) +#define INVALID_SOCKET 0 +#endif + +#include + +class CMyTimeSpan +{ +public: + CMyTimeSpan(); + void Reset(); + unsigned long long GetSpaninMicroseconds(); + unsigned int GetSpaninMilliseconds(); + unsigned int GetSpaninSeconds(); + +private: + timelong_t m_start; + void getCurrentTimeLong(timelong_t* tl); + +}; +//===================================================================================== + + + +#if defined(_LINUX_PLATFORM_) +unsigned long GetTickCount(); +#endif + +typedef struct +{ + int block; + int sendbuffersize; + int recvbuffersize; + int lingertimeout; + int recvtimeout; + int sendtimeout; +} socketoption_t; + +typedef struct +{ + int nbytes; + int nresult; +} transresult_t; + +int InitializeSocketEnvironment(); +void FreeSocketEnvironment(); +void GetAddressFrom(sockaddr_in* addr, const char* ip, int port); +void GetIpAddress(char* ip, sockaddr_in* addr); +bool IsValidSocketHandle(HSocket handle); +int GetLastSocketError(); + +HSocket SocketOpen(int tcpudp); +void SocketClose(HSocket& handle); + +int SocketBlock(HSocket hs, bool bblock); +int SocketTimeOut(HSocket hs, int recvtimeout, int sendtimeout, int lingertimeout); + +int GetSocketName(HSocket hs,sockaddr_in* addr); +int GetPeerName(HSocket hs,sockaddr_in* addr); + +int SocketBind(HSocket hs, sockaddr_in* addr); +int SocketConnect(HSocket hs, sockaddr_in* paddr); +HSocket SocketAccept(HSocket hs, sockaddr_in* addr); +int SocketListen(HSocket hs, int maxconn); + +void SocketSend(HSocket hs, const char* ptr, int nbytes, transresult_t& rt); +void SocketRecv(HSocket hs, char* ptr, int nbytes, transresult_t& rt); +void SocketTryRecv(HSocket hs, char* ptr, int nbytes, int milliseconds, transresult_t& rt); +void SocketTrySend(HSocket hs, const char* ptr, int nbytes, int milliseconds, transresult_t& rt); + + +int SockSendTo (HSocket hs, const char* ptr, int len, const struct sockaddr_in* to); + +int SockRecvFrom(HSocket hs, const char* ptr, int len, struct sockaddr_in* from); + + +void SocketClearRecvBuffer(HSocket hs); + +class CSockWrap +{ +public: + CSockWrap(int tcpudp); + ~CSockWrap(); + void SetAddress(const char* ip, int port); + void SetAddress(sockaddr_in* addr); + int SetTimeOut(int recvtimeout, int sendtimeout, int lingertimeout); + int SetBufferSize(int recvbuffersize, int sendbuffersize); + int SetBlock(bool bblock); + + HSocket GetHandle () + { + return m_hSocket; + } + void Reopen(bool bForceClose); + void Close(); + transresult_t Send(void* ptr, int nbytes); + transresult_t Recv(void* ptr, int nbytes ); + transresult_t TrySend(void* ptr, int nbytes, int milliseconds); + transresult_t TryRecv(void* ptr, int nbytes, int milliseconds ); + void ClearRecvBuffer(); + +protected: + HSocket m_hSocket; + sockaddr_in m_stAddr; + int m_tcpudp; +}; + + +#endif diff --git a/ThirdLib/thirdparty/zookeeper/include/config.h b/ThirdLib/thirdparty/zookeeper/include/config.h new file mode 100644 index 000000000..68d05e919 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/config.h @@ -0,0 +1,157 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CONFIG_H_ +#define CONFIG_H_ + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the file `generated/zookeeper.jute.c'. */ +#define HAVE_GENERATED_ZOOKEEPER_JUTE_C 1 + +/* Define to 1 if you have the file `generated/zookeeper.jute.h'. */ +#define HAVE_GENERATED_ZOOKEEPER_JUTE_H 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the `getlogin' function. */ +#define HAVE_GETLOGIN 1 + +/* Define to 1 if you have the `getpwuid_r' function. */ +#define HAVE_GETPWUID_R 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `getuid' function. */ +#define HAVE_GETUID 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `rt' library (-lrt). */ +#define HAVE_LIBRT 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the `poll' function. */ +#define HAVE_POLL 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strtol' function. */ +#define HAVE_STRTOL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if IPv6 support is available. */ +#define ZOO_IPV6_ENABLED 1 + +/* Define to 1 if SOCK_CLOEXEC is available and wanted */ +/* #undef SOCK_CLOEXEC_ENABLED */ + +/* poll() second argument type */ +#define POLL_NFDS_TYPE nfds_t + +/* Name of package */ +#define PACKAGE "zookeeper" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "user@zookeeper.apache.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "zookeeper C client" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "zookeeper C client 3.5.4" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "zookeeper" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "3.5.4" + +/* Version number of package */ +#define VERSION "3.5.4" + +#endif diff --git a/ThirdLib/thirdparty/zookeeper/include/proto.h b/ThirdLib/thirdparty/zookeeper/include/proto.h new file mode 100644 index 000000000..933d7c28b --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/proto.h @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef PROTO_H_ +#define PROTO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZOO_NOTIFY_OP 0 +#define ZOO_CREATE_OP 1 +#define ZOO_DELETE_OP 2 +#define ZOO_EXISTS_OP 3 +#define ZOO_GETDATA_OP 4 +#define ZOO_SETDATA_OP 5 +#define ZOO_GETACL_OP 6 +#define ZOO_SETACL_OP 7 +#define ZOO_GETCHILDREN_OP 8 +#define ZOO_SYNC_OP 9 +#define ZOO_PING_OP 11 +#define ZOO_GETCHILDREN2_OP 12 +#define ZOO_CHECK_OP 13 +#define ZOO_MULTI_OP 14 +#define ZOO_CREATE2_OP 15 +#define ZOO_RECONFIG_OP 16 +#define ZOO_REMOVE_WATCHES 17 +#define ZOO_CLOSE_OP -11 +#define ZOO_SETAUTH_OP 100 +#define ZOO_SETWATCHES_OP 101 + +#ifdef __cplusplus +} +#endif + +#endif /*PROTO_H_*/ diff --git a/ThirdLib/thirdparty/zookeeper/include/recordio.h b/ThirdLib/thirdparty/zookeeper/include/recordio.h new file mode 100644 index 000000000..876ad32d6 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/recordio.h @@ -0,0 +1,80 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef __RECORDIO_H__ +#define __RECORDIO_H__ + +#include +#include /* for int64_t */ +#ifdef WIN32 +#include "winconfig.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct buffer { + int32_t len; + char *buff; +}; + +void deallocate_String(char **s); +void deallocate_Buffer(struct buffer *b); +void deallocate_vector(void *d); +struct iarchive { + int (*start_record)(struct iarchive *ia, const char *tag); + int (*end_record)(struct iarchive *ia, const char *tag); + int (*start_vector)(struct iarchive *ia, const char *tag, int32_t *count); + int (*end_vector)(struct iarchive *ia, const char *tag); + int (*deserialize_Bool)(struct iarchive *ia, const char *name, int32_t *); + int (*deserialize_Int)(struct iarchive *ia, const char *name, int32_t *); + int (*deserialize_Long)(struct iarchive *ia, const char *name, int64_t *); + int (*deserialize_Buffer)(struct iarchive *ia, const char *name, + struct buffer *); + int (*deserialize_String)(struct iarchive *ia, const char *name, char **); + void *priv; +}; +struct oarchive { + int (*start_record)(struct oarchive *oa, const char *tag); + int (*end_record)(struct oarchive *oa, const char *tag); + int (*start_vector)(struct oarchive *oa, const char *tag, const int32_t *count); + int (*end_vector)(struct oarchive *oa, const char *tag); + int (*serialize_Bool)(struct oarchive *oa, const char *name, const int32_t *); + int (*serialize_Int)(struct oarchive *oa, const char *name, const int32_t *); + int (*serialize_Long)(struct oarchive *oa, const char *name, + const int64_t *); + int (*serialize_Buffer)(struct oarchive *oa, const char *name, + const struct buffer *); + int (*serialize_String)(struct oarchive *oa, const char *name, char **); + void *priv; +}; + +struct oarchive *create_buffer_oarchive(void); +void close_buffer_oarchive(struct oarchive **oa, int free_buffer); +struct iarchive *create_buffer_iarchive(char *buffer, int len); +void close_buffer_iarchive(struct iarchive **ia); +char *get_buffer(struct oarchive *); +int get_buffer_len(struct oarchive *); + +int64_t zoo_htonll(int64_t v); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ThirdLib/thirdparty/zookeeper/include/winconfig.h b/ThirdLib/thirdparty/zookeeper/include/winconfig.h new file mode 100644 index 000000000..c273a932a --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/winconfig.h @@ -0,0 +1,15 @@ +#ifndef WINCONFIG_H_ +#define WINCONFIG_H_ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#define inline __inline +#endif + +#define __attribute__(x) +#define __func__ __FUNCTION__ + +#define ACL ZKACL /* Conflict with windows API */ + +#endif diff --git a/ThirdLib/thirdparty/zookeeper/include/zookeeper.h b/ThirdLib/thirdparty/zookeeper/include/zookeeper.h new file mode 100644 index 000000000..af601f154 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/zookeeper.h @@ -0,0 +1,2072 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ZOOKEEPER_H_ +#define ZOOKEEPER_H_ + +#include + +/* we must not include config.h as a public header */ +#ifndef WIN32 +#include +#include +#endif + +#ifdef WIN32 +#include /* must always be included before ws2tcpip.h */ +#include /* for struct sock_addr and socklen_t */ +#endif + +#include +#include + +#include "proto.h" +#include "zookeeper_version.h" +#include "recordio.h" +#include "zookeeper.jute.h" + +/** + * \file zookeeper.h + * \brief ZooKeeper functions and definitions. + * + * ZooKeeper is a network service that may be backed by a cluster of + * synchronized servers. The data in the service is represented as a tree + * of data nodes. Each node has data, children, an ACL, and status information. + * The data for a node is read and write in its entirety. + * + * ZooKeeper clients can leave watches when they queries the data or children + * of a node. If a watch is left, that client will be notified of the change. + * The notification is a one time trigger. Subsequent chances to the node will + * not trigger a notification unless the client issues a query with the watch + * flag set. If the client is ever disconnected from the service, the watches do + * not need to be reset. The client automatically resets the watches. + * + * When a node is created, it may be flagged as an ephemeral node. Ephemeral + * nodes are automatically removed when a client session is closed or when + * a session times out due to inactivity (the ZooKeeper runtime fills in + * periods of inactivity with pings). Ephemeral nodes cannot have children. + * + * ZooKeeper clients are identified by a server assigned session id. For + * security reasons The server + * also generates a corresponding password for a session. A client may save its + * id and corresponding password to persistent storage in order to use the + * session across program invocation boundaries. + */ + +/* Support for building on various platforms */ + +// on cygwin we should take care of exporting/importing symbols properly +#ifdef DLL_EXPORT +# define ZOOAPI __declspec(dllexport) +#else +# if (defined(__CYGWIN__) || defined(WIN32)) && !defined(USE_STATIC_LIB) +# define ZOOAPI __declspec(dllimport) +# else +# define ZOOAPI +# endif +#endif + +/** zookeeper return constants **/ + +enum ZOO_ERRORS { + ZOK = 0, /*!< Everything is OK */ + + /** System and server-side errors. + * This is never thrown by the server, it shouldn't be used other than + * to indicate a range. Specifically error codes greater than this + * value, but lesser than {@link #ZAPIERROR}, are system errors. */ + ZSYSTEMERROR = -1, + ZRUNTIMEINCONSISTENCY = -2, /*!< A runtime inconsistency was found */ + ZDATAINCONSISTENCY = -3, /*!< A data inconsistency was found */ + ZCONNECTIONLOSS = -4, /*!< Connection to the server has been lost */ + ZMARSHALLINGERROR = -5, /*!< Error while marshalling or unmarshalling data */ + ZUNIMPLEMENTED = -6, /*!< Operation is unimplemented */ + ZOPERATIONTIMEOUT = -7, /*!< Operation timeout */ + ZBADARGUMENTS = -8, /*!< Invalid arguments */ + ZINVALIDSTATE = -9, /*!< Invliad zhandle state */ + ZNEWCONFIGNOQUORUM = -13, /*!< No quorum of new config is connected and + up-to-date with the leader of last commmitted + config - try invoking reconfiguration after new + servers are connected and synced */ + ZRECONFIGINPROGRESS = -14, /*!< Reconfiguration requested while another + reconfiguration is currently in progress. This + is currently not supported. Please retry. */ + + /** API errors. + * This is never thrown by the server, it shouldn't be used other than + * to indicate a range. Specifically error codes greater than this + * value are API errors (while values less than this indicate a + * {@link #ZSYSTEMERROR}). + */ + ZAPIERROR = -100, + ZNONODE = -101, /*!< Node does not exist */ + ZNOAUTH = -102, /*!< Not authenticated */ + ZBADVERSION = -103, /*!< Version conflict */ + ZNOCHILDRENFOREPHEMERALS = -108, /*!< Ephemeral nodes may not have children */ + ZNODEEXISTS = -110, /*!< The node already exists */ + ZNOTEMPTY = -111, /*!< The node has children */ + ZSESSIONEXPIRED = -112, /*!< The session has been expired by the server */ + ZINVALIDCALLBACK = -113, /*!< Invalid callback specified */ + ZINVALIDACL = -114, /*!< Invalid ACL specified */ + ZAUTHFAILED = -115, /*!< Client authentication failed */ + ZCLOSING = -116, /*!< ZooKeeper is closing */ + ZNOTHING = -117, /*!< (not error) no server responses to process */ + ZSESSIONMOVED = -118, /*! + * The legacy style, an application wishing to receive events from ZooKeeper must + * first implement a function with this signature and pass a pointer to the function + * to \ref zookeeper_init. Next, the application sets a watch by calling one of + * the getter API that accept the watch integer flag (for example, \ref zoo_aexists, + * \ref zoo_get, etc). + *

+ * The watcher object style uses an instance of a "watcher object" which in + * the C world is represented by a pair: a pointer to a function implementing this + * signature and a pointer to watcher context -- handback user-specific data. + * When a watch is triggered this function will be called along with + * the watcher context. An application wishing to use this style must use + * the getter API functions with the "w" prefix in their names (for example, \ref + * zoo_awexists, \ref zoo_wget, etc). + * + * \param zh zookeeper handle + * \param type event type. This is one of the *_EVENT constants. + * \param state connection state. The state value will be one of the *_STATE constants. + * \param path znode path for which the watcher is triggered. NULL if the event + * type is ZOO_SESSION_EVENT + * \param watcherCtx watcher context. + */ +typedef void (*watcher_fn)(zhandle_t *zh, int type, + int state, const char *path,void *watcherCtx); + +/** + * \brief typedef for setting the log callback. It's a function pointer which + * returns void and accepts a const char* as its only argument. + * + * \param message message to be passed to the callback function. + */ +typedef void (*log_callback_fn)(const char *message); + +/** + * \brief create a handle to used communicate with zookeeper. + * + * This method creates a new handle and a zookeeper session that corresponds + * to that handle. Session establishment is asynchronous, meaning that the + * session should not be considered established until (and unless) an + * event of state ZOO_CONNECTED_STATE is received. + * \param host comma separated host:port pairs, each corresponding to a zk + * server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002" + * \param fn the global watcher callback function. When notifications are + * triggered this function will be invoked. + * \param clientid the id of a previously established session that this + * client will be reconnecting to. Pass 0 if not reconnecting to a previous + * session. Clients can access the session id of an established, valid, + * connection by calling \ref zoo_client_id. If the session corresponding to + * the specified clientid has expired, or if the clientid is invalid for + * any reason, the returned zhandle_t will be invalid -- the zhandle_t + * state will indicate the reason for failure (typically + * ZOO_EXPIRED_SESSION_STATE). + * \param context the handback object that will be associated with this instance + * of zhandle_t. Application can access it (for example, in the watcher + * callback) using \ref zoo_get_context. The object is not used by zookeeper + * internally and can be null. + * \param flags reserved for future use. Should be set to zero. + * \return a pointer to the opaque zhandle structure. If it fails to create + * a new zhandle the function returns NULL and the errno variable + * indicates the reason. + */ +ZOOAPI zhandle_t *zookeeper_init(const char *host, watcher_fn fn, + int recv_timeout, const clientid_t *clientid, void *context, int flags); + +/** + * \brief create a handle to communicate with zookeeper. + * + * This function is identical to \ref zookeeper_init except it allows one + * to specify an additional callback to be used for all logging for that + * specific connection. For more details on the logging callback see + * \ref zoo_get_log_callback and \ref zoo_set_log_callback. + * + * This method creates a new handle and a zookeeper session that corresponds + * to that handle. Session establishment is asynchronous, meaning that the + * session should not be considered established until (and unless) an + * event of state ZOO_CONNECTED_STATE is received. + * \param host comma separated host:port pairs, each corresponding to a zk + * server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002" + * \param fn the global watcher callback function. When notifications are + * triggered this function will be invoked. + * \param clientid the id of a previously established session that this + * client will be reconnecting to. Pass 0 if not reconnecting to a previous + * session. Clients can access the session id of an established, valid, + * connection by calling \ref zoo_client_id. If the session corresponding to + * the specified clientid has expired, or if the clientid is invalid for + * any reason, the returned zhandle_t will be invalid -- the zhandle_t + * state will indicate the reason for failure (typically + * ZOO_EXPIRED_SESSION_STATE). + * \param context the handback object that will be associated with this instance + * of zhandle_t. Application can access it (for example, in the watcher + * callback) using \ref zoo_get_context. The object is not used by zookeeper + * internally and can be null. + * \param flags reserved for future use. Should be set to zero. + * \param log_callback All log messages will be passed to this callback function. + * For more details see \ref zoo_get_log_callback and \ref zoo_set_log_callback. + * \return a pointer to the opaque zhandle structure. If it fails to create + * a new zhandle the function returns NULL and the errno variable + * indicates the reason. + */ +ZOOAPI zhandle_t *zookeeper_init2(const char *host, watcher_fn fn, + int recv_timeout, const clientid_t *clientid, void *context, int flags, + log_callback_fn log_callback); + +/** + * \brief update the list of servers this client will connect to. + * + * This method allows a client to update the connection string by providing + * a new comma separated list of host:port pairs, each corresponding to a + * ZooKeeper server. + * + * This function invokes a probabilistic load-balancing algorithm which may cause + * the client to disconnect from its current host to achieve expected uniform + * connections per server in the new list. In case the current host to which the + * client is connected is not in the new list this call will always cause the + * connection to be dropped. Otherwise, the decision is based on whether the + * number of servers has increased or decreased and by how much. + * + * If the connection is dropped, the client moves to a special "reconfig" mode + * where he chooses a new server to connect to using the probabilistic algorithm. + * After finding a server or exhaustively trying all the servers in the new list, + * the client moves back to the normal mode of operation where it will pick an + * arbitrary server from the 'host' string. + * + * See {@link https://issues.apache.org/jira/browse/ZOOKEEPER-1355} for the + * protocol and its evaluation, + * + * \param host comma separated host:port pairs, each corresponding to a zk + * server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002" + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZSYSTEMERROR -- a system (OS) error occured; it's worth checking errno to get details + */ +ZOOAPI int zoo_set_servers(zhandle_t *zh, const char *hosts); + +/** + * \brief cycle to the next server on the next connection attempt. + * + * Note: typically this method should NOT be used outside of testing. + * + * This method allows a client to cycle through the list of servers in it's + * connection pool to be used on the next connection attempt. This function does + * not actually trigger a connection or state change in any way. Its purpose is + * to allow testing changing servers on the fly and the probabilistic load + * balancing algorithm. + */ +ZOOAPI void zoo_cycle_next_server(zhandle_t *zh); + +/** + * \brief get current host:port this client is connecting/connected to. + * + * Note: typically this method should NOT be used outside of testing. + * + * This method allows a client to get the current host:port that this client + * is either in the process of connecting to or is currently connected to. This + * is mainly used for testing purposes but might also come in handy as a general + * purpose tool to be used by other clients. + */ +ZOOAPI const char* zoo_get_current_server(zhandle_t* zh); + +/** + * \brief close the zookeeper handle and free up any resources. + * + * After this call, the client session will no longer be valid. The function + * will flush any outstanding send requests before return. As a result it may + * block. + * + * This method should only be called only once on a zookeeper handle. Calling + * twice will cause undefined (and probably undesirable behavior). Calling any other + * zookeeper method after calling close is undefined behaviour and should be avoided. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \return a result code. Regardless of the error code returned, the zhandle + * will be destroyed and all resources freed. + * + * ZOK - success + * ZBADARGUMENTS - invalid input parameters + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + * ZOPERATIONTIMEOUT - failed to flush the buffers within the specified timeout. + * ZCONNECTIONLOSS - a network error occurred while attempting to send request to server + * ZSYSTEMERROR -- a system (OS) error occurred; it's worth checking errno to get details + */ +ZOOAPI int zookeeper_close(zhandle_t *zh); + +/** + * \brief return the client session id, only valid if the connections + * is currently connected (ie. last watcher state is ZOO_CONNECTED_STATE) + */ +ZOOAPI const clientid_t *zoo_client_id(zhandle_t *zh); + +/** + * \brief return the timeout for this session, only valid if the connections + * is currently connected (ie. last watcher state is ZOO_CONNECTED_STATE). This + * value may change after a server re-connect. + */ +ZOOAPI int zoo_recv_timeout(zhandle_t *zh); + +/** + * \brief return the context for this handle. + */ +ZOOAPI const void *zoo_get_context(zhandle_t *zh); + +/** + * \brief set the context for this handle. + */ +ZOOAPI void zoo_set_context(zhandle_t *zh, void *context); + +/** + * \brief set a watcher function + * \return previous watcher function + */ +ZOOAPI watcher_fn zoo_set_watcher(zhandle_t *zh,watcher_fn newFn); + +/** + * \brief returns the socket address for the current connection + * \return socket address of the connected host or NULL on failure, only valid if the + * connection is current connected + */ +ZOOAPI struct sockaddr* zookeeper_get_connected_host(zhandle_t *zh, + struct sockaddr *addr, socklen_t *addr_len); + +#ifndef THREADED +/** + * \brief Returns the events that zookeeper is interested in. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param fd is the file descriptor of interest + * \param interest is an or of the ZOOKEEPER_WRITE and ZOOKEEPER_READ flags to + * indicate the I/O of interest on fd. + * \param tv a timeout value to be used with select/poll system call + * \return a result code. + * ZOK - success + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZCONNECTIONLOSS - a network error occurred while attempting to establish + * a connection to the server + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + * ZOPERATIONTIMEOUT - hasn't received anything from the server for 2/3 of the + * timeout value specified in zookeeper_init() + * ZSYSTEMERROR -- a system (OS) error occurred; it's worth checking errno to get details + */ +#ifdef WIN32 +ZOOAPI int zookeeper_interest(zhandle_t *zh, SOCKET *fd, int *interest, + struct timeval *tv); +#else +ZOOAPI int zookeeper_interest(zhandle_t *zh, int *fd, int *interest, + struct timeval *tv); +#endif + +/** + * \brief Notifies zookeeper that an event of interest has happened. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param events will be an OR of the ZOOKEEPER_WRITE and ZOOKEEPER_READ flags. + * \return a result code. + * ZOK - success + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZCONNECTIONLOSS - a network error occurred while attempting to send request to server + * ZSESSIONEXPIRED - connection attempt failed -- the session's expired + * ZAUTHFAILED - authentication request failed, e.i. invalid credentials + * ZRUNTIMEINCONSISTENCY - a server response came out of order + * ZSYSTEMERROR -- a system (OS) error occurred; it's worth checking errno to get details + * ZNOTHING -- not an error; simply indicates that there no more data from the server + * to be processed (when called with ZOOKEEPER_READ flag). + */ +ZOOAPI int zookeeper_process(zhandle_t *zh, int events); +#endif + +/** + * \brief signature of a completion function for a call that returns void. + * + * This method will be invoked at the end of a asynchronous call and also as + * a result of connection loss or timeout. + * \param rc the error code of the call. Connection loss/timeout triggers + * the completion with one of the following error codes: + * ZCONNECTIONLOSS -- lost connection to the server + * ZOPERATIONTIMEOUT -- connection timed out + * Data related events trigger the completion with error codes listed the + * Exceptions section of the documentation of the function that initiated the + * call. (Zero indicates call was successful.) + * \param data the pointer that was passed by the caller when the function + * that this completion corresponds to was invoked. The programmer + * is responsible for any memory freeing associated with the data + * pointer. + */ +typedef void (*void_completion_t)(int rc, const void *data); + +/** + * \brief signature of a completion function that returns a Stat structure. + * + * This method will be invoked at the end of a asynchronous call and also as + * a result of connection loss or timeout. + * \param rc the error code of the call. Connection loss/timeout triggers + * the completion with one of the following error codes: + * ZCONNECTIONLOSS -- lost connection to the server + * ZOPERATIONTIMEOUT -- connection timed out + * Data related events trigger the completion with error codes listed the + * Exceptions section of the documentation of the function that initiated the + * call. (Zero indicates call was successful.) + * \param stat a pointer to the stat information for the node involved in + * this function. If a non zero error code is returned, the content of + * stat is undefined. The programmer is NOT responsible for freeing stat. + * \param data the pointer that was passed by the caller when the function + * that this completion corresponds to was invoked. The programmer + * is responsible for any memory freeing associated with the data + * pointer. + */ +typedef void (*stat_completion_t)(int rc, const struct Stat *stat, + const void *data); + +/** + * \brief signature of a completion function that returns data. + * + * This method will be invoked at the end of a asynchronous call and also as + * a result of connection loss or timeout. + * \param rc the error code of the call. Connection loss/timeout triggers + * the completion with one of the following error codes: + * ZCONNECTIONLOSS -- lost connection to the server + * ZOPERATIONTIMEOUT -- connection timed out + * Data related events trigger the completion with error codes listed the + * Exceptions section of the documentation of the function that initiated the + * call. (Zero indicates call was successful.) + * \param value the value of the information returned by the asynchronous call. + * If a non zero error code is returned, the content of value is undefined. + * The programmer is NOT responsible for freeing value. + * \param value_len the number of bytes in value. + * \param stat a pointer to the stat information for the node involved in + * this function. If a non zero error code is returned, the content of + * stat is undefined. The programmer is NOT responsible for freeing stat. + * \param data the pointer that was passed by the caller when the function + * that this completion corresponds to was invoked. The programmer + * is responsible for any memory freeing associated with the data + * pointer. + */ +typedef void (*data_completion_t)(int rc, const char *value, int value_len, + const struct Stat *stat, const void *data); + +/** + * \brief signature of a completion function that returns a list of strings. + * + * This method will be invoked at the end of a asynchronous call and also as + * a result of connection loss or timeout. + * \param rc the error code of the call. Connection loss/timeout triggers + * the completion with one of the following error codes: + * ZCONNECTIONLOSS -- lost connection to the server + * ZOPERATIONTIMEOUT -- connection timed out + * Data related events trigger the completion with error codes listed the + * Exceptions section of the documentation of the function that initiated the + * call. (Zero indicates call was successful.) + * \param strings a pointer to the structure containng the list of strings of the + * names of the children of a node. If a non zero error code is returned, + * the content of strings is undefined. The programmer is NOT responsible + * for freeing strings. + * \param data the pointer that was passed by the caller when the function + * that this completion corresponds to was invoked. The programmer + * is responsible for any memory freeing associated with the data + * pointer. + */ +typedef void (*strings_completion_t)(int rc, + const struct String_vector *strings, const void *data); + +/** + * \brief signature of a completion function that returns a string and stat. + * . + * + * This method will be invoked at the end of a asynchronous call and also as + * a result of connection loss or timeout. + * \param rc the error code of the call. Connection loss/timeout triggers + * the completion with one of the following error codes: + * ZCONNECTIONLOSS -- lost connection to the server + * ZOPERATIONTIMEOUT -- connection timed out + * Data related events trigger the completion with error codes listed the + * Exceptions section of the documentation of the function that initiated the + * call. (Zero indicates call was successful.) + * \param value the value of the string returned. + * \param stat a pointer to the stat information for the node involved in + * this function. If a non zero error code is returned, the content of + * stat is undefined. The programmer is NOT responsible for freeing stat. + * \param data the pointer that was passed by the caller when the function + * that this completion corresponds to was invoked. The programmer + * is responsible for any memory freeing associated with the data + * pointer. + */ +typedef void (*string_stat_completion_t)(int rc, + const char *string, const struct Stat *stat, const void *data); + +/** + * \brief signature of a completion function that returns a list of strings and stat. + * . + * + * This method will be invoked at the end of a asynchronous call and also as + * a result of connection loss or timeout. + * \param rc the error code of the call. Connection loss/timeout triggers + * the completion with one of the following error codes: + * ZCONNECTIONLOSS -- lost connection to the server + * ZOPERATIONTIMEOUT -- connection timed out + * Data related events trigger the completion with error codes listed the + * Exceptions section of the documentation of the function that initiated the + * call. (Zero indicates call was successful.) + * \param strings a pointer to the structure containng the list of strings of the + * names of the children of a node. If a non zero error code is returned, + * the content of strings is undefined. The programmer is NOT responsible + * for freeing strings. + * \param stat a pointer to the stat information for the node involved in + * this function. If a non zero error code is returned, the content of + * stat is undefined. The programmer is NOT responsible for freeing stat. + * \param data the pointer that was passed by the caller when the function + * that this completion corresponds to was invoked. The programmer + * is responsible for any memory freeing associated with the data + * pointer. + */ +typedef void (*strings_stat_completion_t)(int rc, + const struct String_vector *strings, const struct Stat *stat, + const void *data); + +/** + * \brief signature of a completion function that returns a list of strings. + * + * This method will be invoked at the end of a asynchronous call and also as + * a result of connection loss or timeout. + * \param rc the error code of the call. Connection loss/timeout triggers + * the completion with one of the following error codes: + * ZCONNECTIONLOSS -- lost connection to the server + * ZOPERATIONTIMEOUT -- connection timed out + * Data related events trigger the completion with error codes listed the + * Exceptions section of the documentation of the function that initiated the + * call. (Zero indicates call was successful.) + * \param value the value of the string returned. + * \param data the pointer that was passed by the caller when the function + * that this completion corresponds to was invoked. The programmer + * is responsible for any memory freeing associated with the data + * pointer. + */ +typedef void + (*string_completion_t)(int rc, const char *value, const void *data); + +/** + * \brief signature of a completion function that returns an ACL. + * + * This method will be invoked at the end of a asynchronous call and also as + * a result of connection loss or timeout. + * \param rc the error code of the call. Connection loss/timeout triggers + * the completion with one of the following error codes: + * ZCONNECTIONLOSS -- lost connection to the server + * ZOPERATIONTIMEOUT -- connection timed out + * Data related events trigger the completion with error codes listed the + * Exceptions section of the documentation of the function that initiated the + * call. (Zero indicates call was successful.) + * \param acl a pointer to the structure containng the ACL of a node. If a non + * zero error code is returned, the content of strings is undefined. The + * programmer is NOT responsible for freeing acl. + * \param stat a pointer to the stat information for the node involved in + * this function. If a non zero error code is returned, the content of + * stat is undefined. The programmer is NOT responsible for freeing stat. + * \param data the pointer that was passed by the caller when the function + * that this completion corresponds to was invoked. The programmer + * is responsible for any memory freeing associated with the data + * pointer. + */ +typedef void (*acl_completion_t)(int rc, struct ACL_vector *acl, + struct Stat *stat, const void *data); + +/** + * \brief get the state of the zookeeper connection. + * + * The return value will be one of the \ref State Consts. + */ +ZOOAPI int zoo_state(zhandle_t *zh); + +/** + * \brief create a node. + * + * This method will create a node in ZooKeeper. A node can only be created if + * it does not already exists. The Create Flags affect the creation of nodes. + * If ZOO_EPHEMERAL flag is set, the node will automatically get removed if the + * client session goes away. If the ZOO_SEQUENCE flag is set, a unique + * monotonically increasing sequence number is appended to the path name. The + * sequence number is always fixed length of 10 digits, 0 padded. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path The name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param value The data to be stored in the node. + * \param valuelen The number of bytes in data. + * \param acl The initial ACL of the node. The ACL must not be null or empty. + * \param flags this parameter can be set to 0 for normal create or an OR + * of the Create Flags + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the parent node does not exist. + * ZNODEEXISTS the node already exists + * ZNOAUTH the client does not have permission. + * ZNOCHILDRENFOREPHEMERALS cannot create children of ephemeral nodes. + * \param data The data that will be passed to the completion routine when the + * function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_acreate(zhandle_t *zh, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl, int flags, + string_completion_t completion, const void *data); + +/** + * \brief create a node asynchronously and returns stat details. + * + * This method will create a node in ZooKeeper. A node can only be created if + * it does not already exists. The Create Flags affect the creation of nodes. + * If ZOO_EPHEMERAL flag is set, the node will automatically get removed if the + * client session goes away. If the ZOO_SEQUENCE flag is set, a unique + * monotonically increasing sequence number is appended to the path name. The + * sequence number is always fixed length of 10 digits, 0 padded. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path The name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param value The data to be stored in the node. + * \param valuelen The number of bytes in data. + * \param acl The initial ACL of the node. The ACL must not be null or empty. + * \param flags this parameter can be set to 0 for normal create or an OR + * of the Create Flags + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the parent node does not exist. + * ZNODEEXISTS the node already exists + * ZNOAUTH the client does not have permission. + * ZNOCHILDRENFOREPHEMERALS cannot create children of ephemeral nodes. + * \param data The data that will be passed to the completion routine when the + * function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_acreate2(zhandle_t *zh, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl, int flags, + string_stat_completion_t completion, const void *data); + +/** + * \brief delete a node in zookeeper. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param version the expected version of the node. The function will fail if the + * actual version of the node does not match the expected version. + * If -1 is used the version check will not take place. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADVERSION expected version does not match actual version. + * ZNOTEMPTY children are present; node cannot be deleted. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_adelete(zhandle_t *zh, const char *path, int version, + void_completion_t completion, const void *data); + +/** + * \brief checks the existence of a node in zookeeper. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watch if nonzero, a watch will be set at the server to notify the + * client if the node changes. The watch will be set even if the node does not + * exist. This allows clients to watch for nodes to appear. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when the + * function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_aexists(zhandle_t *zh, const char *path, int watch, + stat_completion_t completion, const void *data); + +/** + * \brief checks the existence of a node in zookeeper. + * + * This function is similar to \ref zoo_axists except it allows one specify + * a watcher object - a function pointer and associated context. The function + * will be called once the watch has fired. The associated context data will be + * passed to the function as the watcher context parameter. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watcher if non-null a watch will set on the specified znode on the server. + * The watch will be set even if the node does not exist. This allows clients + * to watch for nodes to appear. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when the + * function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_awexists(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + stat_completion_t completion, const void *data); + +/** + * \brief gets the data associated with a node. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watch if nonzero, a watch will be set at the server to notify + * the client if the node changes. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_aget(zhandle_t *zh, const char *path, int watch, + data_completion_t completion, const void *data); + +/** + * \brief gets the data associated with a node. + * + * This function is similar to \ref zoo_aget except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watcher if non-null, a watch will be set at the server to notify + * the client if the node changes. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_awget(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + data_completion_t completion, const void *data); + +/** + * \brief gets the last committed configuration of the ZooKeeper cluster as it is known to + * the server to which the client is connected. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param watch if nonzero, a watch will be set at the server to notify + * the client if the configuration changes. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the configuration node (/zookeeper/config) does not exist. + * ZNOAUTH the client does not have permission to access the configuration node. + * \param data the configuration data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_agetconfig(zhandle_t *zh, int watch, + data_completion_t completion, const void *data); + +/** + * \brief gets the last committed configuration of the ZooKeeper cluster as it is known to + * the server to which the client is connected. + * + * This function is similar to \ref zoo_agetconfig except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param watcher if non-null, a watch will be set at the server to notify + * the client if the node changes. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the configuration node (/zookeeper/config) does not exist. + * ZNOAUTH the client does not have permission to access the configuration node. + * \param data the configuration data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_awgetconfig(zhandle_t *zh, watcher_fn watcher, void* watcherCtx, + data_completion_t completion, const void *data); + +/** + * \brief asynchronous reconfiguration interface - allows changing ZK cluster + * ensemble membership and roles of ensemble peers. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param joining - comma separated list of servers to be added to the ensemble. + * Each has a configuration line for a server to be added (as would appear in a + * configuration file), only for maj. quorums. NULL for non-incremental reconfiguration. + * \param leaving - comma separated list of server IDs to be removed from the ensemble. + * Each has an id of a server to be removed, only for maj. quorums. NULL for + * non-incremental reconfiguration. + * \param members - comma separated list of new membership (e.g., contents of a + * membership configuration file) - for use only with a non-incremental + * reconfiguration. NULL for incremental reconfiguration. + * \param version - version of config from which we want to reconfigure - if + * current config is different reconfiguration will fail. Should be -1 to disable + * this option. + * \param completion - the routine to invoke when the request completes. The + * completion will be triggered with one of the following codes passed in as the + * rc argument: + * ZOK operation completed successfully + * \param data the configuration data that will be passed to the completion routine + * when the function completes. + * \return return value of the function call. + * ZOK operation completed successfully + * ZBADARGUMENTS - invalid input parameters (one case when this is returned is + * when the new config has less than 2 servers) + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + * ZNEWCONFIGNOQUORUM - no quorum of new config is connected and up-to-date with + * the leader of last committed config - try invoking reconfiguration after new servers are connected and synced + * ZRECONFIGINPROGRESS - another reconfig is currently in progress + */ +ZOOAPI int zoo_areconfig(zhandle_t *zh, const char *joining, const char *leaving, + const char *members, int64_t version, data_completion_t dc, const void *data); + +/** + * \brief sets the data associated with a node. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param buffer the buffer holding data to be written to the node. + * \param buflen the number of bytes from buffer to write. + * \param version the expected version of the node. The function will fail if + * the actual version of the node does not match the expected version. If -1 is + * used the version check will not take place. * completion: If null, + * the function will execute synchronously. Otherwise, the function will return + * immediately and invoke the completion routine when the request completes. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADVERSION expected version does not match actual version. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_aset(zhandle_t *zh, const char *path, const char *buffer, int buflen, + int version, stat_completion_t completion, const void *data); + +/** + * \brief lists the children of a node. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watch if nonzero, a watch will be set at the server to notify + * the client if the node changes. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_aget_children(zhandle_t *zh, const char *path, int watch, + strings_completion_t completion, const void *data); + +/** + * \brief lists the children of a node. + * + * This function is similar to \ref zoo_aget_children except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watcher if non-null, a watch will be set at the server to notify + * the client if the node changes. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_awget_children(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + strings_completion_t completion, const void *data); + +/** + * \brief lists the children of a node, and get the parent stat. + * + * This function is new in version 3.3.0 + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watch if nonzero, a watch will be set at the server to notify + * the client if the node changes. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_aget_children2(zhandle_t *zh, const char *path, int watch, + strings_stat_completion_t completion, const void *data); + +/** + * \brief lists the children of a node, and get the parent stat. + * + * This function is similar to \ref zoo_aget_children2 except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * This function is new in version 3.3.0 + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watcher if non-null, a watch will be set at the server to notify + * the client if the node changes. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_awget_children2(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + strings_stat_completion_t completion, const void *data); + +/** + * \brief Flush leader channel. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ + +ZOOAPI int zoo_async(zhandle_t *zh, const char *path, + string_completion_t completion, const void *data); + + +/** + * \brief gets the acl associated with a node. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_aget_acl(zhandle_t *zh, const char *path, acl_completion_t completion, + const void *data); + +/** + * \brief sets the acl associated with a node. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param buffer the buffer holding the acls to be written to the node. + * \param buflen the number of bytes from buffer to write. + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with one of the following codes passed in as the rc argument: + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZINVALIDACL invalid ACL specified + * ZBADVERSION expected version does not match actual version. + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_aset_acl(zhandle_t *zh, const char *path, int version, + struct ACL_vector *acl, void_completion_t, const void *data); + +/** + * \brief atomically commits multiple zookeeper operations. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param count the number of operations + * \param ops an array of operations to commit + * \param results an array to hold the results of the operations + * \param completion the routine to invoke when the request completes. The completion + * will be triggered with any of the error codes that can that can be returned by the + * ops supported by a multi op (see \ref zoo_acreate, \ref zoo_adelete, \ref zoo_aset). + * \param data the data that will be passed to the completion routine when + * the function completes. + * \return the return code for the function call. This can be any of the + * values that can be returned by the ops supported by a multi op (see + * \ref zoo_acreate, \ref zoo_adelete, \ref zoo_aset). + */ +ZOOAPI int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops, + zoo_op_result_t *results, void_completion_t, const void *data); + +/** + * \brief return an error string. + * + * \param return code + * \return string corresponding to the return code + */ +ZOOAPI const char* zerror(int c); + +/** + * \brief specify application credentials. + * + * The application calls this function to specify its credentials for purposes + * of authentication. The server will use the security provider specified by + * the scheme parameter to authenticate the client connection. If the + * authentication request has failed: + * - the server connection is dropped + * - the watcher is called with the ZOO_AUTH_FAILED_STATE value as the state + * parameter. + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param scheme the id of authentication scheme. Natively supported: + * "digest" password-based authentication + * \param cert application credentials. The actual value depends on the scheme. + * \param certLen the length of the data parameter + * \param completion the routine to invoke when the request completes. One of + * the following result codes may be passed into the completion callback: + * ZOK operation completed successfully + * ZAUTHFAILED authentication failed + * \param data the data that will be passed to the completion routine when the + * function completes. + * \return ZOK on success or one of the following errcodes on failure: + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + * ZSYSTEMERROR - a system error occurred + */ +ZOOAPI int zoo_add_auth(zhandle_t *zh,const char* scheme,const char* cert, + int certLen, void_completion_t completion, const void *data); + +/** + * \brief checks if the current zookeeper connection state can't be recovered. + * + * The application must close the zhandle and try to reconnect. + * + * \param zh the zookeeper handle (see \ref zookeeper_init) + * \return ZINVALIDSTATE if connection is unrecoverable + */ +ZOOAPI int is_unrecoverable(zhandle_t *zh); + +/** + * \brief sets the debugging level for the library + */ +ZOOAPI void zoo_set_debug_level(ZooLogLevel logLevel); + +/** + * \brief sets the stream to be used by the library for logging + * + * The zookeeper library uses stderr as its default log stream. Application + * must make sure the stream is writable. Passing in NULL resets the stream + * to its default value (stderr). + */ +ZOOAPI void zoo_set_log_stream(FILE* logStream); + +/** + * \brief gets the callback to be used by this connection for logging. + * + * This is a per-connection logging mechanism that will take priority over + * the library-wide default log stream. That is, zookeeper library will first + * try to use a per-connection callback if available and if not, will fallback + * to using the logging stream. Passing in NULL resets the callback and will + * cause it to then fallback to using the logging stream as described in \ref + * zoo_set_log_stream. + */ +ZOOAPI log_callback_fn zoo_get_log_callback(const zhandle_t *zh); + +/** + * \brief sets the callback to be used by the library for logging + * + * Setting this callback has the effect of overriding the default log stream. + * Zookeeper will first try to use a per-connection callback if available + * and if not, will fallback to using the logging stream. Passing in NULL + * resets the callback and will cause it to then fallback to using the logging + * stream as described in \ref zoo_set_log_stream. + * + * Note: The provided callback will be invoked by multiple threads and therefore + * it needs to be thread-safe. + */ +ZOOAPI void zoo_set_log_callback(zhandle_t *zh, log_callback_fn callback); + +/** + * \brief enable/disable quorum endpoint order randomization + * + * Note: typically this method should NOT be used outside of testing. + * + * If passed a non-zero value, will make the client connect to quorum peers + * in the order as specified in the zookeeper_init() call. + * A zero value causes zookeeper_init() to permute the peer endpoints + * which is good for more even client connection distribution among the + * quorum peers. + */ +ZOOAPI void zoo_deterministic_conn_order(int yesOrNo); + +/** + * Type of watchers: used to select which type of watchers should be removed + */ +typedef enum { + ZWATCHERTYPE_CHILDREN = 1, + ZWATCHERTYPE_DATA = 2, + ZWATCHERTYPE_ANY = 3 +} ZooWatcherType; + +/** + * \brief removes the watchers for the given path and watcher type. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the path for which watchers will be removed + * \param wtype the watcher type to be removed + * \param watcher the watcher to be removed, if null all watchers for that + * path (and watcher type) will be removed + * \param watcherCtx the contex associated with the watcher to be removed + * \param local whether the watchers will be removed locally even if there is + * no server connection + * \return the return code for the function call. + * ZOK - operation completed successfully + * ZNOWATCHER - the watcher couldn't be found. + * ZINVALIDSTATE - if !local, zhandle state is either ZOO_SESSION_EXPIRED_STATE + * or ZOO_AUTH_FAILED_STATE + * ZBADARGUMENTS - invalid input parameters + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + * ZSYSTEMERROR - a system error occured + */ +ZOOAPI int zoo_aremove_watchers(zhandle_t *zh, const char *path, + ZooWatcherType wtype, watcher_fn watcher, void *watcherCtx, int local, + void_completion_t *completion, const void *data); + + +#ifdef THREADED +/** + * \brief create a node synchronously. + * + * This method will create a node in ZooKeeper. A node can only be created if + * it does not already exists. The Create Flags affect the creation of nodes. + * If ZOO_EPHEMERAL flag is set, the node will automatically get removed if the + * client session goes away. If the ZOO_SEQUENCE flag is set, a unique + * monotonically increasing sequence number is appended to the path name. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path The name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param value The data to be stored in the node. + * \param valuelen The number of bytes in data. To set the data to be NULL use + * value as NULL and valuelen as -1. + * \param acl The initial ACL of the node. The ACL must not be null or empty. + * \param flags this parameter can be set to 0 for normal create or an OR + * of the Create Flags + * \param path_buffer Buffer which will be filled with the path of the + * new node (this might be different than the supplied path + * because of the ZOO_SEQUENCE flag). The path string will always be + * null-terminated. This parameter may be NULL if path_buffer_len = 0. + * \param path_buffer_len Size of path buffer; if the path of the new + * node (including space for the null terminator) exceeds the buffer size, + * the path string will be truncated to fit. The actual path of the + * new node in the server will not be affected by the truncation. + * The path string will always be null-terminated. + * \return one of the following codes are returned: + * ZOK operation completed successfully + * ZNONODE the parent node does not exist. + * ZNODEEXISTS the node already exists + * ZNOAUTH the client does not have permission. + * ZNOCHILDRENFOREPHEMERALS cannot create children of ephemeral nodes. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_create(zhandle_t *zh, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl, int flags, + char *path_buffer, int path_buffer_len); + +/** + * \brief create a node synchronously and collect stat details. + * + * This method will create a node in ZooKeeper. A node can only be created if + * it does not already exists. The Create Flags affect the creation of nodes. + * If ZOO_EPHEMERAL flag is set, the node will automatically get removed if the + * client session goes away. If the ZOO_SEQUENCE flag is set, a unique + * monotonically increasing sequence number is appended to the path name. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path The name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param value The data to be stored in the node. + * \param valuelen The number of bytes in data. To set the data to be NULL use + * value as NULL and valuelen as -1. + * \param acl The initial ACL of the node. The ACL must not be null or empty. + * \param flags this parameter can be set to 0 for normal create or an OR + * of the Create Flags + * \param path_buffer Buffer which will be filled with the path of the + * new node (this might be different than the supplied path + * because of the ZOO_SEQUENCE flag). The path string will always be + * null-terminated. This parameter may be NULL if path_buffer_len = 0. + * \param path_buffer_len Size of path buffer; if the path of the new + * node (including space for the null terminator) exceeds the buffer size, + * the path string will be truncated to fit. The actual path of the + * new node in the server will not be affected by the truncation. + * The path string will always be null-terminated. + * \param stat The Stat struct to store Stat info into. + * \return one of the following codes are returned: + * ZOK operation completed successfully + * ZNONODE the parent node does not exist. + * ZNODEEXISTS the node already exists + * ZNOAUTH the client does not have permission. + * ZNOCHILDRENFOREPHEMERALS cannot create children of ephemeral nodes. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_create2(zhandle_t *zh, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl, int flags, + char *path_buffer, int path_buffer_len, struct Stat *stat); + +/** + * \brief delete a node in zookeeper synchronously. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param version the expected version of the node. The function will fail if the + * actual version of the node does not match the expected version. + * If -1 is used the version check will not take place. + * \return one of the following values is returned. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADVERSION expected version does not match actual version. + * ZNOTEMPTY children are present; node cannot be deleted. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_delete(zhandle_t *zh, const char *path, int version); + + +/** + * \brief checks the existence of a node in zookeeper synchronously. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watch if nonzero, a watch will be set at the server to notify the + * client if the node changes. The watch will be set even if the node does not + * exist. This allows clients to watch for nodes to appear. + * \param the return stat value of the node. + * \return return code of the function call. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_exists(zhandle_t *zh, const char *path, int watch, struct Stat *stat); + +/** + * \brief checks the existence of a node in zookeeper synchronously. + * + * This function is similar to \ref zoo_exists except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watcher if non-null a watch will set on the specified znode on the server. + * The watch will be set even if the node does not exist. This allows clients + * to watch for nodes to appear. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param the return stat value of the node. + * \return return code of the function call. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_wexists(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, struct Stat *stat); + +/** + * \brief gets the data associated with a node synchronously. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watch if nonzero, a watch will be set at the server to notify + * the client if the node changes. + * \param buffer the buffer holding the node data returned by the server + * \param buffer_len is the size of the buffer pointed to by the buffer parameter. + * It'll be set to the actual data length upon return. If the data is NULL, length is -1. + * \param stat if not NULL, will hold the value of stat for the path on return. + * \return return value of the function call. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_get(zhandle_t *zh, const char *path, int watch, char *buffer, + int* buffer_len, struct Stat *stat); +/** + * \brief gets the data associated with a node synchronously. + * + * This function is similar to \ref zoo_get except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watcher if non-null, a watch will be set at the server to notify + * the client if the node changes. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param buffer the buffer holding the node data returned by the server + * \param buffer_len is the size of the buffer pointed to by the buffer parameter. + * It'll be set to the actual data length upon return. If the data is NULL, length is -1. + * \param stat if not NULL, will hold the value of stat for the path on return. + * \return return value of the function call. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_wget(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + char *buffer, int* buffer_len, struct Stat *stat); + +/** + * \brief gets the last committed configuration of the ZooKeeper cluster as it is known to + * the server to which the client is connected, synchronously. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param watch if nonzero, a watch will be set at the server to notify + * the client if the node changes. + * \param buffer the buffer holding the configuration data returned by the server + * \param buffer_len is the size of the buffer pointed to by the buffer parameter. + * It'll be set to the actual data length upon return. If the data is NULL, length is -1. + * \param stat if not NULL, will hold the value of stat for the path on return. + * \return return value of the function call. + * ZOK operation completed successfully + * ZNONODE the configuration node (/zookeeper/config) does not exist. + * ZNOAUTH the client does not have permission to access the configuration node. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_getconfig(zhandle_t *zh, int watch, char *buffer, + int* buffer_len, struct Stat *stat); + +/** + * \brief gets the last committed configuration of the ZooKeeper cluster as it is known to + * the server to which the client is connected, synchronously. + * + * This function is similar to \ref zoo_getconfig except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param watcher if non-null, a watch will be set at the server to notify + * the client if the node changes. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param buffer the buffer holding the configuration data returned by the server + * \param buffer_len is the size of the buffer pointed to by the buffer parameter. + * It'll be set to the actual data length upon return. If the data is NULL, length is -1. + * \param stat if not NULL, will hold the value of stat for the path on return. + * \return return value of the function call. + * ZOK operation completed successfully + * ZNONODE the configuration node (/zookeeper/config) does not exist. + * ZNOAUTH the client does not have permission to access the configuration node. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_wgetconfig(zhandle_t *zh, watcher_fn watcher, void* watcherCtx, + char *buffer, int* buffer_len, struct Stat *stat); + +/** + * \brief synchronous reconfiguration interface - allows changing ZK cluster + * ensemble membership and roles of ensemble peers. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param joining - comma separated list of servers to be added to the ensemble. + * Each has a configuration line for a server to be added (as would appear in a + * configuration file), only for maj. quorums. NULL for non-incremental reconfiguration. + * \param leaving - comma separated list of server IDs to be removed from the ensemble. + * Each has an id of a server to be removed, only for maj. quorums. NULL for + * non-incremental reconfiguration. + * \param members - comma separated list of new membership (e.g., contents of a + * membership configuration file) - for use only with a non-incremental + * reconfiguration. NULL for incremental reconfiguration. + * \param version - zxid of config from which we want to reconfigure - if + * current config is different reconfiguration will fail. Should be -1 to + * disable this option. + * \param buffer the buffer holding the configuration data returned by the server + * \param buffer_len is the size of the buffer pointed to by the buffer parameter. + * It'll be set to the actual data length upon return. If the data is NULL, length + * is -1. + * \param stat if not NULL, will hold the value of stat for the path on return. + * \return return value of the function call. + * ZOK operation completed successfully + * ZBADARGUMENTS - invalid input parameters (one case when this is returned is + * when the new config has less than 2 servers) + * ZINVALIDSTATE - zhandle state is either in ZOO_SESSION_EXPIRED_STATE or + * ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + * ZNEWCONFIGNOQUORUM - no quorum of new config is connected and up-to-date with + * the leader of last committed config - try invoking reconfiguration after new + * servers are connected and synced + * ZRECONFIGINPROGRESS - another reconfig is currently in progress + */ +ZOOAPI int zoo_reconfig(zhandle_t *zh, const char *joining, const char *leaving, + const char *members, int64_t version, char *buffer, int* buffer_len, + struct Stat *stat); + +/** + * \brief sets the data associated with a node. See zoo_set2 function if + * you require access to the stat information associated with the znode. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param buffer the buffer holding data to be written to the node. + * \param buflen the number of bytes from buffer to write. To set NULL as data + * use buffer as NULL and buflen as -1. + * \param version the expected version of the node. The function will fail if + * the actual version of the node does not match the expected version. If -1 is + * used the version check will not take place. + * \return the return code for the function call. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADVERSION expected version does not match actual version. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_set(zhandle_t *zh, const char *path, const char *buffer, + int buflen, int version); + +/** + * \brief sets the data associated with a node. This function is the same + * as zoo_set except that it also provides access to stat information + * associated with the znode. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param buffer the buffer holding data to be written to the node. + * \param buflen the number of bytes from buffer to write. To set NULL as data + * use buffer as NULL and buflen as -1. + * \param version the expected version of the node. The function will fail if + * the actual version of the node does not match the expected version. If -1 is + * used the version check will not take place. + * \param stat if not NULL, will hold the value of stat for the path on return. + * \return the return code for the function call. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADVERSION expected version does not match actual version. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_set2(zhandle_t *zh, const char *path, const char *buffer, + int buflen, int version, struct Stat *stat); + +/** + * \brief lists the children of a node synchronously. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watch if nonzero, a watch will be set at the server to notify + * the client if the node changes. + * \param strings return value of children paths. + * \return the return code of the function. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_get_children(zhandle_t *zh, const char *path, int watch, + struct String_vector *strings); + +/** + * \brief lists the children of a node synchronously. + * + * This function is similar to \ref zoo_get_children except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watcher if non-null, a watch will be set at the server to notify + * the client if the node changes. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param strings return value of children paths. + * \return the return code of the function. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_wget_children(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + struct String_vector *strings); + +/** + * \brief lists the children of a node and get its stat synchronously. + * + * This function is new in version 3.3.0 + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watch if nonzero, a watch will be set at the server to notify + * the client if the node changes. + * \param strings return value of children paths. + * \param stat return value of node stat. + * \return the return code of the function. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_get_children2(zhandle_t *zh, const char *path, int watch, + struct String_vector *strings, struct Stat *stat); + +/** + * \brief lists the children of a node and get its stat synchronously. + * + * This function is similar to \ref zoo_get_children except it allows one specify + * a watcher object rather than a boolean watch flag. + * + * This function is new in version 3.3.0 + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param watcher if non-null, a watch will be set at the server to notify + * the client if the node changes. + * \param watcherCtx user specific data, will be passed to the watcher callback. + * Unlike the global context set by \ref zookeeper_init, this watcher context + * is associated with the given instance of the watcher only. + * \param strings return value of children paths. + * \param stat return value of node stat. + * \return the return code of the function. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_wget_children2(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + struct String_vector *strings, struct Stat *stat); + +/** + * \brief gets the acl associated with a node synchronously. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param acl the return value of acls on the path. + * \param stat returns the stat of the path specified. + * \return the return code for the function call. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_get_acl(zhandle_t *zh, const char *path, struct ACL_vector *acl, + struct Stat *stat); + +/** + * \brief sets the acl associated with a node synchronously. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the name of the node. Expressed as a file name with slashes + * separating ancestors of the node. + * \param version the expected version of the path. + * \param acl the acl to be set on the path. + * \return the return code for the function call. + * ZOK operation completed successfully + * ZNONODE the node does not exist. + * ZNOAUTH the client does not have permission. + * ZINVALIDACL invalid ACL specified + * ZBADVERSION expected version does not match actual version. + * ZBADARGUMENTS - invalid input parameters + * ZINVALIDSTATE - zhandle state is either ZOO_SESSION_EXPIRED_STATE or ZOO_AUTH_FAILED_STATE + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + */ +ZOOAPI int zoo_set_acl(zhandle_t *zh, const char *path, int version, + const struct ACL_vector *acl); + +/** + * \brief atomically commits multiple zookeeper operations synchronously. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param count the number of operations + * \param ops an array of operations to commit + * \param results an array to hold the results of the operations + * \return the return code for the function call. This can be any of the + * values that can be returned by the ops supported by a multi op (see + * \ref zoo_acreate, \ref zoo_adelete, \ref zoo_aset). + */ +ZOOAPI int zoo_multi(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results); + +/** + * \brief removes the watchers for the given path and watcher type. + * + * \param zh the zookeeper handle obtained by a call to \ref zookeeper_init + * \param path the path for which watchers will be removed + * \param wtype the watcher type to be removed + * \param watcher the watcher to be removed, if null all watchers for that + * path (and watcher type) will be removed + * \param watcherCtx the contex associated with the watcher to be removed + * \param local whether the watchers will be removed locally even if there is + * no server connection + * \return the return code for the function call. + * ZOK - operation completed successfully + * ZNOWATCHER - the watcher couldn't be found. + * ZINVALIDSTATE - if !local, zhandle state is either ZOO_SESSION_EXPIRED_STATE + * or ZOO_AUTH_FAILED_STATE + * ZBADARGUMENTS - invalid input parameters + * ZMARSHALLINGERROR - failed to marshall a request; possibly, out of memory + * ZSYSTEMERROR - a system error occured + */ +ZOOAPI int zoo_remove_watchers(zhandle_t *zh, const char *path, + ZooWatcherType wtype, watcher_fn watcher, void *watcherCtx, int local); +#endif +#ifdef __cplusplus +} +#endif + +#endif /*ZOOKEEPER_H_*/ diff --git a/ThirdLib/thirdparty/zookeeper/include/zookeeper.jute.c b/ThirdLib/thirdparty/zookeeper/include/zookeeper.jute.c new file mode 100644 index 000000000..68f381811 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/zookeeper.jute.c @@ -0,0 +1,1470 @@ +/** +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include +#include "zookeeper.jute.h" + +int serialize_Id(struct oarchive *out, const char *tag, struct Id *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "scheme", &v->scheme); + rc = rc ? rc : out->serialize_String(out, "id", &v->id); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_Id(struct iarchive *in, const char *tag, struct Id*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "scheme", &v->scheme); + rc = rc ? rc : in->deserialize_String(in, "id", &v->id); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_Id(struct Id*v){ + deallocate_String(&v->scheme); + deallocate_String(&v->id); +} +int serialize_ACL(struct oarchive *out, const char *tag, struct ACL *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "perms", &v->perms); + rc = rc ? rc : serialize_Id(out, "id", &v->id); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ACL(struct iarchive *in, const char *tag, struct ACL*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "perms", &v->perms); + rc = rc ? rc : deserialize_Id(in, "id", &v->id); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ACL(struct ACL*v){ + deallocate_Id(&v->id); +} +int serialize_Stat(struct oarchive *out, const char *tag, struct Stat *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Long(out, "czxid", &v->czxid); + rc = rc ? rc : out->serialize_Long(out, "mzxid", &v->mzxid); + rc = rc ? rc : out->serialize_Long(out, "ctime", &v->ctime); + rc = rc ? rc : out->serialize_Long(out, "mtime", &v->mtime); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->serialize_Int(out, "cversion", &v->cversion); + rc = rc ? rc : out->serialize_Int(out, "aversion", &v->aversion); + rc = rc ? rc : out->serialize_Long(out, "ephemeralOwner", &v->ephemeralOwner); + rc = rc ? rc : out->serialize_Int(out, "dataLength", &v->dataLength); + rc = rc ? rc : out->serialize_Int(out, "numChildren", &v->numChildren); + rc = rc ? rc : out->serialize_Long(out, "pzxid", &v->pzxid); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_Stat(struct iarchive *in, const char *tag, struct Stat*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Long(in, "czxid", &v->czxid); + rc = rc ? rc : in->deserialize_Long(in, "mzxid", &v->mzxid); + rc = rc ? rc : in->deserialize_Long(in, "ctime", &v->ctime); + rc = rc ? rc : in->deserialize_Long(in, "mtime", &v->mtime); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->deserialize_Int(in, "cversion", &v->cversion); + rc = rc ? rc : in->deserialize_Int(in, "aversion", &v->aversion); + rc = rc ? rc : in->deserialize_Long(in, "ephemeralOwner", &v->ephemeralOwner); + rc = rc ? rc : in->deserialize_Int(in, "dataLength", &v->dataLength); + rc = rc ? rc : in->deserialize_Int(in, "numChildren", &v->numChildren); + rc = rc ? rc : in->deserialize_Long(in, "pzxid", &v->pzxid); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_Stat(struct Stat*v){ +} +int serialize_StatPersisted(struct oarchive *out, const char *tag, struct StatPersisted *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Long(out, "czxid", &v->czxid); + rc = rc ? rc : out->serialize_Long(out, "mzxid", &v->mzxid); + rc = rc ? rc : out->serialize_Long(out, "ctime", &v->ctime); + rc = rc ? rc : out->serialize_Long(out, "mtime", &v->mtime); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->serialize_Int(out, "cversion", &v->cversion); + rc = rc ? rc : out->serialize_Int(out, "aversion", &v->aversion); + rc = rc ? rc : out->serialize_Long(out, "ephemeralOwner", &v->ephemeralOwner); + rc = rc ? rc : out->serialize_Long(out, "pzxid", &v->pzxid); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_StatPersisted(struct iarchive *in, const char *tag, struct StatPersisted*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Long(in, "czxid", &v->czxid); + rc = rc ? rc : in->deserialize_Long(in, "mzxid", &v->mzxid); + rc = rc ? rc : in->deserialize_Long(in, "ctime", &v->ctime); + rc = rc ? rc : in->deserialize_Long(in, "mtime", &v->mtime); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->deserialize_Int(in, "cversion", &v->cversion); + rc = rc ? rc : in->deserialize_Int(in, "aversion", &v->aversion); + rc = rc ? rc : in->deserialize_Long(in, "ephemeralOwner", &v->ephemeralOwner); + rc = rc ? rc : in->deserialize_Long(in, "pzxid", &v->pzxid); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_StatPersisted(struct StatPersisted*v){ +} +int serialize_ConnectRequest(struct oarchive *out, const char *tag, struct ConnectRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "protocolVersion", &v->protocolVersion); + rc = rc ? rc : out->serialize_Long(out, "lastZxidSeen", &v->lastZxidSeen); + rc = rc ? rc : out->serialize_Int(out, "timeOut", &v->timeOut); + rc = rc ? rc : out->serialize_Long(out, "sessionId", &v->sessionId); + rc = rc ? rc : out->serialize_Buffer(out, "passwd", &v->passwd); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ConnectRequest(struct iarchive *in, const char *tag, struct ConnectRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "protocolVersion", &v->protocolVersion); + rc = rc ? rc : in->deserialize_Long(in, "lastZxidSeen", &v->lastZxidSeen); + rc = rc ? rc : in->deserialize_Int(in, "timeOut", &v->timeOut); + rc = rc ? rc : in->deserialize_Long(in, "sessionId", &v->sessionId); + rc = rc ? rc : in->deserialize_Buffer(in, "passwd", &v->passwd); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ConnectRequest(struct ConnectRequest*v){ + deallocate_Buffer(&v->passwd); +} +int serialize_ConnectResponse(struct oarchive *out, const char *tag, struct ConnectResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "protocolVersion", &v->protocolVersion); + rc = rc ? rc : out->serialize_Int(out, "timeOut", &v->timeOut); + rc = rc ? rc : out->serialize_Long(out, "sessionId", &v->sessionId); + rc = rc ? rc : out->serialize_Buffer(out, "passwd", &v->passwd); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ConnectResponse(struct iarchive *in, const char *tag, struct ConnectResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "protocolVersion", &v->protocolVersion); + rc = rc ? rc : in->deserialize_Int(in, "timeOut", &v->timeOut); + rc = rc ? rc : in->deserialize_Long(in, "sessionId", &v->sessionId); + rc = rc ? rc : in->deserialize_Buffer(in, "passwd", &v->passwd); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ConnectResponse(struct ConnectResponse*v){ + deallocate_Buffer(&v->passwd); +} +int allocate_String_vector(struct String_vector *v, int32_t len) { + if (!len) { + v->count = 0; + v->data = 0; + } else { + v->count = len; + v->data = calloc(sizeof(*v->data), len); + } + return 0; +} +int deallocate_String_vector(struct String_vector *v) { + if (v->data) { + int32_t i; + for(i=0;icount; i++) { + deallocate_String(&v->data[i]); + } + free(v->data); + v->data = 0; + } + return 0; +} +int serialize_String_vector(struct oarchive *out, const char *tag, struct String_vector *v) +{ + int32_t count = v->count; + int rc = 0; + int32_t i; + rc = out->start_vector(out, tag, &count); + for(i=0;icount;i++) { + rc = rc ? rc : out->serialize_String(out, "data", &v->data[i]); + } + rc = rc ? rc : out->end_vector(out, tag); + return rc; +} +int deserialize_String_vector(struct iarchive *in, const char *tag, struct String_vector *v) +{ + int rc = 0; + int32_t i; + rc = in->start_vector(in, tag, &v->count); + v->data = calloc(v->count, sizeof(*v->data)); + for(i=0;icount;i++) { + rc = rc ? rc : in->deserialize_String(in, "value", &v->data[i]); + } + rc = in->end_vector(in, tag); + return rc; +} +int serialize_SetWatches(struct oarchive *out, const char *tag, struct SetWatches *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Long(out, "relativeZxid", &v->relativeZxid); + rc = rc ? rc : serialize_String_vector(out, "dataWatches", &v->dataWatches); + rc = rc ? rc : serialize_String_vector(out, "existWatches", &v->existWatches); + rc = rc ? rc : serialize_String_vector(out, "childWatches", &v->childWatches); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetWatches(struct iarchive *in, const char *tag, struct SetWatches*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Long(in, "relativeZxid", &v->relativeZxid); + rc = rc ? rc : deserialize_String_vector(in, "dataWatches", &v->dataWatches); + rc = rc ? rc : deserialize_String_vector(in, "existWatches", &v->existWatches); + rc = rc ? rc : deserialize_String_vector(in, "childWatches", &v->childWatches); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetWatches(struct SetWatches*v){ + deallocate_String_vector(&v->dataWatches); + deallocate_String_vector(&v->existWatches); + deallocate_String_vector(&v->childWatches); +} +int serialize_RequestHeader(struct oarchive *out, const char *tag, struct RequestHeader *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "xid", &v->xid); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_RequestHeader(struct iarchive *in, const char *tag, struct RequestHeader*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "xid", &v->xid); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_RequestHeader(struct RequestHeader*v){ +} +int serialize_MultiHeader(struct oarchive *out, const char *tag, struct MultiHeader *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->serialize_Bool(out, "done", &v->done); + rc = rc ? rc : out->serialize_Int(out, "err", &v->err); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_MultiHeader(struct iarchive *in, const char *tag, struct MultiHeader*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->deserialize_Bool(in, "done", &v->done); + rc = rc ? rc : in->deserialize_Int(in, "err", &v->err); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_MultiHeader(struct MultiHeader*v){ +} +int serialize_AuthPacket(struct oarchive *out, const char *tag, struct AuthPacket *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->serialize_String(out, "scheme", &v->scheme); + rc = rc ? rc : out->serialize_Buffer(out, "auth", &v->auth); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_AuthPacket(struct iarchive *in, const char *tag, struct AuthPacket*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->deserialize_String(in, "scheme", &v->scheme); + rc = rc ? rc : in->deserialize_Buffer(in, "auth", &v->auth); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_AuthPacket(struct AuthPacket*v){ + deallocate_String(&v->scheme); + deallocate_Buffer(&v->auth); +} +int serialize_ReplyHeader(struct oarchive *out, const char *tag, struct ReplyHeader *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "xid", &v->xid); + rc = rc ? rc : out->serialize_Long(out, "zxid", &v->zxid); + rc = rc ? rc : out->serialize_Int(out, "err", &v->err); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ReplyHeader(struct iarchive *in, const char *tag, struct ReplyHeader*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "xid", &v->xid); + rc = rc ? rc : in->deserialize_Long(in, "zxid", &v->zxid); + rc = rc ? rc : in->deserialize_Int(in, "err", &v->err); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ReplyHeader(struct ReplyHeader*v){ +} +int serialize_GetDataRequest(struct oarchive *out, const char *tag, struct GetDataRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Bool(out, "watch", &v->watch); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetDataRequest(struct iarchive *in, const char *tag, struct GetDataRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Bool(in, "watch", &v->watch); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetDataRequest(struct GetDataRequest*v){ + deallocate_String(&v->path); +} +int serialize_SetDataRequest(struct oarchive *out, const char *tag, struct SetDataRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetDataRequest(struct iarchive *in, const char *tag, struct SetDataRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetDataRequest(struct SetDataRequest*v){ + deallocate_String(&v->path); + deallocate_Buffer(&v->data); +} +int serialize_ReconfigRequest(struct oarchive *out, const char *tag, struct ReconfigRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "joiningServers", &v->joiningServers); + rc = rc ? rc : out->serialize_String(out, "leavingServers", &v->leavingServers); + rc = rc ? rc : out->serialize_String(out, "newMembers", &v->newMembers); + rc = rc ? rc : out->serialize_Long(out, "curConfigId", &v->curConfigId); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ReconfigRequest(struct iarchive *in, const char *tag, struct ReconfigRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "joiningServers", &v->joiningServers); + rc = rc ? rc : in->deserialize_String(in, "leavingServers", &v->leavingServers); + rc = rc ? rc : in->deserialize_String(in, "newMembers", &v->newMembers); + rc = rc ? rc : in->deserialize_Long(in, "curConfigId", &v->curConfigId); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ReconfigRequest(struct ReconfigRequest*v){ + deallocate_String(&v->joiningServers); + deallocate_String(&v->leavingServers); + deallocate_String(&v->newMembers); +} +int serialize_SetDataResponse(struct oarchive *out, const char *tag, struct SetDataResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : serialize_Stat(out, "stat", &v->stat); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetDataResponse(struct iarchive *in, const char *tag, struct SetDataResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : deserialize_Stat(in, "stat", &v->stat); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetDataResponse(struct SetDataResponse*v){ + deallocate_Stat(&v->stat); +} +int serialize_GetSASLRequest(struct oarchive *out, const char *tag, struct GetSASLRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Buffer(out, "token", &v->token); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetSASLRequest(struct iarchive *in, const char *tag, struct GetSASLRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Buffer(in, "token", &v->token); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetSASLRequest(struct GetSASLRequest*v){ + deallocate_Buffer(&v->token); +} +int serialize_SetSASLRequest(struct oarchive *out, const char *tag, struct SetSASLRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Buffer(out, "token", &v->token); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetSASLRequest(struct iarchive *in, const char *tag, struct SetSASLRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Buffer(in, "token", &v->token); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetSASLRequest(struct SetSASLRequest*v){ + deallocate_Buffer(&v->token); +} +int serialize_SetSASLResponse(struct oarchive *out, const char *tag, struct SetSASLResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Buffer(out, "token", &v->token); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetSASLResponse(struct iarchive *in, const char *tag, struct SetSASLResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Buffer(in, "token", &v->token); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetSASLResponse(struct SetSASLResponse*v){ + deallocate_Buffer(&v->token); +} +int allocate_ACL_vector(struct ACL_vector *v, int32_t len) { + if (!len) { + v->count = 0; + v->data = 0; + } else { + v->count = len; + v->data = calloc(sizeof(*v->data), len); + } + return 0; +} +int deallocate_ACL_vector(struct ACL_vector *v) { + if (v->data) { + int32_t i; + for(i=0;icount; i++) { + deallocate_ACL(&v->data[i]); + } + free(v->data); + v->data = 0; + } + return 0; +} +int serialize_ACL_vector(struct oarchive *out, const char *tag, struct ACL_vector *v) +{ + int32_t count = v->count; + int rc = 0; + int32_t i; + rc = out->start_vector(out, tag, &count); + for(i=0;icount;i++) { + rc = rc ? rc : serialize_ACL(out, "data", &v->data[i]); + } + rc = rc ? rc : out->end_vector(out, tag); + return rc; +} +int deserialize_ACL_vector(struct iarchive *in, const char *tag, struct ACL_vector *v) +{ + int rc = 0; + int32_t i; + rc = in->start_vector(in, tag, &v->count); + v->data = calloc(v->count, sizeof(*v->data)); + for(i=0;icount;i++) { + rc = rc ? rc : deserialize_ACL(in, "value", &v->data[i]); + } + rc = in->end_vector(in, tag); + return rc; +} +int serialize_CreateRequest(struct oarchive *out, const char *tag, struct CreateRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : out->serialize_Int(out, "flags", &v->flags); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CreateRequest(struct iarchive *in, const char *tag, struct CreateRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : in->deserialize_Int(in, "flags", &v->flags); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CreateRequest(struct CreateRequest*v){ + deallocate_String(&v->path); + deallocate_Buffer(&v->data); + deallocate_ACL_vector(&v->acl); +} +int serialize_CreateTTLRequest(struct oarchive *out, const char *tag, struct CreateTTLRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : out->serialize_Int(out, "flags", &v->flags); + rc = rc ? rc : out->serialize_Long(out, "ttl", &v->ttl); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CreateTTLRequest(struct iarchive *in, const char *tag, struct CreateTTLRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : in->deserialize_Int(in, "flags", &v->flags); + rc = rc ? rc : in->deserialize_Long(in, "ttl", &v->ttl); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CreateTTLRequest(struct CreateTTLRequest*v){ + deallocate_String(&v->path); + deallocate_Buffer(&v->data); + deallocate_ACL_vector(&v->acl); +} +int serialize_DeleteRequest(struct oarchive *out, const char *tag, struct DeleteRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_DeleteRequest(struct iarchive *in, const char *tag, struct DeleteRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_DeleteRequest(struct DeleteRequest*v){ + deallocate_String(&v->path); +} +int serialize_GetChildrenRequest(struct oarchive *out, const char *tag, struct GetChildrenRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Bool(out, "watch", &v->watch); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetChildrenRequest(struct iarchive *in, const char *tag, struct GetChildrenRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Bool(in, "watch", &v->watch); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetChildrenRequest(struct GetChildrenRequest*v){ + deallocate_String(&v->path); +} +int serialize_GetChildren2Request(struct oarchive *out, const char *tag, struct GetChildren2Request *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Bool(out, "watch", &v->watch); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetChildren2Request(struct iarchive *in, const char *tag, struct GetChildren2Request*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Bool(in, "watch", &v->watch); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetChildren2Request(struct GetChildren2Request*v){ + deallocate_String(&v->path); +} +int serialize_CheckVersionRequest(struct oarchive *out, const char *tag, struct CheckVersionRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CheckVersionRequest(struct iarchive *in, const char *tag, struct CheckVersionRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CheckVersionRequest(struct CheckVersionRequest*v){ + deallocate_String(&v->path); +} +int serialize_GetMaxChildrenRequest(struct oarchive *out, const char *tag, struct GetMaxChildrenRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetMaxChildrenRequest(struct iarchive *in, const char *tag, struct GetMaxChildrenRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetMaxChildrenRequest(struct GetMaxChildrenRequest*v){ + deallocate_String(&v->path); +} +int serialize_GetMaxChildrenResponse(struct oarchive *out, const char *tag, struct GetMaxChildrenResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "max", &v->max); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetMaxChildrenResponse(struct iarchive *in, const char *tag, struct GetMaxChildrenResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "max", &v->max); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetMaxChildrenResponse(struct GetMaxChildrenResponse*v){ +} +int serialize_SetMaxChildrenRequest(struct oarchive *out, const char *tag, struct SetMaxChildrenRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Int(out, "max", &v->max); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetMaxChildrenRequest(struct iarchive *in, const char *tag, struct SetMaxChildrenRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Int(in, "max", &v->max); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetMaxChildrenRequest(struct SetMaxChildrenRequest*v){ + deallocate_String(&v->path); +} +int serialize_SyncRequest(struct oarchive *out, const char *tag, struct SyncRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SyncRequest(struct iarchive *in, const char *tag, struct SyncRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SyncRequest(struct SyncRequest*v){ + deallocate_String(&v->path); +} +int serialize_SyncResponse(struct oarchive *out, const char *tag, struct SyncResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SyncResponse(struct iarchive *in, const char *tag, struct SyncResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SyncResponse(struct SyncResponse*v){ + deallocate_String(&v->path); +} +int serialize_GetACLRequest(struct oarchive *out, const char *tag, struct GetACLRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetACLRequest(struct iarchive *in, const char *tag, struct GetACLRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetACLRequest(struct GetACLRequest*v){ + deallocate_String(&v->path); +} +int serialize_SetACLRequest(struct oarchive *out, const char *tag, struct SetACLRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetACLRequest(struct iarchive *in, const char *tag, struct SetACLRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetACLRequest(struct SetACLRequest*v){ + deallocate_String(&v->path); + deallocate_ACL_vector(&v->acl); +} +int serialize_SetACLResponse(struct oarchive *out, const char *tag, struct SetACLResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : serialize_Stat(out, "stat", &v->stat); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetACLResponse(struct iarchive *in, const char *tag, struct SetACLResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : deserialize_Stat(in, "stat", &v->stat); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetACLResponse(struct SetACLResponse*v){ + deallocate_Stat(&v->stat); +} +int serialize_WatcherEvent(struct oarchive *out, const char *tag, struct WatcherEvent *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->serialize_Int(out, "state", &v->state); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_WatcherEvent(struct iarchive *in, const char *tag, struct WatcherEvent*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->deserialize_Int(in, "state", &v->state); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_WatcherEvent(struct WatcherEvent*v){ + deallocate_String(&v->path); +} +int serialize_ErrorResponse(struct oarchive *out, const char *tag, struct ErrorResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "err", &v->err); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ErrorResponse(struct iarchive *in, const char *tag, struct ErrorResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "err", &v->err); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ErrorResponse(struct ErrorResponse*v){ +} +int serialize_CreateResponse(struct oarchive *out, const char *tag, struct CreateResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CreateResponse(struct iarchive *in, const char *tag, struct CreateResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CreateResponse(struct CreateResponse*v){ + deallocate_String(&v->path); +} +int serialize_Create2Response(struct oarchive *out, const char *tag, struct Create2Response *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : serialize_Stat(out, "stat", &v->stat); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_Create2Response(struct iarchive *in, const char *tag, struct Create2Response*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : deserialize_Stat(in, "stat", &v->stat); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_Create2Response(struct Create2Response*v){ + deallocate_String(&v->path); + deallocate_Stat(&v->stat); +} +int serialize_ExistsRequest(struct oarchive *out, const char *tag, struct ExistsRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Bool(out, "watch", &v->watch); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ExistsRequest(struct iarchive *in, const char *tag, struct ExistsRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Bool(in, "watch", &v->watch); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ExistsRequest(struct ExistsRequest*v){ + deallocate_String(&v->path); +} +int serialize_ExistsResponse(struct oarchive *out, const char *tag, struct ExistsResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : serialize_Stat(out, "stat", &v->stat); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ExistsResponse(struct iarchive *in, const char *tag, struct ExistsResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : deserialize_Stat(in, "stat", &v->stat); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ExistsResponse(struct ExistsResponse*v){ + deallocate_Stat(&v->stat); +} +int serialize_GetDataResponse(struct oarchive *out, const char *tag, struct GetDataResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : serialize_Stat(out, "stat", &v->stat); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetDataResponse(struct iarchive *in, const char *tag, struct GetDataResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : deserialize_Stat(in, "stat", &v->stat); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetDataResponse(struct GetDataResponse*v){ + deallocate_Buffer(&v->data); + deallocate_Stat(&v->stat); +} +int serialize_GetChildrenResponse(struct oarchive *out, const char *tag, struct GetChildrenResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : serialize_String_vector(out, "children", &v->children); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetChildrenResponse(struct iarchive *in, const char *tag, struct GetChildrenResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : deserialize_String_vector(in, "children", &v->children); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetChildrenResponse(struct GetChildrenResponse*v){ + deallocate_String_vector(&v->children); +} +int serialize_GetChildren2Response(struct oarchive *out, const char *tag, struct GetChildren2Response *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : serialize_String_vector(out, "children", &v->children); + rc = rc ? rc : serialize_Stat(out, "stat", &v->stat); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetChildren2Response(struct iarchive *in, const char *tag, struct GetChildren2Response*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : deserialize_String_vector(in, "children", &v->children); + rc = rc ? rc : deserialize_Stat(in, "stat", &v->stat); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetChildren2Response(struct GetChildren2Response*v){ + deallocate_String_vector(&v->children); + deallocate_Stat(&v->stat); +} +int serialize_GetACLResponse(struct oarchive *out, const char *tag, struct GetACLResponse *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : serialize_Stat(out, "stat", &v->stat); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_GetACLResponse(struct iarchive *in, const char *tag, struct GetACLResponse*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : deserialize_Stat(in, "stat", &v->stat); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_GetACLResponse(struct GetACLResponse*v){ + deallocate_ACL_vector(&v->acl); + deallocate_Stat(&v->stat); +} +int serialize_CheckWatchesRequest(struct oarchive *out, const char *tag, struct CheckWatchesRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CheckWatchesRequest(struct iarchive *in, const char *tag, struct CheckWatchesRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CheckWatchesRequest(struct CheckWatchesRequest*v){ + deallocate_String(&v->path); +} +int serialize_RemoveWatchesRequest(struct oarchive *out, const char *tag, struct RemoveWatchesRequest *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_RemoveWatchesRequest(struct iarchive *in, const char *tag, struct RemoveWatchesRequest*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_RemoveWatchesRequest(struct RemoveWatchesRequest*v){ + deallocate_String(&v->path); +} +int serialize_LearnerInfo(struct oarchive *out, const char *tag, struct LearnerInfo *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Long(out, "serverid", &v->serverid); + rc = rc ? rc : out->serialize_Int(out, "protocolVersion", &v->protocolVersion); + rc = rc ? rc : out->serialize_Long(out, "configVersion", &v->configVersion); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_LearnerInfo(struct iarchive *in, const char *tag, struct LearnerInfo*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Long(in, "serverid", &v->serverid); + rc = rc ? rc : in->deserialize_Int(in, "protocolVersion", &v->protocolVersion); + rc = rc ? rc : in->deserialize_Long(in, "configVersion", &v->configVersion); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_LearnerInfo(struct LearnerInfo*v){ +} +int allocate_Id_vector(struct Id_vector *v, int32_t len) { + if (!len) { + v->count = 0; + v->data = 0; + } else { + v->count = len; + v->data = calloc(sizeof(*v->data), len); + } + return 0; +} +int deallocate_Id_vector(struct Id_vector *v) { + if (v->data) { + int32_t i; + for(i=0;icount; i++) { + deallocate_Id(&v->data[i]); + } + free(v->data); + v->data = 0; + } + return 0; +} +int serialize_Id_vector(struct oarchive *out, const char *tag, struct Id_vector *v) +{ + int32_t count = v->count; + int rc = 0; + int32_t i; + rc = out->start_vector(out, tag, &count); + for(i=0;icount;i++) { + rc = rc ? rc : serialize_Id(out, "data", &v->data[i]); + } + rc = rc ? rc : out->end_vector(out, tag); + return rc; +} +int deserialize_Id_vector(struct iarchive *in, const char *tag, struct Id_vector *v) +{ + int rc = 0; + int32_t i; + rc = in->start_vector(in, tag, &v->count); + v->data = calloc(v->count, sizeof(*v->data)); + for(i=0;icount;i++) { + rc = rc ? rc : deserialize_Id(in, "value", &v->data[i]); + } + rc = in->end_vector(in, tag); + return rc; +} +int serialize_QuorumPacket(struct oarchive *out, const char *tag, struct QuorumPacket *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->serialize_Long(out, "zxid", &v->zxid); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : serialize_Id_vector(out, "authinfo", &v->authinfo); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_QuorumPacket(struct iarchive *in, const char *tag, struct QuorumPacket*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->deserialize_Long(in, "zxid", &v->zxid); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : deserialize_Id_vector(in, "authinfo", &v->authinfo); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_QuorumPacket(struct QuorumPacket*v){ + deallocate_Buffer(&v->data); + deallocate_Id_vector(&v->authinfo); +} +int serialize_QuorumAuthPacket(struct oarchive *out, const char *tag, struct QuorumAuthPacket *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Long(out, "magic", &v->magic); + rc = rc ? rc : out->serialize_Int(out, "status", &v->status); + rc = rc ? rc : out->serialize_Buffer(out, "token", &v->token); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_QuorumAuthPacket(struct iarchive *in, const char *tag, struct QuorumAuthPacket*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Long(in, "magic", &v->magic); + rc = rc ? rc : in->deserialize_Int(in, "status", &v->status); + rc = rc ? rc : in->deserialize_Buffer(in, "token", &v->token); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_QuorumAuthPacket(struct QuorumAuthPacket*v){ + deallocate_Buffer(&v->token); +} +int serialize_FileHeader(struct oarchive *out, const char *tag, struct FileHeader *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "magic", &v->magic); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->serialize_Long(out, "dbid", &v->dbid); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_FileHeader(struct iarchive *in, const char *tag, struct FileHeader*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "magic", &v->magic); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->deserialize_Long(in, "dbid", &v->dbid); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_FileHeader(struct FileHeader*v){ +} +int serialize_TxnHeader(struct oarchive *out, const char *tag, struct TxnHeader *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Long(out, "clientId", &v->clientId); + rc = rc ? rc : out->serialize_Int(out, "cxid", &v->cxid); + rc = rc ? rc : out->serialize_Long(out, "zxid", &v->zxid); + rc = rc ? rc : out->serialize_Long(out, "time", &v->time); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_TxnHeader(struct iarchive *in, const char *tag, struct TxnHeader*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Long(in, "clientId", &v->clientId); + rc = rc ? rc : in->deserialize_Int(in, "cxid", &v->cxid); + rc = rc ? rc : in->deserialize_Long(in, "zxid", &v->zxid); + rc = rc ? rc : in->deserialize_Long(in, "time", &v->time); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_TxnHeader(struct TxnHeader*v){ +} +int serialize_CreateTxnV0(struct oarchive *out, const char *tag, struct CreateTxnV0 *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : out->serialize_Bool(out, "ephemeral", &v->ephemeral); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CreateTxnV0(struct iarchive *in, const char *tag, struct CreateTxnV0*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : in->deserialize_Bool(in, "ephemeral", &v->ephemeral); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CreateTxnV0(struct CreateTxnV0*v){ + deallocate_String(&v->path); + deallocate_Buffer(&v->data); + deallocate_ACL_vector(&v->acl); +} +int serialize_CreateTxn(struct oarchive *out, const char *tag, struct CreateTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : out->serialize_Bool(out, "ephemeral", &v->ephemeral); + rc = rc ? rc : out->serialize_Int(out, "parentCVersion", &v->parentCVersion); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CreateTxn(struct iarchive *in, const char *tag, struct CreateTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : in->deserialize_Bool(in, "ephemeral", &v->ephemeral); + rc = rc ? rc : in->deserialize_Int(in, "parentCVersion", &v->parentCVersion); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CreateTxn(struct CreateTxn*v){ + deallocate_String(&v->path); + deallocate_Buffer(&v->data); + deallocate_ACL_vector(&v->acl); +} +int serialize_CreateTTLTxn(struct oarchive *out, const char *tag, struct CreateTTLTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : out->serialize_Int(out, "parentCVersion", &v->parentCVersion); + rc = rc ? rc : out->serialize_Long(out, "ttl", &v->ttl); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CreateTTLTxn(struct iarchive *in, const char *tag, struct CreateTTLTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : in->deserialize_Int(in, "parentCVersion", &v->parentCVersion); + rc = rc ? rc : in->deserialize_Long(in, "ttl", &v->ttl); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CreateTTLTxn(struct CreateTTLTxn*v){ + deallocate_String(&v->path); + deallocate_Buffer(&v->data); + deallocate_ACL_vector(&v->acl); +} +int serialize_CreateContainerTxn(struct oarchive *out, const char *tag, struct CreateContainerTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : out->serialize_Int(out, "parentCVersion", &v->parentCVersion); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CreateContainerTxn(struct iarchive *in, const char *tag, struct CreateContainerTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : in->deserialize_Int(in, "parentCVersion", &v->parentCVersion); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CreateContainerTxn(struct CreateContainerTxn*v){ + deallocate_String(&v->path); + deallocate_Buffer(&v->data); + deallocate_ACL_vector(&v->acl); +} +int serialize_DeleteTxn(struct oarchive *out, const char *tag, struct DeleteTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_DeleteTxn(struct iarchive *in, const char *tag, struct DeleteTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_DeleteTxn(struct DeleteTxn*v){ + deallocate_String(&v->path); +} +int serialize_SetDataTxn(struct oarchive *out, const char *tag, struct SetDataTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetDataTxn(struct iarchive *in, const char *tag, struct SetDataTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetDataTxn(struct SetDataTxn*v){ + deallocate_String(&v->path); + deallocate_Buffer(&v->data); +} +int serialize_CheckVersionTxn(struct oarchive *out, const char *tag, struct CheckVersionTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CheckVersionTxn(struct iarchive *in, const char *tag, struct CheckVersionTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CheckVersionTxn(struct CheckVersionTxn*v){ + deallocate_String(&v->path); +} +int serialize_SetACLTxn(struct oarchive *out, const char *tag, struct SetACLTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : serialize_ACL_vector(out, "acl", &v->acl); + rc = rc ? rc : out->serialize_Int(out, "version", &v->version); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetACLTxn(struct iarchive *in, const char *tag, struct SetACLTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : deserialize_ACL_vector(in, "acl", &v->acl); + rc = rc ? rc : in->deserialize_Int(in, "version", &v->version); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetACLTxn(struct SetACLTxn*v){ + deallocate_String(&v->path); + deallocate_ACL_vector(&v->acl); +} +int serialize_SetMaxChildrenTxn(struct oarchive *out, const char *tag, struct SetMaxChildrenTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_String(out, "path", &v->path); + rc = rc ? rc : out->serialize_Int(out, "max", &v->max); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_SetMaxChildrenTxn(struct iarchive *in, const char *tag, struct SetMaxChildrenTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_String(in, "path", &v->path); + rc = rc ? rc : in->deserialize_Int(in, "max", &v->max); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_SetMaxChildrenTxn(struct SetMaxChildrenTxn*v){ + deallocate_String(&v->path); +} +int serialize_CreateSessionTxn(struct oarchive *out, const char *tag, struct CreateSessionTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "timeOut", &v->timeOut); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_CreateSessionTxn(struct iarchive *in, const char *tag, struct CreateSessionTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "timeOut", &v->timeOut); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_CreateSessionTxn(struct CreateSessionTxn*v){ +} +int serialize_ErrorTxn(struct oarchive *out, const char *tag, struct ErrorTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "err", &v->err); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_ErrorTxn(struct iarchive *in, const char *tag, struct ErrorTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "err", &v->err); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_ErrorTxn(struct ErrorTxn*v){ +} +int serialize_Txn(struct oarchive *out, const char *tag, struct Txn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : out->serialize_Int(out, "type", &v->type); + rc = rc ? rc : out->serialize_Buffer(out, "data", &v->data); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_Txn(struct iarchive *in, const char *tag, struct Txn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : in->deserialize_Int(in, "type", &v->type); + rc = rc ? rc : in->deserialize_Buffer(in, "data", &v->data); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_Txn(struct Txn*v){ + deallocate_Buffer(&v->data); +} +int allocate_Txn_vector(struct Txn_vector *v, int32_t len) { + if (!len) { + v->count = 0; + v->data = 0; + } else { + v->count = len; + v->data = calloc(sizeof(*v->data), len); + } + return 0; +} +int deallocate_Txn_vector(struct Txn_vector *v) { + if (v->data) { + int32_t i; + for(i=0;icount; i++) { + deallocate_Txn(&v->data[i]); + } + free(v->data); + v->data = 0; + } + return 0; +} +int serialize_Txn_vector(struct oarchive *out, const char *tag, struct Txn_vector *v) +{ + int32_t count = v->count; + int rc = 0; + int32_t i; + rc = out->start_vector(out, tag, &count); + for(i=0;icount;i++) { + rc = rc ? rc : serialize_Txn(out, "data", &v->data[i]); + } + rc = rc ? rc : out->end_vector(out, tag); + return rc; +} +int deserialize_Txn_vector(struct iarchive *in, const char *tag, struct Txn_vector *v) +{ + int rc = 0; + int32_t i; + rc = in->start_vector(in, tag, &v->count); + v->data = calloc(v->count, sizeof(*v->data)); + for(i=0;icount;i++) { + rc = rc ? rc : deserialize_Txn(in, "value", &v->data[i]); + } + rc = in->end_vector(in, tag); + return rc; +} +int serialize_MultiTxn(struct oarchive *out, const char *tag, struct MultiTxn *v){ + int rc; + rc = out->start_record(out, tag); + rc = rc ? rc : serialize_Txn_vector(out, "txns", &v->txns); + rc = rc ? rc : out->end_record(out, tag); + return rc; +} +int deserialize_MultiTxn(struct iarchive *in, const char *tag, struct MultiTxn*v){ + int rc; + rc = in->start_record(in, tag); + rc = rc ? rc : deserialize_Txn_vector(in, "txns", &v->txns); + rc = rc ? rc : in->end_record(in, tag); + return rc; +} +void deallocate_MultiTxn(struct MultiTxn*v){ + deallocate_Txn_vector(&v->txns); +} diff --git a/ThirdLib/thirdparty/zookeeper/include/zookeeper.jute.h b/ThirdLib/thirdparty/zookeeper/include/zookeeper.jute.h new file mode 100644 index 000000000..c28a14571 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/zookeeper.jute.h @@ -0,0 +1,540 @@ +/** +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#ifndef __ZOOKEEPER_JUTE__ +#define __ZOOKEEPER_JUTE__ +#include "recordio.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct Id { + char * scheme; + char * id; +}; +int serialize_Id(struct oarchive *out, const char *tag, struct Id *v); +int deserialize_Id(struct iarchive *in, const char *tag, struct Id*v); +void deallocate_Id(struct Id*); +struct ACL { + int32_t perms; + struct Id id; +}; +int serialize_ACL(struct oarchive *out, const char *tag, struct ACL *v); +int deserialize_ACL(struct iarchive *in, const char *tag, struct ACL*v); +void deallocate_ACL(struct ACL*); +struct Stat { + int64_t czxid; + int64_t mzxid; + int64_t ctime; + int64_t mtime; + int32_t version; + int32_t cversion; + int32_t aversion; + int64_t ephemeralOwner; + int32_t dataLength; + int32_t numChildren; + int64_t pzxid; +}; +int serialize_Stat(struct oarchive *out, const char *tag, struct Stat *v); +int deserialize_Stat(struct iarchive *in, const char *tag, struct Stat*v); +void deallocate_Stat(struct Stat*); +struct StatPersisted { + int64_t czxid; + int64_t mzxid; + int64_t ctime; + int64_t mtime; + int32_t version; + int32_t cversion; + int32_t aversion; + int64_t ephemeralOwner; + int64_t pzxid; +}; +int serialize_StatPersisted(struct oarchive *out, const char *tag, struct StatPersisted *v); +int deserialize_StatPersisted(struct iarchive *in, const char *tag, struct StatPersisted*v); +void deallocate_StatPersisted(struct StatPersisted*); +struct ConnectRequest { + int32_t protocolVersion; + int64_t lastZxidSeen; + int32_t timeOut; + int64_t sessionId; + struct buffer passwd; +}; +int serialize_ConnectRequest(struct oarchive *out, const char *tag, struct ConnectRequest *v); +int deserialize_ConnectRequest(struct iarchive *in, const char *tag, struct ConnectRequest*v); +void deallocate_ConnectRequest(struct ConnectRequest*); +struct ConnectResponse { + int32_t protocolVersion; + int32_t timeOut; + int64_t sessionId; + struct buffer passwd; +}; +int serialize_ConnectResponse(struct oarchive *out, const char *tag, struct ConnectResponse *v); +int deserialize_ConnectResponse(struct iarchive *in, const char *tag, struct ConnectResponse*v); +void deallocate_ConnectResponse(struct ConnectResponse*); +struct String_vector { + int32_t count; + char * *data; + +}; +int serialize_String_vector(struct oarchive *out, const char *tag, struct String_vector *v); +int deserialize_String_vector(struct iarchive *in, const char *tag, struct String_vector *v); +int allocate_String_vector(struct String_vector *v, int32_t len); +int deallocate_String_vector(struct String_vector *v); +struct SetWatches { + int64_t relativeZxid; + struct String_vector dataWatches; + struct String_vector existWatches; + struct String_vector childWatches; +}; +int serialize_SetWatches(struct oarchive *out, const char *tag, struct SetWatches *v); +int deserialize_SetWatches(struct iarchive *in, const char *tag, struct SetWatches*v); +void deallocate_SetWatches(struct SetWatches*); +struct RequestHeader { + int32_t xid; + int32_t type; +}; +int serialize_RequestHeader(struct oarchive *out, const char *tag, struct RequestHeader *v); +int deserialize_RequestHeader(struct iarchive *in, const char *tag, struct RequestHeader*v); +void deallocate_RequestHeader(struct RequestHeader*); +struct MultiHeader { + int32_t type; + int32_t done; + int32_t err; +}; +int serialize_MultiHeader(struct oarchive *out, const char *tag, struct MultiHeader *v); +int deserialize_MultiHeader(struct iarchive *in, const char *tag, struct MultiHeader*v); +void deallocate_MultiHeader(struct MultiHeader*); +struct AuthPacket { + int32_t type; + char * scheme; + struct buffer auth; +}; +int serialize_AuthPacket(struct oarchive *out, const char *tag, struct AuthPacket *v); +int deserialize_AuthPacket(struct iarchive *in, const char *tag, struct AuthPacket*v); +void deallocate_AuthPacket(struct AuthPacket*); +struct ReplyHeader { + int32_t xid; + int64_t zxid; + int32_t err; +}; +int serialize_ReplyHeader(struct oarchive *out, const char *tag, struct ReplyHeader *v); +int deserialize_ReplyHeader(struct iarchive *in, const char *tag, struct ReplyHeader*v); +void deallocate_ReplyHeader(struct ReplyHeader*); +struct GetDataRequest { + char * path; + int32_t watch; +}; +int serialize_GetDataRequest(struct oarchive *out, const char *tag, struct GetDataRequest *v); +int deserialize_GetDataRequest(struct iarchive *in, const char *tag, struct GetDataRequest*v); +void deallocate_GetDataRequest(struct GetDataRequest*); +struct SetDataRequest { + char * path; + struct buffer data; + int32_t version; +}; +int serialize_SetDataRequest(struct oarchive *out, const char *tag, struct SetDataRequest *v); +int deserialize_SetDataRequest(struct iarchive *in, const char *tag, struct SetDataRequest*v); +void deallocate_SetDataRequest(struct SetDataRequest*); +struct ReconfigRequest { + char * joiningServers; + char * leavingServers; + char * newMembers; + int64_t curConfigId; +}; +int serialize_ReconfigRequest(struct oarchive *out, const char *tag, struct ReconfigRequest *v); +int deserialize_ReconfigRequest(struct iarchive *in, const char *tag, struct ReconfigRequest*v); +void deallocate_ReconfigRequest(struct ReconfigRequest*); +struct SetDataResponse { + struct Stat stat; +}; +int serialize_SetDataResponse(struct oarchive *out, const char *tag, struct SetDataResponse *v); +int deserialize_SetDataResponse(struct iarchive *in, const char *tag, struct SetDataResponse*v); +void deallocate_SetDataResponse(struct SetDataResponse*); +struct GetSASLRequest { + struct buffer token; +}; +int serialize_GetSASLRequest(struct oarchive *out, const char *tag, struct GetSASLRequest *v); +int deserialize_GetSASLRequest(struct iarchive *in, const char *tag, struct GetSASLRequest*v); +void deallocate_GetSASLRequest(struct GetSASLRequest*); +struct SetSASLRequest { + struct buffer token; +}; +int serialize_SetSASLRequest(struct oarchive *out, const char *tag, struct SetSASLRequest *v); +int deserialize_SetSASLRequest(struct iarchive *in, const char *tag, struct SetSASLRequest*v); +void deallocate_SetSASLRequest(struct SetSASLRequest*); +struct SetSASLResponse { + struct buffer token; +}; +int serialize_SetSASLResponse(struct oarchive *out, const char *tag, struct SetSASLResponse *v); +int deserialize_SetSASLResponse(struct iarchive *in, const char *tag, struct SetSASLResponse*v); +void deallocate_SetSASLResponse(struct SetSASLResponse*); +struct ACL_vector { + int32_t count; + struct ACL *data; + +}; +int serialize_ACL_vector(struct oarchive *out, const char *tag, struct ACL_vector *v); +int deserialize_ACL_vector(struct iarchive *in, const char *tag, struct ACL_vector *v); +int allocate_ACL_vector(struct ACL_vector *v, int32_t len); +int deallocate_ACL_vector(struct ACL_vector *v); +struct CreateRequest { + char * path; + struct buffer data; + struct ACL_vector acl; + int32_t flags; +}; +int serialize_CreateRequest(struct oarchive *out, const char *tag, struct CreateRequest *v); +int deserialize_CreateRequest(struct iarchive *in, const char *tag, struct CreateRequest*v); +void deallocate_CreateRequest(struct CreateRequest*); +struct CreateTTLRequest { + char * path; + struct buffer data; + struct ACL_vector acl; + int32_t flags; + int64_t ttl; +}; +int serialize_CreateTTLRequest(struct oarchive *out, const char *tag, struct CreateTTLRequest *v); +int deserialize_CreateTTLRequest(struct iarchive *in, const char *tag, struct CreateTTLRequest*v); +void deallocate_CreateTTLRequest(struct CreateTTLRequest*); +struct DeleteRequest { + char * path; + int32_t version; +}; +int serialize_DeleteRequest(struct oarchive *out, const char *tag, struct DeleteRequest *v); +int deserialize_DeleteRequest(struct iarchive *in, const char *tag, struct DeleteRequest*v); +void deallocate_DeleteRequest(struct DeleteRequest*); +struct GetChildrenRequest { + char * path; + int32_t watch; +}; +int serialize_GetChildrenRequest(struct oarchive *out, const char *tag, struct GetChildrenRequest *v); +int deserialize_GetChildrenRequest(struct iarchive *in, const char *tag, struct GetChildrenRequest*v); +void deallocate_GetChildrenRequest(struct GetChildrenRequest*); +struct GetChildren2Request { + char * path; + int32_t watch; +}; +int serialize_GetChildren2Request(struct oarchive *out, const char *tag, struct GetChildren2Request *v); +int deserialize_GetChildren2Request(struct iarchive *in, const char *tag, struct GetChildren2Request*v); +void deallocate_GetChildren2Request(struct GetChildren2Request*); +struct CheckVersionRequest { + char * path; + int32_t version; +}; +int serialize_CheckVersionRequest(struct oarchive *out, const char *tag, struct CheckVersionRequest *v); +int deserialize_CheckVersionRequest(struct iarchive *in, const char *tag, struct CheckVersionRequest*v); +void deallocate_CheckVersionRequest(struct CheckVersionRequest*); +struct GetMaxChildrenRequest { + char * path; +}; +int serialize_GetMaxChildrenRequest(struct oarchive *out, const char *tag, struct GetMaxChildrenRequest *v); +int deserialize_GetMaxChildrenRequest(struct iarchive *in, const char *tag, struct GetMaxChildrenRequest*v); +void deallocate_GetMaxChildrenRequest(struct GetMaxChildrenRequest*); +struct GetMaxChildrenResponse { + int32_t max; +}; +int serialize_GetMaxChildrenResponse(struct oarchive *out, const char *tag, struct GetMaxChildrenResponse *v); +int deserialize_GetMaxChildrenResponse(struct iarchive *in, const char *tag, struct GetMaxChildrenResponse*v); +void deallocate_GetMaxChildrenResponse(struct GetMaxChildrenResponse*); +struct SetMaxChildrenRequest { + char * path; + int32_t max; +}; +int serialize_SetMaxChildrenRequest(struct oarchive *out, const char *tag, struct SetMaxChildrenRequest *v); +int deserialize_SetMaxChildrenRequest(struct iarchive *in, const char *tag, struct SetMaxChildrenRequest*v); +void deallocate_SetMaxChildrenRequest(struct SetMaxChildrenRequest*); +struct SyncRequest { + char * path; +}; +int serialize_SyncRequest(struct oarchive *out, const char *tag, struct SyncRequest *v); +int deserialize_SyncRequest(struct iarchive *in, const char *tag, struct SyncRequest*v); +void deallocate_SyncRequest(struct SyncRequest*); +struct SyncResponse { + char * path; +}; +int serialize_SyncResponse(struct oarchive *out, const char *tag, struct SyncResponse *v); +int deserialize_SyncResponse(struct iarchive *in, const char *tag, struct SyncResponse*v); +void deallocate_SyncResponse(struct SyncResponse*); +struct GetACLRequest { + char * path; +}; +int serialize_GetACLRequest(struct oarchive *out, const char *tag, struct GetACLRequest *v); +int deserialize_GetACLRequest(struct iarchive *in, const char *tag, struct GetACLRequest*v); +void deallocate_GetACLRequest(struct GetACLRequest*); +struct SetACLRequest { + char * path; + struct ACL_vector acl; + int32_t version; +}; +int serialize_SetACLRequest(struct oarchive *out, const char *tag, struct SetACLRequest *v); +int deserialize_SetACLRequest(struct iarchive *in, const char *tag, struct SetACLRequest*v); +void deallocate_SetACLRequest(struct SetACLRequest*); +struct SetACLResponse { + struct Stat stat; +}; +int serialize_SetACLResponse(struct oarchive *out, const char *tag, struct SetACLResponse *v); +int deserialize_SetACLResponse(struct iarchive *in, const char *tag, struct SetACLResponse*v); +void deallocate_SetACLResponse(struct SetACLResponse*); +struct WatcherEvent { + int32_t type; + int32_t state; + char * path; +}; +int serialize_WatcherEvent(struct oarchive *out, const char *tag, struct WatcherEvent *v); +int deserialize_WatcherEvent(struct iarchive *in, const char *tag, struct WatcherEvent*v); +void deallocate_WatcherEvent(struct WatcherEvent*); +struct ErrorResponse { + int32_t err; +}; +int serialize_ErrorResponse(struct oarchive *out, const char *tag, struct ErrorResponse *v); +int deserialize_ErrorResponse(struct iarchive *in, const char *tag, struct ErrorResponse*v); +void deallocate_ErrorResponse(struct ErrorResponse*); +struct CreateResponse { + char * path; +}; +int serialize_CreateResponse(struct oarchive *out, const char *tag, struct CreateResponse *v); +int deserialize_CreateResponse(struct iarchive *in, const char *tag, struct CreateResponse*v); +void deallocate_CreateResponse(struct CreateResponse*); +struct Create2Response { + char * path; + struct Stat stat; +}; +int serialize_Create2Response(struct oarchive *out, const char *tag, struct Create2Response *v); +int deserialize_Create2Response(struct iarchive *in, const char *tag, struct Create2Response*v); +void deallocate_Create2Response(struct Create2Response*); +struct ExistsRequest { + char * path; + int32_t watch; +}; +int serialize_ExistsRequest(struct oarchive *out, const char *tag, struct ExistsRequest *v); +int deserialize_ExistsRequest(struct iarchive *in, const char *tag, struct ExistsRequest*v); +void deallocate_ExistsRequest(struct ExistsRequest*); +struct ExistsResponse { + struct Stat stat; +}; +int serialize_ExistsResponse(struct oarchive *out, const char *tag, struct ExistsResponse *v); +int deserialize_ExistsResponse(struct iarchive *in, const char *tag, struct ExistsResponse*v); +void deallocate_ExistsResponse(struct ExistsResponse*); +struct GetDataResponse { + struct buffer data; + struct Stat stat; +}; +int serialize_GetDataResponse(struct oarchive *out, const char *tag, struct GetDataResponse *v); +int deserialize_GetDataResponse(struct iarchive *in, const char *tag, struct GetDataResponse*v); +void deallocate_GetDataResponse(struct GetDataResponse*); +struct GetChildrenResponse { + struct String_vector children; +}; +int serialize_GetChildrenResponse(struct oarchive *out, const char *tag, struct GetChildrenResponse *v); +int deserialize_GetChildrenResponse(struct iarchive *in, const char *tag, struct GetChildrenResponse*v); +void deallocate_GetChildrenResponse(struct GetChildrenResponse*); +struct GetChildren2Response { + struct String_vector children; + struct Stat stat; +}; +int serialize_GetChildren2Response(struct oarchive *out, const char *tag, struct GetChildren2Response *v); +int deserialize_GetChildren2Response(struct iarchive *in, const char *tag, struct GetChildren2Response*v); +void deallocate_GetChildren2Response(struct GetChildren2Response*); +struct GetACLResponse { + struct ACL_vector acl; + struct Stat stat; +}; +int serialize_GetACLResponse(struct oarchive *out, const char *tag, struct GetACLResponse *v); +int deserialize_GetACLResponse(struct iarchive *in, const char *tag, struct GetACLResponse*v); +void deallocate_GetACLResponse(struct GetACLResponse*); +struct CheckWatchesRequest { + char * path; + int32_t type; +}; +int serialize_CheckWatchesRequest(struct oarchive *out, const char *tag, struct CheckWatchesRequest *v); +int deserialize_CheckWatchesRequest(struct iarchive *in, const char *tag, struct CheckWatchesRequest*v); +void deallocate_CheckWatchesRequest(struct CheckWatchesRequest*); +struct RemoveWatchesRequest { + char * path; + int32_t type; +}; +int serialize_RemoveWatchesRequest(struct oarchive *out, const char *tag, struct RemoveWatchesRequest *v); +int deserialize_RemoveWatchesRequest(struct iarchive *in, const char *tag, struct RemoveWatchesRequest*v); +void deallocate_RemoveWatchesRequest(struct RemoveWatchesRequest*); +struct LearnerInfo { + int64_t serverid; + int32_t protocolVersion; + int64_t configVersion; +}; +int serialize_LearnerInfo(struct oarchive *out, const char *tag, struct LearnerInfo *v); +int deserialize_LearnerInfo(struct iarchive *in, const char *tag, struct LearnerInfo*v); +void deallocate_LearnerInfo(struct LearnerInfo*); +struct Id_vector { + int32_t count; + struct Id *data; + +}; +int serialize_Id_vector(struct oarchive *out, const char *tag, struct Id_vector *v); +int deserialize_Id_vector(struct iarchive *in, const char *tag, struct Id_vector *v); +int allocate_Id_vector(struct Id_vector *v, int32_t len); +int deallocate_Id_vector(struct Id_vector *v); +struct QuorumPacket { + int32_t type; + int64_t zxid; + struct buffer data; + struct Id_vector authinfo; +}; +int serialize_QuorumPacket(struct oarchive *out, const char *tag, struct QuorumPacket *v); +int deserialize_QuorumPacket(struct iarchive *in, const char *tag, struct QuorumPacket*v); +void deallocate_QuorumPacket(struct QuorumPacket*); +struct QuorumAuthPacket { + int64_t magic; + int32_t status; + struct buffer token; +}; +int serialize_QuorumAuthPacket(struct oarchive *out, const char *tag, struct QuorumAuthPacket *v); +int deserialize_QuorumAuthPacket(struct iarchive *in, const char *tag, struct QuorumAuthPacket*v); +void deallocate_QuorumAuthPacket(struct QuorumAuthPacket*); +struct FileHeader { + int32_t magic; + int32_t version; + int64_t dbid; +}; +int serialize_FileHeader(struct oarchive *out, const char *tag, struct FileHeader *v); +int deserialize_FileHeader(struct iarchive *in, const char *tag, struct FileHeader*v); +void deallocate_FileHeader(struct FileHeader*); +struct TxnHeader { + int64_t clientId; + int32_t cxid; + int64_t zxid; + int64_t time; + int32_t type; +}; +int serialize_TxnHeader(struct oarchive *out, const char *tag, struct TxnHeader *v); +int deserialize_TxnHeader(struct iarchive *in, const char *tag, struct TxnHeader*v); +void deallocate_TxnHeader(struct TxnHeader*); +struct CreateTxnV0 { + char * path; + struct buffer data; + struct ACL_vector acl; + int32_t ephemeral; +}; +int serialize_CreateTxnV0(struct oarchive *out, const char *tag, struct CreateTxnV0 *v); +int deserialize_CreateTxnV0(struct iarchive *in, const char *tag, struct CreateTxnV0*v); +void deallocate_CreateTxnV0(struct CreateTxnV0*); +struct CreateTxn { + char * path; + struct buffer data; + struct ACL_vector acl; + int32_t ephemeral; + int32_t parentCVersion; +}; +int serialize_CreateTxn(struct oarchive *out, const char *tag, struct CreateTxn *v); +int deserialize_CreateTxn(struct iarchive *in, const char *tag, struct CreateTxn*v); +void deallocate_CreateTxn(struct CreateTxn*); +struct CreateTTLTxn { + char * path; + struct buffer data; + struct ACL_vector acl; + int32_t parentCVersion; + int64_t ttl; +}; +int serialize_CreateTTLTxn(struct oarchive *out, const char *tag, struct CreateTTLTxn *v); +int deserialize_CreateTTLTxn(struct iarchive *in, const char *tag, struct CreateTTLTxn*v); +void deallocate_CreateTTLTxn(struct CreateTTLTxn*); +struct CreateContainerTxn { + char * path; + struct buffer data; + struct ACL_vector acl; + int32_t parentCVersion; +}; +int serialize_CreateContainerTxn(struct oarchive *out, const char *tag, struct CreateContainerTxn *v); +int deserialize_CreateContainerTxn(struct iarchive *in, const char *tag, struct CreateContainerTxn*v); +void deallocate_CreateContainerTxn(struct CreateContainerTxn*); +struct DeleteTxn { + char * path; +}; +int serialize_DeleteTxn(struct oarchive *out, const char *tag, struct DeleteTxn *v); +int deserialize_DeleteTxn(struct iarchive *in, const char *tag, struct DeleteTxn*v); +void deallocate_DeleteTxn(struct DeleteTxn*); +struct SetDataTxn { + char * path; + struct buffer data; + int32_t version; +}; +int serialize_SetDataTxn(struct oarchive *out, const char *tag, struct SetDataTxn *v); +int deserialize_SetDataTxn(struct iarchive *in, const char *tag, struct SetDataTxn*v); +void deallocate_SetDataTxn(struct SetDataTxn*); +struct CheckVersionTxn { + char * path; + int32_t version; +}; +int serialize_CheckVersionTxn(struct oarchive *out, const char *tag, struct CheckVersionTxn *v); +int deserialize_CheckVersionTxn(struct iarchive *in, const char *tag, struct CheckVersionTxn*v); +void deallocate_CheckVersionTxn(struct CheckVersionTxn*); +struct SetACLTxn { + char * path; + struct ACL_vector acl; + int32_t version; +}; +int serialize_SetACLTxn(struct oarchive *out, const char *tag, struct SetACLTxn *v); +int deserialize_SetACLTxn(struct iarchive *in, const char *tag, struct SetACLTxn*v); +void deallocate_SetACLTxn(struct SetACLTxn*); +struct SetMaxChildrenTxn { + char * path; + int32_t max; +}; +int serialize_SetMaxChildrenTxn(struct oarchive *out, const char *tag, struct SetMaxChildrenTxn *v); +int deserialize_SetMaxChildrenTxn(struct iarchive *in, const char *tag, struct SetMaxChildrenTxn*v); +void deallocate_SetMaxChildrenTxn(struct SetMaxChildrenTxn*); +struct CreateSessionTxn { + int32_t timeOut; +}; +int serialize_CreateSessionTxn(struct oarchive *out, const char *tag, struct CreateSessionTxn *v); +int deserialize_CreateSessionTxn(struct iarchive *in, const char *tag, struct CreateSessionTxn*v); +void deallocate_CreateSessionTxn(struct CreateSessionTxn*); +struct ErrorTxn { + int32_t err; +}; +int serialize_ErrorTxn(struct oarchive *out, const char *tag, struct ErrorTxn *v); +int deserialize_ErrorTxn(struct iarchive *in, const char *tag, struct ErrorTxn*v); +void deallocate_ErrorTxn(struct ErrorTxn*); +struct Txn { + int32_t type; + struct buffer data; +}; +int serialize_Txn(struct oarchive *out, const char *tag, struct Txn *v); +int deserialize_Txn(struct iarchive *in, const char *tag, struct Txn*v); +void deallocate_Txn(struct Txn*); +struct Txn_vector { + int32_t count; + struct Txn *data; + +}; +int serialize_Txn_vector(struct oarchive *out, const char *tag, struct Txn_vector *v); +int deserialize_Txn_vector(struct iarchive *in, const char *tag, struct Txn_vector *v); +int allocate_Txn_vector(struct Txn_vector *v, int32_t len); +int deallocate_Txn_vector(struct Txn_vector *v); +struct MultiTxn { + struct Txn_vector txns; +}; +int serialize_MultiTxn(struct oarchive *out, const char *tag, struct MultiTxn *v); +int deserialize_MultiTxn(struct iarchive *in, const char *tag, struct MultiTxn*v); +void deallocate_MultiTxn(struct MultiTxn*); + +#ifdef __cplusplus +} +#endif + +#endif //ZOOKEEPER_JUTE__ diff --git a/ThirdLib/thirdparty/zookeeper/include/zookeeper_log.h b/ThirdLib/thirdparty/zookeeper/include/zookeeper_log.h new file mode 100644 index 000000000..56a9b73ab --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/zookeeper_log.h @@ -0,0 +1,50 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ZK_LOG_H_ +#define ZK_LOG_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern ZOOAPI ZooLogLevel logLevel; +#define LOGCALLBACK(_zh) zoo_get_log_callback(_zh) +#define LOGSTREAM NULL + +#define LOG_ERROR(_cb, ...) if(logLevel>=ZOO_LOG_LEVEL_ERROR) \ + log_message(_cb, ZOO_LOG_LEVEL_ERROR, __LINE__, __func__, __VA_ARGS__) +#define LOG_WARN(_cb, ...) if(logLevel>=ZOO_LOG_LEVEL_WARN) \ + log_message(_cb, ZOO_LOG_LEVEL_WARN, __LINE__, __func__, __VA_ARGS__) +#define LOG_INFO(_cb, ...) if(logLevel>=ZOO_LOG_LEVEL_INFO) \ + log_message(_cb, ZOO_LOG_LEVEL_INFO, __LINE__, __func__, __VA_ARGS__) +#define LOG_DEBUG(_cb, ...) if(logLevel==ZOO_LOG_LEVEL_DEBUG) \ + log_message(_cb, ZOO_LOG_LEVEL_DEBUG, __LINE__, __func__, __VA_ARGS__) + +ZOOAPI void log_message(log_callback_fn callback, ZooLogLevel curLevel, + int line, const char* funcName, const char* format, ...); + +FILE* zoo_get_log_stream(); + +#ifdef __cplusplus +} +#endif + +#endif /*ZK_LOG_H_*/ diff --git a/ThirdLib/thirdparty/zookeeper/include/zookeeper_version.h b/ThirdLib/thirdparty/zookeeper/include/zookeeper_version.h new file mode 100644 index 000000000..581690dad --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/include/zookeeper_version.h @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef ZOOKEEPER_VERSION_H_ +#define ZOOKEEPER_VERSION_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZOO_MAJOR_VERSION 3 +#define ZOO_MINOR_VERSION 5 +#define ZOO_PATCH_VERSION 4 + +#ifdef __cplusplus +} +#endif + +#endif /* ZOOKEEPER_VERSION_H_ */ diff --git a/ThirdLib/thirdparty/zookeeper/src/addrvec.c b/ThirdLib/thirdparty/zookeeper/src/addrvec.c new file mode 100644 index 000000000..fdfb68d34 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/addrvec.c @@ -0,0 +1,253 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#ifdef WIN32 +#define random rand /* replace POSIX random with Windows rand */ +#include /* must always be included before ws2tcpip.h */ +#include /* for sockaddr_storage */ +#include "winport.h" +#endif + +#include "addrvec.h" + +#define ADDRVEC_DEFAULT_GROW_AMOUNT 16 + +void addrvec_init(addrvec_t *avec) +{ + assert(avec); + avec->next = 0; + avec->count = 0; + avec->capacity = 0; + avec->data = NULL; +} + +void addrvec_free(addrvec_t *avec) +{ + if (avec == NULL) + { + return; + } + + avec->next = 0; + avec->count = 0; + avec->capacity = 0; + if (avec->data) { + free(avec->data); + avec->data = NULL; + } +} + +int addrvec_alloc(addrvec_t *avec) +{ + addrvec_init(avec); + return addrvec_grow_default(avec); +} + +int addrvec_alloc_capacity(addrvec_t* avec, uint32_t capacity) +{ + addrvec_init(avec); + return addrvec_grow(avec, capacity); +} + +int addrvec_grow(addrvec_t *avec, uint32_t grow_amount) +{ + unsigned int old_capacity = 0; + struct sockaddr_storage *old_data = NULL; + assert(avec); + + if (grow_amount == 0) + { + return 0; + } + + // Save off old data and capacity in case there is a realloc failure + old_capacity = avec->capacity; + old_data = avec->data; + + avec->capacity += grow_amount; + avec->data = realloc(avec->data, sizeof(*avec->data) * avec->capacity); + if (avec->data == NULL) + { + avec->capacity = old_capacity; + avec->data = old_data; + errno = ENOMEM; + return 1; + } + + return 0; +} + +int addrvec_grow_default(addrvec_t *avec) +{ + return addrvec_grow(avec, ADDRVEC_DEFAULT_GROW_AMOUNT); +} + +static int addrvec_grow_if_full(addrvec_t *avec) +{ + assert(avec); + if (avec->count == avec->capacity) + { + int rc = addrvec_grow_default(avec); + if (rc != 0) + { + return rc; + } + } + + return 0; +} + +int addrvec_contains(const addrvec_t *avec, const struct sockaddr_storage *addr) +{ + uint32_t i = 0; + if (!avec || !addr) + { + return 0; + } + + for (i = 0; i < avec->count; i++) + { + if(memcmp(&avec->data[i], addr, INET_ADDRSTRLEN) == 0) + return 1; + } + + return 0; +} + +int addrvec_append(addrvec_t *avec, const struct sockaddr_storage *addr) +{ + int rc = 0; + assert(avec); + assert(addr); + + rc = addrvec_grow_if_full(avec); + if (rc != 0) + { + return rc; + } + + // Copy addrinfo into address list + memcpy(avec->data + avec->count, addr, sizeof(*addr)); + ++avec->count; + + return 0; +} + +int addrvec_append_addrinfo(addrvec_t *avec, const struct addrinfo *addrinfo) +{ + int rc = 0; + assert(avec); + assert(addrinfo); + + rc = addrvec_grow_if_full(avec); + if (rc != 0) + { + return rc; + } + + // Copy addrinfo into address list + memcpy(avec->data + avec->count, addrinfo->ai_addr, addrinfo->ai_addrlen); + ++avec->count; + + return 0; +} + +void addrvec_shuffle(addrvec_t *avec) +{ + int i = 0; + for (i = avec->count - 1; i > 0; --i) { + long int j = random()%(i+1); + if (i != j) { + struct sockaddr_storage t = avec->data[i]; + avec->data[i] = avec->data[j]; + avec->data[j] = t; + } + } +} + +int addrvec_hasnext(const addrvec_t *avec) +{ + return avec->count > 0 && (avec->next < avec->count); +} + +int addrvec_atend(const addrvec_t *avec) +{ + return avec->count > 0 && avec->next >= avec->count; +} + +void addrvec_next(addrvec_t *avec, struct sockaddr_storage *next) +{ + int index; + + // If we're at the end of the list, then reset index to start + if (addrvec_atend(avec)) { + avec->next = 0; + } + + if (!addrvec_hasnext(avec)) { + if (next) { + memset(next, 0, sizeof(*next)); + } + + return; + } + + index = avec->next++; + + if (next) { + *next = avec->data[index]; + } +} + +void addrvec_peek(addrvec_t *avec, struct sockaddr_storage *next) +{ + int index = avec->next; + + if (avec->count == 0) { + memset(next, 0, sizeof(*next)); + return; + } + + if (addrvec_atend(avec)) { + index = 0; + } + + *next = avec->data[index]; +} + + +int addrvec_eq(const addrvec_t *a1, const addrvec_t *a2) +{ + uint32_t i = 0; + if (a1->count != a2->count) + { + return 0; + } + + for (i = 0; i < a1->count; ++i) + { + if (!addrvec_contains(a2, &a1->data[i])) + return 0; + } + + return 1; +} diff --git a/ThirdLib/thirdparty/zookeeper/src/addrvec.h b/ThirdLib/thirdparty/zookeeper/src/addrvec.h new file mode 100644 index 000000000..a12642908 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/addrvec.h @@ -0,0 +1,138 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ADDRVEC_H_ +#define ADDRVEC_H_ + +#ifndef WIN32 +#include +#include +#include +#include +#else +#include +#include +#endif + +/** + * This structure represents a list of addresses. It stores the count of the + * number of elements that have been inserted via calls to addrvec_append and + * addrvec_append_addrinfo. It also has a capacity field for the number of + * addresses it has the ability to hold without needing to be enlarged. + */ +typedef struct _addrvec { + unsigned int next; // next index to use + unsigned int count; // number of addresses in this list + unsigned int capacity; // number of address this list can hold + struct sockaddr_storage *data; // list of addresses +} addrvec_t; + +/** + * Initialize an addrvec by clearing out all its state. + */ +void addrvec_init(addrvec_t *avec); + +/** + * Free any memory used internally by an addrvec + */ +void addrvec_free(addrvec_t *avec); + +/** + * Allocate an addrvec with a default capacity (16) + */ +int addrvec_alloc(addrvec_t *avec); + +/** + * Allocates an addrvec with a specified capacity + */ +int addrvec_alloc_capacity(addrvec_t *avec, uint32_t capacity); + +/** + * Grow an addrvec by the specified amount. This will increase the capacity + * of the vector and not the contents. + */ +int addrvec_grow(addrvec_t *avec, uint32_t grow_amount); + +/** + * Similar to addrvec_grow but uses a default growth amount of 16. + */ +int addrvec_grow_default(addrvec_t *avec); + +/** + * Check if an addrvec contains the specificed sockaddr_storage value. + * \returns 1 if it contains the value and 0 otherwise. + */ +int addrvec_contains(const addrvec_t *avec, const struct sockaddr_storage *addr); + +/** + * Append the given sockaddr_storage pointer into the addrvec. The contents of + * the given 'addr' are copied into the addrvec via memcpy. + */ +int addrvec_append(addrvec_t *avec, const struct sockaddr_storage *addr); + +/** + * Append the given addrinfo pointer into the addrvec. The contents of the given + * 'addrinfo' are copied into the addrvec via memcpy. + */ +int addrvec_append_addrinfo(addrvec_t *avec, const struct addrinfo *addrinfo); + +/** + * Shuffle the addrvec so that it's internal list of addresses are randomized. + * Uses random() and assumes it has been properly seeded. + */ +void addrvec_shuffle(addrvec_t *avec); + +/** + * Determine if the addrvec has a next element (e.g. it's safe to call addrvec_next) + * + * \returns 1 if it has a next element and 0 otherwise + */ +int addrvec_hasnext(const addrvec_t *avec); + +/** + * Determine if the addrvec is at the end or not. Specifically, this means a + * subsequent call to addrvec_next will loop around to the start again. + */ +int addrvec_atend(const addrvec_t *avec); + +/** + * Get the next entry from the addrvec and update the associated index. + * + * If next is NULL, the index will still be updated. + * + * If the current index points at (or after) the last element in the vector then + * it will loop back around and start at the beginning of the list. + */ +void addrvec_next(addrvec_t *avec, struct sockaddr_storage *next); + +/** + * Retrieves the next entry from the addrvec but doesn't update the index. + */ +void addrvec_peek(addrvec_t *avec, struct sockaddr_storage *next); + +/** + * Compare two addrvecs for equality. + * + * \returns 1 if the contents of the two lists are identical and and 0 otherwise. + */ +int addrvec_eq(const addrvec_t *a1, const addrvec_t *a2); + +#endif // ADDRVEC_H + + + diff --git a/ThirdLib/thirdparty/zookeeper/src/cli.c b/ThirdLib/thirdparty/zookeeper/src/cli.c new file mode 100644 index 000000000..6ca4a415f --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/cli.c @@ -0,0 +1,836 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * cli.c is a example/sample C client shell for ZooKeeper. It contains + * basic shell functionality which exercises some of the features of + * the ZooKeeper C client API. It is not a full fledged client and is + * not meant for production usage - see the Java client shell for a + * fully featured shell. + */ + +#include +#include +#include +#include +#include + +#ifndef WIN32 +#include +#include +#include +#else +#include "winport.h" +//#include <-- can't include, conflicting definitions of close() +int read(int _FileHandle, void * _DstBuf, unsigned int _MaxCharCount); +int write(int _Filehandle, const void * _Buf, unsigned int _MaxCharCount); +#define ctime_r(tctime, buffer) ctime_s (buffer, 40, tctime) +#endif + +#include +#include +#include + +#ifdef YCA +#include +#endif + +#define _LL_CAST_ (long long) + +static zhandle_t *zh; +static clientid_t myid; +static const char *clientIdFile = 0; +struct timeval startTime; +static char cmd[1024]; +static int batchMode=0; + +static int to_send=0; +static int sent=0; +static int recvd=0; + +static int shutdownThisThing=0; + +static __attribute__ ((unused)) void +printProfileInfo(struct timeval start, struct timeval end, int thres, + const char* msg) +{ + int delay=(end.tv_sec*1000+end.tv_usec/1000)- + (start.tv_sec*1000+start.tv_usec/1000); + if(delay>thres) + fprintf(stderr,"%s: execution time=%dms\n",msg,delay); +} + +static const char* state2String(int state){ + if (state == 0) + return "CLOSED_STATE"; + if (state == ZOO_CONNECTING_STATE) + return "CONNECTING_STATE"; + if (state == ZOO_ASSOCIATING_STATE) + return "ASSOCIATING_STATE"; + if (state == ZOO_CONNECTED_STATE) + return "CONNECTED_STATE"; + if (state == ZOO_READONLY_STATE) + return "READONLY_STATE"; + if (state == ZOO_EXPIRED_SESSION_STATE) + return "EXPIRED_SESSION_STATE"; + if (state == ZOO_AUTH_FAILED_STATE) + return "AUTH_FAILED_STATE"; + + return "INVALID_STATE"; +} + +static const char* type2String(int state){ + if (state == ZOO_CREATED_EVENT) + return "CREATED_EVENT"; + if (state == ZOO_DELETED_EVENT) + return "DELETED_EVENT"; + if (state == ZOO_CHANGED_EVENT) + return "CHANGED_EVENT"; + if (state == ZOO_CHILD_EVENT) + return "CHILD_EVENT"; + if (state == ZOO_SESSION_EVENT) + return "SESSION_EVENT"; + if (state == ZOO_NOTWATCHING_EVENT) + return "NOTWATCHING_EVENT"; + + return "UNKNOWN_EVENT_TYPE"; +} + +void watcher(zhandle_t *zzh, int type, int state, const char *path, + void* context) +{ + /* Be careful using zh here rather than zzh - as this may be mt code + * the client lib may call the watcher before zookeeper_init returns */ + + fprintf(stderr, "Watcher %s state = %s", type2String(type), state2String(state)); + if (path && strlen(path) > 0) { + fprintf(stderr, " for path %s", path); + } + fprintf(stderr, "\n"); + + if (type == ZOO_SESSION_EVENT) { + if (state == ZOO_CONNECTED_STATE) { + const clientid_t *id = zoo_client_id(zzh); + if (myid.client_id == 0 || myid.client_id != id->client_id) { + myid = *id; + fprintf(stderr, "Got a new session id: 0x%llx\n", + _LL_CAST_ myid.client_id); + if (clientIdFile) { + FILE *fh = fopen(clientIdFile, "w"); + if (!fh) { + perror(clientIdFile); + } else { + int rc = fwrite(&myid, sizeof(myid), 1, fh); + if (rc != sizeof(myid)) { + perror("writing client id"); + } + fclose(fh); + } + } + } + } else if (state == ZOO_AUTH_FAILED_STATE) { + fprintf(stderr, "Authentication failure. Shutting down...\n"); + zookeeper_close(zzh); + shutdownThisThing=1; + zh=0; + } else if (state == ZOO_EXPIRED_SESSION_STATE) { + fprintf(stderr, "Session expired. Shutting down...\n"); + zookeeper_close(zzh); + shutdownThisThing=1; + zh=0; + } + } +} + +void dumpStat(const struct Stat *stat) { + char tctimes[40]; + char tmtimes[40]; + time_t tctime; + time_t tmtime; + + if (!stat) { + fprintf(stderr,"null\n"); + return; + } + tctime = stat->ctime/1000; + tmtime = stat->mtime/1000; + + ctime_r(&tmtime, tmtimes); + ctime_r(&tctime, tctimes); + + fprintf(stderr, "\tctime = %s\tczxid=%llx\n" + "\tmtime=%s\tmzxid=%llx\n" + "\tversion=%x\taversion=%x\n" + "\tephemeralOwner = %llx\n", + tctimes, _LL_CAST_ stat->czxid, tmtimes, + _LL_CAST_ stat->mzxid, + (unsigned int)stat->version, (unsigned int)stat->aversion, + _LL_CAST_ stat->ephemeralOwner); +} + +void my_string_completion(int rc, const char *name, const void *data) { + fprintf(stderr, "[%s]: rc = %d\n", (char*)(data==0?"null":data), rc); + if (!rc) { + fprintf(stderr, "\tname = %s\n", name); + } + if(batchMode) + shutdownThisThing=1; +} + +void my_string_completion_free_data(int rc, const char *name, const void *data) { + my_string_completion(rc, name, data); + free((void*)data); +} + +void my_string_stat_completion(int rc, const char *name, const struct Stat *stat, + const void *data) { + my_string_completion(rc, name, data); + dumpStat(stat); +} + +void my_string_stat_completion_free_data(int rc, const char *name, + const struct Stat *stat, const void *data) { + my_string_stat_completion(rc, name, stat, data); + free((void*)data); +} + +void my_data_completion(int rc, const char *value, int value_len, + const struct Stat *stat, const void *data) { + struct timeval tv; + int sec; + int usec; + gettimeofday(&tv, 0); + sec = tv.tv_sec - startTime.tv_sec; + usec = tv.tv_usec - startTime.tv_usec; + fprintf(stderr, "time = %d msec\n", sec*1000 + usec/1000); + fprintf(stderr, "%s: rc = %d\n", (char*)data, rc); + if (value) { + fprintf(stderr, " value_len = %d\n", value_len); + assert(write(2, value, value_len) == value_len); + } + fprintf(stderr, "\nStat:\n"); + dumpStat(stat); + free((void*)data); + if(batchMode) + shutdownThisThing=1; +} + +void my_silent_data_completion(int rc, const char *value, int value_len, + const struct Stat *stat, const void *data) { + recvd++; + fprintf(stderr, "Data completion %s rc = %d\n",(char*)data,rc); + free((void*)data); + if (recvd==to_send) { + fprintf(stderr,"Recvd %d responses for %d requests sent\n",recvd,to_send); + if(batchMode) + shutdownThisThing=1; + } +} + +void my_strings_completion(int rc, const struct String_vector *strings, + const void *data) { + struct timeval tv; + int sec; + int usec; + int i; + + gettimeofday(&tv, 0); + sec = tv.tv_sec - startTime.tv_sec; + usec = tv.tv_usec - startTime.tv_usec; + fprintf(stderr, "time = %d msec\n", sec*1000 + usec/1000); + fprintf(stderr, "%s: rc = %d\n", (char*)data, rc); + if (strings) + for (i=0; i < strings->count; i++) { + fprintf(stderr, "\t%s\n", strings->data[i]); + } + free((void*)data); + gettimeofday(&tv, 0); + sec = tv.tv_sec - startTime.tv_sec; + usec = tv.tv_usec - startTime.tv_usec; + fprintf(stderr, "time = %d msec\n", sec*1000 + usec/1000); + if(batchMode) + shutdownThisThing=1; +} + +void my_strings_stat_completion(int rc, const struct String_vector *strings, + const struct Stat *stat, const void *data) { + my_strings_completion(rc, strings, data); + dumpStat(stat); + if(batchMode) + shutdownThisThing=1; +} + +void my_void_completion(int rc, const void *data) { + fprintf(stderr, "%s: rc = %d\n", (char*)data, rc); + free((void*)data); + if(batchMode) + shutdownThisThing=1; +} + +void my_stat_completion(int rc, const struct Stat *stat, const void *data) { + fprintf(stderr, "%s: rc = %d Stat:\n", (char*)data, rc); + dumpStat(stat); + free((void*)data); + if(batchMode) + shutdownThisThing=1; +} + +void my_silent_stat_completion(int rc, const struct Stat *stat, + const void *data) { + // fprintf(stderr, "State completion: [%s] rc = %d\n", (char*)data, rc); + sent++; + free((void*)data); +} + +static void sendRequest(const char* data) { + zoo_aset(zh, "/od", data, strlen(data), -1, my_silent_stat_completion, + strdup("/od")); + zoo_aget(zh, "/od", 1, my_silent_data_completion, strdup("/od")); +} + +void od_completion(int rc, const struct Stat *stat, const void *data) { + int i; + fprintf(stderr, "od command response: rc = %d Stat:\n", rc); + dumpStat(stat); + // send a whole bunch of requests + recvd=0; + sent=0; + to_send=200; + for (i=0; i\n"); + fprintf(stderr, " create2 [+[e|s]] \n"); + fprintf(stderr, " delete \n"); + fprintf(stderr, " set \n"); + fprintf(stderr, " get \n"); + fprintf(stderr, " ls \n"); + fprintf(stderr, " ls2 \n"); + fprintf(stderr, " sync \n"); + fprintf(stderr, " exists \n"); + fprintf(stderr, " wexists \n"); + fprintf(stderr, " myid\n"); + fprintf(stderr, " verbose\n"); + fprintf(stderr, " addauth \n"); + fprintf(stderr, " config\n"); + fprintf(stderr, " reconfig [-file | -members ,... | " + " -add ,... | -remove ,...] [-version ]\n"); + fprintf(stderr, " quit\n"); + fprintf(stderr, "\n"); + fprintf(stderr, " prefix the command with the character 'a' to run the command asynchronously.\n"); + fprintf(stderr, " run the 'verbose' command to toggle verbose logging.\n"); + fprintf(stderr, " i.e. 'aget /foo' to get /foo asynchronously\n"); + } else if (startsWith(line, "verbose")) { + if (verbose) { + verbose = 0; + zoo_set_debug_level(ZOO_LOG_LEVEL_WARN); + fprintf(stderr, "logging level set to WARN\n"); + } else { + verbose = 1; + zoo_set_debug_level(ZOO_LOG_LEVEL_DEBUG); + fprintf(stderr, "logging level set to DEBUG\n"); + } + } else if (startsWith(line, "get ")) { + line += 4; + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } + + rc = zoo_aget(zh, line, 1, my_data_completion, strdup(line)); + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (strcmp(line, "config") == 0) { + gettimeofday(&startTime, 0); + rc = zoo_agetconfig(zh, 1, my_data_completion, strdup(ZOO_CONFIG_NODE)); + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (startsWith(line, "reconfig ")) { + int syntaxError = 0; + char* p = NULL; + char* joining = NULL; + char* leaving = NULL; + char* members = NULL; + size_t members_size = 0; + + int mode = 0; // 0 = not set, 1 = incremental, 2 = non-incremental + int64_t version = -1; + + line += 9; + p = strtok (strdup(line)," "); + while (p != NULL) { + if (strcmp(p, "-add")==0) { + p = strtok (NULL," "); + if (mode == 2 || p == NULL) { + syntaxError = 1; + break; + } + mode = 1; + joining = strdup(p); + } else if (strcmp(p, "-remove")==0){ + p = strtok (NULL," "); + if (mode == 2 || p == NULL) { + syntaxError = 1; + break; + } + mode = 1; + leaving = strdup(p); + } else if (strcmp(p, "-members")==0) { + p = strtok (NULL," "); + if (mode == 1 || p == NULL) { + syntaxError = 1; + break; + } + mode = 2; + members = strdup(p); + } else if (strcmp(p, "-file")==0){ + FILE *fp = NULL; + p = strtok (NULL," "); + if (mode == 1 || p == NULL) { + syntaxError = 1; + break; + } + mode = 2; + fp = fopen(p, "r"); + if (fp == NULL) { + fprintf(stderr, "Error reading file: %s\n", p); + syntaxError = 1; + break; + } + fseek(fp, 0L, SEEK_END); /* Position to end of file */ + members_size = ftell(fp); /* Get file length */ + rewind(fp); /* Back to start of file */ + members = calloc(members_size + 1, sizeof(char)); + if(members == NULL ) + { + fprintf(stderr, "\nInsufficient memory to read file: %s\n", p); + syntaxError = 1; + fclose(fp); + break; + } + + /* Read the entire file into members + * NOTE: -- fread returns number of items successfully read + * not the number of bytes. We're requesting one item of + * members_size bytes. So we expect the return value here + * to be 1. + */ + if (fread(members, members_size, 1, fp) != 1){ + fprintf(stderr, "Error reading file: %s\n", p); + syntaxError = 1; + fclose(fp); + break; + } + fclose(fp); + } else if (strcmp(p, "-version")==0){ + p = strtok (NULL," "); + if (version != -1 || p == NULL){ + syntaxError = 1; + break; + } +#ifdef WIN32 + version = _strtoui64(p, NULL, 16); +#else + version = strtoull(p, NULL, 16); +#endif + if (version < 0) { + syntaxError = 1; + break; + } + } else { + syntaxError = 1; + break; + } + p = strtok (NULL," "); + } + if (syntaxError) return; + + rc = zoo_areconfig(zh, joining, leaving, members, version, my_data_completion, strdup(line)); + free(joining); + free(leaving); + free(members); + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + + } else if (startsWith(line, "set ")) { + char *ptr; + line += 4; + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } + ptr = strchr(line, ' '); + if (!ptr) { + fprintf(stderr, "No data found after path\n"); + return; + } + *ptr = '\0'; + ptr++; + rc = zoo_aset(zh, line, ptr, strlen(ptr), -1, my_stat_completion, + strdup(line)); + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (startsWith(line, "ls ")) { + line += 3; + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } + gettimeofday(&startTime, 0); + rc= zoo_aget_children(zh, line, 1, my_strings_completion, strdup(line)); + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (startsWith(line, "ls2 ")) { + line += 4; + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } + gettimeofday(&startTime, 0); + rc= zoo_aget_children2(zh, line, 1, my_strings_stat_completion, strdup(line)); + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (startsWith(line, "create ") || startsWith(line, "create2 ")) { + int flags = 0; + int is_create2 = startsWith(line, "create2 "); + line += is_create2 ? 8 : 7; + if (line[0] == '+') { + line++; + if (line[0] == 'e') { + flags |= ZOO_EPHEMERAL; + line++; + } + if (line[0] == 's') { + flags |= ZOO_SEQUENCE; + line++; + } + line++; + } + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } + fprintf(stderr, "Creating [%s] node\n", line); +// { +// struct ACL _CREATE_ONLY_ACL_ACL[] = {{ZOO_PERM_CREATE, ZOO_ANYONE_ID_UNSAFE}}; +// struct ACL_vector CREATE_ONLY_ACL = {1,_CREATE_ONLY_ACL_ACL}; +// rc = zoo_acreate(zh, line, "new", 3, &CREATE_ONLY_ACL, flags, +// my_string_completion, strdup(line)); +// } + if (is_create2) { + rc = zoo_acreate2(zh, line, "new", 3, &ZOO_OPEN_ACL_UNSAFE, flags, + my_string_stat_completion_free_data, strdup(line)); + } else { + rc = zoo_acreate(zh, line, "new", 3, &ZOO_OPEN_ACL_UNSAFE, flags, + my_string_completion_free_data, strdup(line)); + } + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (startsWith(line, "delete ")) { + line += 7; + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } + rc = zoo_adelete(zh, line, -1, my_void_completion, strdup(line)); + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (startsWith(line, "sync ")) { + line += 5; + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } + rc = zoo_async(zh, line, my_string_completion_free_data, strdup(line)); + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (startsWith(line, "wexists ")) { +#ifdef THREADED + struct Stat stat; +#endif + line += 8; + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } +#ifndef THREADED + rc = zoo_awexists(zh, line, watcher, (void*) 0, my_stat_completion, strdup(line)); +#else + rc = zoo_wexists(zh, line, watcher, (void*) 0, &stat); +#endif + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (startsWith(line, "exists ")) { +#ifdef THREADED + struct Stat stat; +#endif + line += 7; + if (line[0] != '/') { + fprintf(stderr, "Path must start with /, found: %s\n", line); + return; + } +#ifndef THREADED + rc = zoo_aexists(zh, line, 1, my_stat_completion, strdup(line)); +#else + rc = zoo_exists(zh, line, 1, &stat); +#endif + if (rc) { + fprintf(stderr, "Error %d for %s\n", rc, line); + } + } else if (strcmp(line, "myid") == 0) { + printf("session Id = %llx\n", _LL_CAST_ zoo_client_id(zh)->client_id); + } else if (strcmp(line, "reinit") == 0) { + zookeeper_close(zh); + // we can't send myid to the server here -- zookeeper_close() removes + // the session on the server. We must start anew. + zh = zookeeper_init(hostPort, watcher, 30000, 0, 0, 0); + } else if (startsWith(line, "quit")) { + fprintf(stderr, "Quitting...\n"); + shutdownThisThing=1; + } else if (startsWith(line, "od")) { + const char val[]="fire off"; + fprintf(stderr, "Overdosing...\n"); + rc = zoo_aset(zh, "/od", val, sizeof(val)-1, -1, od_completion, 0); + if (rc) + fprintf(stderr, "od command failed: %d\n", rc); + } else if (startsWith(line, "addauth ")) { + char *ptr; + line += 8; + ptr = strchr(line, ' '); + if (ptr) { + *ptr = '\0'; + ptr++; + } + zoo_add_auth(zh, line, ptr, ptr ? strlen(ptr) : 0, NULL, NULL); + } +} + +int main(int argc, char **argv) { +#ifndef THREADED + fd_set rfds, wfds, efds; + int processed=0; +#endif + char buffer[4096]; + char p[2048]; +#ifdef YCA + char *cert=0; + char appId[64]; +#endif + int bufoff = 0; + int flags, i; + FILE *fh; + + if (argc < 2) { + fprintf(stderr, + "USAGE %s zookeeper_host_list [clientid_file|cmd:(ls|ls2|create|create2|od|...)]\n", + argv[0]); + fprintf(stderr, + "Version: ZooKeeper cli (c client) version %d.%d.%d\n", + ZOO_MAJOR_VERSION, + ZOO_MINOR_VERSION, + ZOO_PATCH_VERSION); + return 2; + } + if (argc > 2) { + if(strncmp("cmd:",argv[2],4)==0){ + size_t cmdlen = strlen(argv[2]); + if (cmdlen > sizeof(cmd)) { + fprintf(stderr, + "Command length %zu exceeds max length of %zu\n", + cmdlen, + sizeof(cmd)); + return 2; + } + strncpy(cmd, argv[2]+4, sizeof(cmd)); + batchMode=1; + fprintf(stderr,"Batch mode: %s\n",cmd); + }else{ + clientIdFile = argv[2]; + fh = fopen(clientIdFile, "r"); + if (fh) { + if (fread(&myid, sizeof(myid), 1, fh) != sizeof(myid)) { + memset(&myid, 0, sizeof(myid)); + } + fclose(fh); + } + } + } + + flags = 0; + for (i = 1; i < argc; ++i) { + if (strcmp("-r", argv[i]) == 0) { + flags = ZOO_READONLY; + break; + } + } + +#ifdef YCA + strcpy(appId,"yahoo.example.yca_test"); + cert = yca_get_cert_once(appId); + if(cert!=0) { + fprintf(stderr,"Certificate for appid [%s] is [%s]\n",appId,cert); + strncpy(p,cert,sizeof(p)-1); + free(cert); + } else { + fprintf(stderr,"Certificate for appid [%s] not found\n",appId); + strcpy(p,"dummy"); + } +#else + strcpy(p, "dummy"); +#endif + verbose = 0; + zoo_set_debug_level(ZOO_LOG_LEVEL_WARN); + zoo_deterministic_conn_order(1); // enable deterministic order + hostPort = argv[1]; + zh = zookeeper_init(hostPort, watcher, 30000, &myid, NULL, flags); + if (!zh) { + return errno; + } + +#ifdef YCA + if(zoo_add_auth(zh,"yca",p,strlen(p),0,0)!=ZOK) + return 2; +#endif + +#ifdef THREADED + while(!shutdownThisThing) { + int rc; + int len = sizeof(buffer) - bufoff -1; + if (len <= 0) { + fprintf(stderr, "Can't handle lines that long!\n"); + exit(2); + } + rc = read(0, buffer+bufoff, len); + if (rc <= 0) { + fprintf(stderr, "bye\n"); + shutdownThisThing=1; + break; + } + bufoff += rc; + buffer[bufoff] = '\0'; + while (strchr(buffer, '\n')) { + char *ptr = strchr(buffer, '\n'); + *ptr = '\0'; + processline(buffer); + ptr++; + memmove(buffer, ptr, strlen(ptr)+1); + bufoff = 0; + } + } +#else + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + while (!shutdownThisThing) { + int fd; + int interest; + int events; + struct timeval tv; + int rc; + zookeeper_interest(zh, &fd, &interest, &tv); + if (fd != -1) { + if (interest&ZOOKEEPER_READ) { + FD_SET(fd, &rfds); + } else { + FD_CLR(fd, &rfds); + } + if (interest&ZOOKEEPER_WRITE) { + FD_SET(fd, &wfds); + } else { + FD_CLR(fd, &wfds); + } + } else { + fd = 0; + } + FD_SET(0, &rfds); + rc = select(fd+1, &rfds, &wfds, &efds, &tv); + events = 0; + if (rc > 0) { + if (FD_ISSET(fd, &rfds)) { + events |= ZOOKEEPER_READ; + } + if (FD_ISSET(fd, &wfds)) { + events |= ZOOKEEPER_WRITE; + } + } + if(batchMode && processed==0){ + //batch mode + processline(cmd); + processed=1; + } + if (!processed && FD_ISSET(0, &rfds)) { + int rc; + int len = sizeof(buffer) - bufoff -1; + if (len <= 0) { + fprintf(stderr, "Can't handle lines that long!\n"); + exit(2); + } + rc = read(0, buffer+bufoff, len); + if (rc <= 0) { + fprintf(stderr, "bye\n"); + break; + } + bufoff += rc; + buffer[bufoff] = '\0'; + while (strchr(buffer, '\n')) { + char *ptr = strchr(buffer, '\n'); + *ptr = '\0'; + processline(buffer); + ptr++; + memmove(buffer, ptr, strlen(ptr)+1); + bufoff = 0; + } + } + zookeeper_process(zh, events); + } +#endif + if (to_send!=0) + fprintf(stderr,"Recvd %d responses for %d requests sent\n",recvd,sent); + zookeeper_close(zh); + return 0; +} diff --git a/ThirdLib/thirdparty/zookeeper/src/hashtable/LICENSE.txt b/ThirdLib/thirdparty/zookeeper/src/hashtable/LICENSE.txt new file mode 100644 index 000000000..674a62456 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/hashtable/LICENSE.txt @@ -0,0 +1,30 @@ +Copyright (c) 2002, 2004, Christopher Clark +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + + * Neither the name of the original author; nor the names of any contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable.c b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable.c new file mode 100644 index 000000000..caa5f6ccc --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable.c @@ -0,0 +1,274 @@ +/* Copyright (C) 2004 Christopher Clark */ + +#include "hashtable.h" +#include "hashtable_private.h" +#include +#include +#include +#include + +/* +Credit for primes table: Aaron Krowne + http://br.endernet.org/~akrowne/ + http://planetmath.org/encyclopedia/GoodHashTablePrimes.html +*/ +static const unsigned int primes[] = { +53, 97, 193, 389, +769, 1543, 3079, 6151, +12289, 24593, 49157, 98317, +196613, 393241, 786433, 1572869, +3145739, 6291469, 12582917, 25165843, +50331653, 100663319, 201326611, 402653189, +805306457, 1610612741 +}; +const unsigned int prime_table_length = sizeof(primes)/sizeof(primes[0]); +const float max_load_factor = 0.65; + +/*****************************************************************************/ +struct hashtable * +create_hashtable(unsigned int minsize, + unsigned int (*hashf) (void*), + int (*eqf) (void*,void*)) +{ + struct hashtable *h; + unsigned int pindex, size = primes[0]; + /* Check requested hashtable isn't too large */ + if (minsize > (1u << 30)) return NULL; + /* Enforce size as prime */ + for (pindex=0; pindex < prime_table_length; pindex++) { + if (primes[pindex] > minsize) { size = primes[pindex]; break; } + } + h = (struct hashtable *)malloc(sizeof(struct hashtable)); + if (NULL == h) return NULL; /*oom*/ + h->table = (struct entry **)malloc(sizeof(struct entry*) * size); + if (NULL == h->table) { free(h); return NULL; } /*oom*/ + memset(h->table, 0, size * sizeof(struct entry *)); + h->tablelength = size; + h->primeindex = pindex; + h->entrycount = 0; + h->hashfn = hashf; + h->eqfn = eqf; + h->loadlimit = (unsigned int) ceil(size * max_load_factor); + return h; +} + +/*****************************************************************************/ +unsigned int +hash(struct hashtable *h, void *k) +{ + /* Aim to protect against poor hash functions by adding logic here + * - logic taken from java 1.4 hashtable source */ + unsigned int i = h->hashfn(k); + i += ~(i << 9); + i ^= ((i >> 14) | (i << 18)); /* >>> */ + i += (i << 4); + i ^= ((i >> 10) | (i << 22)); /* >>> */ + return i; +} + +/*****************************************************************************/ +static int +hashtable_expand(struct hashtable *h) +{ + /* Double the size of the table to accomodate more entries */ + struct entry **newtable; + struct entry *e; + struct entry **pE; + unsigned int newsize, i, index; + /* Check we're not hitting max capacity */ + if (h->primeindex == (prime_table_length - 1)) return 0; + newsize = primes[++(h->primeindex)]; + + newtable = (struct entry **)malloc(sizeof(struct entry*) * newsize); + if (NULL != newtable) + { + memset(newtable, 0, newsize * sizeof(struct entry *)); + /* This algorithm is not 'stable'. ie. it reverses the list + * when it transfers entries between the tables */ + for (i = 0; i < h->tablelength; i++) { + while (NULL != (e = h->table[i])) { + h->table[i] = e->next; + index = indexFor(newsize,e->h); + e->next = newtable[index]; + newtable[index] = e; + } + } + free(h->table); + h->table = newtable; + } + /* Plan B: realloc instead */ + else + { + newtable = (struct entry **) + realloc(h->table, newsize * sizeof(struct entry *)); + if (NULL == newtable) { (h->primeindex)--; return 0; } + h->table = newtable; + memset(newtable[h->tablelength], 0, newsize - h->tablelength); + for (i = 0; i < h->tablelength; i++) { + for (pE = &(newtable[i]), e = *pE; e != NULL; e = *pE) { + index = indexFor(newsize,e->h); + if (index == i) + { + pE = &(e->next); + } + else + { + *pE = e->next; + e->next = newtable[index]; + newtable[index] = e; + } + } + } + } + h->tablelength = newsize; + h->loadlimit = (unsigned int) ceil(newsize * max_load_factor); + return -1; +} + +/*****************************************************************************/ +unsigned int +hashtable_count(struct hashtable *h) +{ + return h->entrycount; +} + +/*****************************************************************************/ +int +hashtable_insert(struct hashtable *h, void *k, void *v) +{ + /* This method allows duplicate keys - but they shouldn't be used */ + unsigned int index; + struct entry *e; + if (++(h->entrycount) > h->loadlimit) + { + /* Ignore the return value. If expand fails, we should + * still try cramming just this value into the existing table + * -- we may not have memory for a larger table, but one more + * element may be ok. Next time we insert, we'll try expanding again.*/ + hashtable_expand(h); + } + e = (struct entry *)malloc(sizeof(struct entry)); + if (NULL == e) { --(h->entrycount); return 0; } /*oom*/ + e->h = hash(h,k); + index = indexFor(h->tablelength,e->h); + e->k = k; + e->v = v; + e->next = h->table[index]; + h->table[index] = e; + return -1; +} + +/*****************************************************************************/ +void * /* returns value associated with key */ +hashtable_search(struct hashtable *h, void *k) +{ + struct entry *e; + unsigned int hashvalue, index; + hashvalue = hash(h,k); + index = indexFor(h->tablelength,hashvalue); + e = h->table[index]; + while (NULL != e) + { + /* Check hash value to short circuit heavier comparison */ + if ((hashvalue == e->h) && (h->eqfn(k, e->k))) return e->v; + e = e->next; + } + return NULL; +} + +/*****************************************************************************/ +void * /* returns value associated with key */ +hashtable_remove(struct hashtable *h, void *k) +{ + /* TODO: consider compacting the table when the load factor drops enough, + * or provide a 'compact' method. */ + + struct entry *e; + struct entry **pE; + void *v; + unsigned int hashvalue, index; + + hashvalue = hash(h,k); + index = indexFor(h->tablelength, hashvalue); + pE = &(h->table[index]); + e = *pE; + while (NULL != e) + { + /* Check hash value to short circuit heavier comparison */ + if ((hashvalue == e->h) && (h->eqfn(k, e->k))) + { + *pE = e->next; + h->entrycount--; + v = e->v; + freekey(e->k); + free(e); + return v; + } + pE = &(e->next); + e = e->next; + } + return NULL; +} + +/*****************************************************************************/ +/* destroy */ +void +hashtable_destroy(struct hashtable *h, int free_values) +{ + unsigned int i; + struct entry *e, *f; + struct entry **table = h->table; + if (free_values) + { + for (i = 0; i < h->tablelength; i++) + { + e = table[i]; + while (NULL != e) + { f = e; e = e->next; freekey(f->k); free(f->v); free(f); } + } + } + else + { + for (i = 0; i < h->tablelength; i++) + { + e = table[i]; + while (NULL != e) + { f = e; e = e->next; freekey(f->k); free(f); } + } + } + free(h->table); + free(h); +} + +/* + * Copyright (c) 2002, Christopher Clark + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of the original author; nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ diff --git a/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable.h b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable.h new file mode 100644 index 000000000..cbead1829 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable.h @@ -0,0 +1,209 @@ +/* Copyright (C) 2002 Christopher Clark */ + +#ifndef __HASHTABLE_CWC22_H__ +#define __HASHTABLE_CWC22_H__ +#ifdef WIN32 +#include "winconfig.h" +#endif +#ifdef __cplusplus +extern "C" { +#endif + +struct hashtable; + +/* Example of use: + * + * struct hashtable *h; + * struct some_key *k; + * struct some_value *v; + * + * static unsigned int hash_from_key_fn( void *k ); + * static int keys_equal_fn ( void *key1, void *key2 ); + * + * h = create_hashtable(16, hash_from_key_fn, keys_equal_fn); + * k = (struct some_key *) malloc(sizeof(struct some_key)); + * v = (struct some_value *) malloc(sizeof(struct some_value)); + * + * (initialise k and v to suitable values) + * + * if (! hashtable_insert(h,k,v) ) + * { exit(-1); } + * + * if (NULL == (found = hashtable_search(h,k) )) + * { printf("not found!"); } + * + * if (NULL == (found = hashtable_remove(h,k) )) + * { printf("Not found\n"); } + * + */ + +/* Macros may be used to define type-safe(r) hashtable access functions, with + * methods specialized to take known key and value types as parameters. + * + * Example: + * + * Insert this at the start of your file: + * + * DEFINE_HASHTABLE_INSERT(insert_some, struct some_key, struct some_value); + * DEFINE_HASHTABLE_SEARCH(search_some, struct some_key, struct some_value); + * DEFINE_HASHTABLE_REMOVE(remove_some, struct some_key, struct some_value); + * + * This defines the functions 'insert_some', 'search_some' and 'remove_some'. + * These operate just like hashtable_insert etc., with the same parameters, + * but their function signatures have 'struct some_key *' rather than + * 'void *', and hence can generate compile time errors if your program is + * supplying incorrect data as a key (and similarly for value). + * + * Note that the hash and key equality functions passed to create_hashtable + * still take 'void *' parameters instead of 'some key *'. This shouldn't be + * a difficult issue as they're only defined and passed once, and the other + * functions will ensure that only valid keys are supplied to them. + * + * The cost for this checking is increased code size and runtime overhead + * - if performance is important, it may be worth switching back to the + * unsafe methods once your program has been debugged with the safe methods. + * This just requires switching to some simple alternative defines - eg: + * #define insert_some hashtable_insert + * + */ + +/***************************************************************************** + * create_hashtable + + * @name create_hashtable + * @param minsize minimum initial size of hashtable + * @param hashfunction function for hashing keys + * @param key_eq_fn function for determining key equality + * @return newly created hashtable or NULL on failure + */ + +struct hashtable * +create_hashtable(unsigned int minsize, + unsigned int (*hashfunction) (void*), + int (*key_eq_fn) (void*,void*)); + +/***************************************************************************** + * hashtable_insert + + * @name hashtable_insert + * @param h the hashtable to insert into + * @param k the key - hashtable claims ownership and will free on removal + * @param v the value - does not claim ownership + * @return non-zero for successful insertion + * + * This function will cause the table to expand if the insertion would take + * the ratio of entries to table size over the maximum load factor. + * + * This function does not check for repeated insertions with a duplicate key. + * The value returned when using a duplicate key is undefined -- when + * the hashtable changes size, the order of retrieval of duplicate key + * entries is reversed. + * If in doubt, remove before insert. + */ + +int +hashtable_insert(struct hashtable *h, void *k, void *v); + +#define DEFINE_HASHTABLE_INSERT(fnname, keytype, valuetype) \ +int fnname (struct hashtable *h, keytype *k, valuetype *v) \ +{ \ + return hashtable_insert(h,k,v); \ +} + +/***************************************************************************** + * hashtable_search + + * @name hashtable_search + * @param h the hashtable to search + * @param k the key to search for - does not claim ownership + * @return the value associated with the key, or NULL if none found + */ + +void * +hashtable_search(struct hashtable *h, void *k); + +#define DEFINE_HASHTABLE_SEARCH(fnname, keytype, valuetype) \ +valuetype * fnname (struct hashtable *h, keytype *k) \ +{ \ + return (valuetype *) (hashtable_search(h,k)); \ +} + +/***************************************************************************** + * hashtable_remove + + * @name hashtable_remove + * @param h the hashtable to remove the item from + * @param k the key to search for - does not claim ownership + * @return the value associated with the key, or NULL if none found + */ + +void * /* returns value */ +hashtable_remove(struct hashtable *h, void *k); + +#define DEFINE_HASHTABLE_REMOVE(fnname, keytype, valuetype) \ +valuetype * fnname (struct hashtable *h, keytype *k) \ +{ \ + return (valuetype *) (hashtable_remove(h,k)); \ +} + + +/***************************************************************************** + * hashtable_count + + * @name hashtable_count + * @param h the hashtable + * @return the number of items stored in the hashtable + */ +unsigned int +hashtable_count(struct hashtable *h); + + +/***************************************************************************** + * hashtable_destroy + + * @name hashtable_destroy + * @param h the hashtable + * @param free_values whether to call 'free' on the remaining values + */ + +void +hashtable_destroy(struct hashtable *h, int free_values); + +#ifdef __cplusplus +} +#endif + +#endif /* __HASHTABLE_CWC22_H__ */ + +/* + * Copyright (c) 2002, Christopher Clark + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of the original author; nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ diff --git a/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_itr.c b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_itr.c new file mode 100644 index 000000000..defac691f --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_itr.c @@ -0,0 +1,176 @@ +/* Copyright (C) 2002, 2004 Christopher Clark */ + +#include "hashtable.h" +#include "hashtable_private.h" +#include "hashtable_itr.h" +#include /* defines NULL */ + +/*****************************************************************************/ +/* hashtable_iterator - iterator constructor */ + +struct hashtable_itr * +hashtable_iterator(struct hashtable *h) +{ + unsigned int i, tablelength; + struct hashtable_itr *itr = (struct hashtable_itr *) + malloc(sizeof(struct hashtable_itr)); + if (NULL == itr) return NULL; + itr->h = h; + itr->e = NULL; + itr->parent = NULL; + tablelength = h->tablelength; + itr->index = tablelength; + if (0 == h->entrycount) return itr; + + for (i = 0; i < tablelength; i++) + { + if (NULL != h->table[i]) + { + itr->e = h->table[i]; + itr->index = i; + break; + } + } + return itr; +} + +/*****************************************************************************/ +/* advance - advance the iterator to the next element + * returns zero if advanced to end of table */ + +int +hashtable_iterator_advance(struct hashtable_itr *itr) +{ + unsigned int j,tablelength; + struct entry **table; + struct entry *next; + if (NULL == itr->e) return 0; /* stupidity check */ + + next = itr->e->next; + if (NULL != next) + { + itr->parent = itr->e; + itr->e = next; + return -1; + } + tablelength = itr->h->tablelength; + itr->parent = NULL; + if (tablelength <= (j = ++(itr->index))) + { + itr->e = NULL; + return 0; + } + table = itr->h->table; + while (NULL == (next = table[j])) + { + if (++j >= tablelength) + { + itr->index = tablelength; + itr->e = NULL; + return 0; + } + } + itr->index = j; + itr->e = next; + return -1; +} + +/*****************************************************************************/ +/* remove - remove the entry at the current iterator position + * and advance the iterator, if there is a successive + * element. + * If you want the value, read it before you remove: + * beware memory leaks if you don't. + * Returns zero if end of iteration. */ + +int +hashtable_iterator_remove(struct hashtable_itr *itr) +{ + struct entry *remember_e, *remember_parent; + int ret; + + /* Do the removal */ + if (NULL == (itr->parent)) + { + /* element is head of a chain */ + itr->h->table[itr->index] = itr->e->next; + } else { + /* element is mid-chain */ + itr->parent->next = itr->e->next; + } + /* itr->e is now outside the hashtable */ + remember_e = itr->e; + itr->h->entrycount--; + freekey(remember_e->k); + + /* Advance the iterator, correcting the parent */ + remember_parent = itr->parent; + ret = hashtable_iterator_advance(itr); + if (itr->parent == remember_e) { itr->parent = remember_parent; } + free(remember_e); + return ret; +} + +/*****************************************************************************/ +int /* returns zero if not found */ +hashtable_iterator_search(struct hashtable_itr *itr, + struct hashtable *h, void *k) +{ + struct entry *e, *parent; + unsigned int hashvalue, index; + + hashvalue = hash(h,k); + index = indexFor(h->tablelength,hashvalue); + + e = h->table[index]; + parent = NULL; + while (NULL != e) + { + /* Check hash value to short circuit heavier comparison */ + if ((hashvalue == e->h) && (h->eqfn(k, e->k))) + { + itr->index = index; + itr->e = e; + itr->parent = parent; + itr->h = h; + return -1; + } + parent = e; + e = e->next; + } + return 0; +} + + +/* + * Copyright (c) 2002, 2004, Christopher Clark + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of the original author; nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ diff --git a/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_itr.h b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_itr.h new file mode 100644 index 000000000..30379c7ee --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_itr.h @@ -0,0 +1,119 @@ +/* Copyright (C) 2002, 2004 Christopher Clark */ + +#ifndef __HASHTABLE_ITR_CWC22__ +#define __HASHTABLE_ITR_CWC22__ +#include "hashtable.h" +#include "hashtable_private.h" /* needed to enable inlining */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*****************************************************************************/ +/* This struct is only concrete here to allow the inlining of two of the + * accessor functions. */ +struct hashtable_itr +{ + struct hashtable *h; + struct entry *e; + struct entry *parent; + unsigned int index; +}; + + +/*****************************************************************************/ +/* hashtable_iterator + */ + +struct hashtable_itr * +hashtable_iterator(struct hashtable *h); + +/*****************************************************************************/ +/* hashtable_iterator_key + * - return the value of the (key,value) pair at the current position */ + +static inline void * +hashtable_iterator_key(struct hashtable_itr *i) +{ + return i->e->k; +} + +/*****************************************************************************/ +/* value - return the value of the (key,value) pair at the current position */ + +static inline void * +hashtable_iterator_value(struct hashtable_itr *i) +{ + return i->e->v; +} + +/*****************************************************************************/ +/* advance - advance the iterator to the next element + * returns zero if advanced to end of table */ + +int +hashtable_iterator_advance(struct hashtable_itr *itr); + +/*****************************************************************************/ +/* remove - remove current element and advance the iterator to the next element + * NB: if you need the value to free it, read it before + * removing. ie: beware memory leaks! + * returns zero if advanced to end of table */ + +int +hashtable_iterator_remove(struct hashtable_itr *itr); + +/*****************************************************************************/ +/* search - overwrite the supplied iterator, to point to the entry + * matching the supplied key. + h points to the hashtable to be searched. + * returns zero if not found. */ +int +hashtable_iterator_search(struct hashtable_itr *itr, + struct hashtable *h, void *k); + +#define DEFINE_HASHTABLE_ITERATOR_SEARCH(fnname, keytype) \ +int fnname (struct hashtable_itr *i, struct hashtable *h, keytype *k) \ +{ \ + return (hashtable_iterator_search(i,h,k)); \ +} + + +#ifdef __cplusplus +} +#endif + +#endif /* __HASHTABLE_ITR_CWC22__*/ + +/* + * Copyright (c) 2002, 2004, Christopher Clark + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of the original author; nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ diff --git a/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_private.h b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_private.h new file mode 100644 index 000000000..3e95f6005 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/hashtable/hashtable_private.h @@ -0,0 +1,85 @@ +/* Copyright (C) 2002, 2004 Christopher Clark */ + +#ifndef __HASHTABLE_PRIVATE_CWC22_H__ +#define __HASHTABLE_PRIVATE_CWC22_H__ + +#include "hashtable.h" + +/*****************************************************************************/ +struct entry +{ + void *k, *v; + unsigned int h; + struct entry *next; +}; + +struct hashtable { + unsigned int tablelength; + struct entry **table; + unsigned int entrycount; + unsigned int loadlimit; + unsigned int primeindex; + unsigned int (*hashfn) (void *k); + int (*eqfn) (void *k1, void *k2); +}; + +/*****************************************************************************/ +unsigned int +hash(struct hashtable *h, void *k); + +/*****************************************************************************/ +/* indexFor */ +static inline unsigned int +indexFor(unsigned int tablelength, unsigned int hashvalue) { + return (hashvalue % tablelength); +}; + +/* Only works if tablelength == 2^N */ +/*static inline unsigned int +indexFor(unsigned int tablelength, unsigned int hashvalue) +{ + return (hashvalue & (tablelength - 1u)); +} +*/ + +/*****************************************************************************/ +#define freekey(X) free(X) +/*define freekey(X) ; */ + + +/*****************************************************************************/ + +#endif /* __HASHTABLE_PRIVATE_CWC22_H__*/ + +/* + * Copyright (c) 2002, Christopher Clark + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of the original author; nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ diff --git a/ThirdLib/thirdparty/zookeeper/src/load_gen.c b/ThirdLib/thirdparty/zookeeper/src/load_gen.c new file mode 100644 index 000000000..886fe1b3e --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/load_gen.c @@ -0,0 +1,282 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "zookeeper_log.h" +#include +#ifdef THREADED +#include +#endif +#include +#include + +static zhandle_t *zh; + +static int shutdownThisThing=0; + +// ***************************************************************************** +// +static pthread_cond_t cond=PTHREAD_COND_INITIALIZER; +static pthread_mutex_t lock=PTHREAD_MUTEX_INITIALIZER; + +static pthread_cond_t counterCond=PTHREAD_COND_INITIALIZER; +static pthread_mutex_t counterLock=PTHREAD_MUTEX_INITIALIZER; +static int counter; + + + +void ensureConnected(){ + pthread_mutex_lock(&lock); + while (zoo_state(zh)!=ZOO_CONNECTED_STATE) { + pthread_cond_wait(&cond,&lock); + } + pthread_mutex_unlock(&lock); +} + +void incCounter(int delta){ + pthread_mutex_lock(&counterLock); + counter+=delta; + pthread_cond_broadcast(&counterCond); + pthread_mutex_unlock(&counterLock); + +} +void setCounter(int cnt){ + pthread_mutex_lock(&counterLock); + counter=cnt; + pthread_cond_broadcast(&counterCond); + pthread_mutex_unlock(&counterLock); + +} +void waitCounter(){ + pthread_mutex_lock(&counterLock); + while (counter>0) { + pthread_cond_wait(&counterCond,&counterLock); + } + pthread_mutex_unlock(&counterLock); +} + +void listener(zhandle_t *zzh, int type, int state, const char *path,void* ctx) { + if (type == ZOO_SESSION_EVENT) { + if (state == ZOO_CONNECTED_STATE || state == ZOO_READONLY_STATE) { + pthread_mutex_lock(&lock); + pthread_cond_broadcast(&cond); + pthread_mutex_unlock(&lock); + } + setCounter(0); + } +} + +void create_completion(int rc, const char *name, const void *data) { + incCounter(-1); + if(rc!=ZOK){ + LOG_ERROR(LOGSTREAM, "Failed to create a node rc=%d",rc); + } +} + +int doCreateNodes(const char* root, int count){ + char nodeName[1024]; + int i; + for(i=0; idata) { + int32_t i; + for(i=0;icount; i++) { + free(v->data[i]); + } + free(v->data); + v->data = 0; + } + return 0; +} + +static int deletedCounter; + +int recursiveDelete(const char* root){ + struct String_vector children; + int i; + int rc=zoo_get_children(zh,root,0,&children); + if(rc!=ZNONODE){ + if(rc!=ZOK){ + LOG_ERROR(LOGSTREAM, "Failed to get children of %s, rc=%d",root,rc); + return rc; + } + for(i=0;i +#include +#include +#include +#include +#include + +#ifndef WIN32 +#include +#include +#include +#include +#endif + +int zoo_lock_auth(zhandle_t *zh) +{ + return pthread_mutex_lock(&zh->auth_h.lock); +} +int zoo_unlock_auth(zhandle_t *zh) +{ + return pthread_mutex_unlock(&zh->auth_h.lock); +} +int lock_buffer_list(buffer_head_t *l) +{ + return pthread_mutex_lock(&l->lock); +} +int unlock_buffer_list(buffer_head_t *l) +{ + return pthread_mutex_unlock(&l->lock); +} +int lock_completion_list(completion_head_t *l) +{ + return pthread_mutex_lock(&l->lock); +} +int unlock_completion_list(completion_head_t *l) +{ + pthread_cond_broadcast(&l->cond); + return pthread_mutex_unlock(&l->lock); +} +struct sync_completion *alloc_sync_completion(void) +{ + struct sync_completion *sc = (struct sync_completion*)calloc(1, sizeof(struct sync_completion)); + if (sc) { + pthread_cond_init(&sc->cond, 0); + pthread_mutex_init(&sc->lock, 0); + } + return sc; +} +int wait_sync_completion(struct sync_completion *sc) +{ + pthread_mutex_lock(&sc->lock); + while (!sc->complete) { + pthread_cond_wait(&sc->cond, &sc->lock); + } + pthread_mutex_unlock(&sc->lock); + return 0; +} + +void free_sync_completion(struct sync_completion *sc) +{ + if (sc) { + pthread_mutex_destroy(&sc->lock); + pthread_cond_destroy(&sc->cond); + free(sc); + } +} + +void notify_sync_completion(struct sync_completion *sc) +{ + pthread_mutex_lock(&sc->lock); + sc->complete = 1; + pthread_cond_broadcast(&sc->cond); + pthread_mutex_unlock(&sc->lock); +} + +int process_async(int outstanding_sync) +{ + return 0; +} + +#ifdef WIN32 +unsigned __stdcall do_io( void * ); +unsigned __stdcall do_completion( void * ); + +int handle_error(zhandle_t* zh, SOCKET sock, char* message) +{ + LOG_ERROR(LOGCALLBACK(zh), "%s. %d",message, WSAGetLastError()); + closesocket (sock); + return -1; +} + +//--create socket pair for interupting selects. +int create_socket_pair(zhandle_t* zh, SOCKET fds[2]) +{ + struct sockaddr_in inaddr; + struct sockaddr addr; + int yes=1; + int len=0; + + SOCKET lst=socket(AF_INET, SOCK_STREAM,IPPROTO_TCP); + if (lst == INVALID_SOCKET ){ + LOG_ERROR(LOGCALLBACK(zh), "Error creating socket. %d",WSAGetLastError()); + return -1; + } + memset(&inaddr, 0, sizeof(inaddr)); + memset(&addr, 0, sizeof(addr)); + inaddr.sin_family = AF_INET; + inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + inaddr.sin_port = 0; //--system assigns the port + + if ( setsockopt(lst,SOL_SOCKET,SO_REUSEADDR,(char*)&yes,sizeof(yes)) == SOCKET_ERROR ) { + return handle_error(zh, lst,"Error trying to set socket option."); + } + if (bind(lst,(struct sockaddr *)&inaddr,sizeof(inaddr)) == SOCKET_ERROR){ + return handle_error(zh, lst,"Error trying to bind socket."); + } + if (listen(lst,1) == SOCKET_ERROR){ + return handle_error(zh, lst,"Error trying to listen on socket."); + } + len=sizeof(inaddr); + getsockname(lst, &addr,&len); + fds[0]=socket(AF_INET, SOCK_STREAM,0); + if (connect(fds[0],&addr,len) == SOCKET_ERROR){ + return handle_error(zh, lst, "Error while connecting to socket."); + } + if ((fds[1]=accept(lst,0,0)) == INVALID_SOCKET){ + closesocket(fds[0]); + return handle_error(zh, lst, "Error while accepting socket connection."); + } + closesocket(lst); + return 0; +} +#else +void *do_io(void *); +void *do_completion(void *); +#endif + + +int wakeup_io_thread(zhandle_t *zh); + +#ifdef WIN32 +static int set_nonblock(SOCKET fd){ + ULONG nonblocking_flag = 1; + if (ioctlsocket(fd, FIONBIO, &nonblocking_flag) == 0) + return 1; + else + return -1; +} +#else +static int set_nonblock(int fd){ + long l = fcntl(fd, F_GETFL); + if(l & O_NONBLOCK) return 0; + return fcntl(fd, F_SETFL, l | O_NONBLOCK); +} +#endif + +void wait_for_others(zhandle_t* zh) +{ + struct adaptor_threads* adaptor=zh->adaptor_priv; + pthread_mutex_lock(&adaptor->lock); + while(adaptor->threadsToWait>0) + pthread_cond_wait(&adaptor->cond,&adaptor->lock); + pthread_mutex_unlock(&adaptor->lock); +} + +void notify_thread_ready(zhandle_t* zh) +{ + struct adaptor_threads* adaptor=zh->adaptor_priv; + pthread_mutex_lock(&adaptor->lock); + adaptor->threadsToWait--; + pthread_cond_broadcast(&adaptor->cond); + while(adaptor->threadsToWait>0) + pthread_cond_wait(&adaptor->cond,&adaptor->lock); + pthread_mutex_unlock(&adaptor->lock); +} + + +void start_threads(zhandle_t* zh) +{ + int rc = 0; + struct adaptor_threads* adaptor=zh->adaptor_priv; + pthread_cond_init(&adaptor->cond,0); + pthread_mutex_init(&adaptor->lock,0); + adaptor->threadsToWait=2; // wait for 2 threads before opening the barrier + + // use api_prolog() to make sure zhandle doesn't get destroyed + // while initialization is in progress + api_prolog(zh); + LOG_DEBUG(LOGCALLBACK(zh), "starting threads..."); + rc=pthread_create(&adaptor->io, 0, do_io, zh); + assert("pthread_create() failed for the IO thread"&&!rc); + rc=pthread_create(&adaptor->completion, 0, do_completion, zh); + assert("pthread_create() failed for the completion thread"&&!rc); + wait_for_others(zh); + api_epilog(zh, 0); +} + +int adaptor_init(zhandle_t *zh) +{ + pthread_mutexattr_t recursive_mx_attr; + struct adaptor_threads *adaptor_threads = calloc(1, sizeof(*adaptor_threads)); + if (!adaptor_threads) { + LOG_ERROR(LOGCALLBACK(zh), "Out of memory"); + return -1; + } + + /* We use a pipe for interrupting select() in unix/sol and socketpair in windows. */ +#ifdef WIN32 + if (create_socket_pair(zh, adaptor_threads->self_pipe) == -1){ + LOG_ERROR(LOGCALLBACK(zh), "Can't make a socket."); +#else + if(pipe(adaptor_threads->self_pipe)==-1) { + LOG_ERROR(LOGCALLBACK(zh), "Can't make a pipe %d",errno); +#endif + free(adaptor_threads); + return -1; + } + set_nonblock(adaptor_threads->self_pipe[1]); + set_nonblock(adaptor_threads->self_pipe[0]); + + pthread_mutex_init(&zh->auth_h.lock,0); + + zh->adaptor_priv = adaptor_threads; + pthread_mutex_init(&zh->to_process.lock,0); + pthread_mutex_init(&adaptor_threads->zh_lock,0); + pthread_mutex_init(&adaptor_threads->reconfig_lock,0); + // to_send must be recursive mutex + pthread_mutexattr_init(&recursive_mx_attr); + pthread_mutexattr_settype(&recursive_mx_attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&zh->to_send.lock,&recursive_mx_attr); + pthread_mutexattr_destroy(&recursive_mx_attr); + + pthread_mutex_init(&zh->sent_requests.lock,0); + pthread_cond_init(&zh->sent_requests.cond,0); + pthread_mutex_init(&zh->completions_to_process.lock,0); + pthread_cond_init(&zh->completions_to_process.cond,0); + start_threads(zh); + return 0; +} + +void adaptor_finish(zhandle_t *zh) +{ + struct adaptor_threads *adaptor_threads; + // make sure zh doesn't get destroyed until after we're done here + api_prolog(zh); + adaptor_threads = zh->adaptor_priv; + if(adaptor_threads==0) { + api_epilog(zh,0); + return; + } + + if(!pthread_equal(adaptor_threads->io,pthread_self())){ + wakeup_io_thread(zh); + pthread_join(adaptor_threads->io, 0); + }else + pthread_detach(adaptor_threads->io); + + if(!pthread_equal(adaptor_threads->completion,pthread_self())){ + pthread_mutex_lock(&zh->completions_to_process.lock); + pthread_cond_broadcast(&zh->completions_to_process.cond); + pthread_mutex_unlock(&zh->completions_to_process.lock); + pthread_join(adaptor_threads->completion, 0); + }else + pthread_detach(adaptor_threads->completion); + + api_epilog(zh,0); +} + +void adaptor_destroy(zhandle_t *zh) +{ + struct adaptor_threads *adaptor = zh->adaptor_priv; + if(adaptor==0) return; + + pthread_cond_destroy(&adaptor->cond); + pthread_mutex_destroy(&adaptor->lock); + pthread_mutex_destroy(&zh->to_process.lock); + pthread_mutex_destroy(&zh->to_send.lock); + pthread_mutex_destroy(&zh->sent_requests.lock); + pthread_cond_destroy(&zh->sent_requests.cond); + pthread_mutex_destroy(&zh->completions_to_process.lock); + pthread_cond_destroy(&zh->completions_to_process.cond); + pthread_mutex_destroy(&adaptor->zh_lock); + + pthread_mutex_destroy(&zh->auth_h.lock); + + close(adaptor->self_pipe[0]); + close(adaptor->self_pipe[1]); + free(adaptor); + zh->adaptor_priv=0; +} + +int wakeup_io_thread(zhandle_t *zh) +{ + struct adaptor_threads *adaptor_threads = zh->adaptor_priv; + char c=0; +#ifndef WIN32 + return write(adaptor_threads->self_pipe[1],&c,1)==1? ZOK: ZSYSTEMERROR; +#else + return send(adaptor_threads->self_pipe[1], &c, 1, 0)==1? ZOK: ZSYSTEMERROR; +#endif +} + +int adaptor_send_queue(zhandle_t *zh, int timeout) +{ + if(!zh->close_requested) + return wakeup_io_thread(zh); + // don't rely on the IO thread to send the messages if the app has + // requested to close + return flush_send_queue(zh, timeout); +} + +/* These two are declared here because we will run the event loop + * and not the client */ +#ifdef WIN32 +int zookeeper_interest(zhandle_t *zh, SOCKET *fd, int *interest, + struct timeval *tv); +#else +int zookeeper_interest(zhandle_t *zh, int *fd, int *interest, + struct timeval *tv); +#endif +int zookeeper_process(zhandle_t *zh, int events); + +#ifdef WIN32 +unsigned __stdcall do_io( void * v) +#else +void *do_io(void *v) +#endif +{ + zhandle_t *zh = (zhandle_t*)v; +#ifndef WIN32 + struct pollfd fds[2]; + struct adaptor_threads *adaptor_threads = zh->adaptor_priv; + + api_prolog(zh); + notify_thread_ready(zh); + LOG_DEBUG(LOGCALLBACK(zh), "started IO thread"); + fds[0].fd=adaptor_threads->self_pipe[0]; + fds[0].events=POLLIN; + while(!zh->close_requested) { + zh->io_count++; + struct timeval tv; + int fd; + int interest; + int timeout; + int maxfd=1; + + zookeeper_interest(zh, &fd, &interest, &tv); + if (fd != -1) { + fds[1].fd=fd; + fds[1].events=(interest&ZOOKEEPER_READ)?POLLIN:0; + fds[1].events|=(interest&ZOOKEEPER_WRITE)?POLLOUT:0; + maxfd=2; + } + timeout=tv.tv_sec * 1000 + (tv.tv_usec/1000); + + poll(fds,maxfd,timeout); + if (fd != -1) { + interest=(fds[1].revents&POLLIN)?ZOOKEEPER_READ:0; + interest|=((fds[1].revents&POLLOUT)||(fds[1].revents&POLLHUP))?ZOOKEEPER_WRITE:0; + } + if(fds[0].revents&POLLIN){ + // flush the pipe + char b[128]; + while(read(adaptor_threads->self_pipe[0],b,sizeof(b))==sizeof(b)){} + } +#else + fd_set rfds, wfds; + struct adaptor_threads *adaptor_threads = zh->adaptor_priv; + api_prolog(zh); + notify_thread_ready(zh); + LOG_DEBUG(LOGCALLBACK(zh), "started IO thread"); + + while(!zh->close_requested) { + struct timeval tv; + SOCKET fd; + int interest; + int rc; + + zookeeper_interest(zh, &fd, &interest, &tv); + + // FD_ZERO is cheap on Win32, it just sets count of elements to zero. + // It needs to be done to ensure no stale entries. + FD_ZERO(&rfds); + FD_ZERO(&wfds); + + if (fd != -1) { + if (interest&ZOOKEEPER_READ) { + FD_SET(fd, &rfds); + } + + if (interest&ZOOKEEPER_WRITE) { + FD_SET(fd, &wfds); + } + } + + // Always interested in self_pipe. + FD_SET(adaptor_threads->self_pipe[0], &rfds); + + rc = select(/* unused */0, &rfds, &wfds, NULL, &tv); + if (rc > 0) { + interest=(FD_ISSET(fd, &rfds))? ZOOKEEPER_READ: 0; + interest|=(FD_ISSET(fd, &wfds))? ZOOKEEPER_WRITE: 0; + + if (FD_ISSET(adaptor_threads->self_pipe[0], &rfds)){ + // flush the pipe/socket + char b[128]; + while(recv(adaptor_threads->self_pipe[0],b,sizeof(b), 0)==sizeof(b)){} + } + } + else if (rc < 0) { + LOG_ERROR(LOGCALLBACK(zh), ("select() failed %d [%d].", rc, WSAGetLastError())); + + // Clear interest events for zookeeper_process if select() fails. + interest = 0; + } + +#endif + // dispatch zookeeper events + zookeeper_process(zh, interest); + // check the current state of the zhandle and terminate + // if it is_unrecoverable() + if(is_unrecoverable(zh)) + break; + } + api_epilog(zh, 0); + LOG_DEBUG(LOGCALLBACK(zh), "IO thread terminated"); + return 0; +} + +#ifdef WIN32 +unsigned __stdcall do_completion( void * v) +#else +void *do_completion(void *v) +#endif +{ + zhandle_t *zh = v; + api_prolog(zh); + notify_thread_ready(zh); + LOG_DEBUG(LOGCALLBACK(zh), "started completion thread"); + while(!zh->close_requested) { + pthread_mutex_lock(&zh->completions_to_process.lock); + while(!zh->completions_to_process.head && !zh->close_requested) { + pthread_cond_wait(&zh->completions_to_process.cond, &zh->completions_to_process.lock); + } + pthread_mutex_unlock(&zh->completions_to_process.lock); + process_completions(zh); + } + api_epilog(zh, 0); + LOG_DEBUG(LOGCALLBACK(zh), "completion thread terminated"); + return 0; +} + +int32_t inc_ref_counter(zhandle_t* zh,int i) +{ + int incr=(i<0?-1:(i>0?1:0)); + // fetch_and_add implements atomic post-increment + int v=fetch_and_add(&zh->ref_counter,incr); + // inc_ref_counter wants pre-increment + v+=incr; // simulate pre-increment + return v; +} + +int32_t fetch_and_add(volatile int32_t* operand, int incr) +{ +#ifndef WIN32 + return __sync_fetch_and_add(operand, incr); +#else + return InterlockedExchangeAdd(operand, incr); +#endif +} + +// make sure the static xid is initialized before any threads started +__attribute__((constructor)) int32_t get_xid() +{ + static int32_t xid = -1; + if (xid == -1) { + xid = time(0); + } + return fetch_and_add(&xid,1); +} + +int lock_reconfig(struct _zhandle *zh) +{ + struct adaptor_threads *adaptor = zh->adaptor_priv; + if (adaptor) { + return pthread_mutex_lock(&adaptor->reconfig_lock); + } else { + return 0; + } +} +int unlock_reconfig(struct _zhandle *zh) +{ + struct adaptor_threads *adaptor = zh->adaptor_priv; + if (adaptor) { + return pthread_mutex_unlock(&adaptor->reconfig_lock); + } else { + return 0; + } +} + +int enter_critical(zhandle_t* zh) +{ + struct adaptor_threads *adaptor = zh->adaptor_priv; + if (adaptor) { + return pthread_mutex_lock(&adaptor->zh_lock); + } else { + return 0; + } +} + +int leave_critical(zhandle_t* zh) +{ + struct adaptor_threads *adaptor = zh->adaptor_priv; + if (adaptor) { + return pthread_mutex_unlock(&adaptor->zh_lock); + } else { + return 0; + } +} diff --git a/ThirdLib/thirdparty/zookeeper/src/recordio.c b/ThirdLib/thirdparty/zookeeper/src/recordio.c new file mode 100644 index 000000000..77fae2878 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/recordio.c @@ -0,0 +1,372 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#ifndef WIN32 +#include +#else +#include /* for _htonl and _ntohl */ +#endif + +void deallocate_String(char **s) +{ + if (*s) + free(*s); + *s = 0; +} + +void deallocate_Buffer(struct buffer *b) +{ + if (b->buff) + free(b->buff); + b->buff = 0; +} + +struct buff_struct { + int32_t len; + int32_t off; + char *buffer; +}; + +static int resize_buffer(struct buff_struct *s, int newlen) +{ + char *buffer= NULL; + while (s->len < newlen) { + s->len *= 2; + } + buffer = (char*)realloc(s->buffer, s->len); + if (!buffer) { + s->buffer = 0; + return -ENOMEM; + } + s->buffer = buffer; + return 0; +} + +int oa_start_record(struct oarchive *oa, const char *tag) +{ + return 0; +} +int oa_end_record(struct oarchive *oa, const char *tag) +{ + return 0; +} +int oa_serialize_int(struct oarchive *oa, const char *tag, const int32_t *d) +{ + struct buff_struct *priv = oa->priv; + int32_t i = htonl(*d); + if ((priv->len - priv->off) < sizeof(i)) { + int rc = resize_buffer(priv, priv->len + sizeof(i)); + if (rc < 0) return rc; + } + memcpy(priv->buffer+priv->off, &i, sizeof(i)); + priv->off+=sizeof(i); + return 0; +} +int64_t zoo_htonll(int64_t v) +{ + int i = 0; + char *s = (char *)&v; + if (htonl(1) == 1) { + return v; + } + for (i = 0; i < 4; i++) { + int tmp = s[i]; + s[i] = s[8-i-1]; + s[8-i-1] = tmp; + } + + return v; +} + +int oa_serialize_long(struct oarchive *oa, const char *tag, const int64_t *d) +{ + const int64_t i = zoo_htonll(*d); + struct buff_struct *priv = oa->priv; + if ((priv->len - priv->off) < sizeof(i)) { + int rc = resize_buffer(priv, priv->len + sizeof(i)); + if (rc < 0) return rc; + } + memcpy(priv->buffer+priv->off, &i, sizeof(i)); + priv->off+=sizeof(i); + return 0; +} +int oa_start_vector(struct oarchive *oa, const char *tag, const int32_t *count) +{ + return oa_serialize_int(oa, tag, count); +} +int oa_end_vector(struct oarchive *oa, const char *tag) +{ + return 0; +} +int oa_serialize_bool(struct oarchive *oa, const char *name, const int32_t *i) +{ + //return oa_serialize_int(oa, name, i); + struct buff_struct *priv = oa->priv; + if ((priv->len - priv->off) < 1) { + int rc = resize_buffer(priv, priv->len + 1); + if (rc < 0) + return rc; + } + priv->buffer[priv->off] = (*i == 0 ? '\0' : '\1'); + priv->off++; + return 0; +} +static const int32_t negone = -1; +int oa_serialize_buffer(struct oarchive *oa, const char *name, + const struct buffer *b) +{ + struct buff_struct *priv = oa->priv; + int rc; + if (!b) { + return oa_serialize_int(oa, "len", &negone); + } + rc = oa_serialize_int(oa, "len", &b->len); + if (rc < 0) + return rc; + // this means a buffer of NUll + // with size of -1. This is + // waht we use in java serialization for NULL + if (b->len == -1) { + return rc; + } + if ((priv->len - priv->off) < b->len) { + rc = resize_buffer(priv, priv->len + b->len); + if (rc < 0) + return rc; + } + memcpy(priv->buffer+priv->off, b->buff, b->len); + priv->off += b->len; + return 0; +} +int oa_serialize_string(struct oarchive *oa, const char *name, char **s) +{ + struct buff_struct *priv = oa->priv; + int32_t len; + int rc; + if (!*s) { + oa_serialize_int(oa, "len", &negone); + return 0; + } + len = strlen(*s); + rc = oa_serialize_int(oa, "len", &len); + if (rc < 0) + return rc; + if ((priv->len - priv->off) < len) { + rc = resize_buffer(priv, priv->len + len); + if (rc < 0) + return rc; + } + memcpy(priv->buffer+priv->off, *s, len); + priv->off += len; + return 0; +} +int ia_start_record(struct iarchive *ia, const char *tag) +{ + return 0; +} +int ia_end_record(struct iarchive *ia, const char *tag) +{ + return 0; +} +int ia_deserialize_int(struct iarchive *ia, const char *tag, int32_t *count) +{ + struct buff_struct *priv = ia->priv; + if ((priv->len - priv->off) < sizeof(*count)) { + return -E2BIG; + } + memcpy(count, priv->buffer+priv->off, sizeof(*count)); + priv->off+=sizeof(*count); + *count = ntohl(*count); + return 0; +} + +int ia_deserialize_long(struct iarchive *ia, const char *tag, int64_t *count) +{ + struct buff_struct *priv = ia->priv; + int64_t v = 0; + if ((priv->len - priv->off) < sizeof(*count)) { + return -E2BIG; + } + memcpy(count, priv->buffer+priv->off, sizeof(*count)); + priv->off+=sizeof(*count); + v = zoo_htonll(*count); // htonll and ntohll do the same + *count = v; + return 0; +} +int ia_start_vector(struct iarchive *ia, const char *tag, int32_t *count) +{ + return ia_deserialize_int(ia, tag, count); +} +int ia_end_vector(struct iarchive *ia, const char *tag) +{ + return 0; +} +int ia_deserialize_bool(struct iarchive *ia, const char *name, int32_t *v) +{ + struct buff_struct *priv = ia->priv; + //fprintf(stderr, "Deserializing bool %d\n", priv->off); + //return ia_deserialize_int(ia, name, v); + if ((priv->len - priv->off) < 1) { + return -E2BIG; + } + *v = priv->buffer[priv->off]; + priv->off+=1; + //fprintf(stderr, "Deserializing bool end %d\n", priv->off); + return 0; +} +int ia_deserialize_buffer(struct iarchive *ia, const char *name, + struct buffer *b) +{ + struct buff_struct *priv = ia->priv; + int rc = ia_deserialize_int(ia, "len", &b->len); + if (rc < 0) + return rc; + if ((priv->len - priv->off) < b->len) { + return -E2BIG; + } + // set the buffer to null + if (b->len == -1) { + b->buff = NULL; + return rc; + } + b->buff = malloc(b->len); + if (!b->buff) { + return -ENOMEM; + } + memcpy(b->buff, priv->buffer+priv->off, b->len); + priv->off += b->len; + return 0; +} +int ia_deserialize_string(struct iarchive *ia, const char *name, char **s) +{ + struct buff_struct *priv = ia->priv; + int32_t len; + int rc = ia_deserialize_int(ia, "len", &len); + if (rc < 0) + return rc; + if ((priv->len - priv->off) < len) { + return -E2BIG; + } + if (len < 0) { + return -EINVAL; + } + *s = malloc(len+1); + if (!*s) { + return -ENOMEM; + } + memcpy(*s, priv->buffer+priv->off, len); + (*s)[len] = '\0'; + priv->off += len; + return 0; +} + +static struct iarchive ia_default = { + ia_start_record, + ia_end_record, + ia_start_vector, + ia_end_vector, + ia_deserialize_bool, + ia_deserialize_int, + ia_deserialize_long , + ia_deserialize_buffer, + ia_deserialize_string}; + +static struct oarchive oa_default = { + oa_start_record, + oa_end_record, + oa_start_vector, + oa_end_vector, + oa_serialize_bool, + oa_serialize_int, + oa_serialize_long , + oa_serialize_buffer, + oa_serialize_string}; + +struct iarchive *create_buffer_iarchive(char *buffer, int len) +{ + struct iarchive *ia; + struct buff_struct *buff; + ia = malloc(sizeof(*ia)); + if (!ia) return 0; + buff = malloc(sizeof(struct buff_struct)); + if (!buff) { + free(ia); + return 0; + } + *ia = ia_default; + buff->off = 0; + buff->buffer = buffer; + buff->len = len; + ia->priv = buff; + return ia; +} + +struct oarchive *create_buffer_oarchive() +{ + struct oarchive *oa; + struct buff_struct *buff; + oa = malloc(sizeof(*oa)); + if (!oa) return 0; + buff = malloc(sizeof(struct buff_struct)); + if (!buff) { + free(oa); + return 0; + } + *oa = oa_default; + buff->off = 0; + buff->buffer = malloc(128); + buff->len = 128; + oa->priv = buff; + return oa; +} + +void close_buffer_iarchive(struct iarchive **ia) +{ + free((*ia)->priv); + free(*ia); + *ia = 0; +} + +void close_buffer_oarchive(struct oarchive **oa, int free_buffer) +{ + if (free_buffer) { + struct buff_struct *buff = (struct buff_struct *)(*oa)->priv; + if (buff->buffer) { + free(buff->buffer); + } + } + free((*oa)->priv); + free(*oa); + *oa = 0; +} + +char *get_buffer(struct oarchive *oa) +{ + struct buff_struct *buff = oa->priv; + return buff->buffer; +} +int get_buffer_len(struct oarchive *oa) +{ + struct buff_struct *buff = oa->priv; + return buff->off; +} diff --git a/ThirdLib/thirdparty/zookeeper/src/st_adaptor.c b/ThirdLib/thirdparty/zookeeper/src/st_adaptor.c new file mode 100644 index 000000000..5e9a4ff99 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/st_adaptor.c @@ -0,0 +1,105 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef DLL_EXPORT +# define USE_STATIC_LIB +#endif + +#include "zk_adaptor.h" +#include +#include + +int zoo_lock_auth(zhandle_t *zh) +{ + return 0; +} +int zoo_unlock_auth(zhandle_t *zh) +{ + return 0; +} +int lock_buffer_list(buffer_head_t *l) +{ + return 0; +} +int unlock_buffer_list(buffer_head_t *l) +{ + return 0; +} +int lock_completion_list(completion_head_t *l) +{ + return 0; +} +int unlock_completion_list(completion_head_t *l) +{ + return 0; +} +int process_async(int outstanding_sync) +{ + return outstanding_sync == 0; +} + +int adaptor_init(zhandle_t *zh) +{ + return 0; +} + +void adaptor_finish(zhandle_t *zh){} + +void adaptor_destroy(zhandle_t *zh){} + +int flush_send_queue(zhandle_t *, int); + +int adaptor_send_queue(zhandle_t *zh, int timeout) +{ + return flush_send_queue(zh, timeout); +} + +int32_t inc_ref_counter(zhandle_t* zh,int i) +{ + zh->ref_counter+=(i<0?-1:(i>0?1:0)); + return zh->ref_counter; +} + +int32_t get_xid() +{ + static int32_t xid = -1; + if (xid == -1) { + xid = time(0); + } + return xid++; +} + +int lock_reconfig(struct _zhandle *zh) +{ + return 0; +} + +int unlock_reconfig(struct _zhandle *zh) +{ + return 0; +} + +int enter_critical(zhandle_t* zh) +{ + return 0; +} + +int leave_critical(zhandle_t* zh) +{ + return 0; +} diff --git a/ThirdLib/thirdparty/zookeeper/src/winport.c b/ThirdLib/thirdparty/zookeeper/src/winport.c new file mode 100644 index 000000000..d40614c91 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/winport.c @@ -0,0 +1,307 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifdef WIN32 +#include "winport.h" +#include +#include /* for int64_t */ +#include /* must always be included before ws2tcpip.h */ +#include /* for SOCKET */ + +int pthread_mutex_lock(pthread_mutex_t* _mutex ){ + int rc = WaitForSingleObject( *_mutex, // handle to mutex + INFINITE); // no time-out interval + return ((rc == WAIT_OBJECT_0) ? 0: rc); +} + +int pthread_mutex_unlock( pthread_mutex_t* _mutex ){ + int rc = ReleaseMutex(*_mutex); + return ((rc != 0)? 0: GetLastError()); +} + +int pthread_mutex_init(pthread_mutex_t* _mutex, void* ignoredAttr){ + //use CreateMutex as we are using the HANDLES in pthread_cond + *_mutex = CreateMutex( + NULL, // default security attributes + FALSE, // initially not owned + NULL); // unnamed mutex + return ((*_mutex == NULL) ? GetLastError() : 0); +} + +int pthread_mutex_destroy(pthread_mutex_t* _mutex) +{ + int rc = CloseHandle(*_mutex); + return ((rc != 0)? 0: GetLastError()); +} + +int pthread_create(pthread_t *thread, const pthread_attr_t *attr, unsigned (__stdcall* start_routine)(void* a), void *arg) +{ + int _intThreadId; + (*thread).thread_handle = (HANDLE)_beginthreadex( NULL, 0, start_routine , arg, 0, (unsigned int*)&_intThreadId ); + (*thread).thread_id = _intThreadId; + return (((*thread).thread_handle == 0 ) ? errno : 0 ); +} + + +int pthread_equal(pthread_t t1, pthread_t t2){ +//Is there a better way to do this? GetThreadId(handle) is only supported Windows 2003 n above. + return ((t1.thread_id == t2.thread_id) ? 1:0); +} + +pthread_t pthread_self(){ + pthread_t thread_self; + thread_self.thread_handle = GetCurrentThread(); + thread_self.thread_id = GetCurrentThreadId(); + return thread_self; +} + +int pthread_join(pthread_t _thread, void** ignore) +{ + int rc = WaitForSingleObject( _thread.thread_handle, INFINITE ); + return ((rc == WAIT_OBJECT_0) ? 0: rc); +} + +int pthread_detach(pthread_t _thread) +{ + int rc = CloseHandle(_thread.thread_handle) ; + return (rc != 0) ? 0: GetLastError(); +} + +void pthread_mutexattr_init(pthread_mutexattr_t* ignore){} +void pthread_mutexattr_settype(pthread_mutexattr_t* ingore_attr, int ignore){} +void pthread_mutexattr_destroy(pthread_mutexattr_t* ignore_attr){} + +int +pthread_cond_init (pthread_cond_t *cv, + const pthread_condattr_t * ignore) +{ + cv->waiters_count_ = 0; + cv->was_broadcast_ = 0; + cv->sema_ = CreateSemaphore (NULL, // no security + 0, // initially 0 + 0x7fffffff, // max count + NULL); // unnamed + if (cv->sema_ == NULL ) + return GetLastError(); + InitializeCriticalSection (&cv->waiters_count_lock_); + cv->waiters_done_ = CreateEvent (NULL, // no security + FALSE, // auto-reset + FALSE, // non-signaled initially + NULL); // unnamed + return (cv->waiters_done_ == NULL) ? GetLastError() : 0; + +} + + +int pthread_cond_destroy(pthread_cond_t *cond) +{ + CloseHandle( cond->sema_); + DeleteCriticalSection(&cond->waiters_count_lock_); + return (CloseHandle( cond->waiters_done_ ) == 0)? GetLastError(): 0 ; +} + + +int +pthread_cond_signal (pthread_cond_t *cv) +{ + int have_waiters; + EnterCriticalSection (& (cv->waiters_count_lock_)); + have_waiters = cv->waiters_count_ > 0; + LeaveCriticalSection (&cv->waiters_count_lock_); + + // If there aren't any waiters, then this is a no-op. + if (have_waiters){ + return (ReleaseSemaphore (cv->sema_, 1, 0) == 0 ) ? GetLastError() : 0 ; + }else + return 0; +} + + +int +pthread_cond_broadcast (pthread_cond_t *cv) +{ + // This is needed to ensure that and are + // consistent relative to each other. + int have_waiters = 0; + EnterCriticalSection (&cv->waiters_count_lock_); + + if (cv->waiters_count_ > 0) { + // We are broadcasting, even if there is just one waiter... + // Record that we are broadcasting, which helps optimize + // for the non-broadcast case. + cv->was_broadcast_ = 1; + have_waiters = 1; + } + + if (have_waiters) { + // Wake up all the waiters atomically. + ReleaseSemaphore (cv->sema_, cv->waiters_count_, 0); + + LeaveCriticalSection (&cv->waiters_count_lock_); + + // Wait for all the awakened threads to acquire the counting + // semaphore. + WaitForSingleObject (cv->waiters_done_, INFINITE); + // This assignment is okay, even without the held + // because no other waiter threads can wake up to access it. + cv->was_broadcast_ = 0; + } + else + LeaveCriticalSection (&cv->waiters_count_lock_); +} + + +int +pthread_cond_wait (pthread_cond_t *cv, + pthread_mutex_t *external_mutex) +{ + int last_waiter; + // Avoid race conditions. + EnterCriticalSection (&cv->waiters_count_lock_); + cv->waiters_count_++; + LeaveCriticalSection (&cv->waiters_count_lock_); + + // This call atomically releases the mutex and waits on the + // semaphore until or + // are called by another thread. + SignalObjectAndWait (*external_mutex, cv->sema_, INFINITE, FALSE); + + // Reacquire lock to avoid race conditions. + EnterCriticalSection (&cv->waiters_count_lock_); + + // We're no longer waiting... + cv->waiters_count_--; + + // Check to see if we're the last waiter after . + last_waiter = cv->was_broadcast_ && cv->waiters_count_ == 0; + + LeaveCriticalSection (&cv->waiters_count_lock_); + + // If we're the last waiter thread during this particular broadcast + // then let all the other threads proceed. + if (last_waiter) + // This call atomically signals the event and waits until + // it can acquire the . This is required to ensure fairness. + SignalObjectAndWait (cv->waiters_done_, *external_mutex, INFINITE, FALSE); + else + // Always regain the external mutex since that's the guarantee we + // give to our callers. + WaitForSingleObject (*external_mutex, INFINITE); +} + +int pthread_key_create(pthread_key_t *key, void (*destructor)(void *) ) +{ + int result = 0; + pthread_key_t* newkey; + + if ((newkey = (pthread_key_t*) calloc (1, sizeof (pthread_key_t))) == NULL) + { + result = ENOMEM; + } + else if ((newkey->key = TlsAlloc ()) == TLS_OUT_OF_INDEXES) + { + result = EAGAIN; + free (newkey); + newkey = NULL; + } + else if (destructor != NULL) + { + //--we have to store the function pointer for destructor, so that we can call it + //--to free up the user allocated storage-- + newkey->destructor = destructor; + } + key = newkey; + return (result); +} + +int pthread_key_delete(pthread_key_t key) +{ + int rc = 0; + LPVOID lpvData = TlsGetValue(key.key); + rc = TlsFree (key.key); + rc = (rc != 0 ) ? 0 : GetLastError(); + if (key.destructor != NULL && lpvData != 0){ + key.destructor(lpvData); //we take control of calling destructor, instead of calling it on thread exit. + } + free (&key); + return (rc); +} + +void *pthread_getspecific(pthread_key_t key) +{ + LPVOID lpvData = TlsGetValue(key.key); + if ((lpvData == 0) && (GetLastError() != ERROR_SUCCESS)) + return NULL; + else + return lpvData; +} + +int pthread_setspecific(pthread_key_t key, const void *value) +{ + int rc = TlsSetValue (key.key, value); + return ((rc != 0 ) ? 0 : GetLastError()); +} + +int gettimeofday(struct timeval *tp, void *tzp) { + int64_t now = 0; + if (tzp != 0) { errno = EINVAL; return -1; } + GetSystemTimeAsFileTime( (LPFILETIME)&now ); + tp->tv_sec = (long)(now / 10000000 - 11644473600LL); + tp->tv_usec = (now / 10) % 1000000; + return 0; +} + +int close(SOCKET fd) { + return closesocket(fd); +} + +int Win32WSAStartup() +{ + WORD wVersionRq; + WSADATA wsaData; + int err; + + wVersionRq = MAKEWORD(2,0); + err = WSAStartup(wVersionRq, &wsaData); + if (err != 0) + return 1; + + // confirm the version information + if ((LOBYTE(wsaData.wVersion) != 2) || + (HIBYTE(wsaData.wVersion) != 0)) + { + Win32WSACleanup(); + return 1; + } + return 0; +} + +void Win32WSACleanup() +{ + WSACleanup(); +} + +double drand48(void) +{ + return (double)(rand()) / RAND_MAX; +} + +#endif //WIN32 + + + diff --git a/ThirdLib/thirdparty/zookeeper/src/winport.h b/ThirdLib/thirdparty/zookeeper/src/winport.h new file mode 100644 index 000000000..d216f7fd3 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/winport.h @@ -0,0 +1,139 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This header file is to port pthread lib , sockets and other utility methods on windows. + * Specifically the threads function, mutexes, keys, and socket initialization. + */ + +#ifndef WINPORT_H_ +#define WINPORT_H_ + +#ifdef WIN32 +#include "winconfig.h" + +#define _WINSOCK_DEPRECATED_NO_WARNINGS +#include /* must always be included before ws2tcpip.h */ +#include /* for struct sock_addr used in zookeeper.h */ + +/* POSIX names are deprecated, use ISO conformant names instead. */ +#define strdup _strdup +#define getcwd _getcwd +#define getpid _getpid + +/* Windows "secure" versions of POSIX reentrant functions */ +#define strtok_r strtok_s +#define localtime_r(a,b) localtime_s(b,a) + +/* After this version of MSVC, snprintf became a defined function, + and so cannot be redefined, nor can #ifndef be used to guard it. */ +#if ((defined(_MSC_VER) && _MSC_VER < 1900) || !defined(_MSC_VER)) +#define snprintf _snprintf +#endif + + +#include +#include +#include /* for int64_t */ +#include +#include + + +typedef int ssize_t; +typedef HANDLE pthread_mutex_t; + +struct pthread_t_ +{ + HANDLE thread_handle; + DWORD thread_id; +}; + +typedef struct pthread_t_ pthread_t; +typedef int pthread_mutexattr_t; +typedef int pthread_condattr_t; +typedef int pthread_attr_t; +#define PTHREAD_MUTEX_RECURSIVE 0 + +int pthread_mutex_lock(pthread_mutex_t* _mutex ); +int pthread_mutex_unlock( pthread_mutex_t* _mutex ); +int pthread_mutex_init(pthread_mutex_t* _mutex, void* ignoredAttr); +int pthread_mutex_destroy(pthread_mutex_t* _mutex); +int pthread_create(pthread_t *thread, const pthread_attr_t *attr, unsigned (__stdcall* start_routine)(void* a), void *arg); +int pthread_equal(pthread_t t1, pthread_t t2); +pthread_t pthread_self(); +int pthread_join(pthread_t _thread, void** ignore); +int pthread_detach(pthread_t _thread); + +void pthread_mutexattr_init(pthread_mutexattr_t* ignore); +void pthread_mutexattr_settype(pthread_mutexattr_t* ingore_attr, int ignore); +void pthread_mutexattr_destroy(pthread_mutexattr_t* ignore_attr); + + +// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html + +typedef struct +{ + int waiters_count_; + // Number of waiting threads. + + CRITICAL_SECTION waiters_count_lock_; + // Serialize access to . + + HANDLE sema_; + // Semaphore used to queue up threads waiting for the condition to + // become signaled. + + HANDLE waiters_done_; + // An auto-reset event used by the broadcast/signal thread to wait + // for all the waiting thread(s) to wake up and be released from the + // semaphore. + + size_t was_broadcast_; + // Keeps track of whether we were broadcasting or signaling. This + // allows us to optimize the code if we're just signaling. +}pthread_cond_t; + +int pthread_cond_init (pthread_cond_t *cv,const pthread_condattr_t * ignore); +int pthread_cond_destroy(pthread_cond_t *cond); +int pthread_cond_signal (pthread_cond_t *cv); +int pthread_cond_broadcast (pthread_cond_t *cv); +int pthread_cond_wait (pthread_cond_t *cv, pthread_mutex_t *external_mutex); + + +struct pthread_key_t_ +{ + DWORD key; + void (*destructor) (void *); +}; + +typedef struct pthread_key_t_ pthread_key_t; +int pthread_key_create(pthread_key_t *key, void (*destructor)(void *) ); +int pthread_key_delete(pthread_key_t key); +void *pthread_getspecific(pthread_key_t key); +int pthread_setspecific(pthread_key_t key, const void *value); + +int gettimeofday(struct timeval *tp, void *tzp); +int close(SOCKET fd); +int Win32WSAStartup(); +void Win32WSACleanup(); +double drand48(void); +#endif //WIN32 + + + +#endif //WINPORT_H_ diff --git a/ThirdLib/thirdparty/zookeeper/src/zk_adaptor.h b/ThirdLib/thirdparty/zookeeper/src/zk_adaptor.h new file mode 100644 index 000000000..97995e36a --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/zk_adaptor.h @@ -0,0 +1,325 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ZK_ADAPTOR_H_ +#define ZK_ADAPTOR_H_ +#include +#ifdef THREADED +#ifndef WIN32 +#include +#else +#include "winport.h" +#endif +#endif +#include "zookeeper.h" +#include "zk_hashtable.h" +#include "addrvec.h" + +/* predefined xid's values recognized as special by the server */ +#define WATCHER_EVENT_XID -1 +#define PING_XID -2 +#define AUTH_XID -4 +#define SET_WATCHES_XID -8 + +/* zookeeper state constants */ +#define EXPIRED_SESSION_STATE_DEF -112 +#define AUTH_FAILED_STATE_DEF -113 +#define CONNECTING_STATE_DEF 1 +#define ASSOCIATING_STATE_DEF 2 +#define CONNECTED_STATE_DEF 3 +#define READONLY_STATE_DEF 5 +#define NOTCONNECTED_STATE_DEF 999 + +/* zookeeper event type constants */ +#define CREATED_EVENT_DEF 1 +#define DELETED_EVENT_DEF 2 +#define CHANGED_EVENT_DEF 3 +#define CHILD_EVENT_DEF 4 +#define SESSION_EVENT_DEF -1 +#define NOTWATCHING_EVENT_DEF -2 + +#ifdef __cplusplus +extern "C" { +#endif + +struct _buffer_list; +struct _completion_list; + +typedef struct _buffer_head { + struct _buffer_list *volatile head; + struct _buffer_list *last; +#ifdef THREADED + pthread_mutex_t lock; +#endif +} buffer_head_t; + +typedef struct _completion_head { + struct _completion_list *volatile head; + struct _completion_list *last; +#ifdef THREADED + pthread_cond_t cond; + pthread_mutex_t lock; +#endif +} completion_head_t; + +int lock_buffer_list(buffer_head_t *l); +int unlock_buffer_list(buffer_head_t *l); +int lock_completion_list(completion_head_t *l); +int unlock_completion_list(completion_head_t *l); + +struct sync_completion { + int rc; + union { + struct { + char *str; + int str_len; + } str; + struct Stat stat; + struct { + char *buffer; + int buff_len; + struct Stat stat; + } data; + struct { + struct ACL_vector acl; + struct Stat stat; + } acl; + struct String_vector strs2; + struct { + struct String_vector strs2; + struct Stat stat2; + } strs_stat; + } u; + int complete; +#ifdef THREADED + pthread_cond_t cond; + pthread_mutex_t lock; +#endif +}; + +typedef struct _auth_info { + int state; /* 0=>inactive, >0 => active */ + char* scheme; + struct buffer auth; + void_completion_t completion; + const char* data; + struct _auth_info *next; +} auth_info; + +/** + * This structure represents a packet being read or written. + */ +typedef struct _buffer_list { + char *buffer; + int len; /* This represents the length of sizeof(header) + length of buffer */ + int curr_offset; /* This is the offset into the header followed by offset into the buffer */ + struct _buffer_list *next; +} buffer_list_t; + +/* the size of connect request */ +#define HANDSHAKE_REQ_SIZE 45 +/* connect request */ +struct connect_req { + int32_t protocolVersion; + int64_t lastZxidSeen; + int32_t timeOut; + int64_t sessionId; + int32_t passwd_len; + char passwd[16]; + char readOnly; +}; + +/* the connect response */ +struct prime_struct { + int32_t len; + int32_t protocolVersion; + int32_t timeOut; + int64_t sessionId; + int32_t passwd_len; + char passwd[16]; + char readOnly; +}; + +#ifdef THREADED +/* this is used by mt_adaptor internally for thread management */ +struct adaptor_threads { + pthread_t io; + pthread_t completion; + int threadsToWait; // barrier + pthread_cond_t cond; // barrier's conditional + pthread_mutex_t lock; // ... and a lock + pthread_mutex_t zh_lock; // critical section lock + pthread_mutex_t reconfig_lock; // lock for reconfiguring cluster's ensemble +#ifdef WIN32 + SOCKET self_pipe[2]; +#else + int self_pipe[2]; +#endif +}; +#endif + +/** the auth list for adding auth */ +typedef struct _auth_list_head { + auth_info *auth; +#ifdef THREADED + pthread_mutex_t lock; +#endif +} auth_list_head_t; + +/** + * This structure represents the connection to zookeeper. + */ +struct _zhandle { +#ifdef WIN32 + SOCKET fd; // the descriptor used to talk to zookeeper +#else + int fd; // the descriptor used to talk to zookeeper +#endif + + // Hostlist and list of addresses + char *hostname; // hostname contains list of zookeeper servers to connect to + struct sockaddr_storage addr_cur; // address of server we're currently connecting/connected to + struct sockaddr_storage addr_rw_server; // address of last known read/write server found. + + addrvec_t addrs; // current list of addresses we're connected to + addrvec_t addrs_old; // old list of addresses that we are no longer connected to + addrvec_t addrs_new; // new list of addresses to connect to if we're reconfiguring + + int reconfig; // Are we in the process of reconfiguring cluster's ensemble + double pOld, pNew; // Probability for selecting between 'addrs_old' and 'addrs_new' + int delay; + int disable_reconnection_attempt; // When set, client will not try reconnect to a different server in + // server list. This makes a sticky server for client, and is useful + // for testing if a sticky server is required, or if client wants to + // explicitly shuffle server by calling zoo_cycle_next_server. + // The default value is 0. + + watcher_fn watcher; // the registered watcher + + // Message timings + struct timeval last_recv; // time last message was received + struct timeval last_send; // time last message was sent + struct timeval last_ping; // time last PING was sent + struct timeval next_deadline; // time of the next deadline + int recv_timeout; // max receive timeout for messages from server + + // Buffers + buffer_list_t *input_buffer; // current buffer being read in + buffer_head_t to_process; // buffers that have been read and ready to be processed + buffer_head_t to_send; // packets queued to send + completion_head_t sent_requests; // outstanding requests + completion_head_t completions_to_process; // completions that are ready to run + int outstanding_sync; // number of outstanding synchronous requests + + /* read-only mode specific fields */ + struct timeval last_ping_rw; /* The last time we checked server for being r/w */ + int ping_rw_timeout; /* The time that can go by before checking next server */ + + // State info + volatile int state; // Current zookeeper state + void *context; // client-side provided context + clientid_t client_id; // client-id + long long last_zxid; // last zookeeper ID + auth_list_head_t auth_h; // authentication data list + log_callback_fn log_callback; // Callback for logging (falls back to logging to stderr) + int io_count; // counts the number of iterations of do_io + + // Primer storage + struct _buffer_list primer_buffer; // The buffer used for the handshake at the start of a connection + struct prime_struct primer_storage; // the connect response + char primer_storage_buffer[41]; // the true size of primer_storage + + /* zookeeper_close is not reentrant because it de-allocates the zhandler. + * This guard variable is used to defer the destruction of zhandle till + * right before top-level API call returns to the caller */ + int32_t ref_counter; + volatile int close_requested; + void *adaptor_priv; + + /* Used for debugging only: non-zero value indicates the time when the zookeeper_process + * call returned while there was at least one unprocessed server response + * available in the socket recv buffer */ + struct timeval socket_readable; + + // Watchers + zk_hashtable* active_node_watchers; + zk_hashtable* active_exist_watchers; + zk_hashtable* active_child_watchers; + + /** used for chroot path at the client side **/ + char *chroot; + + /** Indicates if this client is allowed to go to r/o mode */ + char allow_read_only; + /** Indicates if we connected to a majority server before */ + char seen_rw_server_before; +}; + + +int adaptor_init(zhandle_t *zh); +void adaptor_finish(zhandle_t *zh); +void adaptor_destroy(zhandle_t *zh); +#if THREADED +struct sync_completion *alloc_sync_completion(void); +int wait_sync_completion(struct sync_completion *sc); +void free_sync_completion(struct sync_completion *sc); +void notify_sync_completion(struct sync_completion *sc); +#endif +int adaptor_send_queue(zhandle_t *zh, int timeout); +int process_async(int outstanding_sync); +void process_completions(zhandle_t *zh); +int flush_send_queue(zhandle_t*zh, int timeout); +char* sub_string(zhandle_t *zh, const char* server_path); +void free_duplicate_path(const char* free_path, const char* path); +int zoo_lock_auth(zhandle_t *zh); +int zoo_unlock_auth(zhandle_t *zh); + +// ensemble reconfigure access guards +int lock_reconfig(struct _zhandle *zh); +int unlock_reconfig(struct _zhandle *zh); + +// critical section guards +int enter_critical(zhandle_t* zh); +int leave_critical(zhandle_t* zh); + +// zhandle object reference counting +void api_prolog(zhandle_t* zh); +int api_epilog(zhandle_t *zh, int rc); +int32_t get_xid(); + +// returns the new value of the ref counter +int32_t inc_ref_counter(zhandle_t* zh,int i); + +#ifdef THREADED +// atomic post-increment +int32_t fetch_and_add(volatile int32_t* operand, int incr); +// in mt mode process session event asynchronously by the completion thread +#define PROCESS_SESSION_EVENT(zh,newstate) queue_session_event(zh,newstate) +#else +// in single-threaded mode process session event immediately +//#define PROCESS_SESSION_EVENT(zh,newstate) deliverWatchers(zh,ZOO_SESSION_EVENT,newstate,0) +#define PROCESS_SESSION_EVENT(zh,newstate) queue_session_event(zh,newstate) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*ZK_ADAPTOR_H_*/ + + diff --git a/ThirdLib/thirdparty/zookeeper/src/zk_hashtable.c b/ThirdLib/thirdparty/zookeeper/src/zk_hashtable.c new file mode 100644 index 000000000..da3fb8359 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/zk_hashtable.c @@ -0,0 +1,476 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "zk_hashtable.h" +#include "zk_adaptor.h" +#include "hashtable/hashtable.h" +#include "hashtable/hashtable_itr.h" +#include +#include +#include + +typedef struct _watcher_object { + watcher_fn watcher; + void* context; + struct _watcher_object* next; +} watcher_object_t; + + +struct _zk_hashtable { + struct hashtable* ht; +}; + +struct watcher_object_list { + watcher_object_t* head; +}; + +/* the following functions are for testing only */ +typedef struct hashtable hashtable_impl; + +hashtable_impl* getImpl(zk_hashtable* ht){ + return ht->ht; +} + +watcher_object_t* getFirstWatcher(zk_hashtable* ht,const char* path) +{ + watcher_object_list_t* wl=hashtable_search(ht->ht,(void*)path); + if(wl!=0) + return wl->head; + return 0; +} +/* end of testing functions */ + +watcher_object_t* clone_watcher_object(watcher_object_t* wo) +{ + watcher_object_t* res=calloc(1,sizeof(watcher_object_t)); + assert(res); + res->watcher=wo->watcher; + res->context=wo->context; + return res; +} + +static unsigned int string_hash_djb2(void *str) +{ + unsigned int hash = 5381; + int c; + const char* cstr = (const char*)str; + while ((c = *cstr++)) + hash = ((hash << 5) + hash) + c; /* hash * 33 + c */ + + return hash; +} + +static int string_equal(void *key1,void *key2) +{ + return strcmp((const char*)key1,(const char*)key2)==0; +} + +static watcher_object_t* create_watcher_object(watcher_fn watcher,void* ctx) +{ + watcher_object_t* wo=calloc(1,sizeof(watcher_object_t)); + assert(wo); + wo->watcher=watcher; + wo->context=ctx; + return wo; +} + +static watcher_object_list_t* create_watcher_object_list(watcher_object_t* head) +{ + watcher_object_list_t* wl=calloc(1,sizeof(watcher_object_list_t)); + assert(wl); + wl->head=head; + return wl; +} + +static void destroy_watcher_object_list(watcher_object_list_t* list) +{ + watcher_object_t* e = NULL; + + if(list==0) + return; + e=list->head; + while(e!=0){ + watcher_object_t* this=e; + e=e->next; + free(this); + } + free(list); +} + +zk_hashtable* create_zk_hashtable() +{ + struct _zk_hashtable *ht=calloc(1,sizeof(struct _zk_hashtable)); + assert(ht); + ht->ht=create_hashtable(32,string_hash_djb2,string_equal); + return ht; +} + +static void do_clean_hashtable(zk_hashtable* ht) +{ + struct hashtable_itr *it; + int hasMore; + if(hashtable_count(ht->ht)==0) + return; + it=hashtable_iterator(ht->ht); + do { + watcher_object_list_t* w=hashtable_iterator_value(it); + destroy_watcher_object_list(w); + hasMore=hashtable_iterator_remove(it); + } while(hasMore); + free(it); +} + +void destroy_zk_hashtable(zk_hashtable* ht) +{ + if(ht!=0){ + do_clean_hashtable(ht); + hashtable_destroy(ht->ht,0); + free(ht); + } +} + +// searches for a watcher object instance in a watcher object list; +// two watcher objects are equal if their watcher function and context pointers +// are equal +static watcher_object_t* search_watcher(watcher_object_list_t** wl,watcher_object_t* wo) +{ + watcher_object_t* wobj=(*wl)->head; + while(wobj!=0){ + if(wobj->watcher==wo->watcher && wobj->context==wo->context) + return wobj; + wobj=wobj->next; + } + return 0; +} + +static int add_to_list(watcher_object_list_t **wl, watcher_object_t *wo, + int clone) +{ + if (search_watcher(wl, wo)==0) { + watcher_object_t* cloned=wo; + if (clone) { + cloned = clone_watcher_object(wo); + assert(cloned); + } + cloned->next = (*wl)->head; + (*wl)->head = cloned; + return 1; + } else if (!clone) { + // If it's here and we aren't supposed to clone, we must destroy + free(wo); + } + return 0; +} + +static int do_insert_watcher_object(zk_hashtable *ht, const char *path, watcher_object_t* wo) +{ + int res=1; + watcher_object_list_t* wl; + + wl=hashtable_search(ht->ht,(void*)path); + if(wl==0){ + int res; + /* inserting a new path element */ + res=hashtable_insert(ht->ht,strdup(path),create_watcher_object_list(wo)); + assert(res); + }else{ + /* + * Path already exists; check if the watcher already exists. + * Don't clone the watcher since it's allocated on the heap --- avoids + * a memory leak and saves a clone operation (calloc + copy). + */ + res = add_to_list(&wl, wo, 0); + } + return res; +} + + +char **collect_keys(zk_hashtable *ht, int *count) +{ + char **list; + struct hashtable_itr *it; + int i; + + *count = hashtable_count(ht->ht); + list = calloc(*count, sizeof(char*)); + it=hashtable_iterator(ht->ht); + for(i = 0; i < *count; i++) { + list[i] = strdup(hashtable_iterator_key(it)); + hashtable_iterator_advance(it); + } + free(it); + return list; +} + +static int insert_watcher_object(zk_hashtable *ht, const char *path, + watcher_object_t* wo) +{ + int res; + res=do_insert_watcher_object(ht,path,wo); + return res; +} + +static void copy_watchers(watcher_object_list_t *from, watcher_object_list_t *to, int clone) +{ + watcher_object_t* wo=from->head; + while(wo){ + watcher_object_t *next = wo->next; + add_to_list(&to, wo, clone); + wo=next; + } +} + +static void copy_table(zk_hashtable *from, watcher_object_list_t *to) { + struct hashtable_itr *it; + int hasMore; + if(hashtable_count(from->ht)==0) + return; + it=hashtable_iterator(from->ht); + do { + watcher_object_list_t *w = hashtable_iterator_value(it); + copy_watchers(w, to, 1); + hasMore=hashtable_iterator_advance(it); + } while(hasMore); + free(it); +} + +static void collect_session_watchers(zhandle_t *zh, + watcher_object_list_t **list) +{ + copy_table(zh->active_node_watchers, *list); + copy_table(zh->active_exist_watchers, *list); + copy_table(zh->active_child_watchers, *list); +} + +static void add_for_event(zk_hashtable *ht, char *path, watcher_object_list_t **list) +{ + watcher_object_list_t* wl; + wl = (watcher_object_list_t*)hashtable_remove(ht->ht, path); + if (wl) { + copy_watchers(wl, *list, 0); + // Since we move, not clone the watch_objects, we just need to free the + // head pointer + free(wl); + } +} + +static void do_foreach_watcher(watcher_object_t* wo,zhandle_t* zh, + const char* path,int type,int state) +{ + // session event's don't have paths + const char *client_path = + (type != ZOO_SESSION_EVENT ? sub_string(zh, path) : path); + while(wo!=0){ + wo->watcher(zh,type,state,client_path,wo->context); + wo=wo->next; + } + free_duplicate_path(client_path, path); +} + +watcher_object_list_t *collectWatchers(zhandle_t *zh,int type, char *path) +{ + struct watcher_object_list *list = create_watcher_object_list(0); + + if(type==ZOO_SESSION_EVENT){ + watcher_object_t defWatcher; + defWatcher.watcher=zh->watcher; + defWatcher.context=zh->context; + add_to_list(&list, &defWatcher, 1); + collect_session_watchers(zh, &list); + return list; + } + switch(type){ + case CREATED_EVENT_DEF: + case CHANGED_EVENT_DEF: + // look up the watchers for the path and move them to a delivery list + add_for_event(zh->active_node_watchers,path,&list); + add_for_event(zh->active_exist_watchers,path,&list); + break; + case CHILD_EVENT_DEF: + // look up the watchers for the path and move them to a delivery list + add_for_event(zh->active_child_watchers,path,&list); + break; + case DELETED_EVENT_DEF: + // look up the watchers for the path and move them to a delivery list + add_for_event(zh->active_node_watchers,path,&list); + add_for_event(zh->active_exist_watchers,path,&list); + add_for_event(zh->active_child_watchers,path,&list); + break; + } + return list; +} + +void deliverWatchers(zhandle_t *zh, int type,int state, char *path, watcher_object_list_t **list) +{ + if (!list || !(*list)) return; + do_foreach_watcher((*list)->head, zh, path, type, state); + destroy_watcher_object_list(*list); + *list = 0; +} + +void activateWatcher(zhandle_t *zh, watcher_registration_t* reg, int rc) +{ + if(reg){ + /* in multithreaded lib, this code is executed + * by the IO thread */ + zk_hashtable *ht = reg->checker(zh, rc); + if(ht){ + insert_watcher_object(ht,reg->path, + create_watcher_object(reg->watcher, reg->context)); + } + } +} + +/* If watcher is NULL, we return TRUE since we consider it a match */ +static int containsWatcher(zk_hashtable *watchers, const char *path, + watcher_fn watcher, void *watcherCtx) +{ + watcher_object_list_t *wl; + watcher_object_t e; + + if (!watcher) + return 1; + + wl = hashtable_search(watchers->ht, (void *)path); + if (!wl) + return 0; + + e.watcher = watcher; + e.context = watcherCtx; + + return search_watcher(&wl, &e) ? 1 : 0; +} + +/** + * remove any watcher_object that has a matching (watcher, watcherCtx) + */ +static void removeWatcherFromList(watcher_object_list_t *wl, watcher_fn watcher, + void *watcherCtx) +{ + watcher_object_t *e = NULL; + + if (!wl || (wl && !wl->head)) + return; + + e = wl->head; + while (e){ + if (e->next && + e->next->watcher == watcher && + e->next->context == watcherCtx) { + watcher_object_t *this = e->next; + e->next = e->next->next; + free(this); + break; + } + e = e->next; + } + + if (wl->head && + wl->head->watcher == watcher && wl->head->context == watcherCtx) { + watcher_object_t *this = wl->head; + wl->head = wl->head->next; + free(this); + } +} + +static void removeWatcher(zk_hashtable *watchers, const char *path, + watcher_fn watcher, void *watcherCtx) +{ + watcher_object_list_t *wl = hashtable_search(watchers->ht, (void *)path); + + if (!wl) + return; + + if (!watcher) { + wl = (watcher_object_list_t *) hashtable_remove(watchers->ht, + (void *)path); + destroy_watcher_object_list(wl); + return; + } + + removeWatcherFromList(wl, watcher, watcherCtx); + + if (!wl->head) { + wl = (watcher_object_list_t *) hashtable_remove(watchers->ht, + (void *)path); + destroy_watcher_object_list(wl); + } +} + +void deactivateWatcher(zhandle_t *zh, watcher_deregistration_t *dereg, int rc) +{ + if (rc != ZOK || !dereg) + return; + + removeWatchers(zh, dereg->path, dereg->type, dereg->watcher, + dereg->context); +} + +void removeWatchers(zhandle_t *zh, const char* path, ZooWatcherType type, + watcher_fn watcher, void *watcherCtx) +{ + switch (type) { + case ZWATCHERTYPE_CHILDREN: + removeWatcher(zh->active_child_watchers, path, watcher, watcherCtx); + break; + case ZWATCHERTYPE_DATA: + removeWatcher(zh->active_node_watchers, path, watcher, watcherCtx); + removeWatcher(zh->active_exist_watchers, path, watcher, watcherCtx); + break; + case ZWATCHERTYPE_ANY: + removeWatcher(zh->active_child_watchers, path, watcher, watcherCtx); + removeWatcher(zh->active_node_watchers, path, watcher, watcherCtx); + removeWatcher(zh->active_exist_watchers, path, watcher, watcherCtx); + break; + } +} + +int pathHasWatcher(zhandle_t *zh, const char *path, int wtype, + watcher_fn watcher, void *watcherCtx) +{ + int watcher_found = 0; + + switch (wtype) { + case ZWATCHERTYPE_CHILDREN: + watcher_found = containsWatcher(zh->active_child_watchers, + path, watcher, watcherCtx); + break; + case ZWATCHERTYPE_DATA: + watcher_found = containsWatcher(zh->active_node_watchers, path, + watcher, watcherCtx); + if (!watcher_found) { + watcher_found = containsWatcher(zh->active_exist_watchers, path, + watcher, watcherCtx); + } + break; + case ZWATCHERTYPE_ANY: + watcher_found = containsWatcher(zh->active_child_watchers, path, + watcher, watcherCtx); + if (!watcher_found) { + watcher_found = containsWatcher(zh->active_node_watchers, path, + watcher, watcherCtx); + } + if (!watcher_found) { + watcher_found = containsWatcher(zh->active_exist_watchers, path, + watcher, watcherCtx); + } + break; + } + + return watcher_found; +} diff --git a/ThirdLib/thirdparty/zookeeper/src/zk_hashtable.h b/ThirdLib/thirdparty/zookeeper/src/zk_hashtable.h new file mode 100644 index 000000000..5227e0776 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/zk_hashtable.h @@ -0,0 +1,86 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ZK_HASHTABLE_H_ +#define ZK_HASHTABLE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + typedef struct watcher_object_list watcher_object_list_t; +typedef struct _zk_hashtable zk_hashtable; + +/** + * The function must return a non-zero value if the watcher object can be activated + * as a result of the server response. Normally, a watch can only be activated + * if the server returns a success code (ZOK). However in the case when zoo_exists() + * returns a ZNONODE code the watcher should be activated nevertheless. + */ +typedef zk_hashtable *(*result_checker_fn)(zhandle_t *, int rc); + +/** + * A watcher object gets temporarily stored with the completion entry until + * the server response comes back at which moment the watcher object is moved + * to the active watchers map. + */ +typedef struct _watcher_registration { + watcher_fn watcher; + void* context; + result_checker_fn checker; + const char* path; +} watcher_registration_t; + +/** + * A watcher deregistration gets temporarily stored with the completion entry until + * the server response comes back at which moment we can remove the watchers from + * the active watchers map. + */ +typedef struct _watcher_deregistration { + watcher_fn watcher; + void* context; + ZooWatcherType type; + const char* path; +} watcher_deregistration_t; + +zk_hashtable* create_zk_hashtable(); +void destroy_zk_hashtable(zk_hashtable* ht); + +char **collect_keys(zk_hashtable *ht, int *count); + +/** + * check if the completion has a watcher object associated + * with it. If it does, move the watcher object to the map of + * active watchers (only if the checker allows to do so) + */ + void activateWatcher(zhandle_t *zh, watcher_registration_t* reg, int rc); + void deactivateWatcher(zhandle_t *zh, watcher_deregistration_t *dereg, int rc); + watcher_object_list_t *collectWatchers(zhandle_t *zh,int type, char *path); + void deliverWatchers(zhandle_t *zh, int type, int state, char *path, struct watcher_object_list **list); + void removeWatchers(zhandle_t *zh, const char* path, ZooWatcherType type, + watcher_fn watcher, void *watcherCtx); + int pathHasWatcher(zhandle_t *zh, const char *path, int wtype, + watcher_fn watcher, void *watcherCtx); + +#ifdef __cplusplus +} +#endif + +#endif /*ZK_HASHTABLE_H_*/ diff --git a/ThirdLib/thirdparty/zookeeper/src/zk_log.c b/ThirdLib/thirdparty/zookeeper/src/zk_log.c new file mode 100644 index 000000000..436485e97 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/zk_log.c @@ -0,0 +1,203 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if !defined(DLL_EXPORT) && !defined(USE_STATIC_LIB) +# define USE_STATIC_LIB +#endif + +#include "zookeeper_log.h" +#ifndef WIN32 +#include +#else +typedef DWORD pid_t; +#include /* for getpid */ +#endif + +#include +#include + +#define TIME_NOW_BUF_SIZE 1024 +#define FORMAT_LOG_BUF_SIZE 4096 + +#ifdef THREADED +#ifndef WIN32 +#include +#else +#include "winport.h" +#endif + +static pthread_key_t time_now_buffer; +static pthread_key_t format_log_msg_buffer; + +void freeBuffer(void* p){ + if(p) free(p); +} + +__attribute__((constructor)) void prepareTSDKeys() { + pthread_key_create (&time_now_buffer, freeBuffer); + pthread_key_create (&format_log_msg_buffer, freeBuffer); +} + +char* getTSData(pthread_key_t key,int size){ + char* p=pthread_getspecific(key); + if(p==0){ + int res; + p=calloc(1,size); + res=pthread_setspecific(key,p); + if(res!=0){ + fprintf(stderr,"Failed to set TSD key: %d",res); + } + } + return p; +} + +char* get_time_buffer(){ + return getTSData(time_now_buffer,TIME_NOW_BUF_SIZE); +} + +char* get_format_log_buffer(){ + return getTSData(format_log_msg_buffer,FORMAT_LOG_BUF_SIZE); +} +#else +char* get_time_buffer(){ + static char buf[TIME_NOW_BUF_SIZE]; + return buf; +} + +char* get_format_log_buffer(){ + static char buf[FORMAT_LOG_BUF_SIZE]; + return buf; +} + +#endif + +ZooLogLevel logLevel=ZOO_LOG_LEVEL_INFO; + +static FILE* logStream=0; +FILE* zoo_get_log_stream(){ + if(logStream==0) + logStream=stderr; + return logStream; +} + +void zoo_set_log_stream(FILE* stream){ + logStream=stream; +} + +static const char* time_now(char* now_str){ + struct timeval tv; + struct tm lt; + time_t now = 0; + size_t len = 0; + + gettimeofday(&tv,0); + + now = tv.tv_sec; + localtime_r(&now, <); + + // clone the format used by log4j ISO8601DateFormat + // specifically: "yyyy-MM-dd HH:mm:ss,SSS" + + len = strftime(now_str, TIME_NOW_BUF_SIZE, + "%Y-%m-%d %H:%M:%S", + <); + + len += snprintf(now_str + len, + TIME_NOW_BUF_SIZE - len, + ",%03d", + (int)(tv.tv_usec/1000)); + + return now_str; +} + +void log_message(log_callback_fn callback, ZooLogLevel curLevel, + int line, const char* funcName, const char* format, ...) +{ + static const char* dbgLevelStr[]={"ZOO_INVALID","ZOO_ERROR","ZOO_WARN", + "ZOO_INFO","ZOO_DEBUG"}; + static pid_t pid=0; + va_list va; + int ofs = 0; +#ifdef THREADED + unsigned long int tid = 0; +#endif +#ifdef WIN32 + char timebuf [TIME_NOW_BUF_SIZE]; + const char* time = time_now(timebuf); +#else + const char* time = time_now(get_time_buffer()); +#endif + + char* buf = get_format_log_buffer(); + if(!buf) + { + fprintf(stderr, "log_message: Unable to allocate memory buffer"); + return; + } + + if(pid==0) + { + pid=getpid(); + } + + +#ifndef THREADED + + // pid_t is long on Solaris + ofs = snprintf(buf, FORMAT_LOG_BUF_SIZE, + "%s:%ld:%s@%s@%d: ", time, (long)pid, + dbgLevelStr[curLevel], funcName, line); +#else + + #ifdef WIN32 + tid = (unsigned long int)(pthread_self().thread_id); + #else + tid = (unsigned long int)(pthread_self()); + #endif + + ofs = snprintf(buf, FORMAT_LOG_BUF_SIZE-1, + "%s:%ld(0x%lx):%s@%s@%d: ", time, (long)pid, tid, + dbgLevelStr[curLevel], funcName, line); +#endif + + // Now grab the actual message out of the variadic arg list + va_start(va, format); + vsnprintf(buf+ofs, FORMAT_LOG_BUF_SIZE-1-ofs, format, va); + va_end(va); + + if (callback) + { + callback(buf); + } else { + fprintf(zoo_get_log_stream(), "%s\n", buf); + fflush(zoo_get_log_stream()); + } +} + +void zoo_set_debug_level(ZooLogLevel level) +{ + if(level==0){ + // disable logging (unit tests do this) + logLevel=(ZooLogLevel)0; + return; + } + if(levelZOO_LOG_LEVEL_DEBUG)level=ZOO_LOG_LEVEL_DEBUG; + logLevel=level; +} + diff --git a/ThirdLib/thirdparty/zookeeper/src/zookeeper.c b/ThirdLib/thirdparty/zookeeper/src/zookeeper.c new file mode 100644 index 000000000..47e2ee191 --- /dev/null +++ b/ThirdLib/thirdparty/zookeeper/src/zookeeper.c @@ -0,0 +1,4860 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if !defined(DLL_EXPORT) && !defined(USE_STATIC_LIB) +# define USE_STATIC_LIB +#endif + +#if defined(__CYGWIN__) +#define USE_IPV6 +#endif + +#include "config.h" +#include +#include +#include +#include "zk_adaptor.h" +#include "zookeeper_log.h" +#include "zk_hashtable.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_POLL +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETDB_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include // needed for _POSIX_MONOTONIC_CLOCK +#endif + +#ifdef HAVE_SYS_UTSNAME_H +#include +#endif + +#ifdef HAVE_GETPWUID_R +#include +#endif + +#ifdef __MACH__ // OS X +#include +#include +#endif + +#ifdef WIN32 +#include /* for getpid */ +#include /* for getcwd */ +#define EAI_ADDRFAMILY WSAEINVAL /* is this still needed? */ +#define EHOSTDOWN EPIPE +#define ESTALE ENODEV +#endif + +#define IF_DEBUG(x) if(logLevel==ZOO_LOG_LEVEL_DEBUG) {x;} + +const int ZOOKEEPER_WRITE = 1 << 0; +const int ZOOKEEPER_READ = 1 << 1; + +const int ZOO_EPHEMERAL = 1 << 0; +const int ZOO_SEQUENCE = 1 << 1; + +const int ZOO_EXPIRED_SESSION_STATE = EXPIRED_SESSION_STATE_DEF; +const int ZOO_AUTH_FAILED_STATE = AUTH_FAILED_STATE_DEF; +const int ZOO_CONNECTING_STATE = CONNECTING_STATE_DEF; +const int ZOO_ASSOCIATING_STATE = ASSOCIATING_STATE_DEF; +const int ZOO_CONNECTED_STATE = CONNECTED_STATE_DEF; +const int ZOO_READONLY_STATE = READONLY_STATE_DEF; +const int ZOO_NOTCONNECTED_STATE = NOTCONNECTED_STATE_DEF; + +static __attribute__ ((unused)) const char* state2String(int state){ + switch(state){ + case 0: + return "ZOO_CLOSED_STATE"; + case CONNECTING_STATE_DEF: + return "ZOO_CONNECTING_STATE"; + case ASSOCIATING_STATE_DEF: + return "ZOO_ASSOCIATING_STATE"; + case CONNECTED_STATE_DEF: + return "ZOO_CONNECTED_STATE"; + case READONLY_STATE_DEF: + return "ZOO_READONLY_STATE"; + case EXPIRED_SESSION_STATE_DEF: + return "ZOO_EXPIRED_SESSION_STATE"; + case AUTH_FAILED_STATE_DEF: + return "ZOO_AUTH_FAILED_STATE"; + } + return "INVALID_STATE"; +} + +const int ZOO_CREATED_EVENT = CREATED_EVENT_DEF; +const int ZOO_DELETED_EVENT = DELETED_EVENT_DEF; +const int ZOO_CHANGED_EVENT = CHANGED_EVENT_DEF; +const int ZOO_CHILD_EVENT = CHILD_EVENT_DEF; +const int ZOO_SESSION_EVENT = SESSION_EVENT_DEF; +const int ZOO_NOTWATCHING_EVENT = NOTWATCHING_EVENT_DEF; +static __attribute__ ((unused)) const char* watcherEvent2String(int ev){ + switch(ev){ + case 0: + return "ZOO_ERROR_EVENT"; + case CREATED_EVENT_DEF: + return "ZOO_CREATED_EVENT"; + case DELETED_EVENT_DEF: + return "ZOO_DELETED_EVENT"; + case CHANGED_EVENT_DEF: + return "ZOO_CHANGED_EVENT"; + case CHILD_EVENT_DEF: + return "ZOO_CHILD_EVENT"; + case SESSION_EVENT_DEF: + return "ZOO_SESSION_EVENT"; + case NOTWATCHING_EVENT_DEF: + return "ZOO_NOTWATCHING_EVENT"; + } + return "INVALID_EVENT"; +} + +const int ZOO_PERM_READ = 1 << 0; +const int ZOO_PERM_WRITE = 1 << 1; +const int ZOO_PERM_CREATE = 1 << 2; +const int ZOO_PERM_DELETE = 1 << 3; +const int ZOO_PERM_ADMIN = 1 << 4; +const int ZOO_PERM_ALL = 0x1f; +struct Id ZOO_ANYONE_ID_UNSAFE = {"world", "anyone"}; +struct Id ZOO_AUTH_IDS = {"auth", ""}; +static struct ACL _OPEN_ACL_UNSAFE_ACL[] = {{0x1f, {"world", "anyone"}}}; +static struct ACL _READ_ACL_UNSAFE_ACL[] = {{0x01, {"world", "anyone"}}}; +static struct ACL _CREATOR_ALL_ACL_ACL[] = {{0x1f, {"auth", ""}}}; +struct ACL_vector ZOO_OPEN_ACL_UNSAFE = { 1, _OPEN_ACL_UNSAFE_ACL}; +struct ACL_vector ZOO_READ_ACL_UNSAFE = { 1, _READ_ACL_UNSAFE_ACL}; +struct ACL_vector ZOO_CREATOR_ALL_ACL = { 1, _CREATOR_ALL_ACL_ACL}; + +#define COMPLETION_WATCH -1 +#define COMPLETION_VOID 0 +#define COMPLETION_STAT 1 +#define COMPLETION_DATA 2 +#define COMPLETION_STRINGLIST 3 +#define COMPLETION_STRINGLIST_STAT 4 +#define COMPLETION_ACLLIST 5 +#define COMPLETION_STRING 6 +#define COMPLETION_MULTI 7 +#define COMPLETION_STRING_STAT 8 + +typedef struct _auth_completion_list { + void_completion_t completion; + const char *auth_data; + struct _auth_completion_list *next; +} auth_completion_list_t; + +typedef struct completion { + int type; /* one of COMPLETION_* values above */ + union { + void_completion_t void_result; + stat_completion_t stat_result; + data_completion_t data_result; + strings_completion_t strings_result; + strings_stat_completion_t strings_stat_result; + acl_completion_t acl_result; + string_completion_t string_result; + string_stat_completion_t string_stat_result; + struct watcher_object_list *watcher_result; + }; + completion_head_t clist; /* For multi-op */ +} completion_t; + +typedef struct _completion_list { + int xid; + completion_t c; + const void *data; + buffer_list_t *buffer; + struct _completion_list *next; + watcher_registration_t* watcher; + watcher_deregistration_t* watcher_deregistration; +} completion_list_t; + +const char*err2string(int err); +static int queue_session_event(zhandle_t *zh, int state); +static const char* format_endpoint_info(const struct sockaddr_storage* ep); + +/* deserialize forward declarations */ +static void deserialize_response(zhandle_t *zh, int type, int xid, int failed, int rc, completion_list_t *cptr, struct iarchive *ia); +static int deserialize_multi(zhandle_t *zh, int xid, completion_list_t *cptr, struct iarchive *ia); + +/* completion routine forward declarations */ +static int add_completion(zhandle_t *zh, int xid, int completion_type, + const void *dc, const void *data, int add_to_front, + watcher_registration_t* wo, completion_head_t *clist); +static int add_completion_deregistration(zhandle_t *zh, int xid, + int completion_type, const void *dc, const void *data, + int add_to_front, watcher_deregistration_t* wo, + completion_head_t *clist); +static int do_add_completion(zhandle_t *zh, const void *dc, completion_list_t *c, + int add_to_front); + +static completion_list_t* create_completion_entry(zhandle_t *zh, int xid, int completion_type, + const void *dc, const void *data, watcher_registration_t* wo, + completion_head_t *clist); +static completion_list_t* create_completion_entry_deregistration(zhandle_t *zh, + int xid, int completion_type, const void *dc, const void *data, + watcher_deregistration_t* wo, completion_head_t *clist); +static completion_list_t* do_create_completion_entry(zhandle_t *zh, + int xid, int completion_type, const void *dc, const void *data, + watcher_registration_t* wo, completion_head_t *clist, + watcher_deregistration_t* wdo); +static void destroy_completion_entry(completion_list_t* c); +static void queue_completion_nolock(completion_head_t *list, completion_list_t *c, + int add_to_front); +static void queue_completion(completion_head_t *list, completion_list_t *c, + int add_to_front); +static int handle_socket_error_msg(zhandle_t *zh, int line, int rc, + const char* format,...); +static void cleanup_bufs(zhandle_t *zh,int callCompletion,int rc); + +static int disable_conn_permute=0; // permute enabled by default +static struct sockaddr_storage *addr_rw_server = 0; + +static __attribute__((unused)) void print_completion_queue(zhandle_t *zh); + +static void *SYNCHRONOUS_MARKER = (void*)&SYNCHRONOUS_MARKER; +static int isValidPath(const char* path, const int flags); + +#ifdef THREADED +static void process_sync_completion(zhandle_t *zh, + completion_list_t *cptr, + struct sync_completion *sc, + struct iarchive *ia); +#endif + +#ifdef _WIN32 +typedef SOCKET socket_t; +typedef int sendsize_t; +#define SEND_FLAGS 0 +#else +#ifdef __APPLE__ +#define SEND_FLAGS SO_NOSIGPIPE +#endif +#ifdef __linux__ +#define SEND_FLAGS MSG_NOSIGNAL +#endif +#ifndef SEND_FLAGS +#define SEND_FLAGS 0 +#endif +typedef int socket_t; +typedef ssize_t sendsize_t; +#endif + +static void zookeeper_set_sock_nodelay(zhandle_t *, socket_t); +static void zookeeper_set_sock_noblock(zhandle_t *, socket_t); +static void zookeeper_set_sock_timeout(zhandle_t *, socket_t, int); +static socket_t zookeeper_connect(zhandle_t *, struct sockaddr_storage *, socket_t); + + +/* + * abort due to the use of a sync api in a singlethreaded environment + */ +static void abort_singlethreaded(zhandle_t *zh) +{ + LOG_ERROR(LOGCALLBACK(zh), "Sync completion used without threads"); + abort(); +} + +static sendsize_t zookeeper_send(socket_t s, const void* buf, size_t len) +{ + return send(s, buf, len, SEND_FLAGS); +} + +/** + * Get the system time. + * + * If the monotonic clock is available, we use that. The monotonic clock does + * not change when the wall-clock time is adjusted by NTP or the system + * administrator. The monotonic clock returns a value which is monotonically + * increasing. + * + * If POSIX monotonic clocks are not available, we fall back on the wall-clock. + * + * @param tv (out param) The time. + */ +void get_system_time(struct timeval *tv) +{ + int ret; + +#ifdef __MACH__ // OS X + clock_serv_t cclock; + mach_timespec_t mts; + ret = host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock); + if (!ret) { + ret += clock_get_time(cclock, &mts); + ret += mach_port_deallocate(mach_task_self(), cclock); + if (!ret) { + tv->tv_sec = mts.tv_sec; + tv->tv_usec = mts.tv_nsec / 1000; + } + } + if (ret) { + // Default to gettimeofday in case of failure. + ret = gettimeofday(tv, NULL); + } +#elif CLOCK_MONOTONIC_RAW + // On Linux, CLOCK_MONOTONIC is affected by ntp slew but CLOCK_MONOTONIC_RAW + // is not. We want the non-slewed (constant rate) CLOCK_MONOTONIC_RAW if it + // is available. + struct timespec ts = { 0 }; + ret = clock_gettime(CLOCK_MONOTONIC_RAW, &ts); + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; +#elif _POSIX_MONOTONIC_CLOCK + struct timespec ts = { 0 }; + ret = clock_gettime(CLOCK_MONOTONIC, &ts); + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / 1000; +#elif _WIN32 + LARGE_INTEGER counts, countsPerSecond, countsPerMicrosecond; + if (QueryPerformanceFrequency(&countsPerSecond) && + QueryPerformanceCounter(&counts)) { + countsPerMicrosecond.QuadPart = countsPerSecond.QuadPart / 1000000; + tv->tv_sec = (long)(counts.QuadPart / countsPerSecond.QuadPart); + tv->tv_usec = (long)((counts.QuadPart % countsPerSecond.QuadPart) / + countsPerMicrosecond.QuadPart); + ret = 0; + } else { + ret = gettimeofday(tv, NULL); + } +#else + ret = gettimeofday(tv, NULL); +#endif + if (ret) { + abort(); + } +} + +const void *zoo_get_context(zhandle_t *zh) +{ + return zh->context; +} + +void zoo_set_context(zhandle_t *zh, void *context) +{ + if (zh != NULL) { + zh->context = context; + } +} + +int zoo_recv_timeout(zhandle_t *zh) +{ + return zh->recv_timeout; +} + +/** these functions are thread unsafe, so make sure that + zoo_lock_auth is called before you access them **/ +static auth_info* get_last_auth(auth_list_head_t *auth_list) { + auth_info *element; + element = auth_list->auth; + if (element == NULL) { + return NULL; + } + while (element->next != NULL) { + element = element->next; + } + return element; +} + +static void free_auth_completion(auth_completion_list_t *a_list) { + auth_completion_list_t *tmp, *ftmp; + if (a_list == NULL) { + return; + } + tmp = a_list->next; + while (tmp != NULL) { + ftmp = tmp; + tmp = tmp->next; + ftmp->completion = NULL; + ftmp->auth_data = NULL; + free(ftmp); + } + a_list->completion = NULL; + a_list->auth_data = NULL; + a_list->next = NULL; + return; +} + +static void add_auth_completion(auth_completion_list_t* a_list, void_completion_t* completion, + const char *data) { + auth_completion_list_t *element; + auth_completion_list_t *n_element; + element = a_list; + if (a_list->completion == NULL) { + //this is the first element + a_list->completion = *completion; + a_list->next = NULL; + a_list->auth_data = data; + return; + } + while (element->next != NULL) { + element = element->next; + } + n_element = (auth_completion_list_t*) malloc(sizeof(auth_completion_list_t)); + n_element->next = NULL; + n_element->completion = *completion; + n_element->auth_data = data; + element->next = n_element; + return; +} + +static void get_auth_completions(auth_list_head_t *auth_list, auth_completion_list_t *a_list) { + auth_info *element; + element = auth_list->auth; + if (element == NULL) { + return; + } + while (element) { + if (element->completion) { + add_auth_completion(a_list, &element->completion, element->data); + } + element->completion = NULL; + element = element->next; + } + return; +} + +static void add_last_auth(auth_list_head_t *auth_list, auth_info *add_el) { + auth_info *element; + element = auth_list->auth; + if (element == NULL) { + //first element in the list + auth_list->auth = add_el; + return; + } + while (element->next != NULL) { + element = element->next; + } + element->next = add_el; + return; +} + +static void init_auth_info(auth_list_head_t *auth_list) +{ + auth_list->auth = NULL; +} + +static void mark_active_auth(zhandle_t *zh) { + auth_list_head_t auth_h = zh->auth_h; + auth_info *element; + if (auth_h.auth == NULL) { + return; + } + element = auth_h.auth; + while (element != NULL) { + element->state = 1; + element = element->next; + } +} + +static void free_auth_info(auth_list_head_t *auth_list) +{ + auth_info *auth = auth_list->auth; + while (auth != NULL) { + auth_info* old_auth = NULL; + if(auth->scheme!=NULL) + free(auth->scheme); + deallocate_Buffer(&auth->auth); + old_auth = auth; + auth = auth->next; + free(old_auth); + } + init_auth_info(auth_list); +} + +int is_unrecoverable(zhandle_t *zh) +{ + return (zh->state<0)? ZINVALIDSTATE: ZOK; +} + +zk_hashtable *exists_result_checker(zhandle_t *zh, int rc) +{ + if (rc == ZOK) { + return zh->active_node_watchers; + } else if (rc == ZNONODE) { + return zh->active_exist_watchers; + } + return 0; +} + +zk_hashtable *data_result_checker(zhandle_t *zh, int rc) +{ + return rc==ZOK ? zh->active_node_watchers : 0; +} + +zk_hashtable *child_result_checker(zhandle_t *zh, int rc) +{ + return rc==ZOK ? zh->active_child_watchers : 0; +} + +/** + * Frees and closes everything associated with a handle, + * including the handle itself. + */ +static void destroy(zhandle_t *zh) +{ + if (zh == NULL) { + return; + } + /* call any outstanding completions with a special error code */ + cleanup_bufs(zh,1,ZCLOSING); + if (zh->hostname != 0) { + free(zh->hostname); + zh->hostname = NULL; + } + if (zh->fd != -1) { + close(zh->fd); + zh->fd = -1; + memset(&zh->addr_cur, 0, sizeof(zh->addr_cur)); + zh->state = 0; + } + addrvec_free(&zh->addrs); + + if (zh->chroot != NULL) { + free(zh->chroot); + zh->chroot = NULL; + } + + free_auth_info(&zh->auth_h); + destroy_zk_hashtable(zh->active_node_watchers); + destroy_zk_hashtable(zh->active_exist_watchers); + destroy_zk_hashtable(zh->active_child_watchers); + addrvec_free(&zh->addrs_old); + addrvec_free(&zh->addrs_new); +} + +static void setup_random() +{ +#ifndef _WIN32 // TODO: better seed + int seed; + int fd = open("/dev/urandom", O_RDONLY); + if (fd == -1) { + seed = getpid(); + } else { + int seed_len = 0; + + /* Enter a loop to fill in seed with random data from /dev/urandom. + * This is done in a loop so that we can safely handle short reads + * which can happen due to signal interruptions. + */ + while (seed_len < sizeof(seed)) { + /* Assert we either read something or we were interrupted due to a + * signal (errno == EINTR) in which case we need to retry. + */ + int rc = read(fd, &seed + seed_len, sizeof(seed) - seed_len); + assert(rc > 0 || errno == EINTR); + if (rc > 0) { + seed_len += rc; + } + } + close(fd); + } + srandom(seed); + srand48(seed); +#endif +} + +#ifndef __CYGWIN__ +/** + * get the errno from the return code + * of get addrinfo. Errno is not set + * with the call to getaddrinfo, so thats + * why we have to do this. + */ +static int getaddrinfo_errno(int rc) { + switch(rc) { + case EAI_NONAME: +// ZOOKEEPER-1323 EAI_NODATA and EAI_ADDRFAMILY are deprecated in FreeBSD. +#if defined EAI_NODATA && EAI_NODATA != EAI_NONAME + case EAI_NODATA: +#endif + return ENOENT; + case EAI_MEMORY: + return ENOMEM; + default: + return EINVAL; + } +} +#endif + +/** + * Count the number of hosts in the connection host string. This assumes it's + * a well-formed connection string whereby each host is separated by a comma. + */ +static int count_hosts(char *hosts) +{ + uint32_t count = 0; + char *loc = hosts; + if (!hosts || strlen(hosts) == 0) { + return 0; + } + + while ((loc = strchr(loc, ','))) { + count++; + loc+=1; + } + + return count+1; +} + +/** + * Resolve hosts and populate provided address vector with shuffled results. + * The contents of the provided address vector will be initialized to an + * empty state. + */ +static int resolve_hosts(const zhandle_t *zh, const char *hosts_in, addrvec_t *avec) +{ + int rc = ZOK; + char *host = NULL; + char *hosts = NULL; + int num_hosts = 0; + char *strtok_last = NULL; + + if (zh == NULL || hosts_in == NULL || avec == NULL) { + return ZBADARGUMENTS; + } + + // initialize address vector + addrvec_init(avec); + + hosts = strdup(hosts_in); + if (hosts == NULL) { + LOG_ERROR(LOGCALLBACK(zh), "out of memory"); + errno=ENOMEM; + rc=ZSYSTEMERROR; + goto fail; + } + + num_hosts = count_hosts(hosts); + if (num_hosts == 0) { + free(hosts); + return ZOK; + } + + // Allocate list inside avec + rc = addrvec_alloc_capacity(avec, num_hosts); + if (rc != 0) { + LOG_ERROR(LOGCALLBACK(zh), "out of memory"); + errno=ENOMEM; + rc=ZSYSTEMERROR; + goto fail; + } + + host = strtok_r(hosts, ",", &strtok_last); + while(host) { + char *port_spec = strrchr(host, ':'); + char *end_port_spec; + int port; + if (!port_spec) { + LOG_ERROR(LOGCALLBACK(zh), "no port in %s", host); + errno=EINVAL; + rc=ZBADARGUMENTS; + goto fail; + } + *port_spec = '\0'; + port_spec++; + port = strtol(port_spec, &end_port_spec, 0); + if (!*port_spec || *end_port_spec || port == 0) { + LOG_ERROR(LOGCALLBACK(zh), "invalid port in %s", host); + errno=EINVAL; + rc=ZBADARGUMENTS; + goto fail; + } +#if defined(__CYGWIN__) + // sadly CYGWIN doesn't have getaddrinfo + // but happily gethostbyname is threadsafe in windows + { + struct hostent *he; + char **ptr; + struct sockaddr_in *addr4; + + he = gethostbyname(host); + if (!he) { + LOG_ERROR(LOGCALLBACK(zh), "could not resolve %s", host); + errno=ENOENT; + rc=ZBADARGUMENTS; + goto fail; + } + + // Setup the address array + for(ptr = he->h_addr_list;*ptr != 0; ptr++) { + if (addrs->count == addrs->capacity) { + rc = addrvec_grow_default(addrs); + if (rc != 0) { + LOG_ERROR(LOGCALLBACK(zh), "out of memory"); + errno=ENOMEM; + rc=ZSYSTEMERROR; + goto fail; + } + } + addr = &addrs->list[addrs->count]; + addr4 = (struct sockaddr_in*)addr; + addr->ss_family = he->h_addrtype; + if (addr->ss_family == AF_INET) { + addr4->sin_port = htons(port); + memset(&addr4->sin_zero, 0, sizeof(addr4->sin_zero)); + memcpy(&addr4->sin_addr, *ptr, he->h_length); + zh->addrs.count++; + } +#if defined(AF_INET6) + else if (addr->ss_family == AF_INET6) { + struct sockaddr_in6 *addr6; + + addr6 = (struct sockaddr_in6*)addr; + addr6->sin6_port = htons(port); + addr6->sin6_scope_id = 0; + addr6->sin6_flowinfo = 0; + memcpy(&addr6->sin6_addr, *ptr, he->h_length); + zh->addrs.count++; + } +#endif + else { + LOG_WARN(LOGCALLBACK(zh), "skipping unknown address family %x for %s", + addr->ss_family, hosts_in); + } + } + host = strtok_r(0, ",", &strtok_last); + } +#else + { + struct addrinfo hints, *res, *res0; + + memset(&hints, 0, sizeof(hints)); +#ifdef AI_ADDRCONFIG + hints.ai_flags = AI_ADDRCONFIG; +#else + hints.ai_flags = 0; +#endif + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + + while(isspace(*host) && host != strtok_last) + host++; + + if ((rc = getaddrinfo(host, port_spec, &hints, &res0)) != 0) { + //bug in getaddrinfo implementation when it returns + //EAI_BADFLAGS or EAI_ADDRFAMILY with AF_UNSPEC and + // ai_flags as AI_ADDRCONFIG +#ifdef AI_ADDRCONFIG + if ((hints.ai_flags == AI_ADDRCONFIG) && +// ZOOKEEPER-1323 EAI_NODATA and EAI_ADDRFAMILY are deprecated in FreeBSD. +#ifdef EAI_ADDRFAMILY + ((rc ==EAI_BADFLAGS) || (rc == EAI_ADDRFAMILY))) { +#else + (rc == EAI_BADFLAGS)) { +#endif + //reset ai_flags to null + hints.ai_flags = 0; + //retry getaddrinfo + rc = getaddrinfo(host, port_spec, &hints, &res0); + } +#endif + if (rc != 0) { + errno = getaddrinfo_errno(rc); +#ifdef _WIN32 + LOG_ERROR(LOGCALLBACK(zh), "Win32 message: %s\n", gai_strerror(rc)); +#elif __linux__ && __GNUC__ + LOG_ERROR(LOGCALLBACK(zh), "getaddrinfo: %s\n", gai_strerror(rc)); +#else + LOG_ERROR(LOGCALLBACK(zh), "getaddrinfo: %s\n", strerror(errno)); +#endif + rc=ZSYSTEMERROR; + goto fail; + } + } + + for (res = res0; res; res = res->ai_next) { + // Expand address list if needed + if (avec->count == avec->capacity) { + rc = addrvec_grow_default(avec); + if (rc != 0) { + LOG_ERROR(LOGCALLBACK(zh), "out of memory"); + errno=ENOMEM; + rc=ZSYSTEMERROR; + goto fail; + } + } + + // Copy addrinfo into address list + switch (res->ai_family) { + case AF_INET: +#if defined(AF_INET6) + case AF_INET6: +#endif + addrvec_append_addrinfo(avec, res); + break; + default: + LOG_WARN(LOGCALLBACK(zh), "skipping unknown address family %x for %s", + res->ai_family, hosts_in); + break; + } + } + + freeaddrinfo(res0); + + host = strtok_r(0, ",", &strtok_last); + } +#endif + } + free(hosts); + + if(!disable_conn_permute){ + setup_random(); + addrvec_shuffle(avec); + } + + return ZOK; + +fail: + addrvec_free(avec); + + if (hosts) { + free(hosts); + hosts = NULL; + } + + return rc; +} + +/** + * Updates the list of servers and determine if changing connections is necessary. + * Permutes server list for proper load balancing. + * + * Changing connections is necessary if one of the following holds: + * a) the server this client is currently connected is not in new address list. + * Otherwise (if currentHost is in the new list): + * b) the number of servers in the cluster is increasing - in this case the load + * on currentHost should decrease, which means that SOME of the clients + * connected to it will migrate to the new servers. The decision whether this + * client migrates or not is probabilistic so that the expected number of + * clients connected to each server is the same. + * + * If reconfig is set to true, the function sets pOld and pNew that correspond + * to the probability to migrate to ones of the new servers or one of the old + * servers (migrating to one of the old servers is done only if our client's + * currentHost is not in new list). + * + * See zoo_cycle_next_server for the selection logic. + * + * See {@link https://issues.apache.org/jira/browse/ZOOKEEPER-1355} for the + * protocol and its evaluation, + */ +int update_addrs(zhandle_t *zh) +{ + int rc = ZOK; + char *hosts = NULL; + uint32_t num_old = 0; + uint32_t num_new = 0; + uint32_t i = 0; + int found_current = 0; + addrvec_t resolved = { 0 }; + + // Verify we have a valid handle + if (zh == NULL) { + return ZBADARGUMENTS; + } + + // zh->hostname should always be set + if (zh->hostname == NULL) + { + return ZSYSTEMERROR; + } + + // NOTE: guard access to {hostname, addr_cur, addrs, addrs_old, addrs_new} + lock_reconfig(zh); + + // Copy zh->hostname for local use + hosts = strdup(zh->hostname); + if (hosts == NULL) { + rc = ZSYSTEMERROR; + goto fail; + } + + rc = resolve_hosts(zh, hosts, &resolved); + if (rc != ZOK) + { + goto fail; + } + + // If the addrvec list is identical to last time we ran don't do anything + if (addrvec_eq(&zh->addrs, &resolved)) + { + goto fail; + } + + // Is the server we're connected to in the new resolved list? + found_current = addrvec_contains(&resolved, &zh->addr_cur); + + // Clear out old and new address lists + zh->reconfig = 1; + addrvec_free(&zh->addrs_old); + addrvec_free(&zh->addrs_new); + + // Divide server list into addrs_old if in previous list and addrs_new if not + for (i = 0; i < resolved.count; i++) + { + struct sockaddr_storage *resolved_address = &resolved.data[i]; + if (addrvec_contains(&zh->addrs, resolved_address)) + { + rc = addrvec_append(&zh->addrs_old, resolved_address); + if (rc != ZOK) + { + goto fail; + } + } + else { + rc = addrvec_append(&zh->addrs_new, resolved_address); + if (rc != ZOK) + { + goto fail; + } + } + } + + num_old = zh->addrs_old.count; + num_new = zh->addrs_new.count; + + // Number of servers increased + if (num_old + num_new > zh->addrs.count) + { + if (found_current) { + // my server is in the new config, but load should be decreased. + // Need to decide if the client is moving to one of the new servers + if (drand48() <= (1 - ((double)zh->addrs.count) / (num_old + num_new))) { + zh->pNew = 1; + zh->pOld = 0; + } else { + // do nothing special -- stay with the current server + zh->reconfig = 0; + } + } else { + // my server is not in the new config, and load on old servers must + // be decreased, so connect to one of the new servers + zh->pNew = 1; + zh->pOld = 0; + } + } + + // Number of servers stayed the same or decreased + else { + if (found_current) { + // my server is in the new config, and load should be increased, so + // stay with this server and do nothing special + zh->reconfig = 0; + } else { + zh->pOld = ((double) (num_old * (zh->addrs.count - (num_old + num_new)))) / ((num_old + num_new) * (zh->addrs.count - num_old)); + zh->pNew = 1 - zh->pOld; + } + } + + addrvec_free(&zh->addrs); + zh->addrs = resolved; + + // If we need to do a reconfig and we're currently connected to a server, + // then force close that connection so on next interest() call we'll make a + // new connection + if (zh->reconfig == 1 && zh->fd != -1) + { + close(zh->fd); + zh->fd = -1; + zh->state = ZOO_NOTCONNECTED_STATE; + } + +fail: + + unlock_reconfig(zh); + + // If we short-circuited out and never assigned resolved to zh->addrs then we + // need to free resolved to avoid a memleak. + if (zh->addrs.data != resolved.data) + { + addrvec_free(&resolved); + } + + if (hosts) { + free(hosts); + hosts = NULL; + } + + return rc; +} + +const clientid_t *zoo_client_id(zhandle_t *zh) +{ + return &zh->client_id; +} + +static void null_watcher_fn(zhandle_t* p1, int p2, int p3,const char* p4,void*p5){} + +watcher_fn zoo_set_watcher(zhandle_t *zh,watcher_fn newFn) +{ + watcher_fn oldWatcher=zh->watcher; + if (newFn) { + zh->watcher = newFn; + } else { + zh->watcher = null_watcher_fn; + } + return oldWatcher; +} + +struct sockaddr* zookeeper_get_connected_host(zhandle_t *zh, + struct sockaddr *addr, socklen_t *addr_len) +{ + if (zh->state!=ZOO_CONNECTED_STATE) { + return NULL; + } + if (getpeername(zh->fd, addr, addr_len)==-1) { + return NULL; + } + return addr; +} + +static void log_env(zhandle_t *zh) { + char buf[2048]; +#ifdef HAVE_SYS_UTSNAME_H + struct utsname utsname; +#endif + +#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID_R) + struct passwd pw; + struct passwd *pwp = NULL; + uid_t uid = 0; +#endif + + LOG_INFO(LOGCALLBACK(zh), "Client environment:zookeeper.version=%s", PACKAGE_STRING); + +#ifdef HAVE_GETHOSTNAME + gethostname(buf, sizeof(buf)); + LOG_INFO(LOGCALLBACK(zh), "Client environment:host.name=%s", buf); +#else + LOG_INFO(LOGCALLBACK(zh), "Client environment:host.name="); +#endif + +#ifdef HAVE_SYS_UTSNAME_H + uname(&utsname); + LOG_INFO(LOGCALLBACK(zh), "Client environment:os.name=%s", utsname.sysname); + LOG_INFO(LOGCALLBACK(zh), "Client environment:os.arch=%s", utsname.release); + LOG_INFO(LOGCALLBACK(zh), "Client environment:os.version=%s", utsname.version); +#else + LOG_INFO(LOGCALLBACK(zh), "Client environment:os.name="); + LOG_INFO(LOGCALLBACK(zh), "Client environment:os.arch="); + LOG_INFO(LOGCALLBACK(zh), "Client environment:os.version="); +#endif + +#ifdef HAVE_GETLOGIN + LOG_INFO(LOGCALLBACK(zh), "Client environment:user.name=%s", getlogin()); +#else + LOG_INFO(LOGCALLBACK(zh), "Client environment:user.name="); +#endif + +#if defined(HAVE_GETUID) && defined(HAVE_GETPWUID_R) + uid = getuid(); + if (!getpwuid_r(uid, &pw, buf, sizeof(buf), &pwp) && pwp) { + LOG_INFO(LOGCALLBACK(zh), "Client environment:user.home=%s", pw.pw_dir); + } else { + LOG_INFO(LOGCALLBACK(zh), "Client environment:user.home="); + } +#else + LOG_INFO(LOGCALLBACK(zh), "Client environment:user.home="); +#endif + +#ifdef HAVE_GETCWD + if (!getcwd(buf, sizeof(buf))) { + LOG_INFO(LOGCALLBACK(zh), "Client environment:user.dir="); + } else { + LOG_INFO(LOGCALLBACK(zh), "Client environment:user.dir=%s", buf); + } +#else + LOG_INFO(LOGCALLBACK(zh), "Client environment:user.dir="); +#endif +} + +/** + * Create a zookeeper handle associated with the given host and port. + */ +static zhandle_t *zookeeper_init_internal(const char *host, watcher_fn watcher, + int recv_timeout, const clientid_t *clientid, void *context, int flags, + log_callback_fn log_callback) +{ + int errnosave = 0; + zhandle_t *zh = NULL; + char *index_chroot = NULL; + + // Create our handle + zh = calloc(1, sizeof(*zh)); + if (!zh) { + return 0; + } + + // Set log callback before calling into log_env + zh->log_callback = log_callback; + log_env(zh); + +#ifdef _WIN32 + if (Win32WSAStartup()){ + LOG_ERROR(LOGCALLBACK(zh), "Error initializing ws2_32.dll"); + return 0; + } +#endif + LOG_INFO(LOGCALLBACK(zh), "Initiating client connection, host=%s sessionTimeout=%d watcher=%p" + " sessionId=%#llx sessionPasswd=%s context=%p flags=%d", + host, + recv_timeout, + watcher, + (clientid == 0 ? 0 : clientid->client_id), + ((clientid == 0) || (clientid->passwd[0] == 0) ? + "" : ""), + context, + flags); + + zh->hostname = NULL; + zh->fd = -1; + zh->state = ZOO_NOTCONNECTED_STATE; + zh->context = context; + zh->recv_timeout = recv_timeout; + zh->allow_read_only = flags & ZOO_READONLY; + // non-zero clientid implies we've seen r/w server already + zh->seen_rw_server_before = (clientid != 0 && clientid->client_id != 0); + init_auth_info(&zh->auth_h); + if (watcher) { + zh->watcher = watcher; + } else { + zh->watcher = null_watcher_fn; + } + if (host == 0 || *host == 0) { // what we shouldn't dup + errno=EINVAL; + goto abort; + } + //parse the host to get the chroot if available + index_chroot = strchr(host, '/'); + if (index_chroot) { + zh->chroot = strdup(index_chroot); + if (zh->chroot == NULL) { + goto abort; + } + // if chroot is just / set it to null + if (strlen(zh->chroot) == 1) { + free(zh->chroot); + zh->chroot = NULL; + } + // cannot use strndup so allocate and strcpy + zh->hostname = (char *) malloc(index_chroot - host + 1); + zh->hostname = strncpy(zh->hostname, host, (index_chroot - host)); + //strncpy does not null terminate + *(zh->hostname + (index_chroot - host)) = '\0'; + + } else { + zh->chroot = NULL; + zh->hostname = strdup(host); + } + if (zh->chroot && !isValidPath(zh->chroot, 0)) { + errno = EINVAL; + goto abort; + } + if (zh->hostname == 0) { + goto abort; + } + if(update_addrs(zh) != 0) { + goto abort; + } + + if (clientid) { + memcpy(&zh->client_id, clientid, sizeof(zh->client_id)); + } else { + memset(&zh->client_id, 0, sizeof(zh->client_id)); + } + zh->io_count = 0; + zh->primer_buffer.buffer = zh->primer_storage_buffer; + zh->primer_buffer.curr_offset = 0; + zh->primer_buffer.len = sizeof(zh->primer_storage_buffer); + zh->primer_buffer.next = 0; + zh->last_zxid = 0; + zh->next_deadline.tv_sec=zh->next_deadline.tv_usec=0; + zh->socket_readable.tv_sec=zh->socket_readable.tv_usec=0; + zh->active_node_watchers=create_zk_hashtable(); + zh->active_exist_watchers=create_zk_hashtable(); + zh->active_child_watchers=create_zk_hashtable(); + zh->disable_reconnection_attempt = 0; + + if (adaptor_init(zh) == -1) { + goto abort; + } + + return zh; +abort: + errnosave=errno; + destroy(zh); + free(zh); + errno=errnosave; + return 0; +} + +zhandle_t *zookeeper_init(const char *host, watcher_fn watcher, + int recv_timeout, const clientid_t *clientid, void *context, int flags) +{ + return zookeeper_init_internal(host, watcher, recv_timeout, clientid, context, flags, NULL); +} + +zhandle_t *zookeeper_init2(const char *host, watcher_fn watcher, + int recv_timeout, const clientid_t *clientid, void *context, int flags, + log_callback_fn log_callback) +{ + return zookeeper_init_internal(host, watcher, recv_timeout, clientid, context, flags, log_callback); +} + +/** + * Set a new list of zk servers to connect to. Disconnect will occur if + * current connection endpoint is not in the list. + */ +int zoo_set_servers(zhandle_t *zh, const char *hosts) +{ + if (hosts == NULL) + { + LOG_ERROR(LOGCALLBACK(zh), "New server list cannot be empty"); + return ZBADARGUMENTS; + } + + // NOTE: guard access to {hostname, addr_cur, addrs, addrs_old, addrs_new} + lock_reconfig(zh); + + // Reset hostname to new set of hosts to connect to + if (zh->hostname) { + free(zh->hostname); + } + + zh->hostname = strdup(hosts); + + unlock_reconfig(zh); + + return update_addrs(zh); +} + +/** + * Get the next server to connect to, when in 'reconfig' mode, which means that + * we've updated the server list to connect to, and are now trying to find some + * server to connect to. Once we get successfully connected, 'reconfig' mode is + * set to false. Similarly, if we tried to connect to all servers in new config + * and failed, 'reconfig' mode is set to false. + * + * While in 'reconfig' mode, we should connect to a server in the new set of + * servers (addrs_new) with probability pNew and to servers in the old set of + * servers (addrs_old) with probability pOld (which is just 1-pNew). If we tried + * out all servers in either, we continue to try servers from the other set, + * regardless of pNew or pOld. If we tried all servers we give up and go back to + * the normal round robin mode + * + * When called, must be protected by lock_reconfig(zh). + */ +static int get_next_server_in_reconfig(zhandle_t *zh) +{ + int take_new = drand48() <= zh->pNew; + + LOG_DEBUG(LOGCALLBACK(zh), "[OLD] count=%d capacity=%d next=%d hasnext=%d", + zh->addrs_old.count, zh->addrs_old.capacity, zh->addrs_old.next, + addrvec_hasnext(&zh->addrs_old)); + LOG_DEBUG(LOGCALLBACK(zh), "[NEW] count=%d capacity=%d next=%d hasnext=%d", + zh->addrs_new.count, zh->addrs_new.capacity, zh->addrs_new.next, + addrvec_hasnext(&zh->addrs_new)); + + // Take one of the new servers if we haven't tried them all yet + // and either the probability tells us to connect to one of the new servers + // or if we already tried them all then use one of the old servers + if (addrvec_hasnext(&zh->addrs_new) + && (take_new || !addrvec_hasnext(&zh->addrs_old))) + { + addrvec_next(&zh->addrs_new, &zh->addr_cur); + LOG_DEBUG(LOGCALLBACK(zh), "Using next from NEW=%s", format_endpoint_info(&zh->addr_cur)); + return 0; + } + + // start taking old servers + if (addrvec_hasnext(&zh->addrs_old)) { + addrvec_next(&zh->addrs_old, &zh->addr_cur); + LOG_DEBUG(LOGCALLBACK(zh), "Using next from OLD=%s", format_endpoint_info(&zh->addr_cur)); + return 0; + } + + LOG_DEBUG(LOGCALLBACK(zh), "Failed to find either new or old"); + memset(&zh->addr_cur, 0, sizeof(zh->addr_cur)); + return 1; +} + +/** + * Cycle through our server list to the correct 'next' server. The 'next' server + * to connect to depends upon whether we're in a 'reconfig' mode or not. Reconfig + * mode means we've upated the server list and are now trying to find a server + * to connect to. Once we get connected, we are no longer in the reconfig mode. + * Similarly, if we try to connect to all the servers in the new configuration + * and failed, reconfig mode is set to false. + * + * For more algorithm details, see get_next_server_in_reconfig. + */ +void zoo_cycle_next_server(zhandle_t *zh) +{ + // NOTE: guard access to {hostname, addr_cur, addrs, addrs_old, addrs_new} + lock_reconfig(zh); + + memset(&zh->addr_cur, 0, sizeof(zh->addr_cur)); + + if (zh->reconfig) + { + if (get_next_server_in_reconfig(zh) == 0) { + unlock_reconfig(zh); + return; + } + + // tried all new and old servers and couldn't connect + zh->reconfig = 0; + } + + addrvec_next(&zh->addrs, &zh->addr_cur); + + unlock_reconfig(zh); + + return; +} + +/** + * Get the host:port for the server we are currently connecting to or connected + * to. This is largely for testing purposes but is also generally useful for + * other client software built on top of this client. + */ +const char* zoo_get_current_server(zhandle_t* zh) +{ + const char *endpoint_info = NULL; + + // NOTE: guard access to {hostname, addr_cur, addrs, addrs_old, addrs_new} + // Need the lock here as it is changed in update_addrs() + lock_reconfig(zh); + + endpoint_info = format_endpoint_info(&zh->addr_cur); + unlock_reconfig(zh); + return endpoint_info; +} + +/** + * deallocated the free_path only its beeen allocated + * and not equal to path + */ +void free_duplicate_path(const char *free_path, const char* path) { + if (free_path != path) { + free((void*)free_path); + } +} + +/** + prepend the chroot path if available else return the path +*/ +static char* prepend_string(zhandle_t *zh, const char* client_path) { + char *ret_str; + if (zh == NULL || zh->chroot == NULL) + return (char *) client_path; + // handle the chroot itself, client_path = "/" + if (strlen(client_path) == 1) { + return strdup(zh->chroot); + } + ret_str = (char *) malloc(strlen(zh->chroot) + strlen(client_path) + 1); + strcpy(ret_str, zh->chroot); + return strcat(ret_str, client_path); +} + +/** + strip off the chroot string from the server path + if there is one else return the exact path + */ +char* sub_string(zhandle_t *zh, const char* server_path) { + char *ret_str; + if (zh->chroot == NULL) + return (char *) server_path; + //ZOOKEEPER-1027 + if (strncmp(server_path, zh->chroot, strlen(zh->chroot)) != 0) { + LOG_ERROR(LOGCALLBACK(zh), "server path %s does not include chroot path %s", + server_path, zh->chroot); + return (char *) server_path; + } + if (strlen(server_path) == strlen(zh->chroot)) { + //return "/" + ret_str = strdup("/"); + return ret_str; + } + ret_str = strdup(server_path + strlen(zh->chroot)); + return ret_str; +} + +static buffer_list_t *allocate_buffer(char *buff, int len) +{ + buffer_list_t *buffer = calloc(1, sizeof(*buffer)); + if (buffer == 0) + return 0; + + buffer->len = len==0?sizeof(*buffer):len; + buffer->curr_offset = 0; + buffer->buffer = buff; + buffer->next = 0; + return buffer; +} + +static void free_buffer(buffer_list_t *b) +{ + if (!b) { + return; + } + if (b->buffer) { + free(b->buffer); + } + free(b); +} + +static buffer_list_t *dequeue_buffer(buffer_head_t *list) +{ + buffer_list_t *b; + lock_buffer_list(list); + b = list->head; + if (b) { + list->head = b->next; + if (!list->head) { + assert(b == list->last); + list->last = 0; + } + } + unlock_buffer_list(list); + return b; +} + +static int remove_buffer(buffer_head_t *list) +{ + buffer_list_t *b = dequeue_buffer(list); + if (!b) { + return 0; + } + free_buffer(b); + return 1; +} + +static void queue_buffer(buffer_head_t *list, buffer_list_t *b, int add_to_front) +{ + b->next = 0; + lock_buffer_list(list); + if (list->head) { + assert(list->last); + // The list is not empty + if (add_to_front) { + b->next = list->head; + list->head = b; + } else { + list->last->next = b; + list->last = b; + } + }else{ + // The list is empty + assert(!list->head); + list->head = b; + list->last = b; + } + unlock_buffer_list(list); +} + +static int queue_buffer_bytes(buffer_head_t *list, char *buff, int len) +{ + buffer_list_t *b = allocate_buffer(buff,len); + if (!b) + return ZSYSTEMERROR; + queue_buffer(list, b, 0); + return ZOK; +} + +static int queue_front_buffer_bytes(buffer_head_t *list, char *buff, int len) +{ + buffer_list_t *b = allocate_buffer(buff,len); + if (!b) + return ZSYSTEMERROR; + queue_buffer(list, b, 1); + return ZOK; +} + +static __attribute__ ((unused)) int get_queue_len(buffer_head_t *list) +{ + int i; + buffer_list_t *ptr; + lock_buffer_list(list); + ptr = list->head; + for (i=0; ptr!=0; ptr=ptr->next, i++) + ; + unlock_buffer_list(list); + return i; +} +/* returns: + * -1 if send failed, + * 0 if send would block while sending the buffer (or a send was incomplete), + * 1 if success + */ +static int send_buffer(socket_t fd, buffer_list_t *buff) +{ + int len = buff->len; + int off = buff->curr_offset; + int rc = -1; + + if (off < 4) { + /* we need to send the length at the beginning */ + int nlen = htonl(len); + char *b = (char*)&nlen; + rc = zookeeper_send(fd, b + off, sizeof(nlen) - off); + if (rc == -1) { +#ifdef _WIN32 + if (WSAGetLastError() != WSAEWOULDBLOCK) { +#else + if (errno != EAGAIN) { +#endif + return -1; + } else { + return 0; + } + } else { + buff->curr_offset += rc; + } + off = buff->curr_offset; + } + if (off >= 4) { + /* want off to now represent the offset into the buffer */ + off -= sizeof(buff->len); + rc = zookeeper_send(fd, buff->buffer + off, len - off); + if (rc == -1) { +#ifdef _WIN32 + if (WSAGetLastError() != WSAEWOULDBLOCK) { +#else + if (errno != EAGAIN) { +#endif + return -1; + } + } else { + buff->curr_offset += rc; + } + } + return buff->curr_offset == len + sizeof(buff->len); +} + +/* returns: + * -1 if recv call failed, + * 0 if recv would block, + * 1 if success + */ +static int recv_buffer(zhandle_t *zh, buffer_list_t *buff) +{ + int off = buff->curr_offset; + int rc = 0; + + /* if buffer is less than 4, we are reading in the length */ + if (off < 4) { + char *buffer = (char*)&(buff->len); + rc = recv(zh->fd, buffer+off, sizeof(int)-off, 0); + switch (rc) { + case 0: + errno = EHOSTDOWN; + case -1: +#ifdef _WIN32 + if (WSAGetLastError() == WSAEWOULDBLOCK) { +#else + if (errno == EAGAIN) { +#endif + return 0; + } + return -1; + default: + buff->curr_offset += rc; + } + off = buff->curr_offset; + if (buff->curr_offset == sizeof(buff->len)) { + buff->len = ntohl(buff->len); + buff->buffer = calloc(1, buff->len); + } + } + if (buff->buffer) { + /* want off to now represent the offset into the buffer */ + off -= sizeof(buff->len); + + rc = recv(zh->fd, buff->buffer+off, buff->len-off, 0); + + /* dirty hack to make new client work against old server + * old server sends 40 bytes to finish connection handshake, + * while we're expecting 41 (1 byte for read-only mode data) */ + if (buff == &zh->primer_buffer && rc == buff->len - 1) ++rc; + + switch(rc) { + case 0: + errno = EHOSTDOWN; + case -1: +#ifdef _WIN32 + if (WSAGetLastError() == WSAEWOULDBLOCK) { +#else + if (errno == EAGAIN) { +#endif + break; + } + return -1; + default: + buff->curr_offset += rc; + } + } + return buff->curr_offset == buff->len + sizeof(buff->len); +} + +void free_buffers(buffer_head_t *list) +{ + while (remove_buffer(list)) + ; +} + +void free_completions(zhandle_t *zh,int callCompletion,int reason) +{ + completion_head_t tmp_list; + struct oarchive *oa; + struct ReplyHeader h; + void_completion_t auth_completion = NULL; + auth_completion_list_t a_list, *a_tmp; + + if (lock_completion_list(&zh->sent_requests) == 0) { + tmp_list = zh->sent_requests; + zh->sent_requests.head = 0; + zh->sent_requests.last = 0; + unlock_completion_list(&zh->sent_requests); + while (tmp_list.head) { + completion_list_t *cptr = tmp_list.head; + + tmp_list.head = cptr->next; + if (cptr->c.data_result == SYNCHRONOUS_MARKER) { +#ifdef THREADED + struct sync_completion + *sc = (struct sync_completion*)cptr->data; + sc->rc = reason; + notify_sync_completion(sc); + zh->outstanding_sync--; + destroy_completion_entry(cptr); +#else + abort_singlethreaded(zh); +#endif + } else if (callCompletion) { + // Fake the response + buffer_list_t *bptr; + h.xid = cptr->xid; + h.zxid = -1; + h.err = reason; + oa = create_buffer_oarchive(); + serialize_ReplyHeader(oa, "header", &h); + bptr = calloc(sizeof(*bptr), 1); + assert(bptr); + bptr->len = get_buffer_len(oa); + bptr->buffer = get_buffer(oa); + close_buffer_oarchive(&oa, 0); + cptr->buffer = bptr; + queue_completion(&zh->completions_to_process, cptr, 0); + } + } + } + if (zoo_lock_auth(zh) == 0) { + a_list.completion = NULL; + a_list.next = NULL; + + get_auth_completions(&zh->auth_h, &a_list); + zoo_unlock_auth(zh); + + a_tmp = &a_list; + // chain call user's completion function + while (a_tmp->completion != NULL) { + auth_completion = a_tmp->completion; + auth_completion(reason, a_tmp->auth_data); + a_tmp = a_tmp->next; + if (a_tmp == NULL) + break; + } + } + free_auth_completion(&a_list); +} + +static void cleanup_bufs(zhandle_t *zh,int callCompletion,int rc) +{ + enter_critical(zh); + free_buffers(&zh->to_send); + free_buffers(&zh->to_process); + free_completions(zh,callCompletion,rc); + leave_critical(zh); + if (zh->input_buffer && zh->input_buffer != &zh->primer_buffer) { + free_buffer(zh->input_buffer); + zh->input_buffer = 0; + } +} + +/* return 1 if zh's state is ZOO_CONNECTED_STATE or ZOO_READONLY_STATE, + * 0 otherwise */ +static int is_connected(zhandle_t* zh) +{ + return (zh->state==ZOO_CONNECTED_STATE || zh->state==ZOO_READONLY_STATE); +} + +static void cleanup(zhandle_t *zh,int rc) +{ + close(zh->fd); + if (is_unrecoverable(zh)) { + LOG_DEBUG(LOGCALLBACK(zh), "Calling a watcher for a ZOO_SESSION_EVENT and the state=%s", + state2String(zh->state)); + PROCESS_SESSION_EVENT(zh, zh->state); + } else if (is_connected(zh)) { + LOG_DEBUG(LOGCALLBACK(zh), "Calling a watcher for a ZOO_SESSION_EVENT and the state=CONNECTING_STATE"); + PROCESS_SESSION_EVENT(zh, ZOO_CONNECTING_STATE); + } + cleanup_bufs(zh,1,rc); + zh->fd = -1; + + LOG_DEBUG(LOGCALLBACK(zh), "Previous connection=[%s] delay=%d", zoo_get_current_server(zh), zh->delay); + + if (!is_unrecoverable(zh)) { + zh->state = 0; + } + if (process_async(zh->outstanding_sync)) { + process_completions(zh); + } +} + +static void handle_error(zhandle_t *zh,int rc) +{ + cleanup(zh, rc); + // NOTE: If we're at the end of the list of addresses to connect to, then + // we want to delay the next connection attempt to avoid spinning. + // Then increment what host we'll connect to since we failed to connect to current + zh->delay = addrvec_atend(&zh->addrs); + addrvec_next(&zh->addrs, &zh->addr_cur); +} + +static int handle_socket_error_msg(zhandle_t *zh, int line, int rc, + const char* format, ...) +{ + if(logLevel>=ZOO_LOG_LEVEL_ERROR){ + va_list va; + char buf[1024]; + va_start(va,format); + vsnprintf(buf, sizeof(buf)-1,format,va); + log_message(LOGCALLBACK(zh), ZOO_LOG_LEVEL_ERROR,line,__func__, + "Socket [%s] zk retcode=%d, errno=%d(%s): %s", + zoo_get_current_server(zh),rc,errno,strerror(errno),buf); + va_end(va); + } + handle_error(zh,rc); + return rc; +} + +static void auth_completion_func(int rc, zhandle_t* zh) +{ + void_completion_t auth_completion = NULL; + auth_completion_list_t a_list; + auth_completion_list_t *a_tmp; + + if(zh==NULL) + return; + + zoo_lock_auth(zh); + + if(rc!=0){ + zh->state=ZOO_AUTH_FAILED_STATE; + }else{ + //change state for all auths + mark_active_auth(zh); + } + a_list.completion = NULL; + a_list.next = NULL; + get_auth_completions(&zh->auth_h, &a_list); + zoo_unlock_auth(zh); + if (rc) { + LOG_ERROR(LOGCALLBACK(zh), "Authentication scheme %s failed. Connection closed.", + zh->auth_h.auth->scheme); + } + else { + LOG_INFO(LOGCALLBACK(zh), "Authentication scheme %s succeeded", zh->auth_h.auth->scheme); + } + a_tmp = &a_list; + // chain call user's completion function + while (a_tmp->completion != NULL) { + auth_completion = a_tmp->completion; + auth_completion(rc, a_tmp->auth_data); + a_tmp = a_tmp->next; + if (a_tmp == NULL) + break; + } + free_auth_completion(&a_list); +} + +static int send_info_packet(zhandle_t *zh, auth_info* auth) { + struct oarchive *oa; + struct RequestHeader h = {AUTH_XID, ZOO_SETAUTH_OP}; + struct AuthPacket req; + int rc; + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + req.type=0; // ignored by the server + req.scheme = auth->scheme; + req.auth = auth->auth; + rc = rc < 0 ? rc : serialize_AuthPacket(oa, "req", &req); + /* add this buffer to the head of the send queue */ + rc = rc < 0 ? rc : queue_front_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + return rc; +} + +/** send all auths, not just the last one **/ +static int send_auth_info(zhandle_t *zh) { + int rc = 0; + auth_info *auth = NULL; + + zoo_lock_auth(zh); + auth = zh->auth_h.auth; + if (auth == NULL) { + zoo_unlock_auth(zh); + return ZOK; + } + while (auth != NULL) { + rc = send_info_packet(zh, auth); + auth = auth->next; + } + zoo_unlock_auth(zh); + LOG_DEBUG(LOGCALLBACK(zh), "Sending all auth info request to %s", zoo_get_current_server(zh)); + return (rc <0) ? ZMARSHALLINGERROR:ZOK; +} + +static int send_last_auth_info(zhandle_t *zh) +{ + int rc = 0; + auth_info *auth = NULL; + + zoo_lock_auth(zh); + auth = get_last_auth(&zh->auth_h); + if(auth==NULL) { + zoo_unlock_auth(zh); + return ZOK; // there is nothing to send + } + rc = send_info_packet(zh, auth); + zoo_unlock_auth(zh); + LOG_DEBUG(LOGCALLBACK(zh), "Sending auth info request to %s",zoo_get_current_server(zh)); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +static void free_key_list(char **list, int count) +{ + int i; + + for(i = 0; i < count; i++) { + free(list[i]); + } + free(list); +} + +static int send_set_watches(zhandle_t *zh) +{ + struct oarchive *oa; + struct RequestHeader h = {SET_WATCHES_XID, ZOO_SETWATCHES_OP}; + struct SetWatches req; + int rc; + + req.relativeZxid = zh->last_zxid; + req.dataWatches.data = collect_keys(zh->active_node_watchers, (int*)&req.dataWatches.count); + req.existWatches.data = collect_keys(zh->active_exist_watchers, (int*)&req.existWatches.count); + req.childWatches.data = collect_keys(zh->active_child_watchers, (int*)&req.childWatches.count); + + // return if there are no pending watches + if (!req.dataWatches.count && !req.existWatches.count && + !req.childWatches.count) { + free_key_list(req.dataWatches.data, req.dataWatches.count); + free_key_list(req.existWatches.data, req.existWatches.count); + free_key_list(req.childWatches.data, req.childWatches.count); + return ZOK; + } + + + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_SetWatches(oa, "req", &req); + /* add this buffer to the head of the send queue */ + rc = rc < 0 ? rc : queue_front_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + free_key_list(req.dataWatches.data, req.dataWatches.count); + free_key_list(req.existWatches.data, req.existWatches.count); + free_key_list(req.childWatches.data, req.childWatches.count); + LOG_DEBUG(LOGCALLBACK(zh), "Sending set watches request to %s",zoo_get_current_server(zh)); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +static int serialize_prime_connect(struct connect_req *req, char* buffer){ + //this should be the order of serialization + int offset = 0; + req->protocolVersion = htonl(req->protocolVersion); + memcpy(buffer + offset, &req->protocolVersion, sizeof(req->protocolVersion)); + offset = offset + sizeof(req->protocolVersion); + + req->lastZxidSeen = zoo_htonll(req->lastZxidSeen); + memcpy(buffer + offset, &req->lastZxidSeen, sizeof(req->lastZxidSeen)); + offset = offset + sizeof(req->lastZxidSeen); + + req->timeOut = htonl(req->timeOut); + memcpy(buffer + offset, &req->timeOut, sizeof(req->timeOut)); + offset = offset + sizeof(req->timeOut); + + req->sessionId = zoo_htonll(req->sessionId); + memcpy(buffer + offset, &req->sessionId, sizeof(req->sessionId)); + offset = offset + sizeof(req->sessionId); + + req->passwd_len = htonl(req->passwd_len); + memcpy(buffer + offset, &req->passwd_len, sizeof(req->passwd_len)); + offset = offset + sizeof(req->passwd_len); + + memcpy(buffer + offset, req->passwd, sizeof(req->passwd)); + offset = offset + sizeof(req->passwd); + + memcpy(buffer + offset, &req->readOnly, sizeof(req->readOnly)); + + return 0; +} + +static int deserialize_prime_response(struct prime_struct *resp, char* buffer) +{ + //this should be the order of deserialization + int offset = 0; + memcpy(&resp->len, buffer + offset, sizeof(resp->len)); + offset = offset + sizeof(resp->len); + + resp->len = ntohl(resp->len); + memcpy(&resp->protocolVersion, + buffer + offset, + sizeof(resp->protocolVersion)); + offset = offset + sizeof(resp->protocolVersion); + + resp->protocolVersion = ntohl(resp->protocolVersion); + memcpy(&resp->timeOut, buffer + offset, sizeof(resp->timeOut)); + offset = offset + sizeof(resp->timeOut); + + resp->timeOut = ntohl(resp->timeOut); + memcpy(&resp->sessionId, buffer + offset, sizeof(resp->sessionId)); + offset = offset + sizeof(resp->sessionId); + + resp->sessionId = zoo_htonll(resp->sessionId); + memcpy(&resp->passwd_len, buffer + offset, sizeof(resp->passwd_len)); + offset = offset + sizeof(resp->passwd_len); + + resp->passwd_len = ntohl(resp->passwd_len); + memcpy(resp->passwd, buffer + offset, sizeof(resp->passwd)); + offset = offset + sizeof(resp->passwd); + + memcpy(&resp->readOnly, buffer + offset, sizeof(resp->readOnly)); + + return 0; +} + +static int prime_connection(zhandle_t *zh) +{ + int rc; + /*this is the size of buffer to serialize req into*/ + char buffer_req[HANDSHAKE_REQ_SIZE]; + int len = sizeof(buffer_req); + int hlen = 0; + struct connect_req req; + req.protocolVersion = 0; + req.sessionId = zh->seen_rw_server_before ? zh->client_id.client_id : 0; + req.passwd_len = sizeof(req.passwd); + memcpy(req.passwd, zh->client_id.passwd, sizeof(zh->client_id.passwd)); + req.timeOut = zh->recv_timeout; + req.lastZxidSeen = zh->last_zxid; + req.readOnly = zh->allow_read_only; + hlen = htonl(len); + /* We are running fast and loose here, but this string should fit in the initial buffer! */ + rc=zookeeper_send(zh->fd, &hlen, sizeof(len)); + serialize_prime_connect(&req, buffer_req); + rc=rc<0 ? rc : zookeeper_send(zh->fd, buffer_req, len); + if (rc<0) { + return handle_socket_error_msg(zh, __LINE__, ZCONNECTIONLOSS, + "failed to send a handshake packet: %s", strerror(errno)); + } + zh->state = ZOO_ASSOCIATING_STATE; + + zh->input_buffer = &zh->primer_buffer; + memset(zh->input_buffer->buffer, 0, zh->input_buffer->len); + + /* This seems a bit weird to to set the offset to 4, but we already have a + * length, so we skip reading the length (and allocating the buffer) by + * saying that we are already at offset 4 */ + zh->input_buffer->curr_offset = 4; + + return ZOK; +} + +static inline int calculate_interval(const struct timeval *start, + const struct timeval *end) +{ + int interval; + struct timeval i = *end; + i.tv_sec -= start->tv_sec; + i.tv_usec -= start->tv_usec; + interval = i.tv_sec * 1000 + (i.tv_usec/1000); + return interval; +} + +static struct timeval get_timeval(int interval) +{ + struct timeval tv; + if (interval < 0) { + interval = 0; + } + tv.tv_sec = interval/1000; + tv.tv_usec = (interval%1000)*1000; + return tv; +} + + static int add_void_completion(zhandle_t *zh, int xid, void_completion_t dc, + const void *data); + static int add_string_completion(zhandle_t *zh, int xid, + string_completion_t dc, const void *data); + static int add_string_stat_completion(zhandle_t *zh, int xid, + string_stat_completion_t dc, const void *data); + + + int send_ping(zhandle_t* zh) + { + int rc; + struct oarchive *oa = create_buffer_oarchive(); + struct RequestHeader h = {PING_XID, ZOO_PING_OP}; + + rc = serialize_RequestHeader(oa, "header", &h); + enter_critical(zh); + get_system_time(&zh->last_ping); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + close_buffer_oarchive(&oa, 0); + return rc<0 ? rc : adaptor_send_queue(zh, 0); +} + +/* upper bound of a timeout for seeking for r/w server when in read-only mode */ +const int MAX_RW_TIMEOUT = 60000; +const int MIN_RW_TIMEOUT = 200; + +static int ping_rw_server(zhandle_t* zh) +{ + char buf[10]; + socket_t sock; + int rc; + sendsize_t ssize; + int sock_flags; + + addrvec_peek(&zh->addrs, &zh->addr_rw_server); + +#ifdef SOCK_CLOEXEC_ENABLED + sock_flags = SOCK_STREAM | SOCK_CLOEXEC; +#else + sock_flags = SOCK_STREAM; +#endif + sock = socket(zh->addr_rw_server.ss_family, sock_flags, 0); + if (sock < 0) { + return 0; + } + + zookeeper_set_sock_nodelay(zh, sock); + zookeeper_set_sock_timeout(zh, sock, 1); + + rc = zookeeper_connect(zh, &zh->addr_rw_server, sock); + if (rc < 0) { + return 0; + } + + ssize = zookeeper_send(sock, "isro", 4); + if (ssize < 0) { + rc = 0; + goto out; + } + + memset(buf, 0, sizeof(buf)); + rc = recv(sock, buf, sizeof(buf), 0); + if (rc < 0) { + rc = 0; + goto out; + } + + rc = strcmp("rw", buf) == 0; + +out: + close(sock); + addr_rw_server = rc ? &zh->addr_rw_server : 0; + return rc; +} + +#if !defined(WIN32) && !defined(min) +static inline int min(int a, int b) +{ + return a < b ? a : b; +} +#endif + +static void zookeeper_set_sock_noblock(zhandle_t *zh, socket_t sock) +{ +#ifdef _WIN32 + ULONG nonblocking_flag = 1; + + ioctlsocket(sock, FIONBIO, &nonblocking_flag); +#else + fcntl(sock, F_SETFL, O_NONBLOCK|fcntl(sock, F_GETFL, 0)); +#endif +} + +static void zookeeper_set_sock_timeout(zhandle_t *zh, socket_t s, int timeout) +{ + struct timeval tv; + + tv.tv_sec = timeout; + setsockopt(s, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(struct timeval)); + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(struct timeval)); +} + +static void zookeeper_set_sock_nodelay(zhandle_t *zh, socket_t sock) +{ +#ifdef _WIN32 + char enable_tcp_nodelay = 1; +#else + int enable_tcp_nodelay = 1; +#endif + int rc; + + rc = setsockopt(sock, + IPPROTO_TCP, + TCP_NODELAY, + &enable_tcp_nodelay, + sizeof(enable_tcp_nodelay)); + + if (rc) { + LOG_WARN(LOGCALLBACK(zh), + "Unable to set TCP_NODELAY, latency may be effected"); + } +} + +static socket_t zookeeper_connect(zhandle_t *zh, + struct sockaddr_storage *addr, + socket_t fd) +{ + int rc; + int addr_len; + +#if defined(AF_INET6) + if (addr->ss_family == AF_INET6) { + addr_len = sizeof(struct sockaddr_in6); + } else { + addr_len = sizeof(struct sockaddr_in); + } +#else + addr_len = sizeof(struct sockaddr_in); +#endif + + LOG_DEBUG(LOGCALLBACK(zh), "[zk] connect()\n"); + rc = connect(fd, (struct sockaddr *)addr, addr_len); + +#ifdef _WIN32 + errno = GetLastError(); + +#ifndef EWOULDBLOCK +#define EWOULDBLOCK WSAEWOULDBLOCK +#endif + +#ifndef EINPROGRESS +#define EINPROGRESS WSAEINPROGRESS +#endif + +#if _MSC_VER >= 1600 + switch(errno) { + case WSAEWOULDBLOCK: + errno = EWOULDBLOCK; + break; + case WSAEINPROGRESS: + errno = EINPROGRESS; + break; + } +#endif +#endif + + return rc; +} + +int zookeeper_interest(zhandle_t *zh, socket_t *fd, int *interest, + struct timeval *tv) +{ + int sock_flags; + int rc = 0; + struct timeval now; + +#ifdef SOCK_CLOEXEC_ENABLED + sock_flags = SOCK_STREAM | SOCK_CLOEXEC; +#else + sock_flags = SOCK_STREAM; +#endif + + if(zh==0 || fd==0 ||interest==0 || tv==0) + return ZBADARGUMENTS; + if (is_unrecoverable(zh)) + return ZINVALIDSTATE; + get_system_time(&now); + if(zh->next_deadline.tv_sec!=0 || zh->next_deadline.tv_usec!=0){ + int time_left = calculate_interval(&zh->next_deadline, &now); + int max_exceed = zh->recv_timeout / 10 > 200 ? 200 : + (zh->recv_timeout / 10); + if (time_left > max_exceed) + LOG_WARN(LOGCALLBACK(zh), "Exceeded deadline by %dms", time_left); + } + api_prolog(zh); + + rc = update_addrs(zh); + if (rc != ZOK) { + return api_epilog(zh, rc); + } + + *fd = zh->fd; + *interest = 0; + tv->tv_sec = 0; + tv->tv_usec = 0; + + if (*fd == -1) { + /* + * If we previously failed to connect to server pool (zh->delay == 1) + * then we need delay our connection on this iteration 1/60 of the + * recv timeout before trying again so we don't spin. + * + * We always clear the delay setting. If we fail again, we'll set delay + * again and on the next iteration we'll do the same. + * + * We will also delay if the disable_reconnection_attempt is set. + */ + if (zh->delay == 1 || zh->disable_reconnection_attempt == 1) { + *tv = get_timeval(zh->recv_timeout/60); + zh->delay = 0; + + LOG_WARN(LOGCALLBACK(zh), "Delaying connection after exhaustively trying all servers [%s]", + zh->hostname); + } else { + if (addr_rw_server) { + zh->addr_cur = *addr_rw_server; + addr_rw_server = 0; + } else { + // No need to delay -- grab the next server and attempt connection + zoo_cycle_next_server(zh); + } + zh->fd = socket(zh->addr_cur.ss_family, sock_flags, 0); + if (zh->fd < 0) { + rc = handle_socket_error_msg(zh, + __LINE__, + ZSYSTEMERROR, + "socket() call failed"); + return api_epilog(zh, rc); + } + + zookeeper_set_sock_nodelay(zh, zh->fd); + zookeeper_set_sock_noblock(zh, zh->fd); + + rc = zookeeper_connect(zh, &zh->addr_cur, zh->fd); + + if (rc == -1) { + /* we are handling the non-blocking connect according to + * the description in section 16.3 "Non-blocking connect" + * in UNIX Network Programming vol 1, 3rd edition */ + if (errno == EWOULDBLOCK || errno == EINPROGRESS) { + zh->state = ZOO_CONNECTING_STATE; + } else { + rc = handle_socket_error_msg(zh, + __LINE__, + ZCONNECTIONLOSS, + "connect() call failed"); + return api_epilog(zh, rc); + } + } else { + rc = prime_connection(zh); + if (rc != 0) { + return api_epilog(zh,rc); + } + + LOG_INFO(LOGCALLBACK(zh), + "Initiated connection to server [%s]", + format_endpoint_info(&zh->addr_cur)); + } + *tv = get_timeval(zh->recv_timeout/3); + } + *fd = zh->fd; + zh->last_recv = now; + zh->last_send = now; + zh->last_ping = now; + zh->last_ping_rw = now; + zh->ping_rw_timeout = MIN_RW_TIMEOUT; + } + + if (zh->fd != -1) { + int idle_recv = calculate_interval(&zh->last_recv, &now); + int idle_send = calculate_interval(&zh->last_send, &now); + int recv_to = zh->recv_timeout*2/3 - idle_recv; + int send_to = zh->recv_timeout/3; + // have we exceeded the receive timeout threshold? + if (recv_to <= 0) { + // We gotta cut our losses and connect to someone else +#ifdef _WIN32 + errno = WSAETIMEDOUT; +#else + errno = ETIMEDOUT; +#endif + *interest=0; + *tv = get_timeval(0); + return api_epilog(zh,handle_socket_error_msg(zh, + __LINE__,ZOPERATIONTIMEOUT, + "connection to %s timed out (exceeded timeout by %dms)", + format_endpoint_info(&zh->addr_cur), + -recv_to)); + + } + + // We only allow 1/3 of our timeout time to expire before sending + // a PING + if (is_connected(zh)) { + send_to = zh->recv_timeout/3 - idle_send; + if (send_to <= 0) { + if (zh->sent_requests.head == 0) { + rc = send_ping(zh); + if (rc < 0) { + LOG_ERROR(LOGCALLBACK(zh), "failed to send PING request (zk retcode=%d)",rc); + return api_epilog(zh,rc); + } + } + send_to = zh->recv_timeout/3; + } + } + + // If we are in read-only mode, seek for read/write server + if (zh->state == ZOO_READONLY_STATE) { + int idle_ping_rw = calculate_interval(&zh->last_ping_rw, &now); + if (idle_ping_rw >= zh->ping_rw_timeout) { + zh->last_ping_rw = now; + idle_ping_rw = 0; + zh->ping_rw_timeout = min(zh->ping_rw_timeout * 2, + MAX_RW_TIMEOUT); + if (ping_rw_server(zh)) { + struct sockaddr_storage addr; + addrvec_peek(&zh->addrs, &addr); + zh->ping_rw_timeout = MIN_RW_TIMEOUT; + LOG_INFO(LOGCALLBACK(zh), + "r/w server found at %s", + format_endpoint_info(&addr)); + cleanup(zh, ZOK); + } else { + addrvec_next(&zh->addrs, NULL); + } + } + send_to = min(send_to, zh->ping_rw_timeout - idle_ping_rw); + } + + // choose the lesser value as the timeout + *tv = get_timeval(min(recv_to, send_to)); + + zh->next_deadline.tv_sec = now.tv_sec + tv->tv_sec; + zh->next_deadline.tv_usec = now.tv_usec + tv->tv_usec; + if (zh->next_deadline.tv_usec > 1000000) { + zh->next_deadline.tv_sec += zh->next_deadline.tv_usec / 1000000; + zh->next_deadline.tv_usec = zh->next_deadline.tv_usec % 1000000; + } + *interest = ZOOKEEPER_READ; + /* we are interested in a write if we are connected and have something + * to send, or we are waiting for a connect to finish. */ + if ((zh->to_send.head && is_connected(zh)) + || zh->state == ZOO_CONNECTING_STATE) { + *interest |= ZOOKEEPER_WRITE; + } + } + return api_epilog(zh,ZOK); +} + +static int check_events(zhandle_t *zh, int events) +{ + if (zh->fd == -1) + return ZINVALIDSTATE; + if ((events&ZOOKEEPER_WRITE)&&(zh->state == ZOO_CONNECTING_STATE)) { + int rc, error; + socklen_t len = sizeof(error); + rc = getsockopt(zh->fd, SOL_SOCKET, SO_ERROR, &error, &len); + /* the description in section 16.4 "Non-blocking connect" + * in UNIX Network Programming vol 1, 3rd edition, points out + * that sometimes the error is in errno and sometimes in error */ + if (rc < 0 || error) { + if (rc == 0) + errno = error; + return handle_socket_error_msg(zh, __LINE__,ZCONNECTIONLOSS, + "server refused to accept the client"); + } + + if((rc=prime_connection(zh))!=0) + return rc; + + LOG_INFO(LOGCALLBACK(zh), "initiated connection to server [%s]", format_endpoint_info(&zh->addr_cur)); + return ZOK; + } + if (zh->to_send.head && (events&ZOOKEEPER_WRITE)) { + /* make the flush call non-blocking by specifying a 0 timeout */ + int rc=flush_send_queue(zh,0); + if (rc < 0) + return handle_socket_error_msg(zh,__LINE__,ZCONNECTIONLOSS, + "failed while flushing send queue"); + } + if (events&ZOOKEEPER_READ) { + int rc; + if (zh->input_buffer == 0) { + zh->input_buffer = allocate_buffer(0,0); + } + + rc = recv_buffer(zh, zh->input_buffer); + if (rc < 0) { + return handle_socket_error_msg(zh, __LINE__,ZCONNECTIONLOSS, + "failed while receiving a server response"); + } + if (rc > 0) { + get_system_time(&zh->last_recv); + if (zh->input_buffer != &zh->primer_buffer) { + queue_buffer(&zh->to_process, zh->input_buffer, 0); + } else { + int64_t oldid, newid; + //deserialize + deserialize_prime_response(&zh->primer_storage, zh->primer_buffer.buffer); + /* We are processing the primer_buffer, so we need to finish + * the connection handshake */ + oldid = zh->seen_rw_server_before ? zh->client_id.client_id : 0; + zh->seen_rw_server_before |= !zh->primer_storage.readOnly; + newid = zh->primer_storage.sessionId; + if (oldid != 0 && oldid != newid) { + zh->state = ZOO_EXPIRED_SESSION_STATE; + errno = ESTALE; + return handle_socket_error_msg(zh,__LINE__,ZSESSIONEXPIRED, + "sessionId=%#llx has expired.",oldid); + } else { + zh->recv_timeout = zh->primer_storage.timeOut; + zh->client_id.client_id = newid; + + memcpy(zh->client_id.passwd, &zh->primer_storage.passwd, + sizeof(zh->client_id.passwd)); + zh->state = zh->primer_storage.readOnly ? + ZOO_READONLY_STATE : ZOO_CONNECTED_STATE; + zh->reconfig = 0; + LOG_INFO(LOGCALLBACK(zh), + "session establishment complete on server [%s], sessionId=%#llx, negotiated timeout=%d %s", + format_endpoint_info(&zh->addr_cur), + newid, zh->recv_timeout, + zh->primer_storage.readOnly ? "(READ-ONLY mode)" : ""); + /* we want the auth to be sent for, but since both call push to front + we need to call send_watch_set first */ + send_set_watches(zh); + /* send the authentication packet now */ + send_auth_info(zh); + LOG_DEBUG(LOGCALLBACK(zh), "Calling a watcher for a ZOO_SESSION_EVENT and the state=ZOO_CONNECTED_STATE"); + zh->input_buffer = 0; // just in case the watcher calls zookeeper_process() again + PROCESS_SESSION_EVENT(zh, zh->state); + } + } + zh->input_buffer = 0; + } else { + // zookeeper_process was called but there was nothing to read + // from the socket + return ZNOTHING; + } + } + return ZOK; +} + +void api_prolog(zhandle_t* zh) +{ + inc_ref_counter(zh,1); +} + +int api_epilog(zhandle_t *zh,int rc) +{ + if(inc_ref_counter(zh,-1)==0 && zh->close_requested!=0) + zookeeper_close(zh); + return rc; +} + +static __attribute__((unused)) void print_completion_queue(zhandle_t *zh) +{ + completion_list_t* cptr; + + if(logLevelsent_requests.head==0) { + fprintf(LOGSTREAM,"empty\n"); + return; + } + + cptr=zh->sent_requests.head; + while(cptr){ + fprintf(LOGSTREAM,"%d,",cptr->xid); + cptr=cptr->next; + } + fprintf(LOGSTREAM,"end\n"); +} + +//#ifdef THREADED +// IO thread queues session events to be processed by the completion thread +static int queue_session_event(zhandle_t *zh, int state) +{ + int rc; + struct WatcherEvent evt = { ZOO_SESSION_EVENT, state, "" }; + struct ReplyHeader hdr = { WATCHER_EVENT_XID, 0, 0 }; + struct oarchive *oa; + completion_list_t *cptr; + + if ((oa=create_buffer_oarchive())==NULL) { + LOG_ERROR(LOGCALLBACK(zh), "out of memory"); + goto error; + } + rc = serialize_ReplyHeader(oa, "hdr", &hdr); + rc = rc<0?rc: serialize_WatcherEvent(oa, "event", &evt); + if(rc<0){ + close_buffer_oarchive(&oa, 1); + goto error; + } + cptr = create_completion_entry(zh, WATCHER_EVENT_XID,-1,0,0,0,0); + cptr->buffer = allocate_buffer(get_buffer(oa), get_buffer_len(oa)); + cptr->buffer->curr_offset = get_buffer_len(oa); + if (!cptr->buffer) { + free(cptr); + close_buffer_oarchive(&oa, 1); + goto error; + } + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + cptr->c.watcher_result = collectWatchers(zh, ZOO_SESSION_EVENT, ""); + queue_completion(&zh->completions_to_process, cptr, 0); + if (process_async(zh->outstanding_sync)) { + process_completions(zh); + } + return ZOK; +error: + errno=ENOMEM; + return ZSYSTEMERROR; +} +//#endif + +completion_list_t *dequeue_completion(completion_head_t *list) +{ + completion_list_t *cptr; + lock_completion_list(list); + cptr = list->head; + if (cptr) { + list->head = cptr->next; + if (!list->head) { + assert(list->last == cptr); + list->last = 0; + } + } + unlock_completion_list(list); + return cptr; +} + +static int deserialize_multi(zhandle_t *zh, int xid, completion_list_t *cptr, struct iarchive *ia) +{ + int rc = 0; + completion_head_t *clist = &cptr->c.clist; + struct MultiHeader mhdr = {0, 0, 0}; + assert(clist); + deserialize_MultiHeader(ia, "multiheader", &mhdr); + while (!mhdr.done) { + completion_list_t *entry = dequeue_completion(clist); + assert(entry); + + if (mhdr.type == -1) { + struct ErrorResponse er; + deserialize_ErrorResponse(ia, "error", &er); + mhdr.err = er.err ; + if (rc == 0 && er.err != 0 && er.err != ZRUNTIMEINCONSISTENCY) { + rc = er.err; + } + } + + deserialize_response(zh, entry->c.type, xid, mhdr.type == -1, mhdr.err, entry, ia); + deserialize_MultiHeader(ia, "multiheader", &mhdr); + //While deserializing the response we must destroy completion entry for each operation in + //the zoo_multi transaction. Otherwise this results in memory leak when client invokes zoo_multi + //operation. + destroy_completion_entry(entry); + } + + return rc; +} + +static void deserialize_response(zhandle_t *zh, int type, int xid, int failed, int rc, completion_list_t *cptr, struct iarchive *ia) +{ + switch (type) { + case COMPLETION_DATA: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_DATA for xid=%#x failed=%d rc=%d", + cptr->xid, failed, rc); + if (failed) { + cptr->c.data_result(rc, 0, 0, 0, cptr->data); + } else { + struct GetDataResponse res; + deserialize_GetDataResponse(ia, "reply", &res); + cptr->c.data_result(rc, res.data.buff, res.data.len, + &res.stat, cptr->data); + deallocate_GetDataResponse(&res); + } + break; + case COMPLETION_STAT: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_STAT for xid=%#x failed=%d rc=%d", + cptr->xid, failed, rc); + if (failed) { + cptr->c.stat_result(rc, 0, cptr->data); + } else { + struct SetDataResponse res; + deserialize_SetDataResponse(ia, "reply", &res); + cptr->c.stat_result(rc, &res.stat, cptr->data); + deallocate_SetDataResponse(&res); + } + break; + case COMPLETION_STRINGLIST: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_STRINGLIST for xid=%#x failed=%d rc=%d", + cptr->xid, failed, rc); + if (failed) { + cptr->c.strings_result(rc, 0, cptr->data); + } else { + struct GetChildrenResponse res; + deserialize_GetChildrenResponse(ia, "reply", &res); + cptr->c.strings_result(rc, &res.children, cptr->data); + deallocate_GetChildrenResponse(&res); + } + break; + case COMPLETION_STRINGLIST_STAT: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_STRINGLIST_STAT for xid=%#x failed=%d rc=%d", + cptr->xid, failed, rc); + if (failed) { + cptr->c.strings_stat_result(rc, 0, 0, cptr->data); + } else { + struct GetChildren2Response res; + deserialize_GetChildren2Response(ia, "reply", &res); + cptr->c.strings_stat_result(rc, &res.children, &res.stat, cptr->data); + deallocate_GetChildren2Response(&res); + } + break; + case COMPLETION_STRING: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_STRING for xid=%#x failed=%d, rc=%d", + cptr->xid, failed, rc); + if (failed) { + cptr->c.string_result(rc, 0, cptr->data); + } else { + struct CreateResponse res; + memset(&res, 0, sizeof(res)); + deserialize_CreateResponse(ia, "reply", &res); + cptr->c.string_result(rc, res.path, cptr->data); + deallocate_CreateResponse(&res); + } + break; + case COMPLETION_STRING_STAT: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_STRING_STAT for xid=%#x failed=%d, rc=%d", + cptr->xid, failed, rc); + if (failed) { + cptr->c.string_stat_result(rc, 0, 0, cptr->data); + } else { + struct Create2Response res; + deserialize_Create2Response(ia, "reply", &res); + cptr->c.string_stat_result(rc, res.path, &res.stat, cptr->data); + deallocate_Create2Response(&res); + } + break; + case COMPLETION_ACLLIST: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_ACLLIST for xid=%#x failed=%d rc=%d", + cptr->xid, failed, rc); + if (failed) { + cptr->c.acl_result(rc, 0, 0, cptr->data); + } else { + struct GetACLResponse res; + deserialize_GetACLResponse(ia, "reply", &res); + cptr->c.acl_result(rc, &res.acl, &res.stat, cptr->data); + deallocate_GetACLResponse(&res); + } + break; + case COMPLETION_VOID: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_VOID for xid=%#x failed=%d rc=%d", + cptr->xid, failed, rc); + assert(cptr->c.void_result); + cptr->c.void_result(rc, cptr->data); + break; + case COMPLETION_MULTI: + LOG_DEBUG(LOGCALLBACK(zh), "Calling COMPLETION_MULTI for xid=%#x failed=%d rc=%d", + cptr->xid, failed, rc); + rc = deserialize_multi(zh, xid, cptr, ia); + assert(cptr->c.void_result); + cptr->c.void_result(rc, cptr->data); + break; + default: + LOG_DEBUG(LOGCALLBACK(zh), "Unsupported completion type=%d", cptr->c.type); + } +} + + +/* handles async completion (both single- and multithreaded) */ +void process_completions(zhandle_t *zh) +{ + completion_list_t *cptr; + while ((cptr = dequeue_completion(&zh->completions_to_process)) != 0) { + struct ReplyHeader hdr; + buffer_list_t *bptr = cptr->buffer; + struct iarchive *ia = create_buffer_iarchive(bptr->buffer, + bptr->len); + deserialize_ReplyHeader(ia, "hdr", &hdr); + + if (hdr.xid == WATCHER_EVENT_XID) { + int type, state; + struct WatcherEvent evt; + deserialize_WatcherEvent(ia, "event", &evt); + /* We are doing a notification, so there is no pending request */ + type = evt.type; + state = evt.state; + /* This is a notification so there aren't any pending requests */ + LOG_DEBUG(LOGCALLBACK(zh), "Calling a watcher for node [%s], type = %d event=%s", + (evt.path==NULL?"NULL":evt.path), cptr->c.type, + watcherEvent2String(type)); + deliverWatchers(zh,type,state,evt.path, &cptr->c.watcher_result); + deallocate_WatcherEvent(&evt); + } else { + deserialize_response(zh, cptr->c.type, hdr.xid, hdr.err != 0, hdr.err, cptr, ia); + } + destroy_completion_entry(cptr); + close_buffer_iarchive(&ia); + } +} + +static void isSocketReadable(zhandle_t* zh) +{ +#ifndef _WIN32 + struct pollfd fds; + fds.fd = zh->fd; + fds.events = POLLIN; + if (poll(&fds,1,0)<=0) { + // socket not readable -- no more responses to process + zh->socket_readable.tv_sec=zh->socket_readable.tv_usec=0; + } +#else + fd_set rfds; + struct timeval waittime = {0, 0}; + FD_ZERO(&rfds); + FD_SET( zh->fd , &rfds); + if (select(0, &rfds, NULL, NULL, &waittime) <= 0){ + // socket not readable -- no more responses to process + zh->socket_readable.tv_sec=zh->socket_readable.tv_usec=0; + } +#endif + else{ + get_system_time(&zh->socket_readable); + } +} + +static void checkResponseLatency(zhandle_t* zh) +{ + int delay; + struct timeval now; + + if(zh->socket_readable.tv_sec==0) + return; + + get_system_time(&now); + delay=calculate_interval(&zh->socket_readable, &now); + if(delay>20) + LOG_DEBUG(LOGCALLBACK(zh), "The following server response has spent at least %dms sitting in the client socket recv buffer",delay); + + zh->socket_readable.tv_sec=zh->socket_readable.tv_usec=0; +} + +int zookeeper_process(zhandle_t *zh, int events) +{ + buffer_list_t *bptr; + int rc; + + if (zh==NULL) + return ZBADARGUMENTS; + if (is_unrecoverable(zh)) + return ZINVALIDSTATE; + api_prolog(zh); + IF_DEBUG(checkResponseLatency(zh)); + rc = check_events(zh, events); + if (rc!=ZOK) + return api_epilog(zh, rc); + + IF_DEBUG(isSocketReadable(zh)); + + while (rc >= 0 && (bptr=dequeue_buffer(&zh->to_process))) { + struct ReplyHeader hdr; + struct iarchive *ia = create_buffer_iarchive( + bptr->buffer, bptr->curr_offset); + deserialize_ReplyHeader(ia, "hdr", &hdr); + + if (hdr.xid == PING_XID) { + // Ping replies can arrive out-of-order + int elapsed = 0; + struct timeval now; + gettimeofday(&now, 0); + elapsed = calculate_interval(&zh->last_ping, &now); + LOG_DEBUG(LOGCALLBACK(zh), "Got ping response in %d ms", elapsed); + free_buffer(bptr); + } else if (hdr.xid == WATCHER_EVENT_XID) { + struct WatcherEvent evt; + int type = 0; + char *path = NULL; + completion_list_t *c = NULL; + + LOG_DEBUG(LOGCALLBACK(zh), "Processing WATCHER_EVENT"); + + deserialize_WatcherEvent(ia, "event", &evt); + type = evt.type; + path = evt.path; + /* We are doing a notification, so there is no pending request */ + c = create_completion_entry(zh, WATCHER_EVENT_XID,-1,0,0,0,0); + c->buffer = bptr; + c->c.watcher_result = collectWatchers(zh, type, path); + + // We cannot free until now, otherwise path will become invalid + deallocate_WatcherEvent(&evt); + queue_completion(&zh->completions_to_process, c, 0); + } else if (hdr.xid == SET_WATCHES_XID) { + LOG_DEBUG(LOGCALLBACK(zh), "Processing SET_WATCHES"); + free_buffer(bptr); + } else if (hdr.xid == AUTH_XID){ + LOG_DEBUG(LOGCALLBACK(zh), "Processing AUTH_XID"); + + /* special handling for the AUTH response as it may come back + * out-of-band */ + auth_completion_func(hdr.err,zh); + free_buffer(bptr); + /* authentication completion may change the connection state to + * unrecoverable */ + if(is_unrecoverable(zh)){ + handle_error(zh, ZAUTHFAILED); + close_buffer_iarchive(&ia); + return api_epilog(zh, ZAUTHFAILED); + } + } else { + int rc = hdr.err; + /* Find the request corresponding to the response */ + completion_list_t *cptr = dequeue_completion(&zh->sent_requests); + + /* [ZOOKEEPER-804] Don't assert if zookeeper_close has been called. */ + if (zh->close_requested == 1 && cptr == NULL) { + LOG_DEBUG(LOGCALLBACK(zh), "Completion queue has been cleared by zookeeper_close()"); + close_buffer_iarchive(&ia); + free_buffer(bptr); + return api_epilog(zh,ZINVALIDSTATE); + } + assert(cptr); + /* The requests are going to come back in order */ + if (cptr->xid != hdr.xid) { + LOG_DEBUG(LOGCALLBACK(zh), "Processing unexpected or out-of-order response!"); + + // received unexpected (or out-of-order) response + close_buffer_iarchive(&ia); + free_buffer(bptr); + // put the completion back on the queue (so it gets properly + // signaled and deallocated) and disconnect from the server + queue_completion(&zh->sent_requests,cptr,1); + return api_epilog(zh, + handle_socket_error_msg(zh, __LINE__,ZRUNTIMEINCONSISTENCY, + "unexpected server response: expected %#x, but received %#x", + hdr.xid,cptr->xid)); + } + + if (hdr.zxid > 0) { + // Update last_zxid only when it is a request response + zh->last_zxid = hdr.zxid; + } + activateWatcher(zh, cptr->watcher, rc); + deactivateWatcher(zh, cptr->watcher_deregistration, rc); + + if (cptr->c.void_result != SYNCHRONOUS_MARKER) { + LOG_DEBUG(LOGCALLBACK(zh), "Queueing asynchronous response"); + cptr->buffer = bptr; + queue_completion(&zh->completions_to_process, cptr, 0); + } else { +#ifdef THREADED + struct sync_completion + *sc = (struct sync_completion*)cptr->data; + sc->rc = rc; + + process_sync_completion(zh, cptr, sc, ia); + + notify_sync_completion(sc); + free_buffer(bptr); + zh->outstanding_sync--; + destroy_completion_entry(cptr); +#else + abort_singlethreaded(zh); +#endif + } + } + + close_buffer_iarchive(&ia); + + } + if (process_async(zh->outstanding_sync)) { + process_completions(zh); + } + + return api_epilog(zh, ZOK); +} + +int zoo_state(zhandle_t *zh) +{ + if(zh!=0) + return zh->state; + return 0; +} + +static watcher_registration_t* create_watcher_registration(const char* path, + result_checker_fn checker,watcher_fn watcher,void* ctx){ + watcher_registration_t* wo; + if(watcher==0) + return 0; + wo=calloc(1,sizeof(watcher_registration_t)); + wo->path=strdup(path); + wo->watcher=watcher; + wo->context=ctx; + wo->checker=checker; + return wo; +} + +static watcher_deregistration_t* create_watcher_deregistration(const char* path, + watcher_fn watcher, void *watcherCtx, ZooWatcherType wtype) { + watcher_deregistration_t *wdo; + + wdo = calloc(1, sizeof(watcher_deregistration_t)); + if (!wdo) { + return NULL; + } + wdo->path = strdup(path); + wdo->watcher = watcher; + wdo->context = watcherCtx; + wdo->type = wtype; + return wdo; +} + +static void destroy_watcher_registration(watcher_registration_t* wo){ + if(wo!=0){ + free((void*)wo->path); + free(wo); + } +} + +static void destroy_watcher_deregistration(watcher_deregistration_t *wdo) { + if (wdo) { + free((void *)wdo->path); + free(wdo); + } +} + +static completion_list_t* create_completion_entry(zhandle_t *zh, int xid, int completion_type, + const void *dc, const void *data,watcher_registration_t* wo, completion_head_t *clist) +{ + return do_create_completion_entry(zh, xid, completion_type, dc, data, wo, + clist, NULL); +} + +static completion_list_t* create_completion_entry_deregistration(zhandle_t *zh, + int xid, int completion_type, const void *dc, const void *data, + watcher_deregistration_t* wdo, completion_head_t *clist) +{ + return do_create_completion_entry(zh, xid, completion_type, dc, data, NULL, + clist, wdo); +} + +static completion_list_t* do_create_completion_entry(zhandle_t *zh, int xid, + int completion_type, const void *dc, const void *data, + watcher_registration_t* wo, completion_head_t *clist, + watcher_deregistration_t* wdo) +{ + completion_list_t *c = calloc(1, sizeof(completion_list_t)); + if (!c) { + LOG_ERROR(LOGCALLBACK(zh), "out of memory"); + return 0; + } + c->c.type = completion_type; + c->data = data; + switch(c->c.type) { + case COMPLETION_VOID: + c->c.void_result = (void_completion_t)dc; + break; + case COMPLETION_STRING: + c->c.string_result = (string_completion_t)dc; + break; + case COMPLETION_DATA: + c->c.data_result = (data_completion_t)dc; + break; + case COMPLETION_STAT: + c->c.stat_result = (stat_completion_t)dc; + break; + case COMPLETION_STRINGLIST: + c->c.strings_result = (strings_completion_t)dc; + break; + case COMPLETION_STRINGLIST_STAT: + c->c.strings_stat_result = (strings_stat_completion_t)dc; + break; + case COMPLETION_STRING_STAT: + c->c.string_stat_result = (string_stat_completion_t)dc; + case COMPLETION_ACLLIST: + c->c.acl_result = (acl_completion_t)dc; + break; + case COMPLETION_MULTI: + assert(clist); + c->c.void_result = (void_completion_t)dc; + c->c.clist = *clist; + break; + } + c->xid = xid; + c->watcher = wo; + c->watcher_deregistration = wdo; + + return c; +} + +static void destroy_completion_entry(completion_list_t* c){ + if(c!=0){ + destroy_watcher_registration(c->watcher); + destroy_watcher_deregistration(c->watcher_deregistration); + if(c->buffer!=0) + free_buffer(c->buffer); + free(c); + } +} + +static void queue_completion_nolock(completion_head_t *list, + completion_list_t *c, + int add_to_front) +{ + c->next = 0; + /* appending a new entry to the back of the list */ + if (list->last) { + assert(list->head); + // List is not empty + if (!add_to_front) { + list->last->next = c; + list->last = c; + } else { + c->next = list->head; + list->head = c; + } + } else { + // List is empty + assert(!list->head); + list->head = c; + list->last = c; + } +} + +static void queue_completion(completion_head_t *list, completion_list_t *c, + int add_to_front) +{ + + lock_completion_list(list); + queue_completion_nolock(list, c, add_to_front); + unlock_completion_list(list); +} + +static int add_completion(zhandle_t *zh, int xid, int completion_type, + const void *dc, const void *data, int add_to_front, + watcher_registration_t* wo, completion_head_t *clist) +{ + completion_list_t *c =create_completion_entry(zh, xid, completion_type, dc, + data, wo, clist); + return do_add_completion(zh, dc, c, add_to_front); +} + +static int add_completion_deregistration(zhandle_t *zh, int xid, + int completion_type, const void *dc, const void *data, int add_to_front, + watcher_deregistration_t* wdo, completion_head_t *clist) +{ + completion_list_t *c = create_completion_entry_deregistration(zh, xid, + completion_type, dc, data, wdo, clist); + return do_add_completion(zh, dc, c, add_to_front); +} + +static int do_add_completion(zhandle_t *zh, const void *dc, + completion_list_t *c, int add_to_front) +{ + int rc = 0; + if (!c) + return ZSYSTEMERROR; + lock_completion_list(&zh->sent_requests); + if (zh->close_requested != 1) { + queue_completion_nolock(&zh->sent_requests, c, add_to_front); + if (dc == SYNCHRONOUS_MARKER) { + zh->outstanding_sync++; + } + rc = ZOK; + } else { + free(c); + rc = ZINVALIDSTATE; + } + unlock_completion_list(&zh->sent_requests); + return rc; +} + +static int add_data_completion(zhandle_t *zh, int xid, data_completion_t dc, + const void *data,watcher_registration_t* wo) +{ + return add_completion(zh, xid, COMPLETION_DATA, dc, data, 0, wo, 0); +} + +static int add_stat_completion(zhandle_t *zh, int xid, stat_completion_t dc, + const void *data,watcher_registration_t* wo) +{ + return add_completion(zh, xid, COMPLETION_STAT, dc, data, 0, wo, 0); +} + +static int add_strings_completion(zhandle_t *zh, int xid, + strings_completion_t dc, const void *data,watcher_registration_t* wo) +{ + return add_completion(zh, xid, COMPLETION_STRINGLIST, dc, data, 0, wo, 0); +} + +static int add_strings_stat_completion(zhandle_t *zh, int xid, + strings_stat_completion_t dc, const void *data,watcher_registration_t* wo) +{ + return add_completion(zh, xid, COMPLETION_STRINGLIST_STAT, dc, data, 0, wo, 0); +} + +static int add_acl_completion(zhandle_t *zh, int xid, acl_completion_t dc, + const void *data) +{ + return add_completion(zh, xid, COMPLETION_ACLLIST, dc, data, 0, 0, 0); +} + +static int add_void_completion(zhandle_t *zh, int xid, void_completion_t dc, + const void *data) +{ + return add_completion(zh, xid, COMPLETION_VOID, dc, data, 0, 0, 0); +} + +static int add_string_completion(zhandle_t *zh, int xid, + string_completion_t dc, const void *data) +{ + return add_completion(zh, xid, COMPLETION_STRING, dc, data, 0, 0, 0); +} + +static int add_string_stat_completion(zhandle_t *zh, int xid, + string_stat_completion_t dc, const void *data) +{ + return add_completion(zh, xid, COMPLETION_STRING_STAT, dc, data, 0, 0, 0); +} + +static int add_multi_completion(zhandle_t *zh, int xid, void_completion_t dc, + const void *data, completion_head_t *clist) +{ + return add_completion(zh, xid, COMPLETION_MULTI, dc, data, 0,0, clist); +} + +int zookeeper_close(zhandle_t *zh) +{ + int rc=ZOK; + if (zh==0) + return ZBADARGUMENTS; + + zh->close_requested=1; + if (inc_ref_counter(zh,1)>1) { + /* We have incremented the ref counter to prevent the + * completions from calling zookeeper_close before we have + * completed the adaptor_finish call below. */ + + /* Signal any syncronous completions before joining the threads */ + enter_critical(zh); + free_completions(zh,1,ZCLOSING); + leave_critical(zh); + + adaptor_finish(zh); + /* Now we can allow the handle to be cleaned up, if the completion + * threads finished during the adaptor_finish call. */ + api_epilog(zh, 0); + return ZOK; + } + /* No need to decrement the counter since we're just going to + * destroy the handle later. */ + if (is_connected(zh)){ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_CLOSE_OP}; + LOG_INFO(LOGCALLBACK(zh), "Closing zookeeper sessionId=%#llx to [%s]\n", + zh->client_id.client_id,zoo_get_current_server(zh)); + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + if (rc < 0) { + rc = ZMARSHALLINGERROR; + goto finish; + } + + /* make sure the close request is sent; we set timeout to an arbitrary + * (but reasonable) number of milliseconds since we want the call to block*/ + rc=adaptor_send_queue(zh, 3000); + }else{ + LOG_INFO(LOGCALLBACK(zh), "Freeing zookeeper resources for sessionId=%#llx\n", + zh->client_id.client_id); + rc = ZOK; + } + +finish: + destroy(zh); + adaptor_destroy(zh); + free(zh); +#ifdef _WIN32 + Win32WSACleanup(); +#endif + return rc; +} + +static int isValidPath(const char* path, const int flags) { + int len = 0; + char lastc = '/'; + char c; + int i = 0; + + if (path == 0) + return 0; + len = strlen(path); + if (len == 0) + return 0; + if (path[0] != '/') + return 0; + if (len == 1) // done checking - it's the root + return 1; + if (path[len - 1] == '/' && !(flags & ZOO_SEQUENCE)) + return 0; + + i = 1; + for (; i < len; lastc = path[i], i++) { + c = path[i]; + + if (c == 0) { + return 0; + } else if (c == '/' && lastc == '/') { + return 0; + } else if (c == '.' && lastc == '.') { + if (path[i-2] == '/' && (((i + 1 == len) && !(flags & ZOO_SEQUENCE)) + || path[i+1] == '/')) { + return 0; + } + } else if (c == '.') { + if ((path[i-1] == '/') && (((i + 1 == len) && !(flags & ZOO_SEQUENCE)) + || path[i+1] == '/')) { + return 0; + } + } else if (c > 0x00 && c < 0x1f) { + return 0; + } + } + + return 1; +} + +/*---------------------------------------------------------------------------* + * REQUEST INIT HELPERS + *---------------------------------------------------------------------------*/ +/* Common Request init helper functions to reduce code duplication */ +static int Request_path_init(zhandle_t *zh, int flags, + char **path_out, const char *path) +{ + assert(path_out); + + *path_out = prepend_string(zh, path); + if (zh == NULL || !isValidPath(*path_out, flags)) { + free_duplicate_path(*path_out, path); + return ZBADARGUMENTS; + } + if (is_unrecoverable(zh)) { + free_duplicate_path(*path_out, path); + return ZINVALIDSTATE; + } + + return ZOK; +} + +static int Request_path_watch_init(zhandle_t *zh, int flags, + char **path_out, const char *path, + int32_t *watch_out, uint32_t watch) +{ + int rc = Request_path_init(zh, flags, path_out, path); + if (rc != ZOK) { + return rc; + } + *watch_out = watch; + return ZOK; +} + +/*---------------------------------------------------------------------------* + * ASYNC API + *---------------------------------------------------------------------------*/ +int zoo_aget(zhandle_t *zh, const char *path, int watch, data_completion_t dc, + const void *data) +{ + return zoo_awget(zh,path,watch?zh->watcher:0,zh->context,dc,data); +} + +int zoo_awget(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + data_completion_t dc, const void *data) +{ + struct oarchive *oa; + char *server_path = prepend_string(zh, path); + struct RequestHeader h = {get_xid(), ZOO_GETDATA_OP}; + struct GetDataRequest req = { (char*)server_path, watcher!=0 }; + int rc; + + if (zh==0 || !isValidPath(server_path, 0)) { + free_duplicate_path(server_path, path); + return ZBADARGUMENTS; + } + if (is_unrecoverable(zh)) { + free_duplicate_path(server_path, path); + return ZINVALIDSTATE; + } + oa=create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_GetDataRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_data_completion(zh, h.xid, dc, data, + create_watcher_registration(server_path,data_result_checker,watcher,watcherCtx)); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(server_path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +int zoo_agetconfig(zhandle_t *zh, int watch, data_completion_t dc, + const void *data) +{ + return zoo_awgetconfig(zh,watch?zh->watcher:0,zh->context,dc,data); +} + +int zoo_awgetconfig(zhandle_t *zh, watcher_fn watcher, void* watcherCtx, + data_completion_t dc, const void *data) +{ + struct oarchive *oa; + char *path = ZOO_CONFIG_NODE; + char *server_path = ZOO_CONFIG_NODE; + struct RequestHeader h = { get_xid(), ZOO_GETDATA_OP }; + struct GetDataRequest req = { (char*)server_path, watcher!=0 }; + int rc; + + if (zh==0 || !isValidPath(server_path, 0)) { + free_duplicate_path(server_path, path); + return ZBADARGUMENTS; + } + if (is_unrecoverable(zh)) { + free_duplicate_path(server_path, path); + return ZINVALIDSTATE; + } + oa=create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_GetDataRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_data_completion(zh, h.xid, dc, data, + create_watcher_registration(server_path,data_result_checker,watcher,watcherCtx)); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(server_path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +int zoo_areconfig(zhandle_t *zh, const char *joining, const char *leaving, + const char *members, int64_t version, data_completion_t dc, const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = { get_xid(), ZOO_RECONFIG_OP }; + struct ReconfigRequest req; + int rc = 0; + + if (zh==0) { + return ZBADARGUMENTS; + } + if (is_unrecoverable(zh)) { + return ZINVALIDSTATE; + } + + oa=create_buffer_oarchive(); + req.joiningServers = (char *)joining; + req.leavingServers = (char *)leaving; + req.newMembers = (char *)members; + req.curConfigId = version; + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_ReconfigRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_data_completion(zh, h.xid, dc, data, NULL); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending Reconfig request xid=%#x to %s",h.xid, zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +static int SetDataRequest_init(zhandle_t *zh, struct SetDataRequest *req, + const char *path, const char *buffer, int buflen, int version) +{ + int rc; + assert(req); + rc = Request_path_init(zh, 0, &req->path, path); + if (rc != ZOK) { + return rc; + } + req->data.buff = (char*)buffer; + req->data.len = buflen; + req->version = version; + + return ZOK; +} + +int zoo_aset(zhandle_t *zh, const char *path, const char *buffer, int buflen, + int version, stat_completion_t dc, const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_SETDATA_OP}; + struct SetDataRequest req; + int rc = SetDataRequest_init(zh, &req, path, buffer, buflen, version); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_SetDataRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_stat_completion(zh, h.xid, dc, data,0); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +static int CreateRequest_init(zhandle_t *zh, struct CreateRequest *req, + const char *path, const char *value, + int valuelen, const struct ACL_vector *acl_entries, int flags) +{ + int rc; + assert(req); + rc = Request_path_init(zh, flags, &req->path, path); + assert(req); + if (rc != ZOK) { + return rc; + } + req->flags = flags; + req->data.buff = (char*)value; + req->data.len = valuelen; + if (acl_entries == 0) { + req->acl.count = 0; + req->acl.data = 0; + } else { + req->acl = *acl_entries; + } + + return ZOK; +} + +int zoo_acreate(zhandle_t *zh, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl_entries, int flags, + string_completion_t completion, const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_CREATE_OP}; + struct CreateRequest req; + + int rc = CreateRequest_init(zh, &req, + path, value, valuelen, acl_entries, flags); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_CreateRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_string_completion(zh, h.xid, completion, data); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +int zoo_acreate2(zhandle_t *zh, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl_entries, int flags, + string_stat_completion_t completion, const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = { get_xid(), ZOO_CREATE2_OP }; + struct CreateRequest req; + + int rc = CreateRequest_init(zh, &req, path, value, valuelen, acl_entries, flags); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_CreateRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_string_stat_completion(zh, h.xid, completion, data); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +int DeleteRequest_init(zhandle_t *zh, struct DeleteRequest *req, + const char *path, int version) +{ + int rc = Request_path_init(zh, 0, &req->path, path); + if (rc != ZOK) { + return rc; + } + req->version = version; + return ZOK; +} + +int zoo_adelete(zhandle_t *zh, const char *path, int version, + void_completion_t completion, const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_DELETE_OP}; + struct DeleteRequest req; + int rc = DeleteRequest_init(zh, &req, path, version); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_DeleteRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_void_completion(zh, h.xid, completion, data); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +int zoo_aexists(zhandle_t *zh, const char *path, int watch, + stat_completion_t sc, const void *data) +{ + return zoo_awexists(zh,path,watch?zh->watcher:0,zh->context,sc,data); +} + +int zoo_awexists(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + stat_completion_t completion, const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_EXISTS_OP}; + struct ExistsRequest req; + int rc = Request_path_watch_init(zh, 0, &req.path, path, + &req.watch, watcher != NULL); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_ExistsRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_stat_completion(zh, h.xid, completion, data, + create_watcher_registration(req.path,exists_result_checker, + watcher,watcherCtx)); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +static int zoo_awget_children_(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + strings_completion_t sc, + const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_GETCHILDREN_OP}; + struct GetChildrenRequest req ; + int rc = Request_path_watch_init(zh, 0, &req.path, path, + &req.watch, watcher != NULL); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_GetChildrenRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_strings_completion(zh, h.xid, sc, data, + create_watcher_registration(req.path,child_result_checker,watcher,watcherCtx)); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +int zoo_aget_children(zhandle_t *zh, const char *path, int watch, + strings_completion_t dc, const void *data) +{ + return zoo_awget_children_(zh,path,watch?zh->watcher:0,zh->context,dc,data); +} + +int zoo_awget_children(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + strings_completion_t dc, + const void *data) +{ + return zoo_awget_children_(zh,path,watcher,watcherCtx,dc,data); +} + +static int zoo_awget_children2_(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + strings_stat_completion_t ssc, + const void *data) +{ + /* invariant: (sc == NULL) != (sc == NULL) */ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_GETCHILDREN2_OP}; + struct GetChildren2Request req ; + int rc = Request_path_watch_init(zh, 0, &req.path, path, + &req.watch, watcher != NULL); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_GetChildren2Request(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_strings_stat_completion(zh, h.xid, ssc, data, + create_watcher_registration(req.path,child_result_checker,watcher,watcherCtx)); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +int zoo_aget_children2(zhandle_t *zh, const char *path, int watch, + strings_stat_completion_t dc, const void *data) +{ + return zoo_awget_children2_(zh,path,watch?zh->watcher:0,zh->context,dc,data); +} + +int zoo_awget_children2(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + strings_stat_completion_t dc, + const void *data) +{ + return zoo_awget_children2_(zh,path,watcher,watcherCtx,dc,data); +} + +int zoo_async(zhandle_t *zh, const char *path, + string_completion_t completion, const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_SYNC_OP}; + struct SyncRequest req; + int rc = Request_path_init(zh, 0, &req.path, path); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_SyncRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_string_completion(zh, h.xid, completion, data); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + + +int zoo_aget_acl(zhandle_t *zh, const char *path, acl_completion_t completion, + const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_GETACL_OP}; + struct GetACLRequest req; + int rc = Request_path_init(zh, 0, &req.path, path) ; + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_GetACLRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_acl_completion(zh, h.xid, completion, data); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +int zoo_aset_acl(zhandle_t *zh, const char *path, int version, + struct ACL_vector *acl, void_completion_t completion, const void *data) +{ + struct oarchive *oa; + struct RequestHeader h = {get_xid(), ZOO_SETACL_OP}; + struct SetACLRequest req; + int rc = Request_path_init(zh, 0, &req.path, path); + if (rc != ZOK) { + return rc; + } + oa = create_buffer_oarchive(); + req.acl = *acl; + req.version = version; + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_SetACLRequest(oa, "req", &req); + enter_critical(zh); + rc = rc < 0 ? rc : add_void_completion(zh, h.xid, completion, data); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + free_duplicate_path(req.path, path); + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s",h.xid,path, + zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + return (rc < 0)?ZMARSHALLINGERROR:ZOK; +} + +/* Completions for multi-op results */ +static void op_result_string_completion(int err, const char *value, const void *data) +{ + struct zoo_op_result *result = (struct zoo_op_result *)data; + assert(result); + result->err = err; + + if (result->value && value) { + int len = strlen(value) + 1; + if (len > result->valuelen) { + len = result->valuelen; + } + if (len > 0) { + memcpy(result->value, value, len - 1); + result->value[len - 1] = '\0'; + } + } else { + result->value = NULL; + } +} + +static void op_result_void_completion(int err, const void *data) +{ + struct zoo_op_result *result = (struct zoo_op_result *)data; + assert(result); + result->err = err; +} + +static void op_result_stat_completion(int err, const struct Stat *stat, const void *data) +{ + struct zoo_op_result *result = (struct zoo_op_result *)data; + assert(result); + result->err = err; + + if (result->stat && err == 0 && stat) { + *result->stat = *stat; + } else { + result->stat = NULL ; + } +} + +static int CheckVersionRequest_init(zhandle_t *zh, struct CheckVersionRequest *req, + const char *path, int version) +{ + int rc ; + assert(req); + rc = Request_path_init(zh, 0, &req->path, path); + if (rc != ZOK) { + return rc; + } + req->version = version; + + return ZOK; +} + +int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops, + zoo_op_result_t *results, void_completion_t completion, const void *data) +{ + struct RequestHeader h = {get_xid(), ZOO_MULTI_OP}; + struct MultiHeader mh = {-1, 1, -1}; + struct oarchive *oa = create_buffer_oarchive(); + completion_head_t clist = { 0 }; + + int rc = serialize_RequestHeader(oa, "header", &h); + + int index = 0; + for (index=0; index < count; index++) { + const zoo_op_t *op = ops+index; + zoo_op_result_t *result = results+index; + completion_list_t *entry = NULL; + + struct MultiHeader mh = {op->type, 0, -1}; + rc = rc < 0 ? rc : serialize_MultiHeader(oa, "multiheader", &mh); + + switch(op->type) { + case ZOO_CREATE_OP: { + struct CreateRequest req; + + rc = rc < 0 ? rc : CreateRequest_init(zh, &req, + op->create_op.path, op->create_op.data, + op->create_op.datalen, op->create_op.acl, + op->create_op.flags); + rc = rc < 0 ? rc : serialize_CreateRequest(oa, "req", &req); + result->value = op->create_op.buf; + result->valuelen = op->create_op.buflen; + + enter_critical(zh); + entry = create_completion_entry(zh, h.xid, COMPLETION_STRING, op_result_string_completion, result, 0, 0); + leave_critical(zh); + free_duplicate_path(req.path, op->create_op.path); + break; + } + + case ZOO_DELETE_OP: { + struct DeleteRequest req; + rc = rc < 0 ? rc : DeleteRequest_init(zh, &req, op->delete_op.path, op->delete_op.version); + rc = rc < 0 ? rc : serialize_DeleteRequest(oa, "req", &req); + + enter_critical(zh); + entry = create_completion_entry(zh, h.xid, COMPLETION_VOID, op_result_void_completion, result, 0, 0); + leave_critical(zh); + free_duplicate_path(req.path, op->delete_op.path); + break; + } + + case ZOO_SETDATA_OP: { + struct SetDataRequest req; + rc = rc < 0 ? rc : SetDataRequest_init(zh, &req, + op->set_op.path, op->set_op.data, + op->set_op.datalen, op->set_op.version); + rc = rc < 0 ? rc : serialize_SetDataRequest(oa, "req", &req); + result->stat = op->set_op.stat; + + enter_critical(zh); + entry = create_completion_entry(zh, h.xid, COMPLETION_STAT, op_result_stat_completion, result, 0, 0); + leave_critical(zh); + free_duplicate_path(req.path, op->set_op.path); + break; + } + + case ZOO_CHECK_OP: { + struct CheckVersionRequest req; + rc = rc < 0 ? rc : CheckVersionRequest_init(zh, &req, + op->check_op.path, op->check_op.version); + rc = rc < 0 ? rc : serialize_CheckVersionRequest(oa, "req", &req); + + enter_critical(zh); + entry = create_completion_entry(zh, h.xid, COMPLETION_VOID, op_result_void_completion, result, 0, 0); + leave_critical(zh); + free_duplicate_path(req.path, op->check_op.path); + break; + } + + default: + LOG_ERROR(LOGCALLBACK(zh), "Unimplemented sub-op type=%d in multi-op", op->type); + return ZUNIMPLEMENTED; + } + + queue_completion(&clist, entry, 0); + } + + rc = rc < 0 ? rc : serialize_MultiHeader(oa, "multiheader", &mh); + + /* BEGIN: CRTICIAL SECTION */ + enter_critical(zh); + rc = rc < 0 ? rc : add_multi_completion(zh, h.xid, completion, data, &clist); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + leave_critical(zh); + + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending multi request xid=%#x with %d subrequests to %s", + h.xid, index, zoo_get_current_server(zh)); + /* make a best (non-blocking) effort to send the requests asap */ + adaptor_send_queue(zh, 0); + + return (rc < 0) ? ZMARSHALLINGERROR : ZOK; +} + + +int zoo_aremove_watchers(zhandle_t *zh, const char *path, ZooWatcherType wtype, + watcher_fn watcher, void *watcherCtx, int local, + void_completion_t *completion, const void *data) +{ + char *server_path = prepend_string(zh, path); + int rc; + struct oarchive *oa; + struct RequestHeader h = { get_xid(), ZOO_REMOVE_WATCHES }; + struct RemoveWatchesRequest req = { (char*)server_path, wtype }; + watcher_deregistration_t *wdo; + + if (!zh || !isValidPath(server_path, 0)) { + rc = ZBADARGUMENTS; + goto done; + } + + if (!local && is_unrecoverable(zh)) { + rc = ZINVALIDSTATE; + goto done; + } + + if (!pathHasWatcher(zh, server_path, wtype, watcher, watcherCtx)) { + rc = ZNOWATCHER; + goto done; + } + + if (local) { + removeWatchers(zh, server_path, wtype, watcher, watcherCtx); +#ifdef THREADED + notify_sync_completion((struct sync_completion *)data); +#endif + rc = ZOK; + goto done; + } + + oa = create_buffer_oarchive(); + rc = serialize_RequestHeader(oa, "header", &h); + rc = rc < 0 ? rc : serialize_RemoveWatchesRequest(oa, "req", &req); + if (rc < 0) { + goto done; + } + + wdo = create_watcher_deregistration(server_path, watcher, watcherCtx, + wtype); + if (!wdo) { + rc = ZSYSTEMERROR; + goto done; + } + + enter_critical(zh); + rc = add_completion_deregistration(zh, h.xid, COMPLETION_VOID, + completion, data, 0, wdo, 0); + rc = rc < 0 ? rc : queue_buffer_bytes(&zh->to_send, get_buffer(oa), + get_buffer_len(oa)); + rc = rc < 0 ? ZMARSHALLINGERROR : ZOK; + leave_critical(zh); + + /* We queued the buffer, so don't free it */ + close_buffer_oarchive(&oa, 0); + + LOG_DEBUG(LOGCALLBACK(zh), "Sending request xid=%#x for path [%s] to %s", + h.xid, path, zoo_get_current_server(zh)); + + adaptor_send_queue(zh, 0); + +done: + free_duplicate_path(server_path, path); + return rc; +} +void zoo_create_op_init(zoo_op_t *op, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl, int flags, + char *path_buffer, int path_buffer_len) +{ + assert(op); + op->type = ZOO_CREATE_OP; + op->create_op.path = path; + op->create_op.data = value; + op->create_op.datalen = valuelen; + op->create_op.acl = acl; + op->create_op.flags = flags; + op->create_op.buf = path_buffer; + op->create_op.buflen = path_buffer_len; +} + +void zoo_create2_op_init(zoo_op_t *op, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl, int flags, + char *path_buffer, int path_buffer_len) +{ + assert(op); + op->type = ZOO_CREATE2_OP; + op->create_op.path = path; + op->create_op.data = value; + op->create_op.datalen = valuelen; + op->create_op.acl = acl; + op->create_op.flags = flags; + op->create_op.buf = path_buffer; + op->create_op.buflen = path_buffer_len; +} + +void zoo_delete_op_init(zoo_op_t *op, const char *path, int version) +{ + assert(op); + op->type = ZOO_DELETE_OP; + op->delete_op.path = path; + op->delete_op.version = version; +} + +void zoo_set_op_init(zoo_op_t *op, const char *path, const char *buffer, + int buflen, int version, struct Stat *stat) +{ + assert(op); + op->type = ZOO_SETDATA_OP; + op->set_op.path = path; + op->set_op.data = buffer; + op->set_op.datalen = buflen; + op->set_op.version = version; + op->set_op.stat = stat; +} + +void zoo_check_op_init(zoo_op_t *op, const char *path, int version) +{ + assert(op); + op->type = ZOO_CHECK_OP; + op->check_op.path = path; + op->check_op.version = version; +} + +/* specify timeout of 0 to make the function non-blocking */ +/* timeout is in milliseconds */ +int flush_send_queue(zhandle_t*zh, int timeout) +{ + int rc= ZOK; + struct timeval started; +#ifdef _WIN32 + fd_set pollSet; + struct timeval wait; +#endif + get_system_time(&started); + // we can't use dequeue_buffer() here because if (non-blocking) send_buffer() + // returns EWOULDBLOCK we'd have to put the buffer back on the queue. + // we use a recursive lock instead and only dequeue the buffer if a send was + // successful + lock_buffer_list(&zh->to_send); + while (zh->to_send.head != 0 && is_connected(zh)) { + if(timeout!=0){ +#ifndef _WIN32 + struct pollfd fds; +#endif + int elapsed; + struct timeval now; + get_system_time(&now); + elapsed=calculate_interval(&started,&now); + if (elapsed>timeout) { + rc = ZOPERATIONTIMEOUT; + break; + } + +#ifdef _WIN32 + wait = get_timeval(timeout-elapsed); + FD_ZERO(&pollSet); + FD_SET(zh->fd, &pollSet); + // Poll the socket + rc = select((int)(zh->fd)+1, NULL, &pollSet, NULL, &wait); +#else + fds.fd = zh->fd; + fds.events = POLLOUT; + fds.revents = 0; + rc = poll(&fds, 1, timeout-elapsed); +#endif + if (rc<=0) { + /* timed out or an error or POLLERR */ + rc = rc==0 ? ZOPERATIONTIMEOUT : ZSYSTEMERROR; + break; + } + } + + rc = send_buffer(zh->fd, zh->to_send.head); + if(rc==0 && timeout==0){ + /* send_buffer would block while sending this buffer */ + rc = ZOK; + break; + } + if (rc < 0) { + rc = ZCONNECTIONLOSS; + break; + } + // if the buffer has been sent successfully, remove it from the queue + if (rc > 0) + remove_buffer(&zh->to_send); + get_system_time(&zh->last_send); + rc = ZOK; + } + unlock_buffer_list(&zh->to_send); + return rc; +} + +const char* zerror(int c) +{ + switch (c){ + case ZOK: + return "ok"; + case ZSYSTEMERROR: + return "system error"; + case ZRUNTIMEINCONSISTENCY: + return "run time inconsistency"; + case ZDATAINCONSISTENCY: + return "data inconsistency"; + case ZCONNECTIONLOSS: + return "connection loss"; + case ZMARSHALLINGERROR: + return "marshalling error"; + case ZUNIMPLEMENTED: + return "unimplemented"; + case ZOPERATIONTIMEOUT: + return "operation timeout"; + case ZBADARGUMENTS: + return "bad arguments"; + case ZINVALIDSTATE: + return "invalid zhandle state"; + case ZAPIERROR: + return "api error"; + case ZNONODE: + return "no node"; + case ZNOAUTH: + return "not authenticated"; + case ZBADVERSION: + return "bad version"; + case ZNOCHILDRENFOREPHEMERALS: + return "no children for ephemerals"; + case ZNODEEXISTS: + return "node exists"; + case ZNOTEMPTY: + return "not empty"; + case ZSESSIONEXPIRED: + return "session expired"; + case ZINVALIDCALLBACK: + return "invalid callback"; + case ZINVALIDACL: + return "invalid acl"; + case ZAUTHFAILED: + return "authentication failed"; + case ZCLOSING: + return "zookeeper is closing"; + case ZNOTHING: + return "(not error) no server responses to process"; + case ZSESSIONMOVED: + return "session moved to another server, so operation is ignored"; + case ZNOTREADONLY: + return "state-changing request is passed to read-only server"; + case ZNEWCONFIGNOQUORUM: + return "no quorum of new config is connected and up-to-date with the leader of last commmitted config - try invoking reconfiguration after new servers are connected and synced"; + case ZRECONFIGINPROGRESS: + return "Another reconfiguration is in progress -- concurrent reconfigs not supported (yet)"; + } + if (c > 0) { + return strerror(c); + } + return "unknown error"; +} + +int zoo_add_auth(zhandle_t *zh,const char* scheme,const char* cert, + int certLen,void_completion_t completion, const void *data) +{ + struct buffer auth; + auth_info *authinfo; + if(scheme==NULL || zh==NULL) + return ZBADARGUMENTS; + + if (is_unrecoverable(zh)) + return ZINVALIDSTATE; + + // [ZOOKEEPER-800] zoo_add_auth should return ZINVALIDSTATE if + // the connection is closed. + if (zoo_state(zh) == 0) { + return ZINVALIDSTATE; + } + + if(cert!=NULL && certLen!=0){ + auth.buff=calloc(1,certLen); + if(auth.buff==0) { + return ZSYSTEMERROR; + } + memcpy(auth.buff,cert,certLen); + auth.len=certLen; + } else { + auth.buff = 0; + auth.len = 0; + } + + zoo_lock_auth(zh); + authinfo = (auth_info*) malloc(sizeof(auth_info)); + authinfo->scheme=strdup(scheme); + authinfo->auth=auth; + authinfo->completion=completion; + authinfo->data=data; + authinfo->next = NULL; + add_last_auth(&zh->auth_h, authinfo); + zoo_unlock_auth(zh); + + if (is_connected(zh) || zh->state == ZOO_ASSOCIATING_STATE) + return send_last_auth_info(zh); + + return ZOK; +} + +static const char* format_endpoint_info(const struct sockaddr_storage* ep) +{ + static char buf[128] = { 0 }; + char addrstr[128] = { 0 }; + void *inaddr; +#ifdef _WIN32 + char * addrstring; +#endif + int port; + if(ep==0) + return "null"; + +#if defined(AF_INET6) + if(ep->ss_family==AF_INET6){ + inaddr=&((struct sockaddr_in6*)ep)->sin6_addr; + port=((struct sockaddr_in6*)ep)->sin6_port; + } else { +#endif + inaddr=&((struct sockaddr_in*)ep)->sin_addr; + port=((struct sockaddr_in*)ep)->sin_port; +#if defined(AF_INET6) + } +#endif +#ifdef _WIN32 + addrstring = inet_ntoa (*(struct in_addr*)inaddr); + sprintf(buf,"%s:%d",addrstring,ntohs(port)); +#else + inet_ntop(ep->ss_family,inaddr,addrstr,sizeof(addrstr)-1); + sprintf(buf,"%s:%d",addrstr,ntohs(port)); +#endif + return buf; +} + +log_callback_fn zoo_get_log_callback(const zhandle_t* zh) +{ + // Verify we have a valid handle + if (zh == NULL) { + return NULL; + } + + return zh->log_callback; +} + +void zoo_set_log_callback(zhandle_t *zh, log_callback_fn callback) +{ + // Verify we have a valid handle + if (zh == NULL) { + return; + } + + zh->log_callback = callback; +} + +void zoo_deterministic_conn_order(int yesOrNo) +{ + disable_conn_permute=yesOrNo; +} + +#ifdef THREADED + +static void process_sync_completion(zhandle_t *zh, + completion_list_t *cptr, + struct sync_completion *sc, + struct iarchive *ia) +{ + LOG_DEBUG(LOGCALLBACK(zh), "Processing sync_completion with type=%d xid=%#x rc=%d", + cptr->c.type, cptr->xid, sc->rc); + + switch(cptr->c.type) { + case COMPLETION_DATA: + if (sc->rc==0) { + struct GetDataResponse res; + int len; + deserialize_GetDataResponse(ia, "reply", &res); + if (res.data.len <= sc->u.data.buff_len) { + len = res.data.len; + } else { + len = sc->u.data.buff_len; + } + sc->u.data.buff_len = len; + // check if len is negative + // just of NULL which is -1 int + if (len == -1) { + sc->u.data.buffer = NULL; + } else { + memcpy(sc->u.data.buffer, res.data.buff, len); + } + sc->u.data.stat = res.stat; + deallocate_GetDataResponse(&res); + } + break; + case COMPLETION_STAT: + if (sc->rc==0) { + struct SetDataResponse res; + deserialize_SetDataResponse(ia, "reply", &res); + sc->u.stat = res.stat; + deallocate_SetDataResponse(&res); + } + break; + case COMPLETION_STRINGLIST: + if (sc->rc==0) { + struct GetChildrenResponse res; + deserialize_GetChildrenResponse(ia, "reply", &res); + sc->u.strs2 = res.children; + /* We don't deallocate since we are passing it back */ + // deallocate_GetChildrenResponse(&res); + } + break; + case COMPLETION_STRINGLIST_STAT: + if (sc->rc==0) { + struct GetChildren2Response res; + deserialize_GetChildren2Response(ia, "reply", &res); + sc->u.strs_stat.strs2 = res.children; + sc->u.strs_stat.stat2 = res.stat; + /* We don't deallocate since we are passing it back */ + // deallocate_GetChildren2Response(&res); + } + break; + case COMPLETION_STRING: + if (sc->rc==0) { + struct CreateResponse res; + int len; + const char * client_path; + deserialize_CreateResponse(ia, "reply", &res); + //ZOOKEEPER-1027 + client_path = sub_string(zh, res.path); + len = strlen(client_path) + 1;if (len > sc->u.str.str_len) { + len = sc->u.str.str_len; + } + if (len > 0) { + memcpy(sc->u.str.str, client_path, len - 1); + sc->u.str.str[len - 1] = '\0'; + } + free_duplicate_path(client_path, res.path); + deallocate_CreateResponse(&res); + } + break; + case COMPLETION_STRING_STAT: + if (sc->rc==0) { + struct Create2Response res; + int len; + const char * client_path; + deserialize_Create2Response(ia, "reply", &res); + client_path = sub_string(zh, res.path); + len = strlen(client_path) + 1; + if (len > sc->u.str.str_len) { + len = sc->u.str.str_len; + } + if (len > 0) { + memcpy(sc->u.str.str, client_path, len - 1); + sc->u.str.str[len - 1] = '\0'; + } + free_duplicate_path(client_path, res.path); + sc->u.stat = res.stat; + deallocate_Create2Response(&res); + } + break; + case COMPLETION_ACLLIST: + if (sc->rc==0) { + struct GetACLResponse res; + deserialize_GetACLResponse(ia, "reply", &res); + sc->u.acl.acl = res.acl; + sc->u.acl.stat = res.stat; + /* We don't deallocate since we are passing it back */ + //deallocate_GetACLResponse(&res); + } + break; + case COMPLETION_VOID: + break; + case COMPLETION_MULTI: + sc->rc = deserialize_multi(zh, cptr->xid, cptr, ia); + break; + default: + LOG_DEBUG(LOGCALLBACK(zh), "Unsupported completion type=%d", cptr->c.type); + break; + } +} + +/*---------------------------------------------------------------------------* + * SYNC API + *---------------------------------------------------------------------------*/ +int zoo_create(zhandle_t *zh, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl, int flags, + char *path_buffer, int path_buffer_len) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + sc->u.str.str = path_buffer; + sc->u.str.str_len = path_buffer_len; + rc=zoo_acreate(zh, path, value, valuelen, acl, flags, SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + } + free_sync_completion(sc); + return rc; +} + +int zoo_create2(zhandle_t *zh, const char *path, const char *value, + int valuelen, const struct ACL_vector *acl, int flags, + char *path_buffer, int path_buffer_len, struct Stat *stat) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + + sc->u.str.str = path_buffer; + sc->u.str.str_len = path_buffer_len; + rc=zoo_acreate2(zh, path, value, valuelen, acl, flags, SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + if (rc == 0 && stat) { + *stat = sc->u.stat; + } + } + free_sync_completion(sc); + return rc; +} + +int zoo_delete(zhandle_t *zh, const char *path, int version) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + rc=zoo_adelete(zh, path, version, SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + } + free_sync_completion(sc); + return rc; +} + +int zoo_exists(zhandle_t *zh, const char *path, int watch, struct Stat *stat) +{ + return zoo_wexists(zh,path,watch?zh->watcher:0,zh->context,stat); +} + +int zoo_wexists(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, struct Stat *stat) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + rc=zoo_awexists(zh,path,watcher,watcherCtx,SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + if (rc == 0&& stat) { + *stat = sc->u.stat; + } + } + free_sync_completion(sc); + return rc; +} + +int zoo_get(zhandle_t *zh, const char *path, int watch, char *buffer, + int* buffer_len, struct Stat *stat) +{ + return zoo_wget(zh,path,watch?zh->watcher:0,zh->context, + buffer,buffer_len,stat); +} + +int zoo_wget(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + char *buffer, int* buffer_len, struct Stat *stat) +{ + struct sync_completion *sc; + int rc=0; + + if(buffer_len==NULL) + return ZBADARGUMENTS; + if((sc=alloc_sync_completion())==NULL) + return ZSYSTEMERROR; + + sc->u.data.buffer = buffer; + sc->u.data.buff_len = *buffer_len; + rc=zoo_awget(zh, path, watcher, watcherCtx, SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + if (rc == 0) { + if(stat) + *stat = sc->u.data.stat; + *buffer_len = sc->u.data.buff_len; + } + } + free_sync_completion(sc); + return rc; +} + +int zoo_getconfig(zhandle_t *zh, int watch, char *buffer, + int* buffer_len, struct Stat *stat) +{ + return zoo_wget(zh,ZOO_CONFIG_NODE,watch?zh->watcher:0,zh->context, buffer,buffer_len,stat); +} + +int zoo_wgetconfig(zhandle_t *zh, watcher_fn watcher, void* watcherCtx, + char *buffer, int* buffer_len, struct Stat *stat) +{ + return zoo_wget(zh, ZOO_CONFIG_NODE, watcher, watcherCtx, buffer, buffer_len, stat); +} + + +int zoo_reconfig(zhandle_t *zh, const char *joining, const char *leaving, + const char *members, int64_t version, char *buffer, int* buffer_len, + struct Stat *stat) +{ + struct sync_completion *sc; + int rc=0; + + if(buffer_len==NULL) + return ZBADARGUMENTS; + if((sc=alloc_sync_completion())==NULL) + return ZSYSTEMERROR; + + sc->u.data.buffer = buffer; + sc->u.data.buff_len = *buffer_len; + rc=zoo_areconfig(zh, joining, leaving, members, version, SYNCHRONOUS_MARKER, sc); + + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + if (rc == 0) { + if(stat) + *stat = sc->u.data.stat; + *buffer_len = sc->u.data.buff_len; + } + } + free_sync_completion(sc); + return rc; +} + +int zoo_set(zhandle_t *zh, const char *path, const char *buffer, int buflen, + int version) +{ + return zoo_set2(zh, path, buffer, buflen, version, 0); +} + +int zoo_set2(zhandle_t *zh, const char *path, const char *buffer, int buflen, + int version, struct Stat *stat) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + rc=zoo_aset(zh, path, buffer, buflen, version, SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + if (rc == 0 && stat) { + *stat = sc->u.stat; + } + } + free_sync_completion(sc); + return rc; +} + +static int zoo_wget_children_(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + struct String_vector *strings) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + rc= zoo_awget_children (zh, path, watcher, watcherCtx, SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + if (rc == 0) { + if (strings) { + *strings = sc->u.strs2; + } else { + deallocate_String_vector(&sc->u.strs2); + } + } + } + free_sync_completion(sc); + return rc; +} + +static int zoo_wget_children2_(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + struct String_vector *strings, struct Stat *stat) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + rc= zoo_awget_children2(zh, path, watcher, watcherCtx, SYNCHRONOUS_MARKER, sc); + + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + if (rc == 0) { + *stat = sc->u.strs_stat.stat2; + if (strings) { + *strings = sc->u.strs_stat.strs2; + } else { + deallocate_String_vector(&sc->u.strs_stat.strs2); + } + } + } + free_sync_completion(sc); + return rc; +} + +int zoo_get_children(zhandle_t *zh, const char *path, int watch, + struct String_vector *strings) +{ + return zoo_wget_children_(zh,path,watch?zh->watcher:0,zh->context,strings); +} + +int zoo_wget_children(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + struct String_vector *strings) +{ + return zoo_wget_children_(zh,path,watcher,watcherCtx,strings); +} + +int zoo_get_children2(zhandle_t *zh, const char *path, int watch, + struct String_vector *strings, struct Stat *stat) +{ + return zoo_wget_children2_(zh,path,watch?zh->watcher:0,zh->context,strings,stat); +} + +int zoo_wget_children2(zhandle_t *zh, const char *path, + watcher_fn watcher, void* watcherCtx, + struct String_vector *strings, struct Stat *stat) +{ + return zoo_wget_children2_(zh,path,watcher,watcherCtx,strings,stat); +} + +int zoo_get_acl(zhandle_t *zh, const char *path, struct ACL_vector *acl, + struct Stat *stat) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + rc=zoo_aget_acl(zh, path, SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + if (rc == 0&& stat) { + *stat = sc->u.acl.stat; + } + if (rc == 0) { + if (acl) { + *acl = sc->u.acl.acl; + } else { + deallocate_ACL_vector(&sc->u.acl.acl); + } + } + } + free_sync_completion(sc); + return rc; +} + +int zoo_set_acl(zhandle_t *zh, const char *path, int version, + const struct ACL_vector *acl) +{ + struct sync_completion *sc = alloc_sync_completion(); + int rc; + if (!sc) { + return ZSYSTEMERROR; + } + rc=zoo_aset_acl(zh, path, version, (struct ACL_vector*)acl, + SYNCHRONOUS_MARKER, sc); + if(rc==ZOK){ + wait_sync_completion(sc); + rc = sc->rc; + } + free_sync_completion(sc); + return rc; +} + +int zoo_remove_watchers(zhandle_t *zh, const char *path, ZooWatcherType wtype, + watcher_fn watcher, void *watcherCtx, int local) +{ + struct sync_completion *sc; + int rc = 0; + + if (!path) + return ZBADARGUMENTS; + + sc = alloc_sync_completion(); + if (!sc) + return ZSYSTEMERROR; + + rc = zoo_aremove_watchers(zh, path, wtype, watcher, watcherCtx, local, + SYNCHRONOUS_MARKER, sc); + if (rc == ZOK) { + wait_sync_completion(sc); + rc = sc->rc; + } + free_sync_completion(sc); + return rc; +} + +int zoo_multi(zhandle_t *zh, int count, const zoo_op_t *ops, zoo_op_result_t *results) +{ + int rc; + + struct sync_completion *sc = alloc_sync_completion(); + if (!sc) { + return ZSYSTEMERROR; + } + + rc = zoo_amulti(zh, count, ops, results, SYNCHRONOUS_MARKER, sc); + if (rc == ZOK) { + wait_sync_completion(sc); + rc = sc->rc; + } + free_sync_completion(sc); + + return rc; +} +#endif diff --git a/ToDo.md b/ToDo.md index 9c56e9854..b94e8bb6f 100644 --- a/ToDo.md +++ b/ToDo.md @@ -13,6 +13,8 @@ > 10. 重新开发支持ssl的邮件发送程序,使用CURL组件替换原有的smtp服务,目前smtp基本都转为smtps。(Finish) > 11. 开发支持直接转发的数据中继功能,参数配置化实现。(Finish) > 12. 开发TTy设备的支持。(Finish) +> 13. 开发支持跨平台的PSS工具组。(Doing) +> 14. 开发平台逻辑线程是使用接口。(Doing) ##work by ruqi > 1. 配置PSS生成Windows程序在sonar里检测与代码覆盖 (Doing) diff --git a/purenessscopeserver/Common/ILogicThreadManager.h b/purenessscopeserver/Common/ILogicThreadManager.h new file mode 100644 index 000000000..4458246d4 --- /dev/null +++ b/purenessscopeserver/Common/ILogicThreadManager.h @@ -0,0 +1,52 @@ +#ifndef _ILOGICTHREADMANAGER_H +#define _ILOGICTHREADMANAGER_H + +#include + +enum ThreadReturn +{ + THREAD_Task_Exit = 0, //当前线程退出 + THREAD_Task_Finish, //当前线程任务完成 +}; + +enum ThreadError +{ + THREAD_Error_Timeout = 0, //线程死锁 +}; + +//线程创建函数(参数为线程ID) +typedef void(*ThreadInit)(int); + +//线程消息处理函数(参数为线程ID, 消息ID, 内容指针) +typedef ThreadReturn(*ThreadCallbackLogic)(int, int, void*); + +//线程错误回调函数(线程ID, 错误ID) +typedef void(*ThreadErrorLogic)(int, int); + +//线程退出函数 +typedef void(*ThreadExit)(int); + +class ILogicThreadManager +{ +public: + virtual ~ILogicThreadManager() {} + + //创建逻辑线程 + virtual int CreateLogicThread(int nLogicThreadID, + int nTimeout, + ThreadInit thread_init, + ThreadCallbackLogic thread_callback_logic, + ThreadErrorLogic thread_callback_error, + ThreadExit thread_exit) = 0; + + //关闭逻辑线程 + virtual int KillLogicThread(int nLogicThreadID) = 0; + + //添加消息和逻辑线程的映射关系 + virtual int MessageMappingLogicThread(int nLogicThreadID, int nMessageID) = 0; + + //发送线程消息 + virtual int SendLogicThreadMessage(int nMessageID, void* arg) = 0; +}; + +#endif diff --git a/purenessscopeserver/Common/IObject.h b/purenessscopeserver/Common/IObject.h index 8881b7bad..9208f997a 100644 --- a/purenessscopeserver/Common/IObject.h +++ b/purenessscopeserver/Common/IObject.h @@ -22,6 +22,7 @@ #include "IFrameCommand.h" #include "ITSTimer.h" #include "ITTyClientManager.h" +#include "ILogicThreadManager.h" class CServerObject { @@ -43,6 +44,7 @@ class CServerObject m_pFrameCommand = NULL; m_pTSTimerManager = NULL; m_pTTyClientManager = NULL; + m_pLogicThreadManager = NULL; } virtual ~CServerObject() {} @@ -110,6 +112,11 @@ class CServerObject m_pTTyClientManager = pTTyClientManager; } + void SetLogicThreadManager(ILogicThreadManager* pLogicThreadManager) + { + m_pLogicThreadManager = pLogicThreadManager; + } + IMessageManager* GetMessageManager() { return m_pIMessageManager; @@ -174,6 +181,11 @@ class CServerObject return m_pTTyClientManager; } + ILogicThreadManager* GetLogicThreadManager() + { + return m_pLogicThreadManager; + } + private: IMessageManager* m_pIMessageManager; ILogManager* m_pLogManager; @@ -190,6 +202,7 @@ class CServerObject IFrameCommand* m_pFrameCommand; ITSTimerManager* m_pTSTimerManager; ITTyClientManager* m_pTTyClientManager; + ILogicThreadManager* m_pLogicThreadManager; }; typedef ACE_Singleton App_ServerObject; diff --git a/purenessscopeserver/FrameCore/CMakeLists.txt b/purenessscopeserver/FrameCore/CMakeLists.txt new file mode 100644 index 000000000..a27e4c809 --- /dev/null +++ b/purenessscopeserver/FrameCore/CMakeLists.txt @@ -0,0 +1,178 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PurenessScopeServer) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PurenessScopeServer_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../purenessscopeserver/Common + ./Common + ../../ThirdLib/include/TinyXML + ./Mail + ./Message + ./LogSystem + ./Reactor + ./PacketParse + ./FileTest + ./UDP + ./Console + +) + + +# Compiler options +add_definitions(-O2 -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/Message/LogicThreadManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxml.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + ${CMAKE_CURRENT_LIST_DIR}/../Common/ACEMemory.cpp + ${CMAKE_CURRENT_LIST_DIR}/../Common/RandomNumber.cpp + ${CMAKE_CURRENT_LIST_DIR}/../Common/Time_Value.cpp + ${CMAKE_CURRENT_LIST_DIR}/../Common/TimerThread.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/BaseConsoleHandle.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/BuffPacket.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/BuffPacketManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/CommandAccount.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/ForbiddenIP.cpp + ${CMAKE_CURRENT_LIST_DIR}/../Common/Threading.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/Frame_Logging_Strategy.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/IPAccount.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/MessageBlockManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/ServerMessageTask.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/ThreadInfo.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/TimerManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Console/MessageDefine.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/BaseTask.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/XmlConfig.cpp + ${CMAKE_CURRENT_LIST_DIR}/../Common/TimerInfo.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/BaseServerManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/PacketParse/PacketConsoleParse.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/BaseClientConnectManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/SendCacheManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/AceReactorManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/MyACELoggingStrategy.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/BaseHander.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/MakePacket.cpp + ${CMAKE_CURRENT_LIST_DIR}/PacketParse/PacketParsePool.cpp + ${CMAKE_CURRENT_LIST_DIR}/Message/Message.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/AppConfig.cpp + ${CMAKE_CURRENT_LIST_DIR}/FileTest/FileTestManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Message/MessageDyeingManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/WindowsCPU.cpp + ${CMAKE_CURRENT_LIST_DIR}/PacketParse/PacketParse.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/ProfileTime.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/WindowsProcess.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/BaseConnectClient.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ConnectClient.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ServerManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Console/ConsolePromiss.cpp + ${CMAKE_CURRENT_LIST_DIR}/PacketParse/PacketParseBase.cpp + ${CMAKE_CURRENT_LIST_DIR}/Message/MessageManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Mail/smtps.cpp + ${CMAKE_CURRENT_LIST_DIR}/LogSystem/LogManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/PurenessScopeServer.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ConsoleAccept.cpp + ${CMAKE_CURRENT_LIST_DIR}/UDP/ReactorUDPHander.cpp + ${CMAKE_CURRENT_LIST_DIR}/UDP/ReactorUDPClient.cpp + ${CMAKE_CURRENT_LIST_DIR}/UDP/ProactorUDPHandler.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/SendMessage.cpp + ${CMAKE_CURRENT_LIST_DIR}/UDP/ProactorUDPClient.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/WaitQuitSignal.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/LinuxCPU.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/ProgramService.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ConsoleHandler.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ControlListen.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/TcpRedirection.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ConnectHandler.cpp + ${CMAKE_CURRENT_LIST_DIR}/LogSystem/FileLogger.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ConnectAccept.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ClientReConnectManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ReTTyClientManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Message/WorkThreadAI.cpp + ${CMAKE_CURRENT_LIST_DIR}/Message/ModuleMessageManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/Message/MessageService.cpp + ${CMAKE_CURRENT_LIST_DIR}/Reactor/ReTTyHandler.cpp + ${CMAKE_CURRENT_LIST_DIR}/Message/LoadPacketParse.cpp + ${CMAKE_CURRENT_LIST_DIR}/Message/LoadModule.cpp + ${CMAKE_CURRENT_LIST_DIR}/Mail/base64.cpp + ${CMAKE_CURRENT_LIST_DIR}/Console/MessageDispose.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../ThirdLib/include/TinyXML/tinystr.cpp + ${CMAKE_CURRENT_LIST_DIR}/Mail/smtp.cpp + ${CMAKE_CURRENT_LIST_DIR}/Console/FrameCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/Console/ConsoleMessage.cpp + ${CMAKE_CURRENT_LIST_DIR}/Common/XmlOpeation.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_executable(PurenessScopeServer ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PurenessScopeServer ${LINK_OPTIONS}) + +target_link_libraries(PurenessScopeServer + /usr/local/lib/libACE.so + /usr/lib/libdl.so + /usr/lib/libpthread.so +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/FrameCore/Common/AppConfig.cpp b/purenessscopeserver/FrameCore/Common/AppConfig.cpp index f5e28179e..9b5812d36 100644 --- a/purenessscopeserver/FrameCore/Common/AppConfig.cpp +++ b/purenessscopeserver/FrameCore/Common/AppConfig.cpp @@ -7,9 +7,9 @@ CAppConfig::CAppConfig(void) m_szError[0] = '\0'; } -CAppConfig::CAppConfig(const CAppConfig& p) +CAppConfig::CAppConfig(const CAppConfig& ar) { - ACE_UNUSED_ARG(p); + (*this) = ar; } CAppConfig::~CAppConfig(void) diff --git a/purenessscopeserver/FrameCore/Common/AppConfig.h b/purenessscopeserver/FrameCore/Common/AppConfig.h index 2bc5802b8..d9cb5a161 100644 --- a/purenessscopeserver/FrameCore/Common/AppConfig.h +++ b/purenessscopeserver/FrameCore/Common/AppConfig.h @@ -23,7 +23,7 @@ class CAppConfig CAppConfig(const CAppConfig& ar); - CAppConfig& operator = (CAppConfig& ar) + CAppConfig& operator = (const CAppConfig& ar) { if (this != &ar) { diff --git a/purenessscopeserver/FrameCore/Common/BaseServerManager.cpp b/purenessscopeserver/FrameCore/Common/BaseServerManager.cpp index 5f3d75ffc..f68b64d71 100644 --- a/purenessscopeserver/FrameCore/Common/BaseServerManager.cpp +++ b/purenessscopeserver/FrameCore/Common/BaseServerManager.cpp @@ -84,7 +84,14 @@ bool Server_Manager_Common_Pool() return true; } -bool Server_Manager_Common_IObject(IConnectManager* pConnectManager, IClientManager* pClientManager, IUDPConnectManager* pUDPConnectManager, IFrameCommand* pFrameCommand, IServerManager* pIServerManager, ITSTimerManager* pTSTimerManager, ITTyClientManager* pTTyClientManager) +bool Server_Manager_Common_IObject(IConnectManager* pConnectManager, + IClientManager* pClientManager, + IUDPConnectManager* pUDPConnectManager, + IFrameCommand* pFrameCommand, + IServerManager* pIServerManager, + ITSTimerManager* pTSTimerManager, + ITTyClientManager* pTTyClientManager, + ILogicThreadManager* pLogicThreadManager) { App_ServerObject::instance()->SetMessageManager(dynamic_cast(App_MessageManager::instance())); App_ServerObject::instance()->SetLogManager(dynamic_cast(AppLogManager::instance())); @@ -101,6 +108,7 @@ bool Server_Manager_Common_IObject(IConnectManager* pConnectManager, IClientMana App_ServerObject::instance()->SetServerManager(pIServerManager); App_ServerObject::instance()->SetTSTimer(pTSTimerManager); App_ServerObject::instance()->SetTTyClientManager(pTTyClientManager); + App_ServerObject::instance()->SetLogicThreadManager(pLogicThreadManager); return true; } diff --git a/purenessscopeserver/FrameCore/Common/BaseServerManager.h b/purenessscopeserver/FrameCore/Common/BaseServerManager.h index ed1edf6f6..e620f8c97 100644 --- a/purenessscopeserver/FrameCore/Common/BaseServerManager.h +++ b/purenessscopeserver/FrameCore/Common/BaseServerManager.h @@ -35,7 +35,8 @@ bool Server_Manager_Common_IObject(IConnectManager* pConnectManager, IFrameCommand* pFrameCommand, IServerManager* pIServerManager, ITSTimerManager* pTSTimerManager, - ITTyClientManager* pTTyClientManager); + ITTyClientManager* pTTyClientManager, + ILogicThreadManager* pLogicThreadManager); //ʼģļ bool Server_Manager_Common_Module(); diff --git a/purenessscopeserver/FrameCore/Common/ServerMessageTask.cpp b/purenessscopeserver/FrameCore/Common/ServerMessageTask.cpp index 2cce31a30..fe220eeb0 100644 --- a/purenessscopeserver/FrameCore/Common/ServerMessageTask.cpp +++ b/purenessscopeserver/FrameCore/Common/ServerMessageTask.cpp @@ -104,6 +104,11 @@ CServerMessageTask::CServerMessageTask():m_mutex(), m_cond(m_mutex) m_emState = SERVER_RECV_INIT; } +CServerMessageTask::CServerMessageTask(const CServerMessageTask& ar) : CServerMessageTask() +{ + (*this) = ar; +} + CServerMessageTask::~CServerMessageTask() { OUR_DEBUG((LM_INFO, "[CServerMessageTask::~CServerMessageTask].\n")); diff --git a/purenessscopeserver/FrameCore/Common/ServerMessageTask.h b/purenessscopeserver/FrameCore/Common/ServerMessageTask.h index 2169d3448..f407ff5d8 100644 --- a/purenessscopeserver/FrameCore/Common/ServerMessageTask.h +++ b/purenessscopeserver/FrameCore/Common/ServerMessageTask.h @@ -149,7 +149,9 @@ class CServerMessageTask : public ACE_Task { public: CServerMessageTask(); - ~CServerMessageTask(); + virtual ~CServerMessageTask(); + + CServerMessageTask(const CServerMessageTask& ar); CServerMessageTask& operator = (const CServerMessageTask& ar) { diff --git a/purenessscopeserver/FrameCore/CppUnit/CppUnitMain.cpp b/purenessscopeserver/FrameCore/CppUnit/CppUnitMain.cpp index 097885806..6c84aab67 100644 --- a/purenessscopeserver/FrameCore/CppUnit/CppUnitMain.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/CppUnitMain.cpp @@ -40,6 +40,7 @@ CCppUnitMain::CCppUnitMain() CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CUnit_LogManager, "pss"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CUnit_LoadModule, "pss"); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CUnit_Redirection, "pss"); + CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CUnit_LogicThreadManager, "pss"); //ʱ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(CUnit_Frame_Logging, "pss"); } diff --git a/purenessscopeserver/FrameCore/CppUnit/CppUnitMain.h b/purenessscopeserver/FrameCore/CppUnit/CppUnitMain.h index 4f9e748ee..3ebc84316 100644 --- a/purenessscopeserver/FrameCore/CppUnit/CppUnitMain.h +++ b/purenessscopeserver/FrameCore/CppUnit/CppUnitMain.h @@ -41,6 +41,7 @@ #include "Uint_LogManager.h" #include "Unit_LoadModule.h" #include "Uint_TcpRedirection.h" +#include "Unit_LogicThreadManager.h" #define CPPUNIT_REPORT_PATH "./reports/cppunit/report.xml" diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_AceReactorManager.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_AceReactorManager.cpp index eb85e215f..81ed68908 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_AceReactorManager.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_AceReactorManager.cpp @@ -2,11 +2,21 @@ #ifdef _CPPUNIT_TEST -CUnit_AceReactorManager::~CUnit_AceReactorManager() +CUnit_AceReactorManager::CUnit_AceReactorManager() { m_pReactorManager = NULL; } +CUnit_AceReactorManager::CUnit_AceReactorManager(const CUnit_AceReactorManager& ar) +{ + (*this) = ar; +} + +CUnit_AceReactorManager::~CUnit_AceReactorManager() +{ + +} + void CUnit_AceReactorManager::setUp(void) { m_pReactorManager = new CAceReactorManager(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_AceReactorManager.h b/purenessscopeserver/FrameCore/CppUnit/Uint_AceReactorManager.h index 217deb46d..37e984293 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_AceReactorManager.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_AceReactorManager.h @@ -13,8 +13,22 @@ class CUnit_AceReactorManager : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_AceReactorManager(); + virtual ~CUnit_AceReactorManager(); + CUnit_AceReactorManager(const CUnit_AceReactorManager& ar); + + CUnit_AceReactorManager& operator = (const CUnit_AceReactorManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectClient.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectClient.cpp index 0ff28f5cf..ea527421a 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectClient.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectClient.cpp @@ -2,11 +2,21 @@ #ifdef _CPPUNIT_TEST -CUnit_ConnectClient::~CUnit_ConnectClient() +CUnit_ConnectClient::CUnit_ConnectClient() { m_pConnectClient = NULL; } +CUnit_ConnectClient::CUnit_ConnectClient(const CUnit_ConnectClient& ar) +{ + (*this) = ar; +} + +CUnit_ConnectClient::~CUnit_ConnectClient() +{ + +} + void CUnit_ConnectClient::setUp(void) { m_pConnectClient = new CConnectClient(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectClient.h b/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectClient.h index f258de40a..2eb7ae58a 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectClient.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectClient.h @@ -15,8 +15,22 @@ class CUnit_ConnectClient : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ConnectClient(); + virtual ~CUnit_ConnectClient(); + CUnit_ConnectClient(const CUnit_ConnectClient& ar); + + CUnit_ConnectClient& operator = (const CUnit_ConnectClient& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectHandler.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectHandler.cpp index 94f9cf0ef..c8f109522 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectHandler.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectHandler.cpp @@ -2,11 +2,21 @@ #ifdef _CPPUNIT_TEST -CUnit_ConnectHandler::~CUnit_ConnectHandler() +CUnit_ConnectHandler::CUnit_ConnectHandler() { m_pConnectHandler = NULL; } +CUnit_ConnectHandler::CUnit_ConnectHandler(const CUnit_ConnectHandler& ar) +{ + (*this) = ar; +} + +CUnit_ConnectHandler::~CUnit_ConnectHandler() +{ + +} + void CUnit_ConnectHandler::setUp(void) { m_pConnectHandler = new CConnectHandler(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectHandler.h b/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectHandler.h index 8e36135f6..28d973137 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectHandler.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ConnectHandler.h @@ -17,8 +17,22 @@ class CUnit_ConnectHandler : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ConnectHandler(); + virtual ~CUnit_ConnectHandler(); + CUnit_ConnectHandler(const CUnit_ConnectHandler& ar); + + CUnit_ConnectHandler& operator = (const CUnit_ConnectHandler& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ConsoleMessage.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_ConsoleMessage.cpp index 484fe67f4..ae0db2b5d 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ConsoleMessage.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ConsoleMessage.cpp @@ -2,11 +2,23 @@ #ifdef _CPPUNIT_TEST +CUnit_ConsoleMessage::CUnit_ConsoleMessage() +{ + m_pConsoleMessage = NULL; +} + +CUnit_ConsoleMessage::CUnit_ConsoleMessage(const CUnit_ConsoleMessage& ar) +{ + (*this) = ar; +} + CUnit_ConsoleMessage::~CUnit_ConsoleMessage() { } + + void CUnit_ConsoleMessage::setUp(void) { m_pConsoleMessage = new CConsoleMessage(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ConsoleMessage.h b/purenessscopeserver/FrameCore/CppUnit/Uint_ConsoleMessage.h index 7f2e63d97..da8046fe0 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ConsoleMessage.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ConsoleMessage.h @@ -59,8 +59,22 @@ class CUnit_ConsoleMessage : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ConsoleMessage(); + virtual ~CUnit_ConsoleMessage(); + CUnit_ConsoleMessage(const CUnit_ConsoleMessage& ar); + + CUnit_ConsoleMessage& operator = (const CUnit_ConsoleMessage& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ConsolePromissions.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_ConsolePromissions.cpp index f176f10ce..be6ba5ffc 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ConsolePromissions.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ConsolePromissions.cpp @@ -2,6 +2,16 @@ #ifdef _CPPUNIT_TEST +CUnit_ConsolePromissions::CUnit_ConsolePromissions() +{ + m_pConsolePromissions = NULL; +} + +CUnit_ConsolePromissions::CUnit_ConsolePromissions(const CUnit_ConsolePromissions& ar) +{ + (*this) = ar; +} + CUnit_ConsolePromissions::~CUnit_ConsolePromissions() { diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ConsolePromissions.h b/purenessscopeserver/FrameCore/CppUnit/Uint_ConsolePromissions.h index b797a721b..829bfe19e 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ConsolePromissions.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ConsolePromissions.h @@ -13,8 +13,23 @@ class CUnit_ConsolePromissions : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ConsolePromissions(); + virtual ~CUnit_ConsolePromissions(); + CUnit_ConsolePromissions(const CUnit_ConsolePromissions& ar); + + CUnit_ConsolePromissions& operator = (const CUnit_ConsolePromissions& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_LogManager.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_LogManager.cpp index 06f280cb9..5377feccf 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_LogManager.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_LogManager.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_LogManager::~CUnit_LogManager() +CUnit_LogManager::CUnit_LogManager() { m_pLogBlockPool = NULL; } +CUnit_LogManager::CUnit_LogManager(const CUnit_LogManager& ar) +{ + (*this) = ar; +} + +CUnit_LogManager::~CUnit_LogManager() +{ +} + void CUnit_LogManager::setUp(void) { m_pLogBlockPool = new CLogBlockPool(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_LogManager.h b/purenessscopeserver/FrameCore/CppUnit/Uint_LogManager.h index 48407f784..709124ba2 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_LogManager.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_LogManager.h @@ -14,8 +14,22 @@ class CUnit_LogManager : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_LogManager(); + virtual ~CUnit_LogManager(); + CUnit_LogManager(const CUnit_LogManager& ar); + + CUnit_LogManager& operator = (const CUnit_LogManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_MessageService.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_MessageService.cpp index 1dc899ea9..e99cd365b 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_MessageService.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_MessageService.cpp @@ -2,11 +2,22 @@ #ifdef _CPPUNIT_TEST -CUnit_MessageService::~CUnit_MessageService() +CUnit_MessageService::CUnit_MessageService() { m_pMessageService = NULL; } +CUnit_MessageService::CUnit_MessageService(const CUnit_MessageService& ar) +{ + (*this) = ar; +} + +CUnit_MessageService::~CUnit_MessageService() +{ +} + + + void CUnit_MessageService::setUp(void) { m_pMessageService = new CMessageService(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_MessageService.h b/purenessscopeserver/FrameCore/CppUnit/Uint_MessageService.h index f9ea34bc8..85f86ccfd 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_MessageService.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_MessageService.h @@ -13,8 +13,22 @@ class CUnit_MessageService : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_MessageService(); + virtual ~CUnit_MessageService(); + CUnit_MessageService(const CUnit_MessageService& ar); + + CUnit_MessageService& operator = (const CUnit_MessageService& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_PacketParse.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_PacketParse.cpp index 7a7aa35e4..48a8adf21 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_PacketParse.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_PacketParse.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_PacketParse::~CUnit_PacketParse() +CUnit_PacketParse::CUnit_PacketParse() { m_pPacketParsePool = NULL; } +CUnit_PacketParse::CUnit_PacketParse(const CUnit_PacketParse& ar) +{ + (*this) = ar; +} + +CUnit_PacketParse::~CUnit_PacketParse() +{ +} + void CUnit_PacketParse::setUp(void) { m_pPacketParsePool = new CPacketParsePool(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_PacketParse.h b/purenessscopeserver/FrameCore/CppUnit/Uint_PacketParse.h index bee979104..5c0349026 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_PacketParse.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_PacketParse.h @@ -13,8 +13,22 @@ class CUnit_PacketParse : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_PacketParse(); + virtual ~CUnit_PacketParse(); + CUnit_PacketParse(const CUnit_PacketParse& ar); + + CUnit_PacketParse& operator = (const CUnit_PacketParse& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageInfoPool.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageInfoPool.cpp index 54d9a4c20..d3c1033e4 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageInfoPool.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageInfoPool.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_ServerMessageInfoPool::~CUnit_ServerMessageInfoPool() +CUnit_ServerMessageInfoPool::CUnit_ServerMessageInfoPool() { m_pServerMessageInfoPool = NULL; } +CUnit_ServerMessageInfoPool::CUnit_ServerMessageInfoPool(const CUnit_ServerMessageInfoPool& ar) +{ + (*this) = ar; +} + +CUnit_ServerMessageInfoPool::~CUnit_ServerMessageInfoPool() +{ +} + void CUnit_ServerMessageInfoPool::setUp(void) { m_pServerMessageInfoPool = new CServerMessageInfoPool(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageInfoPool.h b/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageInfoPool.h index 032a86c21..12d713eb5 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageInfoPool.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageInfoPool.h @@ -13,8 +13,22 @@ class CUnit_ServerMessageInfoPool : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ServerMessageInfoPool(); + virtual ~CUnit_ServerMessageInfoPool(); + CUnit_ServerMessageInfoPool(const CUnit_ServerMessageInfoPool& ar); + + CUnit_ServerMessageInfoPool& operator = (const CUnit_ServerMessageInfoPool& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageManager.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageManager.cpp index 6575b272f..1c37f4c3d 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageManager.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageManager.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_ServerMessageManager::~CUnit_ServerMessageManager() +CUnit_ServerMessageManager::CUnit_ServerMessageManager() { m_pServerMessageManager = NULL; } +CUnit_ServerMessageManager::CUnit_ServerMessageManager(const CUnit_ServerMessageManager& ar) +{ + (*this) = ar; +} + +CUnit_ServerMessageManager::~CUnit_ServerMessageManager() +{ +} + void CUnit_ServerMessageManager::setUp(void) { m_pServerMessageManager = new CServerMessageManager(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageManager.h b/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageManager.h index 65638e0f1..86d69f57a 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageManager.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ServerMessageManager.h @@ -14,8 +14,22 @@ class CUnit_ServerMessageManager : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ServerMessageManager(); + virtual ~CUnit_ServerMessageManager(); + CUnit_ServerMessageManager(const CUnit_ServerMessageManager& ar); + + CUnit_ServerMessageManager& operator = (const CUnit_ServerMessageManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_TcpRedirection.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_TcpRedirection.cpp index 62dd90b54..389cbca36 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_TcpRedirection.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_TcpRedirection.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_Redirection::~CUnit_Redirection() +CUnit_Redirection::CUnit_Redirection() { m_pTcpRedirection = NULL; } +CUnit_Redirection::CUnit_Redirection(const CUnit_Redirection& ar) +{ + (*this) = ar; +} + +CUnit_Redirection::~CUnit_Redirection() +{ +} + void CUnit_Redirection::setUp(void) { m_pTcpRedirection = new CTcpRedirection(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_TcpRedirection.h b/purenessscopeserver/FrameCore/CppUnit/Uint_TcpRedirection.h index e19003b52..3a413e047 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_TcpRedirection.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_TcpRedirection.h @@ -16,8 +16,22 @@ class CUnit_Redirection : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_Redirection(); + virtual ~CUnit_Redirection(); + CUnit_Redirection(const CUnit_Redirection& ar); + + CUnit_Redirection& operator = (const CUnit_Redirection& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ThreadInfo.cpp b/purenessscopeserver/FrameCore/CppUnit/Uint_ThreadInfo.cpp index 122e013ae..efbbf8560 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ThreadInfo.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ThreadInfo.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_ThreadInfo::~CUnit_ThreadInfo() +CUnit_ThreadInfo::CUnit_ThreadInfo() { m_pThreadInfo = NULL; } +CUnit_ThreadInfo::CUnit_ThreadInfo(const CUnit_ThreadInfo& ar) +{ + (*this) = ar; +} + +CUnit_ThreadInfo::~CUnit_ThreadInfo() +{ +} + void CUnit_ThreadInfo::setUp(void) { m_pThreadInfo = new CThreadInfo(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Uint_ThreadInfo.h b/purenessscopeserver/FrameCore/CppUnit/Uint_ThreadInfo.h index 4111af90d..a51a683a2 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Uint_ThreadInfo.h +++ b/purenessscopeserver/FrameCore/CppUnit/Uint_ThreadInfo.h @@ -13,8 +13,22 @@ class CUnit_ThreadInfo : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ThreadInfo(); + virtual ~CUnit_ThreadInfo(); + CUnit_ThreadInfo(const CUnit_ThreadInfo& ar); + + CUnit_ThreadInfo& operator = (const CUnit_ThreadInfo& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_Aes.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_Aes.cpp index c235c2aea..6dd890852 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_Aes.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_Aes.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_Aes::~CUnit_Aes() +CUnit_Aes::CUnit_Aes() +{ + m_pAES = NULL; +} + +CUnit_Aes::CUnit_Aes(const CUnit_Aes& ar) { + (*this) = ar; +} +CUnit_Aes::~CUnit_Aes() +{ } void CUnit_Aes::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_Aes.h b/purenessscopeserver/FrameCore/CppUnit/Unit_Aes.h index e5ff30cd9..acad70781 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_Aes.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_Aes.h @@ -14,8 +14,22 @@ class CUnit_Aes : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_Aes(); + virtual ~CUnit_Aes(); + CUnit_Aes(const CUnit_Aes& ar); + + CUnit_Aes& operator = (const CUnit_Aes& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_AppConfig.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_AppConfig.cpp index f62bce9fc..006bb7301 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_AppConfig.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_AppConfig.cpp @@ -2,6 +2,16 @@ #ifdef _CPPUNIT_TEST +CUnit_AppConfig::CUnit_AppConfig() +{ + m_pAppConfig = NULL; +} + +CUnit_AppConfig::CUnit_AppConfig(const CUnit_AppConfig& ar) +{ + (*this) = ar; +} + CUnit_AppConfig::~CUnit_AppConfig() { } diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_AppConfig.h b/purenessscopeserver/FrameCore/CppUnit/Unit_AppConfig.h index 0314b366f..43c474de8 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_AppConfig.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_AppConfig.h @@ -14,8 +14,22 @@ class CUnit_AppConfig : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_AppConfig(); + virtual ~CUnit_AppConfig(); + CUnit_AppConfig(const CUnit_AppConfig& ar); + + CUnit_AppConfig& operator = (const CUnit_AppConfig& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_BaseConnectClient.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_BaseConnectClient.cpp index 42eea447f..490824abd 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_BaseConnectClient.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_BaseConnectClient.cpp @@ -2,6 +2,16 @@ #ifdef _CPPUNIT_TEST +CUnit_BaseConnectClient::CUnit_BaseConnectClient() +{ + m_u2CommandID = 0; +} + +CUnit_BaseConnectClient::CUnit_BaseConnectClient(const CUnit_BaseConnectClient& ar) +{ + (*this) = ar; +} + CUnit_BaseConnectClient::~CUnit_BaseConnectClient() { diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_BaseConnectClient.h b/purenessscopeserver/FrameCore/CppUnit/Unit_BaseConnectClient.h index 507ba3f90..d958acf67 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_BaseConnectClient.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_BaseConnectClient.h @@ -16,8 +16,22 @@ class CUnit_BaseConnectClient : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_BaseConnectClient(); + virtual ~CUnit_BaseConnectClient(); + CUnit_BaseConnectClient(const CUnit_BaseConnectClient& ar); + + CUnit_BaseConnectClient& operator = (const CUnit_BaseConnectClient& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_BaseHandler.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_BaseHandler.cpp index 55ac7e742..9cc68d11c 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_BaseHandler.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_BaseHandler.cpp @@ -2,6 +2,21 @@ #ifdef _CPPUNIT_TEST +CUnit_Basehandler::CUnit_Basehandler() +{ + m_nBaseHandlerID = 0; +} + +CUnit_Basehandler::CUnit_Basehandler(const CUnit_Basehandler& ar) +{ + (*this) = ar; +} + +CUnit_Basehandler::~CUnit_Basehandler() +{ + +} + void CUnit_Basehandler::setUp(void) { m_nBaseHandlerID = 1; diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_BaseHandler.h b/purenessscopeserver/FrameCore/CppUnit/Unit_BaseHandler.h index 7c030809b..451605160 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_BaseHandler.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_BaseHandler.h @@ -19,6 +19,21 @@ class CUnit_Basehandler : public CppUnit::TestFixture CPPUNIT_TEST(Test_Tcp_Common_Make_Send_Packet); CPPUNIT_TEST_SUITE_END(); public: + CUnit_Basehandler(); + + virtual ~CUnit_Basehandler(); + + CUnit_Basehandler(const CUnit_Basehandler& ar); + + CUnit_Basehandler& operator = (const CUnit_Basehandler& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } virtual void setUp(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_BuffPacket.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_BuffPacket.cpp index 0a82233a3..c308b1371 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_BuffPacket.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_BuffPacket.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_BuffPacket::~CUnit_BuffPacket() +CUnit_BuffPacket::CUnit_BuffPacket() +{ + m_pBuffPacket = NULL; +} + +CUnit_BuffPacket::CUnit_BuffPacket(const CUnit_BuffPacket& ar) { + (*this) = ar; +} +CUnit_BuffPacket::~CUnit_BuffPacket() +{ } void CUnit_BuffPacket::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_BuffPacket.h b/purenessscopeserver/FrameCore/CppUnit/Unit_BuffPacket.h index f00db3dec..36e6d98eb 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_BuffPacket.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_BuffPacket.h @@ -33,8 +33,22 @@ class CUnit_BuffPacket : public CppUnit::TestFixture CPPUNIT_TEST(Test_PacketCount); CPPUNIT_TEST_SUITE_END(); public: + CUnit_BuffPacket(); + virtual ~CUnit_BuffPacket(); + CUnit_BuffPacket(const CUnit_BuffPacket& ar); + + CUnit_BuffPacket& operator = (const CUnit_BuffPacket& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_CommandAccount.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_CommandAccount.cpp index 5692e7cf3..ec3c1f7ca 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_CommandAccount.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_CommandAccount.cpp @@ -2,6 +2,19 @@ #ifdef _CPPUNIT_TEST +CUnit_CommandAccount::CUnit_CommandAccount() +{ + m_pCommandAccount = 0; + m_u1CommandAccount = 1; + m_u1Flow = 0; + m_u2RecvTimeout = 30; +} + +CUnit_CommandAccount::CUnit_CommandAccount(const CUnit_CommandAccount& ar) +{ + (*this) = ar; +} + CUnit_CommandAccount::~CUnit_CommandAccount() { } diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_CommandAccount.h b/purenessscopeserver/FrameCore/CppUnit/Unit_CommandAccount.h index e63738e97..1d78b069f 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_CommandAccount.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_CommandAccount.h @@ -16,8 +16,22 @@ class CUnit_CommandAccount : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_CommandAccount(); + virtual ~CUnit_CommandAccount(); + CUnit_CommandAccount(const CUnit_CommandAccount& ar); + + CUnit_CommandAccount& operator = (const CUnit_CommandAccount& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectTcp.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectTcp.cpp index 0b7a87df4..9ee72a415 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectTcp.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectTcp.cpp @@ -2,6 +2,16 @@ #ifdef _CPPUNIT_TEST +CUnit_ConnectTcp::CUnit_ConnectTcp() +{ + m_nServerID = 0; +} + +CUnit_ConnectTcp::CUnit_ConnectTcp(const CUnit_ConnectTcp& ar) +{ + (*this) = ar; +} + CUnit_ConnectTcp::~CUnit_ConnectTcp() { diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectTcp.h b/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectTcp.h index a9079d9d8..5c358d41d 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectTcp.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectTcp.h @@ -16,8 +16,22 @@ class CUnit_ConnectTcp : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ConnectTcp(); + virtual ~CUnit_ConnectTcp(); + CUnit_ConnectTcp(const CUnit_ConnectTcp& ar); + + CUnit_ConnectTcp& operator = (const CUnit_ConnectTcp& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectUdp.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectUdp.cpp index 1e9b5cbd3..0bf0385d4 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectUdp.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectUdp.cpp @@ -2,6 +2,16 @@ #ifdef _CPPUNIT_TEST +CUnit_ConnectUdp::CUnit_ConnectUdp() +{ + m_nServerID = 0; +} + +CUnit_ConnectUdp::CUnit_ConnectUdp(const CUnit_ConnectUdp& ar) +{ + (*this) = ar; +} + CUnit_ConnectUdp::~CUnit_ConnectUdp() { diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectUdp.h b/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectUdp.h index 60ed468bf..3db75d2c1 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectUdp.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ConnectUdp.h @@ -15,8 +15,22 @@ class CUnit_ConnectUdp : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ConnectUdp(); + virtual ~CUnit_ConnectUdp(); + CUnit_ConnectUdp(const CUnit_ConnectUdp& ar); + + CUnit_ConnectUdp& operator = (const CUnit_ConnectUdp& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ControlListen.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_ControlListen.cpp index 6715423eb..b6dcfd5ab 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ControlListen.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ControlListen.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_ControlListen::~CUnit_ControlListen() +CUnit_ControlListen::CUnit_ControlListen() { m_pControlListen = NULL; } +CUnit_ControlListen::CUnit_ControlListen(const CUnit_ControlListen& ar) +{ + (*this) = ar; +} + +CUnit_ControlListen::~CUnit_ControlListen() +{ +} + void CUnit_ControlListen::setUp(void) { m_pControlListen = new CControlListen(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ControlListen.h b/purenessscopeserver/FrameCore/CppUnit/Unit_ControlListen.h index 32ad4d275..94f162c1b 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ControlListen.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ControlListen.h @@ -13,8 +13,22 @@ class CUnit_ControlListen : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ControlListen(); + virtual ~CUnit_ControlListen(); + CUnit_ControlListen(const CUnit_ControlListen& ar); + + CUnit_ControlListen& operator = (const CUnit_ControlListen& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_FileLog.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_FileLog.cpp index 9b661efa9..1af19f61f 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_FileLog.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_FileLog.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_FileLogger::~CUnit_FileLogger() +CUnit_FileLogger::CUnit_FileLogger() { + m_pLogFile = NULL; +} +CUnit_FileLogger::CUnit_FileLogger(const CUnit_FileLogger& ar) +{ + (*this) = ar; +} + +CUnit_FileLogger::~CUnit_FileLogger() +{ } void CUnit_FileLogger::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_FileLog.h b/purenessscopeserver/FrameCore/CppUnit/Unit_FileLog.h index 7c57ca15e..b951a2002 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_FileLog.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_FileLog.h @@ -14,8 +14,22 @@ class CUnit_FileLogger : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_FileLogger(); + virtual ~CUnit_FileLogger(); + CUnit_FileLogger(const CUnit_FileLogger& ar); + + CUnit_FileLogger& operator = (const CUnit_FileLogger& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_FileTestManager.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_FileTestManager.cpp index 506713edd..546244a03 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_FileTestManager.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_FileTestManager.cpp @@ -2,6 +2,20 @@ #ifdef _CPPUNIT_TEST +CUnit_FileTestManager::CUnit_FileTestManager() +{ + m_pFileTestManager = NULL; +} + +CUnit_FileTestManager::CUnit_FileTestManager(const CUnit_FileTestManager& ar) +{ + (*this) = ar; +} + +CUnit_FileTestManager::~CUnit_FileTestManager() +{ +} + void CUnit_FileTestManager::setUp(void) { m_pFileTestManager = new CFileTestManager(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_FileTestManager.h b/purenessscopeserver/FrameCore/CppUnit/Unit_FileTestManager.h index 582419bfe..465814218 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_FileTestManager.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_FileTestManager.h @@ -14,6 +14,21 @@ class CUnit_FileTestManager : public CppUnit::TestFixture CPPUNIT_TEST(Test_FileTestStop); CPPUNIT_TEST_SUITE_END(); public: + CUnit_FileTestManager(); + + virtual ~CUnit_FileTestManager(); + + CUnit_FileTestManager(const CUnit_FileTestManager& ar); + + CUnit_FileTestManager& operator = (const CUnit_FileTestManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } virtual void setUp(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ForbiddenIP.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_ForbiddenIP.cpp index 1a4478169..09b11f892 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ForbiddenIP.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ForbiddenIP.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_ForbiddenIP::~CUnit_ForbiddenIP() +CUnit_ForbiddenIP::CUnit_ForbiddenIP() { m_pForbiddenIP = NULL; } +CUnit_ForbiddenIP::CUnit_ForbiddenIP(const CUnit_ForbiddenIP& ar) +{ + (*this) = ar; +} + +CUnit_ForbiddenIP::~CUnit_ForbiddenIP() +{ +} + void CUnit_ForbiddenIP::setUp(void) { m_pForbiddenIP = new CForbiddenIP(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ForbiddenIP.h b/purenessscopeserver/FrameCore/CppUnit/Unit_ForbiddenIP.h index 8eedf51eb..927e46360 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ForbiddenIP.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ForbiddenIP.h @@ -13,8 +13,22 @@ class CUnit_ForbiddenIP : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ForbiddenIP(); + virtual ~CUnit_ForbiddenIP(); + CUnit_ForbiddenIP(const CUnit_ForbiddenIP& ar); + + CUnit_ForbiddenIP& operator = (const CUnit_ForbiddenIP& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_FrameCommand.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_FrameCommand.cpp index 87154a200..7e01febd7 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_FrameCommand.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_FrameCommand.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_FrameCommand::~CUnit_FrameCommand() +CUnit_FrameCommand::CUnit_FrameCommand() { + m_pFrameCommand = NULL; +} +CUnit_FrameCommand::CUnit_FrameCommand(const CUnit_FrameCommand& ar) +{ + (*this) = ar; +} + +CUnit_FrameCommand::~CUnit_FrameCommand() +{ } void CUnit_FrameCommand::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_FrameCommand.h b/purenessscopeserver/FrameCore/CppUnit/Unit_FrameCommand.h index 35cca454c..5004ebd41 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_FrameCommand.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_FrameCommand.h @@ -13,8 +13,22 @@ class CUnit_FrameCommand: public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_FrameCommand(); + virtual ~CUnit_FrameCommand(); + CUnit_FrameCommand(const CUnit_FrameCommand& ar); + + CUnit_FrameCommand& operator = (const CUnit_FrameCommand& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_IPAccount.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_IPAccount.cpp index a9c6a397a..41e5529e1 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_IPAccount.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_IPAccount.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_IPAccount::~CUnit_IPAccount() +CUnit_IPAccount::CUnit_IPAccount() { + m_pIPAccount = NULL; +} +CUnit_IPAccount::CUnit_IPAccount(const CUnit_IPAccount& ar) +{ + (*this) = ar; +} + +CUnit_IPAccount::~CUnit_IPAccount() +{ } void CUnit_IPAccount::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_IPAccount.h b/purenessscopeserver/FrameCore/CppUnit/Unit_IPAccount.h index 8948b8f03..047b7802e 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_IPAccount.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_IPAccount.h @@ -17,8 +17,22 @@ class CUnit_IPAccount : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_IPAccount(); + virtual ~CUnit_IPAccount(); + CUnit_IPAccount(const CUnit_IPAccount& ar); + + CUnit_IPAccount& operator = (const CUnit_IPAccount& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_LoadModule.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_LoadModule.cpp index 79f48efee..cca0ad6dc 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_LoadModule.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_LoadModule.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_LoadModule::~CUnit_LoadModule() +CUnit_LoadModule::CUnit_LoadModule() { + m_szModuleName[0] = '\0'; +} +CUnit_LoadModule::CUnit_LoadModule(const CUnit_LoadModule& ar) +{ + (*this) = ar; +} + +CUnit_LoadModule::~CUnit_LoadModule() +{ } void CUnit_LoadModule::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_LoadModule.h b/purenessscopeserver/FrameCore/CppUnit/Unit_LoadModule.h index d6cd89313..fb6a522cc 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_LoadModule.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_LoadModule.h @@ -13,8 +13,22 @@ class CUnit_LoadModule : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_LoadModule(); + virtual ~CUnit_LoadModule(); + CUnit_LoadModule(const CUnit_LoadModule& ar); + + CUnit_LoadModule& operator = (const CUnit_LoadModule& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_Logging.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_Logging.cpp index 8782860e9..a8dc4c91b 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_Logging.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_Logging.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_Frame_Logging::~CUnit_Frame_Logging() +CUnit_Frame_Logging::CUnit_Frame_Logging() { + m_pFrameLoggingStrategy = NULL; +} +CUnit_Frame_Logging::CUnit_Frame_Logging(const CUnit_Frame_Logging& ar) +{ + (*this) = ar; +} + +CUnit_Frame_Logging::~CUnit_Frame_Logging() +{ } void CUnit_Frame_Logging::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_Logging.h b/purenessscopeserver/FrameCore/CppUnit/Unit_Logging.h index bd880d9f5..95b87990c 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_Logging.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_Logging.h @@ -14,8 +14,22 @@ class CUnit_Frame_Logging : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_Frame_Logging(); + virtual ~CUnit_Frame_Logging(); + CUnit_Frame_Logging(const CUnit_Frame_Logging& ar); + + CUnit_Frame_Logging& operator = (const CUnit_Frame_Logging& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_LogicThreadManager.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_LogicThreadManager.cpp new file mode 100644 index 000000000..2eccf2e1b --- /dev/null +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_LogicThreadManager.cpp @@ -0,0 +1,89 @@ +#include "Unit_LogicThreadManager.h" + +#ifdef _CPPUNIT_TEST + +void Test_LogicThreadInit(int nLogicThread) +{ + OUR_DEBUG((LM_INFO, "[Test_LogicThreadInit]Init LogicThread=%d.\n", nLogicThread)); +} + +ThreadReturn Test_LogicThreadCallbackLogic(int nLogicThread, int nMessage, void* arg) +{ + ACE_UNUSED_ARG(arg); + + OUR_DEBUG((LM_INFO, "[Test_LogicThreadCallbackLogic]LogicThread=%d, nMessage=%d.\n", nLogicThread, nMessage)); + + return THREAD_Task_Finish; +} + +void Test_LogicThreadErrorLogic(int nLogicThread, int nErrorID) +{ + OUR_DEBUG((LM_INFO, "[Test_LogicThreadErrorLogic]LogicThread=%d, nErrorID=%d.\n", nLogicThread, nErrorID)); +} + +void Test_LogicThreadExit(int nLogicThread) +{ + OUR_DEBUG((LM_INFO, "[Test_LogicThreadExit]LogicThread=%d.\n", nLogicThread)); +} + +CUnit_LogicThreadManager::CUnit_LogicThreadManager() +{ + m_nMessage = 1000; +} + +CUnit_LogicThreadManager::CUnit_LogicThreadManager(const CUnit_LogicThreadManager& ar) +{ + (*this) = ar; +} + +CUnit_LogicThreadManager::~CUnit_LogicThreadManager() +{ +} + +void CUnit_LogicThreadManager::setUp(void) +{ +} + +void CUnit_LogicThreadManager::tearDown(void) +{ +} + +void CUnit_LogicThreadManager::Test_LogicThreadManager(void) +{ + bool blRet = false; + int nRet = App_LogicThreadManager::instance()->CreateLogicThread(1, + 120, + Test_LogicThreadInit, + Test_LogicThreadCallbackLogic, + Test_LogicThreadErrorLogic, + Test_LogicThreadExit); + + if (0 != nRet) + { + blRet = true; + CPPUNIT_ASSERT_MESSAGE("[Test_TimerManager]CreateLogicThread is fail.", true == blRet); + } + + nRet = App_LogicThreadManager::instance()->MessageMappingLogicThread(1, m_nMessage); + + if (0 != nRet) + { + blRet = true; + CPPUNIT_ASSERT_MESSAGE("[Test_TimerManager]MessageMappingLogicThread is fail.", true == blRet); + } + + nRet = App_LogicThreadManager::instance()->SendLogicThreadMessage(m_nMessage, NULL); + + if (0 != nRet) + { + blRet = true; + CPPUNIT_ASSERT_MESSAGE("[Test_TimerManager]SendLogicThreadMessage is fail.", true == blRet); + } + + ACE_Time_Value tvSleep(0, 1000); + ACE_OS::sleep(tvSleep); + + OUR_DEBUG((LM_INFO, "[CUnit_LogicThreadManager]objActiveTimer is close.\n")); +} + +#endif diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_LogicThreadManager.h b/purenessscopeserver/FrameCore/CppUnit/Unit_LogicThreadManager.h new file mode 100644 index 000000000..09db68761 --- /dev/null +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_LogicThreadManager.h @@ -0,0 +1,58 @@ +#ifndef _UNIT_LOGICTHREADMANAGER_H +#define _UNIT_LOGICTHREADMANAGER_H + +#ifdef _CPPUNIT_TEST + +#include "Unit_Common.h" +#include "define.h" +#include "LogicThreadManager.h" + + +//ʼ߼߳ +void Test_LogicThreadInit(int nLogicThread); + +//߳Ϣ(Ϊ߳ID, ϢID, ָ) +ThreadReturn Test_LogicThreadCallbackLogic(int nLogicThread, int nMessage, void* arg); + +//̴߳ص(߳ID, ID) +void Test_LogicThreadErrorLogic(int nLogicThread, int nErrorID); + +//߳˳ +void Test_LogicThreadExit(int nLogicThread); + +class CUnit_LogicThreadManager : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE(CUnit_LogicThreadManager); + CPPUNIT_TEST(Test_LogicThreadManager); + CPPUNIT_TEST_SUITE_END(); + +public: + CUnit_LogicThreadManager(); + + virtual ~CUnit_LogicThreadManager(); + + CUnit_LogicThreadManager(const CUnit_LogicThreadManager& ar); + + CUnit_LogicThreadManager& operator = (const CUnit_LogicThreadManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + + virtual void setUp(void); + + virtual void tearDown(void); + + void Test_LogicThreadManager(void); + +private: + int m_nMessage; +}; + +#endif + +#endif diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_MakePacket.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_MakePacket.cpp index 277039b4b..bda2af967 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_MakePacket.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_MakePacket.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_MakePacket::~CUnit_MakePacket() +CUnit_MakePacket::CUnit_MakePacket() { m_pMakePacket = NULL; } +CUnit_MakePacket::CUnit_MakePacket(const CUnit_MakePacket& ar) +{ + (*this) = ar; +} + +CUnit_MakePacket::~CUnit_MakePacket() +{ +} + void CUnit_MakePacket::setUp(void) { m_pMakePacket = new CMakePacket(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_MakePacket.h b/purenessscopeserver/FrameCore/CppUnit/Unit_MakePacket.h index 54f155720..5afb04699 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_MakePacket.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_MakePacket.h @@ -13,8 +13,22 @@ class CUnit_MakePacket : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_MakePacket(); + virtual ~CUnit_MakePacket(); + CUnit_MakePacket(const CUnit_MakePacket& ar); + + CUnit_MakePacket& operator = (const CUnit_MakePacket& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDefine.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDefine.cpp index 861247642..ca7175b47 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDefine.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDefine.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_MessageDefine::~CUnit_MessageDefine() +CUnit_MessageDefine::CUnit_MessageDefine() +{ + m_nMessageDefine = 0; +} + +CUnit_MessageDefine::CUnit_MessageDefine(const CUnit_MessageDefine& ar) { + (*this) = ar; +} +CUnit_MessageDefine::~CUnit_MessageDefine() +{ } void CUnit_MessageDefine::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDefine.h b/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDefine.h index b6d5d89c3..3949007fa 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDefine.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDefine.h @@ -22,8 +22,22 @@ class CUnit_MessageDefine : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_MessageDefine(); + virtual ~CUnit_MessageDefine(); + CUnit_MessageDefine(const CUnit_MessageDefine& ar); + + CUnit_MessageDefine& operator = (const CUnit_MessageDefine& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDyeingManager.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDyeingManager.cpp index 56e7b7bd1..33f2bd2dd 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDyeingManager.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDyeingManager.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_MessageDyeingManager::~CUnit_MessageDyeingManager() +CUnit_MessageDyeingManager::CUnit_MessageDyeingManager() { m_pMessageDyeingManager = NULL; } +CUnit_MessageDyeingManager::CUnit_MessageDyeingManager(const CUnit_MessageDyeingManager& ar) +{ + (*this) = ar; +} + +CUnit_MessageDyeingManager::~CUnit_MessageDyeingManager() +{ +} + void CUnit_MessageDyeingManager::setUp(void) { m_pMessageDyeingManager = new CMessageDyeingManager(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDyeingManager.h b/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDyeingManager.h index 211c33dfd..8f734e4ac 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDyeingManager.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_MessageDyeingManager.h @@ -13,8 +13,22 @@ class CUnit_MessageDyeingManager : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_MessageDyeingManager(); + virtual ~CUnit_MessageDyeingManager(); + CUnit_MessageDyeingManager(const CUnit_MessageDyeingManager& ar); + + CUnit_MessageDyeingManager& operator = (const CUnit_MessageDyeingManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ModuleMessageManager.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_ModuleMessageManager.cpp index 6e40e5261..27a239cf7 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ModuleMessageManager.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ModuleMessageManager.cpp @@ -2,9 +2,18 @@ #ifdef _CPPUNIT_TEST -CUnit_ModuleMessageManager::~CUnit_ModuleMessageManager() +CUnit_ModuleMessageManager::CUnit_ModuleMessageManager() +{ + m_pModuleMessageManager = NULL; +} + +CUnit_ModuleMessageManager::CUnit_ModuleMessageManager(const CUnit_ModuleMessageManager& ar) { + (*this) = ar; +} +CUnit_ModuleMessageManager::~CUnit_ModuleMessageManager() +{ } void CUnit_ModuleMessageManager::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ModuleMessageManager.h b/purenessscopeserver/FrameCore/CppUnit/Unit_ModuleMessageManager.h index 124771e3d..0cdb3d9e4 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ModuleMessageManager.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ModuleMessageManager.h @@ -14,8 +14,22 @@ class CUnit_ModuleMessageManager : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ModuleMessageManager(); + virtual ~CUnit_ModuleMessageManager(); + CUnit_ModuleMessageManager(const CUnit_ModuleMessageManager& ar); + + CUnit_ModuleMessageManager& operator = (const CUnit_ModuleMessageManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ProfileTime.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_ProfileTime.cpp index a6680c07e..17d7a7942 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ProfileTime.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ProfileTime.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_ProfileTime::~CUnit_ProfileTime() +CUnit_ProfileTime::CUnit_ProfileTime() { m_pProfileTime = NULL; } +CUnit_ProfileTime::CUnit_ProfileTime(const CUnit_ProfileTime& ar) +{ + (*this) = ar; +} + +CUnit_ProfileTime::~CUnit_ProfileTime() +{ +} + void CUnit_ProfileTime::setUp(void) { m_pProfileTime = new CProfileTime(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_ProfileTime.h b/purenessscopeserver/FrameCore/CppUnit/Unit_ProfileTime.h index 710518d62..fe93f2144 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_ProfileTime.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_ProfileTime.h @@ -13,8 +13,22 @@ class CUnit_ProfileTime : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_ProfileTime(); + virtual ~CUnit_ProfileTime(); + CUnit_ProfileTime(const CUnit_ProfileTime& ar); + + CUnit_ProfileTime& operator = (const CUnit_ProfileTime& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_TimeQueue.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_TimeQueue.cpp index 3a976d1cb..0e219b953 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_TimeQueue.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_TimeQueue.cpp @@ -22,9 +22,18 @@ int CTimeTask::handle_timeout(const ACE_Time_Value& tv, const void* arg) return 0; } -CUnit_TimerManager::~CUnit_TimerManager() +CUnit_TimerManager::CUnit_TimerManager() { + m_pTimeTask = NULL; +} +CUnit_TimerManager::CUnit_TimerManager(const CUnit_TimerManager& ar) +{ + (*this) = ar; +} + +CUnit_TimerManager::~CUnit_TimerManager() +{ } void CUnit_TimerManager::setUp(void) diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_TimeQueue.h b/purenessscopeserver/FrameCore/CppUnit/Unit_TimeQueue.h index aa0c32ef6..a94e17416 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_TimeQueue.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_TimeQueue.h @@ -23,8 +23,22 @@ class CUnit_TimerManager : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_TimerManager(); + virtual ~CUnit_TimerManager(); + CUnit_TimerManager(const CUnit_TimerManager& ar); + + CUnit_TimerManager& operator = (const CUnit_TimerManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_WorkThreadAI.cpp b/purenessscopeserver/FrameCore/CppUnit/Unit_WorkThreadAI.cpp index 11588ccd9..de2e41abb 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_WorkThreadAI.cpp +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_WorkThreadAI.cpp @@ -2,11 +2,20 @@ #ifdef _CPPUNIT_TEST -CUnit_WorkThreadAI::~CUnit_WorkThreadAI() +CUnit_WorkThreadAI::CUnit_WorkThreadAI() { m_pWorkThreadAI = NULL; } +CUnit_WorkThreadAI::CUnit_WorkThreadAI(const CUnit_WorkThreadAI& ar) +{ + (*this) = ar; +} + +CUnit_WorkThreadAI::~CUnit_WorkThreadAI() +{ +} + void CUnit_WorkThreadAI::setUp(void) { m_pWorkThreadAI = new CWorkThreadAI(); diff --git a/purenessscopeserver/FrameCore/CppUnit/Unit_WorkThreadAI.h b/purenessscopeserver/FrameCore/CppUnit/Unit_WorkThreadAI.h index dc1472531..aa6d6ece2 100644 --- a/purenessscopeserver/FrameCore/CppUnit/Unit_WorkThreadAI.h +++ b/purenessscopeserver/FrameCore/CppUnit/Unit_WorkThreadAI.h @@ -13,8 +13,22 @@ class CUnit_WorkThreadAI : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: + CUnit_WorkThreadAI(); + virtual ~CUnit_WorkThreadAI(); + CUnit_WorkThreadAI(const CUnit_WorkThreadAI& ar); + + CUnit_WorkThreadAI& operator = (const CUnit_WorkThreadAI& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual void setUp(void); virtual void tearDown(void); diff --git a/purenessscopeserver/FrameCore/FileTest/FileTestManager.cpp b/purenessscopeserver/FrameCore/FileTest/FileTestManager.cpp index 61c46f9c9..07fbdad33 100644 --- a/purenessscopeserver/FrameCore/FileTest/FileTestManager.cpp +++ b/purenessscopeserver/FrameCore/FileTest/FileTestManager.cpp @@ -12,6 +12,11 @@ CFileTestManager::CFileTestManager(void) m_u4TimeInterval = 0; } +CFileTestManager::CFileTestManager(const CFileTestManager& ar) +{ + (*this) = ar; +} + CFileTestManager::~CFileTestManager(void) { Close(); diff --git a/purenessscopeserver/FrameCore/FileTest/FileTestManager.h b/purenessscopeserver/FrameCore/FileTest/FileTestManager.h index 00b3b8389..183bcb2f7 100644 --- a/purenessscopeserver/FrameCore/FileTest/FileTestManager.h +++ b/purenessscopeserver/FrameCore/FileTest/FileTestManager.h @@ -22,6 +22,18 @@ class CFileTestManager : public ACE_Task, public IFileTestManager CFileTestManager(void); virtual ~CFileTestManager(void); + CFileTestManager(const CFileTestManager& ar); + + CFileTestManager& operator = (const CFileTestManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + //ļԷ FileTestResultInfoSt FileTestStart(const char* szXmlFileTestName); //ʼļ int FileTestEnd(); //ļ @@ -66,6 +78,10 @@ class CFileTestManager : public ACE_Task, public IFileTestManager Init(); } + ~ResponseRecordSt() + { + } + ResponseRecordSt(const ResponseRecordSt& ar) { this->m_u8StartTime = ar.m_u8StartTime; diff --git a/purenessscopeserver/FrameCore/LogSystem/FileLogger.cpp b/purenessscopeserver/FrameCore/LogSystem/FileLogger.cpp index 0ab8e5ef5..0de1ec8b1 100644 --- a/purenessscopeserver/FrameCore/LogSystem/FileLogger.cpp +++ b/purenessscopeserver/FrameCore/LogSystem/FileLogger.cpp @@ -451,6 +451,11 @@ CFileLogger::CFileLogger() m_szLogRoot[0] = '\0'; } +CFileLogger::CFileLogger(const CFileLogger& ar) +{ + (*this) = ar; +} + CFileLogger::~CFileLogger() { OUR_DEBUG((LM_INFO, "[CFileLogger::~CFileLogger].\n")); diff --git a/purenessscopeserver/FrameCore/LogSystem/FileLogger.h b/purenessscopeserver/FrameCore/LogSystem/FileLogger.h index 5ee638c7d..0b9107048 100644 --- a/purenessscopeserver/FrameCore/LogSystem/FileLogger.h +++ b/purenessscopeserver/FrameCore/LogSystem/FileLogger.h @@ -190,7 +190,19 @@ class CFileLogger : public IServerLogger { public: CFileLogger(); - ~CFileLogger(); + virtual ~CFileLogger(); + + CFileLogger(const CFileLogger& ar); + + CFileLogger& operator = (const CFileLogger& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } int DoLog(int nLogType, _LogBlockInfo* pLogBlockInfo); int GetLogTypeCount(); diff --git a/purenessscopeserver/FrameCore/LogSystem/LogManager.cpp b/purenessscopeserver/FrameCore/LogSystem/LogManager.cpp index 35d5758c0..3cbb56324 100644 --- a/purenessscopeserver/FrameCore/LogSystem/LogManager.cpp +++ b/purenessscopeserver/FrameCore/LogSystem/LogManager.cpp @@ -18,6 +18,11 @@ CLogBlockPool::CLogBlockPool() m_u4CurrIndex = 0; } +CLogBlockPool::CLogBlockPool(const CLogBlockPool& ar) +{ + (*this) = ar; +} + CLogBlockPool::~CLogBlockPool() { Close(); @@ -107,6 +112,11 @@ CLogManager::CLogManager(void):m_mutex(), m_cond(m_mutex) m_blIsMail = false; } +CLogManager::CLogManager(const CLogManager& ar) : CLogManager() +{ + (*this) = ar; +} + CLogManager::~CLogManager(void) { OUR_DEBUG((LM_ERROR,"[CLogManager::~CLogManager].\n")); diff --git a/purenessscopeserver/FrameCore/LogSystem/LogManager.h b/purenessscopeserver/FrameCore/LogSystem/LogManager.h index 991471cf7..0613a56b7 100644 --- a/purenessscopeserver/FrameCore/LogSystem/LogManager.h +++ b/purenessscopeserver/FrameCore/LogSystem/LogManager.h @@ -18,6 +18,18 @@ class CLogBlockPool CLogBlockPool(); ~CLogBlockPool(); + CLogBlockPool(const CLogBlockPool& ar); + + CLogBlockPool& operator = (const CLogBlockPool& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Init(uint32 u4BlockSize, uint32 u4PoolCount); void Close(); @@ -37,7 +49,19 @@ class CLogManager : public ACE_Task, public ILogManager { public: CLogManager(void); - ~CLogManager(void); + virtual ~CLogManager(void); + + CLogManager(const CLogManager& ar); + + CLogManager& operator = (const CLogManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } virtual int open (void* args = 0); virtual int svc(void); diff --git a/purenessscopeserver/FrameCore/Makefile b/purenessscopeserver/FrameCore/Makefile new file mode 100644 index 000000000..2a7da018d --- /dev/null +++ b/purenessscopeserver/FrameCore/Makefile @@ -0,0 +1,756 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PurenessScopeServer +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../purenessscopeserver/FrameCore +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PurenessScopeServer.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../purenessscopeserver/Common $(IncludeSwitch)./Common $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)./Mail $(IncludeSwitch)./Message $(IncludeSwitch)./LogSystem $(IncludeSwitch)./Reactor $(IncludeSwitch)./PacketParse $(IncludeSwitch)./FileTest $(IncludeSwitch)./UDP $(IncludeSwitch)./Console +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)ACE $(LibrarySwitch)dl $(LibrarySwitch)pthread +ArLibs := "libACE.so" "libdl.so" "libpthread.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ $(LibraryPathSwitch)/usr/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_ACEMemory.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_RandomNumber.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_Time_Value.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_TimerThread.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BuffPacket.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BuffPacketManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_CommandAccount.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Common_ForbiddenIP.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_Threading.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_IPAccount.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_MessageBlockManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_ServerMessageTask.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_ThreadInfo.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_TimerManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_WindowsProcess.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseTask.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Common_XmlConfig.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_TimerInfo.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_WindowsCPU.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseServerManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_LogicThreadManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_SendCacheManager.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(ObjectSuffix) $(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_LinuxCPU.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_ProgramService.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseHander.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_MakePacket.cpp$(ObjectSuffix) + +Objects1=$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_Message.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Common_AppConfig.cpp$(ObjectSuffix) $(IntermediateDirectory)/FileTest_FileTestManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_MessageDefine.cpp$(ObjectSuffix) $(IntermediateDirectory)/PacketParse_PacketParse.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_ProfileTime.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseConnectClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConnectClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ServerManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_ConsolePromiss.cpp$(ObjectSuffix) $(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Message_MessageManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Mail_smtps.cpp$(ObjectSuffix) $(IntermediateDirectory)/LogSystem_LogManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/PurenessScopeServer.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_SendMessage.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Reactor_ControlListen.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_TcpRedirection.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/LogSystem_FileLogger.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_WorkThreadAI.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_MessageService.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_LoadPacketParse.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_LoadModule.cpp$(ObjectSuffix) $(IntermediateDirectory)/Mail_base64.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_MessageDispose.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) + +Objects2=$(IntermediateDirectory)/Mail_smtp.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_FrameCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_ConsoleMessage.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_XmlOpeation.cpp$(ObjectSuffix) \ + + + + +Objects=$(Objects0) $(Objects1) $(Objects2) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + @echo $(Objects1) >> $(ObjectsFileList) + @echo $(Objects2) >> $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(ObjectSuffix): ../Common/ACEMemory.cpp $(IntermediateDirectory)/up_Common_ACEMemory.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../Common/ACEMemory.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(DependSuffix): ../Common/ACEMemory.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(DependSuffix) -MM ../Common/ACEMemory.cpp + +$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(PreprocessSuffix): ../Common/ACEMemory.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_ACEMemory.cpp$(PreprocessSuffix) ../Common/ACEMemory.cpp + +$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(ObjectSuffix): ../Common/RandomNumber.cpp $(IntermediateDirectory)/up_Common_RandomNumber.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../Common/RandomNumber.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(DependSuffix): ../Common/RandomNumber.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(DependSuffix) -MM ../Common/RandomNumber.cpp + +$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(PreprocessSuffix): ../Common/RandomNumber.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_RandomNumber.cpp$(PreprocessSuffix) ../Common/RandomNumber.cpp + +$(IntermediateDirectory)/up_Common_Time_Value.cpp$(ObjectSuffix): ../Common/Time_Value.cpp $(IntermediateDirectory)/up_Common_Time_Value.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../Common/Time_Value.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_Time_Value.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_Time_Value.cpp$(DependSuffix): ../Common/Time_Value.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_Time_Value.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_Time_Value.cpp$(DependSuffix) -MM ../Common/Time_Value.cpp + +$(IntermediateDirectory)/up_Common_Time_Value.cpp$(PreprocessSuffix): ../Common/Time_Value.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_Time_Value.cpp$(PreprocessSuffix) ../Common/Time_Value.cpp + +$(IntermediateDirectory)/up_Common_TimerThread.cpp$(ObjectSuffix): ../Common/TimerThread.cpp $(IntermediateDirectory)/up_Common_TimerThread.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../Common/TimerThread.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_TimerThread.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_TimerThread.cpp$(DependSuffix): ../Common/TimerThread.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_TimerThread.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_TimerThread.cpp$(DependSuffix) -MM ../Common/TimerThread.cpp + +$(IntermediateDirectory)/up_Common_TimerThread.cpp$(PreprocessSuffix): ../Common/TimerThread.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_TimerThread.cpp$(PreprocessSuffix) ../Common/TimerThread.cpp + +$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(ObjectSuffix): Common/BaseConsoleHandle.cpp $(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/BaseConsoleHandle.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(DependSuffix): Common/BaseConsoleHandle.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(DependSuffix) -MM Common/BaseConsoleHandle.cpp + +$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(PreprocessSuffix): Common/BaseConsoleHandle.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(PreprocessSuffix) Common/BaseConsoleHandle.cpp + +$(IntermediateDirectory)/Common_BuffPacket.cpp$(ObjectSuffix): Common/BuffPacket.cpp $(IntermediateDirectory)/Common_BuffPacket.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/BuffPacket.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BuffPacket.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BuffPacket.cpp$(DependSuffix): Common/BuffPacket.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BuffPacket.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BuffPacket.cpp$(DependSuffix) -MM Common/BuffPacket.cpp + +$(IntermediateDirectory)/Common_BuffPacket.cpp$(PreprocessSuffix): Common/BuffPacket.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BuffPacket.cpp$(PreprocessSuffix) Common/BuffPacket.cpp + +$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(ObjectSuffix): Common/BuffPacketManager.cpp $(IntermediateDirectory)/Common_BuffPacketManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/BuffPacketManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(DependSuffix): Common/BuffPacketManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(DependSuffix) -MM Common/BuffPacketManager.cpp + +$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(PreprocessSuffix): Common/BuffPacketManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BuffPacketManager.cpp$(PreprocessSuffix) Common/BuffPacketManager.cpp + +$(IntermediateDirectory)/Common_CommandAccount.cpp$(ObjectSuffix): Common/CommandAccount.cpp $(IntermediateDirectory)/Common_CommandAccount.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/CommandAccount.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_CommandAccount.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_CommandAccount.cpp$(DependSuffix): Common/CommandAccount.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_CommandAccount.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_CommandAccount.cpp$(DependSuffix) -MM Common/CommandAccount.cpp + +$(IntermediateDirectory)/Common_CommandAccount.cpp$(PreprocessSuffix): Common/CommandAccount.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_CommandAccount.cpp$(PreprocessSuffix) Common/CommandAccount.cpp + +$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(ObjectSuffix): Common/ForbiddenIP.cpp $(IntermediateDirectory)/Common_ForbiddenIP.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/ForbiddenIP.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(DependSuffix): Common/ForbiddenIP.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(DependSuffix) -MM Common/ForbiddenIP.cpp + +$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(PreprocessSuffix): Common/ForbiddenIP.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ForbiddenIP.cpp$(PreprocessSuffix) Common/ForbiddenIP.cpp + +$(IntermediateDirectory)/up_Common_Threading.cpp$(ObjectSuffix): ../Common/Threading.cpp $(IntermediateDirectory)/up_Common_Threading.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../Common/Threading.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_Threading.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_Threading.cpp$(DependSuffix): ../Common/Threading.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_Threading.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_Threading.cpp$(DependSuffix) -MM ../Common/Threading.cpp + +$(IntermediateDirectory)/up_Common_Threading.cpp$(PreprocessSuffix): ../Common/Threading.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_Threading.cpp$(PreprocessSuffix) ../Common/Threading.cpp + +$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(ObjectSuffix): Common/Frame_Logging_Strategy.cpp $(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/Frame_Logging_Strategy.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(DependSuffix): Common/Frame_Logging_Strategy.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(DependSuffix) -MM Common/Frame_Logging_Strategy.cpp + +$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(PreprocessSuffix): Common/Frame_Logging_Strategy.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(PreprocessSuffix) Common/Frame_Logging_Strategy.cpp + +$(IntermediateDirectory)/Common_IPAccount.cpp$(ObjectSuffix): Common/IPAccount.cpp $(IntermediateDirectory)/Common_IPAccount.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/IPAccount.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_IPAccount.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_IPAccount.cpp$(DependSuffix): Common/IPAccount.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_IPAccount.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_IPAccount.cpp$(DependSuffix) -MM Common/IPAccount.cpp + +$(IntermediateDirectory)/Common_IPAccount.cpp$(PreprocessSuffix): Common/IPAccount.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_IPAccount.cpp$(PreprocessSuffix) Common/IPAccount.cpp + +$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(ObjectSuffix): Common/MessageBlockManager.cpp $(IntermediateDirectory)/Common_MessageBlockManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/MessageBlockManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(DependSuffix): Common/MessageBlockManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(DependSuffix) -MM Common/MessageBlockManager.cpp + +$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(PreprocessSuffix): Common/MessageBlockManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_MessageBlockManager.cpp$(PreprocessSuffix) Common/MessageBlockManager.cpp + +$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(ObjectSuffix): Common/ServerMessageTask.cpp $(IntermediateDirectory)/Common_ServerMessageTask.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/ServerMessageTask.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(DependSuffix): Common/ServerMessageTask.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(DependSuffix) -MM Common/ServerMessageTask.cpp + +$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(PreprocessSuffix): Common/ServerMessageTask.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ServerMessageTask.cpp$(PreprocessSuffix) Common/ServerMessageTask.cpp + +$(IntermediateDirectory)/Common_ThreadInfo.cpp$(ObjectSuffix): Common/ThreadInfo.cpp $(IntermediateDirectory)/Common_ThreadInfo.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/ThreadInfo.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ThreadInfo.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ThreadInfo.cpp$(DependSuffix): Common/ThreadInfo.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ThreadInfo.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ThreadInfo.cpp$(DependSuffix) -MM Common/ThreadInfo.cpp + +$(IntermediateDirectory)/Common_ThreadInfo.cpp$(PreprocessSuffix): Common/ThreadInfo.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ThreadInfo.cpp$(PreprocessSuffix) Common/ThreadInfo.cpp + +$(IntermediateDirectory)/Common_TimerManager.cpp$(ObjectSuffix): Common/TimerManager.cpp $(IntermediateDirectory)/Common_TimerManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/TimerManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_TimerManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_TimerManager.cpp$(DependSuffix): Common/TimerManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_TimerManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_TimerManager.cpp$(DependSuffix) -MM Common/TimerManager.cpp + +$(IntermediateDirectory)/Common_TimerManager.cpp$(PreprocessSuffix): Common/TimerManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_TimerManager.cpp$(PreprocessSuffix) Common/TimerManager.cpp + +$(IntermediateDirectory)/Common_WindowsProcess.cpp$(ObjectSuffix): Common/WindowsProcess.cpp $(IntermediateDirectory)/Common_WindowsProcess.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/WindowsProcess.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_WindowsProcess.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_WindowsProcess.cpp$(DependSuffix): Common/WindowsProcess.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_WindowsProcess.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_WindowsProcess.cpp$(DependSuffix) -MM Common/WindowsProcess.cpp + +$(IntermediateDirectory)/Common_WindowsProcess.cpp$(PreprocessSuffix): Common/WindowsProcess.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_WindowsProcess.cpp$(PreprocessSuffix) Common/WindowsProcess.cpp + +$(IntermediateDirectory)/Common_BaseTask.cpp$(ObjectSuffix): Common/BaseTask.cpp $(IntermediateDirectory)/Common_BaseTask.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/BaseTask.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseTask.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseTask.cpp$(DependSuffix): Common/BaseTask.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseTask.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseTask.cpp$(DependSuffix) -MM Common/BaseTask.cpp + +$(IntermediateDirectory)/Common_BaseTask.cpp$(PreprocessSuffix): Common/BaseTask.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseTask.cpp$(PreprocessSuffix) Common/BaseTask.cpp + +$(IntermediateDirectory)/Common_XmlConfig.cpp$(ObjectSuffix): Common/XmlConfig.cpp $(IntermediateDirectory)/Common_XmlConfig.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/XmlConfig.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_XmlConfig.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_XmlConfig.cpp$(DependSuffix): Common/XmlConfig.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_XmlConfig.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_XmlConfig.cpp$(DependSuffix) -MM Common/XmlConfig.cpp + +$(IntermediateDirectory)/Common_XmlConfig.cpp$(PreprocessSuffix): Common/XmlConfig.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_XmlConfig.cpp$(PreprocessSuffix) Common/XmlConfig.cpp + +$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(ObjectSuffix): ../Common/TimerInfo.cpp $(IntermediateDirectory)/up_Common_TimerInfo.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../Common/TimerInfo.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(DependSuffix): ../Common/TimerInfo.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(DependSuffix) -MM ../Common/TimerInfo.cpp + +$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(PreprocessSuffix): ../Common/TimerInfo.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_TimerInfo.cpp$(PreprocessSuffix) ../Common/TimerInfo.cpp + +$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(ObjectSuffix): Message/MessageDyeingManager.cpp $(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/MessageDyeingManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(DependSuffix): Message/MessageDyeingManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(DependSuffix) -MM Message/MessageDyeingManager.cpp + +$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(PreprocessSuffix): Message/MessageDyeingManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(PreprocessSuffix) Message/MessageDyeingManager.cpp + +$(IntermediateDirectory)/Common_WindowsCPU.cpp$(ObjectSuffix): Common/WindowsCPU.cpp $(IntermediateDirectory)/Common_WindowsCPU.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/WindowsCPU.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_WindowsCPU.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_WindowsCPU.cpp$(DependSuffix): Common/WindowsCPU.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_WindowsCPU.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_WindowsCPU.cpp$(DependSuffix) -MM Common/WindowsCPU.cpp + +$(IntermediateDirectory)/Common_WindowsCPU.cpp$(PreprocessSuffix): Common/WindowsCPU.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_WindowsCPU.cpp$(PreprocessSuffix) Common/WindowsCPU.cpp + +$(IntermediateDirectory)/Common_BaseServerManager.cpp$(ObjectSuffix): Common/BaseServerManager.cpp $(IntermediateDirectory)/Common_BaseServerManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/BaseServerManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseServerManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseServerManager.cpp$(DependSuffix): Common/BaseServerManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseServerManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseServerManager.cpp$(DependSuffix) -MM Common/BaseServerManager.cpp + +$(IntermediateDirectory)/Common_BaseServerManager.cpp$(PreprocessSuffix): Common/BaseServerManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseServerManager.cpp$(PreprocessSuffix) Common/BaseServerManager.cpp + +$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(ObjectSuffix): PacketParse/PacketConsoleParse.cpp $(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PacketParse/PacketConsoleParse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(DependSuffix): PacketParse/PacketConsoleParse.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(DependSuffix) -MM PacketParse/PacketConsoleParse.cpp + +$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(PreprocessSuffix): PacketParse/PacketConsoleParse.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(PreprocessSuffix) PacketParse/PacketConsoleParse.cpp + +$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(ObjectSuffix): Message/LogicThreadManager.cpp $(IntermediateDirectory)/Message_LogicThreadManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/LogicThreadManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(DependSuffix): Message/LogicThreadManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(DependSuffix) -MM Message/LogicThreadManager.cpp + +$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(PreprocessSuffix): Message/LogicThreadManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_LogicThreadManager.cpp$(PreprocessSuffix) Message/LogicThreadManager.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(ObjectSuffix): Common/BaseClientConnectManager.cpp $(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/BaseClientConnectManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(DependSuffix): Common/BaseClientConnectManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(DependSuffix) -MM Common/BaseClientConnectManager.cpp + +$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(PreprocessSuffix): Common/BaseClientConnectManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(PreprocessSuffix) Common/BaseClientConnectManager.cpp + +$(IntermediateDirectory)/Common_SendCacheManager.cpp$(ObjectSuffix): Common/SendCacheManager.cpp $(IntermediateDirectory)/Common_SendCacheManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/SendCacheManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_SendCacheManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_SendCacheManager.cpp$(DependSuffix): Common/SendCacheManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_SendCacheManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_SendCacheManager.cpp$(DependSuffix) -MM Common/SendCacheManager.cpp + +$(IntermediateDirectory)/Common_SendCacheManager.cpp$(PreprocessSuffix): Common/SendCacheManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_SendCacheManager.cpp$(PreprocessSuffix) Common/SendCacheManager.cpp + +$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(ObjectSuffix): Reactor/AceReactorManager.cpp $(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/AceReactorManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(DependSuffix): Reactor/AceReactorManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(DependSuffix) -MM Reactor/AceReactorManager.cpp + +$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(PreprocessSuffix): Reactor/AceReactorManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(PreprocessSuffix) Reactor/AceReactorManager.cpp + +$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(ObjectSuffix): Common/MyACELoggingStrategy.cpp $(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/MyACELoggingStrategy.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(DependSuffix): Common/MyACELoggingStrategy.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(DependSuffix) -MM Common/MyACELoggingStrategy.cpp + +$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(PreprocessSuffix): Common/MyACELoggingStrategy.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(PreprocessSuffix) Common/MyACELoggingStrategy.cpp + +$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(ObjectSuffix): PacketParse/PacketParsePool.cpp $(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PacketParse/PacketParsePool.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(DependSuffix): PacketParse/PacketParsePool.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(DependSuffix) -MM PacketParse/PacketParsePool.cpp + +$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(PreprocessSuffix): PacketParse/PacketParsePool.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(PreprocessSuffix) PacketParse/PacketParsePool.cpp + +$(IntermediateDirectory)/Common_LinuxCPU.cpp$(ObjectSuffix): Common/LinuxCPU.cpp $(IntermediateDirectory)/Common_LinuxCPU.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/LinuxCPU.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_LinuxCPU.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_LinuxCPU.cpp$(DependSuffix): Common/LinuxCPU.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_LinuxCPU.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_LinuxCPU.cpp$(DependSuffix) -MM Common/LinuxCPU.cpp + +$(IntermediateDirectory)/Common_LinuxCPU.cpp$(PreprocessSuffix): Common/LinuxCPU.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_LinuxCPU.cpp$(PreprocessSuffix) Common/LinuxCPU.cpp + +$(IntermediateDirectory)/Common_ProgramService.cpp$(ObjectSuffix): Common/ProgramService.cpp $(IntermediateDirectory)/Common_ProgramService.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/ProgramService.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ProgramService.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ProgramService.cpp$(DependSuffix): Common/ProgramService.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ProgramService.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ProgramService.cpp$(DependSuffix) -MM Common/ProgramService.cpp + +$(IntermediateDirectory)/Common_ProgramService.cpp$(PreprocessSuffix): Common/ProgramService.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ProgramService.cpp$(PreprocessSuffix) Common/ProgramService.cpp + +$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(ObjectSuffix): Reactor/ConsoleHandler.cpp $(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ConsoleHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(DependSuffix): Reactor/ConsoleHandler.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(DependSuffix) -MM Reactor/ConsoleHandler.cpp + +$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(PreprocessSuffix): Reactor/ConsoleHandler.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(PreprocessSuffix) Reactor/ConsoleHandler.cpp + +$(IntermediateDirectory)/Common_BaseHander.cpp$(ObjectSuffix): Common/BaseHander.cpp $(IntermediateDirectory)/Common_BaseHander.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/BaseHander.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseHander.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseHander.cpp$(DependSuffix): Common/BaseHander.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseHander.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseHander.cpp$(DependSuffix) -MM Common/BaseHander.cpp + +$(IntermediateDirectory)/Common_BaseHander.cpp$(PreprocessSuffix): Common/BaseHander.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseHander.cpp$(PreprocessSuffix) Common/BaseHander.cpp + +$(IntermediateDirectory)/Common_MakePacket.cpp$(ObjectSuffix): Common/MakePacket.cpp $(IntermediateDirectory)/Common_MakePacket.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/MakePacket.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_MakePacket.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_MakePacket.cpp$(DependSuffix): Common/MakePacket.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_MakePacket.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_MakePacket.cpp$(DependSuffix) -MM Common/MakePacket.cpp + +$(IntermediateDirectory)/Common_MakePacket.cpp$(PreprocessSuffix): Common/MakePacket.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_MakePacket.cpp$(PreprocessSuffix) Common/MakePacket.cpp + +$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(ObjectSuffix): Reactor/WaitQuitSignal.cpp $(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/WaitQuitSignal.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(DependSuffix): Reactor/WaitQuitSignal.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(DependSuffix) -MM Reactor/WaitQuitSignal.cpp + +$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(PreprocessSuffix): Reactor/WaitQuitSignal.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(PreprocessSuffix) Reactor/WaitQuitSignal.cpp + +$(IntermediateDirectory)/Message_Message.cpp$(ObjectSuffix): Message/Message.cpp $(IntermediateDirectory)/Message_Message.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/Message.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_Message.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_Message.cpp$(DependSuffix): Message/Message.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_Message.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_Message.cpp$(DependSuffix) -MM Message/Message.cpp + +$(IntermediateDirectory)/Message_Message.cpp$(PreprocessSuffix): Message/Message.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_Message.cpp$(PreprocessSuffix) Message/Message.cpp + +$(IntermediateDirectory)/Common_AppConfig.cpp$(ObjectSuffix): Common/AppConfig.cpp $(IntermediateDirectory)/Common_AppConfig.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/AppConfig.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_AppConfig.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_AppConfig.cpp$(DependSuffix): Common/AppConfig.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_AppConfig.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_AppConfig.cpp$(DependSuffix) -MM Common/AppConfig.cpp + +$(IntermediateDirectory)/Common_AppConfig.cpp$(PreprocessSuffix): Common/AppConfig.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_AppConfig.cpp$(PreprocessSuffix) Common/AppConfig.cpp + +$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(ObjectSuffix): FileTest/FileTestManager.cpp $(IntermediateDirectory)/FileTest_FileTestManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./FileTest/FileTestManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(DependSuffix): FileTest/FileTestManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(DependSuffix) -MM FileTest/FileTestManager.cpp + +$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(PreprocessSuffix): FileTest/FileTestManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/FileTest_FileTestManager.cpp$(PreprocessSuffix) FileTest/FileTestManager.cpp + +$(IntermediateDirectory)/Console_MessageDefine.cpp$(ObjectSuffix): Console/MessageDefine.cpp $(IntermediateDirectory)/Console_MessageDefine.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Console/MessageDefine.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_MessageDefine.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_MessageDefine.cpp$(DependSuffix): Console/MessageDefine.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_MessageDefine.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_MessageDefine.cpp$(DependSuffix) -MM Console/MessageDefine.cpp + +$(IntermediateDirectory)/Console_MessageDefine.cpp$(PreprocessSuffix): Console/MessageDefine.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_MessageDefine.cpp$(PreprocessSuffix) Console/MessageDefine.cpp + +$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(ObjectSuffix): PacketParse/PacketParse.cpp $(IntermediateDirectory)/PacketParse_PacketParse.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PacketParse/PacketParse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(DependSuffix): PacketParse/PacketParse.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(DependSuffix) -MM PacketParse/PacketParse.cpp + +$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(PreprocessSuffix): PacketParse/PacketParse.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_PacketParse.cpp$(PreprocessSuffix) PacketParse/PacketParse.cpp + +$(IntermediateDirectory)/Common_ProfileTime.cpp$(ObjectSuffix): Common/ProfileTime.cpp $(IntermediateDirectory)/Common_ProfileTime.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/ProfileTime.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ProfileTime.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ProfileTime.cpp$(DependSuffix): Common/ProfileTime.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ProfileTime.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ProfileTime.cpp$(DependSuffix) -MM Common/ProfileTime.cpp + +$(IntermediateDirectory)/Common_ProfileTime.cpp$(PreprocessSuffix): Common/ProfileTime.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ProfileTime.cpp$(PreprocessSuffix) Common/ProfileTime.cpp + +$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(ObjectSuffix): Common/BaseConnectClient.cpp $(IntermediateDirectory)/Common_BaseConnectClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/BaseConnectClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(DependSuffix): Common/BaseConnectClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(DependSuffix) -MM Common/BaseConnectClient.cpp + +$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(PreprocessSuffix): Common/BaseConnectClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseConnectClient.cpp$(PreprocessSuffix) Common/BaseConnectClient.cpp + +$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(ObjectSuffix): Reactor/ConnectClient.cpp $(IntermediateDirectory)/Reactor_ConnectClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ConnectClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(DependSuffix): Reactor/ConnectClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(DependSuffix) -MM Reactor/ConnectClient.cpp + +$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(PreprocessSuffix): Reactor/ConnectClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConnectClient.cpp$(PreprocessSuffix) Reactor/ConnectClient.cpp + +$(IntermediateDirectory)/Reactor_ServerManager.cpp$(ObjectSuffix): Reactor/ServerManager.cpp $(IntermediateDirectory)/Reactor_ServerManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ServerManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ServerManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ServerManager.cpp$(DependSuffix): Reactor/ServerManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ServerManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ServerManager.cpp$(DependSuffix) -MM Reactor/ServerManager.cpp + +$(IntermediateDirectory)/Reactor_ServerManager.cpp$(PreprocessSuffix): Reactor/ServerManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ServerManager.cpp$(PreprocessSuffix) Reactor/ServerManager.cpp + +$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(ObjectSuffix): Console/ConsolePromiss.cpp $(IntermediateDirectory)/Console_ConsolePromiss.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Console/ConsolePromiss.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(DependSuffix): Console/ConsolePromiss.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(DependSuffix) -MM Console/ConsolePromiss.cpp + +$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(PreprocessSuffix): Console/ConsolePromiss.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_ConsolePromiss.cpp$(PreprocessSuffix) Console/ConsolePromiss.cpp + +$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(ObjectSuffix): PacketParse/PacketParseBase.cpp $(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PacketParse/PacketParseBase.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(DependSuffix): PacketParse/PacketParseBase.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(DependSuffix) -MM PacketParse/PacketParseBase.cpp + +$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(PreprocessSuffix): PacketParse/PacketParseBase.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(PreprocessSuffix) PacketParse/PacketParseBase.cpp + +$(IntermediateDirectory)/Message_MessageManager.cpp$(ObjectSuffix): Message/MessageManager.cpp $(IntermediateDirectory)/Message_MessageManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/MessageManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_MessageManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_MessageManager.cpp$(DependSuffix): Message/MessageManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_MessageManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_MessageManager.cpp$(DependSuffix) -MM Message/MessageManager.cpp + +$(IntermediateDirectory)/Message_MessageManager.cpp$(PreprocessSuffix): Message/MessageManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_MessageManager.cpp$(PreprocessSuffix) Message/MessageManager.cpp + +$(IntermediateDirectory)/Mail_smtps.cpp$(ObjectSuffix): Mail/smtps.cpp $(IntermediateDirectory)/Mail_smtps.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Mail/smtps.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Mail_smtps.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Mail_smtps.cpp$(DependSuffix): Mail/smtps.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Mail_smtps.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Mail_smtps.cpp$(DependSuffix) -MM Mail/smtps.cpp + +$(IntermediateDirectory)/Mail_smtps.cpp$(PreprocessSuffix): Mail/smtps.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Mail_smtps.cpp$(PreprocessSuffix) Mail/smtps.cpp + +$(IntermediateDirectory)/LogSystem_LogManager.cpp$(ObjectSuffix): LogSystem/LogManager.cpp $(IntermediateDirectory)/LogSystem_LogManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LogSystem/LogManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LogSystem_LogManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LogSystem_LogManager.cpp$(DependSuffix): LogSystem/LogManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LogSystem_LogManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LogSystem_LogManager.cpp$(DependSuffix) -MM LogSystem/LogManager.cpp + +$(IntermediateDirectory)/LogSystem_LogManager.cpp$(PreprocessSuffix): LogSystem/LogManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LogSystem_LogManager.cpp$(PreprocessSuffix) LogSystem/LogManager.cpp + +$(IntermediateDirectory)/PurenessScopeServer.cpp$(ObjectSuffix): PurenessScopeServer.cpp $(IntermediateDirectory)/PurenessScopeServer.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PurenessScopeServer.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PurenessScopeServer.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PurenessScopeServer.cpp$(DependSuffix): PurenessScopeServer.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PurenessScopeServer.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PurenessScopeServer.cpp$(DependSuffix) -MM PurenessScopeServer.cpp + +$(IntermediateDirectory)/PurenessScopeServer.cpp$(PreprocessSuffix): PurenessScopeServer.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PurenessScopeServer.cpp$(PreprocessSuffix) PurenessScopeServer.cpp + +$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(ObjectSuffix): Reactor/ConsoleAccept.cpp $(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ConsoleAccept.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(DependSuffix): Reactor/ConsoleAccept.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(DependSuffix) -MM Reactor/ConsoleAccept.cpp + +$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(PreprocessSuffix): Reactor/ConsoleAccept.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(PreprocessSuffix) Reactor/ConsoleAccept.cpp + +$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(ObjectSuffix): UDP/ReactorUDPHander.cpp $(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./UDP/ReactorUDPHander.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(DependSuffix): UDP/ReactorUDPHander.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(DependSuffix) -MM UDP/ReactorUDPHander.cpp + +$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(PreprocessSuffix): UDP/ReactorUDPHander.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(PreprocessSuffix) UDP/ReactorUDPHander.cpp + +$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(ObjectSuffix): UDP/ReactorUDPClient.cpp $(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./UDP/ReactorUDPClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(DependSuffix): UDP/ReactorUDPClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(DependSuffix) -MM UDP/ReactorUDPClient.cpp + +$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(PreprocessSuffix): UDP/ReactorUDPClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(PreprocessSuffix) UDP/ReactorUDPClient.cpp + +$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(ObjectSuffix): UDP/ProactorUDPHandler.cpp $(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./UDP/ProactorUDPHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(DependSuffix): UDP/ProactorUDPHandler.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(DependSuffix) -MM UDP/ProactorUDPHandler.cpp + +$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(PreprocessSuffix): UDP/ProactorUDPHandler.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(PreprocessSuffix) UDP/ProactorUDPHandler.cpp + +$(IntermediateDirectory)/Common_SendMessage.cpp$(ObjectSuffix): Common/SendMessage.cpp $(IntermediateDirectory)/Common_SendMessage.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/SendMessage.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_SendMessage.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_SendMessage.cpp$(DependSuffix): Common/SendMessage.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_SendMessage.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_SendMessage.cpp$(DependSuffix) -MM Common/SendMessage.cpp + +$(IntermediateDirectory)/Common_SendMessage.cpp$(PreprocessSuffix): Common/SendMessage.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_SendMessage.cpp$(PreprocessSuffix) Common/SendMessage.cpp + +$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(ObjectSuffix): UDP/ProactorUDPClient.cpp $(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./UDP/ProactorUDPClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(DependSuffix): UDP/ProactorUDPClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(DependSuffix) -MM UDP/ProactorUDPClient.cpp + +$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(PreprocessSuffix): UDP/ProactorUDPClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(PreprocessSuffix) UDP/ProactorUDPClient.cpp + +$(IntermediateDirectory)/Reactor_ControlListen.cpp$(ObjectSuffix): Reactor/ControlListen.cpp $(IntermediateDirectory)/Reactor_ControlListen.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ControlListen.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ControlListen.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ControlListen.cpp$(DependSuffix): Reactor/ControlListen.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ControlListen.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ControlListen.cpp$(DependSuffix) -MM Reactor/ControlListen.cpp + +$(IntermediateDirectory)/Reactor_ControlListen.cpp$(PreprocessSuffix): Reactor/ControlListen.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ControlListen.cpp$(PreprocessSuffix) Reactor/ControlListen.cpp + +$(IntermediateDirectory)/Common_TcpRedirection.cpp$(ObjectSuffix): Common/TcpRedirection.cpp $(IntermediateDirectory)/Common_TcpRedirection.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/TcpRedirection.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_TcpRedirection.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_TcpRedirection.cpp$(DependSuffix): Common/TcpRedirection.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_TcpRedirection.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_TcpRedirection.cpp$(DependSuffix) -MM Common/TcpRedirection.cpp + +$(IntermediateDirectory)/Common_TcpRedirection.cpp$(PreprocessSuffix): Common/TcpRedirection.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_TcpRedirection.cpp$(PreprocessSuffix) Common/TcpRedirection.cpp + +$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(ObjectSuffix): Reactor/ConnectHandler.cpp $(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ConnectHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(DependSuffix): Reactor/ConnectHandler.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(DependSuffix) -MM Reactor/ConnectHandler.cpp + +$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(PreprocessSuffix): Reactor/ConnectHandler.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(PreprocessSuffix) Reactor/ConnectHandler.cpp + +$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(ObjectSuffix): LogSystem/FileLogger.cpp $(IntermediateDirectory)/LogSystem_FileLogger.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LogSystem/FileLogger.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(DependSuffix): LogSystem/FileLogger.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(DependSuffix) -MM LogSystem/FileLogger.cpp + +$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(PreprocessSuffix): LogSystem/FileLogger.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LogSystem_FileLogger.cpp$(PreprocessSuffix) LogSystem/FileLogger.cpp + +$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(ObjectSuffix): Reactor/ConnectAccept.cpp $(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ConnectAccept.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(DependSuffix): Reactor/ConnectAccept.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(DependSuffix) -MM Reactor/ConnectAccept.cpp + +$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(PreprocessSuffix): Reactor/ConnectAccept.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(PreprocessSuffix) Reactor/ConnectAccept.cpp + +$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(ObjectSuffix): Reactor/ClientReConnectManager.cpp $(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ClientReConnectManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(DependSuffix): Reactor/ClientReConnectManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(DependSuffix) -MM Reactor/ClientReConnectManager.cpp + +$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(PreprocessSuffix): Reactor/ClientReConnectManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(PreprocessSuffix) Reactor/ClientReConnectManager.cpp + +$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(ObjectSuffix): Reactor/ReTTyClientManager.cpp $(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ReTTyClientManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(DependSuffix): Reactor/ReTTyClientManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(DependSuffix) -MM Reactor/ReTTyClientManager.cpp + +$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(PreprocessSuffix): Reactor/ReTTyClientManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(PreprocessSuffix) Reactor/ReTTyClientManager.cpp + +$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(ObjectSuffix): Message/WorkThreadAI.cpp $(IntermediateDirectory)/Message_WorkThreadAI.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/WorkThreadAI.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(DependSuffix): Message/WorkThreadAI.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(DependSuffix) -MM Message/WorkThreadAI.cpp + +$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(PreprocessSuffix): Message/WorkThreadAI.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_WorkThreadAI.cpp$(PreprocessSuffix) Message/WorkThreadAI.cpp + +$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(ObjectSuffix): Message/ModuleMessageManager.cpp $(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/ModuleMessageManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(DependSuffix): Message/ModuleMessageManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(DependSuffix) -MM Message/ModuleMessageManager.cpp + +$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(PreprocessSuffix): Message/ModuleMessageManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(PreprocessSuffix) Message/ModuleMessageManager.cpp + +$(IntermediateDirectory)/Message_MessageService.cpp$(ObjectSuffix): Message/MessageService.cpp $(IntermediateDirectory)/Message_MessageService.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/MessageService.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_MessageService.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_MessageService.cpp$(DependSuffix): Message/MessageService.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_MessageService.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_MessageService.cpp$(DependSuffix) -MM Message/MessageService.cpp + +$(IntermediateDirectory)/Message_MessageService.cpp$(PreprocessSuffix): Message/MessageService.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_MessageService.cpp$(PreprocessSuffix) Message/MessageService.cpp + +$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(ObjectSuffix): Reactor/ReTTyHandler.cpp $(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Reactor/ReTTyHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(DependSuffix): Reactor/ReTTyHandler.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(DependSuffix) -MM Reactor/ReTTyHandler.cpp + +$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(PreprocessSuffix): Reactor/ReTTyHandler.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(PreprocessSuffix) Reactor/ReTTyHandler.cpp + +$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(ObjectSuffix): Message/LoadPacketParse.cpp $(IntermediateDirectory)/Message_LoadPacketParse.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/LoadPacketParse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(DependSuffix): Message/LoadPacketParse.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(DependSuffix) -MM Message/LoadPacketParse.cpp + +$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(PreprocessSuffix): Message/LoadPacketParse.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_LoadPacketParse.cpp$(PreprocessSuffix) Message/LoadPacketParse.cpp + +$(IntermediateDirectory)/Message_LoadModule.cpp$(ObjectSuffix): Message/LoadModule.cpp $(IntermediateDirectory)/Message_LoadModule.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Message/LoadModule.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_LoadModule.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_LoadModule.cpp$(DependSuffix): Message/LoadModule.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_LoadModule.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_LoadModule.cpp$(DependSuffix) -MM Message/LoadModule.cpp + +$(IntermediateDirectory)/Message_LoadModule.cpp$(PreprocessSuffix): Message/LoadModule.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_LoadModule.cpp$(PreprocessSuffix) Message/LoadModule.cpp + +$(IntermediateDirectory)/Mail_base64.cpp$(ObjectSuffix): Mail/base64.cpp $(IntermediateDirectory)/Mail_base64.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Mail/base64.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Mail_base64.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Mail_base64.cpp$(DependSuffix): Mail/base64.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Mail_base64.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Mail_base64.cpp$(DependSuffix) -MM Mail/base64.cpp + +$(IntermediateDirectory)/Mail_base64.cpp$(PreprocessSuffix): Mail/base64.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Mail_base64.cpp$(PreprocessSuffix) Mail/base64.cpp + +$(IntermediateDirectory)/Console_MessageDispose.cpp$(ObjectSuffix): Console/MessageDispose.cpp $(IntermediateDirectory)/Console_MessageDispose.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Console/MessageDispose.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_MessageDispose.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_MessageDispose.cpp$(DependSuffix): Console/MessageDispose.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_MessageDispose.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_MessageDispose.cpp$(DependSuffix) -MM Console/MessageDispose.cpp + +$(IntermediateDirectory)/Console_MessageDispose.cpp$(PreprocessSuffix): Console/MessageDispose.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_MessageDispose.cpp$(PreprocessSuffix) Console/MessageDispose.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/Mail_smtp.cpp$(ObjectSuffix): Mail/smtp.cpp $(IntermediateDirectory)/Mail_smtp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Mail/smtp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Mail_smtp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Mail_smtp.cpp$(DependSuffix): Mail/smtp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Mail_smtp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Mail_smtp.cpp$(DependSuffix) -MM Mail/smtp.cpp + +$(IntermediateDirectory)/Mail_smtp.cpp$(PreprocessSuffix): Mail/smtp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Mail_smtp.cpp$(PreprocessSuffix) Mail/smtp.cpp + +$(IntermediateDirectory)/Console_FrameCommand.cpp$(ObjectSuffix): Console/FrameCommand.cpp $(IntermediateDirectory)/Console_FrameCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Console/FrameCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_FrameCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_FrameCommand.cpp$(DependSuffix): Console/FrameCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_FrameCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_FrameCommand.cpp$(DependSuffix) -MM Console/FrameCommand.cpp + +$(IntermediateDirectory)/Console_FrameCommand.cpp$(PreprocessSuffix): Console/FrameCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_FrameCommand.cpp$(PreprocessSuffix) Console/FrameCommand.cpp + +$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(ObjectSuffix): Console/ConsoleMessage.cpp $(IntermediateDirectory)/Console_ConsoleMessage.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Console/ConsoleMessage.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(DependSuffix): Console/ConsoleMessage.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(DependSuffix) -MM Console/ConsoleMessage.cpp + +$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(PreprocessSuffix): Console/ConsoleMessage.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_ConsoleMessage.cpp$(PreprocessSuffix) Console/ConsoleMessage.cpp + +$(IntermediateDirectory)/Common_XmlOpeation.cpp$(ObjectSuffix): Common/XmlOpeation.cpp $(IntermediateDirectory)/Common_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_XmlOpeation.cpp$(DependSuffix): Common/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_XmlOpeation.cpp$(DependSuffix) -MM Common/XmlOpeation.cpp + +$(IntermediateDirectory)/Common_XmlOpeation.cpp$(PreprocessSuffix): Common/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_XmlOpeation.cpp$(PreprocessSuffix) Common/XmlOpeation.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/FrameCore/Message/LoadModule.cpp b/purenessscopeserver/FrameCore/Message/LoadModule.cpp index e75e0c2ea..cd0107fce 100644 --- a/purenessscopeserver/FrameCore/Message/LoadModule.cpp +++ b/purenessscopeserver/FrameCore/Message/LoadModule.cpp @@ -11,6 +11,11 @@ CLoadModule::CLoadModule(void) m_szModulePath[0] = '\0'; } +CLoadModule::CLoadModule(const CLoadModule& ar) +{ + (*this) = ar; +} + CLoadModule::~CLoadModule(void) { OUR_DEBUG((LM_INFO, "[CLoadModule::~CLoadModule].\n")); diff --git a/purenessscopeserver/FrameCore/Message/LoadModule.h b/purenessscopeserver/FrameCore/Message/LoadModule.h index 38ab80ed8..2583873da 100644 --- a/purenessscopeserver/FrameCore/Message/LoadModule.h +++ b/purenessscopeserver/FrameCore/Message/LoadModule.h @@ -72,6 +72,18 @@ class CLoadModule : public IModuleInfo CLoadModule(void); virtual ~CLoadModule(void); + CLoadModule(const CLoadModule& ar); + + CLoadModule& operator = (const CLoadModule& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Init(uint16 u2MaxModuleCount); void Close(); diff --git a/purenessscopeserver/FrameCore/Message/LoadPacketParse.cpp b/purenessscopeserver/FrameCore/Message/LoadPacketParse.cpp index b37ebc0d3..16706ba59 100644 --- a/purenessscopeserver/FrameCore/Message/LoadPacketParse.cpp +++ b/purenessscopeserver/FrameCore/Message/LoadPacketParse.cpp @@ -4,6 +4,11 @@ CLoadPacketParse::CLoadPacketParse() { } +CLoadPacketParse::CLoadPacketParse(const CLoadPacketParse& ar) +{ + (*this) = ar; +} + CLoadPacketParse::~CLoadPacketParse() { OUR_DEBUG((LM_ERROR, "[CLoadPacketParse::~CLoadPacketParse]\n")); diff --git a/purenessscopeserver/FrameCore/Message/LoadPacketParse.h b/purenessscopeserver/FrameCore/Message/LoadPacketParse.h index e0a23b9ef..3fb9a6c6e 100644 --- a/purenessscopeserver/FrameCore/Message/LoadPacketParse.h +++ b/purenessscopeserver/FrameCore/Message/LoadPacketParse.h @@ -50,6 +50,18 @@ class CLoadPacketParse CLoadPacketParse(); ~CLoadPacketParse(); + CLoadPacketParse(const CLoadPacketParse& ar); + + CLoadPacketParse& operator = (const CLoadPacketParse& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Init(int nCount); bool LoadPacketInfo(uint32 u4PacketParseID, uint8 u1Type, uint32 u4HeadLen, const char* pPacketParsePath, const char* szPacketParseName); diff --git a/purenessscopeserver/FrameCore/Message/LogicThreadManager.cpp b/purenessscopeserver/FrameCore/Message/LogicThreadManager.cpp new file mode 100644 index 000000000..5b7d02e54 --- /dev/null +++ b/purenessscopeserver/FrameCore/Message/LogicThreadManager.cpp @@ -0,0 +1,475 @@ +#include "LogicThreadManager.h" + +CLogicThreadMessagePool::CLogicThreadMessagePool() +{ +} + +CLogicThreadMessagePool::CLogicThreadMessagePool(const CLogicThreadMessagePool& ar) +{ + (*this) = ar; +} + +void CLogicThreadMessagePool::Init_Callback(int nIndex, CLogicThreadMessage* pMessage) +{ + pMessage->SetHashID(nIndex); +} + +void CLogicThreadMessagePool::Close_Callback(int nIndex, CLogicThreadMessage* pMessage) +{ + ACE_UNUSED_ARG(nIndex); + ACE_UNUSED_ARG(pMessage); +} + +CLogicThreadMessage* CLogicThreadMessagePool::Create() +{ + return dynamic_cast(CObjectPoolManager::Create(__FILE__, __LINE__)); +} + +bool CLogicThreadMessagePool::Delete(CLogicThreadMessage* pMessage) +{ + if (NULL == pMessage) + { + return false; + } + + pMessage->Clear(); + + bool blState = CObjectPoolManager::Delete(pMessage->GetHashID(), pMessage); + + if (false == blState) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadMessagePool::Delete]HashID=%d(0x%08x).\n", pMessage->GetHashID(), pMessage)); + } + + return true; +} + +CLogicThreadMessagePool::~CLogicThreadMessagePool() +{ + OUR_DEBUG((LM_INFO, "[CLogicThreadMessagePool::~CLogicThreadMessagePool].\n")); + OUR_DEBUG((LM_INFO, "[CLogicThreadMessagePool::~CLogicThreadMessagePool]End.\n")); +} + +//======================================================== +CLogicThread::CLogicThread() : m_blRun(false), + m_logicthreadmutex(), + m_logicthreadcond(m_logicthreadmutex), + m_u4ThreadState(0) +{ +} + +CLogicThread::CLogicThread(const CLogicThread& ar) : CLogicThread() +{ + (*this) = ar; +} + +CLogicThread::~CLogicThread() +{ +} + +void CLogicThread::Init(CLogicThreadInfo objThreadInfo) +{ + m_objThreadInfo = objThreadInfo; + + //Ϣ + m_MessagePool.Init(MAX_MESSAGE_POOL, CLogicThreadMessagePool::Init_Callback); +} + +bool CLogicThread::Start() +{ + if (0 != open()) + { + return false; + } + else + { + return true; + } +} + +int CLogicThread::handle_signal(int signum, siginfo_t* siginfo, ucontext_t* ucontext) +{ + if (signum == SIGUSR1 + grp_id()) + { + OUR_DEBUG((LM_INFO, "[CLogicThread::handle_signal(](%d) will be kill.\n", grp_id())); + + if (NULL != siginfo && NULL != ucontext) + { + OUR_DEBUG((LM_INFO, "[CLogicThread::handle_signal(]siginfo is not null.\n")); + } + + ACE_Thread::exit(); + } + + return 0; +} + +int CLogicThread::open(void* args) +{ + if (args != NULL) + { + OUR_DEBUG((LM_INFO, "[CLogicThread::open]args is not NULL.\n")); + } + + m_blRun = true; + + if (activate(THREAD_PARAM, MAX_MSG_THREADCOUNT) == -1) + { + OUR_DEBUG((LM_ERROR, "[CMessageService::open] activate error ThreadCount = [%d].\n", MAX_MSG_THREADCOUNT)); + m_blRun = false; + return -1; + } + + resume(); + return 0; +} + +int CLogicThread::svc(void) +{ + //óʼ̲߳ + m_u4ThreadState = THREAD_INIT; + + if (NULL != m_objThreadInfo.fn_thread_init) + { + m_objThreadInfo.fn_thread_init(m_objThreadInfo.m_nLogicThreadID); + } + + while (m_blRun) + { + if (false == Dispose_Queue()) + { + break; + } + + //ʹڴأڴ治ͷ + } + + //߳̽ + if (NULL != m_objThreadInfo.fn_thread_exit) + { + m_objThreadInfo.fn_thread_exit(m_objThreadInfo.m_nLogicThreadID); + } + + return 0; +} + +int CLogicThread::Close() +{ + if (m_blRun) + { + if (false == this->CloseMsgQueue()) + { + OUR_DEBUG((LM_INFO, "[CMessageService::Close]CloseMsgQueue is fail.\n")); + } + } + else + { + msg_queue()->deactivate(); + } + + m_MessagePool.Close_Object(CLogicThreadMessagePool::Close_Callback); + + return 0; +} + +bool CLogicThread::CheckTimeout(ACE_Time_Value tvNow) +{ + if (THREAD_RUNBEGIN == m_u4ThreadState) + { + ACE_Time_Value tvInterval = tvNow - m_tvUpdateTime; + + if (tvInterval.sec() > m_objThreadInfo.m_nTimeout) + { + //ص̳߳ʱӿ + m_objThreadInfo.fn_thread_callback_error(m_objThreadInfo.m_nLogicThreadID, 1); + return false; + } + } + + return true; +} + +bool CLogicThread::PutMessage(int nMessageID, void* pParam) +{ + CLogicThreadMessage* pMessage = m_MessagePool.Create(); + + if (NULL != pMessage) + { + pMessage->m_nMessageID = nMessageID; + pMessage->m_pParam = pParam; + + ACE_Message_Block* mb = pMessage->GetQueueMessage(); + ACE_Time_Value xtime = ACE_OS::gettimeofday() + ACE_Time_Value(0, 10000); + + if (this->putq(mb, &xtime) == -1) + { + OUR_DEBUG((LM_ERROR, "[CLogicThread::PutMessage] Queue putq error errno = [%d].\n", errno)); + return false; + } + } + else + { + OUR_DEBUG((LM_INFO, "[CLogicThread::PutMessage]Create fail.\n")); + return false; + } + + return true; +} + +CLogicThreadInfo* CLogicThread::GetThreadInfo() +{ + return &m_objThreadInfo; +} + +int CLogicThread::CloseMsgQueue() +{ + return Task_Common_CloseMsgQueue((ACE_Task*)this, m_logicthreadcond, m_logicthreadmutex); +} + +bool CLogicThread::Dispose_Queue() +{ + ACE_Message_Block* mb = NULL; + ACE_OS::last_error(0); + + if (getq(mb, 0) == -1) + { + OUR_DEBUG((LM_ERROR, "[CLogicThread::Dispose_Queue] PutMessage error errno = [%d].\n", ACE_OS::last_error())); + m_blRun = false; + return false; + } + else if (mb->msg_type() == ACE_Message_Block::MB_STOP) + { + m_logicthreadmutex.acquire(); + mb->release(); + this->msg_queue()->deactivate(); + m_logicthreadcond.signal(); + m_logicthreadmutex.release(); + m_blRun = false; + return false; + } + else + { + //Ϣ + CLogicThreadMessage* msg = *((CLogicThreadMessage**)mb->base()); + + ThreadReturn emRet = THREAD_Task_Finish; + + m_u4ThreadState = THREAD_RUNBEGIN; + m_tvUpdateTime = ACE_OS::gettimeofday(); + + if (NULL != m_objThreadInfo.fn_thread_callback_logic) + { + emRet = m_objThreadInfo.fn_thread_callback_logic(m_objThreadInfo.m_nLogicThreadID, + msg->m_nMessageID, + msg->m_pParam); + + } + + //Ϣ + m_MessagePool.Delete(msg); + + m_u4ThreadState = THREAD_RUNEND; + + if (THREAD_Task_Finish == emRet) + { + return true; + } + else + { + return false; + } + } +} + +CLogicThreadManager::CLogicThreadManager() +{ + m_u4TimerID = 0; +} + +CLogicThreadManager::~CLogicThreadManager() +{ +} + +int CLogicThreadManager::handle_timeout(const ACE_Time_Value& tv, const void* arg) +{ + ACE_Guard guard(m_ThreadWriteLock); + ACE_UNUSED_ARG(arg); + + vector vecLogicThreadList; + + m_objThreadInfoList.Get_All_Used(vecLogicThreadList); + + for (int i = 0; i < (int)vecLogicThreadList.size(); i++) + { + vecLogicThreadList[i]->CheckTimeout(tv); + } + + return 0; +} + +void CLogicThreadManager::Init() +{ + //ʼHash + m_objThreadInfoList.Init(LOGICTHREAD_MAX_COUNT); + m_objMessageIDList.Init(LOGICTHREAD_MESSAGE_MAX_COUNT); + + //ʱ(Ĭһһ) + m_u4TimerID = App_TimerManager::instance()->schedule(this, NULL, ACE_OS::gettimeofday() + ACE_Time_Value(MAX_MSG_STARTTIME), ACE_Time_Value(MAX_MSG_TIMEDELAYTIME)); +} + +void CLogicThreadManager::Close() +{ + ACE_Guard guard(m_ThreadWriteLock); + + //ֹͣʱ + if (m_u4TimerID > 0) + { + App_TimerManager::instance()->cancel(m_u4TimerID); + m_u4TimerID = 0; + } + + ACE_Time_Value tvSleep(0, 1000); + vector vecLogicThreadList; + + m_objThreadInfoList.Get_All_Used(vecLogicThreadList); + + for (int i = 0; i < (int)vecLogicThreadList.size(); i++) + { + vecLogicThreadList[i]->Close(); + + ACE_OS::sleep(tvSleep); + SAFE_DELETE(vecLogicThreadList[i]); + } + + vecLogicThreadList.clear(); +} + +int CLogicThreadManager::CreateLogicThread(int nLogicThreadID, int nTimeout, ThreadInit thread_init, ThreadCallbackLogic thread_callback_logic, ThreadErrorLogic thread_callback_error, ThreadExit thread_exit) +{ + ACE_Guard guard(m_ThreadWriteLock); + + CLogicThread* pLogicThread = m_objThreadInfoList.Get_Hash_Box_Data_By_Uint32((uint32)nLogicThreadID); + + if (NULL != pLogicThread) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]Create logic thread id(%d) is exist.\n", nLogicThreadID)); + return -1; + } + + CLogicThreadInfo* pLogicThreadInfo = new CLogicThreadInfo(); + + pLogicThreadInfo->m_nLogicThreadID = nLogicThreadID; + pLogicThreadInfo->m_nTimeout = nTimeout; + pLogicThreadInfo->fn_thread_init = thread_init; + pLogicThreadInfo->fn_thread_callback_logic = thread_callback_logic; + pLogicThreadInfo->fn_thread_callback_error = thread_callback_error; + pLogicThreadInfo->fn_thread_exit = thread_exit; + + pLogicThread = new CLogicThread(); + pLogicThread->Init(*pLogicThreadInfo); + + if (false == pLogicThread->Start()) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]nLogicThreadID=%d Start error.\n", nLogicThreadID)); + SAFE_DELETE(pLogicThreadInfo); + SAFE_DELETE(pLogicThread); + return -1; + } + + if (0 > m_objThreadInfoList.Add_Hash_Data_By_Key_Unit32(nLogicThreadID, pLogicThread)) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]nLogicThreadID=%d add error.\n", nLogicThreadID)); + SAFE_DELETE(pLogicThreadInfo); + SAFE_DELETE(pLogicThread); + return -1; + } + + return 0; +} + +int CLogicThreadManager::KillLogicThread(int nLogicThreadID) +{ + ACE_Guard guard(m_ThreadWriteLock); + + CLogicThread* pLogicThread = m_objThreadInfoList.Get_Hash_Box_Data_By_Uint32((uint32)nLogicThreadID); + + if (NULL == pLogicThread) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]Create logic thread id(%d) is no exist.\n", nLogicThreadID)); + return -1; + } + else + { + pLogicThread->Close(); + SAFE_DELETE(pLogicThread); + m_objThreadInfoList.Del_Hash_Data_By_Unit32((uint32)nLogicThreadID); + return 0; + } +} + +int CLogicThreadManager::MessageMappingLogicThread(int nLogicThreadID, int nMessageID) +{ + ACE_Guard guard(m_ThreadWriteLock); + + CLogicThreadInfo* pLogicThreadInfo = NULL; + CLogicThread* pLogicThread = m_objThreadInfoList.Get_Hash_Box_Data_By_Uint32((uint32)nLogicThreadID); + + if (NULL == pLogicThread) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]Create logic thread id(%d) is no exist.\n", nLogicThreadID)); + return -1; + } + + pLogicThreadInfo = m_objMessageIDList.Get_Hash_Box_Data_By_Uint32((uint32)nMessageID); + + if (NULL != pLogicThreadInfo) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]Message id(%d) at logic thread(%d) is exist.\n", + nMessageID, + pLogicThreadInfo->m_nLogicThreadID)); + return -1; + } + + pLogicThreadInfo = pLogicThread->GetThreadInfo(); + + if (0 > m_objMessageIDList.Add_Hash_Data_By_Key_Unit32((uint32)nMessageID, pLogicThreadInfo)) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]Message id(%d) at logic thread(%d) add error.\n", + nMessageID, + pLogicThreadInfo->m_nLogicThreadID)); + return -1; + } + + return 0; +} + +int CLogicThreadManager::SendLogicThreadMessage(int nMessageID, void* arg) +{ + ACE_Guard guard(m_ThreadWriteLock); + + CLogicThreadInfo* pLogicThreadInfo = m_objMessageIDList.Get_Hash_Box_Data_By_Uint32((uint32)nMessageID); + + if (NULL == pLogicThreadInfo) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]Message id(%d) at logic is no exist.\n", + nMessageID, + pLogicThreadInfo->m_nLogicThreadID)); + return -1; + } + + CLogicThread* pLogicThread = m_objThreadInfoList.Get_Hash_Box_Data_By_Uint32((uint32)pLogicThreadInfo->m_nLogicThreadID); + + if (NULL == pLogicThread) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]Create logic thread id(%d) is no exist.\n", pLogicThreadInfo->m_nLogicThreadID)); + return -1; + } + + if (false == pLogicThread->PutMessage(nMessageID, arg)) + { + OUR_DEBUG((LM_INFO, "[CLogicThreadManager::CreateLogicThread]Create logic thread id(%d) putmessage error.\n", pLogicThreadInfo->m_nLogicThreadID)); + return -1; + } + + return 0; +} diff --git a/purenessscopeserver/FrameCore/Message/LogicThreadManager.h b/purenessscopeserver/FrameCore/Message/LogicThreadManager.h new file mode 100644 index 000000000..b2dd33ee6 --- /dev/null +++ b/purenessscopeserver/FrameCore/Message/LogicThreadManager.h @@ -0,0 +1,245 @@ +#ifndef _LOGICTHREADMANAGER_H +#define _LOGICTHREADMANAGER_H + +#include "ace/Synch.h" +#include "ace/Malloc_T.h" +#include "ace/Singleton.h" +#include "ace/Thread_Mutex.h" + +#include "define.h" +#include "HashTable.h" +#include "ILogicThreadManager.h" +#include "ObjectPoolManager.h" +#include "BaseTask.h" +#include "TimerManager.h" + +#define LOGICTHREAD_MAX_COUNT 100 +#define LOGICTHREAD_MESSAGE_MAX_COUNT 2000 + +//߼̵߳Ϣ +class CLogicThreadMessage +{ +public: + CLogicThreadMessage() : m_nHashID(0), m_nMessageID(0), m_pParam(NULL) + { + //ָϵҲֱָʹõʹָ + m_pmbQueuePtr = new ACE_Message_Block(sizeof(CLogicThreadMessage*)); + + CLogicThreadMessage** ppMessage = (CLogicThreadMessage**)m_pmbQueuePtr->base(); + *ppMessage = this; + } + + ~CLogicThreadMessage() + { + if (NULL != m_pmbQueuePtr) + { + m_pmbQueuePtr->release(); + m_pmbQueuePtr = NULL; + } + } + + CLogicThreadMessage(const CLogicThreadMessage& ar) + { + (*this) = ar; + } + + CLogicThreadMessage& operator = (const CLogicThreadMessage& ar) + { + if (this != &ar) + { + this->m_nMessageID = ar.m_nMessageID; + this->m_pParam = ar.m_pParam; + } + + return *this; + } + + void SetHashID(int nHasnID) + { + m_nHashID = nHasnID; + } + + int GetHashID() + { + return m_nHashID; + } + + void Clear() + { + m_nMessageID = 0; + m_pParam = NULL; + } + + ACE_Message_Block* GetQueueMessage() + { + return m_pmbQueuePtr; + } + + int m_nHashID; + int m_nMessageID; + void* m_pParam; + ACE_Message_Block* m_pmbQueuePtr; //Ϣָ +}; + +//߼̲߳ +class CLogicThreadInfo +{ +public: + CLogicThreadInfo() : m_nLogicThreadID(0), + m_nTimeout(0), + fn_thread_init(NULL), + fn_thread_callback_logic(NULL), + fn_thread_callback_error(NULL), + fn_thread_exit(NULL) + { + } + + ~CLogicThreadInfo() + { + } + + CLogicThreadInfo(const CLogicThreadInfo& ar) + { + (*this) = ar; + } + + CLogicThreadInfo& operator = (const CLogicThreadInfo& ar) + { + if (this != &ar) + { + this->m_nLogicThreadID = ar.m_nLogicThreadID; + this->m_nTimeout = ar.m_nTimeout; + this->fn_thread_init = ar.fn_thread_init; + this->fn_thread_callback_logic = ar.fn_thread_callback_logic; + this->fn_thread_callback_error = ar.fn_thread_callback_error; + this->fn_thread_exit = ar.fn_thread_exit; + } + + return *this; + } + + int m_nLogicThreadID; + int m_nTimeout; + ThreadInit fn_thread_init; + ThreadCallbackLogic fn_thread_callback_logic; + ThreadErrorLogic fn_thread_callback_error; + ThreadExit fn_thread_exit; +}; + +//Message +class CLogicThreadMessagePool : public CObjectPoolManager +{ +public: + CLogicThreadMessagePool(); + ~CLogicThreadMessagePool(); + + CLogicThreadMessagePool(const CLogicThreadMessagePool& ar); + + CLogicThreadMessagePool& operator = (const CLogicThreadMessagePool& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + + static void Init_Callback(int nIndex, CLogicThreadMessage* pMessage); + static void Close_Callback(int nIndex, CLogicThreadMessage* pMessage); + + CLogicThreadMessage* Create(); + bool Delete(CLogicThreadMessage* pMakePacket); +}; + +//߼߳ +class CLogicThread : public ACE_Task +{ +public: + CLogicThread(); + virtual ~CLogicThread(); + + CLogicThread(const CLogicThread& ar); + + CLogicThread& operator = (const CLogicThread& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + + void Init(CLogicThreadInfo objThreadInfo); + + bool Start(); + + virtual int handle_signal(int signum, + siginfo_t* = 0, + ucontext_t* = 0); + + virtual int open(void* args = 0); + virtual int svc(void); + int Close(); + + bool CheckTimeout(ACE_Time_Value tvNow); + + bool PutMessage(int nMessageID, void* pParam); + + CLogicThreadInfo* GetThreadInfo(); + +private: + int CloseMsgQueue(); + bool Dispose_Queue(); // + +private: + CLogicThreadInfo m_objThreadInfo; + bool m_blRun; + ACE_Thread_Mutex m_logicthreadmutex; + ACE_Condition m_logicthreadcond; + uint32 m_u4ThreadState; //ǰ߳״̬ + ACE_Time_Value m_tvUpdateTime; //߳ݵʱ + CLogicThreadMessagePool m_MessagePool; //Ϣ +}; + +//߼̹߳ +class CLogicThreadManager : public ILogicThreadManager, public ACE_Task +{ +public: + CLogicThreadManager(); + virtual ~CLogicThreadManager(); + + virtual int handle_timeout(const ACE_Time_Value& tv, const void* arg); + + void Init(); + + void Close(); + + //߼߳ + virtual int CreateLogicThread(int nLogicThreadID, + int nTimeout, + ThreadInit thread_init, + ThreadCallbackLogic thread_callback_logic, + ThreadErrorLogic thread_callback_error, + ThreadExit thread_exit); + + //ر߼߳ + virtual int KillLogicThread(int nLogicThreadID); + + //Ϣ߼̵߳ӳϵ + virtual int MessageMappingLogicThread(int nLogicThreadID, int nMessageID); + + //߳Ϣ + virtual int SendLogicThreadMessage(int nMessageID, void* arg); + +public: + CHashTable m_objThreadInfoList; + CHashTable m_objMessageIDList; + ACE_Recursive_Thread_Mutex m_ThreadWriteLock; + uint32 m_u4TimerID; +}; + +typedef ACE_Singleton App_LogicThreadManager; + +#endif diff --git a/purenessscopeserver/FrameCore/Message/Message.cpp b/purenessscopeserver/FrameCore/Message/Message.cpp index 242050db7..4ed1c568e 100644 --- a/purenessscopeserver/FrameCore/Message/Message.cpp +++ b/purenessscopeserver/FrameCore/Message/Message.cpp @@ -161,6 +161,11 @@ CMessagePool::CMessagePool() { } +CMessagePool::CMessagePool(const CMessagePool& ar) +{ + (*this) = ar; +} + CMessagePool::~CMessagePool() { OUR_DEBUG((LM_INFO, "[CMessagePool::~CMessagePool].\n")); diff --git a/purenessscopeserver/FrameCore/Message/Message.h b/purenessscopeserver/FrameCore/Message/Message.h index bf36f7baf..ea04eb2f2 100644 --- a/purenessscopeserver/FrameCore/Message/Message.h +++ b/purenessscopeserver/FrameCore/Message/Message.h @@ -55,6 +55,18 @@ class CMessagePool : public CObjectPoolManagerSaveThreadInfoData()) + if (NULL != pMessageService && false == pMessageService->SaveThreadInfoData(tvNow)) { OUR_DEBUG((LM_INFO, "[CMessageServiceGroup::CheckWorkThread]SaveThreadInfo error.\n")); } diff --git a/purenessscopeserver/FrameCore/Message/MessageService.h b/purenessscopeserver/FrameCore/Message/MessageService.h index e34ec8648..522aedace 100644 --- a/purenessscopeserver/FrameCore/Message/MessageService.h +++ b/purenessscopeserver/FrameCore/Message/MessageService.h @@ -39,10 +39,22 @@ class CMessageService : public ACE_Task { public: CMessageService(); - ~CMessageService(); + virtual ~CMessageService(); + + CMessageService(const CMessageService& ar); + + CMessageService& operator = (const CMessageService& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } virtual int handle_signal (int signum, - siginfo_t* = 0, + siginfo_t* = 0, ucontext_t* = 0); virtual int open(void* args = 0); @@ -57,7 +69,7 @@ class CMessageService : public ACE_Task bool PutUpdateCommandMessage(uint32 u4UpdateIndex); _ThreadInfo* GetThreadInfo(); - bool SaveThreadInfoData(); //¼ǰ߳״̬Ϣ־ + bool SaveThreadInfoData(const ACE_Time_Value& tvNow); //¼ǰ߳״̬Ϣ־ void GetAIInfo(_WorkThreadAIInfo& objAIInfo); //õй̵߳AI void GetAITO(vecCommandTimeout& objTimeout); //õеAIʱݰϢ @@ -123,7 +135,7 @@ class CMessageServiceGroup : public ACE_Task { public: CMessageServiceGroup(); - ~CMessageServiceGroup(); + virtual ~CMessageServiceGroup(); virtual int handle_timeout(const ACE_Time_Value& tv, const void* arg); @@ -165,10 +177,10 @@ class CMessageServiceGroup : public ACE_Task bool StartTimer(); bool KillTimer(); - bool CheckWorkThread(); //еĹ߳״̬ - bool CheckPacketParsePool(); //ʹõϢ - bool CheckPlugInState(); //в״̬ - int32 GetWorkThreadID(uint32 u4ConnectID, uint8 u1PacketType); //ݲͺConnectIDǸ߳ID + bool CheckWorkThread(const ACE_Time_Value& tvNow); //еĹ߳״̬ + bool CheckPacketParsePool(); //ʹõϢ + bool CheckPlugInState(); //в״̬ + int32 GetWorkThreadID(uint32 u4ConnectID, uint8 u1PacketType); //ݲͺConnectIDǸ߳ID typedef vector vecMessageService; vecMessageService m_vecMessageService; diff --git a/purenessscopeserver/FrameCore/Message/WorkThreadAI.cpp b/purenessscopeserver/FrameCore/Message/WorkThreadAI.cpp index 219ad6086..6649ff69d 100644 --- a/purenessscopeserver/FrameCore/Message/WorkThreadAI.cpp +++ b/purenessscopeserver/FrameCore/Message/WorkThreadAI.cpp @@ -12,6 +12,11 @@ CWorkThreadAI::CWorkThreadAI() m_szWTReturnData[0] = '\0'; } +CWorkThreadAI::CWorkThreadAI(const CWorkThreadAI& ar) +{ + (*this) = ar; +} + CWorkThreadAI::~CWorkThreadAI() { Close(); diff --git a/purenessscopeserver/FrameCore/Message/WorkThreadAI.h b/purenessscopeserver/FrameCore/Message/WorkThreadAI.h index 67f8c1b1b..98f43efde 100644 --- a/purenessscopeserver/FrameCore/Message/WorkThreadAI.h +++ b/purenessscopeserver/FrameCore/Message/WorkThreadAI.h @@ -256,6 +256,18 @@ class CWorkThreadAI CWorkThreadAI(); ~CWorkThreadAI(); + CWorkThreadAI(const CWorkThreadAI& ar); + + CWorkThreadAI& operator = (const CWorkThreadAI& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Close(); void Init(uint8 u1AI, uint32 u4DisposeTime, uint32 u4WTCheckTime, uint32 u4WTTimeoutCount, uint32 u4WTStopTime, uint8 u1WTReturnDataType, const char* pReturnData); diff --git a/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj b/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj deleted file mode 100644 index 0a762593c..000000000 --- a/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj +++ /dev/null @@ -1,741 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {8C99CA60-B114-4866-8D87-9DC0C17831F3} - PurenessScopeServer - Win32Proj - 10.0.16299.0 - - - - Application - v140 - MultiByte - true - - - Application - v140 - MultiByte - true - - - Application - v140 - MultiByte - - - Application - v140_xp - MultiByte - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - .\Windows_Bin\ - $(Configuration)\ - true - $(ProjectName)_D - - - true - $(ProjectName)_D - .\Windows_Bin\ - - - .\Windows_Bin\ - $(Configuration)\ - false - - - false - .\Windows_Bin - - - - Disabled - $(ACE_ROOT);../Common;./Common;./Encrypt;./LogSystem;./Message;./PacketParse;./Proactor;./Reactor;./UDP;./Console;./TinyXML;./Mail;./FileTest - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level3 - EditAndContinue - - - aced.lib;DbgHelp.lib;psapi.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName)_D.exe - $(ACE_ROOT)\lib;.\Lib;%(AdditionalLibraryDirectories) - true - Console - false - - MachineX86 - - - - - Disabled - $(ACE_ROOT);../Common;./Common;./Encrypt;./LogSystem;./Message;./PacketParse;./Proactor;./Reactor;./UDP;./Console;./TinyXML;./Mail;./FileTest - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - aced.lib;DbgHelp.lib;psapi.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName)_D.exe - $(ACE_ROOT)\lib;.\Lib;%(AdditionalLibraryDirectories) - true - Console - false - - - - - - - $(ACE_ROOT);./Common;./Encrypt;./IObject;./LogSystem;./Message;./PacketParse;./Proactor;./Reactor;./UDP;./Console;./TinyXML;./Mail;./FileTest; - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - - Level3 - ProgramDatabase - - - ace.lib;DbgHelp.lib;psapi.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName)_R.exe - $(ACE_ROOT)\lib;.\Lib;%(AdditionalLibraryDirectories) - true - Console - true - true - false - - MachineX86 - - - - - $(ACE_ROOT);../Common;./Common;./Encrypt;./LogSystem;./Message;./PacketParse;./Proactor;./Reactor;./UDP;./Console;./TinyXML;./Mail;./FileTest - WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - 4091;%(DisableSpecificWarnings) - - - ace.lib;DbgHelp.lib;psapi.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName)_R.exe - $(ACE_ROOT)\lib;.\Lib;%(AdditionalLibraryDirectories) - true - Console - true - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $(IntDir) - $(IntDir) - $(IntDir) - $(IntDir) - - - - - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.obj - $(IntDir)%(Filename)1.xdc - $(IntDir)%(Filename)1.xdc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj.filters b/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj.filters deleted file mode 100644 index 3dc0cb770..000000000 --- a/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj.filters +++ /dev/null @@ -1,1032 +0,0 @@ - - - - - Common\cppfile - - - Proactor\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Common\cppfile - - - Proactor\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Console\cppfile - - - Reactor\cppfile - - - Log\cppfile - - - FileTest\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Message\cppfile - - - Message\cppfile - - - Log\cppfile - - - Common\cppfile - - - Message\cppfile - - - Message\cppfile - - - Message\cppfile - - - Message\cppfile - - - Common\cppfile - - - PacketParse\cppfile - - - PacketParse\cppfile - - - PacketParse\cppfile - - - PacketParse\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Common\cppfile - - - Common\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Main - - - Reactor\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Common\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Mail\cppfile - - - Common\cppfile - - - Common\cppfile - - - tinyXML\cppfile - - - tinyXML\cppfile - - - tinyXML\cppfile - - - tinyXML\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Common\cppfile - - - Message\cppfile - - - Common\cppfile - - - Encrypt\cppfile - - - Encrypt\cppfile - - - Common\cppfile - - - Console\cppfile - - - Message\cppfile - - - Console\cppfile - - - IObject - - - Common\cppfile - - - Common\cppfile - - - Console\cppfile - - - Console\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - Common\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - Mail\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - CppUnit\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - - - Common\hfile - - - Proactor\hfile - - - Reactor\hfile - - - Common\hfile - - - Common\hfile - - - Proactor\hfile - - - Reactor\hfile - - - Common\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Console\hfile - - - Reactor\hfile - - - Common\hfile - - - Log\hfile - - - FileTest\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Message\hfile - - - Message\hfile - - - Log\hfile - - - Common\hfile - - - Message\hfile - - - Message\hfile - - - Message\hfile - - - Message\hfile - - - Common\hfile - - - PacketParse\hfile - - - PacketParse\hfile - - - PacketParse\hfile - - - PacketParse\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Common\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Reactor\hfile - - - Common\hfile - - - Mail\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - tinyXML\hfile - - - tinyXML\hfile - - - Reactor\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Message\hfile - - - Common\hfile - - - Encrypt\hfile - - - Encrypt\hfile - - - FileTest\hfile - - - Common\hfile - - - Console\hfile - - - Message\hfile - - - Console\hfile - - - Common\hfile - - - Common\hfile - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Console\hfile - - - Console\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - Mail\hfile - - - IObject - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - CppUnit\hfile - - - Common\hfile - - - Proactor\hfile - - - Proactor\hfile - - - IObject - - - IObject - - - Proactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Common\hfile - - - - - - - - {6e1a23c5-c02b-4aee-8c08-d3723f10720d} - - - {2a678cc6-c2ae-4c13-aaa7-086e05baf28c} - - - {34c4c620-4b26-491c-a515-fdac51ca51f9} - - - {3b791c4d-65a6-454b-a4b1-2794c06c04a0} - - - {c49d20cb-26cd-4a0a-9f8e-c5cd10998f28} - - - {f37fc6e6-ee47-4cf3-a598-636d72c0edad} - - - {4e976861-1a1e-4f67-b2a4-4bd480ba541c} - - - {785fd0fd-b5dc-4a3c-a1c6-77669c9334c6} - - - {896581cd-642c-4a01-b5d8-170a98f924ab} - - - {a13c567d-c6d1-4684-bad8-3f6d992aa777} - - - {dfc85df2-d608-477b-9f8b-42a2a180038d} - - - {970d6c7c-808b-42bc-9bc9-9539a3cd188d} - - - {eb14e4e1-f354-4e01-aa9d-49a40be305e1} - - - {42777ead-2a37-4713-9cc8-6fc453f631f9} - - - {c6b94503-a35f-4875-aed8-9765f833e62f} - - - {fc710f41-657a-4714-925c-8f101da08a43} - - - {36a16cce-407e-40d5-a447-92dad660ab24} - - - {a141de86-995a-4c13-9e94-1870682a9d70} - - - {fb940973-e613-4320-8aa7-730a843906ac} - - - {f3d9cfb7-6b32-4583-885e-7a4a67b5179d} - - - {4beb72a1-38b1-4c26-a204-63a243264a27} - - - {4f990f22-32e2-479f-b960-e10835d3ef0b} - - - {e2eb1591-de5e-4cee-a500-e30bcca181cd} - - - {1e7d4140-e9e7-4ecb-bad4-32f340ac7bb1} - - - {eedd631e-d496-41f3-ba0a-49baee3570cf} - - - {400682d1-ea86-4aa9-8384-f4d6b733a986} - - - {53b14e23-05f4-443d-a720-6bbbbf87f593} - - - {243887f0-535c-4f57-81a4-d0c303c98805} - - - {c9395047-1d79-4b3d-a7f2-6b377b350f35} - - - {8c5c378f-e2ba-4b48-ab70-112851fb0afb} - - - {435fc3fc-5365-4bd5-8ffe-b55d3faa34f2} - - - {236514d0-07af-4b1d-8016-50b13c571e3a} - - - {b9c7fd4f-4b91-4b70-ac4e-0516b2b19322} - - - {a6a9e4d3-7350-4fa3-ae09-e5a80ed0ee2e} - - - {2c263c1d-404b-43bd-95c7-725b3199c8f8} - - - {0f1feb6c-b6f4-4a7c-b190-f48f8b592edc} - - - {de713252-9822-4162-bdf5-86b770c0d7a7} - - - {0f62b50d-545b-4de3-852e-6f0e85ef76f4} - - - \ No newline at end of file diff --git a/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj.user b/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj.user deleted file mode 100644 index be2507870..000000000 --- a/purenessscopeserver/FrameCore/PSS_vc2015.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/purenessscopeserver/FrameCore/PSS_vc2017.cbp b/purenessscopeserver/FrameCore/PSS_vc2017.cbp new file mode 100644 index 000000000..34035b9f7 --- /dev/null +++ b/purenessscopeserver/FrameCore/PSS_vc2017.cbp @@ -0,0 +1,334 @@ + + + + + + diff --git a/purenessscopeserver/FrameCore/PSS_vc2017.depend b/purenessscopeserver/FrameCore/PSS_vc2017.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/FrameCore/PSS_vc2017.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/FrameCore/PSS_vc2017.layout b/purenessscopeserver/FrameCore/PSS_vc2017.layout new file mode 100644 index 000000000..8aa1df0ae --- /dev/null +++ b/purenessscopeserver/FrameCore/PSS_vc2017.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/FrameCore/PSS_vc2017.vcxproj b/purenessscopeserver/FrameCore/PSS_vc2017.vcxproj index b7eb08062..de330d682 100644 --- a/purenessscopeserver/FrameCore/PSS_vc2017.vcxproj +++ b/purenessscopeserver/FrameCore/PSS_vc2017.vcxproj @@ -22,7 +22,7 @@ {8C99CA60-B114-4866-8D87-9DC0C17831F3} PurenessScopeServer Win32Proj - 10.0.16299.0 + 10.0.17763.0 @@ -67,7 +67,7 @@ <_ProjectFileVersion>11.0.50727.1 - .\Windows_Bin\ + ..\..\Build\Windows\ $(Configuration)\ true $(ProjectName)_D @@ -75,7 +75,7 @@ true $(ProjectName)_D - .\Windows_Bin\ + ..\..\Build\Windows\ .\Windows_Bin\ @@ -84,7 +84,8 @@ false - .\Windows_Bin + $(SolutionDir)\Windows_Bin + $(SolutionDir)\Temp\ @@ -236,7 +237,9 @@ + + @@ -330,12 +333,6 @@ - - - - - - @@ -655,6 +652,7 @@ + @@ -674,7 +672,7 @@ - + diff --git a/purenessscopeserver/FrameCore/PSS_vc2017.vcxproj.filters b/purenessscopeserver/FrameCore/PSS_vc2017.vcxproj.filters deleted file mode 100644 index 69d758263..000000000 --- a/purenessscopeserver/FrameCore/PSS_vc2017.vcxproj.filters +++ /dev/null @@ -1,1023 +0,0 @@ - - - - - Common\cppfile - - - Proactor\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Common\cppfile - - - Proactor\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Console\cppfile - - - Reactor\cppfile - - - Log\cppfile - - - FileTest\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Message\cppfile - - - Message\cppfile - - - Log\cppfile - - - Common\cppfile - - - Message\cppfile - - - Message\cppfile - - - Message\cppfile - - - Message\cppfile - - - Common\cppfile - - - PacketParse\cppfile - - - PacketParse\cppfile - - - PacketParse\cppfile - - - PacketParse\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Common\cppfile - - - Common\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - Main - - - Reactor\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Common\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Mail\cppfile - - - Common\cppfile - - - Common\cppfile - - - tinyXML\cppfile - - - tinyXML\cppfile - - - tinyXML\cppfile - - - tinyXML\cppfile - - - Reactor\cppfile - - - Common\cppfile - - - Common\cppfile - - - Message\cppfile - - - Common\cppfile - - - Encrypt\cppfile - - - Encrypt\cppfile - - - Common\cppfile - - - Console\cppfile - - - Message\cppfile - - - Console\cppfile - - - IObject - - - Common\cppfile - - - Common\cppfile - - - Console\cppfile - - - Console\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - Common\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - CppUnit\cppfile - - - Mail\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - Common\cppfile - - - CppUnit\cppfile - - - Reactor\cppfile - - - Reactor\cppfile - - - Proactor\cppfile - - - Proactor\cppfile - - - - - Common\hfile - - - Proactor\hfile - - - Reactor\hfile - - - Common\hfile - - - Common\hfile - - - Proactor\hfile - - - Reactor\hfile - - - Common\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Console\hfile - - - Reactor\hfile - - - Common\hfile - - - Log\hfile - - - FileTest\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Message\hfile - - - Message\hfile - - - Log\hfile - - - Common\hfile - - - Message\hfile - - - Message\hfile - - - Message\hfile - - - Message\hfile - - - Common\hfile - - - PacketParse\hfile - - - PacketParse\hfile - - - PacketParse\hfile - - - PacketParse\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Common\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Reactor\hfile - - - Common\hfile - - - Mail\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - tinyXML\hfile - - - tinyXML\hfile - - - Reactor\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Message\hfile - - - Common\hfile - - - Encrypt\hfile - - - Encrypt\hfile - - - FileTest\hfile - - - Common\hfile - - - Console\hfile - - - Message\hfile - - - Console\hfile - - - Common\hfile - - - Common\hfile - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - IObject - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Console\hfile - - - Console\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - CppUnit\hfile - - - Mail\hfile - - - IObject - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - Common\hfile - - - CppUnit\hfile - - - Reactor\hfile - - - Reactor\hfile - - - Proactor\hfile - - - Proactor\hfile - - - Common\hfile - - - - - - - - {6e1a23c5-c02b-4aee-8c08-d3723f10720d} - - - {2a678cc6-c2ae-4c13-aaa7-086e05baf28c} - - - {34c4c620-4b26-491c-a515-fdac51ca51f9} - - - {3b791c4d-65a6-454b-a4b1-2794c06c04a0} - - - {c49d20cb-26cd-4a0a-9f8e-c5cd10998f28} - - - {f37fc6e6-ee47-4cf3-a598-636d72c0edad} - - - {4e976861-1a1e-4f67-b2a4-4bd480ba541c} - - - {785fd0fd-b5dc-4a3c-a1c6-77669c9334c6} - - - {896581cd-642c-4a01-b5d8-170a98f924ab} - - - {a13c567d-c6d1-4684-bad8-3f6d992aa777} - - - {dfc85df2-d608-477b-9f8b-42a2a180038d} - - - {970d6c7c-808b-42bc-9bc9-9539a3cd188d} - - - {eb14e4e1-f354-4e01-aa9d-49a40be305e1} - - - {42777ead-2a37-4713-9cc8-6fc453f631f9} - - - {c6b94503-a35f-4875-aed8-9765f833e62f} - - - {fc710f41-657a-4714-925c-8f101da08a43} - - - {36a16cce-407e-40d5-a447-92dad660ab24} - - - {a141de86-995a-4c13-9e94-1870682a9d70} - - - {fb940973-e613-4320-8aa7-730a843906ac} - - - {f3d9cfb7-6b32-4583-885e-7a4a67b5179d} - - - {4beb72a1-38b1-4c26-a204-63a243264a27} - - - {4f990f22-32e2-479f-b960-e10835d3ef0b} - - - {e2eb1591-de5e-4cee-a500-e30bcca181cd} - - - {1e7d4140-e9e7-4ecb-bad4-32f340ac7bb1} - - - {eedd631e-d496-41f3-ba0a-49baee3570cf} - - - {400682d1-ea86-4aa9-8384-f4d6b733a986} - - - {53b14e23-05f4-443d-a720-6bbbbf87f593} - - - {243887f0-535c-4f57-81a4-d0c303c98805} - - - {c9395047-1d79-4b3d-a7f2-6b377b350f35} - - - {8c5c378f-e2ba-4b48-ab70-112851fb0afb} - - - {435fc3fc-5365-4bd5-8ffe-b55d3faa34f2} - - - {236514d0-07af-4b1d-8016-50b13c571e3a} - - - {b9c7fd4f-4b91-4b70-ac4e-0516b2b19322} - - - {a6a9e4d3-7350-4fa3-ae09-e5a80ed0ee2e} - - - {2c263c1d-404b-43bd-95c7-725b3199c8f8} - - - {0f1feb6c-b6f4-4a7c-b190-f48f8b592edc} - - - {de713252-9822-4162-bdf5-86b770c0d7a7} - - - {0f62b50d-545b-4de3-852e-6f0e85ef76f4} - - - \ No newline at end of file diff --git a/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.cpp b/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.cpp index d0d409508..d394108ae 100644 --- a/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.cpp +++ b/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.cpp @@ -20,6 +20,11 @@ CPacketParseBase::CPacketParseBase(void) m_pPacketHeadInfo = NULL; } +CPacketParseBase::CPacketParseBase(const CPacketParseBase& ar) +{ + (*this) = ar; +} + CPacketParseBase::~CPacketParseBase(void) { SAFE_DELETE(m_pPacketHeadInfo); diff --git a/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.h b/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.h index 55b8a068b..7e6b6c8d3 100644 --- a/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.h +++ b/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.h @@ -17,6 +17,18 @@ class CPacketParseBase virtual ~CPacketParseBase(void); + CPacketParseBase(const CPacketParseBase& ar); + + CPacketParseBase& operator = (const CPacketParseBase& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Clear(); void Close(); diff --git a/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.cpp b/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.cpp index e3e54ce39..82c37fe17 100644 --- a/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.cpp +++ b/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.cpp @@ -4,6 +4,11 @@ CPacketParsePool::CPacketParsePool() { } +CPacketParsePool::CPacketParsePool(const CPacketParsePool& ar) +{ + (*this) = ar; +} + CPacketParsePool::~CPacketParsePool() { OUR_DEBUG((LM_INFO, "[CPacketParsePool::~CPacketParsePool].\n")); @@ -40,11 +45,11 @@ CPacketParse* CPacketParsePool::Create(const char* pFileName, uint32 u4Line) bool CPacketParsePool::Delete(CPacketParse* pPacketParse, bool blDelete) { - if (NULL == pPacketParse) - { - OUR_DEBUG((LM_INFO, "[CPacketParsePool::Delete] pPacketParse is NULL.\n")); - return false; - } + if (NULL == pPacketParse) + { + OUR_DEBUG((LM_INFO, "[CPacketParsePool::Delete] pPacketParse is NULL.\n")); + return false; + } if (true == blDelete) { diff --git a/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.h b/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.h index 271ae2c82..928b3e98f 100644 --- a/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.h +++ b/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.h @@ -15,6 +15,18 @@ class CPacketParsePool : public CObjectPoolManagerInit(GetXmlConfigAttribute(xmlSendInfo)->SendQueueCount); + //ʼ߼߳ + App_LogicThreadManager::instance()->Init(); + //ʼĶӿ IConnectManager* pConnectManager = dynamic_cast(App_ProConnectManager::instance()); IClientManager* pClientManager = dynamic_cast(App_ClientProConnectManager::instance()); @@ -68,13 +71,16 @@ bool CProServerManager::Init() ITSTimerManager* pTSTimer = dynamic_cast(&m_TSThread); IServerManager* pServerManager = dynamic_cast(this); ITTyClientManager* pTTyClientManager = dynamic_cast(App_ProTTyClientManager::instance()); + ILogicThreadManager* pLogicThreadManager = dynamic_cast(App_LogicThreadManager::instance()); + Server_Manager_Common_IObject(pConnectManager, pClientManager, pUDPConnectManager, pFrameCommand, pServerManager, pTSTimer, - pTTyClientManager); + pTTyClientManager, + pLogicThreadManager); //ʼģأΪܰмӼ if (false == Server_Manager_Common_Module()) @@ -368,6 +374,9 @@ bool CProServerManager::Close() App_ProConnectAcceptManager::instance()->Close(); OUR_DEBUG((LM_INFO, "[CProServerManager::Close]Close App_ProConnectAcceptManager OK.\n")); + App_LogicThreadManager::instance()->Close(); + OUR_DEBUG((LM_INFO, "[CServerManager::Close]Close App_LogicThreadManager OK.\n")); + m_ProConsoleConnectAcceptor.cancel(); App_TimerManager::instance()->deactivate(); OUR_DEBUG((LM_INFO, "[CProServerManager::Close]Close App_TimerManager OK.\n")); diff --git a/purenessscopeserver/FrameCore/Proactor/ProServerManager.h b/purenessscopeserver/FrameCore/Proactor/ProServerManager.h index 0ba7823d5..d4e5ac523 100644 --- a/purenessscopeserver/FrameCore/Proactor/ProServerManager.h +++ b/purenessscopeserver/FrameCore/Proactor/ProServerManager.h @@ -9,6 +9,7 @@ #include "ClientProConnectManager.h" #include "ProUDPManager.h" #include "XmlConfig.h" +#include "LogicThreadManager.h" //ӶԷƵ֧֣Consoleģ֧ԷĿ //add by freeeyes diff --git a/purenessscopeserver/FrameCore/PurenessScopeServer.mk b/purenessscopeserver/FrameCore/PurenessScopeServer.mk new file mode 100644 index 000000000..f10982382 --- /dev/null +++ b/purenessscopeserver/FrameCore/PurenessScopeServer.mk @@ -0,0 +1,756 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PurenessScopeServer +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PurenessScopeServer.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../purenessscopeserver/Common $(IncludeSwitch)./Common $(IncludeSwitch)../../ThirdLib/include/TinyXML $(IncludeSwitch)./Mail $(IncludeSwitch)./Message $(IncludeSwitch)./LogSystem $(IncludeSwitch)./Reactor $(IncludeSwitch)./PacketParse $(IncludeSwitch)./FileTest $(IncludeSwitch)./UDP $(IncludeSwitch)./Console +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)ACE $(LibrarySwitch)dl $(LibrarySwitch)pthread +ArLibs := "libACE.so" "libdl.so" "libpthread.so" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ $(LibraryPathSwitch)/usr/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_ACEMemory.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_RandomNumber.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_Time_Value.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_TimerThread.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BuffPacket.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BuffPacketManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_CommandAccount.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Common_ForbiddenIP.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_Threading.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_IPAccount.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_MessageBlockManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_ServerMessageTask.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_ThreadInfo.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_TimerManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_WindowsProcess.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseTask.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Common_XmlConfig.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_Common_TimerInfo.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_WindowsCPU.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseServerManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_LogicThreadManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_SendCacheManager.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(ObjectSuffix) $(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_LinuxCPU.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_ProgramService.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseHander.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_MakePacket.cpp$(ObjectSuffix) + +Objects1=$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_Message.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Common_AppConfig.cpp$(ObjectSuffix) $(IntermediateDirectory)/FileTest_FileTestManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_MessageDefine.cpp$(ObjectSuffix) $(IntermediateDirectory)/PacketParse_PacketParse.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_ProfileTime.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_BaseConnectClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConnectClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ServerManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_ConsolePromiss.cpp$(ObjectSuffix) $(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Message_MessageManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Mail_smtps.cpp$(ObjectSuffix) $(IntermediateDirectory)/LogSystem_LogManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/PurenessScopeServer.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_SendMessage.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Reactor_ControlListen.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_TcpRedirection.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/LogSystem_FileLogger.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_WorkThreadAI.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_MessageService.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_LoadPacketParse.cpp$(ObjectSuffix) $(IntermediateDirectory)/Message_LoadModule.cpp$(ObjectSuffix) $(IntermediateDirectory)/Mail_base64.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_MessageDispose.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) + +Objects2=$(IntermediateDirectory)/Mail_smtp.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_FrameCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Console_ConsoleMessage.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_XmlOpeation.cpp$(ObjectSuffix) \ + + + + +Objects=$(Objects0) $(Objects1) $(Objects2) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + @echo $(Objects1) >> $(ObjectsFileList) + @echo $(Objects2) >> $(ObjectsFileList) + $(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(ObjectSuffix): ../Common/ACEMemory.cpp $(IntermediateDirectory)/up_Common_ACEMemory.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/Common/ACEMemory.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(DependSuffix): ../Common/ACEMemory.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(DependSuffix) -MM ../Common/ACEMemory.cpp + +$(IntermediateDirectory)/up_Common_ACEMemory.cpp$(PreprocessSuffix): ../Common/ACEMemory.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_ACEMemory.cpp$(PreprocessSuffix) ../Common/ACEMemory.cpp + +$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(ObjectSuffix): ../Common/RandomNumber.cpp $(IntermediateDirectory)/up_Common_RandomNumber.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/Common/RandomNumber.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(DependSuffix): ../Common/RandomNumber.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(DependSuffix) -MM ../Common/RandomNumber.cpp + +$(IntermediateDirectory)/up_Common_RandomNumber.cpp$(PreprocessSuffix): ../Common/RandomNumber.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_RandomNumber.cpp$(PreprocessSuffix) ../Common/RandomNumber.cpp + +$(IntermediateDirectory)/up_Common_Time_Value.cpp$(ObjectSuffix): ../Common/Time_Value.cpp $(IntermediateDirectory)/up_Common_Time_Value.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/Common/Time_Value.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_Time_Value.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_Time_Value.cpp$(DependSuffix): ../Common/Time_Value.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_Time_Value.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_Time_Value.cpp$(DependSuffix) -MM ../Common/Time_Value.cpp + +$(IntermediateDirectory)/up_Common_Time_Value.cpp$(PreprocessSuffix): ../Common/Time_Value.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_Time_Value.cpp$(PreprocessSuffix) ../Common/Time_Value.cpp + +$(IntermediateDirectory)/up_Common_TimerThread.cpp$(ObjectSuffix): ../Common/TimerThread.cpp $(IntermediateDirectory)/up_Common_TimerThread.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/Common/TimerThread.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_TimerThread.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_TimerThread.cpp$(DependSuffix): ../Common/TimerThread.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_TimerThread.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_TimerThread.cpp$(DependSuffix) -MM ../Common/TimerThread.cpp + +$(IntermediateDirectory)/up_Common_TimerThread.cpp$(PreprocessSuffix): ../Common/TimerThread.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_TimerThread.cpp$(PreprocessSuffix) ../Common/TimerThread.cpp + +$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(ObjectSuffix): Common/BaseConsoleHandle.cpp $(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/BaseConsoleHandle.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(DependSuffix): Common/BaseConsoleHandle.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(DependSuffix) -MM Common/BaseConsoleHandle.cpp + +$(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(PreprocessSuffix): Common/BaseConsoleHandle.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseConsoleHandle.cpp$(PreprocessSuffix) Common/BaseConsoleHandle.cpp + +$(IntermediateDirectory)/Common_BuffPacket.cpp$(ObjectSuffix): Common/BuffPacket.cpp $(IntermediateDirectory)/Common_BuffPacket.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/BuffPacket.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BuffPacket.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BuffPacket.cpp$(DependSuffix): Common/BuffPacket.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BuffPacket.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BuffPacket.cpp$(DependSuffix) -MM Common/BuffPacket.cpp + +$(IntermediateDirectory)/Common_BuffPacket.cpp$(PreprocessSuffix): Common/BuffPacket.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BuffPacket.cpp$(PreprocessSuffix) Common/BuffPacket.cpp + +$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(ObjectSuffix): Common/BuffPacketManager.cpp $(IntermediateDirectory)/Common_BuffPacketManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/BuffPacketManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(DependSuffix): Common/BuffPacketManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(DependSuffix) -MM Common/BuffPacketManager.cpp + +$(IntermediateDirectory)/Common_BuffPacketManager.cpp$(PreprocessSuffix): Common/BuffPacketManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BuffPacketManager.cpp$(PreprocessSuffix) Common/BuffPacketManager.cpp + +$(IntermediateDirectory)/Common_CommandAccount.cpp$(ObjectSuffix): Common/CommandAccount.cpp $(IntermediateDirectory)/Common_CommandAccount.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/CommandAccount.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_CommandAccount.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_CommandAccount.cpp$(DependSuffix): Common/CommandAccount.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_CommandAccount.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_CommandAccount.cpp$(DependSuffix) -MM Common/CommandAccount.cpp + +$(IntermediateDirectory)/Common_CommandAccount.cpp$(PreprocessSuffix): Common/CommandAccount.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_CommandAccount.cpp$(PreprocessSuffix) Common/CommandAccount.cpp + +$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(ObjectSuffix): Common/ForbiddenIP.cpp $(IntermediateDirectory)/Common_ForbiddenIP.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/ForbiddenIP.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(DependSuffix): Common/ForbiddenIP.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(DependSuffix) -MM Common/ForbiddenIP.cpp + +$(IntermediateDirectory)/Common_ForbiddenIP.cpp$(PreprocessSuffix): Common/ForbiddenIP.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ForbiddenIP.cpp$(PreprocessSuffix) Common/ForbiddenIP.cpp + +$(IntermediateDirectory)/up_Common_Threading.cpp$(ObjectSuffix): ../Common/Threading.cpp $(IntermediateDirectory)/up_Common_Threading.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/Common/Threading.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_Threading.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_Threading.cpp$(DependSuffix): ../Common/Threading.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_Threading.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_Threading.cpp$(DependSuffix) -MM ../Common/Threading.cpp + +$(IntermediateDirectory)/up_Common_Threading.cpp$(PreprocessSuffix): ../Common/Threading.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_Threading.cpp$(PreprocessSuffix) ../Common/Threading.cpp + +$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(ObjectSuffix): Common/Frame_Logging_Strategy.cpp $(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/Frame_Logging_Strategy.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(DependSuffix): Common/Frame_Logging_Strategy.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(DependSuffix) -MM Common/Frame_Logging_Strategy.cpp + +$(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(PreprocessSuffix): Common/Frame_Logging_Strategy.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_Frame_Logging_Strategy.cpp$(PreprocessSuffix) Common/Frame_Logging_Strategy.cpp + +$(IntermediateDirectory)/Common_IPAccount.cpp$(ObjectSuffix): Common/IPAccount.cpp $(IntermediateDirectory)/Common_IPAccount.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/IPAccount.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_IPAccount.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_IPAccount.cpp$(DependSuffix): Common/IPAccount.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_IPAccount.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_IPAccount.cpp$(DependSuffix) -MM Common/IPAccount.cpp + +$(IntermediateDirectory)/Common_IPAccount.cpp$(PreprocessSuffix): Common/IPAccount.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_IPAccount.cpp$(PreprocessSuffix) Common/IPAccount.cpp + +$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(ObjectSuffix): Common/MessageBlockManager.cpp $(IntermediateDirectory)/Common_MessageBlockManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/MessageBlockManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(DependSuffix): Common/MessageBlockManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(DependSuffix) -MM Common/MessageBlockManager.cpp + +$(IntermediateDirectory)/Common_MessageBlockManager.cpp$(PreprocessSuffix): Common/MessageBlockManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_MessageBlockManager.cpp$(PreprocessSuffix) Common/MessageBlockManager.cpp + +$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(ObjectSuffix): Common/ServerMessageTask.cpp $(IntermediateDirectory)/Common_ServerMessageTask.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/ServerMessageTask.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(DependSuffix): Common/ServerMessageTask.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(DependSuffix) -MM Common/ServerMessageTask.cpp + +$(IntermediateDirectory)/Common_ServerMessageTask.cpp$(PreprocessSuffix): Common/ServerMessageTask.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ServerMessageTask.cpp$(PreprocessSuffix) Common/ServerMessageTask.cpp + +$(IntermediateDirectory)/Common_ThreadInfo.cpp$(ObjectSuffix): Common/ThreadInfo.cpp $(IntermediateDirectory)/Common_ThreadInfo.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/ThreadInfo.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ThreadInfo.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ThreadInfo.cpp$(DependSuffix): Common/ThreadInfo.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ThreadInfo.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ThreadInfo.cpp$(DependSuffix) -MM Common/ThreadInfo.cpp + +$(IntermediateDirectory)/Common_ThreadInfo.cpp$(PreprocessSuffix): Common/ThreadInfo.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ThreadInfo.cpp$(PreprocessSuffix) Common/ThreadInfo.cpp + +$(IntermediateDirectory)/Common_TimerManager.cpp$(ObjectSuffix): Common/TimerManager.cpp $(IntermediateDirectory)/Common_TimerManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/TimerManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_TimerManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_TimerManager.cpp$(DependSuffix): Common/TimerManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_TimerManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_TimerManager.cpp$(DependSuffix) -MM Common/TimerManager.cpp + +$(IntermediateDirectory)/Common_TimerManager.cpp$(PreprocessSuffix): Common/TimerManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_TimerManager.cpp$(PreprocessSuffix) Common/TimerManager.cpp + +$(IntermediateDirectory)/Common_WindowsProcess.cpp$(ObjectSuffix): Common/WindowsProcess.cpp $(IntermediateDirectory)/Common_WindowsProcess.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/WindowsProcess.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_WindowsProcess.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_WindowsProcess.cpp$(DependSuffix): Common/WindowsProcess.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_WindowsProcess.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_WindowsProcess.cpp$(DependSuffix) -MM Common/WindowsProcess.cpp + +$(IntermediateDirectory)/Common_WindowsProcess.cpp$(PreprocessSuffix): Common/WindowsProcess.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_WindowsProcess.cpp$(PreprocessSuffix) Common/WindowsProcess.cpp + +$(IntermediateDirectory)/Common_BaseTask.cpp$(ObjectSuffix): Common/BaseTask.cpp $(IntermediateDirectory)/Common_BaseTask.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/BaseTask.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseTask.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseTask.cpp$(DependSuffix): Common/BaseTask.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseTask.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseTask.cpp$(DependSuffix) -MM Common/BaseTask.cpp + +$(IntermediateDirectory)/Common_BaseTask.cpp$(PreprocessSuffix): Common/BaseTask.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseTask.cpp$(PreprocessSuffix) Common/BaseTask.cpp + +$(IntermediateDirectory)/Common_XmlConfig.cpp$(ObjectSuffix): Common/XmlConfig.cpp $(IntermediateDirectory)/Common_XmlConfig.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/XmlConfig.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_XmlConfig.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_XmlConfig.cpp$(DependSuffix): Common/XmlConfig.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_XmlConfig.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_XmlConfig.cpp$(DependSuffix) -MM Common/XmlConfig.cpp + +$(IntermediateDirectory)/Common_XmlConfig.cpp$(PreprocessSuffix): Common/XmlConfig.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_XmlConfig.cpp$(PreprocessSuffix) Common/XmlConfig.cpp + +$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(ObjectSuffix): ../Common/TimerInfo.cpp $(IntermediateDirectory)/up_Common_TimerInfo.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/Common/TimerInfo.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(DependSuffix): ../Common/TimerInfo.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(DependSuffix) -MM ../Common/TimerInfo.cpp + +$(IntermediateDirectory)/up_Common_TimerInfo.cpp$(PreprocessSuffix): ../Common/TimerInfo.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_Common_TimerInfo.cpp$(PreprocessSuffix) ../Common/TimerInfo.cpp + +$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(ObjectSuffix): Message/MessageDyeingManager.cpp $(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/MessageDyeingManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(DependSuffix): Message/MessageDyeingManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(DependSuffix) -MM Message/MessageDyeingManager.cpp + +$(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(PreprocessSuffix): Message/MessageDyeingManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_MessageDyeingManager.cpp$(PreprocessSuffix) Message/MessageDyeingManager.cpp + +$(IntermediateDirectory)/Common_WindowsCPU.cpp$(ObjectSuffix): Common/WindowsCPU.cpp $(IntermediateDirectory)/Common_WindowsCPU.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/WindowsCPU.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_WindowsCPU.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_WindowsCPU.cpp$(DependSuffix): Common/WindowsCPU.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_WindowsCPU.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_WindowsCPU.cpp$(DependSuffix) -MM Common/WindowsCPU.cpp + +$(IntermediateDirectory)/Common_WindowsCPU.cpp$(PreprocessSuffix): Common/WindowsCPU.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_WindowsCPU.cpp$(PreprocessSuffix) Common/WindowsCPU.cpp + +$(IntermediateDirectory)/Common_BaseServerManager.cpp$(ObjectSuffix): Common/BaseServerManager.cpp $(IntermediateDirectory)/Common_BaseServerManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/BaseServerManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseServerManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseServerManager.cpp$(DependSuffix): Common/BaseServerManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseServerManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseServerManager.cpp$(DependSuffix) -MM Common/BaseServerManager.cpp + +$(IntermediateDirectory)/Common_BaseServerManager.cpp$(PreprocessSuffix): Common/BaseServerManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseServerManager.cpp$(PreprocessSuffix) Common/BaseServerManager.cpp + +$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(ObjectSuffix): PacketParse/PacketConsoleParse.cpp $(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/PacketParse/PacketConsoleParse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(DependSuffix): PacketParse/PacketConsoleParse.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(DependSuffix) -MM PacketParse/PacketConsoleParse.cpp + +$(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(PreprocessSuffix): PacketParse/PacketConsoleParse.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_PacketConsoleParse.cpp$(PreprocessSuffix) PacketParse/PacketConsoleParse.cpp + +$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(ObjectSuffix): Message/LogicThreadManager.cpp $(IntermediateDirectory)/Message_LogicThreadManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/LogicThreadManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(DependSuffix): Message/LogicThreadManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(DependSuffix) -MM Message/LogicThreadManager.cpp + +$(IntermediateDirectory)/Message_LogicThreadManager.cpp$(PreprocessSuffix): Message/LogicThreadManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_LogicThreadManager.cpp$(PreprocessSuffix) Message/LogicThreadManager.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(ObjectSuffix): Common/BaseClientConnectManager.cpp $(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/BaseClientConnectManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(DependSuffix): Common/BaseClientConnectManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(DependSuffix) -MM Common/BaseClientConnectManager.cpp + +$(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(PreprocessSuffix): Common/BaseClientConnectManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseClientConnectManager.cpp$(PreprocessSuffix) Common/BaseClientConnectManager.cpp + +$(IntermediateDirectory)/Common_SendCacheManager.cpp$(ObjectSuffix): Common/SendCacheManager.cpp $(IntermediateDirectory)/Common_SendCacheManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/SendCacheManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_SendCacheManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_SendCacheManager.cpp$(DependSuffix): Common/SendCacheManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_SendCacheManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_SendCacheManager.cpp$(DependSuffix) -MM Common/SendCacheManager.cpp + +$(IntermediateDirectory)/Common_SendCacheManager.cpp$(PreprocessSuffix): Common/SendCacheManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_SendCacheManager.cpp$(PreprocessSuffix) Common/SendCacheManager.cpp + +$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(ObjectSuffix): Reactor/AceReactorManager.cpp $(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/AceReactorManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(DependSuffix): Reactor/AceReactorManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(DependSuffix) -MM Reactor/AceReactorManager.cpp + +$(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(PreprocessSuffix): Reactor/AceReactorManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_AceReactorManager.cpp$(PreprocessSuffix) Reactor/AceReactorManager.cpp + +$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(ObjectSuffix): Common/MyACELoggingStrategy.cpp $(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/MyACELoggingStrategy.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(DependSuffix): Common/MyACELoggingStrategy.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(DependSuffix) -MM Common/MyACELoggingStrategy.cpp + +$(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(PreprocessSuffix): Common/MyACELoggingStrategy.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_MyACELoggingStrategy.cpp$(PreprocessSuffix) Common/MyACELoggingStrategy.cpp + +$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(ObjectSuffix): PacketParse/PacketParsePool.cpp $(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/PacketParse/PacketParsePool.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(DependSuffix): PacketParse/PacketParsePool.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(DependSuffix) -MM PacketParse/PacketParsePool.cpp + +$(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(PreprocessSuffix): PacketParse/PacketParsePool.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_PacketParsePool.cpp$(PreprocessSuffix) PacketParse/PacketParsePool.cpp + +$(IntermediateDirectory)/Common_LinuxCPU.cpp$(ObjectSuffix): Common/LinuxCPU.cpp $(IntermediateDirectory)/Common_LinuxCPU.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/LinuxCPU.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_LinuxCPU.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_LinuxCPU.cpp$(DependSuffix): Common/LinuxCPU.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_LinuxCPU.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_LinuxCPU.cpp$(DependSuffix) -MM Common/LinuxCPU.cpp + +$(IntermediateDirectory)/Common_LinuxCPU.cpp$(PreprocessSuffix): Common/LinuxCPU.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_LinuxCPU.cpp$(PreprocessSuffix) Common/LinuxCPU.cpp + +$(IntermediateDirectory)/Common_ProgramService.cpp$(ObjectSuffix): Common/ProgramService.cpp $(IntermediateDirectory)/Common_ProgramService.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/ProgramService.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ProgramService.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ProgramService.cpp$(DependSuffix): Common/ProgramService.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ProgramService.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ProgramService.cpp$(DependSuffix) -MM Common/ProgramService.cpp + +$(IntermediateDirectory)/Common_ProgramService.cpp$(PreprocessSuffix): Common/ProgramService.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ProgramService.cpp$(PreprocessSuffix) Common/ProgramService.cpp + +$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(ObjectSuffix): Reactor/ConsoleHandler.cpp $(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(DependSuffix): Reactor/ConsoleHandler.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(DependSuffix) -MM Reactor/ConsoleHandler.cpp + +$(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(PreprocessSuffix): Reactor/ConsoleHandler.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConsoleHandler.cpp$(PreprocessSuffix) Reactor/ConsoleHandler.cpp + +$(IntermediateDirectory)/Common_BaseHander.cpp$(ObjectSuffix): Common/BaseHander.cpp $(IntermediateDirectory)/Common_BaseHander.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/BaseHander.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseHander.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseHander.cpp$(DependSuffix): Common/BaseHander.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseHander.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseHander.cpp$(DependSuffix) -MM Common/BaseHander.cpp + +$(IntermediateDirectory)/Common_BaseHander.cpp$(PreprocessSuffix): Common/BaseHander.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseHander.cpp$(PreprocessSuffix) Common/BaseHander.cpp + +$(IntermediateDirectory)/Common_MakePacket.cpp$(ObjectSuffix): Common/MakePacket.cpp $(IntermediateDirectory)/Common_MakePacket.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/MakePacket.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_MakePacket.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_MakePacket.cpp$(DependSuffix): Common/MakePacket.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_MakePacket.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_MakePacket.cpp$(DependSuffix) -MM Common/MakePacket.cpp + +$(IntermediateDirectory)/Common_MakePacket.cpp$(PreprocessSuffix): Common/MakePacket.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_MakePacket.cpp$(PreprocessSuffix) Common/MakePacket.cpp + +$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(ObjectSuffix): Reactor/WaitQuitSignal.cpp $(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/WaitQuitSignal.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(DependSuffix): Reactor/WaitQuitSignal.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(DependSuffix) -MM Reactor/WaitQuitSignal.cpp + +$(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(PreprocessSuffix): Reactor/WaitQuitSignal.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_WaitQuitSignal.cpp$(PreprocessSuffix) Reactor/WaitQuitSignal.cpp + +$(IntermediateDirectory)/Message_Message.cpp$(ObjectSuffix): Message/Message.cpp $(IntermediateDirectory)/Message_Message.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/Message.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_Message.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_Message.cpp$(DependSuffix): Message/Message.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_Message.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_Message.cpp$(DependSuffix) -MM Message/Message.cpp + +$(IntermediateDirectory)/Message_Message.cpp$(PreprocessSuffix): Message/Message.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_Message.cpp$(PreprocessSuffix) Message/Message.cpp + +$(IntermediateDirectory)/Common_AppConfig.cpp$(ObjectSuffix): Common/AppConfig.cpp $(IntermediateDirectory)/Common_AppConfig.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/AppConfig.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_AppConfig.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_AppConfig.cpp$(DependSuffix): Common/AppConfig.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_AppConfig.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_AppConfig.cpp$(DependSuffix) -MM Common/AppConfig.cpp + +$(IntermediateDirectory)/Common_AppConfig.cpp$(PreprocessSuffix): Common/AppConfig.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_AppConfig.cpp$(PreprocessSuffix) Common/AppConfig.cpp + +$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(ObjectSuffix): FileTest/FileTestManager.cpp $(IntermediateDirectory)/FileTest_FileTestManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/FileTest/FileTestManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(DependSuffix): FileTest/FileTestManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(DependSuffix) -MM FileTest/FileTestManager.cpp + +$(IntermediateDirectory)/FileTest_FileTestManager.cpp$(PreprocessSuffix): FileTest/FileTestManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/FileTest_FileTestManager.cpp$(PreprocessSuffix) FileTest/FileTestManager.cpp + +$(IntermediateDirectory)/Console_MessageDefine.cpp$(ObjectSuffix): Console/MessageDefine.cpp $(IntermediateDirectory)/Console_MessageDefine.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Console/MessageDefine.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_MessageDefine.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_MessageDefine.cpp$(DependSuffix): Console/MessageDefine.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_MessageDefine.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_MessageDefine.cpp$(DependSuffix) -MM Console/MessageDefine.cpp + +$(IntermediateDirectory)/Console_MessageDefine.cpp$(PreprocessSuffix): Console/MessageDefine.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_MessageDefine.cpp$(PreprocessSuffix) Console/MessageDefine.cpp + +$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(ObjectSuffix): PacketParse/PacketParse.cpp $(IntermediateDirectory)/PacketParse_PacketParse.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/PacketParse/PacketParse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(DependSuffix): PacketParse/PacketParse.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(DependSuffix) -MM PacketParse/PacketParse.cpp + +$(IntermediateDirectory)/PacketParse_PacketParse.cpp$(PreprocessSuffix): PacketParse/PacketParse.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_PacketParse.cpp$(PreprocessSuffix) PacketParse/PacketParse.cpp + +$(IntermediateDirectory)/Common_ProfileTime.cpp$(ObjectSuffix): Common/ProfileTime.cpp $(IntermediateDirectory)/Common_ProfileTime.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/ProfileTime.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_ProfileTime.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_ProfileTime.cpp$(DependSuffix): Common/ProfileTime.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_ProfileTime.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_ProfileTime.cpp$(DependSuffix) -MM Common/ProfileTime.cpp + +$(IntermediateDirectory)/Common_ProfileTime.cpp$(PreprocessSuffix): Common/ProfileTime.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_ProfileTime.cpp$(PreprocessSuffix) Common/ProfileTime.cpp + +$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(ObjectSuffix): Common/BaseConnectClient.cpp $(IntermediateDirectory)/Common_BaseConnectClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/BaseConnectClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(DependSuffix): Common/BaseConnectClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(DependSuffix) -MM Common/BaseConnectClient.cpp + +$(IntermediateDirectory)/Common_BaseConnectClient.cpp$(PreprocessSuffix): Common/BaseConnectClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_BaseConnectClient.cpp$(PreprocessSuffix) Common/BaseConnectClient.cpp + +$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(ObjectSuffix): Reactor/ConnectClient.cpp $(IntermediateDirectory)/Reactor_ConnectClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ConnectClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(DependSuffix): Reactor/ConnectClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(DependSuffix) -MM Reactor/ConnectClient.cpp + +$(IntermediateDirectory)/Reactor_ConnectClient.cpp$(PreprocessSuffix): Reactor/ConnectClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConnectClient.cpp$(PreprocessSuffix) Reactor/ConnectClient.cpp + +$(IntermediateDirectory)/Reactor_ServerManager.cpp$(ObjectSuffix): Reactor/ServerManager.cpp $(IntermediateDirectory)/Reactor_ServerManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ServerManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ServerManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ServerManager.cpp$(DependSuffix): Reactor/ServerManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ServerManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ServerManager.cpp$(DependSuffix) -MM Reactor/ServerManager.cpp + +$(IntermediateDirectory)/Reactor_ServerManager.cpp$(PreprocessSuffix): Reactor/ServerManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ServerManager.cpp$(PreprocessSuffix) Reactor/ServerManager.cpp + +$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(ObjectSuffix): Console/ConsolePromiss.cpp $(IntermediateDirectory)/Console_ConsolePromiss.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Console/ConsolePromiss.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(DependSuffix): Console/ConsolePromiss.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(DependSuffix) -MM Console/ConsolePromiss.cpp + +$(IntermediateDirectory)/Console_ConsolePromiss.cpp$(PreprocessSuffix): Console/ConsolePromiss.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_ConsolePromiss.cpp$(PreprocessSuffix) Console/ConsolePromiss.cpp + +$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(ObjectSuffix): PacketParse/PacketParseBase.cpp $(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/PacketParse/PacketParseBase.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(DependSuffix): PacketParse/PacketParseBase.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(DependSuffix) -MM PacketParse/PacketParseBase.cpp + +$(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(PreprocessSuffix): PacketParse/PacketParseBase.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_PacketParseBase.cpp$(PreprocessSuffix) PacketParse/PacketParseBase.cpp + +$(IntermediateDirectory)/Message_MessageManager.cpp$(ObjectSuffix): Message/MessageManager.cpp $(IntermediateDirectory)/Message_MessageManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/MessageManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_MessageManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_MessageManager.cpp$(DependSuffix): Message/MessageManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_MessageManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_MessageManager.cpp$(DependSuffix) -MM Message/MessageManager.cpp + +$(IntermediateDirectory)/Message_MessageManager.cpp$(PreprocessSuffix): Message/MessageManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_MessageManager.cpp$(PreprocessSuffix) Message/MessageManager.cpp + +$(IntermediateDirectory)/Mail_smtps.cpp$(ObjectSuffix): Mail/smtps.cpp $(IntermediateDirectory)/Mail_smtps.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Mail/smtps.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Mail_smtps.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Mail_smtps.cpp$(DependSuffix): Mail/smtps.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Mail_smtps.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Mail_smtps.cpp$(DependSuffix) -MM Mail/smtps.cpp + +$(IntermediateDirectory)/Mail_smtps.cpp$(PreprocessSuffix): Mail/smtps.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Mail_smtps.cpp$(PreprocessSuffix) Mail/smtps.cpp + +$(IntermediateDirectory)/LogSystem_LogManager.cpp$(ObjectSuffix): LogSystem/LogManager.cpp $(IntermediateDirectory)/LogSystem_LogManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/LogSystem/LogManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LogSystem_LogManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LogSystem_LogManager.cpp$(DependSuffix): LogSystem/LogManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LogSystem_LogManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LogSystem_LogManager.cpp$(DependSuffix) -MM LogSystem/LogManager.cpp + +$(IntermediateDirectory)/LogSystem_LogManager.cpp$(PreprocessSuffix): LogSystem/LogManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LogSystem_LogManager.cpp$(PreprocessSuffix) LogSystem/LogManager.cpp + +$(IntermediateDirectory)/PurenessScopeServer.cpp$(ObjectSuffix): PurenessScopeServer.cpp $(IntermediateDirectory)/PurenessScopeServer.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/PurenessScopeServer.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PurenessScopeServer.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PurenessScopeServer.cpp$(DependSuffix): PurenessScopeServer.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PurenessScopeServer.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PurenessScopeServer.cpp$(DependSuffix) -MM PurenessScopeServer.cpp + +$(IntermediateDirectory)/PurenessScopeServer.cpp$(PreprocessSuffix): PurenessScopeServer.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PurenessScopeServer.cpp$(PreprocessSuffix) PurenessScopeServer.cpp + +$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(ObjectSuffix): Reactor/ConsoleAccept.cpp $(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ConsoleAccept.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(DependSuffix): Reactor/ConsoleAccept.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(DependSuffix) -MM Reactor/ConsoleAccept.cpp + +$(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(PreprocessSuffix): Reactor/ConsoleAccept.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConsoleAccept.cpp$(PreprocessSuffix) Reactor/ConsoleAccept.cpp + +$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(ObjectSuffix): UDP/ReactorUDPHander.cpp $(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/UDP/ReactorUDPHander.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(DependSuffix): UDP/ReactorUDPHander.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(DependSuffix) -MM UDP/ReactorUDPHander.cpp + +$(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(PreprocessSuffix): UDP/ReactorUDPHander.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDP_ReactorUDPHander.cpp$(PreprocessSuffix) UDP/ReactorUDPHander.cpp + +$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(ObjectSuffix): UDP/ReactorUDPClient.cpp $(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/UDP/ReactorUDPClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(DependSuffix): UDP/ReactorUDPClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(DependSuffix) -MM UDP/ReactorUDPClient.cpp + +$(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(PreprocessSuffix): UDP/ReactorUDPClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDP_ReactorUDPClient.cpp$(PreprocessSuffix) UDP/ReactorUDPClient.cpp + +$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(ObjectSuffix): UDP/ProactorUDPHandler.cpp $(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/UDP/ProactorUDPHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(DependSuffix): UDP/ProactorUDPHandler.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(DependSuffix) -MM UDP/ProactorUDPHandler.cpp + +$(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(PreprocessSuffix): UDP/ProactorUDPHandler.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDP_ProactorUDPHandler.cpp$(PreprocessSuffix) UDP/ProactorUDPHandler.cpp + +$(IntermediateDirectory)/Common_SendMessage.cpp$(ObjectSuffix): Common/SendMessage.cpp $(IntermediateDirectory)/Common_SendMessage.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/SendMessage.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_SendMessage.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_SendMessage.cpp$(DependSuffix): Common/SendMessage.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_SendMessage.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_SendMessage.cpp$(DependSuffix) -MM Common/SendMessage.cpp + +$(IntermediateDirectory)/Common_SendMessage.cpp$(PreprocessSuffix): Common/SendMessage.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_SendMessage.cpp$(PreprocessSuffix) Common/SendMessage.cpp + +$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(ObjectSuffix): UDP/ProactorUDPClient.cpp $(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/UDP/ProactorUDPClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(DependSuffix): UDP/ProactorUDPClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(DependSuffix) -MM UDP/ProactorUDPClient.cpp + +$(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(PreprocessSuffix): UDP/ProactorUDPClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDP_ProactorUDPClient.cpp$(PreprocessSuffix) UDP/ProactorUDPClient.cpp + +$(IntermediateDirectory)/Reactor_ControlListen.cpp$(ObjectSuffix): Reactor/ControlListen.cpp $(IntermediateDirectory)/Reactor_ControlListen.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ControlListen.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ControlListen.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ControlListen.cpp$(DependSuffix): Reactor/ControlListen.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ControlListen.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ControlListen.cpp$(DependSuffix) -MM Reactor/ControlListen.cpp + +$(IntermediateDirectory)/Reactor_ControlListen.cpp$(PreprocessSuffix): Reactor/ControlListen.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ControlListen.cpp$(PreprocessSuffix) Reactor/ControlListen.cpp + +$(IntermediateDirectory)/Common_TcpRedirection.cpp$(ObjectSuffix): Common/TcpRedirection.cpp $(IntermediateDirectory)/Common_TcpRedirection.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/TcpRedirection.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_TcpRedirection.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_TcpRedirection.cpp$(DependSuffix): Common/TcpRedirection.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_TcpRedirection.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_TcpRedirection.cpp$(DependSuffix) -MM Common/TcpRedirection.cpp + +$(IntermediateDirectory)/Common_TcpRedirection.cpp$(PreprocessSuffix): Common/TcpRedirection.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_TcpRedirection.cpp$(PreprocessSuffix) Common/TcpRedirection.cpp + +$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(ObjectSuffix): Reactor/ConnectHandler.cpp $(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ConnectHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(DependSuffix): Reactor/ConnectHandler.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(DependSuffix) -MM Reactor/ConnectHandler.cpp + +$(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(PreprocessSuffix): Reactor/ConnectHandler.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConnectHandler.cpp$(PreprocessSuffix) Reactor/ConnectHandler.cpp + +$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(ObjectSuffix): LogSystem/FileLogger.cpp $(IntermediateDirectory)/LogSystem_FileLogger.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/LogSystem/FileLogger.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(DependSuffix): LogSystem/FileLogger.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(DependSuffix) -MM LogSystem/FileLogger.cpp + +$(IntermediateDirectory)/LogSystem_FileLogger.cpp$(PreprocessSuffix): LogSystem/FileLogger.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LogSystem_FileLogger.cpp$(PreprocessSuffix) LogSystem/FileLogger.cpp + +$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(ObjectSuffix): Reactor/ConnectAccept.cpp $(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ConnectAccept.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(DependSuffix): Reactor/ConnectAccept.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(DependSuffix) -MM Reactor/ConnectAccept.cpp + +$(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(PreprocessSuffix): Reactor/ConnectAccept.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ConnectAccept.cpp$(PreprocessSuffix) Reactor/ConnectAccept.cpp + +$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(ObjectSuffix): Reactor/ClientReConnectManager.cpp $(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(DependSuffix): Reactor/ClientReConnectManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(DependSuffix) -MM Reactor/ClientReConnectManager.cpp + +$(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(PreprocessSuffix): Reactor/ClientReConnectManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ClientReConnectManager.cpp$(PreprocessSuffix) Reactor/ClientReConnectManager.cpp + +$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(ObjectSuffix): Reactor/ReTTyClientManager.cpp $(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ReTTyClientManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(DependSuffix): Reactor/ReTTyClientManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(DependSuffix) -MM Reactor/ReTTyClientManager.cpp + +$(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(PreprocessSuffix): Reactor/ReTTyClientManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ReTTyClientManager.cpp$(PreprocessSuffix) Reactor/ReTTyClientManager.cpp + +$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(ObjectSuffix): Message/WorkThreadAI.cpp $(IntermediateDirectory)/Message_WorkThreadAI.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/WorkThreadAI.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(DependSuffix): Message/WorkThreadAI.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(DependSuffix) -MM Message/WorkThreadAI.cpp + +$(IntermediateDirectory)/Message_WorkThreadAI.cpp$(PreprocessSuffix): Message/WorkThreadAI.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_WorkThreadAI.cpp$(PreprocessSuffix) Message/WorkThreadAI.cpp + +$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(ObjectSuffix): Message/ModuleMessageManager.cpp $(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/ModuleMessageManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(DependSuffix): Message/ModuleMessageManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(DependSuffix) -MM Message/ModuleMessageManager.cpp + +$(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(PreprocessSuffix): Message/ModuleMessageManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_ModuleMessageManager.cpp$(PreprocessSuffix) Message/ModuleMessageManager.cpp + +$(IntermediateDirectory)/Message_MessageService.cpp$(ObjectSuffix): Message/MessageService.cpp $(IntermediateDirectory)/Message_MessageService.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/MessageService.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_MessageService.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_MessageService.cpp$(DependSuffix): Message/MessageService.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_MessageService.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_MessageService.cpp$(DependSuffix) -MM Message/MessageService.cpp + +$(IntermediateDirectory)/Message_MessageService.cpp$(PreprocessSuffix): Message/MessageService.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_MessageService.cpp$(PreprocessSuffix) Message/MessageService.cpp + +$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(ObjectSuffix): Reactor/ReTTyHandler.cpp $(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Reactor/ReTTyHandler.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(DependSuffix): Reactor/ReTTyHandler.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(DependSuffix) -MM Reactor/ReTTyHandler.cpp + +$(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(PreprocessSuffix): Reactor/ReTTyHandler.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Reactor_ReTTyHandler.cpp$(PreprocessSuffix) Reactor/ReTTyHandler.cpp + +$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(ObjectSuffix): Message/LoadPacketParse.cpp $(IntermediateDirectory)/Message_LoadPacketParse.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/LoadPacketParse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(DependSuffix): Message/LoadPacketParse.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(DependSuffix) -MM Message/LoadPacketParse.cpp + +$(IntermediateDirectory)/Message_LoadPacketParse.cpp$(PreprocessSuffix): Message/LoadPacketParse.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_LoadPacketParse.cpp$(PreprocessSuffix) Message/LoadPacketParse.cpp + +$(IntermediateDirectory)/Message_LoadModule.cpp$(ObjectSuffix): Message/LoadModule.cpp $(IntermediateDirectory)/Message_LoadModule.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Message/LoadModule.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Message_LoadModule.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Message_LoadModule.cpp$(DependSuffix): Message/LoadModule.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Message_LoadModule.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Message_LoadModule.cpp$(DependSuffix) -MM Message/LoadModule.cpp + +$(IntermediateDirectory)/Message_LoadModule.cpp$(PreprocessSuffix): Message/LoadModule.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Message_LoadModule.cpp$(PreprocessSuffix) Message/LoadModule.cpp + +$(IntermediateDirectory)/Mail_base64.cpp$(ObjectSuffix): Mail/base64.cpp $(IntermediateDirectory)/Mail_base64.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Mail/base64.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Mail_base64.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Mail_base64.cpp$(DependSuffix): Mail/base64.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Mail_base64.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Mail_base64.cpp$(DependSuffix) -MM Mail/base64.cpp + +$(IntermediateDirectory)/Mail_base64.cpp$(PreprocessSuffix): Mail/base64.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Mail_base64.cpp$(PreprocessSuffix) Mail/base64.cpp + +$(IntermediateDirectory)/Console_MessageDispose.cpp$(ObjectSuffix): Console/MessageDispose.cpp $(IntermediateDirectory)/Console_MessageDispose.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Console/MessageDispose.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_MessageDispose.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_MessageDispose.cpp$(DependSuffix): Console/MessageDispose.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_MessageDispose.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_MessageDispose.cpp$(DependSuffix) -MM Console/MessageDispose.cpp + +$(IntermediateDirectory)/Console_MessageDispose.cpp$(PreprocessSuffix): Console/MessageDispose.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_MessageDispose.cpp$(PreprocessSuffix) Console/MessageDispose.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/Mail_smtp.cpp$(ObjectSuffix): Mail/smtp.cpp $(IntermediateDirectory)/Mail_smtp.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Mail/smtp.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Mail_smtp.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Mail_smtp.cpp$(DependSuffix): Mail/smtp.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Mail_smtp.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Mail_smtp.cpp$(DependSuffix) -MM Mail/smtp.cpp + +$(IntermediateDirectory)/Mail_smtp.cpp$(PreprocessSuffix): Mail/smtp.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Mail_smtp.cpp$(PreprocessSuffix) Mail/smtp.cpp + +$(IntermediateDirectory)/Console_FrameCommand.cpp$(ObjectSuffix): Console/FrameCommand.cpp $(IntermediateDirectory)/Console_FrameCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Console/FrameCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_FrameCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_FrameCommand.cpp$(DependSuffix): Console/FrameCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_FrameCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_FrameCommand.cpp$(DependSuffix) -MM Console/FrameCommand.cpp + +$(IntermediateDirectory)/Console_FrameCommand.cpp$(PreprocessSuffix): Console/FrameCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_FrameCommand.cpp$(PreprocessSuffix) Console/FrameCommand.cpp + +$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(ObjectSuffix): Console/ConsoleMessage.cpp $(IntermediateDirectory)/Console_ConsoleMessage.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Console/ConsoleMessage.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(DependSuffix): Console/ConsoleMessage.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(DependSuffix) -MM Console/ConsoleMessage.cpp + +$(IntermediateDirectory)/Console_ConsoleMessage.cpp$(PreprocessSuffix): Console/ConsoleMessage.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Console_ConsoleMessage.cpp$(PreprocessSuffix) Console/ConsoleMessage.cpp + +$(IntermediateDirectory)/Common_XmlOpeation.cpp$(ObjectSuffix): Common/XmlOpeation.cpp $(IntermediateDirectory)/Common_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/FrameCore/Common/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_XmlOpeation.cpp$(DependSuffix): Common/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_XmlOpeation.cpp$(DependSuffix) -MM Common/XmlOpeation.cpp + +$(IntermediateDirectory)/Common_XmlOpeation.cpp$(PreprocessSuffix): Common/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_XmlOpeation.cpp$(PreprocessSuffix) Common/XmlOpeation.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/FrameCore/PurenessScopeServer.project b/purenessscopeserver/FrameCore/PurenessScopeServer.project new file mode 100644 index 000000000..4b9df1603 --- /dev/null +++ b/purenessscopeserver/FrameCore/PurenessScopeServer.project @@ -0,0 +1,328 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/FrameCore/PurenessScopeServer.txt b/purenessscopeserver/FrameCore/PurenessScopeServer.txt new file mode 100644 index 000000000..ea824056a --- /dev/null +++ b/purenessscopeserver/FrameCore/PurenessScopeServer.txt @@ -0,0 +1,3 @@ +../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxml.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp.o ../../Build/Linux/Temp/up_Common_ACEMemory.cpp.o ../../Build/Linux/Temp/up_Common_RandomNumber.cpp.o ../../Build/Linux/Temp/up_Common_Time_Value.cpp.o ../../Build/Linux/Temp/up_Common_TimerThread.cpp.o ../../Build/Linux/Temp/Common_BaseConsoleHandle.cpp.o ../../Build/Linux/Temp/Common_BuffPacket.cpp.o ../../Build/Linux/Temp/Common_BuffPacketManager.cpp.o ../../Build/Linux/Temp/Common_CommandAccount.cpp.o ../../Build/Linux/Temp/Common_ForbiddenIP.cpp.o ../../Build/Linux/Temp/up_Common_Threading.cpp.o ../../Build/Linux/Temp/Common_Frame_Logging_Strategy.cpp.o ../../Build/Linux/Temp/Common_IPAccount.cpp.o ../../Build/Linux/Temp/Common_MessageBlockManager.cpp.o ../../Build/Linux/Temp/Common_ServerMessageTask.cpp.o ../../Build/Linux/Temp/Common_ThreadInfo.cpp.o ../../Build/Linux/Temp/Common_TimerManager.cpp.o ../../Build/Linux/Temp/Common_WindowsProcess.cpp.o ../../Build/Linux/Temp/Common_BaseTask.cpp.o ../../Build/Linux/Temp/Common_XmlConfig.cpp.o ../../Build/Linux/Temp/up_Common_TimerInfo.cpp.o ../../Build/Linux/Temp/Message_MessageDyeingManager.cpp.o ../../Build/Linux/Temp/Common_WindowsCPU.cpp.o ../../Build/Linux/Temp/Common_BaseServerManager.cpp.o ../../Build/Linux/Temp/PacketParse_PacketConsoleParse.cpp.o ../../Build/Linux/Temp/Message_LogicThreadManager.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp.o ../../Build/Linux/Temp/Common_BaseClientConnectManager.cpp.o ../../Build/Linux/Temp/Common_SendCacheManager.cpp.o ../../Build/Linux/Temp/Reactor_AceReactorManager.cpp.o ../../Build/Linux/Temp/Common_MyACELoggingStrategy.cpp.o ../../Build/Linux/Temp/PacketParse_PacketParsePool.cpp.o ../../Build/Linux/Temp/Common_LinuxCPU.cpp.o ../../Build/Linux/Temp/Common_ProgramService.cpp.o ../../Build/Linux/Temp/Reactor_ConsoleHandler.cpp.o ../../Build/Linux/Temp/Common_BaseHander.cpp.o ../../Build/Linux/Temp/Common_MakePacket.cpp.o +../../Build/Linux/Temp/Reactor_WaitQuitSignal.cpp.o ../../Build/Linux/Temp/Message_Message.cpp.o ../../Build/Linux/Temp/Common_AppConfig.cpp.o ../../Build/Linux/Temp/FileTest_FileTestManager.cpp.o ../../Build/Linux/Temp/Console_MessageDefine.cpp.o ../../Build/Linux/Temp/PacketParse_PacketParse.cpp.o ../../Build/Linux/Temp/Common_ProfileTime.cpp.o ../../Build/Linux/Temp/Common_BaseConnectClient.cpp.o ../../Build/Linux/Temp/Reactor_ConnectClient.cpp.o ../../Build/Linux/Temp/Reactor_ServerManager.cpp.o ../../Build/Linux/Temp/Console_ConsolePromiss.cpp.o ../../Build/Linux/Temp/PacketParse_PacketParseBase.cpp.o ../../Build/Linux/Temp/Message_MessageManager.cpp.o ../../Build/Linux/Temp/Mail_smtps.cpp.o ../../Build/Linux/Temp/LogSystem_LogManager.cpp.o ../../Build/Linux/Temp/PurenessScopeServer.cpp.o ../../Build/Linux/Temp/Reactor_ConsoleAccept.cpp.o ../../Build/Linux/Temp/UDP_ReactorUDPHander.cpp.o ../../Build/Linux/Temp/UDP_ReactorUDPClient.cpp.o ../../Build/Linux/Temp/UDP_ProactorUDPHandler.cpp.o ../../Build/Linux/Temp/Common_SendMessage.cpp.o ../../Build/Linux/Temp/UDP_ProactorUDPClient.cpp.o ../../Build/Linux/Temp/Reactor_ControlListen.cpp.o ../../Build/Linux/Temp/Common_TcpRedirection.cpp.o ../../Build/Linux/Temp/Reactor_ConnectHandler.cpp.o ../../Build/Linux/Temp/LogSystem_FileLogger.cpp.o ../../Build/Linux/Temp/Reactor_ConnectAccept.cpp.o ../../Build/Linux/Temp/Reactor_ClientReConnectManager.cpp.o ../../Build/Linux/Temp/Reactor_ReTTyClientManager.cpp.o ../../Build/Linux/Temp/Message_WorkThreadAI.cpp.o ../../Build/Linux/Temp/Message_ModuleMessageManager.cpp.o ../../Build/Linux/Temp/Message_MessageService.cpp.o ../../Build/Linux/Temp/Reactor_ReTTyHandler.cpp.o ../../Build/Linux/Temp/Message_LoadPacketParse.cpp.o ../../Build/Linux/Temp/Message_LoadModule.cpp.o ../../Build/Linux/Temp/Mail_base64.cpp.o ../../Build/Linux/Temp/Console_MessageDispose.cpp.o ../../Build/Linux/Temp/up_up_ThirdLib_include_TinyXML_tinystr.cpp.o +../../Build/Linux/Temp/Mail_smtp.cpp.o ../../Build/Linux/Temp/Console_FrameCommand.cpp.o ../../Build/Linux/Temp/Console_ConsoleMessage.cpp.o ../../Build/Linux/Temp/Common_XmlOpeation.cpp.o diff --git a/purenessscopeserver/FrameCore/PurenessScopeServer.vcproj b/purenessscopeserver/FrameCore/PurenessScopeServer.vcproj deleted file mode 100644 index 5e604c543..000000000 --- a/purenessscopeserver/FrameCore/PurenessScopeServer.vcproj +++ /dev/null @@ -1,1455 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/FrameCore/Reactor/AceReactorManager.cpp b/purenessscopeserver/FrameCore/Reactor/AceReactorManager.cpp index 92f43809d..f35144345 100644 --- a/purenessscopeserver/FrameCore/Reactor/AceReactorManager.cpp +++ b/purenessscopeserver/FrameCore/Reactor/AceReactorManager.cpp @@ -10,6 +10,11 @@ CAceReactor::CAceReactor() m_u4ReactorID = 0; } +CAceReactor::CAceReactor(const CAceReactor& ar) : CAceReactor() +{ + (*this) = ar; +} + void CAceReactor::SetReactorID(uint32 u4ReactorID) { m_u4ReactorID = u4ReactorID; @@ -272,6 +277,11 @@ CAceReactorManager::CAceReactorManager(void) ACE_OS::memset(m_szError, 0, MAX_BUFF_500); } +CAceReactorManager::CAceReactorManager(const CAceReactorManager& ar) +{ + (*this) = ar; +} + CAceReactorManager::~CAceReactorManager(void) { OUR_DEBUG((LM_INFO, "[CAceReactorManager::~CAceReactorManager].\n")); diff --git a/purenessscopeserver/FrameCore/Reactor/AceReactorManager.h b/purenessscopeserver/FrameCore/Reactor/AceReactorManager.h index 811d571cf..6f2722a3d 100644 --- a/purenessscopeserver/FrameCore/Reactor/AceReactorManager.h +++ b/purenessscopeserver/FrameCore/Reactor/AceReactorManager.h @@ -38,6 +38,18 @@ class CAceReactor : public ACE_Task public: ~CAceReactor(); + CAceReactor(const CAceReactor& ar); + + CAceReactor& operator = (const CAceReactor& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Close(); bool Init(int nReactorType, int nThreadCount, int nMaxHandleCount = 0); @@ -77,6 +89,18 @@ class CAceReactorManager CAceReactorManager(void); ~CAceReactorManager(void); + CAceReactorManager(const CAceReactorManager& ar); + + CAceReactorManager& operator = (const CAceReactorManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Init(uint16 u2Count); bool AddNewReactor(int nReactorID, int nReactorType = Reactor_Select, int nThreadCount = 1, int nMaxHandleCount = 0); diff --git a/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.cpp b/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.cpp index 8c33d55d4..27ad293ae 100644 --- a/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.cpp +++ b/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.cpp @@ -12,6 +12,11 @@ CReactorClientInfo::CReactorClientInfo() m_blIsLocal = false; } +CReactorClientInfo::CReactorClientInfo(const CReactorClientInfo& ar) +{ + (*this) = ar; +} + CReactorClientInfo::~CReactorClientInfo() { OUR_DEBUG((LM_ERROR, "[CReactorClientInfo::~CReactorClientInfo].\n")); @@ -231,6 +236,11 @@ CClientReConnectManager::CClientReConnectManager(void) m_u4MaxPoolCount = 0; } +CClientReConnectManager::CClientReConnectManager(const CClientReConnectManager& ar) +{ + (*this) = ar; +} + CClientReConnectManager::~CClientReConnectManager(void) { OUR_DEBUG((LM_ERROR, "[CClientReConnectManager::~CClientReConnectManager].\n")); diff --git a/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.h b/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.h index 92b05307e..edf90a549 100644 --- a/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.h +++ b/purenessscopeserver/FrameCore/Reactor/ClientReConnectManager.h @@ -21,6 +21,18 @@ class CReactorClientInfo CReactorClientInfo(); ~CReactorClientInfo(); + CReactorClientInfo(const CReactorClientInfo& ar); + + CReactorClientInfo& operator = (const CReactorClientInfo& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + bool Init(int nServerID, const char* pIP, int nPort, uint8 u1IPType, CConnectClientConnector* pReactorConnect, IClientMessage* pClientMessage, ACE_Reactor* pReactor); //ʼӵַͶ˿ void SetLocalAddr(const char* pIP, int nPort, uint8 u1IPType); //󶨱صIPͶ˿ bool Run(bool blIsReady, EM_Server_Connect_State emState = SERVER_CONNECT_RECONNECT); //ʼ @@ -50,7 +62,19 @@ class CClientReConnectManager : public ACE_Event_Handler, public IClientManager { public: CClientReConnectManager(void); - ~CClientReConnectManager(void); + virtual ~CClientReConnectManager(void); + + CClientReConnectManager(const CClientReConnectManager& ar); + + CClientReConnectManager& operator = (const CClientReConnectManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } bool Init(ACE_Reactor* pReactor); virtual bool Connect(int nServerID, const char* pIP, int nPort, uint8 u1IPType, IClientMessage* pClientMessage); //ӷ(TCP) diff --git a/purenessscopeserver/FrameCore/Reactor/ConnectAccept.cpp b/purenessscopeserver/FrameCore/Reactor/ConnectAccept.cpp index 7826f5e7e..a10c68411 100644 --- a/purenessscopeserver/FrameCore/Reactor/ConnectAccept.cpp +++ b/purenessscopeserver/FrameCore/Reactor/ConnectAccept.cpp @@ -9,6 +9,16 @@ ConnectAcceptor::ConnectAcceptor() m_u4PacketParseInfoID = 0; } +ConnectAcceptor::ConnectAcceptor(const ConnectAcceptor& ar) +{ + (*this) = ar; +} + +ConnectAcceptor::~ConnectAcceptor() +{ + +} + void ConnectAcceptor::InitClientReactor(uint32 u4ClientReactorCount) { if(u4ClientReactorCount > 0) @@ -169,6 +179,11 @@ CConnectAcceptorManager::CConnectAcceptorManager(void) m_szError[0] = '\0'; } +CConnectAcceptorManager::CConnectAcceptorManager(const CConnectAcceptorManager& ar) +{ + (*this) = ar; +} + CConnectAcceptorManager::~CConnectAcceptorManager(void) { OUR_DEBUG((LM_INFO, "[CConnectAcceptorManager::~CConnectAcceptorManager].\n")); diff --git a/purenessscopeserver/FrameCore/Reactor/ConnectAccept.h b/purenessscopeserver/FrameCore/Reactor/ConnectAccept.h index e1b587e56..0d1e34c45 100644 --- a/purenessscopeserver/FrameCore/Reactor/ConnectAccept.h +++ b/purenessscopeserver/FrameCore/Reactor/ConnectAccept.h @@ -14,6 +14,20 @@ class ConnectAcceptor : public ACE_Acceptor public: ConnectAcceptor(); + virtual ~ConnectAcceptor(); + + ConnectAcceptor(const ConnectAcceptor& ar); + + ConnectAcceptor& operator = (const ConnectAcceptor& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void InitClientReactor(uint32 u4ClientReactorCount); void SetPacketParseInfoID(uint32 u4PaccketParseInfoID); uint32 GetPacketParseInfoID(); @@ -54,6 +68,18 @@ class CConnectAcceptorManager CConnectAcceptorManager(void); ~CConnectAcceptorManager(void); + CConnectAcceptorManager(const CConnectAcceptorManager& ar); + + CConnectAcceptorManager& operator = (const CConnectAcceptorManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + bool InitConnectAcceptor(int nCount, uint32 u4ClientReactorCount); void Close(); int GetCount(); diff --git a/purenessscopeserver/FrameCore/Reactor/ConnectHandler.cpp b/purenessscopeserver/FrameCore/Reactor/ConnectHandler.cpp index be08de3d3..9d7e573a3 100644 --- a/purenessscopeserver/FrameCore/Reactor/ConnectHandler.cpp +++ b/purenessscopeserver/FrameCore/Reactor/ConnectHandler.cpp @@ -46,6 +46,11 @@ CConnectHandler::CConnectHandler(void) m_u4LocalPort = 0; } +CConnectHandler::CConnectHandler(const CConnectHandler& ar) +{ + (*this) = ar; +} + CConnectHandler::~CConnectHandler(void) { this->closing_ = true; @@ -1533,6 +1538,11 @@ CConnectManager::CConnectManager(void):m_mutex(), m_cond(m_mutex) m_SendMessagePool.Init(); } +CConnectManager::CConnectManager(const CConnectManager& ar) : CConnectManager() +{ + (*this) = ar; +} + CConnectManager::~CConnectManager(void) { OUR_DEBUG((LM_INFO, "[CConnectManager::~CConnectManager].\n")); @@ -2216,6 +2226,11 @@ CConnectHandlerPool::CConnectHandlerPool(void) m_u4CurrMaxCount = 1; } +CConnectHandlerPool::CConnectHandlerPool(const CConnectHandlerPool& ar) +{ + (*this) = ar; +} + CConnectHandlerPool::~CConnectHandlerPool(void) { OUR_DEBUG((LM_INFO, "[CConnectHandlerPool::~CConnectHandlerPool].\n")); @@ -2316,6 +2331,11 @@ CConnectManagerGroup::CConnectManagerGroup() m_u2ThreadQueueCount = SENDQUEUECOUNT; } +CConnectManagerGroup::CConnectManagerGroup(const CConnectManagerGroup& ar) +{ + (*this) = ar; +} + CConnectManagerGroup::~CConnectManagerGroup() { OUR_DEBUG((LM_INFO, "[CConnectManagerGroup::~CConnectManagerGroup].\n")); diff --git a/purenessscopeserver/FrameCore/Reactor/ConnectHandler.h b/purenessscopeserver/FrameCore/Reactor/ConnectHandler.h index b2b026167..00211607a 100644 --- a/purenessscopeserver/FrameCore/Reactor/ConnectHandler.h +++ b/purenessscopeserver/FrameCore/Reactor/ConnectHandler.h @@ -43,7 +43,19 @@ class CConnectHandler : public ACE_Svc_Handler { public: CConnectHandler(void); - ~CConnectHandler(void); + virtual ~CConnectHandler(void); + + CConnectHandler(const CConnectHandler& ar); + + CConnectHandler& operator = (const CConnectHandler& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } //д̳з virtual int open(void*); //ûһ @@ -167,6 +179,18 @@ class CConnectManager : public ACE_Task CConnectManager(void); ~CConnectManager(void); + CConnectManager(const CConnectManager& ar); + + CConnectManager& operator = (const CConnectManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + virtual int handle_timeout(const ACE_Time_Value& tv, const void* arg); //ʱ static void TimeWheel_Timeout_Callback(void* pArgsContext, vector vecConnectHandle); @@ -241,6 +265,18 @@ class CConnectHandlerPool CConnectHandlerPool(void); ~CConnectHandlerPool(void); + CConnectHandlerPool(const CConnectHandlerPool& ar); + + CConnectHandlerPool& operator = (const CConnectHandlerPool& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Init(int nObjcetCount); void Close(); @@ -264,6 +300,18 @@ class CConnectManagerGroup : public IConnectManager CConnectManagerGroup(); ~CConnectManagerGroup(); + CConnectManagerGroup(const CConnectManagerGroup& ar); + + CConnectManagerGroup& operator = (const CConnectManagerGroup& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + void Init(uint16 u2SendQueueCount); void Close(); diff --git a/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.cpp b/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.cpp index 69a5f828e..756586cb7 100644 --- a/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.cpp +++ b/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.cpp @@ -24,6 +24,11 @@ CConsoleHandler::CConsoleHandler(void) m_u4SendCheckTime = 0; } +CConsoleHandler::CConsoleHandler(const CConsoleHandler& ar) +{ + (*this) = ar; +} + CConsoleHandler::~CConsoleHandler(void) { OUR_DEBUG((LM_ERROR, "[CConsoleHandler::~CConsoleHandler].\n")); diff --git a/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.h b/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.h index a32d06a7d..6eb74c586 100644 --- a/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.h +++ b/purenessscopeserver/FrameCore/Reactor/ConsoleHandler.h @@ -24,6 +24,18 @@ class CConsoleHandler : public ACE_Svc_Handler CConsoleHandler(void); ~CConsoleHandler(void); + CConsoleHandler(const CConsoleHandler& ar); + + CConsoleHandler& operator = (const CConsoleHandler& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + //д̳з virtual int open(void*); //ûһ virtual int handle_input(ACE_HANDLE fd = ACE_INVALID_HANDLE); diff --git a/purenessscopeserver/FrameCore/Reactor/ServerManager.cpp b/purenessscopeserver/FrameCore/Reactor/ServerManager.cpp index aaf3286d0..b996b91e2 100644 --- a/purenessscopeserver/FrameCore/Reactor/ServerManager.cpp +++ b/purenessscopeserver/FrameCore/Reactor/ServerManager.cpp @@ -9,6 +9,11 @@ CServerManager::CServerManager(void) m_pFrameLoggingStrategy = NULL; } +CServerManager::CServerManager(const CServerManager& ar) +{ + (*this) = ar; +} + CServerManager::~CServerManager(void) { OUR_DEBUG((LM_INFO, "[CServerManager::~CServerManager].\n")); @@ -74,21 +79,27 @@ bool CServerManager::Init() //ʼӹ App_ConnectManager::instance()->Init(GetXmlConfigAttribute(xmlSendInfo)->SendQueueCount); + //ʼ߼߳ + App_LogicThreadManager::instance()->Init(); + //ʼĶӿ - IConnectManager* pConnectManager = dynamic_cast(App_ConnectManager::instance()); - IClientManager* pClientManager = dynamic_cast(App_ClientReConnectManager::instance()); - IUDPConnectManager* pUDPConnectManager = dynamic_cast(App_ReUDPManager::instance()); - IFrameCommand* pFrameCommand = dynamic_cast(&m_objFrameCommand); - ITSTimerManager* pTSTimer = dynamic_cast(&m_TSThread); - IServerManager* pServerManager = dynamic_cast(this); - ITTyClientManager* pTTyClientManager = dynamic_cast(App_ReTTyClientManager::instance()); + IConnectManager* pConnectManager = dynamic_cast(App_ConnectManager::instance()); + IClientManager* pClientManager = dynamic_cast(App_ClientReConnectManager::instance()); + IUDPConnectManager* pUDPConnectManager = dynamic_cast(App_ReUDPManager::instance()); + IFrameCommand* pFrameCommand = dynamic_cast(&m_objFrameCommand); + ITSTimerManager* pTSTimer = dynamic_cast(&m_TSThread); + IServerManager* pServerManager = dynamic_cast(this); + ITTyClientManager* pTTyClientManager = dynamic_cast(App_ReTTyClientManager::instance()); + ILogicThreadManager* pLogicThreadManager = dynamic_cast(App_LogicThreadManager::instance()); + Server_Manager_Common_IObject(pConnectManager, pClientManager, pUDPConnectManager, pFrameCommand, pServerManager, pTSTimer, - pTTyClientManager); + pTTyClientManager, + pLogicThreadManager); //ʼģأΪܰмӼ if (false == Server_Manager_Common_Module()) @@ -583,7 +594,9 @@ bool CServerManager::Close() OUR_DEBUG((LM_INFO, "[CServerManager::Close]Close m_TSThread OK.\n")); App_ConnectAcceptorManager::instance()->Close(); m_ConnectConsoleAcceptor.close(); - OUR_DEBUG((LM_INFO, "[CServerManager::Close]Close App_TimerManager OK.\n")); + OUR_DEBUG((LM_INFO, "[CServerManager::Close]AppLogManager OK\n")); + App_LogicThreadManager::instance()->Close(); + OUR_DEBUG((LM_INFO, "[CServerManager::Close]Close App_LogicThreadManager OK.\n")); App_TimerManager::instance()->deactivate(); OUR_DEBUG((LM_INFO, "[CServerManager::Close]Close App_ReUDPManager OK.\n")); App_ReUDPManager::instance()->Close(); diff --git a/purenessscopeserver/FrameCore/Reactor/ServerManager.h b/purenessscopeserver/FrameCore/Reactor/ServerManager.h index 0f1eed51b..3d09fe3e3 100644 --- a/purenessscopeserver/FrameCore/Reactor/ServerManager.h +++ b/purenessscopeserver/FrameCore/Reactor/ServerManager.h @@ -14,6 +14,7 @@ #include "ClientReConnectManager.h" #include "ReUDPManager.h" #include "ReTTyClientManager.h" +#include "LogicThreadManager.h" class Frame_Logging_Strategy; @@ -23,6 +24,18 @@ class CServerManager : public IServerManager CServerManager(void); ~CServerManager(void); + CServerManager(const CServerManager& ar); + + CServerManager& operator = (const CServerManager& ar) + { + if (this != &ar) + { + ACE_UNUSED_ARG(ar); + } + + return *this; + } + bool Init(); bool Start(); bool Close(); diff --git a/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.exe b/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.exe new file mode 100644 index 000000000..75ad61afc Binary files /dev/null and b/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.exe differ diff --git a/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.iobj b/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.iobj new file mode 100644 index 000000000..b50cb0e21 Binary files /dev/null and b/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.iobj differ diff --git a/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.ipdb b/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.ipdb new file mode 100644 index 000000000..c60d7148b Binary files /dev/null and b/purenessscopeserver/FrameCore/Windows_Bin/PSS_vc2017_R.ipdb differ diff --git a/purenessscopeserver/FrameCore/resource.h b/purenessscopeserver/FrameCore/resource.h deleted file mode 100644 index 899ba5738..000000000 --- a/purenessscopeserver/FrameCore/resource.h +++ /dev/null @@ -1,14 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by FreeeyesServer.rc - -// ¶һĬֵ -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/purenessscopeserver/FrameCore/sonar-project.properties b/purenessscopeserver/FrameCore/sonar-project.properties index 4438cd7ea..dd1d17952 100644 --- a/purenessscopeserver/FrameCore/sonar-project.properties +++ b/purenessscopeserver/FrameCore/sonar-project.properties @@ -7,11 +7,10 @@ sonar.projectVersion=1.0 # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. # This property is optional if sonar.modules is set. -sonar.cpp.std=C++98 sonar.sources=./ -sonar.cfamily.build-wrapper-output=./Linux_Bin/bw-output -sonar.cfamily.gcov.reportsPath=./Linux_Bin -sonar.cfamily.cppunit.reportsPath=./Linux_Bin/reports/cppunit +sonar.cfamily.build-wrapper-output=../../Build/Linux/bw-output +sonar.cfamily.gcov.reportsPath=../../Build/Linux +sonar.cfamily.cppunit.reportsPath=../../Build/Linux/reports/cppunit # Encoding of the source code. Default is default system encoding sonar.exclusions=**TinyXML/**,**Mail/**,**Windows_Bin/**,**Linux_Bin/**,**lib/**,**Proactor/**,**UDP/Proactor**,**Reactor/ReTTyClientManager.cpp**,**Reactor/ReTTyHandler.cpp**,**Reactor/ReTTyClientManager.h**,**Reactor/ReTTyHandler.h**,**Common/MyACELoggingStrategy.cpp**,**Unit_TTyClientManager.cpp**,**Unit_TTyClientManager.h** diff --git a/purenessscopeserver/PSS_vc2015.sln b/purenessscopeserver/PSS_vc2015.sln deleted file mode 100644 index b62ec7959..000000000 --- a/purenessscopeserver/PSS_vc2015.sln +++ /dev/null @@ -1,30 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSS_vc2015", "FrameCore\PSS_vc2015.vcxproj", "{8C99CA60-B114-4866-8D87-9DC0C17831F3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Debug|Win32.ActiveCfg = Debug|Win32 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Debug|Win32.Build.0 = Debug|Win32 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Debug|x64.ActiveCfg = Debug|x64 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Debug|x64.Build.0 = Debug|x64 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Release|Win32.ActiveCfg = Release|Win32 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Release|Win32.Build.0 = Release|Win32 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Release|x64.ActiveCfg = Release|x64 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {918A94DC-FDF4-456D-ABE3-FCC4705CC6EE} - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/PSS_vc2017.sln b/purenessscopeserver/PSS_vc2017.sln deleted file mode 100644 index fa8f97942..000000000 --- a/purenessscopeserver/PSS_vc2017.sln +++ /dev/null @@ -1,30 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2005 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PurenessScopeServer", "FrameCore\PSS_vc2017.vcxproj", "{8C99CA60-B114-4866-8D87-9DC0C17831F3}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Debug|Win32.ActiveCfg = Debug|Win32 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Debug|Win32.Build.0 = Debug|Win32 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Debug|x64.ActiveCfg = Debug|x64 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Debug|x64.Build.0 = Debug|x64 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Release|Win32.ActiveCfg = Release|Win32 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Release|Win32.Build.0 = Release|Win32 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Release|x64.ActiveCfg = Release|x64 - {8C99CA60-B114-4866-8D87-9DC0C17831F3}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {918A94DC-FDF4-456D-ABE3-FCC4705CC6EE} - EndGlobalSection -EndGlobal \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface/CMakeLists.txt b/purenessscopeserver/PacketParse_Interface/CMakeLists.txt new file mode 100644 index 000000000..261beec04 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface/CMakeLists.txt @@ -0,0 +1,83 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PacketParse_Interface) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PacketParse_Interface_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/PacketParse_Interface/PacketParse_Interface.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(PacketParse_Interface SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PacketParse_Interface ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/PacketParse_Interface/Makefile b/purenessscopeserver/PacketParse_Interface/Makefile new file mode 100644 index 000000000..023b5bfe7 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface/Makefile @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PacketParse_Interface +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../purenessscopeserver/PacketParse_Interface +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PacketParse_Interface.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../Build/Linux/.build-release" + @echo rebuilt > "../../Build/Linux/.build-release/PacketParse_Interface" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(ObjectSuffix): PacketParse_Interface/PacketParse_Interface.cpp $(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PacketParse_Interface/PacketParse_Interface.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(DependSuffix): PacketParse_Interface/PacketParse_Interface.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(DependSuffix) -MM PacketParse_Interface/PacketParse_Interface.cpp + +$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(PreprocessSuffix): PacketParse_Interface/PacketParse_Interface.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(PreprocessSuffix) PacketParse_Interface/PacketParse_Interface.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.mk b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.mk new file mode 100644 index 000000000..6b38f9163 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.mk @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PacketParse_Interface +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PacketParse_Interface.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/PacketParse_Interface" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(ObjectSuffix): PacketParse_Interface/PacketParse_Interface.cpp $(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface/PacketParse_Interface/PacketParse_Interface.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(DependSuffix): PacketParse_Interface/PacketParse_Interface.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(DependSuffix) -MM PacketParse_Interface/PacketParse_Interface.cpp + +$(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(PreprocessSuffix): PacketParse_Interface/PacketParse_Interface.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_Interface_PacketParse_Interface.cpp$(PreprocessSuffix) PacketParse_Interface/PacketParse_Interface.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.mpc b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.mpc deleted file mode 100644 index af74e81fe..000000000 --- a/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.mpc +++ /dev/null @@ -1,28 +0,0 @@ -project(PacketParse_Interface):acelib{ - sharedname=PacketParse_Interface - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ../Common/*.cpp - ./*.cpp - } - - includes += ../Common - - specific(make) { - compile_flags += -fcheck-new - } - - specific(gnuace) { - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../FrameCore/Windows_Bin - } else { - dllout = ../FrameCore/Linux_Bin - } - includes += . -} diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.project b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.project new file mode 100644 index 000000000..3eeb4729d --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.project @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.txt b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.txt new file mode 100644 index 000000000..4001e2fb7 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.txt @@ -0,0 +1 @@ +../../Build/Linux/Temp/PacketParse_Interface_PacketParse_Interface.cpp.o diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.vcproj b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.vcproj deleted file mode 100644 index 10e2f8f65..000000000 --- a/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.vcproj +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/PacketParse_Interface/IMessageBlockManager.h b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface/IMessageBlockManager.h similarity index 100% rename from purenessscopeserver/PacketParse_Interface/IMessageBlockManager.h rename to purenessscopeserver/PacketParse_Interface/PacketParse_Interface/IMessageBlockManager.h diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_Interface.cpp b/purenessscopeserver/PacketParse_Interface/PacketParse_Interface/PacketParse_Interface.cpp similarity index 100% rename from purenessscopeserver/PacketParse_Interface/PacketParse_Interface.cpp rename to purenessscopeserver/PacketParse_Interface/PacketParse_Interface/PacketParse_Interface.cpp diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.sln b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.sln deleted file mode 100644 index 46e15afc3..000000000 --- a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PacketParse_Interface", "PacketParse_VS2015.vcxproj", "{511391FD-8BFC-458F-86AD-2E08525F84A2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|Win32.ActiveCfg = Debug|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|Win32.Build.0 = Debug|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|x64.ActiveCfg = Debug|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|x64.Build.0 = Debug|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|Win32.ActiveCfg = Release|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|Win32.Build.0 = Release|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|x64.ActiveCfg = Release|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.vcxproj b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.vcxproj deleted file mode 100644 index 78412ecb9..000000000 --- a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.vcxproj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {511391FD-8BFC-458F-86AD-2E08525F84A2} - PacketParse_Interface - Win32Proj - 8.1 - - - - DynamicLibrary - v140 - Unicode - true - - - DynamicLibrary - v140 - Unicode - true - - - DynamicLibrary - v140 - Unicode - - - DynamicLibrary - v140 - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\FrameCore\Windows_Bin\ - $(Configuration)\ - true - - - true - ..\FrameCore\Windows_Bin\ - - - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - - - false - - - - Disabled - $(ACE_ROOT);%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level3 - EditAndContinue - - - aced.lib;%(AdditionalDependencies) - $(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - MachineX86 - - - - - Disabled - $(ACE_ROOT);%(AdditionalIncludeDirectories);../Common - WIN32;_DEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_EXPORTS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - ACEd.lib;%(AdditionalDependencies) - $(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - - - - - MaxSpeed - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - Level3 - ProgramDatabase - - - true - Windows - true - true - MachineX86 - - - - - MaxSpeed - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - $(ACE_ROOT);%(AdditionalIncludeDirectories);../Common - - - true - Windows - true - true - $(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - ACE.lib;%(AdditionalDependencies) - - - - - - - - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.vcxproj.filters b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.vcxproj.filters deleted file mode 100644 index 0c871c5fc..000000000 --- a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2015.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - 源文件 - - - - - 头文件 - - - 头文件 - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.cbp b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.cbp new file mode 100644 index 000000000..6fe48c83a --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.cbp @@ -0,0 +1,37 @@ + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.depend b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.layout b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.sln b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.sln deleted file mode 100644 index fb186a7d7..000000000 --- a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2037 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PacketParse_Interface", "PacketParse_VS2017.vcxproj", "{511391FD-8BFC-458F-86AD-2E08525F84A2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|Win32.ActiveCfg = Debug|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|Win32.Build.0 = Debug|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|x64.ActiveCfg = Debug|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|x64.Build.0 = Debug|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|Win32.ActiveCfg = Release|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|Win32.Build.0 = Release|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|x64.ActiveCfg = Release|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.vcxproj b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.vcxproj index 5f85d8212..00a30361d 100644 --- a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.vcxproj +++ b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.vcxproj @@ -18,11 +18,17 @@ x64 + + + + + + {511391FD-8BFC-458F-86AD-2E08525F84A2} PacketParse_Interface Win32Proj - 10.0.16299.0 + 10.0.17763.0 @@ -67,13 +73,13 @@ <_ProjectFileVersion>11.0.50727.1 - ..\PurenessScopeServer\Windows_Bin\ + ..\..\Build\Windows\ $(Configuration)\ true true - ..\PurenessScopeServer\Windows_Bin\ + ..\..\Build\Windows\ $(SolutionDir)$(Configuration)\ @@ -82,6 +88,8 @@ false + $(SolutionDir)\Windows_Bin + $(SolutionDir)\Temp\ @@ -163,13 +171,6 @@ ACE.lib;%(AdditionalDependencies) - - - - - - - diff --git a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.vcxproj.filters b/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.vcxproj.filters deleted file mode 100644 index 0c871c5fc..000000000 --- a/purenessscopeserver/PacketParse_Interface/PacketParse_VS2017.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - 源文件 - - - - - 头文件 - - - 头文件 - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface/runlinuxmake.sh b/purenessscopeserver/PacketParse_Interface/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/PacketParse_Interface/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_Http/CMakeLists.txt b/purenessscopeserver/PacketParse_Interface_Http/CMakeLists.txt new file mode 100644 index 000000000..05ae83a5d --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Http/CMakeLists.txt @@ -0,0 +1,83 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PacketParse_Interface_Http) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PacketParse_Interface_Http_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/PacketParse_Interface_Http/PacketParse_Interface_Http.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(PacketParse_Interface_Http SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PacketParse_Interface_Http ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/PacketParse_Interface_Http/Makefile b/purenessscopeserver/PacketParse_Interface_Http/Makefile new file mode 100644 index 000000000..aa3395bbf --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Http/Makefile @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PacketParse_Interface_Http +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../purenessscopeserver/PacketParse_Interface_Http +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PacketParse_Interface_Http.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../Build/Linux/.build-release" + @echo rebuilt > "../../Build/Linux/.build-release/PacketParse_Interface_Http" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(ObjectSuffix): PacketParse_Interface_Http/PacketParse_Interface_Http.cpp $(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PacketParse_Interface_Http/PacketParse_Interface_Http.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(DependSuffix): PacketParse_Interface_Http/PacketParse_Interface_Http.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(DependSuffix) -MM PacketParse_Interface_Http/PacketParse_Interface_Http.cpp + +$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(PreprocessSuffix): PacketParse_Interface_Http/PacketParse_Interface_Http.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(PreprocessSuffix) PacketParse_Interface_Http/PacketParse_Interface_Http.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/PacketParse_Interface_Http/Makefile.mpc b/purenessscopeserver/PacketParse_Interface_Http/Makefile.mpc deleted file mode 100644 index c0cd4602a..000000000 --- a/purenessscopeserver/PacketParse_Interface_Http/Makefile.mpc +++ /dev/null @@ -1,16 +0,0 @@ -project(PacketParse_Interface_Http):acelib{ - sharedname=PacketParse_Interface_Http - dynamicflags += PACKETPARSE_INTERFACE_HTTP_EXPORTS - - Source_Files{ - ./*.cpp - } - - specific (prop:microsoft){ - dllout = ../FrameCore/Windows_Bin - } else { - macros += __LINUX__ - dllout = ../FrameCore/Linux_Bin - } - includes += ../Common -} \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.mk b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.mk new file mode 100644 index 000000000..fa2d8c25d --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.mk @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PacketParse_Interface_Http +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_Http +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PacketParse_Interface_Http.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/PacketParse_Interface_Http" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(ObjectSuffix): PacketParse_Interface_Http/PacketParse_Interface_Http.cpp $(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http/PacketParse_Interface_Http.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(DependSuffix): PacketParse_Interface_Http/PacketParse_Interface_Http.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(DependSuffix) -MM PacketParse_Interface_Http/PacketParse_Interface_Http.cpp + +$(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(PreprocessSuffix): PacketParse_Interface_Http/PacketParse_Interface_Http.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp$(PreprocessSuffix) PacketParse_Interface_Http/PacketParse_Interface_Http.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.project b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.project new file mode 100644 index 000000000..5f1a291e2 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.txt b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.txt new file mode 100644 index 000000000..948e351ce --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.txt @@ -0,0 +1 @@ +../../Build/Linux/Temp/PacketParse_Interface_Http_PacketParse_Interface_Http.cpp.o diff --git a/purenessscopeserver/PacketParse_Interface_Http/HttpInfo.h b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http/HttpInfo.h similarity index 100% rename from purenessscopeserver/PacketParse_Interface_Http/HttpInfo.h rename to purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http/HttpInfo.h diff --git a/purenessscopeserver/PacketParse_Interface_Http/IMessageBlockManager.h b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http/IMessageBlockManager.h similarity index 100% rename from purenessscopeserver/PacketParse_Interface_Http/IMessageBlockManager.h rename to purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http/IMessageBlockManager.h diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.cpp b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http/PacketParse_Interface_Http.cpp similarity index 100% rename from purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http.cpp rename to purenessscopeserver/PacketParse_Interface_Http/PacketParse_Interface_Http/PacketParse_Interface_Http.cpp diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.sln b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.sln deleted file mode 100644 index a178479a4..000000000 --- a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PacketParse_Interface_Http", "PacketParse_VS2015_Http.vcxproj", "{94519142-1FDA-44E6-9B3F-F38D2D231B3D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Debug|x64.ActiveCfg = Debug|x64 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Debug|x64.Build.0 = Debug|x64 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Debug|x86.ActiveCfg = Debug|Win32 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Debug|x86.Build.0 = Debug|Win32 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Release|x64.ActiveCfg = Release|x64 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Release|x64.Build.0 = Release|x64 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Release|x86.ActiveCfg = Release|Win32 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.vcxproj b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.vcxproj deleted file mode 100644 index 1e9ad9425..000000000 --- a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.vcxproj +++ /dev/null @@ -1,175 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - {94519142-1FDA-44E6-9B3F-F38D2D231B3D} - Win32Proj - PacketParse_Interface_Http - 8.1 - - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - DynamicLibrary - true - v140 - Unicode - - - DynamicLibrary - false - v140 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - true - ..\FrameCore\Windows_Bin - - - false - ..\PurenessScopeServer\Windows_Bin\ - $(Platform)\$(Configuration)\ - - - false - ..\PurenessScopeServer\Windows_Bin - - - - - - Level3 - Disabled - WIN32;_CRT_SECURE_NO_WARNINGS;_DEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_HTTP_EXPORTS;%(PreprocessorDefinitions) - true - $(ACE_ROOT);%(AdditionalIncludeDirectories);../Common; - - - Windows - true - - - - - NotUsing - Level3 - Disabled - _DEBUG;_WINDOWS;WIN32;_USRDLL;PACKETPARSE_INTERFACE_HTTP_EXPORTS;%(PreprocessorDefinitions) - true - $(ACE_ROOT);%(AdditionalIncludeDirectories);../Common; - ProgramDatabase - - - Windows - true - $(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - aced.lib;%(AdditionalDependencies) - - - - - Level3 - - - MaxSpeed - true - true - NDEBUG;WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_HTTP_EXPORTS;%(PreprocessorDefinitions) - true - $(ACE_ROOT);%(AdditionalIncludeDirectories) - - - Windows - true - true - true - $(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - ace.lib;%(AdditionalDependencies) - - - - - Level3 - NotUsing - MaxSpeed - true - true - NDEBUG;WIN32;_WINSOCK_DEPRECATED_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_HTTP_EXPORTS;%(PreprocessorDefinitions) - true - ..\Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) - - - Windows - true - true - true - $(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - ace.lib;%(AdditionalDependencies) - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.vcxproj.filters b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.vcxproj.filters deleted file mode 100644 index 7b05d55de..000000000 --- a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2015_Http.vcxproj.filters +++ /dev/null @@ -1,36 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - 源文件 - - - - - 头文件 - - - 头文件 - - - 头文件 - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.cbp b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.cbp new file mode 100644 index 000000000..f9b98ee4f --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.cbp @@ -0,0 +1,38 @@ + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.depend b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.layout b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.sln b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.sln deleted file mode 100644 index 613402788..000000000 --- a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2037 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PacketParse_Interface_Http", "PacketParse_VS2017_Http.vcxproj", "{94519142-1FDA-44E6-9B3F-F38D2D231B3D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Debug|x64.ActiveCfg = Debug|x64 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Debug|x64.Build.0 = Debug|x64 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Debug|x86.ActiveCfg = Debug|Win32 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Debug|x86.Build.0 = Debug|Win32 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Release|x64.ActiveCfg = Release|x64 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Release|x64.Build.0 = Release|x64 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Release|x86.ActiveCfg = Release|Win32 - {94519142-1FDA-44E6-9B3F-F38D2D231B3D}.Release|x86.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.vcxproj b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.vcxproj index 5af674ddb..a83bfde55 100644 --- a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.vcxproj +++ b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.vcxproj @@ -18,11 +18,18 @@ x64 + + + + + + + {94519142-1FDA-44E6-9B3F-F38D2D231B3D} Win32Proj PacketParse_Interface_Http - 10.0.16299.0 + 10.0.17763.0 @@ -71,10 +78,11 @@ true + ..\..\Build\Windows\ true - ..\FrameCore\Windows_Bin + ..\..\Build\Windows\ false @@ -83,7 +91,8 @@ false - ..\PurenessScopeServer\Windows_Bin + $(SolutionDir)\Windows_Bin + $(SolutionDir)\Temp\ @@ -158,17 +167,6 @@ ace.lib;%(AdditionalDependencies) - - - - - - - - - - - diff --git a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.vcxproj.filters b/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.vcxproj.filters deleted file mode 100644 index 7b05d55de..000000000 --- a/purenessscopeserver/PacketParse_Interface_Http/PacketParse_VS2017_Http.vcxproj.filters +++ /dev/null @@ -1,36 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - 源文件 - - - - - 头文件 - - - 头文件 - - - 头文件 - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_Http/ReadMe.txt b/purenessscopeserver/PacketParse_Interface_Http/ReadMe.txt deleted file mode 100644 index 0a3a3b2a6..000000000 --- a/purenessscopeserver/PacketParse_Interface_Http/ReadMe.txt +++ /dev/null @@ -1,32 +0,0 @@ -======================================================================== - 动态链接库:PacketParse_Interface_Http 项目概述 -======================================================================== - -应用程序向导已为您创建了此 PacketParse_Interface_Http DLL。 - -本文件概要介绍组成 PacketParse_Interface_Http 应用程序的每个文件的内容。 - - -PacketParse_Interface_Http.vcxproj - 这是使用应用程序向导生成的 VC++ 项目的主项目文件,其中包含生成该文件的 Visual C++ 的版本信息,以及有关使用应用程序向导选择的平台、配置和项目功能的信息。 - -PacketParse_Interface_Http.vcxproj.filters - 这是使用“应用程序向导”生成的 VC++ 项目筛选器文件。它包含有关项目文件与筛选器之间的关联信息。在 IDE 中,通过这种关联,在特定节点下以分组形式显示具有相似扩展名的文件。例如,“.cpp”文件与“源文件”筛选器关联。 - -PacketParse_Interface_Http.cpp - 这是主 DLL 源文件。 - - 此 DLL 在创建时不导出任何符号。因此,生成时不会产生 .lib 文件。如果希望此项目成为其他某个项目的项目依赖项,则需要添加代码以从 DLL 导出某些符号,以便产生一个导出库,或者,也可以在项目“属性页”对话框中的“链接器”文件夹中,将“常规”属性页上的“忽略输入库”属性设置为“是”。 - -///////////////////////////////////////////////////////////////////////////// -其他标准文件: - -StdAfx.h, StdAfx.cpp - 这些文件用于生成名为 PacketParse_Interface_Http.pch 的预编译头 (PCH) 文件和名为 StdAfx.obj 的预编译类型文件。 - -///////////////////////////////////////////////////////////////////////////// -其他注释: - -应用程序向导使用“TODO:”注释来指示应添加或自定义的源代码部分。 - -///////////////////////////////////////////////////////////////////////////// diff --git a/purenessscopeserver/PacketParse_Interface_Http/runlinuxmake.sh b/purenessscopeserver/PacketParse_Interface_Http/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/PacketParse_Interface_Http/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/CMakeLists.txt b/purenessscopeserver/PacketParse_Interface_Monitor/CMakeLists.txt new file mode 100644 index 000000000..b68c56e8a --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Monitor/CMakeLists.txt @@ -0,0 +1,83 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PacketParse_Interface_Monitor) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PacketParse_Interface_Monitor_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../ThirdLib/include/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(PacketParse_Interface_Monitor SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PacketParse_Interface_Monitor ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/Makefile b/purenessscopeserver/PacketParse_Interface_Monitor/Makefile new file mode 100644 index 000000000..e9cc66b9a --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Monitor/Makefile @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PacketParse_Interface_Monitor +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../purenessscopeserver/PacketParse_Interface_Monitor +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PacketParse_Interface_Monitor.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/Common $(IncludeSwitch)../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../Build/Linux/.build-release" + @echo rebuilt > "../../Build/Linux/.build-release/PacketParse_Interface_Monitor" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(ObjectSuffix): PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp $(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(DependSuffix): PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(DependSuffix) -MM PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp + +$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(PreprocessSuffix): PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(PreprocessSuffix) PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cbp b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cbp new file mode 100644 index 000000000..ba668161e --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cbp @@ -0,0 +1,38 @@ + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.depend b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.layout b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.mk b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.mk new file mode 100644 index 000000000..db8f721bc --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.mk @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PacketParse_Interface_Monitor +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_Monitor +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PacketParse_Interface_Monitor.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/Common $(IncludeSwitch)../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/PacketParse_Interface_Monitor" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(ObjectSuffix): PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp $(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(DependSuffix): PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(DependSuffix) -MM PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp + +$(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(PreprocessSuffix): PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp$(PreprocessSuffix) PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.mpc b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.mpc deleted file mode 100644 index 18981199f..000000000 --- a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.mpc +++ /dev/null @@ -1,28 +0,0 @@ -project(PacketParse_Interface_monitor):acelib{ - sharedname=PacketParse_Interface_monitor - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ../Common/*.cpp - ./*.cpp - } - - includes += ../Common - - specific(make) { - compile_flags += -fcheck-new - } - - specific(gnuace) { - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../FrameCore/Windows_Bin - } else { - dllout = ../FrameCore/Linux_Bin - } - includes += . -} diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.project b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.project new file mode 100644 index 000000000..3ef93db56 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.txt b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.txt new file mode 100644 index 000000000..161ca5696 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.txt @@ -0,0 +1 @@ +../../Build/Linux/Temp/PacketParse_Interface_Monitor_PacketParse_Interface_Monitor.cpp.o diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.vcproj b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.vcproj deleted file mode 100644 index b2bd9c5ea..000000000 --- a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.vcproj +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/IMessageBlockManager.h b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor/IMessageBlockManager.h similarity index 100% rename from purenessscopeserver/PacketParse_Interface_Monitor/IMessageBlockManager.h rename to purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor/IMessageBlockManager.h diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp b/purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp similarity index 100% rename from purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp rename to purenessscopeserver/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor/PacketParse_Interface_Monitor.cpp diff --git a/purenessscopeserver/PacketParse_Interface_Monitor/runlinuxmake.sh b/purenessscopeserver/PacketParse_Interface_Monitor/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/PacketParse_Interface_Monitor/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/CMakeLists.txt b/purenessscopeserver/PacketParse_Interface_WebSocket/CMakeLists.txt new file mode 100644 index 000000000..e8f27ac53 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/CMakeLists.txt @@ -0,0 +1,84 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PacketParse_Interface_WebSocket) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PacketParse_Interface_WebSocket_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../ThirdLib/include/Common + ../Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/PacketParse_Interface_WebSocket/PacketParse_Interface.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(PacketParse_Interface_WebSocket SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PacketParse_Interface_WebSocket ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/Makefile b/purenessscopeserver/PacketParse_Interface_WebSocket/Makefile new file mode 100644 index 000000000..7e2ac46d0 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/Makefile @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PacketParse_Interface_WebSocket +ConfigurationName :=Release +WorkspacePath :=../../Build/Linux +ProjectPath :=../purenessscopeserver/PacketParse_Interface_WebSocket +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PacketParse_Interface_WebSocket.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/Common $(IncludeSwitch)../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../Build/Linux/.build-release" + @echo rebuilt > "../../Build/Linux/.build-release/PacketParse_Interface_WebSocket" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(ObjectSuffix): PacketParse_Interface_WebSocket/PacketParse_Interface.cpp $(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PacketParse_Interface_WebSocket/PacketParse_Interface.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(DependSuffix): PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(DependSuffix) -MM PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + +$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(PreprocessSuffix): PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(PreprocessSuffix) PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface.mpc b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface.mpc deleted file mode 100644 index 1391444ae..000000000 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface.mpc +++ /dev/null @@ -1,17 +0,0 @@ -project(PacketParse_Interface_WebSocket):acelib{ - sharedname=PacketParse_Interface_WebSocket - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ./*.cpp - } - macros += __LINUX__ - - libout = ./ - specific (prop:microsoft){ - dllout = ../FrameCore/Windows_Bin - } else { - dllout = ../FrameCore/Linux_Bin - } - includes += ../Common -} diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface.vcproj b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface.vcproj deleted file mode 100644 index 9d06a3962..000000000 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface.vcproj +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.mk b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.mk new file mode 100644 index 000000000..e756477bb --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.mk @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PacketParse_Interface_WebSocket +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_WebSocket +IntermediateDirectory :=$(WorkspacePath)/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PacketParse_Interface_WebSocket.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../ThirdLib/include/Common $(IncludeSwitch)../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/PacketParse_Interface_WebSocket" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Temp || $(MakeDirCommand) $(WorkspacePath)/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(ObjectSuffix): PacketParse_Interface_WebSocket/PacketParse_Interface.cpp $(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/PacketParse_Interface.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(DependSuffix): PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(DependSuffix) -MM PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + +$(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(PreprocessSuffix): PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp$(PreprocessSuffix) PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Temp/ + + diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.project b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.project new file mode 100644 index 000000000..a7d3b0251 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.project @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.txt b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.txt new file mode 100644 index 000000000..2be4650a3 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket.txt @@ -0,0 +1 @@ +../../Build/Linux/Temp/PacketParse_Interface_WebSocket_PacketParse_Interface.cpp.o diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/IMessageBlockManager.h b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/IMessageBlockManager.h similarity index 100% rename from purenessscopeserver/PacketParse_Interface_WebSocket/IMessageBlockManager.h rename to purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/IMessageBlockManager.h diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface.cpp b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/PacketParse_Interface.cpp similarity index 100% rename from purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface.cpp rename to purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/PacketParse_Interface.cpp diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/WebSocketInfo.h b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/WebSocketInfo.h similarity index 100% rename from purenessscopeserver/PacketParse_Interface_WebSocket/WebSocketInfo.h rename to purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/WebSocketInfo.h diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.sln b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.sln deleted file mode 100644 index 202849ed0..000000000 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PacketParse_Interface", "PacketParse_VS2015_WebSocket.vcxproj", "{511391FD-8BFC-458F-86AD-2E08525F84A2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|Win32.ActiveCfg = Debug|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|Win32.Build.0 = Debug|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|x64.ActiveCfg = Debug|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|x64.Build.0 = Debug|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|Win32.ActiveCfg = Release|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|Win32.Build.0 = Release|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|x64.ActiveCfg = Release|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.vcxproj b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.vcxproj deleted file mode 100644 index cf78201e8..000000000 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.vcxproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {511391FD-8BFC-458F-86AD-2E08525F84A2} - PacketParse_Interface - Win32Proj - 8.1 - - - - DynamicLibrary - v140 - Unicode - true - - - DynamicLibrary - v140 - Unicode - true - - - DynamicLibrary - v140 - Unicode - - - DynamicLibrary - v140 - Unicode - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\PurenessScopeServer\Windows_Bin\ - $(Configuration)\ - true - PacketParse_WebSocket - - - true - PacketParse_WebSocket - ..\FrameCore\Windows_Bin\ - - - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - - - false - - - - Disabled - $(ACE_ROOT);%(AdditionalIncludeDirectories);../Common - WIN32;_DEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - Level3 - EditAndContinue - - - aced.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - $(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - MachineX86 - - - - - Disabled - $(ACE_ROOT);%(AdditionalIncludeDirectories);../Common - WIN32;_DEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - aced.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - $(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - - - - - MaxSpeed - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - Level3 - ProgramDatabase - - - true - Windows - true - true - MachineX86 - - - - - MaxSpeed - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;PACKETPARSE_INTERFACE_EXPORTS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - - - true - Windows - true - true - - - - - - - - - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.vcxproj.filters b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.vcxproj.filters deleted file mode 100644 index 6777a4fdb..000000000 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2015_WebSocket.vcxproj.filters +++ /dev/null @@ -1,33 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - 源文件 - - - - - 头文件 - - - 头文件 - - - 头文件 - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.cbp b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.cbp new file mode 100644 index 000000000..5de9942c7 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.cbp @@ -0,0 +1,39 @@ + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.depend b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.depend new file mode 100644 index 000000000..dad0c22b5 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.depend @@ -0,0 +1,36 @@ +# depslib dependency file v1.0 +1553770511 source:/data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/PacketParse_Interface.cpp + "define.h" + "WebSocketInfo.h" + "IMessageBlockManager.h" + "ace/svc_export.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//define.h + "ace/SString.h" + "ace/Malloc.h" + "ace/Malloc_T.h" + "ace/Task_T.h" + "ace/Local_Memory_Pool.h" + "ace/Time_Value.h" + "ace/OS_main.h" + "ace/OS_NS_sys_stat.h" + "ace/OS_NS_sys_socket.h" + "ace/OS_NS_unistd.h" + "ace/OS_NS_string.h" + "ace/High_Res_Timer.h" + "ace/INET_Addr.h" + "ace/Hash_Map_Manager.h" + + + + + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/WebSocketInfo.h + "define.h" + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_Interface_WebSocket/IMessageBlockManager.h + "define.h" + "ace/Message_Block.h" + diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.layout b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.layout new file mode 100644 index 000000000..937cdda44 --- /dev/null +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.sln b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.sln deleted file mode 100644 index fc6a0494b..000000000 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2037 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PacketParse_Interface", "PacketParse_VS2017_WebSocket.vcxproj", "{511391FD-8BFC-458F-86AD-2E08525F84A2}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|Win32.ActiveCfg = Debug|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|Win32.Build.0 = Debug|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|x64.ActiveCfg = Debug|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Debug|x64.Build.0 = Debug|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|Win32.ActiveCfg = Release|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|Win32.Build.0 = Release|Win32 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|x64.ActiveCfg = Release|x64 - {511391FD-8BFC-458F-86AD-2E08525F84A2}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.vcxproj b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.vcxproj index a5a1ce8cb..f0c89c1a2 100644 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.vcxproj +++ b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.vcxproj @@ -18,11 +18,18 @@ x64 + + + + + + + - {511391FD-8BFC-458F-86AD-2E08525F84A2} + {FB788A13-6437-4FD1-AD68-8F4E54C85549} PacketParse_Interface Win32Proj - 10.0.16299.0 + 10.0.17763.0 @@ -84,6 +91,8 @@ false + $(SolutionDir)\Windows_Bin + $(SolutionDir)\Temp\ @@ -156,22 +165,17 @@ Level3 ProgramDatabase + ../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) true Windows true true + .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) + ACE.lib;%(AdditionalDependencies) - - - - - - - - diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.vcxproj.filters b/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.vcxproj.filters deleted file mode 100644 index 6777a4fdb..000000000 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/PacketParse_VS2017_WebSocket.vcxproj.filters +++ /dev/null @@ -1,33 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - 源文件 - - - - - 头文件 - - - 头文件 - - - 头文件 - - - \ No newline at end of file diff --git a/purenessscopeserver/PacketParse_Interface_WebSocket/runlinuxmake.sh b/purenessscopeserver/PacketParse_Interface_WebSocket/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/PacketParse_Interface_WebSocket/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.cbp b/purenessscopeserver/example-Module/AutoTest/AutoTest.cbp new file mode 100644 index 000000000..2133b6286 --- /dev/null +++ b/purenessscopeserver/example-Module/AutoTest/AutoTest.cbp @@ -0,0 +1,40 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.depend b/purenessscopeserver/example-Module/AutoTest/AutoTest.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/AutoTest/AutoTest.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.layout b/purenessscopeserver/example-Module/AutoTest/AutoTest.layout new file mode 100644 index 000000000..d1629207b --- /dev/null +++ b/purenessscopeserver/example-Module/AutoTest/AutoTest.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.mk b/purenessscopeserver/example-Module/AutoTest/AutoTest.mk new file mode 100644 index 000000000..c8ea7bc19 --- /dev/null +++ b/purenessscopeserver/example-Module/AutoTest/AutoTest.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=AutoTest +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/AutoTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="AutoTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(ObjectSuffix) $(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/AutoTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(ObjectSuffix): ./AutoTest/AutoTest.cpp $(IntermediateDirectory)/AutoTest_AutoTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/AutoTest/AutoTest/AutoTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(DependSuffix): ./AutoTest/AutoTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(DependSuffix) -MM ./AutoTest/AutoTest.cpp + +$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(PreprocessSuffix): ./AutoTest/AutoTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/AutoTest_AutoTest.cpp$(PreprocessSuffix) ./AutoTest/AutoTest.cpp + +$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(ObjectSuffix): ./AutoTest/BaseCommand.cpp $(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/AutoTest/AutoTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(DependSuffix): ./AutoTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(DependSuffix) -MM ./AutoTest/BaseCommand.cpp + +$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(PreprocessSuffix): ./AutoTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(PreprocessSuffix) ./AutoTest/BaseCommand.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.mpc b/purenessscopeserver/example-Module/AutoTest/AutoTest.mpc deleted file mode 100644 index b7aeb9394..000000000 --- a/purenessscopeserver/example-Module/AutoTest/AutoTest.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(AutoTest):acelib{ - sharedname=AutoTest - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.project b/purenessscopeserver/example-Module/AutoTest/AutoTest.project new file mode 100644 index 000000000..346a198c1 --- /dev/null +++ b/purenessscopeserver/example-Module/AutoTest/AutoTest.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.sln b/purenessscopeserver/example-Module/AutoTest/AutoTest.sln deleted file mode 100644 index 4605cdac7..000000000 --- a/purenessscopeserver/example-Module/AutoTest/AutoTest.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AutoTest", "AutoTest.vcxproj", "{2F26D6BE-FECA-1BAD-2246-D8260000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2F26D6BE-FECA-1BAD-2246-D8260000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {2F26D6BE-FECA-1BAD-2246-D8260000002E}.Debug|Win32.Build.0 = Debug|Win32 - {2F26D6BE-FECA-1BAD-2246-D8260000002E}.Debug|x64.ActiveCfg = Debug|x64 - {2F26D6BE-FECA-1BAD-2246-D8260000002E}.Debug|x64.Build.0 = Debug|x64 - {2F26D6BE-FECA-1BAD-2246-D8260000002E}.Release|Win32.ActiveCfg = Release|Win32 - {2F26D6BE-FECA-1BAD-2246-D8260000002E}.Release|Win32.Build.0 = Release|Win32 - {2F26D6BE-FECA-1BAD-2246-D8260000002E}.Release|x64.ActiveCfg = Release|x64 - {2F26D6BE-FECA-1BAD-2246-D8260000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.txt b/purenessscopeserver/example-Module/AutoTest/AutoTest.txt new file mode 100644 index 000000000..da17eae4b --- /dev/null +++ b/purenessscopeserver/example-Module/AutoTest/AutoTest.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/AutoTest_AutoTest.cpp.o ../../../Build/Linux/Linux_Bin/Temp/AutoTest_BaseCommand.cpp.o diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.vcproj b/purenessscopeserver/example-Module/AutoTest/AutoTest.vcproj deleted file mode 100644 index 6bfb232f1..000000000 --- a/purenessscopeserver/example-Module/AutoTest/AutoTest.vcproj +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.vcxproj b/purenessscopeserver/example-Module/AutoTest/AutoTest.vcxproj index 47d4b62ab..9b0b4bcb9 100644 --- a/purenessscopeserver/example-Module/AutoTest/AutoTest.vcxproj +++ b/purenessscopeserver/example-Module/AutoTest/AutoTest.vcxproj @@ -1,243 +1,166 @@ - - + + Debug Win32 - - Debug - x64 - Release Win32 + + Debug + x64 + Release x64 + + + + + + + + + + - {2F26D6BE-FECA-1BAD-2246-D8260000002E} - AutoTest + 15.0 + {5F837ED0-153F-4EEB-8018-2D1A84BDBBB1} Win32Proj + AutoTest + 10.0.17763.0 - - DynamicLibrary - v140 - NotSet - DynamicLibrary - v140 - NotSet + true + v141 + Unicode - + DynamicLibrary - v140 - NotSet + false + v141 + true + Unicode DynamicLibrary - v140 - NotSet + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode - + + + - + - + - + - - <_ProjectFileVersion>11.0.50727.1 - - ..\..\PurenessScopeServer\Windows_Bin\ - Debug\AutoTest\I386\ true - - ..\..\PurenessScopeServer\Windows_Bin\ - Release\AutoTest\I386\ - false - - ..\..\PurenessScopeServer\Windows_Bin\ - Debug\AutoTest\AMD64\ true + + false + - ..\..\PurenessScopeServer\Windows_Bin\ - Release\AutoTest\AMD64\ false + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - Disabled - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true + Use Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) + Disabled + true + WIN32;_DEBUG;AUTOTEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true Windows - .\\AutoTestd.lib - MachineX86 + true - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - + - MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true + Use Level3 - 4355;%(DisableSpecificWarnings) + Disabled + true + _DEBUG;AUTOTEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)AutoTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false Windows - true - true - .\\AutoTest.lib - MachineX86 + true - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - + - Disabled - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true + Use Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) + MaxSpeed + true + true + true + WIN32;NDEBUG;AUTOTEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)AutoTestd.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true Windows - .\\AutoTestd.lib - MachineX64 + true + true + true - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true + NotUsing Level3 - 4355;%(DisableSpecificWarnings) + MaxSpeed + true + true + true + TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + true + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)AutoTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false Windows - true true - .\\AutoTest.lib - MachineX64 + true + true + .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) + ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - - - - - - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.vcxproj.filters b/purenessscopeserver/example-Module/AutoTest/AutoTest.vcxproj.filters index 2431540a7..a697dcde2 100644 --- a/purenessscopeserver/example-Module/AutoTest/AutoTest.vcxproj.filters +++ b/purenessscopeserver/example-Module/AutoTest/AutoTest.vcxproj.filters @@ -1,35 +1,33 @@  - - {ee0a7ab5-8036-4a36-bf36-2b2f4fb88053} - cpp;cxx;cc;c;C + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - {1a64c6bc-c739-440d-9172-6af224bbae33} - h;hpp;hxx;hh + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - {e35f7553-962a-4ba2-b8e6-12439f26faa7} - mpc;mpb;mwc + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - Source Files + + 源文件 - - Source Files + + 源文件 - - Header Files - + - - Build Files - + + 头文件 + \ No newline at end of file diff --git a/purenessscopeserver/example-Module/AutoTest/AutoTest.cpp b/purenessscopeserver/example-Module/AutoTest/AutoTest/AutoTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/AutoTest/AutoTest.cpp rename to purenessscopeserver/example-Module/AutoTest/AutoTest/AutoTest.cpp diff --git a/purenessscopeserver/example-Module/AutoTest/BaseCommand.cpp b/purenessscopeserver/example-Module/AutoTest/AutoTest/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/AutoTest/BaseCommand.cpp rename to purenessscopeserver/example-Module/AutoTest/AutoTest/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/AutoTest/BaseCommand.h b/purenessscopeserver/example-Module/AutoTest/AutoTest/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/AutoTest/BaseCommand.h rename to purenessscopeserver/example-Module/AutoTest/AutoTest/BaseCommand.h diff --git a/purenessscopeserver/example-Module/AutoTest/CMakeLists.txt b/purenessscopeserver/example-Module/AutoTest/CMakeLists.txt new file mode 100644 index 000000000..fbd431f1c --- /dev/null +++ b/purenessscopeserver/example-Module/AutoTest/CMakeLists.txt @@ -0,0 +1,84 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(AutoTest) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_AutoTest_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./AutoTest/AutoTest.cpp + ${CMAKE_CURRENT_LIST_DIR}/./AutoTest/BaseCommand.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(AutoTest SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(AutoTest ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/AutoTest/Makefile b/purenessscopeserver/example-Module/AutoTest/Makefile new file mode 100644 index 000000000..b5f6751b6 --- /dev/null +++ b/purenessscopeserver/example-Module/AutoTest/Makefile @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=AutoTest +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/AutoTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="AutoTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(ObjectSuffix) $(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/AutoTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(ObjectSuffix): ./AutoTest/AutoTest.cpp $(IntermediateDirectory)/AutoTest_AutoTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./AutoTest/AutoTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(DependSuffix): ./AutoTest/AutoTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(DependSuffix) -MM ./AutoTest/AutoTest.cpp + +$(IntermediateDirectory)/AutoTest_AutoTest.cpp$(PreprocessSuffix): ./AutoTest/AutoTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/AutoTest_AutoTest.cpp$(PreprocessSuffix) ./AutoTest/AutoTest.cpp + +$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(ObjectSuffix): ./AutoTest/BaseCommand.cpp $(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./AutoTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(DependSuffix): ./AutoTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(DependSuffix) -MM ./AutoTest/BaseCommand.cpp + +$(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(PreprocessSuffix): ./AutoTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/AutoTest_BaseCommand.cpp$(PreprocessSuffix) ./AutoTest/BaseCommand.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/AutoTest/runlinuxmake.sh b/purenessscopeserver/example-Module/AutoTest/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/AutoTest/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/AutoTest/zzz.bat b/purenessscopeserver/example-Module/AutoTest/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/AutoTest/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/FtpTest/CMakeLists.txt b/purenessscopeserver/example-Module/FtpTest/CMakeLists.txt new file mode 100644 index 000000000..0f886ab3b --- /dev/null +++ b/purenessscopeserver/example-Module/FtpTest/CMakeLists.txt @@ -0,0 +1,85 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(FtpTest) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_FtpTest_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LDebug ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./FtpTest/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./FtpTest/DirView.cpp + ${CMAKE_CURRENT_LIST_DIR}/./FtpTest/FtpTest.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(FtpTest SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(FtpTest ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.cbp b/purenessscopeserver/example-Module/FtpTest/FtpTest.cbp new file mode 100644 index 000000000..933b373aa --- /dev/null +++ b/purenessscopeserver/example-Module/FtpTest/FtpTest.cbp @@ -0,0 +1,75 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.depend b/purenessscopeserver/example-Module/FtpTest/FtpTest.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/FtpTest/FtpTest.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.layout b/purenessscopeserver/example-Module/FtpTest/FtpTest.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/FtpTest/FtpTest.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.mk b/purenessscopeserver/example-Module/FtpTest/FtpTest.mk new file mode 100644 index 000000000..6b7441f59 --- /dev/null +++ b/purenessscopeserver/example-Module/FtpTest/FtpTest.mk @@ -0,0 +1,128 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=FtpTest +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/FtpTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="FtpTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/FtpTest_DirView.cpp$(ObjectSuffix) $(IntermediateDirectory)/FtpTest_FtpTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/FtpTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(ObjectSuffix): ./FtpTest/BaseCommand.cpp $(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/FtpTest/FtpTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(DependSuffix): ./FtpTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(DependSuffix) -MM ./FtpTest/BaseCommand.cpp + +$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(PreprocessSuffix): ./FtpTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(PreprocessSuffix) ./FtpTest/BaseCommand.cpp + +$(IntermediateDirectory)/FtpTest_DirView.cpp$(ObjectSuffix): ./FtpTest/DirView.cpp $(IntermediateDirectory)/FtpTest_DirView.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/FtpTest/FtpTest/DirView.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/FtpTest_DirView.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/FtpTest_DirView.cpp$(DependSuffix): ./FtpTest/DirView.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/FtpTest_DirView.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/FtpTest_DirView.cpp$(DependSuffix) -MM ./FtpTest/DirView.cpp + +$(IntermediateDirectory)/FtpTest_DirView.cpp$(PreprocessSuffix): ./FtpTest/DirView.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/FtpTest_DirView.cpp$(PreprocessSuffix) ./FtpTest/DirView.cpp + +$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(ObjectSuffix): ./FtpTest/FtpTest.cpp $(IntermediateDirectory)/FtpTest_FtpTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/FtpTest/FtpTest/FtpTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(DependSuffix): ./FtpTest/FtpTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(DependSuffix) -MM ./FtpTest/FtpTest.cpp + +$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(PreprocessSuffix): ./FtpTest/FtpTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/FtpTest_FtpTest.cpp$(PreprocessSuffix) ./FtpTest/FtpTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.mpc b/purenessscopeserver/example-Module/FtpTest/FtpTest.mpc deleted file mode 100644 index e417459f7..000000000 --- a/purenessscopeserver/example-Module/FtpTest/FtpTest.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(FtpTest):acelib{ - sharedname=FtpTest - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.project b/purenessscopeserver/example-Module/FtpTest/FtpTest.project new file mode 100644 index 000000000..628af80d0 --- /dev/null +++ b/purenessscopeserver/example-Module/FtpTest/FtpTest.project @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.sln b/purenessscopeserver/example-Module/FtpTest/FtpTest.sln deleted file mode 100644 index ae5f586ee..000000000 --- a/purenessscopeserver/example-Module/FtpTest/FtpTest.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FtpTest", "FtpTest.vcxproj", "{6D1726BE-FECA-1BAD-2246-CB560000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6D1726BE-FECA-1BAD-2246-CB560000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {6D1726BE-FECA-1BAD-2246-CB560000002E}.Debug|Win32.Build.0 = Debug|Win32 - {6D1726BE-FECA-1BAD-2246-CB560000002E}.Debug|x64.ActiveCfg = Debug|x64 - {6D1726BE-FECA-1BAD-2246-CB560000002E}.Debug|x64.Build.0 = Debug|x64 - {6D1726BE-FECA-1BAD-2246-CB560000002E}.Release|Win32.ActiveCfg = Release|Win32 - {6D1726BE-FECA-1BAD-2246-CB560000002E}.Release|Win32.Build.0 = Release|Win32 - {6D1726BE-FECA-1BAD-2246-CB560000002E}.Release|x64.ActiveCfg = Release|x64 - {6D1726BE-FECA-1BAD-2246-CB560000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.txt b/purenessscopeserver/example-Module/FtpTest/FtpTest.txt new file mode 100644 index 000000000..eab468920 --- /dev/null +++ b/purenessscopeserver/example-Module/FtpTest/FtpTest.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/FtpTest_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/FtpTest_DirView.cpp.o ../../../Build/Linux/Linux_Bin/Temp/FtpTest_FtpTest.cpp.o diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.vcproj b/purenessscopeserver/example-Module/FtpTest/FtpTest.vcproj deleted file mode 100644 index 34d1252a0..000000000 --- a/purenessscopeserver/example-Module/FtpTest/FtpTest.vcproj +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.vcxproj b/purenessscopeserver/example-Module/FtpTest/FtpTest.vcxproj index 7404f7334..c786c025c 100644 --- a/purenessscopeserver/example-Module/FtpTest/FtpTest.vcxproj +++ b/purenessscopeserver/example-Module/FtpTest/FtpTest.vcxproj @@ -1,253 +1,165 @@ - - + + Debug Win32 - - Debug - x64 - Release Win32 + + Debug + x64 + Release x64 + + + + + + + + + - {6D1726BE-FECA-1BAD-2246-CB560000002E} - FtpTest + 15.0 + {7E908FD1-461A-4BAE-8065-1C3D8A0E84E8} Win32Proj + FtpTest + 10.0.17763.0 - - DynamicLibrary - v140 - NotSet - DynamicLibrary - v140 - NotSet + true + v141 + Unicode - + DynamicLibrary - v140 - NotSet + false + v141 + true + Unicode DynamicLibrary - v140 - NotSet + true + v141 + Unicode + + + DynamicLibrary + false + v141 + true + Unicode - + + + - + - + - + - - <_ProjectFileVersion>11.0.50727.1 + + false + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ - ..\..\PurenessScopeServer\Windows_Bin\ - Debug\FtpTest\I386\ true - - ..\..\PurenessScopeServer\Windows_Bin\ - Release\FtpTest\I386\ - false - - ..\..\PurenessScopeServer\Windows_Bin\ - Debug\FtpTest\AMD64\ true - - ..\..\PurenessScopeServer\Windows_Bin\ - Release\FtpTest\AMD64\ + false - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - + - Disabled - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true + NotUsing Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) + MaxSpeed + true + true + true + TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + true + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true Windows - .\\FtpTestd.lib - MachineX86 + true + true + true + .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) + ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - + - MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true + Use Level3 - 4355;%(DisableSpecificWarnings) + Disabled + true + WIN32;_DEBUG;FTPTEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)FtpTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false Windows - true - true - .\\FtpTest.lib - MachineX86 + true - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - Disabled - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true + Use Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) + Disabled + true + _DEBUG;FTPTEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)FtpTestd.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true Windows - .\\FtpTestd.lib - MachineX64 + true - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - + - MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true + Use Level3 - 4355;%(DisableSpecificWarnings) + MaxSpeed + true + true + true + WIN32;NDEBUG;FTPTEST_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)FtpTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false Windows - true true - .\\FtpTest.lib - MachineX64 + true + true - - - - - - - - - - - - true - true - true - true - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.vcxproj.filters b/purenessscopeserver/example-Module/FtpTest/FtpTest.vcxproj.filters index f67913c16..9f0486d55 100644 --- a/purenessscopeserver/example-Module/FtpTest/FtpTest.vcxproj.filters +++ b/purenessscopeserver/example-Module/FtpTest/FtpTest.vcxproj.filters @@ -1,47 +1,36 @@  - - {0e224752-b985-4e7d-a134-b05835d6a0cf} - cpp;cxx;cc;c;C + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - {0fc735d3-a470-4399-8965-0b4ae1d579e0} - h;hpp;hxx;hh + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;ipp;xsd - - {b129afd6-7c1a-4a8e-bd43-f207a0b3569c} - mpc;mpb;mwc - - - {23dc0464-18c0-42d3-84fd-243a3e31b7d3} + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - Source Files + + 源文件 - - Source Files + + 源文件 - - Source Files + + 源文件 - - Header Files + + 头文件 - - Header Files + + 头文件 - - - Build Files - - - Documentation - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/FtpTest/BaseCommand.cpp b/purenessscopeserver/example-Module/FtpTest/FtpTest/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/FtpTest/BaseCommand.cpp rename to purenessscopeserver/example-Module/FtpTest/FtpTest/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/FtpTest/BaseCommand.h b/purenessscopeserver/example-Module/FtpTest/FtpTest/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/FtpTest/BaseCommand.h rename to purenessscopeserver/example-Module/FtpTest/FtpTest/BaseCommand.h diff --git a/purenessscopeserver/example-Module/FtpTest/DirView.cpp b/purenessscopeserver/example-Module/FtpTest/FtpTest/DirView.cpp similarity index 100% rename from purenessscopeserver/example-Module/FtpTest/DirView.cpp rename to purenessscopeserver/example-Module/FtpTest/FtpTest/DirView.cpp diff --git a/purenessscopeserver/example-Module/FtpTest/DirView.h b/purenessscopeserver/example-Module/FtpTest/FtpTest/DirView.h similarity index 100% rename from purenessscopeserver/example-Module/FtpTest/DirView.h rename to purenessscopeserver/example-Module/FtpTest/FtpTest/DirView.h diff --git a/purenessscopeserver/example-Module/FtpTest/FtpTest.cpp b/purenessscopeserver/example-Module/FtpTest/FtpTest/FtpTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/FtpTest/FtpTest.cpp rename to purenessscopeserver/example-Module/FtpTest/FtpTest/FtpTest.cpp diff --git a/purenessscopeserver/example-Module/FtpTest/Makefile b/purenessscopeserver/example-Module/FtpTest/Makefile index 42a88ea94..9f0246b47 100644 --- a/purenessscopeserver/example-Module/FtpTest/Makefile +++ b/purenessscopeserver/example-Module/FtpTest/Makefile @@ -1,26 +1,128 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=FtpTest +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/FtpTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="FtpTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o FtpTest.o DirView.o -LIB_BASE_OBJS = BaseCommand.o FtpTest.o DirView.o -LIB_BASE = libFtpTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/FtpTest_DirView.cpp$(ObjectSuffix) $(IntermediateDirectory)/FtpTest_FtpTest.cpp$(ObjectSuffix) -all: libFtpTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/FtpTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(ObjectSuffix): ./FtpTest/BaseCommand.cpp $(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./FtpTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(DependSuffix): ./FtpTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(DependSuffix) -MM ./FtpTest/BaseCommand.cpp + +$(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(PreprocessSuffix): ./FtpTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/FtpTest_BaseCommand.cpp$(PreprocessSuffix) ./FtpTest/BaseCommand.cpp + +$(IntermediateDirectory)/FtpTest_DirView.cpp$(ObjectSuffix): ./FtpTest/DirView.cpp $(IntermediateDirectory)/FtpTest_DirView.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./FtpTest/DirView.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/FtpTest_DirView.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/FtpTest_DirView.cpp$(DependSuffix): ./FtpTest/DirView.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/FtpTest_DirView.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/FtpTest_DirView.cpp$(DependSuffix) -MM ./FtpTest/DirView.cpp + +$(IntermediateDirectory)/FtpTest_DirView.cpp$(PreprocessSuffix): ./FtpTest/DirView.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/FtpTest_DirView.cpp$(PreprocessSuffix) ./FtpTest/DirView.cpp + +$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(ObjectSuffix): ./FtpTest/FtpTest.cpp $(IntermediateDirectory)/FtpTest_FtpTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./FtpTest/FtpTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(DependSuffix): ./FtpTest/FtpTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(DependSuffix) -MM ./FtpTest/FtpTest.cpp + +$(IntermediateDirectory)/FtpTest_FtpTest.cpp$(PreprocessSuffix): ./FtpTest/FtpTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/FtpTest_FtpTest.cpp$(PreprocessSuffix) ./FtpTest/FtpTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libFtpTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/FtpTest/Makefile.define b/purenessscopeserver/example-Module/FtpTest/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/FtpTest/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/FtpTest/runlinuxmake.sh b/purenessscopeserver/example-Module/FtpTest/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/FtpTest/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/FtpTest/zzz.bat b/purenessscopeserver/example-Module/FtpTest/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/FtpTest/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/Http/CMakeLists.txt b/purenessscopeserver/example-Module/Http/CMakeLists.txt new file mode 100644 index 000000000..3cc69bfeb --- /dev/null +++ b/purenessscopeserver/example-Module/Http/CMakeLists.txt @@ -0,0 +1,84 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(Http) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_Http_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LDebug ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./Http/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./Http/HttpTest.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(Http SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(Http ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/Http/Http.mk b/purenessscopeserver/example-Module/Http/Http.mk new file mode 100644 index 000000000..bfd910155 --- /dev/null +++ b/purenessscopeserver/example-Module/Http/Http.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=Http +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Http +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="Http.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Http_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Http_HttpTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/Http" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Http_BaseCommand.cpp$(ObjectSuffix): ./Http/BaseCommand.cpp $(IntermediateDirectory)/Http_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Http/Http/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Http_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Http_BaseCommand.cpp$(DependSuffix): ./Http/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Http_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Http_BaseCommand.cpp$(DependSuffix) -MM ./Http/BaseCommand.cpp + +$(IntermediateDirectory)/Http_BaseCommand.cpp$(PreprocessSuffix): ./Http/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Http_BaseCommand.cpp$(PreprocessSuffix) ./Http/BaseCommand.cpp + +$(IntermediateDirectory)/Http_HttpTest.cpp$(ObjectSuffix): ./Http/HttpTest.cpp $(IntermediateDirectory)/Http_HttpTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Http/Http/HttpTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Http_HttpTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Http_HttpTest.cpp$(DependSuffix): ./Http/HttpTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Http_HttpTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Http_HttpTest.cpp$(DependSuffix) -MM ./Http/HttpTest.cpp + +$(IntermediateDirectory)/Http_HttpTest.cpp$(PreprocessSuffix): ./Http/HttpTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Http_HttpTest.cpp$(PreprocessSuffix) ./Http/HttpTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/Http/Http.project b/purenessscopeserver/example-Module/Http/Http.project new file mode 100644 index 000000000..49dd912f1 --- /dev/null +++ b/purenessscopeserver/example-Module/Http/Http.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/Http/Http.sln b/purenessscopeserver/example-Module/Http/Http.sln deleted file mode 100644 index 438ca3409..000000000 --- a/purenessscopeserver/example-Module/Http/Http.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HttpTest", "HttpTest.vcxproj", "{263726BE-FECA-1BAD-2242-79560000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {263726BE-FECA-1BAD-2242-79560000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {263726BE-FECA-1BAD-2242-79560000002E}.Debug|Win32.Build.0 = Debug|Win32 - {263726BE-FECA-1BAD-2242-79560000002E}.Debug|x64.ActiveCfg = Debug|x64 - {263726BE-FECA-1BAD-2242-79560000002E}.Debug|x64.Build.0 = Debug|x64 - {263726BE-FECA-1BAD-2242-79560000002E}.Release|Win32.ActiveCfg = Release|Win32 - {263726BE-FECA-1BAD-2242-79560000002E}.Release|Win32.Build.0 = Release|Win32 - {263726BE-FECA-1BAD-2242-79560000002E}.Release|x64.ActiveCfg = Release|x64 - {263726BE-FECA-1BAD-2242-79560000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/Http/Http.txt b/purenessscopeserver/example-Module/Http/Http.txt new file mode 100644 index 000000000..59b234dc8 --- /dev/null +++ b/purenessscopeserver/example-Module/Http/Http.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/Http_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/Http_HttpTest.cpp.o diff --git a/purenessscopeserver/example-Module/Http/BaseCommand.cpp b/purenessscopeserver/example-Module/Http/Http/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/Http/BaseCommand.cpp rename to purenessscopeserver/example-Module/Http/Http/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/Http/BaseCommand.h b/purenessscopeserver/example-Module/Http/Http/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/Http/BaseCommand.h rename to purenessscopeserver/example-Module/Http/Http/BaseCommand.h diff --git a/purenessscopeserver/example-Module/Http/HttpTest.cpp b/purenessscopeserver/example-Module/Http/Http/HttpTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/Http/HttpTest.cpp rename to purenessscopeserver/example-Module/Http/Http/HttpTest.cpp diff --git a/purenessscopeserver/example-Module/Http/HttpTest.cbp b/purenessscopeserver/example-Module/Http/HttpTest.cbp new file mode 100644 index 000000000..cf4bf883e --- /dev/null +++ b/purenessscopeserver/example-Module/Http/HttpTest.cbp @@ -0,0 +1,47 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/Http/HttpTest.depend b/purenessscopeserver/example-Module/Http/HttpTest.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/Http/HttpTest.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/Http/HttpTest.exp b/purenessscopeserver/example-Module/Http/HttpTest.exp new file mode 100644 index 000000000..b34eeb510 Binary files /dev/null and b/purenessscopeserver/example-Module/Http/HttpTest.exp differ diff --git a/purenessscopeserver/example-Module/Http/HttpTest.layout b/purenessscopeserver/example-Module/Http/HttpTest.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/Http/HttpTest.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/Http/HttpTest.lib b/purenessscopeserver/example-Module/Http/HttpTest.lib new file mode 100644 index 000000000..d17c8cfdc Binary files /dev/null and b/purenessscopeserver/example-Module/Http/HttpTest.lib differ diff --git a/purenessscopeserver/example-Module/Http/HttpTest.mpc b/purenessscopeserver/example-Module/Http/HttpTest.mpc deleted file mode 100644 index 6324b2a83..000000000 --- a/purenessscopeserver/example-Module/Http/HttpTest.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(HttpTest):acelib{ - sharedname=HttpTest - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/Http/HttpTest.vcproj b/purenessscopeserver/example-Module/Http/HttpTest.vcproj deleted file mode 100644 index 9f68d6108..000000000 --- a/purenessscopeserver/example-Module/Http/HttpTest.vcproj +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/Http/HttpTest.vcxproj b/purenessscopeserver/example-Module/Http/HttpTest.vcxproj index 0f1b32850..09fffc03c 100644 --- a/purenessscopeserver/example-Module/Http/HttpTest.vcxproj +++ b/purenessscopeserver/example-Module/Http/HttpTest.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -22,26 +22,27 @@ {263726BE-FECA-1BAD-2242-79560000002E} HttpTest Win32Proj + 10.0.17763.0 DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet @@ -64,7 +65,7 @@ <_ProjectFileVersion>11.0.50727.1 - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\HttpTest\I386\ true @@ -74,13 +75,13 @@ false - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\HttpTest\AMD64\ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\HttpTest\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -197,7 +198,7 @@ MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -224,19 +225,11 @@ - - - - - + + - - true - true - true - true - + diff --git a/purenessscopeserver/example-Module/Http/HttpTest.vcxproj.filters b/purenessscopeserver/example-Module/Http/HttpTest.vcxproj.filters index 53bf3efa1..818efeaa8 100644 --- a/purenessscopeserver/example-Module/Http/HttpTest.vcxproj.filters +++ b/purenessscopeserver/example-Module/Http/HttpTest.vcxproj.filters @@ -15,21 +15,16 @@ - + Source Files - + Source Files - + Header Files - - - Build Files - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Http/Makefile b/purenessscopeserver/example-Module/Http/Makefile index 771a10c0b..0d7d3bdbf 100644 --- a/purenessscopeserver/example-Module/Http/Makefile +++ b/purenessscopeserver/example-Module/Http/Makefile @@ -1,26 +1,120 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=Http +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/Http +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="Http.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o HttpTest.o -LIB_BASE_OBJS = BaseCommand.o HttpTest.o -LIB_BASE = libHttpTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Http_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Http_HttpTest.cpp$(ObjectSuffix) -all: libHttpTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/Http" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Http_BaseCommand.cpp$(ObjectSuffix): ./Http/BaseCommand.cpp $(IntermediateDirectory)/Http_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Http/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Http_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Http_BaseCommand.cpp$(DependSuffix): ./Http/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Http_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Http_BaseCommand.cpp$(DependSuffix) -MM ./Http/BaseCommand.cpp + +$(IntermediateDirectory)/Http_BaseCommand.cpp$(PreprocessSuffix): ./Http/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Http_BaseCommand.cpp$(PreprocessSuffix) ./Http/BaseCommand.cpp + +$(IntermediateDirectory)/Http_HttpTest.cpp$(ObjectSuffix): ./Http/HttpTest.cpp $(IntermediateDirectory)/Http_HttpTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Http/HttpTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Http_HttpTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Http_HttpTest.cpp$(DependSuffix): ./Http/HttpTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Http_HttpTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Http_HttpTest.cpp$(DependSuffix) -MM ./Http/HttpTest.cpp + +$(IntermediateDirectory)/Http_HttpTest.cpp$(PreprocessSuffix): ./Http/HttpTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Http_HttpTest.cpp$(PreprocessSuffix) ./Http/HttpTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libHttpTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/Http/Makefile.define b/purenessscopeserver/example-Module/Http/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/Http/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Http/runlinuxmake.sh b/purenessscopeserver/example-Module/Http/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/Http/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Http/zzz.bat b/purenessscopeserver/example-Module/Http/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/Http/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/KafkaClient/CMakeLists.txt b/purenessscopeserver/example-Module/KafkaClient/CMakeLists.txt new file mode 100644 index 000000000..590f839dd --- /dev/null +++ b/purenessscopeserver/example-Module/KafkaClient/CMakeLists.txt @@ -0,0 +1,90 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(KafkaClient) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_KafkaClient_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + /usr/local/include/librdkafka + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./KafkaClient/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./KafkaClient/kafkaTest.cpp + ${CMAKE_CURRENT_LIST_DIR}/./KafkaClient/KafkaClient.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(KafkaClient SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(KafkaClient ${LINK_OPTIONS}) + +target_link_libraries(KafkaClient + /usr/local/lib/librdkafka++.a +) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/KafkaClient/KafkaClient.cbp b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.cbp new file mode 100644 index 000000000..e82284705 --- /dev/null +++ b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.cbp @@ -0,0 +1,42 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/KafkaClient/KafkaClient.depend b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/KafkaClient/KafkaClient.layout b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.layout new file mode 100644 index 000000000..c065e6839 --- /dev/null +++ b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.layout @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/KafkaClient/KafkaClient.mk b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.mk new file mode 100644 index 000000000..31da32583 --- /dev/null +++ b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.mk @@ -0,0 +1,128 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=KafkaClient +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/KafkaClient +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="KafkaClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)/usr/local/include/librdkafka +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)rdkafka++ +ArLibs := "librdkafka++.a" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(ObjectSuffix) $(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/KafkaClient" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(ObjectSuffix): ./KafkaClient/BaseCommand.cpp $(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/KafkaClient/KafkaClient/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(DependSuffix): ./KafkaClient/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(DependSuffix) -MM ./KafkaClient/BaseCommand.cpp + +$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(PreprocessSuffix): ./KafkaClient/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(PreprocessSuffix) ./KafkaClient/BaseCommand.cpp + +$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(ObjectSuffix): ./KafkaClient/kafkaTest.cpp $(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/KafkaClient/KafkaClient/kafkaTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(DependSuffix): ./KafkaClient/kafkaTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(DependSuffix) -MM ./KafkaClient/kafkaTest.cpp + +$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(PreprocessSuffix): ./KafkaClient/kafkaTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(PreprocessSuffix) ./KafkaClient/kafkaTest.cpp + +$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(ObjectSuffix): ./KafkaClient/KafkaClient.cpp $(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/KafkaClient/KafkaClient/KafkaClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(DependSuffix): ./KafkaClient/KafkaClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(DependSuffix) -MM ./KafkaClient/KafkaClient.cpp + +$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(PreprocessSuffix): ./KafkaClient/KafkaClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(PreprocessSuffix) ./KafkaClient/KafkaClient.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/KafkaClient/KafkaClient.project b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.project new file mode 100644 index 000000000..8c9a4a815 --- /dev/null +++ b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.project @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/KafkaClient/KafkaClient.txt b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.txt new file mode 100644 index 000000000..1c76e5c7b --- /dev/null +++ b/purenessscopeserver/example-Module/KafkaClient/KafkaClient.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/KafkaClient_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/KafkaClient_kafkaTest.cpp.o ../../../Build/Linux/Linux_Bin/Temp/KafkaClient_KafkaClient.cpp.o diff --git a/purenessscopeserver/example-Module/KafkaClient/BaseCommand.cpp b/purenessscopeserver/example-Module/KafkaClient/KafkaClient/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/KafkaClient/BaseCommand.cpp rename to purenessscopeserver/example-Module/KafkaClient/KafkaClient/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/KafkaClient/BaseCommand.h b/purenessscopeserver/example-Module/KafkaClient/KafkaClient/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/KafkaClient/BaseCommand.h rename to purenessscopeserver/example-Module/KafkaClient/KafkaClient/BaseCommand.h diff --git a/purenessscopeserver/example-Module/KafkaClient/KafkaClient.cpp b/purenessscopeserver/example-Module/KafkaClient/KafkaClient/KafkaClient.cpp similarity index 100% rename from purenessscopeserver/example-Module/KafkaClient/KafkaClient.cpp rename to purenessscopeserver/example-Module/KafkaClient/KafkaClient/KafkaClient.cpp diff --git a/purenessscopeserver/example-Module/KafkaClient/KafkaClient.h b/purenessscopeserver/example-Module/KafkaClient/KafkaClient/KafkaClient.h similarity index 100% rename from purenessscopeserver/example-Module/KafkaClient/KafkaClient.h rename to purenessscopeserver/example-Module/KafkaClient/KafkaClient/KafkaClient.h diff --git a/purenessscopeserver/example-Module/KafkaClient/kafkaTest.cpp b/purenessscopeserver/example-Module/KafkaClient/KafkaClient/kafkaTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/KafkaClient/kafkaTest.cpp rename to purenessscopeserver/example-Module/KafkaClient/KafkaClient/kafkaTest.cpp diff --git a/purenessscopeserver/example-Module/KafkaClient/Makefile b/purenessscopeserver/example-Module/KafkaClient/Makefile new file mode 100644 index 000000000..b220cc336 --- /dev/null +++ b/purenessscopeserver/example-Module/KafkaClient/Makefile @@ -0,0 +1,128 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=KafkaClient +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/KafkaClient +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="KafkaClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)/usr/local/include/librdkafka +IncludePCH := +RcIncludePath := +Libs := $(LibrarySwitch)rdkafka++ +ArLibs := "librdkafka++.a" +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)/usr/local/lib/ + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(ObjectSuffix) $(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/KafkaClient" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(ObjectSuffix): ./KafkaClient/BaseCommand.cpp $(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./KafkaClient/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(DependSuffix): ./KafkaClient/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(DependSuffix) -MM ./KafkaClient/BaseCommand.cpp + +$(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(PreprocessSuffix): ./KafkaClient/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/KafkaClient_BaseCommand.cpp$(PreprocessSuffix) ./KafkaClient/BaseCommand.cpp + +$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(ObjectSuffix): ./KafkaClient/kafkaTest.cpp $(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./KafkaClient/kafkaTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(DependSuffix): ./KafkaClient/kafkaTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(DependSuffix) -MM ./KafkaClient/kafkaTest.cpp + +$(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(PreprocessSuffix): ./KafkaClient/kafkaTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/KafkaClient_kafkaTest.cpp$(PreprocessSuffix) ./KafkaClient/kafkaTest.cpp + +$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(ObjectSuffix): ./KafkaClient/KafkaClient.cpp $(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./KafkaClient/KafkaClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(DependSuffix): ./KafkaClient/KafkaClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(DependSuffix) -MM ./KafkaClient/KafkaClient.cpp + +$(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(PreprocessSuffix): ./KafkaClient/KafkaClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/KafkaClient_KafkaClient.cpp$(PreprocessSuffix) ./KafkaClient/KafkaClient.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/KafkaClient/kafkaTest.mpc b/purenessscopeserver/example-Module/KafkaClient/kafkaTest.mpc deleted file mode 100644 index 90fde714b..000000000 --- a/purenessscopeserver/example-Module/KafkaClient/kafkaTest.mpc +++ /dev/null @@ -1,28 +0,0 @@ -project(KafkaTest):acelib{ - sharedname=KafkaTest - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common - includes += /usr/local/include/librdkafka - libs += rdkafka - libpaths += /usr/local/lib -} diff --git a/purenessscopeserver/example-Module/KafkaClient/runlinuxmake.sh b/purenessscopeserver/example-Module/KafkaClient/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/KafkaClient/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/KafkaClient/zzz.bat b/purenessscopeserver/example-Module/KafkaClient/zzz.bat deleted file mode 100644 index 68ea973f6..000000000 --- a/purenessscopeserver/example-Module/KafkaClient/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc11 diff --git a/purenessscopeserver/example-Module/LGLogic/BaseCommand.cpp b/purenessscopeserver/example-Module/LGLogic/BaseCommand.cpp deleted file mode 100644 index c30ed54eb..000000000 --- a/purenessscopeserver/example-Module/LGLogic/BaseCommand.cpp +++ /dev/null @@ -1,289 +0,0 @@ -#include "BaseCommand.h" - -CBaseCommand::CBaseCommand(void) -{ - m_pServerObject = NULL; - m_nCount = 0; - - m_szLSIP[0] = '\0'; - m_u4LSPort = 0; - m_u4LSServerID = 0; -} - -CBaseCommand::~CBaseCommand(void) -{ -} - -void CBaseCommand::SetServerObject(CServerObject* pServerObject) -{ - m_pServerObject = pServerObject; -} - -int CBaseCommand::DoMessage(IMessage* pMessage, bool& bDeleteFlag) -{ - //__ENTER_FUNCTIONԶĺ׷tryĺ꣬ڲ׽ʹ__THROW_FUNCTION()׳Ĵ - //__THROW_FUNCTION("hello"); ԶLogļµassert.log¼ļ - //Ƽʹ꣬סһҪںĽʹ__LEAVE_FUNCTION__LEAVE_FUNCTION_WITHRETURN֮ԡ - //__LEAVE_FUNCTION_WITHRETURN__LEAVE_FUNCTIONͬǰ߿ֺ֧˳ʱ򷵻һ - //Ƿһint - //ôĩβ__LEAVE_FUNCTION_WITHRETURN(0); 0ǷصintȻҲֱ֧ͱ忴Լĺ - //καʹ__LEAVE_FUNCTIONɡ - __ENTER_FUNCTION(); - - if(m_pServerObject == NULL) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] m_pServerObject is NULL(%d).\n", bDeleteFlag)); - return -1; - } - - if(pMessage == NULL) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pMessage is NULL.\n")); - return -1; - } - - //ӽϢ - MESSAGE_FUNCTION_BEGIN(pMessage->GetMessageBase()->m_u2Cmd); - MESSAGE_FUNCTION(CLIENT_LINK_CONNECT, Do_Connect, pMessage); - MESSAGE_FUNCTION(CLIENT_LINK_CDISCONNET, Do_DisConnect, pMessage); - MESSAGE_FUNCTION(CLINET_LINK_SENDTIMEOUT, Do_ClientSendTimeout, pMessage); - MESSAGE_FUNCTION(COMMAND_LOGIC_CLIENAT_LOGIN, Do_Logic_Client_Login, pMessage); - MESSAGE_FUNCTION_END; - - return 0; - - __LEAVE_FUNCTION_WITHRETURN(0); -} - -int CBaseCommand::Do_Connect(IMessage* pMessage) -{ - OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_Connect] (%d)TCP CLIENT_LINK_CONNECT OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); - - //жϵǰǷԽ2000 - int nConnectCount = m_pServerObject->GetConnectManager()->GetCount(); - - if(nConnectCount > 2000) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_Connect]connect count is more(%d).\n", nConnectCount)); - } - - return 0; -} - -int CBaseCommand::Do_DisConnect(IMessage* pMessage) -{ - //ӶϿ¼ - OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_DisConnect](%d)CLIENT_LINK_CDISCONNET OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); - - return 0; -} - -int CBaseCommand::Do_ClientSendTimeout(IMessage* pMessage) -{ - //Ϳͻӳֵ¼ - OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_DisConnect](%d)CLINET_LINK_SNEDTIMEOUT OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); - - return 0; -} - -int CBaseCommand::Do_Logic_Client_Login(IMessage* pMessage) -{ - IBuffPacket* pBodyPacket = m_pServerObject->GetPacketManager()->Create(); - - if(NULL == pBodyPacket) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pBodyPacket is NULL.\n")); - return -1; - } - - _PacketInfo BodyPacket; - pMessage->GetPacketBody(BodyPacket); - - pBodyPacket->WriteStream(BodyPacket.m_pData, BodyPacket.m_nDataLen); - - _VCHARS_STR strUserName; - _VCHARS_STR strUserPass; - _VCHARS_STR strLSKey; - - (*pBodyPacket) >> strUserName; - (*pBodyPacket) >> strUserPass; - (*pBodyPacket) >> strLSKey; - - m_pServerObject->GetPacketManager()->Delete(pBodyPacket); - - uint8 u1Type = 0; //1ҪȥLSб0Ҫ - - if(ACE_OS::strcmp(strLSKey.text, m_objLSServer.Get_LS_Key()) != 0) - { - u1Type = 1; - } - - //Ϳͻ - IBuffPacket* pResponsesPacket = m_pServerObject->GetPacketManager()->Create(); - uint16 u2PostCommandID = COMMAND_LOGIC_CLIENAT_LOGIN_R; - - //ݱIJ - pResponsesPacket->SetNetSort(true); - - uint32 u4UserID = 0; - _VCHARS_STR strServerCode; - - //ƴӷMD5 - uint8 u1Len = (uint8)ACE_OS::strlen( m_objLSServer.Get_LS_Key()); - strServerCode.SetData( m_objLSServer.Get_LS_Key(), u1Len); - - uint32 u4ListCount = 0; - IBuffPacket* pListPacket = NULL; - - //ƴб - if(u1Type == 1) - { - pListPacket = m_pServerObject->GetPacketManager()->Create(); - pListPacket->SetNetSort(true); - m_objLSServer.Get_All_LG_List(pListPacket, u4ListCount); - } - - //Ϣб - uint32 u4SendPacketLen = 0; - - if(u1Type == 1) - { - u4SendPacketLen = sizeof(uint32) + sizeof(uint8) + - sizeof(uint8) + ACE_OS::strlen( m_objLSServer.Get_LS_Key()) + 1 - + sizeof(uint32) + pListPacket->GetPacketLen(); - } - else - { - u4SendPacketLen = sizeof(uint32) + sizeof(uint8) + - sizeof(uint8) + ACE_OS::strlen( m_objLSServer.Get_LS_Key()) + 1; - } - - //ݰͷ - _PacketInfo HeadPacket; - pMessage->GetPacketHead(HeadPacket); - - IBuffPacket* pHeadPacket = m_pServerObject->GetPacketManager()->Create(); - pHeadPacket->WriteStream(HeadPacket.m_pData, HeadPacket.m_nDataLen); - - uint16 u2CommandID = 0; // - uint32 u2Version = 0; //Э汾 - uint32 u4BodyLen = 0; //峤 - char szSession[33] = {'\0'}; //Sessionַ - - //ͷеݰ - (*pHeadPacket) >> u2Version; - (*pHeadPacket) >> u2CommandID; - (*pHeadPacket) >> u4BodyLen; - pHeadPacket->WriteStream(szSession, 32); - - m_pServerObject->GetPacketManager()->Delete(pHeadPacket); - - (*pResponsesPacket) << u2Version; - (*pResponsesPacket) << u2PostCommandID; - (*pResponsesPacket) << u4SendPacketLen; //ݰ峤 - pResponsesPacket->WriteStream(szSession, 32); - - (*pResponsesPacket) << u4UserID; - (*pResponsesPacket) << u1Type; - (*pResponsesPacket) << strServerCode; - - //ҪListбƴ - if(u1Type == 1) - { - (*pResponsesPacket) << u4ListCount; - pResponsesPacket->WriteStream(pListPacket->GetData(), pListPacket->GetPacketLen()); - m_pServerObject->GetPacketManager()->Delete(pListPacket); - } - - if(NULL != m_pServerObject->GetConnectManager()) - { - //ȫ - m_pServerObject->GetConnectManager()->PostMessage(pMessage->GetMessageBase()->m_u4ConnectID, - pResponsesPacket, - SENDMESSAGE_JAMPNOMAL, - u2PostCommandID, - PACKET_SEND_IMMEDIATLY, - PACKET_IS_FRAMEWORK_RECYC); - } - else - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage] m_pConnectManager = NULL")); - m_pServerObject->GetPacketManager()->Delete(pResponsesPacket); - } - - //m_pServerObject->GetConnectManager()->CloseConnect(pMessage->GetMessageBase()->m_u4ConnectID); - - return 0; -} - -void CBaseCommand::Init(const char* pFileName) -{ - ReadIniFile(pFileName); - - //m_objLSServer.Init(1, "127.0.0.1", 10080, m_pServerObject); - m_objLSServer.Init(1, m_szLSIP, m_u4LSPort, m_pServerObject); - - vecControlInfo objControlInfo; - m_pServerObject->GetControlListen()->ShowListen(objControlInfo); - - //ԶõǰŵIPͶ˿ڣȻ¼͸ԶLS - m_objLSServer.Set_LG_Info(objControlInfo[0].m_szListenIP, - objControlInfo[0].m_u4Port, - (uint32)m_pServerObject->GetControlListen()->GetServerID()); - m_objLSServer.Connect(); - - ActiveTimer* pTimer = m_pServerObject->GetTimerManager(); - m_u4TimeID = (uint32)pTimer->schedule(this, NULL, ACE_OS::gettimeofday() + ACE_Time_Value(MAX_TIMER_INTERVAL), ACE_Time_Value(MAX_TIMER_INTERVAL)); -} - -int CBaseCommand::handle_timeout( const ACE_Time_Value& tv, const void* arg ) -{ - if(arg != NULL) - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::handle_timeout]tv.sec=%d!\n", tv.sec())); - } - - //ʱʱִ - OUR_DEBUG((LM_INFO, "[CBaseCommand::handle_timeout]Run!\n")); - m_objLSServer.Send_LG_Alive(); - return 0; -} - -void CBaseCommand::ReadIniFile(const char* pIniFileName) -{ - dictionary* pDictionary = NULL; - pDictionary = iniparser_load(pIniFileName); - - if(NULL == pDictionary) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::ReadIniFile](%s)Read Ini fail.\n", pIniFileName)); - return; - } - else - { - //ȡIniļ - m_u4LSServerID = (uint32)iniparser_getint(pDictionary, "LSServer:ServerID", 0); - - if(0 != m_u4LSServerID) - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::ReadIniFile]ServerID=%d.\n", m_u4LSServerID)); - } - - char* pData = iniparser_getstring(pDictionary, "LSServer:IP", NULL); - - if(NULL != pData) - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::ReadIniFile]IP=%s.\n", pData)); - sprintf_safe(m_szLSIP, 50, "%s", pData); - } - - m_u4LSPort = (uint32)iniparser_getint(pDictionary, "LSServer:Port", 0); - - if(0 != m_u4LSPort) - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::ReadIniFile]Port=%d.\n", m_u4LSPort)); - } - - iniparser_freedict(pDictionary); - } -} diff --git a/purenessscopeserver/example-Module/LGLogic/CMakeLists.txt b/purenessscopeserver/example-Module/LGLogic/CMakeLists.txt new file mode 100644 index 000000000..82cbcbc97 --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/CMakeLists.txt @@ -0,0 +1,86 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(LGLogic) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_LGLogic_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LDebug ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./LGLogic/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./LGLogic/LGLogic.cpp + ${CMAKE_CURRENT_LIST_DIR}/./LGLogic/LSServerManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/./LGLogic/ListManager.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(LGLogic SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(LGLogic ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.cbp b/purenessscopeserver/example-Module/LGLogic/LGLogic.cbp new file mode 100644 index 000000000..e1b91f4a7 --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic.cbp @@ -0,0 +1,58 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.depend b/purenessscopeserver/example-Module/LGLogic/LGLogic.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.exp b/purenessscopeserver/example-Module/LGLogic/LGLogic.exp new file mode 100644 index 000000000..85cf019e1 Binary files /dev/null and b/purenessscopeserver/example-Module/LGLogic/LGLogic.exp differ diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.layout b/purenessscopeserver/example-Module/LGLogic/LGLogic.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.lib b/purenessscopeserver/example-Module/LGLogic/LGLogic.lib new file mode 100644 index 000000000..ab011d306 Binary files /dev/null and b/purenessscopeserver/example-Module/LGLogic/LGLogic.lib differ diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.mk b/purenessscopeserver/example-Module/LGLogic/LGLogic.mk new file mode 100644 index 000000000..22caa9c74 --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic.mk @@ -0,0 +1,136 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LGLogic +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LGLogic +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LGLogic.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/LGLogic_LGLogic.cpp$(ObjectSuffix) $(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/LGLogic_ListManager.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/LGLogic" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(ObjectSuffix): ./LGLogic/BaseCommand.cpp $(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LGLogic/LGLogic/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(DependSuffix): ./LGLogic/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(DependSuffix) -MM ./LGLogic/BaseCommand.cpp + +$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(PreprocessSuffix): ./LGLogic/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(PreprocessSuffix) ./LGLogic/BaseCommand.cpp + +$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(ObjectSuffix): ./LGLogic/LGLogic.cpp $(IntermediateDirectory)/LGLogic_LGLogic.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LGLogic/LGLogic/LGLogic.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(DependSuffix): ./LGLogic/LGLogic.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(DependSuffix) -MM ./LGLogic/LGLogic.cpp + +$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(PreprocessSuffix): ./LGLogic/LGLogic.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LGLogic_LGLogic.cpp$(PreprocessSuffix) ./LGLogic/LGLogic.cpp + +$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(ObjectSuffix): ./LGLogic/LSServerManager.cpp $(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LGLogic/LGLogic/LSServerManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(DependSuffix): ./LGLogic/LSServerManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(DependSuffix) -MM ./LGLogic/LSServerManager.cpp + +$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(PreprocessSuffix): ./LGLogic/LSServerManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(PreprocessSuffix) ./LGLogic/LSServerManager.cpp + +$(IntermediateDirectory)/LGLogic_ListManager.cpp$(ObjectSuffix): ./LGLogic/ListManager.cpp $(IntermediateDirectory)/LGLogic_ListManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LGLogic/LGLogic/ListManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LGLogic_ListManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LGLogic_ListManager.cpp$(DependSuffix): ./LGLogic/ListManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LGLogic_ListManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LGLogic_ListManager.cpp$(DependSuffix) -MM ./LGLogic/ListManager.cpp + +$(IntermediateDirectory)/LGLogic_ListManager.cpp$(PreprocessSuffix): ./LGLogic/ListManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LGLogic_ListManager.cpp$(PreprocessSuffix) ./LGLogic/ListManager.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.mpc b/purenessscopeserver/example-Module/LGLogic/LGLogic.mpc deleted file mode 100644 index 97e96dcac..000000000 --- a/purenessscopeserver/example-Module/LGLogic/LGLogic.mpc +++ /dev/null @@ -1,26 +0,0 @@ -project(LGLogic):acelib{ - sharedname=LGLogic - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - ./IniRead/*.c - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common ./IniRead -} diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.project b/purenessscopeserver/example-Module/LGLogic/LGLogic.project new file mode 100644 index 000000000..740d59bd0 --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic.project @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.sln b/purenessscopeserver/example-Module/LGLogic/LGLogic.sln deleted file mode 100644 index 37d1f1a66..000000000 --- a/purenessscopeserver/example-Module/LGLogic/LGLogic.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LGLogic", "LGLogic.vcxproj", "{1D87DD85-FECA-1BAD-91F1-C2590000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1D87DD85-FECA-1BAD-91F1-C2590000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {1D87DD85-FECA-1BAD-91F1-C2590000002E}.Debug|Win32.Build.0 = Debug|Win32 - {1D87DD85-FECA-1BAD-91F1-C2590000002E}.Debug|x64.ActiveCfg = Debug|x64 - {1D87DD85-FECA-1BAD-91F1-C2590000002E}.Debug|x64.Build.0 = Debug|x64 - {1D87DD85-FECA-1BAD-91F1-C2590000002E}.Release|Win32.ActiveCfg = Release|Win32 - {1D87DD85-FECA-1BAD-91F1-C2590000002E}.Release|Win32.Build.0 = Release|Win32 - {1D87DD85-FECA-1BAD-91F1-C2590000002E}.Release|x64.ActiveCfg = Release|x64 - {1D87DD85-FECA-1BAD-91F1-C2590000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.txt b/purenessscopeserver/example-Module/LGLogic/LGLogic.txt new file mode 100644 index 000000000..256ea37ed --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/LGLogic_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/LGLogic_LGLogic.cpp.o ../../../Build/Linux/Linux_Bin/Temp/LGLogic_LSServerManager.cpp.o ../../../Build/Linux/Linux_Bin/Temp/LGLogic_ListManager.cpp.o diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.vcproj b/purenessscopeserver/example-Module/LGLogic/LGLogic.vcproj deleted file mode 100644 index 657d63439..000000000 --- a/purenessscopeserver/example-Module/LGLogic/LGLogic.vcproj +++ /dev/null @@ -1,456 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.vcxproj b/purenessscopeserver/example-Module/LGLogic/LGLogic.vcxproj index acc74bfbe..03d3eb71f 100644 --- a/purenessscopeserver/example-Module/LGLogic/LGLogic.vcxproj +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic.vcxproj @@ -1,5 +1,5 @@ - - + + Debug @@ -18,30 +18,46 @@ x64 + + + + + + + + + + + + + + + {1D87DD85-FECA-1BAD-91F1-C2590000002E} LGLogic Win32Proj + 10.0.17763.0 DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet @@ -61,27 +77,39 @@ - <_ProjectFileVersion>11.0.50727.1 + <_ProjectFileVersion>15.0.28127.55 ..\..\PurenessScopeServer\Windows_Bin\ Debug\LGLogic\I386\ true + MinimumRecommendedRules.ruleset + + ..\..\PurenessScopeServer\Windows_Bin\ Release\LGLogic\I386\ false + MinimumRecommendedRules.ruleset + + ..\..\PurenessScopeServer\Windows_Bin\ Debug\LGLogic\AMD64\ true + MinimumRecommendedRules.ruleset + + - ..\..\PurenessScopeServer\Windows_Bin\ - Release\LGLogic\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false + MinimumRecommendedRules.ruleset + + @@ -109,7 +137,7 @@ ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) + $(OutDir)LGLogicd.dll true .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) true @@ -197,7 +225,7 @@ MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);LGLogic\IniRead\;%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -223,29 +251,6 @@ MachineX64 - - - - - - - - - - - - - - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.vcxproj.filters b/purenessscopeserver/example-Module/LGLogic/LGLogic.vcxproj.filters index 8cbfec488..4ca309bc0 100644 --- a/purenessscopeserver/example-Module/LGLogic/LGLogic.vcxproj.filters +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic.vcxproj.filters @@ -2,58 +2,56 @@ - {be4a353b-864b-4c78-a5d6-81417c877b8c} + {c3207d70-4331-4c63-af78-e26a5943da31} cpp;cxx;cc;c;C - {932fe134-0564-4af4-bc78-43580d6831f5} + {1c94c99f-f18b-41fa-b748-66dbc91cc8f8} h;hpp;hxx;hh - {07d1efe8-5afe-4a1b-8154-69ed6b228f1a} + {e758c90c-2a34-4f86-948d-b5b5baf09ddc} mpc;mpb;mwc + + {d57c00b4-b1e7-4ac1-908b-cde11bc465a5} + - + Source Files - + Source Files - + Source Files - + Source Files - - Source Files + + IniRead - - Source Files + + IniRead - + Header Files - + Header Files - + Header Files - - Header Files + + IniRead - - Header Files + + IniRead - - - Build Files - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic/BaseCommand.cpp b/purenessscopeserver/example-Module/LGLogic/LGLogic/BaseCommand.cpp new file mode 100644 index 000000000..3c54f8e22 --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic/BaseCommand.cpp @@ -0,0 +1,290 @@ +#include "BaseCommand.h" + +CBaseCommand::CBaseCommand(void) +{ + m_pServerObject = NULL; + m_nCount = 0; + + m_szLSIP[0] = '\0'; + m_u4LSPort = 0; + m_u4LSServerID = 0; +} + +CBaseCommand::~CBaseCommand(void) +{ +} + +void CBaseCommand::SetServerObject(CServerObject* pServerObject) +{ + m_pServerObject = pServerObject; +} + +int CBaseCommand::DoMessage(IMessage* pMessage, bool& bDeleteFlag) +{ + //__ENTER_FUNCTIONԶĺ׷tryĺ꣬ڲ׽ʹ__THROW_FUNCTION()׳Ĵ + //__THROW_FUNCTION("hello"); ԶLogļµassert.log¼ļ + //Ƽʹ꣬סһҪںĽʹ__LEAVE_FUNCTION__LEAVE_FUNCTION_WITHRETURN֮ԡ + //__LEAVE_FUNCTION_WITHRETURN__LEAVE_FUNCTIONͬǰ߿ֺ֧˳ʱ򷵻һ + //Ƿһint + //ôĩβ__LEAVE_FUNCTION_WITHRETURN(0); 0ǷصintȻҲֱ֧ͱ忴Լĺ + //καʹ__LEAVE_FUNCTIONɡ + __ENTER_FUNCTION(); + + if(m_pServerObject == NULL) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] m_pServerObject is NULL(%d).\n", bDeleteFlag)); + return -1; + } + + if(pMessage == NULL) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pMessage is NULL.\n")); + return -1; + } + + //ӽϢ + MESSAGE_FUNCTION_BEGIN(pMessage->GetMessageBase()->m_u2Cmd); + MESSAGE_FUNCTION(CLIENT_LINK_CONNECT, Do_Connect, pMessage); + MESSAGE_FUNCTION(CLIENT_LINK_CDISCONNET, Do_DisConnect, pMessage); + MESSAGE_FUNCTION(CLINET_LINK_SENDTIMEOUT, Do_ClientSendTimeout, pMessage); + MESSAGE_FUNCTION(COMMAND_LOGIC_CLIENAT_LOGIN, Do_Logic_Client_Login, pMessage); + MESSAGE_FUNCTION_END; + + return 0; + + __LEAVE_FUNCTION_WITHRETURN(0); +} + +int CBaseCommand::Do_Connect(IMessage* pMessage) +{ + OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_Connect] (%d)TCP CLIENT_LINK_CONNECT OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); + + //жϵǰǷԽ2000 + int nConnectCount = m_pServerObject->GetConnectManager()->GetCount(); + + if(nConnectCount > 2000) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_Connect]connect count is more(%d).\n", nConnectCount)); + } + + return 0; +} + +int CBaseCommand::Do_DisConnect(IMessage* pMessage) +{ + //ӶϿ¼ + OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_DisConnect](%d)CLIENT_LINK_CDISCONNET OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); + + return 0; +} + +int CBaseCommand::Do_ClientSendTimeout(IMessage* pMessage) +{ + //Ϳͻӳֵ¼ + OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_DisConnect](%d)CLINET_LINK_SNEDTIMEOUT OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); + + return 0; +} + +int CBaseCommand::Do_Logic_Client_Login(IMessage* pMessage) +{ + IBuffPacket* pBodyPacket = m_pServerObject->GetPacketManager()->Create(); + + if(NULL == pBodyPacket) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pBodyPacket is NULL.\n")); + return -1; + } + + _PacketInfo BodyPacket; + pMessage->GetPacketBody(BodyPacket); + + pBodyPacket->WriteStream(BodyPacket.m_pData, BodyPacket.m_nDataLen); + + _VCHARS_STR strUserName; + _VCHARS_STR strUserPass; + _VCHARS_STR strLSKey; + + (*pBodyPacket) >> strUserName; + (*pBodyPacket) >> strUserPass; + (*pBodyPacket) >> strLSKey; + + m_pServerObject->GetPacketManager()->Delete(pBodyPacket); + + uint8 u1Type = 0; //1ҪȥLSб0Ҫ + + if(ACE_OS::strcmp(strLSKey.text, m_objLSServer.Get_LS_Key()) != 0) + { + u1Type = 1; + } + + //Ϳͻ + IBuffPacket* pResponsesPacket = m_pServerObject->GetPacketManager()->Create(); + uint16 u2PostCommandID = COMMAND_LOGIC_CLIENAT_LOGIN_R; + + //ݱIJ + pResponsesPacket->SetNetSort(true); + + uint32 u4UserID = 0; + _VCHARS_STR strServerCode; + + //ƴӷMD5 + uint8 u1Len = (uint8)ACE_OS::strlen( m_objLSServer.Get_LS_Key()); + strServerCode.SetData( m_objLSServer.Get_LS_Key(), u1Len); + + uint32 u4ListCount = 0; + IBuffPacket* pListPacket = NULL; + + //ƴб + if(u1Type == 1) + { + pListPacket = m_pServerObject->GetPacketManager()->Create(); + pListPacket->SetNetSort(true); + m_objLSServer.Get_All_LG_List(pListPacket, u4ListCount); + } + + //Ϣб + uint32 u4SendPacketLen = 0; + + if(u1Type == 1) + { + u4SendPacketLen = sizeof(uint32) + sizeof(uint8) + + sizeof(uint8) + ACE_OS::strlen( m_objLSServer.Get_LS_Key()) + 1 + + sizeof(uint32) + pListPacket->GetPacketLen(); + } + else + { + u4SendPacketLen = sizeof(uint32) + sizeof(uint8) + + sizeof(uint8) + ACE_OS::strlen( m_objLSServer.Get_LS_Key()) + 1; + } + + //ݰͷ + _PacketInfo HeadPacket; + pMessage->GetPacketHead(HeadPacket); + + IBuffPacket* pHeadPacket = m_pServerObject->GetPacketManager()->Create(); + pHeadPacket->WriteStream(HeadPacket.m_pData, HeadPacket.m_nDataLen); + + uint16 u2CommandID = 0; // + uint32 u2Version = 0; //Э汾 + uint32 u4BodyLen = 0; //峤 + char szSession[33] = {'\0'}; //Sessionַ + + //ͷеݰ + (*pHeadPacket) >> u2Version; + (*pHeadPacket) >> u2CommandID; + (*pHeadPacket) >> u4BodyLen; + pHeadPacket->WriteStream(szSession, 32); + + m_pServerObject->GetPacketManager()->Delete(pHeadPacket); + + (*pResponsesPacket) << u2Version; + (*pResponsesPacket) << u2PostCommandID; + (*pResponsesPacket) << u4SendPacketLen; //ݰ峤 + pResponsesPacket->WriteStream(szSession, 32); + + (*pResponsesPacket) << u4UserID; + (*pResponsesPacket) << u1Type; + (*pResponsesPacket) << strServerCode; + + //ҪListбƴ + if(u1Type == 1) + { + (*pResponsesPacket) << u4ListCount; + pResponsesPacket->WriteStream(pListPacket->GetData(), pListPacket->GetPacketLen()); + m_pServerObject->GetPacketManager()->Delete(pListPacket); + } + + if(NULL != m_pServerObject->GetConnectManager()) + { + //ȫ + m_pServerObject->GetConnectManager()->PostMessage(pMessage->GetMessageBase()->m_u4ConnectID, + pResponsesPacket, + SENDMESSAGE_JAMPNOMAL, + u2PostCommandID, + PACKET_SEND_IMMEDIATLY, + PACKET_IS_FRAMEWORK_RECYC); + } + else + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage] m_pConnectManager = NULL")); + m_pServerObject->GetPacketManager()->Delete(pResponsesPacket); + } + + //m_pServerObject->GetConnectManager()->CloseConnect(pMessage->GetMessageBase()->m_u4ConnectID); + + return 0; +} + +void CBaseCommand::Init(const char* pFileName) +{ + ReadIniFile(pFileName); + + //m_objLSServer.Init(1, "127.0.0.1", 10080, m_pServerObject); + m_objLSServer.Init(1, m_szLSIP, m_u4LSPort, m_pServerObject); + + vecControlInfo objControlInfo; + m_pServerObject->GetControlListen()->ShowListen(0,objControlInfo[0]); + //virtual bool ShowListen(uint32 u4Index, _ControlInfo& objControlInfo) = 0; //Ѵ򿪵ļ˿Ϣ + + //ԶõǰŵIPͶ˿ڣȻ¼͸ԶLS + m_objLSServer.Set_LG_Info(objControlInfo[0].m_szListenIP, + objControlInfo[0].m_u4Port, + (uint32)m_pServerObject->GetControlListen()->GetServerID()); + m_objLSServer.Connect(); + + ActiveTimer* pTimer = m_pServerObject->GetTimerManager(); + m_u4TimeID = (uint32)pTimer->schedule(this, NULL, ACE_OS::gettimeofday() + ACE_Time_Value(MAX_TIMER_INTERVAL), ACE_Time_Value(MAX_TIMER_INTERVAL)); +} + +int CBaseCommand::handle_timeout( const ACE_Time_Value& tv, const void* arg ) +{ + if(arg != NULL) + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::handle_timeout]tv.sec=%d!\n", tv.sec())); + } + + //ʱʱִ + OUR_DEBUG((LM_INFO, "[CBaseCommand::handle_timeout]Run!\n")); + m_objLSServer.Send_LG_Alive(); + return 0; +} + +void CBaseCommand::ReadIniFile(const char* pIniFileName) +{ + dictionary* pDictionary = NULL; + pDictionary = iniparser_load(pIniFileName); + + if(NULL == pDictionary) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::ReadIniFile](%s)Read Ini fail.\n", pIniFileName)); + return; + } + else + { + //ȡIniļ + m_u4LSServerID = (uint32)iniparser_getint(pDictionary, "LSServer:ServerID", 0); + + if(0 != m_u4LSServerID) + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::ReadIniFile]ServerID=%d.\n", m_u4LSServerID)); + } + + char* pData = (char*)iniparser_getstring(pDictionary, "LSServer:IP", NULL); + + if(NULL != pData) + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::ReadIniFile]IP=%s.\n", pData)); + sprintf_safe(m_szLSIP, 50, "%s", pData); + } + + m_u4LSPort = (uint32)iniparser_getint(pDictionary, "LSServer:Port", 0); + + if(0 != m_u4LSPort) + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::ReadIniFile]Port=%d.\n", m_u4LSPort)); + } + + iniparser_freedict(pDictionary); + } +} diff --git a/purenessscopeserver/example-Module/LGLogic/BaseCommand.h b/purenessscopeserver/example-Module/LGLogic/LGLogic/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/LGLogic/BaseCommand.h rename to purenessscopeserver/example-Module/LGLogic/LGLogic/BaseCommand.h diff --git a/purenessscopeserver/example-Module/LGLogic/IniRead/dictionary.c b/purenessscopeserver/example-Module/LGLogic/LGLogic/IniRead/dictionary.c similarity index 100% rename from purenessscopeserver/example-Module/LGLogic/IniRead/dictionary.c rename to purenessscopeserver/example-Module/LGLogic/LGLogic/IniRead/dictionary.c diff --git a/purenessscopeserver/example-Module/LGLogic/IniRead/dictionary.h b/purenessscopeserver/example-Module/LGLogic/LGLogic/IniRead/dictionary.h similarity index 100% rename from purenessscopeserver/example-Module/LGLogic/IniRead/dictionary.h rename to purenessscopeserver/example-Module/LGLogic/LGLogic/IniRead/dictionary.h diff --git a/purenessscopeserver/example-Module/LGLogic/IniRead/iniparser.c b/purenessscopeserver/example-Module/LGLogic/LGLogic/IniRead/iniparser.c similarity index 100% rename from purenessscopeserver/example-Module/LGLogic/IniRead/iniparser.c rename to purenessscopeserver/example-Module/LGLogic/LGLogic/IniRead/iniparser.c diff --git a/purenessscopeserver/example-Module/LGLogic/IniRead/iniparser.h b/purenessscopeserver/example-Module/LGLogic/LGLogic/IniRead/iniparser.h similarity index 100% rename from purenessscopeserver/example-Module/LGLogic/IniRead/iniparser.h rename to purenessscopeserver/example-Module/LGLogic/LGLogic/IniRead/iniparser.h diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic.cpp b/purenessscopeserver/example-Module/LGLogic/LGLogic/LGLogic.cpp similarity index 100% rename from purenessscopeserver/example-Module/LGLogic/LGLogic.cpp rename to purenessscopeserver/example-Module/LGLogic/LGLogic/LGLogic.cpp diff --git a/purenessscopeserver/example-Module/LGLogic/LSServer.ini b/purenessscopeserver/example-Module/LGLogic/LGLogic/LSServer.ini similarity index 100% rename from purenessscopeserver/example-Module/LGLogic/LSServer.ini rename to purenessscopeserver/example-Module/LGLogic/LGLogic/LSServer.ini diff --git a/purenessscopeserver/example-Module/LGLogic/LSServerManager.cpp b/purenessscopeserver/example-Module/LGLogic/LGLogic/LSServerManager.cpp similarity index 96% rename from purenessscopeserver/example-Module/LGLogic/LSServerManager.cpp rename to purenessscopeserver/example-Module/LGLogic/LGLogic/LSServerManager.cpp index 2c14b8203..54c83461c 100644 --- a/purenessscopeserver/example-Module/LGLogic/LSServerManager.cpp +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic/LSServerManager.cpp @@ -120,7 +120,8 @@ void CLSServerManager::Send_LG_Login() (*pSendPacket) << m_u4LGPort; (*pSendPacket) << strServerCode; - m_pServerObject->GetClientManager()->SendData(m_u4ServerID, pSendPacket->GetData(), pSendPacket->GetPacketLen(), false); + char* SendPacket_Data =(char*)pSendPacket->GetData(); + m_pServerObject->GetClientManager()->SendData(m_u4ServerID, SendPacket_Data, pSendPacket->GetPacketLen(), false); m_pServerObject->GetPacketManager()->Delete(pSendPacket); } @@ -149,7 +150,8 @@ void CLSServerManager::Send_LG_List() strServerCode.SetData(m_objlistManager.Get_MD5_Data(), u1Len); (*pSendPacket) << m_u4LGID; - m_pServerObject->GetClientManager()->SendData(m_u4ServerID, pSendPacket->GetData(), pSendPacket->GetPacketLen(), false); + char* SendPacket_Data = (char*)pSendPacket->GetData(); + m_pServerObject->GetClientManager()->SendData(m_u4ServerID, SendPacket_Data, pSendPacket->GetPacketLen(), false); m_pServerObject->GetPacketManager()->Delete(pSendPacket); } @@ -185,7 +187,8 @@ void CLSServerManager::Send_LG_Alive() strServerCode.SetData(m_objlistManager.Get_MD5_Data(), u1Len); (*pSendPacket) << m_u4LGID; - m_pServerObject->GetClientManager()->SendData(m_u4ServerID, pSendPacket->GetData(), pSendPacket->GetPacketLen(), false); + char* SendPacket_Data = (char*)pSendPacket->GetData(); + m_pServerObject->GetClientManager()->SendData(m_u4ServerID, SendPacket_Data, pSendPacket->GetPacketLen(), false); m_pServerObject->GetPacketManager()->Delete(pSendPacket); } @@ -313,7 +316,7 @@ bool CLSServerManager::Send_Format_data(char* pData, uint32 u4Len, IMessageBlock return false; } -bool CLSServerManager::Recv_Format_data(ACE_Message_Block* mbRecv, IMessageBlockManager* pMessageBlockManager, uint16& u2CommandID, ACE_Message_Block*& mbFinishRecv) +bool CLSServerManager::Recv_Format_data(ACE_Message_Block* mbRecv, IMessageBlockManager* pMessageBlockManager, uint16& u2CommandID, ACE_Message_Block*& mbFinishRecv, EM_PACKET_ROUTE& emPacketRoute) { if(m_u4RecvBuffLength + mbRecv->length() < 40 || mbRecv->length() >= RECV_BUFF_SIZE) { diff --git a/purenessscopeserver/example-Module/LGLogic/LSServerManager.h b/purenessscopeserver/example-Module/LGLogic/LGLogic/LSServerManager.h similarity index 92% rename from purenessscopeserver/example-Module/LGLogic/LSServerManager.h rename to purenessscopeserver/example-Module/LGLogic/LGLogic/LSServerManager.h index 135d9480f..6af27f25a 100644 --- a/purenessscopeserver/example-Module/LGLogic/LSServerManager.h +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic/LSServerManager.h @@ -10,12 +10,12 @@ #define SERVER_PROTOCAL_VERSION 100 //ͨѶЭ汾 -#define COMMAND_LOGIC_LG_LOGIN 0x2000 //LGע -#define COMMAND_LOGIC_ALIVE 0x2001 //LG -#define COMMAND_LOGIC_LG_LIST 0x2002 //LGõǰб +#define COMMAND_LOGIC_LG_LOGIN 0x2000 //LGע +#define COMMAND_LOGIC_ALIVE 0x2001 //LG +#define COMMAND_LOGIC_LG_LIST 0x2002 //LGõǰб #define COMMAND_LOGIC_LG_LOGIN_R 0xe000 //LGעӦ #define COMMAND_LOGIC_LG_KEY_R 0xe001 //LG·бkey -#define COMMAND_LOGIC_LG_LIST_R 0xe002 //LG·бϢ +#define COMMAND_LOGIC_LG_LIST_R 0xe002 //LG·бϢ #define SESSION_KEY "LogicSever" //ݰSession KEY @@ -29,7 +29,7 @@ class CLSServerManager : public IClientMessage bool Send_Format_data(char* pData, uint32 u4Len, IMessageBlockManager* pMessageBlockManager, ACE_Message_Block*& mbSend); - bool Recv_Format_data(ACE_Message_Block* mbRecv, IMessageBlockManager* pMessageBlockManager, uint16& u2CommandID, ACE_Message_Block*& mbFinishRecv); + bool Recv_Format_data(ACE_Message_Block* mbRecv, IMessageBlockManager* pMessageBlockManager, uint16& u2CommandID, ACE_Message_Block*& mbFinishRecv, EM_PACKET_ROUTE& emPacketRoute); void Init(uint32 u4ServerID, const char* pIP, uint32 u4Port, CServerObject* pServerObject); diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogic/ListManager.cpp b/purenessscopeserver/example-Module/LGLogic/LGLogic/ListManager.cpp new file mode 100644 index 000000000..4c6ee2c4d --- /dev/null +++ b/purenessscopeserver/example-Module/LGLogic/LGLogic/ListManager.cpp @@ -0,0 +1,222 @@ +#include "ListManager.h" + +ClistManager::ClistManager() +{ + sprintf_safe(m_szMD5, 33, "%s", LG_LIST_MD5); +} + +ClistManager::~ClistManager() +{ + +} + +void ClistManager::Add_LG_Info(uint32 u4ConnectID, uint32 u4LGID, const char* pIP, uint32 u4Port) +{ + ACE_Guard WGuard(m_ThreadLock); + + _LG_Info* pInfo = Get_LG_Info_By_LGID(u4LGID); + + if(NULL == pInfo) + { + _LG_Info objNewInfo; + objNewInfo.m_u4ConnectID = u4ConnectID; + objNewInfo.m_u4LGID = u4LGID; + objNewInfo.m_u4Port = u4Port; + sprintf_safe(objNewInfo.m_szIP, 50, "%s", pIP); + m_vecLGInfo.push_back(objNewInfo); + } + else + { + pInfo->m_u4ConnectID = u4ConnectID; + pInfo->m_u4LGID = u4LGID; + pInfo->m_u4Port = u4Port; + sprintf_safe(pInfo->m_szIP, 50, "%s", pIP); + } +} + +_LG_Info* ClistManager::Get_LG_Info_By_LGID(uint32 u4LGID) +{ + ACE_Guard WGuard(m_ThreadLock); + + for(uint32 u4Index = 0; u4Index < (uint32)m_vecLGInfo.size(); u4Index++) + { + if(m_vecLGInfo[u4Index].m_u4LGID == u4LGID) + { + return &m_vecLGInfo[u4Index]; + } + } + + return NULL; +} + +_LG_Info* ClistManager::Get_LG_Info_By_ConnectID(uint32 u4ConnectID) +{ + ACE_Guard WGuard(m_ThreadLock); + + for(uint32 u4Index = 0; u4Index < (uint32)m_vecLGInfo.size(); u4Index++) + { + if(m_vecLGInfo[u4Index].m_u4ConnectID == u4ConnectID) + { + return &m_vecLGInfo[u4Index]; + } + } + + return NULL; +} + +_LG_Info* ClistManager::Get_LG_Info_By_Index(uint32 u4Index) +{ + ACE_Guard WGuard(m_ThreadLock); + + if(u4Index >= (uint32)m_vecLGInfo.size()) + { + return NULL; + } + else + { + return &m_vecLGInfo[u4Index]; + } +} + +void ClistManager::Del_LG_Info_By_ConnectID(uint32 u4ConnectID) +{ + ACE_Guard WGuard(m_ThreadLock); + + for(vecLGInfo::iterator b = m_vecLGInfo.begin(); b != m_vecLGInfo.end(); b++) + { + if(b->m_u4ConnectID == u4ConnectID) + { + m_vecLGInfo.erase(b); + return; + } + } +} + +uint32 ClistManager::Get_LG_Count() +{ + ACE_Guard WGuard(m_ThreadLock); + + return (uint32)m_vecLGInfo.size(); +} + +void ClistManager::Get_All_LG_List(IBuffPacket* pbpList, uint32& u4Count) +{ + ACE_Guard WGuard(m_ThreadLock); + + if(pbpList == NULL) + { + return; + } + + u4Count = Get_LG_Count(); + + for(uint32 i = 0; i < u4Count; i++) + { + _LG_Info* pInfo = Get_LG_Info_By_Index(i); + _VCHARS_STR strIP; + uint8 u1Len = (uint8)strlen(pInfo->m_szIP); + strIP.SetData(pInfo->m_szIP, u1Len); + + (*pbpList) << pInfo->m_u4LGID; + (*pbpList) << strIP; + (*pbpList) << pInfo->m_u4Port; + } +} + +char* ClistManager::Get_MD5_Data() +{ + ACE_Guard WGuard(m_ThreadLock); + + return (char* )m_szMD5; +} + +void ClistManager::Set_MD5_Data(const char* pMD5) +{ + ACE_Guard WGuard(m_ThreadLock); + + sprintf_safe(m_szMD5, 33, "%s", pMD5); +} + +void ClistManager::Clear() +{ + ACE_Guard WGuard(m_ThreadLock); + + m_vecLGInfo.clear(); + sprintf_safe(m_szMD5, 33, "%s", LG_LIST_MD5); +} + +void ClistManager::SaveList() +{ + //ǰбϢ洢ļ + FILE* pFile = fopen(LS_LIST_FILENAME, "w+"); + + if(NULL == pFile) + { + OUR_DEBUG((LM_ERROR, "[ClistManager::SaveList](%s)Write Ini fail.\n", LS_LIST_FILENAME)); + return; + } + + char szTemp[200] = {'\0'}; + sprintf_safe(szTemp, 200, "[List]\nMD5=%s\nCount=%d\n", + Get_MD5_Data(), + Get_LG_Count()); + fwrite(szTemp, sizeof(char), strlen(szTemp), pFile); + + for(uint32 i = 0; i < Get_LG_Count(); i++) + { + sprintf_safe(szTemp, 200, "LGID%d=%d\nLGIP%d=%s\nLGPort%d=%d", + i, + m_vecLGInfo[i].m_u4LGID, + i, + m_vecLGInfo[i].m_szIP, + i, + m_vecLGInfo[i].m_u4Port); + fwrite(szTemp, sizeof(char), strlen(szTemp), pFile); + } + + fclose(pFile); +} + +void ClistManager::ReadList() +{ + //Ӵ洢ļлԭListбϢ + Clear(); + + dictionary* pDictionary = NULL; + pDictionary = iniparser_load(LS_LIST_FILENAME); + + if(NULL == pDictionary) + { + OUR_DEBUG((LM_ERROR, "[ClistManager::ReadList](%s)Read Ini fail.\n", LS_LIST_FILENAME)); + return; + } + + char* pData = (char*)iniparser_getstring(pDictionary, "List:MD5", NULL); + + if(NULL != pData) + { + sprintf_safe(m_szMD5, 33, "%s", pData); + } + + uint32 u4Count = (uint32)iniparser_getint(pDictionary, "List:Count", 0); + + char szIP[50] = {'\0'}; + uint32 u4Port = 0; + uint32 u4LGID = 0; + + char szTempName[50] = {'\0'}; + + for(uint32 i = 0; i < u4Count; i++) + { + sprintf_safe(szTempName, 50, "List:LGID%d", i); + u4LGID = (uint32)iniparser_getint(pDictionary, szTempName, 0); + sprintf_safe(szTempName, 50, "List:LGIP%d", i); + pData = (char*)iniparser_getstring(pDictionary, szTempName, NULL); + { + sprintf_safe(szIP, 50, "%s", pData); + } + sprintf_safe(szTempName, 50, "List:LGPort%d", i); + u4Port = (uint32)iniparser_getint(pDictionary, szTempName, 0);; + Add_LG_Info(0, u4LGID, szIP, u4Port); + } +} diff --git a/purenessscopeserver/example-Module/LGLogic/ListManager.h b/purenessscopeserver/example-Module/LGLogic/LGLogic/ListManager.h similarity index 100% rename from purenessscopeserver/example-Module/LGLogic/ListManager.h rename to purenessscopeserver/example-Module/LGLogic/LGLogic/ListManager.h diff --git a/purenessscopeserver/example-Module/LGLogic/LGLogicd.exp b/purenessscopeserver/example-Module/LGLogic/LGLogicd.exp deleted file mode 100644 index ba5f7fb50..000000000 Binary files a/purenessscopeserver/example-Module/LGLogic/LGLogicd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/LGLogic/ListManager.cpp b/purenessscopeserver/example-Module/LGLogic/ListManager.cpp deleted file mode 100644 index ac78a3173..000000000 --- a/purenessscopeserver/example-Module/LGLogic/ListManager.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include "ListManager.h" - -ClistManager::ClistManager() -{ - sprintf_safe(m_szMD5, 33, "%s", LG_LIST_MD5); -} - -ClistManager::~ClistManager() -{ - -} - -void ClistManager::Add_LG_Info(uint32 u4ConnectID, uint32 u4LGID, const char* pIP, uint32 u4Port) -{ - ACE_Guard WGuard(m_ThreadLock); - - _LG_Info* pInfo = Get_LG_Info_By_LGID(u4LGID); - - if(NULL == pInfo) - { - _LG_Info objNewInfo; - objNewInfo.m_u4ConnectID = u4ConnectID; - objNewInfo.m_u4LGID = u4LGID; - objNewInfo.m_u4Port = u4Port; - sprintf_safe(objNewInfo.m_szIP, 50, "%s", pIP); - m_vecLGInfo.push_back(objNewInfo); - } - else - { - pInfo->m_u4ConnectID = u4ConnectID; - pInfo->m_u4LGID = u4LGID; - pInfo->m_u4Port = u4Port; - sprintf_safe(pInfo->m_szIP, 50, "%s", pIP); - } -} - -_LG_Info* ClistManager::Get_LG_Info_By_LGID(uint32 u4LGID) -{ - ACE_Guard WGuard(m_ThreadLock); - - for(uint32 u4Index = 0; u4Index < (uint32)m_vecLGInfo.size(); u4Index++) - { - if(m_vecLGInfo[u4Index].m_u4LGID == u4LGID) - { - return &m_vecLGInfo[u4Index]; - } - } - - return NULL; -} - -_LG_Info* ClistManager::Get_LG_Info_By_ConnectID(uint32 u4ConnectID) -{ - ACE_Guard WGuard(m_ThreadLock); - - for(uint32 u4Index = 0; u4Index < (uint32)m_vecLGInfo.size(); u4Index++) - { - if(m_vecLGInfo[u4Index].m_u4ConnectID == u4ConnectID) - { - return &m_vecLGInfo[u4Index]; - } - } - - return NULL; -} - -_LG_Info* ClistManager::Get_LG_Info_By_Index(uint32 u4Index) -{ - ACE_Guard WGuard(m_ThreadLock); - - if(u4Index >= (uint32)m_vecLGInfo.size()) - { - return NULL; - } - else - { - return &m_vecLGInfo[u4Index]; - } -} - -void ClistManager::Del_LG_Info_By_ConnectID(uint32 u4ConnectID) -{ - ACE_Guard WGuard(m_ThreadLock); - - for(vecLGInfo::iterator b = m_vecLGInfo.begin(); b != m_vecLGInfo.end(); b++) - { - if(b->m_u4ConnectID == u4ConnectID) - { - m_vecLGInfo.erase(b); - return; - } - } -} - -uint32 ClistManager::Get_LG_Count() -{ - ACE_Guard WGuard(m_ThreadLock); - - return (uint32)m_vecLGInfo.size(); -} - -void ClistManager::Get_All_LG_List(IBuffPacket* pbpList, uint32& u4Count) -{ - ACE_Guard WGuard(m_ThreadLock); - - if(pbpList == NULL) - { - return; - } - - u4Count = Get_LG_Count(); - - for(uint32 i = 0; i < u4Count; i++) - { - _LG_Info* pInfo = Get_LG_Info_By_Index(i); - _VCHARS_STR strIP; - uint8 u1Len = (uint8)strlen(pInfo->m_szIP); - strIP.SetData(pInfo->m_szIP, u1Len); - - (*pbpList) << pInfo->m_u4LGID; - (*pbpList) << strIP; - (*pbpList) << pInfo->m_u4Port; - } -} - -char* ClistManager::Get_MD5_Data() -{ - ACE_Guard WGuard(m_ThreadLock); - - return (char* )m_szMD5; -} - -void ClistManager::Set_MD5_Data(const char* pMD5) -{ - ACE_Guard WGuard(m_ThreadLock); - - sprintf_safe(m_szMD5, 33, "%s", pMD5); -} - -void ClistManager::Clear() -{ - ACE_Guard WGuard(m_ThreadLock); - - m_vecLGInfo.clear(); - sprintf_safe(m_szMD5, 33, "%s", LG_LIST_MD5); -} - -void ClistManager::SaveList() -{ - //ǰбϢ洢ļ - FILE* pFile = fopen(LS_LIST_FILENAME, "w+"); - - if(NULL == pFile) - { - OUR_DEBUG((LM_ERROR, "[ClistManager::SaveList](%s)Write Ini fail.\n", LS_LIST_FILENAME)); - return; - } - - char szTemp[200] = {'\0'}; - sprintf_safe(szTemp, 200, "[List]\nMD5=%s\nCount=%d\n", - Get_MD5_Data(), - Get_LG_Count()); - fwrite(szTemp, sizeof(char), strlen(szTemp), pFile); - - for(uint32 i = 0; i < Get_LG_Count(); i++) - { - sprintf_safe(szTemp, 200, "LGID%d=%d\nLGIP%d=%s\nLGPort%d=%d", - i, - m_vecLGInfo[i].m_u4LGID, - i, - m_vecLGInfo[i].m_szIP, - i, - m_vecLGInfo[i].m_u4Port); - fwrite(szTemp, sizeof(char), strlen(szTemp), pFile); - } - - fclose(pFile); -} - -void ClistManager::ReadList() -{ - //Ӵ洢ļлԭListбϢ - Clear(); - - dictionary* pDictionary = NULL; - pDictionary = iniparser_load(LS_LIST_FILENAME); - - if(NULL == pDictionary) - { - OUR_DEBUG((LM_ERROR, "[ClistManager::ReadList](%s)Read Ini fail.\n", LS_LIST_FILENAME)); - return; - } - - char* pData = iniparser_getstring(pDictionary, "List:MD5", NULL); - - if(NULL != pData) - { - sprintf_safe(m_szMD5, 33, "%s", pData); - } - - uint32 u4Count = (uint32)iniparser_getint(pDictionary, "List:Count", 0); - - char szIP[50] = {'\0'}; - uint32 u4Port = 0; - uint32 u4LGID = 0; - - char szTempName[50] = {'\0'}; - - for(uint32 i = 0; i < u4Count; i++) - { - sprintf_safe(szTempName, 50, "List:LGID%d", i); - u4LGID = (uint32)iniparser_getint(pDictionary, szTempName, 0); - sprintf_safe(szTempName, 50, "List:LGIP%d", i); - pData = iniparser_getstring(pDictionary, szTempName, NULL); - { - sprintf_safe(szIP, 50, "%s", pData); - } - sprintf_safe(szTempName, 50, "List:LGPort%d", i); - u4Port = (uint32)iniparser_getint(pDictionary, szTempName, 0);; - Add_LG_Info(0, u4LGID, szIP, u4Port); - } -} diff --git a/purenessscopeserver/example-Module/LGLogic/Makefile b/purenessscopeserver/example-Module/LGLogic/Makefile index 196311d15..a8af4724b 100644 --- a/purenessscopeserver/example-Module/LGLogic/Makefile +++ b/purenessscopeserver/example-Module/LGLogic/Makefile @@ -1,26 +1,136 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LGLogic +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/LGLogic +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LGLogic.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o LGLogic.o LSServerManager.o ListManager.o ./IniRead/dictionary.o ./IniRead/iniparser.o -LIB_BASE_OBJS = BaseCommand.o LGLogic.o LSServerManager.o dictionary.o iniparser.o ListManager.o -LIB_BASE = libLGLogic.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/LGLogic_LGLogic.cpp$(ObjectSuffix) $(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/LGLogic_ListManager.cpp$(ObjectSuffix) -all: libLGLogic.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/LGLogic" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(ObjectSuffix): ./LGLogic/BaseCommand.cpp $(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LGLogic/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(DependSuffix): ./LGLogic/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(DependSuffix) -MM ./LGLogic/BaseCommand.cpp + +$(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(PreprocessSuffix): ./LGLogic/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LGLogic_BaseCommand.cpp$(PreprocessSuffix) ./LGLogic/BaseCommand.cpp + +$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(ObjectSuffix): ./LGLogic/LGLogic.cpp $(IntermediateDirectory)/LGLogic_LGLogic.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LGLogic/LGLogic.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(DependSuffix): ./LGLogic/LGLogic.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(DependSuffix) -MM ./LGLogic/LGLogic.cpp + +$(IntermediateDirectory)/LGLogic_LGLogic.cpp$(PreprocessSuffix): ./LGLogic/LGLogic.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LGLogic_LGLogic.cpp$(PreprocessSuffix) ./LGLogic/LGLogic.cpp + +$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(ObjectSuffix): ./LGLogic/LSServerManager.cpp $(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LGLogic/LSServerManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(DependSuffix): ./LGLogic/LSServerManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(DependSuffix) -MM ./LGLogic/LSServerManager.cpp + +$(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(PreprocessSuffix): ./LGLogic/LSServerManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LGLogic_LSServerManager.cpp$(PreprocessSuffix) ./LGLogic/LSServerManager.cpp + +$(IntermediateDirectory)/LGLogic_ListManager.cpp$(ObjectSuffix): ./LGLogic/ListManager.cpp $(IntermediateDirectory)/LGLogic_ListManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LGLogic/ListManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LGLogic_ListManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LGLogic_ListManager.cpp$(DependSuffix): ./LGLogic/ListManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LGLogic_ListManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LGLogic_ListManager.cpp$(DependSuffix) -MM ./LGLogic/ListManager.cpp + +$(IntermediateDirectory)/LGLogic_ListManager.cpp$(PreprocessSuffix): ./LGLogic/ListManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LGLogic_ListManager.cpp$(PreprocessSuffix) ./LGLogic/ListManager.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libLGLogic.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LGLogic/Makefile.define b/purenessscopeserver/example-Module/LGLogic/Makefile.define deleted file mode 100644 index 54deef6cb..000000000 --- a/purenessscopeserver/example-Module/LGLogic/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -I ./IniRead -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LGLogic/runlinuxmake.sh b/purenessscopeserver/example-Module/LGLogic/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/LGLogic/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LGLogic/zzz.bat b/purenessscopeserver/example-Module/LGLogic/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/LGLogic/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/LoginBuffer/CMakeLists.txt b/purenessscopeserver/example-Module/LoginBuffer/CMakeLists.txt new file mode 100644 index 000000000..c8c2a23bf --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/CMakeLists.txt @@ -0,0 +1,85 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(LoginBuffer_Watch) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_LoginBuffer_Watch_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../Common + ./LoginBuffer/Common + ./Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./Watch/Watch.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(LoginBuffer_Watch SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(LoginBuffer_Watch ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login.cbp b/purenessscopeserver/example-Module/LoginBuffer/Login.cbp new file mode 100644 index 000000000..f0e9a5e87 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Login.cbp @@ -0,0 +1,53 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login.depend b/purenessscopeserver/example-Module/LoginBuffer/Login.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Login.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login.exp b/purenessscopeserver/example-Module/LoginBuffer/Login.exp new file mode 100644 index 000000000..d3771e8ee Binary files /dev/null and b/purenessscopeserver/example-Module/LoginBuffer/Login.exp differ diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login.layout b/purenessscopeserver/example-Module/LoginBuffer/Login.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Login.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login.lib b/purenessscopeserver/example-Module/LoginBuffer/Login.lib new file mode 100644 index 000000000..b64486696 Binary files /dev/null and b/purenessscopeserver/example-Module/LoginBuffer/Login.lib differ diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login.project b/purenessscopeserver/example-Module/LoginBuffer/Login.project new file mode 100644 index 000000000..81d657072 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Login.project @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.cpp b/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.cpp index aef6329c7..36ddd7f6c 100644 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.cpp +++ b/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.cpp @@ -171,8 +171,9 @@ void CBaseCommand::Do_User_Login( IMessage* pMessage ) u4Pos += u2UserPassSize; ACE_OS::memcpy(&szPostData[u4Pos], (char* )&pMessage->GetMessageBase()->m_u4ConnectID, sizeof(uint32)); u4Pos += sizeof(uint32); - - if(false == m_pServerObject->GetClientManager()->SendData(1, szPostData, (int)u4SendSize, false)) + + char *PostData =szPostData; + if(false == m_pServerObject->GetClientManager()->SendData(1, PostData, (int)u4SendSize, false)) { u4Ret = LOGIN_FAIL_NOEXIST; } @@ -324,8 +325,9 @@ void CBaseCommand::Do_User_Info( IMessage* pMessage ) u4Pos += sizeof(uint32); ACE_OS::memcpy(&szPostData[u4Pos], (char* )&pMessage->GetMessageBase()->m_u4ConnectID, sizeof(uint32)); u4Pos += sizeof(uint32); - - if(false == m_pServerObject->GetClientManager()->SendData(1, szPostData, (int)u4SendSize, false)) + + char *PostData =szPostData; + if(false == m_pServerObject->GetClientManager()->SendData(1, PostData, (int)u4SendSize, false)) { u4Ret = LOGIN_FAIL_NOEXIST; (*pResponsesPacket) << (uint16)u2PostCommandID; //ƴӦID diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.h b/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.h index d1312e32b..7fd64c253 100644 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.h +++ b/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.h @@ -73,7 +73,7 @@ class CPostServerData : public IClientMessage return false; }; - bool Recv_Format_data(ACE_Message_Block* mbRecv, IMessageBlockManager* pMessageBlockManager, uint16& u2CommandID, ACE_Message_Block*& mbFinishRecv) + bool Recv_Format_data(ACE_Message_Block* mbRecv, IMessageBlockManager* pMessageBlockManager, uint16& u2CommandID, ACE_Message_Block*& mbFinishRecv, EM_PACKET_ROUTE& emPacketRoute) { //жϷݿǷС0 u2CommandID = 0; diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.mpc b/purenessscopeserver/example-Module/LoginBuffer/Login/Login.mpc deleted file mode 100644 index eee32aaeb..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.mpc +++ /dev/null @@ -1,26 +0,0 @@ -project(Login):acelib{ - sharedname=Login - dynamicflags += TEST_TCP_BUILD_LOGIN_DLL - libout = ./ - - Source_Files{ - ./*.cpp - ../Common/*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../../Common ../Common -} diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.sln b/purenessscopeserver/example-Module/LoginBuffer/Login/Login.sln deleted file mode 100644 index edfddbc1b..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Login", "Login.vcxproj", "{C900DD85-FECA-1BAD-91FC-8A290000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C900DD85-FECA-1BAD-91FC-8A290000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {C900DD85-FECA-1BAD-91FC-8A290000002E}.Debug|Win32.Build.0 = Debug|Win32 - {C900DD85-FECA-1BAD-91FC-8A290000002E}.Debug|x64.ActiveCfg = Debug|x64 - {C900DD85-FECA-1BAD-91FC-8A290000002E}.Debug|x64.Build.0 = Debug|x64 - {C900DD85-FECA-1BAD-91FC-8A290000002E}.Release|Win32.ActiveCfg = Release|Win32 - {C900DD85-FECA-1BAD-91FC-8A290000002E}.Release|Win32.Build.0 = Release|Win32 - {C900DD85-FECA-1BAD-91FC-8A290000002E}.Release|x64.ActiveCfg = Release|x64 - {C900DD85-FECA-1BAD-91FC-8A290000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcproj b/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcproj deleted file mode 100644 index aad0a878d..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcproj +++ /dev/null @@ -1,456 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcxproj b/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcxproj deleted file mode 100644 index 3c6f62ba6..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcxproj +++ /dev/null @@ -1,252 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {C900DD85-FECA-1BAD-91FC-8A290000002E} - Login - Win32Proj - - - - DynamicLibrary - v110 - NotSet - - - DynamicLibrary - v110 - NotSet - - - DynamicLibrary - v110 - NotSet - - - DynamicLibrary - v110 - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\Login\I386\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\Login\I386\ - false - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\Login\AMD64\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\Login\AMD64\ - false - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\include;..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_LOGIN_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\Logind.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_LOGIN_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)Login.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\Login.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_LOGIN_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)Logind.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\Logind.lib - MachineX64 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_LOGIN_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)Login.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\Login.lib - MachineX64 - - - - - - - - - - - - - - - - - - - - true - true - true - true - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcxproj.filters b/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcxproj.filters deleted file mode 100644 index cb6e30e7b..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/Login.vcxproj.filters +++ /dev/null @@ -1,59 +0,0 @@ - - - - - {5f9d8efe-9ee9-433e-8728-56e49f978974} - cpp;cxx;cc;c;C - - - {6f6366d3-2bf1-4d52-8b25-01a3390ee359} - h;hpp;hxx;hh - - - {0ccd3747-470b-4039-83b4-d4c8b208d6a1} - mpc;mpb;mwc - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Build Files - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/Logind.exp b/purenessscopeserver/example-Module/LoginBuffer/Login/Logind.exp deleted file mode 100644 index 96017600f..000000000 Binary files a/purenessscopeserver/example-Module/LoginBuffer/Login/Logind.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/Makefile b/purenessscopeserver/example-Module/LoginBuffer/Login/Makefile deleted file mode 100644 index 0b8d1ffa9..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include Makefile.define - -# Ĭϳ -default:all - -# Ӧļб -PATS = BaseCommand.o Login.o ../Common/SMOption.o ../Common/UserValidManager.o ../Common/UserInfoManager.o - -LIB_BASE_OBJS = BaseCommand.o Login.o SMOption.o UserValidManager.o UserInfoManager.o -LIB_BASE = libLogin.so - -all: libLogin.so clear - -# Ӧó -all:$(LIB_BASE) Makefile - -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) - -# -clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libLogin.so ../../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/Makefile.define b/purenessscopeserver/example-Module/LoginBuffer/Login/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/runlinuxmake.sh b/purenessscopeserver/example-Module/LoginBuffer/Login/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LoginBuffer/Login/zzz.bat b/purenessscopeserver/example-Module/LoginBuffer/Login/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Login/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Login.mk b/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Login.mk new file mode 100644 index 000000000..277c9b7e2 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Login.mk @@ -0,0 +1,144 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LoginBuffer_Login +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LoginBuffer +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LoginBuffer_Login.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../Common $(IncludeSwitch)./LoginBuffer/Common $(IncludeSwitch)./Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Login_Login.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_UserValidManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_UserInfoManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Login_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_SMOption.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/LoginBuffer_Login" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Login_Login.cpp$(ObjectSuffix): Login/Login.cpp $(IntermediateDirectory)/Login_Login.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LoginBuffer/Login/Login.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Login_Login.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Login_Login.cpp$(DependSuffix): Login/Login.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Login_Login.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Login_Login.cpp$(DependSuffix) -MM Login/Login.cpp + +$(IntermediateDirectory)/Login_Login.cpp$(PreprocessSuffix): Login/Login.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Login_Login.cpp$(PreprocessSuffix) Login/Login.cpp + +$(IntermediateDirectory)/Common_UserValidManager.cpp$(ObjectSuffix): Common/UserValidManager.cpp $(IntermediateDirectory)/Common_UserValidManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LoginBuffer/Common/UserValidManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_UserValidManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_UserValidManager.cpp$(DependSuffix): Common/UserValidManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_UserValidManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_UserValidManager.cpp$(DependSuffix) -MM Common/UserValidManager.cpp + +$(IntermediateDirectory)/Common_UserValidManager.cpp$(PreprocessSuffix): Common/UserValidManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_UserValidManager.cpp$(PreprocessSuffix) Common/UserValidManager.cpp + +$(IntermediateDirectory)/Common_UserInfoManager.cpp$(ObjectSuffix): Common/UserInfoManager.cpp $(IntermediateDirectory)/Common_UserInfoManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LoginBuffer/Common/UserInfoManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_UserInfoManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_UserInfoManager.cpp$(DependSuffix): Common/UserInfoManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_UserInfoManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_UserInfoManager.cpp$(DependSuffix) -MM Common/UserInfoManager.cpp + +$(IntermediateDirectory)/Common_UserInfoManager.cpp$(PreprocessSuffix): Common/UserInfoManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_UserInfoManager.cpp$(PreprocessSuffix) Common/UserInfoManager.cpp + +$(IntermediateDirectory)/Login_BaseCommand.cpp$(ObjectSuffix): Login/BaseCommand.cpp $(IntermediateDirectory)/Login_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LoginBuffer/Login/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Login_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Login_BaseCommand.cpp$(DependSuffix): Login/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Login_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Login_BaseCommand.cpp$(DependSuffix) -MM Login/BaseCommand.cpp + +$(IntermediateDirectory)/Login_BaseCommand.cpp$(PreprocessSuffix): Login/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Login_BaseCommand.cpp$(PreprocessSuffix) Login/BaseCommand.cpp + +$(IntermediateDirectory)/Common_SMOption.cpp$(ObjectSuffix): Common/SMOption.cpp $(IntermediateDirectory)/Common_SMOption.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LoginBuffer/Common/SMOption.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_SMOption.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_SMOption.cpp$(DependSuffix): Common/SMOption.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_SMOption.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_SMOption.cpp$(DependSuffix) -MM Common/SMOption.cpp + +$(IntermediateDirectory)/Common_SMOption.cpp$(PreprocessSuffix): Common/SMOption.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_SMOption.cpp$(PreprocessSuffix) Common/SMOption.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Login.txt b/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Login.txt new file mode 100644 index 000000000..f93edb369 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Login.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/Login_Login.cpp.o ../../../Build/Linux/Linux_Bin/Temp/Common_UserValidManager.cpp.o ../../../Build/Linux/Linux_Bin/Temp/Common_UserInfoManager.cpp.o ../../../Build/Linux/Linux_Bin/Temp/Login_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/Common_SMOption.cpp.o diff --git a/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Watch.mk b/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Watch.mk new file mode 100644 index 000000000..999533960 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Watch.mk @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LoginBuffer_Watch +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LoginBuffer +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LoginBuffer_Watch.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../Common $(IncludeSwitch)./LoginBuffer/Common $(IncludeSwitch)./Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/LoginBuffer_Watch" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix): ./Watch/Watch.cpp $(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix): ./Watch/Watch.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix) -MM ./Watch/Watch.cpp + +$(IntermediateDirectory)/Watch_Watch.cpp$(PreprocessSuffix): ./Watch/Watch.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Watch_Watch.cpp$(PreprocessSuffix) ./Watch/Watch.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Watch.txt b/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Watch.txt new file mode 100644 index 000000000..a8abb70f2 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/LoginBuffer_Watch.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/Watch_Watch.cpp.o diff --git a/purenessscopeserver/example-Module/LoginBuffer/Makefile_Login b/purenessscopeserver/example-Module/LoginBuffer/Makefile_Login new file mode 100644 index 000000000..b9b3549f4 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Makefile_Login @@ -0,0 +1,144 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LoginBuffer_Login +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/LoginBuffer +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LoginBuffer_Login.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../Common $(IncludeSwitch)./LoginBuffer/Common $(IncludeSwitch)./Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Login_Login.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_UserValidManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_UserInfoManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/Login_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Common_SMOption.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/LoginBuffer_Login" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Login_Login.cpp$(ObjectSuffix): Login/Login.cpp $(IntermediateDirectory)/Login_Login.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Login/Login.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Login_Login.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Login_Login.cpp$(DependSuffix): Login/Login.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Login_Login.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Login_Login.cpp$(DependSuffix) -MM Login/Login.cpp + +$(IntermediateDirectory)/Login_Login.cpp$(PreprocessSuffix): Login/Login.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Login_Login.cpp$(PreprocessSuffix) Login/Login.cpp + +$(IntermediateDirectory)/Common_UserValidManager.cpp$(ObjectSuffix): Common/UserValidManager.cpp $(IntermediateDirectory)/Common_UserValidManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/UserValidManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_UserValidManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_UserValidManager.cpp$(DependSuffix): Common/UserValidManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_UserValidManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_UserValidManager.cpp$(DependSuffix) -MM Common/UserValidManager.cpp + +$(IntermediateDirectory)/Common_UserValidManager.cpp$(PreprocessSuffix): Common/UserValidManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_UserValidManager.cpp$(PreprocessSuffix) Common/UserValidManager.cpp + +$(IntermediateDirectory)/Common_UserInfoManager.cpp$(ObjectSuffix): Common/UserInfoManager.cpp $(IntermediateDirectory)/Common_UserInfoManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/UserInfoManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_UserInfoManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_UserInfoManager.cpp$(DependSuffix): Common/UserInfoManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_UserInfoManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_UserInfoManager.cpp$(DependSuffix) -MM Common/UserInfoManager.cpp + +$(IntermediateDirectory)/Common_UserInfoManager.cpp$(PreprocessSuffix): Common/UserInfoManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_UserInfoManager.cpp$(PreprocessSuffix) Common/UserInfoManager.cpp + +$(IntermediateDirectory)/Login_BaseCommand.cpp$(ObjectSuffix): Login/BaseCommand.cpp $(IntermediateDirectory)/Login_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Login/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Login_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Login_BaseCommand.cpp$(DependSuffix): Login/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Login_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Login_BaseCommand.cpp$(DependSuffix) -MM Login/BaseCommand.cpp + +$(IntermediateDirectory)/Login_BaseCommand.cpp$(PreprocessSuffix): Login/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Login_BaseCommand.cpp$(PreprocessSuffix) Login/BaseCommand.cpp + +$(IntermediateDirectory)/Common_SMOption.cpp$(ObjectSuffix): Common/SMOption.cpp $(IntermediateDirectory)/Common_SMOption.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Common/SMOption.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Common_SMOption.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Common_SMOption.cpp$(DependSuffix): Common/SMOption.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Common_SMOption.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Common_SMOption.cpp$(DependSuffix) -MM Common/SMOption.cpp + +$(IntermediateDirectory)/Common_SMOption.cpp$(PreprocessSuffix): Common/SMOption.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Common_SMOption.cpp$(PreprocessSuffix) Common/SMOption.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Makefile_Watch b/purenessscopeserver/example-Module/LoginBuffer/Makefile_Watch new file mode 100644 index 000000000..d236a4f91 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Makefile_Watch @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LoginBuffer_Watch +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/LoginBuffer +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LoginBuffer_Watch.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../Common $(IncludeSwitch)./LoginBuffer/Common $(IncludeSwitch)./Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/LoginBuffer_Watch" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix): ./Watch/Watch.cpp $(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Watch/Watch.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix): ./Watch/Watch.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix) -MM ./Watch/Watch.cpp + +$(IntermediateDirectory)/Watch_Watch.cpp$(PreprocessSuffix): ./Watch/Watch.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Watch_Watch.cpp$(PreprocessSuffix) ./Watch/Watch.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch.cbp b/purenessscopeserver/example-Module/LoginBuffer/Watch.cbp new file mode 100644 index 000000000..559876d32 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Watch.cbp @@ -0,0 +1,50 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch.depend b/purenessscopeserver/example-Module/LoginBuffer/Watch.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Watch.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch.layout b/purenessscopeserver/example-Module/LoginBuffer/Watch.layout new file mode 100644 index 000000000..3d508c7d2 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Watch.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch.project b/purenessscopeserver/example-Module/LoginBuffer/Watch.project new file mode 100644 index 000000000..6525d6f23 --- /dev/null +++ b/purenessscopeserver/example-Module/LoginBuffer/Watch.project @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.mpc b/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.mpc deleted file mode 100644 index d25e54934..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.mpc +++ /dev/null @@ -1,12 +0,0 @@ -project(Watch):aceexe{ - exename=Watch - includes += ../../include ../Common - specific (prop:microsoft){ - exeout=”../../../PurenessScopeServer/Windows_Bin” - } - - Source_Files { - ../Common/*.cpp - *.cpp - } -} diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.sln b/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.sln deleted file mode 100644 index fd4cfb8ca..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.sln +++ /dev/null @@ -1,33 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -# $Id: VC9WorkspaceCreator.pm 2035 2011-10-06 15:05:21Z johnnyw $ -# -# This file was generated by MPC. Any changes made directly to -# this file will be lost the next time it is generated. -# -# MPC Command: -# D:\Program\ACE+TAO+CIAO-6.0.0\ACE_wrappers\bin\mwc.pl -type vc9 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Watch", "Watch.vcproj", "{A90162BF-FECA-1BAD-625A-8A320000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A90162BF-FECA-1BAD-625A-8A320000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {A90162BF-FECA-1BAD-625A-8A320000002E}.Debug|Win32.Build.0 = Debug|Win32 - {A90162BF-FECA-1BAD-625A-8A320000002E}.Debug|x64.ActiveCfg = Debug|x64 - {A90162BF-FECA-1BAD-625A-8A320000002E}.Debug|x64.Build.0 = Debug|x64 - {A90162BF-FECA-1BAD-625A-8A320000002E}.Release|Win32.ActiveCfg = Release|Win32 - {A90162BF-FECA-1BAD-625A-8A320000002E}.Release|Win32.Build.0 = Release|Win32 - {A90162BF-FECA-1BAD-625A-8A320000002E}.Release|x64.ActiveCfg = Release|x64 - {A90162BF-FECA-1BAD-625A-8A320000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.vcproj b/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.vcproj deleted file mode 100644 index 747246cc5..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Watch/Watch.vcproj +++ /dev/null @@ -1,440 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch/zzz.bat b/purenessscopeserver/example-Module/LoginBuffer/Watch/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Watch/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/LoginBuffer/Watch/zzz.sh b/purenessscopeserver/example-Module/LoginBuffer/Watch/zzz.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/LoginBuffer/Watch/zzz.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git "a/purenessscopeserver/example-Module/LoginBuffer/Watch/\350\276\223\345\207\272-\347\224\237\346\210\220.txt" "b/purenessscopeserver/example-Module/LoginBuffer/Watch/\350\276\223\345\207\272-\347\224\237\346\210\220.txt" deleted file mode 100644 index 56bfd601b..000000000 --- "a/purenessscopeserver/example-Module/LoginBuffer/Watch/\350\276\223\345\207\272-\347\224\237\346\210\220.txt" +++ /dev/null @@ -1,16 +0,0 @@ -1>------ : Ŀ: Watch, : Debug Win32 ------ -1>ڱ... -1>Watch.cpp -1>UserValidManager.cpp -1>SMOption.cpp -1>ɴ... -1>ڱԴ嵥... -1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 -1>Copyright (C) Microsoft Corporation. All rights reserved. -1>... -1>Ƕ嵥... -1>Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0 -1>Copyright (C) Microsoft Corporation. All rights reserved. -1>־ڡfile://d:\freeeyesWork\Pureness\PurenessScopeServer_SVN\purenessscopeserver\ purenessscopeserver --username freeeyes1226@gmail.com\example-Module\LoginBuffer\Watch\Debug\Watch\I386\BuildLog.htm -1>Watch - 0 0 -========== : ɹ 1 ʧ 0 0 0 ========== diff --git a/purenessscopeserver/example-Module/LsPlugIn/CMakeLists.txt b/purenessscopeserver/example-Module/LsPlugIn/CMakeLists.txt new file mode 100644 index 000000000..b5306e812 --- /dev/null +++ b/purenessscopeserver/example-Module/LsPlugIn/CMakeLists.txt @@ -0,0 +1,88 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(LsPlugIn) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_LsPlugIn_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../Common + ./LoginBuffer/Common + ./Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./LsPlugIn/MD5.cpp + ${CMAKE_CURRENT_LIST_DIR}/./LsPlugIn/ListManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/./LsPlugIn/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./LsPlugIn/LSLogic.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(LsPlugIn SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(LsPlugIn ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.cbp b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.cbp new file mode 100644 index 000000000..e32da6e17 --- /dev/null +++ b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.cbp @@ -0,0 +1,57 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.depend b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.exp b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.exp new file mode 100644 index 000000000..2ac81ccd0 Binary files /dev/null and b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.exp differ diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.layout b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.lib b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.lib new file mode 100644 index 000000000..8eba8c649 Binary files /dev/null and b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.lib differ diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.mpc b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.mpc deleted file mode 100644 index fa4feeb99..000000000 --- a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.mpc +++ /dev/null @@ -1,26 +0,0 @@ -project(LSLogic):acelib{ - sharedname=LSLogic - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - ./IniRead/*.c - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common ./IniRead -} diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcproj b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcproj deleted file mode 100644 index 7bbe41606..000000000 --- a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcproj +++ /dev/null @@ -1,456 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcxproj b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcxproj index ce36dd403..1c78d7b0e 100644 --- a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcxproj +++ b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -18,30 +18,46 @@ x64 + + + + + + + + + + + + + + + {1D93DD85-FECA-1BAD-91F1-C3190000002E} LSLogic Win32Proj + 10.0.17763.0 DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet @@ -64,7 +80,7 @@ <_ProjectFileVersion>11.0.50727.1 - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\LSLogic\I386\ true @@ -74,13 +90,13 @@ false - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\LSLogic\AMD64\ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\LSLogic\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -197,7 +213,7 @@ MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);LsPlugIn\IniRead\;%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -223,29 +239,6 @@ MachineX64 - - - - - - - - - - - - - - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcxproj.filters b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcxproj.filters index 67779ead8..c744f1821 100644 --- a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcxproj.filters +++ b/purenessscopeserver/example-Module/LsPlugIn/LSLogic.vcxproj.filters @@ -1,59 +1,31 @@  - - {660044c3-25d1-4780-98a7-1930d47de2c9} - cpp;cxx;cc;c;C - - - {761e8eb2-07ee-4e23-a25f-7f75ba6c4c43} - h;hpp;hxx;hh - - - {6ca231d3-4144-40ae-96c0-a6525e59ee66} - mpc;mpb;mwc + + {71f7ee3a-9563-4030-9a55-3814bb480a71} - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files + + IniRead - - Source Files + + IniRead + + + + - - Header Files + + IniRead - - Header Files + + IniRead - - Header Files - - - Header Files - - - Header Files - - - - - Build Files - + + + \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogicd.exp b/purenessscopeserver/example-Module/LsPlugIn/LSLogicd.exp deleted file mode 100644 index ebb66fa29..000000000 Binary files a/purenessscopeserver/example-Module/LsPlugIn/LSLogicd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/LsPlugIn/ListManager.cpp b/purenessscopeserver/example-Module/LsPlugIn/ListManager.cpp deleted file mode 100644 index 80b1410a8..000000000 --- a/purenessscopeserver/example-Module/LsPlugIn/ListManager.cpp +++ /dev/null @@ -1,236 +0,0 @@ -#include "ListManager.h" - -ClistManager::ClistManager() -{ - m_szMD5[0] = '\0'; -} - -ClistManager::~ClistManager() -{ - -} - -void ClistManager::Add_LG_Info(uint32 u4ConnectID, uint32 u4LGID, const char* pIP, uint32 u4Port, const char* pMD5, const char* pSession, uint16 u2Version) -{ - ACE_Guard WGuard(m_ThreadLock); - - _LG_Info* pInfo = Get_LG_Info_By_LGID(u4LGID); - - if(NULL == pInfo) - { - _LG_Info objNewInfo; - objNewInfo.m_u4ConnectID = u4ConnectID; - objNewInfo.m_u4LGID = u4LGID; - objNewInfo.m_u4Port = u4Port; - sprintf_safe(objNewInfo.m_szIP, 50, "%s", pIP); - sprintf_safe(objNewInfo.m_szMD5, 33, "%s", pMD5); - sprintf_safe(objNewInfo.m_szSession, 33, "%s", pSession); - m_vecLGInfo.push_back(objNewInfo); - objNewInfo.m_u2Version = u2Version; - } - else - { - pInfo->m_u4ConnectID = u4ConnectID; - pInfo->m_u4LGID = u4LGID; - pInfo->m_u4Port = u4Port; - sprintf_safe(pInfo->m_szIP, 50, "%s", pIP); - sprintf_safe(pInfo->m_szMD5, 33, "%s", pMD5); - sprintf_safe(pInfo->m_szSession, 33, "%s", pSession); - pInfo->m_u2Version = u2Version; - } - - Compare_MD5(); - - Check_LG_Target(u4ConnectID, u4LGID, pIP, u4Port); -} - -_LG_Info* ClistManager::Get_LG_Info_By_LGID(uint32 u4LGID) -{ - ACE_Guard WGuard(m_ThreadLock); - - for(uint32 u4Index = 0; u4Index < (uint32)m_vecLGInfo.size(); u4Index++) - { - if(m_vecLGInfo[u4Index].m_u4LGID == u4LGID) - { - return &m_vecLGInfo[u4Index]; - } - } - - return NULL; -} - -_LG_Info* ClistManager::Get_LG_Info_By_ConnectID(uint32 u4ConnectID) -{ - ACE_Guard WGuard(m_ThreadLock); - - for(uint32 u4Index = 0; u4Index < (uint32)m_vecLGInfo.size(); u4Index++) - { - if(m_vecLGInfo[u4Index].m_u4ConnectID == u4ConnectID) - { - return &m_vecLGInfo[u4Index]; - } - } - - return NULL; -} - -_LG_Info* ClistManager::Get_LG_Info_By_Index(uint32 u4Index) -{ - ACE_Guard WGuard(m_ThreadLock); - - if(u4Index >= (uint32)m_vecLGInfo.size()) - { - return NULL; - } - else - { - return &m_vecLGInfo[u4Index]; - } -} - -void ClistManager::Del_LG_Info_By_ConnectID(uint32 u4ConnectID) -{ - ACE_Guard WGuard(m_ThreadLock); - - for(vecLGInfo::iterator b = m_vecLGInfo.begin(); b != m_vecLGInfo.end(); b++) - { - if(b->m_u4ConnectID == u4ConnectID) - { - m_vecLGInfo.erase(b); - return; - } - } - - Compare_MD5(); -} - -uint32 ClistManager::Get_LG_Count() -{ - ACE_Guard WGuard(m_ThreadLock); - - return (uint32)m_vecLGInfo.size(); -} - -void ClistManager::Get_All_LG_List(IBuffPacket* pbpList, uint32& u4Count) -{ - ACE_Guard WGuard(m_ThreadLock); - - if(pbpList == NULL) - { - return; - } - - u4Count = Get_LG_Count(); - - for(uint32 i = 0; i < u4Count; i++) - { - _LG_Info* pInfo = Get_LG_Info_By_Index(i); - _VCHARS_STR strIP; - uint8 u1Len = (uint8)strlen(pInfo->m_szIP); - strIP.SetData(pInfo->m_szIP, u1Len); - - (*pbpList) << pInfo->m_u4LGID; - (*pbpList) << strIP; - (*pbpList) << pInfo->m_u4Port; - } -} - -void ClistManager::Compare_MD5() -{ - //CMD5 objMD5; - //objMD5.ENCODE_DATA((char* )&m_vecLGInfo, sizeof(m_vecLGInfo), m_szMD5); - unsigned char uszMD5[16] = {'\0'}; - - MD5_CTX obj_MD5_CTX; - MD5Init(&obj_MD5_CTX); - MD5Update(&obj_MD5_CTX, (unsigned char* )&m_vecLGInfo, sizeof(m_vecLGInfo)); - MD5Final(&obj_MD5_CTX, uszMD5); - - //תΪַ - char szDigit[3] = {'\0'}; - - for(int i = 0; i < 16; i++) - { - sprintf_safe(szDigit, 3, "%02x", (char)uszMD5[i]); - memcpy_safe((char* )&uszMD5[i*2], 32 - i*2, szDigit, 2); - } - -} - -char* ClistManager::Get_MD5_Data() -{ - ACE_Guard WGuard(m_ThreadLock); - - return (char* )m_szMD5; -} - -void ClistManager::Clear() -{ - ACE_Guard WGuard(m_ThreadLock); - - m_vecLGInfo.clear(); - m_szMD5[0] = '\0'; -} - -void ClistManager::ReadList() -{ - m_vecLGTargetInfo.clear(); - - dictionary* pDictionary = NULL; - pDictionary = iniparser_load(LS_LIST_FILENAME); - - if(NULL == pDictionary) - { - OUR_DEBUG((LM_ERROR, "[ClistManager::ReadList](%s)Read Ini fail.\n", LS_LIST_FILENAME)); - return; - } - - uint32 u4Count = (uint32)iniparser_getint(pDictionary, "List:Count", 0); - - char szTempName[50] = {'\0'}; - - for(uint32 i = 0; i < u4Count; i++) - { - _LG_Target_Info objTarhgetInfo; - sprintf_safe(szTempName, 50, "List:LGID%d", i); - objTarhgetInfo.m_u4LGID = (uint32)iniparser_getint(pDictionary, szTempName, 0); - sprintf_safe(szTempName, 50, "List:LGIP%d", i); - char* pData = iniparser_getstring(pDictionary, szTempName, NULL); - { - sprintf_safe(objTarhgetInfo.m_szIP, 50, "%s", pData); - } - sprintf_safe(szTempName, 50, "List:LGPort%d", i); - objTarhgetInfo.m_u4Port = (uint32)iniparser_getint(pDictionary, szTempName, 0);; - m_vecLGTargetInfo.push_back(objTarhgetInfo); - } -} - -void ClistManager::Check_LG_Target(uint32 u4ConnectID, uint32 u4LGID, const char* pIP, uint32 u4Port) -{ - for(int i = 0; i < (int)m_vecLGTargetInfo.size(); i++) - { - if(m_vecLGTargetInfo[i].m_u4LGID == u4LGID && - m_vecLGTargetInfo[i].m_u4Port == u4Port && - ACE_OS::strcmp(m_vecLGTargetInfo[i].m_szIP, pIP) == 0) - { - m_vecLGTargetInfo[i].m_nConnectID = (int)u4ConnectID; - break; - } - } -} - -bool ClistManager::Get_All_Target_list_Finish() -{ - bool blRet = true; - - for(int i = 0; i < (int)m_vecLGTargetInfo.size(); i++) - { - if(m_vecLGTargetInfo[i].m_nConnectID == -1) - { - blRet = false; - break; - } - } - - return blRet; -} \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.mk b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.mk new file mode 100644 index 000000000..73d0fd1c0 --- /dev/null +++ b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.mk @@ -0,0 +1,136 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LsPlugIn +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LsPlugIn +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LsPlugIn.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../Common $(IncludeSwitch)./LoginBuffer/Common $(IncludeSwitch)./Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(ObjectSuffix) $(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/LsPlugIn" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(ObjectSuffix): ./LsPlugIn/MD5.cpp $(IntermediateDirectory)/LsPlugIn_MD5.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/MD5.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(DependSuffix): ./LsPlugIn/MD5.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(DependSuffix) -MM ./LsPlugIn/MD5.cpp + +$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(PreprocessSuffix): ./LsPlugIn/MD5.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LsPlugIn_MD5.cpp$(PreprocessSuffix) ./LsPlugIn/MD5.cpp + +$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(ObjectSuffix): ./LsPlugIn/ListManager.cpp $(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/ListManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(DependSuffix): ./LsPlugIn/ListManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(DependSuffix) -MM ./LsPlugIn/ListManager.cpp + +$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(PreprocessSuffix): ./LsPlugIn/ListManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(PreprocessSuffix) ./LsPlugIn/ListManager.cpp + +$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(ObjectSuffix): ./LsPlugIn/BaseCommand.cpp $(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(DependSuffix): ./LsPlugIn/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(DependSuffix) -MM ./LsPlugIn/BaseCommand.cpp + +$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(PreprocessSuffix): ./LsPlugIn/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(PreprocessSuffix) ./LsPlugIn/BaseCommand.cpp + +$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(ObjectSuffix): ./LsPlugIn/LSLogic.cpp $(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/LSLogic.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(DependSuffix): ./LsPlugIn/LSLogic.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(DependSuffix) -MM ./LsPlugIn/LSLogic.cpp + +$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(PreprocessSuffix): ./LsPlugIn/LSLogic.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(PreprocessSuffix) ./LsPlugIn/LSLogic.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.project b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.project new file mode 100644 index 000000000..5b8747f8f --- /dev/null +++ b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.project @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.sln b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.sln deleted file mode 100644 index f74e002de..000000000 --- a/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LSLogic", "LSLogic.vcxproj", "{1D93DD85-FECA-1BAD-91F1-C3190000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1D93DD85-FECA-1BAD-91F1-C3190000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {1D93DD85-FECA-1BAD-91F1-C3190000002E}.Debug|Win32.Build.0 = Debug|Win32 - {1D93DD85-FECA-1BAD-91F1-C3190000002E}.Debug|x64.ActiveCfg = Debug|x64 - {1D93DD85-FECA-1BAD-91F1-C3190000002E}.Debug|x64.Build.0 = Debug|x64 - {1D93DD85-FECA-1BAD-91F1-C3190000002E}.Release|Win32.ActiveCfg = Release|Win32 - {1D93DD85-FECA-1BAD-91F1-C3190000002E}.Release|Win32.Build.0 = Release|Win32 - {1D93DD85-FECA-1BAD-91F1-C3190000002E}.Release|x64.ActiveCfg = Release|x64 - {1D93DD85-FECA-1BAD-91F1-C3190000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.txt b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.txt new file mode 100644 index 000000000..1c004b789 --- /dev/null +++ b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/LsPlugIn_MD5.cpp.o ../../../Build/Linux/Linux_Bin/Temp/LsPlugIn_ListManager.cpp.o ../../../Build/Linux/Linux_Bin/Temp/LsPlugIn_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/LsPlugIn_LSLogic.cpp.o diff --git a/purenessscopeserver/example-Module/LsPlugIn/BaseCommand.cpp b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/BaseCommand.cpp rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/LsPlugIn/BaseCommand.h b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/BaseCommand.h rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/BaseCommand.h diff --git a/purenessscopeserver/example-Module/LsPlugIn/IniRead/dictionary.c b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/IniRead/dictionary.c similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/IniRead/dictionary.c rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/IniRead/dictionary.c diff --git a/purenessscopeserver/example-Module/LsPlugIn/IniRead/dictionary.h b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/IniRead/dictionary.h similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/IniRead/dictionary.h rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/IniRead/dictionary.h diff --git a/purenessscopeserver/example-Module/LsPlugIn/IniRead/iniparser.c b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/IniRead/iniparser.c similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/IniRead/iniparser.c rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/IniRead/iniparser.c diff --git a/purenessscopeserver/example-Module/LsPlugIn/IniRead/iniparser.h b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/IniRead/iniparser.h similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/IniRead/iniparser.h rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/IniRead/iniparser.h diff --git a/purenessscopeserver/example-Module/LsPlugIn/LSLogic.cpp b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/LSLogic.cpp similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/LSLogic.cpp rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/LSLogic.cpp diff --git a/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/ListManager.cpp b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/ListManager.cpp new file mode 100644 index 000000000..b63f121fa --- /dev/null +++ b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/ListManager.cpp @@ -0,0 +1,236 @@ +#include "ListManager.h" + +ClistManager::ClistManager() +{ + m_szMD5[0] = '\0'; +} + +ClistManager::~ClistManager() +{ + +} + +void ClistManager::Add_LG_Info(uint32 u4ConnectID, uint32 u4LGID, const char* pIP, uint32 u4Port, const char* pMD5, const char* pSession, uint16 u2Version) +{ + ACE_Guard WGuard(m_ThreadLock); + + _LG_Info* pInfo = Get_LG_Info_By_LGID(u4LGID); + + if(NULL == pInfo) + { + _LG_Info objNewInfo; + objNewInfo.m_u4ConnectID = u4ConnectID; + objNewInfo.m_u4LGID = u4LGID; + objNewInfo.m_u4Port = u4Port; + sprintf_safe(objNewInfo.m_szIP, 50, "%s", pIP); + sprintf_safe(objNewInfo.m_szMD5, 33, "%s", pMD5); + sprintf_safe(objNewInfo.m_szSession, 33, "%s", pSession); + m_vecLGInfo.push_back(objNewInfo); + objNewInfo.m_u2Version = u2Version; + } + else + { + pInfo->m_u4ConnectID = u4ConnectID; + pInfo->m_u4LGID = u4LGID; + pInfo->m_u4Port = u4Port; + sprintf_safe(pInfo->m_szIP, 50, "%s", pIP); + sprintf_safe(pInfo->m_szMD5, 33, "%s", pMD5); + sprintf_safe(pInfo->m_szSession, 33, "%s", pSession); + pInfo->m_u2Version = u2Version; + } + + Compare_MD5(); + + Check_LG_Target(u4ConnectID, u4LGID, pIP, u4Port); +} + +_LG_Info* ClistManager::Get_LG_Info_By_LGID(uint32 u4LGID) +{ + ACE_Guard WGuard(m_ThreadLock); + + for(uint32 u4Index = 0; u4Index < (uint32)m_vecLGInfo.size(); u4Index++) + { + if(m_vecLGInfo[u4Index].m_u4LGID == u4LGID) + { + return &m_vecLGInfo[u4Index]; + } + } + + return NULL; +} + +_LG_Info* ClistManager::Get_LG_Info_By_ConnectID(uint32 u4ConnectID) +{ + ACE_Guard WGuard(m_ThreadLock); + + for(uint32 u4Index = 0; u4Index < (uint32)m_vecLGInfo.size(); u4Index++) + { + if(m_vecLGInfo[u4Index].m_u4ConnectID == u4ConnectID) + { + return &m_vecLGInfo[u4Index]; + } + } + + return NULL; +} + +_LG_Info* ClistManager::Get_LG_Info_By_Index(uint32 u4Index) +{ + ACE_Guard WGuard(m_ThreadLock); + + if(u4Index >= (uint32)m_vecLGInfo.size()) + { + return NULL; + } + else + { + return &m_vecLGInfo[u4Index]; + } +} + +void ClistManager::Del_LG_Info_By_ConnectID(uint32 u4ConnectID) +{ + ACE_Guard WGuard(m_ThreadLock); + + for(vecLGInfo::iterator b = m_vecLGInfo.begin(); b != m_vecLGInfo.end(); b++) + { + if(b->m_u4ConnectID == u4ConnectID) + { + m_vecLGInfo.erase(b); + return; + } + } + + Compare_MD5(); +} + +uint32 ClistManager::Get_LG_Count() +{ + ACE_Guard WGuard(m_ThreadLock); + + return (uint32)m_vecLGInfo.size(); +} + +void ClistManager::Get_All_LG_List(IBuffPacket* pbpList, uint32& u4Count) +{ + ACE_Guard WGuard(m_ThreadLock); + + if(pbpList == NULL) + { + return; + } + + u4Count = Get_LG_Count(); + + for(uint32 i = 0; i < u4Count; i++) + { + _LG_Info* pInfo = Get_LG_Info_By_Index(i); + _VCHARS_STR strIP; + uint8 u1Len = (uint8)strlen(pInfo->m_szIP); + strIP.SetData(pInfo->m_szIP, u1Len); + + (*pbpList) << pInfo->m_u4LGID; + (*pbpList) << strIP; + (*pbpList) << pInfo->m_u4Port; + } +} + +void ClistManager::Compare_MD5() +{ + //CMD5 objMD5; + //objMD5.ENCODE_DATA((char* )&m_vecLGInfo, sizeof(m_vecLGInfo), m_szMD5); + unsigned char uszMD5[16] = {'\0'}; + + MD5_CTX obj_MD5_CTX; + MD5Init(&obj_MD5_CTX); + MD5Update(&obj_MD5_CTX, (unsigned char* )&m_vecLGInfo, sizeof(m_vecLGInfo)); + MD5Final(&obj_MD5_CTX, uszMD5); + + //תΪַ + char szDigit[3] = {'\0'}; + + for(int i = 0; i < 16; i++) + { + sprintf_safe(szDigit, 3, "%02x", (char)uszMD5[i]); + memcpy_safe((char* )&uszMD5[i*2], 32 - i*2, szDigit, 2); + } + +} + +char* ClistManager::Get_MD5_Data() +{ + ACE_Guard WGuard(m_ThreadLock); + + return (char* )m_szMD5; +} + +void ClistManager::Clear() +{ + ACE_Guard WGuard(m_ThreadLock); + + m_vecLGInfo.clear(); + m_szMD5[0] = '\0'; +} + +void ClistManager::ReadList() +{ + m_vecLGTargetInfo.clear(); + + dictionary* pDictionary = NULL; + pDictionary = iniparser_load(LS_LIST_FILENAME); + + if(NULL == pDictionary) + { + OUR_DEBUG((LM_ERROR, "[ClistManager::ReadList](%s)Read Ini fail.\n", LS_LIST_FILENAME)); + return; + } + + uint32 u4Count = (uint32)iniparser_getint(pDictionary, "List:Count", 0); + + char szTempName[50] = {'\0'}; + + for(uint32 i = 0; i < u4Count; i++) + { + _LG_Target_Info objTarhgetInfo; + sprintf_safe(szTempName, 50, "List:LGID%d", i); + objTarhgetInfo.m_u4LGID = (uint32)iniparser_getint(pDictionary, szTempName, 0); + sprintf_safe(szTempName, 50, "List:LGIP%d", i); + char* pData = (char*)iniparser_getstring(pDictionary, szTempName, NULL); + { + sprintf_safe(objTarhgetInfo.m_szIP, 50, "%s", pData); + } + sprintf_safe(szTempName, 50, "List:LGPort%d", i); + objTarhgetInfo.m_u4Port = (uint32)iniparser_getint(pDictionary, szTempName, 0);; + m_vecLGTargetInfo.push_back(objTarhgetInfo); + } +} + +void ClistManager::Check_LG_Target(uint32 u4ConnectID, uint32 u4LGID, const char* pIP, uint32 u4Port) +{ + for(int i = 0; i < (int)m_vecLGTargetInfo.size(); i++) + { + if(m_vecLGTargetInfo[i].m_u4LGID == u4LGID && + m_vecLGTargetInfo[i].m_u4Port == u4Port && + ACE_OS::strcmp(m_vecLGTargetInfo[i].m_szIP, pIP) == 0) + { + m_vecLGTargetInfo[i].m_nConnectID = (int)u4ConnectID; + break; + } + } +} + +bool ClistManager::Get_All_Target_list_Finish() +{ + bool blRet = true; + + for(int i = 0; i < (int)m_vecLGTargetInfo.size(); i++) + { + if(m_vecLGTargetInfo[i].m_nConnectID == -1) + { + blRet = false; + break; + } + } + + return blRet; +} diff --git a/purenessscopeserver/example-Module/LsPlugIn/ListManager.h b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/ListManager.h similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/ListManager.h rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/ListManager.h diff --git a/purenessscopeserver/example-Module/LsPlugIn/MD5.cpp b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/MD5.cpp similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/MD5.cpp rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/MD5.cpp diff --git a/purenessscopeserver/example-Module/LsPlugIn/MD5.h b/purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/MD5.h similarity index 100% rename from purenessscopeserver/example-Module/LsPlugIn/MD5.h rename to purenessscopeserver/example-Module/LsPlugIn/LsPlugIn/MD5.h diff --git a/purenessscopeserver/example-Module/LsPlugIn/Makefile b/purenessscopeserver/example-Module/LsPlugIn/Makefile index fe4862264..b956abb47 100644 --- a/purenessscopeserver/example-Module/LsPlugIn/Makefile +++ b/purenessscopeserver/example-Module/LsPlugIn/Makefile @@ -1,26 +1,136 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LsPlugIn +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/LsPlugIn +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LsPlugIn.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../Common $(IncludeSwitch)./LoginBuffer/Common $(IncludeSwitch)./Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o ListManager.o LSLogic.o MD5.o dictionary.o iniparser.o -LIB_BASE_OBJS = BaseCommand.o ListManager.o LSLogic.o MD5.o dictionary.o iniparser.o -LIB_BASE = libLSLogic.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(ObjectSuffix) $(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(ObjectSuffix) -all: libLSLogic.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/LsPlugIn" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(ObjectSuffix): ./LsPlugIn/MD5.cpp $(IntermediateDirectory)/LsPlugIn_MD5.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LsPlugIn/MD5.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(DependSuffix): ./LsPlugIn/MD5.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(DependSuffix) -MM ./LsPlugIn/MD5.cpp + +$(IntermediateDirectory)/LsPlugIn_MD5.cpp$(PreprocessSuffix): ./LsPlugIn/MD5.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LsPlugIn_MD5.cpp$(PreprocessSuffix) ./LsPlugIn/MD5.cpp + +$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(ObjectSuffix): ./LsPlugIn/ListManager.cpp $(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LsPlugIn/ListManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(DependSuffix): ./LsPlugIn/ListManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(DependSuffix) -MM ./LsPlugIn/ListManager.cpp + +$(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(PreprocessSuffix): ./LsPlugIn/ListManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LsPlugIn_ListManager.cpp$(PreprocessSuffix) ./LsPlugIn/ListManager.cpp + +$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(ObjectSuffix): ./LsPlugIn/BaseCommand.cpp $(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LsPlugIn/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(DependSuffix): ./LsPlugIn/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(DependSuffix) -MM ./LsPlugIn/BaseCommand.cpp + +$(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(PreprocessSuffix): ./LsPlugIn/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LsPlugIn_BaseCommand.cpp$(PreprocessSuffix) ./LsPlugIn/BaseCommand.cpp + +$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(ObjectSuffix): ./LsPlugIn/LSLogic.cpp $(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./LsPlugIn/LSLogic.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(DependSuffix): ./LsPlugIn/LSLogic.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(DependSuffix) -MM ./LsPlugIn/LSLogic.cpp + +$(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(PreprocessSuffix): ./LsPlugIn/LSLogic.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LsPlugIn_LSLogic.cpp$(PreprocessSuffix) ./LsPlugIn/LSLogic.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libLSLogic.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LsPlugIn/Makefile.define b/purenessscopeserver/example-Module/LsPlugIn/Makefile.define deleted file mode 100644 index 54deef6cb..000000000 --- a/purenessscopeserver/example-Module/LsPlugIn/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -I ./IniRead -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LsPlugIn/runlinuxmake.sh b/purenessscopeserver/example-Module/LsPlugIn/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/LsPlugIn/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LsPlugIn/zzz.bat b/purenessscopeserver/example-Module/LsPlugIn/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/LsPlugIn/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/LuaTest/CMakeLists.txt b/purenessscopeserver/example-Module/LuaTest/CMakeLists.txt new file mode 100644 index 000000000..569b1256e --- /dev/null +++ b/purenessscopeserver/example-Module/LuaTest/CMakeLists.txt @@ -0,0 +1,131 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(LuaTest) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_LuaTest_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + ../../../ThirdLib/thirdparty/LuaLib/ + ../../../ThirdLib/thirdparty/toluapp-master/include + ../../../ThirdLib/thirdparty/LuaLib/ + ../../../ThirdLib/include/Lua/ + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the C sources +set ( C_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lgc.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/ldblib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lobject.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/liolib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/ltablib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/ldo.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/loslib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lmem.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/print.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lfunc.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/ldump.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/ltable.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lstate.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lapi.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lzio.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lvm.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/ltm.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lparser.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/loadlib.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lstring.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/ldebug.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lcode.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/llex.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/linit.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/lundump.c + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/thirdparty/LuaLib/toluabind.c +) + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./LuaTest/BaseCommand.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +set_source_files_properties( + ${C_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(LuaTest SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(LuaTest ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/Lua.lib b/purenessscopeserver/example-Module/LuaTest/LuaBase/Lua.lib deleted file mode 100644 index ba6715d5e..000000000 Binary files a/purenessscopeserver/example-Module/LuaTest/LuaBase/Lua.lib and /dev/null differ diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lauxlib.h b/purenessscopeserver/example-Module/LuaTest/LuaBase/lauxlib.h deleted file mode 100644 index c428a0152..000000000 --- a/purenessscopeserver/example-Module/LuaTest/LuaBase/lauxlib.h +++ /dev/null @@ -1,176 +0,0 @@ -/* -** $Id: lauxlib.h,v 1.88.1.1 2007/12/27 13:02:25 roberto Exp $ -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lauxlib_h -#define lauxlib_h - - -#include -#include - -#include "lua.h" - - -#if defined(LUA_COMPAT_GETN) -LUALIB_API int (luaL_getn) (lua_State* L, int t); -LUALIB_API void (luaL_setn) (lua_State* L, int t, int n); -#else -#define luaL_getn(L,i) ((int)lua_objlen(L, i)) -#define luaL_setn(L,i,j) ((void)0) /* no op! */ -#endif - -#if defined(LUA_COMPAT_OPENLIB) -#define luaI_openlib luaL_openlib -#endif - - -/* extra error code for `luaL_load' */ -#define LUA_ERRFILE (LUA_ERRERR+1) - - -typedef struct luaL_Reg -{ - const char* name; - lua_CFunction func; -} luaL_Reg; - - - -LUALIB_API void (luaI_openlib) (lua_State* L, const char* libname, - const luaL_Reg* l, int nup); -LUALIB_API void (luaL_register) (lua_State* L, const char* libname, - const luaL_Reg* l); -LUALIB_API int (luaL_getmetafield) (lua_State* L, int obj, const char* e); -LUALIB_API int (luaL_callmeta) (lua_State* L, int obj, const char* e); -LUALIB_API int (luaL_typerror) (lua_State* L, int narg, const char* tname); -LUALIB_API int (luaL_argerror) (lua_State* L, int numarg, const char* extramsg); -LUALIB_API const char* (luaL_checklstring) (lua_State* L, int numArg, - size_t* l); -LUALIB_API const char* (luaL_optlstring) (lua_State* L, int numArg, - const char* def, size_t* l); -LUALIB_API lua_Number (luaL_checknumber) (lua_State* L, int numArg); -LUALIB_API lua_Number (luaL_optnumber) (lua_State* L, int nArg, lua_Number def); - -LUALIB_API lua_Integer (luaL_checkinteger) (lua_State* L, int numArg); -LUALIB_API lua_Integer (luaL_optinteger) (lua_State* L, int nArg, - lua_Integer def); - -LUALIB_API void (luaL_checkstack) (lua_State* L, int sz, const char* msg); -LUALIB_API void (luaL_checktype) (lua_State* L, int narg, int t); -LUALIB_API void (luaL_checkany) (lua_State* L, int narg); - -LUALIB_API int (luaL_newmetatable) (lua_State* L, const char* tname); -LUALIB_API void* (luaL_checkudata) (lua_State* L, int ud, const char* tname); - -LUALIB_API void (luaL_where) (lua_State* L, int lvl); -LUALIB_API int (luaL_error) (lua_State* L, const char* fmt, ...); - -LUALIB_API int (luaL_checkoption) (lua_State* L, int narg, const char* def, - const char* const lst[]); - -LUALIB_API int (luaL_ref) (lua_State* L, int t); -LUALIB_API void (luaL_unref) (lua_State* L, int t, int ref); - -LUALIB_API int (luaL_loadfile) (lua_State* L, const char* filename); -LUALIB_API int (luaL_loadbuffer) (lua_State* L, const char* buff, size_t sz, - const char* name); -LUALIB_API int (luaL_loadstring) (lua_State* L, const char* s); - -LUALIB_API lua_State* (luaL_newstate) (void); - - -LUALIB_API const char* (luaL_gsub) (lua_State* L, const char* s, const char* p, - const char* r); - -LUALIB_API const char* (luaL_findtable) (lua_State* L, int idx, - const char* fname, int szhint); - - - - -/* -** =============================================================== -** some useful macros -** =============================================================== -*/ - -#define luaL_argcheck(L, cond,numarg,extramsg) \ - ((void)((cond) || luaL_argerror(L, (numarg), (extramsg)))) -#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) -#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) -#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) -#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) -#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) -#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) - -#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) - -#define luaL_dofile(L, fn) \ - (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) - -#define luaL_dostring(L, s) \ - (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) - -#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) - -#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - - - -typedef struct luaL_Buffer -{ - char* p; /* current position in buffer */ - int lvl; /* number of strings in the stack (level) */ - lua_State* L; - char buffer[LUAL_BUFFERSIZE]; -} luaL_Buffer; - -#define luaL_addchar(B,c) \ - ((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \ - (*(B)->p++ = (char)(c))) - -/* compatibility only */ -#define luaL_putchar(B,c) luaL_addchar(B,c) - -#define luaL_addsize(B,n) ((B)->p += (n)) - -LUALIB_API void (luaL_buffinit) (lua_State* L, luaL_Buffer* B); -LUALIB_API char* (luaL_prepbuffer) (luaL_Buffer* B); -LUALIB_API void (luaL_addlstring) (luaL_Buffer* B, const char* s, size_t l); -LUALIB_API void (luaL_addstring) (luaL_Buffer* B, const char* s); -LUALIB_API void (luaL_addvalue) (luaL_Buffer* B); -LUALIB_API void (luaL_pushresult) (luaL_Buffer* B); - - -/* }====================================================== */ - - -/* compatibility with ref system */ - -/* pre-defined references */ -#define LUA_NOREF (-2) -#define LUA_REFNIL (-1) - -#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ - (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0)) - -#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) - -#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref)) - - -#define luaL_reg luaL_Reg - -#endif - - diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lcode.h b/purenessscopeserver/example-Module/LuaTest/LuaBase/lcode.h deleted file mode 100644 index 88cdd97b9..000000000 --- a/purenessscopeserver/example-Module/LuaTest/LuaBase/lcode.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $ -** Code generator for Lua -** See Copyright Notice in lua.h -*/ - -#ifndef lcode_h -#define lcode_h - -#include "llex.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" - - -/* -** Marks the end of a patch list. It is an invalid value both as an absolute -** address, and as a list link (would link an element to itself). -*/ -#define NO_JUMP (-1) - - -/* -** grep "ORDER OPR" if you change these enums -*/ -typedef enum BinOpr -{ - OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW, - OPR_CONCAT, - OPR_NE, OPR_EQ, - OPR_LT, OPR_LE, OPR_GT, OPR_GE, - OPR_AND, OPR_OR, - OPR_NOBINOPR -} BinOpr; - - -typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; - - -#define getcode(fs,e) ((fs)->f->code[(e)->u.s.info]) - -#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) - -#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) - -LUAI_FUNC int luaK_codeABx (FuncState* fs, OpCode o, int A, unsigned int Bx); -LUAI_FUNC int luaK_codeABC (FuncState* fs, OpCode o, int A, int B, int C); -LUAI_FUNC void luaK_fixline (FuncState* fs, int line); -LUAI_FUNC void luaK_nil (FuncState* fs, int from, int n); -LUAI_FUNC void luaK_reserveregs (FuncState* fs, int n); -LUAI_FUNC void luaK_checkstack (FuncState* fs, int n); -LUAI_FUNC int luaK_stringK (FuncState* fs, TString* s); -LUAI_FUNC int luaK_numberK (FuncState* fs, lua_Number r); -LUAI_FUNC void luaK_dischargevars (FuncState* fs, expdesc* e); -LUAI_FUNC int luaK_exp2anyreg (FuncState* fs, expdesc* e); -LUAI_FUNC void luaK_exp2nextreg (FuncState* fs, expdesc* e); -LUAI_FUNC void luaK_exp2val (FuncState* fs, expdesc* e); -LUAI_FUNC int luaK_exp2RK (FuncState* fs, expdesc* e); -LUAI_FUNC void luaK_self (FuncState* fs, expdesc* e, expdesc* key); -LUAI_FUNC void luaK_indexed (FuncState* fs, expdesc* t, expdesc* k); -LUAI_FUNC void luaK_goiftrue (FuncState* fs, expdesc* e); -LUAI_FUNC void luaK_storevar (FuncState* fs, expdesc* var, expdesc* e); -LUAI_FUNC void luaK_setreturns (FuncState* fs, expdesc* e, int nresults); -LUAI_FUNC void luaK_setoneret (FuncState* fs, expdesc* e); -LUAI_FUNC int luaK_jump (FuncState* fs); -LUAI_FUNC void luaK_ret (FuncState* fs, int first, int nret); -LUAI_FUNC void luaK_patchlist (FuncState* fs, int list, int target); -LUAI_FUNC void luaK_patchtohere (FuncState* fs, int list); -LUAI_FUNC void luaK_concat (FuncState* fs, int* l1, int l2); -LUAI_FUNC int luaK_getlabel (FuncState* fs); -LUAI_FUNC void luaK_prefix (FuncState* fs, UnOpr op, expdesc* v); -LUAI_FUNC void luaK_infix (FuncState* fs, BinOpr op, expdesc* v); -LUAI_FUNC void luaK_posfix (FuncState* fs, BinOpr op, expdesc* v1, expdesc* v2); -LUAI_FUNC void luaK_setlist (FuncState* fs, int base, int nelems, int tostore); - - -#endif diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/ldebug.h b/purenessscopeserver/example-Module/LuaTest/LuaBase/ldebug.h deleted file mode 100644 index 1dc02a4b4..000000000 --- a/purenessscopeserver/example-Module/LuaTest/LuaBase/ldebug.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -** $Id: ldebug.h,v 2.3.1.1 2007/12/27 13:02:25 roberto Exp $ -** Auxiliary functions from Debug Interface module -** See Copyright Notice in lua.h -*/ - -#ifndef ldebug_h -#define ldebug_h - - -#include "lstate.h" - - -#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) - -#define getline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0) - -#define resethookcount(L) (L->hookcount = L->basehookcount) - - -LUAI_FUNC void luaG_typeerror (lua_State* L, const TValue* o, - const char* opname); -LUAI_FUNC void luaG_concaterror (lua_State* L, StkId p1, StkId p2); -LUAI_FUNC void luaG_aritherror (lua_State* L, const TValue* p1, - const TValue* p2); -LUAI_FUNC int luaG_ordererror (lua_State* L, const TValue* p1, - const TValue* p2); -LUAI_FUNC void luaG_runerror (lua_State* L, const char* fmt, ...); -LUAI_FUNC void luaG_errormsg (lua_State* L); -LUAI_FUNC int luaG_checkcode (const Proto* pt); -LUAI_FUNC int luaG_checkopenop (Instruction i); - -#endif diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/lgc.h b/purenessscopeserver/example-Module/LuaTest/LuaBase/lgc.h deleted file mode 100644 index 2c576d5b8..000000000 --- a/purenessscopeserver/example-Module/LuaTest/LuaBase/lgc.h +++ /dev/null @@ -1,110 +0,0 @@ -/* -** $Id: lgc.h,v 2.15.1.1 2007/12/27 13:02:25 roberto Exp $ -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#ifndef lgc_h -#define lgc_h - - -#include "lobject.h" - - -/* -** Possible states of the Garbage Collector -*/ -#define GCSpause 0 -#define GCSpropagate 1 -#define GCSsweepstring 2 -#define GCSsweep 3 -#define GCSfinalize 4 - - -/* -** some userful bit tricks -*/ -#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) -#define setbits(x,m) ((x) |= (m)) -#define testbits(x,m) ((x) & (m)) -#define bitmask(b) (1<<(b)) -#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) -#define l_setbit(x,b) setbits(x, bitmask(b)) -#define resetbit(x,b) resetbits(x, bitmask(b)) -#define testbit(x,b) testbits(x, bitmask(b)) -#define set2bits(x,b1,b2) setbits(x, (bit2mask(b1, b2))) -#define reset2bits(x,b1,b2) resetbits(x, (bit2mask(b1, b2))) -#define test2bits(x,b1,b2) testbits(x, (bit2mask(b1, b2))) - - - -/* -** Layout for bit use in `marked' field: -** bit 0 - object is white (type 0) -** bit 1 - object is white (type 1) -** bit 2 - object is black -** bit 3 - for userdata: has been finalized -** bit 3 - for tables: has weak keys -** bit 4 - for tables: has weak values -** bit 5 - object is fixed (should not be collected) -** bit 6 - object is "super" fixed (only the main thread) -*/ - - -#define WHITE0BIT 0 -#define WHITE1BIT 1 -#define BLACKBIT 2 -#define FINALIZEDBIT 3 -#define KEYWEAKBIT 3 -#define VALUEWEAKBIT 4 -#define FIXEDBIT 5 -#define SFIXEDBIT 6 -#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) - - -#define iswhite(x) test2bits((x)->gch.marked, WHITE0BIT, WHITE1BIT) -#define isblack(x) testbit((x)->gch.marked, BLACKBIT) -#define isgray(x) (!isblack(x) && !iswhite(x)) - -#define otherwhite(g) (g->currentwhite ^ WHITEBITS) -#define isdead(g,v) ((v)->gch.marked & otherwhite(g) & WHITEBITS) - -#define changewhite(x) ((x)->gch.marked ^= WHITEBITS) -#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT) - -#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) - -#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) - - -#define luaC_checkGC(L) { \ - condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1)); \ - if (G(L)->totalbytes >= G(L)->GCthreshold) \ - luaC_step(L); } - - -#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \ - luaC_barrierf(L,obj2gco(p),gcvalue(v)); } - -#define luaC_barriert(L,t,v) { if (valiswhite(v) && isblack(obj2gco(t))) \ - luaC_barrierback(L,t); } - -#define luaC_objbarrier(L,p,o) \ - { if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \ - luaC_barrierf(L,obj2gco(p),obj2gco(o)); } - -#define luaC_objbarriert(L,t,o) \ - { if (iswhite(obj2gco(o)) && isblack(obj2gco(t))) luaC_barrierback(L,t); } - -LUAI_FUNC size_t luaC_separateudata (lua_State* L, int all); -LUAI_FUNC void luaC_callGCTM (lua_State* L); -LUAI_FUNC void luaC_freeall (lua_State* L); -LUAI_FUNC void luaC_step (lua_State* L); -LUAI_FUNC void luaC_fullgc (lua_State* L); -LUAI_FUNC void luaC_link (lua_State* L, GCObject* o, lu_byte tt); -LUAI_FUNC void luaC_linkupval (lua_State* L, UpVal* uv); -LUAI_FUNC void luaC_barrierf (lua_State* L, GCObject* o, GCObject* v); -LUAI_FUNC void luaC_barrierback (lua_State* L, Table* t); - - -#endif diff --git a/purenessscopeserver/example-Module/LuaTest/LuaBase/toluabind_default.h b/purenessscopeserver/example-Module/LuaTest/LuaBase/toluabind_default.h deleted file mode 100644 index c31a14875..000000000 --- a/purenessscopeserver/example-Module/LuaTest/LuaBase/toluabind_default.h +++ /dev/null @@ -1,8 +0,0 @@ -/* -** Lua binding: tolua -** Generated automatically by tolua++-1.0.8pre2 on Tue Dec 13 01:43:55 2005. -*/ - -/* Exported function */ -TOLUA_API int tolua_tolua_open (lua_State* tolua_S); - diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.cbp b/purenessscopeserver/example-Module/LuaTest/LuaTest.cbp new file mode 100644 index 000000000..c52fe561b --- /dev/null +++ b/purenessscopeserver/example-Module/LuaTest/LuaTest.cbp @@ -0,0 +1,48 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.depend b/purenessscopeserver/example-Module/LuaTest/LuaTest.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/LuaTest/LuaTest.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.exp b/purenessscopeserver/example-Module/LuaTest/LuaTest.exp new file mode 100644 index 000000000..6a2ff28be Binary files /dev/null and b/purenessscopeserver/example-Module/LuaTest/LuaTest.exp differ diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.layout b/purenessscopeserver/example-Module/LuaTest/LuaTest.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/LuaTest/LuaTest.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.lib b/purenessscopeserver/example-Module/LuaTest/LuaTest.lib new file mode 100644 index 000000000..e98478343 Binary files /dev/null and b/purenessscopeserver/example-Module/LuaTest/LuaTest.lib differ diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.mk b/purenessscopeserver/example-Module/LuaTest/LuaTest.mk new file mode 100644 index 000000000..0d82a0414 --- /dev/null +++ b/purenessscopeserver/example-Module/LuaTest/LuaTest.mk @@ -0,0 +1,403 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LuaTest +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LuaTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LuaTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)../../../ThirdLib/thirdparty/LuaLib/ $(IncludeSwitch)../../../ThirdLib/thirdparty/toluapp-master/include $(IncludeSwitch)../../../ThirdLib/thirdparty/LuaLib/ $(IncludeSwitch)../../../ThirdLib/include/Lua/ +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) $(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) \ + $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) \ + $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/LuaTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lgc.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lgc.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lgc.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lgc.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lgc.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lgc.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldblib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldblib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldblib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ldblib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldblib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ldblib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_event.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lobject.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lobject.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lobject.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lobject.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lobject.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lobject.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/liolib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/liolib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/liolib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/liolib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/liolib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/liolib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltablib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltablib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltablib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ltablib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltablib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ltablib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lauxlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_to.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldo.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldo.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldo.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ldo.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldo.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ldo.c + +$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(ObjectSuffix): ./LuaTest/BaseCommand.cpp $(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LuaTest/LuaTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(DependSuffix): ./LuaTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(DependSuffix) -MM ./LuaTest/BaseCommand.cpp + +$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(PreprocessSuffix): ./LuaTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(PreprocessSuffix) ./LuaTest/BaseCommand.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/loslib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/loslib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/loslib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/loslib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/loslib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/loslib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_is.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmem.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lmem.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmem.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lmem.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmem.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lmem.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/print.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/print.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/print.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/print.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/print.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/print.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lfunc.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lfunc.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lfunc.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lfunc.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lfunc.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lfunc.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lmathlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldump.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldump.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldump.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ldump.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldump.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ldump.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltable.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltable.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltable.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ltable.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltable.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ltable.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_push.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstrlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstate.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstate.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstate.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lstate.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstate.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lstate.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lapi.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lapi.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lapi.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lapi.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lapi.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lapi.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lzio.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lzio.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lzio.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lzio.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lzio.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lzio.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lbaselib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lvm.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lvm.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lvm.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lvm.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lvm.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lvm.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lopcodes.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltm.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ltm.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltm.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ltm.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltm.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ltm.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lparser.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lparser.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lparser.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lparser.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lparser.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lparser.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/loadlib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/loadlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/loadlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/loadlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/loadlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/loadlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstring.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lstring.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstring.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lstring.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstring.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lstring.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldebug.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/ldebug.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldebug.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ldebug.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldebug.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ldebug.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lcode.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lcode.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lcode.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lcode.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lcode.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lcode.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/llex.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/llex.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/llex.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/llex.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/llex.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/llex.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/tolua_map.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/linit.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/linit.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/linit.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/linit.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/linit.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/linit.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lundump.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/lundump.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lundump.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lundump.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lundump.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lundump.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/toluabind.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix) + $(CC) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/thirdparty/LuaLib/toluabind.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/toluabind.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/toluabind.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/toluabind.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/toluabind.c + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.mpc b/purenessscopeserver/example-Module/LuaTest/LuaTest.mpc deleted file mode 100644 index a43c56f10..000000000 --- a/purenessscopeserver/example-Module/LuaTest/LuaTest.mpc +++ /dev/null @@ -1,26 +0,0 @@ -project(LuaTest):acelib{ - sharedname=LuaTest - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . ../../Common ./LuaBase ./Lua - - libs += ./Lua/Lua -} diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.project b/purenessscopeserver/example-Module/LuaTest/LuaTest.project new file mode 100644 index 000000000..99fd04a6e --- /dev/null +++ b/purenessscopeserver/example-Module/LuaTest/LuaTest.project @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.txt b/purenessscopeserver/example-Module/LuaTest/LuaTest.txt new file mode 100644 index 000000000..992b404ba --- /dev/null +++ b/purenessscopeserver/example-Module/LuaTest/LuaTest.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c.o ../../../Build/Linux/Linux_Bin/Temp/LuaTest_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_print.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c.o diff --git a/purenessscopeserver/example-Module/LuaTest/BaseCommand.cpp b/purenessscopeserver/example-Module/LuaTest/LuaTest/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/BaseCommand.cpp rename to purenessscopeserver/example-Module/LuaTest/LuaTest/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/LuaTest/BaseCommand.h b/purenessscopeserver/example-Module/LuaTest/LuaTest/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/BaseCommand.h rename to purenessscopeserver/example-Module/LuaTest/LuaTest/BaseCommand.h diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTest.cpp b/purenessscopeserver/example-Module/LuaTest/LuaTest/LuaTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/LuaTest/LuaTest.cpp rename to purenessscopeserver/example-Module/LuaTest/LuaTest/LuaTest.cpp diff --git a/purenessscopeserver/example-Module/LuaTest/LuaTestd.exp b/purenessscopeserver/example-Module/LuaTest/LuaTestd.exp deleted file mode 100644 index b1681fd3b..000000000 Binary files a/purenessscopeserver/example-Module/LuaTest/LuaTestd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/LuaTest/Makefile b/purenessscopeserver/example-Module/LuaTest/Makefile index e64feed56..497a1494d 100644 --- a/purenessscopeserver/example-Module/LuaTest/Makefile +++ b/purenessscopeserver/example-Module/LuaTest/Makefile @@ -1,26 +1,403 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=LuaTest +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/LuaTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="LuaTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)../../../ThirdLib/thirdparty/LuaLib/ $(IncludeSwitch)../../../ThirdLib/thirdparty/toluapp-master/include $(IncludeSwitch)../../../ThirdLib/thirdparty/LuaLib/ $(IncludeSwitch)../../../ThirdLib/include/Lua/ +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o LuaTest.o ./Lua/LuaFn.o -LIB_BASE_OBJS = BaseCommand.o LuaTest.o LuaFn.o -LIB_BASE = libLuaTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) $(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(ObjectSuffix) \ + $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) \ + $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) \ + $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) -all: libLuaTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/LuaTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lgc.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lgc.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lgc.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lgc.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lgc.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lgc.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lgc.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldblib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/ldblib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldblib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ldblib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldblib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldblib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ldblib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/tolua_event.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_event.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_event.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lobject.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lobject.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lobject.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lobject.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lobject.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lobject.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lobject.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/liolib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/liolib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/liolib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/liolib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/liolib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_liolib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/liolib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltablib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/ltablib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltablib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ltablib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltablib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltablib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ltablib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lauxlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lauxlib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lauxlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/tolua_to.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_to.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_to.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldo.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/ldo.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldo.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ldo.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldo.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldo.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ldo.c + +$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(ObjectSuffix): ./LuaTest/BaseCommand.cpp $(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/LuaTest/LuaTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(DependSuffix): ./LuaTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(DependSuffix) -MM ./LuaTest/BaseCommand.cpp + +$(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(PreprocessSuffix): ./LuaTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/LuaTest_BaseCommand.cpp$(PreprocessSuffix) ./LuaTest/BaseCommand.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/loslib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/loslib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/loslib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/loslib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/loslib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loslib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/loslib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/tolua_is.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_is.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_is.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmem.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lmem.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmem.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lmem.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmem.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmem.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lmem.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/print.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/print.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/print.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/print.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/print.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_print.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/print.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lfunc.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lfunc.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lfunc.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lfunc.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lfunc.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lfunc.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lfunc.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lmathlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lmathlib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lmathlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldump.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/ldump.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldump.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ldump.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldump.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldump.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ldump.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltable.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/ltable.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltable.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ltable.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltable.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltable.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ltable.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/tolua_push.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_push.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_push.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lstrlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstrlib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lstrlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstate.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lstate.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstate.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lstate.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstate.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstate.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lstate.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lapi.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lapi.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lapi.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lapi.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lapi.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lapi.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lapi.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lzio.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lzio.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lzio.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lzio.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lzio.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lzio.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lzio.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lbaselib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lbaselib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lbaselib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lvm.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lvm.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lvm.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lvm.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lvm.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lvm.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lvm.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lopcodes.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lopcodes.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lopcodes.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltm.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/ltm.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltm.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ltm.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ltm.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ltm.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ltm.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lparser.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lparser.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lparser.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lparser.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lparser.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lparser.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lparser.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/loadlib.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/loadlib.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/loadlib.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/loadlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/loadlib.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_loadlib.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/loadlib.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstring.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lstring.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstring.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lstring.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lstring.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lstring.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lstring.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldebug.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/ldebug.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldebug.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/ldebug.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/ldebug.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_ldebug.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/ldebug.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lcode.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lcode.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lcode.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lcode.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lcode.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lcode.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lcode.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/llex.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/llex.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/llex.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/llex.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/llex.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_llex.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/llex.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/tolua_map.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_tolua_map.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/tolua_map.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/linit.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/linit.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/linit.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/linit.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/linit.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_linit.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/linit.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/lundump.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/lundump.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/lundump.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/lundump.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/lundump.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_lundump.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/lundump.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix): ../../../ThirdLib/thirdparty/LuaLib/toluabind.c $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix) + $(CC) $(SourceSwitch) "../../../ThirdLib/thirdparty/LuaLib/toluabind.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix): ../../../ThirdLib/thirdparty/LuaLib/toluabind.c + @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(DependSuffix) -MM ../../../ThirdLib/thirdparty/LuaLib/toluabind.c + +$(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(PreprocessSuffix): ../../../ThirdLib/thirdparty/LuaLib/toluabind.c + $(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_thirdparty_LuaLib_toluabind.c$(PreprocessSuffix) ../../../ThirdLib/thirdparty/LuaLib/toluabind.c + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libLuaTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/LuaTest/Makefile.define b/purenessscopeserver/example-Module/LuaTest/Makefile.define deleted file mode 100644 index 91b411aba..000000000 --- a/purenessscopeserver/example-Module/LuaTest/Makefile.define +++ /dev/null @@ -1,23 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -LDFLAGS=-Wl,-E -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -I./Lua -I./LuaTest -I/m2mjk/tools/tolua/include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L/m2mjk/tools/tolua/lib -L./ -L../ -lACE -lz -ldl -ltolua++ -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LuaTest/ToLua_Linux_Make.txt b/purenessscopeserver/example-Module/LuaTest/ToLua_Linux_Make.txt deleted file mode 100644 index 0f860ad00..000000000 --- a/purenessscopeserver/example-Module/LuaTest/ToLua_Linux_Make.txt +++ /dev/null @@ -1,34 +0,0 @@ -tolua++luaϵһģԣ밲װtolua++򵥵ķʽ: -1ѹlua-5.1.4.tar.gz -tar xvzf lua-5.1.4.tar.gz -2lua -cd lua-5.1.4.tar.gz -make linux -3ѹtolua++-1.0.93.tar.bz2 -tar xvjf tolua++-1.0.93.tar.bz2 -4sconsװַhttp://www.scons.org/download.php - linuxʹwget http://prdownloads.sourceforge.net/scons/scons-2.3.2-1.noarch.rpm -rpm -ihv scons-2.3.2-1.noarch.rpm - -python setup.py install - -5밲װtolua++ -wget http://www.codenix.com/~tolua/tolua++-1.0.93.tar.bz2 -tar xvjf tolua++-1.0.93.tar.bz2 -cd tolua++-1.0.93 -cp custom-5.1.py custom.py -vim custom.py޸£ -CCFLAGS = ['-I/home/jackcy/Tools/lua-5.1.4/src', '-O2', '-ansi'] עǴдi -ע⣬64λlinux Ӧøд -CCFLAGS = ['-I/home/jackcy/Tools/lua-5.1.4/src', '-O2', '-ansi', '-fPIC'] עǴдi -LIBPATH = ['/home/jackcy/Tools/lua-5.1.4/src'] -LIBS = ['lua', 'dl', 'm'] -prefix = '/mingw' -#build_dev=1 -tolua_bin = 'tolua++5.1' -tolua_lib = 'tolua++5.1' -TOLUAPP = 'tolua++5.1' -6toluabind_default.cļ -cp src/bin/toluabind_default.c src/bin/toluabind.c -7scons: -scons all \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LuaTest/runlinuxmake.sh b/purenessscopeserver/example-Module/LuaTest/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/LuaTest/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/LuaTest/zzz.bat b/purenessscopeserver/example-Module/LuaTest/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/LuaTest/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/MonitorServer/CMakeLists.txt b/purenessscopeserver/example-Module/MonitorServer/CMakeLists.txt new file mode 100644 index 000000000..76e9c0e6a --- /dev/null +++ b/purenessscopeserver/example-Module/MonitorServer/CMakeLists.txt @@ -0,0 +1,93 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(MonitorServer) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_MonitorServer_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + ../../../ThirdLib/include/EncodeConvert + ../../../ThirdLib/include/TinyXML + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./MonitorServer/DataManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/./MonitorServer/MonitorServer.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/TinyXML/tinyxml.cpp + ${CMAKE_CURRENT_LIST_DIR}/./MonitorServer/TimeEvent.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/TinyXML/tinystr.cpp + ${CMAKE_CURRENT_LIST_DIR}/./MonitorServer/MonitorCommand.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(MonitorServer SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(MonitorServer ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/MonitorServer/Makefile b/purenessscopeserver/example-Module/MonitorServer/Makefile new file mode 100644 index 000000000..ad96055e9 --- /dev/null +++ b/purenessscopeserver/example-Module/MonitorServer/Makefile @@ -0,0 +1,176 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=MonitorServer +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/MonitorServer +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="MonitorServer.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)../../../ThirdLib/include/EncodeConvert $(IncludeSwitch)../../../ThirdLib/include/TinyXML +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/MonitorServer" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(ObjectSuffix): ./MonitorServer/DataManager.cpp $(IntermediateDirectory)/MonitorServer_DataManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./MonitorServer/DataManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(DependSuffix): ./MonitorServer/DataManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(DependSuffix) -MM ./MonitorServer/DataManager.cpp + +$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(PreprocessSuffix): ./MonitorServer/DataManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/MonitorServer_DataManager.cpp$(PreprocessSuffix) ./MonitorServer/DataManager.cpp + +$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(ObjectSuffix): ./MonitorServer/MonitorServer.cpp $(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./MonitorServer/MonitorServer.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(DependSuffix): ./MonitorServer/MonitorServer.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(DependSuffix) -MM ./MonitorServer/MonitorServer.cpp + +$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(PreprocessSuffix): ./MonitorServer/MonitorServer.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(PreprocessSuffix) ./MonitorServer/MonitorServer.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(ObjectSuffix): ./MonitorServer/TimeEvent.cpp $(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./MonitorServer/TimeEvent.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(DependSuffix): ./MonitorServer/TimeEvent.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(DependSuffix) -MM ./MonitorServer/TimeEvent.cpp + +$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(PreprocessSuffix): ./MonitorServer/TimeEvent.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(PreprocessSuffix) ./MonitorServer/TimeEvent.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(ObjectSuffix): ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(DependSuffix): ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(DependSuffix) -MM ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(PreprocessSuffix): ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(PreprocessSuffix) ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(ObjectSuffix): ./MonitorServer/MonitorCommand.cpp $(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./MonitorServer/MonitorCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(DependSuffix): ./MonitorServer/MonitorCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(DependSuffix) -MM ./MonitorServer/MonitorCommand.cpp + +$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(PreprocessSuffix): ./MonitorServer/MonitorCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(PreprocessSuffix) ./MonitorServer/MonitorCommand.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.cbp b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.cbp new file mode 100644 index 000000000..57c827164 --- /dev/null +++ b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.cbp @@ -0,0 +1,52 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.depend b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.exp b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.exp new file mode 100644 index 000000000..b07943bbe Binary files /dev/null and b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.exp differ diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.layout b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.layout new file mode 100644 index 000000000..f43e1ef8e --- /dev/null +++ b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.lib b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.lib new file mode 100644 index 000000000..1142cc8d5 Binary files /dev/null and b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.lib differ diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.mk b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.mk new file mode 100644 index 000000000..c858b5892 --- /dev/null +++ b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.mk @@ -0,0 +1,176 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=MonitorServer +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MonitorServer +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="MonitorServer.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)../../../ThirdLib/include/EncodeConvert $(IncludeSwitch)../../../ThirdLib/include/TinyXML +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(ObjectSuffix) $(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/MonitorServer" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(ObjectSuffix): ./MonitorServer/DataManager.cpp $(IntermediateDirectory)/MonitorServer_DataManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MonitorServer/MonitorServer/DataManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(DependSuffix): ./MonitorServer/DataManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(DependSuffix) -MM ./MonitorServer/DataManager.cpp + +$(IntermediateDirectory)/MonitorServer_DataManager.cpp$(PreprocessSuffix): ./MonitorServer/DataManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/MonitorServer_DataManager.cpp$(PreprocessSuffix) ./MonitorServer/DataManager.cpp + +$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(ObjectSuffix): ./MonitorServer/MonitorServer.cpp $(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MonitorServer/MonitorServer/MonitorServer.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(DependSuffix): ./MonitorServer/MonitorServer.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(DependSuffix) -MM ./MonitorServer/MonitorServer.cpp + +$(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(PreprocessSuffix): ./MonitorServer/MonitorServer.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/MonitorServer_MonitorServer.cpp$(PreprocessSuffix) ./MonitorServer/MonitorServer.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(ObjectSuffix): ./MonitorServer/TimeEvent.cpp $(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MonitorServer/MonitorServer/TimeEvent.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(DependSuffix): ./MonitorServer/TimeEvent.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(DependSuffix) -MM ./MonitorServer/TimeEvent.cpp + +$(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(PreprocessSuffix): ./MonitorServer/TimeEvent.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/MonitorServer_TimeEvent.cpp$(PreprocessSuffix) ./MonitorServer/TimeEvent.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(ObjectSuffix): ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(DependSuffix): ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(DependSuffix) -MM ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(PreprocessSuffix): ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp$(PreprocessSuffix) ../../../ThirdLib/include/EncodeConvert/GBKtoUTF8.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(ObjectSuffix): ./MonitorServer/MonitorCommand.cpp $(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MonitorServer/MonitorServer/MonitorCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(DependSuffix): ./MonitorServer/MonitorCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(DependSuffix) -MM ./MonitorServer/MonitorCommand.cpp + +$(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(PreprocessSuffix): ./MonitorServer/MonitorCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/MonitorServer_MonitorCommand.cpp$(PreprocessSuffix) ./MonitorServer/MonitorCommand.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.mpc b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.mpc deleted file mode 100644 index 013e496f3..000000000 --- a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.mpc +++ /dev/null @@ -1,23 +0,0 @@ -project(Monitor):acelib{ - sharedname=MonitorServer - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ./TinyXML/*.cpp - ./EncodeConvert/*.cpp - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common ./TinyXML ./EncodeConvert -} diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.project b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.project new file mode 100644 index 000000000..7194a4ab0 --- /dev/null +++ b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.project @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.sln b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.sln deleted file mode 100644 index 3e121bb13..000000000 --- a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.sln +++ /dev/null @@ -1,33 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -# $Id: VC12WorkspaceCreator.pm 2211 2014-06-26 18:11:09Z elliott_c $ -# -# This file was generated by MPC. Any changes made directly to -# this file will be lost the next time it is generated. -# -# MPC Command: -# C:\Tools\ACE-6.3.0\ACE_wrappers\bin\mwc.pl -type vc12 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MonitorServer", "MonitorServer.vcxproj", "{5B2CB44B-FECA-1BAD-E280-C1FB0000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5B2CB44B-FECA-1BAD-E280-C1FB0000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {5B2CB44B-FECA-1BAD-E280-C1FB0000002E}.Debug|Win32.Build.0 = Debug|Win32 - {5B2CB44B-FECA-1BAD-E280-C1FB0000002E}.Debug|x64.ActiveCfg = Debug|x64 - {5B2CB44B-FECA-1BAD-E280-C1FB0000002E}.Debug|x64.Build.0 = Debug|x64 - {5B2CB44B-FECA-1BAD-E280-C1FB0000002E}.Release|Win32.ActiveCfg = Release|Win32 - {5B2CB44B-FECA-1BAD-E280-C1FB0000002E}.Release|Win32.Build.0 = Release|Win32 - {5B2CB44B-FECA-1BAD-E280-C1FB0000002E}.Release|x64.ActiveCfg = Release|x64 - {5B2CB44B-FECA-1BAD-E280-C1FB0000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.txt b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.txt new file mode 100644 index 000000000..df15a9e2d --- /dev/null +++ b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/MonitorServer_DataManager.cpp.o ../../../Build/Linux/Linux_Bin/Temp/MonitorServer_MonitorServer.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp.o ../../../Build/Linux/Linux_Bin/Temp/MonitorServer_TimeEvent.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_EncodeConvert_GBKtoUTF8.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp.o ../../../Build/Linux/Linux_Bin/Temp/MonitorServer_MonitorCommand.cpp.o diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.vcxproj b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.vcxproj index 1fe7948d6..c34b50eb0 100644 --- a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.vcxproj +++ b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -23,32 +23,33 @@ {5B2CB44B-FECA-1BAD-E280-C1FB0000002E} MonitorServer Win32Proj + 10.0.17763.0 DynamicLibrary true NotSet - v140 + v141 DynamicLibrary false NotSet - v140 + v141 true DynamicLibrary true NotSet - v140 + v141 DynamicLibrary false NotSet - v140 + v141 true @@ -69,7 +70,7 @@ <_ProjectFileVersion>10.0.30319.1 - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\MonitorServer\I386\ true MonitorServerd @@ -89,7 +90,7 @@ AllRules.ruleset - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\MonitorServer\AMD64\ true MonitorServerd @@ -99,8 +100,8 @@ AllRules.ruleset - ..\..\PurenessScopeServer\Windows_Bin\ - Release\MonitorServer\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false MonitorServer @@ -250,7 +251,7 @@ MaxSpeed true - $(ACE_ROOT);.;..\..\Common;.\TinyXML;.\EncodeConvert;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);../../../ThirdLib/include/EncodeConvert;../../../ThirdLib/include/TinyXML;%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -285,36 +286,26 @@ --> + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + - - - true - true - true - true - + diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.vcxproj.filters b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.vcxproj.filters index 38f92e72a..f7f0ac68b 100644 --- a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.vcxproj.filters +++ b/purenessscopeserver/example-Module/MonitorServer/MonitorServer.vcxproj.filters @@ -1,52 +1,51 @@  - - - - - TinyXML + + {11e3eb0f-c5f8-4382-a7fc-95d5970a5fb3} + + + {58ba57ac-ad58-4965-a6f8-f6eb60d5cdf8} + + + + + EncodeConvert - + TinyXML - + TinyXML - + TinyXML - - - EncodeConvert + + TinyXML + + + + - - - - TinyXML + + EncodeConvert - + TinyXML - - - EncodeConvert + + TinyXML + + + - - + EncodeConvert - - - {cdc3e448-8ea0-4069-a816-3eae52025661} - - - {a2c82fb4-6817-414e-a33f-a6ed8f27c26e} - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/MonitorServer/DataManager.cpp b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/DataManager.cpp similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/DataManager.cpp rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/DataManager.cpp diff --git a/purenessscopeserver/example-Module/MonitorServer/DataManager.h b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/DataManager.h similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/DataManager.h rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/DataManager.h diff --git a/purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/Index.html b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/Index.html similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/Index.html rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/Index.html diff --git a/purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/detail/test-01.html b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/detail/test-01.html similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/detail/test-01.html rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/detail/test-01.html diff --git a/purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/json/test-01_connect.json b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/json/test-01_connect.json similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/json/test-01_connect.json rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/json/test-01_connect.json diff --git a/purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/json/test-01_cpu.json b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/json/test-01_cpu.json similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/json/test-01_cpu.json rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/json/test-01_cpu.json diff --git a/purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/json/test-01_flow.json b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/json/test-01_flow.json similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/json/test-01_flow.json rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/json/test-01_flow.json diff --git a/purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/json/test-01_memory.json b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/json/test-01_memory.json similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/HtmlTemplate/json/test-01_memory.json rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/HtmlTemplate/json/test-01_memory.json diff --git a/purenessscopeserver/example-Module/MonitorServer/Monitor.xml b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/Monitor.xml similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/Monitor.xml rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/Monitor.xml diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorCommand.cpp b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/MonitorCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/MonitorCommand.cpp rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/MonitorCommand.cpp diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorCommand.h b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/MonitorCommand.h similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/MonitorCommand.h rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/MonitorCommand.h diff --git a/purenessscopeserver/example-Module/MonitorServer/MonitorServer.cpp b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/MonitorServer.cpp similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/MonitorServer.cpp rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/MonitorServer.cpp diff --git a/purenessscopeserver/example-Module/MonitorServer/TimeEvent.cpp b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/TimeEvent.cpp similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/TimeEvent.cpp rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/TimeEvent.cpp diff --git a/purenessscopeserver/example-Module/MonitorServer/TimeEvent.h b/purenessscopeserver/example-Module/MonitorServer/MonitorServer/TimeEvent.h similarity index 100% rename from purenessscopeserver/example-Module/MonitorServer/TimeEvent.h rename to purenessscopeserver/example-Module/MonitorServer/MonitorServer/TimeEvent.h diff --git a/purenessscopeserver/example-Module/MonitorServer/TinyXML/tinyxml.cpp b/purenessscopeserver/example-Module/MonitorServer/TinyXML/tinyxml.cpp deleted file mode 100644 index a25ca5c8a..000000000 --- a/purenessscopeserver/example-Module/MonitorServer/TinyXML/tinyxml.cpp +++ /dev/null @@ -1,2238 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#include - -#ifdef TIXML_USE_STL -#include -#include -#endif - -#include "tinyxml.h" - -FILE* TiXmlFOpen( const char* filename, const char* mode ); - -bool TiXmlBase::condenseWhiteSpace = true; - -// Microsoft compiler security -FILE* TiXmlFOpen( const char* filename, const char* mode ) -{ -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - FILE* fp = 0; - errno_t err = fopen_s( &fp, filename, mode ); - - if ( !err && fp ) - { - return fp; - } - - return 0; -#else - return fopen( filename, mode ); -#endif -} - -void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) -{ - int i=0; - - while( i<(int)str.length() ) - { - unsigned char c = (unsigned char) str[i]; - - if ( c == '&' - && i < ( (int)str.length() - 2 ) - && str[i+1] == '#' - && str[i+2] == 'x' ) - { - // Hexadecimal character reference. - // Pass through unchanged. - // © -- copyright symbol, for example. - // - // The -1 is a bug fix from Rob Laveaux. It keeps - // an overflow from happening if there is no ';'. - // There are actually 2 ways to exit this loop - - // while fails (error case) and break (semicolon found). - // However, there is no mechanism (currently) for - // this function to return an error. - while ( i<(int)str.length()-1 ) - { - outString->append( str.c_str() + i, 1 ); - ++i; - - if ( str[i] == ';' ) - { - break; - } - } - } - else if ( c == '&' ) - { - outString->append( entity[0].str, entity[0].strLength ); - ++i; - } - else if ( c == '<' ) - { - outString->append( entity[1].str, entity[1].strLength ); - ++i; - } - else if ( c == '>' ) - { - outString->append( entity[2].str, entity[2].strLength ); - ++i; - } - else if ( c == '\"' ) - { - outString->append( entity[3].str, entity[3].strLength ); - ++i; - } - else if ( c == '\'' ) - { - outString->append( entity[4].str, entity[4].strLength ); - ++i; - } - else if ( c < 32 ) - { - // Easy pass at non-alpha/numeric/symbol - // Below 32 is symbolic. - char buf[ 32 ]; - -#if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); -#else - sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); -#endif - - //*ME: warning C4267: convert 'size_t' to 'int' - //*ME: Int-Cast to make compiler happy ... - outString->append( buf, (int)strlen( buf ) ); - ++i; - } - else - { - //char realc = (char) c; - //outString->append( &realc, 1 ); - *outString += (char) c; // somewhat more efficient function call. - ++i; - } - } -} - - -TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() -{ - parent = 0; - type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; -} - - -TiXmlNode::~TiXmlNode() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } -} - - -void TiXmlNode::CopyTo( TiXmlNode* target ) const -{ - target->SetValue (value.c_str() ); - target->userData = userData; - target->location = location; -} - - -void TiXmlNode::Clear() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } - - firstChild = 0; - lastChild = 0; -} - - -TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) -{ - assert( node->parent == 0 || node->parent == this ); - assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); - - if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - delete node; - - if ( GetDocument() ) - { - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } - - return 0; - } - - node->parent = this; - - node->prev = lastChild; - node->next = 0; - - if ( lastChild ) - { - lastChild->next = node; - } - else - { - firstChild = node; // it was an empty list. - } - - lastChild = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) -{ - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - { - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } - - return 0; - } - - TiXmlNode* node = addThis.Clone(); - - if ( !node ) - { - return 0; - } - - return LinkEndChild( node ); -} - - -TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) -{ - if ( !beforeThis || beforeThis->parent != this ) - { - return 0; - } - - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - { - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } - - return 0; - } - - TiXmlNode* node = addThis.Clone(); - - if ( !node ) - { - return 0; - } - - node->parent = this; - - node->next = beforeThis; - node->prev = beforeThis->prev; - - if ( beforeThis->prev ) - { - beforeThis->prev->next = node; - } - else - { - assert( firstChild == beforeThis ); - firstChild = node; - } - - beforeThis->prev = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) -{ - if ( !afterThis || afterThis->parent != this ) - { - return 0; - } - - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - { - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } - - return 0; - } - - TiXmlNode* node = addThis.Clone(); - - if ( !node ) - { - return 0; - } - - node->parent = this; - - node->prev = afterThis; - node->next = afterThis->next; - - if ( afterThis->next ) - { - afterThis->next->prev = node; - } - else - { - assert( lastChild == afterThis ); - lastChild = node; - } - - afterThis->next = node; - return node; -} - - -TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) -{ - if ( !replaceThis ) - { - return 0; - } - - if ( replaceThis->parent != this ) - { - return 0; - } - - if ( withThis.ToDocument() ) - { - // A document can never be a child. Thanks to Noam. - TiXmlDocument* document = GetDocument(); - - if ( document ) - { - document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - } - - return 0; - } - - TiXmlNode* node = withThis.Clone(); - - if ( !node ) - { - return 0; - } - - node->next = replaceThis->next; - node->prev = replaceThis->prev; - - if ( replaceThis->next ) - { - replaceThis->next->prev = node; - } - else - { - lastChild = node; - } - - if ( replaceThis->prev ) - { - replaceThis->prev->next = node; - } - else - { - firstChild = node; - } - - delete replaceThis; - node->parent = this; - return node; -} - - -bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) -{ - if ( !removeThis ) - { - return false; - } - - if ( removeThis->parent != this ) - { - assert( 0 ); - return false; - } - - if ( removeThis->next ) - { - removeThis->next->prev = removeThis->prev; - } - else - { - lastChild = removeThis->prev; - } - - if ( removeThis->prev ) - { - removeThis->prev->next = removeThis->next; - } - else - { - firstChild = removeThis->next; - } - - delete removeThis; - return true; -} - -const TiXmlNode* TiXmlNode::FirstChild( const char* _value ) const -{ - const TiXmlNode* node; - - for ( node = firstChild; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - { - return node; - } - } - - return 0; -} - - -const TiXmlNode* TiXmlNode::LastChild( const char* _value ) const -{ - const TiXmlNode* node; - - for ( node = lastChild; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - { - return node; - } - } - - return 0; -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild(); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling(); - } -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const char* val, const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild( val ); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling( val ); - } -} - - -const TiXmlNode* TiXmlNode::NextSibling( const char* _value ) const -{ - const TiXmlNode* node; - - for ( node = next; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - { - return node; - } - } - - return 0; -} - - -const TiXmlNode* TiXmlNode::PreviousSibling( const char* _value ) const -{ - const TiXmlNode* node; - - for ( node = prev; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - { - return node; - } - } - - return 0; -} - - -void TiXmlElement::RemoveAttribute( const char* name ) -{ -#ifdef TIXML_USE_STL - TIXML_STRING str( name ); - TiXmlAttribute* node = attributeSet.Find( str ); -#else - TiXmlAttribute* node = attributeSet.Find( name ); -#endif - - if ( node ) - { - attributeSet.Remove( node ); - delete node; - } -} - -const TiXmlElement* TiXmlNode::FirstChildElement() const -{ - const TiXmlNode* node; - - for ( node = FirstChild(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - { - return node->ToElement(); - } - } - - return 0; -} - - -const TiXmlElement* TiXmlNode::FirstChildElement( const char* _value ) const -{ - const TiXmlNode* node; - - for ( node = FirstChild( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - { - return node->ToElement(); - } - } - - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement() const -{ - const TiXmlNode* node; - - for ( node = NextSibling(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - { - return node->ToElement(); - } - } - - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement( const char* _value ) const -{ - const TiXmlNode* node; - - for ( node = NextSibling( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - { - return node->ToElement(); - } - } - - return 0; -} - - -const TiXmlDocument* TiXmlNode::GetDocument() const -{ - const TiXmlNode* node; - - for( node = this; node; node = node->parent ) - { - if ( node->ToDocument() ) - { - return node->ToDocument(); - } - } - - return 0; -} - - -TiXmlElement::TiXmlElement (const char* _value) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} - - -#ifdef TIXML_USE_STL -TiXmlElement::TiXmlElement( const std::string& _value ) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} -#endif - - -TiXmlElement::TiXmlElement( const TiXmlElement& copy) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - copy.CopyTo( this ); -} - - -TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base ) -{ - ClearThis(); - base.CopyTo( this ); - return *this; -} - - -TiXmlElement::~TiXmlElement() -{ - ClearThis(); -} - - -void TiXmlElement::ClearThis() -{ - Clear(); - - while( attributeSet.First() ) - { - TiXmlAttribute* node = attributeSet.First(); - attributeSet.Remove( node ); - delete node; - } -} - - -const char* TiXmlElement::Attribute( const char* name ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - - if ( node ) - { - return node->Value(); - } - - return 0; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - - if ( attrib ) - { - return &attrib->ValueStr(); - } - - return 0; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) - { - result = attrib->Value(); - - if ( i ) - { - attrib->QueryIntValue( i ); - } - } - - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) - { - result = &attrib->ValueStr(); - - if ( i ) - { - attrib->QueryIntValue( i ); - } - } - - return result; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) - { - result = attrib->Value(); - - if ( d ) - { - attrib->QueryDoubleValue( d ); - } - } - - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) - { - result = &attrib->ValueStr(); - - if ( d ) - { - attrib->QueryDoubleValue( d ); - } - } - - return result; -} -#endif - - -int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - - if ( !attrib ) - { - return TIXML_NO_ATTRIBUTE; - } - - return attrib->QueryIntValue( ival ); -} - - -int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - - if ( !node ) - { - return TIXML_NO_ATTRIBUTE; - } - - int ival = 0; - int result = node->QueryIntValue( &ival ); - *value = (unsigned)ival; - return result; -} - - -int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - - if ( !node ) - { - return TIXML_NO_ATTRIBUTE; - } - - int result = TIXML_WRONG_TYPE; - - if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = true; - result = TIXML_SUCCESS; - } - else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = false; - result = TIXML_SUCCESS; - } - - return result; -} - - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - - if ( !attrib ) - { - return TIXML_NO_ATTRIBUTE; - } - - return attrib->QueryIntValue( ival ); -} -#endif - - -int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - - if ( !attrib ) - { - return TIXML_NO_ATTRIBUTE; - } - - return attrib->QueryDoubleValue( dval ); -} - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - - if ( !attrib ) - { - return TIXML_NO_ATTRIBUTE; - } - - return attrib->QueryDoubleValue( dval ); -} -#endif - - -void TiXmlElement::SetAttribute( const char* name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - - if ( attrib ) - { - attrib->SetIntValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - - if ( attrib ) - { - attrib->SetIntValue( val ); - } -} -#endif - - -void TiXmlElement::SetDoubleAttribute( const char* name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - - if ( attrib ) - { - attrib->SetDoubleValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - - if ( attrib ) - { - attrib->SetDoubleValue( val ); - } -} -#endif - - -void TiXmlElement::SetAttribute( const char* cname, const char* cvalue ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); - - if ( attrib ) - { - attrib->SetValue( cvalue ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name ); - - if ( attrib ) - { - attrib->SetValue( _value ); - } -} -#endif - - -void TiXmlElement::Print( FILE* cfile, int depth ) const -{ - int i; - assert( cfile ); - - for ( i=0; iNext() ) - { - fprintf( cfile, " " ); - attrib->Print( cfile, depth ); - } - - // There are 3 different formatting approaches: - // 1) An element without children is printed as a node - // 2) An element with only a text child is printed as text - // 3) An element with children is printed on multiple lines. - TiXmlNode* node; - - if ( !firstChild ) - { - fprintf( cfile, " />" ); - } - else if ( firstChild == lastChild && firstChild->ToText() ) - { - fprintf( cfile, ">" ); - firstChild->Print( cfile, depth + 1 ); - fprintf( cfile, "", value.c_str() ); - } - else - { - fprintf( cfile, ">" ); - - for ( node = firstChild; node; node=node->NextSibling() ) - { - if ( !node->ToText() ) - { - fprintf( cfile, "\n" ); - } - - node->Print( cfile, depth+1 ); - } - - fprintf( cfile, "\n" ); - - for( i=0; i", value.c_str() ); - } -} - - -void TiXmlElement::CopyTo( TiXmlElement* target ) const -{ - // superclass: - TiXmlNode::CopyTo( target ); - - // Element class: - // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; - - for( attribute = attributeSet.First(); - attribute; - attribute = attribute->Next() ) - { - target->SetAttribute( attribute->Name(), attribute->Value() ); - } - - TiXmlNode* node = 0; - - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - -bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this, attributeSet.First() ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - { - break; - } - } - } - - return visitor->VisitExit( *this ); -} - - -TiXmlNode* TiXmlElement::Clone() const -{ - TiXmlElement* clone = new TiXmlElement( Value() ); - - if ( !clone ) - { - return 0; - } - - CopyTo( clone ); - return clone; -} - - -const char* TiXmlElement::GetText() const -{ - const TiXmlNode* child = this->FirstChild(); - - if ( child ) - { - const TiXmlText* childText = child->ToText(); - - if ( childText ) - { - return childText->Value(); - } - } - - return 0; -} - - -TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - ClearError(); -} - -TiXmlDocument::TiXmlDocument( const char* documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} - - -#ifdef TIXML_USE_STL -TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} -#endif - - -TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) -{ - return LoadFile( Value(), encoding ); -} - - -bool TiXmlDocument::SaveFile() const -{ - return SaveFile( Value() ); -} - -bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) -{ - TIXML_STRING filename( _filename ); - value = filename; - - // reading in binary mode so that tinyxml can normalize the EOL - FILE* file = TiXmlFOpen( value.c_str (), "rb" ); - - if ( file ) - { - bool result = LoadFile( file, encoding ); - fclose( file ); - return result; - } - else - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } -} - -bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) -{ - if ( !file ) - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Delete the existing data: - Clear(); - location.Clear(); - - // Get the file size, so we can pre-allocate the string. HUGE speed impact. - long length = 0; - fseek( file, 0, SEEK_END ); - length = ftell( file ); - fseek( file, 0, SEEK_SET ); - - // Strange case, but good to handle up front. - if ( length <= 0 ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Subtle bug here. TinyXml did use fgets. But from the XML spec: - // 2.11 End-of-Line Handling - // - // - // ...the XML processor MUST behave as if it normalized all line breaks in external - // parsed entities (including the document entity) on input, before parsing, by translating - // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to - // a single #xA character. - // - // - // It is not clear fgets does that, and certainly isn't clear it works cross platform. - // Generally, you expect fgets to translate from the convention of the OS to the c/unix - // convention, and not work generally. - - /* - while( fgets( buf, sizeof(buf), file ) ) - { - data += buf; - } - */ - - char* buf = new char[ length+1 ]; - buf[0] = 0; - - if ( fread( buf, length, 1, file ) != 1 ) - { - delete [] buf; - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Process the buffer in place to normalize new lines. (See comment above.) - // Copies from the 'p' to 'q' pointer, where p can advance faster if - // a newline-carriage return is hit. - // - // Wikipedia: - // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or - // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... - // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others - // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS - // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 - - const char* p = buf; // the read head - char* q = buf; // the write head - const char CR = 0x0d; - const char LF = 0x0a; - - buf[length] = 0; - - while( *p ) - { - assert( p < (buf+length) ); - assert( q <= (buf+length) ); - assert( q <= p ); - - if ( *p == CR ) - { - *q++ = LF; - p++; - - if ( *p == LF ) // check for CR+LF (and skip LF) - { - p++; - } - } - else - { - *q++ = *p++; - } - } - - assert( q <= (buf+length) ); - *q = 0; - - Parse( buf, 0, encoding ); - - delete [] buf; - return !Error(); -} - - -bool TiXmlDocument::SaveFile( const char* filename ) const -{ - // The old c stuff lives on... - FILE* fp = TiXmlFOpen( filename, "w" ); - - if ( fp ) - { - bool result = SaveFile( fp ); - fclose( fp ); - return result; - } - - return false; -} - - -bool TiXmlDocument::SaveFile( FILE* fp ) const -{ - if ( useMicrosoftBOM ) - { - const unsigned char TIXML_UTF_LEAD_0 = 0xefU; - const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; - const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - - fputc( TIXML_UTF_LEAD_0, fp ); - fputc( TIXML_UTF_LEAD_1, fp ); - fputc( TIXML_UTF_LEAD_2, fp ); - } - - Print( fp, 0 ); - return (ferror(fp) == 0); -} - - -void TiXmlDocument::CopyTo( TiXmlDocument* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->error = error; - target->errorId = errorId; - target->errorDesc = errorDesc; - target->tabsize = tabsize; - target->errorLocation = errorLocation; - target->useMicrosoftBOM = useMicrosoftBOM; - - TiXmlNode* node = 0; - - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - - -TiXmlNode* TiXmlDocument::Clone() const -{ - TiXmlDocument* clone = new TiXmlDocument(); - - if ( !clone ) - { - return 0; - } - - CopyTo( clone ); - return clone; -} - - -void TiXmlDocument::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - node->Print( cfile, depth ); - fprintf( cfile, "\n" ); - } -} - - -bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - { - break; - } - } - } - - return visitor->VisitExit( *this ); -} - - -const TiXmlAttribute* TiXmlAttribute::Next() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - { - return 0; - } - - return next; -} - -/* -TiXmlAttribute* TiXmlAttribute::Next() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} -*/ - -const TiXmlAttribute* TiXmlAttribute::Previous() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - { - return 0; - } - - return prev; -} - -/* -TiXmlAttribute* TiXmlAttribute::Previous() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} -*/ - -void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - TIXML_STRING n, v; - - EncodeString( name, &n ); - EncodeString( value, &v ); - - if (value.find ('\"') == TIXML_STRING::npos) - { - if ( cfile ) - { - fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); - } - - if ( str ) - { - (*str) += n; - (*str) += "=\""; - (*str) += v; - (*str) += "\""; - } - } - else - { - if ( cfile ) - { - fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); - } - - if ( str ) - { - (*str) += n; - (*str) += "='"; - (*str) += v; - (*str) += "'"; - } - } -} - - -int TiXmlAttribute::QueryIntValue( int* ival ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) - { - return TIXML_SUCCESS; - } - - return TIXML_WRONG_TYPE; -} - -int TiXmlAttribute::QueryDoubleValue( double* dval ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) - { - return TIXML_SUCCESS; - } - - return TIXML_WRONG_TYPE; -} - -void TiXmlAttribute::SetIntValue( int _value ) -{ - char buf [64]; -#if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); -#else - sprintf (buf, "%d", _value); -#endif - SetValue (buf); -} - -void TiXmlAttribute::SetDoubleValue( double _value ) -{ - char buf [256]; -#if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); -#else - sprintf (buf, "%g", _value); -#endif - SetValue (buf); -} - -int TiXmlAttribute::IntValue() const -{ - return atoi (value.c_str ()); -} - -double TiXmlAttribute::DoubleValue() const -{ - return atof (value.c_str ()); -} - - -TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base ) -{ - Clear(); - base.CopyTo( this ); - return *this; -} - - -void TiXmlComment::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlComment::CopyTo( TiXmlComment* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlComment::Clone() const -{ - TiXmlComment* clone = new TiXmlComment(); - - if ( !clone ) - { - return 0; - } - - CopyTo( clone ); - return clone; -} - - -void TiXmlText::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - - if ( cdata ) - { - int i; - fprintf( cfile, "\n" ); - - for ( i=0; i\n", value.c_str() ); // unformatted output - } - else - { - TIXML_STRING buffer; - EncodeString( value, &buffer ); - fprintf( cfile, "%s", buffer.c_str() ); - } -} - - -void TiXmlText::CopyTo( TiXmlText* target ) const -{ - TiXmlNode::CopyTo( target ); - target->cdata = cdata; -} - - -bool TiXmlText::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlText::Clone() const -{ - TiXmlText* clone = 0; - clone = new TiXmlText( "" ); - - if ( !clone ) - { - return 0; - } - - CopyTo( clone ); - return clone; -} - - -TiXmlDeclaration::TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} - - -#ifdef TIXML_USE_STL -TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} -#endif - - -TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - copy.CopyTo( this ); -} - - -TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - if ( cfile ) - { - fprintf( cfile, "" ); - } - - if ( str ) - { - (*str) += "?>"; - } -} - - -void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->version = version; - target->encoding = encoding; - target->standalone = standalone; -} - - -bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlDeclaration::Clone() const -{ - TiXmlDeclaration* clone = new TiXmlDeclaration(); - - if ( !clone ) - { - return 0; - } - - CopyTo( clone ); - return clone; -} - - -void TiXmlUnknown::Print( FILE* cfile, int depth ) const -{ - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlUnknown::Clone() const -{ - TiXmlUnknown* clone = new TiXmlUnknown(); - - if ( !clone ) - { - return 0; - } - - CopyTo( clone ); - return clone; -} - - -TiXmlAttributeSet::TiXmlAttributeSet() -{ - sentinel.next = &sentinel; - sentinel.prev = &sentinel; -} - - -TiXmlAttributeSet::~TiXmlAttributeSet() -{ - assert( sentinel.next == &sentinel ); - assert( sentinel.prev == &sentinel ); -} - - -void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) -{ -#ifdef TIXML_USE_STL - assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. -#else - assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. -#endif - - addMe->next = &sentinel; - addMe->prev = sentinel.prev; - - sentinel.prev->next = addMe; - sentinel.prev = addMe; -} - -void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) -{ - TiXmlAttribute* node; - - for( node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node == removeMe ) - { - node->prev->next = node->next; - node->next->prev = node->prev; - node->next = 0; - node->prev = 0; - return; - } - } - - assert( 0 ); // we tried to remove a non-linked attribute. -} - - -#ifdef TIXML_USE_STL -TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node->name == name ) - { - return node; - } - } - - return 0; -} - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - - if ( !attrib ) - { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - - return attrib; -} -#endif - - -TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( strcmp( node->name.c_str(), name ) == 0 ) - { - return node; - } - } - - return 0; -} - - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - - if ( !attrib ) - { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - - return attrib; -} - - -#ifdef TIXML_USE_STL -std::istream& operator>> (std::istream& in, TiXmlNode& base) -{ - TIXML_STRING tag; - tag.reserve( 8 * 1000 ); - base.StreamIn( &in, &tag ); - - base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); - return in; -} -#endif - - -#ifdef TIXML_USE_STL -std::ostream& operator<< (std::ostream& out, const TiXmlNode& base) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out << printer.Str(); - - return out; -} - - -std::string& operator<< (std::string& out, const TiXmlNode& base ) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out.append( printer.Str() ); - - return out; -} -#endif - - -TiXmlHandle TiXmlHandle::FirstChild() const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild(); - - if ( child ) - { - return TiXmlHandle( child ); - } - } - - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChild( const char* value ) const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild( value ); - - if ( child ) - { - return TiXmlHandle( child ); - } - } - - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement() const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement(); - - if ( child ) - { - return TiXmlHandle( child ); - } - } - - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement( const char* value ) const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement( value ); - - if ( child ) - { - return TiXmlHandle( child ); - } - } - - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild(); - - for ( i=0; - child && iNextSibling(), ++i ) - { - // nothing - } - - if ( child ) - { - return TiXmlHandle( child ); - } - } - - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild( value ); - - for ( i=0; - child && iNextSibling( value ), ++i ) - { - // nothing - } - - if ( child ) - { - return TiXmlHandle( child ); - } - } - - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement(); - - for ( i=0; - child && iNextSiblingElement(), ++i ) - { - // nothing - } - - if ( child ) - { - return TiXmlHandle( child ); - } - } - - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement( value ); - - for ( i=0; - child && iNextSiblingElement( value ), ++i ) - { - // nothing - } - - if ( child ) - { - return TiXmlHandle( child ); - } - } - - return TiXmlHandle( 0 ); -} - - -bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) -{ - DoIndent(); - buffer += "<"; - buffer += element.Value(); - - for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) - { - buffer += " "; - attrib->Print( 0, 0, &buffer ); - } - - if ( !element.FirstChild() ) - { - buffer += " />"; - DoLineBreak(); - } - else - { - buffer += ">"; - - if ( element.FirstChild()->ToText() - && element.LastChild() == element.FirstChild() - && element.FirstChild()->ToText()->CDATA() == false ) - { - simpleTextPrint = true; - // no DoLineBreak()! - } - else - { - DoLineBreak(); - } - } - - ++depth; - return true; -} - - -bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) -{ - --depth; - - if ( !element.FirstChild() ) - { - // nothing. - } - else - { - if ( simpleTextPrint ) - { - simpleTextPrint = false; - } - else - { - DoIndent(); - } - - buffer += ""; - DoLineBreak(); - } - - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlText& text ) -{ - if ( text.CDATA() ) - { - DoIndent(); - buffer += ""; - DoLineBreak(); - } - else if ( simpleTextPrint ) - { - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - } - else - { - DoIndent(); - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - DoLineBreak(); - } - - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) -{ - DoIndent(); - declaration.Print( 0, 0, &buffer ); - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlComment& comment ) -{ - DoIndent(); - buffer += ""; - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) -{ - DoIndent(); - buffer += "<"; - buffer += unknown.Value(); - buffer += ">"; - DoLineBreak(); - return true; -} - diff --git a/purenessscopeserver/example-Module/MonitorServer/TinyXML/tinyxml.h b/purenessscopeserver/example-Module/MonitorServer/TinyXML/tinyxml.h deleted file mode 100644 index 4a669ccd0..000000000 --- a/purenessscopeserver/example-Module/MonitorServer/TinyXML/tinyxml.h +++ /dev/null @@ -1,2270 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TINYXML_INCLUDED -#define TINYXML_INCLUDED - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4530 ) -#pragma warning( disable : 4786 ) -#endif - -#include -#include -#include -#include -#include - -// Help out windows: -#if defined( _DEBUG ) && !defined( DEBUG ) -#define DEBUG -#endif - -#ifdef TIXML_USE_STL -#include -#include -#include -#define TIXML_STRING std::string -#else -#include "tinystr.h" -#define TIXML_STRING TiXmlString -#endif - -// Deprecated library function hell. Compilers want to use the -// new safe versions. This probably doesn't fully address the problem, -// but it gets closer. There are too many compilers for me to fully -// test. If you get compilation troubles, undefine TIXML_SAFE -#define TIXML_SAFE - -#ifdef TIXML_SAFE -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) -// Microsoft visual studio, version 2005 and higher. -#define TIXML_SNPRINTF _snprintf_s -#define TIXML_SSCANF sscanf_s -#elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) -// Microsoft visual studio, version 6 and higher. -//#pragma message( "Using _sn* functions." ) -#define TIXML_SNPRINTF _snprintf -#define TIXML_SSCANF sscanf -#elif defined(__GNUC__) && (__GNUC__ >= 3 ) -// GCC version 3 and higher.s -//#warning( "Using sn* functions." ) -#define TIXML_SNPRINTF snprintf -#define TIXML_SSCANF sscanf -#else -#define TIXML_SNPRINTF snprintf -#define TIXML_SSCANF sscanf -#endif -#endif - -class TiXmlDocument; -class TiXmlElement; -class TiXmlComment; -class TiXmlUnknown; -class TiXmlAttribute; -class TiXmlText; -class TiXmlDeclaration; -class TiXmlParsingData; - -const int TIXML_MAJOR_VERSION = 2; -const int TIXML_MINOR_VERSION = 6; -const int TIXML_PATCH_VERSION = 2; - -/* Internal structure for tracking location of items - in the XML file. -*/ -struct TiXmlCursor -{ - TiXmlCursor() - { - Clear(); - } - void Clear() - { - row = col = -1; - } - - int row; // 0 based. - int col; // 0 based. -}; - - -/** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a TiXmlVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves - are simply called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its sibilings will be Visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. - - You should never change the document from a callback. - - @sa TiXmlNode::Accept() -*/ -class TiXmlVisitor -{ -public: - virtual ~TiXmlVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) - { - return true; - } - /// Visit a document. - virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) - { - return true; - } - - /// Visit an element. - virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) - { - return true; - } - /// Visit an element. - virtual bool VisitExit( const TiXmlElement& /*element*/ ) - { - return true; - } - - /// Visit a declaration - virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) - { - return true; - } - /// Visit a text node - virtual bool Visit( const TiXmlText& /*text*/ ) - { - return true; - } - /// Visit a comment node - virtual bool Visit( const TiXmlComment& /*comment*/ ) - { - return true; - } - /// Visit an unknown node - virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) - { - return true; - } -}; - -// Only used by Attribute::Query functions -enum -{ - TIXML_SUCCESS, - TIXML_NO_ATTRIBUTE, - TIXML_WRONG_TYPE -}; - - -// Used by the parsing routines. -enum TiXmlEncoding -{ - TIXML_ENCODING_UNKNOWN, - TIXML_ENCODING_UTF8, - TIXML_ENCODING_LEGACY -}; - -const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; - -/** TiXmlBase is a base class for every class in TinyXml. - It does little except to establish that TinyXml classes - can be printed and provide some utility functions. - - In XML, the document and elements can contain - other elements and other types of nodes. - - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) - - A Decleration contains: Attributes (not on tree) - @endverbatim -*/ -class TiXmlBase -{ - friend class TiXmlNode; - friend class TiXmlElement; - friend class TiXmlDocument; - -public: - TiXmlBase() : userData(0) {} - virtual ~TiXmlBase() {} - - /** All TinyXml classes can print themselves to a filestream - or the string class (TiXmlString in non-STL mode, std::string - in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert - tabs and newlines. - - (For an unformatted stream, use the << operator.) - */ - virtual void Print( FILE* cfile, int depth ) const = 0; - - /** The world does not agree on whether white space should be kept or - not. In order to make everyone happy, these global, static functions - are provided to set whether or not TinyXml will condense all white space - into a single space or not. The default is to condense. Note changing this - value is not thread safe. - */ - static void SetCondenseWhiteSpace( bool condense ) - { - condenseWhiteSpace = condense; - } - - /// Return the current white space setting. - static bool IsWhiteSpaceCondensed() - { - return condenseWhiteSpace; - } - - /** Return the position, in the original source file, of this node or attribute. - The row and column are 1-based. (That is the first row and first column is - 1,1). If the returns values are 0 or less, then the parser does not have - a row and column value. - - Generally, the row and column value will be set when the TiXmlDocument::Load(), - TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set - when the DOM was created from operator>>. - - The values reflect the initial load. Once the DOM is modified programmatically - (by adding or changing nodes and attributes) the new values will NOT update to - reflect changes in the document. - - There is a minor performance cost to computing the row and column. Computation - can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. - - @sa TiXmlDocument::SetTabSize() - */ - int Row() const - { - return location.row + 1; - } - int Column() const - { - return location.col + 1; ///< See Row() - } - - void SetUserData( void* user ) - { - userData = user; ///< Set a pointer to arbitrary user data. - } - void* GetUserData() - { - return userData; ///< Get a pointer to arbitrary user data. - } - const void* GetUserData() const - { - return userData; ///< Get a pointer to arbitrary user data. - } - - // Table that returs, for a given lead byte, the total number of bytes - // in the UTF-8 sequence. - static const int utf8ByteTable[256]; - - virtual const char* Parse( const char* p, - TiXmlParsingData* data, - TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; - - /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, - or they will be transformed into entities! - */ - static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); - - enum - { - TIXML_NO_ERROR = 0, - TIXML_ERROR, - TIXML_ERROR_OPENING_FILE, - TIXML_ERROR_PARSING_ELEMENT, - TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, - TIXML_ERROR_READING_ELEMENT_VALUE, - TIXML_ERROR_READING_ATTRIBUTES, - TIXML_ERROR_PARSING_EMPTY, - TIXML_ERROR_READING_END_TAG, - TIXML_ERROR_PARSING_UNKNOWN, - TIXML_ERROR_PARSING_COMMENT, - TIXML_ERROR_PARSING_DECLARATION, - TIXML_ERROR_DOCUMENT_EMPTY, - TIXML_ERROR_EMBEDDED_NULL, - TIXML_ERROR_PARSING_CDATA, - TIXML_ERROR_DOCUMENT_TOP_ONLY, - - TIXML_ERROR_STRING_COUNT - }; - -protected: - - static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); - } - inline static bool IsWhiteSpace( int c ) - { - if ( c < 256 ) - { - return IsWhiteSpace( (char) c ); - } - - return false; // Again, only truly correct for English/Latin...but usually works. - } - -#ifdef TIXML_USE_STL - static bool StreamWhiteSpace( std::istream* in, TIXML_STRING* tag ); - static bool StreamTo( std::istream* in, int character, TIXML_STRING* tag ); -#endif - - /* Reads an XML name into the string provided. Returns - a pointer just past the last character of the name, - or 0 if the function has an error. - */ - static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); - - /* Reads text. Returns a pointer past the given end tag. - Wickedly complex options, but it keeps the (sensitive) code in one place. - */ - static const char* ReadText( const char* in, // where to start - TIXML_STRING* text, // the string read - bool ignoreWhiteSpace, // whether to keep the white space - const char* endTag, // what ends this text - bool ignoreCase, // whether to ignore case in the end tag - TiXmlEncoding encoding ); // the current encoding - - // If an entity has been found, transform it into a character. - static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); - - // Get a character, while interpreting entities. - // The length can be from 0 to 4 bytes. - inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) - { - assert( p ); - - if ( encoding == TIXML_ENCODING_UTF8 ) - { - *length = utf8ByteTable[ *((const unsigned char*)p) ]; - assert( *length >= 0 && *length < 5 ); - } - else - { - *length = 1; - } - - if ( *length == 1 ) - { - if ( *p == '&' ) - { - return GetEntity( p, _value, length, encoding ); - } - - *_value = *p; - return p+1; - } - else if ( *length ) - { - //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), - // and the null terminator isn't needed - for( int i=0; p[i] && i<*length; ++i ) - { - _value[i] = p[i]; - } - - return p + (*length); - } - else - { - // Not valid text. - return 0; - } - } - - // Return true if the next characters in the stream are any of the endTag sequences. - // Ignore case only works for english, and should only be relied on when comparing - // to English words: StringEqual( p, "version", true ) is fine. - static bool StringEqual( const char* p, - const char* endTag, - bool ignoreCase, - TiXmlEncoding encoding ); - - static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; - - TiXmlCursor location; - - /// Field containing a generic user pointer - void* userData; - - // None of these methods are reliable for any language except English. - // Good for approximation, not great for accuracy. - static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); - static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); - inline static int ToLower( int v, TiXmlEncoding encoding ) - { - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( v < 128 ) - { - return tolower( v ); - } - - return v; - } - else - { - return tolower( v ); - } - } - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); - -private: - TiXmlBase( const TiXmlBase& ); // not implemented. - void operator=( const TiXmlBase& base ); // not allowed. - - struct Entity - { - const char* str; - unsigned int strLength; - char chr; - }; - enum - { - NUM_ENTITY = 5, - MAX_ENTITY_LENGTH = 6 - - }; - static Entity entity[ NUM_ENTITY ]; - static bool condenseWhiteSpace; -}; - - -/** The parent class for everything in the Document Object Model. - (Except for attributes). - Nodes have siblings, a parent, and children. A node can be - in a document, or stand on its own. The type of a TiXmlNode - can be queried, and it can be cast to its more defined type. -*/ -class TiXmlNode : public TiXmlBase -{ - friend class TiXmlDocument; - friend class TiXmlElement; - -public: -#ifdef TIXML_USE_STL - - /** An input stream operator, for every class. Tolerant of newlines and - formatting, but doesn't expect them. - */ - friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - - /** An output stream operator, for every class. Note that this outputs - without any newlines or formatting, as opposed to Print(), which - includes tabs and new lines. - - The operator<< and operator>> are not completely symmetric. Writing - a node to a stream is very well defined. You'll get a nice stream - of output, without any extra whitespace or newlines. - - But reading is not as well defined. (As it always is.) If you create - a TiXmlElement (for example) and read that from an input stream, - the text needs to define an element or junk will result. This is - true of all input streams, but it's worth keeping in mind. - - A TiXmlDocument will read nodes until it reads a root element, and - all the children of that root element. - */ - friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - - /// Appends the XML node or attribute to a std::string. - friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - -#endif - - /** The types of XML nodes supported by TinyXml. (All the - unsupported types are picked up by UNKNOWN.) - */ - enum NodeType - { - TINYXML_DOCUMENT, - TINYXML_ELEMENT, - TINYXML_COMMENT, - TINYXML_UNKNOWN, - TINYXML_TEXT, - TINYXML_DECLARATION, - TINYXML_TYPECOUNT - }; - - virtual ~TiXmlNode(); - - /** The meaning of 'value' changes for the specific type of - TiXmlNode. - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - - The subclasses will wrap this function. - */ - const char* Value() const - { - return value.c_str (); - } - -#ifdef TIXML_USE_STL - /** Return Value() as a std::string. If you only use STL, - this is more efficient than calling Value(). - Only available in STL mode. - */ - const std::string& ValueStr() const - { - return value; - } -#endif - - const TIXML_STRING& ValueTStr() const - { - return value; - } - - /** Changes the value of the node. Defined as: - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - void SetValue(const char* _value) - { - value = _value; - } - -#ifdef TIXML_USE_STL - /// STL std::string form. - void SetValue( const std::string& _value ) - { - value = _value; - } -#endif - - /// Delete all the children of this node. Does not affect 'this'. - void Clear(); - - /// One step up the DOM. - TiXmlNode* Parent() - { - return parent; - } - const TiXmlNode* Parent() const - { - return parent; - } - - const TiXmlNode* FirstChild() const - { - return firstChild; ///< The first child of this node. Will be null if there are no children. - } - TiXmlNode* FirstChild() - { - return firstChild; - } - const TiXmlNode* FirstChild( const char* value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. - /// The first child of this node with the matching 'value'. Will be null if none found. - TiXmlNode* FirstChild( const char* _value ) - { - // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) - // call the method, cast the return back to non-const. - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); - } - const TiXmlNode* LastChild() const - { - return lastChild; /// The last child of this node. Will be null if there are no children. - } - TiXmlNode* LastChild() - { - return lastChild; - } - - const TiXmlNode* LastChild( const char* value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. - TiXmlNode* LastChild( const char* _value ) - { - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); - } - -#ifdef TIXML_USE_STL - const TiXmlNode* FirstChild( const std::string& _value ) const - { - return FirstChild (_value.c_str ()); ///< STL std::string form. - } - TiXmlNode* FirstChild( const std::string& _value ) - { - return FirstChild (_value.c_str ()); ///< STL std::string form. - } - const TiXmlNode* LastChild( const std::string& _value ) const - { - return LastChild (_value.c_str ()); ///< STL std::string form. - } - TiXmlNode* LastChild( const std::string& _value ) - { - return LastChild (_value.c_str ()); ///< STL std::string form. - } -#endif - - /** An alternate way to walk the children of a node. - One way to iterate over nodes is: - @verbatim - for( child = parent->FirstChild(); child; child = child->NextSibling() ) - @endverbatim - - IterateChildren does the same thing with the syntax: - @verbatim - child = 0; - while( child = parent->IterateChildren( child ) ) - @endverbatim - - IterateChildren takes the previous child as input and finds - the next one. If the previous child is null, it returns the - first. IterateChildren will return null when done. - */ - const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const TiXmlNode* previous ) - { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); - } - - /// This flavor of IterateChildren searches for children with a particular 'value' - const TiXmlNode* IterateChildren( const char* value, const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const char* _value, const TiXmlNode* previous ) - { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); - } - -#ifdef TIXML_USE_STL - const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const - { - return IterateChildren (_value.c_str (), previous); ///< STL std::string form. - } - TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) - { - return IterateChildren (_value.c_str (), previous); ///< STL std::string form. - } -#endif - - /** Add a new node related to this. Adds a child past the LastChild. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); - - - /** Add a new node related to this. Adds a child past the LastChild. - - NOTE: the node to be added is passed by pointer, and will be - henceforth owned (and deleted) by tinyXml. This method is efficient - and avoids an extra copy, but should be used with care as it - uses a different memory model than the other insert functions. - - @sa InsertEndChild - */ - TiXmlNode* LinkEndChild( TiXmlNode* addThis ); - - /** Add a new node related to this. Adds a child before the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); - - /** Add a new node related to this. Adds a child after the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); - - /** Replace a child of this node. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); - - /// Delete a child of this node. - bool RemoveChild( TiXmlNode* removeThis ); - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling() const - { - return prev; - } - TiXmlNode* PreviousSibling() - { - return prev; - } - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling( const char* ) const; - TiXmlNode* PreviousSibling( const char* _prev ) - { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); - } - -#ifdef TIXML_USE_STL - const TiXmlNode* PreviousSibling( const std::string& _value ) const - { - return PreviousSibling (_value.c_str ()); ///< STL std::string form. - } - TiXmlNode* PreviousSibling( const std::string& _value ) - { - return PreviousSibling (_value.c_str ()); ///< STL std::string form. - } - const TiXmlNode* NextSibling( const std::string& _value) const - { - return NextSibling (_value.c_str ()); ///< STL std::string form. - } - TiXmlNode* NextSibling( const std::string& _value) - { - return NextSibling (_value.c_str ()); ///< STL std::string form. - } -#endif - - /// Navigate to a sibling node. - const TiXmlNode* NextSibling() const - { - return next; - } - TiXmlNode* NextSibling() - { - return next; - } - - /// Navigate to a sibling node with the given 'value'. - const TiXmlNode* NextSibling( const char* ) const; - TiXmlNode* NextSibling( const char* _next ) - { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement() const; - TiXmlElement* NextSiblingElement() - { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement( const char* ) const; - TiXmlElement* NextSiblingElement( const char* _next ) - { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); - } - -#ifdef TIXML_USE_STL - const TiXmlElement* NextSiblingElement( const std::string& _value) const - { - return NextSiblingElement (_value.c_str ()); ///< STL std::string form. - } - TiXmlElement* NextSiblingElement( const std::string& _value) - { - return NextSiblingElement (_value.c_str ()); ///< STL std::string form. - } -#endif - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement() const; - TiXmlElement* FirstChildElement() - { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); - } - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement( const char* _value ) const; - TiXmlElement* FirstChildElement( const char* _value ) - { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); - } - -#ifdef TIXML_USE_STL - const TiXmlElement* FirstChildElement( const std::string& _value ) const - { - return FirstChildElement (_value.c_str ()); ///< STL std::string form. - } - TiXmlElement* FirstChildElement( const std::string& _value ) - { - return FirstChildElement (_value.c_str ()); ///< STL std::string form. - } -#endif - - /** Query the type (as an enumerated value, above) of this node. - The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, - TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION. - */ - int Type() const - { - return type; - } - - /** Return a pointer to the Document this node lives in. - Returns null if not in a document. - */ - const TiXmlDocument* GetDocument() const; - TiXmlDocument* GetDocument() - { - return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); - } - - /// Returns true if this node has no children. - bool NoChildren() const - { - return !firstChild; - } - - virtual const TiXmlDocument* ToDocument() const - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual const TiXmlElement* ToElement() const - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual const TiXmlComment* ToComment() const - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual const TiXmlUnknown* ToUnknown() const - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual const TiXmlText* ToText() const - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual const TiXmlDeclaration* ToDeclaration() const - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - - virtual TiXmlDocument* ToDocument() - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual TiXmlElement* ToElement() - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual TiXmlComment* ToComment() - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual TiXmlUnknown* ToUnknown() - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual TiXmlText* ToText() - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - virtual TiXmlDeclaration* ToDeclaration() - { - return 0; ///< Cast to a more defined type. Will return null if not of the requested type. - } - - /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. - */ - virtual TiXmlNode* Clone() const = 0; - - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the TiXmlVisitor interface. - - This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - TiXmlPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( TiXmlVisitor* visitor ) const = 0; - -protected: - TiXmlNode( NodeType _type ); - - // Copy to the allocated object. Shared functionality between Clone, Copy constructor, - // and the assignment operator. - void CopyTo( TiXmlNode* target ) const; - -#ifdef TIXML_USE_STL - // The real work of the input operator. - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; -#endif - - // Figure out what is at *p, and parse it. Returns null if it is not an xml node. - TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); - - TiXmlNode* parent; - NodeType type; - - TiXmlNode* firstChild; - TiXmlNode* lastChild; - - TIXML_STRING value; - - TiXmlNode* prev; - TiXmlNode* next; - -private: - TiXmlNode( const TiXmlNode& ); // not implemented. - void operator=( const TiXmlNode& base ); // not allowed. -}; - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not TiXmlNodes, since they are not - part of the tinyXML document object model. There are other - suggested ways to look at this problem. -*/ -class TiXmlAttribute : public TiXmlBase -{ - friend class TiXmlAttributeSet; - -public: - /// Construct an empty attribute. - TiXmlAttribute() : TiXmlBase() - { - document = 0; - prev = next = 0; - } - -#ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlAttribute( const std::string& _name, const std::string& _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } -#endif - - /// Construct an attribute with a name and value. - TiXmlAttribute( const char* _name, const char* _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - - const char* Name() const - { - return name.c_str(); ///< Return the name of this attribute. - } - const char* Value() const - { - return value.c_str(); ///< Return the value of this attribute. - } -#ifdef TIXML_USE_STL - const std::string& ValueStr() const - { - return value; ///< Return the value of this attribute. - } -#endif - int IntValue() const; ///< Return the value of this attribute, converted to an integer. - double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - - // Get the tinyxml string representation - const TIXML_STRING& NameTStr() const - { - return name; - } - - /** QueryIntValue examines the value string. It is an alternative to the - IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. - - A specialized but useful call. Note that for success it returns 0, - which is the opposite of almost all other TinyXml calls. - */ - int QueryIntValue( int* _value ) const; - /// QueryDoubleValue examines the value string. See QueryIntValue(). - int QueryDoubleValue( double* _value ) const; - - void SetName( const char* _name ) - { - name = _name; ///< Set the name of this attribute. - } - void SetValue( const char* _value ) - { - value = _value; ///< Set the value. - } - - void SetIntValue( int _value ); ///< Set the value from an integer. - void SetDoubleValue( double _value ); ///< Set the value from a double. - -#ifdef TIXML_USE_STL - /// STL std::string form. - void SetName( const std::string& _name ) - { - name = _name; - } - /// STL std::string form. - void SetValue( const std::string& _value ) - { - value = _value; - } -#endif - - /// Get the next sibling attribute in the DOM. Returns null at end. - const TiXmlAttribute* Next() const; - TiXmlAttribute* Next() - { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); - } - - /// Get the previous sibling attribute in the DOM. Returns null at beginning. - const TiXmlAttribute* Previous() const; - TiXmlAttribute* Previous() - { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); - } - - bool operator==( const TiXmlAttribute& rhs ) const - { - return rhs.name == name; - } - bool operator<( const TiXmlAttribute& rhs ) const - { - return name < rhs.name; - } - bool operator>( const TiXmlAttribute& rhs ) const - { - return name > rhs.name; - } - - /* Attribute parsing starts: first letter of the name - returns: the next char after the value end quote - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - // Prints this Attribute to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const - { - Print( cfile, depth, 0 ); - } - void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - - // [internal use] - // Set the document pointer so the attribute can report errors. - void SetDocument( TiXmlDocument* doc ) - { - document = doc; - } - -private: - TiXmlAttribute( const TiXmlAttribute& ); // not implemented. - void operator=( const TiXmlAttribute& base ); // not allowed. - - TiXmlDocument* document; // A pointer back to a document, for error reporting. - TIXML_STRING name; - TIXML_STRING value; - TiXmlAttribute* prev; - TiXmlAttribute* next; -}; - - -/* A class used to manage a group of attributes. - It is only used internally, both by the ELEMENT and the DECLARATION. - - The set can be changed transparent to the Element and Declaration - classes that use it, but NOT transparent to the Attribute - which has to implement a next() and previous() method. Which makes - it a bit problematic and prevents the use of STL. - - This version is implemented with circular lists because: - - I like circular lists - - it demonstrates some independence from the (typical) doubly linked list. -*/ -class TiXmlAttributeSet -{ -public: - TiXmlAttributeSet(); - ~TiXmlAttributeSet(); - - void Add( TiXmlAttribute* attribute ); - void Remove( TiXmlAttribute* attribute ); - - const TiXmlAttribute* First() const - { - return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; - } - TiXmlAttribute* First() - { - return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; - } - const TiXmlAttribute* Last() const - { - return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; - } - TiXmlAttribute* Last() - { - return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; - } - - TiXmlAttribute* Find( const char* _name ) const; - TiXmlAttribute* FindOrCreate( const char* _name ); - -# ifdef TIXML_USE_STL - TiXmlAttribute* Find( const std::string& _name ) const; - TiXmlAttribute* FindOrCreate( const std::string& _name ); -# endif - - -private: - //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), - //*ME: this class must be also use a hidden/disabled copy-constructor !!! - TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed - void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) - - TiXmlAttribute sentinel; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TiXmlElement : public TiXmlNode -{ -public: - /// Construct an element. - TiXmlElement (const char* in_value); - -#ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlElement( const std::string& _value ); -#endif - - TiXmlElement( const TiXmlElement& ); - - TiXmlElement& operator=( const TiXmlElement& base ); - - virtual ~TiXmlElement(); - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - */ - const char* Attribute( const char* name ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an integer, - the integer value will be put in the return 'i', if 'i' - is non-null. - */ - const char* Attribute( const char* name, int* i ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an double, - the double value will be put in the return 'd', if 'd' - is non-null. - */ - const char* Attribute( const char* name, double* d ) const; - - /** QueryIntAttribute examines the attribute - it is an alternative to the - Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. If the attribute - does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ - int QueryIntAttribute( const char* name, int* _value ) const; - /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute(). - int QueryUnsignedAttribute( const char* name, unsigned* _value ) const; - /** QueryBoolAttribute examines the attribute - see QueryIntAttribute(). - Note that '1', 'true', or 'yes' are considered true, while '0', 'false' - and 'no' are considered false. - */ - int QueryBoolAttribute( const char* name, bool* _value ) const; - /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). - int QueryDoubleAttribute( const char* name, double* _value ) const; - /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). - int QueryFloatAttribute( const char* name, float* _value ) const - { - double d; - int result = QueryDoubleAttribute( name, &d ); - - if ( result == TIXML_SUCCESS ) - { - *_value = (float)d; - } - - return result; - } - -#ifdef TIXML_USE_STL - /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). - int QueryStringAttribute( const char* name, std::string* _value ) const - { - const char* cstr = Attribute( name ); - - if ( cstr ) - { - *_value = std::string( cstr ); - return TIXML_SUCCESS; - } - - return TIXML_NO_ATTRIBUTE; - } - - /** Template form of the attribute query which will try to read the - attribute into the specified type. Very easy, very powerful, but - be careful to make sure to call this with the correct type. - - NOTE: This method doesn't work correctly for 'string' types that contain spaces. - - @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE - */ - template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - - if ( !node ) - { - return TIXML_NO_ATTRIBUTE; - } - - std::stringstream sstream( node->ValueStr() ); - sstream >> *outValue; - - if ( !sstream.fail() ) - { - return TIXML_SUCCESS; - } - - return TIXML_WRONG_TYPE; - } - - int QueryValueAttribute( const std::string& name, std::string* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - - if ( !node ) - { - return TIXML_NO_ATTRIBUTE; - } - - *outValue = node->ValueStr(); - return TIXML_SUCCESS; - } -#endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, const char* _value ); - -#ifdef TIXML_USE_STL - const std::string* Attribute( const std::string& name ) const; - const std::string* Attribute( const std::string& name, int* i ) const; - const std::string* Attribute( const std::string& name, double* d ) const; - int QueryIntAttribute( const std::string& name, int* _value ) const; - int QueryDoubleAttribute( const std::string& name, double* _value ) const; - - /// STL std::string form. - void SetAttribute( const std::string& name, const std::string& _value ); - ///< STL std::string form. - void SetAttribute( const std::string& name, int _value ); - ///< STL std::string form. - void SetDoubleAttribute( const std::string& name, double value ); -#endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, int value ); - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetDoubleAttribute( const char* name, double value ); - - /** Deletes an attribute with the given name. - */ - void RemoveAttribute( const char* name ); -#ifdef TIXML_USE_STL - void RemoveAttribute( const std::string& name ) - { - RemoveAttribute (name.c_str ()); ///< STL std::string form. - } -#endif - - const TiXmlAttribute* FirstAttribute() const - { - return attributeSet.First(); ///< Access the first attribute in this element. - } - TiXmlAttribute* FirstAttribute() - { - return attributeSet.First(); - } - const TiXmlAttribute* LastAttribute() const - { - return attributeSet.Last(); ///< Access the last attribute in this element. - } - TiXmlAttribute* LastAttribute() - { - return attributeSet.Last(); - } - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the TiXmlText child - and accessing it directly. - - If the first child of 'this' is a TiXmlText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are - safe type casts on the referenced node. - */ - const char* GetText() const; - - /// Creates a new Element and returns it - the returned element is a copy. - virtual TiXmlNode* Clone() const; - // Print the Element to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: next char past '<' - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlElement* ToElement() const - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - virtual TiXmlElement* ToElement() - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - - void CopyTo( TiXmlElement* target ) const; - void ClearThis(); // like clear, but initializes 'this' object as well - - // Used to be public [internal use] -#ifdef TIXML_USE_STL - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); -#endif - /* [internal use] - Reads the "value" of the element -- another element, or text. - This should terminate with the current end tag. - */ - const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - -private: - TiXmlAttributeSet attributeSet; -}; - - -/** An XML comment. -*/ -class TiXmlComment : public TiXmlNode -{ -public: - /// Constructs an empty comment. - TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} - /// Construct a comment from text. - TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) - { - SetValue( _value ); - } - TiXmlComment( const TiXmlComment& ); - TiXmlComment& operator=( const TiXmlComment& base ); - - virtual ~TiXmlComment() {} - - /// Returns a copy of this Comment. - virtual TiXmlNode* Clone() const; - // Write this Comment to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: at the ! of the !-- - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlComment* ToComment() const - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - virtual TiXmlComment* ToComment() - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlComment* target ) const; - - // used to be public -#ifdef TIXML_USE_STL - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); -#endif - // virtual void StreamOut( TIXML_OSTREAM * out ) const; - -private: - -}; - - -/** XML text. A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCDATA() and query it with CDATA(). -*/ -class TiXmlText : public TiXmlNode -{ - friend class TiXmlElement; -public: - /** Constructor for text element. By default, it is treated as - normal, encoded text. If you want it be output as a CDATA text - element, set the parameter _cdata to 'true' - */ - TiXmlText (const char* initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - virtual ~TiXmlText() {} - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } -#endif - - TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) - { - copy.CopyTo( this ); - } - TiXmlText& operator=( const TiXmlText& base ) - { - base.CopyTo( this ); - return *this; - } - - // Write this text object to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /// Queries whether this represents text using a CDATA section. - bool CDATA() const - { - return cdata; - } - /// Turns on or off a CDATA representation of text. - void SetCDATA( bool _cdata ) - { - cdata = _cdata; - } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlText* ToText() const - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - virtual TiXmlText* ToText() - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - /// [internal use] Creates a new Element and returns it. - virtual TiXmlNode* Clone() const; - void CopyTo( TiXmlText* target ) const; - - bool Blank() const; // returns true if all white space and new lines - // [internal use] -#ifdef TIXML_USE_STL - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); -#endif - -private: - bool cdata; // true if this should be input and output as a CDATA style text element -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXml will happily read or write files without a declaration, - however. There are 3 possible attributes to the declaration: - version, encoding, and standalone. - - Note: In this version of the code, the attributes are - handled as special cases, not generic attributes, simply - because there can only be at most 3 and they are always the same. -*/ -class TiXmlDeclaration : public TiXmlNode -{ -public: - /// Construct an empty declaration. - TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ); -#endif - - /// Construct. - TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ); - - TiXmlDeclaration( const TiXmlDeclaration& copy ); - TiXmlDeclaration& operator=( const TiXmlDeclaration& copy ); - - virtual ~TiXmlDeclaration() {} - - /// Version. Will return an empty string if none was found. - const char* Version() const - { - return version.c_str (); - } - /// Encoding. Will return an empty string if none was found. - const char* Encoding() const - { - return encoding.c_str (); - } - /// Is this a standalone document? - const char* Standalone() const - { - return standalone.c_str (); - } - - /// Creates a copy of this Declaration and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const - { - Print( cfile, depth, 0 ); - } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlDeclaration* ToDeclaration() const - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - virtual TiXmlDeclaration* ToDeclaration() - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlDeclaration* target ) const; - // used to be public -#ifdef TIXML_USE_STL - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); -#endif - -private: - - TIXML_STRING version; - TIXML_STRING encoding; - TIXML_STRING standalone; -}; - - -/** Any tag that tinyXml doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into TiXmlUnknowns. -*/ -class TiXmlUnknown : public TiXmlNode -{ -public: - TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} - virtual ~TiXmlUnknown() {} - - TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) - { - copy.CopyTo( this ); - } - TiXmlUnknown& operator=( const TiXmlUnknown& copy ) - { - copy.CopyTo( this ); - return *this; - } - - /// Creates a copy of this Unknown and returns it. - virtual TiXmlNode* Clone() const; - // Print this Unknown to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlUnknown* ToUnknown() const - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - virtual TiXmlUnknown* ToUnknown() - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected: - void CopyTo( TiXmlUnknown* target ) const; - -#ifdef TIXML_USE_STL - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); -#endif - -private: - -}; - - -/** Always the top level node. A document binds together all the - XML pieces. It can be saved, loaded, and printed to the screen. - The 'value' of a document node is the xml file name. -*/ -class TiXmlDocument : public TiXmlNode -{ -public: - /// Create an empty document, that has no name. - TiXmlDocument(); - /// Create a document with a name. The name of the document is also the filename of the xml. - TiXmlDocument( const char* documentName ); - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlDocument( const std::string& documentName ); -#endif - - TiXmlDocument( const TiXmlDocument& copy ); - TiXmlDocument& operator=( const TiXmlDocument& copy ); - - virtual ~TiXmlDocument() {} - - /** Load a file using the current document value. - Returns true if successful. Will delete any existing - document data before loading. - */ - bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the current document value. Returns true if successful. - bool SaveFile() const; - /// Load a file using the given filename. Returns true if successful. - bool LoadFile( const char* filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given filename. Returns true if successful. - bool SaveFile( const char* filename ) const; - /** Load a file using the given FILE*. Returns true if successful. Note that this method - doesn't stream - the entire object pointed at by the FILE* - will be interpreted as an XML file. TinyXML doesn't stream in XML from the current - file location. Streaming may be added in the future. - */ - bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given FILE*. Returns true if successful. - bool SaveFile( FILE* ) const; - -#ifdef TIXML_USE_STL - bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. - { - return LoadFile( filename.c_str(), encoding ); - } - bool SaveFile( const std::string& filename ) const ///< STL std::string version. - { - return SaveFile( filename.c_str() ); - } -#endif - - /** Parse the given null terminated block of xml data. Passing in an encoding to this - method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml - to use that encoding, regardless of what TinyXml might otherwise try to detect. - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** Get the root element -- the only top level element -- of the document. - In well formed XML, there should only be one. TinyXml is tolerant of - multiple elements at the document level. - */ - const TiXmlElement* RootElement() const - { - return FirstChildElement(); - } - TiXmlElement* RootElement() - { - return FirstChildElement(); - } - - /** If an error occurs, Error will be set to true. Also, - - The ErrorId() will contain the integer identifier of the error (not generally useful) - - The ErrorDesc() method will return the name of the error. (very useful) - - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ - bool Error() const - { - return error; - } - - /// Contains a textual (english) description of the error if one occurs. - const char* ErrorDesc() const - { - return errorDesc.c_str (); - } - - /** Generally, you probably want the error string ( ErrorDesc() ). But if you - prefer the ErrorId, this function will fetch it. - */ - int ErrorId() const - { - return errorId; - } - - /** Returns the location (if known) of the error. The first column is column 1, - and the first row is row 1. A value of 0 means the row and column wasn't applicable - (memory errors, for example, have no row/column) or the parser lost the error. (An - error in the error reporting, in that case.) - - @sa SetTabSize, Row, Column - */ - int ErrorRow() const - { - return errorLocation.row+1; - } - int ErrorCol() const - { - return errorLocation.col+1; ///< The column where the error occured. See ErrorRow() - } - - /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) - to report the correct values for row and column. It does not change the output - or input in any way. - - By calling this method, with a tab size - greater than 0, the row and column of each node and attribute is stored - when the file is loaded. Very useful for tracking the DOM back in to - the source file. - - The tab size is required for calculating the location of nodes. If not - set, the default of 4 is used. The tabsize is set per document. Setting - the tabsize to 0 disables row/column tracking. - - Note that row and column tracking is not supported when using operator>>. - - The tab size needs to be enabled before the parse or load. Correct usage: - @verbatim - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Load( "myfile.xml" ); - @endverbatim - - @sa Row, Column - */ - void SetTabSize( int _tabsize ) - { - tabsize = _tabsize; - } - - int TabSize() const - { - return tabsize; - } - - /** If you have handled the error, it can be reset with this call. The error - state is automatically cleared if you Parse a new XML block. - */ - void ClearError() - { - error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; - } - - /** Write the document to standard out using formatted printing ("pretty print"). */ - void Print() const - { - Print( stdout, 0 ); - } - - /* Write the document to a string using formatted printing ("pretty print"). This - will allocate a character array (new char[]) and return it as a pointer. The - calling code pust call delete[] on the return char* to avoid a memory leak. - */ - //char* PrintToMemory() const; - - /// Print this Document to a FILE stream. - virtual void Print( FILE* cfile, int depth = 0 ) const; - // [internal use] - void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - - virtual const TiXmlDocument* ToDocument() const - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - virtual TiXmlDocument* ToDocument() - { - return this; ///< Cast to a more defined type. Will return null not of the requested type. - } - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - // [internal use] - virtual TiXmlNode* Clone() const; -#ifdef TIXML_USE_STL - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ); -#endif - -private: - void CopyTo( TiXmlDocument* target ) const; - - bool error; - int errorId; - TIXML_STRING errorDesc; - int tabsize; - TiXmlCursor errorLocation; - bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. -}; - - -/** - A TiXmlHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - TiXmlElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - TiXmlElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - TiXmlElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - TiXmlElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - TiXmlHandle docHandle( &document ); - TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - TiXmlHandle handleCopy = handle; - @endverbatim - - What they should not be used for is iteration: - - @verbatim - int i=0; - while ( true ) - { - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); - if ( !child ) - break; - // do something - ++i; - } - @endverbatim - - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs - to. Instead, prefer: - - @verbatim - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); - - for( child; child; child=child->NextSiblingElement() ) - { - // do something - } - @endverbatim -*/ -class TiXmlHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle( TiXmlNode* _node ) - { - this->node = _node; - } - /// Copy constructor - TiXmlHandle( const TiXmlHandle& ref ) - { - this->node = ref.node; - } - TiXmlHandle operator=( const TiXmlHandle& ref ) - { - if ( &ref != this ) - { - this->node = ref.node; - } - - return *this; - } - - /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; - /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild( const char* value ) const; - /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; - /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement( const char* value ) const; - - /** Return a handle to the "index" child with the given name. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( int index ) const; - -#ifdef TIXML_USE_STL - TiXmlHandle FirstChild( const std::string& _value ) const - { - return FirstChild( _value.c_str() ); - } - TiXmlHandle FirstChildElement( const std::string& _value ) const - { - return FirstChildElement( _value.c_str() ); - } - - TiXmlHandle Child( const std::string& _value, int index ) const - { - return Child( _value.c_str(), index ); - } - TiXmlHandle ChildElement( const std::string& _value, int index ) const - { - return ChildElement( _value.c_str(), index ); - } -#endif - - /** Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* ToNode() const - { - return node; - } - /** Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* ToElement() const - { - return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); - } - /** Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* ToText() const - { - return ( ( node && node->ToText() ) ? node->ToText() : 0 ); - } - /** Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* ToUnknown() const - { - return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); - } - - /** @deprecated use ToNode. - Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* Node() const - { - return ToNode(); - } - /** @deprecated use ToElement. - Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* Element() const - { - return ToElement(); - } - /** @deprecated use ToText() - Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* Text() const - { - return ToText(); - } - /** @deprecated use ToUnknown() - Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* Unknown() const - { - return ToUnknown(); - } - -private: - TiXmlNode* node; -}; - - -/** Print to memory functionality. The TiXmlPrinter is useful when you need to: - - -# Print to memory (especially in non-STL mode) - -# Control formatting (line endings, etc.) - - When constructed, the TiXmlPrinter is in its default "pretty printing" mode. - Before calling Accept() you can call methods to control the printing - of the XML document. After TiXmlNode::Accept() is called, the printed document can - be accessed via the CStr(), Str(), and Size() methods. - - TiXmlPrinter uses the Visitor API. - @verbatim - TiXmlPrinter printer; - printer.SetIndent( "\t" ); - - doc.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - @endverbatim -*/ -class TiXmlPrinter : public TiXmlVisitor -{ -public: - TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), - buffer(), indent( " " ), lineBreak( "\n" ) {} - - virtual bool VisitEnter( const TiXmlDocument& doc ); - virtual bool VisitExit( const TiXmlDocument& doc ); - - virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); - virtual bool VisitExit( const TiXmlElement& element ); - - virtual bool Visit( const TiXmlDeclaration& declaration ); - virtual bool Visit( const TiXmlText& text ); - virtual bool Visit( const TiXmlComment& comment ); - virtual bool Visit( const TiXmlUnknown& unknown ); - - /** Set the indent characters for printing. By default 4 spaces - but tab (\t) is also useful, or null/empty string for no indentation. - */ - void SetIndent( const char* _indent ) - { - indent = _indent ? _indent : "" ; - } - /// Query the indention string. - const char* Indent() - { - return indent.c_str(); - } - /** Set the line breaking string. By default set to newline (\n). - Some operating systems prefer other characters, or can be - set to the null/empty string for no indenation. - */ - void SetLineBreak( const char* _lineBreak ) - { - lineBreak = _lineBreak ? _lineBreak : ""; - } - /// Query the current line breaking string. - const char* LineBreak() - { - return lineBreak.c_str(); - } - - /** Switch over to "stream printing" which is the most dense formatting without - linebreaks. Common when the XML is needed for network transmission. - */ - void SetStreamPrinting() - { - indent = ""; - lineBreak = ""; - } - /// Return the result. - const char* CStr() - { - return buffer.c_str(); - } - /// Return the length of the result string. - size_t Size() - { - return buffer.size(); - } - -#ifdef TIXML_USE_STL - /// Return the result. - const std::string& Str() - { - return buffer; - } -#endif - -private: - void DoIndent() - { - for( int i=0; i -#include - -#include "tinyxml.h" - -//#define DEBUG_PARSER -#if defined( DEBUG_PARSER ) -# if defined( DEBUG ) && defined( _MSC_VER ) -# include -# define TIXML_LOG OutputDebugString -# else -# define TIXML_LOG printf -# endif -#endif - -// Note tha "PutString" hardcodes the same list. This -// is less flexible than it appears. Changing the entries -// or order will break putstring. -TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = -{ - { "&", 5, '&' }, - { "<", 4, '<' }, - { ">", 4, '>' }, - { """, 6, '\"' }, - { "'", 6, '\'' } -}; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// Including the basic of this table, which determines the #bytes in the -// sequence from the lead byte. 1 placed for invalid sequences -- -// although the result will be junk, pass it through as much as possible. -// Beware of the non-characters in UTF-8: -// ef bb bf (Microsoft "lead bytes") -// ef bf be -// ef bf bf - -const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - -const int TiXmlBase::utf8ByteTable[256] = -{ - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid -}; - - -void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) - { - *length = 1; - } - else if ( input < 0x800 ) - { - *length = 2; - } - else if ( input < 0x10000 ) - { - *length = 3; - } - else if ( input < 0x200000 ) - { - *length = 4; - } - else - { - *length = 0; // This code won't covert this correctly anyway. - return; - } - - output += *length; - - // Scary scary fall throughs. - switch (*length) - { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - } -} - - -/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - - // if ( encoding == TIXML_ENCODING_UTF8 ) - // { - if ( anyByte < 127 ) - { - return isalpha( anyByte ); - } - else - { - return 1; // What else to do? The unicode set is huge...get the english ones right. - } - - // } - // else - // { - // return isalpha( anyByte ); - // } -} - - -/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - - // if ( encoding == TIXML_ENCODING_UTF8 ) - // { - if ( anyByte < 127 ) - { - return isalnum( anyByte ); - } - else - { - return 1; // What else to do? The unicode set is huge...get the english ones right. - } - - // } - // else - // { - // return isalnum( anyByte ); - // } -} - - -class TiXmlParsingData -{ - friend class TiXmlDocument; -public: - void Stamp( const char* now, TiXmlEncoding encoding ); - - const TiXmlCursor& Cursor() const - { - return cursor; - } - -private: - // Only used by the document! - TiXmlParsingData( const char* start, int _tabsize, int row, int col ) - { - assert( start ); - stamp = start; - tabsize = _tabsize; - cursor.row = row; - cursor.col = col; - } - - TiXmlCursor cursor; - const char* stamp; - int tabsize; -}; - - -void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) -{ - assert( now ); - - // Do nothing if the tabsize is 0. - if ( tabsize < 1 ) - { - return; - } - - // Get the current row, column. - int row = cursor.row; - int col = cursor.col; - const char* p = stamp; - assert( p ); - - while ( p < now ) - { - // Treat p as unsigned, so we have a happy compiler. - const unsigned char* pU = (const unsigned char*)p; - - // Code contributed by Fletcher Dunn: (modified by lee) - switch (*pU) - { - case 0: - // We *should* never get here, but in case we do, don't - // advance past the terminating null character, ever - return; - - case '\r': - // bump down to the next line - ++row; - col = 0; - // Eat the character - ++p; - - // Check for \r\n sequence, and treat this as a single character - if (*p == '\n') - { - ++p; - } - - break; - - case '\n': - // bump down to the next line - ++row; - col = 0; - - // Eat the character - ++p; - - // Check for \n\r sequence, and treat this as a single - // character. (Yes, this bizarre thing does occur still - // on some arcane platforms...) - if (*p == '\r') - { - ++p; - } - - break; - - case '\t': - // Eat the character - ++p; - - // Skip to next tab stop - col = (col / tabsize + 1) * tabsize; - break; - - case TIXML_UTF_LEAD_0: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( *(p+1) && *(p+2) ) - { - // In these cases, don't advance the column. These are - // 0-width spaces. - if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - { - p += 3; - } - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - { - p += 3; - } - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - { - p += 3; - } - else - { - p +=3; // A normal character. - ++col; - } - } - } - else - { - ++p; - ++col; - } - - break; - - default: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // Eat the 1 to 4 byte utf8 character. - int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; - - if ( step == 0 ) - { - step = 1; // Error case from bad encoding, but handle gracefully. - } - - p += step; - - // Just advance one column, of course. - ++col; - } - else - { - ++p; - ++col; - } - - break; - } - } - - cursor.row = row; - cursor.col = col; - assert( cursor.row >= -1 ); - assert( cursor.col >= -1 ); - stamp = p; - assert( stamp ); -} - - -const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) -{ - if ( !p || !*p ) - { - return 0; - } - - if ( encoding == TIXML_ENCODING_UTF8 ) - { - while ( *p ) - { - const unsigned char* pU = (const unsigned char*)p; - - // Skip the stupid Microsoft UTF-8 Byte order marks - if ( *(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==TIXML_UTF_LEAD_1 - && *(pU+2)==TIXML_UTF_LEAD_2 ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbeU ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbfU ) - { - p += 3; - continue; - } - - if ( IsWhiteSpace( *p ) ) // Still using old rules for white space. - { - ++p; - } - else - { - break; - } - } - } - else - { - while ( *p && IsWhiteSpace( *p ) ) - { - ++p; - } - } - - return p; -} - -#ifdef TIXML_USE_STL -/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream* in, TIXML_STRING* tag ) -{ - for( ;; ) - { - if ( !in->good() ) - { - return false; - } - - int c = in->peek(); - - // At this scope, we can't get to a document. So fail silently. - if ( !IsWhiteSpace( c ) || c <= 0 ) - { - return true; - } - - *tag += (char) in->get(); - } -} - -/*static*/ bool TiXmlBase::StreamTo( std::istream* in, int character, TIXML_STRING* tag ) -{ - //assert( character > 0 && character < 128 ); // else it won't work in utf-8 - while ( in->good() ) - { - int c = in->peek(); - - if ( c == character ) - { - return true; - } - - if ( c <= 0 ) // Silent failure: can't get document at this scope - { - return false; - } - - in->get(); - *tag += (char) c; - } - - return false; -} -#endif - -// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The -// "assign" optimization removes over 10% of the execution time. -// -const char* TiXmlBase::ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ) -{ - // Oddly, not supported on some comilers, - //name->clear(); - // So use this: - *name = ""; - assert( p ); - - // Names start with letters or underscores. - // Of course, in unicode, tinyxml has no idea what a letter *is*. The - // algorithm is generous. - // - // After that, they can be letters, underscores, numbers, - // hyphens, or colons. (Colons are valid ony for namespaces, - // but tinyxml can't tell namespaces from names.) - if ( p && *p - && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) - { - const char* start = p; - - while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) - || *p == '_' - || *p == '-' - || *p == '.' - || *p == ':' ) ) - { - //(*name) += *p; // expensive - ++p; - } - - if ( p-start > 0 ) - { - name->assign( start, p-start ); - } - - return p; - } - - return 0; -} - -const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) -{ - // Presume an entity, and pull it out. - TIXML_STRING ent; - int i; - *length = 0; - - if ( *(p+1) && *(p+1) == '#' && *(p+2) ) - { - unsigned long ucs = 0; - ptrdiff_t delta = 0; - unsigned mult = 1; - - if ( *(p+2) == 'x' ) - { - // Hexadecimal. - if ( !*(p+3) ) - { - return 0; - } - - const char* q = p+3; - q = strchr( q, ';' ); - - if ( !q || !*q ) - { - return 0; - } - - delta = q-p; - --q; - - while ( *q != 'x' ) - { - if ( *q >= '0' && *q <= '9' ) - { - ucs += mult * (*q - '0'); - } - else if ( *q >= 'a' && *q <= 'f' ) - { - ucs += mult * (*q - 'a' + 10); - } - else if ( *q >= 'A' && *q <= 'F' ) - { - ucs += mult * (*q - 'A' + 10 ); - } - else - { - return 0; - } - - mult *= 16; - --q; - } - } - else - { - // Decimal. - if ( !*(p+2) ) - { - return 0; - } - - const char* q = p+2; - q = strchr( q, ';' ); - - if ( !q || !*q ) - { - return 0; - } - - delta = q-p; - --q; - - while ( *q != '#' ) - { - if ( *q >= '0' && *q <= '9' ) - { - ucs += mult * (*q - '0'); - } - else - { - return 0; - } - - mult *= 10; - --q; - } - } - - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - } - else - { - *value = (char)ucs; - *length = 1; - } - - return p + delta + 1; - } - - // Now try to match it. - for( i=0; iappend( cArr, len ); - } - } - else - { - bool whitespace = false; - - // Remove leading white space: - p = SkipWhiteSpace( p, encoding ); - - while ( p && *p - && !StringEqual( p, endTag, caseInsensitive, encoding ) ) - { - if ( *p == '\r' || *p == '\n' ) - { - whitespace = true; - ++p; - } - else if ( IsWhiteSpace( *p ) ) - { - whitespace = true; - ++p; - } - else - { - // If we've found whitespace, add it before the - // new character. Any whitespace just becomes a space. - if ( whitespace ) - { - (*text) += ' '; - whitespace = false; - } - - int len; - char cArr[4] = { 0, 0, 0, 0 }; - p = GetChar( p, cArr, &len, encoding ); - - if ( len == 1 ) - { - (*text) += cArr[0]; // more efficient - } - else - { - text->append( cArr, len ); - } - } - } - } - - if ( p && *p ) - { - p += strlen( endTag ); - } - - return ( p && *p ) ? p : 0; -} - -#ifdef TIXML_USE_STL - -void TiXmlDocument::StreamIn( std::istream* in, TIXML_STRING* tag ) -{ - // The basic issue with a document is that we don't know what we're - // streaming. Read something presumed to be a tag (and hope), then - // identify it, and call the appropriate stream method on the tag. - // - // This "pre-streaming" will never read the closing ">" so the - // sub-tag can orient itself. - - if ( !StreamTo( in, '<', tag ) ) - { - SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - while ( in->good() ) - { - int tagIndex = (int) tag->length(); - - while ( in->good() && in->peek() != '>' ) - { - int c = in->get(); - - if ( c <= 0 ) - { - SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - break; - } - - (*tag) += (char) c; - } - - if ( in->good() ) - { - // We now have something we presume to be a node of - // some sort. Identify it, and call the node to - // continue streaming. - TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); - - if ( node ) - { - node->StreamIn( in, tag ); - bool isElement = node->ToElement() != 0; - delete node; - node = 0; - - // If this is the root element, we're done. Parsing will be - // done by the >> operator. - if ( isElement ) - { - return; - } - } - else - { - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - } - } - - // We should have returned sooner. - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); -} - -#endif - -const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) -{ - ClearError(); - - // Parse away, at the document level. Since a document - // contains nothing but other tags, most of what happens - // here is skipping white space. - if ( !p || !*p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - // Note that, for a document, this needs to come - // before the while space skip, so that parsing - // starts from the pointer we are given. - location.Clear(); - - if ( prevData ) - { - location.row = prevData->cursor.row; - location.col = prevData->cursor.col; - } - else - { - location.row = 0; - location.col = 0; - } - - TiXmlParsingData data( p, TabSize(), location.row, location.col ); - location = data.Cursor(); - - if ( encoding == TIXML_ENCODING_UNKNOWN ) - { - // Check for the Microsoft UTF-8 lead bytes. - const unsigned char* pU = (const unsigned char*)p; - - if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 - && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 - && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) - { - encoding = TIXML_ENCODING_UTF8; - useMicrosoftBOM = true; - } - } - - p = SkipWhiteSpace( p, encoding ); - - if ( !p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - while ( p && *p ) - { - TiXmlNode* node = Identify( p, encoding ); - - if ( node ) - { - p = node->Parse( p, &data, encoding ); - LinkEndChild( node ); - } - else - { - break; - } - - // Did we get encoding info? - if ( encoding == TIXML_ENCODING_UNKNOWN - && node->ToDeclaration() ) - { - TiXmlDeclaration* dec = node->ToDeclaration(); - const char* enc = dec->Encoding(); - assert( enc ); - - if ( *enc == 0 ) - { - encoding = TIXML_ENCODING_UTF8; - } - else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) - { - encoding = TIXML_ENCODING_UTF8; - } - else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) - { - encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - } - else - { - encoding = TIXML_ENCODING_LEGACY; - } - } - - p = SkipWhiteSpace( p, encoding ); - } - - // Was this empty? - if ( !firstChild ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); - return 0; - } - - // All is well. - return p; -} - -void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - // The first error in a chain is more accurate - don't set again! - if ( error ) - { - return; - } - - assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); - error = true; - errorId = err; - errorDesc = errorString[ errorId ]; - - errorLocation.Clear(); - - if ( pError && data ) - { - data->Stamp( pError, encoding ); - errorLocation = data->Cursor(); - } -} - - -TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) -{ - TiXmlNode* returnNode = 0; - - p = SkipWhiteSpace( p, encoding ); - - if( !p || !*p || *p != '<' ) - { - return 0; - } - - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p ) - { - return 0; - } - - // What is this thing? - // - Elements start with a letter or underscore, but xml is reserved. - // - Comments: "; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - { - document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); - } - - return 0; - } - - p += strlen( startTag ); - - // [ 1475201 ] TinyXML parses entities in comments - // Oops - ReadText doesn't work, because we don't want to parse the entities. - // p = ReadText( p, &value, false, endTag, false, encoding ); - // - // from the XML spec: - /* - [Definition: Comments may appear anywhere in a document outside other markup; in addition, - they may appear within the document type declaration at places allowed by the grammar. - They are not part of the document's character data; an XML processor MAY, but need not, - make it possible for an application to retrieve the text of comments. For compatibility, - the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity - references MUST NOT be recognized within comments. - - An example of a comment: - - - */ - - value = ""; - - // Keep all the white space. - while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) - { - value.append( p, 1 ); - ++p; - } - - if ( p && *p ) - { - p += strlen( endTag ); - } - - return p; -} - - -const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p ) - { - return 0; - } - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - - // Read the name, the '=' and the value. - const char* pErr = p; - p = ReadName( p, &name, encoding ); - - if ( !p || !*p ) - { - if ( document ) - { - document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); - } - - return 0; - } - - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p || *p != '=' ) - { - if ( document ) - { - document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - } - - return 0; - } - - ++p; // skip '=' - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p ) - { - if ( document ) - { - document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - } - - return 0; - } - - const char* end; - const char SINGLE_QUOTE = '\''; - const char DOUBLE_QUOTE = '\"'; - - if ( *p == SINGLE_QUOTE ) - { - ++p; - end = "\'"; // single quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else if ( *p == DOUBLE_QUOTE ) - { - ++p; - end = "\""; // double quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else - { - // All attribute values should be in single or double quotes. - // But this is such a common error that the parser will try - // its best, even without them. - value = ""; - - while ( p && *p // existence - && !IsWhiteSpace( *p ) // whitespace - && *p != '/' && *p != '>' ) // tag end - { - if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) - { - // [ 1451649 ] Attribute values with trailing quotes not handled correctly - // We did not have an opening quote but seem to have a - // closing one. Give up and throw an error. - if ( document ) - { - document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - } - - return 0; - } - - value += *p; - ++p; - } - } - - return p; -} - -#ifdef TIXML_USE_STL -void TiXmlText::StreamIn( std::istream* in, TIXML_STRING* tag ) -{ - while ( in->good() ) - { - int c = in->peek(); - - if ( !cdata && (c == '<' ) ) - { - return; - } - - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - - if ( document ) - { - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - } - - return; - } - - (*tag) += (char) c; - in->get(); // "commits" the peek made above - - if ( cdata && c == '>' && tag->size() >= 3 ) - { - size_t len = tag->size(); - - if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) - { - // terminator of cdata. - return; - } - } - } -} -#endif - -const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - value = ""; - TiXmlDocument* document = GetDocument(); - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - - const char* const startTag = ""; - - if ( cdata || StringEqual( p, startTag, false, encoding ) ) - { - cdata = true; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - { - document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); - } - - return 0; - } - - p += strlen( startTag ); - - // Keep all the white space, ignore the encoding, etc. - while ( p && *p - && !StringEqual( p, endTag, false, encoding ) - ) - { - value += *p; - ++p; - } - - TIXML_STRING dummy; - p = ReadText( p, &dummy, false, endTag, false, encoding ); - return p; - } - else - { - bool ignoreWhite = true; - - const char* end = "<"; - p = ReadText( p, &value, ignoreWhite, end, false, encoding ); - - if ( p && *p ) - { - return p-1; // don't truncate the '<' - } - - return 0; - } -} - -#ifdef TIXML_USE_STL -void TiXmlDeclaration::StreamIn( std::istream* in, TIXML_STRING* tag ) -{ - while ( in->good() ) - { - int c = in->get(); - - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - - if ( document ) - { - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - } - - return; - } - - (*tag) += (char) c; - - if ( c == '>' ) - { - // All is well. - return; - } - } -} -#endif - -const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) -{ - p = SkipWhiteSpace( p, _encoding ); - // Find the beginning, find the end, and look for - // the stuff in-between. - TiXmlDocument* document = GetDocument(); - - if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); - } - - return 0; - } - - if ( data ) - { - data->Stamp( p, _encoding ); - location = data->Cursor(); - } - - p += 5; - - version = ""; - encoding = ""; - standalone = ""; - - while ( p && *p ) - { - if ( *p == '>' ) - { - ++p; - return p; - } - - p = SkipWhiteSpace( p, _encoding ); - - if ( StringEqual( p, "version", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - version = attrib.Value(); - } - else if ( StringEqual( p, "encoding", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - encoding = attrib.Value(); - } - else if ( StringEqual( p, "standalone", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - standalone = attrib.Value(); - } - else - { - // Read over whatever it is. - while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) - { - ++p; - } - } - } - - return 0; -} - -bool TiXmlText::Blank() const -{ - for ( unsigned i=0; i ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(MutiProcess_Queue SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(MutiProcess_Queue ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.cbp b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.cbp new file mode 100644 index 000000000..521f83a48 --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.cbp @@ -0,0 +1,46 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.depend b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.exp b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.exp new file mode 100644 index 000000000..744d28142 Binary files /dev/null and b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.exp differ diff --git a/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.layout b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.lib b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.lib new file mode 100644 index 000000000..b46ee1c21 Binary files /dev/null and b/purenessscopeserver/example-Module/MutiProcess/LinuxQueue.lib differ diff --git a/purenessscopeserver/example-Module/MutiProcess/Makefile_MutiProcess_Queue b/purenessscopeserver/example-Module/MutiProcess/Makefile_MutiProcess_Queue new file mode 100644 index 000000000..d204f6ade --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/Makefile_MutiProcess_Queue @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=MutiProcess_Queue +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/MutiProcess +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="MutiProcess_Queue.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)./Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Queue_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Queue_LinuxQueue.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/MutiProcess_Queue" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Queue_BaseCommand.cpp$(ObjectSuffix): ./Queue/BaseCommand.cpp $(IntermediateDirectory)/Queue_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Queue/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Queue_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Queue_BaseCommand.cpp$(DependSuffix): ./Queue/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Queue_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Queue_BaseCommand.cpp$(DependSuffix) -MM ./Queue/BaseCommand.cpp + +$(IntermediateDirectory)/Queue_BaseCommand.cpp$(PreprocessSuffix): ./Queue/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Queue_BaseCommand.cpp$(PreprocessSuffix) ./Queue/BaseCommand.cpp + +$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(ObjectSuffix): ./Queue/LinuxQueue.cpp $(IntermediateDirectory)/Queue_LinuxQueue.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Queue/LinuxQueue.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(DependSuffix): ./Queue/LinuxQueue.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(DependSuffix) -MM ./Queue/LinuxQueue.cpp + +$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(PreprocessSuffix): ./Queue/LinuxQueue.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Queue_LinuxQueue.cpp$(PreprocessSuffix) ./Queue/LinuxQueue.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/MutiProcess/Makefile_MutiProcess_Watch b/purenessscopeserver/example-Module/MutiProcess/Makefile_MutiProcess_Watch new file mode 100644 index 000000000..5393a3c0e --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/Makefile_MutiProcess_Watch @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=MutiProcess_Watch +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/MutiProcess +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="MutiProcess_Watch.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/MutiProcess_Watch" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix): ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp $(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Watch/Watch.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix): ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix) -MM ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + +$(IntermediateDirectory)/Watch_Watch.cpp$(PreprocessSuffix): ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Watch_Watch.cpp$(PreprocessSuffix) ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Queue.mk b/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Queue.mk new file mode 100644 index 000000000..2005dc41a --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Queue.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=MutiProcess_Queue +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MutiProcess +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月31日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="MutiProcess_Queue.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)./Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Queue_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Queue_LinuxQueue.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/MutiProcess_Queue" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Queue_BaseCommand.cpp$(ObjectSuffix): ./Queue/BaseCommand.cpp $(IntermediateDirectory)/Queue_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MutiProcess/Queue/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Queue_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Queue_BaseCommand.cpp$(DependSuffix): ./Queue/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Queue_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Queue_BaseCommand.cpp$(DependSuffix) -MM ./Queue/BaseCommand.cpp + +$(IntermediateDirectory)/Queue_BaseCommand.cpp$(PreprocessSuffix): ./Queue/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Queue_BaseCommand.cpp$(PreprocessSuffix) ./Queue/BaseCommand.cpp + +$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(ObjectSuffix): ./Queue/LinuxQueue.cpp $(IntermediateDirectory)/Queue_LinuxQueue.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(DependSuffix): ./Queue/LinuxQueue.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(DependSuffix) -MM ./Queue/LinuxQueue.cpp + +$(IntermediateDirectory)/Queue_LinuxQueue.cpp$(PreprocessSuffix): ./Queue/LinuxQueue.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Queue_LinuxQueue.cpp$(PreprocessSuffix) ./Queue/LinuxQueue.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Queue.txt b/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Queue.txt new file mode 100644 index 000000000..6e5035b86 --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Queue.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/Queue_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/Queue_LinuxQueue.cpp.o diff --git a/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Watch.mk b/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Watch.mk new file mode 100644 index 000000000..82cde0010 --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Watch.mk @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=MutiProcess_Watch +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MutiProcess +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月31日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="MutiProcess_Watch.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/MutiProcess_Watch" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix): ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp $(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix): ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Watch_Watch.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Watch_Watch.cpp$(DependSuffix) -MM ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + +$(IntermediateDirectory)/Watch_Watch.cpp$(PreprocessSuffix): ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Watch_Watch.cpp$(PreprocessSuffix) ../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Watch.txt b/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Watch.txt new file mode 100644 index 000000000..a8abb70f2 --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/MutiProcess_Watch.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/Watch_Watch.cpp.o diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue.mk b/purenessscopeserver/example-Module/MutiProcess/Queue.mk new file mode 100644 index 000000000..3a45b0916 --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/Queue.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=MutiProcess_Queue +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/purenessscopeserver/Prj_CodeLite +ProjectPath :=/data/develop/Lib/Network/PSS-master/Build/purenessscopeserver/Prj_CodeLite/MutiProcess_Queue +IntermediateDirectory :=./Debug +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月06日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=bin/Release/libMutiProcess_Queue +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="MutiProcess_Queue.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../../purenessscopeserver/Common $(IncludeSwitch)../../../../purenessscopeserver/example-Module/MutiProcess/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/purenessscopeserver/Prj_CodeLite/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/purenessscopeserver/Prj_CodeLite/.build-release/MutiProcess_Queue" + +MakeIntermediateDirs: + @test -d ./Debug || $(MakeDirCommand) ./Debug + + +$(IntermediateDirectory)/.d: + @test -d ./Debug || $(MakeDirCommand) ./Debug + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(ObjectSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/BaseCommand.cpp $(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MutiProcess/Queue/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(DependSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(DependSuffix) -MM ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/BaseCommand.cpp + +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(PreprocessSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_BaseCommand.cpp$(PreprocessSuffix) ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/BaseCommand.cpp + +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(ObjectSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.cpp $(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(DependSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(DependSuffix) -MM ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.cpp + +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(PreprocessSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Queue_LinuxQueue.cpp$(PreprocessSuffix) ../../../../purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r ./Debug/ + + diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue.project b/purenessscopeserver/example-Module/MutiProcess/Queue.project new file mode 100644 index 000000000..76d129772 --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/Queue.project @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.mpc b/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.mpc deleted file mode 100644 index 95e72dd6e..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(LinuxQueue):acelib{ - sharedname=LinuxQueue - dynamicflags += TEST_TCP_BUILD_QUEUE_DLL - libout = ./ - - Source_Files{ - ./*.cpp - ../Common/*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../../PurenessScopeServer/Linux_Bin - } - includes += ../../../Common ../Common -} diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcproj b/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcproj deleted file mode 100644 index 02e36a09f..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcproj +++ /dev/null @@ -1,428 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcxproj b/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcxproj deleted file mode 100644 index 75a897e42..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcxproj +++ /dev/null @@ -1,245 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {802917F3-FECA-1BAD-3698-18B50000002E} - LinuxQueue - Win32Proj - - - - DynamicLibrary - v110 - NotSet - - - DynamicLibrary - v110 - NotSet - - - DynamicLibrary - v110 - NotSet - - - DynamicLibrary - v110 - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\LinuxQueue\I386\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\LinuxQueue\I386\ - false - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\LinuxQueue\AMD64\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\LinuxQueue\AMD64\ - false - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);..\..\include;..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_QUEUE_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);..\..\include;..\Common;%(AdditionalIncludeDirectories) - - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\LinuxQueued.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);..\..\include;..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_QUEUE_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);..\..\include;..\Common;%(AdditionalIncludeDirectories) - - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)LinuxQueue.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\LinuxQueue.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);..\..\include;..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_QUEUE_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);..\..\include;..\Common;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)LinuxQueued.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\LinuxQueued.lib - MachineX64 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);..\..\include;..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_QUEUE_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);..\..\include;..\Common;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)LinuxQueue.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\LinuxQueue.lib - MachineX64 - - - - - - - - - - - - - true - true - true - true - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcxproj.filters b/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcxproj.filters deleted file mode 100644 index 3b8616ba6..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueue.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {9834c348-5e35-4b33-9dd2-4a861a3d239d} - cpp;cxx;cc;c;C - - - {cf5d112f-601a-4f79-949d-9a5497bae215} - h;hpp;hxx;hh - - - {90392e01-3252-41ce-8689-183a19b08b07} - mpc;mpb;mwc - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Build Files - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueued.exp b/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueued.exp deleted file mode 100644 index dc0b66074..000000000 Binary files a/purenessscopeserver/example-Module/MutiProcess/Queue/LinuxQueued.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/Makefile b/purenessscopeserver/example-Module/MutiProcess/Queue/Makefile deleted file mode 100644 index 7c3821d9b..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include Makefile.define - -# Ĭϳ -default:all - -# Ӧļб -PATS = BaseCommand.o LinuxQueue.o - -LIB_BASE_OBJS = BaseCommand.o LinuxQueue.o -LIB_BASE = libLinuxQueue.so - -all: libLinuxQueue.so clear - -# Ӧó -all:$(LIB_BASE) Makefile - -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) - -# -clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libLinuxQueue.so ../../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/Makefile.define b/purenessscopeserver/example-Module/MutiProcess/Queue/Makefile.define deleted file mode 100644 index e35790a85..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../../include -I ../Common -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/Queue.sln b/purenessscopeserver/example-Module/MutiProcess/Queue/Queue.sln deleted file mode 100644 index 8934e615b..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/Queue.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LinuxQueue", "LinuxQueue.vcxproj", "{802917F3-FECA-1BAD-3698-18B50000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {802917F3-FECA-1BAD-3698-18B50000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {802917F3-FECA-1BAD-3698-18B50000002E}.Debug|Win32.Build.0 = Debug|Win32 - {802917F3-FECA-1BAD-3698-18B50000002E}.Debug|x64.ActiveCfg = Debug|x64 - {802917F3-FECA-1BAD-3698-18B50000002E}.Debug|x64.Build.0 = Debug|x64 - {802917F3-FECA-1BAD-3698-18B50000002E}.Release|Win32.ActiveCfg = Release|Win32 - {802917F3-FECA-1BAD-3698-18B50000002E}.Release|Win32.Build.0 = Release|Win32 - {802917F3-FECA-1BAD-3698-18B50000002E}.Release|x64.ActiveCfg = Release|x64 - {802917F3-FECA-1BAD-3698-18B50000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/runlinuxmake.sh b/purenessscopeserver/example-Module/MutiProcess/Queue/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/MutiProcess/Queue/zzz.bat b/purenessscopeserver/example-Module/MutiProcess/Queue/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Queue/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/MutiProcess/Watch.mk b/purenessscopeserver/example-Module/MutiProcess/Watch.mk new file mode 100644 index 000000000..f23ebde05 --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/Watch.mk @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=MutiProcess_Watch +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/purenessscopeserver/Prj_CodeLite +ProjectPath :=/data/develop/Lib/Network/PSS-master/Build/purenessscopeserver/Prj_CodeLite/MutiProcess_Watch +IntermediateDirectory :=./Debug +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月06日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=bin/Release/libMutiProcess_Watch +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="MutiProcess_Watch.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Debug + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/purenessscopeserver/Prj_CodeLite/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/purenessscopeserver/Prj_CodeLite/.build-release/MutiProcess_Watch" + +MakeIntermediateDirs: + @test -d ./Debug || $(MakeDirCommand) ./Debug + + +$(IntermediateDirectory)/.d: + @test -d ./Debug || $(MakeDirCommand) ./Debug + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(ObjectSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp $(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(DependSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(DependSuffix) -MM ../../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + +$(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(PreprocessSuffix): ../../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_up_purenessscopeserver_example-Module_MutiProcess_Watch_Watch.cpp$(PreprocessSuffix) ../../../../purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r ./Debug/ + + diff --git a/purenessscopeserver/example-Module/MutiProcess/Watch.project b/purenessscopeserver/example-Module/MutiProcess/Watch.project new file mode 100644 index 000000000..19239c52b --- /dev/null +++ b/purenessscopeserver/example-Module/MutiProcess/Watch.project @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp b/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp index f640bd455..d667ed203 100644 --- a/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp +++ b/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.cpp @@ -20,7 +20,7 @@ //ӽ #define CHILDCOUNT 1 - +/* //дռļ int AcquireWriteLock(int fd, int start, int len) { @@ -33,7 +33,7 @@ int AcquireWriteLock(int fd, int start, int len) return fcntl(fd, F_SETLKW, &arg); } - +*/ //ͷŶռļ int ReleaseLock(int fd, int start, int len) { @@ -46,7 +46,7 @@ int ReleaseLock(int fd, int start, int len) return fcntl(fd, F_SETLKW, &arg); } - +/* //鿴д int SeeLock(int fd, int start, int len) { @@ -77,6 +77,7 @@ int SeeLock(int fd, int start, int len) return 0; } +*/ int Chlid_Run() { diff --git a/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.mpc b/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.mpc deleted file mode 100644 index 8255cbb01..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Watch/Watch.mpc +++ /dev/null @@ -1,14 +0,0 @@ -project(Watch):aceexe{ - exename=Watch - includes += ../../include ../Common - specific (prop:microsoft){ - exeout=”../../../PurenessScopeServer/Windows_Bin” - }else{ - macros += __LINUX__ - } - - Source_Files { - ../Common/*.cpp - *.cpp - } -} diff --git a/purenessscopeserver/example-Module/MutiProcess/Watch/zzz.sh b/purenessscopeserver/example-Module/MutiProcess/Watch/zzz.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/MutiProcess/Watch/zzz.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/CMakeLists.txt b/purenessscopeserver/example-Module/PlugAtoB/CMakeLists.txt new file mode 100644 index 000000000..859508a89 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/CMakeLists.txt @@ -0,0 +1,84 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(PlugB) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_PlugB_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./PlugB/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./PlugB/PlugB.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(PlugB SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(PlugB ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/PlugAtoB/Makefile_PlugA b/purenessscopeserver/example-Module/PlugAtoB/Makefile_PlugA new file mode 100644 index 000000000..73c68c164 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/Makefile_PlugA @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PlugA +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/PlugAtoB +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PlugA.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/PlugA_PlugA.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/PlugA" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(ObjectSuffix): ./PlugA/BaseCommand.cpp $(IntermediateDirectory)/PlugA_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PlugA/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(DependSuffix): ./PlugA/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(DependSuffix) -MM ./PlugA/BaseCommand.cpp + +$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(PreprocessSuffix): ./PlugA/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PlugA_BaseCommand.cpp$(PreprocessSuffix) ./PlugA/BaseCommand.cpp + +$(IntermediateDirectory)/PlugA_PlugA.cpp$(ObjectSuffix): ./PlugA/PlugA.cpp $(IntermediateDirectory)/PlugA_PlugA.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PlugA/PlugA.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PlugA_PlugA.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PlugA_PlugA.cpp$(DependSuffix): ./PlugA/PlugA.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PlugA_PlugA.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PlugA_PlugA.cpp$(DependSuffix) -MM ./PlugA/PlugA.cpp + +$(IntermediateDirectory)/PlugA_PlugA.cpp$(PreprocessSuffix): ./PlugA/PlugA.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PlugA_PlugA.cpp$(PreprocessSuffix) ./PlugA/PlugA.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/Makefile_PlugB b/purenessscopeserver/example-Module/PlugAtoB/Makefile_PlugB new file mode 100644 index 000000000..cc0f00067 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/Makefile_PlugB @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PlugB +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/PlugAtoB +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PlugB.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/PlugB_PlugB.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/PlugB" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(ObjectSuffix): ./PlugB/BaseCommand.cpp $(IntermediateDirectory)/PlugB_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PlugB/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(DependSuffix): ./PlugB/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(DependSuffix) -MM ./PlugB/BaseCommand.cpp + +$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(PreprocessSuffix): ./PlugB/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PlugB_BaseCommand.cpp$(PreprocessSuffix) ./PlugB/BaseCommand.cpp + +$(IntermediateDirectory)/PlugB_PlugB.cpp$(ObjectSuffix): ./PlugB/PlugB.cpp $(IntermediateDirectory)/PlugB_PlugB.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./PlugB/PlugB.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PlugB_PlugB.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PlugB_PlugB.cpp$(DependSuffix): ./PlugB/PlugB.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PlugB_PlugB.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PlugB_PlugB.cpp$(DependSuffix) -MM ./PlugB/PlugB.cpp + +$(IntermediateDirectory)/PlugB_PlugB.cpp$(PreprocessSuffix): ./PlugB/PlugB.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PlugB_PlugB.cpp$(PreprocessSuffix) ./PlugB/PlugB.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA.cbp b/purenessscopeserver/example-Module/PlugAtoB/PlugA.cbp new file mode 100644 index 000000000..a4e96f395 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugA.cbp @@ -0,0 +1,44 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA.depend b/purenessscopeserver/example-Module/PlugAtoB/PlugA.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugA.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA.exp b/purenessscopeserver/example-Module/PlugAtoB/PlugA.exp new file mode 100644 index 000000000..f627d22e9 Binary files /dev/null and b/purenessscopeserver/example-Module/PlugAtoB/PlugA.exp differ diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA.layout b/purenessscopeserver/example-Module/PlugAtoB/PlugA.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugA.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA.lib b/purenessscopeserver/example-Module/PlugAtoB/PlugA.lib new file mode 100644 index 000000000..1df9fd849 Binary files /dev/null and b/purenessscopeserver/example-Module/PlugAtoB/PlugA.lib differ diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA.mk b/purenessscopeserver/example-Module/PlugAtoB/PlugA.mk new file mode 100644 index 000000000..923aede4c --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugA.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PlugA +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/PlugAtoB +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PlugA.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/PlugA_PlugA.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/PlugA" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(ObjectSuffix): ./PlugA/BaseCommand.cpp $(IntermediateDirectory)/PlugA_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/PlugAtoB/PlugA/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(DependSuffix): ./PlugA/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(DependSuffix) -MM ./PlugA/BaseCommand.cpp + +$(IntermediateDirectory)/PlugA_BaseCommand.cpp$(PreprocessSuffix): ./PlugA/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PlugA_BaseCommand.cpp$(PreprocessSuffix) ./PlugA/BaseCommand.cpp + +$(IntermediateDirectory)/PlugA_PlugA.cpp$(ObjectSuffix): ./PlugA/PlugA.cpp $(IntermediateDirectory)/PlugA_PlugA.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PlugA_PlugA.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PlugA_PlugA.cpp$(DependSuffix): ./PlugA/PlugA.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PlugA_PlugA.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PlugA_PlugA.cpp$(DependSuffix) -MM ./PlugA/PlugA.cpp + +$(IntermediateDirectory)/PlugA_PlugA.cpp$(PreprocessSuffix): ./PlugA/PlugA.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PlugA_PlugA.cpp$(PreprocessSuffix) ./PlugA/PlugA.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA.project b/purenessscopeserver/example-Module/PlugAtoB/PlugA.project new file mode 100644 index 000000000..30f305666 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugA.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA.txt b/purenessscopeserver/example-Module/PlugAtoB/PlugA.txt new file mode 100644 index 000000000..9fba59f12 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugA.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/PlugA_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/PlugA_PlugA.cpp.o diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/Makefile b/purenessscopeserver/example-Module/PlugAtoB/PlugA/Makefile deleted file mode 100644 index 80b6d4c4c..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include Makefile.define - -# Ĭϳ -default:all - -# Ӧļб -PATS = BaseCommand.o PlugA.o - -LIB_BASE_OBJS = BaseCommand.o PlugA.o -LIB_BASE = libPlugA.so - -all: libPlugA.so clear - -# Ӧó -all:$(LIB_BASE) Makefile - -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) - -# -clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libPlugA.so ../../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/Makefile.define b/purenessscopeserver/example-Module/PlugAtoB/PlugA/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.mpc b/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.mpc deleted file mode 100644 index 17dc5dbcd..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(PlugA):acelib{ - sharedname=PlugA - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../../Common -} diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.sln b/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.sln deleted file mode 100644 index 5550b4e97..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PlugA", "PlugA.vcxproj", "{39011FA9-FECA-1BAD-B333-8A350000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {39011FA9-FECA-1BAD-B333-8A350000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {39011FA9-FECA-1BAD-B333-8A350000002E}.Debug|Win32.Build.0 = Debug|Win32 - {39011FA9-FECA-1BAD-B333-8A350000002E}.Debug|x64.ActiveCfg = Debug|x64 - {39011FA9-FECA-1BAD-B333-8A350000002E}.Debug|x64.Build.0 = Debug|x64 - {39011FA9-FECA-1BAD-B333-8A350000002E}.Release|Win32.ActiveCfg = Release|Win32 - {39011FA9-FECA-1BAD-B333-8A350000002E}.Release|Win32.Build.0 = Release|Win32 - {39011FA9-FECA-1BAD-B333-8A350000002E}.Release|x64.ActiveCfg = Release|x64 - {39011FA9-FECA-1BAD-B333-8A350000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcproj b/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcproj deleted file mode 100644 index 8a5e36f18..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcproj +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcxproj b/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcxproj deleted file mode 100644 index 83e93385e..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcxproj +++ /dev/null @@ -1,244 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {39011FA9-FECA-1BAD-B333-8A350000002E} - PlugA - Win32Proj - - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\PlugA\I386\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\PlugA\I386\ - false - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\PlugA\AMD64\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\PlugA\AMD64\ - false - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\PlugAd.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)PlugA.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\PlugA.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)PlugAd.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\PlugAd.lib - MachineX64 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)PlugA.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\PlugA.lib - MachineX64 - - - - - - - - - - - - true - true - true - true - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcxproj.filters b/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcxproj.filters deleted file mode 100644 index 79caf82e7..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugA.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {e1d143da-b807-412d-9df3-f689dc7880a0} - cpp;cxx;cc;c;C - - - {84ba3430-ece3-4f24-9ebb-e050a1eea4d8} - h;hpp;hxx;hh - - - {ca018399-ca2b-433a-a272-12320d87cc69} - mpc;mpb;mwc - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Build Files - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugAd.exp b/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugAd.exp deleted file mode 100644 index 1dcbbd184..000000000 Binary files a/purenessscopeserver/example-Module/PlugAtoB/PlugA/PlugAd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/runlinuxmake.sh b/purenessscopeserver/example-Module/PlugAtoB/PlugA/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugA/zzz.bat b/purenessscopeserver/example-Module/PlugAtoB/PlugA/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugA/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB.cbp b/purenessscopeserver/example-Module/PlugAtoB/PlugB.cbp new file mode 100644 index 000000000..3b7836122 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugB.cbp @@ -0,0 +1,44 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB.depend b/purenessscopeserver/example-Module/PlugAtoB/PlugB.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugB.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB.exp b/purenessscopeserver/example-Module/PlugAtoB/PlugB.exp new file mode 100644 index 000000000..9dcf82b0b Binary files /dev/null and b/purenessscopeserver/example-Module/PlugAtoB/PlugB.exp differ diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB.layout b/purenessscopeserver/example-Module/PlugAtoB/PlugB.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugB.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB.lib b/purenessscopeserver/example-Module/PlugAtoB/PlugB.lib new file mode 100644 index 000000000..aae4b3d62 Binary files /dev/null and b/purenessscopeserver/example-Module/PlugAtoB/PlugB.lib differ diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB.mk b/purenessscopeserver/example-Module/PlugAtoB/PlugB.mk new file mode 100644 index 000000000..71ee68333 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugB.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=PlugB +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/PlugAtoB +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="PlugB.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/PlugB_PlugB.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/PlugB" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(ObjectSuffix): ./PlugB/BaseCommand.cpp $(IntermediateDirectory)/PlugB_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/PlugAtoB/PlugB/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(DependSuffix): ./PlugB/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(DependSuffix) -MM ./PlugB/BaseCommand.cpp + +$(IntermediateDirectory)/PlugB_BaseCommand.cpp$(PreprocessSuffix): ./PlugB/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PlugB_BaseCommand.cpp$(PreprocessSuffix) ./PlugB/BaseCommand.cpp + +$(IntermediateDirectory)/PlugB_PlugB.cpp$(ObjectSuffix): ./PlugB/PlugB.cpp $(IntermediateDirectory)/PlugB_PlugB.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/PlugB_PlugB.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/PlugB_PlugB.cpp$(DependSuffix): ./PlugB/PlugB.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/PlugB_PlugB.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/PlugB_PlugB.cpp$(DependSuffix) -MM ./PlugB/PlugB.cpp + +$(IntermediateDirectory)/PlugB_PlugB.cpp$(PreprocessSuffix): ./PlugB/PlugB.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/PlugB_PlugB.cpp$(PreprocessSuffix) ./PlugB/PlugB.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB.project b/purenessscopeserver/example-Module/PlugAtoB/PlugB.project new file mode 100644 index 000000000..bfe107a7e --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugB.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB.txt b/purenessscopeserver/example-Module/PlugAtoB/PlugB.txt new file mode 100644 index 000000000..777a959c6 --- /dev/null +++ b/purenessscopeserver/example-Module/PlugAtoB/PlugB.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/PlugB_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/PlugB_PlugB.cpp.o diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/Makefile b/purenessscopeserver/example-Module/PlugAtoB/PlugB/Makefile deleted file mode 100644 index 8eb98e029..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include Makefile.define - -# Ĭϳ -default:all - -# Ӧļб -PATS = BaseCommand.o PlugB.o - -LIB_BASE_OBJS = BaseCommand.o PlugB.o -LIB_BASE = libPlugB.so - -all: libPlugB.so clear - -# Ӧó -all:$(LIB_BASE) Makefile - -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) - -# -clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libPlugB.so ../../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/Makefile.define b/purenessscopeserver/example-Module/PlugAtoB/PlugB/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.mpc b/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.mpc deleted file mode 100644 index b42b1c5d5..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(PlugB):acelib{ - sharedname=PlugB - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../../Common -} diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.sln b/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.sln deleted file mode 100644 index 0ed45f748..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PlugB", "PlugB.vcxproj", "{09011FA9-FECA-1BAD-B330-8A350000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {09011FA9-FECA-1BAD-B330-8A350000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {09011FA9-FECA-1BAD-B330-8A350000002E}.Debug|Win32.Build.0 = Debug|Win32 - {09011FA9-FECA-1BAD-B330-8A350000002E}.Debug|x64.ActiveCfg = Debug|x64 - {09011FA9-FECA-1BAD-B330-8A350000002E}.Debug|x64.Build.0 = Debug|x64 - {09011FA9-FECA-1BAD-B330-8A350000002E}.Release|Win32.ActiveCfg = Release|Win32 - {09011FA9-FECA-1BAD-B330-8A350000002E}.Release|Win32.Build.0 = Release|Win32 - {09011FA9-FECA-1BAD-B330-8A350000002E}.Release|x64.ActiveCfg = Release|x64 - {09011FA9-FECA-1BAD-B330-8A350000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcproj b/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcproj deleted file mode 100644 index ac89d5412..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcproj +++ /dev/null @@ -1,405 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcxproj b/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcxproj deleted file mode 100644 index d7068c53e..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcxproj +++ /dev/null @@ -1,244 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {09011FA9-FECA-1BAD-B330-8A350000002E} - PlugB - Win32Proj - - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\PlugB\I386\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\PlugB\I386\ - false - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\PlugB\AMD64\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\PlugB\AMD64\ - false - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\PlugBd.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)PlugB.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\PlugB.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)PlugBd.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\PlugBd.lib - MachineX64 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)PlugB.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\PlugB.lib - MachineX64 - - - - - - - - - - - - true - true - true - true - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcxproj.filters b/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcxproj.filters deleted file mode 100644 index a7ea7db23..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugB.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {56226f49-e9a5-473b-a171-8a589ed77f60} - cpp;cxx;cc;c;C - - - {12a16d5d-6d57-405f-9388-53778c370fbf} - h;hpp;hxx;hh - - - {383d016f-2900-4d90-9de4-a402646898a1} - mpc;mpb;mwc - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Build Files - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugBd.exp b/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugBd.exp deleted file mode 100644 index 0545f5504..000000000 Binary files a/purenessscopeserver/example-Module/PlugAtoB/PlugB/PlugBd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/runlinuxmake.sh b/purenessscopeserver/example-Module/PlugAtoB/PlugB/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/PlugAtoB/PlugB/zzz.bat b/purenessscopeserver/example-Module/PlugAtoB/PlugB/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/PlugAtoB/PlugB/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/Proxy/CMakeLists.txt b/purenessscopeserver/example-Module/Proxy/CMakeLists.txt new file mode 100644 index 000000000..7c3d84b0e --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/CMakeLists.txt @@ -0,0 +1,83 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(ProxyServer) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_ProxyServer_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./ProxyServer/ProxyServeMain.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(ProxyServer SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(ProxyServer ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/Proxy/Makefile b/purenessscopeserver/example-Module/Proxy/Makefile new file mode 100644 index 000000000..b487b3df0 --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/Makefile @@ -0,0 +1,128 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=Proxy +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/Proxy +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="Proxy.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/Proxy_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Proxy_ProxyTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/Proxy" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(ObjectSuffix): ./Proxy/ProxyClient.cpp $(IntermediateDirectory)/Proxy_ProxyClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Proxy/ProxyClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(DependSuffix): ./Proxy/ProxyClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(DependSuffix) -MM ./Proxy/ProxyClient.cpp + +$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(PreprocessSuffix): ./Proxy/ProxyClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Proxy_ProxyClient.cpp$(PreprocessSuffix) ./Proxy/ProxyClient.cpp + +$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(ObjectSuffix): ./Proxy/BaseCommand.cpp $(IntermediateDirectory)/Proxy_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Proxy/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(DependSuffix): ./Proxy/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(DependSuffix) -MM ./Proxy/BaseCommand.cpp + +$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(PreprocessSuffix): ./Proxy/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Proxy_BaseCommand.cpp$(PreprocessSuffix) ./Proxy/BaseCommand.cpp + +$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(ObjectSuffix): ./Proxy/ProxyTest.cpp $(IntermediateDirectory)/Proxy_ProxyTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./Proxy/ProxyTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(DependSuffix): ./Proxy/ProxyTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(DependSuffix) -MM ./Proxy/ProxyTest.cpp + +$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(PreprocessSuffix): ./Proxy/ProxyTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Proxy_ProxyTest.cpp$(PreprocessSuffix) ./Proxy/ProxyTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/Proxy/Makefile_ProxyServer b/purenessscopeserver/example-Module/Proxy/Makefile_ProxyServer new file mode 100644 index 000000000..da3b61995 --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/Makefile_ProxyServer @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=ProxyServer +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/Proxy +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="ProxyServer.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/ProxyServer" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(ObjectSuffix): ./ProxyServer/ProxyServeMain.cpp $(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./ProxyServer/ProxyServeMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(DependSuffix): ./ProxyServer/ProxyServeMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(DependSuffix) -MM ./ProxyServer/ProxyServeMain.cpp + +$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(PreprocessSuffix): ./ProxyServer/ProxyServeMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(PreprocessSuffix) ./ProxyServer/ProxyServeMain.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/Proxy/Proxy.mk b/purenessscopeserver/example-Module/Proxy/Proxy.mk new file mode 100644 index 000000000..abc5d6b4d --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/Proxy.mk @@ -0,0 +1,128 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=Proxy +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Proxy +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="Proxy.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/Proxy_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/Proxy_ProxyTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/Proxy" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(ObjectSuffix): ./Proxy/ProxyClient.cpp $(IntermediateDirectory)/Proxy_ProxyClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Proxy/Proxy/ProxyClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(DependSuffix): ./Proxy/ProxyClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(DependSuffix) -MM ./Proxy/ProxyClient.cpp + +$(IntermediateDirectory)/Proxy_ProxyClient.cpp$(PreprocessSuffix): ./Proxy/ProxyClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Proxy_ProxyClient.cpp$(PreprocessSuffix) ./Proxy/ProxyClient.cpp + +$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(ObjectSuffix): ./Proxy/BaseCommand.cpp $(IntermediateDirectory)/Proxy_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Proxy/Proxy/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(DependSuffix): ./Proxy/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(DependSuffix) -MM ./Proxy/BaseCommand.cpp + +$(IntermediateDirectory)/Proxy_BaseCommand.cpp$(PreprocessSuffix): ./Proxy/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Proxy_BaseCommand.cpp$(PreprocessSuffix) ./Proxy/BaseCommand.cpp + +$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(ObjectSuffix): ./Proxy/ProxyTest.cpp $(IntermediateDirectory)/Proxy_ProxyTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(DependSuffix): ./Proxy/ProxyTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(DependSuffix) -MM ./Proxy/ProxyTest.cpp + +$(IntermediateDirectory)/Proxy_ProxyTest.cpp$(PreprocessSuffix): ./Proxy/ProxyTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/Proxy_ProxyTest.cpp$(PreprocessSuffix) ./Proxy/ProxyTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/Proxy/Proxy.project b/purenessscopeserver/example-Module/Proxy/Proxy.project new file mode 100644 index 000000000..36f3cbe5e --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/Proxy.project @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/Proxy/Proxy.txt b/purenessscopeserver/example-Module/Proxy/Proxy.txt new file mode 100644 index 000000000..2c89ee74a --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/Proxy.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/Proxy_ProxyClient.cpp.o ../../../Build/Linux/Linux_Bin/Temp/Proxy_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/Proxy_ProxyTest.cpp.o diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/Makefile b/purenessscopeserver/example-Module/Proxy/Proxy/Makefile deleted file mode 100644 index 2d7922303..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -include Makefile.define - -# Ĭϳ -default:all - -# Ӧļб -PATS = BaseCommand.o ProxyTest.o ProxyClient.o - -LIB_BASE_OBJS = BaseCommand.o ProxyTest.o ProxyClient.o -LIB_BASE = libProxyTest.so - -all: libProxyTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile - -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) - -# -clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libProxyTest.so ../../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/Makefile.define b/purenessscopeserver/example-Module/Proxy/Proxy/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/Proxy.sln b/purenessscopeserver/example-Module/Proxy/Proxy/Proxy.sln deleted file mode 100644 index 5df0a5b6b..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/Proxy.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProxyTest", "ProxyTest.vcxproj", "{1D8BB6BB-FECA-1BAD-2211-C29F0000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E}.Debug|Win32.Build.0 = Debug|Win32 - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E}.Debug|x64.ActiveCfg = Debug|x64 - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E}.Debug|x64.Build.0 = Debug|x64 - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E}.Release|Win32.ActiveCfg = Release|Win32 - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E}.Release|Win32.Build.0 = Release|Win32 - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E}.Release|x64.ActiveCfg = Release|x64 - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.mpc b/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.mpc deleted file mode 100644 index 731d0c848..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(ProxyTest):acelib{ - sharedname=ProxyTest - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../../Common -} diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcproj b/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcproj deleted file mode 100644 index 38310389a..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcproj +++ /dev/null @@ -1,432 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcxproj b/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcxproj deleted file mode 100644 index 7f82d940b..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcxproj +++ /dev/null @@ -1,246 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {1D8BB6BB-FECA-1BAD-2211-C29F0000002E} - ProxyTest - Win32Proj - - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\ProxyTest\I386\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\ProxyTest\I386\ - false - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Debug\ProxyTest\AMD64\ - true - - - ..\..\..\PurenessScopeServer\Windows_Bin\ - Release\ProxyTest\AMD64\ - false - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\ProxyTestd.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)ProxyTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\ProxyTest.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)ProxyTestd.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\ProxyTestd.lib - MachineX64 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\..\include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)ProxyTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\ProxyTest.lib - MachineX64 - - - - - - - - - - - - - - true - true - true - true - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcxproj.filters b/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcxproj.filters deleted file mode 100644 index d32a02b5a..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/ProxyTest.vcxproj.filters +++ /dev/null @@ -1,41 +0,0 @@ - - - - - {490f6496-f42d-4759-ba0c-d757decd512b} - cpp;cxx;cc;c;C - - - {f09337de-3cef-4ffe-b44f-66b3e3b79591} - h;hpp;hxx;hh - - - {2fed8a8e-0e4b-4d92-95e7-c763e350dbee} - mpc;mpb;mwc - - - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Build Files - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/runlinuxmake.sh b/purenessscopeserver/example-Module/Proxy/Proxy/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Proxy/Proxy/zzz.bat b/purenessscopeserver/example-Module/Proxy/Proxy/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/Proxy/Proxy/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer.cbp b/purenessscopeserver/example-Module/Proxy/ProxyServer.cbp new file mode 100644 index 000000000..813fabe89 --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyServer.cbp @@ -0,0 +1,42 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer.depend b/purenessscopeserver/example-Module/Proxy/ProxyServer.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyServer.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer.layout b/purenessscopeserver/example-Module/Proxy/ProxyServer.layout new file mode 100644 index 000000000..fb7327ede --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyServer.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer.mk b/purenessscopeserver/example-Module/Proxy/ProxyServer.mk new file mode 100644 index 000000000..a4e06ae3c --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyServer.mk @@ -0,0 +1,112 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=ProxyServer +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Proxy +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="ProxyServer.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/ProxyServer" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(ObjectSuffix): ./ProxyServer/ProxyServeMain.cpp $(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServeMain.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(DependSuffix): ./ProxyServer/ProxyServeMain.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(DependSuffix) -MM ./ProxyServer/ProxyServeMain.cpp + +$(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(PreprocessSuffix): ./ProxyServer/ProxyServeMain.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ProxyServer_ProxyServeMain.cpp$(PreprocessSuffix) ./ProxyServer/ProxyServeMain.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer.project b/purenessscopeserver/example-Module/Proxy/ProxyServer.project new file mode 100644 index 000000000..bbeec4906 --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyServer.project @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer.txt b/purenessscopeserver/example-Module/Proxy/ProxyServer.txt new file mode 100644 index 000000000..b6770fa0e --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyServer.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/ProxyServer_ProxyServeMain.cpp.o diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.sln b/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.sln deleted file mode 100644 index 2cb2e609b..000000000 --- a/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProxyServer", "ProxyServer.vcxproj", "{86C154EC-FECA-1BAD-2211-C29F0000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {86C154EC-FECA-1BAD-2211-C29F0000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {86C154EC-FECA-1BAD-2211-C29F0000002E}.Debug|Win32.Build.0 = Debug|Win32 - {86C154EC-FECA-1BAD-2211-C29F0000002E}.Debug|x64.ActiveCfg = Debug|x64 - {86C154EC-FECA-1BAD-2211-C29F0000002E}.Debug|x64.Build.0 = Debug|x64 - {86C154EC-FECA-1BAD-2211-C29F0000002E}.Release|Win32.ActiveCfg = Release|Win32 - {86C154EC-FECA-1BAD-2211-C29F0000002E}.Release|Win32.Build.0 = Release|Win32 - {86C154EC-FECA-1BAD-2211-C29F0000002E}.Release|x64.ActiveCfg = Release|x64 - {86C154EC-FECA-1BAD-2211-C29F0000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.vcproj b/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.vcproj deleted file mode 100644 index 3675bafd0..000000000 --- a/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.vcproj +++ /dev/null @@ -1,391 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.vcxproj b/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.vcxproj deleted file mode 100644 index 77c9521e1..000000000 --- a/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyServer.vcxproj +++ /dev/null @@ -1,236 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {86C154EC-FECA-1BAD-2211-C29F0000002E} - ProxyServer - Win32Proj - - - - Application - v110 - NotSet - - - Application - v110 - NotSet - - - Application - v110 - NotSet - - - Application - v110 - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - .\ - Debug\ProxyServer\I386\ - true - - - Release\ - Release\ProxyServer\I386\ - false - - - .\ - Debug\ProxyServer\AMD64\ - true - - - Release\ - Release\ProxyServer\AMD64\ - false - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.\;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.\;%(AdditionalIncludeDirectories) - - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Console - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.\;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.\;%(AdditionalIncludeDirectories) - - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)ProxyServer.exe - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Console - true - true - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.\;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.\;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)ProxyServer.exe - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Console - MachineX64 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.\;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_CONSOLE;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.\;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)ProxyServer.exe - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Console - true - true - MachineX64 - - - - - - - - true - true - true - true - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyTest.mpc b/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyTest.mpc deleted file mode 100644 index f5e234a4d..000000000 --- a/purenessscopeserver/example-Module/Proxy/ProxyServer/ProxyTest.mpc +++ /dev/null @@ -1,13 +0,0 @@ -project(ProxyServer):aceexe{ - exename = ProxyServer - - Source_Files{ - ./*.cpp - } - includes += ./ - - specific (prop:microsoft){ - } else { - macros += __LINUX__ - } -} \ No newline at end of file diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer/zzz.bat b/purenessscopeserver/example-Module/Proxy/ProxyServer/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/Proxy/ProxyServer/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/Proxy/ProxyServer/zzz.sh b/purenessscopeserver/example-Module/Proxy/ProxyServer/zzz.sh deleted file mode 100644 index bb1e8f6ec..000000000 --- a/purenessscopeserver/example-Module/Proxy/ProxyServer/zzz.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace diff --git a/purenessscopeserver/example-Module/Proxy/ProxyTest.cbp b/purenessscopeserver/example-Module/Proxy/ProxyTest.cbp new file mode 100644 index 000000000..ce6013a85 --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyTest.cbp @@ -0,0 +1,46 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/Proxy/ProxyTest.depend b/purenessscopeserver/example-Module/Proxy/ProxyTest.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyTest.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/Proxy/ProxyTest.exp b/purenessscopeserver/example-Module/Proxy/ProxyTest.exp new file mode 100644 index 000000000..2381879ed Binary files /dev/null and b/purenessscopeserver/example-Module/Proxy/ProxyTest.exp differ diff --git a/purenessscopeserver/example-Module/Proxy/ProxyTest.layout b/purenessscopeserver/example-Module/Proxy/ProxyTest.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/Proxy/ProxyTest.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/Proxy/ProxyTest.lib b/purenessscopeserver/example-Module/Proxy/ProxyTest.lib new file mode 100644 index 000000000..753907e31 Binary files /dev/null and b/purenessscopeserver/example-Module/Proxy/ProxyTest.lib differ diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/CMakeLists.txt b/purenessscopeserver/example-Module/RealTimeMonitor/CMakeLists.txt new file mode 100644 index 000000000..ea4290c83 --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/CMakeLists.txt @@ -0,0 +1,86 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(RealTimeMonitor) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_RealTimeMonitor_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./RealTimeMonitor/RealTimeMonitor.cpp + ${CMAKE_CURRENT_LIST_DIR}/./RealTimeMonitor/cJSON.cpp + ${CMAKE_CURRENT_LIST_DIR}/./RealTimeMonitor/PostMonitorData.cpp + ${CMAKE_CURRENT_LIST_DIR}/./RealTimeMonitor/MonitorCommand.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(RealTimeMonitor SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(RealTimeMonitor ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/Makefile b/purenessscopeserver/example-Module/RealTimeMonitor/Makefile new file mode 100644 index 000000000..5fc44b5f5 --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/Makefile @@ -0,0 +1,136 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=RealTimeMonitor +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/RealTimeMonitor +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="RealTimeMonitor.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(ObjectSuffix) $(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(ObjectSuffix) $(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/RealTimeMonitor" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(ObjectSuffix): ./RealTimeMonitor/RealTimeMonitor.cpp $(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./RealTimeMonitor/RealTimeMonitor.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(DependSuffix): ./RealTimeMonitor/RealTimeMonitor.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(DependSuffix) -MM ./RealTimeMonitor/RealTimeMonitor.cpp + +$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(PreprocessSuffix): ./RealTimeMonitor/RealTimeMonitor.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(PreprocessSuffix) ./RealTimeMonitor/RealTimeMonitor.cpp + +$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(ObjectSuffix): ./RealTimeMonitor/cJSON.cpp $(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./RealTimeMonitor/cJSON.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(DependSuffix): ./RealTimeMonitor/cJSON.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(DependSuffix) -MM ./RealTimeMonitor/cJSON.cpp + +$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(PreprocessSuffix): ./RealTimeMonitor/cJSON.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(PreprocessSuffix) ./RealTimeMonitor/cJSON.cpp + +$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(ObjectSuffix): ./RealTimeMonitor/PostMonitorData.cpp $(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./RealTimeMonitor/PostMonitorData.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(DependSuffix): ./RealTimeMonitor/PostMonitorData.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(DependSuffix) -MM ./RealTimeMonitor/PostMonitorData.cpp + +$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(PreprocessSuffix): ./RealTimeMonitor/PostMonitorData.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(PreprocessSuffix) ./RealTimeMonitor/PostMonitorData.cpp + +$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(ObjectSuffix): ./RealTimeMonitor/MonitorCommand.cpp $(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./RealTimeMonitor/MonitorCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(DependSuffix): ./RealTimeMonitor/MonitorCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(DependSuffix) -MM ./RealTimeMonitor/MonitorCommand.cpp + +$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(PreprocessSuffix): ./RealTimeMonitor/MonitorCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(PreprocessSuffix) ./RealTimeMonitor/MonitorCommand.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/Monitor.mpc b/purenessscopeserver/example-Module/RealTimeMonitor/Monitor.mpc deleted file mode 100644 index 188e16a33..000000000 --- a/purenessscopeserver/example-Module/RealTimeMonitor/Monitor.mpc +++ /dev/null @@ -1,21 +0,0 @@ -project(RealTimeMonitor):acelib{ - sharedname=RealTimeMonitor - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common ./IniRead -} diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.cbp b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.cbp new file mode 100644 index 000000000..3326789d9 --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.cbp @@ -0,0 +1,50 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.depend b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.exp b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.exp new file mode 100644 index 000000000..f8db1466f Binary files /dev/null and b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.exp differ diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.layout b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.layout new file mode 100644 index 000000000..5e5e686f2 --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.lib b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.lib new file mode 100644 index 000000000..ab96890ef Binary files /dev/null and b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.lib differ diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.mk b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.mk new file mode 100644 index 000000000..6d3682f2b --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.mk @@ -0,0 +1,136 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=RealTimeMonitor +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/RealTimeMonitor +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="RealTimeMonitor.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(ObjectSuffix) $(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(ObjectSuffix) $(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(ObjectSuffix) $(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/RealTimeMonitor" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(ObjectSuffix): ./RealTimeMonitor/RealTimeMonitor.cpp $(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/RealTimeMonitor.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(DependSuffix): ./RealTimeMonitor/RealTimeMonitor.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(DependSuffix) -MM ./RealTimeMonitor/RealTimeMonitor.cpp + +$(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(PreprocessSuffix): ./RealTimeMonitor/RealTimeMonitor.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RealTimeMonitor_RealTimeMonitor.cpp$(PreprocessSuffix) ./RealTimeMonitor/RealTimeMonitor.cpp + +$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(ObjectSuffix): ./RealTimeMonitor/cJSON.cpp $(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/cJSON.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(DependSuffix): ./RealTimeMonitor/cJSON.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(DependSuffix) -MM ./RealTimeMonitor/cJSON.cpp + +$(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(PreprocessSuffix): ./RealTimeMonitor/cJSON.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RealTimeMonitor_cJSON.cpp$(PreprocessSuffix) ./RealTimeMonitor/cJSON.cpp + +$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(ObjectSuffix): ./RealTimeMonitor/PostMonitorData.cpp $(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/PostMonitorData.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(DependSuffix): ./RealTimeMonitor/PostMonitorData.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(DependSuffix) -MM ./RealTimeMonitor/PostMonitorData.cpp + +$(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(PreprocessSuffix): ./RealTimeMonitor/PostMonitorData.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RealTimeMonitor_PostMonitorData.cpp$(PreprocessSuffix) ./RealTimeMonitor/PostMonitorData.cpp + +$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(ObjectSuffix): ./RealTimeMonitor/MonitorCommand.cpp $(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/MonitorCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(DependSuffix): ./RealTimeMonitor/MonitorCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(DependSuffix) -MM ./RealTimeMonitor/MonitorCommand.cpp + +$(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(PreprocessSuffix): ./RealTimeMonitor/MonitorCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/RealTimeMonitor_MonitorCommand.cpp$(PreprocessSuffix) ./RealTimeMonitor/MonitorCommand.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.project b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.project new file mode 100644 index 000000000..39a102537 --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.project @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.sln b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.sln deleted file mode 100644 index 09d7aa05a..000000000 --- a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.sln +++ /dev/null @@ -1,33 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -# $Id: VC12WorkspaceCreator.pm 2211 2014-06-26 18:11:09Z elliott_c $ -# -# This file was generated by MPC. Any changes made directly to -# this file will be lost the next time it is generated. -# -# MPC Command: -# C:\Tools\ACE-6.3.0\ACE_wrappers\bin\mwc.pl -type vc12 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RealTimeMonitor", "RealTimeMonitor.vcxproj", "{5F1B26B0-FECA-1BAD-E280-C1FB0000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5F1B26B0-FECA-1BAD-E280-C1FB0000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {5F1B26B0-FECA-1BAD-E280-C1FB0000002E}.Debug|Win32.Build.0 = Debug|Win32 - {5F1B26B0-FECA-1BAD-E280-C1FB0000002E}.Debug|x64.ActiveCfg = Debug|x64 - {5F1B26B0-FECA-1BAD-E280-C1FB0000002E}.Debug|x64.Build.0 = Debug|x64 - {5F1B26B0-FECA-1BAD-E280-C1FB0000002E}.Release|Win32.ActiveCfg = Release|Win32 - {5F1B26B0-FECA-1BAD-E280-C1FB0000002E}.Release|Win32.Build.0 = Release|Win32 - {5F1B26B0-FECA-1BAD-E280-C1FB0000002E}.Release|x64.ActiveCfg = Release|x64 - {5F1B26B0-FECA-1BAD-E280-C1FB0000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.txt b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.txt new file mode 100644 index 000000000..a1f2eba47 --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/RealTimeMonitor_RealTimeMonitor.cpp.o ../../../Build/Linux/Linux_Bin/Temp/RealTimeMonitor_cJSON.cpp.o ../../../Build/Linux/Linux_Bin/Temp/RealTimeMonitor_PostMonitorData.cpp.o ../../../Build/Linux/Linux_Bin/Temp/RealTimeMonitor_MonitorCommand.cpp.o diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.vcxproj b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.vcxproj index 835e160bb..6a38ea20d 100644 --- a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.vcxproj +++ b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -23,32 +23,33 @@ {5F1B26B0-FECA-1BAD-E280-C1FB0000002E} RealTimeMonitor Win32Proj + 10.0.17763.0 DynamicLibrary true NotSet - v140 + v141 DynamicLibrary false NotSet - v140 + v141 true DynamicLibrary true NotSet - v140 + v141 DynamicLibrary false NotSet - v140 + v141 true @@ -99,8 +100,8 @@ AllRules.ruleset - ..\..\PurenessScopeServer\Windows_Bin\ - Release\RealTimeMonitor\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false RealTimeMonitor @@ -250,7 +251,7 @@ MaxSpeed true - $(ACE_ROOT);.;..\..\Common;.\IniRead;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -285,28 +286,16 @@ --> + + + + - - - - - - - - - - - - - - - - true - true - true - true - + + + + diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/Config.conf b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/Config.conf similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/Config.conf rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/Config.conf diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/IMonitorCommand.h b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/IMonitorCommand.h similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/IMonitorCommand.h rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/IMonitorCommand.h diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/MonitorCommand.cpp b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/MonitorCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/MonitorCommand.cpp rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/MonitorCommand.cpp diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/MonitorCommand.h b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/MonitorCommand.h similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/MonitorCommand.h rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/MonitorCommand.h diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/PostMonitorData.cpp b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/PostMonitorData.cpp similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/PostMonitorData.cpp rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/PostMonitorData.cpp diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/PostMonitorData.h b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/PostMonitorData.h similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/PostMonitorData.h rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/PostMonitorData.h diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.cpp b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/RealTimeMonitor.cpp similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor.cpp rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/RealTimeMonitor.cpp diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/cJSON.cpp b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/cJSON.cpp similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/cJSON.cpp rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/cJSON.cpp diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/cJSON.h b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/cJSON.h similarity index 100% rename from purenessscopeserver/example-Module/RealTimeMonitor/cJSON.h rename to purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/cJSON.h diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/readme.md b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/readme.md new file mode 100644 index 000000000..2ae607671 --- /dev/null +++ b/purenessscopeserver/example-Module/RealTimeMonitor/RealTimeMonitor/readme.md @@ -0,0 +1,62 @@ +# 监控数据包发送格式 +> 目前支持两个指令。 +```cpp +#define COMMAND_MONITOR_LOGIN 0x2001 //发送注册命令 +#define COMMAND_MONITOR_DATA 0x2002 //发送心跳当前数据吞吐命令 +#define COMMAND_MONITOR_LOGIN_ACK 0x8001 //注册命令回应 +#define COMMAND_MONITOR_DATA_ACK 0x8002 //当前数据吞吐命令回应 +``` + +## 命令格式 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
标签标签说明属性信息
COMMAND_MONITOR_LOGIN向监控服务器发注册指令属性说明
Version(uint16)数据包版本
CommandID(uint16)数据包命令ID
PacketBodyLength(uint32)数据包体的总长度,不包含包头长度
Session(char*32)数据包Session字符串
IP长度(uint16)当前服务器IP长度
IP(IP长度)当前服务器IP字符串
COMMAND_MONITOR_LOGIN_ACK注册指令返回属性说明
包长(uint32)数据包体的总长度,不包含包头长度
命令字(uint16)命令字
接收状态(uint32)接收状态
COMMAND_MONITOR_DATA向监控服务器发心跳指令属性说明
Version(uint16)数据包版本
CommandID(uint16)数据包命令ID
PacketBodyLength(uint32)数据包体的总长度,不包含包头长度
Session(char*32)数据包Session字符串
CpuRote(uint32)当前CPU运行百分比,除以100获得百分率
MemorySize(uint32)当前内存占用量,单位是Mb
ConnectCount(uint32)当前服务器连接数
DataInSize(uint32)当前一分钟内流入字节数
DataOutSize(uint32)当前一分钟内流出字节数
COMMAND_MONITOR_DATA_ACK心跳数据返回属性说明
包长(uint32)数据包体的总长度,不包含包头长度
命令字(uint16)命令字
接收状态(uint32)接收状态
\ No newline at end of file diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/runlinuxmake.sh b/purenessscopeserver/example-Module/RealTimeMonitor/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/RealTimeMonitor/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/RealTimeMonitor/zzz.bat b/purenessscopeserver/example-Module/RealTimeMonitor/zzz.bat deleted file mode 100644 index 6fe4b3ade..000000000 --- a/purenessscopeserver/example-Module/RealTimeMonitor/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc12 diff --git a/purenessscopeserver/example-Module/TTyTest/CMakeLists.txt b/purenessscopeserver/example-Module/TTyTest/CMakeLists.txt new file mode 100644 index 000000000..354c9ef5a --- /dev/null +++ b/purenessscopeserver/example-Module/TTyTest/CMakeLists.txt @@ -0,0 +1,89 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(TTyTest) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_TTyTest_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../ThirdLib/include/Common + ../../Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) +add_definitions( + -D__LINUX__ +) + + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./TTyTest/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./TTyTest/TTyTest.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(TTyTest SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(TTyTest ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/TTyTest/Makefile b/purenessscopeserver/example-Module/TTyTest/Makefile index 8e802b6ae..01963ff92 100644 --- a/purenessscopeserver/example-Module/TTyTest/Makefile +++ b/purenessscopeserver/example-Module/TTyTest/Makefile @@ -1,26 +1,120 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TTyTest +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/TTyTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)__LINUX__ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TTyTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../ThirdLib/include/Common $(IncludeSwitch)../../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o TTyTest.o -LIB_BASE_OBJS = BaseCommand.o TTyTest.o -LIB_BASE = libTTyTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TTyTest_TTyTest.cpp$(ObjectSuffix) -all: libTTyTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE): $(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/TTyTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(ObjectSuffix): ./TTyTest/BaseCommand.cpp $(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TTyTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(DependSuffix): ./TTyTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(DependSuffix) -MM ./TTyTest/BaseCommand.cpp + +$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(PreprocessSuffix): ./TTyTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(PreprocessSuffix) ./TTyTest/BaseCommand.cpp + +$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(ObjectSuffix): ./TTyTest/TTyTest.cpp $(IntermediateDirectory)/TTyTest_TTyTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TTyTest/TTyTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(DependSuffix): ./TTyTest/TTyTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(DependSuffix) -MM ./TTyTest/TTyTest.cpp + +$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(PreprocessSuffix): ./TTyTest/TTyTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TTyTest_TTyTest.cpp$(PreprocessSuffix) ./TTyTest/TTyTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libTTyTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TTyTest/Makefile.define b/purenessscopeserver/example-Module/TTyTest/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/TTyTest/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.cbp b/purenessscopeserver/example-Module/TTyTest/TTyTest.cbp new file mode 100644 index 000000000..8fa077b38 --- /dev/null +++ b/purenessscopeserver/example-Module/TTyTest/TTyTest.cbp @@ -0,0 +1,44 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.depend b/purenessscopeserver/example-Module/TTyTest/TTyTest.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/TTyTest/TTyTest.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.exp b/purenessscopeserver/example-Module/TTyTest/TTyTest.exp new file mode 100644 index 000000000..3915b56f9 Binary files /dev/null and b/purenessscopeserver/example-Module/TTyTest/TTyTest.exp differ diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.layout b/purenessscopeserver/example-Module/TTyTest/TTyTest.layout new file mode 100644 index 000000000..e18913f53 --- /dev/null +++ b/purenessscopeserver/example-Module/TTyTest/TTyTest.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.lib b/purenessscopeserver/example-Module/TTyTest/TTyTest.lib new file mode 100644 index 000000000..d45d4dab3 Binary files /dev/null and b/purenessscopeserver/example-Module/TTyTest/TTyTest.lib differ diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.mk b/purenessscopeserver/example-Module/TTyTest/TTyTest.mk new file mode 100644 index 000000000..a25e4d9aa --- /dev/null +++ b/purenessscopeserver/example-Module/TTyTest/TTyTest.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TTyTest +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TTyTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors :=$(PreprocessorSwitch)__LINUX__ +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TTyTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../ThirdLib/include/Common $(IncludeSwitch)../../Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TTyTest_TTyTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/TTyTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(ObjectSuffix): ./TTyTest/BaseCommand.cpp $(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TTyTest/TTyTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(DependSuffix): ./TTyTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(DependSuffix) -MM ./TTyTest/BaseCommand.cpp + +$(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(PreprocessSuffix): ./TTyTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TTyTest_BaseCommand.cpp$(PreprocessSuffix) ./TTyTest/BaseCommand.cpp + +$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(ObjectSuffix): ./TTyTest/TTyTest.cpp $(IntermediateDirectory)/TTyTest_TTyTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TTyTest/TTyTest/TTyTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(DependSuffix): ./TTyTest/TTyTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(DependSuffix) -MM ./TTyTest/TTyTest.cpp + +$(IntermediateDirectory)/TTyTest_TTyTest.cpp$(PreprocessSuffix): ./TTyTest/TTyTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TTyTest_TTyTest.cpp$(PreprocessSuffix) ./TTyTest/TTyTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.mpc b/purenessscopeserver/example-Module/TTyTest/TTyTest.mpc deleted file mode 100644 index ae4658eef..000000000 --- a/purenessscopeserver/example-Module/TTyTest/TTyTest.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(TTyTest):acelib{ - sharedname=TTyTest - dynamicflags += TEST_TTY_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.project b/purenessscopeserver/example-Module/TTyTest/TTyTest.project new file mode 100644 index 000000000..4cb7a5463 --- /dev/null +++ b/purenessscopeserver/example-Module/TTyTest/TTyTest.project @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.txt b/purenessscopeserver/example-Module/TTyTest/TTyTest.txt new file mode 100644 index 000000000..fe1264a2d --- /dev/null +++ b/purenessscopeserver/example-Module/TTyTest/TTyTest.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/TTyTest_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/TTyTest_TTyTest.cpp.o diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.vcproj b/purenessscopeserver/example-Module/TTyTest/TTyTest.vcproj deleted file mode 100644 index 0c3640de8..000000000 --- a/purenessscopeserver/example-Module/TTyTest/TTyTest.vcproj +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/TTyTest/BaseCommand.cpp b/purenessscopeserver/example-Module/TTyTest/TTyTest/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/TTyTest/BaseCommand.cpp rename to purenessscopeserver/example-Module/TTyTest/TTyTest/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/TTyTest/BaseCommand.h b/purenessscopeserver/example-Module/TTyTest/TTyTest/BaseCommand.h similarity index 83% rename from purenessscopeserver/example-Module/TTyTest/BaseCommand.h rename to purenessscopeserver/example-Module/TTyTest/TTyTest/BaseCommand.h index 265ddd19c..4f486482a 100644 --- a/purenessscopeserver/example-Module/TTyTest/BaseCommand.h +++ b/purenessscopeserver/example-Module/TTyTest/TTyTest/BaseCommand.h @@ -1,10 +1,10 @@ #pragma once -#include "..\..\Common\IBuffPacket.h" -#include "..\..\Common\ClientCommand.h" -#include "..\..\Common\IObject.h" -#include "..\..\Common\ITTyMessage.h" -#include "..\..\Common\ITTyClientManager.h" +#include "IBuffPacket.h" +#include "ClientCommand.h" +#include "IObject.h" +#include "ITTyMessage.h" +#include "ITTyClientManager.h" #include //ͻ(TCP) diff --git a/purenessscopeserver/example-Module/TTyTest/TTyTest.cpp b/purenessscopeserver/example-Module/TTyTest/TTyTest/TTyTest.cpp similarity index 98% rename from purenessscopeserver/example-Module/TTyTest/TTyTest.cpp rename to purenessscopeserver/example-Module/TTyTest/TTyTest/TTyTest.cpp index 5f7b3f686..04f5d4672 100644 --- a/purenessscopeserver/example-Module/TTyTest/TTyTest.cpp +++ b/purenessscopeserver/example-Module/TTyTest/TTyTest/TTyTest.cpp @@ -4,7 +4,7 @@ //2011-09-20 #include "BaseCommand.h" -#include "..\..\Common\IObject.h" +#include "IObject.h" #include "ace/svc_export.h" diff --git a/purenessscopeserver/example-Module/TTyTest/runlinuxmake.sh b/purenessscopeserver/example-Module/TTyTest/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/TTyTest/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TTyTest/zzz.bat b/purenessscopeserver/example-Module/TTyTest/zzz.bat deleted file mode 100644 index 3f85e426b..000000000 --- a/purenessscopeserver/example-Module/TTyTest/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc14 diff --git a/purenessscopeserver/example-Module/TcpTest/CMakeLists.txt b/purenessscopeserver/example-Module/TcpTest/CMakeLists.txt new file mode 100644 index 000000000..6c1cba37b --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/CMakeLists.txt @@ -0,0 +1,84 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(TcpTest) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_TcpTest_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./TcpTest/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./TcpTest/TcpTest.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(TcpTest SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(TcpTest ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/TcpTest/Makefile b/purenessscopeserver/example-Module/TcpTest/Makefile new file mode 100644 index 000000000..5d9153733 --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/Makefile @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TcpTest +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/TcpTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TcpTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TcpTest_TcpTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/TcpTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(ObjectSuffix): ./TcpTest/BaseCommand.cpp $(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TcpTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(DependSuffix): ./TcpTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(DependSuffix) -MM ./TcpTest/BaseCommand.cpp + +$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(PreprocessSuffix): ./TcpTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(PreprocessSuffix) ./TcpTest/BaseCommand.cpp + +$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(ObjectSuffix): ./TcpTest/TcpTest.cpp $(IntermediateDirectory)/TcpTest_TcpTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TcpTest/TcpTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(DependSuffix): ./TcpTest/TcpTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(DependSuffix) -MM ./TcpTest/TcpTest.cpp + +$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(PreprocessSuffix): ./TcpTest/TcpTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TcpTest_TcpTest.cpp$(PreprocessSuffix) ./TcpTest/TcpTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.exp b/purenessscopeserver/example-Module/TcpTest/TcpTest.exp new file mode 100644 index 000000000..104ba4a50 Binary files /dev/null and b/purenessscopeserver/example-Module/TcpTest/TcpTest.exp differ diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.lib b/purenessscopeserver/example-Module/TcpTest/TcpTest.lib new file mode 100644 index 000000000..b59314b92 Binary files /dev/null and b/purenessscopeserver/example-Module/TcpTest/TcpTest.lib differ diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.mk b/purenessscopeserver/example-Module/TcpTest/TcpTest.mk new file mode 100644 index 000000000..682f6b084 --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/TcpTest.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TcpTest +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TcpTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TcpTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TcpTest_TcpTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/TcpTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(ObjectSuffix): ./TcpTest/BaseCommand.cpp $(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TcpTest/TcpTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(DependSuffix): ./TcpTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(DependSuffix) -MM ./TcpTest/BaseCommand.cpp + +$(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(PreprocessSuffix): ./TcpTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TcpTest_BaseCommand.cpp$(PreprocessSuffix) ./TcpTest/BaseCommand.cpp + +$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(ObjectSuffix): ./TcpTest/TcpTest.cpp $(IntermediateDirectory)/TcpTest_TcpTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TcpTest/TcpTest/TcpTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(DependSuffix): ./TcpTest/TcpTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(DependSuffix) -MM ./TcpTest/TcpTest.cpp + +$(IntermediateDirectory)/TcpTest_TcpTest.cpp$(PreprocessSuffix): ./TcpTest/TcpTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TcpTest_TcpTest.cpp$(PreprocessSuffix) ./TcpTest/TcpTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.mpc b/purenessscopeserver/example-Module/TcpTest/TcpTest.mpc deleted file mode 100644 index 0c8f54bef..000000000 --- a/purenessscopeserver/example-Module/TcpTest/TcpTest.mpc +++ /dev/null @@ -1,21 +0,0 @@ -project(TcpTest):acelib{ - sharedname=TcpTest - dynamicflags += TEST_TCP_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../FrameCore/Windows_Bin - } else { - dllout = ../../FrameCore/Linux_Bin - } - includes += . - includes += ../../Common ./IniRead -} diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.project b/purenessscopeserver/example-Module/TcpTest/TcpTest.project new file mode 100644 index 000000000..620cf12c2 --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/TcpTest.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.sln b/purenessscopeserver/example-Module/TcpTest/TcpTest.sln deleted file mode 100644 index a58b030c8..000000000 --- a/purenessscopeserver/example-Module/TcpTest/TcpTest.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TcpTest", "TcpTest.vcxproj", "{6C2026BE-FECA-1BAD-2246-D8260000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Debug|Win32.Build.0 = Debug|Win32 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Debug|x64.ActiveCfg = Debug|x64 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Debug|x64.Build.0 = Debug|x64 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Release|Win32.ActiveCfg = Release|Win32 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Release|Win32.Build.0 = Release|Win32 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Release|x64.ActiveCfg = Release|x64 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.txt b/purenessscopeserver/example-Module/TcpTest/TcpTest.txt new file mode 100644 index 000000000..0824cce9b --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/TcpTest.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/TcpTest_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/TcpTest_TcpTest.cpp.o diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.vcproj b/purenessscopeserver/example-Module/TcpTest/TcpTest.vcproj deleted file mode 100644 index f2660ad8f..000000000 --- a/purenessscopeserver/example-Module/TcpTest/TcpTest.vcproj +++ /dev/null @@ -1,484 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.vcxproj b/purenessscopeserver/example-Module/TcpTest/TcpTest.vcxproj deleted file mode 100644 index 0c0851c98..000000000 --- a/purenessscopeserver/example-Module/TcpTest/TcpTest.vcxproj +++ /dev/null @@ -1,253 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {6C2026BE-FECA-1BAD-2246-D8260000002E} - TcpTest - Win32Proj - 8.1 - - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\..\FrameCore\Windows_Bin\ - Debug\TcpTest\I386\ - true - - - ..\..\PurenessScopeServer\Windows_Bin\ - Release\TcpTest\I386\ - false - - - ..\..\FrameCore\Windows_Bin\ - Debug\TcpTest\AMD64\ - true - - - ..\..\PurenessScopeServer\Windows_Bin\ - Release\TcpTest\AMD64\ - false - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\Common;.\IniRead;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - - - ACEd.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\TcpTestd.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - - - ACE.lib;%(AdditionalDependencies) - $(OutDir)TcpTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\TcpTest.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;%(AdditionalDependencies) - $(OutDir)TcpTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\TcpTestd.lib - MachineX64 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) - TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;%(AdditionalDependencies) - $(OutDir)TcpTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\TcpTest.lib - MachineX64 - - - - - - - - - - - - true - true - true - true - - - - - true - true - true - true - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.vcxproj.filters b/purenessscopeserver/example-Module/TcpTest/TcpTest.vcxproj.filters deleted file mode 100644 index a84d7dc0e..000000000 --- a/purenessscopeserver/example-Module/TcpTest/TcpTest.vcxproj.filters +++ /dev/null @@ -1,41 +0,0 @@ - - - - - {b7ff86ea-90f4-4ebe-bad3-0df6d7296521} - cpp;cxx;cc;c;C - - - {bc8e7c2b-121e-4134-87a2-4507d5ba15fa} - h;hpp;hxx;hh - - - {ca54fa94-70eb-4d1c-814b-e57b6ef68396} - mpc;mpb;mwc - - - {296cea86-dcb3-4676-a318-ffae8215e6e4} - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Build Files - - - Documentation - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TcpTest/BaseCommand.cpp b/purenessscopeserver/example-Module/TcpTest/TcpTest/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/TcpTest/BaseCommand.cpp rename to purenessscopeserver/example-Module/TcpTest/TcpTest/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/TcpTest/BaseCommand.h b/purenessscopeserver/example-Module/TcpTest/TcpTest/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/TcpTest/BaseCommand.h rename to purenessscopeserver/example-Module/TcpTest/TcpTest/BaseCommand.h diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest/ReadMe.txt b/purenessscopeserver/example-Module/TcpTest/TcpTest/ReadMe.txt new file mode 100644 index 000000000..6f8409c55 --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/TcpTest/ReadMe.txt @@ -0,0 +1,16 @@ +======================================================================== +̬ӿ⣺TcpTest Ŀ +======================================================================== + +PurenessScopeServerܵһӦdllڲԿTCPTCPϢĽǷơ +ϣʹô˿ܵĿ߻ᶮμԦܣܹԼϣܹӦá +PurenessScopeServer϶2ˣϣܹԼҲȤ㡣 +˹ΪԹ̣ԿģδЭḶ́ԼͿܵϷ +add by freeeyes + +///////////////////////////////////////////////////////////////////////////// +עͣ + +Windows_BinwindowsµĿ¼Linux_BinlinuxµĿ¼ + +///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.cpp b/purenessscopeserver/example-Module/TcpTest/TcpTest/TcpTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/TcpTest/TcpTest.cpp rename to purenessscopeserver/example-Module/TcpTest/TcpTest/TcpTest.cpp diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest.ini b/purenessscopeserver/example-Module/TcpTest/TcpTest/TcpTest.ini similarity index 100% rename from purenessscopeserver/example-Module/TcpTest/TcpTest.ini rename to purenessscopeserver/example-Module/TcpTest/TcpTest/TcpTest.ini diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.cbp b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.cbp new file mode 100644 index 000000000..23cb2109f --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.cbp @@ -0,0 +1,44 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.depend b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.depend new file mode 100644 index 000000000..0c404ecb7 --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.depend @@ -0,0 +1,190 @@ +# depslib dependency file v1.0 +1551867304 source:/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TcpTest/TcpTest/BaseCommand.cpp + "BaseCommand.h" + +1551867304 /data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TcpTest/TcpTest/BaseCommand.h + "IBuffPacket.h" + "ClientCommand.h" + "IObject.h" + "Trace.h" + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IBuffPacket.h + "define.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//define.h + "ace/SString.h" + "ace/Malloc.h" + "ace/Malloc_T.h" + "ace/Task_T.h" + "ace/Local_Memory_Pool.h" + "ace/Time_Value.h" + "ace/OS_main.h" + "ace/OS_NS_sys_stat.h" + "ace/OS_NS_sys_socket.h" + "ace/OS_NS_unistd.h" + "ace/OS_NS_string.h" + "ace/High_Res_Timer.h" + "ace/INET_Addr.h" + "ace/Hash_Map_Manager.h" + + + + + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ClientCommand.h + "IMessage.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IMessage.h + "IBuffPacket.h" + "ProfileTime.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ProfileTime.h + "define.h" + "ace/Profile_Timer.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IObject.h + "IMessage.h" + "IMessageManager.h" + "ILogManager.h" + "IConnectManager.h" + "IPacketManager.h" + "IClientManager.h" + "IUDPConnectManager.h" + "ITimerManager.h" + "IModuleMessageManager.h" + "IControlListen.h" + "IModuleInfo.h" + "IServerManager.h" + "IMessageBlockManager.h" + "IFrameCommand.h" + "ITSTimer.h" + "ITTyClientManager.h" + "ILogicThreadManager.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IMessageManager.h + "ClientCommand.h" + "IMessage.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ILogManager.h + "ILogObject.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ILogObject.h + "define.h" + "ace/SString.h" + "ace/Message_Block.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IConnectManager.h + "IBuffPacket.h" + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IPacketManager.h + "IBuffPacket.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IClientManager.h + "ClientMessage.h" + "ClientUDPMassage.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ClientMessage.h + "IMessageBlockManager.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IMessageBlockManager.h + "define.h" + "ace/Message_Block.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ClientUDPMassage.h + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IUDPConnectManager.h + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ITimerManager.h + "ace/Log_Msg.h" + "ace/Event_Handler.h" + "ace/Singleton.h" + "ace/Synch.h" + "ace/Task.h" + "ace/Timer_Heap_T.h" + "ace/Timer_Queue.h" + "ace/Timer_Heap.h" + "ace/Timer_Wheel.h" + "ace/Timer_Hash.h" + "ace/Timer_List.h" + "ace/Timer_Queue_Adapters.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IModuleMessageManager.h + "IBuffPacket.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IControlListen.h + "define.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IModuleInfo.h + "define.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IServerManager.h + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//IFrameCommand.h + "define.h" + "IBuffPacket.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ITSTimer.h + "TimerInfo.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//TimerInfo.h + "time.h" + "TimerCommon.h" + "Lcm.h" + + + + + + + + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//TimerCommon.h + + "Time_Value.h" + "windows.h" + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//Time_Value.h + "stdio.h" + "time.h" + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//Lcm.h + + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ITTyClientManager.h + "ITTyMessage.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ITTyMessage.h + + "define.h" + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//ILogicThreadManager.h + + +1553770511 /data/develop/Lib/Network/PSS-master/purenessscopeserver/Common//Trace.h + "stdio.h" + "stdlib.h" + "define.h" + + + + + + + + + + + +1551867304 source:/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TcpTest/TcpTest/TcpTest.cpp + "BaseCommand.h" + "IObject.h" + "ace/svc_export.h" + diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.layout b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.sln b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.sln deleted file mode 100644 index c8cd60318..000000000 --- a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2037 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TcpTest", "TcpTest_2017.vcxproj", "{6C2026BE-FECA-1BAD-2246-D8260000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Debug|Win32.Build.0 = Debug|Win32 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Debug|x64.ActiveCfg = Debug|x64 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Debug|x64.Build.0 = Debug|x64 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Release|Win32.ActiveCfg = Release|Win32 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Release|Win32.Build.0 = Release|Win32 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Release|x64.ActiveCfg = Release|x64 - {6C2026BE-FECA-1BAD-2246-D8260000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.vcxproj b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.vcxproj index 973d4a539..db98791fd 100644 --- a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.vcxproj +++ b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.vcxproj @@ -18,11 +18,18 @@ x64 + + + + + + + {6C2026BE-FECA-1BAD-2246-D8260000002E} TcpTest Win32Proj - 10.0.16299.0 + 10.0.17763.0 @@ -65,7 +72,7 @@ <_ProjectFileVersion>11.0.50727.1 - ..\..\FrameCore\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\TcpTest\I386\ true @@ -75,13 +82,13 @@ false - ..\..\FrameCore\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\TcpTest\AMD64\ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\TcpTest\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -198,7 +205,7 @@ MaxSpeed - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -224,29 +231,6 @@ MachineX64 - - - - - - - - - - true - true - true - true - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.vcxproj.filters b/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.vcxproj.filters deleted file mode 100644 index a84d7dc0e..000000000 --- a/purenessscopeserver/example-Module/TcpTest/TcpTest_2017.vcxproj.filters +++ /dev/null @@ -1,41 +0,0 @@ - - - - - {b7ff86ea-90f4-4ebe-bad3-0df6d7296521} - cpp;cxx;cc;c;C - - - {bc8e7c2b-121e-4134-87a2-4507d5ba15fa} - h;hpp;hxx;hh - - - {ca54fa94-70eb-4d1c-814b-e57b6ef68396} - mpc;mpb;mwc - - - {296cea86-dcb3-4676-a318-ffae8215e6e4} - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Build Files - - - Documentation - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTestd.exp b/purenessscopeserver/example-Module/TcpTest/TcpTestd.exp deleted file mode 100644 index 94afdd277..000000000 Binary files a/purenessscopeserver/example-Module/TcpTest/TcpTestd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/TcpTest/TcpTestd.lib b/purenessscopeserver/example-Module/TcpTest/TcpTestd.lib deleted file mode 100644 index c3e4eaa6a..000000000 Binary files a/purenessscopeserver/example-Module/TcpTest/TcpTestd.lib and /dev/null differ diff --git a/purenessscopeserver/example-Module/TcpTest/runlinuxmake.sh b/purenessscopeserver/example-Module/TcpTest/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/TcpTest/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TcpTest/zzz.bat b/purenessscopeserver/example-Module/TcpTest/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/TcpTest/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/TestTCPPost/CMakeLists.txt b/purenessscopeserver/example-Module/TestTCPPost/CMakeLists.txt new file mode 100644 index 000000000..44916c4bb --- /dev/null +++ b/purenessscopeserver/example-Module/TestTCPPost/CMakeLists.txt @@ -0,0 +1,85 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(TestTCPPost) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_TestTCPPost_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./TestTCPPost/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./TestTCPPost/TestTCPPost.cpp + ${CMAKE_CURRENT_LIST_DIR}/./TestTCPPost/ProxyManager.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(TestTCPPost SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(TestTCPPost ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/TestTCPPost/Makefile b/purenessscopeserver/example-Module/TestTCPPost/Makefile index 498127bc1..d1ee98966 100644 --- a/purenessscopeserver/example-Module/TestTCPPost/Makefile +++ b/purenessscopeserver/example-Module/TestTCPPost/Makefile @@ -1,26 +1,128 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TestTCPPost +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/TestTCPPost +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TestTCPPost.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o TestTCPPost.o ProxyManager.o -LIB_BASE_OBJS = BaseCommand.o TestTCPPost.o ProxyManager.o -LIB_BASE = libTcpPostTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(ObjectSuffix) $(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(ObjectSuffix) -all: libTcpPostTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE): $(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/TestTCPPost" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(ObjectSuffix): ./TestTCPPost/BaseCommand.cpp $(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TestTCPPost/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(DependSuffix): ./TestTCPPost/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(DependSuffix) -MM ./TestTCPPost/BaseCommand.cpp + +$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(PreprocessSuffix): ./TestTCPPost/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(PreprocessSuffix) ./TestTCPPost/BaseCommand.cpp + +$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(ObjectSuffix): ./TestTCPPost/TestTCPPost.cpp $(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TestTCPPost/TestTCPPost.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(DependSuffix): ./TestTCPPost/TestTCPPost.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(DependSuffix) -MM ./TestTCPPost/TestTCPPost.cpp + +$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(PreprocessSuffix): ./TestTCPPost/TestTCPPost.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(PreprocessSuffix) ./TestTCPPost/TestTCPPost.cpp + +$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(ObjectSuffix): ./TestTCPPost/ProxyManager.cpp $(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TestTCPPost/ProxyManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(DependSuffix): ./TestTCPPost/ProxyManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(DependSuffix) -MM ./TestTCPPost/ProxyManager.cpp + +$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(PreprocessSuffix): ./TestTCPPost/ProxyManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(PreprocessSuffix) ./TestTCPPost/ProxyManager.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libTcpPostTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TestTCPPost/Makefile.define b/purenessscopeserver/example-Module/TestTCPPost/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/TestTCPPost/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TestTCPPost/ReadMe.txt b/purenessscopeserver/example-Module/TestTCPPost/ReadMe.txt deleted file mode 100644 index 23f8ff17f..000000000 --- a/purenessscopeserver/example-Module/TestTCPPost/ReadMe.txt +++ /dev/null @@ -1,36 +0,0 @@ -======================================================================== -̬ӿ⣺TestTCPPost Ŀ -======================================================================== - -ӦóΪ˴ TestTCPPost DLL - -ļҪ TestTCPPost Ӧóÿļݡ - - -TestTCPPost.vcproj -ʹӦóɵ VC++ ĿĿļ -ɸļ Visual C++ İ汾ϢԼйʹӦóѡƽ̨úĿܵϢ - -TestTCPPost.cpp - DLL Դļ - - DLL ڴʱκηšˣ - ʱ .lib ļϣĿ - ΪijĿĿҪ - ӴԴ DLL ijЩţ - Ա⣬ҲĿҳԻе - ļУ桱ҳϵ - ⡱Ϊǡ - -///////////////////////////////////////////////////////////////////////////// -׼ļ - -StdAfx.h, StdAfx.cpp -ЩļΪ TestTCPPost.pch Ԥͷ (PCH) ļΪ StdAfx.obj Ԥļ - -///////////////////////////////////////////////////////////////////////////// -עͣ - -ӦóʹáTODO:ָʾӦӻԶԴ벿֡ - -///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.cbp b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.cbp new file mode 100644 index 000000000..b665afce0 --- /dev/null +++ b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.cbp @@ -0,0 +1,47 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.depend b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.exp b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.exp new file mode 100644 index 000000000..9dc27e355 Binary files /dev/null and b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.exp differ diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.layout b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.lib b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.lib new file mode 100644 index 000000000..5141c7029 Binary files /dev/null and b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.lib differ diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcproj b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcproj deleted file mode 100644 index 2ab05c8eb..000000000 --- a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcproj +++ /dev/null @@ -1,442 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcxproj b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcxproj index 640b4db7e..50dbc10e4 100644 --- a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcxproj +++ b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -18,30 +18,41 @@ x64 + + + + + + + + + + {3B20673A-FECA-1BAD-3A62-9A060000002E} TcpTestPost Win32Proj + 10.0.17763.0 DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet @@ -64,7 +75,7 @@ <_ProjectFileVersion>14.0.25431.1 - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\TcpTestPost\I386\ true @@ -79,8 +90,8 @@ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\TcpTestPost\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -197,7 +208,7 @@ MaxSpeed - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) TEST_TCPPOST_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -223,31 +234,6 @@ MachineX64 - - - - - - - - - - - - true - true - true - true - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcxproj.filters b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcxproj.filters deleted file mode 100644 index 1fb39265c..000000000 --- a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPost.vcxproj.filters +++ /dev/null @@ -1,49 +0,0 @@ - - - - - {f6c5e34d-6ed6-4993-8e43-7a26715d3e36} - cpp;cxx;cc;c;C - - - {f220a48e-597b-4b52-b152-461218a7f38a} - h;hpp;hxx;hh - - - {88cd8123-acab-4a86-b232-83436e4b24f4} - mpc;mpb;mwc - - - {60e831f4-d5b9-4b25-add2-db5020ab1e60} - - - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Build Files - - - - - Documentation - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPostd.exp b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPostd.exp deleted file mode 100644 index b12c6c279..000000000 Binary files a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPostd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPostd.lib b/purenessscopeserver/example-Module/TestTCPPost/TcpTestPostd.lib deleted file mode 100644 index b8f2a78dd..000000000 Binary files a/purenessscopeserver/example-Module/TestTCPPost/TcpTestPostd.lib and /dev/null differ diff --git a/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.mk b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.mk new file mode 100644 index 000000000..6c2c6aee1 --- /dev/null +++ b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.mk @@ -0,0 +1,128 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TestTCPPost +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TestTCPPost +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TestTCPPost.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(ObjectSuffix) $(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/TestTCPPost" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(ObjectSuffix): ./TestTCPPost/BaseCommand.cpp $(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(DependSuffix): ./TestTCPPost/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(DependSuffix) -MM ./TestTCPPost/BaseCommand.cpp + +$(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(PreprocessSuffix): ./TestTCPPost/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestTCPPost_BaseCommand.cpp$(PreprocessSuffix) ./TestTCPPost/BaseCommand.cpp + +$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(ObjectSuffix): ./TestTCPPost/TestTCPPost.cpp $(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/TestTCPPost.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(DependSuffix): ./TestTCPPost/TestTCPPost.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(DependSuffix) -MM ./TestTCPPost/TestTCPPost.cpp + +$(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(PreprocessSuffix): ./TestTCPPost/TestTCPPost.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestTCPPost_TestTCPPost.cpp$(PreprocessSuffix) ./TestTCPPost/TestTCPPost.cpp + +$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(ObjectSuffix): ./TestTCPPost/ProxyManager.cpp $(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/ProxyManager.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(DependSuffix): ./TestTCPPost/ProxyManager.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(DependSuffix) -MM ./TestTCPPost/ProxyManager.cpp + +$(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(PreprocessSuffix): ./TestTCPPost/ProxyManager.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestTCPPost_ProxyManager.cpp$(PreprocessSuffix) ./TestTCPPost/ProxyManager.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.mpc b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.mpc deleted file mode 100644 index 6b7430ff1..000000000 --- a/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(TcpTestPost):acelib{ - sharedname=TcpTestPost - dynamicflags += TEST_TCPPOST_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.project b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.project new file mode 100644 index 000000000..641d3fd51 --- /dev/null +++ b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.project @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.sln b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.sln deleted file mode 100644 index 082156abe..000000000 --- a/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TcpTestPost", "TcpTestPost.vcxproj", "{3B20673A-FECA-1BAD-3A62-9A060000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3B20673A-FECA-1BAD-3A62-9A060000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {3B20673A-FECA-1BAD-3A62-9A060000002E}.Debug|Win32.Build.0 = Debug|Win32 - {3B20673A-FECA-1BAD-3A62-9A060000002E}.Debug|x64.ActiveCfg = Debug|x64 - {3B20673A-FECA-1BAD-3A62-9A060000002E}.Debug|x64.Build.0 = Debug|x64 - {3B20673A-FECA-1BAD-3A62-9A060000002E}.Release|Win32.ActiveCfg = Release|Win32 - {3B20673A-FECA-1BAD-3A62-9A060000002E}.Release|Win32.Build.0 = Release|Win32 - {3B20673A-FECA-1BAD-3A62-9A060000002E}.Release|x64.ActiveCfg = Release|x64 - {3B20673A-FECA-1BAD-3A62-9A060000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.txt b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.txt new file mode 100644 index 000000000..03c43908f --- /dev/null +++ b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/TestTCPPost_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/TestTCPPost_TestTCPPost.cpp.o ../../../Build/Linux/Linux_Bin/Temp/TestTCPPost_ProxyManager.cpp.o diff --git a/purenessscopeserver/example-Module/TestTCPPost/BaseCommand.cpp b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/TestTCPPost/BaseCommand.cpp rename to purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/TestTCPPost/BaseCommand.h b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/TestTCPPost/BaseCommand.h rename to purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/BaseCommand.h diff --git a/purenessscopeserver/example-Module/TestTCPPost/PostServerLogic.h b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/PostServerLogic.h similarity index 99% rename from purenessscopeserver/example-Module/TestTCPPost/PostServerLogic.h rename to purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/PostServerLogic.h index dc1022a29..d287cc688 100644 --- a/purenessscopeserver/example-Module/TestTCPPost/PostServerLogic.h +++ b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/PostServerLogic.h @@ -127,7 +127,7 @@ class CPostServerData : public IClientMessage uint32 u4SendLength = u4PacketLength + sizeof(uint32); - const char* ptrReturnData = reinterpret_cast(pData); + char* ptrReturnData = reinterpret_cast(pData); m_pServerObject->GetConnectManager()->PostMessage(m_u4ConnectID,ptrReturnData,(uint32)u4SendLength, SENDMESSAGE_JAMPNOMAL, u2RetCommand, PACKET_SEND_IMMEDIATLY, PACKET_IS_SELF_RECYC); OUR_DEBUG((LM_INFO, "[CPostServerData::RecvData](%d)Send Data(%d) OK.\n", m_u4ConnectID, u4SendLength)); } diff --git a/purenessscopeserver/example-Module/TestTCPPost/ProxyManager.cpp b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/ProxyManager.cpp similarity index 100% rename from purenessscopeserver/example-Module/TestTCPPost/ProxyManager.cpp rename to purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/ProxyManager.cpp diff --git a/purenessscopeserver/example-Module/TestTCPPost/ProxyManager.h b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/ProxyManager.h similarity index 100% rename from purenessscopeserver/example-Module/TestTCPPost/ProxyManager.h rename to purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/ProxyManager.h diff --git a/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.cpp b/purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/TestTCPPost.cpp similarity index 100% rename from purenessscopeserver/example-Module/TestTCPPost/TestTCPPost.cpp rename to purenessscopeserver/example-Module/TestTCPPost/TestTCPPost/TestTCPPost.cpp diff --git a/purenessscopeserver/example-Module/TestTCPPost/runlinuxmake.sh b/purenessscopeserver/example-Module/TestTCPPost/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/TestTCPPost/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TestTCPPost/zzz.bat b/purenessscopeserver/example-Module/TestTCPPost/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/TestTCPPost/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/TestUDPPost/BaseCommand.cpp b/purenessscopeserver/example-Module/TestUDPPost/BaseCommand.cpp deleted file mode 100644 index ba1503167..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/BaseCommand.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include "BaseCommand.h" - -CBaseCommand::CBaseCommand(void) -{ - m_pServerObject = NULL; - m_nCount = 0; -} - -CBaseCommand::~CBaseCommand(void) -{ -} - -void CBaseCommand::SetServerObject(CServerObject* pServerObject) -{ - m_pServerObject = pServerObject; -} - -int CBaseCommand::DoMessage(IMessage* pMessage, bool& bDeleteFlag) -{ - if(m_pServerObject == NULL) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] m_pServerObject is NULL(%d).\n", bDeleteFlag)); - return -1; - } - - if(pMessage == NULL) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pMessage is NULL.\n")); - return -1; - } - - //ӽϢ - if(pMessage->GetMessageBase()->m_u2Cmd == CLIENT_LINK_CONNECT) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] CLIENT_LINK_CONNECT OK.\n")); - } - - //ӶϿϢ - if(pMessage->GetMessageBase()->m_u2Cmd == CLIENT_LINK_CDISCONNET) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] CLIENT_LINK_CDISCONNET OK.\n")); - } - - //Ϣ - if(pMessage->GetMessageBase()->m_u2Cmd == COMMAND_BASE) - { - uint16 u2CommandID = 0; - VCHARS_STR strsName; - string strName; - - IBuffPacket* pBodyPacket = m_pServerObject->GetPacketManager()->Create(); - if(NULL == pBodyPacket) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pBodyPacket is NULL.\n")); - return -1; - } - - _PacketInfo BodyPacket; - pMessage->GetPacketBody(BodyPacket); - - pBodyPacket->WriteStream(BodyPacket.m_pData, BodyPacket.m_nDataLen); - - (*pBodyPacket) >> u2CommandID; - (*pBodyPacket) >> strsName; - strName.assign(strsName.text, strsName.u1Len); - - m_pServerObject->GetPacketManager()->Delete(pBodyPacket); - - //мϢ - char szPostData[MAX_BUFF_100] = {'\0'}; - sprintf_safe(szPostData, MAX_BUFF_100, "hello"); - if(false == m_pServerObject->GetClientManager()->SendDataUDP(1, "127.0.0.1", 10006, szPostData, (int)ACE_OS::strlen(szPostData))) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] Send Post Data Error.\n")); - return 0; - } - } - - - return 0; -} - -void CBaseCommand::InitServer() -{ - CPostServerData* pPostServerData = new CPostServerData(); - if(NULL != pPostServerData) - { - m_pServerObject->GetClientManager()->ConnectUDP(1, "127.0.0.1", 10005, TYPE_IPV4, UDP_SINGLE, pPostServerData); - } -} - - diff --git a/purenessscopeserver/example-Module/TestUDPPost/CMakeLists.txt b/purenessscopeserver/example-Module/TestUDPPost/CMakeLists.txt new file mode 100644 index 000000000..14d777958 --- /dev/null +++ b/purenessscopeserver/example-Module/TestUDPPost/CMakeLists.txt @@ -0,0 +1,84 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(TestUDPPost) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_TestUDPPost_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./TestUDPPost/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./TestUDPPost/TestUDPPost.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(TestUDPPost SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(TestUDPPost ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/TestUDPPost/Makefile b/purenessscopeserver/example-Module/TestUDPPost/Makefile index 93adcaa07..cdef1e5c0 100644 --- a/purenessscopeserver/example-Module/TestUDPPost/Makefile +++ b/purenessscopeserver/example-Module/TestUDPPost/Makefile @@ -1,26 +1,120 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TestUDPPost +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/TestUDPPost +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TestUDPPost.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o TestUDPPost.o -LIB_BASE_OBJS = BaseCommand.o TestUDPPost.o -LIB_BASE = libUdpPostTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(ObjectSuffix) -all: libUdpPostTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE): $(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/TestUDPPost" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(ObjectSuffix): ./TestUDPPost/BaseCommand.cpp $(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TestUDPPost/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(DependSuffix): ./TestUDPPost/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(DependSuffix) -MM ./TestUDPPost/BaseCommand.cpp + +$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(PreprocessSuffix): ./TestUDPPost/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(PreprocessSuffix) ./TestUDPPost/BaseCommand.cpp + +$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(ObjectSuffix): ./TestUDPPost/TestUDPPost.cpp $(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TestUDPPost/TestUDPPost.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(DependSuffix): ./TestUDPPost/TestUDPPost.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(DependSuffix) -MM ./TestUDPPost/TestUDPPost.cpp + +$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(PreprocessSuffix): ./TestUDPPost/TestUDPPost.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(PreprocessSuffix) ./TestUDPPost/TestUDPPost.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libUdpPostTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TestUDPPost/Makefile.define b/purenessscopeserver/example-Module/TestUDPPost/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TestUDPPost/ReadMe.txt b/purenessscopeserver/example-Module/TestUDPPost/ReadMe.txt deleted file mode 100644 index bb5dd1f09..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/ReadMe.txt +++ /dev/null @@ -1,36 +0,0 @@ -======================================================================== -̬ӿ⣺TestUDPPost Ŀ -======================================================================== - -ӦóΪ˴ TestUDPPost DLL - -ļҪ TestUDPPost Ӧóÿļݡ - - -TestUDPPost.vcproj -ʹӦóɵ VC++ ĿĿļ -ɸļ Visual C++ İ汾ϢԼйʹӦóѡƽ̨úĿܵϢ - -TestUDPPost.cpp - DLL Դļ - - DLL ڴʱκηšˣ - ʱ .lib ļϣĿ - ΪijĿĿҪ - ӴԴ DLL ijЩţ - Ա⣬ҲĿҳԻе - ļУ桱ҳϵ - ⡱Ϊǡ - -///////////////////////////////////////////////////////////////////////////// -׼ļ - -StdAfx.h, StdAfx.cpp -ЩļΪ TestUDPPost.pch Ԥͷ (PCH) ļΪ StdAfx.obj Ԥļ - -///////////////////////////////////////////////////////////////////////////// -עͣ - -ӦóʹáTODO:ָʾӦӻԶԴ벿֡ - -///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.mk b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.mk new file mode 100644 index 000000000..d46469f5e --- /dev/null +++ b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TestUDPPost +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TestUDPPost +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TestUDPPost.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/TestUDPPost" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(ObjectSuffix): ./TestUDPPost/BaseCommand.cpp $(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(DependSuffix): ./TestUDPPost/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(DependSuffix) -MM ./TestUDPPost/BaseCommand.cpp + +$(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(PreprocessSuffix): ./TestUDPPost/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestUDPPost_BaseCommand.cpp$(PreprocessSuffix) ./TestUDPPost/BaseCommand.cpp + +$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(ObjectSuffix): ./TestUDPPost/TestUDPPost.cpp $(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/TestUDPPost.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(DependSuffix): ./TestUDPPost/TestUDPPost.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(DependSuffix) -MM ./TestUDPPost/TestUDPPost.cpp + +$(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(PreprocessSuffix): ./TestUDPPost/TestUDPPost.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TestUDPPost_TestUDPPost.cpp$(PreprocessSuffix) ./TestUDPPost/TestUDPPost.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.mpc b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.mpc deleted file mode 100644 index 11362ba69..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(UDPTestPost):acelib{ - sharedname=UDPTestPost - dynamicflags += TEST_UDP_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.project b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.project new file mode 100644 index 000000000..2ddd9f4cb --- /dev/null +++ b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.sln b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.sln deleted file mode 100644 index 091515b6a..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UDPTestPost", "UDPTestPost.vcxproj", "{3B20670F-FECA-1BAD-3A62-9B760000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3B20670F-FECA-1BAD-3A62-9B760000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {3B20670F-FECA-1BAD-3A62-9B760000002E}.Debug|Win32.Build.0 = Debug|Win32 - {3B20670F-FECA-1BAD-3A62-9B760000002E}.Debug|x64.ActiveCfg = Debug|x64 - {3B20670F-FECA-1BAD-3A62-9B760000002E}.Debug|x64.Build.0 = Debug|x64 - {3B20670F-FECA-1BAD-3A62-9B760000002E}.Release|Win32.ActiveCfg = Release|Win32 - {3B20670F-FECA-1BAD-3A62-9B760000002E}.Release|Win32.Build.0 = Release|Win32 - {3B20670F-FECA-1BAD-3A62-9B760000002E}.Release|x64.ActiveCfg = Release|x64 - {3B20670F-FECA-1BAD-3A62-9B760000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.txt b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.txt new file mode 100644 index 000000000..910c6df21 --- /dev/null +++ b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/TestUDPPost_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/TestUDPPost_TestUDPPost.cpp.o diff --git a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/BaseCommand.cpp b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/BaseCommand.cpp new file mode 100644 index 000000000..55526fd45 --- /dev/null +++ b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/BaseCommand.cpp @@ -0,0 +1,93 @@ +#include "BaseCommand.h" + +CBaseCommand::CBaseCommand(void) +{ + m_pServerObject = NULL; + m_nCount = 0; +} + +CBaseCommand::~CBaseCommand(void) +{ +} + +void CBaseCommand::SetServerObject(CServerObject* pServerObject) +{ + m_pServerObject = pServerObject; +} + +int CBaseCommand::DoMessage(IMessage* pMessage, bool& bDeleteFlag) +{ + if(m_pServerObject == NULL) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] m_pServerObject is NULL(%d).\n", bDeleteFlag)); + return -1; + } + + if(pMessage == NULL) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pMessage is NULL.\n")); + return -1; + } + + //ӽϢ + if(pMessage->GetMessageBase()->m_u2Cmd == CLIENT_LINK_CONNECT) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] CLIENT_LINK_CONNECT OK.\n")); + } + + //ӶϿϢ + if(pMessage->GetMessageBase()->m_u2Cmd == CLIENT_LINK_CDISCONNET) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] CLIENT_LINK_CDISCONNET OK.\n")); + } + + //Ϣ + if(pMessage->GetMessageBase()->m_u2Cmd == COMMAND_BASE) + { + uint16 u2CommandID = 0; + VCHARS_STR strsName; + string strName; + + IBuffPacket* pBodyPacket = m_pServerObject->GetPacketManager()->Create(); + if(NULL == pBodyPacket) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pBodyPacket is NULL.\n")); + return -1; + } + + _PacketInfo BodyPacket; + pMessage->GetPacketBody(BodyPacket); + + pBodyPacket->WriteStream(BodyPacket.m_pData, BodyPacket.m_nDataLen); + + (*pBodyPacket) >> u2CommandID; + (*pBodyPacket) >> strsName; + strName.assign(strsName.text, strsName.u1Len); + + m_pServerObject->GetPacketManager()->Delete(pBodyPacket); + + //мϢ + char szPostData[MAX_BUFF_100] = {'\0'}; + sprintf_safe(szPostData, MAX_BUFF_100, "hello"); + char *PostData = szPostData; + if(false == m_pServerObject->GetClientManager()->SendDataUDP(1, "127.0.0.1", 10006, PostData, (int)ACE_OS::strlen(szPostData))) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] Send Post Data Error.\n")); + return 0; + } + } + + + return 0; +} + +void CBaseCommand::InitServer() +{ + CPostServerData* pPostServerData = new CPostServerData(); + if(NULL != pPostServerData) + { + m_pServerObject->GetClientManager()->ConnectUDP(1, "127.0.0.1", 10005, TYPE_IPV4, UDP_SINGLE, pPostServerData); + } +} + + diff --git a/purenessscopeserver/example-Module/TestUDPPost/BaseCommand.h b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/TestUDPPost/BaseCommand.h rename to purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/BaseCommand.h diff --git a/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.cpp b/purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/TestUDPPost.cpp similarity index 100% rename from purenessscopeserver/example-Module/TestUDPPost/TestUDPPost.cpp rename to purenessscopeserver/example-Module/TestUDPPost/TestUDPPost/TestUDPPost.cpp diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.cbp b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.cbp new file mode 100644 index 000000000..df43967c7 --- /dev/null +++ b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.cbp @@ -0,0 +1,44 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.depend b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.exp b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.exp new file mode 100644 index 000000000..c5b6b171e Binary files /dev/null and b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.exp differ diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.layout b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.lib b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.lib new file mode 100644 index 000000000..6acd4df29 Binary files /dev/null and b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.lib differ diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcproj b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcproj deleted file mode 100644 index 377da9c61..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcproj +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcxproj b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcxproj index a055790b1..0c9eff5db 100644 --- a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcxproj +++ b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -18,30 +18,38 @@ x64 + + + + + + + {3B20670F-FECA-1BAD-3A62-9B760000002E} UDPTestPost Win32Proj + 10.0.17763.0 DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet @@ -64,7 +72,7 @@ <_ProjectFileVersion>11.0.50727.1 - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\UDPTestPost\I386\ true @@ -74,13 +82,13 @@ false - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\UDPTestPost\AMD64\ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\UDPTestPost\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -197,7 +205,7 @@ MaxSpeed - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) TEST_UDPPOST_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -223,29 +231,6 @@ MachineX64 - - - - - - - - - - true - true - true - true - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcxproj.filters b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcxproj.filters deleted file mode 100644 index 040807459..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPost.vcxproj.filters +++ /dev/null @@ -1,43 +0,0 @@ - - - - - {6276171b-41ad-487d-ade2-b8c315d3a8eb} - cpp;cxx;cc;c;C - - - {99db723f-cd1f-4106-8b28-0cb7974db708} - h;hpp;hxx;hh - - - {08bd30e2-8df2-45bc-bb37-be4fa17815c0} - mpc;mpb;mwc - - - {4e486171-4a0a-4617-b0de-bbe2fa19040b} - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Build Files - - - - - Documentation - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPostd.exp b/purenessscopeserver/example-Module/TestUDPPost/UDPTestPostd.exp deleted file mode 100644 index 65a37af2d..000000000 Binary files a/purenessscopeserver/example-Module/TestUDPPost/UDPTestPostd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/TestUDPPost/runlinuxmake.sh b/purenessscopeserver/example-Module/TestUDPPost/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TestUDPPost/zzz.bat b/purenessscopeserver/example-Module/TestUDPPost/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/TestUDPPost/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/TimerTest/CMakeLists.txt b/purenessscopeserver/example-Module/TimerTest/CMakeLists.txt new file mode 100644 index 000000000..b2f9e8b15 --- /dev/null +++ b/purenessscopeserver/example-Module/TimerTest/CMakeLists.txt @@ -0,0 +1,84 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(TimerTest) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_TimerTest_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./TimerTest/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./TimerTest/TimerTest.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(TimerTest SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(TimerTest ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/TimerTest/Makefile b/purenessscopeserver/example-Module/TimerTest/Makefile index cdb270187..722432cb1 100644 --- a/purenessscopeserver/example-Module/TimerTest/Makefile +++ b/purenessscopeserver/example-Module/TimerTest/Makefile @@ -1,26 +1,120 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TimerTest +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/TimerTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TimerTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o TimerTest.o -LIB_BASE_OBJS = BaseCommand.o TimerTest.o -LIB_BASE = libTimerTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TimerTest_TimerTest.cpp$(ObjectSuffix) -all: libTimerTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/TimerTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(ObjectSuffix): ./TimerTest/BaseCommand.cpp $(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TimerTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(DependSuffix): ./TimerTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(DependSuffix) -MM ./TimerTest/BaseCommand.cpp + +$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(PreprocessSuffix): ./TimerTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(PreprocessSuffix) ./TimerTest/BaseCommand.cpp + +$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(ObjectSuffix): ./TimerTest/TimerTest.cpp $(IntermediateDirectory)/TimerTest_TimerTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./TimerTest/TimerTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(DependSuffix): ./TimerTest/TimerTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(DependSuffix) -MM ./TimerTest/TimerTest.cpp + +$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(PreprocessSuffix): ./TimerTest/TimerTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TimerTest_TimerTest.cpp$(PreprocessSuffix) ./TimerTest/TimerTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libTimerTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TimerTest/Makefile.define b/purenessscopeserver/example-Module/TimerTest/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/TimerTest/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TimerTest/ReadMe.txt b/purenessscopeserver/example-Module/TimerTest/ReadMe.txt deleted file mode 100644 index 3487140c3..000000000 --- a/purenessscopeserver/example-Module/TimerTest/ReadMe.txt +++ /dev/null @@ -1,8 +0,0 @@ -======================================================================== -̬ӿ⣺TimerTest Ŀ -======================================================================== - -ʾһʹTimerвʱʵ -ڴչĴ룬ʵֲĶʱΪ - -///////////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.cbp b/purenessscopeserver/example-Module/TimerTest/TimerTest.cbp new file mode 100644 index 000000000..8356b7917 --- /dev/null +++ b/purenessscopeserver/example-Module/TimerTest/TimerTest.cbp @@ -0,0 +1,44 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.depend b/purenessscopeserver/example-Module/TimerTest/TimerTest.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/TimerTest/TimerTest.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.layout b/purenessscopeserver/example-Module/TimerTest/TimerTest.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/TimerTest/TimerTest.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.mk b/purenessscopeserver/example-Module/TimerTest/TimerTest.mk new file mode 100644 index 000000000..191cfeb37 --- /dev/null +++ b/purenessscopeserver/example-Module/TimerTest/TimerTest.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=TimerTest +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TimerTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="TimerTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/TimerTest_TimerTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/TimerTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(ObjectSuffix): ./TimerTest/BaseCommand.cpp $(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TimerTest/TimerTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(DependSuffix): ./TimerTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(DependSuffix) -MM ./TimerTest/BaseCommand.cpp + +$(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(PreprocessSuffix): ./TimerTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TimerTest_BaseCommand.cpp$(PreprocessSuffix) ./TimerTest/BaseCommand.cpp + +$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(ObjectSuffix): ./TimerTest/TimerTest.cpp $(IntermediateDirectory)/TimerTest_TimerTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/TimerTest/TimerTest/TimerTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(DependSuffix): ./TimerTest/TimerTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(DependSuffix) -MM ./TimerTest/TimerTest.cpp + +$(IntermediateDirectory)/TimerTest_TimerTest.cpp$(PreprocessSuffix): ./TimerTest/TimerTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/TimerTest_TimerTest.cpp$(PreprocessSuffix) ./TimerTest/TimerTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.mpc b/purenessscopeserver/example-Module/TimerTest/TimerTest.mpc deleted file mode 100644 index 7678fca0c..000000000 --- a/purenessscopeserver/example-Module/TimerTest/TimerTest.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(TimerTest):acelib{ - sharedname=TimerTest - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.project b/purenessscopeserver/example-Module/TimerTest/TimerTest.project new file mode 100644 index 000000000..1fdb9b3ce --- /dev/null +++ b/purenessscopeserver/example-Module/TimerTest/TimerTest.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.sln b/purenessscopeserver/example-Module/TimerTest/TimerTest.sln deleted file mode 100644 index 5e0f7de2b..000000000 --- a/purenessscopeserver/example-Module/TimerTest/TimerTest.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TimerTest", "TimerTest.vcxproj", "{46B606BB-FECA-1BAD-2246-D8260000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {46B606BB-FECA-1BAD-2246-D8260000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {46B606BB-FECA-1BAD-2246-D8260000002E}.Debug|Win32.Build.0 = Debug|Win32 - {46B606BB-FECA-1BAD-2246-D8260000002E}.Debug|x64.ActiveCfg = Debug|x64 - {46B606BB-FECA-1BAD-2246-D8260000002E}.Debug|x64.Build.0 = Debug|x64 - {46B606BB-FECA-1BAD-2246-D8260000002E}.Release|Win32.ActiveCfg = Release|Win32 - {46B606BB-FECA-1BAD-2246-D8260000002E}.Release|Win32.Build.0 = Release|Win32 - {46B606BB-FECA-1BAD-2246-D8260000002E}.Release|x64.ActiveCfg = Release|x64 - {46B606BB-FECA-1BAD-2246-D8260000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.txt b/purenessscopeserver/example-Module/TimerTest/TimerTest.txt new file mode 100644 index 000000000..978f12cdc --- /dev/null +++ b/purenessscopeserver/example-Module/TimerTest/TimerTest.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/TimerTest_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/TimerTest_TimerTest.cpp.o diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.vcproj b/purenessscopeserver/example-Module/TimerTest/TimerTest.vcproj deleted file mode 100644 index 38400a23e..000000000 --- a/purenessscopeserver/example-Module/TimerTest/TimerTest.vcproj +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.vcxproj b/purenessscopeserver/example-Module/TimerTest/TimerTest.vcxproj index 98ca8367d..19c253e4b 100644 --- a/purenessscopeserver/example-Module/TimerTest/TimerTest.vcxproj +++ b/purenessscopeserver/example-Module/TimerTest/TimerTest.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -18,30 +18,38 @@ x64 + + + + + + + {46B606BB-FECA-1BAD-2246-D8260000002E} TimerTest Win32Proj + 10.0.17763.0 DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet @@ -64,7 +72,7 @@ <_ProjectFileVersion>11.0.50727.1 - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\TimerTest\I386\ true @@ -74,13 +82,13 @@ false - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\TimerTest\AMD64\ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\TimerTest\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -197,7 +205,7 @@ MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -223,29 +231,6 @@ MachineX64 - - - - - - - - - - true - true - true - true - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.vcxproj.filters b/purenessscopeserver/example-Module/TimerTest/TimerTest.vcxproj.filters deleted file mode 100644 index 9a2386cfd..000000000 --- a/purenessscopeserver/example-Module/TimerTest/TimerTest.vcxproj.filters +++ /dev/null @@ -1,43 +0,0 @@ - - - - - {04de8370-b2aa-45a3-8ce2-3e1b48e0c125} - cpp;cxx;cc;c;C - - - {4dd3bf35-3375-4831-9bb6-434bf9e9da02} - h;hpp;hxx;hh - - - {3ba09267-accb-44cf-be08-3e12f0e92046} - mpc;mpb;mwc - - - {63e2bd7d-b91d-452b-93ef-27ace64794f2} - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Build Files - - - - - Documentation - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TimerTest/BaseCommand.cpp b/purenessscopeserver/example-Module/TimerTest/TimerTest/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/TimerTest/BaseCommand.cpp rename to purenessscopeserver/example-Module/TimerTest/TimerTest/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/TimerTest/BaseCommand.h b/purenessscopeserver/example-Module/TimerTest/TimerTest/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/TimerTest/BaseCommand.h rename to purenessscopeserver/example-Module/TimerTest/TimerTest/BaseCommand.h diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTest.cpp b/purenessscopeserver/example-Module/TimerTest/TimerTest/TimerTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/TimerTest/TimerTest.cpp rename to purenessscopeserver/example-Module/TimerTest/TimerTest/TimerTest.cpp diff --git a/purenessscopeserver/example-Module/TimerTest/TimerTestd.exp b/purenessscopeserver/example-Module/TimerTest/TimerTestd.exp deleted file mode 100644 index e94ea8571..000000000 Binary files a/purenessscopeserver/example-Module/TimerTest/TimerTestd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/TimerTest/runlinuxmake.sh b/purenessscopeserver/example-Module/TimerTest/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/TimerTest/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/TimerTest/zzz.bat b/purenessscopeserver/example-Module/TimerTest/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/TimerTest/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/UDPTest/CMakeLists.txt b/purenessscopeserver/example-Module/UDPTest/CMakeLists.txt new file mode 100644 index 000000000..d6803c57e --- /dev/null +++ b/purenessscopeserver/example-Module/UDPTest/CMakeLists.txt @@ -0,0 +1,84 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(UDPTest) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_UDPTest_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./UDPTest/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./UDPTest/UDPTest.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(UDPTest SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(UDPTest ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/UDPTest/Makefile b/purenessscopeserver/example-Module/UDPTest/Makefile index 67afa3141..407f3a6f7 100644 --- a/purenessscopeserver/example-Module/UDPTest/Makefile +++ b/purenessscopeserver/example-Module/UDPTest/Makefile @@ -1,26 +1,120 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=UDPTest +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/UDPTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="UDPTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = BaseCommand.o UDPTest.o -LIB_BASE_OBJS = BaseCommand.o UDPTest.o -LIB_BASE = libUdpTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDPTest_UDPTest.cpp$(ObjectSuffix) -all: libUdpTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE): $(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/UDPTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(ObjectSuffix): ./UDPTest/BaseCommand.cpp $(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./UDPTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(DependSuffix): ./UDPTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(DependSuffix) -MM ./UDPTest/BaseCommand.cpp + +$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(PreprocessSuffix): ./UDPTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(PreprocessSuffix) ./UDPTest/BaseCommand.cpp + +$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(ObjectSuffix): ./UDPTest/UDPTest.cpp $(IntermediateDirectory)/UDPTest_UDPTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./UDPTest/UDPTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(DependSuffix): ./UDPTest/UDPTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(DependSuffix) -MM ./UDPTest/UDPTest.cpp + +$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(PreprocessSuffix): ./UDPTest/UDPTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDPTest_UDPTest.cpp$(PreprocessSuffix) ./UDPTest/UDPTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libUdpTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/UDPTest/Makefile.define b/purenessscopeserver/example-Module/UDPTest/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/UDPTest/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/UDPTest/TestUDP.mpc b/purenessscopeserver/example-Module/UDPTest/TestUDP.mpc deleted file mode 100644 index 2adec54b8..000000000 --- a/purenessscopeserver/example-Module/UDPTest/TestUDP.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(UDPTest):acelib{ - sharedname=UDPTest - dynamicflags += TEST_UDP_BUILD_DLL - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - libout = ./ - specific (prop:microsoft){ - dllout = ../../FrameCore/Windows_Bin - } else { - dllout = ../../FrameCore/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.exp b/purenessscopeserver/example-Module/UDPTest/UDPTest.exp new file mode 100644 index 000000000..82924c87c Binary files /dev/null and b/purenessscopeserver/example-Module/UDPTest/UDPTest.exp differ diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.lib b/purenessscopeserver/example-Module/UDPTest/UDPTest.lib new file mode 100644 index 000000000..f80f750b4 Binary files /dev/null and b/purenessscopeserver/example-Module/UDPTest/UDPTest.lib differ diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.mk b/purenessscopeserver/example-Module/UDPTest/UDPTest.mk new file mode 100644 index 000000000..0f5719c07 --- /dev/null +++ b/purenessscopeserver/example-Module/UDPTest/UDPTest.mk @@ -0,0 +1,120 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=UDPTest +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/UDPTest +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="UDPTest.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/UDPTest_UDPTest.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/UDPTest" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(ObjectSuffix): ./UDPTest/BaseCommand.cpp $(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/UDPTest/UDPTest/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(DependSuffix): ./UDPTest/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(DependSuffix) -MM ./UDPTest/BaseCommand.cpp + +$(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(PreprocessSuffix): ./UDPTest/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDPTest_BaseCommand.cpp$(PreprocessSuffix) ./UDPTest/BaseCommand.cpp + +$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(ObjectSuffix): ./UDPTest/UDPTest.cpp $(IntermediateDirectory)/UDPTest_UDPTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/UDPTest/UDPTest/UDPTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(DependSuffix): ./UDPTest/UDPTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(DependSuffix) -MM ./UDPTest/UDPTest.cpp + +$(IntermediateDirectory)/UDPTest_UDPTest.cpp$(PreprocessSuffix): ./UDPTest/UDPTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/UDPTest_UDPTest.cpp$(PreprocessSuffix) ./UDPTest/UDPTest.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.project b/purenessscopeserver/example-Module/UDPTest/UDPTest.project new file mode 100644 index 000000000..f52545b32 --- /dev/null +++ b/purenessscopeserver/example-Module/UDPTest/UDPTest.project @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.sln b/purenessscopeserver/example-Module/UDPTest/UDPTest.sln deleted file mode 100644 index e898ed787..000000000 --- a/purenessscopeserver/example-Module/UDPTest/UDPTest.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UDPTest", "UDPTest.vcxproj", "{6C1526BE-FECA-1BAD-1112-D8470000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Debug|Win32.Build.0 = Debug|Win32 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Debug|x64.ActiveCfg = Debug|x64 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Debug|x64.Build.0 = Debug|x64 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Release|Win32.ActiveCfg = Release|Win32 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Release|Win32.Build.0 = Release|Win32 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Release|x64.ActiveCfg = Release|x64 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.txt b/purenessscopeserver/example-Module/UDPTest/UDPTest.txt new file mode 100644 index 000000000..39c67ee1c --- /dev/null +++ b/purenessscopeserver/example-Module/UDPTest/UDPTest.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/UDPTest_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/UDPTest_UDPTest.cpp.o diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.vcproj b/purenessscopeserver/example-Module/UDPTest/UDPTest.vcproj deleted file mode 100644 index 2ab45aff2..000000000 --- a/purenessscopeserver/example-Module/UDPTest/UDPTest.vcproj +++ /dev/null @@ -1,436 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.vcxproj b/purenessscopeserver/example-Module/UDPTest/UDPTest.vcxproj deleted file mode 100644 index 7165fd109..000000000 --- a/purenessscopeserver/example-Module/UDPTest/UDPTest.vcxproj +++ /dev/null @@ -1,253 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {6C1526BE-FECA-1BAD-1112-D8470000002E} - UDPTest - Win32Proj - 8.1 - - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - DynamicLibrary - v140 - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>11.0.50727.1 - - - ..\..\FrameCore\Windows_Bin\ - Debug\UDPTest\I386\ - true - - - ..\..\PurenessScopeServer\Windows_Bin\ - Release\UDPTest\I386\ - false - - - ..\..\FrameCore\Windows_Bin\ - Debug\UDPTest\AMD64\ - true - - - ..\..\PurenessScopeServer\Windows_Bin\ - Release\UDPTest\AMD64\ - false - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);..\..\Common;%(AdditionalIncludeDirectories) - TEST_UDP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - - - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)$(TargetName)$(TargetExt) - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\UDPTestd.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - TEST_UDP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - - - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)UDPTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\UDPTest.lib - MachineX86 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - Disabled - $(ACE_ROOT);.;..\..\Common;%(AdditionalIncludeDirectories) - TEST_UDP_BUILD_DLL;_DEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;MPC_LIB_MODIFIER="d";%(PreprocessorDefinitions) - false - EnableFastChecks - MultiThreadedDebugDLL - true - Level3 - ProgramDatabase - 4355;%(DisableSpecificWarnings) - - - _DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACEd.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)UDPTestd.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - true - Windows - .\\UDPTestd.lib - MachineX64 - - - - - %(Filename).tlb - %(Filename).h - %(Filename)_i.c - %(Filename)_p.c - - - MaxSpeed - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - TEST_UDP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - true - Level3 - 4355;%(DisableSpecificWarnings) - - - NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WIN64;%(PreprocessorDefinitions) - 0x0409 - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) - - - /machine:AMD64 %(AdditionalOptions) - ACE.lib;iphlpapi.lib;%(AdditionalDependencies) - $(OutDir)UDPTest.dll - true - .;$(ACE_ROOT)\lib;%(AdditionalLibraryDirectories) - false - Windows - true - true - .\\UDPTest.lib - MachineX64 - - - - - - - - - - - - true - true - true - true - - - - - true - true - true - true - - - - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.vcxproj.filters b/purenessscopeserver/example-Module/UDPTest/UDPTest.vcxproj.filters deleted file mode 100644 index ad41a057e..000000000 --- a/purenessscopeserver/example-Module/UDPTest/UDPTest.vcxproj.filters +++ /dev/null @@ -1,43 +0,0 @@ - - - - - {13a62b2a-a278-498c-8981-a00f1ae67e38} - cpp;cxx;cc;c;C - - - {2720caaa-bc3b-49fd-8a0d-f8527da5838b} - h;hpp;hxx;hh - - - {ed171ffa-c349-4cf5-86ea-b65677413c4a} - mpc;mpb;mwc - - - {79535a2c-b41b-4307-bb93-e142ce903454} - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Build Files - - - - - Documentation - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/UDPTest/BaseCommand.cpp b/purenessscopeserver/example-Module/UDPTest/UDPTest/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/UDPTest/BaseCommand.cpp rename to purenessscopeserver/example-Module/UDPTest/UDPTest/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/UDPTest/BaseCommand.h b/purenessscopeserver/example-Module/UDPTest/UDPTest/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/UDPTest/BaseCommand.h rename to purenessscopeserver/example-Module/UDPTest/UDPTest/BaseCommand.h diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest.cpp b/purenessscopeserver/example-Module/UDPTest/UDPTest/UDPTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/UDPTest/UDPTest.cpp rename to purenessscopeserver/example-Module/UDPTest/UDPTest/UDPTest.cpp diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.cbp b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.cbp new file mode 100644 index 000000000..bac66000e --- /dev/null +++ b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.cbp @@ -0,0 +1,44 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.depend b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.layout b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.sln b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.sln deleted file mode 100644 index 98a9581c2..000000000 --- a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27428.2037 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UDPTest", "UDPTest_2017.vcxproj", "{6C1526BE-FECA-1BAD-1112-D8470000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Debug|Win32.Build.0 = Debug|Win32 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Debug|x64.ActiveCfg = Debug|x64 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Debug|x64.Build.0 = Debug|x64 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Release|Win32.ActiveCfg = Release|Win32 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Release|Win32.Build.0 = Release|Win32 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Release|x64.ActiveCfg = Release|x64 - {6C1526BE-FECA-1BAD-1112-D8470000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.vcxproj b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.vcxproj index a85ee8169..76ba4d697 100644 --- a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.vcxproj +++ b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.vcxproj @@ -18,11 +18,18 @@ x64 + + + + + + + - {6C1526BE-FECA-1BAD-1112-D8470000002E} + {35E87184-B810-4F30-8333-D463DC335890} UDPTest Win32Proj - 10.0.16299.0 + 10.0.17763.0 @@ -80,8 +87,8 @@ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\UDPTest\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -198,7 +205,7 @@ MaxSpeed - $(ACE_ROOT);.;..\Include;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) TEST_UDP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -224,29 +231,6 @@ MachineX64 - - - - - - - - - - true - true - true - true - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.vcxproj.filters b/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.vcxproj.filters deleted file mode 100644 index ad41a057e..000000000 --- a/purenessscopeserver/example-Module/UDPTest/UDPTest_2017.vcxproj.filters +++ /dev/null @@ -1,43 +0,0 @@ - - - - - {13a62b2a-a278-498c-8981-a00f1ae67e38} - cpp;cxx;cc;c;C - - - {2720caaa-bc3b-49fd-8a0d-f8527da5838b} - h;hpp;hxx;hh - - - {ed171ffa-c349-4cf5-86ea-b65677413c4a} - mpc;mpb;mwc - - - {79535a2c-b41b-4307-bb93-e142ce903454} - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - Build Files - - - - - Documentation - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTestd.exp b/purenessscopeserver/example-Module/UDPTest/UDPTestd.exp deleted file mode 100644 index ae6527430..000000000 Binary files a/purenessscopeserver/example-Module/UDPTest/UDPTestd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/UDPTest/UDPTestd.lib b/purenessscopeserver/example-Module/UDPTest/UDPTestd.lib deleted file mode 100644 index 4a182c76a..000000000 Binary files a/purenessscopeserver/example-Module/UDPTest/UDPTestd.lib and /dev/null differ diff --git a/purenessscopeserver/example-Module/UDPTest/runlinuxmake.sh b/purenessscopeserver/example-Module/UDPTest/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/UDPTest/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/UDPTest/zzz.bat b/purenessscopeserver/example-Module/UDPTest/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/UDPTest/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/WebSocket/BaseCommand.cpp b/purenessscopeserver/example-Module/WebSocket/BaseCommand.cpp deleted file mode 100644 index b5e0222b0..000000000 --- a/purenessscopeserver/example-Module/WebSocket/BaseCommand.cpp +++ /dev/null @@ -1,280 +0,0 @@ -#include "BaseCommand.h" -#include "base64.h" -#include "sha1.h" - -CBaseCommand::CBaseCommand(void) -{ - m_pServerObject = NULL; - m_nCount = 0; -} - -CBaseCommand::~CBaseCommand(void) -{ -} - -void CBaseCommand::SetServerObject(CServerObject* pServerObject) -{ - m_pServerObject = pServerObject; -} - -int CBaseCommand::DoMessage(IMessage* pMessage, bool& bDeleteFlag) -{ - //__ENTER_FUNCTIONԶĺ׷tryĺ꣬ڲ׽ʹ__THROW_FUNCTION()׳Ĵ - //__THROW_FUNCTION("hello"); ԶLogļµassert.log¼ļ - //Ƽʹ꣬סһҪںĽʹ__LEAVE_FUNCTION__LEAVE_FUNCTION_WITHRETURN֮ԡ - //__LEAVE_FUNCTION_WITHRETURN__LEAVE_FUNCTIONͬǰ߿ֺ֧˳ʱ򷵻һ - //Ƿһint - //ôĩβ__LEAVE_FUNCTION_WITHRETURN(0); 0ǷصintȻҲֱ֧ͱ忴Լĺ - //καʹ__LEAVE_FUNCTIONɡ - __ENTER_FUNCTION(); - - if(m_pServerObject == NULL) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] m_pServerObject is NULL(%d).\n", bDeleteFlag)); - return -1; - } - - if(pMessage == NULL) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pMessage is NULL.\n")); - return -1; - } - - //ӽϢ - if(pMessage->GetMessageBase()->m_u2Cmd == CLIENT_LINK_CONNECT) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] CLIENT_LINK_CONNECT OK.\n")); - return 0; - } - - //ӶϿϢ - if(pMessage->GetMessageBase()->m_u2Cmd == CLIENT_LINK_CDISCONNET) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] CLIENT_LINK_CDISCONNET OK.\n")); - return 0; - } - - //Ϣ - if(pMessage->GetMessageBase()->m_u2Cmd == COMMAND_HANDIN) - { - DoMessage_HandIn(pMessage, bDeleteFlag); - } - else if(pMessage->GetMessageBase()->m_u2Cmd == COMMAND_DATAIN) - { - DoMessage_DataIn(pMessage, bDeleteFlag); - } - - return 0; - - __LEAVE_FUNCTION_WITHRETURN(0); -} - -int CBaseCommand::DoMessage_HandIn(IMessage* pMessage, bool& bDeleteFlag) -{ - //յݣ - char szReturnData[MAX_BUFF_500] = {'\0'}; - char szClientKey[MAX_BUFF_100] = {'\0'}; - char szOrigenKey[MAX_BUFF_100] = {'\0'}; - char szMagicKey[MAX_BUFF_100] = {'\0'}; - - //ħַ - sprintf_safe(szMagicKey, MAX_BUFF_100, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - - _PacketInfo BodyPacket; - pMessage->GetPacketBody(BodyPacket); - - //յݰ֤key - //Ѱְеkeyֵ - char* pClientkeyEnd = NULL; - - char* pClientKeyBegin = ACE_OS::strstr(BodyPacket.m_pData, CLIENT_KEY_TAG); - if(NULL != pClientKeyBegin) - { - pClientkeyEnd = strstr(pClientKeyBegin, "\r\n"); - } - else - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] pClientKeyBegin = NULL(%d).\n", bDeleteFlag)); - return 0; - } - - if(NULL == pClientkeyEnd) - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] pClientkeyEnd = NULL.\n")); - return 0; - } - - //ÿͻkey - uint32 u4TagLength = ACE_OS::strlen(CLIENT_KEY_TAG); - uint32 u4ClientKeyLength = (uint32)(pClientkeyEnd - pClientKeyBegin) - u4TagLength; - if(u4ClientKeyLength >= MAX_BUFF_100) - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] key is too length(%d).\n", u4ClientKeyLength)); - return 0; - } - ACE_OS::memcpy(szOrigenKey, pClientKeyBegin + u4TagLength, u4ClientKeyLength); - - //ȥո - TrimString(szOrigenKey, szClientKey); - - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn]ClientKey=%s.\n", szClientKey)); - - //ħַͻ˵key - ACE_OS::strcat(szClientKey, szMagicKey); - - //sha1㷨 - SHA1 objSha; - uint32 u4digest[5]; - - objSha.Reset(); - objSha << szClientKey; - - objSha.Result(u4digest); - - //ļܴת - for (int i = 0; i < 5; i++) - { - u4digest[i] = htonl(u4digest[i]); - } - - //ٽַתBase64 - std::string strServerKey = ""; - strServerKey = base64_encode( - reinterpret_cast - (u4digest), sizeof(u4digest) - ); - - //÷ַ - sprintf_safe(szReturnData, MAX_BUFF_200, HANDIN_RETURN_DATA, strServerKey.c_str()); - - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn]ServerKey=%s.\n", strServerKey.c_str())); - - uint16 u2PostCommandID = COMMAND_RETURN_HANDIN; - - //֤ - if(NULL != m_pServerObject->GetConnectManager()) - { - //ȫ - const char* ptrReturnData = reinterpret_cast(szReturnData); - m_pServerObject->GetConnectManager()->PostMessage(pMessage->GetMessageBase()->m_u4ConnectID, ptrReturnData, - (uint32)ACE_OS::strlen(szReturnData), SENDMESSAGE_JAMPNOMAL, u2PostCommandID, PACKET_SEND_IMMEDIATLY, PACKET_IS_SELF_RECYC); - } - else - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] m_pConnectManager = NULL.\n")); - } - - return 0; -} - -int CBaseCommand::DoMessage_DataIn(IMessage* pMessage, bool& bDeleteFlag) -{ - _PacketInfo BodyPacket; - pMessage->GetPacketBody(BodyPacket); - - char* pData = new char[BodyPacket.m_nDataLen + 1]; - pData[BodyPacket.m_nDataLen] = '\0'; - - ACE_OS::memcpy(pData, BodyPacket.m_pData, BodyPacket.m_nDataLen); - - //ӡպ - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_DataIn](%d)%s\n", bDeleteFlag, pData)); - - //ԭ - char szReturnBuff[MAX_BUFF_1024] = {'\0'}; - uint32 u4ReturnLen = MAX_BUFF_1024; - - uint16 u2PostCommandID = COMMAND_RETURN_DATAIN; - - //ƴӷذ - char szTemp[MAX_BUFF_1024] = {'\0'}; - ACE_OS::memset(szTemp, 0, MAX_BUFF_1024); - sprintf_safe(szTemp, MAX_BUFF_1024, "%04x,%04d", u2PostCommandID, BodyPacket.m_nDataLen + 9); - ACE_OS::memcpy(&szTemp[ACE_OS::strlen(szTemp)], BodyPacket.m_pData, BodyPacket.m_nDataLen); - - WebSocketEncrypt(szTemp, (uint32)ACE_OS::strlen(szTemp), szReturnBuff, u4ReturnLen); - - SAFE_DELETE_ARRAY(pData); - - if(NULL != m_pServerObject->GetConnectManager()) - { - //ȫ - char* ptrReturnData = szReturnBuff; - m_pServerObject->GetConnectManager()->PostMessage(pMessage->GetMessageBase()->m_u4ConnectID, ptrReturnData, - u4ReturnLen, SENDMESSAGE_JAMPNOMAL, u2PostCommandID, PACKET_SEND_IMMEDIATLY, PACKET_IS_SELF_RECYC); - } - else - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] m_pConnectManager = NULL.\n")); - } - - - return 0; -} - -bool CBaseCommand::WebSocketEncrypt(char* pOriData, uint32 u4OriLen, char* pEncryData, uint32& u4EnCryLen) -{ - uint64 length = (uint64)u4OriLen; - uint64 expectedSize = length + 1; //flags byte. - if(length <= 125) - expectedSize += 1; - else if(length > 125 && length <= 65535) - expectedSize += 3; - else - expectedSize += 9; - - int iPyl = 0; - unsigned char payloadFlags = 129; - ACE_OS::memcpy(pEncryData, &payloadFlags, 1); - //length+=1; - iPyl+=1; - - //create the length byte - if (length <= 125) - { - char basicSize = u4OriLen; - ACE_OS::memcpy(pEncryData+iPyl, &basicSize, 1); - //length+=1; - iPyl+=1; - } - else if ((length > 125) && (length <= 65535)) - { - char basicSize = 126; - ACE_OS::memcpy(pEncryData+iPyl, &basicSize, 1); - //length+=1; - iPyl+=1; - - - char len[2]; - len[0] = ( length >> 8 ) & 255; - len[1] = ( length ) & 255; - ACE_OS::memcpy(pEncryData+iPyl,&len,2); - //length+=2; - iPyl+=2; - } - else - { - char basicSize = 127; - ACE_OS::memcpy(pEncryData+iPyl,&basicSize,1); - //length+=1; - iPyl+=1; - - char len[8]; - len[0] = ( length >> 56 ) & 255; - len[1] = ( length >> 48 ) & 255; - len[2] = ( length >> 40 ) & 255; - len[3] = ( length >> 32 ) & 255; - len[4] = ( length >> 24 ) & 255; - len[5] = ( length >> 16 ) & 255; - len[6] = ( length >> 8 ) & 255; - len[7] = ( length ) & 255; - ACE_OS::memcpy(pEncryData+iPyl, len, 8); - //length+=8; - iPyl+=8; - } - - ACE_OS::memcpy(pEncryData+iPyl, pOriData, u4OriLen); - u4EnCryLen = (uint32)expectedSize; - - return true; -} diff --git a/purenessscopeserver/example-Module/WebSocket/CMakeLists.txt b/purenessscopeserver/example-Module/WebSocket/CMakeLists.txt new file mode 100644 index 000000000..c4b3eb002 --- /dev/null +++ b/purenessscopeserver/example-Module/WebSocket/CMakeLists.txt @@ -0,0 +1,86 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(WebSocket) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_WebSocket_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./WebSocket/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./WebSocket/base64.cpp + ${CMAKE_CURRENT_LIST_DIR}/./WebSocket/WebSocketTest.cpp + ${CMAKE_CURRENT_LIST_DIR}/./WebSocket/sha1.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(WebSocket SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(WebSocket ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/WebSocket/Makefile b/purenessscopeserver/example-Module/WebSocket/Makefile index b3fdb8cf7..26a47ed53 100644 --- a/purenessscopeserver/example-Module/WebSocket/Makefile +++ b/purenessscopeserver/example-Module/WebSocket/Makefile @@ -1,26 +1,136 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=WebSocket +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/WebSocket +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="WebSocket.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = base64.o sha1.o BaseCommand.o WebSocketTest.o -LIB_BASE_OBJS = base64.o sha1.o BaseCommand.o WebSocketTest.o -LIB_BASE = libWebSocketTest.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/WebSocket_base64.cpp$(ObjectSuffix) $(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(ObjectSuffix) $(IntermediateDirectory)/WebSocket_sha1.cpp$(ObjectSuffix) -all: libWebSocketTest.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/WebSocket" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(ObjectSuffix): ./WebSocket/BaseCommand.cpp $(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./WebSocket/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(DependSuffix): ./WebSocket/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(DependSuffix) -MM ./WebSocket/BaseCommand.cpp + +$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(PreprocessSuffix): ./WebSocket/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(PreprocessSuffix) ./WebSocket/BaseCommand.cpp + +$(IntermediateDirectory)/WebSocket_base64.cpp$(ObjectSuffix): ./WebSocket/base64.cpp $(IntermediateDirectory)/WebSocket_base64.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./WebSocket/base64.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/WebSocket_base64.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/WebSocket_base64.cpp$(DependSuffix): ./WebSocket/base64.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/WebSocket_base64.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/WebSocket_base64.cpp$(DependSuffix) -MM ./WebSocket/base64.cpp + +$(IntermediateDirectory)/WebSocket_base64.cpp$(PreprocessSuffix): ./WebSocket/base64.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/WebSocket_base64.cpp$(PreprocessSuffix) ./WebSocket/base64.cpp + +$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(ObjectSuffix): ./WebSocket/WebSocketTest.cpp $(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./WebSocket/WebSocketTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(DependSuffix): ./WebSocket/WebSocketTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(DependSuffix) -MM ./WebSocket/WebSocketTest.cpp + +$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(PreprocessSuffix): ./WebSocket/WebSocketTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(PreprocessSuffix) ./WebSocket/WebSocketTest.cpp + +$(IntermediateDirectory)/WebSocket_sha1.cpp$(ObjectSuffix): ./WebSocket/sha1.cpp $(IntermediateDirectory)/WebSocket_sha1.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./WebSocket/sha1.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/WebSocket_sha1.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/WebSocket_sha1.cpp$(DependSuffix): ./WebSocket/sha1.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/WebSocket_sha1.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/WebSocket_sha1.cpp$(DependSuffix) -MM ./WebSocket/sha1.cpp + +$(IntermediateDirectory)/WebSocket_sha1.cpp$(PreprocessSuffix): ./WebSocket/sha1.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/WebSocket_sha1.cpp$(PreprocessSuffix) ./WebSocket/sha1.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libWebSocketTest.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/WebSocket/Makefile.define b/purenessscopeserver/example-Module/WebSocket/Makefile.define deleted file mode 100644 index 1a591ef62..000000000 --- a/purenessscopeserver/example-Module/WebSocket/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c -g $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) $(CFLAGS) -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocket.mk b/purenessscopeserver/example-Module/WebSocket/WebSocket.mk new file mode 100644 index 000000000..6b47b28b0 --- /dev/null +++ b/purenessscopeserver/example-Module/WebSocket/WebSocket.mk @@ -0,0 +1,136 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=WebSocket +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/WebSocket +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="WebSocket.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/WebSocket_base64.cpp$(ObjectSuffix) $(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(ObjectSuffix) $(IntermediateDirectory)/WebSocket_sha1.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/WebSocket" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(ObjectSuffix): ./WebSocket/BaseCommand.cpp $(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/WebSocket/WebSocket/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(DependSuffix): ./WebSocket/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(DependSuffix) -MM ./WebSocket/BaseCommand.cpp + +$(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(PreprocessSuffix): ./WebSocket/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/WebSocket_BaseCommand.cpp$(PreprocessSuffix) ./WebSocket/BaseCommand.cpp + +$(IntermediateDirectory)/WebSocket_base64.cpp$(ObjectSuffix): ./WebSocket/base64.cpp $(IntermediateDirectory)/WebSocket_base64.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/WebSocket/WebSocket/base64.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/WebSocket_base64.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/WebSocket_base64.cpp$(DependSuffix): ./WebSocket/base64.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/WebSocket_base64.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/WebSocket_base64.cpp$(DependSuffix) -MM ./WebSocket/base64.cpp + +$(IntermediateDirectory)/WebSocket_base64.cpp$(PreprocessSuffix): ./WebSocket/base64.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/WebSocket_base64.cpp$(PreprocessSuffix) ./WebSocket/base64.cpp + +$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(ObjectSuffix): ./WebSocket/WebSocketTest.cpp $(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/WebSocket/WebSocket/WebSocketTest.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(DependSuffix): ./WebSocket/WebSocketTest.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(DependSuffix) -MM ./WebSocket/WebSocketTest.cpp + +$(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(PreprocessSuffix): ./WebSocket/WebSocketTest.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/WebSocket_WebSocketTest.cpp$(PreprocessSuffix) ./WebSocket/WebSocketTest.cpp + +$(IntermediateDirectory)/WebSocket_sha1.cpp$(ObjectSuffix): ./WebSocket/sha1.cpp $(IntermediateDirectory)/WebSocket_sha1.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/WebSocket/WebSocket/sha1.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/WebSocket_sha1.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/WebSocket_sha1.cpp$(DependSuffix): ./WebSocket/sha1.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/WebSocket_sha1.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/WebSocket_sha1.cpp$(DependSuffix) -MM ./WebSocket/sha1.cpp + +$(IntermediateDirectory)/WebSocket_sha1.cpp$(PreprocessSuffix): ./WebSocket/sha1.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/WebSocket_sha1.cpp$(PreprocessSuffix) ./WebSocket/sha1.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocket.project b/purenessscopeserver/example-Module/WebSocket/WebSocket.project new file mode 100644 index 000000000..04ee1c6af --- /dev/null +++ b/purenessscopeserver/example-Module/WebSocket/WebSocket.project @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocket.sln b/purenessscopeserver/example-Module/WebSocket/WebSocket.sln deleted file mode 100644 index 6bddff212..000000000 --- a/purenessscopeserver/example-Module/WebSocket/WebSocket.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WebSocketTest", "WebSocketTest.vcxproj", "{FCD375CB-FECA-1BAD-151F-D7130000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {FCD375CB-FECA-1BAD-151F-D7130000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {FCD375CB-FECA-1BAD-151F-D7130000002E}.Debug|Win32.Build.0 = Debug|Win32 - {FCD375CB-FECA-1BAD-151F-D7130000002E}.Debug|x64.ActiveCfg = Debug|x64 - {FCD375CB-FECA-1BAD-151F-D7130000002E}.Debug|x64.Build.0 = Debug|x64 - {FCD375CB-FECA-1BAD-151F-D7130000002E}.Release|Win32.ActiveCfg = Release|Win32 - {FCD375CB-FECA-1BAD-151F-D7130000002E}.Release|Win32.Build.0 = Release|Win32 - {FCD375CB-FECA-1BAD-151F-D7130000002E}.Release|x64.ActiveCfg = Release|x64 - {FCD375CB-FECA-1BAD-151F-D7130000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocket.txt b/purenessscopeserver/example-Module/WebSocket/WebSocket.txt new file mode 100644 index 000000000..b3a254d83 --- /dev/null +++ b/purenessscopeserver/example-Module/WebSocket/WebSocket.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/WebSocket_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/WebSocket_base64.cpp.o ../../../Build/Linux/Linux_Bin/Temp/WebSocket_WebSocketTest.cpp.o ../../../Build/Linux/Linux_Bin/Temp/WebSocket_sha1.cpp.o diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocket/BaseCommand.cpp b/purenessscopeserver/example-Module/WebSocket/WebSocket/BaseCommand.cpp new file mode 100644 index 000000000..f0d36d455 --- /dev/null +++ b/purenessscopeserver/example-Module/WebSocket/WebSocket/BaseCommand.cpp @@ -0,0 +1,280 @@ +#include "BaseCommand.h" +#include "base64.h" +#include "sha1.h" + +CBaseCommand::CBaseCommand(void) +{ + m_pServerObject = NULL; + m_nCount = 0; +} + +CBaseCommand::~CBaseCommand(void) +{ +} + +void CBaseCommand::SetServerObject(CServerObject* pServerObject) +{ + m_pServerObject = pServerObject; +} + +int CBaseCommand::DoMessage(IMessage* pMessage, bool& bDeleteFlag) +{ + //__ENTER_FUNCTIONԶĺ׷tryĺ꣬ڲ׽ʹ__THROW_FUNCTION()׳Ĵ + //__THROW_FUNCTION("hello"); ԶLogļµassert.log¼ļ + //Ƽʹ꣬סһҪںĽʹ__LEAVE_FUNCTION__LEAVE_FUNCTION_WITHRETURN֮ԡ + //__LEAVE_FUNCTION_WITHRETURN__LEAVE_FUNCTIONͬǰ߿ֺ֧˳ʱ򷵻һ + //Ƿһint + //ôĩβ__LEAVE_FUNCTION_WITHRETURN(0); 0ǷصintȻҲֱ֧ͱ忴Լĺ + //καʹ__LEAVE_FUNCTIONɡ + __ENTER_FUNCTION(); + + if(m_pServerObject == NULL) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] m_pServerObject is NULL(%d).\n", bDeleteFlag)); + return -1; + } + + if(pMessage == NULL) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pMessage is NULL.\n")); + return -1; + } + + //ӽϢ + if(pMessage->GetMessageBase()->m_u2Cmd == CLIENT_LINK_CONNECT) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] CLIENT_LINK_CONNECT OK.\n")); + return 0; + } + + //ӶϿϢ + if(pMessage->GetMessageBase()->m_u2Cmd == CLIENT_LINK_CDISCONNET) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] CLIENT_LINK_CDISCONNET OK.\n")); + return 0; + } + + //Ϣ + if(pMessage->GetMessageBase()->m_u2Cmd == COMMAND_HANDIN) + { + DoMessage_HandIn(pMessage, bDeleteFlag); + } + else if(pMessage->GetMessageBase()->m_u2Cmd == COMMAND_DATAIN) + { + DoMessage_DataIn(pMessage, bDeleteFlag); + } + + return 0; + + __LEAVE_FUNCTION_WITHRETURN(0); +} + +int CBaseCommand::DoMessage_HandIn(IMessage* pMessage, bool& bDeleteFlag) +{ + //յݣ + char szReturnData[MAX_BUFF_500] = {'\0'}; + char szClientKey[MAX_BUFF_100] = {'\0'}; + char szOrigenKey[MAX_BUFF_100] = {'\0'}; + char szMagicKey[MAX_BUFF_100] = {'\0'}; + + //ħַ + sprintf_safe(szMagicKey, MAX_BUFF_100, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + + _PacketInfo BodyPacket; + pMessage->GetPacketBody(BodyPacket); + + //յݰ֤key + //Ѱְеkeyֵ + char* pClientkeyEnd = NULL; + + char* pClientKeyBegin = ACE_OS::strstr(BodyPacket.m_pData, CLIENT_KEY_TAG); + if(NULL != pClientKeyBegin) + { + pClientkeyEnd = strstr(pClientKeyBegin, "\r\n"); + } + else + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] pClientKeyBegin = NULL(%d).\n", bDeleteFlag)); + return 0; + } + + if(NULL == pClientkeyEnd) + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] pClientkeyEnd = NULL.\n")); + return 0; + } + + //ÿͻkey + uint32 u4TagLength = ACE_OS::strlen(CLIENT_KEY_TAG); + uint32 u4ClientKeyLength = (uint32)(pClientkeyEnd - pClientKeyBegin) - u4TagLength; + if(u4ClientKeyLength >= MAX_BUFF_100) + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] key is too length(%d).\n", u4ClientKeyLength)); + return 0; + } + ACE_OS::memcpy(szOrigenKey, pClientKeyBegin + u4TagLength, u4ClientKeyLength); + + //ȥո + TrimString(szOrigenKey, szClientKey); + + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn]ClientKey=%s.\n", szClientKey)); + + //ħַͻ˵key + ACE_OS::strcat(szClientKey, szMagicKey); + + //sha1㷨 + SHA1 objSha; + uint32 u4digest[5]; + + objSha.Reset(); + objSha << szClientKey; + + objSha.Result(u4digest); + + //ļܴת + for (int i = 0; i < 5; i++) + { + u4digest[i] = htonl(u4digest[i]); + } + + //ٽַתBase64 + std::string strServerKey = ""; + strServerKey = base64_encode( + reinterpret_cast + (u4digest), sizeof(u4digest) + ); + + //÷ַ + sprintf_safe(szReturnData, MAX_BUFF_200, HANDIN_RETURN_DATA, strServerKey.c_str()); + + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn]ServerKey=%s.\n", strServerKey.c_str())); + + uint16 u2PostCommandID = COMMAND_RETURN_HANDIN; + + //֤ + if(NULL != m_pServerObject->GetConnectManager()) + { + //ȫ + char* ptrReturnData = reinterpret_cast< char*>(szReturnData); + m_pServerObject->GetConnectManager()->PostMessage(pMessage->GetMessageBase()->m_u4ConnectID, ptrReturnData, + (uint32)ACE_OS::strlen(szReturnData), SENDMESSAGE_JAMPNOMAL, u2PostCommandID, PACKET_SEND_IMMEDIATLY, PACKET_IS_SELF_RECYC); + } + else + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] m_pConnectManager = NULL.\n")); + } + + return 0; +} + +int CBaseCommand::DoMessage_DataIn(IMessage* pMessage, bool& bDeleteFlag) +{ + _PacketInfo BodyPacket; + pMessage->GetPacketBody(BodyPacket); + + char* pData = new char[BodyPacket.m_nDataLen + 1]; + pData[BodyPacket.m_nDataLen] = '\0'; + + ACE_OS::memcpy(pData, BodyPacket.m_pData, BodyPacket.m_nDataLen); + + //ӡպ + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_DataIn](%d)%s\n", bDeleteFlag, pData)); + + //ԭ + char szReturnBuff[MAX_BUFF_1024] = {'\0'}; + uint32 u4ReturnLen = MAX_BUFF_1024; + + uint16 u2PostCommandID = COMMAND_RETURN_DATAIN; + + //ƴӷذ + char szTemp[MAX_BUFF_1024] = {'\0'}; + ACE_OS::memset(szTemp, 0, MAX_BUFF_1024); + sprintf_safe(szTemp, MAX_BUFF_1024, "%04x,%04d", u2PostCommandID, BodyPacket.m_nDataLen + 9); + ACE_OS::memcpy(&szTemp[ACE_OS::strlen(szTemp)], BodyPacket.m_pData, BodyPacket.m_nDataLen); + + WebSocketEncrypt(szTemp, (uint32)ACE_OS::strlen(szTemp), szReturnBuff, u4ReturnLen); + + SAFE_DELETE_ARRAY(pData); + + if(NULL != m_pServerObject->GetConnectManager()) + { + //ȫ + char* ptrReturnData = szReturnBuff; + m_pServerObject->GetConnectManager()->PostMessage(pMessage->GetMessageBase()->m_u4ConnectID, ptrReturnData, + u4ReturnLen, SENDMESSAGE_JAMPNOMAL, u2PostCommandID, PACKET_SEND_IMMEDIATLY, PACKET_IS_SELF_RECYC); + } + else + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage_HandIn] m_pConnectManager = NULL.\n")); + } + + + return 0; +} + +bool CBaseCommand::WebSocketEncrypt(char* pOriData, uint32 u4OriLen, char* pEncryData, uint32& u4EnCryLen) +{ + uint64 length = (uint64)u4OriLen; + uint64 expectedSize = length + 1; //flags byte. + if(length <= 125) + expectedSize += 1; + else if(length > 125 && length <= 65535) + expectedSize += 3; + else + expectedSize += 9; + + int iPyl = 0; + unsigned char payloadFlags = 129; + ACE_OS::memcpy(pEncryData, &payloadFlags, 1); + //length+=1; + iPyl+=1; + + //create the length byte + if (length <= 125) + { + char basicSize = u4OriLen; + ACE_OS::memcpy(pEncryData+iPyl, &basicSize, 1); + //length+=1; + iPyl+=1; + } + else if ((length > 125) && (length <= 65535)) + { + char basicSize = 126; + ACE_OS::memcpy(pEncryData+iPyl, &basicSize, 1); + //length+=1; + iPyl+=1; + + + char len[2]; + len[0] = ( length >> 8 ) & 255; + len[1] = ( length ) & 255; + ACE_OS::memcpy(pEncryData+iPyl,&len,2); + //length+=2; + iPyl+=2; + } + else + { + char basicSize = 127; + ACE_OS::memcpy(pEncryData+iPyl,&basicSize,1); + //length+=1; + iPyl+=1; + + char len[8]; + len[0] = ( length >> 56 ) & 255; + len[1] = ( length >> 48 ) & 255; + len[2] = ( length >> 40 ) & 255; + len[3] = ( length >> 32 ) & 255; + len[4] = ( length >> 24 ) & 255; + len[5] = ( length >> 16 ) & 255; + len[6] = ( length >> 8 ) & 255; + len[7] = ( length ) & 255; + ACE_OS::memcpy(pEncryData+iPyl, len, 8); + //length+=8; + iPyl+=8; + } + + ACE_OS::memcpy(pEncryData+iPyl, pOriData, u4OriLen); + u4EnCryLen = (uint32)expectedSize; + + return true; +} diff --git a/purenessscopeserver/example-Module/WebSocket/BaseCommand.h b/purenessscopeserver/example-Module/WebSocket/WebSocket/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/WebSocket/BaseCommand.h rename to purenessscopeserver/example-Module/WebSocket/WebSocket/BaseCommand.h diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.cpp b/purenessscopeserver/example-Module/WebSocket/WebSocket/WebSocketTest.cpp similarity index 100% rename from purenessscopeserver/example-Module/WebSocket/WebSocketTest.cpp rename to purenessscopeserver/example-Module/WebSocket/WebSocket/WebSocketTest.cpp diff --git a/purenessscopeserver/example-Module/WebSocket/base64.cpp b/purenessscopeserver/example-Module/WebSocket/WebSocket/base64.cpp similarity index 100% rename from purenessscopeserver/example-Module/WebSocket/base64.cpp rename to purenessscopeserver/example-Module/WebSocket/WebSocket/base64.cpp diff --git a/purenessscopeserver/example-Module/WebSocket/base64.h b/purenessscopeserver/example-Module/WebSocket/WebSocket/base64.h similarity index 100% rename from purenessscopeserver/example-Module/WebSocket/base64.h rename to purenessscopeserver/example-Module/WebSocket/WebSocket/base64.h diff --git a/purenessscopeserver/example-Module/WebSocket/sha1.cpp b/purenessscopeserver/example-Module/WebSocket/WebSocket/sha1.cpp similarity index 100% rename from purenessscopeserver/example-Module/WebSocket/sha1.cpp rename to purenessscopeserver/example-Module/WebSocket/WebSocket/sha1.cpp diff --git a/purenessscopeserver/example-Module/WebSocket/sha1.h b/purenessscopeserver/example-Module/WebSocket/WebSocket/sha1.h similarity index 100% rename from purenessscopeserver/example-Module/WebSocket/sha1.h rename to purenessscopeserver/example-Module/WebSocket/WebSocket/sha1.h diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.cbp b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.cbp new file mode 100644 index 000000000..11b03e4f3 --- /dev/null +++ b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.cbp @@ -0,0 +1,48 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.depend b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.exp b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.exp new file mode 100644 index 000000000..ab4029130 Binary files /dev/null and b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.exp differ diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.layout b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.layout new file mode 100644 index 000000000..7a518efda --- /dev/null +++ b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.layout @@ -0,0 +1,5 @@ + + + + + diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.lib b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.lib new file mode 100644 index 000000000..9215211d1 Binary files /dev/null and b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.lib differ diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.mpc b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.mpc deleted file mode 100644 index 04a6efded..000000000 --- a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(WebSocketTest):acelib{ - sharedname=WebSocketTest - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common -} diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcproj b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcproj deleted file mode 100644 index 83e563d47..000000000 --- a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcproj +++ /dev/null @@ -1,440 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcxproj b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcxproj index 790e0de77..b5ed46980 100644 --- a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcxproj +++ b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -18,30 +18,42 @@ x64 + + + + + + + + + + + {FCD375CB-FECA-1BAD-151F-D7130000002E} WebSocketTest Win32Proj + 10.0.17763.0 DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet DynamicLibrary - v140 + v141 NotSet @@ -64,7 +76,7 @@ <_ProjectFileVersion>11.0.50727.1 - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\WebSocketTest\I386\ true @@ -74,13 +86,13 @@ false - ..\..\PurenessScopeServer\Windows_Bin\ + ..\..\..\Build\Windows\ Debug\WebSocketTest\AMD64\ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\WebSocketTest\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -197,7 +209,7 @@ MaxSpeed - $(ACE_ROOT);.;..\include;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -223,25 +235,6 @@ MachineX64 - - - - - - - - - - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcxproj.filters b/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcxproj.filters deleted file mode 100644 index caa48dea8..000000000 --- a/purenessscopeserver/example-Module/WebSocket/WebSocketTest.vcxproj.filters +++ /dev/null @@ -1,47 +0,0 @@ - - - - - {044f42b7-320b-4432-899f-80b85e560618} - cpp;cxx;cc;c;C - - - {9bff17d7-9fc5-4e6b-b238-1480ed03376c} - h;hpp;hxx;hh - - - {a30cba9b-ea86-4761-8594-51c6484fcd67} - mpc;mpb;mwc - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - - - Build Files - - - \ No newline at end of file diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTestd.exp b/purenessscopeserver/example-Module/WebSocket/WebSocketTestd.exp deleted file mode 100644 index 25b3999c2..000000000 Binary files a/purenessscopeserver/example-Module/WebSocket/WebSocketTestd.exp and /dev/null differ diff --git a/purenessscopeserver/example-Module/WebSocket/WebSocketTestd.lib b/purenessscopeserver/example-Module/WebSocket/WebSocketTestd.lib deleted file mode 100644 index b4701362c..000000000 Binary files a/purenessscopeserver/example-Module/WebSocket/WebSocketTestd.lib and /dev/null differ diff --git a/purenessscopeserver/example-Module/WebSocket/runlinuxmake.sh b/purenessscopeserver/example-Module/WebSocket/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/WebSocket/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/WebSocket/zzz.bat b/purenessscopeserver/example-Module/WebSocket/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/WebSocket/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/XMLParse/BaseCommand.cpp b/purenessscopeserver/example-Module/XMLParse/BaseCommand.cpp deleted file mode 100644 index fca674e38..000000000 --- a/purenessscopeserver/example-Module/XMLParse/BaseCommand.cpp +++ /dev/null @@ -1,161 +0,0 @@ -#include "BaseCommand.h" - -CBaseCommand::CBaseCommand(void) -{ - m_pServerObject = NULL; - m_nCount = 0; -} - -CBaseCommand::~CBaseCommand(void) -{ -} - -void CBaseCommand::SetServerObject(CServerObject* pServerObject) -{ - m_pServerObject = pServerObject; -} - -int CBaseCommand::DoMessage(IMessage* pMessage, bool& bDeleteFlag) -{ - //__ENTER_FUNCTIONԶĺ׷tryĺ꣬ڲ׽ʹ__THROW_FUNCTION()׳Ĵ - //__THROW_FUNCTION("hello"); ԶLogļµassert.log¼ļ - //Ƽʹ꣬סһҪںĽʹ__LEAVE_FUNCTION__LEAVE_FUNCTION_WITHRETURN֮ԡ - //__LEAVE_FUNCTION_WITHRETURN__LEAVE_FUNCTIONͬǰ߿ֺ֧˳ʱ򷵻һ - //Ƿһint - //ôĩβ__LEAVE_FUNCTION_WITHRETURN(0); 0ǷصintȻҲֱ֧ͱ忴Լĺ - //καʹ__LEAVE_FUNCTIONɡ - __ENTER_FUNCTION(); - - if(m_pServerObject == NULL) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] m_pServerObject is NULL(%d).\n", bDeleteFlag)); - return -1; - } - - if(pMessage == NULL) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pMessage is NULL.\n")); - return -1; - } - - //ӽϢ - MESSAGE_FUNCTION_BEGIN(pMessage->GetMessageBase()->m_u2Cmd); - MESSAGE_FUNCTION(CLIENT_LINK_CONNECT, Do_Connect, pMessage); - MESSAGE_FUNCTION(CLIENT_LINK_CDISCONNET, Do_DisConnect, pMessage); - MESSAGE_FUNCTION(CLINET_LINK_SENDTIMEOUT, Do_ClientSendTimeout, pMessage); - MESSAGE_FUNCTION(COMMAND_BASE, Do_Base, pMessage); - MESSAGE_FUNCTION_END; - - return 0; - - __LEAVE_FUNCTION_WITHRETURN(0); -} - -int CBaseCommand::Do_Connect(IMessage* pMessage) -{ - OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_Connect] (%d)TCP CLIENT_LINK_CONNECT OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); - if(NULL != pMessage) - { - //жϵǰǷԽ2000 - int nConnectCount = m_pServerObject->GetConnectManager()->GetCount(); - if(nConnectCount > 2000) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_Connect]connect count is more(%d).\n", nConnectCount)); - } - } - - return 0; -} - -int CBaseCommand::Do_DisConnect(IMessage* pMessage) -{ - if(NULL != pMessage) - { - //ӶϿ¼ - OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_DisConnect](%d)CLIENT_LINK_CDISCONNET OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); - } - - return 0; -} - -int CBaseCommand::Do_ClientSendTimeout(IMessage* pMessage) -{ - //Ϳͻӳֵ¼ - OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_DisConnect](%d)CLINET_LINK_SNEDTIMEOUT OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); - - return 0; -} - -int CBaseCommand::Do_Base(IMessage* pMessage) -{ - //OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage] TcpTest CommandID = %d", COMMAND_BASE)); - //m_pServerObject->GetLogManager()->WriteToMail(LOG_SYSTEM, 1, "ʼ", ""); - - IBuffPacket* pBodyPacket = m_pServerObject->GetPacketManager()->Create(); - if(NULL == pBodyPacket) - { - OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pBodyPacket is NULL.\n")); - return -1; - } - - _PacketInfo BodyPacket; - pMessage->GetPacketBody(BodyPacket); - - //pBodyPacket->WriteStream(BodyPacket.m_pData, BodyPacket.m_nDataLen); - - - //Լ¼־ - //m_pServerObject->GetLogManager()->WriteLogBinary(LOG_SYSTEM, BodyPacket.m_pData, BodyPacket.m_nDataLen); - - IBuffPacket* pResponsesPacket = m_pServerObject->GetPacketManager()->Create(); - uint16 u2PostCommandID = COMMAND_BASE; - - //ԭ - (*pResponsesPacket) << (uint32)BodyPacket.m_nDataLen; - pResponsesPacket->WriteStream(BodyPacket.m_pData, BodyPacket.m_nDataLen); - - //(*pResponsesPacket) << u2PostCommandID; - //(*pResponsesPacket) << u8ClientTime; - - m_pServerObject->GetPacketManager()->Delete(pBodyPacket); - - if(NULL != m_pServerObject->GetConnectManager()) - { - //ȫ - m_pServerObject->GetConnectManager()->PostMessage(pMessage->GetMessageBase()->m_u4ConnectID, - pResponsesPacket, - SENDMESSAGE_JAMPNOMAL, - u2PostCommandID, - PACKET_SEND_IMMEDIATLY, - PACKET_IS_FRAMEWORK_RECYC); - } - else - { - OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage] m_pConnectManager = NULL")); - m_pServerObject->GetPacketManager()->Delete(pResponsesPacket); - } - - //m_pServerObject->GetConnectManager()->CloseConnect(pMessage->GetMessageBase()->m_u4ConnectID); - - return 0; -} - -void CBaseCommand::Init_XML() -{ - //ԽXML - char szText[200] = {'\0'}; - sprintf_safe(szText, 200, "freeeyes"); - - CXmlOpeation objXmlOpeation; - objXmlOpeation.Init_String(szText); - char* pName = objXmlOpeation.GetData_Text("Name"); - - if(NULL != pName) - { - OUR_DEBUG((LM_INFO, "pName=%s.\n", pName)); - } - else - { - OUR_DEBUG((LM_INFO, "pName is NULL.\n", pName)); - } -} \ No newline at end of file diff --git a/purenessscopeserver/example-Module/XMLParse/CMakeLists.txt b/purenessscopeserver/example-Module/XMLParse/CMakeLists.txt new file mode 100644 index 000000000..706bee6d0 --- /dev/null +++ b/purenessscopeserver/example-Module/XMLParse/CMakeLists.txt @@ -0,0 +1,92 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(XMLParse) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_XMLParse_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + . + ../../../purenessscopeserver/Common + ../../../ThirdLib/include/TinyXML + ../../../ThirdLib/include + +) + + +# Compiler options +add_definitions(-O2 -fPIC -Wall -fexceptions) + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/TinyXML/tinystr.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/TinyXML/tinyxml.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + ${CMAKE_CURRENT_LIST_DIR}/./XMLParse/XMLParse.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/XmlOpeation.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + ${CMAKE_CURRENT_LIST_DIR}/./XMLParse/BaseCommand.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(XMLParse SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(XMLParse ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/XMLParse/Makefile b/purenessscopeserver/example-Module/XMLParse/Makefile index 022f83849..205230022 100644 --- a/purenessscopeserver/example-Module/XMLParse/Makefile +++ b/purenessscopeserver/example-Module/XMLParse/Makefile @@ -1,28 +1,160 @@ -include Makefile.define +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=XMLParse +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/XMLParse +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="XMLParse.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)../../../ThirdLib/include/TinyXML $(IncludeSwitch)../../../ThirdLib/include +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release -# Ĭϳ -default:all +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as -# Ӧļб -PATS = ./TinyXML/tinystr.o ./TinyXML/tinyxml.o ./TinyXML/tinyxmlerror.o ./TinyXML/tinyxmlparser.o \ - BaseCommand.o XmlOpeation.o XMLParse.o -LIB_BASE_OBJS = tinystr.o tinyxml.o tinyxmlerror.o tinyxmlparser.o \ - BaseCommand.o XmlOpeation.o XMLParse.o -LIB_BASE = libXMLParse.so +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/XMLParse_XMLParse.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(ObjectSuffix) -all: libXMLParse.so clear - -# Ӧó -all:$(LIB_BASE) Makefile -$(LIB_BASE):$(PATS) - $(CC) -shared -o $(LIB_BASE) $(LIB_BASE_OBJS) $(LIBS) -# +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/XMLParse" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(ObjectSuffix): ./XMLParse/XMLParse.cpp $(IntermediateDirectory)/XMLParse_XMLParse.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./XMLParse/XMLParse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(DependSuffix): ./XMLParse/XMLParse.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(DependSuffix) -MM ./XMLParse/XMLParse.cpp + +$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(PreprocessSuffix): ./XMLParse/XMLParse.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/XMLParse_XMLParse.cpp$(PreprocessSuffix) ./XMLParse/XMLParse.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix): ../../../ThirdLib/include/XmlOpeation.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix): ../../../ThirdLib/include/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) -MM ../../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix): ../../../ThirdLib/include/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix) ../../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(ObjectSuffix): ./XMLParse/BaseCommand.cpp $(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./XMLParse/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(DependSuffix): ./XMLParse/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(DependSuffix) -MM ./XMLParse/BaseCommand.cpp + +$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(PreprocessSuffix): ./XMLParse/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(PreprocessSuffix) ./XMLParse/BaseCommand.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## clean: - rm -rf *.o $(LIB_BASE) $(LIB_BASE_OBJS) -clear: - mv libXMLParse.so ../../PurenessScopeServer/Linux_Bin/ -cl: - rm -rf *.o + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/XMLParse/Makefile.define b/purenessscopeserver/example-Module/XMLParse/Makefile.define deleted file mode 100644 index 6c9bdd478..000000000 --- a/purenessscopeserver/example-Module/XMLParse/Makefile.define +++ /dev/null @@ -1,22 +0,0 @@ -# ***************************** -# Ԥ -# ***************************** -CC = g++ -AR = ar -CFLAGS = -g -O2 -D__LINUX__ -INCLUDES = -I./ -I../ -I/usr/include -I${ACE_ROOT} -I../include -I ./TinyXML -LIBS = -L/usr/lib64 -L${ACE_ROOT}/lib -L/usr/local/lib64 -L./ -L../ -lACE -lz -ldl -# ***************************** -# 任 -# ***************************** -# Here are some rules for converting .cpp -> .o -.SUFFIXES: .cpp .o -.cpp.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c $*.cpp - @echo '----- '$*.cpp' is compiled ok!' - -# Here are some rules for converting .c -> .o -.SUFFIXES: .c .o -.c.o: - @$(CC) -fPIC $(CFLAGS) ${INCLUDES} -c $*.c - @echo '----- '$*.c' is compiled ok!' \ No newline at end of file diff --git a/purenessscopeserver/example-Module/XMLParse/TinyXML/tinystr.cpp b/purenessscopeserver/example-Module/XMLParse/TinyXML/tinystr.cpp deleted file mode 100644 index 066576820..000000000 --- a/purenessscopeserver/example-Module/XMLParse/TinyXML/tinystr.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TIXML_USE_STL - -#include "tinystr.h" - -// Error value for find primitive -const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1); - - -// Null rep. -TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } }; - - -void TiXmlString::reserve (size_type cap) -{ - if (cap > capacity()) - { - TiXmlString tmp; - tmp.init(length(), cap); - memcpy(tmp.start(), data(), length()); - swap(tmp); - } -} - - -TiXmlString& TiXmlString::assign(const char* str, size_type len) -{ - size_type cap = capacity(); - if (len > cap || cap > 3*(len + 8)) - { - TiXmlString tmp; - tmp.init(len); - memcpy(tmp.start(), str, len); - swap(tmp); - } - else - { - memmove(start(), str, len); - set_size(len); - } - return *this; -} - - -TiXmlString& TiXmlString::append(const char* str, size_type len) -{ - size_type newsize = length() + len; - if (newsize > capacity()) - { - reserve (newsize + capacity()); - } - memmove(finish(), str, len); - set_size(newsize); - return *this; -} - - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b) -{ - TiXmlString tmp; - tmp.reserve(a.length() + b.length()); - tmp += a; - tmp += b; - return tmp; -} - -TiXmlString operator + (const TiXmlString & a, const char* b) -{ - TiXmlString tmp; - TiXmlString::size_type b_len = static_cast( strlen(b) ); - tmp.reserve(a.length() + b_len); - tmp += a; - tmp.append(b, b_len); - return tmp; -} - -TiXmlString operator + (const char* a, const TiXmlString & b) -{ - TiXmlString tmp; - TiXmlString::size_type a_len = static_cast( strlen(a) ); - tmp.reserve(a_len + b.length()); - tmp.append(a, a_len); - tmp += b; - return tmp; -} - - -#endif // TIXML_USE_STL diff --git a/purenessscopeserver/example-Module/XMLParse/TinyXML/tinystr.h b/purenessscopeserver/example-Module/XMLParse/TinyXML/tinystr.h deleted file mode 100644 index 89cca3341..000000000 --- a/purenessscopeserver/example-Module/XMLParse/TinyXML/tinystr.h +++ /dev/null @@ -1,305 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TIXML_USE_STL - -#ifndef TIXML_STRING_INCLUDED -#define TIXML_STRING_INCLUDED - -#include -#include - -/* The support for explicit isn't that universal, and it isn't really - required - it is used to check that the TiXmlString class isn't incorrectly - used. Be nice to old compilers and macro it here: -*/ -#if defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - #define TIXML_EXPLICIT explicit -#elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - #define TIXML_EXPLICIT explicit -#else - #define TIXML_EXPLICIT -#endif - - -/* - TiXmlString is an emulation of a subset of the std::string template. - Its purpose is to allow compiling TinyXML on compilers with no or poor STL support. - Only the member functions relevant to the TinyXML project have been implemented. - The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase - a string and there's no more room, we allocate a buffer twice as big as we need. -*/ -class TiXmlString -{ - public : - // The size type used - typedef size_t size_type; - - // Error value for find primitive - static const size_type npos; // = -1; - - - // TiXmlString empty constructor - TiXmlString () : rep_(&nullrep_) - { - } - - // TiXmlString copy constructor - TiXmlString ( const TiXmlString & copy) : rep_(0) - { - init(copy.length()); - memcpy(start(), copy.data(), length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0) - { - init( static_cast( strlen(copy) )); - memcpy(start(), copy, length()); - } - - // TiXmlString constructor, based on a string - TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0) - { - init(len); - memcpy(start(), str, len); - } - - // TiXmlString destructor - ~TiXmlString () - { - quit(); - } - - TiXmlString& operator = (const char * copy) - { - return assign( copy, (size_type)strlen(copy)); - } - - TiXmlString& operator = (const TiXmlString & copy) - { - return assign(copy.start(), copy.length()); - } - - - // += operator. Maps to append - TiXmlString& operator += (const char * suffix) - { - return append(suffix, static_cast( strlen(suffix) )); - } - - // += operator. Maps to append - TiXmlString& operator += (char single) - { - return append(&single, 1); - } - - // += operator. Maps to append - TiXmlString& operator += (const TiXmlString & suffix) - { - return append(suffix.data(), suffix.length()); - } - - - // Convert a TiXmlString into a null-terminated char * - const char * c_str () const { return rep_->str; } - - // Convert a TiXmlString into a char * (need not be null terminated). - const char * data () const { return rep_->str; } - - // Return the length of a TiXmlString - size_type length () const { return rep_->size; } - - // Alias for length() - size_type size () const { return rep_->size; } - - // Checks if a TiXmlString is empty - bool empty () const { return rep_->size == 0; } - - // Return capacity of string - size_type capacity () const { return rep_->capacity; } - - - // single char extraction - const char& at (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // [] operator - char& operator [] (size_type index) const - { - assert( index < length() ); - return rep_->str[ index ]; - } - - // find a char in a string. Return TiXmlString::npos if not found - size_type find (char lookup) const - { - return find(lookup, 0); - } - - // find a char in a string from an offset. Return TiXmlString::npos if not found - size_type find (char tofind, size_type offset) const - { - if (offset >= length()) return npos; - - for (const char* p = c_str() + offset; *p != '\0'; ++p) - { - if (*p == tofind) return static_cast< size_type >( p - c_str() ); - } - return npos; - } - - void clear () - { - //Lee: - //The original was just too strange, though correct: - // TiXmlString().swap(*this); - //Instead use the quit & re-init: - quit(); - init(0,0); - } - - /* Function to reserve a big amount of data when we know we'll need it. Be aware that this - function DOES NOT clear the content of the TiXmlString if any exists. - */ - void reserve (size_type cap); - - TiXmlString& assign (const char* str, size_type len); - - TiXmlString& append (const char* str, size_type len); - - void swap (TiXmlString& other) - { - Rep* r = rep_; - rep_ = other.rep_; - other.rep_ = r; - } - - private: - - void init(size_type sz) { init(sz, sz); } - void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; } - char* start() const { return rep_->str; } - char* finish() const { return rep_->str + rep_->size; } - - struct Rep - { - size_type size, capacity; - char str[1]; - }; - - void init(size_type sz, size_type cap) - { - if (cap) - { - // Lee: the original form: - // rep_ = static_cast(operator new(sizeof(Rep) + cap)); - // doesn't work in some cases of new being overloaded. Switching - // to the normal allocation, although use an 'int' for systems - // that are overly picky about structure alignment. - const size_type bytesNeeded = sizeof(Rep) + cap; - const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); - rep_ = reinterpret_cast( new int[ intsNeeded ] ); - - rep_->str[ rep_->size = sz ] = '\0'; - rep_->capacity = cap; - } - else - { - rep_ = &nullrep_; - } - } - - void quit() - { - if (rep_ != &nullrep_) - { - // The rep_ is really an array of ints. (see the allocator, above). - // Cast it back before delete, so the compiler won't incorrectly call destructors. - delete [] ( reinterpret_cast( rep_ ) ); - } - } - - Rep * rep_; - static Rep nullrep_; - -} ; - - -inline bool operator == (const TiXmlString & a, const TiXmlString & b) -{ - return ( a.length() == b.length() ) // optimization on some platforms - && ( strcmp(a.c_str(), b.c_str()) == 0 ); // actual compare -} -inline bool operator < (const TiXmlString & a, const TiXmlString & b) -{ - return strcmp(a.c_str(), b.c_str()) < 0; -} - -inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); } -inline bool operator > (const TiXmlString & a, const TiXmlString & b) { return b < a; } -inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); } -inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); } - -inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; } -inline bool operator == (const char* a, const TiXmlString & b) { return b == a; } -inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); } -inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); } - -TiXmlString operator + (const TiXmlString & a, const TiXmlString & b); -TiXmlString operator + (const TiXmlString & a, const char* b); -TiXmlString operator + (const char* a, const TiXmlString & b); - - -/* - TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString. - Only the operators that we need for TinyXML have been developped. -*/ -class TiXmlOutStream : public TiXmlString -{ -public : - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const TiXmlString & in) - { - *this += in; - return *this; - } - - // TiXmlOutStream << operator. - TiXmlOutStream & operator << (const char * in) - { - *this += in; - return *this; - } - -} ; - -#endif // TIXML_STRING_INCLUDED -#endif // TIXML_USE_STL diff --git a/purenessscopeserver/example-Module/XMLParse/TinyXML/tinyxml.cpp b/purenessscopeserver/example-Module/XMLParse/TinyXML/tinyxml.cpp deleted file mode 100644 index 9c161dfcb..000000000 --- a/purenessscopeserver/example-Module/XMLParse/TinyXML/tinyxml.cpp +++ /dev/null @@ -1,1886 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#include - -#ifdef TIXML_USE_STL -#include -#include -#endif - -#include "tinyxml.h" - -FILE* TiXmlFOpen( const char* filename, const char* mode ); - -bool TiXmlBase::condenseWhiteSpace = true; - -// Microsoft compiler security -FILE* TiXmlFOpen( const char* filename, const char* mode ) -{ - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - FILE* fp = 0; - errno_t err = fopen_s( &fp, filename, mode ); - if ( !err && fp ) - return fp; - return 0; - #else - return fopen( filename, mode ); - #endif -} - -void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString ) -{ - int i=0; - - while( i<(int)str.length() ) - { - unsigned char c = (unsigned char) str[i]; - - if ( c == '&' - && i < ( (int)str.length() - 2 ) - && str[i+1] == '#' - && str[i+2] == 'x' ) - { - // Hexadecimal character reference. - // Pass through unchanged. - // © -- copyright symbol, for example. - // - // The -1 is a bug fix from Rob Laveaux. It keeps - // an overflow from happening if there is no ';'. - // There are actually 2 ways to exit this loop - - // while fails (error case) and break (semicolon found). - // However, there is no mechanism (currently) for - // this function to return an error. - while ( i<(int)str.length()-1 ) - { - outString->append( str.c_str() + i, 1 ); - ++i; - if ( str[i] == ';' ) - break; - } - } - else if ( c == '&' ) - { - outString->append( entity[0].str, entity[0].strLength ); - ++i; - } - else if ( c == '<' ) - { - outString->append( entity[1].str, entity[1].strLength ); - ++i; - } - else if ( c == '>' ) - { - outString->append( entity[2].str, entity[2].strLength ); - ++i; - } - else if ( c == '\"' ) - { - outString->append( entity[3].str, entity[3].strLength ); - ++i; - } - else if ( c == '\'' ) - { - outString->append( entity[4].str, entity[4].strLength ); - ++i; - } - else if ( c < 32 ) - { - // Easy pass at non-alpha/numeric/symbol - // Below 32 is symbolic. - char buf[ 32 ]; - - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) ); - #else - sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) ); - #endif - - //*ME: warning C4267: convert 'size_t' to 'int' - //*ME: Int-Cast to make compiler happy ... - outString->append( buf, (int)strlen( buf ) ); - ++i; - } - else - { - //char realc = (char) c; - //outString->append( &realc, 1 ); - *outString += (char) c; // somewhat more efficient function call. - ++i; - } - } -} - - -TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase() -{ - parent = 0; - type = _type; - firstChild = 0; - lastChild = 0; - prev = 0; - next = 0; -} - - -TiXmlNode::~TiXmlNode() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } -} - - -void TiXmlNode::CopyTo( TiXmlNode* target ) const -{ - target->SetValue (value.c_str() ); - target->userData = userData; - target->location = location; -} - - -void TiXmlNode::Clear() -{ - TiXmlNode* node = firstChild; - TiXmlNode* temp = 0; - - while ( node ) - { - temp = node; - node = node->next; - delete temp; - } - - firstChild = 0; - lastChild = 0; -} - - -TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node ) -{ - assert( node->parent == 0 || node->parent == this ); - assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() ); - - if ( node->Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - delete node; - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - node->parent = this; - - node->prev = lastChild; - node->next = 0; - - if ( lastChild ) - lastChild->next = node; - else - firstChild = node; // it was an empty list. - - lastChild = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis ) -{ - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - - return LinkEndChild( node ); -} - - -TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ) -{ - if ( !beforeThis || beforeThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->next = beforeThis; - node->prev = beforeThis->prev; - if ( beforeThis->prev ) - { - beforeThis->prev->next = node; - } - else - { - assert( firstChild == beforeThis ); - firstChild = node; - } - beforeThis->prev = node; - return node; -} - - -TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ) -{ - if ( !afterThis || afterThis->parent != this ) { - return 0; - } - if ( addThis.Type() == TiXmlNode::TINYXML_DOCUMENT ) - { - if ( GetDocument() ) - GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = addThis.Clone(); - if ( !node ) - return 0; - node->parent = this; - - node->prev = afterThis; - node->next = afterThis->next; - if ( afterThis->next ) - { - afterThis->next->prev = node; - } - else - { - assert( lastChild == afterThis ); - lastChild = node; - } - afterThis->next = node; - return node; -} - - -TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ) -{ - if ( !replaceThis ) - return 0; - - if ( replaceThis->parent != this ) - return 0; - - if ( withThis.ToDocument() ) { - // A document can never be a child. Thanks to Noam. - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - TiXmlNode* node = withThis.Clone(); - if ( !node ) - return 0; - - node->next = replaceThis->next; - node->prev = replaceThis->prev; - - if ( replaceThis->next ) - replaceThis->next->prev = node; - else - lastChild = node; - - if ( replaceThis->prev ) - replaceThis->prev->next = node; - else - firstChild = node; - - delete replaceThis; - node->parent = this; - return node; -} - - -bool TiXmlNode::RemoveChild( TiXmlNode* removeThis ) -{ - if ( !removeThis ) { - return false; - } - - if ( removeThis->parent != this ) - { - assert( 0 ); - return false; - } - - if ( removeThis->next ) - removeThis->next->prev = removeThis->prev; - else - lastChild = removeThis->prev; - - if ( removeThis->prev ) - removeThis->prev->next = removeThis->next; - else - firstChild = removeThis->next; - - delete removeThis; - return true; -} - -const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = firstChild; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = lastChild; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild(); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling(); - } -} - - -const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const -{ - if ( !previous ) - { - return FirstChild( val ); - } - else - { - assert( previous->parent == this ); - return previous->NextSibling( val ); - } -} - - -const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = next; node; node = node->next ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const -{ - const TiXmlNode* node; - for ( node = prev; node; node = node->prev ) - { - if ( strcmp( node->Value(), _value ) == 0 ) - return node; - } - return 0; -} - - -void TiXmlElement::RemoveAttribute( const char * name ) -{ - #ifdef TIXML_USE_STL - TIXML_STRING str( name ); - TiXmlAttribute* node = attributeSet.Find( str ); - #else - TiXmlAttribute* node = attributeSet.Find( name ); - #endif - if ( node ) - { - attributeSet.Remove( node ); - delete node; - } -} - -const TiXmlElement* TiXmlNode::FirstChildElement() const -{ - const TiXmlNode* node; - - for ( node = FirstChild(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = FirstChild( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement() const -{ - const TiXmlNode* node; - - for ( node = NextSibling(); - node; - node = node->NextSibling() ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const -{ - const TiXmlNode* node; - - for ( node = NextSibling( _value ); - node; - node = node->NextSibling( _value ) ) - { - if ( node->ToElement() ) - return node->ToElement(); - } - return 0; -} - - -const TiXmlDocument* TiXmlNode::GetDocument() const -{ - const TiXmlNode* node; - - for( node = this; node; node = node->parent ) - { - if ( node->ToDocument() ) - return node->ToDocument(); - } - return 0; -} - - -TiXmlElement::TiXmlElement (const char * _value) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} - - -#ifdef TIXML_USE_STL -TiXmlElement::TiXmlElement( const std::string& _value ) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - value = _value; -} -#endif - - -TiXmlElement::TiXmlElement( const TiXmlElement& copy) - : TiXmlNode( TiXmlNode::TINYXML_ELEMENT ) -{ - firstChild = lastChild = 0; - copy.CopyTo( this ); -} - - -TiXmlElement& TiXmlElement::operator=( const TiXmlElement& base ) -{ - ClearThis(); - base.CopyTo( this ); - return *this; -} - - -TiXmlElement::~TiXmlElement() -{ - ClearThis(); -} - - -void TiXmlElement::ClearThis() -{ - Clear(); - while( attributeSet.First() ) - { - TiXmlAttribute* node = attributeSet.First(); - attributeSet.Remove( node ); - delete node; - } -} - - -const char* TiXmlElement::Attribute( const char* name ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( node ) - return node->Value(); - return 0; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( attrib ) - return &attrib->ValueStr(); - return 0; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) { - result = attrib->Value(); - if ( i ) { - attrib->QueryIntValue( i ); - } - } - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) { - result = &attrib->ValueStr(); - if ( i ) { - attrib->QueryIntValue( i ); - } - } - return result; -} -#endif - - -const char* TiXmlElement::Attribute( const char* name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const char* result = 0; - - if ( attrib ) { - result = attrib->Value(); - if ( d ) { - attrib->QueryDoubleValue( d ); - } - } - return result; -} - - -#ifdef TIXML_USE_STL -const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - const std::string* result = 0; - - if ( attrib ) { - result = &attrib->ValueStr(); - if ( d ) { - attrib->QueryDoubleValue( d ); - } - } - return result; -} -#endif - - -int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryIntValue( ival ); -} - - -int TiXmlElement::QueryUnsignedAttribute( const char* name, unsigned* value ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - int ival = 0; - int result = node->QueryIntValue( &ival ); - *value = (unsigned)ival; - return result; -} - - -int TiXmlElement::QueryBoolAttribute( const char* name, bool* bval ) const -{ - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - int result = TIXML_WRONG_TYPE; - if ( StringEqual( node->Value(), "true", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "yes", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "1", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = true; - result = TIXML_SUCCESS; - } - else if ( StringEqual( node->Value(), "false", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "no", true, TIXML_ENCODING_UNKNOWN ) - || StringEqual( node->Value(), "0", true, TIXML_ENCODING_UNKNOWN ) ) - { - *bval = false; - result = TIXML_SUCCESS; - } - return result; -} - - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryIntValue( ival ); -} -#endif - - -int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryDoubleValue( dval ); -} - - -#ifdef TIXML_USE_STL -int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const -{ - const TiXmlAttribute* attrib = attributeSet.Find( name ); - if ( !attrib ) - return TIXML_NO_ATTRIBUTE; - return attrib->QueryDoubleValue( dval ); -} -#endif - - -void TiXmlElement::SetAttribute( const char * name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetIntValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& name, int val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetIntValue( val ); - } -} -#endif - - -void TiXmlElement::SetDoubleAttribute( const char * name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetDoubleValue( val ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetDoubleAttribute( const std::string& name, double val ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( name ); - if ( attrib ) { - attrib->SetDoubleValue( val ); - } -} -#endif - - -void TiXmlElement::SetAttribute( const char * cname, const char * cvalue ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( cname ); - if ( attrib ) { - attrib->SetValue( cvalue ); - } -} - - -#ifdef TIXML_USE_STL -void TiXmlElement::SetAttribute( const std::string& _name, const std::string& _value ) -{ - TiXmlAttribute* attrib = attributeSet.FindOrCreate( _name ); - if ( attrib ) { - attrib->SetValue( _value ); - } -} -#endif - - -void TiXmlElement::Print( FILE* cfile, int depth ) const -{ - int i; - assert( cfile ); - for ( i=0; iNext() ) - { - fprintf( cfile, " " ); - attrib->Print( cfile, depth ); - } - - // There are 3 different formatting approaches: - // 1) An element without children is printed as a node - // 2) An element with only a text child is printed as text - // 3) An element with children is printed on multiple lines. - TiXmlNode* node; - if ( !firstChild ) - { - fprintf( cfile, " />" ); - } - else if ( firstChild == lastChild && firstChild->ToText() ) - { - fprintf( cfile, ">" ); - firstChild->Print( cfile, depth + 1 ); - fprintf( cfile, "", value.c_str() ); - } - else - { - fprintf( cfile, ">" ); - - for ( node = firstChild; node; node=node->NextSibling() ) - { - if ( !node->ToText() ) - { - fprintf( cfile, "\n" ); - } - node->Print( cfile, depth+1 ); - } - fprintf( cfile, "\n" ); - for( i=0; i", value.c_str() ); - } -} - - -void TiXmlElement::CopyTo( TiXmlElement* target ) const -{ - // superclass: - TiXmlNode::CopyTo( target ); - - // Element class: - // Clone the attributes, then clone the children. - const TiXmlAttribute* attribute = 0; - for( attribute = attributeSet.First(); - attribute; - attribute = attribute->Next() ) - { - target->SetAttribute( attribute->Name(), attribute->Value() ); - } - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - -bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this, attributeSet.First() ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -TiXmlNode* TiXmlElement::Clone() const -{ - TiXmlElement* clone = new TiXmlElement( Value() ); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -const char* TiXmlElement::GetText() const -{ - const TiXmlNode* child = this->FirstChild(); - if ( child ) { - const TiXmlText* childText = child->ToText(); - if ( childText ) { - return childText->Value(); - } - } - return 0; -} - - -TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - ClearError(); -} - -TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} - - -#ifdef TIXML_USE_STL -TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - tabsize = 4; - useMicrosoftBOM = false; - value = documentName; - ClearError(); -} -#endif - - -TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::TINYXML_DOCUMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlDocument& TiXmlDocument::operator=( const TiXmlDocument& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -bool TiXmlDocument::LoadFile( TiXmlEncoding encoding ) -{ - return LoadFile( Value(), encoding ); -} - - -bool TiXmlDocument::SaveFile() const -{ - return SaveFile( Value() ); -} - -bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding ) -{ - TIXML_STRING filename( _filename ); - value = filename; - - // reading in binary mode so that tinyxml can normalize the EOL - FILE* file = TiXmlFOpen( value.c_str (), "rb" ); - - if ( file ) - { - bool result = LoadFile( file, encoding ); - fclose( file ); - return result; - } - else - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } -} - -bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding ) -{ - if ( !file ) - { - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Delete the existing data: - Clear(); - location.Clear(); - - // Get the file size, so we can pre-allocate the string. HUGE speed impact. - long length = 0; - fseek( file, 0, SEEK_END ); - length = ftell( file ); - fseek( file, 0, SEEK_SET ); - - // Strange case, but good to handle up front. - if ( length <= 0 ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Subtle bug here. TinyXml did use fgets. But from the XML spec: - // 2.11 End-of-Line Handling - // - // - // ...the XML processor MUST behave as if it normalized all line breaks in external - // parsed entities (including the document entity) on input, before parsing, by translating - // both the two-character sequence #xD #xA and any #xD that is not followed by #xA to - // a single #xA character. - // - // - // It is not clear fgets does that, and certainly isn't clear it works cross platform. - // Generally, you expect fgets to translate from the convention of the OS to the c/unix - // convention, and not work generally. - - /* - while( fgets( buf, sizeof(buf), file ) ) - { - data += buf; - } - */ - - char* buf = new char[ length+1 ]; - buf[0] = 0; - - if ( fread( buf, length, 1, file ) != 1 ) { - delete [] buf; - SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN ); - return false; - } - - // Process the buffer in place to normalize new lines. (See comment above.) - // Copies from the 'p' to 'q' pointer, where p can advance faster if - // a newline-carriage return is hit. - // - // Wikipedia: - // Systems based on ASCII or a compatible character set use either LF (Line feed, '\n', 0x0A, 10 in decimal) or - // CR (Carriage return, '\r', 0x0D, 13 in decimal) individually, or CR followed by LF (CR+LF, 0x0D 0x0A)... - // * LF: Multics, Unix and Unix-like systems (GNU/Linux, AIX, Xenix, Mac OS X, FreeBSD, etc.), BeOS, Amiga, RISC OS, and others - // * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M, MP/M, DOS, OS/2, Microsoft Windows, Symbian OS - // * CR: Commodore 8-bit machines, Apple II family, Mac OS up to version 9 and OS-9 - - const char* p = buf; // the read head - char* q = buf; // the write head - const char CR = 0x0d; - const char LF = 0x0a; - - buf[length] = 0; - while( *p ) { - assert( p < (buf+length) ); - assert( q <= (buf+length) ); - assert( q <= p ); - - if ( *p == CR ) { - *q++ = LF; - p++; - if ( *p == LF ) { // check for CR+LF (and skip LF) - p++; - } - } - else { - *q++ = *p++; - } - } - assert( q <= (buf+length) ); - *q = 0; - - Parse( buf, 0, encoding ); - - delete [] buf; - return !Error(); -} - - -bool TiXmlDocument::SaveFile( const char * filename ) const -{ - // The old c stuff lives on... - FILE* fp = TiXmlFOpen( filename, "w" ); - if ( fp ) - { - bool result = SaveFile( fp ); - fclose( fp ); - return result; - } - return false; -} - - -bool TiXmlDocument::SaveFile( FILE* fp ) const -{ - if ( useMicrosoftBOM ) - { - const unsigned char TIXML_UTF_LEAD_0 = 0xefU; - const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; - const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - - fputc( TIXML_UTF_LEAD_0, fp ); - fputc( TIXML_UTF_LEAD_1, fp ); - fputc( TIXML_UTF_LEAD_2, fp ); - } - Print( fp, 0 ); - return (ferror(fp) == 0); -} - - -void TiXmlDocument::CopyTo( TiXmlDocument* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->error = error; - target->errorId = errorId; - target->errorDesc = errorDesc; - target->tabsize = tabsize; - target->errorLocation = errorLocation; - target->useMicrosoftBOM = useMicrosoftBOM; - - TiXmlNode* node = 0; - for ( node = firstChild; node; node = node->NextSibling() ) - { - target->LinkEndChild( node->Clone() ); - } -} - - -TiXmlNode* TiXmlDocument::Clone() const -{ - TiXmlDocument* clone = new TiXmlDocument(); - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlDocument::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - node->Print( cfile, depth ); - fprintf( cfile, "\n" ); - } -} - - -bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const -{ - if ( visitor->VisitEnter( *this ) ) - { - for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() ) - { - if ( !node->Accept( visitor ) ) - break; - } - } - return visitor->VisitExit( *this ); -} - - -const TiXmlAttribute* TiXmlAttribute::Next() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} - -/* -TiXmlAttribute* TiXmlAttribute::Next() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( next->value.empty() && next->name.empty() ) - return 0; - return next; -} -*/ - -const TiXmlAttribute* TiXmlAttribute::Previous() const -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} - -/* -TiXmlAttribute* TiXmlAttribute::Previous() -{ - // We are using knowledge of the sentinel. The sentinel - // have a value or name. - if ( prev->value.empty() && prev->name.empty() ) - return 0; - return prev; -} -*/ - -void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - TIXML_STRING n, v; - - EncodeString( name, &n ); - EncodeString( value, &v ); - - if (value.find ('\"') == TIXML_STRING::npos) { - if ( cfile ) { - fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\""; - } - } - else { - if ( cfile ) { - fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() ); - } - if ( str ) { - (*str) += n; (*str) += "='"; (*str) += v; (*str) += "'"; - } - } -} - - -int TiXmlAttribute::QueryIntValue( int* ival ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -int TiXmlAttribute::QueryDoubleValue( double* dval ) const -{ - if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; -} - -void TiXmlAttribute::SetIntValue( int _value ) -{ - char buf [64]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value); - #else - sprintf (buf, "%d", _value); - #endif - SetValue (buf); -} - -void TiXmlAttribute::SetDoubleValue( double _value ) -{ - char buf [256]; - #if defined(TIXML_SNPRINTF) - TIXML_SNPRINTF( buf, sizeof(buf), "%g", _value); - #else - sprintf (buf, "%g", _value); - #endif - SetValue (buf); -} - -int TiXmlAttribute::IntValue() const -{ - return atoi (value.c_str ()); -} - -double TiXmlAttribute::DoubleValue() const -{ - return atof (value.c_str ()); -} - - -TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) -{ - copy.CopyTo( this ); -} - - -TiXmlComment& TiXmlComment::operator=( const TiXmlComment& base ) -{ - Clear(); - base.CopyTo( this ); - return *this; -} - - -void TiXmlComment::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlComment::CopyTo( TiXmlComment* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlComment::Clone() const -{ - TiXmlComment* clone = new TiXmlComment(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlText::Print( FILE* cfile, int depth ) const -{ - assert( cfile ); - if ( cdata ) - { - int i; - fprintf( cfile, "\n" ); - for ( i=0; i\n", value.c_str() ); // unformatted output - } - else - { - TIXML_STRING buffer; - EncodeString( value, &buffer ); - fprintf( cfile, "%s", buffer.c_str() ); - } -} - - -void TiXmlText::CopyTo( TiXmlText* target ) const -{ - TiXmlNode::CopyTo( target ); - target->cdata = cdata; -} - - -bool TiXmlText::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlText::Clone() const -{ - TiXmlText* clone = 0; - clone = new TiXmlText( "" ); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlDeclaration::TiXmlDeclaration( const char * _version, - const char * _encoding, - const char * _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} - - -#ifdef TIXML_USE_STL -TiXmlDeclaration::TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - version = _version; - encoding = _encoding; - standalone = _standalone; -} -#endif - - -TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy ) - : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) -{ - copy.CopyTo( this ); -} - - -TiXmlDeclaration& TiXmlDeclaration::operator=( const TiXmlDeclaration& copy ) -{ - Clear(); - copy.CopyTo( this ); - return *this; -} - - -void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const -{ - if ( cfile ) fprintf( cfile, "" ); - if ( str ) (*str) += "?>"; -} - - -void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const -{ - TiXmlNode::CopyTo( target ); - - target->version = version; - target->encoding = encoding; - target->standalone = standalone; -} - - -bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlDeclaration::Clone() const -{ - TiXmlDeclaration* clone = new TiXmlDeclaration(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -void TiXmlUnknown::Print( FILE* cfile, int depth ) const -{ - for ( int i=0; i", value.c_str() ); -} - - -void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const -{ - TiXmlNode::CopyTo( target ); -} - - -bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const -{ - return visitor->Visit( *this ); -} - - -TiXmlNode* TiXmlUnknown::Clone() const -{ - TiXmlUnknown* clone = new TiXmlUnknown(); - - if ( !clone ) - return 0; - - CopyTo( clone ); - return clone; -} - - -TiXmlAttributeSet::TiXmlAttributeSet() -{ - sentinel.next = &sentinel; - sentinel.prev = &sentinel; -} - - -TiXmlAttributeSet::~TiXmlAttributeSet() -{ - assert( sentinel.next == &sentinel ); - assert( sentinel.prev == &sentinel ); -} - - -void TiXmlAttributeSet::Add( TiXmlAttribute* addMe ) -{ - #ifdef TIXML_USE_STL - assert( !Find( TIXML_STRING( addMe->Name() ) ) ); // Shouldn't be multiply adding to the set. - #else - assert( !Find( addMe->Name() ) ); // Shouldn't be multiply adding to the set. - #endif - - addMe->next = &sentinel; - addMe->prev = sentinel.prev; - - sentinel.prev->next = addMe; - sentinel.prev = addMe; -} - -void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe ) -{ - TiXmlAttribute* node; - - for( node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node == removeMe ) - { - node->prev->next = node->next; - node->next->prev = node->prev; - node->next = 0; - node->prev = 0; - return; - } - } - assert( 0 ); // we tried to remove a non-linked attribute. -} - - -#ifdef TIXML_USE_STL -TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( node->name == name ) - return node; - } - return 0; -} - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const std::string& _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - if ( !attrib ) { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - return attrib; -} -#endif - - -TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const -{ - for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next ) - { - if ( strcmp( node->name.c_str(), name ) == 0 ) - return node; - } - return 0; -} - - -TiXmlAttribute* TiXmlAttributeSet::FindOrCreate( const char* _name ) -{ - TiXmlAttribute* attrib = Find( _name ); - if ( !attrib ) { - attrib = new TiXmlAttribute(); - Add( attrib ); - attrib->SetName( _name ); - } - return attrib; -} - - -#ifdef TIXML_USE_STL -std::istream& operator>> (std::istream & in, TiXmlNode & base) -{ - TIXML_STRING tag; - tag.reserve( 8 * 1000 ); - base.StreamIn( &in, &tag ); - - base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING ); - return in; -} -#endif - - -#ifdef TIXML_USE_STL -std::ostream& operator<< (std::ostream & out, const TiXmlNode & base) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out << printer.Str(); - - return out; -} - - -std::string& operator<< (std::string& out, const TiXmlNode& base ) -{ - TiXmlPrinter printer; - printer.SetStreamPrinting(); - base.Accept( &printer ); - out.append( printer.Str() ); - - return out; -} -#endif - - -TiXmlHandle TiXmlHandle::FirstChild() const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const -{ - if ( node ) - { - TiXmlNode* child = node->FirstChild( value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement() const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement(); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const -{ - if ( node ) - { - TiXmlElement* child = node->FirstChildElement( value ); - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild(); - for ( i=0; - child && iNextSibling(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlNode* child = node->FirstChild( value ); - for ( i=0; - child && iNextSibling( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement(); - for ( i=0; - child && iNextSiblingElement(), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const -{ - if ( node ) - { - int i; - TiXmlElement* child = node->FirstChildElement( value ); - for ( i=0; - child && iNextSiblingElement( value ), ++i ) - { - // nothing - } - if ( child ) - return TiXmlHandle( child ); - } - return TiXmlHandle( 0 ); -} - - -bool TiXmlPrinter::VisitEnter( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitExit( const TiXmlDocument& ) -{ - return true; -} - -bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ) -{ - DoIndent(); - buffer += "<"; - buffer += element.Value(); - - for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() ) - { - buffer += " "; - attrib->Print( 0, 0, &buffer ); - } - - if ( !element.FirstChild() ) - { - buffer += " />"; - DoLineBreak(); - } - else - { - buffer += ">"; - if ( element.FirstChild()->ToText() - && element.LastChild() == element.FirstChild() - && element.FirstChild()->ToText()->CDATA() == false ) - { - simpleTextPrint = true; - // no DoLineBreak()! - } - else - { - DoLineBreak(); - } - } - ++depth; - return true; -} - - -bool TiXmlPrinter::VisitExit( const TiXmlElement& element ) -{ - --depth; - if ( !element.FirstChild() ) - { - // nothing. - } - else - { - if ( simpleTextPrint ) - { - simpleTextPrint = false; - } - else - { - DoIndent(); - } - buffer += ""; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlText& text ) -{ - if ( text.CDATA() ) - { - DoIndent(); - buffer += ""; - DoLineBreak(); - } - else if ( simpleTextPrint ) - { - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - } - else - { - DoIndent(); - TIXML_STRING str; - TiXmlBase::EncodeString( text.ValueTStr(), &str ); - buffer += str; - DoLineBreak(); - } - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration ) -{ - DoIndent(); - declaration.Print( 0, 0, &buffer ); - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlComment& comment ) -{ - DoIndent(); - buffer += ""; - DoLineBreak(); - return true; -} - - -bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown ) -{ - DoIndent(); - buffer += "<"; - buffer += unknown.Value(); - buffer += ">"; - DoLineBreak(); - return true; -} - diff --git a/purenessscopeserver/example-Module/XMLParse/TinyXML/tinyxml.h b/purenessscopeserver/example-Module/XMLParse/TinyXML/tinyxml.h deleted file mode 100644 index a3589e5b2..000000000 --- a/purenessscopeserver/example-Module/XMLParse/TinyXML/tinyxml.h +++ /dev/null @@ -1,1805 +0,0 @@ -/* -www.sourceforge.net/projects/tinyxml -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - - -#ifndef TINYXML_INCLUDED -#define TINYXML_INCLUDED - -#ifdef _MSC_VER -#pragma warning( push ) -#pragma warning( disable : 4530 ) -#pragma warning( disable : 4786 ) -#endif - -#include -#include -#include -#include -#include - -// Help out windows: -#if defined( _DEBUG ) && !defined( DEBUG ) -#define DEBUG -#endif - -#ifdef TIXML_USE_STL - #include - #include - #include - #define TIXML_STRING std::string -#else - #include "tinystr.h" - #define TIXML_STRING TiXmlString -#endif - -// Deprecated library function hell. Compilers want to use the -// new safe versions. This probably doesn't fully address the problem, -// but it gets closer. There are too many compilers for me to fully -// test. If you get compilation troubles, undefine TIXML_SAFE -#define TIXML_SAFE - -#ifdef TIXML_SAFE - #if defined(_MSC_VER) && (_MSC_VER >= 1400 ) - // Microsoft visual studio, version 2005 and higher. - #define TIXML_SNPRINTF _snprintf_s - #define TIXML_SSCANF sscanf_s - #elif defined(_MSC_VER) && (_MSC_VER >= 1200 ) - // Microsoft visual studio, version 6 and higher. - //#pragma message( "Using _sn* functions." ) - #define TIXML_SNPRINTF _snprintf - #define TIXML_SSCANF sscanf - #elif defined(__GNUC__) && (__GNUC__ >= 3 ) - // GCC version 3 and higher.s - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #else - #define TIXML_SNPRINTF snprintf - #define TIXML_SSCANF sscanf - #endif -#endif - -class TiXmlDocument; -class TiXmlElement; -class TiXmlComment; -class TiXmlUnknown; -class TiXmlAttribute; -class TiXmlText; -class TiXmlDeclaration; -class TiXmlParsingData; - -const int TIXML_MAJOR_VERSION = 2; -const int TIXML_MINOR_VERSION = 6; -const int TIXML_PATCH_VERSION = 2; - -/* Internal structure for tracking location of items - in the XML file. -*/ -struct TiXmlCursor -{ - TiXmlCursor() { Clear(); } - void Clear() { row = col = -1; } - - int row; // 0 based. - int col; // 0 based. -}; - - -/** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a TiXmlVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leaves - are simply called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its sibilings will be Visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting. - - You should never change the document from a callback. - - @sa TiXmlNode::Accept() -*/ -class TiXmlVisitor -{ -public: - virtual ~TiXmlVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const TiXmlDocument& /*doc*/ ) { return true; } - /// Visit a document. - virtual bool VisitExit( const TiXmlDocument& /*doc*/ ) { return true; } - - /// Visit an element. - virtual bool VisitEnter( const TiXmlElement& /*element*/, const TiXmlAttribute* /*firstAttribute*/ ) { return true; } - /// Visit an element. - virtual bool VisitExit( const TiXmlElement& /*element*/ ) { return true; } - - /// Visit a declaration - virtual bool Visit( const TiXmlDeclaration& /*declaration*/ ) { return true; } - /// Visit a text node - virtual bool Visit( const TiXmlText& /*text*/ ) { return true; } - /// Visit a comment node - virtual bool Visit( const TiXmlComment& /*comment*/ ) { return true; } - /// Visit an unknown node - virtual bool Visit( const TiXmlUnknown& /*unknown*/ ) { return true; } -}; - -// Only used by Attribute::Query functions -enum -{ - TIXML_SUCCESS, - TIXML_NO_ATTRIBUTE, - TIXML_WRONG_TYPE -}; - - -// Used by the parsing routines. -enum TiXmlEncoding -{ - TIXML_ENCODING_UNKNOWN, - TIXML_ENCODING_UTF8, - TIXML_ENCODING_LEGACY -}; - -const TiXmlEncoding TIXML_DEFAULT_ENCODING = TIXML_ENCODING_UNKNOWN; - -/** TiXmlBase is a base class for every class in TinyXml. - It does little except to establish that TinyXml classes - can be printed and provide some utility functions. - - In XML, the document and elements can contain - other elements and other types of nodes. - - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) - - A Decleration contains: Attributes (not on tree) - @endverbatim -*/ -class TiXmlBase -{ - friend class TiXmlNode; - friend class TiXmlElement; - friend class TiXmlDocument; - -public: - TiXmlBase() : userData(0) {} - virtual ~TiXmlBase() {} - - /** All TinyXml classes can print themselves to a filestream - or the string class (TiXmlString in non-STL mode, std::string - in STL mode.) Either or both cfile and str can be null. - - This is a formatted print, and will insert - tabs and newlines. - - (For an unformatted stream, use the << operator.) - */ - virtual void Print( FILE* cfile, int depth ) const = 0; - - /** The world does not agree on whether white space should be kept or - not. In order to make everyone happy, these global, static functions - are provided to set whether or not TinyXml will condense all white space - into a single space or not. The default is to condense. Note changing this - value is not thread safe. - */ - static void SetCondenseWhiteSpace( bool condense ) { condenseWhiteSpace = condense; } - - /// Return the current white space setting. - static bool IsWhiteSpaceCondensed() { return condenseWhiteSpace; } - - /** Return the position, in the original source file, of this node or attribute. - The row and column are 1-based. (That is the first row and first column is - 1,1). If the returns values are 0 or less, then the parser does not have - a row and column value. - - Generally, the row and column value will be set when the TiXmlDocument::Load(), - TiXmlDocument::LoadFile(), or any TiXmlNode::Parse() is called. It will NOT be set - when the DOM was created from operator>>. - - The values reflect the initial load. Once the DOM is modified programmatically - (by adding or changing nodes and attributes) the new values will NOT update to - reflect changes in the document. - - There is a minor performance cost to computing the row and column. Computation - can be disabled if TiXmlDocument::SetTabSize() is called with 0 as the value. - - @sa TiXmlDocument::SetTabSize() - */ - int Row() const { return location.row + 1; } - int Column() const { return location.col + 1; } ///< See Row() - - void SetUserData( void* user ) { userData = user; } ///< Set a pointer to arbitrary user data. - void* GetUserData() { return userData; } ///< Get a pointer to arbitrary user data. - const void* GetUserData() const { return userData; } ///< Get a pointer to arbitrary user data. - - // Table that returs, for a given lead byte, the total number of bytes - // in the UTF-8 sequence. - static const int utf8ByteTable[256]; - - virtual const char* Parse( const char* p, - TiXmlParsingData* data, - TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0; - - /** Expands entities in a string. Note this should not contian the tag's '<', '>', etc, - or they will be transformed into entities! - */ - static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out ); - - enum - { - TIXML_NO_ERROR = 0, - TIXML_ERROR, - TIXML_ERROR_OPENING_FILE, - TIXML_ERROR_PARSING_ELEMENT, - TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, - TIXML_ERROR_READING_ELEMENT_VALUE, - TIXML_ERROR_READING_ATTRIBUTES, - TIXML_ERROR_PARSING_EMPTY, - TIXML_ERROR_READING_END_TAG, - TIXML_ERROR_PARSING_UNKNOWN, - TIXML_ERROR_PARSING_COMMENT, - TIXML_ERROR_PARSING_DECLARATION, - TIXML_ERROR_DOCUMENT_EMPTY, - TIXML_ERROR_EMBEDDED_NULL, - TIXML_ERROR_PARSING_CDATA, - TIXML_ERROR_DOCUMENT_TOP_ONLY, - - TIXML_ERROR_STRING_COUNT - }; - -protected: - - static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding ); - - inline static bool IsWhiteSpace( char c ) - { - return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' ); - } - inline static bool IsWhiteSpace( int c ) - { - if ( c < 256 ) - return IsWhiteSpace( (char) c ); - return false; // Again, only truly correct for English/Latin...but usually works. - } - - #ifdef TIXML_USE_STL - static bool StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ); - static bool StreamTo( std::istream * in, int character, TIXML_STRING * tag ); - #endif - - /* Reads an XML name into the string provided. Returns - a pointer just past the last character of the name, - or 0 if the function has an error. - */ - static const char* ReadName( const char* p, TIXML_STRING* name, TiXmlEncoding encoding ); - - /* Reads text. Returns a pointer past the given end tag. - Wickedly complex options, but it keeps the (sensitive) code in one place. - */ - static const char* ReadText( const char* in, // where to start - TIXML_STRING* text, // the string read - bool ignoreWhiteSpace, // whether to keep the white space - const char* endTag, // what ends this text - bool ignoreCase, // whether to ignore case in the end tag - TiXmlEncoding encoding ); // the current encoding - - // If an entity has been found, transform it into a character. - static const char* GetEntity( const char* in, char* value, int* length, TiXmlEncoding encoding ); - - // Get a character, while interpreting entities. - // The length can be from 0 to 4 bytes. - inline static const char* GetChar( const char* p, char* _value, int* length, TiXmlEncoding encoding ) - { - assert( p ); - if ( encoding == TIXML_ENCODING_UTF8 ) - { - *length = utf8ByteTable[ *((const unsigned char*)p) ]; - assert( *length >= 0 && *length < 5 ); - } - else - { - *length = 1; - } - - if ( *length == 1 ) - { - if ( *p == '&' ) - return GetEntity( p, _value, length, encoding ); - *_value = *p; - return p+1; - } - else if ( *length ) - { - //strncpy( _value, p, *length ); // lots of compilers don't like this function (unsafe), - // and the null terminator isn't needed - for( int i=0; p[i] && i<*length; ++i ) { - _value[i] = p[i]; - } - return p + (*length); - } - else - { - // Not valid text. - return 0; - } - } - - // Return true if the next characters in the stream are any of the endTag sequences. - // Ignore case only works for english, and should only be relied on when comparing - // to English words: StringEqual( p, "version", true ) is fine. - static bool StringEqual( const char* p, - const char* endTag, - bool ignoreCase, - TiXmlEncoding encoding ); - - static const char* errorString[ TIXML_ERROR_STRING_COUNT ]; - - TiXmlCursor location; - - /// Field containing a generic user pointer - void* userData; - - // None of these methods are reliable for any language except English. - // Good for approximation, not great for accuracy. - static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding ); - static int IsAlphaNum( unsigned char anyByte, TiXmlEncoding encoding ); - inline static int ToLower( int v, TiXmlEncoding encoding ) - { - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( v < 128 ) return tolower( v ); - return v; - } - else - { - return tolower( v ); - } - } - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); - -private: - TiXmlBase( const TiXmlBase& ); // not implemented. - void operator=( const TiXmlBase& base ); // not allowed. - - struct Entity - { - const char* str; - unsigned int strLength; - char chr; - }; - enum - { - NUM_ENTITY = 5, - MAX_ENTITY_LENGTH = 6 - - }; - static Entity entity[ NUM_ENTITY ]; - static bool condenseWhiteSpace; -}; - - -/** The parent class for everything in the Document Object Model. - (Except for attributes). - Nodes have siblings, a parent, and children. A node can be - in a document, or stand on its own. The type of a TiXmlNode - can be queried, and it can be cast to its more defined type. -*/ -class TiXmlNode : public TiXmlBase -{ - friend class TiXmlDocument; - friend class TiXmlElement; - -public: - #ifdef TIXML_USE_STL - - /** An input stream operator, for every class. Tolerant of newlines and - formatting, but doesn't expect them. - */ - friend std::istream& operator >> (std::istream& in, TiXmlNode& base); - - /** An output stream operator, for every class. Note that this outputs - without any newlines or formatting, as opposed to Print(), which - includes tabs and new lines. - - The operator<< and operator>> are not completely symmetric. Writing - a node to a stream is very well defined. You'll get a nice stream - of output, without any extra whitespace or newlines. - - But reading is not as well defined. (As it always is.) If you create - a TiXmlElement (for example) and read that from an input stream, - the text needs to define an element or junk will result. This is - true of all input streams, but it's worth keeping in mind. - - A TiXmlDocument will read nodes until it reads a root element, and - all the children of that root element. - */ - friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base); - - /// Appends the XML node or attribute to a std::string. - friend std::string& operator<< (std::string& out, const TiXmlNode& base ); - - #endif - - /** The types of XML nodes supported by TinyXml. (All the - unsupported types are picked up by UNKNOWN.) - */ - enum NodeType - { - TINYXML_DOCUMENT, - TINYXML_ELEMENT, - TINYXML_COMMENT, - TINYXML_UNKNOWN, - TINYXML_TEXT, - TINYXML_DECLARATION, - TINYXML_TYPECOUNT - }; - - virtual ~TiXmlNode(); - - /** The meaning of 'value' changes for the specific type of - TiXmlNode. - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - - The subclasses will wrap this function. - */ - const char *Value() const { return value.c_str (); } - - #ifdef TIXML_USE_STL - /** Return Value() as a std::string. If you only use STL, - this is more efficient than calling Value(). - Only available in STL mode. - */ - const std::string& ValueStr() const { return value; } - #endif - - const TIXML_STRING& ValueTStr() const { return value; } - - /** Changes the value of the node. Defined as: - @verbatim - Document: filename of the xml file - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - void SetValue(const char * _value) { value = _value;} - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Delete all the children of this node. Does not affect 'this'. - void Clear(); - - /// One step up the DOM. - TiXmlNode* Parent() { return parent; } - const TiXmlNode* Parent() const { return parent; } - - const TiXmlNode* FirstChild() const { return firstChild; } ///< The first child of this node. Will be null if there are no children. - TiXmlNode* FirstChild() { return firstChild; } - const TiXmlNode* FirstChild( const char * value ) const; ///< The first child of this node with the matching 'value'. Will be null if none found. - /// The first child of this node with the matching 'value'. Will be null if none found. - TiXmlNode* FirstChild( const char * _value ) { - // Call through to the const version - safe since nothing is changed. Exiting syntax: cast this to a const (always safe) - // call the method, cast the return back to non-const. - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->FirstChild( _value )); - } - const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children. - TiXmlNode* LastChild() { return lastChild; } - - const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children. - TiXmlNode* LastChild( const char * _value ) { - return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value )); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* FirstChild( const std::string& _value ) const { return FirstChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* FirstChild( const std::string& _value ) { return FirstChild (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* LastChild( const std::string& _value ) const { return LastChild (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* LastChild( const std::string& _value ) { return LastChild (_value.c_str ()); } ///< STL std::string form. - #endif - - /** An alternate way to walk the children of a node. - One way to iterate over nodes is: - @verbatim - for( child = parent->FirstChild(); child; child = child->NextSibling() ) - @endverbatim - - IterateChildren does the same thing with the syntax: - @verbatim - child = 0; - while( child = parent->IterateChildren( child ) ) - @endverbatim - - IterateChildren takes the previous child as input and finds - the next one. If the previous child is null, it returns the - first. IterateChildren will return null when done. - */ - const TiXmlNode* IterateChildren( const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( previous ) ); - } - - /// This flavor of IterateChildren searches for children with a particular 'value' - const TiXmlNode* IterateChildren( const char * value, const TiXmlNode* previous ) const; - TiXmlNode* IterateChildren( const char * _value, const TiXmlNode* previous ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->IterateChildren( _value, previous ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) const { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - TiXmlNode* IterateChildren( const std::string& _value, const TiXmlNode* previous ) { return IterateChildren (_value.c_str (), previous); } ///< STL std::string form. - #endif - - /** Add a new node related to this. Adds a child past the LastChild. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertEndChild( const TiXmlNode& addThis ); - - - /** Add a new node related to this. Adds a child past the LastChild. - - NOTE: the node to be added is passed by pointer, and will be - henceforth owned (and deleted) by tinyXml. This method is efficient - and avoids an extra copy, but should be used with care as it - uses a different memory model than the other insert functions. - - @sa InsertEndChild - */ - TiXmlNode* LinkEndChild( TiXmlNode* addThis ); - - /** Add a new node related to this. Adds a child before the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis ); - - /** Add a new node related to this. Adds a child after the specified child. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis ); - - /** Replace a child of this node. - Returns a pointer to the new object or NULL if an error occured. - */ - TiXmlNode* ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis ); - - /// Delete a child of this node. - bool RemoveChild( TiXmlNode* removeThis ); - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling() const { return prev; } - TiXmlNode* PreviousSibling() { return prev; } - - /// Navigate to a sibling node. - const TiXmlNode* PreviousSibling( const char * ) const; - TiXmlNode* PreviousSibling( const char *_prev ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->PreviousSibling( _prev ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlNode* PreviousSibling( const std::string& _value ) const { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* PreviousSibling( const std::string& _value ) { return PreviousSibling (_value.c_str ()); } ///< STL std::string form. - const TiXmlNode* NextSibling( const std::string& _value) const { return NextSibling (_value.c_str ()); } ///< STL std::string form. - TiXmlNode* NextSibling( const std::string& _value) { return NextSibling (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Navigate to a sibling node. - const TiXmlNode* NextSibling() const { return next; } - TiXmlNode* NextSibling() { return next; } - - /// Navigate to a sibling node with the given 'value'. - const TiXmlNode* NextSibling( const char * ) const; - TiXmlNode* NextSibling( const char* _next ) { - return const_cast< TiXmlNode* >( (const_cast< const TiXmlNode* >(this))->NextSibling( _next ) ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement() const; - TiXmlElement* NextSiblingElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement() ); - } - - /** Convenience function to get through elements. - Calls NextSibling and ToElement. Will skip all non-Element - nodes. Returns 0 if there is not another element. - */ - const TiXmlElement* NextSiblingElement( const char * ) const; - TiXmlElement* NextSiblingElement( const char *_next ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->NextSiblingElement( _next ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* NextSiblingElement( const std::string& _value) const { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* NextSiblingElement( const std::string& _value) { return NextSiblingElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement() const; - TiXmlElement* FirstChildElement() { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement() ); - } - - /// Convenience function to get through elements. - const TiXmlElement* FirstChildElement( const char * _value ) const; - TiXmlElement* FirstChildElement( const char * _value ) { - return const_cast< TiXmlElement* >( (const_cast< const TiXmlNode* >(this))->FirstChildElement( _value ) ); - } - - #ifdef TIXML_USE_STL - const TiXmlElement* FirstChildElement( const std::string& _value ) const { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - TiXmlElement* FirstChildElement( const std::string& _value ) { return FirstChildElement (_value.c_str ()); } ///< STL std::string form. - #endif - - /** Query the type (as an enumerated value, above) of this node. - The possible types are: TINYXML_DOCUMENT, TINYXML_ELEMENT, TINYXML_COMMENT, - TINYXML_UNKNOWN, TINYXML_TEXT, and TINYXML_DECLARATION. - */ - int Type() const { return type; } - - /** Return a pointer to the Document this node lives in. - Returns null if not in a document. - */ - const TiXmlDocument* GetDocument() const; - TiXmlDocument* GetDocument() { - return const_cast< TiXmlDocument* >( (const_cast< const TiXmlNode* >(this))->GetDocument() ); - } - - /// Returns true if this node has no children. - bool NoChildren() const { return !firstChild; } - - virtual const TiXmlDocument* ToDocument() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlElement* ToElement() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlComment* ToComment() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlUnknown* ToUnknown() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlText* ToText() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual const TiXmlDeclaration* ToDeclaration() const { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - virtual TiXmlDocument* ToDocument() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlElement* ToElement() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlComment* ToComment() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlText* ToText() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type. - - /** Create an exact duplicate of this node and return it. The memory must be deleted - by the caller. - */ - virtual TiXmlNode* Clone() const = 0; - - /** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the TiXmlVisitor interface. - - This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - TiXmlPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( TiXmlVisitor* visitor ) const = 0; - -protected: - TiXmlNode( NodeType _type ); - - // Copy to the allocated object. Shared functionality between Clone, Copy constructor, - // and the assignment operator. - void CopyTo( TiXmlNode* target ) const; - - #ifdef TIXML_USE_STL - // The real work of the input operator. - virtual void StreamIn( std::istream* in, TIXML_STRING* tag ) = 0; - #endif - - // Figure out what is at *p, and parse it. Returns null if it is not an xml node. - TiXmlNode* Identify( const char* start, TiXmlEncoding encoding ); - - TiXmlNode* parent; - NodeType type; - - TiXmlNode* firstChild; - TiXmlNode* lastChild; - - TIXML_STRING value; - - TiXmlNode* prev; - TiXmlNode* next; - -private: - TiXmlNode( const TiXmlNode& ); // not implemented. - void operator=( const TiXmlNode& base ); // not allowed. -}; - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not TiXmlNodes, since they are not - part of the tinyXML document object model. There are other - suggested ways to look at this problem. -*/ -class TiXmlAttribute : public TiXmlBase -{ - friend class TiXmlAttributeSet; - -public: - /// Construct an empty attribute. - TiXmlAttribute() : TiXmlBase() - { - document = 0; - prev = next = 0; - } - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlAttribute( const std::string& _name, const std::string& _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - #endif - - /// Construct an attribute with a name and value. - TiXmlAttribute( const char * _name, const char * _value ) - { - name = _name; - value = _value; - document = 0; - prev = next = 0; - } - - const char* Name() const { return name.c_str(); } ///< Return the name of this attribute. - const char* Value() const { return value.c_str(); } ///< Return the value of this attribute. - #ifdef TIXML_USE_STL - const std::string& ValueStr() const { return value; } ///< Return the value of this attribute. - #endif - int IntValue() const; ///< Return the value of this attribute, converted to an integer. - double DoubleValue() const; ///< Return the value of this attribute, converted to a double. - - // Get the tinyxml string representation - const TIXML_STRING& NameTStr() const { return name; } - - /** QueryIntValue examines the value string. It is an alternative to the - IntValue() method with richer error checking. - If the value is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. - - A specialized but useful call. Note that for success it returns 0, - which is the opposite of almost all other TinyXml calls. - */ - int QueryIntValue( int* _value ) const; - /// QueryDoubleValue examines the value string. See QueryIntValue(). - int QueryDoubleValue( double* _value ) const; - - void SetName( const char* _name ) { name = _name; } ///< Set the name of this attribute. - void SetValue( const char* _value ) { value = _value; } ///< Set the value. - - void SetIntValue( int _value ); ///< Set the value from an integer. - void SetDoubleValue( double _value ); ///< Set the value from a double. - - #ifdef TIXML_USE_STL - /// STL std::string form. - void SetName( const std::string& _name ) { name = _name; } - /// STL std::string form. - void SetValue( const std::string& _value ) { value = _value; } - #endif - - /// Get the next sibling attribute in the DOM. Returns null at end. - const TiXmlAttribute* Next() const; - TiXmlAttribute* Next() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() ); - } - - /// Get the previous sibling attribute in the DOM. Returns null at beginning. - const TiXmlAttribute* Previous() const; - TiXmlAttribute* Previous() { - return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() ); - } - - bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; } - bool operator<( const TiXmlAttribute& rhs ) const { return name < rhs.name; } - bool operator>( const TiXmlAttribute& rhs ) const { return name > rhs.name; } - - /* Attribute parsing starts: first letter of the name - returns: the next char after the value end quote - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - // Prints this Attribute to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - - // [internal use] - // Set the document pointer so the attribute can report errors. - void SetDocument( TiXmlDocument* doc ) { document = doc; } - -private: - TiXmlAttribute( const TiXmlAttribute& ); // not implemented. - void operator=( const TiXmlAttribute& base ); // not allowed. - - TiXmlDocument* document; // A pointer back to a document, for error reporting. - TIXML_STRING name; - TIXML_STRING value; - TiXmlAttribute* prev; - TiXmlAttribute* next; -}; - - -/* A class used to manage a group of attributes. - It is only used internally, both by the ELEMENT and the DECLARATION. - - The set can be changed transparent to the Element and Declaration - classes that use it, but NOT transparent to the Attribute - which has to implement a next() and previous() method. Which makes - it a bit problematic and prevents the use of STL. - - This version is implemented with circular lists because: - - I like circular lists - - it demonstrates some independence from the (typical) doubly linked list. -*/ -class TiXmlAttributeSet -{ -public: - TiXmlAttributeSet(); - ~TiXmlAttributeSet(); - - void Add( TiXmlAttribute* attribute ); - void Remove( TiXmlAttribute* attribute ); - - const TiXmlAttribute* First() const { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - TiXmlAttribute* First() { return ( sentinel.next == &sentinel ) ? 0 : sentinel.next; } - const TiXmlAttribute* Last() const { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - TiXmlAttribute* Last() { return ( sentinel.prev == &sentinel ) ? 0 : sentinel.prev; } - - TiXmlAttribute* Find( const char* _name ) const; - TiXmlAttribute* FindOrCreate( const char* _name ); - -# ifdef TIXML_USE_STL - TiXmlAttribute* Find( const std::string& _name ) const; - TiXmlAttribute* FindOrCreate( const std::string& _name ); -# endif - - -private: - //*ME: Because of hidden/disabled copy-construktor in TiXmlAttribute (sentinel-element), - //*ME: this class must be also use a hidden/disabled copy-constructor !!! - TiXmlAttributeSet( const TiXmlAttributeSet& ); // not allowed - void operator=( const TiXmlAttributeSet& ); // not allowed (as TiXmlAttribute) - - TiXmlAttribute sentinel; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TiXmlElement : public TiXmlNode -{ -public: - /// Construct an element. - TiXmlElement (const char * in_value); - - #ifdef TIXML_USE_STL - /// std::string constructor. - TiXmlElement( const std::string& _value ); - #endif - - TiXmlElement( const TiXmlElement& ); - - TiXmlElement& operator=( const TiXmlElement& base ); - - virtual ~TiXmlElement(); - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - */ - const char* Attribute( const char* name ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an integer, - the integer value will be put in the return 'i', if 'i' - is non-null. - */ - const char* Attribute( const char* name, int* i ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none exists. - If the attribute exists and can be converted to an double, - the double value will be put in the return 'd', if 'd' - is non-null. - */ - const char* Attribute( const char* name, double* d ) const; - - /** QueryIntAttribute examines the attribute - it is an alternative to the - Attribute() method with richer error checking. - If the attribute is an integer, it is stored in 'value' and - the call returns TIXML_SUCCESS. If it is not - an integer, it returns TIXML_WRONG_TYPE. If the attribute - does not exist, then TIXML_NO_ATTRIBUTE is returned. - */ - int QueryIntAttribute( const char* name, int* _value ) const; - /// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute(). - int QueryUnsignedAttribute( const char* name, unsigned* _value ) const; - /** QueryBoolAttribute examines the attribute - see QueryIntAttribute(). - Note that '1', 'true', or 'yes' are considered true, while '0', 'false' - and 'no' are considered false. - */ - int QueryBoolAttribute( const char* name, bool* _value ) const; - /// QueryDoubleAttribute examines the attribute - see QueryIntAttribute(). - int QueryDoubleAttribute( const char* name, double* _value ) const; - /// QueryFloatAttribute examines the attribute - see QueryIntAttribute(). - int QueryFloatAttribute( const char* name, float* _value ) const { - double d; - int result = QueryDoubleAttribute( name, &d ); - if ( result == TIXML_SUCCESS ) { - *_value = (float)d; - } - return result; - } - - #ifdef TIXML_USE_STL - /// QueryStringAttribute examines the attribute - see QueryIntAttribute(). - int QueryStringAttribute( const char* name, std::string* _value ) const { - const char* cstr = Attribute( name ); - if ( cstr ) { - *_value = std::string( cstr ); - return TIXML_SUCCESS; - } - return TIXML_NO_ATTRIBUTE; - } - - /** Template form of the attribute query which will try to read the - attribute into the specified type. Very easy, very powerful, but - be careful to make sure to call this with the correct type. - - NOTE: This method doesn't work correctly for 'string' types that contain spaces. - - @return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE - */ - template< typename T > int QueryValueAttribute( const std::string& name, T* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - - std::stringstream sstream( node->ValueStr() ); - sstream >> *outValue; - if ( !sstream.fail() ) - return TIXML_SUCCESS; - return TIXML_WRONG_TYPE; - } - - int QueryValueAttribute( const std::string& name, std::string* outValue ) const - { - const TiXmlAttribute* node = attributeSet.Find( name ); - if ( !node ) - return TIXML_NO_ATTRIBUTE; - *outValue = node->ValueStr(); - return TIXML_SUCCESS; - } - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char* name, const char * _value ); - - #ifdef TIXML_USE_STL - const std::string* Attribute( const std::string& name ) const; - const std::string* Attribute( const std::string& name, int* i ) const; - const std::string* Attribute( const std::string& name, double* d ) const; - int QueryIntAttribute( const std::string& name, int* _value ) const; - int QueryDoubleAttribute( const std::string& name, double* _value ) const; - - /// STL std::string form. - void SetAttribute( const std::string& name, const std::string& _value ); - ///< STL std::string form. - void SetAttribute( const std::string& name, int _value ); - ///< STL std::string form. - void SetDoubleAttribute( const std::string& name, double value ); - #endif - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetAttribute( const char * name, int value ); - - /** Sets an attribute of name to a given value. The attribute - will be created if it does not exist, or changed if it does. - */ - void SetDoubleAttribute( const char * name, double value ); - - /** Deletes an attribute with the given name. - */ - void RemoveAttribute( const char * name ); - #ifdef TIXML_USE_STL - void RemoveAttribute( const std::string& name ) { RemoveAttribute (name.c_str ()); } ///< STL std::string form. - #endif - - const TiXmlAttribute* FirstAttribute() const { return attributeSet.First(); } ///< Access the first attribute in this element. - TiXmlAttribute* FirstAttribute() { return attributeSet.First(); } - const TiXmlAttribute* LastAttribute() const { return attributeSet.Last(); } ///< Access the last attribute in this element. - TiXmlAttribute* LastAttribute() { return attributeSet.Last(); } - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the TiXmlText child - and accessing it directly. - - If the first child of 'this' is a TiXmlText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - - WARNING: GetText() accesses a child node - don't become confused with the - similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are - safe type casts on the referenced node. - */ - const char* GetText() const; - - /// Creates a new Element and returns it - the returned element is a copy. - virtual TiXmlNode* Clone() const; - // Print the Element to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: next char past '<' - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - - void CopyTo( TiXmlElement* target ) const; - void ClearThis(); // like clear, but initializes 'this' object as well - - // Used to be public [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - /* [internal use] - Reads the "value" of the element -- another element, or text. - This should terminate with the current end tag. - */ - const char* ReadValue( const char* in, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - -private: - TiXmlAttributeSet attributeSet; -}; - - -/** An XML comment. -*/ -class TiXmlComment : public TiXmlNode -{ -public: - /// Constructs an empty comment. - TiXmlComment() : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) {} - /// Construct a comment from text. - TiXmlComment( const char* _value ) : TiXmlNode( TiXmlNode::TINYXML_COMMENT ) { - SetValue( _value ); - } - TiXmlComment( const TiXmlComment& ); - TiXmlComment& operator=( const TiXmlComment& base ); - - virtual ~TiXmlComment() {} - - /// Returns a copy of this Comment. - virtual TiXmlNode* Clone() const; - // Write this Comment to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /* Attribtue parsing starts: at the ! of the !-- - returns: next char past '>' - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlComment* target ) const; - - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif -// virtual void StreamOut( TIXML_OSTREAM * out ) const; - -private: - -}; - - -/** XML text. A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCDATA() and query it with CDATA(). -*/ -class TiXmlText : public TiXmlNode -{ - friend class TiXmlElement; -public: - /** Constructor for text element. By default, it is treated as - normal, encoded text. If you want it be output as a CDATA text - element, set the parameter _cdata to 'true' - */ - TiXmlText (const char * initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - virtual ~TiXmlText() {} - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlText( const std::string& initValue ) : TiXmlNode (TiXmlNode::TINYXML_TEXT) - { - SetValue( initValue ); - cdata = false; - } - #endif - - TiXmlText( const TiXmlText& copy ) : TiXmlNode( TiXmlNode::TINYXML_TEXT ) { copy.CopyTo( this ); } - TiXmlText& operator=( const TiXmlText& base ) { base.CopyTo( this ); return *this; } - - // Write this text object to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - /// Queries whether this represents text using a CDATA section. - bool CDATA() const { return cdata; } - /// Turns on or off a CDATA representation of text. - void SetCDATA( bool _cdata ) { cdata = _cdata; } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - /// [internal use] Creates a new Element and returns it. - virtual TiXmlNode* Clone() const; - void CopyTo( TiXmlText* target ) const; - - bool Blank() const; // returns true if all white space and new lines - // [internal use] - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - bool cdata; // true if this should be input and output as a CDATA style text element -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXml will happily read or write files without a declaration, - however. There are 3 possible attributes to the declaration: - version, encoding, and standalone. - - Note: In this version of the code, the attributes are - handled as special cases, not generic attributes, simply - because there can only be at most 3 and they are always the same. -*/ -class TiXmlDeclaration : public TiXmlNode -{ -public: - /// Construct an empty declaration. - TiXmlDeclaration() : TiXmlNode( TiXmlNode::TINYXML_DECLARATION ) {} - -#ifdef TIXML_USE_STL - /// Constructor. - TiXmlDeclaration( const std::string& _version, - const std::string& _encoding, - const std::string& _standalone ); -#endif - - /// Construct. - TiXmlDeclaration( const char* _version, - const char* _encoding, - const char* _standalone ); - - TiXmlDeclaration( const TiXmlDeclaration& copy ); - TiXmlDeclaration& operator=( const TiXmlDeclaration& copy ); - - virtual ~TiXmlDeclaration() {} - - /// Version. Will return an empty string if none was found. - const char *Version() const { return version.c_str (); } - /// Encoding. Will return an empty string if none was found. - const char *Encoding() const { return encoding.c_str (); } - /// Is this a standalone document? - const char *Standalone() const { return standalone.c_str (); } - - /// Creates a copy of this Declaration and returns it. - virtual TiXmlNode* Clone() const; - // Print this declaration to a FILE stream. - virtual void Print( FILE* cfile, int depth, TIXML_STRING* str ) const; - virtual void Print( FILE* cfile, int depth ) const { - Print( cfile, depth, 0 ); - } - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* visitor ) const; - -protected: - void CopyTo( TiXmlDeclaration* target ) const; - // used to be public - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - - TIXML_STRING version; - TIXML_STRING encoding; - TIXML_STRING standalone; -}; - - -/** Any tag that tinyXml doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into TiXmlUnknowns. -*/ -class TiXmlUnknown : public TiXmlNode -{ -public: - TiXmlUnknown() : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) {} - virtual ~TiXmlUnknown() {} - - TiXmlUnknown( const TiXmlUnknown& copy ) : TiXmlNode( TiXmlNode::TINYXML_UNKNOWN ) { copy.CopyTo( this ); } - TiXmlUnknown& operator=( const TiXmlUnknown& copy ) { copy.CopyTo( this ); return *this; } - - /// Creates a copy of this Unknown and returns it. - virtual TiXmlNode* Clone() const; - // Print this Unknown to a FILE stream. - virtual void Print( FILE* cfile, int depth ) const; - - virtual const char* Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ); - - virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected: - void CopyTo( TiXmlUnknown* target ) const; - - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - -}; - - -/** Always the top level node. A document binds together all the - XML pieces. It can be saved, loaded, and printed to the screen. - The 'value' of a document node is the xml file name. -*/ -class TiXmlDocument : public TiXmlNode -{ -public: - /// Create an empty document, that has no name. - TiXmlDocument(); - /// Create a document with a name. The name of the document is also the filename of the xml. - TiXmlDocument( const char * documentName ); - - #ifdef TIXML_USE_STL - /// Constructor. - TiXmlDocument( const std::string& documentName ); - #endif - - TiXmlDocument( const TiXmlDocument& copy ); - TiXmlDocument& operator=( const TiXmlDocument& copy ); - - virtual ~TiXmlDocument() {} - - /** Load a file using the current document value. - Returns true if successful. Will delete any existing - document data before loading. - */ - bool LoadFile( TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the current document value. Returns true if successful. - bool SaveFile() const; - /// Load a file using the given filename. Returns true if successful. - bool LoadFile( const char * filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given filename. Returns true if successful. - bool SaveFile( const char * filename ) const; - /** Load a file using the given FILE*. Returns true if successful. Note that this method - doesn't stream - the entire object pointed at by the FILE* - will be interpreted as an XML file. TinyXML doesn't stream in XML from the current - file location. Streaming may be added in the future. - */ - bool LoadFile( FILE*, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - /// Save a file using the given FILE*. Returns true if successful. - bool SaveFile( FILE* ) const; - - #ifdef TIXML_USE_STL - bool LoadFile( const std::string& filename, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ) ///< STL std::string version. - { - return LoadFile( filename.c_str(), encoding ); - } - bool SaveFile( const std::string& filename ) const ///< STL std::string version. - { - return SaveFile( filename.c_str() ); - } - #endif - - /** Parse the given null terminated block of xml data. Passing in an encoding to this - method (either TIXML_ENCODING_LEGACY or TIXML_ENCODING_UTF8 will force TinyXml - to use that encoding, regardless of what TinyXml might otherwise try to detect. - */ - virtual const char* Parse( const char* p, TiXmlParsingData* data = 0, TiXmlEncoding encoding = TIXML_DEFAULT_ENCODING ); - - /** Get the root element -- the only top level element -- of the document. - In well formed XML, there should only be one. TinyXml is tolerant of - multiple elements at the document level. - */ - const TiXmlElement* RootElement() const { return FirstChildElement(); } - TiXmlElement* RootElement() { return FirstChildElement(); } - - /** If an error occurs, Error will be set to true. Also, - - The ErrorId() will contain the integer identifier of the error (not generally useful) - - The ErrorDesc() method will return the name of the error. (very useful) - - The ErrorRow() and ErrorCol() will return the location of the error (if known) - */ - bool Error() const { return error; } - - /// Contains a textual (english) description of the error if one occurs. - const char * ErrorDesc() const { return errorDesc.c_str (); } - - /** Generally, you probably want the error string ( ErrorDesc() ). But if you - prefer the ErrorId, this function will fetch it. - */ - int ErrorId() const { return errorId; } - - /** Returns the location (if known) of the error. The first column is column 1, - and the first row is row 1. A value of 0 means the row and column wasn't applicable - (memory errors, for example, have no row/column) or the parser lost the error. (An - error in the error reporting, in that case.) - - @sa SetTabSize, Row, Column - */ - int ErrorRow() const { return errorLocation.row+1; } - int ErrorCol() const { return errorLocation.col+1; } ///< The column where the error occured. See ErrorRow() - - /** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol()) - to report the correct values for row and column. It does not change the output - or input in any way. - - By calling this method, with a tab size - greater than 0, the row and column of each node and attribute is stored - when the file is loaded. Very useful for tracking the DOM back in to - the source file. - - The tab size is required for calculating the location of nodes. If not - set, the default of 4 is used. The tabsize is set per document. Setting - the tabsize to 0 disables row/column tracking. - - Note that row and column tracking is not supported when using operator>>. - - The tab size needs to be enabled before the parse or load. Correct usage: - @verbatim - TiXmlDocument doc; - doc.SetTabSize( 8 ); - doc.Load( "myfile.xml" ); - @endverbatim - - @sa Row, Column - */ - void SetTabSize( int _tabsize ) { tabsize = _tabsize; } - - int TabSize() const { return tabsize; } - - /** If you have handled the error, it can be reset with this call. The error - state is automatically cleared if you Parse a new XML block. - */ - void ClearError() { error = false; - errorId = 0; - errorDesc = ""; - errorLocation.row = errorLocation.col = 0; - //errorLocation.last = 0; - } - - /** Write the document to standard out using formatted printing ("pretty print"). */ - void Print() const { Print( stdout, 0 ); } - - /* Write the document to a string using formatted printing ("pretty print"). This - will allocate a character array (new char[]) and return it as a pointer. The - calling code pust call delete[] on the return char* to avoid a memory leak. - */ - //char* PrintToMemory() const; - - /// Print this Document to a FILE stream. - virtual void Print( FILE* cfile, int depth = 0 ) const; - // [internal use] - void SetError( int err, const char* errorLocation, TiXmlParsingData* prevData, TiXmlEncoding encoding ); - - virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type. - - /** Walk the XML tree visiting this node and all of its children. - */ - virtual bool Accept( TiXmlVisitor* content ) const; - -protected : - // [internal use] - virtual TiXmlNode* Clone() const; - #ifdef TIXML_USE_STL - virtual void StreamIn( std::istream * in, TIXML_STRING * tag ); - #endif - -private: - void CopyTo( TiXmlDocument* target ) const; - - bool error; - int errorId; - TIXML_STRING errorDesc; - int tabsize; - TiXmlCursor errorLocation; - bool useMicrosoftBOM; // the UTF-8 BOM were found when read. Note this, and try to write. -}; - - -/** - A TiXmlHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that TiXmlHandle is not part of the TinyXml - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - TiXmlElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - TiXmlElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - TiXmlElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - TiXmlElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity - of such code. A TiXmlHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - TiXmlHandle docHandle( &document ); - TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - TiXmlHandle handleCopy = handle; - @endverbatim - - What they should not be used for is iteration: - - @verbatim - int i=0; - while ( true ) - { - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement(); - if ( !child ) - break; - // do something - ++i; - } - @endverbatim - - It seems reasonable, but it is in fact two embedded while loops. The Child method is - a linear walk to find the element, so this code would iterate much more than it needs - to. Instead, prefer: - - @verbatim - TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).FirstChild( "Child" ).ToElement(); - - for( child; child; child=child->NextSiblingElement() ) - { - // do something - } - @endverbatim -*/ -class TiXmlHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - TiXmlHandle( TiXmlNode* _node ) { this->node = _node; } - /// Copy constructor - TiXmlHandle( const TiXmlHandle& ref ) { this->node = ref.node; } - TiXmlHandle operator=( const TiXmlHandle& ref ) { if ( &ref != this ) this->node = ref.node; return *this; } - - /// Return a handle to the first child node. - TiXmlHandle FirstChild() const; - /// Return a handle to the first child node with the given name. - TiXmlHandle FirstChild( const char * value ) const; - /// Return a handle to the first child element. - TiXmlHandle FirstChildElement() const; - /// Return a handle to the first child element with the given name. - TiXmlHandle FirstChildElement( const char * value ) const; - - /** Return a handle to the "index" child with the given name. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( const char* value, int index ) const; - /** Return a handle to the "index" child. - The first child is 0, the second 1, etc. - */ - TiXmlHandle Child( int index ) const; - /** Return a handle to the "index" child element with the given name. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( const char* value, int index ) const; - /** Return a handle to the "index" child element. - The first child element is 0, the second 1, etc. Note that only TiXmlElements - are indexed: other types are not counted. - */ - TiXmlHandle ChildElement( int index ) const; - - #ifdef TIXML_USE_STL - TiXmlHandle FirstChild( const std::string& _value ) const { return FirstChild( _value.c_str() ); } - TiXmlHandle FirstChildElement( const std::string& _value ) const { return FirstChildElement( _value.c_str() ); } - - TiXmlHandle Child( const std::string& _value, int index ) const { return Child( _value.c_str(), index ); } - TiXmlHandle ChildElement( const std::string& _value, int index ) const { return ChildElement( _value.c_str(), index ); } - #endif - - /** Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* ToNode() const { return node; } - /** Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); } - /** Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* ToText() const { return ( ( node && node->ToText() ) ? node->ToText() : 0 ); } - /** Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); } - - /** @deprecated use ToNode. - Return the handle as a TiXmlNode. This may return null. - */ - TiXmlNode* Node() const { return ToNode(); } - /** @deprecated use ToElement. - Return the handle as a TiXmlElement. This may return null. - */ - TiXmlElement* Element() const { return ToElement(); } - /** @deprecated use ToText() - Return the handle as a TiXmlText. This may return null. - */ - TiXmlText* Text() const { return ToText(); } - /** @deprecated use ToUnknown() - Return the handle as a TiXmlUnknown. This may return null. - */ - TiXmlUnknown* Unknown() const { return ToUnknown(); } - -private: - TiXmlNode* node; -}; - - -/** Print to memory functionality. The TiXmlPrinter is useful when you need to: - - -# Print to memory (especially in non-STL mode) - -# Control formatting (line endings, etc.) - - When constructed, the TiXmlPrinter is in its default "pretty printing" mode. - Before calling Accept() you can call methods to control the printing - of the XML document. After TiXmlNode::Accept() is called, the printed document can - be accessed via the CStr(), Str(), and Size() methods. - - TiXmlPrinter uses the Visitor API. - @verbatim - TiXmlPrinter printer; - printer.SetIndent( "\t" ); - - doc.Accept( &printer ); - fprintf( stdout, "%s", printer.CStr() ); - @endverbatim -*/ -class TiXmlPrinter : public TiXmlVisitor -{ -public: - TiXmlPrinter() : depth( 0 ), simpleTextPrint( false ), - buffer(), indent( " " ), lineBreak( "\n" ) {} - - virtual bool VisitEnter( const TiXmlDocument& doc ); - virtual bool VisitExit( const TiXmlDocument& doc ); - - virtual bool VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute ); - virtual bool VisitExit( const TiXmlElement& element ); - - virtual bool Visit( const TiXmlDeclaration& declaration ); - virtual bool Visit( const TiXmlText& text ); - virtual bool Visit( const TiXmlComment& comment ); - virtual bool Visit( const TiXmlUnknown& unknown ); - - /** Set the indent characters for printing. By default 4 spaces - but tab (\t) is also useful, or null/empty string for no indentation. - */ - void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; } - /// Query the indention string. - const char* Indent() { return indent.c_str(); } - /** Set the line breaking string. By default set to newline (\n). - Some operating systems prefer other characters, or can be - set to the null/empty string for no indenation. - */ - void SetLineBreak( const char* _lineBreak ) { lineBreak = _lineBreak ? _lineBreak : ""; } - /// Query the current line breaking string. - const char* LineBreak() { return lineBreak.c_str(); } - - /** Switch over to "stream printing" which is the most dense formatting without - linebreaks. Common when the XML is needed for network transmission. - */ - void SetStreamPrinting() { indent = ""; - lineBreak = ""; - } - /// Return the result. - const char* CStr() { return buffer.c_str(); } - /// Return the length of the result string. - size_t Size() { return buffer.size(); } - - #ifdef TIXML_USE_STL - /// Return the result. - const std::string& Str() { return buffer; } - #endif - -private: - void DoIndent() { - for( int i=0; i -#include - -#include "tinyxml.h" - -//#define DEBUG_PARSER -#if defined( DEBUG_PARSER ) -# if defined( DEBUG ) && defined( _MSC_VER ) -# include -# define TIXML_LOG OutputDebugString -# else -# define TIXML_LOG printf -# endif -#endif - -// Note tha "PutString" hardcodes the same list. This -// is less flexible than it appears. Changing the entries -// or order will break putstring. -TiXmlBase::Entity TiXmlBase::entity[ TiXmlBase::NUM_ENTITY ] = -{ - { "&", 5, '&' }, - { "<", 4, '<' }, - { ">", 4, '>' }, - { """, 6, '\"' }, - { "'", 6, '\'' } -}; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// Including the basic of this table, which determines the #bytes in the -// sequence from the lead byte. 1 placed for invalid sequences -- -// although the result will be junk, pass it through as much as possible. -// Beware of the non-characters in UTF-8: -// ef bb bf (Microsoft "lead bytes") -// ef bf be -// ef bf bf - -const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - -const int TiXmlBase::utf8ByteTable[256] = -{ - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x20 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x30 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x50 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x70 End of ASCII range - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80 0x80 to 0xc1 invalid - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0 - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0 - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xc0 0xc2 to 0xdf 2 byte - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xd0 - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xe0 0xe0 to 0xef 3 byte - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 // 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid -}; - - -void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) - *length = 1; - else if ( input < 0x800 ) - *length = 2; - else if ( input < 0x10000 ) - *length = 3; - else if ( input < 0x200000 ) - *length = 4; - else - { *length = 0; return; } // This code won't covert this correctly anyway. - - output += *length; - - // Scary scary fall throughs. - switch (*length) - { - case 4: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 3: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 2: - --output; - *output = (char)((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - case 1: - --output; - *output = (char)(input | FIRST_BYTE_MARK[*length]); - } -} - - -/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalpha( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalpha( anyByte ); -// } -} - - -/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ ) -{ - // This will only work for low-ascii, everything else is assumed to be a valid - // letter. I'm not sure this is the best approach, but it is quite tricky trying - // to figure out alhabetical vs. not across encoding. So take a very - // conservative approach. - -// if ( encoding == TIXML_ENCODING_UTF8 ) -// { - if ( anyByte < 127 ) - return isalnum( anyByte ); - else - return 1; // What else to do? The unicode set is huge...get the english ones right. -// } -// else -// { -// return isalnum( anyByte ); -// } -} - - -class TiXmlParsingData -{ - friend class TiXmlDocument; - public: - void Stamp( const char* now, TiXmlEncoding encoding ); - - const TiXmlCursor& Cursor() const { return cursor; } - - private: - // Only used by the document! - TiXmlParsingData( const char* start, int _tabsize, int row, int col ) - { - assert( start ); - stamp = start; - tabsize = _tabsize; - cursor.row = row; - cursor.col = col; - } - - TiXmlCursor cursor; - const char* stamp; - int tabsize; -}; - - -void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding ) -{ - assert( now ); - - // Do nothing if the tabsize is 0. - if ( tabsize < 1 ) - { - return; - } - - // Get the current row, column. - int row = cursor.row; - int col = cursor.col; - const char* p = stamp; - assert( p ); - - while ( p < now ) - { - // Treat p as unsigned, so we have a happy compiler. - const unsigned char* pU = (const unsigned char*)p; - - // Code contributed by Fletcher Dunn: (modified by lee) - switch (*pU) { - case 0: - // We *should* never get here, but in case we do, don't - // advance past the terminating null character, ever - return; - - case '\r': - // bump down to the next line - ++row; - col = 0; - // Eat the character - ++p; - - // Check for \r\n sequence, and treat this as a single character - if (*p == '\n') { - ++p; - } - break; - - case '\n': - // bump down to the next line - ++row; - col = 0; - - // Eat the character - ++p; - - // Check for \n\r sequence, and treat this as a single - // character. (Yes, this bizarre thing does occur still - // on some arcane platforms...) - if (*p == '\r') { - ++p; - } - break; - - case '\t': - // Eat the character - ++p; - - // Skip to next tab stop - col = (col / tabsize + 1) * tabsize; - break; - - case TIXML_UTF_LEAD_0: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - if ( *(p+1) && *(p+2) ) - { - // In these cases, don't advance the column. These are - // 0-width spaces. - if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU ) - p += 3; - else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU ) - p += 3; - else - { p +=3; ++col; } // A normal character. - } - } - else - { - ++p; - ++col; - } - break; - - default: - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // Eat the 1 to 4 byte utf8 character. - int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)]; - if ( step == 0 ) - step = 1; // Error case from bad encoding, but handle gracefully. - p += step; - - // Just advance one column, of course. - ++col; - } - else - { - ++p; - ++col; - } - break; - } - } - cursor.row = row; - cursor.col = col; - assert( cursor.row >= -1 ); - assert( cursor.col >= -1 ); - stamp = p; - assert( stamp ); -} - - -const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding ) -{ - if ( !p || !*p ) - { - return 0; - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - while ( *p ) - { - const unsigned char* pU = (const unsigned char*)p; - - // Skip the stupid Microsoft UTF-8 Byte order marks - if ( *(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==TIXML_UTF_LEAD_1 - && *(pU+2)==TIXML_UTF_LEAD_2 ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbeU ) - { - p += 3; - continue; - } - else if(*(pU+0)==TIXML_UTF_LEAD_0 - && *(pU+1)==0xbfU - && *(pU+2)==0xbfU ) - { - p += 3; - continue; - } - - if ( IsWhiteSpace( *p ) ) // Still using old rules for white space. - ++p; - else - break; - } - } - else - { - while ( *p && IsWhiteSpace( *p ) ) - ++p; - } - - return p; -} - -#ifdef TIXML_USE_STL -/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag ) -{ - for( ;; ) - { - if ( !in->good() ) return false; - - int c = in->peek(); - // At this scope, we can't get to a document. So fail silently. - if ( !IsWhiteSpace( c ) || c <= 0 ) - return true; - - *tag += (char) in->get(); - } -} - -/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag ) -{ - //assert( character > 0 && character < 128 ); // else it won't work in utf-8 - while ( in->good() ) - { - int c = in->peek(); - if ( c == character ) - return true; - if ( c <= 0 ) // Silent failure: can't get document at this scope - return false; - - in->get(); - *tag += (char) c; - } - return false; -} -#endif - -// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The -// "assign" optimization removes over 10% of the execution time. -// -const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding ) -{ - // Oddly, not supported on some comilers, - //name->clear(); - // So use this: - *name = ""; - assert( p ); - - // Names start with letters or underscores. - // Of course, in unicode, tinyxml has no idea what a letter *is*. The - // algorithm is generous. - // - // After that, they can be letters, underscores, numbers, - // hyphens, or colons. (Colons are valid ony for namespaces, - // but tinyxml can't tell namespaces from names.) - if ( p && *p - && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) ) - { - const char* start = p; - while( p && *p - && ( IsAlphaNum( (unsigned char ) *p, encoding ) - || *p == '_' - || *p == '-' - || *p == '.' - || *p == ':' ) ) - { - //(*name) += *p; // expensive - ++p; - } - if ( p-start > 0 ) { - name->assign( start, p-start ); - } - return p; - } - return 0; -} - -const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding ) -{ - // Presume an entity, and pull it out. - TIXML_STRING ent; - int i; - *length = 0; - - if ( *(p+1) && *(p+1) == '#' && *(p+2) ) - { - unsigned long ucs = 0; - ptrdiff_t delta = 0; - unsigned mult = 1; - - if ( *(p+2) == 'x' ) - { - // Hexadecimal. - if ( !*(p+3) ) return 0; - - const char* q = p+3; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != 'x' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else if ( *q >= 'a' && *q <= 'f' ) - ucs += mult * (*q - 'a' + 10); - else if ( *q >= 'A' && *q <= 'F' ) - ucs += mult * (*q - 'A' + 10 ); - else - return 0; - mult *= 16; - --q; - } - } - else - { - // Decimal. - if ( !*(p+2) ) return 0; - - const char* q = p+2; - q = strchr( q, ';' ); - - if ( !q || !*q ) return 0; - - delta = q-p; - --q; - - while ( *q != '#' ) - { - if ( *q >= '0' && *q <= '9' ) - ucs += mult * (*q - '0'); - else - return 0; - mult *= 10; - --q; - } - } - if ( encoding == TIXML_ENCODING_UTF8 ) - { - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - } - else - { - *value = (char)ucs; - *length = 1; - } - return p + delta + 1; - } - - // Now try to match it. - for( i=0; iappend( cArr, len ); - } - } - else - { - bool whitespace = false; - - // Remove leading white space: - p = SkipWhiteSpace( p, encoding ); - while ( p && *p - && !StringEqual( p, endTag, caseInsensitive, encoding ) ) - { - if ( *p == '\r' || *p == '\n' ) - { - whitespace = true; - ++p; - } - else if ( IsWhiteSpace( *p ) ) - { - whitespace = true; - ++p; - } - else - { - // If we've found whitespace, add it before the - // new character. Any whitespace just becomes a space. - if ( whitespace ) - { - (*text) += ' '; - whitespace = false; - } - int len; - char cArr[4] = { 0, 0, 0, 0 }; - p = GetChar( p, cArr, &len, encoding ); - if ( len == 1 ) - (*text) += cArr[0]; // more efficient - else - text->append( cArr, len ); - } - } - } - if ( p && *p ) - p += strlen( endTag ); - return ( p && *p ) ? p : 0; -} - -#ifdef TIXML_USE_STL - -void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - // The basic issue with a document is that we don't know what we're - // streaming. Read something presumed to be a tag (and hope), then - // identify it, and call the appropriate stream method on the tag. - // - // This "pre-streaming" will never read the closing ">" so the - // sub-tag can orient itself. - - if ( !StreamTo( in, '<', tag ) ) - { - SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - while ( in->good() ) - { - int tagIndex = (int) tag->length(); - while ( in->good() && in->peek() != '>' ) - { - int c = in->get(); - if ( c <= 0 ) - { - SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - break; - } - (*tag) += (char) c; - } - - if ( in->good() ) - { - // We now have something we presume to be a node of - // some sort. Identify it, and call the node to - // continue streaming. - TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING ); - - if ( node ) - { - node->StreamIn( in, tag ); - bool isElement = node->ToElement() != 0; - delete node; - node = 0; - - // If this is the root element, we're done. Parsing will be - // done by the >> operator. - if ( isElement ) - { - return; - } - } - else - { - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - } - } - // We should have returned sooner. - SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN ); -} - -#endif - -const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding ) -{ - ClearError(); - - // Parse away, at the document level. Since a document - // contains nothing but other tags, most of what happens - // here is skipping white space. - if ( !p || !*p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - // Note that, for a document, this needs to come - // before the while space skip, so that parsing - // starts from the pointer we are given. - location.Clear(); - if ( prevData ) - { - location.row = prevData->cursor.row; - location.col = prevData->cursor.col; - } - else - { - location.row = 0; - location.col = 0; - } - TiXmlParsingData data( p, TabSize(), location.row, location.col ); - location = data.Cursor(); - - if ( encoding == TIXML_ENCODING_UNKNOWN ) - { - // Check for the Microsoft UTF-8 lead bytes. - const unsigned char* pU = (const unsigned char*)p; - if ( *(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0 - && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1 - && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 ) - { - encoding = TIXML_ENCODING_UTF8; - useMicrosoftBOM = true; - } - } - - p = SkipWhiteSpace( p, encoding ); - if ( !p ) - { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN ); - return 0; - } - - while ( p && *p ) - { - TiXmlNode* node = Identify( p, encoding ); - if ( node ) - { - p = node->Parse( p, &data, encoding ); - LinkEndChild( node ); - } - else - { - break; - } - - // Did we get encoding info? - if ( encoding == TIXML_ENCODING_UNKNOWN - && node->ToDeclaration() ) - { - TiXmlDeclaration* dec = node->ToDeclaration(); - const char* enc = dec->Encoding(); - assert( enc ); - - if ( *enc == 0 ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; - else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) ) - encoding = TIXML_ENCODING_UTF8; // incorrect, but be nice - else - encoding = TIXML_ENCODING_LEGACY; - } - - p = SkipWhiteSpace( p, encoding ); - } - - // Was this empty? - if ( !firstChild ) { - SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding ); - return 0; - } - - // All is well. - return p; -} - -void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - // The first error in a chain is more accurate - don't set again! - if ( error ) - return; - - assert( err > 0 && err < TIXML_ERROR_STRING_COUNT ); - error = true; - errorId = err; - errorDesc = errorString[ errorId ]; - - errorLocation.Clear(); - if ( pError && data ) - { - data->Stamp( pError, encoding ); - errorLocation = data->Cursor(); - } -} - - -TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding ) -{ - TiXmlNode* returnNode = 0; - - p = SkipWhiteSpace( p, encoding ); - if( !p || !*p || *p != '<' ) - { - return 0; - } - - p = SkipWhiteSpace( p, encoding ); - - if ( !p || !*p ) - { - return 0; - } - - // What is this thing? - // - Elements start with a letter or underscore, but xml is reserved. - // - Comments: "; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // [ 1475201 ] TinyXML parses entities in comments - // Oops - ReadText doesn't work, because we don't want to parse the entities. - // p = ReadText( p, &value, false, endTag, false, encoding ); - // - // from the XML spec: - /* - [Definition: Comments may appear anywhere in a document outside other markup; in addition, - they may appear within the document type declaration at places allowed by the grammar. - They are not part of the document's character data; an XML processor MAY, but need not, - make it possible for an application to retrieve the text of comments. For compatibility, - the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity - references MUST NOT be recognized within comments. - - An example of a comment: - - - */ - - value = ""; - // Keep all the white space. - while ( p && *p && !StringEqual( p, endTag, false, encoding ) ) - { - value.append( p, 1 ); - ++p; - } - if ( p && *p ) - p += strlen( endTag ); - - return p; -} - - -const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) return 0; - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - // Read the name, the '=' and the value. - const char* pErr = p; - p = ReadName( p, &name, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding ); - return 0; - } - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p || *p != '=' ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - ++p; // skip '=' - p = SkipWhiteSpace( p, encoding ); - if ( !p || !*p ) - { - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - - const char* end; - const char SINGLE_QUOTE = '\''; - const char DOUBLE_QUOTE = '\"'; - - if ( *p == SINGLE_QUOTE ) - { - ++p; - end = "\'"; // single quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else if ( *p == DOUBLE_QUOTE ) - { - ++p; - end = "\""; // double quote in string - p = ReadText( p, &value, false, end, false, encoding ); - } - else - { - // All attribute values should be in single or double quotes. - // But this is such a common error that the parser will try - // its best, even without them. - value = ""; - while ( p && *p // existence - && !IsWhiteSpace( *p ) // whitespace - && *p != '/' && *p != '>' ) // tag end - { - if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) { - // [ 1451649 ] Attribute values with trailing quotes not handled correctly - // We did not have an opening quote but seem to have a - // closing one. Give up and throw an error. - if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding ); - return 0; - } - value += *p; - ++p; - } - } - return p; -} - -#ifdef TIXML_USE_STL -void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->peek(); - if ( !cdata && (c == '<' ) ) - { - return; - } - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - - (*tag) += (char) c; - in->get(); // "commits" the peek made above - - if ( cdata && c == '>' && tag->size() >= 3 ) { - size_t len = tag->size(); - if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) { - // terminator of cdata. - return; - } - } - } -} -#endif - -const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding ) -{ - value = ""; - TiXmlDocument* document = GetDocument(); - - if ( data ) - { - data->Stamp( p, encoding ); - location = data->Cursor(); - } - - const char* const startTag = ""; - - if ( cdata || StringEqual( p, startTag, false, encoding ) ) - { - cdata = true; - - if ( !StringEqual( p, startTag, false, encoding ) ) - { - if ( document ) - document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding ); - return 0; - } - p += strlen( startTag ); - - // Keep all the white space, ignore the encoding, etc. - while ( p && *p - && !StringEqual( p, endTag, false, encoding ) - ) - { - value += *p; - ++p; - } - - TIXML_STRING dummy; - p = ReadText( p, &dummy, false, endTag, false, encoding ); - return p; - } - else - { - bool ignoreWhite = true; - - const char* end = "<"; - p = ReadText( p, &value, ignoreWhite, end, false, encoding ); - if ( p && *p ) - return p-1; // don't truncate the '<' - return 0; - } -} - -#ifdef TIXML_USE_STL -void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag ) -{ - while ( in->good() ) - { - int c = in->get(); - if ( c <= 0 ) - { - TiXmlDocument* document = GetDocument(); - if ( document ) - document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN ); - return; - } - (*tag) += (char) c; - - if ( c == '>' ) - { - // All is well. - return; - } - } -} -#endif - -const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding ) -{ - p = SkipWhiteSpace( p, _encoding ); - // Find the beginning, find the end, and look for - // the stuff in-between. - TiXmlDocument* document = GetDocument(); - if ( !p || !*p || !StringEqual( p, "SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding ); - return 0; - } - if ( data ) - { - data->Stamp( p, _encoding ); - location = data->Cursor(); - } - p += 5; - - version = ""; - encoding = ""; - standalone = ""; - - while ( p && *p ) - { - if ( *p == '>' ) - { - ++p; - return p; - } - - p = SkipWhiteSpace( p, _encoding ); - if ( StringEqual( p, "version", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - version = attrib.Value(); - } - else if ( StringEqual( p, "encoding", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - encoding = attrib.Value(); - } - else if ( StringEqual( p, "standalone", true, _encoding ) ) - { - TiXmlAttribute attrib; - p = attrib.Parse( p, data, _encoding ); - standalone = attrib.Value(); - } - else - { - // Read over whatever it is. - while( p && *p && *p != '>' && !IsWhiteSpace( *p ) ) - ++p; - } - } - return 0; -} - -bool TiXmlText::Blank() const -{ - for ( unsigned i=0; i + + + + + diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.depend b/purenessscopeserver/example-Module/XMLParse/XMLParse.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/XMLParse/XMLParse.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.exp b/purenessscopeserver/example-Module/XMLParse/XMLParse.exp new file mode 100644 index 000000000..fb2e33b3f Binary files /dev/null and b/purenessscopeserver/example-Module/XMLParse/XMLParse.exp differ diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.layout b/purenessscopeserver/example-Module/XMLParse/XMLParse.layout new file mode 100644 index 000000000..01a8e93a1 --- /dev/null +++ b/purenessscopeserver/example-Module/XMLParse/XMLParse.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.lib b/purenessscopeserver/example-Module/XMLParse/XMLParse.lib new file mode 100644 index 000000000..6fda3bce4 Binary files /dev/null and b/purenessscopeserver/example-Module/XMLParse/XMLParse.lib differ diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.mk b/purenessscopeserver/example-Module/XMLParse/XMLParse.mk new file mode 100644 index 000000000..72ac8e501 --- /dev/null +++ b/purenessscopeserver/example-Module/XMLParse/XMLParse.mk @@ -0,0 +1,160 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=XMLParse +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/XMLParse +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="XMLParse.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)../../../ThirdLib/include/TinyXML $(IncludeSwitch)../../../ThirdLib/include +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IntermediateDirectory)/XMLParse_XMLParse.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/XMLParse" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinystr.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinystr.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinystr.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxml.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxml.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxml.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlerror.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxmlerror.cpp + +$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(ObjectSuffix): ./XMLParse/XMLParse.cpp $(IntermediateDirectory)/XMLParse_XMLParse.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/XMLParse/XMLParse/XMLParse.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(DependSuffix): ./XMLParse/XMLParse.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(DependSuffix) -MM ./XMLParse/XMLParse.cpp + +$(IntermediateDirectory)/XMLParse_XMLParse.cpp$(PreprocessSuffix): ./XMLParse/XMLParse.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/XMLParse_XMLParse.cpp$(PreprocessSuffix) ./XMLParse/XMLParse.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix): ../../../ThirdLib/include/XmlOpeation.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/XmlOpeation.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix): ../../../ThirdLib/include/XmlOpeation.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(DependSuffix) -MM ../../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix): ../../../ThirdLib/include/XmlOpeation.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_XmlOpeation.cpp$(PreprocessSuffix) ../../../ThirdLib/include/XmlOpeation.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/ThirdLib/include/TinyXML/tinyxmlparser.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(DependSuffix) -MM ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix): ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp$(PreprocessSuffix) ../../../ThirdLib/include/TinyXML/tinyxmlparser.cpp + +$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(ObjectSuffix): ./XMLParse/BaseCommand.cpp $(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/XMLParse/XMLParse/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(DependSuffix): ./XMLParse/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(DependSuffix) -MM ./XMLParse/BaseCommand.cpp + +$(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(PreprocessSuffix): ./XMLParse/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/XMLParse_BaseCommand.cpp$(PreprocessSuffix) ./XMLParse/BaseCommand.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.mpc b/purenessscopeserver/example-Module/XMLParse/XMLParse.mpc deleted file mode 100644 index d7c92f1d8..000000000 --- a/purenessscopeserver/example-Module/XMLParse/XMLParse.mpc +++ /dev/null @@ -1,25 +0,0 @@ -project(XMLParse):acelib{ - sharedname=XMLParse - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../include ./TinyXML -} diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.project b/purenessscopeserver/example-Module/XMLParse/XMLParse.project new file mode 100644 index 000000000..62480af07 --- /dev/null +++ b/purenessscopeserver/example-Module/XMLParse/XMLParse.project @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.sln b/purenessscopeserver/example-Module/XMLParse/XMLParse.sln deleted file mode 100644 index fcdac6f31..000000000 --- a/purenessscopeserver/example-Module/XMLParse/XMLParse.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XMLParse", "XMLParse.vcxproj", "{259D12CF-FECA-1BAD-6552-43F50000002E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {259D12CF-FECA-1BAD-6552-43F50000002E}.Debug|Win32.ActiveCfg = Debug|Win32 - {259D12CF-FECA-1BAD-6552-43F50000002E}.Debug|Win32.Build.0 = Debug|Win32 - {259D12CF-FECA-1BAD-6552-43F50000002E}.Debug|x64.ActiveCfg = Debug|x64 - {259D12CF-FECA-1BAD-6552-43F50000002E}.Debug|x64.Build.0 = Debug|x64 - {259D12CF-FECA-1BAD-6552-43F50000002E}.Release|Win32.ActiveCfg = Release|Win32 - {259D12CF-FECA-1BAD-6552-43F50000002E}.Release|Win32.Build.0 = Release|Win32 - {259D12CF-FECA-1BAD-6552-43F50000002E}.Release|x64.ActiveCfg = Release|x64 - {259D12CF-FECA-1BAD-6552-43F50000002E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.txt b/purenessscopeserver/example-Module/XMLParse/XMLParse.txt new file mode 100644 index 000000000..2858d25f4 --- /dev/null +++ b/purenessscopeserver/example-Module/XMLParse/XMLParse.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_TinyXML_tinystr.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_TinyXML_tinyxml.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_TinyXML_tinyxmlerror.cpp.o ../../../Build/Linux/Linux_Bin/Temp/XMLParse_XMLParse.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_XmlOpeation.cpp.o ../../../Build/Linux/Linux_Bin/Temp/up_up_up_ThirdLib_include_TinyXML_tinyxmlparser.cpp.o ../../../Build/Linux/Linux_Bin/Temp/XMLParse_BaseCommand.cpp.o diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.vcproj b/purenessscopeserver/example-Module/XMLParse/XMLParse.vcproj deleted file mode 100644 index 5ad679fe2..000000000 --- a/purenessscopeserver/example-Module/XMLParse/XMLParse.vcproj +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.vcxproj b/purenessscopeserver/example-Module/XMLParse/XMLParse.vcxproj index 03770055c..4a1f48924 100644 --- a/purenessscopeserver/example-Module/XMLParse/XMLParse.vcxproj +++ b/purenessscopeserver/example-Module/XMLParse/XMLParse.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -18,30 +18,46 @@ x64 + + + + + + + + + + + + + + + {259D12CF-FECA-1BAD-6552-43F50000002E} XMLParse Win32Proj + 10.0.17763.0 DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet DynamicLibrary - v110 + v141 NotSet @@ -64,7 +80,7 @@ <_ProjectFileVersion>11.0.50727.1 - ..\..\PurenessScopeServer\Windows_Bin\ + ../../../Build/Windows Debug\XMLParse\I386\ true @@ -74,13 +90,13 @@ false - ..\..\PurenessScopeServer\Windows_Bin\ + ../../../Build/Windows Debug\XMLParse\AMD64\ true - ..\..\PurenessScopeServer\Windows_Bin\ - Release\XMLParse\AMD64\ + $(SolutionDir)\Windows_Bin\Module\ + $(SolutionDir)\Temp\ false @@ -197,7 +213,7 @@ MaxSpeed - $(ACE_ROOT);.;..\include;.\TinyXML;%(AdditionalIncludeDirectories) + ../../Common;$(ACE_ROOT);../../../ThirdLib/include;../../../ThirdLib/include/TinyXML;%(AdditionalIncludeDirectories) TEST_TCP_BUILD_DLL;NDEBUG;WIN32;_WINDOWS;_CRT_NONSTDC_NO_WARNINGS;_AMD64_;_WIN64;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) MultiThreadedDLL true @@ -223,29 +239,6 @@ MachineX64 - - - - - - - - - - - - - - - - - - true - true - true - true - - diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.vcxproj.filters b/purenessscopeserver/example-Module/XMLParse/XMLParse.vcxproj.filters index f233bafc6..367b4b2b4 100644 --- a/purenessscopeserver/example-Module/XMLParse/XMLParse.vcxproj.filters +++ b/purenessscopeserver/example-Module/XMLParse/XMLParse.vcxproj.filters @@ -1,62 +1,35 @@  - - {c454ebb1-4b41-4049-b73c-b27947ee26e1} - cpp;cxx;cc;c;C - - - {cf476824-a40e-4554-b878-606cab7720f0} - h;hpp;hxx;hh - - - {ab429387-66c4-48bd-b9cd-4a649b19d059} - mpc;mpb;mwc - - {b18971ef-b8b0-4412-8902-bce7cabf8b16} + {bcf246fa-d4cd-431f-8810-0c810e8af4d8} - - Source Files - - - Source Files - - - Source Files - - + TinyXML - + TinyXML - + TinyXML - + TinyXML + + + - - Header Files - - - Header Files - - + TinyXML - + TinyXML - - - - Build Files - + + \ No newline at end of file diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse/BaseCommand.cpp b/purenessscopeserver/example-Module/XMLParse/XMLParse/BaseCommand.cpp new file mode 100644 index 000000000..c4ea93cfd --- /dev/null +++ b/purenessscopeserver/example-Module/XMLParse/XMLParse/BaseCommand.cpp @@ -0,0 +1,161 @@ +#include "BaseCommand.h" + +CBaseCommand::CBaseCommand(void) +{ + m_pServerObject = NULL; + m_nCount = 0; +} + +CBaseCommand::~CBaseCommand(void) +{ +} + +void CBaseCommand::SetServerObject(CServerObject* pServerObject) +{ + m_pServerObject = pServerObject; +} + +int CBaseCommand::DoMessage(IMessage* pMessage, bool& bDeleteFlag) +{ + //__ENTER_FUNCTIONԶĺ׷tryĺ꣬ڲ׽ʹ__THROW_FUNCTION()׳Ĵ + //__THROW_FUNCTION("hello"); ԶLogļµassert.log¼ļ + //Ƽʹ꣬סһҪںĽʹ__LEAVE_FUNCTION__LEAVE_FUNCTION_WITHRETURN֮ԡ + //__LEAVE_FUNCTION_WITHRETURN__LEAVE_FUNCTIONͬǰ߿ֺ֧˳ʱ򷵻һ + //Ƿһint + //ôĩβ__LEAVE_FUNCTION_WITHRETURN(0); 0ǷصintȻҲֱ֧ͱ忴Լĺ + //καʹ__LEAVE_FUNCTIONɡ + __ENTER_FUNCTION(); + + if(m_pServerObject == NULL) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] m_pServerObject is NULL(%d).\n", bDeleteFlag)); + return -1; + } + + if(pMessage == NULL) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pMessage is NULL.\n")); + return -1; + } + + //ӽϢ + MESSAGE_FUNCTION_BEGIN(pMessage->GetMessageBase()->m_u2Cmd); + MESSAGE_FUNCTION(CLIENT_LINK_CONNECT, Do_Connect, pMessage); + MESSAGE_FUNCTION(CLIENT_LINK_CDISCONNET, Do_DisConnect, pMessage); + MESSAGE_FUNCTION(CLINET_LINK_SENDTIMEOUT, Do_ClientSendTimeout, pMessage); + MESSAGE_FUNCTION(COMMAND_BASE, Do_Base, pMessage); + MESSAGE_FUNCTION_END; + + return 0; + + __LEAVE_FUNCTION_WITHRETURN(0); +} + +int CBaseCommand::Do_Connect(IMessage* pMessage) +{ + OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_Connect] (%d)TCP CLIENT_LINK_CONNECT OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); + if(NULL != pMessage) + { + //жϵǰǷԽ2000 + int nConnectCount = m_pServerObject->GetConnectManager()->GetCount(); + if(nConnectCount > 2000) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_Connect]connect count is more(%d).\n", nConnectCount)); + } + } + + return 0; +} + +int CBaseCommand::Do_DisConnect(IMessage* pMessage) +{ + if(NULL != pMessage) + { + //ӶϿ¼ + OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_DisConnect](%d)CLIENT_LINK_CDISCONNET OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); + } + + return 0; +} + +int CBaseCommand::Do_ClientSendTimeout(IMessage* pMessage) +{ + //Ϳͻӳֵ¼ + OUR_DEBUG((LM_ERROR, "[CBaseCommand::Do_DisConnect](%d)CLINET_LINK_SNEDTIMEOUT OK.\n", pMessage->GetMessageBase()->m_u4ConnectID)); + + return 0; +} + +int CBaseCommand::Do_Base(IMessage* pMessage) +{ + //OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage] TcpTest CommandID = %d", COMMAND_BASE)); + //m_pServerObject->GetLogManager()->WriteToMail(LOG_SYSTEM, 1, "ʼ", ""); + + IBuffPacket* pBodyPacket = m_pServerObject->GetPacketManager()->Create(); + if(NULL == pBodyPacket) + { + OUR_DEBUG((LM_ERROR, "[CBaseCommand::DoMessage] pBodyPacket is NULL.\n")); + return -1; + } + + _PacketInfo BodyPacket; + pMessage->GetPacketBody(BodyPacket); + + //pBodyPacket->WriteStream(BodyPacket.m_pData, BodyPacket.m_nDataLen); + + + //Լ¼־ + //m_pServerObject->GetLogManager()->WriteLogBinary(LOG_SYSTEM, BodyPacket.m_pData, BodyPacket.m_nDataLen); + + IBuffPacket* pResponsesPacket = m_pServerObject->GetPacketManager()->Create(); + uint16 u2PostCommandID = COMMAND_BASE; + + //ԭ + (*pResponsesPacket) << (uint32)BodyPacket.m_nDataLen; + pResponsesPacket->WriteStream(BodyPacket.m_pData, BodyPacket.m_nDataLen); + + //(*pResponsesPacket) << u2PostCommandID; + //(*pResponsesPacket) << u8ClientTime; + + m_pServerObject->GetPacketManager()->Delete(pBodyPacket); + + if(NULL != m_pServerObject->GetConnectManager()) + { + //ȫ + m_pServerObject->GetConnectManager()->PostMessage(pMessage->GetMessageBase()->m_u4ConnectID, + pResponsesPacket, + SENDMESSAGE_JAMPNOMAL, + u2PostCommandID, + PACKET_SEND_IMMEDIATLY, + PACKET_IS_FRAMEWORK_RECYC); + } + else + { + OUR_DEBUG((LM_INFO, "[CBaseCommand::DoMessage] m_pConnectManager = NULL")); + m_pServerObject->GetPacketManager()->Delete(pResponsesPacket); + } + + //m_pServerObject->GetConnectManager()->CloseConnect(pMessage->GetMessageBase()->m_u4ConnectID); + + return 0; +} + +void CBaseCommand::Init_XML() +{ + //ԽXML + char szText[200] = {'\0'}; + ::sprintf_safe(szText, 200, "freeeyes"); + + CXmlOpeation objXmlOpeation; + objXmlOpeation.Init_String(szText); + char* pName = objXmlOpeation.GetData_Text("Name"); + + if(NULL != pName) + { + OUR_DEBUG((LM_INFO, "pName=%s.\n", pName)); + } + else + { + OUR_DEBUG((LM_INFO, "pName is NULL.\n", pName)); + } +} diff --git a/purenessscopeserver/example-Module/XMLParse/BaseCommand.h b/purenessscopeserver/example-Module/XMLParse/XMLParse/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/XMLParse/BaseCommand.h rename to purenessscopeserver/example-Module/XMLParse/XMLParse/BaseCommand.h diff --git a/purenessscopeserver/example-Module/XMLParse/XMLParse.cpp b/purenessscopeserver/example-Module/XMLParse/XMLParse/XMLParse.cpp similarity index 100% rename from purenessscopeserver/example-Module/XMLParse/XMLParse.cpp rename to purenessscopeserver/example-Module/XMLParse/XMLParse/XMLParse.cpp diff --git a/purenessscopeserver/example-Module/XMLParse/XmlOpeation.cpp b/purenessscopeserver/example-Module/XMLParse/XmlOpeation.cpp deleted file mode 100644 index 4d2e9199b..000000000 --- a/purenessscopeserver/example-Module/XMLParse/XmlOpeation.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include "XmlOpeation.h" - -CXmlOpeation::CXmlOpeation(void) -{ - m_pTiXmlDocument = NULL; - m_pRootElement = NULL; -} - -CXmlOpeation::~CXmlOpeation(void) -{ - Close(); -} - -bool CXmlOpeation::Init(const char* pFileName) -{ - Close(); - m_pTiXmlDocument = new TiXmlDocument(pFileName); - if(NULL == m_pTiXmlDocument) - { - return false; - } - - if(false == m_pTiXmlDocument->LoadFile()) - { - return false; - } - - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - return true; -} - -bool CXmlOpeation::Init_String(const char* pXMLText) -{ - //ַ - Close(); - m_pTiXmlDocument = new TiXmlDocument(); - m_pTiXmlDocument->Parse(pXMLText, 0, TIXML_DEFAULT_ENCODING); - - //øԪ - m_pRootElement = m_pTiXmlDocument->RootElement(); - - return true; -} - -void CXmlOpeation::Close() -{ - if(NULL != m_pTiXmlDocument) - { - delete m_pTiXmlDocument; - m_pTiXmlDocument = NULL; - m_pRootElement = NULL; - } -} - -char* CXmlOpeation::GetData(const char* pName, const char* pAttrName) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = m_pRootElement->FirstChildElement(pName); - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->Attribute(pAttrName); - } - - return NULL; -} - -char* CXmlOpeation::GetData(const char* pName, const char* pAttrName, TiXmlElement*& pNextTiXmlElement) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = NULL; - if(NULL == pNextTiXmlElement) - { - pTiXmlElement = m_pRootElement->FirstChildElement(pName); - pNextTiXmlElement = pTiXmlElement; - } - else - { - pTiXmlElement = pNextTiXmlElement->NextSiblingElement(); - pNextTiXmlElement = pTiXmlElement; - } - - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->Attribute(pAttrName); - } - - return NULL; -} - -char* CXmlOpeation::GetData_Text(const char* pName) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = m_pRootElement->FirstChildElement(pName); - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->GetText(); - } - - return NULL; -} - -char* CXmlOpeation::GetData_Text(const char* pName, TiXmlElement*& pNextTiXmlElement) -{ - if(m_pRootElement == NULL) - { - return NULL; - } - - TiXmlElement* pTiXmlElement = NULL; - if(NULL == pNextTiXmlElement) - { - pTiXmlElement = m_pRootElement->FirstChildElement(pName); - pNextTiXmlElement = pTiXmlElement; - } - else - { - pTiXmlElement = pNextTiXmlElement->NextSiblingElement(); - pNextTiXmlElement = pTiXmlElement; - } - - if(NULL != pTiXmlElement) - { - return (char* )pTiXmlElement->GetText(); - } - - return NULL; -} - diff --git a/purenessscopeserver/example-Module/XMLParse/XmlOpeation.h b/purenessscopeserver/example-Module/XMLParse/XmlOpeation.h deleted file mode 100644 index d80d1e3d5..000000000 --- a/purenessscopeserver/example-Module/XMLParse/XmlOpeation.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _XMLOPRATION_H -#define _XMLOPRATION_H - -#include "tinyxml.h" -#include "tinystr.h" - -class CXmlOpeation -{ -public: - CXmlOpeation(void); - ~CXmlOpeation(void); - - bool Init(const char* pFileName); - bool Init_String(const char* pXMLText); - - char* GetData(const char* pName, const char* pAttrName); - char* GetData(const char* pName, const char* pAttrName, TiXmlElement*& pNextTiXmlElement); - - char* GetData_Text(const char* pName); - char* GetData_Text(const char* pName, TiXmlElement*& pNextTiXmlElement); - - void Close(); - -private: - TiXmlDocument* m_pTiXmlDocument; - TiXmlElement* m_pRootElement; -}; -#endif diff --git a/purenessscopeserver/example-Module/XMLParse/runlinuxmake.sh b/purenessscopeserver/example-Module/XMLParse/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/XMLParse/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/XMLParse/zzz.bat b/purenessscopeserver/example-Module/XMLParse/zzz.bat deleted file mode 100644 index 24bc3dfbe..000000000 --- a/purenessscopeserver/example-Module/XMLParse/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc9 diff --git a/purenessscopeserver/example-Module/ZooClient/CMakeLists.txt b/purenessscopeserver/example-Module/ZooClient/CMakeLists.txt new file mode 100644 index 000000000..f2f697456 --- /dev/null +++ b/purenessscopeserver/example-Module/ZooClient/CMakeLists.txt @@ -0,0 +1,90 @@ +# -*- CMakeLists.txt generated by CodeLite IDE. Do not edit by hand -*- + +cmake_minimum_required(VERSION 2.8.11) + +# Project name +project(ZooClient) + +# This setting is useful for providing JSON file used by CodeLite for code completion +set(CMAKE_EXPORT_COMPILE_COMMANDS 1) + +# Set default locations +set(CL_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux/cmake-build-Release/output) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CL_OUTPUT_DIRECTORY}) + +set(CONFIGURATION_NAME "Release") + +# Projects + + +# Top project +# Define some variables +set(PROJECT_ZooClient_PATH "${CMAKE_CURRENT_LIST_DIR}") +set(WORKSPACE_PATH "${CMAKE_CURRENT_LIST_DIR}/../../../Build/Linux") + + + +#{{{{ User Code 1 +# Place your code here +#}}}} + +include_directories( + . + ../../../purenessscopeserver/Common + ../../../../../zookeeper-release-3.5.4/src/c/include + +) + + +# Compiler options +add_definitions(-O2 -fPIC -DTHREADED -Wall -fexceptions) +add_definitions( + -DTHREADED +) + + +# Linker options +set(LINK_OPTIONS -s) + + +if(WIN32) + # Resource options +endif(WIN32) + +# Library path +set(CMAKE_LDFLAGS "${CMAKE_LDFLAGS} -L. -L. -LRelease ") + +# Define the CXX sources +set ( CXX_SRCS + ${CMAKE_CURRENT_LIST_DIR}/./ZooClient/ZooClient.cpp + ${CMAKE_CURRENT_LIST_DIR}/./ZooClient/BaseCommand.cpp + ${CMAKE_CURRENT_LIST_DIR}/./ZooClient/zkClient.cpp +) + +set_source_files_properties( + ${CXX_SRCS} PROPERTIES COMPILE_FLAGS + " -O2 -fPIC -DTHREADED -Wall -fexceptions") + +if(WIN32) + enable_language(RC) + set(CMAKE_RC_COMPILE_OBJECT + " ${RC_OPTIONS} -O coff -i -o ") +endif(WIN32) + + + +#{{{{ User Code 2 +# Place your code here +#}}}} + +add_library(ZooClient SHARED ${RC_SRCS} ${CXX_SRCS} ${C_SRCS}) +target_link_libraries(ZooClient ${LINK_OPTIONS}) + + + +#{{{{ User Code 3 +# Place your code here +#}}}} + diff --git a/purenessscopeserver/example-Module/ZooClient/Makefile b/purenessscopeserver/example-Module/ZooClient/Makefile new file mode 100644 index 000000000..31502acfa --- /dev/null +++ b/purenessscopeserver/example-Module/ZooClient/Makefile @@ -0,0 +1,128 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=ZooClient +ConfigurationName :=Release +WorkspacePath :=../../../Build/Linux +ProjectPath :=../../purenessscopeserver/example-Module/ZooClient +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="ZooClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)../../../ThirdLib/thirdparty/zookeeper/include/ +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -DTHREADED -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -DTHREADED -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/ZooClient_zkClient.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "../../../Build/Linux/.build-release" + @echo rebuilt > "../../../Build/Linux/.build-release/ZooClient" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(ObjectSuffix): ./ZooClient/ZooClient.cpp $(IntermediateDirectory)/ZooClient_ZooClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./ZooClient/ZooClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(DependSuffix): ./ZooClient/ZooClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(DependSuffix) -MM ./ZooClient/ZooClient.cpp + +$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(PreprocessSuffix): ./ZooClient/ZooClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ZooClient_ZooClient.cpp$(PreprocessSuffix) ./ZooClient/ZooClient.cpp + +$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(ObjectSuffix): ./ZooClient/BaseCommand.cpp $(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./ZooClient/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(DependSuffix): ./ZooClient/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(DependSuffix) -MM ./ZooClient/BaseCommand.cpp + +$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(PreprocessSuffix): ./ZooClient/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(PreprocessSuffix) ./ZooClient/BaseCommand.cpp + +$(IntermediateDirectory)/ZooClient_zkClient.cpp$(ObjectSuffix): ./ZooClient/zkClient.cpp $(IntermediateDirectory)/ZooClient_zkClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "./ZooClient/zkClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ZooClient_zkClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ZooClient_zkClient.cpp$(DependSuffix): ./ZooClient/zkClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ZooClient_zkClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ZooClient_zkClient.cpp$(DependSuffix) -MM ./ZooClient/zkClient.cpp + +$(IntermediateDirectory)/ZooClient_zkClient.cpp$(PreprocessSuffix): ./ZooClient/zkClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ZooClient_zkClient.cpp$(PreprocessSuffix) ./ZooClient/zkClient.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/ZooClient/ZooClient.cbp b/purenessscopeserver/example-Module/ZooClient/ZooClient.cbp new file mode 100644 index 000000000..9033b3f4b --- /dev/null +++ b/purenessscopeserver/example-Module/ZooClient/ZooClient.cbp @@ -0,0 +1,46 @@ + + + + + + diff --git a/purenessscopeserver/example-Module/ZooClient/ZooClient.depend b/purenessscopeserver/example-Module/ZooClient/ZooClient.depend new file mode 100644 index 000000000..c4ac3106e --- /dev/null +++ b/purenessscopeserver/example-Module/ZooClient/ZooClient.depend @@ -0,0 +1 @@ +# depslib dependency file v1.0 diff --git a/purenessscopeserver/example-Module/ZooClient/ZooClient.layout b/purenessscopeserver/example-Module/ZooClient/ZooClient.layout new file mode 100644 index 000000000..c6e398af5 --- /dev/null +++ b/purenessscopeserver/example-Module/ZooClient/ZooClient.layout @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/ZooClient/ZooClient.mk b/purenessscopeserver/example-Module/ZooClient/ZooClient.mk new file mode 100644 index 000000000..bca340da5 --- /dev/null +++ b/purenessscopeserver/example-Module/ZooClient/ZooClient.mk @@ -0,0 +1,128 @@ +## +## Auto Generated makefile by CodeLite IDE +## any manual changes will be erased +## +## Release +ProjectName :=ZooClient +ConfigurationName :=Release +WorkspacePath :=/data/develop/Lib/Network/PSS-master/Build/Linux +ProjectPath :=/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/ZooClient +IntermediateDirectory :=$(WorkspacePath)/Linux_Bin/Temp +OutDir := $(IntermediateDirectory) +CurrentFileName := +CurrentFilePath := +CurrentFileFullPath := +User :=fox mulder +Date :=2019年03月30日 +CodeLitePath :=/home/fox-mulder/.codelite +LinkerName :=/usr/bin/g++ +SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC +ObjectSuffix :=.o +DependSuffix :=.o.d +PreprocessSuffix :=.i +DebugSwitch :=-g +IncludeSwitch :=-I +LibrarySwitch :=-l +OutputSwitch :=-o +LibraryPathSwitch :=-L +PreprocessorSwitch :=-D +SourceSwitch :=-c +OutputFile :=$(WorkspacePath)/Linux_Bin/Module/lib$(ProjectName) +Preprocessors := +ObjectSwitch :=-o +ArchiveOutputSwitch := +PreprocessOnlySwitch :=-E +ObjectsFileList :="ZooClient.txt" +PCHCompileFlags := +MakeDirCommand :=mkdir -p +LinkOptions := -s +IncludePath := $(IncludeSwitch). $(IncludeSwitch)../../../purenessscopeserver/Common $(IncludeSwitch)../../../ThirdLib/thirdparty/zookeeper/include/ +IncludePCH := +RcIncludePath := +Libs := +ArLibs := +LibPath := $(LibraryPathSwitch). $(LibraryPathSwitch). $(LibraryPathSwitch)Release + +## +## Common variables +## AR, CXX, CC, AS, CXXFLAGS and CFLAGS can be overriden using an environment variables +## +AR := /usr/bin/ar rcu +CXX := /usr/bin/g++ +CC := /usr/bin/gcc +CXXFLAGS := -O2 -fPIC -DTHREADED -Wall -fexceptions $(Preprocessors) +CFLAGS := -O2 -fPIC -DTHREADED -Wall -fexceptions $(Preprocessors) +ASFLAGS := +AS := /usr/bin/as + + +## +## User defined environment variables +## +CodeLiteDir:=/usr/share/codelite +Objects0=$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(ObjectSuffix) $(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(ObjectSuffix) $(IntermediateDirectory)/ZooClient_zkClient.cpp$(ObjectSuffix) + + + +Objects=$(Objects0) + +## +## Main Build Targets +## +.PHONY: all clean PreBuild PrePreBuild PostBuild MakeIntermediateDirs +all: $(OutputFile) + +$(OutputFile): $(IntermediateDirectory)/.d $(Objects) + @$(MakeDirCommand) $(@D) + @echo "" > $(IntermediateDirectory)/.d + @echo $(Objects0) > $(ObjectsFileList) + $(SharedObjectLinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions) + @$(MakeDirCommand) "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release" + @echo rebuilt > "/data/develop/Lib/Network/PSS-master/Build/Linux/.build-release/ZooClient" + +MakeIntermediateDirs: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + + +$(IntermediateDirectory)/.d: + @test -d $(WorkspacePath)/Linux_Bin/Temp || $(MakeDirCommand) $(WorkspacePath)/Linux_Bin/Temp + +PreBuild: + + +## +## Objects +## +$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(ObjectSuffix): ./ZooClient/ZooClient.cpp $(IntermediateDirectory)/ZooClient_ZooClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/ZooClient/ZooClient/ZooClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(DependSuffix): ./ZooClient/ZooClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(DependSuffix) -MM ./ZooClient/ZooClient.cpp + +$(IntermediateDirectory)/ZooClient_ZooClient.cpp$(PreprocessSuffix): ./ZooClient/ZooClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ZooClient_ZooClient.cpp$(PreprocessSuffix) ./ZooClient/ZooClient.cpp + +$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(ObjectSuffix): ./ZooClient/BaseCommand.cpp $(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/ZooClient/ZooClient/BaseCommand.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(DependSuffix): ./ZooClient/BaseCommand.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(DependSuffix) -MM ./ZooClient/BaseCommand.cpp + +$(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(PreprocessSuffix): ./ZooClient/BaseCommand.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ZooClient_BaseCommand.cpp$(PreprocessSuffix) ./ZooClient/BaseCommand.cpp + +$(IntermediateDirectory)/ZooClient_zkClient.cpp$(ObjectSuffix): ./ZooClient/zkClient.cpp $(IntermediateDirectory)/ZooClient_zkClient.cpp$(DependSuffix) + $(CXX) $(IncludePCH) $(SourceSwitch) "/data/develop/Lib/Network/PSS-master/purenessscopeserver/example-Module/ZooClient/ZooClient/zkClient.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/ZooClient_zkClient.cpp$(ObjectSuffix) $(IncludePath) +$(IntermediateDirectory)/ZooClient_zkClient.cpp$(DependSuffix): ./ZooClient/zkClient.cpp + @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/ZooClient_zkClient.cpp$(ObjectSuffix) -MF$(IntermediateDirectory)/ZooClient_zkClient.cpp$(DependSuffix) -MM ./ZooClient/zkClient.cpp + +$(IntermediateDirectory)/ZooClient_zkClient.cpp$(PreprocessSuffix): ./ZooClient/zkClient.cpp + $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/ZooClient_zkClient.cpp$(PreprocessSuffix) ./ZooClient/zkClient.cpp + + +-include $(IntermediateDirectory)/*$(DependSuffix) +## +## Clean +## +clean: + $(RM) -r $(WorkspacePath)/Linux_Bin/Temp/ + + diff --git a/purenessscopeserver/example-Module/ZooClient/ZooClient.mpc b/purenessscopeserver/example-Module/ZooClient/ZooClient.mpc deleted file mode 100644 index 658cff3c9..000000000 --- a/purenessscopeserver/example-Module/ZooClient/ZooClient.mpc +++ /dev/null @@ -1,28 +0,0 @@ -project(ZooClient):acelib{ - sharedname=ZooClient - dynamicflags += TEST_TCP_BUILD_DLL - libout = ./ - - Source_Files{ - ./*.cpp - } - specific (gnuace){ - macros += __LINUX__ - compile_flags += -Wno-deprecated - } - - specific(make) { - compile_flags += -fcheck-new - } - - specific (prop:microsoft){ - dllout = ../../PurenessScopeServer/Windows_Bin - } else { - dllout = ../../PurenessScopeServer/Linux_Bin - } - includes += . - includes += ../../Common - includes += /usr/local/include/zookeeper - libs += zookeeper_mt - libpaths += /usr/local/lib -} diff --git a/purenessscopeserver/example-Module/ZooClient/ZooClient.project b/purenessscopeserver/example-Module/ZooClient/ZooClient.project new file mode 100644 index 000000000..568a09ad6 --- /dev/null +++ b/purenessscopeserver/example-Module/ZooClient/ZooClient.project @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/purenessscopeserver/example-Module/ZooClient/ZooClient.txt b/purenessscopeserver/example-Module/ZooClient/ZooClient.txt new file mode 100644 index 000000000..76408a39c --- /dev/null +++ b/purenessscopeserver/example-Module/ZooClient/ZooClient.txt @@ -0,0 +1 @@ +../../../Build/Linux/Linux_Bin/Temp/ZooClient_ZooClient.cpp.o ../../../Build/Linux/Linux_Bin/Temp/ZooClient_BaseCommand.cpp.o ../../../Build/Linux/Linux_Bin/Temp/ZooClient_zkClient.cpp.o diff --git a/purenessscopeserver/example-Module/ZooClient/BaseCommand.cpp b/purenessscopeserver/example-Module/ZooClient/ZooClient/BaseCommand.cpp similarity index 100% rename from purenessscopeserver/example-Module/ZooClient/BaseCommand.cpp rename to purenessscopeserver/example-Module/ZooClient/ZooClient/BaseCommand.cpp diff --git a/purenessscopeserver/example-Module/ZooClient/BaseCommand.h b/purenessscopeserver/example-Module/ZooClient/ZooClient/BaseCommand.h similarity index 100% rename from purenessscopeserver/example-Module/ZooClient/BaseCommand.h rename to purenessscopeserver/example-Module/ZooClient/ZooClient/BaseCommand.h diff --git a/purenessscopeserver/example-Module/ZooClient/ZooClient.cpp b/purenessscopeserver/example-Module/ZooClient/ZooClient/ZooClient.cpp similarity index 100% rename from purenessscopeserver/example-Module/ZooClient/ZooClient.cpp rename to purenessscopeserver/example-Module/ZooClient/ZooClient/ZooClient.cpp diff --git a/purenessscopeserver/example-Module/ZooClient/zkClient.cpp b/purenessscopeserver/example-Module/ZooClient/ZooClient/zkClient.cpp similarity index 100% rename from purenessscopeserver/example-Module/ZooClient/zkClient.cpp rename to purenessscopeserver/example-Module/ZooClient/ZooClient/zkClient.cpp diff --git a/purenessscopeserver/example-Module/ZooClient/zkClient.h b/purenessscopeserver/example-Module/ZooClient/ZooClient/zkClient.h similarity index 100% rename from purenessscopeserver/example-Module/ZooClient/zkClient.h rename to purenessscopeserver/example-Module/ZooClient/ZooClient/zkClient.h diff --git a/purenessscopeserver/example-Module/ZooClient/runlinuxmake.sh b/purenessscopeserver/example-Module/ZooClient/runlinuxmake.sh deleted file mode 100644 index 3275c1680..000000000 --- a/purenessscopeserver/example-Module/ZooClient/runlinuxmake.sh +++ /dev/null @@ -1 +0,0 @@ -mwc.pl -type gnuace \ No newline at end of file diff --git a/purenessscopeserver/example-Module/ZooClient/zzz.bat b/purenessscopeserver/example-Module/ZooClient/zzz.bat deleted file mode 100644 index 68ea973f6..000000000 --- a/purenessscopeserver/example-Module/ZooClient/zzz.bat +++ /dev/null @@ -1 +0,0 @@ -%ACE_ROOT%/bin/mwc.pl -type vc11 diff --git a/testresult/result.md b/testresult/result.md index 6b3aecaec..dffe5af27 100644 --- a/testresult/result.md +++ b/testresult/result.md @@ -6,51 +6,51 @@ time cost(ms) - [Test CI run UTC time] 2019-03-08 03:56:02 + [Test CI run UTC time] 2019-03-27 02:13:02 single packet test 0 [s][127.0.0.1:10002]success. -0.672000ms +0.793000ms multiple packet test(10) 0 [s][127.0.0.1:10002]success. -1.680000ms +1.669000ms multiple connect test(10) 0 [s][127.0.0.1:10002]success. -5.189000ms +6.029000ms unvaild packet test 0 [s][127.0.0.1:10002]success.[Connection reset by peer] -0.326000ms +0.601000ms helf packet test 0 [s][127.0.0.1:10002]success. -0.315000ms +0.379000ms Muliple connect packet test 0 [s][127.0.0.1:10002]success. -4.219000ms +4.221000ms single UDP packet test 0 [s][127.0.0.1:10003]success. -0.074000ms +0.092000ms single UDP packet recv test 0 [s][127.0.0.1:20002]success. -0.120000ms +0.116000ms console command test 0 [s][127.0.0.1:10010]success. -0.656000ms +0.849000ms