CIs: attempt to use csources_v1 (#16282)
* CIs: attempt to use csources_v1 * also updated the BSDs * also updated azure pipelines * std modules should not itself use the 'std/' import dir... * compiler has to be careful with std/ for v1 booting
This commit is contained in:
parent
7bce1f8578
commit
a9b62de895
58 changed files with 142 additions and 143 deletions
|
|
@ -15,7 +15,7 @@ environment:
|
||||||
tasks:
|
tasks:
|
||||||
- setup: |
|
- setup: |
|
||||||
cd Nim
|
cd Nim
|
||||||
git clone --depth 1 -q https://github.com/nim-lang/csources.git
|
git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources
|
||||||
gmake -C csources -j $(sysctl -n hw.ncpu)
|
gmake -C csources -j $(sysctl -n hw.ncpu)
|
||||||
bin/nim c --skipUserCfg --skipParentCfg koch
|
bin/nim c --skipUserCfg --skipParentCfg koch
|
||||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ environment:
|
||||||
tasks:
|
tasks:
|
||||||
- setup: |
|
- setup: |
|
||||||
cd Nim
|
cd Nim
|
||||||
git clone --depth 1 -q https://github.com/nim-lang/csources.git
|
git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources
|
||||||
gmake -C csources -j $(sysctl -n hw.ncpuonline)
|
gmake -C csources -j $(sysctl -n hw.ncpuonline)
|
||||||
bin/nim c koch
|
bin/nim c koch
|
||||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ environment:
|
||||||
tasks:
|
tasks:
|
||||||
- setup: |
|
- setup: |
|
||||||
cd Nim
|
cd Nim
|
||||||
git clone --depth 1 -q https://github.com/nim-lang/csources.git
|
git clone --depth 1 -q https://github.com/nim-lang/csources_v1.git csources
|
||||||
gmake -C csources -j $(sysctl -n hw.ncpuonline)
|
gmake -C csources -j $(sysctl -n hw.ncpuonline)
|
||||||
bin/nim c koch
|
bin/nim c koch
|
||||||
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
echo 'export PATH=$HOME/Nim/bin:$PATH' >> $HOME/.buildenv
|
||||||
|
|
|
||||||
4
.github/workflows/ci_docs.yml
vendored
4
.github/workflows/ci_docs.yml
vendored
|
|
@ -85,7 +85,7 @@ jobs:
|
||||||
id: csources-version
|
id: csources-version
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sha=$(git ls-remote https://github.com/nim-lang/csources master | cut -f 1)
|
sha=$(git ls-remote https://github.com/nim-lang/csources_v1 master | cut -f 1)
|
||||||
echo "::set-output name=sha::$sha"
|
echo "::set-output name=sha::$sha"
|
||||||
|
|
||||||
- name: 'Get prebuilt csources from cache'
|
- name: 'Get prebuilt csources from cache'
|
||||||
|
|
@ -99,7 +99,7 @@ jobs:
|
||||||
if: steps.csources-cache.outputs.cache-hit != 'true'
|
if: steps.csources-cache.outputs.cache-hit != 'true'
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
repository: nim-lang/csources
|
repository: nim-lang/csources_v1
|
||||||
path: csources
|
path: csources
|
||||||
|
|
||||||
- name: 'Build 1-stage compiler from csources'
|
- name: 'Build 1-stage compiler from csources'
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ jobs:
|
||||||
echo $commitMsg | grep -v '\[skip ci\]' # fails if [skip ci] not in commit msg
|
echo $commitMsg | grep -v '\[skip ci\]' # fails if [skip ci] not in commit msg
|
||||||
displayName: 'Check whether to skip CI'
|
displayName: 'Check whether to skip CI'
|
||||||
|
|
||||||
- bash: git clone --depth 1 https://github.com/nim-lang/csources
|
- bash: git clone --depth 1 https://github.com/nim-lang/csources_v1 csources
|
||||||
displayName: 'Checkout Nim csources'
|
displayName: 'Checkout Nim csources'
|
||||||
|
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ REM Some debug info
|
||||||
echo "Running on %CI_RUNNER_ID% (%CI_RUNNER_DESCRIPTION%) with tags %CI_RUNNER_TAGS%."
|
echo "Running on %CI_RUNNER_ID% (%CI_RUNNER_DESCRIPTION%) with tags %CI_RUNNER_TAGS%."
|
||||||
gcc -v
|
gcc -v
|
||||||
|
|
||||||
git clone --depth 1 https://github.com/nim-lang/csources.git
|
git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources
|
||||||
cd csources
|
cd csources
|
||||||
call build64.bat
|
call build64.bat
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
sh ci/deps.sh
|
sh ci/deps.sh
|
||||||
|
|
||||||
# Build from C sources.
|
# Build from C sources.
|
||||||
git clone --depth 1 https://github.com/nim-lang/csources.git
|
git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources
|
||||||
cd csources
|
cd csources
|
||||||
sh build.sh
|
sh build.sh
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ Rem Build csources
|
||||||
koch csources -d:release || exit /b
|
koch csources -d:release || exit /b
|
||||||
|
|
||||||
rem Grab C sources and nimsuggest
|
rem Grab C sources and nimsuggest
|
||||||
git clone --depth 1 https://github.com/nim-lang/csources.git
|
git clone --depth 1 https://github.com/nim-lang/csources_v1.git csources
|
||||||
|
|
||||||
set PATH=%CD%\bin;%PATH%
|
set PATH=%CD%\bin;%PATH%
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
import ropes, platform, condsyms, options, msgs, lineinfos, pathutils
|
import ropes, platform, condsyms, options, msgs, lineinfos, pathutils
|
||||||
|
|
||||||
import std/[os, strutils, osproc, sha1, streams, sequtils, times, strtabs, json]
|
import os, strutils, osproc, std/sha1, streams, sequtils, times, strtabs, json
|
||||||
|
|
||||||
type
|
type
|
||||||
TInfoCCProp* = enum # properties of the C compiler:
|
TInfoCCProp* = enum # properties of the C compiler:
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
## also doing cross-module dependency tracking and DCE that we don't need
|
## also doing cross-module dependency tracking and DCE that we don't need
|
||||||
## anymore. DCE is now done as prepass over the entire packed module graph.
|
## anymore. DCE is now done as prepass over the entire packed module graph.
|
||||||
|
|
||||||
import std/[packedsets, algorithm, tables]
|
import std/packedsets, algorithm, tables
|
||||||
# std/intsets would give `UnusedImport`, pending https://github.com/nim-lang/Nim/issues/14246
|
|
||||||
import ".."/[ast, options, lineinfos, modulegraphs, cgendata, cgen,
|
import ".."/[ast, options, lineinfos, modulegraphs, cgendata, cgen,
|
||||||
pathutils, extccomp, msgs]
|
pathutils, extccomp, msgs]
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ proc addFileToLink(config: ConfigRef; m: PSym) =
|
||||||
addFileToCompile(config, cf)
|
addFileToCompile(config, cf)
|
||||||
|
|
||||||
when defined(debugDce):
|
when defined(debugDce):
|
||||||
import std / [os, packedsets]
|
import os, std/packedsets
|
||||||
|
|
||||||
proc storeAliveSymsImpl(asymFile: AbsoluteFile; s: seq[int32]) =
|
proc storeAliveSymsImpl(asymFile: AbsoluteFile; s: seq[int32]) =
|
||||||
var f = rodfiles.create(asymFile.string)
|
var f = rodfiles.create(asymFile.string)
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
## Dead code elimination (=DCE) for IC.
|
## Dead code elimination (=DCE) for IC.
|
||||||
|
|
||||||
import std / [intsets, tables]
|
import intsets, tables
|
||||||
import ".." / [ast, options, lineinfos, types]
|
import ".." / [ast, options, lineinfos, types]
|
||||||
|
|
||||||
import packed_ast, ic, bitabs
|
import packed_ast, ic, bitabs
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,12 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
import std / [hashes, tables, intsets, sha1]
|
import hashes, tables, intsets, std/sha1
|
||||||
import packed_ast, bitabs, rodfiles
|
import packed_ast, bitabs, rodfiles
|
||||||
import ".." / [ast, idents, lineinfos, msgs, ropes, options,
|
import ".." / [ast, idents, lineinfos, msgs, ropes, options,
|
||||||
pathutils, condsyms]
|
pathutils, condsyms]
|
||||||
#import ".." / [renderer, astalgo]
|
#import ".." / [renderer, astalgo]
|
||||||
from std / os import removeFile, isAbsolute
|
from os import removeFile, isAbsolute
|
||||||
|
|
||||||
type
|
type
|
||||||
PackedConfig* = object
|
PackedConfig* = object
|
||||||
|
|
@ -143,7 +143,7 @@ const
|
||||||
debugConfigDiff = defined(debugConfigDiff)
|
debugConfigDiff = defined(debugConfigDiff)
|
||||||
|
|
||||||
when debugConfigDiff:
|
when debugConfigDiff:
|
||||||
import std / [hashes, tables, intsets, sha1, strutils, sets]
|
import hashes, tables, intsets, sha1, strutils, sets
|
||||||
|
|
||||||
proc configIdentical(m: PackedModule; config: ConfigRef): bool =
|
proc configIdentical(m: PackedModule; config: ConfigRef): bool =
|
||||||
result = m.definedSymbols == definedSymbolsAsString(config)
|
result = m.definedSymbols == definedSymbolsAsString(config)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
## Integrity checking for a set of .rod files.
|
## Integrity checking for a set of .rod files.
|
||||||
## The set must cover a complete Nim project.
|
## The set must cover a complete Nim project.
|
||||||
|
|
||||||
import std / sets
|
import sets
|
||||||
import ".." / [ast, modulegraphs]
|
import ".." / [ast, modulegraphs]
|
||||||
import packed_ast, bitabs, ic
|
import packed_ast, bitabs, ic
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
## IDE-like features. It uses the set of .rod files to accomplish
|
## IDE-like features. It uses the set of .rod files to accomplish
|
||||||
## its task. The set must cover a complete Nim project.
|
## its task. The set must cover a complete Nim project.
|
||||||
|
|
||||||
import std / sets
|
import sets
|
||||||
|
|
||||||
from os import nil
|
from os import nil
|
||||||
from std/private/miscdollars import toLocation
|
from std/private/miscdollars import toLocation
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
## use this representation directly in all the transformations,
|
## use this representation directly in all the transformations,
|
||||||
## it is superior.
|
## it is superior.
|
||||||
|
|
||||||
import std / [hashes, tables, strtabs]
|
import hashes, tables, strtabs
|
||||||
import bitabs
|
import bitabs
|
||||||
import ".." / [ast, options]
|
import ".." / [ast, options]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
## hold all from `low(BiggestInt)` to `high(BiggestUInt)`, This
|
## hold all from `low(BiggestInt)` to `high(BiggestUInt)`, This
|
||||||
## type is for that purpose.
|
## type is for that purpose.
|
||||||
|
|
||||||
from std/math import trunc
|
from math import trunc
|
||||||
|
|
||||||
type
|
type
|
||||||
Int128* = object
|
Int128* = object
|
||||||
|
|
@ -378,7 +378,7 @@ proc `*`*(lhs, rhs: Int128): Int128 =
|
||||||
proc `*=`*(a: var Int128, b: Int128) =
|
proc `*=`*(a: var Int128, b: Int128) =
|
||||||
a = a * b
|
a = a * b
|
||||||
|
|
||||||
import std/bitops
|
import bitops
|
||||||
|
|
||||||
proc fastLog2*(a: Int128): int =
|
proc fastLog2*(a: Int128): int =
|
||||||
if a.udata[3] != 0:
|
if a.udata[3] != 0:
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import
|
||||||
cgmeth, lowerings, sighashes, modulegraphs, lineinfos, rodutils,
|
cgmeth, lowerings, sighashes, modulegraphs, lineinfos, rodutils,
|
||||||
transf, injectdestructors, sourcemap
|
transf, injectdestructors, sourcemap
|
||||||
|
|
||||||
import std/[json, sets, math, tables, intsets, strutils]
|
import json, sets, math, tables, intsets, strutils
|
||||||
|
|
||||||
from modulegraphs import ModuleGraph, PPassContext
|
from modulegraphs import ModuleGraph, PPassContext
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -372,7 +372,7 @@ when false:
|
||||||
of 'a'..'z': result = getIdent(c.cache, toLowerAscii(x.s[0]) & x.s.substr(1))
|
of 'a'..'z': result = getIdent(c.cache, toLowerAscii(x.s[0]) & x.s.substr(1))
|
||||||
else: result = x
|
else: result = x
|
||||||
|
|
||||||
import std/[editdistance, heapqueue]
|
import std/editdistance, heapqueue
|
||||||
|
|
||||||
type SpellCandidate = object
|
type SpellCandidate = object
|
||||||
dist: int
|
dist: int
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
## represents a complete Nim project. Single modules can either be kept in RAM
|
## represents a complete Nim project. Single modules can either be kept in RAM
|
||||||
## or stored in a rod-file.
|
## or stored in a rod-file.
|
||||||
|
|
||||||
import std / [intsets, tables, hashes, md5]
|
import intsets, tables, hashes, md5
|
||||||
import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils
|
import ast, astalgo, options, lineinfos,idents, btrees, ropes, msgs, pathutils
|
||||||
import ic / [packed_ast, ic]
|
import ic / [packed_ast, ic]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import ast, renderer, intsets, tables, msgs, options, lineinfos, strformat, idents, treetab, hashes
|
import ast, renderer, intsets, tables, msgs, options, lineinfos, strformat, idents, treetab, hashes
|
||||||
import sequtils, strutils, std / sets
|
import sequtils, strutils, sets
|
||||||
|
|
||||||
# IMPORTANT: notes not up to date, i'll update this comment again
|
# IMPORTANT: notes not up to date, i'll update this comment again
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import
|
||||||
idents, lineinfos, cmdlinehelper,
|
idents, lineinfos, cmdlinehelper,
|
||||||
pathutils, modulegraphs
|
pathutils, modulegraphs
|
||||||
|
|
||||||
from std/browsers import openDefaultBrowser
|
from browsers import openDefaultBrowser
|
||||||
from nodejs import findNodeJs
|
from nodejs import findNodeJs
|
||||||
|
|
||||||
when hasTinyCBackend:
|
when hasTinyCBackend:
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ interpolation variables:
|
||||||
Unstable API
|
Unstable API
|
||||||
]##
|
]##
|
||||||
|
|
||||||
import std/[os,strutils]
|
import os, strutils
|
||||||
|
|
||||||
const
|
const
|
||||||
docCss* = "$nimr/doc/nimdoc.css"
|
docCss* = "$nimr/doc/nimdoc.css"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
## Serialization utilities for the compiler.
|
## Serialization utilities for the compiler.
|
||||||
import std/[strutils, math]
|
import strutils, math
|
||||||
|
|
||||||
# bcc on windows doesn't have C99 functions
|
# bcc on windows doesn't have C99 functions
|
||||||
when defined(windows) and defined(bcc):
|
when defined(windows) and defined(bcc):
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
## This module contains the data structures for the semantic checking phase.
|
## This module contains the data structures for the semantic checking phase.
|
||||||
|
|
||||||
import std / tables
|
import tables
|
||||||
|
|
||||||
import
|
import
|
||||||
intsets, options, ast, astalgo, msgs, idents, renderer,
|
intsets, options, ast, astalgo, msgs, idents, renderer,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
# this module does the semantic checking of type declarations
|
# this module does the semantic checking of type declarations
|
||||||
# included from sem.nim
|
# included from sem.nim
|
||||||
|
|
||||||
import std/math
|
import math
|
||||||
|
|
||||||
const
|
const
|
||||||
errStringOrIdentNodeExpected = "string or ident node expected"
|
errStringOrIdentNodeExpected = "string or ident node expected"
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
## This module contains the type definitions for the new evaluation engine.
|
## This module contains the type definitions for the new evaluation engine.
|
||||||
## An instruction is 1-3 int32s in memory, it is a register based VM.
|
## An instruction is 1-3 int32s in memory, it is a register based VM.
|
||||||
|
|
||||||
import std / tables
|
import tables
|
||||||
|
|
||||||
import ast, idents, options, modulegraphs, lineinfos
|
import ast, idents, options, modulegraphs, lineinfos
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
# solves the opcLdConst vs opcAsgnConst issue. Of course whether we need
|
# solves the opcLdConst vs opcAsgnConst issue. Of course whether we need
|
||||||
# this copy depends on the involved types.
|
# this copy depends on the involved types.
|
||||||
|
|
||||||
import std / tables
|
import tables
|
||||||
|
|
||||||
import
|
import
|
||||||
strutils, ast, types, msgs, renderer, vmdef,
|
strutils, ast, types, msgs, renderer, vmdef,
|
||||||
|
|
|
||||||
|
|
@ -9,24 +9,24 @@
|
||||||
|
|
||||||
# Unfortunately this cannot be a module yet:
|
# Unfortunately this cannot be a module yet:
|
||||||
#import vmdeps, vm
|
#import vmdeps, vm
|
||||||
from std/math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
|
from math import sqrt, ln, log10, log2, exp, round, arccos, arcsin,
|
||||||
arctan, arctan2, cos, cosh, hypot, sinh, sin, tan, tanh, pow, trunc,
|
arctan, arctan2, cos, cosh, hypot, sinh, sin, tan, tanh, pow, trunc,
|
||||||
floor, ceil, `mod`, cbrt, arcsinh, arccosh, arctanh, erf, erfc, gamma,
|
floor, ceil, `mod`, cbrt, arcsinh, arccosh, arctanh, erf, erfc, gamma,
|
||||||
lgamma
|
lgamma
|
||||||
|
|
||||||
when declared(math.copySign):
|
when declared(math.copySign):
|
||||||
from std/math import copySign
|
from math import copySign
|
||||||
|
|
||||||
when declared(math.signbit):
|
when declared(math.signbit):
|
||||||
from std/math import signbit
|
from math import signbit
|
||||||
|
|
||||||
from std/os import getEnv, existsEnv, dirExists, fileExists, putEnv, walkDir,
|
from os import getEnv, existsEnv, dirExists, fileExists, putEnv, walkDir,
|
||||||
getAppFilename, raiseOSError, osLastError
|
getAppFilename, raiseOSError, osLastError
|
||||||
|
|
||||||
from std/md5 import getMD5
|
from md5 import getMD5
|
||||||
from std/times import cpuTime
|
from times import cpuTime
|
||||||
from std/hashes import hash
|
from hashes import hash
|
||||||
from std/osproc import nil
|
from osproc import nil
|
||||||
|
|
||||||
from sighashes import symBodyDigest
|
from sighashes import symBodyDigest
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
## writeLine(stdout, "your password: " & myData["password"])
|
## writeLine(stdout, "your password: " & myData["password"])
|
||||||
## writeLine(stdout, "</body></html>")
|
## writeLine(stdout, "</body></html>")
|
||||||
|
|
||||||
import std/[strutils, os, strtabs, cookies, uri]
|
import strutils, os, strtabs, cookies, uri
|
||||||
export uri.encodeUrl, uri.decodeUrl
|
export uri.encodeUrl, uri.decodeUrl
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ runnableExamples:
|
||||||
|
|
||||||
import std/private/since
|
import std/private/since
|
||||||
|
|
||||||
import std/math
|
import math
|
||||||
|
|
||||||
type
|
type
|
||||||
Deque*[T] = object
|
Deque*[T] = object
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ runnableExamples:
|
||||||
|
|
||||||
|
|
||||||
import std/private/since
|
import std/private/since
|
||||||
import std/[hashes, math, algorithm]
|
import hashes, math, algorithm
|
||||||
|
|
||||||
type
|
type
|
||||||
KeyValuePair[A, B] = tuple[hcode: Hash, key: A, val: B]
|
KeyValuePair[A, B] = tuple[hcode: Hash, key: A, val: B]
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ runnableExamples:
|
||||||
{.push checks: off, line_dir: off, stack_trace: off, debugger: off.}
|
{.push checks: off, line_dir: off, stack_trace: off, debugger: off.}
|
||||||
# the user does not want to trace a part of the standard library!
|
# the user does not want to trace a part of the standard library!
|
||||||
|
|
||||||
import std/math
|
import math
|
||||||
|
|
||||||
type
|
type
|
||||||
Complex*[T: SomeFloat] = object
|
Complex*[T: SomeFloat] = object
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
## This module implements helper procs for parsing Cookies.
|
## This module implements helper procs for parsing Cookies.
|
||||||
|
|
||||||
import std/[strtabs, times, options]
|
import strtabs, times, options
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,11 @@
|
||||||
##
|
##
|
||||||
## See `packaging <packaging.html>`_ for hints on distributing Nim using OS packages.
|
## See `packaging <packaging.html>`_ for hints on distributing Nim using OS packages.
|
||||||
|
|
||||||
from std/strutils import contains, toLowerAscii
|
from strutils import contains, toLowerAscii
|
||||||
|
|
||||||
when not defined(nimscript):
|
when not defined(nimscript):
|
||||||
from std/osproc import execProcess
|
from osproc import execProcess
|
||||||
from std/os import existsEnv
|
from os import existsEnv
|
||||||
|
|
||||||
type
|
type
|
||||||
Distribution* {.pure.} = enum ## the list of known distributions
|
Distribution* {.pure.} = enum ## the list of known distributions
|
||||||
|
|
|
||||||
|
|
@ -159,10 +159,9 @@ runnableExamples:
|
||||||
a1, a2, a0, a3, a4: int
|
a1, a2, a0, a3, a4: int
|
||||||
doAssert $(%* Foo()) == """{"a1":0,"a2":0,"a0":0,"a3":0,"a4":0}"""
|
doAssert $(%* Foo()) == """{"a1":0,"a2":0,"a0":0,"a3":0,"a4":0}"""
|
||||||
|
|
||||||
import
|
import hashes, tables, strutils, lexbase, streams, macros, parsejson
|
||||||
std/[hashes, tables, strutils, lexbase, streams, macros, parsejson]
|
|
||||||
|
|
||||||
import std/options # xxx remove this dependency using same approach as https://github.com/nim-lang/Nim/pull/14563
|
import options # xxx remove this dependency using same approach as https://github.com/nim-lang/Nim/pull/14563
|
||||||
import std/private/since
|
import std/private/since
|
||||||
|
|
||||||
export
|
export
|
||||||
|
|
@ -921,7 +920,7 @@ proc parseJson*(s: Stream, filename: string = ""; rawIntegers = false, rawFloats
|
||||||
p.close()
|
p.close()
|
||||||
|
|
||||||
when defined(js):
|
when defined(js):
|
||||||
from std/math import `mod`
|
from math import `mod`
|
||||||
from std/jsffi import JSObject, `[]`, to
|
from std/jsffi import JSObject, `[]`, to
|
||||||
from std/private/jsutils import getProtoName, isInteger, isSafeInteger
|
from std/private/jsutils import getProtoName, isInteger, isSafeInteger
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ Please use alternative packages for serialization.
|
||||||
It is possible to reimplement this module using generics and type traits.
|
It is possible to reimplement this module using generics and type traits.
|
||||||
Please contribute a new implementation.""".}
|
Please contribute a new implementation.""".}
|
||||||
|
|
||||||
import std/[streams, typeinfo, json, intsets, tables, unicode]
|
import streams, typeinfo, json, intsets, tables, unicode
|
||||||
|
|
||||||
proc ptrToInt(x: pointer): int {.inline.} =
|
proc ptrToInt(x: pointer): int {.inline.} =
|
||||||
result = cast[int](x) # don't skip alignment
|
result = cast[int](x) # don't skip alignment
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ import std/private/since
|
||||||
{.push debugger: off.} # the user does not want to trace a part
|
{.push debugger: off.} # the user does not want to trace a part
|
||||||
# of the standard library!
|
# of the standard library!
|
||||||
|
|
||||||
import std/[bitops, fenv]
|
import bitops, fenv
|
||||||
|
|
||||||
when defined(c) or defined(cpp):
|
when defined(c) or defined(cpp):
|
||||||
proc c_isnan(x: float): bool {.importc: "isnan", header: "<math.h>".}
|
proc c_isnan(x: float): bool {.importc: "isnan", header: "<math.h>".}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
## This implementation calls `initRand()` for the first call of
|
## This implementation calls `initRand()` for the first call of
|
||||||
## `genOid`.
|
## `genOid`.
|
||||||
|
|
||||||
import std/[hashes, times, endians, random]
|
import hashes, times, endians, random
|
||||||
from std/private/decode_helpers import handleHexChar
|
from std/private/decode_helpers import handleHexChar
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ supports pattern matching on `Option`s, with the `Some(<pattern>)` and
|
||||||
# xxx pending https://github.com/timotheecour/Nim/issues/376 use `runnableExamples` and `whichModule`
|
# xxx pending https://github.com/timotheecour/Nim/issues/376 use `runnableExamples` and `whichModule`
|
||||||
|
|
||||||
|
|
||||||
import std/typetraits
|
import typetraits
|
||||||
|
|
||||||
when (NimMajor, NimMinor) >= (1, 1):
|
when (NimMajor, NimMinor) >= (1, 1):
|
||||||
type
|
type
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
include system/inclrtl
|
include system/inclrtl
|
||||||
import std/private/since
|
import std/private/since
|
||||||
|
|
||||||
import std/[strutils, pathnorm]
|
import strutils, pathnorm
|
||||||
|
|
||||||
const weirdTarget = defined(nimscript) or defined(js)
|
const weirdTarget = defined(nimscript) or defined(js)
|
||||||
|
|
||||||
|
|
@ -65,9 +65,9 @@ since (1, 1):
|
||||||
when weirdTarget:
|
when weirdTarget:
|
||||||
discard
|
discard
|
||||||
elif defined(windows):
|
elif defined(windows):
|
||||||
import std/[winlean, times]
|
import winlean, times
|
||||||
elif defined(posix):
|
elif defined(posix):
|
||||||
import std/[posix, times]
|
import posix, times
|
||||||
|
|
||||||
proc toTime(ts: Timespec): times.Time {.inline.} =
|
proc toTime(ts: Timespec): times.Time {.inline.} =
|
||||||
result = initTime(ts.tv_sec.int64, ts.tv_nsec.int)
|
result = initTime(ts.tv_sec.int64, ts.tv_nsec.int)
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ runnableExamples:
|
||||||
## * `list of cryptographic and hashing modules <lib.html#pure-libraries-hashing>`_
|
## * `list of cryptographic and hashing modules <lib.html#pure-libraries-hashing>`_
|
||||||
## in the standard library
|
## in the standard library
|
||||||
|
|
||||||
import std/[algorithm, math]
|
import algorithm, math
|
||||||
import std/private/since
|
import std/private/since
|
||||||
|
|
||||||
include system/inclrtl
|
include system/inclrtl
|
||||||
|
|
@ -625,7 +625,7 @@ proc shuffle*[T](x: var openArray[T]) =
|
||||||
shuffle(state, x)
|
shuffle(state, x)
|
||||||
|
|
||||||
when not defined(nimscript) and not defined(standalone):
|
when not defined(nimscript) and not defined(standalone):
|
||||||
import std/times
|
import times
|
||||||
|
|
||||||
proc initRand(): Rand =
|
proc initRand(): Rand =
|
||||||
## Initializes a new Rand state with a seed based on the current time.
|
## Initializes a new Rand state with a seed based on the current time.
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ runnableExamples:
|
||||||
doAssert r1 * r2 == -3 // 8
|
doAssert r1 * r2 == -3 // 8
|
||||||
doAssert r1 / r2 == -2 // 3
|
doAssert r1 / r2 == -2 // 3
|
||||||
|
|
||||||
import std/[math, hashes]
|
import math, hashes
|
||||||
|
|
||||||
type Rational*[T] = object
|
type Rational*[T] = object
|
||||||
## A rational number, consisting of a numerator `num` and a denominator `den`.
|
## A rational number, consisting of a numerator `num` and a denominator `den`.
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
## runtime efficiency.
|
## runtime efficiency.
|
||||||
|
|
||||||
include system/inclrtl
|
include system/inclrtl
|
||||||
import std/streams
|
import streams
|
||||||
|
|
||||||
{.push debugger: off.} # the user does not want to trace a part
|
{.push debugger: off.} # the user does not want to trace a part
|
||||||
# of the standard library!
|
# of the standard library!
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ runnableExamples:
|
||||||
doAssert statistics.kurtosis() ~= -1.0
|
doAssert statistics.kurtosis() ~= -1.0
|
||||||
doAssert statistics.kurtosisS() ~= -0.7000000000000008
|
doAssert statistics.kurtosisS() ~= -0.7000000000000008
|
||||||
|
|
||||||
from std/math import FloatClass, sqrt, pow, round
|
from math import FloatClass, sqrt, pow, round
|
||||||
|
|
||||||
{.push debugger: off.} # the user does not want to trace a part
|
{.push debugger: off.} # the user does not want to trace a part
|
||||||
# of the standard library!
|
# of the standard library!
|
||||||
|
|
|
||||||
|
|
@ -313,8 +313,8 @@ help with readability, since there is only so much you can cram into
|
||||||
single letter DSLs.
|
single letter DSLs.
|
||||||
]##
|
]##
|
||||||
|
|
||||||
import std/[macros, parseutils, unicode]
|
import macros, parseutils, unicode
|
||||||
import std/strutils except format
|
import strutils except format
|
||||||
|
|
||||||
proc mkDigit(v: int, typ: char): string {.inline.} =
|
proc mkDigit(v: int, typ: char): string {.inline.} =
|
||||||
assert(v < 26)
|
assert(v < 26)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
## macro system.
|
## macro system.
|
||||||
|
|
||||||
import std/private/since
|
import std/private/since
|
||||||
import std/macros
|
import macros
|
||||||
|
|
||||||
proc checkPragma(ex, prag: var NimNode) =
|
proc checkPragma(ex, prag: var NimNode) =
|
||||||
since (1, 3):
|
since (1, 3):
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ since (1, 3, 5):
|
||||||
|
|
||||||
typeof(block: (for ai in a: ai))
|
typeof(block: (for ai in a: ai))
|
||||||
|
|
||||||
import std/macros
|
import macros
|
||||||
|
|
||||||
macro enumLen*(T: typedesc[enum]): int =
|
macro enumLen*(T: typedesc[enum]): int =
|
||||||
## Returns the number of items in the enum `T`.
|
## Returns the number of items in the enum `T`.
|
||||||
|
|
|
||||||
|
|
@ -108,15 +108,15 @@
|
||||||
import std/private/since
|
import std/private/since
|
||||||
import std/exitprocs
|
import std/exitprocs
|
||||||
|
|
||||||
import std/[macros, strutils, streams, times, sets, sequtils]
|
import macros, strutils, streams, times, sets, sequtils
|
||||||
|
|
||||||
when declared(stdout):
|
when declared(stdout):
|
||||||
import std/os
|
import os
|
||||||
|
|
||||||
const useTerminal = not defined(js)
|
const useTerminal = not defined(js)
|
||||||
|
|
||||||
when useTerminal:
|
when useTerminal:
|
||||||
import std/terminal
|
import terminal
|
||||||
|
|
||||||
type
|
type
|
||||||
TestStatus* = enum ## The status of a test when it is done.
|
TestStatus* = enum ## The status of a test when it is done.
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ runnableExamples:
|
||||||
doAssert getDataUri("Nim", "text/plain") == "data:text/plain;charset=utf-8;base64,Tmlt"
|
doAssert getDataUri("Nim", "text/plain") == "data:text/plain;charset=utf-8;base64,Tmlt"
|
||||||
|
|
||||||
|
|
||||||
import std/[strutils, parseutils, base64]
|
import strutils, parseutils, base64
|
||||||
import std/private/[since, decode_helpers]
|
import std/private/[since, decode_helpers]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
# distribution, for details about the copyright.
|
# distribution, for details about the copyright.
|
||||||
#
|
#
|
||||||
|
|
||||||
import std/macros
|
import macros
|
||||||
from std/typetraits import OrdinalEnum, HoleyEnum
|
from typetraits import OrdinalEnum, HoleyEnum
|
||||||
|
|
||||||
# xxx `genEnumCaseStmt` needs tests and runnableExamples
|
# xxx `genEnumCaseStmt` needs tests and runnableExamples
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ runnableExamples:
|
||||||
let j = a.toJson
|
let j = a.toJson
|
||||||
assert j.jsonTo(typeof(a)).toJson == j
|
assert j.jsonTo(typeof(a)).toJson == j
|
||||||
|
|
||||||
import std/[json,strutils,tables,sets,strtabs,options]
|
import json, strutils, tables, sets, strtabs, options
|
||||||
|
|
||||||
#[
|
#[
|
||||||
Future directions:
|
Future directions:
|
||||||
|
|
@ -27,7 +27,7 @@ add a way to customize serialization, for e.g.:
|
||||||
objects.
|
objects.
|
||||||
]#
|
]#
|
||||||
|
|
||||||
import std/macros
|
import macros
|
||||||
|
|
||||||
type
|
type
|
||||||
Joptions* = object
|
Joptions* = object
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ See also
|
||||||
* `times module <times.html>`_
|
* `times module <times.html>`_
|
||||||
]##
|
]##
|
||||||
|
|
||||||
import std/times
|
import times
|
||||||
|
|
||||||
type
|
type
|
||||||
MonoTime* = object ## Represents a monotonic timestamp.
|
MonoTime* = object ## Represents a monotonic timestamp.
|
||||||
|
|
@ -77,7 +77,7 @@ when defined(js):
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
|
||||||
elif defined(posix) and not defined(osx):
|
elif defined(posix) and not defined(osx):
|
||||||
import std/posix
|
import posix
|
||||||
|
|
||||||
elif defined(windows):
|
elif defined(windows):
|
||||||
proc QueryPerformanceCounter(res: var uint64) {.
|
proc QueryPerformanceCounter(res: var uint64) {.
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ this can eventually be moved to std/os and `walkDirRec` can be implemented in te
|
||||||
to avoid duplication
|
to avoid duplication
|
||||||
]##
|
]##
|
||||||
|
|
||||||
import std/[os]
|
import os
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
from strutils import replace
|
from strutils import replace
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
## * `std/packedsets <packedsets.html>`_
|
## * `std/packedsets <packedsets.html>`_
|
||||||
## * `std/sets <sets.html>`_
|
## * `std/sets <sets.html>`_
|
||||||
|
|
||||||
import std/[typetraits, macros]
|
import typetraits, macros
|
||||||
|
|
||||||
#[
|
#[
|
||||||
type SetElement* = char|byte|bool|int16|uint16|enum|uint8|int8
|
type SetElement* = char|byte|bool|int16|uint16|enum|uint8|int8
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ runnableExamples("-r:off"):
|
||||||
b = parseSecureHash("10DFAEBF6BFDBC7939957068E2EFACEC4972933C")
|
b = parseSecureHash("10DFAEBF6BFDBC7939957068E2EFACEC4972933C")
|
||||||
assert a == b, "files don't match"
|
assert a == b, "files don't match"
|
||||||
|
|
||||||
import std/strutils
|
import strutils
|
||||||
from std/endians import bigEndian32, bigEndian64
|
from endians import bigEndian32, bigEndian64
|
||||||
|
|
||||||
const Sha1DigestSize = 20
|
const Sha1DigestSize = 20
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ runnableExamples:
|
||||||
|
|
||||||
|
|
||||||
when not defined(js):
|
when not defined(js):
|
||||||
import std/os
|
import os
|
||||||
|
|
||||||
when defined(posix):
|
when defined(posix):
|
||||||
import std/posix
|
import posix
|
||||||
|
|
||||||
const
|
const
|
||||||
batchImplOS = defined(freebsd) or defined(openbsd) or (defined(macosx) and not defined(ios))
|
batchImplOS = defined(freebsd) or defined(openbsd) or (defined(macosx) and not defined(ios))
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ runnableExamples:
|
||||||
|
|
||||||
assert (?.f2.x2.x2).x3 == nil # this terminates ?. early
|
assert (?.f2.x2.x2).x3 == nil # this terminates ?. early
|
||||||
|
|
||||||
from std/options import Option, isSome, get, option, unsafeGet, UnpackDefect
|
from options import Option, isSome, get, option, unsafeGet, UnpackDefect
|
||||||
export options.get, options.isSome, options.isNone
|
export options.get, options.isSome, options.isNone
|
||||||
|
|
||||||
template fakeDot*(a: Option, b): untyped =
|
template fakeDot*(a: Option, b): untyped =
|
||||||
|
|
@ -59,7 +59,7 @@ func `[]`*[U](a: Option[U]): auto {.inline.} =
|
||||||
if a2 != nil:
|
if a2 != nil:
|
||||||
result = option(a2[])
|
result = option(a2[])
|
||||||
|
|
||||||
import std/macros
|
import macros
|
||||||
|
|
||||||
func replace(n: NimNode): NimNode =
|
func replace(n: NimNode): NimNode =
|
||||||
if n.kind == nnkDotExpr:
|
if n.kind == nnkDotExpr:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue