swarm-support
[Top][All Lists]
Advanced

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

My Proposed EZGraph patch


From: Paul E Johnson
Subject: My Proposed EZGraph patch
Date: Wed, 17 Jan 2001 16:21:57 -0600

I attached the file "EZGraphArg.patch" to this email.  This aplies
against development-swarm version 2.1.26 (2001-01-10).  I sincerely hope
the SDG will consider installing it in the distribution.  Also, I want
one of those Swarm do-gooder badges I've heard so much about:). 


Anybody that has compiled Swarm can apply the patch (copy patch into
source tree and type "patch -p1 < EZGraphArg.patch") and recompile
("make") just the src/objectbase and src/analysis directories and then
"make install" in each directory.


This turned out to be much simpler than I thought at first.  I add a
method in the MessageProbe.[hm] and then methods in the EZSequence and
EZAverageSequence classes to allow them to take an argument.  I did this
with the limited intention of passing only an unsigned integer argument,
which is all I need for my purposes, but if somebody else needs to pass
something more substantial, I can work it out.  


Best of all (sound the trumpets):
none of the interface/code of EZGraph.[hm] was affected/changed at all!  


You only need to specify the argument if your selector calls for one,
otherwise forget it. 


Here's how to use it:
The argument is added by a message sent to the sequence that is returned
from one of the "create sequence" commands in EZGraph.  Here is an
example I just used to pass the value "3" along:

  sequence= [stabilityGraph createSequence: sequenceName
                            withFeedFrom: placeholder
                            andSelector: M(getMembershipLevelLag:) ];
  [sequence setUnsignedArg: 3];


This works with createAverageSequence or any of the other
"create-your-favorite-sequence" methods that exist in the modern
EZGraph.  I've tested this by grafting it onto the sss code's
createAverage graphs and it worked fine there.

I do not yet know what is necessary to make this change show up on the
Java side.  Perhaps Marcus will give me a pointer if some work is
necessary.

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700
diff -r -c swarm-2.1.26.20010110-orig/src/analysis/EZGraph.h 
swarm-2.1.26.20010110/src/analysis/EZGraph.h
*** swarm-2.1.26.20010110-orig/src/analysis/EZGraph.h   Wed May 17 13:22:14 2000
--- swarm-2.1.26.20010110/src/analysis/EZGraph.h        Wed Jan 17 14:26:02 2001
***************
*** 127,132 ****
--- 127,133 ----
  
  - setActiveOutFile: anActiveOutFile;
  - setActiveGrapher: aGrapher;
+ - setUnsignedArg: (unsigned) x;
  
  - step;
  
***************
*** 142,147 ****
  }
  
  - setAverager: anAverager;
! 
  @end
  
--- 143,148 ----
  }
  
  - setAverager: anAverager;
! - setUnsignedArg: (unsigned) x;
  @end
  
diff -r -c swarm-2.1.26.20010110-orig/src/analysis/EZGraph.m 
swarm-2.1.26.20010110/src/analysis/EZGraph.m
*** swarm-2.1.26.20010110-orig/src/analysis/EZGraph.m   Tue Oct  3 10:46:24 2000
--- swarm-2.1.26.20010110/src/analysis/EZGraph.m        Wed Jan 17 14:40:50 2001
***************
*** 502,507 ****
--- 502,514 ----
    return self;
  }
  
+ 
+ - setUnsignedArg: (unsigned) x
+ {
+   [activeGrapher setArg: 0 ToUnsigned: x];
+   return self;
+ }
+ 
  - step
  {
    if (activeGrapher)
***************
*** 521,526 ****
--- 528,535 ----
    return self;
  }
  
+ 
+ 
  - outputGraph
  {
    if (activeGrapher)
***************
*** 562,567 ****
--- 571,582 ----
    return self;
  }
  
+ - setUnsignedArg: (unsigned) x
+ {
+   [averager setArg: 0 ToUnsigned: x];
+   return self;
+ }
+ 
  - step
  {
    [averager update];
***************
*** 583,585 ****
--- 598,616 ----
  }
  
  @end 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
