docs now show nimExperimentalX APIs (#18345)

* docs now show nimExperimentalX APIs

* fix for windows
This commit is contained in:
Timothee Cour 2021-06-25 07:47:10 -07:00 • committed by GitHub
commit 8535b26a75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View file

@ -3,7 +3,7 @@
when not defined(js): when not defined(js):
{.fatal: "Module jsfetch is designed to be used with the JavaScript backend.".} {.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] import std/[asyncjs, jsheaders, jsformdata]
from std/httpcore import HttpMethod from std/httpcore import HttpMethod
from std/jsffi import JsObject from std/jsffi import JsObject

View file

@ -32,17 +32,17 @@ proc printKeyCodes*() {.importc: "linenoisePrintKeyCodes".}
proc free*(s: cstring) {.importc: "free", header: "<stdlib.h>".} proc free*(s: cstring) {.importc: "free", header: "<stdlib.h>".}
when defined nimExperimentalLinenoiseExtra: when defined(nimExperimentalLinenoiseExtra) and not defined(windows):
# C interface # C interface
type linenoiseStatus = enum type LinenoiseStatus = enum
linenoiseStatus_ctrl_unknown linenoiseStatus_ctrl_unknown
linenoiseStatus_ctrl_C linenoiseStatus_ctrl_C
linenoiseStatus_ctrl_D linenoiseStatus_ctrl_D
type linenoiseData* = object type LinenoiseData* = object
status: linenoiseStatus status: LinenoiseStatus
proc linenoiseExtra(prompt: cstring, data: ptr linenoiseData): cstring {.importc.} proc linenoiseExtra(prompt: cstring, data: ptr LinenoiseData): cstring {.importc.}
# stable nim interface # stable nim interface
type Status* = enum type Status* = enum
@ -65,7 +65,7 @@ when defined nimExperimentalLinenoiseExtra:
if ret.line.len > 0: echo ret.line if ret.line.len > 0: echo ret.line
if ret.status == lnCtrlD: break if ret.status == lnCtrlD: break
echo "exiting" echo "exiting"
var data: linenoiseData var data: LinenoiseData
let buf = linenoiseExtra(prompt, data.addr) let buf = linenoiseExtra(prompt, data.addr)
result.line = $buf result.line = $buf
free(buf) free(buf)

View file

@ -30,4 +30,7 @@ hint("Processing", off)
# switch("hint", "ConvFromXtoItselfNotNeeded") # switch("hint", "ConvFromXtoItselfNotNeeded")
# experimental API's are enabled in testament, refs https://github.com/timotheecour/Nim/issues/575 # 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", "nimExperimentalAsyncjsThen")
switch("define", "nimExperimentalJsfetch")
switch("define", "nimExperimentalLinenoiseExtra")

View file

@ -8,7 +8,8 @@ const
gaCode* = " --doc.googleAnalytics:UA-48159761-1" gaCode* = " --doc.googleAnalytics:UA-48159761-1"
# errormax: subsequent errors are probably consequences of 1st one; a simple # errormax: subsequent errors are probably consequences of 1st one; a simple
# bug could cause unlimited number of errors otherwise, hard to debug in CI. # 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" gitUrl = "https://github.com/nim-lang/Nim"
docHtmlOutput = "doc/html" docHtmlOutput = "doc/html"
webUploadOutput = "web/upload" webUploadOutput = "web/upload"