diff --git a/uppdev/CzTest/CzTest.upp b/uppdev/CzTest/CzTest.upp new file mode 100644 index 000000000..14ccea71b --- /dev/null +++ b/uppdev/CzTest/CzTest.upp @@ -0,0 +1,10 @@ +uses + CtrlLib, + Report; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/CzTest/init b/uppdev/CzTest/init new file mode 100644 index 000000000..0e87ef365 --- /dev/null +++ b/uppdev/CzTest/init @@ -0,0 +1,5 @@ +#ifndef _CzTest_icpp_init_stub +#define _CzTest_icpp_init_stub +#include "CtrlLib/init" +#include "Report/init" +#endif diff --git a/uppdev/CzTest/main.cpp b/uppdev/CzTest/main.cpp new file mode 100644 index 000000000..fab408b4d --- /dev/null +++ b/uppdev/CzTest/main.cpp @@ -0,0 +1,36 @@ +#include + +using namespace Upp; + +GUI_APP_MAIN +{ + WString text = ReadClipboardUnicodeText(); + WString r; + const wchar *s = text; + while(*s) { + if(WString("hkrdtn").Find(*s) >= 0 && WString("yý").Find(s[1]) >= 0 || + WString("žščřcjďťňdtn").Find(*s) >= 0 && WString("ií").Find(s[1]) >= 0) { + r.Cat(*s); + r.Cat("_"); + s += 2; + if(*s == ' ') + r.Cat(' '); + } + else + if(s[0] == 'c' && s[1] == 'h' && WString("yý").Find(s[2]) >= 0) { + r.Cat("ch_"); + if(*s == ' ') + r.Cat(' '); + s += 3; + } + else { + r.Cat(*s); + if(*s == '.' && s[1] != ' ') + r.Cat(' '); + s++; + } + } + Report report; + report << "[R4/ " + DeQtfLf(r.ToString()); + Perform(report); +} diff --git a/uppdev/DropChoice/main.cpp b/uppdev/DropChoice/main.cpp index ce2baf8c5..07fc2fbde 100644 --- a/uppdev/DropChoice/main.cpp +++ b/uppdev/DropChoice/main.cpp @@ -8,8 +8,13 @@ GUI_APP_MAIN WithDropChoice edit; win.Add(edit.TopPos(0, 20).LeftPos(0, 100)); - edit.AddList("Ahoj!"); + edit.AddList("Hello there!"); edit.DropWidth(500); win.Run(); + + StringStream ss; + ss % edit; + String s = ss; + LOGHEXDUMP(s, s.GetCount()); } diff --git a/uppdev/SocketServer/SocketServer.cpp b/uppdev/SocketServer/SocketServer.cpp new file mode 100644 index 000000000..04e2c619a --- /dev/null +++ b/uppdev/SocketServer/SocketServer.cpp @@ -0,0 +1,26 @@ +#include + +using namespace Upp; + +CONSOLE_APP_MAIN +{ + Socket server; + if(!ServerSocket(server, 3214)) { + Cout() << "Unable to initialize server socket!\n"; + SetExitCode(1); + return; + } + Cout() << "Waiting for requests..\n"; + for(;;) { + Socket s; + if(server.Accept(s)) { + String w = s.ReadUntil('\n'); + Cout() << "Request: " << w << " from: " << s.GetPeerName() << '\n'; + if(w == "time") + s.Write(AsString(GetSysTime())); + else + s.Write(AsString(3 * atoi(~w))); + s.Write("\n"); + } + } +} diff --git a/uppdev/SocketServer/SocketServer.upp b/uppdev/SocketServer/SocketServer.upp new file mode 100644 index 000000000..2616342c5 --- /dev/null +++ b/uppdev/SocketServer/SocketServer.upp @@ -0,0 +1,12 @@ +description "Example of using server Socket - its counterpart is SocketClient\377"; + +uses + Core, + Web; + +file + SocketServer.cpp; + +mainconfig + "" = ""; + diff --git a/uppdev/SocketServer/init b/uppdev/SocketServer/init new file mode 100644 index 000000000..6cefabdd0 --- /dev/null +++ b/uppdev/SocketServer/init @@ -0,0 +1,5 @@ +#ifndef _SocketServer_icpp_init_stub +#define _SocketServer_icpp_init_stub +#include "Core/init" +#include "Web/init" +#endif