##// END OF EJS Templates
Working WAIT without busy-wait
naryl -
r29:f8046447 default
parent child Browse files
Show More
@@ -1,12 +1,14 b''
1
1
2 * Duplicate label error (in the parser)
3 * Reporting error lines in the parser
4 * MENU with async/await
2 * MENU with async/await
5 * Special locations
3 * Special locations
6 * Special variables
4 * Special variables
7 * CLI build for Linux
5 * CLI build for Linux
8 * CLI build for Windows
6 * CLI build for Windows
9 * Storing error lines in the parser to report it in runtime errors
7
8 * Reporting error lines in the parser
9 * Report duplicate label (in the parser)
10 * reporting error lines at runtime (by storing them in every form in the parser
11 * Report JUMP with missing label (in tagbody)
10
12
11 * Build Istreblenie
13 * Build Istreblenie
12 * Windows GUI (for the compiler)
14 * Windows GUI (for the compiler)
@@ -14,7 +14,8 b" ACT '\xd0\x98\xd0\xb4\xd1\x82\xd0\xb8 \xd0\xb4\xd0\xbe\xd0\xbc\xd0\xbe\xd0\xb9':GOTO '\xd0\x94\xd0\xbe\xd0\xbc'"
14 ACT 'Идти в магазин':GOTO 'Магазин'
14 ACT 'Идти в магазин':GOTO 'Магазин'
15 ACT 'Перенести ящик':
15 ACT 'Перенести ящик':
16 Ящик = Ящик + 1
16 Ящик = Ящик + 1
17 IF Ящик = 3:
17 WAIT 500
18 IF Ящик = 3:
18 Деньги = Деньги + 5
19 Деньги = Деньги + 5
19 Ящик = 0
20 Ящик = 0
20 END
21 END
@@ -112,3 +112,10 b''
112 justify-content: center;
112 justify-content: center;
113 align-items: center;
113 align-items: center;
114 }
114 }
115
116 /* misc */
117
118 .disable a {
119 pointer-events: none;
120 cursor: default;
121 }
@@ -22,8 +22,23 b''
22 (defun report-error (text)
22 (defun report-error (text)
23 (alert text))
23 (alert text))
24
24
25 (defun start-sleeping ()
26 (chain (by-id "qsp") class-list (add "disable"))
27 (setf (root sleeping) t))
28
29 (defun finish-sleeping ()
30 (chain (by-id "qsp") class-list (remove "disable"))
31 (setf (root sleeping) nil))
32
25 (defun sleep (msec)
33 (defun sleep (msec)
26 (new (*promise (=> resolve (set-timeout resolve msec)))))
34 (start-sleeping)
35 (new (*promise
36 (lambda (resolve)
37 (set-timeout
38 (lambda ()
39 (finish-sleeping)
40 (resolve))
41 msec)))))
27
42
28 (defun init-dom ()
43 (defun init-dom ()
29 ;; Save/load buttons
44 ;; Save/load buttons
@@ -95,8 +110,9 b''
95 (funcall (getprop (root locs) name) args))))
110 (funcall (getprop (root locs) name) args))))
96
111
97 (defun call-act (title)
112 (defun call-act (title)
98 (with-frame
113 (unless (root sleeping)
99 (funcall (getprop (root acts) title 'act))))
114 (with-frame
115 (funcall (getprop (root acts) title 'act)))))
100
116
101 ;;; Text windows
117 ;;; Text windows
102
118
@@ -27,7 +27,8 b''
27 href parse
27 href parse
28 set-prototype-of
28 set-prototype-of
29 body append-child remove-child
29 body append-child remove-child
30 create-element set-attribute
30 add ; remove (is already in COMMON-LISP)
31 create-element set-attribute class-list
31 *file-reader read-as-text
32 *file-reader read-as-text
32 style display src
33 style display src
33 ;; lib
34 ;; lib
@@ -7,7 +7,7 b''
7 (psw (string-downcase "await "))
7 (psw (string-downcase "await "))
8 (print-op-argument 'ps-js::await x))
8 (print-op-argument 'ps-js::await x))
9
9
10 (define-trivial-special-ops await)
10 (define-trivial-special-ops await ps-js::await)
11
11
12 (define-statement-operator async-defun (name lambda-list &rest body)
12 (define-statement-operator async-defun (name lambda-list &rest body)
13 (multiple-value-bind (effective-args body-block docstring)
13 (multiple-value-bind (effective-args body-block docstring)
General Comments 0
You need to be logged in to leave comments. Login now