Allow #pragma directives to be provided in the config file.

This commit is contained in:
Greg 2019-04-26 15:41:29 -04:00
parent 009a974a1a
commit 6135381cc7
2 changed files with 9 additions and 3 deletions

View File

@ -19,6 +19,7 @@ type conf struct {
Classes []string
Imports []string
SysImports []string
Pragma []string
}
var Config conf
@ -166,6 +167,7 @@ func Start() (err error) {
w := wrap.NewWrapper(Debug)
w.Import(Config.Imports)
w.SysImport(Config.SysImports)
w.Pragma(Config.Pragma)
for _, n := range(unit.Children()) {
switch x := n.(type) {
case *ast.ObjCInterfaceDecl:

View File

@ -46,9 +46,13 @@ func (w *Wrapper) Import(ss []string) {
func (w *Wrapper) SysImport(ss []string) {
for _,s := range ss {
w.cCode.WriteString(`
#import <` + s + `>
`)
w.cCode.WriteString("\n#import <" + s + ">\n")
}
}
func (w *Wrapper) Pragma(ss []string) {
for _,s := range ss {
w.cCode.WriteString("\n#pragma " + s + "\n")
}
}