Skip to content

Commit

Permalink
handle different init modes. update version
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmeiners committed Feb 15, 2020
1 parent 1df894a commit 1cd7f75
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion termbox.release-info
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
(repo git "git://github.com/justinmeiners/chicken-{egg-name}.git")
(uri targz "https://github.com/justinmeiners/chicken-{egg-name}/tarball/{egg-release}")
(release "0.1")
(release "0.2")
11 changes: 9 additions & 2 deletions termbox.scm
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,15 @@
(define tb/event/resize (foreign-value "TB_EVENT_RESIZE" unsigned-integer32))
(define tb/event/mouse (foreign-value "TB_EVENT_MOUSE" unsigned-integer32))

(define termbox-init
(foreign-lambda int "tb_init"))
(define priv-termbox-init (foreign-lambda int "tb_init"))
(define priv-termbox-init-file (foreign-lambda int "tb_init_file" c-string))
(define priv-termbox-init-fd (foreign-lambda int "tb_init_fd" integer))

(define (termbox-init . args)
(cond ((null? args) (priv-termbox-init))
((string? (car args)) (priv-termbox-init-file (car args)))
((number? (car args)) (priv-termbox-init-fd (car args)))
(else (error "bad argument type"))))

(define termbox-shutdown
(foreign-lambda void "tb_shutdown"))
Expand Down
4 changes: 4 additions & 0 deletions tests/test.scm
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
(termbox-peek-event 2000)
(termbox-clear)

(termbox-shutdown)

(termbox-init "/dev/tty")

(display-note "Press any key")

(termbox-present)
Expand Down

0 comments on commit 1cd7f75

Please sign in to comment.