File renaming

This commit is contained in:
Daniel Ziltener 2024-10-08 17:17:35 +02:00
parent a939188406
commit 11f51a2dac
Signed by: zilti
GPG key ID: B38976E82C9DAE42
14 changed files with 67 additions and 7 deletions

8
.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
*~
*.sh
*.import.scm
*.o
*.so
*.c
.direnv/

2
build-sdl3 Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
"$CHICKEN_CSC" -C -Werror -C "$(pkg-config --cflags sdl3)" -L "$(pkg-config --libs sdl3)" -sJ "$@"

View file

@ -31,3 +31,29 @@
(define (foldl-uint-flags flags)
(foldl bitwise-ior (car flags) (cdr flags)))
(define-syntax call-c*
(er-macro-transformer
(lambda (exp rename compare)
(let ((return-type (list-ref exp 1))
(proc (list-ref exp 2))
(args (list-ref exp 3))
(callbody (list-ref exp 4))
(callbody-args (list-ref exp 5)))
`((foreign-lambda* ,return-type
,args
,(apply format #f callbody
(symbol->string proc)
(map (compose symbol->string cadr) args)
callbody-args))
,@(map cadr args))))))
(define-syntax call-c
(syntax-rules (void)
((_ void proc (args ...))
(call-c* void proc (args ...)
"~A(~{~^, ~};" ()))
((_ return-type proc (args ...))
(call-c* return-type proc (args ...)
"C_return(~A(~{~^, ~}));"))))

View file

@ -1,6 +1,5 @@
(import (scheme)
(chicken base)
(chicken bitwise)
(chicken foreign)
(sdl internal utilities))
(import-for-syntax (sdl3 internal utilities))

View file

@ -124,7 +124,7 @@
;; TODO: SDL_CreateWindowWithProperties
(define destroy-window
(foreign-lambda void "SDL_DestroyWindow" (c-pointer SDL_Window)))
(call-c void SDL_DestroyWindow ((c-pointer SDL_Window))))
(define destroy-window-surface
(foreign-lambda bool "SDL_DestroyWindowSurface" (c-pointer SDL_Window)))

View file

@ -27,8 +27,8 @@ stdenv.mkDerivation (finalAttrs: {
srcs = [
(fetchgit {
url = "git://code.call-cc.org/chicken-core";
rev = "2c80bbab33302444bebc7eaac7f42ee9cda50301";
sha256 = "sha256-KWL9/s03ZGwjsjvxZxluXtaKvBuimHGH5UXaQVf68Mg=";
rev = "25825fd5584cde8693544919d2ff824a53d1e56c";
sha256 = "sha256-LX7dRZ2i8rI91RsHDsnQl3TNt/YQZzm+zAAtqScjx2U=";
})
(fetchurl {
url = "https://code.call-cc.org/dev-snapshots/2024/07/01/chicken-6.0.0-bootstrap.tar.gz";

20
sdl3.egg Normal file
View file

@ -0,0 +1,20 @@
;; -*- mode: scheme -*-
((author "Daniel Ziltener")
(synopsis "SDL3 bindings for Chicken Scheme")
(category ui)
(license "MIT")
(version "0.1")
(dependencies)
(test-dependencies)
(components
(extension sdl3.internal.utilities)
(extension sdl3.features)
(extension sdl3.init (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities))
(extension sdl3.main (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities))
(extension sdl3.video (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities))
(extension sdl3.render (custom-build "build-sdl3")
(component-dependencies sdl3.internal.utilities))))

View file

@ -1,6 +1,7 @@
(module (sdl3 internal utilities)
(define-sdl-flag
define-sdl-enum-values)
define-sdl-enum-values
call-c)
(import (scheme)
(chicken base))
(begin

View file

@ -2,7 +2,10 @@ with import <nixpkgs> {
overlays = [
(final: prev: {
tcc-mob = final.callPackage ./nix/tinycc.nix { stdenv = final.gcc13Stdenv; };
chicken = final.callPackage ./nix/chicken.nix { stdenv = final.gcc13Stdenv; };
chicken = final.callPackage ./nix/chicken.nix {
stdenv = final.gcc13Stdenv;
version = "25825f";
};
sdl3 = final.callPackage ./nix/sdl3.nix {
stdenv = final.gcc13Stdenv;
version = "2.99.0";
@ -12,6 +15,7 @@ with import <nixpkgs> {
};
mkShell {
packages = with pkgs; [
pkg-config
tcc-mob
sdl3
chicken
@ -30,7 +34,7 @@ mkShell {
export CC="${pkgs.tcc-mob}/bin/tcc"
export CHICKEN_PREFIX="$(pwd)/.chicken"
export CHICKEN_INSTALL_REPOSITORY="$(pwd)/.chicken/eggs"
export CHICKEN_REPOSITORY_PATH="${pkgs.chicken}/lib/chicken/11:$(pwd)/.chicken/eggs"
export CHICKEN_REPOSITORY_PATH="${pkgs.chicken}/lib/chicken/12:$(pwd)/.chicken/eggs"
export PATH="$PATH:$CHICKEN_PREFIX"
# chicken-install lsp-server salmonella
export CHICKEN_PREFIX="${pkgs.chicken}"