Check-in [0e3c53a30e]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:SDL_Image added
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:0e3c53a30ecceab2a18d0cb94adb82a12f92cca5
User & Date: ovenpasta@users.noreply.github.com 2018-01-08 17:10:49
Original User & Date: ovenpasta@users.noreply.github.com 2018-01-08 17:10:50
Context
2018-01-08
17:10
SDL_Image added check-in: 0e3c53a30e user: ovenpasta@users.noreply.github.com tags: trunk
17:10
Initial SDL_ttf support check-in: 31b4446932 user: ovenpasta@users.noreply.github.com tags: trunk
2017-12-06
16:56
use memv instead of memq for string-replace (comment fix) check-in: 4405ad641b user: aldo tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to sdl2.sls.

709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
...
811
812
813
814
815
816
817

818
819
820
821
822
	 (only (srfi s1 lists) fold)
	 (only (thunder-utils) string-replace string-split) 
	 (only (srfi s13 strings) string-delete string-suffix? string-prefix?)
	 (srfi s14 char-sets))
 
 (include "sdl2/ffi.ss")
 (include "sdl2/base-types.ss")
 
 (include "sdl2/guardian.ss")

 (include "sdl2/error-types.ss")
 (include "sdl2/error-functions.ss")

 (include "sdl2/assert-types.ss")
 (include "sdl2/assert-functions.ss")
................................................................................
 (include "sdl2/events-functions.ss")
 (include "sdl2/atomic-types.ss")
 (include "sdl2/atomic-functions.ss")

 (include "sdl2/main-functions.ss") 

 (include "sdl2/sdl-functions.ss")


 (include "sdl2/init.ss")

 (include "sdl2/extras.ss")
)







<







 







>



|
<
709
710
711
712
713
714
715

716
717
718
719
720
721
722
...
810
811
812
813
814
815
816
817
818
819
820
821

	 (only (srfi s1 lists) fold)
	 (only (thunder-utils) string-replace string-split) 
	 (only (srfi s13 strings) string-delete string-suffix? string-prefix?)
	 (srfi s14 char-sets))
 
 (include "sdl2/ffi.ss")
 (include "sdl2/base-types.ss")

 (include "sdl2/guardian.ss")

 (include "sdl2/error-types.ss")
 (include "sdl2/error-functions.ss")

 (include "sdl2/assert-types.ss")
 (include "sdl2/assert-functions.ss")
................................................................................
 (include "sdl2/events-functions.ss")
 (include "sdl2/atomic-types.ss")
 (include "sdl2/atomic-functions.ss")

 (include "sdl2/main-functions.ss") 

 (include "sdl2/sdl-functions.ss")
 

 (include "sdl2/init.ss")

 (include "sdl2/extras.ss"))

Changes to sdl2/atomic-functions.ss.

1
2
3


4
5
6
7
8
9
10
(define-sdl-func sdl-bool-t sdl-atomic-try-lock ((lock (* sdl-spin-lock-t))) "SDL_AtomicTryLock")
(define-sdl-func void sdl-atomic-lock ((lock (* sdl-spin-lock-t))) "SDL_AtomicLock")
(define-sdl-func void sdl-atomic-unlock ((lock (* sdl-spin-lock-t))) "SDL_AtomicUnlock")


(define-sdl-func sdl-bool-t sdl-atomic-cas ((a (* sdl-atomic-t)) (oldval int) (newval int)) "SDL_AtomicCAS")
(define-sdl-func int sdl-atomic-set ((a (* sdl-atomic-t)) (v int)) "SDL_AtomicSet")
(define-sdl-func int sdl-atomic-get ((a (* sdl-atomic-t))) "SDL_AtomicGet")
(define-sdl-func int sdl-atomic-add ((a (* sdl-atomic-t)) (v int)) "SDL_AtomicAdd")
(define-sdl-func sdl-bool-t sdl-atomic-cas-ptr ((a (* void*)) (oldval void*) (newval void*)) "SDL_AtomicCASPtr")
(define-sdl-func void* sdl-atomic-set-ptr ((a (* void*)) (v void*)) "SDL_AtomicSetPtr")
(define-sdl-func void* sdl-atomic-get-ptr ((a (* void*))) "SDL_AtomicGetPtr")



>
>







1
2
3
4
5
6
7
8
9
10
11
12
(define-sdl-func sdl-bool-t sdl-atomic-try-lock ((lock (* sdl-spin-lock-t))) "SDL_AtomicTryLock")
(define-sdl-func void sdl-atomic-lock ((lock (* sdl-spin-lock-t))) "SDL_AtomicLock")
(define-sdl-func void sdl-atomic-unlock ((lock (* sdl-spin-lock-t))) "SDL_AtomicUnlock")
(define-sdl-func void sdl-memory-barrier-release-function () "SDL_MemoryBarrierReleaseFunction")
(define-sdl-func void sdl-memory-barrier-acquire-function () "SDL_MemoryBarrierAcquireFunction")
(define-sdl-func sdl-bool-t sdl-atomic-cas ((a (* sdl-atomic-t)) (oldval int) (newval int)) "SDL_AtomicCAS")
(define-sdl-func int sdl-atomic-set ((a (* sdl-atomic-t)) (v int)) "SDL_AtomicSet")
(define-sdl-func int sdl-atomic-get ((a (* sdl-atomic-t))) "SDL_AtomicGet")
(define-sdl-func int sdl-atomic-add ((a (* sdl-atomic-t)) (v int)) "SDL_AtomicAdd")
(define-sdl-func sdl-bool-t sdl-atomic-cas-ptr ((a (* void*)) (oldval void*) (newval void*)) "SDL_AtomicCASPtr")
(define-sdl-func void* sdl-atomic-set-ptr ((a (* void*)) (v void*)) "SDL_AtomicSetPtr")
(define-sdl-func void* sdl-atomic-get-ptr ((a (* void*))) "SDL_AtomicGetPtr")

Changes to sdl2/audio-functions.ss.

11
12
13
14
15
16
17







18
19
20
21
22
23
24
25
26
27
28
29
(define-sdl-func sdl-audio-status-t sdl-get-audio-device-status ((dev sdl-audio-device-id-t)) "SDL_GetAudioDeviceStatus")
(define-sdl-func void sdl-pause-audio ((pause_on int)) "SDL_PauseAudio")
(define-sdl-func void sdl-pause-audio-device ((dev sdl-audio-device-id-t) (pause_on int)) "SDL_PauseAudioDevice")
(define-sdl-func (* sdl-audio-spec-t) sdl-load-wav-rw ((src (* sdl-rw-ops-t)) (freesrc int) (spec (* sdl-audio-spec-t)) (audio_buf (* uint8)) (audio_len (* uint32))) "SDL_LoadWAV_RW")
(define-sdl-func void sdl-free-wav ((audio_buf (* uint8))) "SDL_FreeWAV")
(define-sdl-func int sdl-build-audio-cvt ((cvt (* sdl-audio-cvt-t)) (src_format sdl-audio-format-t) (src_channels uint8) (src_rate int) (dst_format sdl-audio-format-t) (dst_channels uint8) (dst_rate int)) "SDL_BuildAudioCVT")
(define-sdl-func int sdl-convert-audio ((cvt (* sdl-audio-cvt-t))) "SDL_ConvertAudio")







