X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=if.lisp;h=881c62956b537b25ca6c5fbc4b8c2166faf8a9fc;hb=09e2ca3c7abae98d97cbd8efedc45482e15c6169;hp=dd8d31ae82e56a99d3aba7d3394afba901632796;hpb=a55a923ba8e14bae6a6590c2b28b379f773f8760;p=lifp.git diff --git a/if.lisp b/if.lisp index dd8d31a..881c629 100644 --- a/if.lisp +++ b/if.lisp @@ -36,18 +36,17 @@ :addword :word2dic :addword2dic :split-to-words :sprint :parser :description :article :glance - :initnames :addnames - :read-property :read-property-string :read-property-number - :read-property-integer :read-property-object :read-property-execute - :read-property-other :read-property-list :exec :exec* + :initnames :addnames + :read-property :rp :read-property- + :exec :exec* :abstractobject :name :names :parent :children :flags - :initflags :add-flags :has :hasnt :-> :give + :initflags :add-flags :has :hasnt :-> :give :child :ifclass :object :defaction :*meta* :move :rmv :ofclass :among :verb :extend-verb :extend-verb-first :extend-verb-only :extend-verb-only-first :deftoken :string== :matchp :!last! - :in :objectloop :provides + :in :notin :objectloop :provides :wordlist :tokenlist :nosuchword :nosuchword-word :parse-command :unknown-verb :run-action :run-action-after @@ -89,7 +88,7 @@ "make defvars for names" `(progn ,@(loop for x in names - collect `(defvar ,x)))) + collect `(defvar ,x nil)))) ;;SECTION 2: Global parameters and definitions @@ -359,7 +358,7 @@ word in dictionary, add it." (defun give (obj &rest flags) "Informish synonim to add-flags." - (setf (flags obj) (combine-flags (append (flags obj) flags)))) + (setf (flags obj) (combine-flags (append (flags obj) flags))) nil) (defun has (obj &rest flags) "Informish macro has. Unlike Inform, can accept several flags." @@ -370,6 +369,10 @@ word in dictionary, add it." (not (intersection flags (flags obj)))) ;(not (subsetp flags (flags obj)))) +(defun child (obj) + "Returns the first child of the object" + (car (children obj))) + (defmethod parser ((obj abstractobject) words) "Default parser. Really bad one." (when (zerop (length words)) (return-from parser 0)) @@ -478,6 +481,17 @@ word in dictionary, add it." (glance (apply #'read-property-string (slot-value self property) args)) (t (slot-value self property)))) +(defun read-property- (method self property &rest args) + "read-property using specific method. method is one of keywords: + :string :number :object :integer :" + (case method + (:string (apply #'read-property-string (slot-value self property) args)) + (:number (apply #'read-property-string (slot-value self property) args)) + (:integer (apply #'read-property-string (slot-value self property) args)) + (:object (apply #'read-property-string (slot-value self property) args)) + (:execute (apply #'read-property-string (slot-value self property) args)) + (:list (apply #'read-property-string (slot-value self property) args)) + (t (slot-value self property)))) ;;SECTION 7: IfClass macro and its hairy surroundings