begin -> do
Shorter and doesn't imply existence of `end'
This commit is contained in:
@@ -128,7 +128,7 @@ return Sex code.
|
|||||||
#+begin_src scheme
|
#+begin_src scheme
|
||||||
(pub defmacro (check-sdl-return call message ret-code)
|
(pub defmacro (check-sdl-return call message ret-code)
|
||||||
`(if (< 0 ,call)
|
`(if (< 0 ,call)
|
||||||
(begin
|
(do
|
||||||
(puts ,message)
|
(puts ,message)
|
||||||
(return ,ret-code))))
|
(return ,ret-code))))
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ return Sex code.
|
|||||||
#+begin_src scheme
|
#+begin_src scheme
|
||||||
(pub fn init () int
|
(pub fn init () int
|
||||||
(if (< 0 (SDL_Init SDL_INIT_VIDEO))
|
(if (< 0 (SDL_Init SDL_INIT_VIDEO))
|
||||||
(begin (puts "Failed to initialize SDL") (return 1)))
|
(do (puts "Failed to initialize SDL") (return 1)))
|
||||||
...)
|
...)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
(pub defmacro (list-for-each list-type list-var elt-type elt-var what-do)
|
(pub defmacro (list-for-each list-type list-var elt-type elt-var what-do)
|
||||||
(let ((list-var-2 (cat list-var '-2)))
|
(let ((list-var-2 (cat list-var '-2)))
|
||||||
`(begin
|
`(do
|
||||||
(var ,list-var-2 (* ,list-type) ,list-var)
|
(var ,list-var-2 (* ,list-type) ,list-var)
|
||||||
(var ,elt-var ,elt-type (-> ,list-var-2 value))
|
(var ,elt-var ,elt-type (-> ,list-var-2 value))
|
||||||
(while (!= (-> ,list-var-2 next) NULL)
|
(while (!= (-> ,list-var-2 next) NULL)
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ surrounding c-block supplies them)."
|
|||||||
(case atom
|
(case atom
|
||||||
((fn) '%fun)
|
((fn) '%fun)
|
||||||
((prototype) '%prototype)
|
((prototype) '%prototype)
|
||||||
((begin) '%block-begin)
|
((do) '%block-begin)
|
||||||
((define) '%define)
|
((define) '%define)
|
||||||
((pointer) '%pointer)
|
((pointer) '%pointer)
|
||||||
((array) '%array)
|
((array) '%array)
|
||||||
@@ -141,7 +141,7 @@ surrounding c-block supplies them)."
|
|||||||
;; Statement positions. These are the only places a #line may go,
|
;; Statement positions. These are the only places a #line may go,
|
||||||
;; and each is spliced or wrapped according to what the
|
;; and each is spliced or wrapped according to what the
|
||||||
;; corresponding fmt-c procedure accepts.
|
;; corresponding fmt-c procedure accepts.
|
||||||
(('begin . stmts) (cons '%block-begin (walk-body stmts)))
|
(('do . stmts) (cons '%block-begin (walk-body stmts)))
|
||||||
(('if . clauses) (cons 'if (walk-if-clauses clauses)))
|
(('if . clauses) (cons 'if (walk-if-clauses clauses)))
|
||||||
(('while test . body)
|
(('while test . body)
|
||||||
(cons* 'while (walk-expr test) (walk-body body)))
|
(cons* 'while (walk-expr test) (walk-body body)))
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
|
|||||||
;; Keywords
|
;; Keywords
|
||||||
(list (concat "("
|
(list (concat "("
|
||||||
(regexp-opt '(
|
(regexp-opt '(
|
||||||
"begin"
|
"do"
|
||||||
"case"
|
"case"
|
||||||
"default"
|
"default"
|
||||||
"do"
|
"do"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
;; atom-to-fmt-c
|
;; atom-to-fmt-c
|
||||||
(test '%fun (atom-to-fmt-c 'fn))
|
(test '%fun (atom-to-fmt-c 'fn))
|
||||||
(test '%prototype (atom-to-fmt-c 'prototype))
|
(test '%prototype (atom-to-fmt-c 'prototype))
|
||||||
(test '%block-begin (atom-to-fmt-c 'begin))
|
(test '%block-begin (atom-to-fmt-c 'do))
|
||||||
(test '%define (atom-to-fmt-c 'define))
|
(test '%define (atom-to-fmt-c 'define))
|
||||||
(test '%pointer (atom-to-fmt-c 'pointer))
|
(test '%pointer (atom-to-fmt-c 'pointer))
|
||||||
(test '%array (atom-to-fmt-c 'array))
|
(test '%array (atom-to-fmt-c 'array))
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
" (break))" ; 45
|
" (break))" ; 45
|
||||||
" (default" ; 46
|
" (default" ; 46
|
||||||
" (putchar 120)))" ; 47
|
" (putchar 120)))" ; 47
|
||||||
" (begin" ; 48
|
" (do" ; 48
|
||||||
" (var bvar int 121)" ; 49
|
" (var bvar int 121)" ; 49
|
||||||
" (putchar bvar))" ; 50
|
" (putchar bvar))" ; 50
|
||||||
" (goto done)" ; 51
|
" (goto done)" ; 51
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
(pub defmacro (list-for-each list-type list-var elt-type elt-var what-do)
|
(pub defmacro (list-for-each list-type list-var elt-type elt-var what-do)
|
||||||
(let ((list-var-2 (cat list-var '-2)))
|
(let ((list-var-2 (cat list-var '-2)))
|
||||||
`(begin
|
`(do
|
||||||
(var ,list-var-2 (* ,list-type) ,list-var)
|
(var ,list-var-2 (* ,list-type) ,list-var)
|
||||||
(var ,elt-var ,elt-type (-> ,list-var-2 value))
|
(var ,elt-var ,elt-type (-> ,list-var-2 value))
|
||||||
(while (!= (-> ,list-var-2 next) NULL)
|
(while (!= (-> ,list-var-2 next) NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user