code cleanup and debugging stuff

This commit is contained in:
Andreas Rumpf
2017-03-03 10:19:49 +01:00
parent a9c1afd5fd
commit 50835257d6
2 changed files with 5 additions and 23 deletions

View File

@@ -199,20 +199,7 @@ proc returnEpc(socket: Socket, uid: BiggestInt, s: SexpNode|string,
let response = $convertSexp([newSSymbol(return_symbol), uid, s])
socket.send(toHex(len(response), 6))
socket.send(response)
template sendEpc(results: typed, tdef, hook: untyped) =
hook = proc (s: tdef) =
results.add(
# Put newlines to parse output by flycheck-nim.el
when results is string: s & "\n"
else: s
)
executeEpc(gIdeCmd, args, graph, cache)
let res = sexp(results)
if gLogging:
log($res)
returnEpc(client, uid, res)
log "did send " & response
template checkSanity(client, sizeHex, size, messageBuffer: typed) =
if client.recv(sizeHex, 6) != 6:
@@ -350,11 +337,6 @@ proc replEpc(x: ThreadParams) {.thread.} =
gIdeCmd = parseIdeCmd(message[2].getSymbol)
case gIdeCmd
of ideChk:
setVerbosity(1)
# Use full path because other emacs plugins depends it
gListFullPaths = true
incl(gGlobalOptions, optIdeDebug)
of ideSug, ideCon, ideDef, ideUse, ideDus, ideOutline, ideHighlight:
setVerbosity(0)
else: discard

View File

@@ -148,7 +148,7 @@ proc sendEpcStr(socket: Socket; cmd: string) =
proc recvEpc(socket: Socket): string =
var L = newStringOfCap(6)
if socket.recv(L, 6) != 6:
raise newException(ValueError, "recv A failed")
raise newException(ValueError, "recv A failed #" & L & "#")
let x = parseHexInt(L)
result = newString(x)
if socket.recv(result, x) != x:
@@ -225,7 +225,7 @@ proc runEpcTest(filename: string): int =
for cmd in s.startup:
if not runCmd(cmd, s.dest):
quit "invalid command: " & cmd
let epccmd = s.cmd.replace("--tester", "--epc --v2")
let epccmd = s.cmd.replace("--tester", "--epc --v2 --log")
let cl = parseCmdLine(epccmd)
var p = startProcess(command=cl[0], args=cl[1 .. ^1],
options={poStdErrToStdOut, poUsePath,
@@ -299,8 +299,8 @@ proc runTest(filename: string): int =
proc main() =
var failures = 0
when false:
let x = getAppDir() / "tests/tdot1.nim"
when true:
let x = getAppDir() / "tests/tchk1.nim"
let xx = expandFilename x
failures += runEpcTest(xx)
else: