-d:nocaas mode for easier bootstrapping on exotic OSes (Haiku)
This commit is contained in:
parent
8087f51d14
commit
6825a69a70
4 changed files with 37 additions and 22 deletions
|
|
@ -8,7 +8,10 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import
|
import
|
||||||
options, strutils, os, tables, sockets, ropes, platform
|
options, strutils, os, tables, ropes, platform
|
||||||
|
|
||||||
|
when useCaas:
|
||||||
|
import sockets
|
||||||
|
|
||||||
type
|
type
|
||||||
TMsgKind* = enum
|
TMsgKind* = enum
|
||||||
|
|
@ -529,14 +532,19 @@ var
|
||||||
gWarnCounter*: int = 0
|
gWarnCounter*: int = 0
|
||||||
gErrorMax*: int = 1 # stop after gErrorMax errors
|
gErrorMax*: int = 1 # stop after gErrorMax errors
|
||||||
gSilence*: int # == 0 if we produce any output at all
|
gSilence*: int # == 0 if we produce any output at all
|
||||||
stdoutSocket*: TSocket
|
|
||||||
|
when useCaas:
|
||||||
|
var stdoutSocket*: TSocket
|
||||||
|
|
||||||
proc SuggestWriteln*(s: string) =
|
proc SuggestWriteln*(s: string) =
|
||||||
if gSilence == 0:
|
if gSilence == 0:
|
||||||
|
when useCaas:
|
||||||
if isNil(stdoutSocket): Writeln(stdout, s)
|
if isNil(stdoutSocket): Writeln(stdout, s)
|
||||||
else:
|
else:
|
||||||
Writeln(stdout, s)
|
Writeln(stdout, s)
|
||||||
stdoutSocket.send(s & "\c\L")
|
stdoutSocket.send(s & "\c\L")
|
||||||
|
else:
|
||||||
|
Writeln(stdout, s)
|
||||||
|
|
||||||
proc SuggestQuit*() =
|
proc SuggestQuit*() =
|
||||||
if not isServing:
|
if not isServing:
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ const
|
||||||
useEffectSystem* = true
|
useEffectSystem* = true
|
||||||
hasFFI* = defined(useFFI)
|
hasFFI* = defined(useFFI)
|
||||||
newScopeForIf* = true
|
newScopeForIf* = true
|
||||||
|
useCaas* = not defined(noCaas)
|
||||||
|
|
||||||
type # please make sure we have under 32 options
|
type # please make sure we have under 32 options
|
||||||
# (improves code efficiency a lot!)
|
# (improves code efficiency a lot!)
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,12 @@
|
||||||
## Implements the "compiler as a service" feature.
|
## Implements the "compiler as a service" feature.
|
||||||
|
|
||||||
import
|
import
|
||||||
sockets,
|
|
||||||
times, commands, options, msgs, nimconf,
|
times, commands, options, msgs, nimconf,
|
||||||
extccomp, strutils, os, platform, parseopt
|
extccomp, strutils, os, platform, parseopt
|
||||||
|
|
||||||
|
when useCaas:
|
||||||
|
import sockets
|
||||||
|
|
||||||
# We cache modules and the dependency graph. However, we don't check for
|
# We cache modules and the dependency graph. However, we don't check for
|
||||||
# file changes but expect the client to tell us about them, otherwise the
|
# file changes but expect the client to tell us about them, otherwise the
|
||||||
# repeated CRC calculations may turn out to be too slow.
|
# repeated CRC calculations may turn out to be too slow.
|
||||||
|
|
@ -80,6 +82,7 @@ proc serve*(action: proc (){.nimcall.}) =
|
||||||
FlushFile(stdout)
|
FlushFile(stdout)
|
||||||
|
|
||||||
of "tcp", "":
|
of "tcp", "":
|
||||||
|
when useCaas:
|
||||||
var server = Socket()
|
var server = Socket()
|
||||||
let p = getConfigVar("server.port")
|
let p = getConfigVar("server.port")
|
||||||
let port = if p.len > 0: parseInt(p).TPort else: 6000.TPort
|
let port = if p.len > 0: parseInt(p).TPort else: 6000.TPort
|
||||||
|
|
@ -93,6 +96,8 @@ proc serve*(action: proc (){.nimcall.}) =
|
||||||
execute inp.string
|
execute inp.string
|
||||||
stdoutSocket.send("\c\L")
|
stdoutSocket.send("\c\L")
|
||||||
stdoutSocket.close()
|
stdoutSocket.close()
|
||||||
|
else:
|
||||||
|
quit "server.type not supported; compiler built without caas support"
|
||||||
else:
|
else:
|
||||||
echo "Invalid server.type:", typ
|
echo "Invalid server.type:", typ
|
||||||
quit 1
|
quit 1
|
||||||
|
|
|
||||||
1
koch.nim
1
koch.nim
|
|
@ -52,6 +52,7 @@ Boot options:
|
||||||
(not needed on Windows)
|
(not needed on Windows)
|
||||||
-d:useFFI build Nimrod with FFI support at compile time
|
-d:useFFI build Nimrod with FFI support at compile time
|
||||||
-d:nativeStacktrace use native stack traces (only for Mac OS X or Linux)
|
-d:nativeStacktrace use native stack traces (only for Mac OS X or Linux)
|
||||||
|
-d:noCaas build Nimrod without CAAS support
|
||||||
"""
|
"""
|
||||||
|
|
||||||
proc exe(f: string): string = return addFileExt(f, ExeExt)
|
proc exe(f: string): string = return addFileExt(f, ExeExt)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue