summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-10-05 03:06:19 +0200
committerAraq <rumpf_a@web.de>2014-10-05 03:06:19 +0200
commita9a5766c665c1d88f61669d562483fc8794d3960 (patch)
tree44b3db27d26449844c01d343bc35c901a86406e4 /lib/pure
parentfc47c0edc76d1d8460fa0d1b384b97b7f2c92934 (diff)
downloadNim-a9a5766c665c1d88f61669d562483fc8794d3960.tar.gz
docgen should work again
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/ftpclient.nim15
-rw-r--r--lib/pure/json.nim58
-rw-r--r--lib/pure/logging.nim5
3 files changed, 41 insertions, 37 deletions
diff --git a/lib/pure/ftpclient.nim b/lib/pure/ftpclient.nim
index 37b25871d..975eae7e2 100644
--- a/lib/pure/ftpclient.nim
+++ b/lib/pure/ftpclient.nim
@@ -446,13 +446,14 @@ proc getFile[T](ftp: FtpBase[T], async = false): bool =
       ftp.job.file.write(r2)
     elif returned and r2 == "":
       ftp.dsockConnected = false
-  
-  if not async:
-    var readSocks: seq[TSocket] = @[ftp.csock]
-    blockingOperation(ftp.csock):
-      if readSocks.select(1) != 0 and ftp.csock in readSocks:
-        assertReply ftp.expectReply(), "226"
-        return true
+
+  when T is TSocket:
+    if not async:
+      var readSocks: seq[TSocket] = @[ftp.csock]
+      blockingOperation(ftp.csock):
+        if readSocks.select(1) != 0 and ftp.csock in readSocks:
+          assertReply ftp.expectReply(), "226"
+          return true
 
 proc retrFile*[T](ftp: FtpBase[T], file, dest: string, async = false) =
   ## Downloads ``file`` and saves it to ``dest``. Usage of this function
diff --git a/lib/pure/json.nim b/lib/pure/json.nim
index 8bd05ad55..385787d6c 100644
--- a/lib/pure/json.nim
+++ b/lib/pure/json.nim
@@ -542,7 +542,7 @@ proc raiseParseErr*(p: JsonParser, msg: string) {.noinline, noreturn.} =
   raise newException(JsonParsingError, errorMsgExpected(p, msg))
 
 proc newJString*(s: string): JsonNode =
-  ## Creates a new `JString PJsonNode`.
+  ## Creates a new `JString JsonNode`.
   new(result)
   result.kind = JString
   result.str = s
@@ -553,73 +553,73 @@ proc newJStringMove(s: string): JsonNode =
   shallowCopy(result.str, s)
 
 proc newJInt*(n: BiggestInt): JsonNode =
-  ## Creates a new `JInt PJsonNode`.
+  ## Creates a new `JInt JsonNode`.
   new(result)
   result.kind = JInt
   result.num  = n
 
 proc newJFloat*(n: float): JsonNode =
-  ## Creates a new `JFloat PJsonNode`.
+  ## Creates a new `JFloat JsonNode`.
   new(result)
   result.kind = JFloat
   result.fnum  = n
 
 proc newJBool*(b: bool): JsonNode =
-  ## Creates a new `JBool PJsonNode`.
+  ## Creates a new `JBool JsonNode`.
   new(result)
   result.kind = JBool
   result.bval = b
 
 proc newJNull*(): JsonNode =
-  ## Creates a new `JNull PJsonNode`.
+  ## Creates a new `JNull JsonNode`.
   new(result)
 
 proc newJObject*(): JsonNode =
-  ## Creates a new `JObject PJsonNode`
+  ## Creates a new `JObject JsonNode`
   new(result)
   result.kind = JObject
   result.fields = @[]
 
 proc newJArray*(): JsonNode =
-  ## Creates a new `JArray PJsonNode`
+  ## Creates a new `JArray JsonNode`
   new(result)
   result.kind = JArray
   result.elems = @[]
 
 
 proc `%`*(s: string): JsonNode =
-  ## Generic constructor for JSON data. Creates a new `JString PJsonNode`.
+  ## Generic constructor for JSON data. Creates a new `JString JsonNode`.
   new(result)
   result.kind = JString
   result.str = s
 
 proc `%`*(n: BiggestInt): JsonNode =
-  ## Generic constructor for JSON data. Creates a new `JInt PJsonNode`.
+  ## Generic constructor for JSON data. Creates a new `JInt JsonNode`.
   new(result)
   result.kind = JInt
   result.num  = n
 
 proc `%`*(n: float): JsonNode =
-  ## Generic constructor for JSON data. Creates a new `JFloat PJsonNode`.
+  ## Generic constructor for JSON data. Creates a new `JFloat JsonNode`.
   new(result)
   result.kind = JFloat
   result.fnum  = n
 
 proc `%`*(b: bool): JsonNode =
