v0.2.2 9100209

gconvert.go RawHistoryFolder

1// Package glib was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package glib
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11)
12
13// The GIConv struct wraps an iconv() conversion descriptor. It contains
14// private data and should only be accessed using the following functions.
15type IConv struct {
16	_ structs.HostLayout
17}
18
19func (x *IConv) GoPointer() uintptr {
20	return uintptr(unsafe.Pointer(x))
21}
22
23var xIConvGIconv func(uintptr, string, *uint, string, *uint) uint
24
25// Same as the standard UNIX routine iconv(), but
26// may be implemented via libiconv on UNIX flavors that lack
27// a native implementation.
28//
29// GLib provides g_convert() and g_locale_to_utf8() which are likely
30// more convenient than the raw iconv wrappers.
31//
32// Note that the behaviour of iconv() for characters which are valid in the
33// input character set, but which have no representation in the output character
34// set, is implementation defined. This function may return success (with a
35// positive number of non-reversible conversions as replacement characters were
36// used), or it may return -1 and set an error such as %EILSEQ, in such a
37// situation.
38//
39// See [`iconv(3posix)`](man:iconv(3posix)) and [`iconv(3)`](man:iconv(3)) for more details about behavior when an
40// error occurs.
41func (x *IConv) GIconv(InbufVar string, InbytesLeftVar *uint, OutbufVar string, OutbytesLeftVar *uint) uint {
42
43	cret := xIConvGIconv(x.GoPointer(), InbufVar, InbytesLeftVar, OutbufVar, OutbytesLeftVar)
44	return cret
45}
46
47var xIConvClose func(uintptr) int
48
49// Same as the standard UNIX routine iconv_close(), but
50// may be implemented via libiconv on UNIX flavors that lack
51// a native implementation. Should be called to clean up
52// the conversion descriptor from g_iconv_open() when
53// you are done converting things.
54//
55// GLib provides g_convert() and g_locale_to_utf8() which are likely
56// more convenient than the raw iconv wrappers.
57func (x *IConv) Close() int {
58
59	cret := xIConvClose(x.GoPointer())
60	return cret
61}
62
63// Error codes returned by character set conversion routines.
64type ConvertError int
65
66const (
67
68	// Conversion between the requested character
69	//     sets is not supported.
70	GConvertErrorNoConversionValue ConvertError = 0
71	// Invalid byte sequence in conversion input;
72	//    or the character sequence could not be represented in the target
73	//    character set.
74	GConvertErrorIllegalSequenceValue ConvertError = 1
75	// Conversion failed for some reason.
76	GConvertErrorFailedValue ConvertError = 2
77	// Partial character sequence at end of input.
78	GConvertErrorPartialInputValue ConvertError = 3
79	// URI is invalid.
80	GConvertErrorBadUriValue ConvertError = 4
81	// Pathname is not an absolute path.
82	GConvertErrorNotAbsolutePathValue ConvertError = 5
83	// No memory available. Since: 2.40
84	GConvertErrorNoMemoryValue ConvertError = 6
85	// An embedded NUL character is present in
86	//     conversion output where a NUL-terminated string is expected.
87	//     Since: 2.56
88	GConvertErrorEmbeddedNulValue ConvertError = 7
89)
90
91var xConvert func([]byte, int, string, string, *uint, *uint, **Error) uintptr
92
93// Converts a string from one character set to another.
94//
95// Note that you should use g_iconv() for streaming conversions.
96// Despite the fact that @bytes_read can return information about partial
97// characters, the g_convert_... functions are not generally suitable
98// for streaming. If the underlying converter maintains internal state,
99// then this won't be preserved across successive calls to g_convert(),
100// g_convert_with_iconv() or g_convert_with_fallback(). (An example of
101// this is the GNU C converter for CP1255 which does not emit a base
102// character until it knows that the next character is not a mark that
103// could combine with the base character.)
104//
105// Using extensions such as "//TRANSLIT" may not work (or may not work
106// well) on many platforms.  Consider using g_str_to_ascii() instead.
107func Convert(StrVar []byte, LenVar int, ToCodesetVar string, FromCodesetVar string, BytesReadVar *uint, BytesWrittenVar *uint) (uintptr, error) {
108	var cerr *Error
109
110	cret := xConvert(StrVar, LenVar, ToCodesetVar, FromCodesetVar, BytesReadVar, BytesWrittenVar, &cerr)
111
112	if cerr == nil {
113		return cret, nil
114	}
115	return cret, cerr
116
117}
118
119var xConvertWithFallback func([]byte, int, string, string, string, *uint, *uint, **Error) uintptr
120
121// Converts a string from one character set to another, possibly
122// including fallback sequences for characters not representable
123// in the output. Note that it is not guaranteed that the specification
124// for the fallback sequences in @fallback will be honored. Some
125// systems may do an approximate conversion from @from_codeset
126// to @to_codeset in their iconv() functions,
127// in which case GLib will simply return that approximate conversion.
128//
129// Note that you should use g_iconv() for streaming conversions.
130// Despite the fact that @bytes_read can return information about partial
131// characters, the g_convert_... functions are not generally suitable
132// for streaming. If the underlying converter maintains internal state,
133// then this won't be preserved across successive calls to g_convert(),
134// g_convert_with_iconv() or g_convert_with_fallback(). (An example of
135// this is the GNU C converter for CP1255 which does not emit a base
136// character until it knows that the next character is not a mark that
137// could combine with the base character.)
138func ConvertWithFallback(StrVar []byte, LenVar int, ToCodesetVar string, FromCodesetVar string, FallbackVar string, BytesReadVar *uint, BytesWrittenVar *uint) (uintptr, error) {
139	var cerr *Error
140
141	cret := xConvertWithFallback(StrVar, LenVar, ToCodesetVar, FromCodesetVar, FallbackVar, BytesReadVar, BytesWrittenVar, &cerr)
142
143	if cerr == nil {
144		return cret, nil
145	}
146	return cret, cerr
147
148}
149
150var xConvertWithIconv func([]byte, int, uintptr, *uint, *uint, **Error) uintptr
151
152// Converts a string from one character set to another.
153//
154// Note that you should use g_iconv() for streaming conversions.
155// Despite the fact that @bytes_read can return information about partial
156// characters, the g_convert_... functions are not generally suitable
157// for streaming. If the underlying converter maintains internal state,
158// then this won't be preserved across successive calls to g_convert(),
159// g_convert_with_iconv() or g_convert_with_fallback(). (An example of
160// this is the GNU C converter for CP1255 which does not emit a base
161// character until it knows that the next character is not a mark that
162// could combine with the base character.)
163//
164// Characters which are valid in the input character set, but which have no
165// representation in the output character set will result in a
166// %G_CONVERT_ERROR_ILLEGAL_SEQUENCE error. This is in contrast to the iconv()
167// specification, which leaves this behaviour implementation defined. Note that
168// this is the same error code as is returned for an invalid byte sequence in
169// the input character set. To get defined behaviour for conversion of
170// unrepresentable characters, use g_convert_with_fallback().
171func ConvertWithIconv(StrVar []byte, LenVar int, ConverterVar uintptr, BytesReadVar *uint, BytesWrittenVar *uint) (uintptr, error) {
172	var cerr *Error
173
174	cret := xConvertWithIconv(StrVar, LenVar, ConverterVar, BytesReadVar, BytesWrittenVar, &cerr)
175
176	if cerr == nil {
177		return cret, nil
178	}
179	return cret, cerr
180
181}
182
183var xFilenameDisplayBasename func(string) string
184
185// Returns the display basename for the particular filename, guaranteed
186// to be valid UTF-8. The display name might not be identical to the filename,
187// for instance there might be problems converting it to UTF-8, and some files
188// can be translated in the display.
189//
190// If GLib cannot make sense of the encoding of @filename, as a last resort it
191// replaces unknown characters with U+FFFD, the Unicode replacement character.
192// You can search the result for the UTF-8 encoding of this character (which is
193// "\357\277\275" in octal notation) to find out if @filename was in an invalid
194// encoding.
195//
196// You must pass the whole absolute pathname to this functions so that
197// translation of well known locations can be done.
198//
199// This function is preferred over g_filename_display_name() if you know the
200// whole path, as it allows translation.
201func FilenameDisplayBasename(FilenameVar string) string {
202
203	cret := xFilenameDisplayBasename(FilenameVar)
204
205	return cret
206}
207
208var xFilenameDisplayName func(string) string
209
210// Converts a filename into a valid UTF-8 string. The conversion is
211// not necessarily reversible, so you should keep the original around
212// and use the return value of this function only for display purposes.
213// Unlike g_filename_to_utf8(), the result is guaranteed to be non-%NULL
214// even if the filename actually isn't in the GLib file name encoding.
215//
216// If GLib cannot make sense of the encoding of @filename, as a last resort it
217// replaces unknown characters with U+FFFD, the Unicode replacement character.
218// You can search the result for the UTF-8 encoding of this character (which is
219// "\357\277\275" in octal notation) to find out if @filename was in an invalid
220// encoding.
221//
222// If you know the whole pathname of the file you should use
223// g_filename_display_basename(), since that allows location-based
224// translation of filenames.
225func FilenameDisplayName(FilenameVar string) string {
226
227	cret := xFilenameDisplayName(FilenameVar)
228
229	return cret
230}
231
232var xFilenameFromUri func(string, *string, **Error) string
233
234// Converts an escaped ASCII-encoded URI to a local filename in the
235// encoding used for filenames.
236//
237// Since GLib 2.78, the query string and fragment can be present in the URI,
238// but are not part of the resulting filename.
239// We take inspiration from https://url.spec.whatwg.org/#file-state,
240// but we don't support the entire standard.
241func FilenameFromUri(UriVar string, HostnameVar *string) (string, error) {
242	var cerr *Error
243
244	cret := xFilenameFromUri(UriVar, HostnameVar, &cerr)
245
246	if cerr == nil {
247		return cret, nil
248	}
249	return cret, cerr
250
251}
252
253var xFilenameFromUtf8 func(string, int, *uint, *uint, **Error) string
254
255// Converts a string from UTF-8 to the encoding GLib uses for
256// filenames. Note that on Windows GLib uses UTF-8 for filenames;
257// on other platforms, this function indirectly depends on the
258// [current locale](running.html#locale).
259//
260// The input string shall not contain nul characters even if the @len
261// argument is positive. A nul character found inside the string will result
262// in error %G_CONVERT_ERROR_ILLEGAL_SEQUENCE. If the filename encoding is
263// not UTF-8 and the conversion output contains a nul character, the error
264// %G_CONVERT_ERROR_EMBEDDED_NUL is set and the function returns %NULL.
265func FilenameFromUtf8(Utf8stringVar string, LenVar int, BytesReadVar *uint, BytesWrittenVar *uint) (string, error) {
266	var cerr *Error
267
268	cret := xFilenameFromUtf8(Utf8stringVar, LenVar, BytesReadVar, BytesWrittenVar, &cerr)
269
270	if cerr == nil {
271		return cret, nil
272	}
273	return cret, cerr
274
275}
276
277var xFilenameToUri func(string, uintptr, **Error) string
278
279// Converts an absolute filename to an escaped ASCII-encoded URI, with the path
280// component following Section 3.3. of RFC 2396.
281func FilenameToUri(FilenameVar string, HostnameVar *string) (string, error) {
282	var cerr *Error
283
284	HostnameVarPtr := core.GStrdupNullable(HostnameVar)
285	defer core.GFreeNullable(HostnameVarPtr)
286
287	cret := xFilenameToUri(FilenameVar, HostnameVarPtr, &cerr)
288
289	if cerr == nil {
290		return cret, nil
291	}
292	return cret, cerr
293
294}
295
296var xFilenameToUtf8 func(string, int, *uint, *uint, **Error) string
297
298// Converts a string which is in the encoding used by GLib for
299// filenames into a UTF-8 string. Note that on Windows GLib uses UTF-8
300// for filenames; on other platforms, this function indirectly depends on
301// the [current locale](running.html#locale).
302//
303// The input string shall not contain nul characters even if the @len
304// argument is positive. A nul character found inside the string will result
305// in error %G_CONVERT_ERROR_ILLEGAL_SEQUENCE.
306// If the source encoding is not UTF-8 and the conversion output contains a
307// nul character, the error %G_CONVERT_ERROR_EMBEDDED_NUL is set and the
308// function returns %NULL. Use g_convert() to produce output that
309// may contain embedded nul characters.
310func FilenameToUtf8(OpsysstringVar string, LenVar int, BytesReadVar *uint, BytesWrittenVar *uint) (string, error) {
311	var cerr *Error
312
313	cret := xFilenameToUtf8(OpsysstringVar, LenVar, BytesReadVar, BytesWrittenVar, &cerr)
314
315	if cerr == nil {
316		return cret, nil
317	}
318	return cret, cerr
319
320}
321
322var xGetFilenameCharsets func(*[]string) bool
323
324// Determines the preferred character sets used for filenames.
325// The first character set from the @charsets is the filename encoding, the
326// subsequent character sets are used when trying to generate a displayable
327// representation of a filename, see g_filename_display_name().
328//
329// On Unix, the character sets are determined by consulting the
330// environment variables `G_FILENAME_ENCODING` and `G_BROKEN_FILENAMES`.
331// On Windows, the character set used in the GLib API is always UTF-8
332// and said environment variables have no effect.
333//
334// `G_FILENAME_ENCODING` may be set to a comma-separated list of
335// character set names. The special token `@locale` is taken to mean the
336// character set for the [current locale](running.html#locale).
337// If `G_FILENAME_ENCODING` is not set, but `G_BROKEN_FILENAMES` is,
338// the character set of the current locale is taken as the filename
339// encoding. If neither environment variable  is set, UTF-8 is taken
340// as the filename encoding, but the character set of the current locale
341// is also put in the list of encodings.
342//
343// The returned @charsets belong to GLib and must not be freed.
344//
345// Note that on Unix, regardless of the locale character set or
346// `G_FILENAME_ENCODING` value, the actual file names present
347// on a system might be in any random encoding or just gibberish.
348func GetFilenameCharsets(FilenameCharsetsVar *[]string) bool {
349
350	cret := xGetFilenameCharsets(FilenameCharsetsVar)
351
352	return cret
353}
354
355var xIconv func(uintptr, string, *uint, string, *uint) uint
356
357// Same as the standard UNIX routine iconv(), but
358// may be implemented via libiconv on UNIX flavors that lack
359// a native implementation.
360//
361// GLib provides g_convert() and g_locale_to_utf8() which are likely
362// more convenient than the raw iconv wrappers.
363//
364// Note that the behaviour of iconv() for characters which are valid in the
365// input character set, but which have no representation in the output character
366// set, is implementation defined. This function may return success (with a
367// positive number of non-reversible conversions as replacement characters were
368// used), or it may return -1 and set an error such as %EILSEQ, in such a
369// situation.
370//
371// See [`iconv(3posix)`](man:iconv(3posix)) and [`iconv(3)`](man:iconv(3)) for more details about behavior when an
372// error occurs.
373func Iconv(ConverterVar uintptr, InbufVar string, InbytesLeftVar *uint, OutbufVar string, OutbytesLeftVar *uint) uint {
374
375	cret := xIconv(ConverterVar, InbufVar, InbytesLeftVar, OutbufVar, OutbytesLeftVar)
376
377	return cret
378}
379
380var xIconvOpen func(string, string) uintptr
381
382// Same as the standard UNIX routine iconv_open(), but
383// may be implemented via libiconv on UNIX flavors that lack
384// a native implementation.
385//
386// GLib provides g_convert() and g_locale_to_utf8() which are likely
387// more convenient than the raw iconv wrappers.
388func IconvOpen(ToCodesetVar string, FromCodesetVar string) uintptr {
389
390	cret := xIconvOpen(ToCodesetVar, FromCodesetVar)
391
392	return cret
393}
394
395var xLocaleFromUtf8 func(string, int, *uint, *uint, **Error) uintptr
396
397// Converts a string from UTF-8 to the encoding used for strings by
398// the C runtime (usually the same as that used by the operating
399// system) in the [current locale](running.html#locale).
400// On Windows this means the system codepage.
401//
402// The input string shall not contain nul characters even if the @len
403// argument is positive. A nul character found inside the string will result
404// in error %G_CONVERT_ERROR_ILLEGAL_SEQUENCE. Use g_convert() to convert
405// input that may contain embedded nul characters.
406func LocaleFromUtf8(Utf8stringVar string, LenVar int, BytesReadVar *uint, BytesWrittenVar *uint) (uintptr, error) {
407	var cerr *Error
408
409	cret := xLocaleFromUtf8(Utf8stringVar, LenVar, BytesReadVar, BytesWrittenVar, &cerr)
410
411	if cerr == nil {
412		return cret, nil
413	}
414	return cret, cerr
415
416}
417
418var xLocaleToUtf8 func([]byte, int, *uint, *uint, **Error) string
419
420// Converts a string which is in the encoding used for strings by
421// the C runtime (usually the same as that used by the operating
422// system) in the [current locale](running.html#locale) into a UTF-8 string.
423//
424// If the source encoding is not UTF-8 and the conversion output contains a
425// nul character, the error %G_CONVERT_ERROR_EMBEDDED_NUL is set and the
426// function returns %NULL.
427// If the source encoding is UTF-8, an embedded nul character is treated with
428// the %G_CONVERT_ERROR_ILLEGAL_SEQUENCE error for backward compatibility with
429// earlier versions of this library. Use g_convert() to produce output that
430// may contain embedded nul characters.
431func LocaleToUtf8(OpsysstringVar []byte, LenVar int, BytesReadVar *uint, BytesWrittenVar *uint) (string, error) {
432	var cerr *Error
433
434	cret := xLocaleToUtf8(OpsysstringVar, LenVar, BytesReadVar, BytesWrittenVar, &cerr)
435
436	if cerr == nil {
437		return cret, nil
438	}
439	return cret, cerr
440
441}
442
443var xUriListExtractUris func(string) []string
444
445// Splits an URI list conforming to the text/uri-list
446// mime type defined in RFC 2483 into individual URIs,
447// discarding any comments. The URIs are not validated.
448func UriListExtractUris(UriListVar string) []string {
449
450	cret := xUriListExtractUris(UriListVar)
451
452	return cret
453}
454
455func init() {
456	core.SetPackageName("GLIB", "glib-2.0")
457	core.SetSharedLibraries("GLIB", []string{"libgobject-2.0.so.0", "libglib-2.0.so.0"})
458	var libs []uintptr
459	for _, libPath := range core.GetPaths("GLIB") {
460		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
461		if err != nil {
462			panic(err)
463		}
464		libs = append(libs, lib)
465	}
466
467	core.PuregoSafeRegister(&xConvert, libs, "g_convert")
468	core.PuregoSafeRegister(&xConvertWithFallback, libs, "g_convert_with_fallback")
469	core.PuregoSafeRegister(&xConvertWithIconv, libs, "g_convert_with_iconv")
470	core.PuregoSafeRegister(&xFilenameDisplayBasename, libs, "g_filename_display_basename")
471	core.PuregoSafeRegister(&xFilenameDisplayName, libs, "g_filename_display_name")
472	core.PuregoSafeRegister(&xFilenameFromUri, libs, "g_filename_from_uri")
473	core.PuregoSafeRegister(&xFilenameFromUtf8, libs, "g_filename_from_utf8")
474	core.PuregoSafeRegister(&xFilenameToUri, libs, "g_filename_to_uri")
475	core.PuregoSafeRegister(&xFilenameToUtf8, libs, "g_filename_to_utf8")
476	core.PuregoSafeRegister(&xGetFilenameCharsets, libs, "g_get_filename_charsets")
477	core.PuregoSafeRegister(&xIconv, libs, "g_iconv")
478	core.PuregoSafeRegister(&xIconvOpen, libs, "g_iconv_open")
479	core.PuregoSafeRegister(&xLocaleFromUtf8, libs, "g_locale_from_utf8")
480	core.PuregoSafeRegister(&xLocaleToUtf8, libs, "g_locale_to_utf8")
481	core.PuregoSafeRegister(&xUriListExtractUris, libs, "g_uri_list_extract_uris")
482
483	core.PuregoSafeRegister(&xIConvGIconv, libs, "g_iconv")
484	core.PuregoSafeRegister(&xIConvClose, libs, "g_iconv_close")
485
486}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close