Permalink
Browse files

Some work on #576

  • Loading branch information...
1 parent 4cf5c10 commit 1c4e303b543f193b4e66e5fcdbabb074bc75cc7b @nddrylliog nddrylliog committed Feb 17, 2013
@@ -33,20 +33,24 @@ CGenerator: class extends Skeleton {
init: func ~cgenerator (=params, =module) {
- if (params libcache) {
- hOutPath := File new(File new(params libcachePath, module getSourceFolderName()), module getPath(""))
- hOutPath parent mkdirs()
- hw = AwesomeWriter new(this, CachedFileWriter new(hOutPath path + ".h"))
- fw = AwesomeWriter new(this, CachedFileWriter new(hOutPath path + "-fwd.h"))
- } else {
- hw = AwesomeWriter new(this, CachedFileWriter new(File new(params outPath, module getPath(".h"))))
- fw = AwesomeWriter new(this, CachedFileWriter new(File new(params outPath, module getPath("-fwd.h"))))
+ hOutPath := match (params libcache) {
+ case true =>
+ File new(params libcachePath, module getPath(""))
+ case false =>
+ File new(params outPath, module getPath(""))
}
+ hOutPath parent mkdirs()
+
+ hw = _makeWriter(hOutPath path + ".h")
+ fw = _makeWriter(hOutPath path + "-fwd.h")
- cOutPath := File new(params outPath path, module getPath(".c"))
+ cOutPath := File new(params outPath, module getPath(".c"))
cOutPath parent mkdirs()
- cw = AwesomeWriter new(this, CachedFileWriter new(cOutPath path))
+ cw = _makeWriter(cOutPath path)
+ }
+ _makeWriter: func (path: String) -> AwesomeWriter {
+ AwesomeWriter new(this, CachedFileWriter new(path))
}
/** Write the whole module, return true if files were modified on-disk */
@@ -176,9 +176,9 @@ SequenceDriver: class extends Driver {
*/
buildModule: func (module: Module, sourceFolder: SourceFolder, force: Bool) -> Int {
- path := File new(params outPath, module getPath("")) getPath()
- cFile := File new(path + ".c")
- oFile := File new(params libcachePath, sourceFolder relativeObjectPath(module))
+ path := module getPath()
+ cFile := File new(params outPath, path + ".c")
+ oFile := File new(params libcachePath, path + ".o")
archive := sourceFolder archive
archiveDate := (archive ? File new(archive outlib) lastModified() : oFile lastModified())
@@ -49,7 +49,7 @@ Module: class extends Node {
this path = (File separator == '/') ? fullName : fullName replaceAll('/', File separator)
this oocPath = pathElement + File separator + path + ".ooc"
- // that's a Win32 fix - but I think it's due to an issue in
+ // win32 fix - sometimes we get fullName(s) with '\' in the input
this fullName = fullName replaceAll(File separator, '/')
idx := this fullName lastIndexOf('/')
@@ -83,6 +83,15 @@ Module: class extends Node {
}
}
+ getPath: func (suffix := "") -> String {
+ base := getSourceFolderName()
+ File new(base, path) path + suffix
+ }
+
+ getOocPath: func -> String {
+ oocPath
+ }
+
/**
* TODO: this is redundant with some stuff in Driver, merge those
*/
@@ -201,15 +210,6 @@ Module: class extends Node {
accept: func (visitor: Visitor) { visitor visitModule(this) }
- getPath: func (suffix: String) -> String {
- last := (File new(pathElement) name)
- return (last + File separator) + fullName replaceAll('/', File separator) + suffix
- }
-
- getOocPath: func -> String {
- oocPath
- }
-
/** return global (e.g. non-namespaced) imports */
getGlobalImports: func -> List<Import> { imports }

0 comments on commit 1c4e303

Please sign in to comment.