Skip to content

Commit

Permalink
scriptcomp: don't print encoding debug text for each thread
Browse files Browse the repository at this point in the history
  • Loading branch information
niv committed Dec 17, 2023
1 parent c3f8f03 commit 7f50682
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions nwn_script_comp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ var demandResRefThread: Thread[void]
createThread(demandResRefThread) do ():
# TODO: Make shared init less sucky. We need to call this here to set up args (again)
# so newBasicResMan can refer to it.
discard DOC(ArgsHelp)
discard DOC(ArgsHelp, false)

let rm = newBasicResMan()

Expand Down Expand Up @@ -185,7 +185,7 @@ proc getThreadState(): ThreadState {.gcsafe.} =
new(state)
# TODO: make shared init less sucky. We need to init this here because workers
# will depend on logging and related to be set up.
discard DOC(ArgsHelp)
discard DOC(ArgsHelp, false)
state.chDemandResRefResponse.open(maxItems=1)
state.cNSS = newCompiler(params.langSpec, params.debugSymbols, resolveFile, params.maxIncludeDepth)
state.cNSS.setOptimizations(params.optFlags)
Expand Down
7 changes: 4 additions & 3 deletions private/shared.nim
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type OptArgs* = Table[string, docopt_internal.Value]

var Args {.threadvar.}: OptArgs

proc DOC*(body: string): OptArgs =
proc DOC*(body: string, mainThread = true): OptArgs =
let body2 = body.replace("$USAGE", GlobalUsage).
replace("$0", getAppFilename().extractFilename()).
replace("$OPTRESMAN", getResmanOpts()).
Expand All @@ -93,8 +93,9 @@ proc DOC*(body: string): OptArgs =
setNwnEncoding($Args["--nwn-encoding"])
setNativeEncoding($Args["--other-encoding"])

debug("NWN file encoding: " & getNwnEncoding())
debug("Other file encoding: " & getNativeEncoding())
if mainThread:
debug("NWN file encoding: " & getNwnEncoding())
debug("Other file encoding: " & getNativeEncoding())

if Args.hasKey("--add-restypes") and Args["--add-restypes"]:
let types = ($Args["--add-restypes"]).split(",").mapIt(it.split(":"))
Expand Down

0 comments on commit 7f50682

Please sign in to comment.