summary refs log tree commit diff stats
path: root/compiler/nimblecmd.nim
Commit message (Collapse)AuthorAgeFilesLines
* compiler refactoring; use typesafe path handing; docgen: render symbols ↵Andreas Rumpf2018-09-071-7/+7
| | | | between modules
* fixes #8776Araq2018-08-271-10/+11
|
* remove more global variables in the Nim compilerAndreas Rumpf2018-05-271-1/+1
|
* move more global variables into ConfigRefAndreas Rumpf2018-05-111-4/+4
|
* big refactoring: parser compiles againAndreas Rumpf2018-05-101-12/+13
|
* fixes #6949Araq2017-12-211-6/+18
|
* implemented new experimental scriptable import mechanismAndreas Rumpf2017-10-011-4/+4
|
* Fixed handling of versions with dashes in nimble pkgs (#6335)Yuriy Glukhov2017-09-061-9/+20
|
* Implement .nimble-link files in the compiler and add tests for them.Dominik Picheta2017-09-021-3/+14
|
* Add readme to tests. Add fileDir option to testament & create nimble test.Dominik Picheta2017-09-021-35/+60
|
* fixes #5752Araq2017-05-021-11/+30
|
* removed compiler internal list implementation (#5371)Arne Döring2017-02-221-4/+4
|
* remove unused stuffJacek Sieka2016-08-091-12/+0
|
* added getOrDefault; bootstrapping works againAraq2015-10-131-1/+1
|
* compiler: Trim .nim files trailing whitespaceAdam Strzelecki2015-09-041-3/+3
| | | | via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
* Introduce NotesVerbosity defining verbosity levelsAdam Strzelecki2015-07-031-1/+1
| | | | | | | | | | | | | | This solves two issues: 1. Some notes were enabled explicitly for some verbosity levels, so --hintName:on has no effect if verbosity level was too low. 2. Verbosity level for notes is not longer scattered across the source code, instead if now lives in msgs.nim NotesVerbosity array 3. Individual note settings have stronger effect than verbosity setting, so --hintName:off will disable hint regardless of high verbosity setting, and vice-versa --hintName:on will enable hint even on low verbosity setting.
* Fix typosFederico Ceratto2015-02-151-1/+1
|
* VM supports math and a few os procsAraq2014-08-301-1/+1
|
* renamed babelcmd to nimblecmd; config files are now nim.cfg; other renamingsAraq2014-08-291-0/+90
db.h nl_types.h poll.h pthread.h pwd.h sched.h select.h semaphore.h signal.h socket.h spawn.h stat.h statvfs.h stdio.h stdlib.h string.h strings.h tcp.h time.h types.h ucontext.h uio.h utsname.h unistd.h wait.h varargs.h windows.h zlib.h """.split BucketSize = 40 proc includes(headerpath, headerfile: string, whitelist: StringTableRef) = whitelist[headerfile] = "processed" for line in lines(headerpath): if line =~ peg"""s <- ws '#include' ws ('"' / '<') {[^">]+} ('"' / '>') ws comment <- '/*' @ '*/' / '//' .* ws <- (comment / \s+)* """: let m = matches[0].extractFilename if whitelist[m] != "processed": whitelist[m] = "found" proc processIncludes(dir: string, whitelist: StringTableRef) = for kind, path in walkDir(dir): case kind of pcFile: let name = extractFilename(path) if ('.' notin name and "include" in path) or ("c++" in path): let n = whitelist[name] if n != "processed": whitelist[name] = "found" if name.endswith(".h"): let n = whitelist[name] if n == "found": includes(path, name, whitelist) of pcDir: processIncludes(path, whitelist) else: discard proc gatherFiles(dir: string, whitelist: StringTableRef, result: var seq[string]) = for kind, path in walkDir(dir): case kind of pcFile: let name = extractFilename(path) if not whitelist.hasKey(name): result.add(path) of pcDir: gatherFiles(path, whitelist, result) else: discard proc newName(f: string): string = let (dir, name, ext) = splitFile(f) return dir / "trim_" & name & ext proc ccStillWorks(): bool = const c1 = r"nim c --force_build koch" c2 = r"nim c --force_build --threads:on --out:temp.exe tools/trimcc" result = execShellCmd(c1) == 0 and execShellCmd(c2) == 0 proc trialDeletion(files: seq[string], a, b: int) = for i in a .. min(b, files.high): let path = files[i] moveFile(dest=newName(path), source=path) if ccStillWorks(): for i in a .. min(b, files.high): let path = files[i] echo "Optional: ", path removeFile(newName(path)) else: for i in a .. min(b, files.high): let path = files[i] echo "Required: ", path # copy back: moveFile(dest=path, source=newName(path)) proc main(dir: string) = var whitelist = newStringTable(modeCaseInsensitive) for e in Essential: whitelist[e] = "found" while true: let oldLen = whitelist.len processIncludes(dir, whitelist) if oldLen == whitelist.len: break var allFiles: seq[string] = @[] gatherFiles(dir, whitelist, allFiles) when true: var i = 0 while i < allFiles.len: trialDeletion(allFiles, i, i+BucketSize-1) inc i, BucketSize else: for x in allFiles: echo x proc fakeTimeDep() = echo(times.getDateStr()) proc fakedeps() = var x = 0.4 {.emit: "#if 0\n".} fakeCppDep(addr x) {.emit: "#endif\n".} # this is not true: if math.sin(x) > 0.6: spawn(fakeTimeDep()) if paramCount() == 1: doAssert ccStillWorks() fakedeps() main(paramStr(1)) else: quit "Usage: trimcc c_compiler_directory"