##// END OF EJS Templates
Fix a bug with kill-var and calling service locations
Fix a bug with kill-var and calling service locations

File last commit:

r65:4e5eb097 default
r66:84186fb0 default
Show More
intrinsic-macros.lisp
180 lines | 3.1 KiB | text/x-common-lisp | CommonLispLexer
/ src / intrinsic-macros.lisp
Menu, game saving
r11
Rename system to txt2web
r49 (in-package txt2web.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
Fix two regressions
r64 (defpsmacro killvar (&optional varname index)
MENU
r30 `(api-call kill-var ,varname ,index))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro killall ()
Fix two regressions
r64 `(progn
(killvar)
(killobj)))
Menu, game saving
r11
;;; 3expr
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 ()
Bugfixes to optimized variables. CURACT, DELACT
r40 `*current-location)
Menu, game saving
r11
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
Bugfixes
r51 (defpsmacro qspreplace (s from to)
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 `(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
Fix two regressions
r64 (defpsmacro dynamic (block &rest args)
`(progn
(when (stringp ,block)
(api:report-error "DYNAMIC can't evaluate arbitrary strings.\\nUse {braces} to create blocks for DYNAMIC."))
Fix a bug in dynamic return
r65 (api:with-call-args ,args nil
(funcall ,block))))
Fix two regressions
r64
(defpsmacro dyneval (block &rest args)
`(progn
Fix a bug in dynamic return
r65 (when (stringp ,block)
Fix two regressions
r64 (api:report-error "DYNEVAL can't evaluate arbitrary strings.\\nUse {braces} to create blocks for DYNEVAL."))
Fix a bug in dynamic return
r65 (api:with-call-args ,args t
(funcall ,block))))
Fix two regressions
r64
Menu, game saving
r11 ;;; 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))
Bugfixes to optimized variables. CURACT, DELACT
r40 (defpsmacro delact (&optional name)
Bugfixes
r41 (if name
`(api-call del-act ,name)
`(api-call del-act)))
Menu, game saving
r11
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 ()
Bugfixes to optimized variables. CURACT, DELACT
r40 `(length *objs))
Menu, game saving
r11
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro getobj (index)
Bugfixes to optimized variables. CURACT, DELACT
r40 `(or (elt *objs ,index) ""))
Menu, game saving
r11
;;; 16menu
;;; 17sound
Use Parenscript's minifier and obfuscator... and namespaces. SAVES CURRENTLY BROKEN
r25 (defpsmacro isplay (filename)
Globals instead of ROOT object
r39 `(funcall (@ playing includes) ,filename))
Sounds, save/load UI buttons
r12
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
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))