1// Package pango was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package pango
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/glib"
9)
10
11var xMarkupParserFinish func(*glib.MarkupParseContext, **AttrList, *string, *uint32, **glib.Error) bool
12
13// Finishes parsing markup.
14//
15// After feeding a Pango markup parser some data with [method@GLib.MarkupParseContext.parse],
16// use this function to get the list of attributes and text out of the
17// markup. This function will not free @context, use [method@GLib.MarkupParseContext.free]
18// to do so.
19func MarkupParserFinish(ContextVar *glib.MarkupParseContext, AttrListVar **AttrList, TextVar *string, AccelCharVar *uint32) (bool, error) {
20 var cerr *glib.Error
21
22 cret := xMarkupParserFinish(ContextVar, AttrListVar, TextVar, AccelCharVar, &cerr)
23 if cerr == nil {
24 return cret, nil
25 }
26 return cret, cerr
27
28}
29
30var xMarkupParserNew func(uint32) *glib.MarkupParseContext
31
32// Incrementally parses marked-up text to create a plain-text string
33// and an attribute list.
34//
35// See the [Pango Markup](pango_markup.html) docs for details about the
36// supported markup.
37//
38// If @accel_marker is nonzero, the given character will mark the
39// character following it as an accelerator. For example, @accel_marker
40// might be an ampersand or underscore. All characters marked
41// as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
42// and the first character so marked will be returned in @accel_char,
43// when calling [func@markup_parser_finish]. Two @accel_marker characters
44// following each other produce a single literal @accel_marker character.
45//
46// To feed markup to the parser, use [method@GLib.MarkupParseContext.parse]
47// on the returned [struct@GLib.MarkupParseContext]. When done with feeding markup
48// to the parser, use [func@markup_parser_finish] to get the data out
49// of it, and then use [method@GLib.MarkupParseContext.free] to free it.
50//
51// This function is designed for applications that read Pango markup
52// from streams. To simply parse a string containing Pango markup,
53// the [func@Pango.parse_markup] API is recommended instead.
54func MarkupParserNew(AccelMarkerVar uint32) *glib.MarkupParseContext {
55
56 cret := xMarkupParserNew(AccelMarkerVar)
57 return cret
58}
59
60var xParseMarkup func(string, int, uint32, **AttrList, *string, *uint32, **glib.Error) bool
61
62// Parses marked-up text to create a plain-text string and an attribute list.
63//
64// See the [Pango Markup](pango_markup.html) docs for details about the
65// supported markup.
66//
67// If @accel_marker is nonzero, the given character will mark the
68// character following it as an accelerator. For example, @accel_marker
69// might be an ampersand or underscore. All characters marked
70// as an accelerator will receive a %PANGO_UNDERLINE_LOW attribute,
71// and the first character so marked will be returned in @accel_char.
72// Two @accel_marker characters following each other produce a single
73// literal @accel_marker character.
74//
75// To parse a stream of pango markup incrementally, use [func@markup_parser_new].
76//
77// If any error happens, none of the output arguments are touched except
78// for @error.
79func ParseMarkup(MarkupTextVar string, LengthVar int, AccelMarkerVar uint32, AttrListVar **AttrList, TextVar *string, AccelCharVar *uint32) (bool, error) {
80 var cerr *glib.Error
81
82 cret := xParseMarkup(MarkupTextVar, LengthVar, AccelMarkerVar, AttrListVar, TextVar, AccelCharVar, &cerr)
83 if cerr == nil {
84 return cret, nil
85 }
86 return cret, cerr
87
88}
89
90func init() {
91 core.SetPackageName("PANGO", "pango")
92 core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"})
93 var libs []uintptr
94 for _, libPath := range core.GetPaths("PANGO") {
95 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
96 if err != nil {
97 panic(err)
98 }
99 libs = append(libs, lib)
100 }
101
102 core.PuregoSafeRegister(&xMarkupParserFinish, libs, "pango_markup_parser_finish")
103 core.PuregoSafeRegister(&xMarkupParserNew, libs, "pango_markup_parser_new")
104 core.PuregoSafeRegister(&xParseMarkup, libs, "pango_parse_markup")
105
106}