Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2836162
commit 765fb08
Showing
92 changed files
with
35,285 additions
and
518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;作者:evilbinary on 11/19/16. | ||
;邮箱:rootdebug@163.com | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
|
||
(import (scheme) (cffi cffi) ) | ||
|
||
|
||
; (ffi-dl-test) | ||
(load-librarys "foo.so") | ||
|
||
|
||
; (display "============test-normal============\n") | ||
|
||
; (def-function floating "floating" (int float double double) int ) | ||
; (def-function foovv "foo_vv" () void ) | ||
; (def-function foop "foo_p" (void*) void ) | ||
; (def-function foo-string "foo_string" (string) void ) | ||
; (def-function foo-string-string "foo_string_string" (string) string ) | ||
|
||
; (time (display (floating 6 3.141590 0.333333 2.718282) ) ) | ||
; (time (display (foovv ) ) ) | ||
; (time (display (foo-string "hello,world"))) | ||
; (time (display (foo-string-string "hello,world"))) | ||
|
||
; (display "============test-normal============end\n\n") | ||
|
||
|
||
;;test struct | ||
(display "============test-struct============\n") | ||
(def-struct A | ||
(c char 64 ) | ||
(d double 64 ) | ||
(i int 64 ) | ||
) | ||
(display "def-struct end\n") | ||
|
||
(define a (make-A 10 20.0 30 ) ) | ||
(display (format "make-A ~a end\n" a) ) | ||
|
||
|
||
(display "make-A\n") | ||
(define b (make-A) ) | ||
(display "make-A --end\n") | ||
|
||
;(define-top-level-value 'aa make-A) | ||
(display "define-top-level-value end \n") | ||
|
||
;((syntax->datum `,(string->symbol "make-A") ) ) | ||
|
||
;( string->procedure "make-A") | ||
;(display (format "top-level-value======~a\n" ((top-level-value 'make-A ) ) )) | ||
|
||
|
||
|
||
(display a)(newline) | ||
|
||
|
||
(display (A-c a) )(newline) | ||
(A-c-set! a 17) | ||
(display (A-c a) )(newline) | ||
;(display a)(newline) | ||
;(display (record-type-descriptor? (type-descriptor A)) ) | ||
(def-function struct1 "struct1" (A) A) | ||
; (set! b (struct1 a) ) | ||
|
||
(time (display (struct1 a))) | ||
|
||
|
||
(display "============test-struct============end \n\n") | ||
|
||
; (display (slot-value a uc) ) | ||
; (newline) | ||
; (display (slot-value a d) ) | ||
|
||
|
||
; (let loop () | ||
; (time (cffi-call) ) | ||
|
||
; ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
;Copyright 2016-2080 evilbinary. | ||
;作者:evilbinary on 12/24/16. | ||
;邮箱:rootdebug@163.com | ||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
(import (scheme) (glfw glfw) (gui imgui) (gles gles1) (glut glut) (utils libutil) (utils macro) ) | ||
|
||
(define window '() ) | ||
;;资源文件目录设置 | ||
(define res-dir | ||
(case (machine-type) | ||
((arm32le) "/data/data/org.evilbinary.chez/files/") | ||
(else "") | ||
)) | ||
|
||
|
||
(define (glfw-test) | ||
(glfw-init) | ||
(set! window (glfw-create-window 640 480 "Simple example" 0 0) ) | ||
(glfw-window-hint GLFW_DEPTH_BITS 16); | ||
; (glfw-window-hint GLFW_CONTEXT_VERSION_MAJOR 1); | ||
; (glfw-window-hint GLFW_CONTEXT_VERSION_MINOR 0); | ||
|
||
(glfw-make-context-current window); | ||
|
||
(display (glad-load-gles1-loader (get-glfw-get-proc-address) ) ) | ||
|
||
(glfw-swap-interval 1); | ||
|
||
(glfw-set-cursor-pos-callback window | ||
(glfw-make-cursor-pos-callback | ||
(lambda (w x y) | ||
(display (format "w=~x ~x ~a,~a\n" w window x y )) | ||
;(glfw-swap-buffers w) | ||
) | ||
)) | ||
|
||
(glfw-set-key-callback window | ||
(glfw-make-key-callback | ||
(lambda (w k s a m) | ||
(display (format "w=~x key=~a scancode=~a action=~a mods=~a\n" w k s a m)) | ||
) | ||
)) | ||
|
||
|
||
;(display (format "procedure?=~a" (procedure? mouse-callback) ) ) | ||
|
||
(let ( | ||
(rotation 2.0) | ||
(texture-id (imgui-load-texture (string-append res-dir "number.png"))) | ||
(square-vertices (glut-vector 'float | ||
(vector | ||
-0.2 -0.2 | ||
0.2 -0.2 | ||
-0.2 0.2 | ||
0.2 0.2 | ||
))) | ||
(texture-array (glut-vector 'float | ||
(vector | ||
0.0 1.0 | ||
1.0 1.0 | ||
0.0 0.0 | ||
1.0 0.0) )) | ||
) | ||
(while (= (glfw-window-should-close window) 0) | ||
;(glClearColor 1.0 0.0 0.0 1.0 ) | ||
|
||
(glClear (+ GL_DEPTH_BUFFER_BIT GL_COLOR_BUFFER_BIT)) | ||
|
||
(glRotatef rotation 0.0 0.0 0.1) | ||
(glEnable GL_TEXTURE_2D); // 启用纹理映射 | ||
(glBindTexture GL_TEXTURE_2D texture-id); | ||
(glEnableClientState GL_TEXTURE_COORD_ARRAY); | ||
|
||
(glEnableClientState GL_VERTEX_ARRAY); | ||
(glVertexPointer 2 GL_FLOAT 0 square-vertices); | ||
(glTexCoordPointer 2 GL_FLOAT 0 texture-array); | ||
(glDrawArrays GL_TRIANGLE_STRIP 0 4); | ||
(glDisableClientState GL_VERTEX_ARRAY) | ||
(glDisable GL_TEXTURE_2D) | ||
(glDisable GL_TEXTURE_COORD_ARRAY) | ||
|
||
|
||
(glfw-swap-buffers window) | ||
(glfw-poll-events) | ||
)) | ||
(glfw-destroy-window window); | ||
(glfw-terminate) | ||
|
||
) | ||
|
||
(glfw-test) |
Oops, something went wrong.