lots of small changes
This commit is contained in:
parent
c0c35839cc
commit
a5ecbf823f
85 changed files with 180 additions and 110 deletions
|
|
@ -252,7 +252,7 @@ template forwardPacketT*(typeName: expr): stmt {.dirty, immediate.} =
|
|||
proc `pack typeName`*(p: var typeName; s: PStream) =
|
||||
writeData(s, addr p, sizeof(p))
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
type
|
||||
SomeEnum = enum
|
||||
A = 0'i8,
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ template forwardPacketT*(typeName: untyped; underlyingType: untyped) {.dirty.} =
|
|||
#writeData(s, addr p, sizeof(p))
|
||||
buffer.write(underlyingType(ord))
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
type
|
||||
SomeEnum = enum
|
||||
A = 0'i8,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ macro `?`(a: untyped): untyped =
|
|||
result = ($a[1].ident)[0].lit
|
||||
## echo(?F,?a,?t,?t,?y)
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
macro foo(x: untyped) =
|
||||
result = newNimNode(nnkStmtList)
|
||||
result.add(newNimNode(nnkCall).und(!!"echo", "Hello thar".lit))
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ proc writeLEStr*(s: PStream, str: string) =
|
|||
s.write(str.len.int16)
|
||||
s.write(str)
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
var testStream = newStringStream()
|
||||
|
||||
testStream.writeLEStr("Hello")
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ template withDir*(dir: string; body: stmt): stmt =
|
|||
body
|
||||
cd(curDir)
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
if not existsFile("nakefile.nim"):
|
||||
echo "No nakefile.nim found. Current working dir is ", getCurrentDir()
|
||||
quit 1
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ handlers[HZoneJoinReq] = proc(client: PClient; buffer: PBuffer) =
|
|||
|
||||
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
import parseopt, matchers, os, json
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ proc mainRender() =
|
|||
proc readyMainState() =
|
||||
specInputClient.setActive()
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
import parseopt
|
||||
|
||||
localPlayer = newPlayer()
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ proc readChar*(buffer: PBuffer): char {.inline.} = return readInt8(buffer).char
|
|||
proc readBool*(buffer: PBuffer): bool {.inline.} = return readInt8(buffer).bool
|
||||
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
var b = newBuffer(100)
|
||||
var str = "hello there"
|
||||
b.write str
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ template unless*(condition: untyped; body: untyped) {.dirty.} =
|
|||
if not condition:
|
||||
body
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
proc dumpSeq[T](x: seq[T]) =
|
||||
for index, item in x.pairs:
|
||||
echo index, " ", item
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ defPacket(DsMsg, tuple[msg: string])
|
|||
let HVerifyClient* = 'v'
|
||||
defPacket(SdVerifyClient, tuple[session: ScLogin])
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
|
||||
var buf = newBuffer(100)
|
||||
var m = toMd5("hello there")
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ proc uncompress*(source: string, destLen: var int): string =
|
|||
echo "Error occurred: ", res
|
||||
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
import strutils
|
||||
var r = compress("Hello")
|
||||
echo repr(r)
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ proc poll*(timeout: int = 250) =
|
|||
echo("Write ", c, " result: ", res, " data: ", repr(c.outputBuf.data))
|
||||
c.outputBuf.flush()
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
import parseopt, matchers, strutils
|
||||
var cfgFile = "dirserver_settings.json"
|
||||
for kind, key, val in getOpt():
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ proc poll*(timeout: int = 250) =
|
|||
echo("Write ", c, " result: ", res, " data: ", c.outputBuf.data)
|
||||
c.outputBuf.flush()
|
||||
|
||||
when isMainModule:
|
||||
when true:
|
||||
import parseopt, matchers, strutils
|
||||
var zoneCfgFile = "./server_settings.json"
|
||||
for kind, key, val in getOpt():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue