mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
support for objective C generation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
Advanced commands:
|
||||
//compileToOC, oc compile project to Objective C code
|
||||
//run run the project (with Tiny C backend; Linux only!)
|
||||
//pretty pretty print the inputfile
|
||||
//genDepend generate a DOT file containing the
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
14
rod/main.nim
14
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user