¶News
Reminder about the EmacsConf 2024 Call for Participation:
The conference will be December 7 and 8 this year:
https://emacsconf.org/2024/cfp/
If you have an Emacs-related topic you’re excited about, consider submitting a proposal!
- Next week: New System Crafters video on workflows for managing many tasks with Org agenda bulk actions!
¶Taking a Look at PreScheme
- https://prescheme.org/
- https://prescheme.org/posts/announcing-the-pre-scheme-restoration.html
- https://en.wikipedia.org/wiki/Scheme_48
- https://s48.org/
We’ll experiment with PreScheme by referring to the Scheme48 manual:
https://tailcall.au/s48-refman/scheme48.html
A good starting point:
https://tailcall.au/s48-refman/scheme48.html#Example-Pre_002dScheme-compiler-usage
C function interface:
https://tailcall.au/s48-refman/scheme48.html#Pre_002dScheme-access-to-C-functions-and-macros
Can we write a small program with Raylib using PreScheme?
¶The final code
Not fully working, but close!
game.scm:
(define init-window (external "InitWindow" (=> (integer integer (^ char)) null))) (define set-target-fps (external "SetTargetFps" (=> (integer) null))) (define begin-drawing (external "BeginDrawing" (=> () null))) (define end-drawing (external "EndDrawing" (=> () null))) (define close-window (external "CloseWindow" (=> () null))) (define window-should-close? (external "WindowShouldClose" (=> () boolean))) (define-record-type color <color> (make-color r g b a) (r char color-r) (g char color-g) (b char color-b) (a char color-a)) (define (main) (init-window 1024 768 "Hello from PreScheme!") (let loop () (if (eq? (window-should-close?) #f) (begin (begin-drawing) (end-drawing) (loop)) 0)))
packages.scm:
(define-structure pstest (export main)
(open prescheme
ps-record-types)
(files game))
compile.scm:
(prescheme-compiler 'pstest '("packages.scm") 'pstest-init "main.c" '(header "#include <raylib.h>"))