mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
complete std prefixes for stdlib (#22887)
follow up https://github.com/nim-lang/Nim/pull/22851 follow up https://github.com/nim-lang/Nim/pull/22873
This commit is contained in:
@@ -30,9 +30,9 @@ const weirdTarget = defined(nimscript) or defined(js)
|
||||
when weirdTarget:
|
||||
discard
|
||||
elif defined(windows):
|
||||
import winlean
|
||||
import std/winlean
|
||||
elif defined(posix):
|
||||
import posix
|
||||
import std/posix
|
||||
else:
|
||||
{.error: "The cmdline module has not been implemented for the target platform.".}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## This module implements syntax sugar for some declarations.
|
||||
|
||||
import macros
|
||||
import std/macros
|
||||
|
||||
macro byaddr*(sect) =
|
||||
## Allows a syntax for l-value references, being an exact analog to
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## This module implements directory handling.
|
||||
|
||||
from paths import Path, ReadDirEffect, WriteDirEffect
|
||||
from std/paths import Path, ReadDirEffect, WriteDirEffect
|
||||
|
||||
from std/private/osdirs import dirExists, createDir, existsOrCreateDir, removeDir,
|
||||
moveDir, walkDir, setCurrentDir,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
## This module implements an algorithm to compute the
|
||||
## `edit distance`:idx: between two Unicode strings.
|
||||
|
||||
import unicode
|
||||
import std/unicode
|
||||
|
||||
proc editDistance*(a, b: string): int {.noSideEffect.} =
|
||||
## Returns the **unicode-rune** edit distance between `a` and `b`.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
## One can test for the existence of this standard module
|
||||
## via `defined(nimHasEffectTraitsModule)`.
|
||||
|
||||
import macros
|
||||
import std/macros
|
||||
|
||||
proc getRaisesListImpl(n: NimNode): NimNode = discard "see compiler/vmops.nim"
|
||||
proc getTagsListImpl(n: NimNode): NimNode = discard "see compiler/vmops.nim"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
## macro system.
|
||||
|
||||
import std/private/since
|
||||
import macros
|
||||
import std/macros
|
||||
|
||||
|
||||
macro enumerate*(x: ForLoopStmt): untyped {.since: (1, 3).} =
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
import macros
|
||||
from typetraits import OrdinalEnum, HoleyEnum
|
||||
import std/macros
|
||||
from std/typetraits import OrdinalEnum, HoleyEnum
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
@@ -60,7 +60,7 @@ when not defined(nimscript):
|
||||
when defined(windows):
|
||||
proc c_putenv(envstring: cstring): cint {.importc: "_putenv", header: "<stdlib.h>".}
|
||||
from std/private/win_setenv import setEnvImpl
|
||||
import winlean
|
||||
import std/winlean
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/widestrs
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
## This module allows adding hooks to program exit.
|
||||
|
||||
import locks
|
||||
import std/locks
|
||||
when defined(js) and not defined(nodejs):
|
||||
import std/assertions
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
## **See also:**
|
||||
## * `paths module <paths.html>`_ for path manipulation
|
||||
|
||||
from paths import Path, ReadDirEffect, WriteDirEffect
|
||||
from std/paths import Path, ReadDirEffect, WriteDirEffect
|
||||
|
||||
from std/private/osfiles import fileExists, removeFile,
|
||||
moveFile
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## This module implements AST generation using captured variables for macros.
|
||||
|
||||
import macros
|
||||
import std/macros
|
||||
|
||||
type GenAstOpt* = enum
|
||||
kDirtyTemplate,
|
||||
|
||||
@@ -16,7 +16,7 @@ runnableExamples:
|
||||
assert 0.0.toJson.kind == JFloat
|
||||
assert Inf.toJson.kind == JString
|
||||
|
||||
import json, strutils, tables, sets, strtabs, options, strformat
|
||||
import std/[json, strutils, tables, sets, strtabs, options, strformat]
|
||||
|
||||
#[
|
||||
Future directions:
|
||||
@@ -30,9 +30,9 @@ add a way to customize serialization, for e.g.:
|
||||
objects.
|
||||
]#
|
||||
|
||||
import macros
|
||||
from enumutils import symbolName
|
||||
from typetraits import OrdinalEnum, tupleLen
|
||||
import std/macros
|
||||
from std/enumutils import symbolName
|
||||
from std/typetraits import OrdinalEnum, tupleLen
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
@@ -36,7 +36,7 @@ See also
|
||||
* `times module <times.html>`_
|
||||
]##
|
||||
|
||||
import times
|
||||
import std/times
|
||||
|
||||
type
|
||||
MonoTime* = object ## Represents a monotonic timestamp.
|
||||
@@ -74,7 +74,7 @@ when defined(js):
|
||||
{.pop.}
|
||||
|
||||
elif defined(posix) and not defined(osx):
|
||||
import posix
|
||||
import std/posix
|
||||
|
||||
when defined(zephyr):
|
||||
proc k_uptime_ticks(): int64 {.importc: "k_uptime_ticks", header: "<kernel.h>".}
|
||||
|
||||
@@ -15,7 +15,7 @@ type
|
||||
|
||||
when not defined(nimscript):
|
||||
when defined(windows):
|
||||
import winlean
|
||||
import std/winlean
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/widestrs
|
||||
else:
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
## `outParamsAt` macro for easy writing code that works with both 2.0 and 1.x.
|
||||
|
||||
import macros
|
||||
import std/macros
|
||||
|
||||
macro outParamsAt*(positions: static openArray[int]; n: untyped): untyped =
|
||||
## Use this macro to annotate `out` parameters in a portable way.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
## * `sets module <sets.html>`_ for more general hash sets
|
||||
|
||||
import std/private/since
|
||||
import hashes
|
||||
import std/hashes
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
@@ -9,7 +9,7 @@ export osseps
|
||||
import std/envvars
|
||||
import std/private/osappdirs
|
||||
|
||||
import pathnorm
|
||||
import std/pathnorm
|
||||
|
||||
from std/private/ospaths2 import joinPath, splitPath,
|
||||
ReadDirEffect, WriteDirEffect,
|
||||
|
||||
@@ -4,9 +4,9 @@ this can eventually be moved to std/os and `walkDirRec` can be implemented in te
|
||||
to avoid duplication
|
||||
]##
|
||||
|
||||
import os
|
||||
import std/os
|
||||
when defined(windows):
|
||||
from strutils import replace
|
||||
from std/strutils import replace
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/[assertions, objectdollar]
|
||||
@@ -65,6 +65,6 @@ proc nativeToUnixPath*(path: string): string =
|
||||
result = replace(result, '\\', '/')
|
||||
|
||||
when isMainModule:
|
||||
import sugar
|
||||
import std/sugar
|
||||
for a in walkDirRecFilter(".", follow = a=>a.path.lastPathPart notin ["nimcache", ".git", "csources_v1", "csources", "bin"]):
|
||||
echo a
|
||||
|
||||
@@ -22,9 +22,9 @@ type
|
||||
when weirdTarget:
|
||||
discard
|
||||
elif defined(windows):
|
||||
import winlean, times
|
||||
import std/[winlean, times]
|
||||
elif defined(posix):
|
||||
import posix
|
||||
import std/posix
|
||||
proc c_rename(oldname, newname: cstring): cint {.
|
||||
importc: "rename", header: "<stdio.h>".}
|
||||
else:
|
||||
|
||||
@@ -16,9 +16,9 @@ when defined(nimPreviewSlimSystem):
|
||||
when weirdTarget:
|
||||
discard
|
||||
elif defined(windows):
|
||||
import winlean, times
|
||||
import std/[winlean, times]
|
||||
elif defined(posix):
|
||||
import posix, times
|
||||
import std/[posix, times]
|
||||
|
||||
else:
|
||||
{.error: "OS module not ported to your operating system!".}
|
||||
|
||||
@@ -15,9 +15,9 @@ when defined(nimPreviewSlimSystem):
|
||||
when weirdTarget:
|
||||
discard
|
||||
elif defined(windows):
|
||||
import winlean
|
||||
import std/winlean
|
||||
elif defined(posix):
|
||||
import posix, times
|
||||
import std/[posix, times]
|
||||
|
||||
proc toTime(ts: Timespec): times.Time {.inline.} =
|
||||
result = initTime(ts.tv_sec.int64, ts.tv_nsec.int)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
include system/inclrtl
|
||||
import std/private/since
|
||||
|
||||
import strutils, pathnorm
|
||||
import std/[strutils, pathnorm]
|
||||
import std/oserrors
|
||||
|
||||
import oscommon
|
||||
@@ -17,9 +17,9 @@ const weirdTarget = defined(nimscript) or defined(js)
|
||||
when weirdTarget:
|
||||
discard
|
||||
elif defined(windows):
|
||||
import winlean
|
||||
import std/winlean
|
||||
elif defined(posix):
|
||||
import posix, system/ansi_c
|
||||
import std/posix, system/ansi_c
|
||||
else:
|
||||
{.error: "OS module not ported to your operating system!".}
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@ when defined(nimPreviewSlimSystem):
|
||||
when weirdTarget:
|
||||
discard
|
||||
elif defined(windows):
|
||||
import winlean, times
|
||||
import std/[winlean, times]
|
||||
elif defined(posix):
|
||||
import posix
|
||||
import std/posix
|
||||
else:
|
||||
{.error: "OS module not ported to your operating system!".}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
## This is an internal helper module. Do not use.
|
||||
|
||||
import macros
|
||||
import std/macros
|
||||
|
||||
proc underscoredCalls*(result, calls, arg0: NimNode)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
## * `std/packedsets <packedsets.html>`_
|
||||
## * `std/sets <sets.html>`_
|
||||
|
||||
import typetraits, macros
|
||||
import std/[typetraits, macros]
|
||||
|
||||
#[
|
||||
type SetElement* = char|byte|bool|int16|uint16|enum|uint8|int8
|
||||
|
||||
@@ -29,8 +29,8 @@ runnableExamples("-r:off"):
|
||||
|
||||
{.deprecated: "use command `nimble install checksums` and import `checksums/sha1` instead".}
|
||||
|
||||
import strutils
|
||||
from endians import bigEndian32, bigEndian64
|
||||
import std/strutils
|
||||
from std/endians import bigEndian32, bigEndian64
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/syncio
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
## sendStream.write "I" # Throws an error as we can't write into an already sent buffer
|
||||
## ```
|
||||
|
||||
import net, streams
|
||||
import std/[net, streams]
|
||||
|
||||
type
|
||||
ReadSocketStream* = ref ReadSocketStreamObj
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
## .. importdoc:: os.nim
|
||||
|
||||
from paths import Path, ReadDirEffect
|
||||
from std/paths import Path, ReadDirEffect
|
||||
|
||||
from std/private/ossymlinks import symlinkExists, createSymlink, expandSymlink
|
||||
|
||||
|
||||
@@ -363,7 +363,7 @@ elif someGcc or defined(tcc):
|
||||
elif defined(icl):
|
||||
proc cpuRelax* {.importc: "_mm_pause", header: "xmmintrin.h".}
|
||||
elif false:
|
||||
from os import sleep
|
||||
from std/os import sleep
|
||||
|
||||
proc cpuRelax* {.inline.} = os.sleep(1)
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ when not defined(js):
|
||||
import std/oserrors
|
||||
|
||||
when defined(posix):
|
||||
import posix
|
||||
import std/posix
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
|
||||
@@ -29,7 +29,7 @@ const
|
||||
|
||||
|
||||
when defined(windows):
|
||||
import winlean
|
||||
import std/winlean
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/widestrs
|
||||
|
||||
@@ -46,7 +46,7 @@ when defined(windows):
|
||||
proc close_osfandle(fd: cint): cint {.
|
||||
importc: "_close", header: "<io.h>".}
|
||||
else:
|
||||
import posix
|
||||
import std/posix
|
||||
|
||||
proc c_fdopen(
|
||||
filehandle: cint,
|
||||
|
||||
@@ -19,5 +19,5 @@ elif defined(windows):
|
||||
# newest version of Visual C++ defines time_t to be of 64 bits
|
||||
type Time* {.importc: "time_t", header: "<time.h>".} = distinct int64
|
||||
elif defined(posix):
|
||||
import posix
|
||||
import std/posix
|
||||
export posix.Time
|
||||
@@ -14,7 +14,7 @@
|
||||
##
|
||||
## **Since:** version 1.2.
|
||||
|
||||
import macros, private / underscored_calls
|
||||
import std/[macros, private / underscored_calls]
|
||||
|
||||
macro with*(arg: typed; calls: varargs[untyped]): untyped =
|
||||
## This macro provides `chaining`:idx: of function calls.
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
## This module contains an algorithm to wordwrap a Unicode string.
|
||||
|
||||
import strutils, unicode
|
||||
import std/[strutils, unicode]
|
||||
|
||||
proc olen(s: string; start, lastExclusive: int): int =
|
||||
var i = start
|
||||
|
||||
@@ -13,7 +13,7 @@ consider handling indexing operations, eg:
|
||||
doAssert ?.default(seq[int])[3] == default(int)
|
||||
]#
|
||||
|
||||
import macros
|
||||
import std/macros
|
||||
|
||||
runnableExamples:
|
||||
type Foo = ref object
|
||||
@@ -122,7 +122,7 @@ macro `?.`*(a: typed): auto =
|
||||
`lhs`
|
||||
|
||||
# the code below is not needed for `?.`
|
||||
from options import Option, isSome, get, option, unsafeGet, UnpackDefect
|
||||
from std/options import Option, isSome, get, option, unsafeGet, UnpackDefect
|
||||
|
||||
macro `??.`*(a: typed): Option =
|
||||
## Same as `?.` but returns an `Option`.
|
||||
|
||||
Reference in New Issue
Block a user