parent
488f3ed085
commit
8397554315
4 changed files with 60 additions and 22 deletions
|
|
@ -62,8 +62,14 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
|
||||||
cbos listDirs:
|
cbos listDirs:
|
||||||
listDirs(a, {pcDir})
|
listDirs(a, {pcDir})
|
||||||
cbos removeDir:
|
cbos removeDir:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
os.removeDir getString(a, 0)
|
os.removeDir getString(a, 0)
|
||||||
cbos removeFile:
|
cbos removeFile:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
os.removeFile getString(a, 0)
|
os.removeFile getString(a, 0)
|
||||||
cbos createDir:
|
cbos createDir:
|
||||||
os.createDir getString(a, 0)
|
os.createDir getString(a, 0)
|
||||||
|
|
@ -76,12 +82,24 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
|
||||||
cbos getCurrentDir:
|
cbos getCurrentDir:
|
||||||
setResult(a, os.getCurrentDir())
|
setResult(a, os.getCurrentDir())
|
||||||
cbos moveFile:
|
cbos moveFile:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
os.moveFile(getString(a, 0), getString(a, 1))
|
os.moveFile(getString(a, 0), getString(a, 1))
|
||||||
cbos moveDir:
|
cbos moveDir:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
os.moveDir(getString(a, 0), getString(a, 1))
|
os.moveDir(getString(a, 0), getString(a, 1))
|
||||||
cbos copyFile:
|
cbos copyFile:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
os.copyFile(getString(a, 0), getString(a, 1))
|
os.copyFile(getString(a, 0), getString(a, 1))
|
||||||
cbos copyDir:
|
cbos copyDir:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
os.copyDir(getString(a, 0), getString(a, 1))
|
os.copyDir(getString(a, 0), getString(a, 1))
|
||||||
cbos getLastModificationTime:
|
cbos getLastModificationTime:
|
||||||
setResult(a, getLastModificationTime(getString(a, 0)).toUnix)
|
setResult(a, getLastModificationTime(getString(a, 0)).toUnix)
|
||||||
|
|
@ -89,6 +107,9 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
|
||||||
setResult(a, os.findExe(getString(a, 0)))
|
setResult(a, os.findExe(getString(a, 0)))
|
||||||
|
|
||||||
cbos rawExec:
|
cbos rawExec:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
setResult(a, osproc.execCmd getString(a, 0))
|
setResult(a, osproc.execCmd getString(a, 0))
|
||||||
|
|
||||||
cbconf getEnv:
|
cbconf getEnv:
|
||||||
|
|
@ -164,9 +185,15 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
|
||||||
cbconf cppDefine:
|
cbconf cppDefine:
|
||||||
options.cppDefine(conf, a.getString(0))
|
options.cppDefine(conf, a.getString(0))
|
||||||
cbexc stdinReadLine, EOFError:
|
cbexc stdinReadLine, EOFError:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
setResult(a, "")
|
setResult(a, "")
|
||||||
setResult(a, stdin.readLine())
|
setResult(a, stdin.readLine())
|
||||||
cbexc stdinReadAll, EOFError:
|
cbexc stdinReadAll, EOFError:
|
||||||
|
if defined(nimsuggest) or graph.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
setResult(a, "")
|
setResult(a, "")
|
||||||
setResult(a, stdin.readAll())
|
setResult(a, stdin.readAll())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1549,6 +1549,9 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
regs[ra].node.strVal = opSlurp(regs[rb].node.strVal, c.debug[pc],
|
regs[ra].node.strVal = opSlurp(regs[rb].node.strVal, c.debug[pc],
|
||||||
c.module, c.config)
|
c.module, c.config)
|
||||||
of opcGorge:
|
of opcGorge:
|
||||||
|
if defined(nimsuggest) or c.config.cmd == cmdCheck:
|
||||||
|
discard "don't run staticExec for 'nim suggest'"
|
||||||
|
else:
|
||||||
when defined(nimcore):
|
when defined(nimcore):
|
||||||
decodeBC(rkNode)
|
decodeBC(rkNode)
|
||||||
inc pc
|
inc pc
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,14 @@ template wrap2svoid(op, modop) {.dirty.} =
|
||||||
op(getString(a, 0), getString(a, 1))
|
op(getString(a, 0), getString(a, 1))
|
||||||
modop op
|
modop op
|
||||||
|
|
||||||
|
template wrapDangerous(op, modop) {.dirty.} =
|
||||||
|
proc `op Wrapper`(a: VmArgs) {.nimcall.} =
|
||||||
|
if defined(nimsuggest) or c.config.cmd == cmdCheck:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
|
op(getString(a, 0), getString(a, 1))
|
||||||
|
modop op
|
||||||
|
|
||||||
proc getCurrentExceptionMsgWrapper(a: VmArgs) {.nimcall.} =
|
proc getCurrentExceptionMsgWrapper(a: VmArgs) {.nimcall.} =
|
||||||
setResult(a, if a.currentException.isNil: ""
|
setResult(a, if a.currentException.isNil: ""
|
||||||
else: a.currentException.sons[3].skipColon.strVal)
|
else: a.currentException.sons[3].skipColon.strVal)
|
||||||
|
|
@ -133,7 +141,7 @@ proc registerAdditionalOps*(c: PCtx) =
|
||||||
wrap2svoid(putEnv, osop)
|
wrap2svoid(putEnv, osop)
|
||||||
wrap1s(dirExists, osop)
|
wrap1s(dirExists, osop)
|
||||||
wrap1s(fileExists, osop)
|
wrap1s(fileExists, osop)
|
||||||
wrap2svoid(writeFile, ioop)
|
wrapDangerous(writeFile, ioop)
|
||||||
wrap1s(readFile, ioop)
|
wrap1s(readFile, ioop)
|
||||||
wrap2si(readLines, ioop)
|
wrap2si(readLines, ioop)
|
||||||
systemop getCurrentExceptionMsg
|
systemop getCurrentExceptionMsg
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue