cgen.nim: code cleanups
This commit is contained in:
parent
a6d49c3a81
commit
4700018d7e
1 changed files with 17 additions and 15 deletions
|
|
@ -699,23 +699,24 @@ proc generateHeaders(m: BModule) =
|
||||||
for it in m.headerFiles:
|
for it in m.headerFiles:
|
||||||
if it[0] == '#':
|
if it[0] == '#':
|
||||||
add(m.s[cfsHeaders], rope(it.replace('`', '"') & "\L"))
|
add(m.s[cfsHeaders], rope(it.replace('`', '"') & "\L"))
|
||||||
elif it[0] notin {'\"', '<'}:
|
elif it[0] notin {'"', '<'}:
|
||||||
addf(m.s[cfsHeaders], "#include \"$1\"$N", [rope(it)])
|
addf(m.s[cfsHeaders], "#include \"$1\"$N", [rope(it)])
|
||||||
else:
|
else:
|
||||||
addf(m.s[cfsHeaders], "#include $1$N", [rope(it)])
|
addf(m.s[cfsHeaders], "#include $1$N", [rope(it)])
|
||||||
add(m.s[cfsHeaders], "#undef LANGUAGE_C\L")
|
add(m.s[cfsHeaders], """#undef LANGUAGE_C
|
||||||
add(m.s[cfsHeaders], "#undef MIPSEB\L")
|
#undef MIPSEB
|
||||||
add(m.s[cfsHeaders], "#undef MIPSEL\L")
|
#undef MIPSEL
|
||||||
add(m.s[cfsHeaders], "#undef PPC\L")
|
#undef PPC
|
||||||
add(m.s[cfsHeaders], "#undef R3000\L")
|
#undef R3000
|
||||||
add(m.s[cfsHeaders], "#undef R4000\L")
|
#undef R4000
|
||||||
add(m.s[cfsHeaders], "#undef i386\L")
|
#undef i386
|
||||||
add(m.s[cfsHeaders], "#undef linux\L")
|
#undef linux
|
||||||
add(m.s[cfsHeaders], "#undef mips\L")
|
#undef mips
|
||||||
add(m.s[cfsHeaders], "#undef near\L")
|
#undef near
|
||||||
add(m.s[cfsHeaders], "#undef far\L")
|
#undef far
|
||||||
add(m.s[cfsHeaders], "#undef powerpc\L")
|
#undef powerpc
|
||||||
add(m.s[cfsHeaders], "#undef unix\L")
|
#undef unix
|
||||||
|
""")
|
||||||
|
|
||||||
proc openNamespaceNim(namespace: string): Rope =
|
proc openNamespaceNim(namespace: string): Rope =
|
||||||
result.add("namespace ")
|
result.add("namespace ")
|
||||||
|
|
@ -1358,7 +1359,8 @@ proc genMainProc(m: BModule) =
|
||||||
m.s[cfsProcs].add closeNamespaceNim() & "using namespace " & m.config.cppCustomNamespace & ";\L"
|
m.s[cfsProcs].add closeNamespaceNim() & "using namespace " & m.config.cppCustomNamespace & ";\L"
|
||||||
|
|
||||||
appcg(m, m.s[cfsProcs], otherMain, [])
|
appcg(m, m.s[cfsProcs], otherMain, [])
|
||||||
if m.config.cppCustomNamespace.len > 0: m.s[cfsProcs].add openNamespaceNim(m.config.cppCustomNamespace)
|
if m.config.cppCustomNamespace.len > 0:
|
||||||
|
m.s[cfsProcs].add openNamespaceNim(m.config.cppCustomNamespace)
|
||||||
|
|
||||||
proc registerModuleToMain(g: BModuleList; m: BModule) =
|
proc registerModuleToMain(g: BModuleList; m: BModule) =
|
||||||
let
|
let
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue