Displaying the Structure of an Object

An author might want to display the structural details of an object or the comparison of two objects. Proteus provides a set of messages that can be used for this purpose.

 

The displayStructure([cond]) Message

Everything from the previous chapters comes together in this message. We display the structure of the object in a format that mirrors its source definition.

 

The message takes a variable argument list cond which, if present, should be the same as that acceptable to the getStrucList() message.

 

For instance, the message me.displayStructure() displays something like the following:

 

Object        me     extends       Person

{

       DynamOrAnon: nil UnnamedInternal: nil Transient: nil

 

       Lists: Parents Children First Named Ancestors First Named Descendants

 

       Trees: Ancestors Descendants Containment Modifications

 

       Properties: Defined Action State State Delta

 

       properties directly defined by object me

              bulkCapacity : TypeInt = 5

              issueCommandsSynchronously : TypeTrue = true

              location : TypeObject = livingRoom

              nextHoldingIndex : TypeInt = 5

              contents : TypeList = [duffel, keyring, trophy, whiteBox]

              pendingCommand : TypeObject = Vector []

              antecedentTable : TypeObject = LookupTable []

              memoryTable : TypeObject = LookupTable [[television, true], [poBox, true], [staticBowl, true], [smallRedBall, true], [redBook, true], [ironKey, true], [clearJar, true], [greenJar, true], [tads#5d5 (CopperCoin), true], [tads#5d6 (CopperCoin), true], [blueBook, true], [brassKey, true], [box, true], [tricycle, true], [rustyKey, true], [greenBall, true], [eightball, true], [bigRedBall, true], [tads#5d7 (SilverCoin), true], [tads#5dc (GoldCoin), true], [tads#5db (GoldCoin), true], [tads#5dd (GoldCoin), true], [tads#5de (GoldCoin), true], [tads#5da (GoldCoin), true], [tads#5d9 (SilverCoin), true], [tads#5d8 (SilverCoin), true], [morphicBowl, true], [bill, true], [bob, true], [livingRoom, true], [trophy, true], [vase, true], [tads#615 (Candle), true], [tads#617 (StretchyContainer), true], [tads#618 (Container), true], [tads#619 (Thing), true], [tads#616 (Odor), true], [diningRoom, true], [duffel, true], [keyring, true], [whiteBox, true], [beeperNoise, true]]

              objRefTag : TypeSString = 'tads#588'

              tmpAmbient_ : TypeInt = 0

              tmpAmbientWithin_ : TypeInt = 0

              tmpAmbientFill_ : TypeNil = nil

              tmpTrans_ : TypeEnum = transparent

              tmpTransWithin_ : TypeEnum = transparent

              tmpObstructor_ : TypeNil = nil

              tmpObstructorWithin_ : TypeNil = nil

              tmpFillMedium_ : TypeNil = nil

              scheduleOrder : TypeInt = 100

              locationBefore : TypeObject = livingRoom

              locationLitBefore : TypeTrue = true

              followingActor : TypeNil = nil

              moved : TypeTrue = true

              lastTravelDest : TypeObject = livingRoom

              lastTravelBack : TypeObject = diningRoom

              mostRecentAction : TypeObject = tads#6ff (predicate(ListChildObj))

              nextRunTime : TypeInt = 4

}

 

Elements in blue represent hyperlinks that perform various functions.

 

Object Header

The first part of the display consists of an object header, composed of three parts:

 

 

Object Characteristics

The next part of the display consists of a section that further attempts to classify the object, based largely on information obtained from the global symbol table:

 

 

Object Lineage Listings

The next section of the display is a set of hyperlinks that produce unordered lists detailing various aspects of the object’s lineage:

 

 

Object Lineage Trees

One of the most interesting set of hyperlinks consist of the trees of Ancestors, Descendants, Containment, and Modifications. These produce a tree structure of the corresponding relationship of this object to others.

 

Directly Defined Property List

The next part of the display is divided into sections of directly defined property lists for each object we encounter as we traverse the inheritance hierarchy. The display above is only a partial traversal, caused by the cond argument passed as part of the getStrucList() message.

 

The directly defined property list has the format:

 

propertyName: Type <= assignedValue>

 

The elements of the format are defined below:

 

 

So, from our example above me directly defines the property location, which is currently of TypeObject and is assigned the value entryway. The property pendingCommand is currently of TypeObject, and is assigned the value Vector. This is a dynamically-created instance of the class Vector, and we can see from the display that it is empty ([]).

 

The empty braces after Vector is a special aspect of the display mechanism, and not part of the vector object’s name. For any Collection class object displayStructure() will display it’s elements.

 

Displaying the State Delta for Two Objects

The message displayStateDelta(otherObj, sup, [bypass]) is similarly used to display the state delta between two objects. The display looks something like the following:

 

========== START TADS 3 DIAGNOSTIC ==========

 

 

 

State Delta: tads#668 (Person), me

       tads#668 (Person).nextHoldingIndex : TypeInt = 3

       me.nextHoldingIndex : TypeInt = 39

 

 

       tads#668 (Person).contents : TypeList = [duffel, keyring]

       me.contents : TypeList = [duffel, tads#5de (GoldCoin), tads#5d7 (SilverCoin), tads#5d9 (SilverCoin), tads#5d8 (SilverCoin)]

 

 

       tads#668 (Person).nextRunTime : TypeInt = 0

       me.nextRunTime : TypeInt = 1

 

 

       tads#668 (Person).mostRecentAction : TypeNil = nil

       me.mostRecentAction : TypeObject = tads#64b (predicate(Take))

 

 

========== END TADS 3 DIAGNOSTIC ============

 

 

 

The display simply pairs the attributes that are different between the two objects and displays them in a format similar to that of displayStructure().

 

 

This file is part of the TADS 3 Proteus Library Extension

Copyright © 2001-2004 Kevin Forchione. All rights reserved.