Skip to content

Commit

Permalink
Add placeholder section for C wrapper external declartion for future …
Browse files Browse the repository at this point in the history
…extension if needed (cross-language-cpp#139)
  • Loading branch information
Gibu Thomas committed Oct 24, 2022
1 parent b8a6ec6 commit 2d102a8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/scala/djinni/YamlGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class YamlGenerator(spec: Spec) extends Generator(spec) {
val objcppMarshal = new ObjcppMarshal(spec)
val javaMarshal = new JavaMarshal(spec)
val jniMarshal = new JNIMarshal(spec)
val cWrapperMarshal = new CWrapperMarshal(spec)
val cppCliMarshal = new CppCliMarshal(spec)

case class QuotedString(
Expand Down Expand Up @@ -74,6 +75,7 @@ class YamlGenerator(spec: Spec) extends Generator(spec) {
w.wl("java:").nested { write(w, java(td)) }
w.wl("jni:").nested { write(w, jni(td)) }
w.wl("cs:").nested { write(w, cs(td)) }
w.wl("cwrapper:").nested { write(w, cwrapper(td)) }
}

private def write(w: IndentWriter, m: Map[String, Any]) {
Expand Down Expand Up @@ -186,6 +188,10 @@ class YamlGenerator(spec: Spec) extends Generator(spec) {
"reference" -> cppCliMarshal.isReference(td)
)

private def cwrapper(td: TypeDecl) = Map[String, Any](
"typename" -> QuotedString(cWrapperMarshal.fqTypename(td.ident, td.body)),
)

// TODO: there has to be a way to do all this without the MExpr/Meta conversions?
private def mexpr(td: TypeDecl) = MExpr(meta(td), List())

Expand Down

0 comments on commit 2d102a8

Please sign in to comment.