Re: GNU G-Golf 0.8.0-rc6 available for testing

2024-09-20 Thread pelzflorian (Florian Pelz)
David Pirotte  writes:
> Excellent! Note that you'll need to update your configuration and
> use/grab 0.8.0-rc7 - which fixes a 'missing some distributed files',
> necessary to be able to run the newly added
>
>   examples/gtk-4/layout-manager.scm
>   [ a g-golf port of the upstream gtk4-demo layout manager
>   [ (transition) example

I see, but since Guix builds G-Golf from git rather than a tarball,
examples/gtk-4/layout-manager.scm had worked already with rc6.

Tarballs contain bundled M4 files and other build-aux files.  Guix
rather uses its own packaged version of these, avoiding something like
the xz vulnerability’s code injection.  Still it is good that you fixed
the tarball.


>>  Now I can embed GTK programs within the Guix Home
>> configurations ...
>
> I am glad that you (finally) can happily use the distro of your dream.
> Your config example certainly should help other guixers willing to use
> g-golf.

:)


>> All that is left is that I do not understand why
>> (gdk-display-get-default) returns #f in G-Golf but
>> gdk_display_get_default () in C returns 0x1c0e36c0.
>
> You need to have initialized either Gtk or Adw, otherwise it returns #f
> (as expected).
>
>   scheme@(guile-user)> ,use (g-golf)
>   scheme@(guile-user)> (gi-import-by-name "Gdk" "Display")
>   $5 = #<  7fee0e488c30>
>
>   scheme@(guile-user)> (gdk-display-get-default)
>   $6 = #f
>
>   scheme@(guile-user)> (gi-import-by-name "Gtk" "init")
>   $7 = #< 7fee075cb480>
>   scheme@(guile-user)> (gtk-init)
>
>   scheme@(guile-user)> (gdk-display-get-default)
>   $8 = #< 7fee0f054a10>
>
> David

This helped.  When manually run, missing gtk-init import and use was the
issue; thank you!  Funny enough, when auto-started, gtk-init is run by
GtkApplication or perhaps by some library constructor, but I also had
forgotten to actually call add-css-class.  Still I added gtk-init, so I
can manually run my launcher as well.

In case others use it as reference, the fixed version is attached.

Regards,
Florian

;;; Copyright © 2023, 2024 Florian Pelz 
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; 
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;; 
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see .
;; 
;; Dieses Programm ist Freie Software: Sie können es unter den Bedingungen
;; der GNU General Public License, wie von der Free Software Foundation,
;; Version 3 der Lizenz oder (nach Ihrer Wahl) jeder neueren
;; veröffentlichten Version, weiter verteilen und/oder modifizieren.
;; 
;; Dieses Programm wird in der Hoffnung bereitgestellt, dass es nützlich sein 
wird, jedoch
;; OHNE JEDE GEWÄHR,; sogar ohne die implizite
;; Gewähr der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
;; Siehe die GNU General Public License für weitere Einzelheiten.
;; 
;; Sie sollten eine Kopie der GNU General Public License zusammen mit diesem
;; Programm erhalten haben. Wenn nicht, siehe .

(use-modules (gnu home)
 (gnu home services)
 (gnu home services desktop)
 (gnu home services shells)
 (gnu home services sound)
 (gnu home services sway)
 (gnu packages)
 (gnu packages gtk)
 (gnu packages guile-xyz)
 (gnu services)
 (guix build-system glib-or-gtk)
 (guix gexp)
 (guix licenses)
 (guix packages)
 (guix transformations))

(home-environment
  (packages (specifications->packages (list "git")))
  (services
   (list (service home-bash-service-type)
 (service home-dbus-service-type) ;für VLC
 ;; (service home-pipewire-service-type)
 (service home-sway-service-type
   (sway-configuration
(execs
 `(,(with-extensions
 (list graphene gtk
   ((options->transformation
 '((with-commit . "guile-g-golf=v0.8.0-rc6")))
guile-g-golf))
 #~(string-append
"guile "
#$(scheme-file "launcher.scm"
   #~(begin
   (eval-when (expand load eval)
 (use-modules (oop goops))
 (default-duplicate-binding-handler
   '(merge-generics replace
 warn-override-core warn last))
 (setenv

Re: GNU G-Golf 0.8.0-rc6 available for testing

2024-09-20 Thread David Pirotte
Hi Florian,

> ...
> I see, but since Guix builds G-Golf from git rather than a tarball,
> examples/gtk-4/layout-manager.scm had worked already with rc6.
> ...

Ah right -

> ...
> Funny enough, when auto-started, gtk-init is run by GtkApplication

Yes, either GtkApplication or AdwApplication, as part of the default
startup signal handler:

https://docs.gtk.org/gtk4/initialization.html
https://docs.gtk.org/gtk4/func.init.html
https://docs.gtk.org/gtk4/class.Application.html

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Application.html

I recommend you (and g-golf users) to carefully read at least the
GObject tutorial and then the upstream doc entries of the objects,
properties, functions, methods and virtual methods you are using in
your own g-golf based app [1].

David

[1] and also look at (and study from) the distributed examples g-golf
provides, where that applies ... room for improvment(s) (constructive
critics welcome), sure, but they are quite good i should say.


pgpknGHFKAcy3.pgp
Description: OpenPGP digital signature


Re: [ANN] nyacc-2.00.0 released

2024-09-20 Thread Matt Wette

On 9/20/24 10:47 AM, Matt Wette wrote:

Hi All,

I've generated a new release of nyacc.  Due to major change in
the ffi-helper I'm calling this nyacc-2.00.0.


One key item I wanted to mention is that the `set!' procedure from the 
new cdata module

expects the value after the cdata object and before the selection tags:

bytestructures and fh-types:
    (bytestructure-set! bsobj 'a 'b 'c value)
    (fh-object-set! fhobj 'a 'b 'c value)

cdata (like Guile's array):
  (cdata-set! data value 'a 'b 'c)


Also, I've already discovered a bug in 2.00.0  compile-ffi script: It 
will always
compile all dependent ffis.    I have a fix pushed, to appear in 2.00.1 
later.


Matt



Re: GNU G-Golf 0.8.0-rc6 available for testing

2024-09-20 Thread David Pirotte
Hello Greg,

> > ...
> >   GEN  g-golf/support/color.go
> > Backtrace:
> > In system/base/compile.scm:
> > ...
> > ice-9/boot-9.scm:752:25: In procedure dispatch-exception:
> > no binding `string-replace-substring' in module (ice-9 string-fun)
> > *** [g-golf/support/color.go] Error code 1  
> 
> Hum, i was not aware it was not in 2.2. sorry about this - I'll think
> about the best way to fix this, will let you know

I fixed this problem by snarfing a copy -  see
03f4fd6b27bb2cf68633d106bc2cec3652ad2734 - currently in the devel
branch, but it will be part the next release ofc

Can you 'locally grab and apply' this patch? I'd rather wait for some
other changes before to run the next release ...

David


pgpSU7iQ1evH8.pgp
Description: OpenPGP digital signature


[ANN] nyacc-2.00.0 released

2024-09-20 Thread Matt Wette

Hi All,

I've generated a new release of nyacc.  Due to major change in
the ffi-helper I'm calling this nyacc-2.00.0.

Thanks to @lechner on #guile for dicussions of pointers and functions.
At the time of this discussion I was also working on extending gtk2+
in Guile to make a tkinter like module.  I was running into issues with
function pointers also.  The result is that I went back and reworked the
handling of pointers and especially function pointers. One can now pass
scheme procedures to functions expecting function pointers, and one can
set function pointers in structures to procedures.

In addition, I reworked a lot of the processing in the ffi-helper
translator.   Previously, special cases were needed to handle several
declarations from miscellaneous libraries.  Those special cases are
now gone.

Folding in the another big change, I've been working on a C data handling
module that provides an interface to C data structures.   This is much
the same function as (bytestructures guile) module, but it is more tuned
to the ffi-helper and (for me) it can work on foreign machine architectures.


NYACC, for Not Yet Another Compiler Compiler, is set of guile modules for
generating parsers and lexical analyzers.  It also provides sample parsers
and pretty-printers using SXML trees as an intermediate representation.

It provides a decent C parser and a `FFI Helper' tool to help create
Guile Scheme bindings for C-based libraries.

It provides (partially implemented) compilers based on above mentioned
parsers to allow execution with Guile as extension languages.


NEWS

* added `cdata' module for handling type and data from C libraries
  + see doc/cdata.info
  + capable of dealing with foreign architectures
* major ffi helper update:
  + includes two backends:
    - cdata: depends only on system/foreign/cdata module
    - bytestructures: depends on ffi-help-rt and bytestructures modules
  + by default, the ffi helper now uses the cdata backend
    - scheme bytestructures is not required
    - does not use ffi-help-rt
    - generates ~20% smaller .scm files
    - generates ~40% smaller .go files
  + ffi-help.scm(cnvt-udecl): complete re-write, using udecl->mdecl.
    This no longer has special cases for some include files.
  + handling of functions and function types is much cleaner and
    works better (at least for the author, so far)
* updated system/ffi-help-rt (which is not used by cdata)
  + funtion pointers reworked
  + now depends on guile (system foreign-library)
  + definition of fh-cast changed to be a real cast
  + add fh-varg for use with procedures based on C va-args:
  (printf "ans=%d" (fh-varg ffi:int 3))
* scripts/compile-ffi: now accepts argument for backend:
  $ guild compile-ffi -b bytestructures mymodule.ffi
  $ FFI_HELP_BACKEND=bytestructures guild compile-ffi mymodule.ffi
* scripts/compile-ffi: now computes dependencies correctly (I think)
* moved some nx-language implementation code into examples/languages/
* Work to go:
  + Update READMEs and other documentation.
  + Complete ccode->sexp function to convert strings of C code
    to scheme expressions for small ffi interface code


NYACC maturity is production/stable level.

NYACC is free software; the full source distribution is available through

* the tarball repository:
    https://download.savannah.gnu.org/releases/nyacc/

* the git repository:
    git://git.savannah.nongnu.org/nyacc.git

home page, project page and user's guides:
* https://www.nongnu.org/nyacc
* https://savannah.nongnu.org/projects/nyacc
* https://www.nongnu.org/nyacc/nyacc-ug.html
* https://www.nongnu.org/nyacc/ffi-help.html

Report bugs:
* https://savannah.nongnu.org/bugs/?group=nyacc

Get support:
* https://savannah.nongnu.org/support/?group=nyacc
Copyright (C) 2017-2024 Matthew Wette

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.  This file is offered as-is,
without any warranty.


Matt