Skip to content
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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Conversation

GreyCat
Copy link
Member

@GreyCat GreyCat commented Apr 27, 2019

TODO: elaborate what exactly was changed and why

@@ -0,0 +1,570 @@
package io.kaitai.struct.languages

import io.kaitai.struct.CppRuntimeConfig._
Copy link
Member Author

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?

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.

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
Copy link
Member Author

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.

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")
Copy link
Member Author

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 →.

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 = {
Copy link
Member Author

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.

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)};")
}
Copy link
Member Author

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants