Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,9 +1,14 @@
(import (otus ffi))
(if (not (has? *features* 'Windows))
(print "The host platform is not a Windows!"))
(define libc (or
(load-dynamic-library "libc.so") ; General Posix
(load-dynamic-library "libc.so.6") ; Linux
(load-dynamic-library "libc.so.7") ; Latest *BSD
(load-dynamic-library "libSystem.B.dylib") ; Mac
(load-dynamic-library "shlwapi.dll") )) ; Windows
(define self (load-dynamic-library "shlwapi.dll"))
(define strdup (self type-string "StrDupA" type-string))
(define strdup (or
(libc type-string "strdup" type-string) ; All
(libc type-string "StrDupA" type-string) )) ; Win
(print (strdup "Hello World!"))

View file

@ -1,34 +1,26 @@
; The sample usage of GTK3+ library
(import (otus ffi)
(lib glib-2)
(lib gtk-3))
(import (otus ffi))
(define print_hello (vm:pin (cons
(list GtkWidget* gpointer)
(lambda (widget userdata)
(print "hello")
TRUE
))))
(define libc (or
(load-dynamic-library "libc.so") ; General Posix
(load-dynamic-library "libc.so.6") ; Linux
(load-dynamic-library "libc.so.7") ; Latest *BSD
(load-dynamic-library "libSystem.B.dylib") ; Mac
(load-dynamic-library "shlwapi.dll") )) ; Windows
(define activate (vm:pin (cons
(list GtkApplication* gpointer)
(lambda (app userdata)
(define window (gtk_application_window_new app))
(print "window: " window)
(gtk_window_set_title window "Window")
(gtk_window_set_default_size window 200 200)
(define lib2
(load-dynamic-library "kernel32.dll")) ; Windows
(define button_box (gtk_button_box_new GTK_ORIENTATION_HORIZONTAL))
(gtk_container_add window button_box)
(define strdup
(let ((strdup (or
(libc type-vptr "strdup" type-string) ; All
(libc type-vptr "StrDupA" type-string))) ; Win
(free (or
(libc fft-void "free" type-vptr) ; All
(lib2 fft-void "LocalFree" type-vptr)))) ; Win
(lambda (str)
(let*((dupped (strdup str))
(result (vptr->string dupped)))
(free dupped)
result))))
(define button (gtk_button_new_with_label "Hello World"))
(g_signal_connect button "clicked" (G_CALLBACK print_hello) NULL)
(gtk_container_add button_box button)
(gtk_widget_show_all window)
))))
(define app (gtk_application_new (c-string "org.gtk.example") G_APPLICATION_FLAGS_NONE))
(g_signal_connect app (c-string "activate") (G_CALLBACK activate) NULL)
(g_application_run app 0 #false)
(print (strdup "Hello World!"))