about summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* shutil_generatorized: fixed bad destination name on move+overwritehut2010-04-261-2/+2
* gui.colorscheme: fixed error when using custom colorschemeshut2010-04-261-0/+4
* fsobject.directory: removed invalid signal binding 'setopt.filter'hut2010-04-261-1/+1
* TODO: updatehut2010-04-261-0/+2
* ranger.defaults.apps: use "make" for Makefileshut2010-04-231-0/+3
* main: fixed "ranger /path/to/a/file"hut2010-04-231-4/+6
* main: new function "load_apps"hut2010-04-231-0/+13
* main: new function "allow_access_to_confdir"hut2010-04-231-6/+14
* Move loader.py from ranger.fsobject to ranger.corehut2010-04-204-3/+2
* updated pydochut2010-04-205-248/+10
* ext.shutil_generatorized: fixed __all__hut2010-04-201-1/+1
* ext.shutil_generatorized: little optimizationhut2010-04-201-2/+2
* ext.shutil_generatorized: remove unused functions/importshut2010-04-201-36/+0
* updated pydochut2010-04-1941-2286/+247
* defaults.commands: bugfixhut2010-04-191-1/+1
* defaults.keys: quit pager with F3hut2010-04-191-2/+2
* TODO: updatedhut2010-04-191-1/+2
* Added midnight commander-like function keyshut2010-04-192-1/+23
* ranger.api: import common variableshut2010-04-196-2/+7
* Turn keycomb ".term" into command ":terminal"hut2010-04-193-1/+13
* Clean uphut2010-04-1915-53/+39
* Use "/" for root in tabname if "dirname_in_tab" is truehut2010-04-191-1/+1
* added option "dirname_in_tabs"hut2010-04-193-3/+16
* ext.keybinding_parser: added aliases for common special keyshut2010-04-191-0/+3
* ext.keybinding_parser: fixed function keyshut2010-04-192-1/+4
* defaults.apps: added fceuxhut2010-04-191-0/+6
* README: Removed finished parts of roadmaphut2010-04-191-2/+0
* defaults.keys: updated hint, added "zm"hut2010-04-191-2/+3
* defaults.keys: fixed "%", default percentage back to 50hut2010-04-191-1/+1
* defaults.keys: added "zs"hut2010-04-191-0/+1
* defaults.keys: fixed "zd"hut2010-04-191-1/+1
* defaults.apps: run ff/opera detached, dont open swf in elinkshut2010-04-191-1/+5
* defaults.apps: harmless typohut2010-04-191-1/+1
* core.actions: abstracted searching strings in filenameshut2010-04-192-5/+8
* api.commands: fixed python3 compatibiliy errorhut2010-04-191-4/+4
* ext.command_parser: bugfix in tab completionhut2010-04-181-0/+1
* defaults.keys: added zP keyhut2010-04-181-0/+1
* shared.settings: Bugfix, read the options properlyhut2010-04-181-0/+3
* gui.ui: fixed <C-c> keyhut2010-04-181-2/+2
* defaults.keys: added <Enter> mapping in browserhut2010-04-181-0/+1
* Merge branch 'devel'hut2010-04-1838-1244/+2388
|\
| * ranger.main: Added compatibility warninghut2010-04-182-0/+6
| * removed code for backwards compatibiltyhut2010-04-184-69/+0
| * defaults.keys: another examplehut2010-04-181-1/+2
| * ranger.defaults.keys: added documentationhut2010-04-181-1/+18
| * container.keymap: removed __getitem__ from KeyManagerhut2010-04-182-2/+1
| * Rename context "general" to "browser" for less ambiguityhut2010-04-183-5/+5
| * gui.displayable: always move when resizinghut2010-04-181-3/+1
| * tc_displayable: improved (but not fixed) test_boundarieshut2010-04-181-6/+8
| * tc_displayable: test_boundaries fails if you run it more often!hut2010-04-181-20/+21
lass="w"> strtabs const hasTinyCBackend* = defined(tinyc) useEffectSystem* = true hasFFI* = defined(useFFI) newScopeForIf* = true useCaas* = not defined(noCaas) type # please make sure we have under 32 options # (improves code efficiency a lot!) TOption* = enum # **keep binary compatible** optNone, optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck, optOverflowCheck, optNilCheck, optNaNCheck, optInfCheck, optAssert, optLineDir, optWarns, optHints, optOptimizeSpeed, optOptimizeSize, optStackTrace, # stack tracing support optLineTrace, # line tracing support (includes stack tracing) optEndb, # embedded debugger optByRef, # use pass by ref for objects # (for interfacing with C) optProfiler, # profiler turned on optImplicitStatic, # optimization: implicit at compile time # evaluation optPatterns # en/disable pattern matching TOptions* = set[TOption] TGlobalOption* = enum # **keep binary compatible** gloptNone, optForceFullMake, optDeadCodeElim, optListCmd, optCompileOnly, optNoLinking, optSafeCode, # only allow safe code optCDebug, # turn on debugging information optGenDynLib, # generate a dynamic library optGenStaticLib, # generate a static library optGenGuiApp, # generate a GUI application optGenScript, # generate a script file to compile the *.c files optGenMapping, # generate a mapping file optRun, # run the compiled project optSymbolFiles, # use symbol files for speeding up compilation optCaasEnabled # compiler-as-a-service is running optSkipConfigFile, # skip the general config file optSkipProjConfigFile, # skip the project's config file optSkipUserConfigFile, # skip the users's config file optSkipParentConfigFiles, # skip parent dir's config files optNoMain, # do not generate a "main" proc optThreads, # support for multi-threading optStdout, # output to stdout optSuggest, # ideTools: 'suggest' optContext, # ideTools: 'context' optDef, # ideTools: 'def' optUsages, # ideTools: 'usages' optThreadAnalysis, # thread analysis pass optTaintMode, # taint mode turned on optTlsEmulation, # thread var emulation turned on optGenIndex # generate index file for documentation; optEmbedOrigSrc # embed the original source in the generated code # also: generate header file TGlobalOptions* = set[TGlobalOption] TCommands* = enum # Nimrod's commands # **keep binary compatible** cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdCompileToJS, cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc, cmdGenDepend, cmdDump, cmdCheck, # semantic checking for whole project cmdParse, # parse a single file (for debugging) cmdScan, # scan a single file (for debugging) cmdIdeTools, # ide tools cmdDef, # def feature (find definition for IDEs) cmdRst2html, # convert a reStructuredText file to HTML cmdRst2tex, # convert a reStructuredText file to TeX cmdInteractive, # start interactive session cmdRun # run the project via TCC backend TStringSeq* = seq[string] TGCMode* = enum # the selected GC gcNone, gcBoehm, gcMarkAndSweep, gcRefc, gcV2, gcGenerational const ChecksOptions* = {optObjCheck, optFieldCheck, optRangeCheck, optNilCheck, optOverflowCheck, optBoundsCheck, optAssert, optNaNCheck, optInfCheck} var gOptions*: TOptions = {optObjCheck, optFieldCheck, optRangeCheck, optBoundsCheck, optOverflowCheck, optAssert, optWarns, optHints, optStackTrace, optLineTrace, optPatterns, optNilCheck} gGlobalOptions*: TGlobalOptions = {optThreadAnalysis} gExitcode*: int8 gCmd*: TCommands = cmdNone # the command gSelectedGC* = gcRefc # the selected GC searchPaths*, lazyPaths*: TLinkedList outFile*: string = "" headerFile*: string = "" gVerbosity* = 1 # how verbose the compiler is gNumberOfProcessors*: int # number of processors gWholeProject*: bool # for 'doc2': output any dependency gEvalExpr* = "" # expression for idetools --eval gLastCmdTime*: float # when caas is enabled, we measure each command gListFullPaths*: bool isServing*: bool = false gDirtyBufferIdx* = 0'i32 # indicates the fileIdx of the dirty version of # the tracked source X, saved by the CAAS client. gDirtyOriginalIdx* = 0'i32 # the original source file of the dirtified buffer. proc importantComments*(): bool {.inline.} = gCmd in {cmdDoc, cmdIdeTools} proc usesNativeGC*(): bool {.inline.} = gSelectedGC >= gcRefc template isWorkingWithDirtyBuffer*: expr = gDirtyBufferIdx != 0 template compilationCachePresent*: expr = {optCaasEnabled, optSymbolFiles} * gGlobalOptions != {} template optPreserveOrigSource*: expr = optEmbedOrigSrc in gGlobalOptions template optPrintSurroundingSrc*: expr = gVerbosity >= 2 const genSubDir* = "nimcache" NimExt* = "nim" RodExt* = "rod" HtmlExt* = "html" TexExt* = "tex" IniExt* = "ini" DefaultConfig* = "nimrod.cfg" DocConfig* = "nimdoc.cfg" DocTexConfig* = "nimdoc.tex.cfg" # additional configuration variables: var gConfigVars* = newStringTable(modeStyleInsensitive) gDllOverrides = newStringtable(modeCaseInsensitive) libpath* = "" gProjectName* = "" # holds a name like 'nimrod' gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/ gProjectFull* = "" # projectPath/projectName gProjectMainIdx*: int32 # the canonical path id of the main module optMainModule* = "" # the main module that should be used for idetools commands nimcacheDir* = "" command* = "" # the main command (e.g. cc, check, scan, etc) commandArgs*: seq[string] = @[] # any arguments after the main command gKeepComments*: bool = true # whether the parser needs to keep comments implicitImports*: seq[string] = @[] # modules that are to be implicitly imported implicitIncludes*: seq[string] = @[] # modules that are to be implicitly included const oKeepVariableNames* = true const oUseLateInstantiation* = false proc mainCommandArg*: string = ## This is intended for commands like check or parse ## which will work on the main project file unless ## explicitly given a specific file argument if commandArgs.len > 0: result = commandArgs[0] else: result = gProjectName proc existsConfigVar*(key: string): bool = result = hasKey(gConfigVars, key) proc getConfigVar*(key: string): string = result = gConfigVars[key] proc setConfigVar*(key, val: string) = gConfigVars[key] = val proc getOutFile*(filename, ext: string): string = if options.outFile != "": result = options.outFile else: result = changeFileExt(filename, ext) proc getPrefixDir*(): string = ## gets the application directory result = SplitPath(getAppDir()).head proc canonicalizePath*(path: string): string = result = path.expandFilename when not FileSystemCaseSensitive: result = result.toLower proc shortenDir*(dir: string): string = ## returns the interesting part of a dir var prefix = getPrefixDir() & dirSep if startsWith(dir, prefix): return substr(dir, len(prefix)) prefix = gProjectPath & dirSep if startsWith(dir, prefix): return substr(dir, len(prefix)) result = dir proc removeTrailingDirSep*(path: string): string = if (len(path) > 0) and (path[len(path) - 1] == dirSep): result = substr(path, 0, len(path) - 2) else: result = path proc getGeneratedPath: string = result = if nimcacheDir.len > 0: nimcacheDir else: gProjectPath.shortenDir / genSubDir proc getPackageName*(path: string): string = var q = 1 var b = 0 if path[len(path)-1] in {dirsep, altsep}: q = 2 for i in countdown(len(path)-q, 0): if path[i] in {dirsep, altsep}: if b == 0: b = i else: let x = path.substr(i+1, b-1) case x.normalize of "lib", "src", "source", "package", "pckg", "library", "private": b = i else: return x.replace('.', '_') result = "" proc withPackageName*(path: string): string = let x = path.getPackageName if x.len == 0: result = path else: let (p, file, ext) = path.splitFile result = (p / (x & '_' & file)) & ext proc toGeneratedFile*(path, ext: string): string = ## converts "/home/a/mymodule.nim", "rod" to "/home/a/nimcache/mymodule.rod" var (head, tail) = splitPath(path) #if len(head) > 0: head = shortenDir(head & dirSep) result = joinPath([getGeneratedPath(), changeFileExt(tail, ext)]) #echo "toGeneratedFile(", path, ", ", ext, ") = ", result proc completeGeneratedFilePath*(f: string, createSubDir: bool = true): string = var (head, tail) = splitPath(f) #if len(head) > 0: head = removeTrailingDirSep(shortenDir(head & dirSep)) var subdir = getGeneratedPath() # / head if createSubDir: try: createDir(subdir) except EOS: writeln(stdout, "cannot create directory: " & subdir) quit(1) result = joinPath(subdir, tail) #echo "completeGeneratedFilePath(", f, ") = ", result iterator iterSearchPath*(SearchPaths: TLinkedList): string = var it = PStrEntry(SearchPaths.head) while it != nil: yield it.data it = PStrEntry(it.Next) proc rawFindFile(f: string): string = for it in iterSearchPath(SearchPaths): result = JoinPath(it, f) if existsFile(result): return result.canonicalizePath result = "" proc rawFindFile2(f: string): string = var it = PStrEntry(lazyPaths.head) while it != nil: result = JoinPath(it.data, f) if existsFile(result): bringToFront(lazyPaths, it) return result.canonicalizePath it = PStrEntry(it.Next) result = "" proc FindFile*(f: string): string {.procvar.} = result = f.rawFindFile if result.len == 0: result = f.toLower.rawFindFile if result.len == 0: result = f.rawFindFile2 if result.len == 0: result = f.toLower.rawFindFile2 proc findModule*(modulename, currentModule: string): string = # returns path to module let m = addFileExt(modulename, nimExt) let currentPath = currentModule.splitFile.dir result = currentPath / m if not existsFile(result): result = FindFile(m) proc libCandidates*(s: string, dest: var seq[string]) = var le = strutils.find(s, '(') var ri = strutils.find(s, ')', le+1) if le >= 0 and ri > le: var prefix = substr(s, 0, le - 1) var suffix = substr(s, ri + 1) for middle in split(substr(s, le + 1, ri - 1), '|'): libCandidates(prefix & middle & suffix, dest) else: add(dest, s) proc canonDynlibName(s: string): string = let start = if s.startsWith("lib"): 3 else: 0 let ende = strutils.find(s, {'(', ')', '.'}) if ende >= 0: result = s.substr(start, ende-1) else: result = s.substr(start) proc inclDynlibOverride*(lib: string) = gDllOverrides[lib.canonDynlibName] = "true" proc isDynlibOverride*(lib: string): bool = result = gDllOverrides.hasKey(lib.canonDynlibName) proc binaryStrSearch*(x: openarray[string], y: string): int = var a = 0 var b = len(x) - 1 while a <= b: var mid = (a + b) div 2 var c = cmpIgnoreCase(x[mid], y) if c < 0: a = mid + 1 elif c > 0: b = mid - 1 else: return mid result = - 1 template nimdbg*: expr = c.module.fileIdx == gProjectMainIdx template cnimdbg*: expr = p.module.module.fileIdx == gProjectMainIdx template pnimdbg*: expr = p.lex.fileIdx == gProjectMainIdx template lnimdbg*: expr = L.fileIdx == gProjectMainIdx