Show More
@@ -165,6 +165,17 b'' | |||||
165 | (this.append-id "qsp-acts" |
|
165 | (this.append-id "qsp-acts" | |
166 | (this.make-act-html title (ps:getprop obj :img)))))) |
|
166 | (this.make-act-html title (ps:getprop obj :img)))))) | |
167 |
|
167 | |||
|
168 | ;;; "Syntax" | |||
|
169 | ||||
|
170 | (defm (root api qspfor) (name index from to step body) | |||
|
171 | (block nil | |||
|
172 | (ps:for ((i from)) | |||
|
173 | ((< i to)) | |||
|
174 | ((incf i step)) | |||
|
175 | (this.set-var name index :num i) | |||
|
176 | (unless (funcall body) | |||
|
177 | (return))))) | |||
|
178 | ||||
168 | ;;; Variable class |
|
179 | ;;; Variable class | |
169 |
|
180 | |||
170 | (defm (root api *var) (name) |
|
181 | (defm (root api *var) (name) |
@@ -195,9 +195,10 b'' | |||||
195 | ;;; 22for |
|
195 | ;;; 22for | |
196 |
|
196 | |||
197 | (ps:defpsmacro qspfor (var from to step &body body) |
|
197 | (ps:defpsmacro qspfor (var from to step &body body) | |
198 | `(block nil |
|
198 | `(api-call qspfor | |
199 | (set ,var ,from) |
|
199 | ,(string (second var)) ,(third var) ;; name and index | |
200 | (ps:for () |
|
200 | ,from ,to ,step | |
201 |
(( |
|
201 | (lambda () | |
202 | ((set ,var (+ ,var ,step))) |
|
202 | (block nil | |
203 |
,@body |
|
203 | ,@body | |
|
204 | t)))) |
General Comments 0
You need to be logged in to leave comments.
Login now