diff -r -c swarm-2.1.26.20010110-orig/src/analysis/analysis.h 
swarm-2.1.26.20010110/src/analysis/analysis.h
*** swarm-2.1.26.20010110-orig/src/analysis/analysis.h  Wed May 17 14:05:38 2000
--- swarm-2.1.26.20010110/src/analysis/analysis.h       Wed Jan 17 14:40:43 2001
***************
*** 273,278 ****
--- 273,297 ----
  CREATING
  SETTING
  USING
+ 
+ //M: After a sequence has been created and a selector is set, this
+ //M: method allows the user to specify a single unsigned integer argument
+ //M: that is required by the message that the selector implies.  
+ 
+ //E: For  example, suppose you have created an EZGraph called "heightGraph"
+ //E: If one has an object "dog" in which there is a method 
+ //E: - getFriendHeight: (unsigned) h; 
+ 
+ //E: And one wants to create a line to plot the 4th dog, 
+ //E: then the EZsequence can be created with a command like:
+ //E: {
+ //E: id sequence = [heightGraph createSequence: "aName"
+ //E:                            withFeedFrom: dog
+ //E:                            andSelector: M(getFriendHeight:);
+ //E: [sequence setUnsignedArg: 4];
+ //E: }   
+ - setUnsignedArg: (unsigned) x;
+ 
  @end
  
  @protocol EZAverageSequence <SwarmObject, RETURNABLE>
***************
*** 283,288 ****
--- 302,314 ----
  CREATING
  SETTING
  USING
+ 
+ //M: After an EZAverageSequence has been created and a selector is set, this
+ //M: method allows the user to specify a single unsigned integer argument
+ //M: that is required by the message that the selector implies. See EZSequence
+ //M: documentation for an example usage.
+ - setUnsignedArg: (unsigned) x;
+ 
  @end
  
  
diff -r -c swarm-2.1.26.20010110-orig/src/objectbase/MessageProbe.h 
swarm-2.1.26.20010110/src/objectbase/MessageProbe.h
*** swarm-2.1.26.20010110-orig/src/objectbase/MessageProbe.h    Sun Jul  2 
14:26:53 2000
--- swarm-2.1.26.20010110/src/objectbase/MessageProbe.h Wed Jan 17 08:04:44 2001
***************
*** 19,24 ****
--- 19,25 ----
  
  - (const char *)getProbedMessage;
  - (int)getArgCount;
+ - setArg: (int) which ToUnsigned: (unsigned) x;
  - setArg: (int)which ToString: (const char *)str;
  - (val_t)getArg: (int)which;
  - (const char *)getArgName: (int)which;
diff -r -c swarm-2.1.26.20010110-orig/src/objectbase/MessageProbe.m 
swarm-2.1.26.20010110/src/objectbase/MessageProbe.m
*** swarm-2.1.26.20010110-orig/src/objectbase/MessageProbe.m    Wed Sep 13 
19:46:48 2000
--- swarm-2.1.26.20010110/src/objectbase/MessageProbe.m Wed Jan 17 08:04:49 2001
***************
*** 136,141 ****
--- 136,148 ----
    return arguments[which];
  }
  
+ - setArg: (int) which ToUnsigned: (unsigned) x
+ {
+   arguments[which].type = _C_UINT;
+   arguments[which].val.uint =  x ;
+   return self;
+ }
+ 
  - setArg: (int)which ToString: (const char *)what
  {
    switch (nth_type (probedType, which))
diff -r -c swarm-2.1.26.20010110-orig/src/objectbase/objectbase.h 
swarm-2.1.26.20010110/src/objectbase/objectbase.h
*** swarm-2.1.26.20010110-orig/src/objectbase/objectbase.h      Sat Oct 14 
14:40:22 2000
--- swarm-2.1.26.20010110/src/objectbase/objectbase.h   Wed Jan 17 08:13:54 2001
***************
*** 280,285 ****
--- 280,293 ----
  //M: The argument must be provided in string form.
  - setArg: (int)which ToString: (const char *)what;
  
+ 
+ //M: The setArg:ToUnsigned: method sets the nth argument of the message 
+ //M: used by the probe to an unsigned integer value.  The user is 
+ //M: responsible for matching the unsigned integer type of this 
+ //M: argument with the argument type of the method being probed.  
+ 
+ - setArg: (int) which ToUnsigned: (unsigned) x;
+ 
  //M: The dynamicCallOn: method generates a dynamic message call on the target
  //M: object. 
  - (val_t)dynamicCallOn: target;

reply via email to

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