diff options
author | Araq <rumpf_a@web.de> | 2015-07-01 01:29:28 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-07-01 02:15:21 +0200 |
commit | 54a374a8285a3a3387bcf0d31bbca0946ed28d51 (patch) | |
tree | 27ed87bd0dc8ec0d676957e64144b44f9c8c2d56 /compiler | |
parent | 4afb8b8043ab4c92c3ac69da3f6b5fc0a136e41a (diff) | |
download | Nim-54a374a8285a3a3387bcf0d31bbca0946ed28d51.tar.gz |
.header pragma now supports preprocessor directives
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/cgen.nim | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 390150cf7..f4854c988 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -610,10 +610,12 @@ proc generateHeaders(m: BModule) = add(m.s[cfsHeaders], tnl & "#include \"nimbase.h\"" & tnl) var it = PStrEntry(m.headerFiles.head) while it != nil: - if it.data[0] notin {'\"', '<'}: - addf(m.s[cfsHeaders], "$N#include \"$1\"$N", [rope(it.data)]) + if it.data[0] == '#': + 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: - 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) proc retIsNotVoid(s: PSym): bool = @@ -814,7 +816,7 @@ proc genVarPrototype(m: BModule, sym: PSym) = genVarPrototypeAux(m, sym) proc addIntTypes(result: var Rope) {.inline.} = - addf(result, "#define NIM_INTBITS $1", [ + addf(result, "#define NIM_INTBITS $1" & tnl, [ platform.CPU[targetCPU].intSize.rope]) proc getCopyright(cfile: string): Rope = |