summary refs log tree commit diff stats
path: root/compiler/idgen.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-10-21 01:06:24 +0200
committerAraq <rumpf_a@web.de>2011-10-21 01:06:24 +0200
commita6f90d4cdd397017436d385fbf2b54d80e4c1a77 (patch)
tree752909b3c019fb71c566e4404bbd197ca0a5d10b /compiler/idgen.nim
parent7ebaf44897c0e2b0229654cc110b751f54275edb (diff)
downloadNim-a6f90d4cdd397017436d385fbf2b54d80e4c1a77.tar.gz
first steps to C file merge operation for incremental compilation
Diffstat (limited to 'compiler/idgen.nim')
-rw-r--r--compiler/idgen.nim9
1 files changed, 6 insertions, 3 deletions
diff --git a/compiler/idgen.nim b/compiler/idgen.nim
index f5ae8a1f8..8bcfa37b7 100644
--- a/compiler/idgen.nim
+++ b/compiler/idgen.nim
@@ -9,7 +9,7 @@
 
 ## This module contains a simple persistent id generator.
 
-import idents, strutils, os
+import idents, strutils, os, options
 
 var gFrontEndId, gBackendId*: int
 
@@ -40,15 +40,18 @@ proc setId*(id: int) {.inline.} =
 proc IDsynchronizationPoint*(idRange: int) = 
   gFrontEndId = (gFrontEndId div IdRange + 1) * IdRange + 1
 
+proc toGid(f: string): string =
+  result = options.completeGeneratedFilePath(f.addFileExt("gid"))
+
 proc saveMaxIds*(project: string) =
-  var f = open(project.addFileExt("gid"), fmWrite)
+  var f = open(project.toGid, fmWrite)
   f.writeln($gFrontEndId)
   f.writeln($gBackEndId)
   f.close()
   
 proc loadMaxIds*(project: string) =
   var f: TFile
-  if open(f, project.addFileExt("gid"), fmRead):
+  if open(f, project.toGid, fmRead):
     var frontEndId = parseInt(f.readLine)
     var backEndId = parseInt(f.readLine)
     gFrontEndId = max(gFrontEndId, frontEndId)