diff options
author | Araq <rumpf_a@web.de> | 2011-01-10 01:29:10 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-01-10 01:29:10 +0100 |
commit | ceb1f5e218075196cd3b7d40973249e419db8ebf (patch) | |
tree | 82d42a6679fdb06edd86563074ba15c13ff740bd /rod | |
parent | 62643fbc934d4f32c143cc8397039acca9dacf04 (diff) | |
download | Nim-ceb1f5e218075196cd3b7d40973249e419db8ebf.tar.gz |
support for objective C generation
Diffstat (limited to 'rod')
-rwxr-xr-x | rod/commands.nim | 5 | ||||
-rw-r--r-- | rod/extccomp.nim | 1 | ||||
-rwxr-xr-x | rod/main.nim | 14 | ||||
-rwxr-xr-x | rod/options.nim | 6 | ||||
-rwxr-xr-x | rod/wordrecg.nim | 9 |
5 files changed, 23 insertions, 12 deletions
diff --git a/rod/commands.nim b/rod/commands.nim index c5648afe5..ffd117cd8 100755 --- a/rod/commands.nim +++ b/rod/commands.nim @@ -26,8 +26,8 @@ proc processSwitch*(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) # implementation const - HelpMessage = "Nimrod Compiler Version $1 (" & compileDate & ") [$2: $3]" & - "\n" & "Copyright (c) 2004-2011 by Andreas Rumpf" & "\n" + HelpMessage = "Nimrod Compiler Version $1 (" & compileDate & ") [$2: $3]\n" & + "Copyright (c) 2004-2011 by Andreas Rumpf\n" const Usage = """ @@ -70,6 +70,7 @@ Options: AdvancedUsage = """ Advanced commands: + compileToOC, oc compile project to Objective C code run run the project (with Tiny C backend; buggy!) pretty pretty print the inputfile genDepend generate a DOT file containing the diff --git a/rod/extccomp.nim b/rod/extccomp.nim index 10962db53..bb29cea33 100644 --- a/rod/extccomp.nim +++ b/rod/extccomp.nim @@ -270,6 +270,7 @@ proc initVars*() = for i in countup(low(CC), high(CC)): undefSymbol(CC[i].name) defineSymbol(CC[ccompiler].name) if gCmd == cmdCompileToCpp: cExt = ".cpp" + elif gCmd == cmdCompileToOC: cExt = ".m" addCompileOption(getConfigVar(CC[ccompiler].name & ".options.always")) addLinkOption(getConfigVar(CC[ccompiler].name & ".options.linker")) if len(ccompilerPath) == 0: diff --git a/rod/main.nim b/rod/main.nim index a008bcc7c..68958acb6 100755 --- a/rod/main.nim +++ b/rod/main.nim @@ -192,6 +192,16 @@ proc MainCommand(cmd, filename: string) = gCmd = cmdCompileToC wantFile(filename) CommandCompileToC(filename) + of wCompileToCpp: + extccomp.cExt = ".cpp" + gCmd = cmdCompileToCpp + wantFile(filename) + CommandCompileToC(filename) + of wCompileToOC, wOC: + extccomp.cExt = ".m" + gCmd = cmdCompileToOC + wantFile(filename) + CommandCompileToC(filename) of wRun: gCmd = cmdRun wantFile(filename) @@ -200,10 +210,6 @@ proc MainCommand(cmd, filename: string) = CommandCompileToC(filename) else: rawMessage(errInvalidCommandX, cmd) - of wCompileToCpp: - gCmd = cmdCompileToCpp - wantFile(filename) - CommandCompileToC(filename) of wCompileToEcmaScript, wJs: gCmd = cmdCompileToEcmaScript wantFile(filename) diff --git a/rod/options.nim b/rod/options.nim index 3742cad9d..cdba2fcdc 100755 --- a/rod/options.nim +++ b/rod/options.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2010 Andreas Rumpf +# (c) Copyright 2011 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -43,8 +43,8 @@ type # please make sure we have under 32 options optNoMain # do not generate a "main" proc TGlobalOptions* = set[TGlobalOption] TCommands* = enum # Nimrod's commands - cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToEcmaScript, - cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc, + cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, + cmdCompileToEcmaScript, cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc, cmdGenDepend, cmdListDef, cmdCheck, # semantic checking for whole project cmdParse, # parse a single file (for debugging) cmdScan, # scan a single file (for debugging) diff --git a/rod/wordrecg.nim b/rod/wordrecg.nim index 42be7994b..0b5b48bb2 100755 --- a/rod/wordrecg.nim +++ b/rod/wordrecg.nim @@ -54,8 +54,10 @@ type wSymbolFiles, wFieldChecks, wX, wVersion, wAdvanced, wSkipcfg, wSkipProjCfg, wCc, wGenscript, wCheckPoint, wCheckPoints, wNoMain, wSubsChar, wAcyclic, wIndex, - wCompileToC, wCompileToCpp, wCompileToEcmaScript, wCompileToLLVM, wPretty, - wDoc, wGenDepend, wListDef, wCheck, wParse, wScan, wJs, + wCompileToC, wCompileToCpp, wCompileToEcmaScript, wCompileToLLVM, + wCompileToOC, + wPretty, + wDoc, wGenDepend, wListDef, wCheck, wParse, wScan, wJs, wOC, wRst2html, wRst2tex, wI, wWrite, wPutEnv, wPrependEnv, wAppendEnv, wThreadVar, wEmit @@ -102,8 +104,9 @@ const "skipcfg", "skipprojcfg", "cc", "genscript", "checkpoint", "checkpoints", "nomain", "subschar", "acyclic", "index", "compiletoc", "compiletocpp", "compiletoecmascript", "compiletollvm", + "compiletooc", "pretty", "doc", "gendepend", "listdef", "check", "parse", "scan", - "js", "rst2html", "rst2tex", "i", + "js", "oc", "rst2html", "rst2tex", "i", "write", "putenv", "prependenv", "appendenv", "threadvar", "emit"] proc whichKeyword*(id: PIdent): TSpecialWord |