10: Code Wizards

"Code Wizards work Magic!"

Introducing the TypeWriter IV Code Wizard. This Utility was specifically designed based on the Rules of Applied Object-Based Programming with Blitz3D.

This Utility will parse a *.object definition file to generate a *.class file that contains a set of common object methods. Class includes:

  1. objectStart: Initializes Class
  2. objectStop: Shutsdown Class
  3. objectNew: (Constructor) Creates an Instance; Initializes Default Property Values; Assigns Primary Key Object Pointer
  4. objectDelete: (Destructor) Deletes an Instance.
  5. objectWrite: Writes Property Values to a specified file.
  6. objectRead: Creates Instances; Reads and assigns Property Values from a specified file.
  7. objectSave: Saves all Instances Property Values to a specified file.
  8. objectOpen: Loads all Instances from a specified file into Instances.

It's designed to work with all Object Property declarations as explained in the Lesson 02: Advance Custom Types. The utility will also generate needed constructs and methods for Managing Object Key Management and Pointer To Object ID Assignment.

To use it:

  1. Unzip typewriter.zip into the Typewriter4 Folder.
  2. Load and Run demo.bb in Blitz3D IDE.

The *.object File

The *.object File is a definition of the object. TypeWriter's Parser is very limited. It reads the *.object File line by line (no tabs allowed). It recognizes only the following keywords:

type {object name}
field {property label}
max={maximum number of objects in collection; an integer value}
recycle={Primary Key Managment; 0=Counter, 1=Stack}
prefix={Project Prefix Acronym}

type obj
field id%
field a%
field b#
field c$
field d.subobj
field e.subobj[2]
end type
max=4
recycle=1

Typewriter4 requires that each field label to be followed by its datatype extension: %, #, $, .object

Exercise:

1. Create a *.object file of your choice. Modify the demo.bb to execute typewriter v4 on your *.object file.

Email-in this Exercise for Grade!