(define-sdl-func void sdl-mix-audio ((dst (* uint8)) (src (* uint8)) (len uint32) (volume int)) "SDL_MixAudio")
(define-sdl-func void sdl-mix-audio-format ((dst (* uint8)) (src (* uint8)) (format sdl-audio-format-t) (len uint32) (volume int)) "SDL_MixAudioFormat")
(define-sdl-func int sdl-queue-audio ((dev sdl-audio-device-id-t) (data void*) (len uint32)) "SDL_QueueAudio")
(define-sdl-func uint32 sdl-dequeue-audio ((dev sdl-audio-device-id-t) (data void*) (len uint32)) "SDL_DequeueAudio")
(define-sdl-func uint32 sdl-get-queued-audio-size ((dev sdl-audio-device-id-t)) "SDL_GetQueuedAudioSize")
(define-sdl-func void sdl-clear-queued-audio ((dev sdl-audio-device-id-t)) "SDL_ClearQueuedAudio")
(define-sdl-func void sdl-lock-audio () "SDL_LockAudio")
(define-sdl-func void sdl-lock-audio-device ((dev sdl-audio-device-id-t)) "SDL_LockAudioDevice")
(define-sdl-func void sdl-unlock-audio () "SDL_UnlockAudio")
(define-sdl-func void sdl-unlock-audio-device ((dev sdl-audio-device-id-t)) "SDL_UnlockAudioDevice")
(define-sdl-func void sdl-close-audio () "SDL_CloseAudio")
(define-sdl-func void sdl-close-audio-device ((dev sdl-audio-device-id-t)) "SDL_CloseAudioDevice")







>
>
>
>
>
>
>












11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(define-sdl-func sdl-audio-status-t sdl-get-audio-device-status ((dev sdl-audio-device-id-t)) "SDL_GetAudioDeviceStatus")
(define-sdl-func void sdl-pause-audio ((pause_on int)) "SDL_PauseAudio")
(define-sdl-func void sdl-pause-audio-device ((dev sdl-audio-device-id-t) (pause_on int)) "SDL_PauseAudioDevice")
(define-sdl-func (* sdl-audio-spec-t) sdl-load-wav-rw ((src (* sdl-rw-ops-t)) (freesrc int) (spec (* sdl-audio-spec-t)) (audio_buf (* uint8)) (audio_len (* uint32))) "SDL_LoadWAV_RW")
(define-sdl-func void sdl-free-wav ((audio_buf (* uint8))) "SDL_FreeWAV")
(define-sdl-func int sdl-build-audio-cvt ((cvt (* sdl-audio-cvt-t)) (src_format sdl-audio-format-t) (src_channels uint8) (src_rate int) (dst_format sdl-audio-format-t) (dst_channels uint8) (dst_rate int)) "SDL_BuildAudioCVT")
(define-sdl-func int sdl-convert-audio ((cvt (* sdl-audio-cvt-t))) "SDL_ConvertAudio")
(define-sdl-func (* sdl-audio-stream-t) sdl-new-audio-stream ((src_format sdl-audio-format-t) (src_channels uint8) (src_rate int) (dst_format sdl-audio-format-t) (dst_channels uint8) (dst_rate int)) "SDL_NewAudioStream")
(define-sdl-func int sdl-audio-stream-put ((stream (* sdl-audio-stream-t)) (buf void*) (len int)) "SDL_AudioStreamPut")
(define-sdl-func int sdl-audio-stream-get ((stream (* sdl-audio-stream-t)) (buf void*) (len int)) "SDL_AudioStreamGet")
(define-sdl-func int sdl-audio-stream-available ((stream (* sdl-audio-stream-t))) "SDL_AudioStreamAvailable")
(define-sdl-func int sdl-audio-stream-flush ((stream (* sdl-audio-stream-t))) "SDL_AudioStreamFlush")
(define-sdl-func void sdl-audio-stream-clear ((stream (* sdl-audio-stream-t))) "SDL_AudioStreamClear")
(define-sdl-func void sdl-free-audio-stream ((stream (* sdl-audio-stream-t))) "SDL_FreeAudioStream")
(define-sdl-func void sdl-mix-audio ((dst (* uint8)) (src (* uint8)) (len uint32) (volume int)) "SDL_MixAudio")
(define-sdl-func void sdl-mix-audio-format ((dst (* uint8)) (src (* uint8)) (format sdl-audio-format-t) (len uint32) (volume int)) "SDL_MixAudioFormat")
(define-sdl-func int sdl-queue-audio ((dev sdl-audio-device-id-t) (data void*) (len uint32)) "SDL_QueueAudio")
(define-sdl-func uint32 sdl-dequeue-audio ((dev sdl-audio-device-id-t) (data void*) (len uint32)) "SDL_DequeueAudio")
(define-sdl-func uint32 sdl-get-queued-audio-size ((dev sdl-audio-device-id-t)) "SDL_GetQueuedAudioSize")
(define-sdl-func void sdl-clear-queued-audio ((dev sdl-audio-device-id-t)) "SDL_ClearQueuedAudio")
(define-sdl-func void sdl-lock-audio () "SDL_LockAudio")
(define-sdl-func void sdl-lock-audio-device ((dev sdl-audio-device-id-t)) "SDL_LockAudioDevice")
(define-sdl-func void sdl-unlock-audio () "SDL_UnlockAudio")
(define-sdl-func void sdl-unlock-audio-device ((dev sdl-audio-device-id-t)) "SDL_UnlockAudioDevice")
(define-sdl-func void sdl-close-audio () "SDL_CloseAudio")
(define-sdl-func void sdl-close-audio-device ((dev sdl-audio-device-id-t)) "SDL_CloseAudioDevice")

Changes to sdl2/audio-types.ss.

26
27
28
29
30
31
32
33
    (silence uint8)
    (samples uint16)
    (padding uint16)
    (size uint32)
    (callback sdl-audio-callback-t)
    (userdata void*)))
 (define-ftype sdl-audio-cvt-t (struct))








|
26
27
28
29
30
31
32
33
    (silence uint8)
    (samples uint16)
    (padding uint16)
    (size uint32)
    (callback sdl-audio-callback-t)
    (userdata void*)))
 (define-ftype sdl-audio-cvt-t (struct))
(define-ftype sdl-audio-stream-t (struct))

Changes to sdl2/base-types.ss.

4
5
6
7
8
9
10

11
12
13
14
15
16
17
 (define-ftype uint8 unsigned-8)
 (define-ftype uint16 unsigned-16)
 (define-ftype sint16 integer-16)
 (define-ftype uint32 unsigned-32)
 (define-ftype sint32 integer-32)
 (define-ftype sint64 integer-64)
 (define-ftype uint64 integer-64)

 (define-ftype va-list void*)
 (define-ftype int% int)
 (define-ftype file (struct))

 (define-ftype sdl-iconv-t void*)

 ;; Conditions







>







4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 (define-ftype uint8 unsigned-8)
 (define-ftype uint16 unsigned-16)
 (define-ftype sint16 integer-16)
 (define-ftype uint32 unsigned-32)
 (define-ftype sint32 integer-32)
 (define-ftype sint64 integer-64)
 (define-ftype uint64 integer-64)
 (define-ftype size-t uint32)
 (define-ftype va-list void*)
 (define-ftype int% int)
 (define-ftype file (struct))

 (define-ftype sdl-iconv-t void*)

 ;; Conditions

