From 952de51170b060a41067abf267dcd61d37d7d8c2 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 8 Sep 2014 16:48:09 +0100 Subject: [PATCH 01/13] Removed async console FDs. --- lib/pure/asyncfile.nim | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/lib/pure/asyncfile.nim b/lib/pure/asyncfile.nim index 6c8a871841..e861c6e483 100644 --- a/lib/pure/asyncfile.nim +++ b/lib/pure/asyncfile.nim @@ -34,26 +34,7 @@ type fd: TAsyncFd offset: int64 -# TODO: These will be nil in other threads? -var - asyncStdin* {.threadvar.}: AsyncFile ## Asynchronous stdin handle - asyncStdout* {.threadvar.}: AsyncFile ## Asynchronous stdout handle - asyncStderr* {.threadvar.}: AsyncFile ## Asynchronous stderr handle - when defined(windows): - asyncStdin = AsyncFile( - fd: getStdHandle(STD_INPUT_HANDLE).TAsyncFd, - offset: 0 - ) - asyncStdout = AsyncFile( - fd: getStdHandle(STD_OUTPUT_HANDLE).TAsyncFd, - offset: 0 - ) - asyncStderr = AsyncFile( - fd: getStdHandle(STD_ERROR_HANDLE).TAsyncFd, - offset: 0 - ) - proc getDesiredAccess(mode: TFileMode): int32 = case mode of fmRead: @@ -73,19 +54,6 @@ when defined(windows): else: CREATE_NEW else: - asyncStdin = AsyncFile( - fd: STDIN_FILENO.TAsyncFd, - offset: 0 - ) - asyncStdout = AsyncFile( - fd: STDOUT_FILENO.TAsyncFd, - offset: 0 - ) - asyncStderr = AsyncFile( - fd: STDERR_FILENO.TAsyncFd, - offset: 0 - ) - proc getPosixFlags(mode: TFileMode): cint = case mode of fmRead: @@ -100,7 +68,7 @@ else: result = O_RDWR result = result or O_NONBLOCK -proc getFileSize*(f: AsyncFile): int64 = +proc getFileSize(f: AsyncFile): int64 = ## Retrieves the specified file's size. when defined(windows): var high: DWord From 6689fa68f5ee3868b128b308cb237be5c4aa5d98 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 8 Sep 2014 22:04:09 +0100 Subject: [PATCH 02/13] Multiple exception idents in except for async. Ref #1487. --- lib/pure/asyncdispatch.nim | 63 +++++++++++++++++++++++--------------- tests/async/tasyncfile.nim | 2 +- tests/async/tasynctry.nim | 51 ++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 25 deletions(-) create mode 100644 tests/async/tasynctry.nim diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index e521b8e647..1cf54b9229 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -972,29 +972,44 @@ template createCb*(retFutureSym, iteratorNameSym, cb() #{.pop.} proc generateExceptionCheck(futSym, - exceptBranch, rootReceiver, fromNode: PNimrodNode): PNimrodNode {.compileTime.} = - if exceptBranch == nil: + tryStmt, rootReceiver, fromNode: PNimrodNode): PNimrodNode {.compileTime.} = + if tryStmt.len == 1: result = rootReceiver else: - if exceptBranch[0].kind == nnkStmtList: - result = newIfStmt( - (newDotExpr(futSym, newIdentNode("failed")), - exceptBranch[0] - ) - ) - else: - expectKind(exceptBranch[1], nnkStmtList) - result = newIfStmt( - (newDotExpr(futSym, newIdentNode("failed")), - newIfStmt( - (infix(newDotExpr(futSym, newIdentNode("error")), "of", exceptBranch[0]), - exceptBranch[1]) - ) - ) - ) + var exceptionChecks: seq[tuple[cond, body: PNimrodNode]] = @[] + let errorNode = newDotExpr(futSym, newIdentNode("error")) + for i in 1 .. -> else: raise futSym.error + exceptionChecks.add((newIdentNode("true"), + newNimNode(nnkRaiseStmt).add(errorNode))) + # Read the future if there is no error. + # -> else: futSym.read let elseNode = newNimNode(nnkElse, fromNode) elseNode.add newNimNode(nnkStmtList, fromNode) elseNode[0].add rootReceiver + result = newIfStmt( + (newDotExpr(futSym, newIdentNode("failed")), newIfStmt(exceptionChecks)) + ) result.add elseNode template createVar(result: var PNimrodNode, futSymName: string, @@ -1006,11 +1021,11 @@ template createVar(result: var PNimrodNode, futSymName: string, result.add newVarStmt(futSym, asyncProc) # -> var future = y result.add newNimNode(nnkYieldStmt, fromNode).add(futSym) # -> yield future valueReceiver = newDotExpr(futSym, newIdentNode("read")) # -> future.read - result.add generateExceptionCheck(futSym, exceptBranch, rootReceiver, fromNode) + result.add generateExceptionCheck(futSym, tryStmt, rootReceiver, fromNode) proc processBody(node, retFutureSym: PNimrodNode, subTypeIsVoid: bool, - exceptBranch: PNimrodNode): PNimrodNode {.compileTime.} = + tryStmt: PNimrodNode): PNimrodNode {.compileTime.} = #echo(node.treeRepr) result = node case node.kind @@ -1024,7 +1039,7 @@ proc processBody(node, retFutureSym: PNimrodNode, result.add newCall(newIdentNode("complete"), retFutureSym) else: result.add newCall(newIdentNode("complete"), retFutureSym, - node[0].processBody(retFutureSym, subTypeIsVoid, exceptBranch)) + node[0].processBody(retFutureSym, subTypeIsVoid, tryStmt)) result.add newNimNode(nnkReturnStmt, node).add(newNilLit()) return # Don't process the children of this return stmt @@ -1079,7 +1094,7 @@ proc processBody(node, retFutureSym: PNimrodNode, res: PNimrodNode): bool {.compileTime.} = result = false while i < n[0].len: - var processed = processBody(n[0][i], retFutureSym, subTypeIsVoid, n[1]) + var processed = processBody(n[0][i], retFutureSym, subTypeIsVoid, n) if processed.kind != n[0][i].kind or processed.len != n[0][i].len: expectKind(processed, nnkStmtList) expectKind(processed[2][1], nnkElse) @@ -1099,7 +1114,7 @@ proc processBody(node, retFutureSym: PNimrodNode, else: discard for i in 0 .. Date: Tue, 9 Sep 2014 01:16:28 +0100 Subject: [PATCH 03/13] Implements getCurrentException for try in async procs. Ref #1487. --- lib/pure/asyncdispatch.nim | 17 ++++++++++++----- lib/system.nim | 6 ++++++ tests/async/tasynctry.nim | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index 1cf54b9229..f3d37f9d2a 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -973,7 +973,7 @@ template createCb*(retFutureSym, iteratorNameSym, #{.pop.} proc generateExceptionCheck(futSym, tryStmt, rootReceiver, fromNode: PNimrodNode): PNimrodNode {.compileTime.} = - if tryStmt.len == 1: + if tryStmt.kind == nnkNilLit: result = rootReceiver else: var exceptionChecks: seq[tuple[cond, body: PNimrodNode]] = @[] @@ -1007,8 +1007,14 @@ proc generateExceptionCheck(futSym, let elseNode = newNimNode(nnkElse, fromNode) elseNode.add newNimNode(nnkStmtList, fromNode) elseNode[0].add rootReceiver + + let ifBody = newStmtList() + ifBody.add newCall(newIdentNode("setCurrentException"), errorNode) + ifBody.add newIfStmt(exceptionChecks) + ifBody.add newCall(newIdentNode("setCurrentException"), newNilLit()) + result = newIfStmt( - (newDotExpr(futSym, newIdentNode("failed")), newIfStmt(exceptionChecks)) + (newDotExpr(futSym, newIdentNode("failed")), ifBody) ) result.add elseNode @@ -1224,6 +1230,8 @@ proc recvLine*(socket: TAsyncFD): Future[string] {.async.} = ## If the socket is disconnected in the middle of a line (before ``\r\L`` ## is read) then line will be set to ``""``. ## The partial line **will be lost**. + ## + ## **Warning**: This assumes that lines are delimited by ``\r\l``. template addNLIfEmpty(): stmt = if result.len == 0: @@ -1236,9 +1244,8 @@ proc recvLine*(socket: TAsyncFD): Future[string] {.async.} = if c.len == 0: return "" if c == "\r": - c = await recv(socket, 1, {SocketFlag.SafeDisconn, SocketFlag.Peek}) - if c.len > 0 and c == "\L": - discard await recv(socket, 1) + c = await recv(socket, 1) + assert c == "\l" addNLIfEmpty() return elif c == "\L": diff --git a/lib/system.nim b/lib/system.nim index 9153af16ce..ad99306ad7 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -2630,6 +2630,12 @@ when not defined(JS): #and not defined(NimrodVM): excHandler.hasRaiseAction = true excHandler.raiseAction = action + proc setCurrentException*(exc: ref Exception) {.inline, gcsafe.} = + ## sets the current exception. + ## + ## **Warning**: Only use this if you know what you are doing. + currException = exc + {.push stack_trace: off, profiler:off.} when defined(endb) and not defined(NimrodVM): include "system/debugger" diff --git a/tests/async/tasynctry.nim b/tests/async/tasynctry.nim index aa7be0b684..66ea40d498 100644 --- a/tests/async/tasynctry.nim +++ b/tests/async/tasynctry.nim @@ -2,7 +2,7 @@ discard """ file: "tasynctry.nim" exitcode: 0 output: ''' -Generic except +Generic except: Test Specific except Multiple idents in except Multiple except branches @@ -22,7 +22,7 @@ proc catch() {.async.} = try: await foobar() except: - echo("Generic except") + echo("Generic except: ", getCurrentExceptionMsg()) try: await foobar() From 56f11e2c955b710000374d7eb20a3e1fe3a075f7 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 9 Sep 2014 01:17:07 +0100 Subject: [PATCH 04/13] Fixes async tests. --- tests/async/tasyncawait.nim | 10 +++++----- tests/async/tasyncexceptions.nim | 6 +++--- tests/async/tnestedpfuturetypeparam.nim | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/async/tasyncawait.nim b/tests/async/tasyncawait.nim index ec05a03861..efb6f0c256 100644 --- a/tests/async/tasyncawait.nim +++ b/tests/async/tasyncawait.nim @@ -47,18 +47,18 @@ proc readMessages(client: TAsyncFD) {.async.} = proc createServer(port: TPort) {.async.} = var server = newAsyncRawSocket() block: - var name: TSockaddr_in + var name: Sockaddr_in when defined(windows): name.sin_family = toInt(AF_INET).int16 else: name.sin_family = toInt(AF_INET) name.sin_port = htons(int16(port)) name.sin_addr.s_addr = htonl(INADDR_ANY) - if bindAddr(server.TSocketHandle, cast[ptr TSockAddr](addr(name)), - sizeof(name).TSocklen) < 0'i32: - osError(osLastError()) + if bindAddr(server.SocketHandle, cast[ptr SockAddr](addr(name)), + sizeof(name).Socklen) < 0'i32: + raiseOSError(osLastError()) - discard server.TSocketHandle.listen() + discard server.SocketHandle.listen() while true: var client = await accept(server) asyncCheck readMessages(client) diff --git a/tests/async/tasyncexceptions.nim b/tests/async/tasyncexceptions.nim index ca73c6a3d1..30ef417564 100644 --- a/tests/async/tasyncexceptions.nim +++ b/tests/async/tasyncexceptions.nim @@ -1,15 +1,15 @@ discard """ file: "tasyncexceptions.nim" exitcode: 1 - outputsub: "Error: unhandled exception: foobar [E_Base]" + outputsub: "Error: unhandled exception: foobar [Exception]" """ import asyncdispatch -proc accept(): PFuture[int] {.async.} = +proc accept(): Future[int] {.async.} = await sleepAsync(100) result = 4 -proc recvLine(fd: int): PFuture[string] {.async.} = +proc recvLine(fd: int): Future[string] {.async.} = await sleepAsync(100) return "get" diff --git a/tests/async/tnestedpfuturetypeparam.nim b/tests/async/tnestedpfuturetypeparam.nim index 1db442170b..bf346ff8ec 100644 --- a/tests/async/tnestedpfuturetypeparam.nim +++ b/tests/async/tnestedpfuturetypeparam.nim @@ -1,8 +1,8 @@ import asyncdispatch, asyncnet proc main {.async.} = - proc f: PFuture[seq[int]] {.async.} = - await newAsyncSocket().connect("www.google.com", TPort(80)) + proc f: Future[seq[int]] {.async.} = + await newAsyncSocket().connect("www.google.com", Port(80)) let x = await f() asyncCheck main() From 4db65350250c3350351298d9962a9e66404b3ef6 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 9 Sep 2014 11:43:54 +0100 Subject: [PATCH 05/13] Fixes for new comment handling. --- lib/pure/asyncdispatch.nim | 1 + lib/pure/asyncio.nim | 1 + tests/vm/tasmparser.nim | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pure/asyncdispatch.nim b/lib/pure/asyncdispatch.nim index f3d37f9d2a..5363d88624 100644 --- a/lib/pure/asyncdispatch.nim +++ b/lib/pure/asyncdispatch.nim @@ -796,6 +796,7 @@ else: else: # FD no longer a part of the selector. Likely been closed # (e.g. socket disconnected). + discard processTimers(p) diff --git a/lib/pure/asyncio.nim b/lib/pure/asyncio.nim index 9299b73704..10be5e4090 100644 --- a/lib/pure/asyncio.nim +++ b/lib/pure/asyncio.nim @@ -247,6 +247,7 @@ proc asyncSockHandleWrite(h: RootRef) = # Apparently the socket cannot be written to. Even though select # just told us that it can be... This used to be an assert. Just # do nothing instead. + discard elif bytesSent != sock.sendBuffer.len: sock.sendBuffer = sock.sendBuffer[bytesSent .. -1] elif bytesSent == sock.sendBuffer.len: diff --git a/tests/vm/tasmparser.nim b/tests/vm/tasmparser.nim index 24ccb2ec82..67313c8580 100644 --- a/tests/vm/tasmparser.nim +++ b/tests/vm/tasmparser.nim @@ -37,7 +37,7 @@ proc asmx64 () {.compileTime} = proc abortAsmParse (err:string) = - # + discard let codeLen = code.len #let codeEnd = codeLen-1 From 4fc8fcf37c61529e2c9ad2827df18254a0fc8fd2 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 9 Sep 2014 11:44:19 +0100 Subject: [PATCH 06/13] Mentioned new comment handling in news.txt. --- web/news.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/news.txt b/web/news.txt index 3b48140e5a..98d703cfd2 100644 --- a/web/news.txt +++ b/web/news.txt @@ -31,7 +31,8 @@ News will disappear soon! - ``system.fileHandle`` has been renamed to ``system.getFileHandle`` to prevent name conflicts with the new type ``FileHandle``. - + - Comments are now not part of the AST, as such you cannot use them in place + of ``discard``. Language Additions ------------------ From 00b6a144894945d92fe3747fdf9bad32a4aec8d8 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 9 Sep 2014 15:58:44 +0100 Subject: [PATCH 07/13] More empty stmt fixes. --- lib/pure/asynchttpserver.nim | 1 + tests/async/tasyncawait.nim | 11 ++--------- tests/async/tasyncdiscard.nim | 4 ++-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/pure/asynchttpserver.nim b/lib/pure/asynchttpserver.nim index 70a865ed59..931a0c15af 100644 --- a/lib/pure/asynchttpserver.nim +++ b/lib/pure/asynchttpserver.nim @@ -183,6 +183,7 @@ proc processClient(client: PAsyncSocket, address: string, # header states otherwise. # In HTTP 1.0 we assume that the connection should not be persistent. # Unless the connection header states otherwise. + discard else: request.client.close() break diff --git a/tests/async/tasyncawait.nim b/tests/async/tasyncawait.nim index efb6f0c256..5165b0f06e 100644 --- a/tests/async/tasyncawait.nim +++ b/tests/async/tasyncawait.nim @@ -21,15 +21,8 @@ proc launchSwarm(port: TPort) {.async.} = var sock = newAsyncRawSocket() await connect(sock, "localhost", port) - when true: - await sendMessages(sock) - closeSocket(sock) - else: - # Issue #932: https://github.com/Araq/Nim/issues/932 - var msgFut = sendMessages(sock) - msgFut.callback = - proc () = - closeSocket(sock) + await sendMessages(sock) + closeSocket(sock) proc readMessages(client: TAsyncFD) {.async.} = while true: diff --git a/tests/async/tasyncdiscard.nim b/tests/async/tasyncdiscard.nim index 966851acc7..71aba29e2d 100644 --- a/tests/async/tasyncdiscard.nim +++ b/tests/async/tasyncdiscard.nim @@ -13,7 +13,7 @@ discard """ import asyncio, asyncdispatch, asyncnet proc main {.async.} = - proc f: PFuture[int] {.async.} = + proc f: Future[int] {.async.} = discard echo 1 discard @@ -24,7 +24,7 @@ proc main {.async.} = echo x echo 3 - proc g: PFuture[int] {.async.} = + proc g: Future[int] {.async.} = discard echo 4 discard From fce0a89aa0786782f466e4998bd7798de3da007b Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 9 Sep 2014 16:19:52 +0100 Subject: [PATCH 08/13] Added more information to the news. --- web/news.txt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/web/news.txt b/web/news.txt index 98d703cfd2..0b4c98b73d 100644 --- a/web/news.txt +++ b/web/news.txt @@ -14,8 +14,12 @@ News ``threadpool``. - The symbol binding rules in generics changed: ``bar`` in ``foo.bar`` is now considered for implicit early binding. - - ``c2nim`` moved into its own repository and is now a Babel package. - - ``pas2nim`` moved into its own repository and is now a Babel package. + - ``c2nim`` moved into its own + `repository `_ + and is now a Nimble package. + - ``pas2nim`` moved into its own + `repository `_ + and is now a Nimble package. - ``system.$`` for floating point types now produces a human friendly string representation. - ``uri.TUrl`` as well as the ``parseurl`` module are now deprecated in favour @@ -33,6 +37,13 @@ News prevent name conflicts with the new type ``FileHandle``. - Comments are now not part of the AST, as such you cannot use them in place of ``discard``. + - The ``irc`` module has been moved into its own + `repository `_ + and is now a Nimble package. + - Many wrappers have been moved into their own repositories and are now + Nimble packages including ``lua``, ``opengl``, ``x11``, ``nim-zmq``, + ``gtk2``, ``mongo``, ``cairo``, ``tcl`` and ``python``. They can be + found under the `nim-code `_ organisation. Language Additions ------------------ From 205b765fdd570bf90faf2c78db892d977244b9bd Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 10 Sep 2014 00:01:32 +0100 Subject: [PATCH 09/13] Fixes case in cgi module. --- lib/pure/cgi.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pure/cgi.nim b/lib/pure/cgi.nim index b30f8dd337..14c7c56b53 100644 --- a/lib/pure/cgi.nim +++ b/lib/pure/cgi.nim @@ -31,7 +31,7 @@ import strutils, os, strtabs, cookies -proc URLencode*(s: string): string = +proc urlEncode*(s: string): string = ## Encodes a value to be HTTP safe: This means that characters in the set ## ``{'A'..'Z', 'a'..'z', '0'..'9', '_'}`` are carried over to the result, ## a space is converted to ``'+'`` and every other character is encoded as @@ -52,7 +52,7 @@ proc handleHexChar(c: char, x: var int) {.inline.} = of 'A'..'F': x = (x shl 4) or (ord(c) - ord('A') + 10) else: assert(false) -proc URLdecode*(s: string): string = +proc urlDecode*(s: string): string = ## Decodes a value from its HTTP representation: This means that a ``'+'`` ## is converted to a space, ``'%xx'`` (where ``xx`` denotes a hexadecimal ## value) is converted to the character with ordinal number ``xx``, and @@ -82,7 +82,7 @@ proc addXmlChar(dest: var string, c: char) {.inline.} = of '\"': add(dest, """) else: add(dest, c) -proc XMLencode*(s: string): string = +proc xmlEncode*(s: string): string = ## Encodes a value to be XML safe: ## * ``"`` is replaced by ``"`` ## * ``<`` is replaced by ``<`` @@ -331,9 +331,9 @@ proc setTestData*(keysvalues: varargs[string]) = var i = 0 var query = "" while i < keysvalues.len: - add(query, URLencode(keysvalues[i])) + add(query, urlEncode(keysvalues[i])) add(query, '=') - add(query, URLencode(keysvalues[i+1])) + add(query, urlEncode(keysvalues[i+1])) add(query, '&') inc(i, 2) putEnv("QUERY_STRING", query) From 6cc443712b65a4865ee0d4e4a28d22a947c7d77e Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 10 Sep 2014 00:04:07 +0100 Subject: [PATCH 10/13] Changes source build recommendations on website. --- web/download.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/download.txt b/web/download.txt index 5577882174..6d860b3328 100644 --- a/web/download.txt +++ b/web/download.txt @@ -121,8 +121,8 @@ Bleeding edge binaries are available from the `Nimrod build farm `_ branch:: +Use the following commands to build the compiler from source. +Change the branch to suit your needs:: git clone -b master git://github.com/Araq/Nimrod.git cd Nimrod From 4d2ff282f625efa0607b30b448cf0909799bf18b Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 10 Sep 2014 00:09:59 +0100 Subject: [PATCH 11/13] Fix case issues in compiler/docgen. --- compiler/docgen.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 4e576867b8..c34332b57f 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -374,11 +374,11 @@ proc genItem(d: PDoc, n, nameNode: PNode, k: TSymKind) = cleanPlainSymbol = renderPlainSymbolName(nameNode) complexSymbol = complexName(k, n, cleanPlainSymbol) plainSymbolRope = toRope(cleanPlainSymbol) - plainSymbolEncRope = toRope(URLencode(cleanPlainSymbol)) + plainSymbolEncRope = toRope(urlEncode(cleanPlainSymbol)) itemIDRope = toRope(d.id) symbolOrId = d.newUniquePlainSymbol(complexSymbol) symbolOrIdRope = symbolOrId.toRope - symbolOrIdEncRope = URLencode(symbolOrId).toRope + symbolOrIdEncRope = urlEncode(symbolOrId).toRope var seeSrcRope: PRope = nil let docItemSeeSrc = getConfigVar("doc.item.seesrc") From 0b229fae77b17ef5e9f1622d9992da27ec1a5c61 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 10 Sep 2014 00:17:29 +0100 Subject: [PATCH 12/13] Fixes tester. --- tests/testament/htmlgen.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim index d863bd4113..b9eda5383d 100644 --- a/tests/testament/htmlgen.nim +++ b/tests/testament/htmlgen.nim @@ -107,7 +107,7 @@ div.tabContent.hide { display: none; } HtmlEnd = "" proc td(s: string): string = - result = "" & s.substr(0, 200).XMLEncode & "" + result = "" & s.substr(0, 200).xmlEncode & "" proc getCommit(db: TDbConn, c: int): string = var commit = c From 055ed5149fba025f210022acea5a0b31b221b521 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 10 Sep 2014 00:42:40 +0100 Subject: [PATCH 13/13] Add depraction warnings for URLencode/decode. --- lib/pure/cgi.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/pure/cgi.nim b/lib/pure/cgi.nim index 14c7c56b53..d5690bf510 100644 --- a/lib/pure/cgi.nim +++ b/lib/pure/cgi.nim @@ -99,7 +99,8 @@ type methodPost, ## query uses the POST method methodGet ## query uses the GET method -{.deprecated: [TRequestMethod: RequestMethod, ECgi: CgiError].} +{.deprecated: [TRequestMethod: RequestMethod, ECgi: CgiError, + URLencode: urlEncode, XMLencode: xmlEncode, URLdecode: urlDecode].} proc cgiError*(msg: string) {.noreturn.} = ## raises an ECgi exception with message `msg`.