Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: guile-gi for use in GIMP extensions #108

Open
spk121 opened this issue Feb 24, 2021 · 4 comments
Open

RFE: guile-gi for use in GIMP extensions #108

spk121 opened this issue Feb 24, 2021 · 4 comments

Comments

@spk121
Copy link
Owner

spk121 commented Feb 24, 2021

In #106 we began a side discussion about the possibility of make GIMP extensions in Guile using guile-gi to wrap the required GIMP classes.

#106 (comment)

#106 (comment)

@Jehan
Copy link

Jehan commented Apr 5, 2021

Hello!

Nice to see this report here, as I was testing this weekend whether guile-gui would work well for Scheme plug-ins. We are indeed interested into Scheme plug-ins, possibly to even replace the historical script-fu if the CI binding works well (because script-fu is limited to a specific set of functions whereas a CI binding would give developers the full power of the whole libgimp API).

So I built guile-gi (tested with GNU Guile 2.2.7 from Fedora 33 repositories, as I couldn't find a package for Guile 3.0; make test works well except for one test #109), set up a few environment variable, then tried to import the gi module in it:

scheme@(guile-user)> (use-modules (gi)
             (gi repository)
             (gi types)
             (gi util))
[… snip …]
scheme@(guile-user)> (use-typelibs ("GObject" "2.0") ("Gio" "2.0") ("Gtk" "3.0") ("Gdk" "3.0") ("Babl" "0.1") ("Gegl" "0.4"))

(process:16504): GuileGI-WARNING **: 16:38:02.907: no way of determining array size, coercing to pointer

(process:16504): GuileGI-WARNING **: 16:38:02.907: no way of determining array size, coercing to pointer

(process:16504): GuileGI-WARNING **: 16:38:02.909: Unrepresentable type: (unnamed), VaClosureMarshal, unresolved

(process:16504): GuileGI-WARNING **: 16:38:03.031: no way of determining array size, coercing to pointer

(process:16504): GuileGI-WARNING **: 16:38:03.342: Editable - non-Object interface wants signals

(process:16504): GuileGI-WARNING **: 16:38:03.424: no way of determining array size, coercing to pointer

(process:16504): GuileGI-WARNING **: 16:38:03.424: no way of determining array size, coercing to pointer

(process:16504): GuileGI-WARNING **: 16:38:04.064: no way of determining array size, coercing to pointer

Well apart from a few warnings, at least it seems to work so far. Now I still have a few questions:

  • How do you force namespacing? I saw some #:renamer usage in example files, but you seem to use this per-function. What if I want to have all GI module functions prefixed with gtk::, babl:: and whatnot? We just can't expect to have no collision. Even just basic functions gives out warning:
scheme@(guile-user)> (display "hello world") (newline)
WARNING: (guile-user): `display' imported from both (ice-9 r5rs) and (gi Gdk-3.0)
hello world

Anyway now for trying to import libgimp itself:

scheme@(guile-user)> (use-typelibs ("Gimp" "3.0"))

(process:30538): GuileGI-ERROR **: 17:28:03.115: unhandled type GimpConfigPath derived from gchararray
Trace/breakpoint trap (core dumped)

So guile crashes. GimpConfigPath is registered like this: https://gitlab.gnome.org/GNOME/gimp/-/blob/master/libgimpconfig/gimpconfig-path.c#L64

Doesn't guile-gi support static types derived from G_TYPE_STRING?

@LordYuuma
Copy link
Collaborator

You can surely use #:prefix if you so want. Just do (use-typelibs (("GObject" "2.0") #:prefix g-) ...)
As for inheritance, Guile-GI currently only supports inheritance from object types, boxed types and enums. See and modify src/gig_type.c to your needs.

@Jehan
Copy link

Jehan commented Apr 12, 2021

You can surely use #:prefix if you so want. Just do (use-typelibs (("GObject" "2.0") #:prefix g-) ...)

Hmmm… I think I saw this syntax in one of the files and tried it, but it didn't work. Though I'll try again, maybe I did it wrong.

Guile-GI currently only supports inheritance from object types, boxed types and enums.

But not also the basic types such as string? 😢

@LordYuuma
Copy link
Collaborator

LordYuuma commented Apr 12, 2021

You can surely use #:prefix if you so want. Just do (use-typelibs (("GObject" "2.0") #:prefix g-) ...)

Hmmm… I think I saw this syntax in one of the files and tried it, but it didn't work. Though I'll try again, maybe I did it wrong.

That'd be very weird. Guile-GI passes these options to use-modules as-is.

Guile-GI currently only supports inheritance from object types, boxed types and enums.

But not also the basic types such as string?

Not currently, see https://github.com/spk121/guile-gi/blob/master/src/gig_type.c#L272-L375 for full context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants