swarm-support
[Top][All Lists]
Advanced

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

Re: variable order in probe displays


From: Manor Askenazi
Subject: Re: variable order in probe displays
Date: Wed, 18 Dec 1996 00:23:50 -0700

   I seem to recall from a while back that someone wanted probe displays to
   display their variables in the order specified by the programmer rather than
   in a sorted (alphabetical) order.

   Was there a solution to this problem, and if so, what was it?


   --Sven

If you run heatbugs you will see that, for example, the HeatbugModelSwarm
probe shows the variables in alphabetical order but if you get the 
CompleteProbe for HeatbugModelSwarm (by rightClicking on the classname),
you will see that the variables (and methods) appear in the order they
were declared.

The inconsistency is due to an oversight on my part: any probemaps created
by the system will follow the declaration order (a feature requested by
the users) but ironically, the probemaps created by the users themselves
get alphabetised. To get around that you will need to install the following
simple patch. Replace ..whatever../swarm/src/swarmobject/EmptyProbeMap.m
with:

==========================================================================

// Swarm library. Copyright (C) 1996 Santa Fe Institute.
// This library is distributed without any warranty; without even the
// implied warranty of merchantability or fitness for a particular purpose.
// See file LICENSE for details and terms of copying.

#define __USE_FIXED_PROTOTYPES__  // for gcc headers
#include <stdio.h>
#import <swarmobject/EmptyProbeMap.h>

// SAFEPROBES enables lots of error checking here.
#define SAFEPROBES 1

//Used in order to ensure that probemaps do not reorder their contents 
//alphabetically...

static int p_compare(id a, id b){
  if(!([a compare: b]))
    return 0 ;
  else
    return -1 ;
}

@implementation EmptyProbeMap

-createEnd {
  if (SAFEPROBES) {
    if (probedClass == 0) {
      fprintf(stderr, "ProbeMap object was not properly initialized\n");
      return nil;
    }
  }

  probes = [Map createBegin: [self getZone]] ;
  [probes setCompareFunction: &p_compare] ;
  probes = [probes createEnd] ;

  if (probes == nil)
    return nil;

  numEntries = 0 ;
 
  return self ;
}

==========================================================================

Sorry about that,

Manor.


reply via email to

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