move more globals into the config object

This commit is contained in:
Andreas Rumpf
2018-05-13 14:19:42 +02:00
parent e4c088721a
commit 297038f704
6 changed files with 101 additions and 93 deletions

View File

@@ -2025,7 +2025,7 @@ template genStmtListExprImpl(exprOrStmt) {.dirty.} =
let theMacro = it[0].sym
add p.s(cpsStmts), initFrameNoDebug(p, frameName,
makeCString theMacro.name.s,
theMacro.info.quotedFilename, it.info.line.int)
quotedFilename(p.config, theMacro.info), it.info.line.int)
else:
genStmts(p, it)
if n.len > 0: exprOrStmt

View File

@@ -225,7 +225,7 @@ proc genLineDir(p: BProc, t: PNode) =
(p.prc == nil or sfPure notin p.prc.flags) and tt.info.fileIndex != InvalidFileIDX:
if freshLineInfo(p, tt.info):
linefmt(p, cpsStmts, "nimln_($1, $2);$n",
line.rope, tt.info.quotedFilename)
line.rope, quotedFilename(p.config, tt.info))
proc postStmtActions(p: BProc) {.inline.} =
add(p.s(cpsStmts), p.module.injectStmt)
@@ -771,7 +771,7 @@ proc genProcAux(m: BModule, prc: PSym) =
if optStackTrace in prc.options:
add(generatedProc, p.s(cpsLocals))
var procname = makeCString(prc.name.s)
add(generatedProc, initFrame(p, procname, prc.info.quotedFilename))
add(generatedProc, initFrame(p, procname, quotedFilename(p.config, prc.info)))
else:
add(generatedProc, p.s(cpsLocals))
if optProfiler in prc.options:
@@ -1151,7 +1151,7 @@ proc genInitCode(m: BModule) =
incl m.flags, frameDeclared
if preventStackTrace notin m.flags:
var procname = makeCString(m.module.name.s)
add(prc, initFrame(m.initProc, procname, m.module.info.quotedFilename))
add(prc, initFrame(m.initProc, procname, quotedFilename(m.config, m.module.info)))
else:
add(prc, ~"\tTFrame FR_; FR_.len = 0;$N")

View File

@@ -380,11 +380,11 @@ proc getConfigVar(conf: ConfigRef; c: TSystemCC, suffix: string): string =
# use ``cpu.os.cc`` for cross compilation, unless ``--compileOnly`` is given
# for niminst support
let fullSuffix =
if gCmd == cmdCompileToCpp:
if conf.cmd == cmdCompileToCpp:
".cpp" & suffix
elif gCmd == cmdCompileToOC:
elif conf.cmd == cmdCompileToOC:
".objc" & suffix
elif gCmd == cmdCompileToJS:
elif conf.cmd == cmdCompileToJS:
".js" & suffix
else:
suffix
@@ -535,7 +535,7 @@ proc needsExeExt(conf: ConfigRef): bool {.inline.} =
(platform.hostOS == osWindows)
proc getCompilerExe(conf: ConfigRef; compiler: TSystemCC; cfile: string): string =
result = if gCmd == cmdCompileToCpp and not cfile.endsWith(".c"):
result = if conf.cmd == cmdCompileToCpp and not cfile.endsWith(".c"):
CC[compiler].cppCompiler
else:
CC[compiler].compilerExe
@@ -546,7 +546,7 @@ proc getCompilerExe(conf: ConfigRef; compiler: TSystemCC; cfile: string): string
proc getLinkerExe(conf: ConfigRef; compiler: TSystemCC): string =
result = if CC[compiler].linkerExe.len > 0: CC[compiler].linkerExe
elif gMixedMode and gCmd != cmdCompileToCpp: CC[compiler].cppCompiler
elif gMixedMode and conf.cmd != cmdCompileToCpp: CC[compiler].cppCompiler
else: getCompilerExe(conf, compiler, "")
proc getCompileCFileCmd*(conf: ConfigRef; cfile: Cfile): string =
@@ -610,7 +610,7 @@ proc footprint(conf: ConfigRef; cfile: Cfile): SecureHash =
getCompileCFileCmd(conf, cfile))
proc externalFileChanged(conf: ConfigRef; cfile: Cfile): bool =
if gCmd notin {cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdCompileToLLVM}:
if conf.cmd notin {cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdCompileToLLVM}:
return false
var hashFile = toGeneratedFile(conf, conf.withPackageName(cfile.cname), "sha1")

