mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-03 10:24:44 +00:00
docs now show nimExperimentalX APIs (#18345)
* docs now show nimExperimentalX APIs * fix for windows
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
when not defined(js):
|
||||
{.fatal: "Module jsfetch is designed to be used with the JavaScript backend.".}
|
||||
|
||||
when defined(nimExperimentalJsfetch) or defined(nimdoc):
|
||||
when defined(nimExperimentalJsfetch):
|
||||
import std/[asyncjs, jsheaders, jsformdata]
|
||||
from std/httpcore import HttpMethod
|
||||
from std/jsffi import JsObject
|
||||
|
||||
@@ -32,17 +32,17 @@ proc printKeyCodes*() {.importc: "linenoisePrintKeyCodes".}
|
||||
|
||||
proc free*(s: cstring) {.importc: "free", header: "<stdlib.h>".}
|
||||
|
||||
when defined nimExperimentalLinenoiseExtra:
|
||||
when defined(nimExperimentalLinenoiseExtra) and not defined(windows):
|
||||
# C interface
|
||||
type linenoiseStatus = enum
|
||||
type LinenoiseStatus = enum
|
||||
linenoiseStatus_ctrl_unknown
|
||||
linenoiseStatus_ctrl_C
|
||||
linenoiseStatus_ctrl_D
|
||||
|
||||
type linenoiseData* = object
|
||||
status: linenoiseStatus
|
||||
type LinenoiseData* = object
|
||||
status: LinenoiseStatus
|
||||
|
||||
proc linenoiseExtra(prompt: cstring, data: ptr linenoiseData): cstring {.importc.}
|
||||
proc linenoiseExtra(prompt: cstring, data: ptr LinenoiseData): cstring {.importc.}
|
||||
|
||||
# stable nim interface
|
||||
type Status* = enum
|
||||
@@ -65,7 +65,7 @@ when defined nimExperimentalLinenoiseExtra:
|
||||
if ret.line.len > 0: echo ret.line
|
||||
if ret.status == lnCtrlD: break
|
||||
echo "exiting"
|
||||
var data: linenoiseData
|
||||
var data: LinenoiseData
|
||||
let buf = linenoiseExtra(prompt, data.addr)
|
||||
result.line = $buf
|
||||
free(buf)
|
||||
|
||||
@@ -30,4 +30,7 @@ hint("Processing", off)
|
||||
# switch("hint", "ConvFromXtoItselfNotNeeded")
|
||||
|
||||
# experimental API's are enabled in testament, refs https://github.com/timotheecour/Nim/issues/575
|
||||
# sync with `kochdocs.docDefines` or refactor.
|
||||
switch("define", "nimExperimentalAsyncjsThen")
|
||||
switch("define", "nimExperimentalJsfetch")
|
||||
switch("define", "nimExperimentalLinenoiseExtra")
|
||||
|
||||
@@ -8,7 +8,8 @@ const
|
||||
gaCode* = " --doc.googleAnalytics:UA-48159761-1"
|
||||
# errormax: subsequent errors are probably consequences of 1st one; a simple
|
||||
# bug could cause unlimited number of errors otherwise, hard to debug in CI.
|
||||
nimArgs = "--errormax:3 --hint:Conf:off --hint:Path:off --hint:Processing:off --hint:XDeclaredButNotUsed:off --warning:UnusedImport:off -d:boot --putenv:nimversion=$#" % system.NimVersion
|
||||
docDefines = "-d:nimExperimentalAsyncjsThen -d:nimExperimentalJsfetch -d:nimExperimentalLinenoiseExtra"
|
||||
nimArgs = "--errormax:3 --hint:Conf:off --hint:Path:off --hint:Processing:off --hint:XDeclaredButNotUsed:off --warning:UnusedImport:off -d:boot --putenv:nimversion=$# $#" % [system.NimVersion, docDefines]
|
||||
gitUrl = "https://github.com/nim-lang/Nim"
|
||||
docHtmlOutput = "doc/html"
|
||||
webUploadOutput = "web/upload"
|
||||
|
||||
Reference in New Issue
Block a user