G-Golf utilities low level API.
Returns a string34.
Expand the StudlyCaps str to a more schemey-form, according to the conventions of GLib libraries. For example:
(g-studly-caps-expand "GStudlyCapsExpand") ⇒ "g-studly-caps-expand" (g-studly-caps-expand "GSource") ⇒ "g-source" (g-studly-caps-expand "GtkIMContext") ⇒ "im-context"
G-Golf slightly modified the original code to also allow the possibility to specially treat the str (expanded) tokens, such as:
(g-studly-caps-expand "WebKitWebContext") ⇒ "webkit-web-context" ;; not "web-kit-web-context"
The list of StudlyCaps token exception pairs are maintained in the g-studly-caps-expand-token-exception alist.
Return a symbol name, or a string name if as-string is #t.
g-name->name first obtains, the scheme representation of g-name, as a string, by looking for a possible entry in g-name-transform-exception, or if it failed, by calling g-studly-caps-expand.
If the optional as-string argument is #t, it returns
that string, otherwise, it calls and returns the result of
string->symbol
.
g-name->class-name calls g-name->name, surrounds the result
using #\<
and #\>
characters then either return that
string, if as-string? is #t
, otherwise it calls and returns
the result of string->symbol
:
(g-name->class-name "GtkWindow") ⇒ <gtk-window>
Return a symbol name, or a string name if as-string is #t.
Obtains and returns a (method) short name for g-name. It first obtains the sro (scheme representation of) both g-name and g-class-name (which is expected to be the upstream method container (class) name), as a string, then:
If the optional as-string argument is #t, it returns
that string, otherwise, it calls and returns the result of
string->symbol
.
To illustrate, here is an example for each of the three above exposed cases:
(g-name->shortname "gdk_event_get_event_type" "GdkEvent") ⇒ get-event-type (g-name->shortname "gdk_events_get_angle" "GdkEvent") ⇒ get-angle (g-name->short-name "gtk_drag_begin" "GtkWidget") ⇒ drag-begin
Returns a (symbol) name.
Obtains and returns the (symbol) name for class-name, by dropping
the surrounding '<'
and '>'
characters. For example:
(class-name->name '<foo-bar>) ⇒ 'foo-bar
Returns a string.
Obtains and returns the StudlyCaps string reprentation for class-name. For example:
(class-name->g-name '<foo-bar>) ⇒ "FooBar"
Return a symbol, or a string if as-string is #t.
Unless name is a string, it first calls (symbol->string
name)
, then changes all occurrences of -
(hyphen) to _
(underscore) (other characters are not valid in a g-name).
If the optional as-string argument is #t, it returns
that string, otherwise, it calls and returns the result of
string->symbol
.
Returns a (symbol) name.
This procedure is used to ‘protect’ syntax names, from being redefined as generic functions and methods.
Users should normally not call this procedure - except for testing purposes, if/when they customize its default settings - it is appropriately and automatically called by G-Golf when importing a GI typelib.
Here is what it does:
symbol-append
adequately passing either
or both and name and returns the result.
See Customization Square - GI Syntax Name Protect. G-Golf GI Syntax Name Protect default values are:
syntax-name-protect-prefix #f
syntax-name-protect-postfix '_
(the symbol _) syntax-name-protect-renamer #f
As an example, using these default settings, the method short name for
gcr-secret-exchange-begin
would be begin_
.
Returns an integer or '*
(the symbol *
).
Obtains the correponding Guile’s ffi tag value for type-tag, which
must be a member of %gi-type-tag. If type-tag is unknown,
an exception is raised. Note that Guile’s ffi tag values are integers or
'*
(the symbol *
, used by convention to denote pointer
types.
Returns the default init value for type-tag.
Obtains and returns the default init value for type-tag, which
will either be 0
(zero), or %null-pointer
.
This procedure, as well as g-name->name
and g-name->class-name come from Guile-GNOME,
where there are named GStudlyCapsExpand
,
gtype-name->scm-name
and gtype-name->class-name
.
In
G-Golf, these procedures are also be used to transform other (GObject
Introspection) names, such as function names, hence they use the
g-name->
prefix instead