-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Started Objective C compiler #163
base: master
Are you sure you want to change the base?
Conversation
jvm/src/test/scala/io/kaitai/struct/translators/TranslatorSpec.scala
Outdated
Show resolved
Hide resolved
shared/src/main/scala/io/kaitai/struct/translators/BaseTranslator.scala
Outdated
Show resolved
Hide resolved
shared/src/main/scala/io/kaitai/struct/translators/ObjcTranslator.scala
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,570 @@ | |||
package io.kaitai.struct.languages | |||
|
|||
import io.kaitai.struct.CppRuntimeConfig._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Um, something tells me that ObjcCompiler should not use C++-specific config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left that in there just in case I wanted some config options at a later point. I am now at a point where I am 99% sure I will not want any config options. So I will take it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
import io.kaitai.struct.datatype.DataType._ | ||
import io.kaitai.struct.datatype.{CalcEndian, DataType, FixedEndian, InheritedEndian} | ||
import io.kaitai.struct.exprlang.Ast | ||
import io.kaitai.struct.exprlang.Ast.expr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, try to avoid importing this Ast.expr
— we try to use Ast.expr
directly (not expr
, as it's too ambiguous) by convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
override def innerEnums = false | ||
|
||
private def importListToStr(importList: ImportList): String = | ||
importList.toList.map((x) => s"#import <$x>").mkString("", "\n", "\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please indent this 2 spaces →.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
} | ||
|
||
// Members declared in io.kaitai.struct.languages.components.EveryReadIsExpression | ||
override def bytesPadTermExpr(expr0: String,padRight: Option[Int],terminator: Option[Int],include: Boolean): String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This def
and below misses spaces after commas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
outSrc.puts("// comment: attributeDeclaration: InstanceIdentifier or NamedIdentifier") | ||
|
||
outHdr.puts(s"@property (strong,nonatomic) ${kaitaiType2NativeType(attrType, true)}${publicMemberName(attrName)};") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for { ... }
block here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
…ith init are not supose to allocate objects
TODO: elaborate what exactly was changed and why