swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Finding events at a particular time in a Schedule


From: Tee Toth-Fejel
Subject: RE: Finding events at a particular time in a Schedule
Date: Mon, 2 Oct 2000 13:37:19 -0400

> -----Original Message-----
> From: address@hidden [mailto:address@hidden
> Sent: Monday, October 02, 2000 10:39 AM
> To: address@hidden
> Subject: Re: Finding events at a particular time in a Schedule
> 
> 
> >>>>> "TTF" == Tee Toth-Fejel <address@hidden> writes:
> 
> TTF> Did you fix them somehow in the above files?
> 
> Yes.
> 
> TTF> What should they do, given that you don't have the time to expose
> TTF> the ActionConcurrent_c instances to the Java layer?
> 
> I did that.

Thanks a million!
But I must be doing something wrong, because whenever I modify buildActions
to put the 2nd and 3rd event at the same time (time = 2), I get the
following error:
(BTW, it works fine when they all have their own time unit to run in.)

address@hidden//c/jFred] $ javaswarm TestMapIndex
buildObjects: super finished
test: address@hidden
test: swarm.collections.MapIndexImpl
test: swarm.collections.MapIndexImpl
test: next event: address@hidden
assertion "cls != 0 && name != 0 && sig != 0" failed: file
"/src/kaffe/kaffe/kaffevm/support.c", lin
e 753
      0 [sig] Kaffe 1033 stackdump: Dumping stack trace to
Kaffe.exe.stackdump

Where:
address@hidden//c/jFred] $ less Kaffe.exe.stackdump
60000353 [sig] Kaffe 1033 sig_send: wait for sig_complete event failed, sig
11, rc 258, Win32 error 0
60002019 [main] Kaffe 1033 sig_send: wait for sig_complete event failed, sig
6, rc 258, Win32 error 0

Code:

import swarm.activity.ScheduleImpl;
import swarm.activity.Schedule;
import swarm.objectbase.SwarmImpl;
import swarm.defobj.Zone;
import swarm.collections.Index;
import swarm.Selector;
import swarm.Globals;
import swarm.simtoolsgui.GUISwarm;
import swarm.simtoolsgui.GUISwarmImpl;
import swarm.activity.Activity;
import swarm.objectbase.Swarm;
import java.io.OutputStream;
import swarm.defobj.Zone;
import swarm.activity.Schedule;
import swarm.activity.ScheduleImpl;
import swarm.activity.Activity;
import swarm.objectbase.Swarm;
import swarm.simtoolsgui.GUISwarm;
import swarm.simtoolsgui.GUISwarmImpl;
import swarm.Selector;
import swarm.Globals;
import swarm.collections.StringImpl;
import swarm.activity.ActionToImpl;
import swarm.NonUniqueMethodSignatureException;
import swarm.SignatureNotFoundException;
import java.util.StringTokenizer;
import java.util.HashMap;
import java.util.Vector;
import java.util.Set;
import java.util.Iterator;
import swarm.collections.Index;
import swarm.collections.MapIndex;
import swarm.collections.MapIndexImpl;
import java.io.File;
import swarm.defobj.SymbolImpl;

public class TestMapIndex extends GUISwarmImpl {
//public class TestMapIndex extends DeviceSwarm {

  Schedule schedule;
  public static void main (String []args) {
    Globals.env.initSwarm ("TestMapIndex", "0.0", "address@hidden",
args);

    TestMapIndex obj = new TestMapIndex (Globals.env.globalZone);
    obj.buildObjects();
    obj.buildActions ();
    obj.activateIn(null);
    obj.test ();
    obj.go();
  }


  public TestMapIndex (Zone aZone) { 
    super (aZone);
    //super ();
  }

  public void message1 () {
    System.out.println (Globals.env.getCurrentTime()+". message1");
    test();
  }

  public void message2 () {
    System.out.println (Globals.env.getCurrentTime()+". message2");
    test();
  }

  
  public Object buildObjects ()
      {
      // allow our parent class to build anything.
      super.buildObjects();
      System.out.println("buildObjects: super finished");
      return this;
      }

  public Activity activateIn (Swarm swarmContext)
    {
    super.activateIn (swarmContext);
    schedule.activateIn (this);
    return getActivity ();
    }

  public Object buildActions () {
    schedule = new ScheduleImpl(Globals.env.globalZone, true);

    try {
      Selector sel1 = new Selector (getClass (), "message1", false);
      Selector sel2 = new Selector (getClass (), "test", false);
      Selector sel3 = new Selector (getClass (), "message2", false);
      schedule.at$createActionTo$message (1, this, sel1);
      schedule.at$createActionTo$message (2, this, sel3);
      schedule.at$createActionTo$message (2, this, sel2);
    } catch (Exception e) {
      e.printStackTrace (System.err);
      System.exit (1);
    }
    return this;
  }

  public void test () {
    //Schedule schedule2 = (Schedule) schedule.copy(getZone());
    Index index = schedule.begin(getZone());

    System.out.println ("test: "+index);
    System.out.println ("test: "+index.getName ());
    System.out.println ("test: "+index.getName ().toString ());
    Object next = index.next ();
    //System.out.println ("test: first event: " + next);
    while (next != null)
      {
      System.out.println ("test: next event: " + next);
      next = index.next ();
      }

    //System.out.println ("second event: " + index.next ());
    //System.out.println ("third event: " + index.next ());

  }
}
 

As you can see, I have all the latest DLLs and Jar file:
address@hidden//c/Swarm-2.1.1/bin] $ ls -l *dll
-rw-r--r--   1 ttf      Administ   415232 Feb  6  2000 BLT24.dll
-rw-r--r--   1 ttf      Administ  1519673 Apr  8 21:21 cygtcl80.dll
-rw-r--r--   1 ttf      Administ    22686 Apr  8 21:21 cygtclpip80.dll
-rw-r--r--   1 ttf      Administ   183691 Apr  8 21:21 cygtclreg80.dll
-rw-r--r--   1 ttf      Administ  2086467 Apr  8 21:07 cygtk80.dll
-rw-r--r--   1 ttf      Administ   607744 Apr  7 13:32 cygwin1.dll
-rw-r--r--   1 ttf      Administ 10995943 Oct  2 10:56 javaswarm.dll
-rw-r--r--   1 ttf      Administ 10620848 Oct  2 10:54 libkaffeswarm.dll
-rw-r--r--   1 ttf      Administ   841147 Apr  8 20:34 libperl5_00563.dll
-rw-r--r--   1 ttf      Administ     4096 Apr  5 22:23 mingwc10.dll
-rw-r--r--   1 ttf      Administ   309251 Apr  9 20:46 objc.dll
-rw-r--r--   1 ttf      Administ  8013088 Oct  2 10:53 swarm.dll

address@hidden//c/Swarm-2.1.1/share/swarm] $ ls -l *jar
-rw-r--r--   1 ttf      Administ   348617 Oct  2 10:52 swarm.jar

Though I'm not exactly sure what to do with the libgmon.a.a, other than
putting it in \Swarm-2.1.1\i686-pc-cygwin\lib\.  But does it need to be
unpacked somehow, or just renamed?

Thanks again for all your help.
Tee

Tihamer "Tee" Toth-Fejel                    Member of Technical Staff
(734) 623-2544   address@hidden      http://www.anteaters.net/ttf/  
Center for Electronic Commerce, Environmental Research Institute of Michigan




                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]