diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-01-26 01:38:45 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-01-26 01:38:45 +0200 |
commit | 5d712e0d3f9f5b8e486720c8bedd749656b527d8 (patch) | |
tree | c021fc94967717fb6fa56d50271655c99875ae94 /lib | |
parent | 5a6030a16bf74ee7de92117c5b2d7310b8b36d28 (diff) | |
parent | ad74332a9221b17db84de6eca55f19b67a3ec81f (diff) | |
download | Nim-5d712e0d3f9f5b8e486720c8bedd749656b527d8.tar.gz |
Merge branch 'devel' of https://www.github.com/Araq/Nimrod into devel
Diffstat (limited to 'lib')
-rw-r--r-- | lib/core/macros.nim | 4 | ||||
-rw-r--r-- | lib/pure/asyncio.nim | 18 | ||||
-rw-r--r-- | lib/pure/ftpclient.nim | 20 | ||||
-rw-r--r-- | lib/pure/os.nim | 2 | ||||
-rw-r--r-- | lib/pure/osproc.nim | 8 | ||||
-rw-r--r-- | lib/system.nim | 2 | ||||
-rw-r--r-- | lib/system/excpt.nim | 6 |
7 files changed, 30 insertions, 30 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 7cb084653..3b36e31e0 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -390,7 +390,7 @@ proc treeRepr*(n: PNimrodNode): string {.compileTime.} = res.add(($n.kind).substr(3)) case n.kind - of nnkEmpty: nil # same as nil node in this representation + of nnkEmpty: discard # same as nil node in this representation of nnkNilLit: res.add(" nil") of nnkCharLit..nnkInt64Lit: res.add(" " & $n.intVal) of nnkFloatLit..nnkFloat64Lit: res.add(" " & $n.floatVal) @@ -415,7 +415,7 @@ proc lispRepr*(n: PNimrodNode): string {.compileTime.} = add(result, "(") case n.kind - of nnkEmpty: nil # same as nil node in this representation + of nnkEmpty: discard # same as nil node in this representation of nnkNilLit: add(result, "nil") of nnkCharLit..nnkInt64Lit: add(result, $n.intVal) of nnkFloatLit..nnkFloat64Lit: add(result, $n.floatVal) diff --git a/lib/pure/asyncio.nim b/lib/pure/asyncio.nim index 3c2a5c17a..f13cadaa2 100644 --- a/lib/pure/asyncio.nim +++ b/lib/pure/asyncio.nim @@ -139,27 +139,27 @@ type proc newDelegate*(): PDelegate = ## Creates a new delegate. new(result) - result.handleRead = (proc (h: PObject) = nil) - result.handleWrite = (proc (h: PObject) = nil) - result.handleError = (proc (h: PObject) = nil) + result.handleRead = (proc (h: PObject) = discard) + result.handleWrite = (proc (h: PObject) = discard) + result.handleError = (proc (h: PObject) = discard) result.hasDataBuffered = (proc (h: PObject): bool = return false) - result.task = (proc (h: PObject) = nil) + result.task = (proc (h: PObject) = discard) result.mode = fmRead proc newAsyncSocket(): PAsyncSocket = new(result) result.info = SockIdle - result.handleRead = (proc (s: PAsyncSocket) = nil) + result.handleRead = (proc (s: PAsyncSocket) = discard) result.handleWrite = nil - result.handleConnect = (proc (s: PAsyncSocket) = nil) - result.handleAccept = (proc (s: PAsyncSocket) = nil) - result.handleTask = (proc (s: PAsyncSocket) = nil) + result.handleConnect = (proc (s: PAsyncSocket) = discard) + result.handleAccept = (proc (s: PAsyncSocket) = discard) + result.handleTask = (proc (s: PAsyncSocket) = discard) result.lineBuffer = "".TaintedString result.sendBuffer = "" -proc AsyncSocket*(domain: TDomain = AF_INET, typ: TType = SOCK_STREAM, +proc asyncSocket*(domain: TDomain = AF_INET, typ: TType = SOCK_STREAM, protocol: TProtocol = IPPROTO_TCP, buffered = true): PAsyncSocket = ## Initialises an AsyncSocket object. If a socket cannot be initialised diff --git a/lib/pure/ftpclient.nim b/lib/pure/ftpclient.nim index d9f9dfd3d..f136e0016 100644 --- a/lib/pure/ftpclient.nim +++ b/lib/pure/ftpclient.nim @@ -95,7 +95,7 @@ type EInvalidReply* = object of ESynch EFTP* = object of ESynch -proc FTPClient*(address: string, port = TPort(21), +proc ftpClient*(address: string, port = TPort(21), user, pass = ""): PFTPClient = ## Create a ``PFTPClient`` object. new(result) @@ -315,7 +315,7 @@ proc listDirs*(ftp: PFTPClient, dir: string = "", assertReply ftp.send("NLST " & dir.normalizePathSep), ["125", "150"] if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard result = splitLines(ftp.job.lines) ftp.deleteJob() else: return @[] @@ -390,7 +390,7 @@ proc list*(ftp: PFTPClient, dir: string = "", async = false): string = assertReply(ftp.send("LIST" & " " & dir.normalizePathSep), ["125", "150"]) if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard result = ftp.job.lines ftp.deleteJob() else: @@ -405,7 +405,7 @@ proc retrText*(ftp: PFTPClient, file: string, async = false): string = assertReply ftp.send("RETR " & file.normalizePathSep), ["125", "150"] if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard result = ftp.job.lines ftp.deleteJob() else: @@ -460,7 +460,7 @@ proc retrFile*(ftp: PFTPClient, file, dest: string, async = false) = ftp.job.filename = file.normalizePathSep if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard ftp.deleteJob() proc doUpload(ftp: PFTPClient, async = false): bool = @@ -518,7 +518,7 @@ proc store*(ftp: PFTPClient, file, dest: string, async = false) = assertReply ftp.send("STOR " & dest.normalizePathSep), ["125", "150"] if not async: - while not ftp.job.prc(ftp, false): nil + while not ftp.job.prc(ftp, false): discard ftp.deleteJob() proc close*(ftp: PFTPClient) = @@ -554,10 +554,10 @@ proc csockHandleRead(s: PAsyncSocket, ftp: PAsyncFTPClient) = ftp.handleEvent(ftp, r) -proc AsyncFTPClient*(address: string, port = TPort(21), +proc asyncFTPClient*(address: string, port = TPort(21), user, pass = "", handleEvent: proc (ftp: PAsyncFTPClient, ev: TFTPEvent) {.closure.} = - (proc (ftp: PAsyncFTPClient, ev: TFTPEvent) = nil)): PAsyncFTPClient = + (proc (ftp: PAsyncFTPClient, ev: TFTPEvent) = discard)): PAsyncFTPClient = ## Create a ``PAsyncFTPClient`` object. ## ## Use this if you want to use asyncio's dispatcher. @@ -604,7 +604,7 @@ when isMainModule: ftp.close() echo d.len else: assert(false) - var ftp = AsyncFTPClient("picheta.me", user = "test", pass = "asf", handleEvent = hev) + var ftp = asyncFTPClient("picheta.me", user = "test", pass = "asf", handleEvent = hev) d.register(ftp) d.len.echo() @@ -618,7 +618,7 @@ when isMainModule: when isMainModule and false: - var ftp = FTPClient("picheta.me", user = "asdasd", pass = "asfwq") + var ftp = ftpClient("picheta.me", user = "asdasd", pass = "asfwq") ftp.connect() echo ftp.pwd() echo ftp.list() diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 448ecc1e3..1f42d0d58 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1586,7 +1586,7 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [FReadIO].} = # little heuristic that may work on other POSIX-like systems: result = string(getEnv("_")) if len(result) == 0: - result = string(ParamStr(0)) + result = string(paramStr(0)) # POSIX guaranties that this contains the executable # as it has been executed by the calling process if len(result) > 0 and result[0] != DirSep: # not an absolute path? diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index 6c43dc2d9..676707abb 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -660,8 +660,8 @@ elif not defined(useNimRtl): else: - Pid = fork() - if Pid < 0: osError(osLastError()) + pid = fork() + if pid < 0: osError(osLastError()) if pid == 0: ## child process: @@ -685,14 +685,14 @@ elif not defined(useNimRtl): if env == nil: discard execv(command, a) else: - discard execve(command, a, ToCStringArray(env)) + discard execve(command, a, toCStringArray(env)) else: var x = addCmdArgs(command, args) var a = toCStringArray(["sh", "-c"], [x]) if env == nil: discard execv("/bin/sh", a) else: - discard execve("/bin/sh", a, ToCStringArray(env)) + discard execve("/bin/sh", a, toCStringArray(env)) # too risky to raise an exception here: quit("execve call failed: " & $strerror(errno)) # Parent process. Copy process information. diff --git a/lib/system.nim b/lib/system.nim index de23a71fa..09e44a45a 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -1330,7 +1330,7 @@ iterator `||`*[S, T](a: S, b: T, annotation=""): T {. ## such isn't aware of the parallelism in your code! Be careful! Later ## versions of ``||`` will get proper support by Nimrod's code generator ## and GC. - nil + discard {.push stackTrace:off.} proc min*(x, y: int): int {.magic: "MinI", noSideEffect.} = diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index 1964e4d3d..a3f6669d4 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -11,7 +11,7 @@ # use the heap (and nor exceptions) do not include the GC or memory allocator. var - errorMessageWriter*: (proc(msg: string): void {.tags: [FWriteIO].}) + errorMessageWriter*: (proc(msg: string) {.tags: [FWriteIO].}) ## Function that will be called ## instead of stdmsg.write when printing stacktrace. ## Unstable API. @@ -80,9 +80,9 @@ when defined(nativeStacktrace) and nativeStackTraceSupported: type TDl_info {.importc: "Dl_info", header: "<dlfcn.h>", final, pure.} = object - dli_fname: CString + dli_fname: cstring dli_fbase: pointer - dli_sname: CString + dli_sname: cstring dli_saddr: pointer proc backtrace(symbols: ptr pointer, size: int): int {. |