Changes to sdl2/cpuinfo-functions.ss.

7
8
9
10
11
12
13

14
(define-sdl-func sdl-bool-t sdl-has-sse () "SDL_HasSSE")
(define-sdl-func sdl-bool-t sdl-has-ss-e2 () "SDL_HasSSE2")
(define-sdl-func sdl-bool-t sdl-has-ss-e3 () "SDL_HasSSE3")
(define-sdl-func sdl-bool-t sdl-has-ss-e41 () "SDL_HasSSE41")
(define-sdl-func sdl-bool-t sdl-has-ss-e42 () "SDL_HasSSE42")
(define-sdl-func sdl-bool-t sdl-has-avx () "SDL_HasAVX")
(define-sdl-func sdl-bool-t sdl-has-av-x2 () "SDL_HasAVX2")

(define-sdl-func int sdl-get-system-ram () "SDL_GetSystemRAM")







>

7
8
9
10
11
12
13
14
15
(define-sdl-func sdl-bool-t sdl-has-sse () "SDL_HasSSE")
(define-sdl-func sdl-bool-t sdl-has-ss-e2 () "SDL_HasSSE2")
(define-sdl-func sdl-bool-t sdl-has-ss-e3 () "SDL_HasSSE3")
(define-sdl-func sdl-bool-t sdl-has-ss-e41 () "SDL_HasSSE41")
(define-sdl-func sdl-bool-t sdl-has-ss-e42 () "SDL_HasSSE42")
(define-sdl-func sdl-bool-t sdl-has-avx () "SDL_HasAVX")
(define-sdl-func sdl-bool-t sdl-has-av-x2 () "SDL_HasAVX2")
(define-sdl-func sdl-bool-t sdl-has-neon () "SDL_HasNEON")
(define-sdl-func int sdl-get-system-ram () "SDL_GetSystemRAM")

Changes to sdl2/gamecontroller-functions.ss.

1
2


3
4
5
6
7
8
9
10



11
12
13
14
15
16
17
18
19
20
21
22
23
(define-sdl-func int sdl-game-controller-add-mappings-from-rw ((rw (* sdl-rw-ops-t)) (freerw int)) "SDL_GameControllerAddMappingsFromRW")
(define-sdl-func int sdl-game-controller-add-mapping ((mappingString string)) "SDL_GameControllerAddMapping")


