update Readme
This commit is contained in:
22
Readme.org
22
Readme.org
@@ -54,13 +54,13 @@ An example of Sex source:
|
|||||||
#+begin_src scheme
|
#+begin_src scheme
|
||||||
(include stdio.h)
|
(include stdio.h)
|
||||||
|
|
||||||
(pub fn int main ((int argc) (char **argv))
|
(pub fn main ((argc int) (argv [* const char])) int
|
||||||
(puts "Hello from Sex!")
|
(puts "Hello from Sex!")
|
||||||
(var (array char 512) name)
|
(var name [char 512])
|
||||||
(puts "What is your name?")
|
(puts "What is your name?")
|
||||||
(scanf "%s" (cast char* &name))
|
(scanf "%s" (cast (& name) (* char)))
|
||||||
(printf "Hello, %s!\n" name)
|
(printf "Hello, %s!\n" name)
|
||||||
0)
|
(return 0))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Compile and run:
|
Compile and run:
|
||||||
@@ -106,16 +106,16 @@ return Sex code.
|
|||||||
(pub defmacro (list-T type)
|
(pub defmacro (list-T type)
|
||||||
(let ((list-type (cat 'list- type)))
|
(let ((list-type (cat 'list- type)))
|
||||||
`(struct ,list-type
|
`(struct ,list-type
|
||||||
((,type value)
|
((value ,type)
|
||||||
((* ,list-type) next)))))
|
(next (* ,list-type))))))
|
||||||
|
|
||||||
(list-T int)
|
(list-T int)
|
||||||
#+end_src
|
#+end_src
|
||||||
->
|
->
|
||||||
#+begin_src scheme
|
#+begin_src scheme
|
||||||
(struct list_int
|
(struct list_int
|
||||||
((int value)
|
((value int)
|
||||||
((* list_int) next)))
|
(next (* list_int))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
**** Wrapper for checking return codes
|
**** Wrapper for checking return codes
|
||||||
@@ -126,16 +126,16 @@ return Sex code.
|
|||||||
(puts ,message)
|
(puts ,message)
|
||||||
(return ,ret-code))))
|
(return ,ret-code))))
|
||||||
|
|
||||||
(pub fn int init ()
|
(pub fn init () int
|
||||||
(check-sdl-return
|
(check-sdl-return
|
||||||
(SDL-Init SDL-INIT-VIDEO) "Failed to initialize SDL" 1)
|
(SDL-Init SDL-INIT-VIDEO) "Failed to initialize SDL" 1)
|
||||||
...)
|
...)
|
||||||
#+end_src
|
#+end_src
|
||||||
->
|
->
|
||||||
#+begin_src c
|
#+begin_src c
|
||||||
(%fun int init ()
|
(pub fn init () init
|
||||||
(if (< 0 (SDL_Init SDL_INIT_VIDEO))
|
(if (< 0 (SDL_Init SDL_INIT_VIDEO))
|
||||||
(%begin (puts "Failed to initialize SDL") (return 1)))
|
(begin (puts "Failed to initialize SDL") (return 1)))
|
||||||
...)
|
...)
|
||||||
}
|
}
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|||||||
Reference in New Issue
Block a user