Use the type (Ptr Char) to express raw C strings.

This commit is contained in:
Erik Svedäng 2017-09-07 19:44:02 +02:00
parent 9781c5f7cb
commit 3308652c75
4 changed files with 6 additions and 6 deletions

View File

@ -5,5 +5,5 @@
(register copy (Fn [(Ref String)] String))
(register count (Fn [(Ref String)] Int))
(register duplicate (Fn [(Ref String)] String))
(register raw (Fn [(Ref String)] String)) ;; bad name?
(register cstr (Fn [(Ref String)] (Ptr Char)))
)

View File

@ -137,7 +137,7 @@ string String_duplicate(string *s) {
return strdup(*s);
}
string String_raw(string *s) {
char* String_cstr(string *s) {
return *s;
}

View File

@ -1,5 +1,5 @@
(system-include "SDL2/SDL_image.h")
(add-lib "-lSDL2_image")
(register IMG_LoadTexture (Fn [(Ptr SDL_Renderer) String] (Ptr SDL_Texture)))
(register IMG_Load (Fn [String] (Ptr SDL_Surface)))
(register IMG_LoadTexture (Fn [(Ptr SDL_Renderer) (Ptr Char)] (Ptr SDL_Texture)))
(register IMG_Load (Fn [(Ptr Char)] (Ptr SDL_Surface)))

View File

@ -79,8 +79,8 @@
(defn main []
(let [app (app-init (String.copy "~ CARP ~") 512 512)
rend (app-renderer app)
img1 (IMG_LoadTexture rend (raw "./img/square.png"))
img2 (IMG_LoadTexture rend (raw "./img/carp_logo_969_no_texture.png"))
img1 (IMG_LoadTexture rend (cstr "./img/square.png"))
img2 (IMG_LoadTexture rend (cstr "./img/carp_logo_969_no_texture.png"))
images (Images.init img1 img2)]
(while true
(do