-  ## Generic constructor for JSON data. Creates a new `JBool PJsonNode`.
+  ## Generic constructor for JSON data. Creates a new `JBool JsonNode`.
   new(result)
   result.kind = JBool
   result.bval = b
 
 proc `%`*(keyVals: openArray[tuple[key: string, val: JsonNode]]): JsonNode =
-  ## Generic constructor for JSON data. Creates a new `JObject PJsonNode`
+  ## Generic constructor for JSON data. Creates a new `JObject JsonNode`
   new(result)
   result.kind = JObject
   newSeq(result.fields, keyVals.len)
   for i, p in pairs(keyVals): result.fields[i] = p
 
 proc `%`*(elements: openArray[JsonNode]): JsonNode =
-  ## Generic constructor for JSON data. Creates a new `JArray PJsonNode`
+  ## Generic constructor for JSON data. Creates a new `JArray JsonNode`
   new(result)
   result.kind = JArray
   newSeq(result.elems, elements.len)
@@ -932,7 +932,7 @@ proc parseJson(p: var JsonParser): JsonNode =
 
 when not defined(js):
   proc parseJson*(s: Stream, filename: string): JsonNode =
-    ## Parses from a stream `s` into a `PJsonNode`. `filename` is only needed
+    ## Parses from a stream `s` into a `JsonNode`. `filename` is only needed
     ## for nice error messages.
     var p: JsonParser
     p.open(s, filename)
@@ -945,7 +945,7 @@ when not defined(js):
     result = parseJson(newStringStream(buffer), "input")
 
   proc parseFile*(filename: string): JsonNode =
-    ## Parses `file` into a `PJsonNode`.
+    ## Parses `file` into a `JsonNode`.
     var stream = newFileStream(filename, fmRead)
     if stream == nil:
       raise newException(IOError, "cannot read from file: " & filename)
@@ -956,7 +956,7 @@ else:
     TJSObject = object
   proc parseNativeJson(x: cstring): TJSObject {.importc: "JSON.parse".}
 
-  proc getVarType(x): TJsonNodeKind =
+  proc getVarType(x): JsonNodeKind =
     result = JNull
     proc getProtoName(y): cstring
       {.importc: "Object.prototype.toString.call".}
@@ -991,7 +991,7 @@ else:
       return `x`[`y`];
     """
 
-  proc convertObject(x: TJSObject): PJsonNode =
+  proc convertObject(x: TJSObject): JsonNode =
     case getVarType(x)
     of JArray:
       result = newJArray()
@@ -1018,15 +1018,15 @@ else:
     of JNull:
       result = newJNull()
 
-  proc parseJson*(buffer: string): PJsonNode =
+  proc parseJson*(buffer: string): JsonNode =
     return parseNativeJson(buffer).convertObject()
 
 when false:
   import os
-  var s = newFileStream(ParamStr(1), fmRead)
-  if s == nil: quit("cannot open the file" & ParamStr(1))
-  var x: TJsonParser
-  open(x, s, ParamStr(1))
+  var s = newFileStream(paramStr(1), fmRead)
+  if s == nil: quit("cannot open the file" & paramStr(1))
+  var x: JsonParser
+  open(x, s, paramStr(1))
   while true:
     next(x)
     case x.kind
@@ -1035,13 +1035,13 @@ when false:
       break
     of jsonEof: break
     of jsonString, jsonInt, jsonFloat: echo(x.str)
-    of jsonTrue: Echo("!TRUE")
-    of jsonFalse: Echo("!FALSE")
-    of jsonNull: Echo("!NULL")
-    of jsonObjectStart: Echo("{")
-    of jsonObjectEnd: Echo("}")
-    of jsonArrayStart: Echo("[")
-    of jsonArrayEnd: Echo("]")
+    of jsonTrue: echo("!TRUE")
+    of jsonFalse: echo("!FALSE")
+    of jsonNull: echo("!NULL")
+    of jsonObjectStart: echo("{")
+    of jsonObjectEnd: echo("}")
+    of jsonArrayStart: echo("[")
+    of jsonArrayEnd: echo("]")
     
   close(x)
 
diff --git a/lib/pure/logging.nim b/lib/pure/logging.nim
index bd5e1bf42..9247f69c5 100644
--- a/lib/pure/logging.nim
+++ b/lib/pure/logging.nim
@@ -107,9 +107,12 @@ proc substituteLog(frmt: string): string =
       of "app":  result.add(app)
       of "appdir": result.add(app.splitFile.dir)
       of "appname": result.add(app.splitFile.name)
+      else: discard
 
 method log*(logger: Logger, level: Level,
-            frmt: string, args: varargs[string, `$`]) {.raises: [Exception], tags: [FTime, FWriteIO, FReadIO].} =
+            frmt: string, args: varargs[string, `$`]) {.
+            raises: [Exception], 
+            tags: [TimeEffect, WriteIOEffect, ReadIOEffect].} =
   ## Override this method in custom loggers. Default implementation does
   ## nothing.
   discard