move widestrs out of system (#20462)
* move widestrs out of system * fix osproc
This commit is contained in:
parent
cbd9fee22a
commit
0b1650576c
29 changed files with 64 additions and 8 deletions
|
|
@ -14,6 +14,7 @@
|
||||||
- `std/assertions`
|
- `std/assertions`
|
||||||
- `std/formatfloat`
|
- `std/formatfloat`
|
||||||
- `std/objectdollar`
|
- `std/objectdollar`
|
||||||
|
- `std/widestrs`
|
||||||
|
|
||||||
In the future, these definitions will be removed from the `system` module,
|
In the future, these definitions will be removed from the `system` module,
|
||||||
and their respective modules will have to be imported to use them.
|
and their respective modules will have to be imported to use them.
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ import asyncdispatch, os
|
||||||
|
|
||||||
when defined(nimPreviewSlimSystem):
|
when defined(nimPreviewSlimSystem):
|
||||||
import std/[assertions, syncio]
|
import std/[assertions, syncio]
|
||||||
|
when defined(windows):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
# TODO: Fix duplication introduced by PR #4683.
|
# TODO: Fix duplication introduced by PR #4683.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ when defined(nimPreviewSlimSystem):
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
import winlean
|
import winlean
|
||||||
|
when useWinUnicode and defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
from os import absolutePath
|
from os import absolutePath
|
||||||
else:
|
else:
|
||||||
import os
|
import os
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ when not defined(nimscript):
|
||||||
else:
|
else:
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
proc c_putenv(envstring: cstring): cint {.importc: "_putenv", header: "<stdlib.h>".}
|
proc c_putenv(envstring: cstring): cint {.importc: "_putenv", header: "<stdlib.h>".}
|
||||||
from std/private/win_setenv import setEnvImpl
|
from std/private/win_setenv import setEnvImpl
|
||||||
proc c_wgetenv(varname: WideCString): WideCString {.importc: "_wgetenv",
|
proc c_wgetenv(varname: WideCString): WideCString {.importc: "_wgetenv",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ when not defined(nimscript):
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
import winlean
|
import winlean
|
||||||
|
when useWinUnicode and defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
proc `==`*(err1, err2: OSErrorCode): bool {.borrow.}
|
proc `==`*(err1, err2: OSErrorCode): bool {.borrow.}
|
||||||
proc `$`*(err: OSErrorCode): string {.borrow.}
|
proc `$`*(err: OSErrorCode): string {.borrow.}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
import winlean
|
import winlean
|
||||||
|
when useWinUnicode and defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
elif defined(posix):
|
elif defined(posix):
|
||||||
import posix
|
import posix
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -968,6 +968,9 @@ proc getCacheDir*(app: string): string =
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
type DWORD = uint32
|
type DWORD = uint32
|
||||||
|
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
proc getTempPath(
|
proc getTempPath(
|
||||||
nBufferLength: DWORD, lpBuffer: WideCString
|
nBufferLength: DWORD, lpBuffer: WideCString
|
||||||
): DWORD {.stdcall, dynlib: "kernel32.dll", importc: "GetTempPathW".} =
|
): DWORD {.stdcall, dynlib: "kernel32.dll", importc: "GetTempPathW".} =
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ when defined(linux) and defined(useClone):
|
||||||
|
|
||||||
when defined(nimPreviewSlimSystem):
|
when defined(nimPreviewSlimSystem):
|
||||||
import std/[syncio, assertions]
|
import std/[syncio, assertions]
|
||||||
|
when defined(windows):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,8 @@ when not defined(nimscript):
|
||||||
proc c_putenv(envstring: cstring): cint {.importc: "_putenv", header: "<stdlib.h>".}
|
proc c_putenv(envstring: cstring): cint {.importc: "_putenv", header: "<stdlib.h>".}
|
||||||
from std/private/win_setenv import setEnvImpl
|
from std/private/win_setenv import setEnvImpl
|
||||||
import winlean
|
import winlean
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
proc c_wgetenv(varname: WideCString): WideCString {.importc: "_wgetenv",
|
proc c_wgetenv(varname: WideCString): WideCString {.importc: "_wgetenv",
|
||||||
header: "<stdlib.h>".}
|
header: "<stdlib.h>".}
|
||||||
proc getEnvImpl(env: cstring): WideCString = c_wgetenv(env.newWideCString)
|
proc getEnvImpl(env: cstring): WideCString = c_wgetenv(env.newWideCString)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@ type
|
||||||
when not defined(nimscript):
|
when not defined(nimscript):
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
import winlean
|
import winlean
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
else:
|
else:
|
||||||
var errno {.importc, header: "<errno.h>".}: cint
|
var errno {.importc, header: "<errno.h>".}: cint
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ check errno_t vs cint
|
||||||
|
|
||||||
when not defined(windows): discard
|
when not defined(windows): discard
|
||||||
else:
|
else:
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
type wchar_t {.importc: "wchar_t".} = int16
|
type wchar_t {.importc: "wchar_t".} = int16
|
||||||
|
|
||||||
proc setEnvironmentVariableW*(lpName, lpValue: WideCString): int32 {.
|
proc setEnvironmentVariableW*(lpName, lpValue: WideCString): int32 {.
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@
|
||||||
include system/inclrtl
|
include system/inclrtl
|
||||||
import std/private/since
|
import std/private/since
|
||||||
import std/formatfloat
|
import std/formatfloat
|
||||||
|
when defined(windows):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
# ----------------- IO Part ------------------------------------------------
|
# ----------------- IO Part ------------------------------------------------
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ const
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
import winlean
|
import winlean
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
var O_RDWR {.importc: "_O_RDWR", header: "<fcntl.h>".}: cint
|
var O_RDWR {.importc: "_O_RDWR", header: "<fcntl.h>".}: cint
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
# Nim support for C/C++'s `wide strings`:idx:. This is part of the system
|
# Nim support for C/C++'s `wide strings`:idx:.
|
||||||
# module! Do not import it directly!
|
|
||||||
|
|
||||||
#when not declared(ThisIsSystem):
|
#when not declared(ThisIsSystem):
|
||||||
# {.error: "You must not import this module explicitly".}
|
# {.error: "You must not import this module explicitly".}
|
||||||
|
|
@ -2655,8 +2655,9 @@ when defined(genode):
|
||||||
# and return to thread entrypoint.
|
# and return to thread entrypoint.
|
||||||
|
|
||||||
|
|
||||||
import system/widestrs
|
when not defined(nimPreviewSlimSystem):
|
||||||
export widestrs
|
import std/widestrs
|
||||||
|
export widestrs
|
||||||
|
|
||||||
when notJSnotNims:
|
when notJSnotNims:
|
||||||
when defined(windows) and compileOption("threads"):
|
when defined(windows) and compileOption("threads"):
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ is in separate files:
|
||||||
* `exceptions <exceptions.html>`_
|
* `exceptions <exceptions.html>`_
|
||||||
* `assertions <assertions.html>`_
|
* `assertions <assertions.html>`_
|
||||||
* `dollars <dollars.html>`_
|
* `dollars <dollars.html>`_
|
||||||
* `widestrs <widestrs.html>`_
|
|
||||||
* `ctypes <ctypes.html>`_
|
* `ctypes <ctypes.html>`_
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@
|
||||||
|
|
||||||
import winlean, os
|
import winlean, os
|
||||||
|
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
type
|
type
|
||||||
HKEY* = uint
|
HKEY* = uint
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ when defined(nimHasStyleChecks):
|
||||||
|
|
||||||
when defined(nimPreviewSlimSystem):
|
when defined(nimPreviewSlimSystem):
|
||||||
from std/syncio import FileHandle
|
from std/syncio import FileHandle
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
const
|
const
|
||||||
useWinUnicode* = not defined(useWinAnsi)
|
useWinUnicode* = not defined(useWinAnsi)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
when not defined(ODBCVER):
|
when not defined(ODBCVER):
|
||||||
const
|
const
|
||||||
ODBCVER = 0x0351 ## define ODBC version 3.51 by default
|
ODBCVER = 0x0351 ## define ODBC version 3.51 by default
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ discard """
|
||||||
matrix: "--gc:refc; --gc:arc"
|
matrix: "--gc:refc; --gc:arc"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
# bug #19862
|
# bug #19862
|
||||||
type NewString = object
|
type NewString = object
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ q(a)
|
||||||
|
|
||||||
# bug #914
|
# bug #914
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
import std/widestrs
|
||||||
var x = newWideCString("Hello")
|
var x = newWideCString("Hello")
|
||||||
|
|
||||||
echo "success"
|
echo "success"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,15 @@ discard """
|
||||||
when defined(linux):
|
when defined(linux):
|
||||||
import linenoise
|
import linenoise
|
||||||
|
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/[
|
||||||
|
assertions,
|
||||||
|
formatfloat,
|
||||||
|
objectdollar,
|
||||||
|
syncio,
|
||||||
|
widestrs,
|
||||||
|
]
|
||||||
|
|
||||||
import
|
import
|
||||||
algorithm,
|
algorithm,
|
||||||
asyncdispatch,
|
asyncdispatch,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@ discard """
|
||||||
|
|
||||||
{.warning[UnusedImport]: off.}
|
{.warning[UnusedImport]: off.}
|
||||||
|
|
||||||
|
when defined(nimPreviewSlimSystem):
|
||||||
|
import std/[
|
||||||
|
syncio, assertions, formatfloat, objectdollar, widestrs
|
||||||
|
]
|
||||||
|
|
||||||
import std/[
|
import std/[
|
||||||
# Core:
|
# Core:
|
||||||
bitops, typetraits, lenientops, macros, volatile, typeinfo,
|
bitops, typetraits, lenientops, macros, volatile, typeinfo,
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,7 @@ discard """
|
||||||
output: "Test"
|
output: "Test"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import std/widestrs
|
||||||
|
|
||||||
let ws = newWideCString("Test")
|
let ws = newWideCString("Test")
|
||||||
echo ws
|
echo ws
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ template main =
|
||||||
main()
|
main()
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
import std/widestrs
|
||||||
proc c_wgetenv(env: WideCString): WideCString {.importc: "_wgetenv", header: "<stdlib.h>".}
|
proc c_wgetenv(env: WideCString): WideCString {.importc: "_wgetenv", header: "<stdlib.h>".}
|
||||||
proc c_getenv(env: cstring): cstring {.importc: "getenv", header: "<stdlib.h>".}
|
proc c_getenv(env: cstring): cstring {.importc: "getenv", header: "<stdlib.h>".}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ static: main()
|
||||||
main()
|
main()
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
import std/widestrs
|
||||||
proc c_wgetenv(env: WideCString): WideCString {.importc: "_wgetenv", header: "<stdlib.h>".}
|
proc c_wgetenv(env: WideCString): WideCString {.importc: "_wgetenv", header: "<stdlib.h>".}
|
||||||
proc c_getenv(env: cstring): cstring {.importc: "getenv", header: "<stdlib.h>".}
|
proc c_getenv(env: cstring): cstring {.importc: "getenv", header: "<stdlib.h>".}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import std/[syncio, assertions]
|
||||||
when not defined(windows):
|
when not defined(windows):
|
||||||
echo "OK"
|
echo "OK"
|
||||||
else:
|
else:
|
||||||
|
import std/widestrs
|
||||||
{.push gcsafe.}
|
{.push gcsafe.}
|
||||||
|
|
||||||
const CP_UTF8 = 65001'i32
|
const CP_UTF8 = 65001'i32
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@
|
||||||
from stdtest/specialpaths import buildDir
|
from stdtest/specialpaths import buildDir
|
||||||
|
|
||||||
when defined(nimPreviewSlimSystem):
|
when defined(nimPreviewSlimSystem):
|
||||||
import std/syncio
|
import std/[
|
||||||
|
syncio, assertions, formatfloat, objectdollar, widestrs
|
||||||
|
]
|
||||||
|
|
||||||
import std/[
|
import std/[
|
||||||
# Core:
|
# Core:
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,6 @@ lib/system/assertions.nim
|
||||||
lib/system/iterators.nim
|
lib/system/iterators.nim
|
||||||
lib/system/exceptions.nim
|
lib/system/exceptions.nim
|
||||||
lib/system/dollars.nim
|
lib/system/dollars.nim
|
||||||
lib/system/widestrs.nim
|
|
||||||
lib/system/ctypes.nim
|
lib/system/ctypes.nim
|
||||||
""".splitWhitespace()
|
""".splitWhitespace()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue