.header pragma now supports preprocessor directives
This commit is contained in:
parent
4afb8b8043
commit
54a374a828
1 changed files with 6 additions and 4 deletions
|
|
@ -610,10 +610,12 @@ proc generateHeaders(m: BModule) =
|
||||||
add(m.s[cfsHeaders], tnl & "#include \"nimbase.h\"" & tnl)
|
add(m.s[cfsHeaders], tnl & "#include \"nimbase.h\"" & tnl)
|
||||||
var it = PStrEntry(m.headerFiles.head)
|
var it = PStrEntry(m.headerFiles.head)
|
||||||
while it != nil:
|
while it != nil:
|
||||||
if it.data[0] notin {'\"', '<'}:
|
if it.data[0] == '#':
|
||||||
addf(m.s[cfsHeaders], "$N#include \"$1\"$N", [rope(it.data)])
|
add(m.s[cfsHeaders], rope(it.data.replace('`', '"') & tnl))
|
||||||
|
elif it.data[0] notin {'\"', '<'}:
|
||||||
|
addf(m.s[cfsHeaders], "#include \"$1\"$N", [rope(it.data)])
|
||||||
else:
|
else:
|
||||||
addf(m.s[cfsHeaders], "$N#include $1$N", [rope(it.data)])
|
addf(m.s[cfsHeaders], "#include $1$N", [rope(it.data)])
|
||||||
it = PStrEntry(it.next)
|
it = PStrEntry(it.next)
|
||||||
|
|
||||||
proc retIsNotVoid(s: PSym): bool =
|
proc retIsNotVoid(s: PSym): bool =
|
||||||
|
|
@ -814,7 +816,7 @@ proc genVarPrototype(m: BModule, sym: PSym) =
|
||||||
genVarPrototypeAux(m, sym)
|
genVarPrototypeAux(m, sym)
|
||||||
|
|
||||||
proc addIntTypes(result: var Rope) {.inline.} =
|
proc addIntTypes(result: var Rope) {.inline.} =
|
||||||
addf(result, "#define NIM_INTBITS $1", [
|
addf(result, "#define NIM_INTBITS $1" & tnl, [
|
||||||
platform.CPU[targetCPU].intSize.rope])
|
platform.CPU[targetCPU].intSize.rope])
|
||||||
|
|
||||||
proc getCopyright(cfile: string): Rope =
|
proc getCopyright(cfile: string): Rope =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue