##// END OF EJS Templates
Working WAIT without busy-wait
Working WAIT without busy-wait

File last commit:

r25:4adc2646 default
r29:f8046447 default
Show More
intrinsic-macros.lisp
174 lines | 2.9 KiB | text/x-common-lisp | CommonLispLexer
/ src / intrinsic-macros.lisp
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (in-package sugar-qsp.lib)
Menu, game saving
r11
;;;; Macros implementing some intrinsics where it makes sense
;;;; E.g. an equivalent JS function exists, or it's a direct API call
;;; 1loc
;;; 2var
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro killvar (varname &optional index)
`(kill-var ,varname ,index))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro killall ()
Menu, game saving
r11 `(api-call kill-all))
;;; 3expr
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro obj (name)
Menu, game saving
r11 `(funcall (root objs includes) ,name))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro loc (name)
Menu, game saving
r11 `(funcall (root locs includes) ,name))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro no (arg)
Menu, game saving
r11 `(- -1 ,arg))
;;; 4code
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro qspver ()
Menu, game saving
r11 "0.0.1")
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro curloc ()
Menu, game saving
r11 `(root current-location))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro rnd ()
`(funcall rand 1 1000))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro qspmax (&rest args)
A few parser fixes
r13 (if (= 1 (length args))
`(*math.max.apply nil ,@args)
`(*math.max ,@args)))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro qspmin (&rest args)
A few parser fixes
r13 (if (= 1 (length args))
`(*math.min.apply nil ,@args)
`(*math.min ,@args)))
Menu, game saving
r11
;;; 5arrays
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro arrsize (name)
Menu, game saving
r11 `(api-call array-size ,name))
;;; 6str
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro len (s)
Menu, game saving
r11 `(length ,s))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro mid (s from &optional count)
`(chain ,s (substring ,from ,count)))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro ucase (s)
`(chain ,s (to-upper-case)))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro lcase (s)
`(chain ,s (to-lower-case)))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro trim (s)
`(chain ,s (trim)))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro replace (s from to)
`(chain ,s (replace ,from ,to)))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro val (s)
Menu, game saving
r11 `(parse-int ,s 10))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro qspstr (n)
`(chain ,n (to-string)))
Menu, game saving
r11
;;; 7if
;;; 8sub
;;; 9loops
;; JUMP is in ps-macros.lisp (because it's a part of a huge kludge)
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro exit ()
Menu, game saving
r11 `(return-from nil (values)))
;;; 10dynamic
;;; 11main
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro desc (s)
Menu, game saving
r11 (declare (ignore s))
"")
;;; 12stat
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro showstat (enable)
Menu, game saving
r11 `(api-call enable-frame :stat ,enable))
;;; 13diag
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro msg (text)
Menu, game saving
r11 `(alert ,text))
;;; 14act
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro showacts (enable)
Menu, game saving
r11 `(api-call enable-frame :acts ,enable))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro delact (name)
Menu, game saving
r11 `(api-call del-act ,name))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro cla ()
Menu, game saving
r11 `(api-call clear-act))
;;; 15objs
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro showobjs (enable)
Menu, game saving
r11 `(api-call enable-frame :objs ,enable))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro countobj ()
Menu, game saving
r11 `(length (root objs)))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro getobj (index)
Menu, game saving
r11 `(or (elt (root objs) ,index) ""))
;;; 16menu
;;; 17sound
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro isplay (filename)
Sounds, save/load UI buttons
r12 `(funcall (root playing includes) ,filename))
Menu, game saving
r11 ;;; 18img
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro view (&optional path)
Some DOM stuff, VIEW
r18 `(api-call show-image ,path))
Menu, game saving
r11 ;;; 19input
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro showinput (enable)
Finishing lib
r20 `(api-call enable-frame :input ,enable))
Menu, game saving
r11 ;;; 20time
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro wait (msec)
WAIT with async
r24 `(await (api-call sleep ,msec)))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro settimer (interval)
Finishing lib
r20 `(api-call set-timer ,interval))
Locals
r14 ;;; 21local
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro local (var &optional expr)
Locals
r14 `(progn
(api-call new-local ,(string (second var)))
,@(when expr
`((set ,var ,expr)))))
Some DOM stuff, VIEW
r18
;;; 22for
;;; misc
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro opengame (&optional filename)
Some DOM stuff, VIEW
r18 (declare (ignore filename))
`(api-call opengame))
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro savegame (&optional filename)
Some DOM stuff, VIEW
r18 (declare (ignore filename))
`(api-call savegame))