From cd2c6128d1df471830ea7f842b57aa32aee5deab Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 29 Aug 2014 09:03:00 +0200 Subject: [PATCH] renamed babelcmd to nimblecmd; config files are now nim.cfg; other renamings --- compiler/commands.nim | 13 +- compiler/{babelcmd.nim => nimblecmd.nim} | 12 +- compiler/nimconf.nim | 9 +- compiler/options.nim | 4 +- config/nim.cfg | 141 ++++++++++++++++++ doc/advopt.txt | 3 +- doc/{nimrodc.txt => nimc.txt} | 0 examples/parsecfgex.nim | 2 +- .../{actors.nimrod.cfg => actors.nim.cfg} | 0 tests/benchmark.nim | 4 +- tests/js.nim | 2 +- .../{ex_wget.nimrod.cfg => ex_wget.nim.cfg} | 0 ...weine.nimrod.cfg => keineschweine.nim.cfg} | 0 .../{nakefile.nimrod.cfg => nakefile.nim.cfg} | 0 .../{main.nimrod.cfg => main.nim.cfg} | 0 ...nflicts.nimrod.cfg => noconflicts.nim.cfg} | 0 .../{barebone.nimrod.cfg => barebone.nim.cfg} | 0 tests/parallel/{nimrod.cfg => nim.cfg} | 0 tests/testament/backend.nim | 2 +- tests/testament/caasdriver.nim | 20 +-- tests/testament/categories.nim | 4 +- tests/testament/tester.nim | 2 +- tests/threads/{nimrod.cfg => nim.cfg} | 0 tools/{nimgrep.nimrod.cfg => nimgrep.nim.cfg} | 0 web/{nimrod.ini => nim.ini} | 12 +- 25 files changed, 187 insertions(+), 43 deletions(-) rename compiler/{babelcmd.nim => nimblecmd.nim} (91%) create mode 100644 config/nim.cfg rename doc/{nimrodc.txt => nimc.txt} (100%) rename lib/pure/{actors.nimrod.cfg => actors.nim.cfg} (100%) rename tests/manyloc/argument_parser/{ex_wget.nimrod.cfg => ex_wget.nim.cfg} (100%) rename tests/manyloc/keineschweine/{keineschweine.nimrod.cfg => keineschweine.nim.cfg} (100%) rename tests/manyloc/nake/{nakefile.nimrod.cfg => nakefile.nim.cfg} (100%) rename tests/manyloc/named_argument_bug/{main.nimrod.cfg => main.nim.cfg} (100%) rename tests/manyloc/packages/{noconflicts.nimrod.cfg => noconflicts.nim.cfg} (100%) rename tests/manyloc/standalone/{barebone.nimrod.cfg => barebone.nim.cfg} (100%) rename tests/parallel/{nimrod.cfg => nim.cfg} (100%) rename tests/threads/{nimrod.cfg => nim.cfg} (100%) rename tools/{nimgrep.nimrod.cfg => nimgrep.nim.cfg} (100%) rename web/{nimrod.ini => nim.ini} (93%) diff --git a/compiler/commands.nim b/compiler/commands.nim index fff860de90..54d2ed6a4d 100644 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -26,7 +26,7 @@ bootSwitch(usedNoGC, defined(nogc), "--gc:none") import os, msgs, options, nversion, condsyms, strutils, extccomp, platform, lists, - wordrecg, parseutils, babelcmd, idents + wordrecg, parseutils, nimblecmd, idents # but some have deps to imported modules. Yay. bootSwitch(usedTinyC, hasTinyCBackend, "-d:tinyc") @@ -280,14 +280,15 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = of "path", "p": expectArg(switch, arg, pass, info) addPath(processPath(arg), info) - of "babelpath": - if pass in {passCmd2, passPP} and not options.gNoBabelPath: + of "nimblepath", "babelpath": + # keep the old name for compat + if pass in {passCmd2, passPP} and not options.gNoNimblePath: expectArg(switch, arg, pass, info) let path = processPath(arg, notRelativeToProj=true) - babelPath(path, info) - of "nobabelpath": + nimblePath(path, info) + of "nonimblepath", "nobabelpath": expectNoArg(switch, arg, pass, info) - options.gNoBabelPath = true + options.gNoNimblePath = true of "excludepath": expectArg(switch, arg, pass, info) let path = processPath(arg) diff --git a/compiler/babelcmd.nim b/compiler/nimblecmd.nim similarity index 91% rename from compiler/babelcmd.nim rename to compiler/nimblecmd.nim index b096373306..0f73c17bdc 100644 --- a/compiler/babelcmd.nim +++ b/compiler/nimblecmd.nim @@ -58,7 +58,7 @@ iterator chosen(packages: StringTableRef): string = let res = if val == latest: key else: key & '-' & val yield res -proc addBabelPath(p: string, info: TLineInfo) = +proc addNimblePath(p: string, info: TLineInfo) = if not contains(options.searchPaths, p): if gVerbosity >= 1: message(info, hintPath, p) lists.prependStr(options.lazyPaths, p) @@ -70,10 +70,10 @@ proc addPathWithNimFiles(p: string, info: TLineInfo) = result = true break if hasNimFile(p): - addBabelPath(p, info) + addNimblePath(p, info) else: for kind, p2 in walkDir(p): - if hasNimFile(p2): addBabelPath(p2, info) + if hasNimFile(p2): addNimblePath(p2, info) proc addPathRec(dir: string, info: TLineInfo) = var packages = newStringTable(modeStyleInsensitive) @@ -83,8 +83,8 @@ proc addPathRec(dir: string, info: TLineInfo) = if k == pcDir and p[pos] != '.': addPackage(packages, p) for p in packages.chosen: - addBabelPath(p, info) + addNimblePath(p, info) -proc babelPath*(path: string, info: TLineInfo) = +proc nimblePath*(path: string, info: TLineInfo) = addPathRec(path, info) - addBabelPath(path, info) + addNimblePath(path, info) diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim index d23c7f1be8..98fe831d33 100644 --- a/compiler/nimconf.nim +++ b/compiler/nimconf.nim @@ -224,8 +224,8 @@ proc loadConfigs*(cfg: string) = if libpath == "": # choose default libpath: var prefix = getPrefixDir() - if prefix == "/usr": libpath = "/usr/lib/nimrod" - elif prefix == "/usr/local": libpath = "/usr/local/lib/nimrod" + if prefix == "/usr": libpath = "/usr/lib/nim" + elif prefix == "/usr/local": libpath = "/usr/local/lib/nim" else: libpath = joinPath(prefix, "lib") if optSkipConfigFile notin gGlobalOptions: @@ -244,5 +244,6 @@ proc loadConfigs*(cfg: string) = if gProjectName.len != 0: # new project wide config file: - readConfigFile(changeFileExt(gProjectFull, "nimrod.cfg")) - + let projectConfig = changeFileExt(gProjectFull, "nim.cfg") + if fileExists(projectConfig): readConfigFile(projectConfig) + else: readConfigFile(changeFileExt(gProjectFull, "nimrod.cfg")) diff --git a/compiler/options.nim b/compiler/options.nim index e30080e8f5..723d912ca8 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -114,7 +114,7 @@ var 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. - gNoBabelPath* = false + gNoNimblePath* = false proc importantComments*(): bool {.inline.} = gCmd in {cmdDoc, cmdIdeTools} proc usesNativeGC*(): bool {.inline.} = gSelectedGC >= gcRefc @@ -139,7 +139,7 @@ const JsonExt* = "json" TexExt* = "tex" IniExt* = "ini" - DefaultConfig* = "nimrod.cfg" + DefaultConfig* = "nim.cfg" DocConfig* = "nimdoc.cfg" DocTexConfig* = "nimdoc.tex.cfg" diff --git a/config/nim.cfg b/config/nim.cfg new file mode 100644 index 0000000000..6d56bba2c1 --- /dev/null +++ b/config/nim.cfg @@ -0,0 +1,141 @@ +# Configuration file for the Nim Compiler. +# (c) 2014 Andreas Rumpf + +# Feel free to edit the default values as you need. + +# You may set environment variables with +# @putenv "key" "val" +# Environment variables cannot be used in the options, however! + +cc = gcc + +# example of how to setup a cross-compiler: +arm.linux.gcc.exe = "arm-linux-gcc" +arm.linux.gcc.linkerexe = "arm-linux-gcc" + +cs:partial + +path="$lib/core" +path="$lib/pure" +path="$lib/pure/collections" +path="$lib/pure/concurrency" +path="$lib/impure" +path="$lib/wrappers" +# path="$lib/wrappers/cairo" +# path="$lib/wrappers/gtk" +# path="$lib/wrappers/lua" +# path="$lib/wrappers/opengl" +path="$lib/wrappers/pcre" +path="$lib/wrappers/readline" +path="$lib/wrappers/sdl" +# path="$lib/wrappers/x11" +path="$lib/wrappers/zip" +path="$lib/wrappers/libffi" +path="$lib/windows" +path="$lib/posix" +path="$lib/js" +path="$lib/pure/unidecode" + +@if nimbabel: + babelpath="$home/.babel/pkgs/" +@end + +@if release or quick: + obj_checks:off + field_checks:off + range_checks:off + bound_checks:off + overflow_checks:off + assertions:off + stacktrace:off + linetrace:off + debugger:off + line_dir:off + dead_code_elim:on +@end + +@if release: + opt:speed +@end + +# additional options always passed to the compiler: +--parallel_build: "0" # 0 to auto-detect number of processors + +hint[LineTooLong]=off +#hint[XDeclaredButNotUsed]=off + +@if unix: + @if not bsd: + # -fopenmp + gcc.options.linker = "-ldl" + gpp.options.linker = "-ldl" + clang.options.linker = "-ldl" + tcc.options.linker = "-ldl" + @end + @if bsd or haiku: + # BSD got posix_spawn only recently, so we deactivate it for osproc: + define:useFork + # at least NetBSD has problems with thread local storage: + tlsEmulation:on + @end +@end + +# Configuration for the Intel C/C++ compiler: +@if windows: + icl.options.speed = "/Ox /arch:SSE2" + icl.options.always = "/nologo" +@end + +# Configuration for the GNU C/C++ compiler: +@if windows: + #gcc.path = r"$nimrod\dist\mingw\bin" + @if gcc: + tlsEmulation:on + @end +@end + +@if macosx: + cc = clang + tlsEmulation:on + gcc.options.always = "-w -fasm-blocks" + gpp.options.always = "-w -fasm-blocks -fpermissive" +@else: + gcc.options.always = "-w" + gpp.options.always = "-w -fpermissive" +@end + +gcc.options.speed = "-O3 -fno-strict-aliasing" +gcc.options.size = "-Os" +gcc.options.debug = "-g3 -O0" + +gpp.options.speed = "-O3 -fno-strict-aliasing" +gpp.options.size = "-Os" +gpp.options.debug = "-g3 -O0" +#passl = "-pg" + +# Configuration for the LLVM GCC compiler: +llvm_gcc.options.debug = "-g" +llvm_gcc.options.always = "-w" +llvm_gcc.options.speed = "-O2" +llvm_gcc.options.size = "-Os" + +# Configuration for the LLVM CLang compiler: +clang.options.debug = "-g" +clang.options.always = "-w" +clang.options.speed = "-O3" +clang.options.size = "-Os" + +# Configuration for the Visual C/C++ compiler: +vcc.options.linker = "/DEBUG /Zi /Fd\"$projectName.pdb\" /F33554432" # set the stack size to 8 MB +vcc.options.debug = "/Zi /Fd\"$projectName.pdb\"" +vcc.options.always = "/nologo" +vcc.options.speed = "/Ox /arch:SSE2" +vcc.options.size = "/O1" + +# Configuration for the Digital Mars C/C++ compiler: +@if windows: + dmc.path = r"$nimrod\dist\dm\bin" +@end + +# Configuration for the Tiny C Compiler: +tcc.options.always = "-w" diff --git a/doc/advopt.txt b/doc/advopt.txt index 18cea8a793..370639a60a 100644 --- a/doc/advopt.txt +++ b/doc/advopt.txt @@ -79,7 +79,8 @@ Advanced options: select the GC to use; default is 'refc' --index:on|off turn index file generation on|off --putenv:key=value set an environment variable - --babelPath:PATH add a path for Babel support + --NimblePath:PATH add a path for Nimble support + --noNimblePath deactivate the Nimble path --excludePath:PATH exclude a path from the list of search paths --dynlibOverride:SYMBOL marks SYMBOL so that dynlib:SYMBOL has no effect and can be statically linked instead; diff --git a/doc/nimrodc.txt b/doc/nimc.txt similarity index 100% rename from doc/nimrodc.txt rename to doc/nimc.txt diff --git a/examples/parsecfgex.nim b/examples/parsecfgex.nim index 618ecadd61..0f37a0378f 100644 --- a/examples/parsecfgex.nim +++ b/examples/parsecfgex.nim @@ -4,7 +4,7 @@ import var f = newFileStream(paramStr(1), fmRead) if f != nil: - var p: TCfgParser + var p: CfgParser open(p, f, paramStr(1)) while true: var e = next(p) diff --git a/lib/pure/actors.nimrod.cfg b/lib/pure/actors.nim.cfg similarity index 100% rename from lib/pure/actors.nimrod.cfg rename to lib/pure/actors.nim.cfg diff --git a/tests/benchmark.nim b/tests/benchmark.nim index 8dd9cc2e29..0613d1bf93 100644 --- a/tests/benchmark.nim +++ b/tests/benchmark.nim @@ -1,6 +1,6 @@ # # -# Nimrod Benchmark tool +# Nim Benchmark tool # (c) Copyright 2012 Dominik Picheta # # See the file "copying.txt", included in this @@ -15,7 +15,7 @@ type proc compileBench(file: string) = ## Compiles ``file``. - doAssert(execCmdEx("nimrod c -d:release " & file).exitCode == QuitSuccess) + doAssert(execCmdEx("nim c -d:release " & file).exitCode == QuitSuccess) proc runBench(file: string): TBenchResult = ## Runs ``file`` and returns info on how long it took to run. diff --git a/tests/js.nim b/tests/js.nim index becc178341..e5e4323667 100644 --- a/tests/js.nim +++ b/tests/js.nim @@ -1,5 +1,5 @@ discard """ - cmd: "nimrod js --hints:on $options $file" + cmd: "nim js --hints:on $options $file" """ # This file tests the JavaScript generator diff --git a/tests/manyloc/argument_parser/ex_wget.nimrod.cfg b/tests/manyloc/argument_parser/ex_wget.nim.cfg similarity index 100% rename from tests/manyloc/argument_parser/ex_wget.nimrod.cfg rename to tests/manyloc/argument_parser/ex_wget.nim.cfg diff --git a/tests/manyloc/keineschweine/keineschweine.nimrod.cfg b/tests/manyloc/keineschweine/keineschweine.nim.cfg similarity index 100% rename from tests/manyloc/keineschweine/keineschweine.nimrod.cfg rename to tests/manyloc/keineschweine/keineschweine.nim.cfg diff --git a/tests/manyloc/nake/nakefile.nimrod.cfg b/tests/manyloc/nake/nakefile.nim.cfg similarity index 100% rename from tests/manyloc/nake/nakefile.nimrod.cfg rename to tests/manyloc/nake/nakefile.nim.cfg diff --git a/tests/manyloc/named_argument_bug/main.nimrod.cfg b/tests/manyloc/named_argument_bug/main.nim.cfg similarity index 100% rename from tests/manyloc/named_argument_bug/main.nimrod.cfg rename to tests/manyloc/named_argument_bug/main.nim.cfg diff --git a/tests/manyloc/packages/noconflicts.nimrod.cfg b/tests/manyloc/packages/noconflicts.nim.cfg similarity index 100% rename from tests/manyloc/packages/noconflicts.nimrod.cfg rename to tests/manyloc/packages/noconflicts.nim.cfg diff --git a/tests/manyloc/standalone/barebone.nimrod.cfg b/tests/manyloc/standalone/barebone.nim.cfg similarity index 100% rename from tests/manyloc/standalone/barebone.nimrod.cfg rename to tests/manyloc/standalone/barebone.nim.cfg diff --git a/tests/parallel/nimrod.cfg b/tests/parallel/nim.cfg similarity index 100% rename from tests/parallel/nimrod.cfg rename to tests/parallel/nim.cfg diff --git a/tests/testament/backend.nim b/tests/testament/backend.nim index 5199bb9d6f..c7122e1b28 100644 --- a/tests/testament/backend.nim +++ b/tests/testament/backend.nim @@ -1,6 +1,6 @@ # # -# The Nimrod Tester +# The Nim Tester # (c) Copyright 2014 Andreas Rumpf # # Look at license.txt for more info. diff --git a/tests/testament/caasdriver.nim b/tests/testament/caasdriver.nim index ddfe882730..4754fa342b 100644 --- a/tests/testament/caasdriver.nim +++ b/tests/testament/caasdriver.nim @@ -9,7 +9,7 @@ type TRunMode = enum ProcRun, CaasRun, SymbolProcRun - TNimrodSession* = object + NimSession* = object nim: PProcess # Holds the open process for CaasRun sessions, nil otherwise. mode: TRunMode # Stores the type of run mode the session was started with. lastOutput: string # Preserves the last output, needed for ProcRun mode. @@ -26,15 +26,15 @@ const var TesterDir = getAppDir() / ".." - NimrodBin = TesterDir / "../bin/nimrod" + NimBin = TesterDir / "../bin/nim" -proc replaceVars(session: var TNimrodSession, text: string): string = +proc replaceVars(session: var NimSession, text: string): string = result = text.replace(filenameReplaceVar, session.filename) result = result.replace(moduleReplaceVar, session.modname) result = result.replace(silentReplaceVar, silentReplaceText) proc startNimrodSession(project, script: string, mode: TRunMode): - TNimrodSession = + NimSession = let (dir, name, ext) = project.splitFile result.mode = mode result.lastOutput = "" @@ -50,10 +50,10 @@ proc startNimrodSession(project, script: string, mode: TRunMode): removeDir(nimcacheDir / "nimcache") if mode == CaasRun: - result.nim = startProcess(NimrodBin, workingDir = dir, + result.nim = startProcess(NimBin, workingDir = dir, args = ["serve", "--server.type:stdin", name]) -proc doCaasCommand(session: var TNimrodSession, command: string): string = +proc doCaasCommand(session: var NimSession, command: string): string = assert session.mode == CaasRun session.nim.inputStream.write(session.replaceVars(command) & "\n") session.nim.inputStream.flush @@ -69,11 +69,11 @@ proc doCaasCommand(session: var TNimrodSession, command: string): string = result = "FAILED TO EXECUTE: " & command & "\n" & result break -proc doProcCommand(session: var TNimrodSession, command: string): string = +proc doProcCommand(session: var NimSession, command: string): string = assert session.mode == ProcRun or session.mode == SymbolProcRun except: result = "FAILED TO EXECUTE: " & command & "\n" & result var - process = startProcess(NimrodBin, args = session.replaceVars(command).split) + process = startProcess(NimBin, args = session.replaceVars(command).split) stream = outputStream(process) line = TaintedString("") @@ -84,7 +84,7 @@ proc doProcCommand(session: var TNimrodSession, command: string): string = process.close() -proc doCommand(session: var TNimrodSession, command: string) = +proc doCommand(session: var NimSession, command: string) = if session.mode == CaasRun: if not session.nim.running: session.lastOutput = "FAILED TO EXECUTE: " & command & "\n" & @@ -102,7 +102,7 @@ proc doCommand(session: var TNimrodSession, command: string) = session.lastOutput = doProcCommand(session, command & " " & session.filename) -proc close(session: var TNimrodSession) {.destructor.} = +proc close(session: var NimSession) {.destructor.} = if session.mode == CaasRun: session.nim.close diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index 3f4d663cba..566a74cabb 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -192,9 +192,9 @@ proc jsTests(r: var TResults, cat: Category, options: string) = # testSpec(r, t, options) proc findMainFile(dir: string): string = - # finds the file belonging to ".nimrod.cfg"; if there is no such file + # finds the file belonging to ".nim.cfg"; if there is no such file # it returns the some ".nim" file if there is only one: - const cfgExt = ".nimrod.cfg" + const cfgExt = ".nim.cfg" result = "" var nimFiles = 0 for kind, file in os.walkDir(dir): diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index 732a5e86aa..b74fa99c8e 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -7,7 +7,7 @@ # distribution, for details about the copyright. # -## This program verifies Nimrod against the testcases. +## This program verifies Nim against the testcases. import parseutils, strutils, pegs, os, osproc, streams, parsecfg, json, diff --git a/tests/threads/nimrod.cfg b/tests/threads/nim.cfg similarity index 100% rename from tests/threads/nimrod.cfg rename to tests/threads/nim.cfg diff --git a/tools/nimgrep.nimrod.cfg b/tools/nimgrep.nim.cfg similarity index 100% rename from tools/nimgrep.nimrod.cfg rename to tools/nimgrep.nim.cfg diff --git a/web/nimrod.ini b/web/nim.ini similarity index 93% rename from web/nimrod.ini rename to web/nim.ini index 64376cd66e..d610408f7a 100644 --- a/web/nimrod.ini +++ b/web/nim.ini @@ -1,15 +1,15 @@ [Project] -Name: "Nimrod" -Title: "Nimrod Programming Language" +Name: "Nim" +Title: "Nim Programming Language" Logo: "efficient, expressive, elegant" Authors: "Andreas Rumpf and contributors" [Links] # Underscores are replaced with a space. # Everything after ; is the ID -User_Forum: "http://forum.nimrod-code.org;link_forum" +User_Forum: "http://forum.nim-lang.org;link_forum" Aporia_IDE: "https://github.com/nimrod-code/Aporia;link_aporia" -Nimbuild: "http://build.nimrod-code.org;link_nimbuild" +Nimbuild: "http://build.nim-lang.org;link_nimbuild" [Tabs] # Menu entry: filename @@ -36,9 +36,9 @@ UNIX. We don't believe this to be a coincidence. - Jeremy S. Anderson.""" [Documentation] -doc: "endb;intern;apis;lib;manual;tut1;tut2;nimrodc;overview;filters" +doc: "endb;intern;apis;lib;manual;tut1;tut2;nimc;overview;filters" doc: "tools;niminst;nimgrep;gc;estp;idetools;docgen;koch;backends.txt" -pdf: "manual;lib;tut1;tut2;nimrodc;niminst;gc" +pdf: "manual;lib;tut1;tut2;nimc;niminst;gc" srcdoc2: "system.nim;impure/graphics;wrappers/sdl" srcdoc2: "core/macros;pure/marshal;core/typeinfo;core/unsigned" srcdoc2: "impure/re;pure/sockets;pure/typetraits"