changed name mangling for generated C files

This commit is contained in:
Araq
2019-09-13 19:11:48 +02:00
parent 5018e7f304
commit fd63443419
2 changed files with 3 additions and 3 deletions

View File

@@ -1080,7 +1080,7 @@ proc runJsonBuildInstructions*(conf: ConfigRef; projectfile: AbsoluteFile) =
add(cmds, c[1].getStr)
let (_, name, _) = splitFile(c[0].getStr)
add(prettyCmds, "CC: " & name)
add(prettyCmds, "CC: " & demanglePackageName(name))
let prettyCb = proc (idx: int) =
when declared(echo):

View File

@@ -40,10 +40,10 @@ proc getPackageName*(conf: ConfigRef; path: string): string =
proc fakePackageName*(conf: ConfigRef; path: AbsoluteFile): string =
# foo-#head/../bar becomes @foo-@hhead@s..@sbar
result = "@" & relativeTo(path, conf.projectPath, '/').string.multiReplace({"/": "@s", "#": "@h", "@": "@@"})
result = "@m" & relativeTo(path, conf.projectPath, '/').string.multiReplace({"/": "@s", "#": "@h", "@": "@@"})
proc demanglePackageName*(path: string): string =
result = path[1 .. ^1].multiReplace({"@@": "@", "@h": "#", "@s": "/"})
result = path.multiReplace({"@@": "@", "@h": "#", "@s": "/", "@m": ""})
proc withPackageName*(conf: ConfigRef; path: AbsoluteFile): AbsoluteFile =
let x = getPackageName(conf, path.string)