;;blacklisted probably because it uses a struct as value.
(define sdl-game-controller-mapping-for-guid #f)
(define-sdl-func string sdl-game-controller-mapping ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerMapping")
(define-sdl-func sdl-bool-t sdl-is-game-controller ((joystick_index int)) "SDL_IsGameController")
(define-sdl-func string sdl-game-controller-name-for-index ((joystick_index int)) "SDL_GameControllerNameForIndex")
(define-sdl-func (* sdl-game-controller-t) sdl-game-controller-open ((joystick_index int)) "SDL_GameControllerOpen")
(define-sdl-func (* sdl-game-controller-t) sdl-game-controller-from-instance-id ((joyid sdl-joystick-id-t)) "SDL_GameControllerFromInstanceID")
(define-sdl-func string sdl-game-controller-name ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerName")



(define-sdl-func sdl-bool-t sdl-game-controller-get-attached ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerGetAttached")
(define-sdl-func (* sdl-joystick-t) sdl-game-controller-get-joystick ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerGetJoystick")
(define-sdl-func int sdl-game-controller-event-state ((state int)) "SDL_GameControllerEventState")
(define-sdl-func void sdl-game-controller-update () "SDL_GameControllerUpdate")
(define-sdl-func sdl-game-controller-axis-t sdl-game-controller-get-axis-from-string ((pchString string)) "SDL_GameControllerGetAxisFromString")
(define-sdl-func string sdl-game-controller-get-string-for-axis ((axis sdl-game-controller-axis-t)) "SDL_GameControllerGetStringForAxis")
(define-sdl-func sdl-game-controller-button-bind-t sdl-game-controller-get-bind-for-axis ((gamecontroller (* sdl-game-controller-t)) (axis sdl-game-controller-axis-t)) "SDL_GameControllerGetBindForAxis")
(define-sdl-func sint16 sdl-game-controller-get-axis ((gamecontroller (* sdl-game-controller-t)) (axis sdl-game-controller-axis-t)) "SDL_GameControllerGetAxis")
(define-sdl-func sdl-game-controller-button-t sdl-game-controller-get-button-from-string ((pchString string)) "SDL_GameControllerGetButtonFromString")
(define-sdl-func string sdl-game-controller-get-string-for-button ((button sdl-game-controller-button-t)) "SDL_GameControllerGetStringForButton")
(define-sdl-func sdl-game-controller-button-bind-t sdl-game-controller-get-bind-for-button ((gamecontroller (* sdl-game-controller-t)) (button sdl-game-controller-button-t)) "SDL_GameControllerGetBindForButton")
(define-sdl-func uint8 sdl-game-controller-get-button ((gamecontroller (* sdl-game-controller-t)) (button sdl-game-controller-button-t)) "SDL_GameControllerGetButton")
(define-sdl-func void sdl-game-controller-close ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerClose")


>
>








>
>
>













1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(define-sdl-func int sdl-game-controller-add-mappings-from-rw ((rw (* sdl-rw-ops-t)) (freerw int)) "SDL_GameControllerAddMappingsFromRW")
(define-sdl-func int sdl-game-controller-add-mapping ((mappingString string)) "SDL_GameControllerAddMapping")
(define-sdl-func int sdl-game-controller-num-mappings () "SDL_GameControllerNumMappings")
(define-sdl-func string sdl-game-controller-mapping-for-index ((mapping_index int)) "SDL_GameControllerMappingForIndex")
;;blacklisted probably because it uses a struct as value.
(define sdl-game-controller-mapping-for-guid #f)
(define-sdl-func string sdl-game-controller-mapping ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerMapping")
(define-sdl-func sdl-bool-t sdl-is-game-controller ((joystick_index int)) "SDL_IsGameController")
(define-sdl-func string sdl-game-controller-name-for-index ((joystick_index int)) "SDL_GameControllerNameForIndex")
(define-sdl-func (* sdl-game-controller-t) sdl-game-controller-open ((joystick_index int)) "SDL_GameControllerOpen")
(define-sdl-func (* sdl-game-controller-t) sdl-game-controller-from-instance-id ((joyid sdl-joystick-id-t)) "SDL_GameControllerFromInstanceID")
(define-sdl-func string sdl-game-controller-name ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerName")
(define-sdl-func uint16 sdl-game-controller-get-vendor ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerGetVendor")
(define-sdl-func uint16 sdl-game-controller-get-product ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerGetProduct")
(define-sdl-func uint16 sdl-game-controller-get-product-version ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerGetProductVersion")
(define-sdl-func sdl-bool-t sdl-game-controller-get-attached ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerGetAttached")
(define-sdl-func (* sdl-joystick-t) sdl-game-controller-get-joystick ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerGetJoystick")
(define-sdl-func int sdl-game-controller-event-state ((state int)) "SDL_GameControllerEventState")
(define-sdl-func void sdl-game-controller-update () "SDL_GameControllerUpdate")
(define-sdl-func sdl-game-controller-axis-t sdl-game-controller-get-axis-from-string ((pchString string)) "SDL_GameControllerGetAxisFromString")
(define-sdl-func string sdl-game-controller-get-string-for-axis ((axis sdl-game-controller-axis-t)) "SDL_GameControllerGetStringForAxis")
(define-sdl-func sdl-game-controller-button-bind-t sdl-game-controller-get-bind-for-axis ((gamecontroller (* sdl-game-controller-t)) (axis sdl-game-controller-axis-t)) "SDL_GameControllerGetBindForAxis")
(define-sdl-func sint16 sdl-game-controller-get-axis ((gamecontroller (* sdl-game-controller-t)) (axis sdl-game-controller-axis-t)) "SDL_GameControllerGetAxis")
(define-sdl-func sdl-game-controller-button-t sdl-game-controller-get-button-from-string ((pchString string)) "SDL_GameControllerGetButtonFromString")
(define-sdl-func string sdl-game-controller-get-string-for-button ((button sdl-game-controller-button-t)) "SDL_GameControllerGetStringForButton")
(define-sdl-func sdl-game-controller-button-bind-t sdl-game-controller-get-bind-for-button ((gamecontroller (* sdl-game-controller-t)) (button sdl-game-controller-button-t)) "SDL_GameControllerGetBindForButton")
(define-sdl-func uint8 sdl-game-controller-get-button ((gamecontroller (* sdl-game-controller-t)) (button sdl-game-controller-button-t)) "SDL_GameControllerGetButton")
(define-sdl-func void sdl-game-controller-close ((gamecontroller (* sdl-game-controller-t))) "SDL_GameControllerClose")

Added sdl2/image-functions.ss.



















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(define-sdl-func (* sdl-version-t) img-linked-version () "IMG_Linked_Version")
(define-sdl-func int img-init ((flags int)) "IMG_Init")
(define-sdl-func void img-quit () "IMG_Quit")
(define-sdl-func (* sdl-surface-t) img-load-typed-rw ((src (* sdl-rw-ops-t)) (freesrc int) (type string)) "IMG_LoadTyped_RW")
(define-sdl-func (* sdl-surface-t) img-load ((file string)) "IMG_Load")
(define-sdl-func (* sdl-surface-t) img-load-rw ((src (* sdl-rw-ops-t)) (freesrc int)) "IMG_Load_RW")
(define-sdl-func (* sdl-texture-t) img-load-texture ((renderer (* sdl-renderer-t)) (file string)) "IMG_LoadTexture")
(define-sdl-func (* sdl-texture-t) img-load-texture-rw ((renderer (* sdl-renderer-t)) (src (* sdl-rw-ops-t)) (freesrc int)) "IMG_LoadTexture_RW")
(define-sdl-func (* sdl-texture-t) img-load-texture-typed-rw ((renderer (* sdl-renderer-t)) (src (* sdl-rw-ops-t)) (freesrc int) (type string)) "IMG_LoadTextureTyped_RW")
(define-sdl-func int img-is-ico ((src (* sdl-rw-ops-t))) "IMG_isICO")
(define-sdl-func int img-is-cur ((src (* sdl-rw-ops-t))) "IMG_isCUR")
(define-sdl-func int img-is-bmp ((src (* sdl-rw-ops-t))) "IMG_isBMP")
(define-sdl-func int img-is-gif ((src (* sdl-rw-ops-t))) "IMG_isGIF")
(define-sdl-func int img-is-jpg ((src (* sdl-rw-ops-t))) "IMG_isJPG")
(define-sdl-func int img-is-lbm ((src (* sdl-rw-ops-t))) "IMG_isLBM")
(define-sdl-func int img-is-pcx ((src (* sdl-rw-ops-t))) "IMG_isPCX")
(define-sdl-func int img-is-png ((src (* sdl-rw-ops-t))) "IMG_isPNG")
(define-sdl-func int img-is-pnm ((src (* sdl-rw-ops-t))) "IMG_isPNM")
(define-sdl-func int img-is-tif ((src (* sdl-rw-ops-t))) "IMG_isTIF")
(define-sdl-func int img-is-xcf ((src (* sdl-rw-ops-t))) "IMG_isXCF")
(define-sdl-func int img-is-xpm ((src (* sdl-rw-ops-t))) "IMG_isXPM")
(define-sdl-func int img-is-xv ((src (* sdl-rw-ops-t))) "IMG_isXV")
(define-sdl-func int img-is-webp ((src (* sdl-rw-ops-t))) "IMG_isWEBP")
(define-sdl-func (* sdl-surface-t) img-load-ico-rw ((src (* sdl-rw-ops-t))) "IMG_LoadICO_RW")
(define-sdl-func (* sdl-surface-t) img-load-cur-rw ((src (* sdl-rw-ops-t))) "IMG_LoadCUR_RW")
(define-sdl-func (* sdl-surface-t) img-load-bmp-rw ((src (* sdl-rw-ops-t))) "IMG_LoadBMP_RW")
(define-sdl-func (* sdl-surface-t) img-load-gif-rw ((src (* sdl-rw-ops-t))) "IMG_LoadGIF_RW")
(define-sdl-func (* sdl-surface-t) img-load-jpg-rw ((src (* sdl-rw-ops-t))) "IMG_LoadJPG_RW")
(define-sdl-func (* sdl-surface-t) img-load-lbm-rw ((src (* sdl-rw-ops-t))) "IMG_LoadLBM_RW")
(define-sdl-func (* sdl-surface-t) img-load-pcx-rw ((src (* sdl-rw-ops-t))) "IMG_LoadPCX_RW")
(define-sdl-func (* sdl-surface-t) img-load-png-rw ((src (* sdl-rw-ops-t))) "IMG_LoadPNG_RW")
(define-sdl-func (* sdl-surface-t) img-load-pnm-rw ((src (* sdl-rw-ops-t))) "IMG_LoadPNM_RW")
(define-sdl-func (* sdl-surface-t) img-load-tga-rw ((src (* sdl-rw-ops-t))) "IMG_LoadTGA_RW")
(define-sdl-func (* sdl-surface-t) img-load-tif-rw ((src (* sdl-rw-ops-t))) "IMG_LoadTIF_RW")
(define-sdl-func (* sdl-surface-t) img-load-xcf-rw ((src (* sdl-rw-ops-t))) "IMG_LoadXCF_RW")
(define-sdl-func (* sdl-surface-t) img-load-xpm-rw ((src (* sdl-rw-ops-t))) "IMG_LoadXPM_RW")
(define-sdl-func (* sdl-surface-t) img-load-xv-rw ((src (* sdl-rw-ops-t))) "IMG_LoadXV_RW")
(define-sdl-func (* sdl-surface-t) img-load-webp-rw ((src (* sdl-rw-ops-t))) "IMG_LoadWEBP_RW")
(define-sdl-func (* sdl-surface-t) img-read-xpm-from-array ((xpm void*)) "IMG_ReadXPMFromArray")
(define-sdl-func int img-save-png ((surface (* sdl-surface-t)) (file string)) "IMG_SavePNG")
(define-sdl-func int img-save-png-rw ((surface (* sdl-surface-t)) (dst (* sdl-rw-ops-t)) (freedst int)) "IMG_SavePNG_RW")

Added sdl2/image-types.ss.

Added sdl2/image.sls.



















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!r6rs

(library
    (sdl2 image)
  (export

   ;init funcs
   img-init
   img-linked-version
   img-quit

   ;loading
   img-load-typed-rw
   img-load
   img-load-rw
   img-load-texture
   img-load-texture-rw
   img-load-texture-typed-rw

   ;predicates
   img-is-ico
   img-is-cur
   img-is-bmp
   img-is-gif
   img-is-jpg
   img-is-lbm
   img-is-pcx
   img-is-png
   img-is-tif
   img-is-xcf
   img-is-xpm
   img-is-xv
   img-is-webp

   ;specific loading
   img-load-ico-rw
   img-load-cur-rw
   img-load-bmp-rw
   img-load-gif-rw
   img-load-jpg-rw
   img-load-lbm-rw
   img-load-pcx-rw
   img-load-png-rw
   img-load-pnm-rw
   img-load-tga-rw
   img-load-tif-rw
   img-load-xcf-rw
   img-load-xpm-rw
   img-load-xv-rw
   img-load-webp-rw

   ;save and read
   img-read-xpm-from-array
   img-save-png
   img-save-png-rw
   
   ;import libSDL2_image.so
   sdl-image-library-init)

  (import (chezscheme) 
	  (ffi-utils)
	  (sdl2)
	  (only (srfi s1 lists) fold)
	  (only (thunder-utils) string-replace string-split) 
	  (only (srfi s13 strings) string-delete string-suffix? string-prefix?)
	  (srfi s14 char-sets))
  (include "image-functions.ss")
  (include "image-types.ss")
  (define (sdl-image-library-init . l)
    (load-shared-object (if (null? l) "libSDL2_image.so" l))))



Changes to sdl2/joystick-functions.ss.



1
2







3
4
5
6
7
8
9




10
11
12
13
14
15
16
..
17
18
19
20
21
22
23

24
25
26
27
28


(define-sdl-func int sdl-num-joysticks () "SDL_NumJoysticks")
(define-sdl-func string sdl-joystick-name-for-index ((device_index int)) "SDL_JoystickNameForIndex")







(define-sdl-func (* sdl-joystick-t) sdl-joystick-open ((device_index int)) "SDL_JoystickOpen")
(define-sdl-func (* sdl-joystick-t) sdl-joystick-from-instance-id ((joyid sdl-joystick-id-t)) "SDL_JoystickFromInstanceID")
(define-sdl-func string sdl-joystick-name ((joystick (* sdl-joystick-t))) "SDL_JoystickName")
;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-get-device-guid #f)
;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-get-guid #f)




;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-get-guid-string #f)
;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-get-guid-from-string #f)
(define-sdl-func sdl-bool-t sdl-joystick-get-attached ((joystick (* sdl-joystick-t))) "SDL_JoystickGetAttached")
;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-instance-id #f)
................................................................................
(define-sdl-func int sdl-joystick-num-axes ((joystick (* sdl-joystick-t))) "SDL_JoystickNumAxes")
(define-sdl-func int sdl-joystick-num-balls ((joystick (* sdl-joystick-t))) "SDL_JoystickNumBalls")
(define-sdl-func int sdl-joystick-num-hats ((joystick (* sdl-joystick-t))) "SDL_JoystickNumHats")
(define-sdl-func int sdl-joystick-num-buttons ((joystick (* sdl-joystick-t))) "SDL_JoystickNumButtons")
(define-sdl-func void sdl-joystick-update () "SDL_JoystickUpdate")
(define-sdl-func int sdl-joystick-event-state ((state int)) "SDL_JoystickEventState")
(define-sdl-func sint16 sdl-joystick-get-axis ((joystick (* sdl-joystick-t)) (axis int)) "SDL_JoystickGetAxis")

(define-sdl-func uint8 sdl-joystick-get-hat ((joystick (* sdl-joystick-t)) (hat int)) "SDL_JoystickGetHat")
(define-sdl-func int sdl-joystick-get-ball ((joystick (* sdl-joystick-t)) (ball int) (dx (* int)) (dy (* int))) "SDL_JoystickGetBall")
(define-sdl-func uint8 sdl-joystick-get-button ((joystick (* sdl-joystick-t)) (button int)) "SDL_JoystickGetButton")
(define-sdl-func void sdl-joystick-close ((joystick (* sdl-joystick-t))) "SDL_JoystickClose")
(define-sdl-func sdl-joystick-power-level-t sdl-joystick-current-power-level ((joystick (* sdl-joystick-t))) "SDL_JoystickCurrentPowerLevel")
>
>


>
>
>
>
>
>
>




<
<

>
>
>
>







 







>





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15


16
17
18
19
20
21
22
23
24
25
26
27
..
28
29
30
31
32
33
34
35
36
37
38
39
40
(define-sdl-func void sdl-lock-joysticks () "SDL_LockJoysticks")
(define-sdl-func void sdl-unlock-joysticks () "SDL_UnlockJoysticks")
(define-sdl-func int sdl-num-joysticks () "SDL_NumJoysticks")
(define-sdl-func string sdl-joystick-name-for-index ((device_index int)) "SDL_JoystickNameForIndex")
;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-get-device-guid #f)
(define-sdl-func uint16 sdl-joystick-get-device-vendor ((device_index int)) "SDL_JoystickGetDeviceVendor")
(define-sdl-func uint16 sdl-joystick-get-device-product ((device_index int)) "SDL_JoystickGetDeviceProduct")
(define-sdl-func uint16 sdl-joystick-get-device-product-version ((device_index int)) "SDL_JoystickGetDeviceProductVersion")
(define-sdl-func sdl-joystick-type-t sdl-joystick-get-device-type ((device_index int)) "SDL_JoystickGetDeviceType")
(define-sdl-func sdl-joystick-id-t sdl-joystick-get-device-instance-id ((device_index int)) "SDL_JoystickGetDeviceInstanceID")
(define-sdl-func (* sdl-joystick-t) sdl-joystick-open ((device_index int)) "SDL_JoystickOpen")
(define-sdl-func (* sdl-joystick-t) sdl-joystick-from-instance-id ((joyid sdl-joystick-id-t)) "SDL_JoystickFromInstanceID")
(define-sdl-func string sdl-joystick-name ((joystick (* sdl-joystick-t))) "SDL_JoystickName")
;;blacklisted probably because it uses a struct as value.


(define sdl-joystick-get-guid #f)
(define-sdl-func uint16 sdl-joystick-get-vendor ((joystick (* sdl-joystick-t))) "SDL_JoystickGetVendor")
(define-sdl-func uint16 sdl-joystick-get-product ((joystick (* sdl-joystick-t))) "SDL_JoystickGetProduct")
(define-sdl-func uint16 sdl-joystick-get-product-version ((joystick (* sdl-joystick-t))) "SDL_JoystickGetProductVersion")
(define-sdl-func sdl-joystick-type-t sdl-joystick-get-type ((joystick (* sdl-joystick-t))) "SDL_JoystickGetType")
;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-get-guid-string #f)
;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-get-guid-from-string #f)
(define-sdl-func sdl-bool-t sdl-joystick-get-attached ((joystick (* sdl-joystick-t))) "SDL_JoystickGetAttached")
;;blacklisted probably because it uses a struct as value.
(define sdl-joystick-instance-id #f)
................................................................................
(define-sdl-func int sdl-joystick-num-axes ((joystick (* sdl-joystick-t))) "SDL_JoystickNumAxes")
(define-sdl-func int sdl-joystick-num-balls ((joystick (* sdl-joystick-t))) "SDL_JoystickNumBalls")
(define-sdl-func int sdl-joystick-num-hats ((joystick (* sdl-joystick-t))) "SDL_JoystickNumHats")
(define-sdl-func int sdl-joystick-num-buttons ((joystick (* sdl-joystick-t))) "SDL_JoystickNumButtons")
(define-sdl-func void sdl-joystick-update () "SDL_JoystickUpdate")
(define-sdl-func int sdl-joystick-event-state ((state int)) "SDL_JoystickEventState")
(define-sdl-func sint16 sdl-joystick-get-axis ((joystick (* sdl-joystick-t)) (axis int)) "SDL_JoystickGetAxis")
(define-sdl-func sdl-bool-t sdl-joystick-get-axis-initial-state ((joystick (* sdl-joystick-t)) (axis int) (state (* sint16))) "SDL_JoystickGetAxisInitialState")
(define-sdl-func uint8 sdl-joystick-get-hat ((joystick (* sdl-joystick-t)) (hat int)) "SDL_JoystickGetHat")
(define-sdl-func int sdl-joystick-get-ball ((joystick (* sdl-joystick-t)) (ball int) (dx (* int)) (dy (* int))) "SDL_JoystickGetBall")
(define-sdl-func uint8 sdl-joystick-get-button ((joystick (* sdl-joystick-t)) (button int)) "SDL_JoystickGetButton")
(define-sdl-func void sdl-joystick-close ((joystick (* sdl-joystick-t))) "SDL_JoystickClose")
(define-sdl-func sdl-joystick-power-level-t sdl-joystick-current-power-level ((joystick (* sdl-joystick-t))) "SDL_JoystickCurrentPowerLevel")

Changes to sdl2/joystick-types.ss.

11
12
13
14
15
16
17
18
19
20
21
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

 (define-ftype sdl-joystick-t (struct))
 (define-ftype sdl-joystick-guid-t (struct (data (array 16 uint8))))

(define sdl-joystick-power-level-unknown -1)
(define-enumeration* sdl-joystick-power-level
  (empty  low medium full wired max))







|



11
12
13
14
15
16
17
18
19
20
21
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

 (define-ftype sdl-joystick-t (struct))
 (define-ftype sdl-joystick-guid-t (struct (data (array 16 uint8))))
 (define-ftype sdl-joystick-type-t uint32)
(define sdl-joystick-power-level-unknown -1)
(define-enumeration* sdl-joystick-power-level
  (empty  low medium full wired max))

Changes to sdl2/net.sls.

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

#!r6rs

(library
 (sdl2 net)
 (export
  sdl-net-linked-version
  sdl-net-init
  sdl-net-quit
  sdl-net-resolve-host
  sdl-net-resolve-ip
  sdl-net-get-local-addresses
  sdl-net-tcp-get-peer-address
  sdl-net-tcp-open
  sdl-net-tcp-accept 
  sdl-net-tcp-send
  sdl-net-tcp-recv
  sdl-net-tcp-close
  sdl-net-alloc-packet
  sdl-net-resize-packet
  sdl-net-alloc-packetv
  sdl-net-free-packet
  sdl-net-free-packetv
  sdl-net-udp-open
  sdl-net-udp-set-packet-loss
  sdl-net-udp-get-peer-address
  sdl-net-udp-bind
  sdl-net-udp-unbind
  sdl-net-udp-sendv
  sdl-net-udp-send
  sdl-net-udp-recvv
  sdl-net-udp-recv
  sdl-net-udp-close
  sdl-net-alloc-socket-set
  sdl-net-add-socket
  sdl-net-tcp-add-socket
  sdl-net-udp-add-socket
  sdl-net-del-socket
  sdl-net-tcp-del-socket
  sdl-net-udp-del-socket
  sdl-net-check-sockets
  sdl-net-free-socket-set
  sdl-net-set-error
  sdl-net-get-error

  sdl-net-library-init 

  ;;types
  ip-address 
  tcp-socket udp-socket udp-packet
  INADDR_ANY INADDR_NONE INADDR_LOOPBACK INADDR_BROADCAST

  sdl-net-socket-set-t
  sdl-net-generic-socket
  sdl-net-generic-socket-t
  sdl-net-version-t

  )

 (import (chezscheme) 
	 (ffi-utils)	 
	 (only (srfi s1 lists) fold)
	 (only (thunder-utils) string-replace string-split) 
	 (only (srfi s13 strings) string-delete string-suffix? string-prefix?)
	 (srfi s14 char-sets))

(include "ffi.ss")
(include "base-types.ss")

(include "net-types.ss")

(include "net-functions.ss")

(define (sdl-net-library-init . l)
   (load-shared-object (if (null? l) "libSDL2_net.so" l)))

)







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|

|
|
|
|

|
|
|
|

|

|
|
|
|
|
|

|
|

|

|

|
|
<
<
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89


;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

#!r6rs

(library
    (sdl2 net)
  (export
   sdl-net-linked-version
   sdl-net-init
   sdl-net-quit
   sdl-net-resolve-host
   sdl-net-resolve-ip
   sdl-net-get-local-addresses
   sdl-net-tcp-get-peer-address
   sdl-net-tcp-open
   sdl-net-tcp-accept 
   sdl-net-tcp-send
   sdl-net-tcp-recv
   sdl-net-tcp-close
   sdl-net-alloc-packet
   sdl-net-resize-packet
   sdl-net-alloc-packetv
   sdl-net-free-packet
   sdl-net-free-packetv
   sdl-net-udp-open
   sdl-net-udp-set-packet-loss
   sdl-net-udp-get-peer-address
   sdl-net-udp-bind
   sdl-net-udp-unbind
   sdl-net-udp-sendv
   sdl-net-udp-send
   sdl-net-udp-recvv
   sdl-net-udp-recv
   sdl-net-udp-close
   sdl-net-alloc-socket-set
   sdl-net-add-socket
   sdl-net-tcp-add-socket
   sdl-net-udp-add-socket
   sdl-net-del-socket
   sdl-net-tcp-del-socket
   sdl-net-udp-del-socket
   sdl-net-check-sockets
   sdl-net-free-socket-set
   sdl-net-set-error
   sdl-net-get-error

   sdl-net-library-init 

   ;;types
   ip-address 
   tcp-socket udp-socket udp-packet
   INADDR_ANY INADDR_NONE INADDR_LOOPBACK INADDR_BROADCAST

   sdl-net-socket-set-t
   sdl-net-generic-socket
   sdl-net-generic-socket-t
   sdl-net-version-t

   )

  (import (chezscheme) 
	  (ffi-utils)	 
	  (only (srfi s1 lists) fold)
	  (only (thunder-utils) string-replace string-split) 
	  (only (srfi s13 strings) string-delete string-suffix? string-prefix?)
	  (srfi s14 char-sets))

  (include "ffi.ss")
  (include "base-types.ss")

  (include "net-types.ss")

  (include "net-functions.ss")

  (define (sdl-net-library-init . l)
    (load-shared-object (if (null? l) "libSDL2_net.so" l))))


Changes to sdl2/parse-sdl-json.ss.

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
...
162
163
164
165
166
167
168














;;     http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

(import (scheme)
	(json))

(import (only (thunder-utils) string-replace string-split) 
	(only (srfi s13 strings) string-drop string-downcase string-prefix? string-suffix? string-delete)
	(only (srfi s1 lists) fold)
	(srfi s14 char-sets))
................................................................................
(import (only (srfi s13 strings) string-contains))
(define (parse-json-function x m)
  (let-json-object x (tag name location return-type parameters) 
		   (if (and (or (string-contains location m) 
				(and (equal? "sdl" m) (string-contains location "SDL.h")))
			    (equal? tag "function")
			    (or (string-prefix? "SDL_" name)
				(string-prefix? "SDLNet_" name)))

		       (cond
			[(memq (string->symbol (anti-camel name)) blacklist)
			 (printf ";;blacklisted probably because it uses a struct as value.\n(define ~d #f)\n" (anti-camel name))]
			[else
			   (printf "(define-sdl-func ~d ~d ~d \"~d\")\n"
				   (decode-type return-type) 
				   (case name
................................................................................
	      (lambda () 
		(vector-for-each 
		 (lambda (x)
		   (parse-json-function x m))
		 sdlnet-json))
	      'truncate)) '("net"))






















|







 







|
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
;;     http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
(library-directories "~/thunderchez")
(import (scheme)
	(json))

(import (only (thunder-utils) string-replace string-split) 
	(only (srfi s13 strings) string-drop string-downcase string-prefix? string-suffix? string-delete)
	(only (srfi s1 lists) fold)
	(srfi s14 char-sets))
................................................................................
(import (only (srfi s13 strings) string-contains))
(define (parse-json-function x m)
  (let-json-object x (tag name location return-type parameters) 
		   (if (and (or (string-contains location m) 
				(and (equal? "sdl" m) (string-contains location "SDL.h")))
			    (equal? tag "function")
			    (or (string-prefix? "SDL_" name)
				(string-prefix? "SDLNet_" name)
				(string-prefix? "IMG_" name)))
		       (cond
			[(memq (string->symbol (anti-camel name)) blacklist)
			 (printf ";;blacklisted probably because it uses a struct as value.\n(define ~d #f)\n" (anti-camel name))]
			[else
			   (printf "(define-sdl-func ~d ~d ~d \"~d\")\n"
				   (decode-type return-type) 
				   (case name
................................................................................
	      (lambda () 
		(vector-for-each 
		 (lambda (x)
		   (parse-json-function x m))
		 sdlnet-json))
	      'truncate)) '("net"))

(define sdlimage-json-text (read-file "sdl2-image.json"))
(define sdlimage-json (string->json sdlimage-json-text))

(with-output-to-file "sdl2-image.sexp" (lambda () (pretty-print sdlimage-json))
		     'truncate)

(for-each (lambda (m)
	    (with-output-to-file (string-append m "-functions.ss")
	      (lambda ()
		  (vector-for-each
		   (lambda (x)
		     (parse-json-function x m))
		   sdlimage-json))
	      'truncate)) '("image"))

Changes to sdl2/rwops-functions.ss.

1
2
3
4
5
6

7
8
9
10
11
12
13







(define-sdl-func (* sdl-rw-ops-t) sdl-rw-from-file ((file string) (mode string)) "SDL_RWFromFile")
(define-sdl-func (* sdl-rw-ops-t) sdl-rw-from-fp ((fp (* file)) (autoclose sdl-bool-t)) "SDL_RWFromFP")
(define-sdl-func (* sdl-rw-ops-t) sdl-rw-from-mem ((mem void*) (size int)) "SDL_RWFromMem")
(define-sdl-func (* sdl-rw-ops-t) sdl-rw-from-const-mem ((mem void*) (size int)) "SDL_RWFromConstMem")
(define-sdl-func (* sdl-rw-ops-t) sdl-alloc-rw () "SDL_AllocRW")
(define-sdl-func void sdl-free-rw ((area (* sdl-rw-ops-t))) "SDL_FreeRW")

(define-sdl-func uint8 sdl-read-u8 ((src (* sdl-rw-ops-t))) "SDL_ReadU8")
(define-sdl-func uint16 sdl-read-l-e16 ((src (* sdl-rw-ops-t))) "SDL_ReadLE16")
(define-sdl-func uint16 sdl-read-b-e16 ((src (* sdl-rw-ops-t))) "SDL_ReadBE16")
(define-sdl-func uint32 sdl-read-l-e32 ((src (* sdl-rw-ops-t))) "SDL_ReadLE32")
(define-sdl-func uint32 sdl-read-b-e32 ((src (* sdl-rw-ops-t))) "SDL_ReadBE32")
(define-sdl-func uint64 sdl-read-l-e64 ((src (* sdl-rw-ops-t))) "SDL_ReadLE64")
(define-sdl-func uint64 sdl-read-b-e64 ((src (* sdl-rw-ops-t))) "SDL_ReadBE64")













>







>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(define-sdl-func (* sdl-rw-ops-t) sdl-rw-from-file ((file string) (mode string)) "SDL_RWFromFile")
(define-sdl-func (* sdl-rw-ops-t) sdl-rw-from-fp ((fp (* file)) (autoclose sdl-bool-t)) "SDL_RWFromFP")
(define-sdl-func (* sdl-rw-ops-t) sdl-rw-from-mem ((mem void*) (size int)) "SDL_RWFromMem")
(define-sdl-func (* sdl-rw-ops-t) sdl-rw-from-const-mem ((mem void*) (size int)) "SDL_RWFromConstMem")
(define-sdl-func (* sdl-rw-ops-t) sdl-alloc-rw () "SDL_AllocRW")
(define-sdl-func void sdl-free-rw ((area (* sdl-rw-ops-t))) "SDL_FreeRW")
(define-sdl-func void* sdl-load-file-rw ((src (* sdl-rw-ops-t)) (datasize (* size-t)) (freesrc int)) "SDL_LoadFile_RW")
(define-sdl-func uint8 sdl-read-u8 ((src (* sdl-rw-ops-t))) "SDL_ReadU8")
(define-sdl-func uint16 sdl-read-l-e16 ((src (* sdl-rw-ops-t))) "SDL_ReadLE16")
(define-sdl-func uint16 sdl-read-b-e16 ((src (* sdl-rw-ops-t))) "SDL_ReadBE16")
(define-sdl-func uint32 sdl-read-l-e32 ((src (* sdl-rw-ops-t))) "SDL_ReadLE32")
(define-sdl-func uint32 sdl-read-b-e32 ((src (* sdl-rw-ops-t))) "SDL_ReadBE32")
(define-sdl-func uint64 sdl-read-l-e64 ((src (* sdl-rw-ops-t))) "SDL_ReadLE64")
(define-sdl-func uint64 sdl-read-b-e64 ((src (* sdl-rw-ops-t))) "SDL_ReadBE64")
(define-sdl-func size-t sdl-write-u8 ((dst (* sdl-rw-ops-t)) (value uint8)) "SDL_WriteU8")
(define-sdl-func size-t sdl-write-l-e16 ((dst (* sdl-rw-ops-t)) (value uint16)) "SDL_WriteLE16")
(define-sdl-func size-t sdl-write-b-e16 ((dst (* sdl-rw-ops-t)) (value uint16)) "SDL_WriteBE16")
(define-sdl-func size-t sdl-write-l-e32 ((dst (* sdl-rw-ops-t)) (value uint32)) "SDL_WriteLE32")
(define-sdl-func size-t sdl-write-b-e32 ((dst (* sdl-rw-ops-t)) (value uint32)) "SDL_WriteBE32")
(define-sdl-func size-t sdl-write-l-e64 ((dst (* sdl-rw-ops-t)) (value uint64)) "SDL_WriteLE64")
(define-sdl-func size-t sdl-write-b-e64 ((dst (* sdl-rw-ops-t)) (value uint64)) "SDL_WriteBE64")

Changes to sdl2/rwops-types.ss.

9
10
11
12
13
14
15
16
17
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

 (define-ftype sdl-rw-ops-t (struct))








|
<
9
10
11
12
13
14
15
16

;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.

(define-ftype sdl-rw-ops-t (struct))

Added sdl2/sdl2-image.json.

cannot compute difference between binary files

Added sdl2/sdl2-image.sexp.

more than 10,000 changes

Changes to sdl2/sdl2-net.json.

cannot compute difference between binary files

Changes to sdl2/sdl2-net.sexp.

more than 10,000 changes

Changes to sdl2/sdl2.json.

cannot compute difference between binary files

Changes to sdl2/sdl2.sexp.

more than 10,000 changes

Changes to sdl2/surface-functions.ss.

15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30
31
(define-sdl-func int sdl-get-surface-color-mod ((surface (* sdl-surface-t)) (r (* uint8)) (g (* uint8)) (b (* uint8))) "SDL_GetSurfaceColorMod")
(define-sdl-func int sdl-set-surface-alpha-mod ((surface (* sdl-surface-t)) (alpha uint8)) "SDL_SetSurfaceAlphaMod")
(define-sdl-func int sdl-get-surface-alpha-mod ((surface (* sdl-surface-t)) (alpha (* uint8))) "SDL_GetSurfaceAlphaMod")
(define-sdl-func int sdl-set-surface-blend-mode ((surface (* sdl-surface-t)) (blendMode sdl-blend-mode-t)) "SDL_SetSurfaceBlendMode")
(define-sdl-func int sdl-get-surface-blend-mode ((surface (* sdl-surface-t)) (blendMode (* sdl-blend-mode-t))) "SDL_GetSurfaceBlendMode")
(define-sdl-func sdl-bool-t sdl-set-clip-rect ((surface (* sdl-surface-t)) (rect (* sdl-rect-t))) "SDL_SetClipRect")
(define-sdl-func void sdl-get-clip-rect ((surface (* sdl-surface-t)) (rect (* sdl-rect-t))) "SDL_GetClipRect")

(define-sdl-func (* sdl-surface-t) sdl-convert-surface ((src (* sdl-surface-t)) (fmt (* sdl-pixel-format-t)) (flags uint32)) "SDL_ConvertSurface")
(define-sdl-func (* sdl-surface-t) sdl-convert-surface-format ((src (* sdl-surface-t)) (pixel_format uint32) (flags uint32)) "SDL_ConvertSurfaceFormat")
(define-sdl-func int sdl-convert-pixels ((width int) (height int) (src_format uint32) (src void*) (src_pitch int) (dst_format uint32) (dst void*) (dst_pitch int)) "SDL_ConvertPixels")
(define-sdl-func int sdl-fill-rect ((dst (* sdl-surface-t)) (rect (* sdl-rect-t)) (color uint32)) "SDL_FillRect")
(define-sdl-func int sdl-fill-rects ((dst (* sdl-surface-t)) (rects (* sdl-rect-t)) (count int) (color uint32)) "SDL_FillRects")
(define-sdl-func int sdl-upper-blit ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_UpperBlit")
(define-sdl-func int sdl-lower-blit ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_LowerBlit")
(define-sdl-func int sdl-soft-stretch ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_SoftStretch")
(define-sdl-func int sdl-upper-blit-scaled ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_UpperBlitScaled")
(define-sdl-func int sdl-lower-blit-scaled ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_LowerBlitScaled")







>










15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
(define-sdl-func int sdl-get-surface-color-mod ((surface (* sdl-surface-t)) (r (* uint8)) (g (* uint8)) (b (* uint8))) "SDL_GetSurfaceColorMod")
(define-sdl-func int sdl-set-surface-alpha-mod ((surface (* sdl-surface-t)) (alpha uint8)) "SDL_SetSurfaceAlphaMod")
(define-sdl-func int sdl-get-surface-alpha-mod ((surface (* sdl-surface-t)) (alpha (* uint8))) "SDL_GetSurfaceAlphaMod")
(define-sdl-func int sdl-set-surface-blend-mode ((surface (* sdl-surface-t)) (blendMode sdl-blend-mode-t)) "SDL_SetSurfaceBlendMode")
(define-sdl-func int sdl-get-surface-blend-mode ((surface (* sdl-surface-t)) (blendMode (* sdl-blend-mode-t))) "SDL_GetSurfaceBlendMode")
(define-sdl-func sdl-bool-t sdl-set-clip-rect ((surface (* sdl-surface-t)) (rect (* sdl-rect-t))) "SDL_SetClipRect")
(define-sdl-func void sdl-get-clip-rect ((surface (* sdl-surface-t)) (rect (* sdl-rect-t))) "SDL_GetClipRect")
(define-sdl-func (* sdl-surface-t) sdl-duplicate-surface ((surface (* sdl-surface-t))) "SDL_DuplicateSurface")
(define-sdl-func (* sdl-surface-t) sdl-convert-surface ((src (* sdl-surface-t)) (fmt (* sdl-pixel-format-t)) (flags uint32)) "SDL_ConvertSurface")
(define-sdl-func (* sdl-surface-t) sdl-convert-surface-format ((src (* sdl-surface-t)) (pixel_format uint32) (flags uint32)) "SDL_ConvertSurfaceFormat")
(define-sdl-func int sdl-convert-pixels ((width int) (height int) (src_format uint32) (src void*) (src_pitch int) (dst_format uint32) (dst void*) (dst_pitch int)) "SDL_ConvertPixels")
(define-sdl-func int sdl-fill-rect ((dst (* sdl-surface-t)) (rect (* sdl-rect-t)) (color uint32)) "SDL_FillRect")
(define-sdl-func int sdl-fill-rects ((dst (* sdl-surface-t)) (rects (* sdl-rect-t)) (count int) (color uint32)) "SDL_FillRects")
(define-sdl-func int sdl-upper-blit ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_UpperBlit")
(define-sdl-func int sdl-lower-blit ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_LowerBlit")
(define-sdl-func int sdl-soft-stretch ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_SoftStretch")
(define-sdl-func int sdl-upper-blit-scaled ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_UpperBlitScaled")
(define-sdl-func int sdl-lower-blit-scaled ((src (* sdl-surface-t)) (srcrect (* sdl-rect-t)) (dst (* sdl-surface-t)) (dstrect (* sdl-rect-t))) "SDL_LowerBlitScaled")