official update
[lifp.git] / if.lisp
diff --git a/if.lisp b/if.lisp
index a5a98abec8a3082ea833b2838dbddd88392e4133..6a0a3c22027967c87508b4a5f921265c80c8487a 100644 (file)
--- a/if.lisp
+++ b/if.lisp
            :addword :word2dic :addword2dic\r
            :split-to-words :sprint\r
            :parser :description :article :glance \r
-           :initnames :addnames\r
-           :read-property :read-property-string :read-property-number\r
-           :read-property-integer :read-property-object :read-property-execute\r
-           :read-property-other :read-property-list :exec :exec*\r
+           :initnames :addnames \r
+           :read-property :rp :read-property- \r
+           :exec :exec*\r
            :abstractobject :name :names :parent :children :flags\r
            :initflags :add-flags :has :hasnt :-> :give\r
            :ifclass :object :defaction :*meta*\r
@@ -47,7 +46,7 @@
            :verb :extend-verb :extend-verb-first\r
            :extend-verb-only :extend-verb-only-first\r
            :deftoken :string== :matchp :!last!\r
-           :in :objectloop :provides\r
+           :in :notin :objectloop :provides\r
            :wordlist :tokenlist\r
            :nosuchword :nosuchword-word\r
            :parse-command :unknown-verb :run-action :run-action-after\r
@@ -89,7 +88,7 @@
   "make defvars for names"\r
   `(progn\r
      ,@(loop for x in names\r
-           collect `(defvar ,x))))\r
+           collect `(defvar ,x nil))))\r
 \r
 ;;SECTION 2: Global parameters and definitions\r
 \r
@@ -343,7 +342,7 @@ word in dictionary, add it."
   "Tests whether flag2 unsets flag1"\r
   (let ((fl1 (symbol-name flag1))\r
         (fl2 (symbol-name flag2)))\r
-    (and (char= (aref fl2 0) #\~) (string= fl1 (subseq fl2 1)))))\r
+    (and (char= (aref fl2 0) #\~) (string= fl1 fl2 :start2 1))))\r
 \r
 (defun combine-flags (flaglist)\r
   "Combine a list of flags into a _set_ of flags"\r
@@ -359,7 +358,7 @@ word in dictionary, add it."
 \r
 (defun give (obj &rest flags) \r
   "Informish synonim to add-flags." \r
-  (setf (flags obj) (combine-flags (append (flags obj) flags))))\r
+  (setf (flags obj) (combine-flags (append (flags obj) flags)))  nil)\r
 \r
 (defun has (obj &rest flags)\r
   "Informish macro has. Unlike Inform, can accept several flags."\r
@@ -478,6 +477,17 @@ word in dictionary, add it."
     (glance (apply #'read-property-string (slot-value self property) args))\r
     (t (slot-value self property))))\r
 \r
+(defun read-property- (method self property &rest args)\r
+  "read-property using specific method. method is one of keywords:\r
+   :string :number :object :integer :"\r
+  (case method\r
+    (:string (apply #'read-property-string (slot-value self property) args))\r
+    (:number (apply #'read-property-string (slot-value self property) args))\r
+    (:integer (apply #'read-property-string (slot-value self property) args))\r
+    (:object (apply #'read-property-string (slot-value self property) args))\r
+    (:execute (apply #'read-property-string (slot-value self property) args))\r
+    (:list (apply #'read-property-string (slot-value self property) args))\r
+    (t (slot-value self property))))\r
 \r
 ;;SECTION 7: IfClass macro and its hairy surroundings\r
 \r
@@ -528,7 +538,7 @@ word in dictionary, add it."
                     (function #'read-property-execute)\r
                     (list #'read-property-list)\r
                     (t #'read-property-other))\r
-             (slot-value obj property) args)))\r
+             (slot-value self property) args)))\r
 \r
 (defmacro declare-rule (&rest args)\r
   "Declare new rules"\r
@@ -682,7 +692,7 @@ word in dictionary, add it."
 \r
 (defun in (obj1 &rest what)\r
   "Tests whether the first object is inside some of the others"\r
-  (some (lambda (x) (eql (parent obj) x)) what))\r
+  (some (lambda (x) (eql (parent obj1) x)) what))\r
 \r
 (defun destroy (obj)\r
   "Destroy the object, like, totally!"\r