mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 00:47:28 +01:00
Generate macros for public scalar consts
This commit is contained in:
1 parent
4af1b88ef8
commit
5f7c807729
5 files changed
+19
-3
No files matched your search
@@ -681,6 +681,12 @@ func (g *gen) gatherScalarConsts(b *buffer, n *a.Const) error {
|
||||
}
|
||||
|
||||
func (g *gen) writeConst(b *buffer, n *a.Const) error {
|
||||
if n.Public() {
|
||||
if cv := n.Value().ConstValue(); cv != nil {
|
||||
b.printf("#define %s %v\n\n", strings.ToUpper(g.pkgPrefix+n.QID()[1].Str(g.tm)), cv)
|
||||
}
|
||||
}
|
||||
|
||||
b.writes("static const ")
|
||||
if err := g.writeCTypeName(b, n.XType(), "//\n"+g.pkgPrefix, n.QID()[1].Str(g.tm)); err != nil {
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user