summary refs log tree commit diff stats
path: root/compiler/sighashes.nim
Commit message (Expand)AuthorAgeFilesLines
* Correctly hash inferred types (#8286)LemonBoy2018-07-121-1/+1
* Don't blow up with recursive objectsLemonBoy2018-06-221-4/+3
* Discriminate gensym'd type names in sigHashLemonBoy2018-06-221-2/+4
* fix #7653Zahary Karadjov2018-06-101-10/+15
* Support code hot reloading for JavaScript projects (#7362)zah2018-04-131-1/+30
* fixes #7364Araq2018-03-191-1/+1
* fixes #6889Andreas Rumpf2017-12-081-0/+3
* fixes another sighashes problemAraq2017-12-081-5/+17
* deprecated unary '<'Andreas Rumpf2017-10-291-3/+3
* some work to make 'opt' a first class typeAndreas Rumpf2017-09-241-1/+1
* fix compilation regression in aleaZahary Karadjov2017-04-161-11/+1
* fixes #5218Andreas Rumpf2017-01-161-1/+1
* happy new yearAraq2017-01-071-1/+1
* make nimforum compile againAraq2016-12-311-1/+4
* fixes #5147Araq2016-12-301-7/+25
* fixes #5135Andreas Rumpf2016-12-211-0/+5
* bugfix: aporia compiles againAraq2016-12-201-0/+1
* sighashes: multi-methods should work nowAndreas Rumpf2016-12-131-0/+2
* sighashes: do not use the ID mechanism at allAraq2016-12-131-0/+13
* make tsigbreak.nim compileAndreas Rumpf2016-12-121-3/+2
* tgettypeinst works again; fixes an infinite recursion in signature hashingAndreas Rumpf2016-12-061-3/+3
* re-enable object name generation for less dependence on IDsAraq2016-12-051-0/+9
* more fixesAraq2016-12-031-1/+7
* more tests workAraq2016-12-021-1/+1
* more fixesAraq2016-12-021-0/+8
* further progress; more tests are greenAraq2016-11-281-17/+12
* further progressAraq2016-11-281-4/+8
* attempt to fix thingsAndreas Rumpf2016-11-231-1/+5
* the compiler uses tyAlias internally; tester compiles againAraq2016-11-161-3/+6
* removed tyArrayConstr completely from the compiler; introduced tyAlias instea...Araq2016-11-141-1/+1
* bootstrapping works againAraq2016-11-121-5/+18
* signature hashing: more progressAraq2016-11-111-27/+56
* use a full MD5 hash with no collision detection for proc namesAraq2016-11-081-14/+88
* C codegen: first version of signature hashing for better incremental buildsAraq2016-11-081-0/+137
pre>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

                                                      
                     
 
    
                                                        
 
                                                
                                                             






                                                              



                                                             
                                                                         
                                
         
                              

                                 
             
                               

                                     
                                         
                                                                 



                                               
                     
                                        
     
                                                 
# Simple tool to merge C projects into a single C file

import os, sets, pegs

type
  ProcessResult = enum prSkipIncludeDir, prAddIncludeDir

proc process(dir, infile: string, outfile: File,
             processed: var HashSet[string]): ProcessResult =
  if processed.containsOrIncl(infile): return prSkipIncludeDir
  let toProcess = dir / infile
  if not existsFile(toProcess):
    echo "Warning: could not process: ", toProcess
    return prAddIncludeDir
  echo "adding: ", toProcess
  for line in lines(toProcess):
    if line =~ peg"""s <- ig '#include' ig '"' {[^"]+} '"' ig
                     comment <- '/*' !'*/'* '*/' / '//' .*
                     ig <- (comment / \s+)* """:
      # follow the include file:
      if process(dir, matches[0], outfile, processed) == prAddIncludeDir:
        writeLine(outfile, line)
    else:
      writeLine(outfile, line)

proc main(dir, outfile: string) =
  var o: File
  if open(o, outfile, fmWrite):
    var processed = initSet[string]()
    processed.incl(outfile)
    for infile in walkfiles(dir / "*.c"):
      discard process(dir, extractFilename(infile), o, processed)
    close(o)
  else:
    quit("Cannot open for writing: " & outfile)

if paramCount() != 2:
  quit "Usage: cmerge directory outfile"
else:
  main(paramStr(1), addFileExt(paramStr(2), "c"))