View File

@@ -99,8 +99,7 @@ proc newFileInfo(fullPath, projPath: string): TFileInfo =
result.shortName = fileName.changeFileExt("")
result.quotedName = fileName.makeCString
result.quotedFullName = fullPath.makeCString
if optEmbedOrigSrc in gGlobalOptions or true:
result.lines = @[]
result.lines = @[]
when defined(nimpretty):
if result.fullPath.len > 0:
try:
@@ -268,10 +267,10 @@ template toFilename*(info: TLineInfo): string =
template toFullPath*(info: TLineInfo): string =
info.fileIndex.toFullPath
proc toMsgFilename*(info: TLineInfo): string =
proc toMsgFilename*(conf: ConfigRef; info: TLineInfo): string =
if info.fileIndex.int32 < 0:
result = "???"
elif gListFullPaths:
elif optListFullPaths in conf.globalOptions:
result = fileInfos[info.fileIndex.int32].fullPath
else:
result = fileInfos[info.fileIndex.int32].projPath
@@ -306,7 +305,7 @@ type
msgSkipHook ## skip message hook even if it is present
MsgFlags* = set[MsgFlag]
proc msgWriteln*(s: string, flags: MsgFlags = {}) =
proc msgWriteln*(conf: ConfigRef; s: string, flags: MsgFlags = {}) =
## Writes given message string to stderr by default.
## If ``--stdout`` option is given, writes to stdout instead. If message hook
## is present, then it is used to output message rather than stderr/stdout.
@@ -318,7 +317,7 @@ proc msgWriteln*(s: string, flags: MsgFlags = {}) =
if not isNil(writelnHook) and msgSkipHook notin flags:
writelnHook(s)
elif optStdout in gGlobalOptions or msgStdout in flags:
elif optStdout in conf.globalOptions or msgStdout in flags:
if eStdOut in errorOutputs:
writeLine(stdout, s)
flushFile(stdout)
@@ -359,13 +358,13 @@ template callWritelnHook(args: varargs[string, `$`]) =
template styledMsgWriteln*(args: varargs[typed]) =
if not isNil(writelnHook):
callIgnoringStyle(callWritelnHook, nil, args)
elif optStdout in gGlobalOptions:
elif optStdout in conf.globalOptions:
if eStdOut in errorOutputs:
callIgnoringStyle(writeLine, stdout, args)
flushFile(stdout)
else:
if eStdErr in errorOutputs:
if optUseColors in gGlobalOptions:
if optUseColors in conf.globalOptions:
callStyledWriteLineStderr(args)
else:
callIgnoringStyle(writeLine, stderr, args)
@@ -405,14 +404,14 @@ proc quit(conf: ConfigRef; msg: TMsgKind) =
proc handleError(conf: ConfigRef; msg: TMsgKind, eh: TErrorHandling, s: string) =
if msg >= fatalMin and msg <= fatalMax:
if gCmd == cmdIdeTools: log(s)
if conf.cmd == cmdIdeTools: log(s)
quit(conf, msg)
if msg >= errMin and msg <= errMax:
inc(conf.errorCounter)
options.gExitcode = 1'i8
conf.exitcode = 1'i8
if conf.errorCounter >= conf.errorMax:
quit(conf, msg)
elif eh == doAbort and gCmd != cmdIdeTools:
elif eh == doAbort and conf.cmd != cmdIdeTools:
quit(conf, msg)
elif eh == doRaise:
raiseRecoverableError(s)
@@ -433,7 +432,7 @@ proc writeContext(conf: ConfigRef; lastinfo: TLineInfo) =
Severity.Error)
else:
styledMsgWriteln(styleBright,
PosFormat % [toMsgFilename(msgContext[i]),
PosFormat % [toMsgFilename(conf, msgContext[i]),
coordToStr(msgContext[i].line.int),
coordToStr(msgContext[i].col+1)],
resetStyle,
@@ -441,7 +440,7 @@ proc writeContext(conf: ConfigRef; lastinfo: TLineInfo) =
info = msgContext[i]
proc ignoreMsgBecauseOfIdeTools(conf: ConfigRef; msg: TMsgKind): bool =
msg >= errGenerated and gCmd == cmdIdeTools and optIdeDebug notin gGlobalOptions
msg >= errGenerated and conf.cmd == cmdIdeTools and optIdeDebug notin conf.globalOptions
proc rawMessage*(conf: ConfigRef; msg: TMsgKind, args: openArray[string]) =
var
@@ -457,7 +456,7 @@ proc rawMessage*(conf: ConfigRef; msg: TMsgKind, args: openArray[string]) =
color = ErrorColor
of warnMin..warnMax:
sev = Severity.Warning
if optWarns notin gOptions: return
if optWarns notin conf.options: return
if msg notin conf.notes: return
writeContext(conf, unknownLineInfo())
title = WarningTitle
@@ -466,7 +465,7 @@ proc rawMessage*(conf: ConfigRef; msg: TMsgKind, args: openArray[string]) =
inc(conf.warnCounter)
of hintMin..hintMax:
sev = Severity.Hint
if optHints notin gOptions: return
if optHints notin conf.options: return
if msg notin conf.notes: return
title = HintTitle
color = HintColor
@@ -489,20 +488,20 @@ proc rawMessage*(conf: ConfigRef; msg: TMsgKind, arg: string) =
rawMessage(conf, msg, [arg])
proc resetAttributes*(conf: ConfigRef) =
if {optUseColors, optStdout} * gGlobalOptions == {optUseColors}:
if {optUseColors, optStdout} * conf.globalOptions == {optUseColors}:
terminal.resetAttributes(stderr)
proc writeSurroundingSrc(conf: ConfigRef; info: TLineInfo) =
const indent = " "
msgWriteln(indent & $sourceLine(conf, info))
msgWriteln(indent & spaces(info.col) & '^')
msgWriteln(conf, indent & $sourceLine(conf, info))
msgWriteln(conf, indent & spaces(info.col) & '^')
proc formatMsg*(info: TLineInfo, msg: TMsgKind, arg: string): string =
proc formatMsg*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string): string =
let title = case msg
of warnMin..warnMax: WarningTitle
of hintMin..hintMax: HintTitle
else: ErrorTitle
result = PosFormat % [toMsgFilename(info), coordToStr(info.line.int),
result = PosFormat % [toMsgFilename(conf, info), coordToStr(info.line.int),
coordToStr(info.col+1)] &
title &
getMessageStr(msg, arg)
@@ -527,7 +526,7 @@ proc liMessage(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string,
lastError = info
of warnMin..warnMax:
sev = Severity.Warning
ignoreMsg = optWarns notin gOptions or msg notin conf.notes
ignoreMsg = optWarns notin conf.options or msg notin conf.notes
if not ignoreMsg: writeContext(conf, info)
title = WarningTitle
color = WarningColor
@@ -535,7 +534,7 @@ proc liMessage(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string,
inc(conf.warnCounter)
of hintMin..hintMax:
sev = Severity.Hint
ignoreMsg = optHints notin gOptions or msg notin conf.notes
ignoreMsg = optHints notin conf.options or msg notin conf.notes
title = HintTitle
color = HintColor
if msg != hintUserRaw: kind = HintsToStr[ord(msg) - ord(hintMin)]
@@ -543,7 +542,7 @@ proc liMessage(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string,
# NOTE: currently line info line numbers start with 1,
# but column numbers start with 0, however most editors expect
# first column to be 1, so we need to +1 here
let x = PosFormat % [toMsgFilename(info), coordToStr(info.line.int),
let x = PosFormat % [toMsgFilename(conf, info), coordToStr(info.line.int),
coordToStr(info.col+1)]
let s = getMessageStr(msg, arg)
@@ -585,12 +584,12 @@ proc message*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg = "") =
liMessage(conf, info, msg, arg, doNothing)
proc internalError*(conf: ConfigRef; info: TLineInfo, errMsg: string) =
if gCmd == cmdIdeTools and structuredErrorHook.isNil: return
if conf.cmd == cmdIdeTools and structuredErrorHook.isNil: return
writeContext(conf, info)
liMessage(conf, info, errInternal, errMsg, doAbort)
proc internalError*(conf: ConfigRef; errMsg: string) =
if gCmd == cmdIdeTools and structuredErrorHook.isNil: return
if conf.cmd == cmdIdeTools and structuredErrorHook.isNil: return
writeContext(conf, unknownLineInfo())
rawMessage(conf, errInternal, errMsg)
@@ -619,9 +618,9 @@ proc sourceLine*(conf: ConfigRef; i: TLineInfo): Rope =
result = fileInfos[i.fileIndex.int32].lines[i.line.int-1]
proc quotedFilename*(i: TLineInfo): Rope =
proc quotedFilename*(conf: ConfigRef; i: TLineInfo): Rope =
assert i.fileIndex.int32 >= 0
if optExcessiveStackTrace in gGlobalOptions:
if optExcessiveStackTrace in conf.globalOptions:
result = fileInfos[i.fileIndex.int32].quotedFullName
else:
result = fileInfos[i.fileIndex.int32].quotedName
@@ -634,21 +633,21 @@ ropes.errorHandler = proc (err: RopesError, msg: string, useWarning: bool) =
rawMessage(newPartialConfigRef(), if useWarning: warnCannotOpenFile else: errCannotOpenFile, msg)
proc listWarnings*(conf: ConfigRef) =
msgWriteln("Warnings:")
msgWriteln(conf, "Warnings:")
for warn in warnMin..warnMax:
msgWriteln(" [$1] $2" % [
msgWriteln(conf, " [$1] $2" % [
if warn in conf.notes: "x" else: " ",
configuration.WarningsToStr[ord(warn) - ord(warnMin)]
])
proc listHints*(conf: ConfigRef) =
msgWriteln("Hints:")
msgWriteln(conf, "Hints:")
for hint in hintMin..hintMax:
msgWriteln(" [$1] $2" % [
msgWriteln(conf, " [$1] $2" % [
if hint in conf.notes: "x" else: " ",
configuration.HintsToStr[ord(hint) - ord(hintMin)]
])
# enable colors by default on terminals
if terminal.isatty(stderr):
incl(gGlobalOptions, optUseColors)
#if terminal.isatty(stderr):
# incl(gGlobalOptions, optUseColors)

View File

@@ -70,6 +70,11 @@ type # please make sure we have under 32 options
optIdeTerse # idetools: use terse descriptions
optNoCppExceptions # use C exception handling even with CPP
optExcessiveStackTrace # fully qualified module filenames
opWholeProject # for 'doc2': output any dependency
optListFullPaths
optNoNimblePath
optDynlibOverrideAll
optUseNimNamespace
TGlobalOptions* = set[TGlobalOption]
@@ -111,8 +116,22 @@ type
destructor,
notnil
SymbolFilesOption* = enum
disabledSf, enabledSf, writeOnlySf, readOnlySf, v2Sf
ConfigRef* = ref object ## eventually all global configuration should be moved here
linesCompiled*: int # all lines that have been compiled
options*: TOptions
globalOptions*: TGlobalOptions
exitcode*: int8
cmd*: TCommands # the command
selectedGC*: TGCMode # the selected GC
verbosity*: int # how verbose the compiler is
numberOfProcessors*: int # number of processors
evalExpr*: string # expression for idetools --eval
lastCmdTime*: float # when caas is enabled, we measure each command
symbolFiles*: SymbolFilesOption
cppDefines*: HashSet[string]
headerFile*: string
features*: set[Feature]
@@ -154,6 +173,17 @@ type
const oldExperimentalFeatures* = {implicitDeref, dotOperators, callOperator, parallel}
const
ChecksOptions* = {optObjCheck, optFieldCheck, optRangeCheck, optNilCheck,
optOverflowCheck, optBoundsCheck, optAssert, optNaNCheck, optInfCheck,
optMoveCheck}
DefaultOptions* = {optObjCheck, optFieldCheck, optRangeCheck,
optBoundsCheck, optOverflowCheck, optAssert, optWarns,
optHints, optStackTrace, optLineTrace,
optPatterns, optNilCheck, optMoveCheck}
DefaultGlobalOptions* = {optThreadAnalysis, optUseColors}
template newPackageCache*(): untyped =
newStringTable(when FileSystemCaseSensitive:
modeCaseInsensitive
@@ -161,7 +191,13 @@ template newPackageCache*(): untyped =
modeCaseSensitive)
proc newConfigRef*(): ConfigRef =
result = ConfigRef(cppDefines: initSet[string](),
result = ConfigRef(
selectedGC: gcRefc,
verbosity: 1,
options: DefaultOptions,
globalOptions: DefaultGlobalOptions,
evalExpr: "",
cppDefines: initSet[string](),
headerFile: "", features: {}, foreignPackageNotes: {hintProcessing, warnUnknownMagic,
hintQuitCalled, hintExecuting},
notes: NotesVerbosity[1], mainPackageNotes: NotesVerbosity[1],
@@ -188,7 +224,12 @@ proc newConfigRef*(): ConfigRef =
proc newPartialConfigRef*(): ConfigRef =
## create a new ConfigRef that is only good enough for error reporting.
result = ConfigRef(foreignPackageNotes: {hintProcessing, warnUnknownMagic,
result = ConfigRef(
selectedGC: gcRefc,
verbosity: 1,
options: DefaultOptions,
globalOptions: DefaultGlobalOptions,
foreignPackageNotes: {hintProcessing, warnUnknownMagic,
hintQuitCalled, hintExecuting},
notes: NotesVerbosity[1], mainPackageNotes: NotesVerbosity[1])
@@ -234,48 +275,15 @@ proc isDefined*(conf: ConfigRef; symbol: string): bool =
osDragonfly, osMacosx}
else: discard
const
ChecksOptions* = {optObjCheck, optFieldCheck, optRangeCheck, optNilCheck,
optOverflowCheck, optBoundsCheck, optAssert, optNaNCheck, optInfCheck,
optMoveCheck}
var
gOptions*: TOptions = {optObjCheck, optFieldCheck, optRangeCheck,
optBoundsCheck, optOverflowCheck, optAssert, optWarns,
optHints, optStackTrace, optLineTrace,
optPatterns, optNilCheck, optMoveCheck}
gGlobalOptions*: TGlobalOptions = {optThreadAnalysis}
gExitcode*: int8
gCmd*: TCommands = cmdNone # the command
gSelectedGC* = gcRefc # the selected GC
#headerFile*: string = ""
gVerbosity* = 1 # how verbose the compiler is
gNumberOfProcessors*: int # number of processors
gWholeProject*: bool # for 'doc2': output any dependency
gEvalExpr* = "" # expression for idetools --eval
gLastCmdTime*: float # when caas is enabled, we measure each command
gListFullPaths*: bool
gPreciseStack*: bool
gNoNimblePath*: bool
gDynlibOverrideAll*: bool
useNimNamespace*: bool
type
SymbolFilesOption* = enum
disabledSf, enabledSf, writeOnlySf, readOnlySf, v2Sf
var gSymbolFiles*: SymbolFilesOption
proc importantComments*(conf: ConfigRef): bool {.inline.} = gCmd in {cmdDoc, cmdIdeTools}
proc usesNativeGC*(conf: ConfigRef): bool {.inline.} = gSelectedGC >= gcRefc
template preciseStack*(conf: ConfigRef): bool = gPreciseStack
proc importantComments*(conf: ConfigRef): bool {.inline.} = conf.cmd in {cmdDoc, cmdIdeTools}
proc usesNativeGC*(conf: ConfigRef): bool {.inline.} = conf.selectedGC >= gcRefc
template compilationCachePresent*(conf: ConfigRef): untyped =
gSymbolFiles in {enabledSf, writeOnlySf}
conf.symbolFiles in {enabledSf, writeOnlySf}
# {optCaasEnabled, optSymbolFiles} * gGlobalOptions != {}
template optPreserveOrigSource*(conf: ConfigRef): untyped =
optEmbedOrigSrc in gGlobalOptions
optEmbedOrigSrc in conf.globalOptions
const
genSubDir* = "nimcache"
@@ -374,7 +382,7 @@ proc removeTrailingDirSep*(path: string): string =
result = path
proc disableNimblePath*(conf: ConfigRef) =
gNoNimblePath = true
incl conf.globalOptions, optNoNimblePath
conf.lazyPaths.setLen(0)
include packagehandling
@@ -503,7 +511,8 @@ proc inclDynlibOverride*(conf: ConfigRef; lib: string) =
conf.dllOverrides[lib.canonDynlibName] = "true"
proc isDynlibOverride*(conf: ConfigRef; lib: string): bool =
result = gDynlibOverrideAll or conf.dllOverrides.hasKey(lib.canonDynlibName)
result = optDynlibOverrideAll in conf.globalOptions or
conf.dllOverrides.hasKey(lib.canonDynlibName)
proc binaryStrSearch*(x: openArray[string], y: string): int =
var a = 0

View File

@@ -61,7 +61,7 @@ proc stackTraceAux(c: PCtx; x: PStackFrame; pc: int; recursionLimit=100) =
while x != nil:
inc calls
x = x.next
msgWriteln($calls & " calls omitted\n")
msgWriteln(c.config, $calls & " calls omitted\n")
return
stackTraceAux(c, x.next, x.comesFrom, recursionLimit-1)
var info = c.debug[pc]
@@ -78,11 +78,11 @@ proc stackTraceAux(c: PCtx; x: PStackFrame; pc: int; recursionLimit=100) =
if x.prc != nil:
for k in 1..max(1, 25-s.len): add(s, ' ')
add(s, x.prc.name.s)
msgWriteln(s)
msgWriteln(c.config, s)
proc stackTrace(c: PCtx, tos: PStackFrame, pc: int,
msg: string, n: PNode = nil) =
msgWriteln("stack trace: (most recent call last)")
msgWriteln(c.config, "stack trace: (most recent call last)")
stackTraceAux(c, tos, pc)
# XXX test if we want 'globalError' for every mode
let lineInfo = if n == nil: c.debug[pc] else: n.info
@@ -402,7 +402,7 @@ template handleJmpBack() {.dirty.} =
if allowInfiniteLoops in c.features:
c.loopIterations = MaxLoopIterations
else:
msgWriteln("stack trace: (most recent call last)")
msgWriteln(c.config, "stack trace: (most recent call last)")
stackTraceAux(c, tos, pc)
globalError(c.config, c.debug[pc], errTooManyIterations)
dec(c.loopIterations)
@@ -907,13 +907,13 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
of opcEcho:
let rb = instr.regB
if rb == 1:
msgWriteln(regs[ra].node.strVal, {msgStdout})
msgWriteln(c.config, regs[ra].node.strVal, {msgStdout})
else:
var outp = ""
for i in ra..ra+rb-1:
#if regs[i].kind != rkNode: debug regs[i]
outp.add(regs[i].node.strVal)
msgWriteln(outp, {msgStdout})
msgWriteln(c.config, outp, {msgStdout})
of opcContainsSet:
decodeBC(rkInt)
regs[ra].intVal = ord(inSet(regs[rb].node, regs[rc].regToNode))
@@ -1355,11 +1355,11 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
c.debug[pc].toFullPath, c.debug[pc].line.int,
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) =
if error.isNil and msg <= errMax:
error = formatMsg(info, msg, arg))
error = formatMsg(conf, info, msg, arg))
if not error.isNil:
c.errorFlag = error
elif sonsLen(ast) != 1:
c.errorFlag = formatMsg(c.debug[pc], errGenerated,
c.errorFlag = formatMsg(c.config, c.debug[pc], errGenerated,
"expected expression, but got multiple statements")
else:
regs[ra].node = ast.sons[0]
@@ -1370,7 +1370,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
c.debug[pc].toFullPath, c.debug[pc].line.int,
proc (conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string) =
if error.isNil and msg <= errMax:
error = formatMsg(info, msg, arg))
error = formatMsg(conf, info, msg, arg))
if not error.isNil:
c.errorFlag = error
else: