fix #4417, update news

This commit is contained in:
miere43
2016-07-30 18:25:48 +03:00
parent dfee2bf66e
commit f16140fc95
3 changed files with 17 additions and 1 deletions

View File

@@ -217,6 +217,15 @@ proc testCompileOptionArg*(switch, arg: string, info: TLineInfo): bool =
of "none": result = gOptions * {optOptimizeSpeed, optOptimizeSize} == {}
else: localError(info, errNoneSpeedOrSizeExpectedButXFound, arg)
of "verbosity": result = $gVerbosity == arg
of "app":
case arg.normalize
of "gui": result = contains(gGlobalOptions, optGenGuiApp)
of "console": result = not contains(gGlobalOptions, optGenGuiApp)
of "lib": result = contains(gGlobalOptions, optGenDynLib) and
not contains(gGlobalOptions, optGenGuiApp)
of "staticlib": result = contains(gGlobalOptions, optGenStaticLib) and
not contains(gGlobalOptions, optGenGuiApp)
else: localError(info, errGuiConsoleOrLibExpectedButXFound, arg)
else: invalidCmdLineOption(passCmd1, switch, info)
proc testCompileOption*(switch: string, info: TLineInfo): bool =

View File

@@ -3670,3 +3670,8 @@ template closureScope*(body: untyped): untyped =
when defined(nimconfig):
include "system/nimscript"
when defined(windows) and compileOption("app", "console"):
proc setConsoleOutputCP(codepage: cint): cint {.stdcall, dynlib: "kernel32",
importc: "SetConsoleOutputCP".}
discard setConsoleOutputCP(65001) # 65001 - utf-8 codepage

View File

@@ -26,7 +26,7 @@ Changes affecting backwards compatibility
Warning: a [b] will be parsed as command syntax; spacing is deprecated
See `https://github.com/nim-lang/Nim/issues/3898`_ for the relevant
See `<https://github.com/nim-lang/Nim/issues/3898>`_ for the relevant
discussion.
- Overloading the special operators ``.``, ``.()``, ``.=``, ``()`` now
should be enabled via ``{.experimental.}``.
@@ -52,6 +52,8 @@ that have tuple name:
var rocketaims = initOrderedTable[string, Table[tuple[k: int8, v: int8], int64] ]()
rocketaims["hi"] = {(k: -1.int8, v: 0.int8): 0.int64}.toTable()
- Now when you compile console application for Windows, console output
encoding is automatically set to UTF-8.
Library Additions
-----------------