added -d:nimNoArrayToString define to allow easier porting to 0.18
This commit is contained in:
parent
51935c47b0
commit
ce1047f2ae
3 changed files with 27 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
## v0.18.0 - dd/mm/yyyy
|
## v0.18.0 - 01/03/2018
|
||||||
|
|
||||||
### Changes affecting backwards compatibility
|
### Changes affecting backwards compatibility
|
||||||
|
|
||||||
|
|
@ -16,7 +16,9 @@
|
||||||
|
|
||||||
- Arrays of char cannot be converted to ``cstring`` anymore, pointers to
|
- Arrays of char cannot be converted to ``cstring`` anymore, pointers to
|
||||||
arrays of char can! This means ``$`` for arrays can finally exist
|
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`
|
- `reExtended` is no longer default for the `re` constructor in the `re`
|
||||||
module.
|
module.
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ when declared(os.paramCount):
|
||||||
# we cannot provide this for NimRtl creation on Posix, because we can't
|
# we cannot provide this for NimRtl creation on Posix, because we can't
|
||||||
# access the command line arguments then!
|
# 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
|
## inits the option parser. If ``cmdline == ""``, the real command line
|
||||||
## (as provided by the ``OS`` module) is taken.
|
## (as provided by the ``OS`` module) is taken.
|
||||||
result.pos = 0
|
result.pos = 0
|
||||||
|
|
@ -94,6 +94,24 @@ when declared(os.paramCount):
|
||||||
result.key = TaintedString""
|
result.key = TaintedString""
|
||||||
result.val = 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..<cmdline.len:
|
||||||
|
result.cmd.add quote(cmdline[i])
|
||||||
|
result.cmd.add ' '
|
||||||
|
else:
|
||||||
|
for i in countup(1, paramCount()):
|
||||||
|
result.cmd.add quote(paramStr(i).string)
|
||||||
|
result.cmd.add ' '
|
||||||
|
result.kind = cmdEnd
|
||||||
|
result.key = TaintedString""
|
||||||
|
result.val = TaintedString""
|
||||||
|
|
||||||
proc handleShortOption(p: var OptParser) =
|
proc handleShortOption(p: var OptParser) =
|
||||||
var i = p.pos
|
var i = p.pos
|
||||||
p.kind = cmdShortOption
|
p.kind = cmdShortOption
|
||||||
|
|
|
||||||
|
|
@ -3428,10 +3428,10 @@ elif defined(JS):
|
||||||
when defined(nimffi):
|
when defined(nimffi):
|
||||||
include "system/sysio"
|
include "system/sysio"
|
||||||
|
|
||||||
|
when not defined(nimNoArrayToString):
|
||||||
proc `$`*[T, IDX](x: array[IDX, T]): string =
|
proc `$`*[T, IDX](x: array[IDX, T]): string =
|
||||||
## generic ``$`` operator for arrays that is lifted from the components
|
## generic ``$`` operator for arrays that is lifted from the components
|
||||||
collectionToString(x, "[", ", ", "]")
|
collectionToString(x, "[", ", ", "]")
|
||||||
|
|
||||||
proc quit*(errormsg: string, errorcode = QuitFailure) {.noReturn.} =
|
proc quit*(errormsg: string, errorcode = QuitFailure) {.noReturn.} =
|
||||||
## a shorthand for ``echo(errormsg); quit(errorcode)``.
|
## a shorthand for ``echo(errormsg); quit(errorcode)``.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue