DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦aa018f60a⟧ TextFile

    Length: 4397 (0x112d)
    Types: TextFile
    Notes: R1k Text-file segment

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦5a81ac88f⟧ »Space Info Vol 1« 
        └─⟦d26c99606⟧ 
            └─⟦this⟧ 

TextFile


with physicalObject;
package body goal is

   package behaviour is new classBehavior(object,"GOALS     ");

   procedure make       (status        : goal_state;
			 goal_type     : g_type;
			 name	       : physical_object;
			 go_to	       : coordinate) is
      the_goal : goal.object;
   begin
      the_goal.status    := status;
      the_goal.goal_type := goal_type;
      the_goal.name      := name;
      the_goal.go_to     := go_to;

      if the_goal.goal_type = holds and the_goal.name /= nil then
	 declare
	    obj : reference;

            function light_object(an_object : reference) return boolean is
            begin
               return 
                  physicalObject.name(an_object) = the_goal.name	and then
		  physicalObject.weight(an_object) = light;
            end light_object;

            function find_an_object is new collection.findOne(light_object);
	 begin
  	    obj := find_an_object(physicalObject.instances);
	    if collection.isNull(obj) then
	       raise illegal_make;
	    end if;
         end;
      end if;

      if the_goal.goal_type = is_on and the_goal.name /= floor then
	 declare
	    obj : reference;

            function climb_on(an_object : reference) return boolean is
            begin
               return 
                  physicalObject.name(an_object) = the_goal.name;
            end climb_on;

            function find_an_object is new collection.findOne(climb_on);
	 begin
  	    obj := find_an_object(physicalObject.instances);
	    if collection.isNull(obj) then
	       raise illegal_make;
	    end if;
         end;
      end if;

      if the_goal.goal_type = is_at and the_goal.name /= nil then
	 declare
	    obj : reference;

            function move(an_object : reference) return boolean is
            begin
               return 
                  physicalObject.name(an_object) = the_goal.name;
            end move;

            function find_an_object is new collection.findOne(move);
	 begin
  	    obj := find_an_object(physicalObject.instances);
	    if collection.isNull(obj) then
	       raise illegal_make;
	    end if;
         end;
      end if;

      behaviour.allocate(the_goal);
   end make;

   function status      (the_reference : in expertSystem.reference)
                       return goal_state is
   begin
      return behaviour.get(the_reference).status;
   end status;

   function goal_type   (the_reference : in expertSystem.reference)
		       return g_type is
   begin
      return behaviour.get(the_reference).goal_type;
   end goal_type;

   function object_name (the_reference : in expertSystem.reference)
                       return physical_object is
   begin
      return behaviour.get(the_reference).name;
   end object_name;

   function go_to       (the_reference : in expertSystem.reference)
                       return coordinate is
   begin
      return behaviour.get(the_reference).go_to;
   end go_to;

   procedure modify_status      (the_reference  : in expertSystem.reference;
		                 new_status     : in goal_state) is
      the_object : object;
   begin
      the_object := behaviour.get(the_reference);
      the_object.status := new_status;
      behaviour.set(the_reference, the_object);
   end modify_status;

   procedure modify_goal_type   (the_reference  : in expertSystem.reference;
				 new_type       : in g_type) is
      the_object : object;
   begin
      the_object := behaviour.get(the_reference);
      the_object.goal_type := new_type;
      behaviour.set(the_reference, the_object);
   end modify_goal_type;

   procedure modify_object_name (the_reference  : in expertSystem.reference;
				 new_object     : in physical_object) is
      the_object : object;
   begin
      the_object := behaviour.get(the_reference);
      the_object.name := new_object;
      behaviour.set(the_reference, the_object);
   end modify_object_name;

   procedure modify_go_to       (the_reference  : in expertSystem.reference;
				 new_location   : in coordinate) is
      the_object : object;
   begin
      the_object := behaviour.get(the_reference);
      the_object.go_to := new_location;
      behaviour.set(the_reference, the_object);
   end modify_go_to;

   function instances return collection.object is
   begin
      return behaviour.instances;
   end instances;

   procedure clear is
   begin
      behaviour.clear;
   end clear;

end goal;