diff options
-rw-r--r-- | lib/posix/posix.nim | 32 | ||||
-rw-r--r-- | lib/pure/encodings.nim | 24 | ||||
-rw-r--r-- | lib/pure/xmlparser.nim | 8 | ||||
-rw-r--r-- | tests/ccgbugs/tccgen1.nim | 2 | ||||
-rw-r--r-- | tests/closure/tclosure.nim | 2 | ||||
-rw-r--r-- | tests/closure/tclosurebug2.nim | 28 | ||||
-rw-r--r-- | tests/destructor/tdictdestruct.nim | 2 | ||||
-rw-r--r-- | tests/effects/teffects1.nim | 8 | ||||
-rw-r--r-- | tests/effects/teffects2.nim | 8 | ||||
-rw-r--r-- | tests/exception/texcpt1.nim | 4 | ||||
-rw-r--r-- | tests/exception/tnestedreturn.nim | 10 | ||||
-rw-r--r-- | tests/exception/tnestedreturn2.nim | 10 | ||||
-rw-r--r-- | tests/exception/tunhandledexc.nim | 6 | ||||
-rw-r--r-- | tests/exception/twrongexc.nim | 6 | ||||
-rw-r--r-- | tests/let/tlet.nim | 4 | ||||
-rw-r--r-- | tests/typerel/tnoargopenarray.nim | 4 |
16 files changed, 79 insertions, 79 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index fb617f3c5..e7d9b1cc8 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -1799,11 +1799,11 @@ proc inet_pton*(a1: cint, a2: cstring, a3: pointer): cint {. importc, header: "<arpa/inet.h>".} var - in6addr_any* {.importc, header: "<netinet/in.h>".}: TIn6_addr - in6addr_loopback* {.importc, header: "<netinet/in.h>".}: TIn6_addr + in6addr_any* {.importc, header: "<netinet/in.h>".}: TIn6Addr + in6addr_loopback* {.importc, header: "<netinet/in.h>".}: TIn6Addr -proc IN6ADDR_ANY_INIT* (): TIn6_addr {.importc, header: "<netinet/in.h>".} -proc IN6ADDR_LOOPBACK_INIT* (): TIn6_addr {.importc, header: "<netinet/in.h>".} +proc IN6ADDR_ANY_INIT* (): TIn6Addr {.importc, header: "<netinet/in.h>".} +proc IN6ADDR_LOOPBACK_INIT* (): TIn6Addr {.importc, header: "<netinet/in.h>".} # dirent.h proc closedir*(a1: ptr TDIR): cint {.importc, header: "<dirent.h>".} @@ -2518,40 +2518,40 @@ proc if_indextoname*(a1: cint, a2: cstring): cstring {. proc if_nameindex*(): ptr Tif_nameindex {.importc, header: "<net/if.h>".} proc if_freenameindex*(a1: ptr Tif_nameindex) {.importc, header: "<net/if.h>".} -proc IN6_IS_ADDR_UNSPECIFIED* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_UNSPECIFIED* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Unspecified address. -proc IN6_IS_ADDR_LOOPBACK* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_LOOPBACK* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Loopback address. -proc IN6_IS_ADDR_MULTICAST* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_MULTICAST* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Multicast address. -proc IN6_IS_ADDR_LINKLOCAL* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_LINKLOCAL* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Unicast link-local address. -proc IN6_IS_ADDR_SITELOCAL* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_SITELOCAL* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Unicast site-local address. -proc IN6_IS_ADDR_V4MAPPED* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_V4MAPPED* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## IPv4 mapped address. -proc IN6_IS_ADDR_V4COMPAT* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_V4COMPAT* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## IPv4-compatible address. -proc IN6_IS_ADDR_MC_NODELOCAL* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_MC_NODELOCAL* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Multicast node-local address. -proc IN6_IS_ADDR_MC_LINKLOCAL* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_MC_LINKLOCAL* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Multicast link-local address. -proc IN6_IS_ADDR_MC_SITELOCAL* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_MC_SITELOCAL* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Multicast site-local address. -proc IN6_IS_ADDR_MC_ORGLOCAL* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_MC_ORGLOCAL* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Multicast organization-local address. -proc IN6_IS_ADDR_MC_GLOBAL* (a1: ptr TIn6_addr): cint {. +proc IN6_IS_ADDR_MC_GLOBAL* (a1: ptr TIn6Addr): cint {. importc, header: "<netinet/in.h>".} ## Multicast global address. diff --git a/lib/pure/encodings.nim b/lib/pure/encodings.nim index 8cc668359..958a4133b 100644 --- a/lib/pure/encodings.nim +++ b/lib/pure/encodings.nim @@ -262,7 +262,7 @@ else: else: const iconvDll = "(libc.so.6|libiconv.so)" - when defined(macosx) and defined(powerpc32): + when defined(macosx) and defined(powerpc): const prefix = "lib" else: const prefix = "" @@ -281,14 +281,14 @@ else: var errno {.importc, header: "<errno.h>".}: cint - proc iconvOpen(tocode, fromcode: cstring): PConverter {. + proc iconvOpen(tocode, fromcode: cstring): EncodingConverter {. importc: prefix & "iconv_open", cdecl, dynlib: iconvDll.} - proc iconvClose(c: PConverter) {. + proc iconvClose(c: EncodingConverter) {. importc: prefix & "iconv_close", cdecl, dynlib: iconvDll.} - proc iconv(c: PConverter, inbuf: var cstring, inbytesLeft: var int, + proc iconv(c: EncodingConverter, inbuf: var cstring, inbytesLeft: var int, outbuf: var cstring, outbytesLeft: var int): int {. importc: prefix & "iconv", cdecl, dynlib: iconvDll.} - proc iconv(c: PConverter, inbuf: pointer, inbytesLeft: pointer, + proc iconv(c: EncodingConverter, inbuf: pointer, inbytesLeft: pointer, outbuf: var cstring, outbytesLeft: var int): int {. importc: prefix & "iconv", cdecl, dynlib: iconvDll.} @@ -305,7 +305,7 @@ proc open*(destEncoding = "UTF-8", srcEncoding = "CP1252"): EncodingConverter = when not defined(windows): result = iconvOpen(destEncoding, srcEncoding) if result == nil: - raise newException(EInvalidEncoding, + raise newException(EncodingError, "cannot create encoding converter from " & srcEncoding & " to " & destEncoding) else: @@ -401,7 +401,7 @@ when defined(windows): assert(false) # cannot happen else: - proc convert*(c: PConverter, s: string): string = + proc convert*(c: EncodingConverter, s: string): string = result = newString(s.len) var inLen = len(s) var outLen = len(result) @@ -414,7 +414,7 @@ else: var lerr = errno if lerr == EILSEQ or lerr == EINVAL: # unknown char, skip - Dst[0] = Src[0] + dst[0] = src[0] src = cast[cstring](cast[int](src) + 1) dst = cast[cstring](cast[int](dst) + 1) dec(inLen) @@ -426,19 +426,19 @@ else: dst = cast[cstring](cast[int](cstring(result)) + offset) outLen = len(result) - offset else: - osError(lerr.TOSErrorCode) + raiseOSError(lerr.OSErrorCode) # iconv has a buffer that needs flushing, specially if the last char is # not '\0' - discard iconv(c, nil, nil, dst, outlen) + discard iconv(c, nil, nil, dst, outLen) if iconvres == cint(-1) and errno == E2BIG: var offset = cast[int](dst) - cast[int](cstring(result)) setLen(result, len(result)+inLen*2+5) # 5 is minimally one utf-8 char dst = cast[cstring](cast[int](cstring(result)) + offset) outLen = len(result) - offset - discard iconv(c, nil, nil, dst, outlen) + discard iconv(c, nil, nil, dst, outLen) # trim output buffer - setLen(result, len(result) - outlen) + setLen(result, len(result) - outLen) proc convert*(s: string, destEncoding = "UTF-8", srcEncoding = "CP1252"): string = diff --git a/lib/pure/xmlparser.nim b/lib/pure/xmlparser.nim index 83bd45e7d..8591e894c 100644 --- a/lib/pure/xmlparser.nim +++ b/lib/pure/xmlparser.nim @@ -19,7 +19,7 @@ type {.deprecated: [EInvalidXml: XmlError].} proc raiseInvalidXml(errors: seq[string]) = - var e: ref EInvalidXml + var e: ref XmlError new(e) e.msg = errors[0] e.errors = errors @@ -125,14 +125,14 @@ proc parseXml*(s: Stream): XmlNode = ## errors are turned into an ``EInvalidXML`` exception. var errors: seq[string] = @[] result = parseXml(s, "unknown_html_doc", errors) - if errors.len > 0: raiseInvalidXMl(errors) + if errors.len > 0: raiseInvalidXml(errors) proc loadXml*(path: string, errors: var seq[string]): XmlNode = ## Loads and parses XML from file specified by ``path``, and returns ## a ``PXmlNode``. Every occured parsing error is added to the `errors` ## sequence. var s = newFileStream(path, fmRead) - if s == nil: raise newException(EIO, "Unable to read file: " & path) + if s == nil: raise newException(IOError, "Unable to read file: " & path) result = parseXml(s, path, errors) proc loadXml*(path: string): XmlNode = @@ -141,7 +141,7 @@ proc loadXml*(path: string): XmlNode = ## exception. var errors: seq[string] = @[] result = loadXml(path, errors) - if errors.len > 0: raiseInvalidXMl(errors) + if errors.len > 0: raiseInvalidXml(errors) when isMainModule: import os diff --git a/tests/ccgbugs/tccgen1.nim b/tests/ccgbugs/tccgen1.nim index 137dd545d..9234bbd6c 100644 --- a/tests/ccgbugs/tccgen1.nim +++ b/tests/ccgbugs/tccgen1.nim @@ -45,7 +45,7 @@ type PText* = ref Text Text = object of CharacterData - PComment* = ref comment + PComment* = ref Comment Comment = object of CharacterData PCDataSection* = ref CDataSection diff --git a/tests/closure/tclosure.nim b/tests/closure/tclosure.nim index 764aaa97d..445a99b6d 100644 --- a/tests/closure/tclosure.nim +++ b/tests/closure/tclosure.nim @@ -36,7 +36,7 @@ myData.each do (x: int): type ITest = tuple[ - setter: proc(v: Int), + setter: proc(v: int), getter: proc(): int] proc getInterf(): ITest = diff --git a/tests/closure/tclosurebug2.nim b/tests/closure/tclosurebug2.nim index ec4f0045b..12e4e3509 100644 --- a/tests/closure/tclosurebug2.nim +++ b/tests/closure/tclosurebug2.nim @@ -38,17 +38,17 @@ template rawInsertImpl() {.dirty.} = data[h].val = val data[h].slot = seFilled -template AddImpl() {.dirty.} = - if mustRehash(len(t.data), t.counter): Enlarge(t) - RawInsert(t, t.data, key, val) +template addImpl() {.dirty.} = + if mustRehash(len(t.data), t.counter): enlarge(t) + rawInsert(t, t.data, key, val) inc(t.counter) -template PutImpl() {.dirty.} = - var index = RawGet(t, key) +template putImpl() {.dirty.} = + var index = rawGet(t, key) if index >= 0: t.data[index].val = val else: - AddImpl() + addImpl() proc len*[A, B](t: TOrderedTable[A, B]): int {.inline.} = ## returns the number of keys in `t`. @@ -89,7 +89,7 @@ iterator mvalues*[A, B](t: var TOrderedTable[A, B]): var B = forAllOrderedPairs: yield t.data[h].val -proc RawGet[A, B](t: TOrderedTable[A, B], key: A): int = +proc rawGet[A, B](t: TOrderedTable[A, B], key: A): int = rawGetImpl() proc `[]`*[A, B](t: TOrderedTable[A, B], key: A): B = @@ -97,21 +97,21 @@ proc `[]`*[A, B](t: TOrderedTable[A, B], key: A): B = ## default empty value for the type `B` is returned ## and no exception is raised. One can check with ``hasKey`` whether the key ## exists. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val proc mget*[A, B](t: var TOrderedTable[A, B], key: A): var B = ## retrieves the value at ``t[key]``. The value can be modified. ## If `key` is not in `t`, the ``EInvalidKey`` exception is raised. - var index = RawGet(t, key) + var index = rawGet(t, key) if index >= 0: result = t.data[index].val - else: raise newException(EInvalidKey, "key not found: " & $key) + else: raise newException(KeyError, "key not found: " & $key) proc hasKey*[A, B](t: TOrderedTable[A, B], key: A): bool = ## returns true iff `key` is in the table `t`. result = rawGet(t, key) >= 0 -proc RawInsert[A, B](t: var TOrderedTable[A, B], +proc rawInsert[A, B](t: var TOrderedTable[A, B], data: var TOrderedKeyValuePairSeq[A, B], key: A, val: B) = rawInsertImpl() @@ -120,7 +120,7 @@ proc RawInsert[A, B](t: var TOrderedTable[A, B], if t.last >= 0: data[t.last].next = h t.last = h -proc Enlarge[A, B](t: var TOrderedTable[A, B]) = +proc enlarge[A, B](t: var TOrderedTable[A, B]) = var n: TOrderedKeyValuePairSeq[A, B] newSeq(n, len(t.data) * growthFactor) var h = t.first @@ -129,7 +129,7 @@ proc Enlarge[A, B](t: var TOrderedTable[A, B]) = while h >= 0: var nxt = t.data[h].next if t.data[h].slot == seFilled: - RawInsert(t, n, t.data[h].key, t.data[h].val) + rawInsert(t, n, t.data[h].key, t.data[h].val) h = nxt swap(t.data, n) @@ -139,7 +139,7 @@ proc `[]=`*[A, B](t: var TOrderedTable[A, B], key: A, val: B) = proc add*[A, B](t: var TOrderedTable[A, B], key: A, val: B) = ## puts a new (key, value)-pair into `t` even if ``t[key]`` already exists. - AddImpl() + addImpl() proc initOrderedTable*[A, B](initialSize=64): TOrderedTable[A, B] = ## creates a new ordered hash table that is empty. `initialSize` needs to be diff --git a/tests/destructor/tdictdestruct.nim b/tests/destructor/tdictdestruct.nim index b7043f7b7..17ded4853 100644 --- a/tests/destructor/tdictdestruct.nim +++ b/tests/destructor/tdictdestruct.nim @@ -11,7 +11,7 @@ proc fakeNew[T](x: var ref T, destroy: proc (a: ref T) {.nimcall.}) = proc destroyDict[TK, TV](a: PDict[TK, TV]) = return proc newDict[TK, TV](a: TK, b: TV): PDict[TK, TV] = - Fakenew(result, destroyDict[TK, TV]) + fakeNew(result, destroyDict[TK, TV]) # Problem: destroyDict is not instantiated when newDict is instantiated! diff --git a/tests/effects/teffects1.nim b/tests/effects/teffects1.nim index f73230ff9..bbae857ea 100644 --- a/tests/effects/teffects1.nim +++ b/tests/effects/teffects1.nim @@ -1,7 +1,7 @@ discard """ line: 2136 file: "system.nim" - errormsg: "can raise an unlisted exception: ref EIO" + errormsg: "can raise an unlisted exception: ref IOError" """ type @@ -9,13 +9,13 @@ type TObjB = object of TObj a, b, c: string - EIO2 = ref object of EIO + IO2Error = ref object of IOError proc forw: int {. .} -proc lier(): int {.raises: [EIO2].} = +proc lier(): int {.raises: [IO2Error].} = writeln stdout, "arg" proc forw: int = - raise newException(EIO, "arg") + raise newException(IOError, "arg") diff --git a/tests/effects/teffects2.nim b/tests/effects/teffects2.nim index 7e6b17c36..89ad16edc 100644 --- a/tests/effects/teffects2.nim +++ b/tests/effects/teffects2.nim @@ -1,6 +1,6 @@ discard """ line: 19 - errormsg: "can raise an unlisted exception: ref EIO" + errormsg: "can raise an unlisted exception: ref IOError" """ type @@ -8,13 +8,13 @@ type TObjB = object of TObj a, b, c: string - EIO2 = ref object of EIO + EIO2 = ref object of IOError proc forw: int {.raises: [].} -proc lier(): int {.raises: [EIO].} = +proc lier(): int {.raises: [IOError].} = writeln stdout, "arg" proc forw: int = - raise newException(EIO, "arg") + raise newException(IOError, "arg") diff --git a/tests/exception/texcpt1.nim b/tests/exception/texcpt1.nim index ec74c9470..50a95eeec 100644 --- a/tests/exception/texcpt1.nim +++ b/tests/exception/texcpt1.nim @@ -2,8 +2,8 @@ discard """ outputsub: "-6" """ type - ESomething = object of E_Base - ESomeOtherErr = object of E_Base + ESomething = object of Exception + ESomeOtherErr = object of Exception proc genErrors(s: string) = if s == "error!": diff --git a/tests/exception/tnestedreturn.nim b/tests/exception/tnestedreturn.nim index b9f7843f6..591638f0e 100644 --- a/tests/exception/tnestedreturn.nim +++ b/tests/exception/tnestedreturn.nim @@ -10,8 +10,8 @@ proc test1() = finally: echo "A" try: - raise newException(EOS, "Problem") - except EOS: + raise newException(OSError, "Problem") + except OSError: return test1() @@ -23,7 +23,7 @@ proc test2() = try: return - except EOS: + except OSError: discard test2() @@ -31,8 +31,8 @@ test2() proc test3() = try: try: - raise newException(EOS, "Problem") - except EOS: + raise newException(OSError, "Problem") + except OSError: return finally: echo "C" diff --git a/tests/exception/tnestedreturn2.nim b/tests/exception/tnestedreturn2.nim index 14a2dab92..4bd2d535d 100644 --- a/tests/exception/tnestedreturn2.nim +++ b/tests/exception/tnestedreturn2.nim @@ -1,14 +1,14 @@ discard """ - file: "tnestedreturn.nim" - outputsub: "Error: unhandled exception: Problem [EOS]" + file: "tnestedreturn2.nim" + outputsub: "Error: unhandled exception: Problem [OSError]" exitcode: "1" """ proc test4() = try: try: - raise newException(EOS, "Problem") - except EOS: + raise newException(OSError, "Problem") + except OSError: return finally: discard @@ -17,4 +17,4 @@ proc test4() = # but could cause segmentation fault if # exceptions are not handled properly. test4() -raise newException(EOS, "Problem") +raise newException(OSError, "Problem") diff --git a/tests/exception/tunhandledexc.nim b/tests/exception/tunhandledexc.nim index f24881aef..aa9d61236 100644 --- a/tests/exception/tunhandledexc.nim +++ b/tests/exception/tunhandledexc.nim @@ -4,8 +4,8 @@ discard """ exitcode: "1" """ type - ESomething = object of E_Base - ESomeOtherErr = object of E_Base + ESomething = object of Exception + ESomeOtherErr = object of Exception proc genErrors(s: string) = if s == "error!": @@ -13,7 +13,7 @@ proc genErrors(s: string) = else: raise newException(EsomeotherErr, "bla") -when True: +when true: try: genErrors("errssor!") except ESomething: diff --git a/tests/exception/twrongexc.nim b/tests/exception/twrongexc.nim index 755f7d979..4e921b8a3 100644 --- a/tests/exception/twrongexc.nim +++ b/tests/exception/twrongexc.nim @@ -1,11 +1,11 @@ discard """ file: "twrongexc.nim" - outputsub: "Error: unhandled exception: [EInvalidValue]" + outputsub: "Error: unhandled exception: [ValueError]" exitcode: "1" """ try: - raise newException(EInvalidValue, "") -except EOverflow: + raise newException(ValueError, "") +except OverflowError: echo("Error caught") diff --git a/tests/let/tlet.nim b/tests/let/tlet.nim index 3d36432fb..6703ba254 100644 --- a/tests/let/tlet.nim +++ b/tests/let/tlet.nim @@ -3,9 +3,9 @@ discard """ errormsg: "'name' cannot be assigned to" """ -Echo("What's your name? ") +echo("What's your name? ") let name = readLine(stdin) while name == "": - Echo("Please tell me your name: ") + echo("Please tell me your name: ") name = readLine(stdin) diff --git a/tests/typerel/tnoargopenarray.nim b/tests/typerel/tnoargopenarray.nim index 872ec86d2..20ebe5ecc 100644 --- a/tests/typerel/tnoargopenarray.nim +++ b/tests/typerel/tnoargopenarray.nim @@ -1,7 +1,7 @@ import db_sqlite -var db: TDbConn -Exec(db, sql"create table blabla()") +var db: DbConn +exec(db, sql"create table blabla()") |