support for objective C generation
This commit is contained in:
parent
62643fbc93
commit
ceb1f5e218
7 changed files with 24 additions and 13 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
Advanced commands:
|
Advanced commands:
|
||||||
|
//compileToOC, oc compile project to Objective C code
|
||||||
//run run the project (with Tiny C backend; Linux only!)
|
//run run the project (with Tiny C backend; Linux only!)
|
||||||
//pretty pretty print the inputfile
|
//pretty pretty print the inputfile
|
||||||
//genDepend generate a DOT file containing the
|
//genDepend generate a DOT file containing the
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ proc processSwitch*(switch, arg: string, pass: TCmdlinePass, info: TLineInfo)
|
||||||
# implementation
|
# implementation
|
||||||
|
|
||||||
const
|
const
|
||||||
HelpMessage = "Nimrod Compiler Version $1 (" & compileDate & ") [$2: $3]" &
|
HelpMessage = "Nimrod Compiler Version $1 (" & compileDate & ") [$2: $3]\n" &
|
||||||
"\n" & "Copyright (c) 2004-2011 by Andreas Rumpf" & "\n"
|
"Copyright (c) 2004-2011 by Andreas Rumpf\n"
|
||||||
|
|
||||||
const
|
const
|
||||||
Usage = """
|
Usage = """
|
||||||
|
|
@ -70,6 +70,7 @@ Options:
|
||||||
|
|
||||||
AdvancedUsage = """
|
AdvancedUsage = """
|
||||||
Advanced commands:
|
Advanced commands:
|
||||||
|
compileToOC, oc compile project to Objective C code
|
||||||
run run the project (with Tiny C backend; buggy!)
|
run run the project (with Tiny C backend; buggy!)
|
||||||
pretty pretty print the inputfile
|
pretty pretty print the inputfile
|
||||||
genDepend generate a DOT file containing the
|
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)
|
for i in countup(low(CC), high(CC)): undefSymbol(CC[i].name)
|
||||||
defineSymbol(CC[ccompiler].name)
|
defineSymbol(CC[ccompiler].name)
|
||||||
if gCmd == cmdCompileToCpp: cExt = ".cpp"
|
if gCmd == cmdCompileToCpp: cExt = ".cpp"
|
||||||
|
elif gCmd == cmdCompileToOC: cExt = ".m"
|
||||||
addCompileOption(getConfigVar(CC[ccompiler].name & ".options.always"))
|
addCompileOption(getConfigVar(CC[ccompiler].name & ".options.always"))
|
||||||
addLinkOption(getConfigVar(CC[ccompiler].name & ".options.linker"))
|
addLinkOption(getConfigVar(CC[ccompiler].name & ".options.linker"))
|
||||||
if len(ccompilerPath) == 0:
|
if len(ccompilerPath) == 0:
|
||||||
|
|
|
||||||
14
rod/main.nim
14
rod/main.nim
|
|
@ -192,6 +192,16 @@ proc MainCommand(cmd, filename: string) =
|
||||||
gCmd = cmdCompileToC
|
gCmd = cmdCompileToC
|
||||||
wantFile(filename)
|
wantFile(filename)
|
||||||
CommandCompileToC(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:
|
of wRun:
|
||||||
gCmd = cmdRun
|
gCmd = cmdRun
|
||||||
wantFile(filename)
|
wantFile(filename)
|
||||||
|
|
@ -200,10 +210,6 @@ proc MainCommand(cmd, filename: string) =
|
||||||
CommandCompileToC(filename)
|
CommandCompileToC(filename)
|
||||||
else:
|
else:
|
||||||
rawMessage(errInvalidCommandX, cmd)
|
rawMessage(errInvalidCommandX, cmd)
|
||||||
of wCompileToCpp:
|
|
||||||
gCmd = cmdCompileToCpp
|
|
||||||
wantFile(filename)
|
|
||||||
CommandCompileToC(filename)
|
|
||||||
of wCompileToEcmaScript, wJs:
|
of wCompileToEcmaScript, wJs:
|
||||||
gCmd = cmdCompileToEcmaScript
|
gCmd = cmdCompileToEcmaScript
|
||||||
wantFile(filename)
|
wantFile(filename)
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# The Nimrod Compiler
|
# The Nimrod Compiler
|
||||||
# (c) Copyright 2010 Andreas Rumpf
|
# (c) Copyright 2011 Andreas Rumpf
|
||||||
#
|
#
|
||||||
# See the file "copying.txt", included in this
|
# See the file "copying.txt", included in this
|
||||||
# distribution, for details about the copyright.
|
# 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
|
optNoMain # do not generate a "main" proc
|
||||||
TGlobalOptions* = set[TGlobalOption]
|
TGlobalOptions* = set[TGlobalOption]
|
||||||
TCommands* = enum # Nimrod's commands
|
TCommands* = enum # Nimrod's commands
|
||||||
cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToEcmaScript,
|
cmdNone, cmdCompileToC, cmdCompileToCpp, cmdCompileToOC,
|
||||||
cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc,
|
cmdCompileToEcmaScript, cmdCompileToLLVM, cmdInterpret, cmdPretty, cmdDoc,
|
||||||
cmdGenDepend, cmdListDef, cmdCheck, # semantic checking for whole project
|
cmdGenDepend, cmdListDef, cmdCheck, # semantic checking for whole project
|
||||||
cmdParse, # parse a single file (for debugging)
|
cmdParse, # parse a single file (for debugging)
|
||||||
cmdScan, # scan a single file (for debugging)
|
cmdScan, # scan a single file (for debugging)
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,10 @@ type
|
||||||
wSymbolFiles, wFieldChecks, wX, wVersion, wAdvanced, wSkipcfg, wSkipProjCfg,
|
wSymbolFiles, wFieldChecks, wX, wVersion, wAdvanced, wSkipcfg, wSkipProjCfg,
|
||||||
wCc, wGenscript, wCheckPoint, wCheckPoints, wNoMain, wSubsChar,
|
wCc, wGenscript, wCheckPoint, wCheckPoints, wNoMain, wSubsChar,
|
||||||
wAcyclic, wIndex,
|
wAcyclic, wIndex,
|
||||||
wCompileToC, wCompileToCpp, wCompileToEcmaScript, wCompileToLLVM, wPretty,
|
wCompileToC, wCompileToCpp, wCompileToEcmaScript, wCompileToLLVM,
|
||||||
wDoc, wGenDepend, wListDef, wCheck, wParse, wScan, wJs,
|
wCompileToOC,
|
||||||
|
wPretty,
|
||||||
|
wDoc, wGenDepend, wListDef, wCheck, wParse, wScan, wJs, wOC,
|
||||||
wRst2html, wRst2tex, wI,
|
wRst2html, wRst2tex, wI,
|
||||||
wWrite, wPutEnv, wPrependEnv, wAppendEnv, wThreadVar, wEmit
|
wWrite, wPutEnv, wPrependEnv, wAppendEnv, wThreadVar, wEmit
|
||||||
|
|
||||||
|
|
@ -102,8 +104,9 @@ const
|
||||||
"skipcfg", "skipprojcfg", "cc", "genscript", "checkpoint", "checkpoints",
|
"skipcfg", "skipprojcfg", "cc", "genscript", "checkpoint", "checkpoints",
|
||||||
"nomain", "subschar", "acyclic", "index",
|
"nomain", "subschar", "acyclic", "index",
|
||||||
"compiletoc", "compiletocpp", "compiletoecmascript", "compiletollvm",
|
"compiletoc", "compiletocpp", "compiletoecmascript", "compiletollvm",
|
||||||
|
"compiletooc",
|
||||||
"pretty", "doc", "gendepend", "listdef", "check", "parse", "scan",
|
"pretty", "doc", "gendepend", "listdef", "check", "parse", "scan",
|
||||||
"js", "rst2html", "rst2tex", "i",
|
"js", "oc", "rst2html", "rst2tex", "i",
|
||||||
"write", "putenv", "prependenv", "appendenv", "threadvar", "emit"]
|
"write", "putenv", "prependenv", "appendenv", "threadvar", "emit"]
|
||||||
|
|
||||||
proc whichKeyword*(id: PIdent): TSpecialWord
|
proc whichKeyword*(id: PIdent): TSpecialWord
|
||||||
|
|
|
||||||
1
todo.txt
1
todo.txt
|
|
@ -1,5 +1,4 @@
|
||||||
- we need a way to disable tests
|
- we need a way to disable tests
|
||||||
- {.extern: "thisfile.m".} pragma for objective C/C++ support
|
|
||||||
- deprecate ^ and make it available as operator
|
- deprecate ^ and make it available as operator
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue