Skip to content

Commit

Permalink
fix: fixes #5 by handling p_open case explicitely
Browse files Browse the repository at this point in the history
  • Loading branch information
stergiotis committed Jul 27, 2024
1 parent 1ff7006 commit 8150154
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
2 changes: 2 additions & 0 deletions public/imzero/imgui/api.out.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions public/imzero/imgui/doxygen/functions.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</xsl:otherwise>
</xsl:choose>
<xsl:variable name="nParamsMand" select="count(param[not(defval) and @semantics = 'in'])"/>
<xsl:variable name="nParamsOpt" select="count(param[defval and @semantics = 'in'])"/>
<xsl:variable name="nParamsOpt" select="count(param[defval and @semantics = 'in'])"/>


<!-- mandatory arguments -->
Expand Down Expand Up @@ -142,12 +142,17 @@
<xsl:if test="type = 'bool *'"><xsl:value-of select="concat(declname,' bool')"/></xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="callee">
<xsl:choose>
<xsl:when test="$instvar=''"><xsl:value-of select="qualifiedname"/></xsl:when>
<xsl:otherwise><xsl:value-of select="concat('((',$instvarns,substring-before(qualifiedname,'::'),'*)foreignptr)->', substring-after(qualifiedname,'::'))"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="cppParamInitialization">
<xsl:for-each select="param[(not(defval) or $pmode='optional') and @cppInitialization != '']">
<xsl:value-of select="concat(@cppInitialization,$lf)"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="callee">
<xsl:choose>
<xsl:when test="$instvar=''"><xsl:value-of select="qualifiedname"/></xsl:when>
<xsl:otherwise><xsl:value-of select="concat('((',$instvarns,substring-before(qualifiedname,'::'),'*)foreignptr)->', substring-after(qualifiedname,'::'))"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$type = 'void'">
<xsl:choose>
Expand All @@ -160,7 +165,7 @@
</xsl:choose>

<!-- cpp -->
<xsl:value-of select="concat(' _ = `',$callee,'(')" />
<xsl:value-of select="concat(' _ = `',$cppParamInitialization,$callee,'(')" />
<xsl:for-each select="param[not(defval) or $pmode='optional']">
<xsl:call-template name="emitParamCode"/>
<xsl:if test="position() &lt; $nParams">
Expand All @@ -182,7 +187,7 @@
</xsl:choose>

<!-- cpp -->
<xsl:value-of select="concat(' _ = `','auto r = ',$callee,'(')" />
<xsl:value-of select="concat(' _ = `',$cppParamInitialization,'auto r = ',$callee,'(')" />
<xsl:for-each select="param[not(defval) or $pmode='optional']">
<xsl:call-template name="emitParamCode"/>
<xsl:if test="position() &lt; $nParams">
Expand Down
8 changes: 7 additions & 1 deletion public/imzero/imgui/doxygen/semantics.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,18 @@

<xsl:template match="//param">
<xsl:copy>
<xsl:variable name="isPOpen" select="declname = 'p_open' and type = 'bool *'"/>
<xsl:attribute name="semantics">
<xsl:choose>
<xsl:when test="declname = 'p_open' and type = 'bool *'">out</xsl:when>
<xsl:when test="$isPOpen">out</xsl:when>
<xsl:otherwise>in</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="cppInitialization">
<xsl:choose>
<xsl:when test="$isPOpen">p_open = true; /* see issue #5 */</xsl:when>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="castBegin">
<xsl:choose>
<xsl:when test="type = 'ImGuiKey'"><xsl:value-of select="type"/>(</xsl:when>
Expand Down
9 changes: 6 additions & 3 deletions public/imzero/imgui/functions_auto_api.out.idl.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ func Begin(name string) (r bool) {
return
}
func BeginV(name string, flags ImGuiWindowFlags /* = 0*/) (r bool, p_open bool) {
_ = `auto r = ImGui::Begin(name, &p_open, flags)`
_ = `p_open = true; /* see issue #5 */
auto r = ImGui::Begin(name, &p_open, flags)`
return
}
func End() {
Expand Down Expand Up @@ -968,7 +969,8 @@ func BeginPopupModal(name string) (r bool) {
// * p_open bool * = NULL
// * flags ImGuiWindowFlags = 0
func BeginPopupModalV(name string, flags ImGuiWindowFlags /* = 0*/) (r bool, p_open bool) {
_ = `auto r = ImGui::BeginPopupModal(name, &p_open, flags)`
_ = `p_open = true; /* see issue #5 */
auto r = ImGui::BeginPopupModal(name, &p_open, flags)`
return
}

Expand Down Expand Up @@ -1279,7 +1281,8 @@ func BeginTabItem(label string) (r bool) {
// * p_open bool * = NULL
// * flags ImGuiTabItemFlags = 0
func BeginTabItemV(label string, flags ImGuiTabItemFlags /* = 0*/) (r bool, p_open bool) {
_ = `auto r = ImGui::BeginTabItem(label, &p_open, flags)`
_ = `p_open = true; /* see issue #5 */
auto r = ImGui::BeginTabItem(label, &p_open, flags)`
return
}

Expand Down

0 comments on commit 8150154

Please sign in to comment.