From ce1047f2ae07430c80eeeaa0b65eb0a32d8720a3 Mon Sep 17 00:00:00 2001 From: Araq Date: Thu, 1 Mar 2018 09:42:25 +0100 Subject: [PATCH] added -d:nimNoArrayToString define to allow easier porting to 0.18 --- changelog.md | 6 ++++-- lib/pure/parseopt.nim | 20 +++++++++++++++++++- lib/system.nim | 8 ++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 955648c209..3dab051d43 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,4 @@ -## v0.18.0 - dd/mm/yyyy +## v0.18.0 - 01/03/2018 ### Changes affecting backwards compatibility @@ -16,7 +16,9 @@ - Arrays of char cannot be converted to ``cstring`` anymore, pointers to arrays of char can! This means ``$`` for arrays can finally exist - in ``system.nim`` and do the right thing. + in ``system.nim`` and do the right thing. This means ``$myArrayOfChar`` changed + its behaviour! Compile with ``-d:nimNoArrayToString`` to see where to fix your + code. - `reExtended` is no longer default for the `re` constructor in the `re` module. diff --git a/lib/pure/parseopt.nim b/lib/pure/parseopt.nim index 23568edb91..a5ab9899e5 100644 --- a/lib/pure/parseopt.nim +++ b/lib/pure/parseopt.nim @@ -78,7 +78,7 @@ when declared(os.paramCount): # we cannot provide this for NimRtl creation on Posix, because we can't # access the command line arguments then! - proc initOptParser*(cmdline = ""): OptParser = + proc initOptParser*(cmdline = ""): OptParser {.rtl, extern: "npo$1String".} = ## inits the option parser. If ``cmdline == ""``, the real command line ## (as provided by the ``OS`` module) is taken. result.pos = 0 @@ -94,6 +94,24 @@ when declared(os.paramCount): result.key = TaintedString"" result.val = TaintedString"" +proc initOptParser*(cmdline: seq[string]): OptParser {.rtl, extern: "npo$1Seq".} = + ## inits the option parser. If ``cmdline.len == 0``, the real command line + ## (as provided by the ``OS`` module) is taken. + result.pos = 0 + result.inShortState = false + result.cmd = "" + if cmdline.len != 0: + for i in 0..