Coderack
This page describes the organizational forces that limit change.  It explains how to overcome them when necessary. 

Power& tradition holding back progress
This page uses an example to illustrate how:
  • A business can gain focus from targeting key customers,
  • Business planning activities performed by the whole organization can build awareness, empowerment and coherence. 
  • A program approach can ensure strategic alignment. 
Be responsive to market dynamics
This page uses the example of HP's printer organization freeing itself from its organizational constraints to sell a printer targeted at the IBM pc user. 
The constraints are described. 
The techniques to overcome them are implied. 
Overcome reactionaries
Primary Navigation

Agent infrastructure for Copycat

Summary
This page describes the
This page discusses the interdependence of perception and representation in a complex adaptive system (CAS).  Hofstadter and Mitchell's research with Copycat is reviewed. 
Copycat
Coderack. 
The details of the codelet architecture are described
The specialized use of the Coderack by the adaptive web framework's (AWF) Smiley is discussed
The codelet scheduling mechanism is discussed
A variety of Smiley extensions to the Coderack are reviewed
The Coderack infrastructure functions are included
Introduction
Smiley, an
This page describes the Adaptive Web framework (AWF) test system and the agent programming framework (Smiley) that supports its operation. 
Example test system statements are included.  To begin a test a test statement is loaded into Smiley while Smiley executes on the Perl interpreter. 
Part of Smiley's Perl code focused on setting up the infrastructure is included bellow. 
The setup includes:
  • Loading the 'Meta file' specification,
  • Initializing the Slipnet, and Workspaces and loading them
  • So that the Coderack can be called. 
The Coderack, which is the focus of a separate page of the Perl frame then schedules and runs the codelets that are invoked by the test statement structures. 
agent programming framework
, needs a mechanism to instantiate its
Plans are interpreted and implemented by agents.  This page discusses the properties of agents in a complex adaptive system (CAS). 
It then presents examples of agents in different CAS.  The examples include a computer program where modeling and actions are performed by software agents.  These software agents are aggregates. 
The participation of agents in flows is introduced and some implications of this are outlined. 
agents
.  To do this we 'repurposed' and extended (*) the Coderack from Douglas Hofstadter & Melanie Mitchell's
This page discusses the interdependence of perception and representation in a complex adaptive system (CAS).  Hofstadter and Mitchell's research with Copycat is reviewed. 
perception & representation
architecture Copycat. 

Copycat, requires an infrastructure to enforce the partitioning of computation, enabling the progress of each codelet to be associated with strategic priorities,
The complex adaptive system (CAS) nature of a value delivery system is first introduced.  It's a network of agents acting as relays. 

The critical nature of hub agents and the difficulty of altering an aligned network is reviewed. 

The nature of and exceptional opportunities created by platforms are discussed. 

Finally an example of aligning a VDS is presented. 
environmental
pressures and
This page discusses the impact of random events which once they occur encourage a particular direction forward for a complex adaptive system (CAS). 
chance


Smiley's analogous infrastructure and codelets (functions) are architected to:

The agent infrastructure is called the Coderack in Copycat and its agents are codelets.  Smiley extends the Copycat architecture with the
Agents use sensors to detect events in their environment.  This page reviews how these events become signals associated with beneficial responses in a complex adaptive system (CAS).  CAS signals emerge from the Darwinian information model.  Signals can indicate decision summaries and level of uncertainty. 
association
of
Plans emerge in complex adaptive systems (CAS) to provide the instructions that agents use to perform actions.  The component architecture and structure of the plans is reviewed. 
schematic
Workspace structures and
This page describes the Smiley infrastructure and codelets that instantiate the epiphenomena defined in the Meta file and Slipnet. 
Infrastructure sensors are introduced. 
The role of phenomena in shaping the environment is discussed. 
The focusing of forces by phenomena in Smiley is discussed. 
The Meta file association of case keywords with phenomena is included. 
The codelets and supporting functions are included. 
phenomena
, via associative
This page describes the Smiley infrastructure that supports the associative binding of schematic strings to codelets defined in the Meta file and Slipnet. 
The infrastructure supporting the associations is introduced. 
The role of Jeff Hawkins neocortical attributes is discussed. 
Relevant Slipnet configurations are included. 
The codelets and supporting functions are included. 
label spaces
, so the infrastructure can support the emergence of full
This page introduces the complex adaptive system (CAS) theory frame.  The theory is positioned relative to the natural sciences.  It catalogs the laws and strategies which underpin the operation of systems that are based on the interaction of emergent agents. 
John Holland's framework for representing complexity is outlined.  Links to other key aspects of CAS theory discussed at the site are presented. 
complex adaptive system
(CAS)
Plans are interpreted and implemented by agents.  This page discusses the properties of agents in a complex adaptive system (CAS). 
It then presents examples of agents in different CAS.  The examples include a computer program where modeling and actions are performed by software agents.  These software agents are aggregates. 
The participation of agents in flows is introduced and some implications of this are outlined. 
agents
*. 
This page discusses how a Smiley based application the event processor test program's operational phase is structured. 
The goals of the event processor test application are described. 
The implementation strategy is outlined. 
Synchronization of Smiley setup completion and operation phase initiation is discussed. 
The association of structural Workspaces for state representation is discussed. 
An application specific codelet merge streams assert responds to the nature of the assertion.  It does not have an emergent structure.  Instead it reflects software engineering practice.  It includes:
  • Merge stream case specific
    • Modeling with sub-programs
    • Resolving of case
  • Non case assertion
The operation is setup, inhibited, initiated, and managed by iterative phase check-pointing provided by Smiley codelets. 
Schematic synchronization of parallel codelet cascades is performed structurally. 
The assert merge operon cascade is included. 
The Slipnet concept network for merge streams is included. 
The codelets and supporting functions are included. 
Schematic assert merge
is an example of an agent that
This page discusses the mechanisms and effects of emergence underpinning any complex adaptive system (CAS).  Key research is reviewed. 
emerges
from the interactions of various codelets under aggregate
Plans emerge in complex adaptive systems (CAS) to provide the instructions that agents use to perform actions.  The component architecture and structure of the plans is reviewed. 
schematic
control. 

Scheduling of codelets in Copycat
Scheduling of codelets in Copycat is based on their instantaneous salience, Douglas Hofstadter controlled the amount of attention a Workspace object in Copycat would receive from codelets via its salience.  The more descriptions, analogous to geons, an object has and the more highly activated the nodes involved therin, the more important the object is.  Modulating this tendency is any relative lack of connections from the object to the rest of the objects in the Workspace.  Salience is a dynamic number that takes into account both these factors.  In Smiley the instantaneous salience of a Workspace's objects is calculated by itsalience.  .  The higher the salience the more statistically likely they are to be selected to run by the Coderack.   The Smiley implementation of the Coderack includes infrastructure for generating instantaneous salience based on assessments of Workspace and
This page describes the Copycat Slipnet. 
The goal of the Slipnet is reviewed. 
Smiley's specialized use of the Slipnet is introduced. 
The initial Slipnet network used by the 'Merge Streams' and 'Virtual Robot' agent-based applications is setup in initchemistry and is included. 
The Slipnet infrastructure and initialization functions are included. 
Slipnet
: strengths, happiness, temperature, and concept activation.  As codelet builders perform actions these may change the basis of the salience assessments. 

The Smiley Coderack implementation generates the system's bottom up scout codelets, and at the behest of the Slipnet its top down scout codelets.  The bottom up scouts search the active Workspaces looking for local structures which match their context independent models.  The top down scouts extend patterns and focus on concepts in their models and mode of scheduling. 

In effect the Coderack transforms the available central processing power through codelet activity into physical effects analogous to the strong, weak and electromagnetic forces of nature.  The scouts use Smiley's salience, Douglas Hofstadter controlled the amount of attention a Workspace object in Copycat would receive from codelets via its salience.  The more descriptions, analogous to geons, an object has and the more highly activated the nodes involved therin, the more important the object is.  Modulating this tendency is any relative lack of connections from the object to the rest of the objects in the Workspace.  Salience is a dynamic number that takes into account both these factors.  In Smiley the instantaneous salience of a Workspace's objects is calculated by itsalience.   infrastructure (selsalwsitem, salsnlnc) to search for high priority objects to evaluate and potentially build descriptions, bonds and groups, which then affect the salience! 
Smiley Coderack extensions
In a Smiley extension
This page describes the adaptive web framework (AWF) Smiley agent progamming infrastructure's codelet based Copycat grouping operation. 
The requirements needed for a group to complete are described. 
The association of group completion with a Slipnet defined operon is described.  Either actions or signals result from the association. 
How a generated signal is transported to the nucleus of the cell and matched with an operon is described. 
A match with an operon can result in deployment of a schematic string to the original Workspace.  But eventually the deployed string will be destroyed. 
Smiley infrastructure amplification of the group completion operation is introduced.  This includes facilities to inhibit crowding out of offspring. 
A test file awfart04 is included. 
The group codelet and supporting functions are included. 
group completion
* uses the label space to associate schematic structures with phenomena, including queuing new instances of any codelets, which are defined as part of the phenomena in the Slipnet, for the Coderack to select and run

The Smiley Coderack provides extension infrastructure to support sub-programs*.  Sub-programs must access their own environment, rather than those of another sub-program operating on another Workspace structure.  The extensions introduce:
  • Context initiation and completion with getcontext and clogstatx. 
  • Role-in and role-out of key descriptors.  

The Smiley Coderack includes codelet evaluator shells* (icsevaluator & icsrioevaluator) which allow standardized methods of performing feature inversions. 

The Smiley Coderack also imposes competitive pressure by
This page discusses the tagging of signals in a complex adaptive system (CAS).  Tagged signals can be used to control filtering of an event stream.  Examples of CAS filters are reviewed. 
filtering
on urgency and age & hence limiting the total number of codelets that can exist. 
 

Functions

#<!-- start tag ds -resweb -->
#<!-- start tag sca -->
#
sub itstrengths {
    my($kwp, $kwpr, $sactset)=@_;
    my ($i, $ai, $ikwp, $akwp);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("itstrengths kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# Strength indicates structures that align well with bonds based on deep concepts
#
#
# updated for merged workspaces

    $akwp = awsoadr ($kwp);
# move the kwp out of the inactive histone
    if (($Awfif::wsol-> {l}[$akwp][ $Awfif::memes-> {wsohistbp}] != 0) #*** submacrok ***#
    && ($Awfif::histonel-> {l} [$Awfif::wsol-> {l}[$akwp][ $Awfif::memes-> {wsohistbp}]] [2] == 1)) {#*** submacrok ***#

      $ikwp = nextihistone ($kwp, \$akwp);
      }#if
    else {

      $ikwp = $kwp;
      };#else
# look at each object in the active workspace
    $i = $kwpr;
    $ai = awsoadr ($i);
    while (( $ai != 0) && ($i != $ikwp)) {
# $Awfif::memes-> {time} [$Awfif::memes-> {sttime}] [$Awfif::memes-> {starttime}] = time ();

      if (($Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsohistbp}] != 0) #*** submacrok ***#
      && ($Awfif::histonel-> {l} [
        $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsohistbp}]#*** submacrok ***#
          ] [2] == 1)) {#ignore this inactive histone

        $Awfif::wsol-> {l} [$ai][7] = 0;#object's strength
        $i = nextihistone ($i, \$ai);
        }#if
# itstrengthsbf
      elsif (($Awfif::memes-> {activationchange} [$Awfif::memes-> {currentwsbi}] == 1) && (checkwsbf ($ai, 23) == 1)) {
# $Awfif::wsol-> {l} [ $ai][7] already set

        $i = trwsoadr ($i, 1);
        }#elsif
      else {

        $Awfif::wsol-> {l} [ $ai][7] = strengthstructs ($i, $kwp, $kwpr);#object's strength
        $i = trwsoadr ($i, 1);
        };#else
      $ai = awsoadr ($i);
      }# for -> while

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("itstrengths\n");
      };
    }# itstrengths
#
#<!-- end tag ds -->
#
sub ittemperature {
    my($kwp, $kwpr, $sactset)=@_;
    my ($i, $ai, $temp, $ikwp, $akwp);
# Instantaneous temperature aims to reflect how integrated the workspace is.
# Logic seems good. If no bonds are being formed exothermically then energy
# will stay free
# in the environment. As structures are bonded together free energy will drop
# Unhappiness in copycat indicates a concept that is not involved in many bonds
# Strength indicates structures that align well with bonds based on deep concepts
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {tracetemp}) {
      print ("ittemperature kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
#
#
# updated for merged workspaces

    $ai = awsoadr ($kwpr);
    $akwp = awsoadr ($kwp);
# move the kwp out of the inactive histone
    if (($Awfif::wsol-> {l}[$akwp][ $Awfif::memes-> {wsohistbp}] != 0) #*** submacrok ***#
    && ($Awfif::histonel-> {l} [$Awfif::wsol-> {l}[$akwp][ $Awfif::memes-> {wsohistbp}]] [2] == 1)) {#*** submacrok ***#

      $ikwp = nextihistone ($kwp, \$akwp);
      }#if
    else {

      $ikwp = $kwp;
      };#else
    if ($Awfif::wsol-> {l} [$ai][6] - $Awfif::wsol-> {l} [$ai][7] > 0) {
      $temp = $Awfif::wsol-> {l} [$ai][6] - $Awfif::wsol-> {l} [$ai][7];
      };
# look at each object in the active workspace
    $i = trwsoadr($kwpr, 1);
    $ai = awsoadr ($i);
    while (($i != 0) && ($i != $ikwp)) {
      if (($Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsohistbp}] != 0) #*** submacrok ***#
      && ($Awfif::histonel-> {l} [
        $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsohistbp}]#*** submacrok ***#
          ] [2] == 1)) {#ignore this inactive histone
        $i = nextihistone ($i, \$ai);
        }#if
      else {
        if ($Awfif::wsol-> {l} [$ai][6] - $Awfif::wsol-> {l} [$ai][7] > 0) {
          $temp = ($temp + $Awfif::wsol-> {l} [$ai][6] - $Awfif::wsol-> {l} [$ai][7])/2;
          };
        $i = trwsoadr($i, 1);
        };#else
      $ai = awsoadr ($i);
      }# for ->
# The temperature calculation is failing currently
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {tracetemp}) {
      my ($pr);
      $pr = $Awfif::memes->{temp} [$Awfif::memes-> {currentwsbi}];
      print ("ittemperaturex $pr \n");
      };
    }# ittemperature
#
#<!-- end tag sca -->
#<!-- start tag uts -->
#
sub itwsoutput {
    my($ikwp, $ikwpr, $iws)=@_;
    my ($kwp, $kwpr, $i, $ai, $i2, $i3, $sal, $cwsbi, $cwsi, $str, $vs, $ve, $offset, $rel0, $traces);
# Instantaneous workspace output aims to compactly list the current workspace.
#
# updated for merged workspaces
# should always start from the workspaces list tail. If this is not the kwpr
# then should silently iterate from the list tail to the kwp and then output
# process from there.
#

    if (checkscalar (@_)) {#
    $traces = $Awfif::memes-> {trace};
# turn off tracing inside of this procedure
    $Awfif::memes-> {trace} = 0;
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    if ((defined ($iws))
    ){
      $Awfif::memes-> {currentwsbi} = $iws;
      $cwsbi = $cwsi;
      $cwsi = $iws;
      };#if
    if (($ikwp eq 'eos')) {

      if ((defined($ikwpr)) && (($ikwpr < 0))) {
        my ($i5, $i6);
        $i6 = 0;
        for ($i5 = $Awfif::wsbl-> {wsoh}[$Awfif::memes-> {currentwsbi}]; ($i6 < (-$ikwpr)) ; $i5 = trwsoadr ($i5, -1) ) {
          $i6++;
          $kwpr = $i5;
          };
        $kwp = 0;
        }# if
      else {
        $kwpr = $Awfif::wsbl-> {wsoh}[$Awfif::memes-> {currentwsbi}];
        $kwp = 0;
        };#else
      }#if
    elsif ((defined($ikwp)) && (!defined($ikwpr))) {

      $kwpr = $ikwp;
      $kwp = $Awfif::wsol-> {l}[awsoadr ($ikwp)][ $Awfif::memes-> {wsonext}];#*** submacrok ***#
      if ($kwp != 0) {

        $kwp = $Awfif::wsol-> {l}[awsoadr ($kwp)][ $Awfif::memes-> {wsonext}];#*** submacrok ***#
        };
      }#elsif
    else {

      if ((defined($ikwpr)) && (($ikwpr < 0))) {
        my ($i5, $i6);
        $i6 = 0;
        for ($i5 = $ikwp; ($i6 < (-$ikwpr)) ; $i5 = trwsoadr ($i5, -1) ) {
          $i6++;
          $kwpr = $i5;
          };
        $kwp = $ikwp;
        }# if
      else {
        $kwpr = $ikwpr;
        $kwp = $ikwp;
        };#else
      };
    $offset = 1;
    $rel0 = '';
    if (!$Awfif::wsbl->{wsas}[$Awfif::memes-> {currentwsbi}]) {# if the ws is setup without sentinals then the wsoh must be offset

      $offset = 2;
      };
# first find the start from the tail - The operator may have done something dumb
    $i = $Awfif::wsbl->{wsot}[$Awfif::memes-> {currentwsbi}];
    $ai = awsoadr ($i);
    $vs = '';
    $ve = '';
    while (($ai != 0)
    && ((!$vs) or (!$ve))
    && ($i != ($Awfif::wsol-> {l}[($Awfif::wsbl-> {l} [$Awfif::memes-> {currentwsbi}][2] + $Awfif::wsbl-> {wsoh} [$Awfif::memes-> {currentwsbi}]) ][ $Awfif::memes-> {wsonext}] ))) {#*** submacrok ***#
      if (($i == $kwp) or ($kwp == 0)) {

        $ve = 't';
        };
      if (($i == $kwpr)) {

        $vs = 't';
        };
      $i = trwsoadr($i, 1);
      if (($i == 0) && ($rel0)) {

        $ai = 0;}
      else {

        if ($i == 0) {

          $rel0 = 't';
          };
        $ai = awsoadr ($i);
        };
      };#while - validate request

    if (($vs) && ($ve)) {#ok to proceed
    $i = $kwpr;
    $ai = awsoadr ($i);

    while (($ai != 0) && ($i != $kwp)) {
      $i2 = getwsost4 ($i);
      print ("wso [$i] $i2");
      $Awfif::memes-> {currentwsbi} = $cwsi;
# count of usage

      if ($Awfif::wsohist-> {l}[checkwsmd ($ai, $Awfif::memes-> {wsologaei})][3] > 0) {
        $i2 = checkwsmd ($ai, $Awfif::memes-> {wsologaei});
        print (" #[$Awfif::wsohist->{l}[$i2][3]] ");
        }
# itwsoutputhbu1

      if ((checkwsmd ($ai, $Awfif::memes-> {wsohistbp}) != 0) ) {#ignore this inactive histone
        my ($pr);
        if ($Awfif::histonel-> {l} [checkwsmd ($ai, $Awfif::memes-> {wsohistbp})] [2] == 1) {#inactive histone
          $pr = 'iHn ';
          }
        else {
          $pr = 'Hn ';
          };
        print (" $pr");
        };#histone
      $sal = $Awfif::wsol-> {l} [$ai][5] + $Awfif::wsol-> {l} [$ai][6];
      print (" sal $sal");
      $str = $Awfif::wsol-> {l} [$ai][7];
      print (" strth $str");
      $str = $Awfif::wsol-> {l} [$ai][6] - $Awfif::wsol-> {l} [$ai][7];

      if ($str < 0) {$str = 0};# it temperature has a lower bound of 0
      print (" temp $str");
# meta keywords have to be treated specially - Different meaning to wsol->{l}[2] - They are in ws 1
      if ($Awfif::memes-> {currentwsbi} == $Awfif::memes-> {kwwsbi}) {#handle differently
        $i2 = 0;
        }
      else {#standard method of deploying keyword attributes
        $i2 = $Awfif::wsol-> {l}[$ai][2];
        };

      while ($i2 != 0) {# look at each object in the active workspace
        if ($Awfif::workspace-> {l}[$i2][2] <= $Awfif::memes-> {snnh}{wsi}) {
          print (" dr [$i2][2] $Awfif::memes->{snnih}{$Awfif::workspace->{l}[$i2][2]}");
          }#if
        else {

          $i3 = ($Awfif::workspace-> {l} [$i2] [2] - $Awfif::memes-> {snnh} {wsi});
          print (" dr [$i2][2] $i3");
          };
        if ($Awfif::workspace-> {l}[$i2][8] == $Awfif::memes-> {snnh}{iterator}) {

          if ($Awfif::workspace-> {l}[$i2][9] <= $Awfif::memes-> {snnh}{wsi}) {

            print (" [9] $Awfif::workspace->{l}[$i2][9]");
            }#if
          else {

            $i3 = ($Awfif::workspace-> {l} [$i2] [9] - $Awfif::memes-> {snnh} {wsi});
            print (" [9] $i3");
            };#else
          };#if
        print (" [3] $Awfif::memes->{snnih}{$Awfif::workspace->{l}[$i2][3]}");
        print (" [4] $Awfif::memes->{snnih}{$Awfif::workspace->{l}[$i2][4]}");
        $i2 = $Awfif::workspace-> {l}[$i2][0];
        }# for
      print ("\n");

      $i = trwsoadr($i, 1);
      if (($i == 0) && ($rel0)) { $ai = 0;}
      else {
        $ai = awsoadr ($i);
        };
      }# for -> while
      }# valid request
    else {
      print ("invalid request kwp ($ve) kwpr ($vs) \n");
      };
    if ((defined ($iws))
    ){
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      };#if
# restore tracing
    $Awfif::memes-> {trace} = $traces;
    };#scalar param
    }# itwsoutput
#<!-- end tag uts -->
#
sub getwsost4 {
    my($wsoid)=@_;
    my ($cai20, $i2, $cwsi, $string, $ai2, $loopcount);
# find the wso item 4 that is the head of this chain.

    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    $i2 = $wsoid;
    $ai2 = awsoadr($i2);
    if ( ($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsopkpos}] != 0) #*** submacrok ***#
    && ($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsopkwsi}] != 0) #*** submacrok ***#
    ){#can use fast hash

      $Awfif::memes-> {currentwsbi} = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsopkwsi}]; #*** submacrok ***#
      $ai2 = awsoadr ($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsopkpos}]); #*** submacrok ***#
      }
    else {

      $loopcount = 0;
      while (($Awfif::wsol-> {l}[ $ai2][4] eq "")
      && ($ai2 != 0)
      && (
      (!$Awfif::memes-> {loopcheck})
      or ($loopcount++ < $Awfif::memes-> {loopth}))
    ) {
# tricky need to access the data for next i2 in current ws but also switch to the next ws

      $cai20 = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobkwl}]; #*** submacrok ***#
      if (($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobws}] != $Awfif::memes-> {currentwsbi})) {#*** submacrok ***# #need to change the ws to follow the chain
        $Awfif::memes-> {currentwsbi} = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobws}]; #*** submacrok ***#
        };
      $i2 = $cai20;
      $ai2 = awsoadr($i2);
      };
    };#else cant use hash

    $string = $Awfif::wsol->{l}[$ai2][4];

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    return $string
    }# getwsost4
#
sub getwsopkw {
    my($wsoid, $wsi, $more)=@_;
    my ($cai20, $i2, $cwsi, $pkw, $ai2, $i3, $found, $inseries, $completew);
# find the wso that is the primary for this chain. Could be head or the hname token holder

    $inseries = '';
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    if (defined ($$wsi)) {
      $Awfif::memes-> {currentwsbi} = $$wsi;
      };#if
    if (defined ($$more)) {
      $inseries = 't';
      };
    $$more = 0;#assume there is only one kw
    $i2 = $wsoid;
    $ai2 = awsoadr($i2);
    if ((!$inseries)
    && ($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsopkpos}] != 0) #*** submacrok ***#
    && ($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsopkwsi}] != 0) #*** submacrok ***#
    ){#can use fast hash

      $Awfif::memes-> {currentwsbi} = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsopkwsi}]; #*** submacrok ***#
      $ai2 = awsoadr (($i2 = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsopkpos}])); #*** submacrok ***#
# now to be consistant with the rest of the routine that is checking for a wso with an hname ref descending to the first item if none is found want to skip back up to the top of the linked set in this ws.
      while (($Awfif::memes-> {currentwsbi} == 1)
      && ($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsofws}] == $Awfif::memes-> {currentwsbi}) #*** submacrok ***#
      && ($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsofkwl}] != 0) #*** submacrok ***#
      ) {

        $ai2 = awsoadr (($i2 = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsofkwl}])); #*** submacrok ***#
        };#while
      }#if

    $completew = '';
    while (($Awfif::wsol-> {l}[ $ai2][3] == 0) #assumes meta declarations still use original format of tokens
    && (!$completew)) {
# tricky need to access the data for next i2 in current ws but also switch to the next ws

      $cai20 = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobkwl}]; #*** submacrok ***#
      if (($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobws}] != $Awfif::memes-> {currentwsbi})) {#*** submacrok ***# #need to change the ws to follow the chain
        $Awfif::memes-> {currentwsbi} = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobws}]; #*** submacrok ***#
        };
      if ($cai20 == 0) {
        $completew = 't';
        }#if
      else {
        $i2 = $cai20;
        $ai2 = awsoadr($i2);
        };#else
      };
# at the high end of the set of declarations of this keyword want one with hname
# or failing that the first one in the set
    if ( $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobkwl}] == 0) { #*** submacrok ***# #this is the head of the chain

      $pkw = $i2;
      $$wsi = $Awfif::memes-> {currentwsbi};
      $found = 't';
      }
    else {

# is there a match for hname in the set of tokens for this wso?
      $found = '';
      do {
        for ($i3 = $Awfif::wsol->{l}[$ai2][2]; (($i3 < ($Awfif::wsol->{l}[$ai2][2] + $Awfif::wsol->{l}[$ai2][3])) && (!$found)); $i3++) {
          if ($Awfif::memes->{keywordl}[$i3] eq $Awfif::symbolsets-> {meta} {'hname'}) {

            $pkw = $i2;
            $found = 't';
            $$wsi = $Awfif::memes-> {currentwsbi};

            $$more = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobkwl}];#*** submacrok ***#
            };#if
          }; #for
        if (!$found) {

          $cai20 = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobkwl}]; #*** submacrok ***#

          if (($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobws}] != $Awfif::memes-> {currentwsbi})) { #*** submacrok ***# #need to change the ws to follow the chain
            $Awfif::memes-> {currentwsbi} = $Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobws}]; #*** submacrok ***#
            };
          $i2 = $cai20;
          $ai2 = awsoadr($i2);
          if ($Awfif::wsol-> {l}[$ai2][ $Awfif::memes-> {wsobkwl}] == 0) { #*** submacrok ***#

            $found = 't';
            $pkw = $i2;
            $$wsi = $Awfif::memes-> {currentwsbi};
            };
          };#if not found
        }#do
      while (!$found);#do while
      };#else not end of chain

    $Awfif::memes-> {currentwsbi} = $cwsi;
    return $pkw
    }# getwsopkw
#
#<!-- start tag dli -->
#<!-- start tag sca -->
#
sub matchitokwkw {
    my($myli, $ws, $wsoid)=@_;
    my ($i2, $tkws, $cwsi, $awsoid, $i3, $found, $pws, $pwsoid, $apwsoid, $cws, $ckwb, $ckwe, $match, $nomatch, $conforms);
# match the wsoid tokens with the indirectly described tokens (actually schematic keyword equivalents)

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchitokwkw myli $myli ws $ws wsoid $wsoid ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    $Awfif::memes-> {currentwsbi} = $ws;
    $awsoid = awsoadr ($wsoid);
    $pws = $Awfif::wsol-> {l}[$awsoid][ $Awfif::memes-> {wsopkwsi}];#*** submacrok ***#
    $pwsoid = $Awfif::wsol-> {l}[$awsoid][ $Awfif::memes-> {wsopkpos}];#*** submacrok ***#
# now get the context info for this codelet

    $cws = $Awfif::codelet-> {l} [$myli] [20];
    $Awfif::memes-> {currentwsbi} = $cws;
    $ckwb = trwsoadr ($Awfif::codelet-> {l} [$myli] [21], 2);
    $ckwe = $Awfif::codelet-> {l} [$myli] [22];
# check there is a match for every token defined in the context
    $nomatch = '';
    for ($i2 = $ckwb; (($i2 != $ckwe) && (!$nomatch) && (!chmdefis ($myli, $i2, $Awfif::memes-> {snnh}{sloc}, \$conforms))); $i2 = trwsoadr ($i2,1)) {

# move into the primary keywords workspace

      $Awfif::memes-> {currentwsbi} = $pws;
      $apwsoid = awsoadr ($pwsoid);
      $match = '';
      for ($i3 = $Awfif::wsol->{l}[$apwsoid][2]; (($i3 < ($Awfif::wsol->{l}[$apwsoid][2] + $Awfif::wsol->{l}[$apwsoid][3])) && (!$match)); $i3++) {
        if ($Awfif::memes->{keywordl}[$i3] eq $Awfif::symbolsets-> {meta} {$tkws}) {

          $match = 't';
          }#if
# matchitokwkhisu1
        elsif ( ($Awfif::symbolsets-> {meta} {$tkws} eq 'tthistonet')
        && (checkwsmd ($awsoid, $Awfif::memes-> {wsohistbp}) != 0)
        ) {#special case to match the start of a histone

          $match = 't';
          };#elsif
        }; #for
# only proceed if there was a match
      if (!$match) {

        $nomatch = 't';
        };
# switch back to the codelets context workspace to get the next item
      $Awfif::memes-> {currentwsbi} = $cws;
      }; #for
    $found = !$nomatch;

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("matchitokwkwx ret ($found)\n");
      };
    return $found
    }# matchitokwkw
#
#<!-- end tag sca -->
#<!-- end tag dli -->
#
sub getcontainedkwi {
    my($myli, $ws, $wsoid, $ccount)=@_;
    my ($cwsi, $i2, $awsoid, @contained, $pws, $pwsoid);
# given a wsoid find its f1 children in the metafile schema

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getcontainedkwi myli $myli ws $ws wsoid $wsoid ");
      };
    $$ccount = 0;
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    $Awfif::memes-> {currentwsbi} = $ws;
    $awsoid = awsoadr ($wsoid);
# from the wso can look up its primary description in the meta schema

    $pws = $Awfif::wsol-> {l}[$awsoid][ $Awfif::memes-> {wsopkwsi}];#*** submacrok ***#
    $pwsoid = $Awfif::wsol-> {l}[$awsoid][ $Awfif::memes-> {wsopkpos}];#*** submacrok ***#
    $Awfif::memes-> {currentwsbi} = $pws;
    for ($i2 = trwsoadr ($pwsoid,1);
    (($i2 != 0) && (!foundmskwend ($myli, $pws, $pwsoid, $i2)));
    $i2 = nextmskwchild ($myli, $pws, $i2)) {
      $contained [$$ccount++] = $i2;
      }; #for

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getcontainedkwix ret (@contained)\n");
      };
    return @contained
    }# getcontainedkwi
#
sub foundmskwend {
    my($myli, $ws, $pwsoid, $wsoid)=@_;
    my ($found, $string, $cwsi);
# given a wsoid find its f1 children in the metafile schema

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("foundmskwend myli $myli ws $ws pwsoid $pwsoid wsoid $wsoid ");
      };
    $found = '';
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    $Awfif::memes-> {currentwsbi} = $ws;
# from the wso can look up its primary description in the meta schema

    $string = '/' . getwsost4 ($pwsoid);
    if ($string eq getwsost4 ($wsoid)) {
      $found = 't';
      };
    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("foundmskwendx ret ($found)\n");
      };
    return $found
    }# foundmskwend
#
sub nextmskwchild {
    my($myli, $pws, $wsoid)=@_;
    my ($awsoid, $nwsoid, $anwsoid, $cbegins, $cstarts, $cwsi);
# given a wsoid identify where it terminates and respond with the wso after its end
# a wso will be within a certain number of begins and starts
# if the next wso has more begins wsol [i] [21] skip it until number of begins matches current
# if the next wso has more starts wsol [i] [22] skip it until number of starts matches current
# if the next wso has the same number of begins and starts it should be the terminal of this. return the next wso

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("nextmskwchild myli $myli pws $pws wsoid $wsoid ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    $Awfif::memes-> {currentwsbi} = $pws;
# from the wso can look up its primary description in the meta schema

    $awsoid = awsoadr($wsoid);
    $cbegins = $Awfif::wsol-> {l}[$awsoid][ $Awfif::memes-> {wsocbegins}];#*** submacrok ***#
    $cstarts = $Awfif::wsol-> {l}[$awsoid][ $Awfif::memes-> {wsocstarts}];#*** submacrok ***#
    $nwsoid = trwsoadr ($wsoid, 1);
    $anwsoid = awsoadr($nwsoid);
    while (($nwsoid != 0)
    && ($Awfif::wsol-> {l}[$anwsoid][ $Awfif::memes-> {wsocbegins}] >= $cbegins)#*** submacrok ***#
    && ($Awfif::wsol-> {l}[$anwsoid][ $Awfif::memes-> {wsocstarts}] > $cstarts)) {#*** submacrok ***#

      $nwsoid = trwsoadr ($nwsoid, 1);
      $anwsoid = awsoadr($nwsoid);
      };#while
    if ($Awfif::wsol-> {l} [$anwsoid] [4] eq ('/'.$Awfif::wsol-> {l} [$awsoid] [4])) {

      $nwsoid = trwsoadr ($nwsoid, 1);
      };#cluge to differentiate a two-part start-stop from a singleton
    $Awfif::memes-> {currentwsbi} = $cwsi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("nextmskwchildx ret ($nwsoid)\n");
      };
    return $nwsoid
    }# nextmskwchild
#
#<!-- start tag aso -->
#
sub depcdesc {
    my($myli, $stwso, $waitoneval, $sactset)=@_;
    my ($cwsi, $kwp, $kwpr);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("depcdesc myli $myli stwso($stwso) ");
      if (defined ($waitoneval)) {
        my ($pr);
        $pr = $Awfif::memes-> {snnih}{$waitoneval};
        print ("waitoneval ($pr($waitoneval)) ");
        };#if
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
# from the wso can look up its primary description in the meta schema

    my ($e2ftwso, $ae2ftwso, $pws);
    my ($bcount, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    if (defined($waitoneval)){
      $bcount = ifindb ($myli, $stwso, 'pdcab', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset);
      &getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$pws);
      $bcount = ifindb ($myli, $stwso, 'e2finhibb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset, $pws);
      $e2ftwso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $pws);
      $Awfif::memes-> {currentwsbi} = $pws;
      $ae2ftwso = awsoadr ($e2ftwso);
      $Awfif::wsol-> {l} [$ae2ftwso][2]
      = inccounter ( $waitoneval, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $Awfif::memes-> {snnh} {completed}), #pto
          $Awfif::memes-> {snnh} {model}, #from
          $Awfif::wsol-> {l} [$ae2ftwso] [2],#dlinkh
          $ae2ftwso,#awso
          't',#synccod
          $waitoneval,#sltype
          $Awfif::memes-> {snnh} {completed});#spto
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("depcdescx \n");
      };
    }# depcdesc
#
#<!-- start tag sca -->
#
sub depwardesc {
    my($myli, $stwso, $strategy, $sactset)=@_;
    my ($cwsi, $kwp, $kwpr);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("depwardesc myli $myli stwso($stwso) ");
      if (defined ($strategy)) {
        print ("strategy ($strategy) ");
        };#if
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
# from the wso can look up its primary description in the meta schema

    my ($warwso, $awarwso, $warws);
    my ($bcount, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    if (defined($strategy)){
      $bcount = ifindb ($myli, $stwso, 'warb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset);
      &getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$warws);
      $bcount = ifindb ($myli, $stwso, $strategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset, $warws);
      $warwso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $warws);
      $Awfif::memes-> {currentwsbi} = $warws;
      $awarwso = awsoadr ($warwso);
      $Awfif::wsol-> {l} [$awarwso][2]
      = inccounter ( $Awfif::memes-> {snnh} {waitarelay},
          ($Awfif::memes-> {snnh} {wsi} + $Awfif::memes-> {snnh} {completed}), #lets start with one
          $Awfif::memes-> {snnh} {model},
          $Awfif::wsol-> {l} [$awarwso] [2],
          $awarwso,
          't',
          $Awfif::memes-> {snnh} {waitarelay},
          $Awfif::memes-> {snnh} {completed});
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("depwardescx \n");
      };
    }# depwardesc
#
#<!-- end tag sca -->
#<!-- end tag aso -->
#
sub movecomplex {
    my($myli, $wspdsc, $nmoves, $awspwso, $catalysis, $awsi)=@_;
    my ($nwsoid, $tws, $cwsi);
# given a structural workspace update the wsposition descriptor by the relative amount requested
# The position descriptors wso will be provided so that end of workspace can be described

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("movecomplex myli $myli wspdsc $wspdsc nmoves $nmoves awspwso $awspwso ");
      if (defined ($catalysis)) {
        print ("catalysis $catalysis awsi $awsi ");
        };#if
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("nwsoid $nwsoid ");
      };#if
    $tws = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
    $Awfif::memes-> {currentwsbi} = $tws;
# movecucat1
# if catalysis requested handle the request

    if ((defined ($catalysis)) && ($catalysis)) {

      &grabcodelet ($myli, $wspdsc, $awsi, $awspwso);
      };#if
    $nwsoid = trwsoadr ($nwsoid, $nmoves);
    if (($nwsoid == 0) && ($awspwso != 0)) {#describe end of workspace

      $Awfif::wsol-> {l} [$awspwso][2]
      = setupdesc ( ($Awfif::memes-> {snnh} {stream}),
          ($Awfif::memes-> {snnh} {wsi} + 0),
          $Awfif::memes-> {snnh} {eos},
          $Awfif::wsol-> {l} [$awspwso] [2],
          $awspwso);
      }#if end of workspace
    elsif (($nwsoid != 0)) {
      $Awfif::workspace-> {l} [$wspdsc] [2] = $nwsoid + $Awfif::memes->{snnh}{wsi};
      };#elsif

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("movecomplexx ");
      if ($nwsoid != 0) {
      print ("ret ($nwsoid)\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsi;
    return $nwsoid
    }# movecomplex
#
#<!-- start tag aso -->
#
sub getnamefqpair {
    my($myli, $sldesc, $stnws, $stnwsoid, $stayinplace)=@_;
    my ($stname, $nwsoid, $tws, $cwsi, $char, $wsotype, $endquote);
# having been called look along the application workspace for a quote and then capture the name until further quote
# The position descriptors wso will be provided so that end of workspace can be described

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getnamefqpair myli $myli sldesc $sldesc ");
      if (defined ($stayinplace) ){
        print ("stayinplace($stayinplace) ");
        };#if
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    $stname = '';
    $$stnws = 0;
    $$stnwsoid = 0;
    $wsotype = 0;
# move along the workspace looking for a quoted string

    $nwsoid = ($Awfif::workspace-> {l} [$sldesc] [2] - $Awfif::memes-> {snnh} {wsi});
    $tws = ($Awfif::workspace-> {l} [$sldesc] [3] - $Awfif::memes-> {snnh} {wsi});
    $Awfif::memes-> {currentwsbi} = $tws;
    $nwsoid = trwsoadr ($nwsoid, 1);
    while (
    ($nwsoid != 0)
    && (($wsotype = wsbasetype ($nwsoid)) == $Awfif::memes-> {snnh} {char})
    && (($char = getwsost4 ($nwsoid)) ne '"')
    && ($char ne '\'')
    && ($char ne '<rhldq>')
    && ($char ne '<rhlsq>')
      ){ #get next wso

      $nwsoid = trwsoadr ($nwsoid, 1);
      };#
    if ($wsotype == $Awfif::memes-> {snnh} {char}) {#got some sort of quote

      $endquote = $char;
      $$stnws = $tws;
      $$stnwsoid = $nwsoid;
      $nwsoid = trwsoadr ($nwsoid, 1);

      while (
      ($nwsoid != 0)
      && (($char = getwsost4 ($nwsoid)) ne $endquote)
      ){ #get next wso

        if (($wsotype = wsbasetype ($nwsoid)) == $Awfif::memes-> {snnh} {char}) {

          $stname .= $char;
          }#if
        else {#rebuild the string

          $stname = $stname . '<'. $char . '>';
          };#else
        $nwsoid = trwsoadr ($nwsoid, 1);
        };#collect name until end quote
# position the complex at the end quote
      if ( (!defined ($stayinplace))
      or ( (defined ($stayinplace)) && (!$stayinplace))
      ){
        $Awfif::workspace-> {l} [$sldesc] [2] = $nwsoid + $Awfif::memes-> {snnh}{wsi};
        };#if move
      };#process the name

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getnamefqpairx stnws $$stnws stnwsoid $$stnwsoid ret ($stname)\n");
      };
    return $stname
    }# getnamefqpair
#
#<!-- end tag aso -->
#
sub initiateself {
    my($myli, $cws, $bcwso, $matchtoo, $sponsor)=@_;
    my ($cwsi, $sponsortype, $abcwso, $cwsbi);
# initiate a new gc while this codelet should sponsor the next section of a cascade

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("initiateself myli $myli bcwso $bcwso matchtoo $matchtoo sponsor $sponsor ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $sponsortype = wsbasetype ($sponsor);
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
# now want to ungroup if don't find cascade in operation in app str workspace list head
# get the app str ws

    $Awfif::memes-> {currentwsbi} = $cws;
    $abcwso = awsoadr ($bcwso);
    if (
    (!(hdescexists ($myli, $cws, $bcwso, $matchtoo, $sponsortype)))
    ) {
# initiatestfu
# must not free while own sponsorship

      &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{cassponsor});
      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
      ¬gcompleted ($myli, $sponsor, teltail ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$myli] [31]] [15] [3]),'t');# sponsor should be one after telomeric header
      }#if
    else {
# must free once loose sponsorship

      &cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{wascassponsor});
      };#else

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("initiateselfx \n");
      };
    }# initiateself
#
#<!-- start tag scc -->
#
sub hdescexists {
    my($myli, $cws, $bcwso, $matchtoo, $sponsortype)=@_;
    my ($lhdesc, $lhwso, $rhwso, $rhdesc, $cwsi, $exists, $abcwso);
# initiate a new gc while this codelet should sponsor the next section of a cascade

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("hdescexists myli $myli bcwso $bcwso matchtoo $matchtoo ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
# check if there is a model descriptor (sponsortype)-> $matchtoo at the head of the records in the list
# if no records yet look at the list head
# if the record head exists look at the record head only
# get the app str ws

    $exists = 't';
    $Awfif::memes-> {currentwsbi} = $cws;
    $abcwso = awsoadr ($bcwso);
# using the list head get the wso that will contain the descriptor
    $lhdesc = findtdesc ($Awfif::wsol-> {l} [$abcwso] [2], $Awfif::memes-> {snnh} {listhead});

    if ( ($lhdesc == 0 )
    or (($lhwso = ($Awfif::workspace-> {l} [$lhdesc][2] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$lhdesc][3] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($rhdesc = findtdesc ($Awfif::wsol-> {l} [awsoadr($lhwso)] [2], $Awfif::memes-> {snnh} {recordhead})) == 0)
    && (!findbond ($Awfif::wsol-> {l} [ awsoadr ($lhwso)] [2], $matchtoo, $sponsortype, $Awfif::memes-> {snnh} {model}))
    ) {

      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        print ("lhdesc $lhdesc lhwso $lhwso ");
        };#if
      $exists = '';
      }#if
    elsif ((($lhwso = ($Awfif::workspace-> {l} [$lhdesc][2] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$lhdesc][3] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($rhdesc = findtdesc ($Awfif::wsol-> {l} [awsoadr($lhwso)] [2], $Awfif::memes-> {snnh} {recordhead})) != 0)
    && (($rhwso = ($Awfif::workspace-> {l} [$rhdesc][2] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (!findbond ($Awfif::wsol-> {l} [ awsoadr ($rhwso)] [2], $matchtoo, $sponsortype, $Awfif::memes-> {snnh} {model}))

    ) {

      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        print ("lhdesc $lhdesc lhwso $lhwso rhwso $rhwso ");
        };#if
      $exists = '';
      }#elsif
    elsif ((($lhwso = ($Awfif::workspace-> {l} [$lhdesc][2] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$lhdesc][3] - $Awfif::memes-> {snnh} {wsi})) != 0)
    && (($rhdesc = findtdesc ($Awfif::wsol-> {l} [awsoadr($lhwso)] [2], $Awfif::memes-> {snnh} {recordhead})) != 0)
    && (($rhwso = ($Awfif::workspace-> {l} [$rhdesc][2] - $Awfif::memes-> {snnh} {wsi})) == 0)
    && (!findbond ($Awfif::wsol-> {l} [ awsoadr ($lhwso)] [2], $matchtoo, $sponsortype, $Awfif::memes-> {snnh} {model}))
# This case is where a list has been found but no records have been found yet
    ) {

      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        print ("lhdesc $lhdesc lhwso $lhwso rhdesc $rhdesc rhwso $rhwso ");
        };#if
      $exists = '';
      };#elsif

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("hdescexistsx ret ($exists)\n");
      };
    return $exists
    }# hdescexists
#
#<!-- end tag scc -->
#<!-- start tag sia -->
#
sub grabcodelet {
    my($myli, $wspdsc, $stws, $awspwso, $linksubpl, $filialonly, $allowichar)=@_;
    my ($nwsoid, $aws, $cwsi, $catdesc, $catref, $catalysis, $st4, $exclude, $kwp, $kwpr, $char);
# given a structural workspace and the wsposition descriptor associate the codelet with wso type
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("grabcodelet myli $myli wspdsc($wspdsc) awspwso($awspwso) linksubpl($linksubpl) ");
      if ((defined ($filialonly))) {

        print ("filialonly($filialonly) ");
        };#if
      if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

        $pr = $Awfif::codelet-> {l} [$myli] [36];
        print ("sub $pr ");
        };#if
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $catalysis = '';
    $nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    $aws = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
    $Awfif::memes-> {currentwsbi} = $aws;
# grabcicu1
    if ( (defined ($allowichar)) && ($allowichar) && ( ($char = wsbasetype ($nwsoid)) == $Awfif::memes-> {snnh} {ichar})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $st4 = 'ichar';#special use of ichar for applycodelet use only
      } #if
    elsif ( (defined ($allowichar)) && ($allowichar) && ($char == $Awfif::memes-> {snnh} {char})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $st4 = 'char';#special use of char for applycodelet use only
      } #elsif
    elsif ( (defined ($allowichar)) && ($allowichar) && ($char == $Awfif::memes-> {snnh} {whitespace})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $st4 = 'whitespace';#special use of whitespace for applycodelet use only
      } #elsif
    else {

    $Awfif::memes-> {currentwsbi} = $stws;
# grabcatru1
    $catref = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catref});
    if (($catref != 0)) {

      $catdesc = ($Awfif::workspace-> {l} [$catref] [2] - $Awfif::memes-> {snnh}{wsi});
      }#if
    else {

      $catdesc = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catalysis});
      };
# if catalysis enabled handle the request
# grabcspcacheu2

    if (($catdesc != 0)
    ){#setup the catalysis

      $catalysis = 't';
# if this is a do cascade codelet it should signal for only filial catalysis
      $exclude = '';
# grabctrmgru1
      if ((defined ($filialonly)) && ($filialonly)) {

        $exclude = 't';
        };#if
# grabcmst4u1

      if ( ( ( (!defined ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$st4})) or ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$st4} == 0)) && (!$exclude) )
      ) {

        my ($currentdefh);
        $Awfif::clp = ();
        $Awfif::clp-> {urgency} = $Awfif::codelet-> {l} [$myli][3];
        $Awfif::clp-> {action}-> {signal} = $Awfif::codelet-> {l} [$myli][16];
        $Awfif::clp-> {action}-> {schema} = $Awfif::codelet-> {l} [$myli][18];
        $Awfif::clp-> {action}-> {ref} = $Awfif::codelet-> {l} [$myli][4];
        $Awfif::clp-> {action}-> {wse} = $Awfif::codelet-> {l} [$myli][22];
        $currentdefh = $Awfif::memes-> {codeletdef};
# grabcpoolcbru1

        &groupsinv1 ($myli, undef(), undef(), undef(), $Awfif::codelet-> {l} [$myli][17],
          undef(),
          setupprocname ($myli, undef()),
          $kwp,
          $kwpr,
          \@{$Awfif::memes-> {sactset}},
          't', #deferred
          undef (), #ignore
          undef (), #usepooling
          't'#addbreak
          );
        if ($currentdefh != $Awfif::memes-> {codeletdef}) {

          $Awfif::workspace-> {l} [$catdesc] [2] = mdefhcodelettolist ($Awfif::workspace-> {l} [$catdesc] [2]);#make this the head of a list for this $myli
# grabcr34u1
# grabcspcacheu1
          if (($linksubpl) && ($Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36] > 0)
          && (matchaelement (\@{$Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]] [15]}, $Awfif::workspace-> {l} [$catdesc] [2]) == 0) # its not already deployed to this subpid
          && (!codelettypeinsub ($Awfif::workspace-> {l} [$catdesc] [2], $Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]))
          ) {#record the use in subpl

            $Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]] [15][(++$Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]] [15] [0])] = $Awfif::workspace-> {l} [$catdesc] [2];
            }#if
          else {

            $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]]-> {typecodeleta} {$st4} = $Awfif::workspace-> {l} [$catdesc] [2];#associate the binder complex current ws string with the builder codelet
            $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [36]]-> {codelettypea} {$Awfif::workspace-> {l} [$catdesc] [2]} = $st4;#associate the binder complex current ws string with the builder codelet
            };#else
          };#if
        };#if
      };#if catalysis setup

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("grabcodeletx ret ($catalysis)\n");
      };
    return $catalysis
    }# grabcodelet
#
#<!-- start tag ds -resweb -->
#
sub applycodelet {
    my($myli, $wspdsc, $stws, $awspwso, $kwp, $kwpr, $sactset, $filialonly, $framei, $vbworld)=@_;
    my ($nwsoid, $aws, $cwsi, $catdesc, $catref, $s4, $notebmyli, $notecindex, $lwsoid, @depcodelets, $applyfailed, $ldesc, $lvbty, $loktomdesc, $loktom);
# given a structural workspace and the wsposition descriptor associate the codelet with wso type
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("applycodelet myli $myli wspdsc $wspdsc awspwso $awspwso ");
      if ((defined ($filialonly))) {

        print ("filialonly($filialonly) framei($framei) vbworld($vbworld) ");
        };#if
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    if ($Awfif::memes-> {spiglvl} == 0) {#don't apply codelet in middle of spi grab amp

    $nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    $lwsoid = $nwsoid;
    if ((defined ($filialonly)) && ($filialonly) && (defined ($framei))
    ){

      $ldesc = $Awfif::framel-> {l} [$Awfif::workspace-> {l} [$framei] [3]] [4];
      }#if
    elsif ((defined ($filialonly)) && ($filialonly) && (defined ($vbworld)) && ($vbworld)
    ){

      $lvbty = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
      $loktomdesc = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {oktomove});
      $loktom = $Awfif::workspace-> {l} [$loktomdesc] [2];
      }#if
    elsif ((defined ($filialonly)) && ($filialonly)
    ){
      &break ();#if use filial only must have specified framei
      };#elsif
    $applyfailed = '';
    $depcodelets [0] = 0;
    $aws = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
    $Awfif::memes-> {currentwsbi} = $stws;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};

    $notebmyli = $Awfif::memes-> {breakmyli};
    $notecindex = $Awfif::memes-> {bmbcindex};
# applycatru1
    $catref = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catref});
    if (($catref != 0)) {

      $catdesc = ($Awfif::workspace-> {l} [$catref] [2] - $Awfif::memes-> {snnh}{wsi});
      }#if
    else {

      $catdesc = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catalysis});
      };
# applycshareu1
    if (($catdesc != 0)
    && ((!$Awfif::memes-> {tdfsampdo}) or ($Awfif::memes-> {tdfsampacc}))
    && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)
    && ($Awfif::memes-> {applycount} >= $Awfif::memes-> {applycth})
    ) {

      $Awfif::memes-> {applyactive} = 't';
      $Awfif::memes-> {applycount}--;
      }#if
    elsif (($catdesc != 0)
    && ((!$Awfif::memes-> {tdfsampdo}) or ($Awfif::memes-> {tdfsampacc}))
    && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)
    && ($Awfif::memes-> {applycount} <= $Awfif::memes-> {applycmin})
    ) {

      $Awfif::memes-> {applyactive} = '';
      $Awfif::memes-> {applycount}--;
      }#elsif
    elsif (($catdesc != 0)
    && ((!$Awfif::memes-> {tdfsampdo}) or ($Awfif::memes-> {tdfsampacc}))
    && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)
    ){

      $Awfif::memes-> {applycount}--;
      };#else
# if catalysis enabled try to launch any associated codelet


      my ($codelet);
      $Awfif::memes-> {currentwsbi} = $aws;
      if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
# drive the apply process

# applycicu1
      while (($Awfif::memes-> {applyactive})
      && ((!$Awfif::memes-> {tdfsampdo}) or ($Awfif::memes-> {tdfsampacc}))#true implies amplifiers are impacting deployments and should stop
      && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)
      && (!$applyfailed)
      && (((defined ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {($s4 = setups4 (\$nwsoid, $wspdsc) )}))
      && ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4} != 0)
      && ((!defined ($filialonly)) or (!$filialonly)))
      or ((defined ($filialonly)) && ($filialonly)))
# applyctrmgru1
      ) {#associate the binder complex current ws string with the builder codelet

        my (@applylist, $i, $pindesc, $p);
        if ( ($nwsoid != $lwsoid)
        or ((defined ($filialonly)) && ($filialonly) && ((!defined($vbworld)) && ($ldesc != $Awfif::framel-> {l} [$Awfif::workspace-> {l} [$framei] [3]] [4])) )
        or ((defined ($filialonly)) && ($filialonly) && ((defined($vbworld)) && (($lvbty != ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi})) or ($loktom ne $Awfif::workspace-> {l} [$loktomdesc] [2])) ) )# y has moved or oktomove changed
        ){

          $depcodelets[0] = 0;
          $lwsoid = $nwsoid;
          if ((defined ($filialonly)) && ($filialonly) && (!defined($vbworld))
          ){

            $ldesc = $Awfif::framel-> {l} [$Awfif::workspace-> {l} [$framei] [3]] [4];
            }#if
          elsif ((defined ($filialonly)) && ($filialonly) && ($vbworld)
          ){

            $lvbty = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
            $loktom = $Awfif::workspace-> {l} [$loktomdesc] [2];
            };#elsif
          };#if
# applycshareu2
        if ($Awfif::memes-> {applycount} <= $Awfif::memes-> {applycmin}) {

          $Awfif::memes-> {applyactive} = '';
          }
        else {

          $Awfif::memes-> {applycount}--;
          };

        $Awfif::workspace-> {l} [$catdesc] [3] = 1;#note that am within applycodelet
# Build a list of potential candidates to apply
        $applylist [0] = 0;
        if ( ((!defined ($filialonly)) or (!$filialonly))
        && (defined ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4}))
        && (notapplied ($Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4}, \@depcodelets) == 0)
        ){

          $applylist [++$applylist [0]] = $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4};
          };#elsif
# applyctrmgru2

        $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
        if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};

        if ( ( ( ((defined ($filialonly)) && ($filialonly)) && (($pindesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr ($Awfif::codelet-> {l} [$myli] [21], -1))] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 ) )
        or ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr ($Awfif::codelet-> {l} [$Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4}] [21], -1))] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 ) )
        && (($p = ($Awfif::workspace-> {l} [$pindesc] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
        && ($Awfif::jhls-> {l} [$p] [19] != 0)#if the codelet has a list of brothers and sisters
        ){
# loop through the children looking for the one with a match for awsoadr codelet [21]

          my ($gotit, $linki, $only, $filcount, $filappcount, $roledout);
          $gotit = 0;
          $filcount = 0;
          $filappcount = 0;
          $only = '';
          $linki = $Awfif::jhls-> {l} [$p][19];#head of this amoff sub list

          while (($linki != 0)
          && (!$only)
          ) {

            my ($filial, $f1, $codeletname, $and, $salience, $rand, $notdeploid);
            $filcount++;
            $filial = '';
            $rand = '';
            if (defined ($Awfif::amoffl-> {l} [$linki] [6])) {#setup for filial assist
# applycfassu1

              $filial = 't';
              $Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$linki] [6] ] [2] =~ /^(.+)*builder/i;
              $f1 = $1;
              $codeletname = $f1 . 'bsmodeler';
              };#if
            no strict 'refs';
            if ( ((!defined ($filialonly)) or (!$filialonly))
            && ($Awfif::amoffl-> {l} [$linki] [4] == awsoadr (trwsoadr ($Awfif::codelet-> {l} [$Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$s4}] [21], -1)) )
            ) {

              $gotit = $linki;
              $filappcount++;
              }#elsif

            elsif (($filial)
            && ($f1)
            && (defined($Awfif::memes-> {binds}-> {$codeletname}))
# must role out the caller myli, setup the subpid and then the called procedure must role in the subpid specific transaction managed data of this codelet shell and then role it out again
            && (($roledout = idoroleout ($myli)))
            && (($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$linki] [6]][36] = $Awfif::codelet-> {l} [$myli] [36]) == $Awfif::codelet-> {l} [$myli] [36])
            && ( ($salience = $Awfif::memes-> {binds}-> {$codeletname}-> ($Awfif::amoffl-> {l} [$linki] [6], $kwp, $kwpr, \@sactset, \$and)) == $Awfif::memes-> {bsalient} )
            && ($rand = 't')
            && ($and)
            && (($notdeploid =(notapplied ($Awfif::amoffl-> {l} [$linki] [6], \@depcodelets)) == 0))
            && ((notapplied ($Awfif::amoffl-> {l} [$linki] [6], \@applylist) == 0))
            ) {#add salient brothers and sisters to applylist

              $applylist [++$applylist [0]] = $Awfif::amoffl-> {l} [$linki] [6];
              $filappcount++;
              if ( ((defined ($filialonly)) && ($filialonly))
              && ($gotit == 0)
              ){#for filial only can make any of the evaluators that return salient the gotit

                $gotit = $linki;
                };#if
              }#elsif
            elsif (($filial)
            && ($rand)
            && (!$and)
            && ($notdeploid == 0)
            ) {#add salient only codelet

              $applylist [0] = 0;
              $applylist [++$applylist [0]] = $Awfif::amoffl-> {l} [$linki] [6];
              $only = 't';
              };#elsif
            if ($roledout) {

              &idorolein ($myli, $Awfif::codelet-> {l} [$myli] [21]);
              $roledout = '';
              };#if
            $linki = $Awfif::amoffl-> {l} [$linki] [0];
            };#while
          if ($gotit != 0) {
# add each item in the match list to the applylist

            if ((!defined($Awfif::amoffl-> {l}[$gotit] [2]))) {#shift from apply to deploy

              $Awfif::memes-> {applycount} = 0;
              };#elsif
            if (($Awfif::memes-> {newdep} != 0)) {#shift from apply to deploy

              $Awfif::memes-> {newdep}--;
              };#if
            for ($i = 0; $i < $Awfif::amoffl-> {l}[$gotit] [2]; $i++) {#look through list of matching codelets - from which myli should have been excluded
# applyctrmgru3

              if (defined ($codelet = fpiecodelet ($myli, $Awfif::memes-> {currentwsbi}, $Awfif::amoffl-> {m} [$gotit] [$i]))
              && ((notapplied ($codelet, \@applylist) == 0))
              ){

                if ( ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ awsoadr (trwsoadr ($Awfif::codelet-> {l} [$codelet] [21], -1))] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 )
                && (($p = ($Awfif::workspace-> {l} [$pindesc] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
                && ($Awfif::jhls-> {l} [$p] [19] != 0)#if the codelet has a list of brothers and sisters
                ){
# loop through the children looking for the one with a match for awsoadr codelet [21]

                  my ($flinki);
                  $flinki = $Awfif::jhls-> {l} [$p][19];#head of this amoff sub list
                  while (($flinki != 0)
                  && (!$only)
                  ) {

                    my ($filial, $f1, $codeletname, $and, $salience, $rand, $notdeploid);
                    $filcount++;
                    $filial = '';
                    $rand = '';
                    $filcount++;
                    if (defined ($Awfif::amoffl-> {l} [$flinki] [6])) {#setup for filial assist

                      $filial = 't';
                      $Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6] ] [2] =~ /^(.+)*builder/i;
                      $f1 = $1;
                      $codeletname = $f1 . 'bsmodeler';
                      };#if
# applycmdfu1

                    if (($filial)
                    && ($f1)
                    && (defined($Awfif::memes-> {binds}-> {$codeletname}))
                    && ((($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] > 0) && ($Awfif::codelet-> {l} [$myli] [36] > 0)) or (($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] == 0) && ($Awfif::codelet-> {l} [$myli] [36] == 0))) #subprogram schematic codelets cant be used for non sub-program execution
# must role out the caller myli, setup the subpid and then the called procedure must role in the subpid specific transaction managed data of this codelet shell and then role it out again
                    && (($roledout = idoroleout ($myli)))
                    && (($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] = $Awfif::codelet-> {l} [$myli] [36]) == $Awfif::codelet-> {l} [$myli] [36])
                    && ( ($salience = $Awfif::memes-> {binds}-> {$codeletname}-> ($Awfif::amoffl-> {l} [$flinki] [6], $kwp, $kwpr, \@sactset, \$and)) == $Awfif::memes-> {bsalient} )
                    && ($rand = 't')
                    && ($and)
                    && (( !defined ($Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] ]))
                      or ((awsoadr ($Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]] [21])) != $Awfif::subpl-> {w} [$Awfif::codelet-> {l} [$Awfif::amoffl-> {l} [$flinki] [6]][36] ]) )
                    && (($notdeploid =(notapplied ($Awfif::amoffl-> {l} [$flinki] [6], \@depcodelets)) == 0))
                    && ((notapplied ($Awfif::amoffl-> {l} [$flinki] [6], \@applylist) == 0))
                    ) {#add salient brothers and sisters to applylist

                      $applylist [++$applylist [0]] = $Awfif::amoffl-> {l} [$flinki] [6];
                      $filappcount++;
                      }#elsif

                    elsif (($filial)
                    && ($rand)
                    && (!$and)
                    && ($notdeploid == 0)
                    ) {#add salient only codelet

                      $applylist [0] = 0;
                      $applylist [++$applylist [0]] = $Awfif::amoffl-> {l} [$flinki] [6];
                      $only = 't';
                      };#elsif
                    if ($roledout) {

                      &idorolein ($myli, $Awfif::codelet-> {l} [$myli] [21]);
                      $roledout = '';
                      };#if

                    $flinki = $Awfif::amoffl-> {l} [$flinki] [0];
                    };#while
                  };#if
                };#if
              };#for
            };#if
          };#if
        if ($applylist [0] > 0) {

          $codelet = $applylist [1 + int (rand($applylist [0]))];
          $depcodelets [++$depcodelets [0] ] = $codelet;
          $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$codelet] [19] ;
          if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};

          &countcdel ($codelet, 1);# count the nominal deletion
# applyctrmgru5
          &idoroleout ($myli);
          no strict 'refs';

          $Awfif::memes-> {breakmyli} = 0;
          $Awfif::memes-> {bmbcindex} = 0;
          if (!defined ($Awfif::memes-> {binds}-> {$Awfif::codelet-> {l} [$codelet] [2]})) {

            break ();
            $applyfailed = 't';
            }#if
          else {

            &ucsehist ($Awfif::codelet-> {l} [ $codelet ] [2]);
            $Awfif::codelet-> {l} [$codelet][36] = $Awfif::codelet-> {l} [$myli] [36];#ensure the subpid is setup correctly
            $Awfif::codelet-> {l} [$codelet][37] = mapsubtotmgrid (awsoadr (trwsoadr($Awfif::codelet-> {l} [$codelet] [21],-1)), $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l} [$codelet] [36]);#ensure the subpid is setup correctly
# applcfreepu1
            $Awfif::memes-> {cruna}[ ++$Awfif::memes-> {cruna}[0] ] = $codelet;#protect the running codelet from freecodelet
            $Awfif::memes-> {binds}-> {$Awfif::codelet-> {l} [$codelet] [2]}-> ($codelet, \$$kwp, $kwpr, \@$sactset);
            $Awfif::memes-> {cruna}[ $Awfif::memes-> {cruna}[0]-- ] = undef();
            };#else

          $Awfif::memes-> {breakmyli} = 0;
          $Awfif::memes-> {bmbcindex} = 0;
# applyctrmgru4
          &idorolein ($myli, $Awfif::codelet-> {l} [$myli] [21]);
          }#if
        else {

          if ( (defined ($Awfif::memes-> {applycfbreak}))
          && ($Awfif::memes-> {applycfbreak} )
          ){

            &break();
            };#if
          $applyfailed = 't';
          };#else
        $Awfif::workspace-> {l} [$catdesc] [3] = 0;#note that am not within applycodelet
        $Awfif::memes-> {currentwsbi} = $aws;

        if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
        };#while
      };#if catalysis setup

      };#if no spi grab amp

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    $Awfif::memes-> {breakmyli} = $notebmyli;
    $Awfif::memes-> {bmbcindex} = $notecindex;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("applycodeletx\n");
      };
    }# applycodelet
#
sub inapplycodelet {
    my($myli, $awspwso)=@_;
    my ($reply, $cwsi, $catdesc, $catref);
# given a structural workspace and the wsposition descriptor associate the codelet with wso type
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("inapplycodelet myli $myli awspwso($awspwso) ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $reply = 0;
    $catref = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catref});
    if (($catref != 0)) {

      $catdesc = ($Awfif::workspace-> {l} [$catref] [2] - $Awfif::memes-> {snnh}{wsi});
      }#if
    else {

      $catdesc = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catalysis});
      };

    if (($catdesc != 0) && ($Awfif::workspace-> {l} [$catdesc] [3] == 0)) {#active catalysis but not in apply

      $reply = '1';
      }#if catalysis setup
    elsif (($catdesc != 0) && ($Awfif::workspace-> {l} [$catdesc] [3] != 0)) {#in apply

      $reply = '2';
      };#if catalysis setup

    $Awfif::memes-> {currentwsbi} = $cwsi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("inapplycodeletx ret($reply)\n");
      };
    return $reply
    }# inapplycodelet
#
sub setups4 {
    my($nwsoid, $wspdsc)=@_;
    my ($result, $char, $cwsi);
# setup st4 for applycodelet using the convention matches in getcodelet

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("setups4 wspdsc($wspdsc) ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $$nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    if ( ( ($char = wsbasetype ($$nwsoid)) == $Awfif::memes-> {snnh} {ichar})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $result = 'ichar';#special use of ichar for applycodelet use only
      } #if
    elsif ( ($char == $Awfif::memes-> {snnh} {char})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $result = 'char';#special use of char for applycodelet use only
      } #elsif
    elsif ( ($char == $Awfif::memes-> {snnh} {whitespace})
    ){

      if ($Awfif::memes-> {gacicharbreak}) {&break ()};
      $result = 'whitespace';#special use of char for applycodelet use only
      } #elsif
    else {


    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("setups4x nwsoid ($$nwsoid) ret ($result)\n");
      };
    return $result
    }# setups4
#
#<!-- end tag ds -->
#<!-- start tag dli -->
#
sub relcodelets {
    my($myli, $wspdsc, $stws, $awspwso)=@_;
    my ($nwsoid, $aws, $cwsi, $catdesc, $catref);
# given a structural workspace and the wsposition descriptor associate the codelet with wso type
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("relcodelets myli $myli wspdsc $wspdsc awspwso $awspwso ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    $aws = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
    $Awfif::memes-> {currentwsbi} = $stws;
# relcatru1
    $catref = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catref});
    if (($catref != 0)) {

      $catdesc = ($Awfif::workspace-> {l} [$catref] [2] - $Awfif::memes-> {snnh}{wsi});
      }#if
    else {

      $catdesc = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catalysis});
      };
# if catalysis enabled release & free any grabbed codelets

    if (($catdesc != 0)) {#terminate the catalysis

      while (($Awfif::workspace-> {l} [$catdesc] [2] != 0)) {#associate the binder complex current ws string with the builder codelet

        my ($hcodelet);
        $hcodelet = $Awfif::workspace-> {l} [$catdesc] [2];
        $Awfif::codelet-> {l} [$Awfif::workspace-> {l} [$catdesc] [2]] [34] = 0;#this codelet can now be freed by freecodelet
        $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {typecodeleta} {$Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {codelettypea} {$Awfif::workspace-> {l} [$catdesc] [2]}} = undef ();#dis-associate the binder complex current ws string with the builder codelet
        $Awfif::harray-> {tce} [$Awfif::codelet-> {l} [$myli] [36]]-> {codelettypea} {$Awfif::workspace-> {l} [$catdesc] [2]} = undef ();#dis-associate the binder complex current ws string with the builder codelet
        $Awfif::workspace-> {l} [$catdesc] [2] = mhcodelettoactltail ($Awfif::workspace-> {l} [$catdesc] [2]);#move the codelet to the head of the catalysis list
        &freecodelet ($hcodelet, 1);
        };#while
      $Awfif::workspace-> {l} [$catdesc] [4] = $Awfif::workspace-> {l} [$catdesc] [4]+1;
      };#if catalysis setup

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("relcodeletsx\n");
      };
    }# relcodelets
#
#<!-- end tag dli -->
#
sub trancodelet {
    my($myli, $codelet)=@_;
    my ($found, $cwsi);
# check if this codelet has transids in its schemata
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("trancodelet myli $myli codelet $codelet ");
      };
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$codelet] [20];

    $found = '';
    my ($sponsor, $signal, $schema, $swstype, $noswstype, $sponsortype, $tidesc,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# checked for merged workspaces

    $noswstype = '';
    if (getcontext ($codelet, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)) {
      my ($asponsor, $twso);
      $twso = trwsoadr (fgrpend ($sponsor), 1);
      $asponsor = awsoadr ($sponsor);
      $sponsortype = wsbasetype ($sponsor);

      if ( (findcounter ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {transid}, \$tidesc) ) ){

        $found = 't';
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("trancodeletx ret ($found)\n");
      };
    return $found
    }# trancodelet
#
#
sub fillsched {
    my($myli, $ws, $athwso, $fpielinki)=@_;
    my ($cwsi, $pindesc, $p, $codelet);
# the fillial schedular checks the children of some parent for salience model feedback from the codelet bsmodeler
# if a codelet has not bsmodeler the salience is assumed to be 0 (don't include)

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fillsched myli $myli ws $ws athwso $athwso ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $Awfif::memes-> {currentwsbi} = $ws;
    if ( ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ $athwso ] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 )
    && (($p = ($Awfif::workspace-> {l} [$pindesc] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
    && ($Awfif::jhls-> {l} [$p] [19] != 0)#if the codelet has a list of equivalents
    ){
# loop through the children looking for the one with a match for awsoadr codelet [21]

      my ($gotit, $linki);
      $gotit = 0;
      $linki = $Awfif::jhls-> {l} [$p][19];#head of this amoff sub list
      while (($linki != 0) && ($gotit == 0)) {

        if ($Awfif::amoffl-> {l} [$linki] [4] == $athwso) {

          $gotit = $linki;
          };#if
        $linki = $Awfif::amoffl-> {l} [$linki] [0];
        };#while
      if ($gotit != 0) {

        $codelet = $Awfif::amoffl-> {l}[$gotit] [5];
        if (defined ($$fpielinki)) {
          $$fpielinki = $gotit;
          };#if
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fillschedx ");
      if (defined ($$fpielinki)) {
        print (" fpielinki $$fpielinki ");
        };#if
      print ("ret ($codelet)\n");
      };
    return $codelet
    }# fillsched
#
#<!-- start tag scc -->
#
sub fpiecodelet {
    my($myli, $ws, $athwso, $fpielinki)=@_;
    my ($cwsi, $pindesc, $p, $codelet);
# given a structural workspace and the wsposition descriptor associate the codelet with wso type
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fpiecodelet myli $myli ws $ws athwso $athwso ");
      };
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $Awfif::memes-> {currentwsbi} = $ws;
    if ( ( ($pindesc = findtdesc ($Awfif::wsol-> {l} [ $athwso ] [2], $Awfif::memes-> {snnh} {pindequiv})) != 0 )
    && (($p = ($Awfif::workspace-> {l} [$pindesc] [2] - $Awfif::memes-> {snnh} {wsi})) > 0)
    && ($Awfif::jhls-> {l} [$p] [19] != 0)#if the codelet has a list of equivalents
    ){
# loop through the children looking for the one with a match for awsoadr codelet [21]

      my ($gotit, $linki);
      $gotit = 0;
      $linki = $Awfif::jhls-> {l} [$p][19];#head of this amoff sub list
      while (($linki != 0) && ($gotit == 0)) {

        if ($Awfif::amoffl-> {l} [$linki] [4] == $athwso) {

          $gotit = $linki;
          };#if
        $linki = $Awfif::amoffl-> {l} [$linki] [0];
        };#while
      if ($gotit != 0) {

        $codelet = $Awfif::amoffl-> {l}[$gotit] [5];
        if (defined ($$fpielinki)) {
          $$fpielinki = $gotit;
          };#if
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fpiecodeletx ");
      if (defined ($$fpielinki)) {
        print (" fpielinki $$fpielinki ");
        };#if
      print ("ret ($codelet)\n");
      };
    return $codelet
    }# fpiecodelet
#
sub catcodelet {
    my($myli, $wspdsc, $stws, $awspwso)=@_;
    my ($nwsoid, $aws, $cwsi, $catdesc, $catref, $catalysis);
# The catalysis descriptor indicates catalysis in operation and is the head of the codelet list

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("catcodelet myli $myli wspdsc $wspdsc awspwso $awspwso ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $catalysis = '';
    $nwsoid = ($Awfif::workspace-> {l} [$wspdsc] [2] - $Awfif::memes->{snnh}{wsi});
    $aws = ($Awfif::workspace-> {l} [$wspdsc] [3] - $Awfif::memes->{snnh}{wsi});
    $Awfif::memes-> {currentwsbi} = $aws;
    $Awfif::memes-> {currentwsbi} = $stws;
# grabcatru1
    $catref = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catref});
    if (($catref != 0)) {

      $catdesc = ($Awfif::workspace-> {l} [$catref] [2] - $Awfif::memes-> {snnh}{wsi});
      }#if
    else {

      $catdesc = findtdesc ($Awfif::wsol-> {l} [$awspwso] [2], $Awfif::memes-> {snnh} {catalysis});
      };
# if catalysis enabled handle the request

    if (($catdesc != 0)
    ) {#setup the catalysis

      $catalysis = 't';
      };#if catalysis setup

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("catcodeletx ret ($catalysis)\n");
      };
    return $catalysis
    }# catcodelet
#
sub subpl15iecodelet {
    my($myli)=@_;
    my ($cwsi, $i, $codelet);
# see if there is a matching codelet in the subpl [15] cache. If there is then return its codeletid

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpl15iecodelet myli $myli ");
      &itcpoutput ($myli);
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    for ($i = 1; ((!defined ($codelet )) && ($i <= $Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [15] [0])); $i++) {
      if ($Awfif::codelet-> {l} [ $Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [15] [$i] ] [2] eq setupbuildername (setupprocname ($myli)) ) {

        $codelet = $Awfif::subpl-> {l}[$Awfif::codelet-> {l} [$myli] [36]] [15] [$i];
        };#if
      };#for

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpl15iecodeletx ");
      print ("ret ($codelet)\n");
      };
    return $codelet
    }# subpl15iecodelet
#
#<!-- start tag aso -->
sub warfindops {
    my($myli, $stwso, $warws, $warbwso, $sactset)=@_;
    my ($cwsi, $i, $bcount, @result);
# generate a list of wait requesters.

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warfindops myli $myli stwso($stwso) ");
      };
    $cwsi = $Awfif::memes-> {currentwsbi};# to later restore current state

    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $bcount = ifindb ($myli, $stwso, 'warb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@$sactset);
    $$warbwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$$warws);
# find the transcription factor binding
    if ($bcount >= 1) {

      $bcount = ifindb ($myli, $stwso, 'warasb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@$sactset, $$warws, undef (), undef (), 't', 't');
      $result[0] = 0;

      for ($i = 0; (($i < $sigcount)) ; $i++) {

        if ($lomatchs[$i]) {

          if (( ($Awfif::jhls-> {l} [$lola[$i]][4] == $Awfif::memes-> {snnh}{stbinding})
          && ($Awfif::jhls-> {l} [$lola[$i]][7] == $$warws)
          && ($Awfif::jhls-> {l} [$lola[$i]][8] != $$warbwso) )#exclude the wait and relay workspace operon
          && (matchaelement (\@result, $Awfif::jhls-> {l} [$lola[$i]] [8]) == 0) # its not already deployed to this subpid
          ){

            $result [++$result[0]] = $Awfif::jhls-> {l} [$lola[$i]] [8];
            };#if
          };#if
        };#for
      $Awfif::memes-> {currentwsbi} = $$warws;
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsi;
    if (!defined ($Awfif::memes-> {currentwsbi})) {&break()};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("warfindopsx warws($$warws) warbwso($$warbwso) ");
      print ("ret ($result[0])\n");
      };
    return @result
    }# warfindops
#<!-- end tag aso -->
#<!-- end tag scc -->
#<!-- end tag sia -->
#<!-- start tag uts -->
#
sub itcpoutput {
    my($myli)=@_;
    my ($i, $linkp, $plink, $pr);
# Instantaneous codelet parameters output aims to compactly list the current codelet.
#
#
# checked for merged workspaces

    print ("codelet [$myli]: ");
    if (!$Awfif::memes-> {listrelinking} ) {
    if ( (defined ($myli)) && ($myli != 0) ){
    for ($i = 0; $i<=$Awfif::memes-> {cpmax}; $i++) {

      if (defined ($Awfif::codelet-> {l}[$myli][$i])) {# look at each loaded index

        print ("[$i] $Awfif::codelet->{l}[$myli][$i],");
        };#if
      }# for
    $linkp = $Awfif::codelet-> {l}[$myli][1];
    $plink = $myli;
    while (($linkp > 0) & ($linkp != $Awfif::codelet-> {l} [$linkp][1])) {

      $plink = $linkp;
      $linkp = $Awfif::codelet-> {l} [$linkp][1];
      }# while there are active codelets
    if ($plink == $Awfif::memes-> {codeleth}) {

      print (" - a ");
      }
    elsif ($plink == $Awfif::memes-> {codeletf}) {

      print (" - f ");
      }
    elsif (($linkp != 0) && ($linkp == $Awfif::codelet-> {l} [$linkp][1])) {

      print (" - circular ref ");
      }
    else {

      print (" - l ");
      };
    $pr = $Awfif::memes-> {snnih} {$Awfif::codelet-> {t} [$myli]};
    print ("type($pr)");
    };#if not 0
    print ("\n");
    }#if lists ok to access
    else {
    print ("lists relinking \n");
    };#else
    };#myli is scalar
    }# itcpoutput
#
sub checkscalar ($) {
    my ($myli) = @_;
    my ($result);
# use prototype to check that a scalar is being input
#
#

    $result = 't';
    no strict 'refs';
    if (defined ($_[0][1])) {

      $result = '';
      };
    return $result
    }# checkscalar
#
sub itsiboutput {
    my($snn)=@_;
    my ($snl, $i, $pr, $wslp);
# Instantaneous slipnet node output aims to compactly list slipnet siblings.
#
#
# checked for merged workspaces

    $pr = $Awfif::memes-> {snnih} {$snn};
    print ("slipnet node $pr($snn): ");
    $snl = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$snn];
    while ($snl != 0) {
# list the sibling
      $pr = $Awfif::slipnet-> {l}[$snl][0];
      print ("[$snl][0] $pr ");
      $pr = $Awfif::slipnet-> {l}[$snl][1];
      print ("[$snl][1] $pr ");
      for ($i = 2; $i<=4; $i++) {
        if ($Awfif::slipnet-> {l}[$snl][$i] > $Awfif::memes-> {snnh}{wsi}) {
          $pr = $Awfif::slipnet-> {l}[$snl][$i];
          }
        elsif ($Awfif::slipnet-> {l}[$snl][$i] < 0) {
          $pr = '->' . $Awfif::memes-> {snnih} {-($Awfif::slipnet-> {l}[$snl][$i])};
          $pr = $pr . '(';
          $pr = $pr .$Awfif::slipnet-> {l}[$snl][$i];
          $pr = $pr .')';
          }
        else {
          $pr = $Awfif::memes-> {snnih} {$Awfif::slipnet-> {l}[$snl][$i]};
          $pr = $pr . '(';
          $pr = $pr .$Awfif::slipnet-> {l}[$snl][$i];
          $pr = $pr .')';
          };
        print ("[$snl][$i] $pr ");
        };# for loop through 2 - 4
#
# get the next sibling
      $snl = $Awfif::slipnet-> {l}[$snl][0];
      print ("\n");
      };#walk the direct siblings in the slipnet
    $wslp = $Awfif::wsbl->{h};
    print ("ws-snna ");
    while (($wslp != 1) && ($wslp != $Awfif::wsbl->{t})) {#setup salience for this workspace
      $pr = $Awfif::memes->{snw} [$wslp]-> {snna}{$Awfif::memes->{snnih} {$snn}};
      print ("$wslp:$pr ");
      $wslp = $Awfif::wsbl->{l}[$wslp][0];
      };
    print ("\n");
    }# itsiboutput
#
sub itcpdist {
    my($lhead, $shour, $smin, $ssec)=@_;
    my ($lheadi, $lcount, $cll, $i, @part, $ctrace, $pr, @wsc, $wsi, @b, $telcount, $count, $remtc, @c, $actd );
# Instantaneous slipnet node distribution indicates the population of each type of codelet.
#
#
# checked for merged workspaces

    $ctrace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
    @wsc = ();
    if (!$Awfif::memes-> {nocpdist}){#allow cpdist to be silenced when not viewing operations
      if (!defined ($lhead)) {
        $lheadi = $Awfif::memes-> {codeleth};
        }#if
      else {
        $lheadi = $lhead;
        };#else
      $part[0] = 'ts';
      $part[1] = 's';
      $part[2] = 'e';
      $part[3] = 'b';
      $pr = $lheadi;# head such as active list head
      print ("codelet head==($pr) ");
      if ($Awfif::memes-> {pwscount}){

        print ("cdlt sum[ws:#]");
        };#if
      if (!defined($lheadi)) {
        $cll = $Awfif::memes-> {codeleth};
        }#if
      else {
        $cll = $lheadi;
        };#else
      $lcount = 0;
      while (($lcount++ < (2*$Awfif::codelet-> {p})) && ($cll != 0)) {

        if (defined($Awfif::codelet->{l} [$cll][19])) {

          $wsi = $Awfif::codelet->{l} [$cll][19];
          }
        else {

          $wsi = 0;#bucket for unassigned
          };#else
# Count the sibling
        if (defined($Awfif::codelet->{l} [$cll][19])) {

          $wsc[$Awfif::codelet->{l} [$cll][19]]++;
          if ($Awfif::codelet->{l} [$cll][19] == 0 ) {

            $c[0]++;
            };#if
          }#if
        else {
          $c[0]++;
          };#else
        $b [$Awfif::memes-> {ch} {$Awfif::codelet->{l} [$cll][2]}][$wsi] = $b [$Awfif::memes-> {ch} {$Awfif::codelet->{l} [$cll][2]}][$wsi] + $Awfif::codelet->{l}[$cll][3];
#
# get the next sibling
        $cll = $Awfif::codelet-> {l} [$cll][0];
        };#walk the direct siblings in the coderack
      if ($cll == 0) {
# print ("ws:");

        for ($i = $Awfif::wsbl->{t}; $i <= $Awfif::wsbl->{h};$i++) {
          if ($Awfif::memes-> {pwscount}){

            print ("($i):$wsc[$i]");
            };#if
          $c [$i] = $wsc [$i];
          };#for ws

# itcpdisptcu1

        if (($Awfif::memes-> {ptelcount} )) {#print details of statement
          print ("tel count ");
          $remtc = -1;
          for ($i = $Awfif::wsbl->{t}+1; $i <= $Awfif::wsbl->{h};$i++) {

            $count = counttelst1 ($i, \$telcount);
            if (($telcount == $remtc) && ($i != $Awfif::wsbl-> {h})) {

              print ('.');
              }#if
            else {

              $remtc = $telcount;
              print ("($i:$telcount) ");
              };#else
            };#for ws
            print ("\n");
          };#if print telcount
        if (($Awfif::memes-> {pstment}) && (defined($Awfif::memes-> {statementwso}))) {#print details of statement

          $pr = $Awfif::memes-> {statementwso};
          print ("statement --- s($pr) ");
          if (!defined ($Awfif::memes-> {statementtwso})) {

            $pr = $Awfif::memes-> {currentwsbi};
            $Awfif::memes-> {currentwsbi} = $Awfif::memes-> {statementws};
            $Awfif::memes-> {statementtwso} = isterminated ($Awfif::memes-> {statementwso}, $Awfif::wsbl-> {wsoh} [$Awfif::memes-> {statementws}], $Awfif::wsbl-> {wsot} [$Awfif::memes-> {statementws}]);
            $Awfif::memes-> {currentwsbi} = $pr;
            $pr = $Awfif::memes-> {statementtwso};
            print ("e($pr) ");
            }#if
          else {

            $pr = $Awfif::memes-> {statementtwso};
            print ("e($pr) ");
            };#if
          print (" ---\n");
          };#if
        if ($Awfif::memes-> {pactive}) {

          my ($pplus);
          $actd = $Awfif::memes-> {acodelets};
          print ("active codelets --- ");
          $pr = $Awfif::memes-> {acodelets};
          print ("($pr) == ");
          $pplus = '';
          if ($c[0] > 0) {

            $pplus = 't';
            print ("(u:$c[0]) ");
            $actd = $actd - $c[0];
            };#if
          for ($i = $Awfif::wsbl->{t}; $i <= $Awfif::wsbl->{h};$i++) {

            if ($Awfif::wsbl-> {wsactive} [$i]) {#if this is an active workspace report the count

              if (($pplus)) {#for all but first

                print ("+ ");
                };#if
              $pplus = 't';
              print ("($i:$c[$i]) ");
              $actd = $actd - $c[$i];
              };#if
            };#for ws
          print (" ---\n");
          if ($actd != 0) {&break ()};
          };#if
        if (defined ($Awfif::memes-> {vbotwspdsc})){#report vbot world

          &itcanpoutput ();
          };#if
        if (($Awfif::memes-> {psubprogram}) && ($Awfif::subpl-> {p} > 1)) {

          my ($subi, $compcount);
          $compcount = 0;
          $pr = $Awfif::subpl-> {p} - 1;
          for ($subi = 1;$subi < $Awfif::subpl-> {p};$subi++){

            $compcount += itsubstate ($subi);
            };#for
          print ("subprograms t($pr) c($compcount) \n");
          };#print subprogram summary
# display the current apply acceleration count
        my ($pr, $pr2);
        $pr = $Awfif::memes->{applyactive};
        if ($Awfif::memes-> {tdfsampdo}) {$pr .= '(i)'};
        if ($Awfif::memes->{applyactive}) {

          if ($Awfif::memes-> {allowspigrabamp} <= 0) {

            $pr2 = '+spig';
            }#if
          elsif ($Awfif::memes-> {allowspigrabamp} > 0) {

            $pr2 = '-' . $Awfif::memes-> {allowspigrabamp};
            };#elsif
          if ($Awfif::memes-> {spiglvl} > 0){

            $pr2 .= ' amp';
            };#if
          };#if
        print ("ia th($Awfif::memes->{applycth}) ac($Awfif::memes->{applycount}:$pr$pr2) min($Awfif::memes->{applycmin}) ");
# itcpdiscou1

        my ($coi, $rco);
        for ($coi = 1; $coi <= $Awfif::costatel-> {p};$coi++) {

          if ($Awfif::costatel-> {l} [$coi] [3]) {

            $rco = 't';
            };#if
          };#for
        if ($rco) {
          print ("-> crowding out ");
          };
        print ("\n");
        }#if list valid
      else {

        print ("codelet list loop\n");
        &break ();
        };#else
      }#if not nocpdist
    elsif (defined ($Awfif::memes-> {vbotwspdsc})){#report vbot world

      &itcanpoutput ();
      };# elsif nocpdist
    if ($shour ne '') {

      my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat);
      ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat) = localtime(time);
      print ("Coderack entered $shour:$smin:$ssec now $hour:$min:$sec\n");
      }
    else {

      print ("\n");
      };
    $Awfif::memes-> {trace} = $ctrace;
    }# itcpdist
#
sub itcpdistp {# salience cache meter
    my ($b) = @_;
    my ($i1, $i2, @part, $currentct, $currenttd, $currentpart, $previous, $print, $rrequired, $introrequired, @tc);

    $part[0] = 'ts';
    $part[1] = 's';
    $part[2] = 'e';
    $part[3] = 'b';
    $part[4] = 'is';
    $part[5] = 'ih';
    $rrequired = '';#no cr/lf yet
    $previous = '';
    $introrequired = 't';
    $i2 = 0;
    $currentct = 'dummy';

    for my $act (@{$Awfif::memes-> {csset}}) {
      if ($act =~ /^(t)?($currentct)(scout|evaluator|builder|inspector|inhibitor)/i) {#more of this item
        $currenttd = $1;
        $currentpart = $3;
        $print = 't';
        }
      else {# new item setup $currentct
        $act =~ /^(t)?([\w]+)*(scout|evaluator|builder|inspector|inhibitor)/i;

        $currenttd = $1;
        $currentct = $2;
        $currentpart = $3;

        if ($currentct ne '') {
          $print = 't';
          if ($previous) {
            $rrequired = 't';
            }#if
          else {
            $previous = 't';
            };#else
          $introrequired = 't';
          }# if
        else {

          $print = '';
          $currentct = 'dummy';
          };#else
        };#else

      if (($print)
      && (itcqbused (\@$b, $act, 't'))
      ){

        if (($currentpart eq 'scout') && ($currenttd eq 't')) {
          $i2 = 0;
          }#if
        elsif ($currentpart eq 'scout') {

          $i2 = 1;
          }# elsif
        elsif ($currentpart eq 'evaluator') {

          $i2 = 2;
          }# elsif
        elsif ($currentpart eq 'inspector') {

          $i2 = 4;
          }# elsif
        elsif ($currentpart eq 'inhibitor') {

          $i2 = 5;
          }# elsif
        else {# assume its a builder

          $i2 = 3;
          };#else

        if ($rrequired) {
          print (")\n");
          $rrequired = '';
          };#if

        if ($introrequired) {
          print ("$currentct(");
          $introrequired = '';
          };#if
        print ("$part[$i2](");

        for ($i1 = $Awfif::wsbl->{t}+1; $i1 <= $Awfif::wsbl->{h};$i1++) {
          if ($Awfif::wsbl-> {wsactive}[$i1]) {
            my ($pr, $pr2, $pr3);
            $pr = $$b[$Awfif::memes-> {ch} {$act}] [$i1];
            if ($Awfif::memes-> {dcodeletc} [$Awfif::memes-> {ch} {$act}] [$i1] [1] ne '') {
              $pr2 = '+'.$Awfif::memes-> {dcodeletc} [$Awfif::memes-> {ch} {$act}] [$i1] [1];
              }
            else {
              $pr2 = '';
              };;
            if ($Awfif::memes-> {dcodeletc} [$Awfif::memes-> {ch} {$act}] [$i1] [0] ne '') {
              $pr3 = '-'. $Awfif::memes-> {dcodeletc} [$Awfif::memes-> {ch} {$act}] [$i1] [0];
              }
            else {
              $pr3 = '';
              };;
            print ("$i1:$pr$pr2$pr3 ");
# generate the salience histogram

            if (($tc [3] [2] < $pr) && (!( (($tc [2] [0] eq $act) && ($tc [2] [2] >= $pr)) or (($tc [1] [0] eq $act) && ($tc [1] [2] >= $pr)) or (($tc [0] [0] eq $act) && ($tc [0] [2] >= $pr)) )) ) {

              if (($tc [2] [2] < $pr) && (!( (($tc [2] [0] eq $act) && ($tc [2] [2] >= $pr)) or (($tc [1] [0] eq $act) && ($tc [1] [2] >= $pr)) or (($tc [0] [0] eq $act) && ($tc [0] [2] >= $pr)) )) ) {

                if (($tc [1] [2] < $pr) && (!( (($tc [2] [0] eq $act) && ($tc [2] [2] >= $pr)) or (($tc [1] [0] eq $act) && ($tc [1] [2] >= $pr)) or (($tc [0] [0] eq $act) && ($tc [0] [2] >= $pr)) )) ) {

                  if (($tc [0] [2] < $pr) && (!( (($tc [2] [0] eq $act) && ($tc [2] [2] >= $pr)) or (($tc [1] [0] eq $act) && ($tc [1] [2] >= $pr)) or (($tc [0] [0] eq $act) && ($tc [0] [2] >= $pr)) )) ) {

                    if (($tc [2] [0] eq $act) or ($tc [1] [0] eq $act)) {
                      if ($tc [2] [0] eq $act) {# 3 stays as it is
                        $tc [2] [0] = $tc [1] [0];# $act
                        $tc [2] [1] = $tc [1] [1];# $i2 (part)
                        $tc [2] [2] = $tc [1] [2];# urg
                        $tc [1] [0] = $tc [0] [0];# $act
                        $tc [1] [1] = $tc [0] [1];# $i2 (part)
                        $tc [1] [2] = $tc [0] [2];# urg
                        $tc [0] [0] = $act; # $act
                        $tc [0] [1] = $i1;# (workspace)
                        $tc [0] [2] = $pr;# urg
                        }# if
                      elsif ($tc [1] [0] eq $act) {# 2 & 3 stay as they are
                        $tc [1] [0] = $tc [0] [0];# $act
                        $tc [1] [1] = $tc [0] [1];# $i2 (part)
                        $tc [1] [2] = $tc [0] [2];# urg
                        $tc [0] [0] = $act; # $act
                        $tc [0] [1] = $i1;# (workspace)
                        $tc [0] [2] = $pr;# urg
                        };# elsif
                      }
                    else {
                      $tc [3] [0] = $tc [2] [0];# $act
                      $tc [3] [1] = $tc [2] [1];# $i2 (part)
                      $tc [3] [2] = $tc [2] [2];# urg
                      $tc [2] [0] = $tc [1] [0];# $act
                      $tc [2] [1] = $tc [1] [1];# $i2 (part)
                      $tc [2] [2] = $tc [1] [2];# urg
                      $tc [1] [0] = $tc [0] [0];# $act
                      $tc [1] [1] = $tc [0] [1];# $i2 (part)
                      $tc [1] [2] = $tc [0] [2];# urg
                      $tc [0] [0] = $act; # $act
                      $tc [0] [1] = $i1;# (workspace)
                      $tc [0] [2] = $pr;# urg
                      };
                    } #if
                  else {

                    if (($tc [2] [0] eq $act) ) { stays as it is
                      $tc [2] [0] = $tc [1] [0];# $act
                      $tc [2] [1] = $tc [1] [1];# $i2 (part)
                      $tc [2] [2] = $tc [1] [2];# urg
                      $tc [1] [0] = $act; # $act
                      $tc [1] [1] = $i1;# (workspace)
                      $tc [1] [2] = $pr;# urg
                      }
                    else {
# current stuff
                      $tc [3] [0] = $tc [2] [0];# $act
                      $tc [3] [1] = $tc [2] [1];# $i2 (part)
                      $tc [3] [2] = $tc [2] [2];# urg
                      $tc [2] [0] = $tc [1] [0];# $act
                      $tc [2] [1] = $tc [1] [1];# $i2 (part)
                      $tc [2] [2] = $tc [1] [2];# urg
                      $tc [1] [0] = $act; # $act
                      $tc [1] [1] = $i1;# (workspace)
                      $tc [1] [2] = $pr;# urg
                      };#else
                    };#else
                  } #if
                else {

                  $tc [3] [0] = $tc [2] [0];# $act
                  $tc [3] [1] = $tc [2] [1];# $i2 (part)
                  $tc [3] [2] = $tc [2] [2];# urg
                  $tc [2] [0] = $act; # $act
                  $tc [2] [1] = $i1;# (workspace)
                  $tc [2] [2] = $pr;# urg
                  }; #else
                } #if
              else {

                $tc [3] [0] = $act; # $act
                $tc [3] [1] = $i1;# (workspace)
                $tc [3] [2] = $pr;# urg
                }; #else
              }; #if
            };#if
# };#for i3
          };#for ws

        print (")");
        };#if
      };#for act

    print (") \n");
    print ("histogram $tc[0][0]($tc[0][1]:$tc[0][2]) $tc[1][0]($tc[1][1]:$tc[1][2]) $tc[2][0]($tc[2][1]:$tc[2][2]) $tc[3][0]($tc[3][1]:$tc[3][2])\n");
    }# itcpdistp
#<!-- end tag uts -->
#
sub countcdel {
    my($codelet, $mode)=@_;
    my ($cll, $usemode, @part, $wsc, $wsi );
# Deleted codelet node distribution indicates the population of each type of deleted codelet.
#
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("countcdel codelet $codelet, mode ($mode) ");
      };
    $cll = $codelet;
    $wsc = 0;
    $part[0] = 'ts';
    $part[1] = 's';
    $part[2] = 'e';
    $part[3] = 'b';
    if (!defined($mode)) {
      $usemode = 0;
      }#if
    else {
      $usemode = $mode;
      };#else

    if (defined($Awfif::codelet->{l} [$cll][19])) {
      $wsi = $Awfif::codelet->{l} [$cll][19];
      }
    else {

      $wsi = 0;#bucket for unassigned
      };#else
    $Awfif::memes-> {dcodeletc} [$Awfif::memes-> {ch} {$Awfif::codelet-> {l} [$cll] [2]}] [$wsi][$usemode]++;
# handle the case of evaluator switch
    if ((defined ($Awfif::codelet-> {l} [$cll] [27]) )
    && ($Awfif::codelet-> {l} [$cll] [27] =~ /evaluator/i)
    ){

      $Awfif::memes-> {dcodeletc} [$Awfif::memes-> {ch} {$Awfif::codelet-> {l} [$cll] [27]}] [$wsi][$usemode]++;
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my($pr, $i2, $i3);
# Count the total

      $i2 = 0;
      for my $act (@{$Awfif::memes-> {csset}}) {
        for ($i2 = $Awfif::wsbl-> {t}+1 ; $i2 <= $Awfif::wsbl-> {h}; $i2++) {
          for ($i3 = 0; $i3 <= 1; $i3++) {
            $wsc = $wsc + $Awfif::memes-> {dcodeletc} [$Awfif::memes-> {ch} {$act}][$i2][$i3];
            };#for i3
          };#for i2
        };#for act
      $pr = $wsc;
      print ("countcdelx total ($pr) with ");
      $pr = $Awfif::codelet-> {l} [$cll] [2];
      print ("$pr at ");
      $pr = $Awfif::memes-> {dcodeletc} [$Awfif::memes-> {ch} {$Awfif::codelet-> {l} [$cll] [2]}] [$wsi][$usemode];
      print ("$pr\n");
      };
#
    }# countcdel
#<!-- start tag sir -->
#
sub ldlearning {# general feedforward energy delta signal
    my ($result, $update);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ldlearning ");
      };

    $update = '';
    $result = $Awfif::memes-> {ldsignal};
    if ($Awfif::memes-> {ldlcycle} >= $Awfif::memes-> {ldlcyclemax}) {

      $Awfif::memes-> {ldlcycle} = 0;
      $Awfif::memes-> {ldmcycle} = 0;
      $update = 't';
      }
    elsif ($Awfif::memes-> {ldmcycle} >= $Awfif::memes-> {ldmcyclemax}) {

      $Awfif::memes-> {ldlcycle}++;
      $Awfif::memes-> {ldmcycle} = 0;
      $update = 't';
      }
    else {

      $Awfif::memes-> {ldmcycle}++;
      };
# buffer housekeeping
    if ($update) {#update averages & buffer
      my ($ochange, $i, $shift, $gonegative);
# aim to shift the gtp level within maxldav and minldav values

      $shift = 0;
      if (($Awfif::memes-> {ldav} > $Awfif::memes-> {maxldav})
      && ($Awfif::memes-> {fgtp} > int ($Awfif::memes-> {maxldav}/2))
      && (defined ($Awfif::memes-> {ldbmin}))
      && ($Awfif::memes-> {ldbmin} > int ($Awfif::memes-> {maxldav}/2))
      ){

        $shift = $Awfif::memes-> {ldbmin};
        $Awfif::memes-> {fgtp} -= $shift;
        for ($i = 0; $i <= $Awfif::memes-> {ldlcyclemax}; $i++) {

          $Awfif::memes-> {ldbuffer} [$i] -= $shift;
          };#for
        } #if
      elsif (($Awfif::memes-> {ldav} < $Awfif::memes-> {minldav})
      && ($Awfif::memes-> {fgtp} < int ($Awfif::memes-> {minldav}/2))
      && (defined ($Awfif::memes-> {ldbmin}))
      && ($Awfif::memes-> {ldbmin} < int ($Awfif::memes-> {minldav}/2))
      ){

        $shift = $Awfif::memes-> {ldbmin};
        $Awfif::memes-> {fgtp} -= $shift;
        for ($i = 0; $i <= $Awfif::memes-> {ldlcyclemax}; $i++) {

          $Awfif::memes-> {ldbuffer} [$i] -= $shift;
          };#for
        };#else

      $ochange = $Awfif::memes-> {ldav} - $Awfif::memes-> {ldoav};
      $Awfif::memes-> {ldav} -= $shift;
      $Awfif::memes-> {ldoav} = $Awfif::memes-> {ldav};
      $Awfif::memes-> {ldbuffer} [$Awfif::memes-> {ldlcycle}] = $Awfif::memes-> {fgtp};
      $Awfif::memes-> {ldav} = 0;
      $Awfif::memes-> {ldbmin} = $Awfif::memes-> {ldoav};
      if (($Awfif::memes-> {ldbmin} >= 0) ){

        $gonegative = 't';
        }#if
      else {

        $gonegative = '';
        };#else
      for ($i = 0; $i <= $Awfif::memes-> {ldlcyclemax}; $i++) {

        $Awfif::memes-> {ldav} = $Awfif::memes-> {ldav} + ($Awfif::memes-> {ldbuffer} [$i]);
        if (($gonegative) && ($Awfif::memes-> {ldbmin} > $Awfif::memes-> {ldbuffer} [$i])) {

          $Awfif::memes-> {ldbmin} = $Awfif::memes-> {ldbuffer} [$i];
          }#if
        elsif ((!$gonegative) && ($Awfif::memes-> {ldbmin} < $Awfif::memes-> {ldbuffer} [$i])) {

          $Awfif::memes-> {ldbmin} = $Awfif::memes-> {ldbuffer} [$i];
          };#elsif
        };#for
      if ($Awfif::memes-> {ldav} != 0) {

        $Awfif::memes-> {ldav} = int($Awfif::memes-> {ldav}/($Awfif::memes-> {ldlcyclemax}+1));
        };#if
# update the trends

      if ((($Awfif::memes-> {ldav} - $Awfif::memes-> {ldoav}) - $ochange < $Awfif::memes-> {lderr})
      && (($Awfif::memes-> {ldav} - $Awfif::memes-> {ldoav}) - $ochange > (-$Awfif::memes-> {lderr}))) {

        $result = 0;
        }#0
      elsif ((($Awfif::memes-> {ldav} - $Awfif::memes-> {ldoav}) - $ochange > ($Awfif::memes-> {lderr}))) {

        $result = 1;
        }#+ve trend
      else {

        $result = -1;
        };#-ve trend
      };#if
# if the old average - current delta -> new average then no change (0)

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ldlearningx ldmc $Awfif::memes->{ldmcycle} ret $result\n");
      };

    $Awfif::memes-> {ldsignal} = $result;
    if ($Awfif::memes-> {ldsignal} != 0) {
      $Awfif::memes-> {ldtrend} = $Awfif::memes-> {ldav} - $Awfif::memes-> {ldoav};#want negative if old is bigger than new
      };#if
    return $result
    }# ldlearning
#
#<!-- end tag sir -->
#<!-- start tag scc -->
#<!-- start tag uts -->
#<!-- start tag sia -->
#
sub freeswitch34tail {
    my($codelet, $mode)=@_;
    my ($plink, $hlink, $tlink, $rhlink, $rtlink, $cwsbi, $result, $finished, $rcodelet, $newcodeletpt);
    my($newpt);
# look for a codelet that is deletable starting from the pseudo tail which is the first undeletable codelet detected

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freeswitch34tail codelet($codelet) ");
      print ("pseudo tail($Awfif::memes->{codeletpt}) ");
      };#if
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $result = '';
    $finished = '';
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == $Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1]))
    ){

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1]))
    ){

      &break ();
      };# check for circular references
    if ($Awfif::memes-> {codeletpt} > 0){

      $plink = $Awfif::memes-> {codeletpt};
      }
    elsif ($Awfif::memes-> {codeletpt} == 0) {

      $plink = $Awfif::codelet-> {l} [$codelet][1];
      if ($plink == 0) {

        $finished = 't';
        };#if
      }#else no help from pseudo tail pointer
    else {#codeletpt <0 => negative old head where the list ran out of further codelets to try and swop/free

      if ($Awfif::memes-> {codeletpt} == ($Awfif::memes-> {codeleth} * -1) ){

        $finished = 't';
        $plink = 0;
        } #if the pseudo tail is also the head so no further codelets to check
      else {# work forward from the old head

        $plink = ($Awfif::memes-> {codeletpt} * -1);# move on from the old head towards the current head
        $newcodeletpt = 0;
        };#else
      };#codeletpt negative
    if ((defined ($plink)) && ($plink < 0)) {&break ();};
    while ( (!$finished)
    && (defined ($plink))
    && ($plink != 0)
    && (freescheckcantd ($plink, $mode)) #keep going while plink codelet cant be deleted
    ){

      if ($plink != $Awfif::memes-> {codeleth} ){

        $plink = $Awfif::codelet-> {l} [$plink][1];
        if ($plink == 0) {

          $finished = 't';
          };#if
        }#if
      else {#reached end

        $finished = 't';
        };#else
      };#while
# next complete block identifies the next pseudo tail
    if ((defined ($plink)) && ($plink < 0)) {&break ();};
    if ($Awfif::memes-> {codeletpt} > 0){#there were unchecked codelets between pseudo tail and head

# was using plink of current [pseudo] tail. After search that is now the newpt and plink is used to indicate the head of the undeletable sublist
      $newpt = $plink;
      $plink = $Awfif::memes-> {codeletpt};#first deletable should be presented
      if (!$finished) {#identify the next pseudo tail

        if ($Awfif::memes-> {codeletpt} == $newpt) {#
          $newcodeletpt = $Awfif::codelet-> {l} [$newpt] [1];#newcodeletpt will be the new pseudo tail when exit
          }#if
        else {
          $newcodeletpt = $newpt;#newcodeletpt will be the new pseudo tail when exit
          };#else
        }#if
      else {#no further deletable item so new pseudo tail is

        $newcodeletpt = ($Awfif::memes-> {codeleth} * -1);#newcodeletpt will be the new pseudo tail when exit
# looks wrong $finished = '';#since we have the pseudo tail item
        };#else
      }#if
    elsif ($finished){

      $newcodeletpt = ($Awfif::memes-> {codeleth} * -1);#newcodeletpt will be the new pseudo tail when exit
      }#elsif
    else {#codeletpt <= 0 and not finished

      $newcodeletpt = $Awfif::codelet-> {l} [$plink] [1];#newcodeletpt will be the new pseudo tail when exit
      };#else
# have identified the next pseudo tail codelet
    if ((defined ($plink)) && ($plink < 0)) {&break ();};
# proceed to swop current real tail with deletable codelet
    if ((!$finished)
    && ($plink != $codelet)
    ){#swop $codelet and $plink codelet

      $result = 't';
      if (($plink <= 0) or ($codelet <= 0) ){ &break ();};
      $rcodelet = $plink;
      $rtlink = $Awfif::codelet-> {l} [$rcodelet] [0];#towards the tail
      $rhlink = $Awfif::codelet-> {l} [$rcodelet] [1];#nearer the head
      $tlink = $Awfif::codelet-> {l} [$codelet] [0];#towards the tail
      $hlink = $Awfif::codelet-> {l} [$codelet] [1];#nearer the head
      if ( ($tlink == $hlink)
      or ($rtlink == $rhlink)
      ){

        &break ();
        };# check for circular references
      if ($hlink == $rcodelet) {#the swop codelets reference each other

        $Awfif::codelet-> {l} [$codelet] [0] = $hlink;
        $Awfif::codelet-> {l} [$codelet] [1] = $rhlink;
        $Awfif::codelet-> {l} [$rcodelet] [0] = $tlink;
        $Awfif::codelet-> {l} [$rcodelet] [1] = $rtlink;
        if ($codelet == $Awfif::memes-> {codelett}) {

          $Awfif::memes-> {codelett} = $rcodelet;
          }#if
        else {

          $Awfif::codelet-> {l} [$tlink] [0] = $rcodelet;
          };#else
        if ($rcodelet == $Awfif::memes-> {codeleth}) {

          $Awfif::memes-> {codeleth} = $codelet;
          }#if
        else {

          $Awfif::codelet-> {l} [$rhlink] [0] = $codelet;
          };#else
        }#if
      else {
# now relink the rest of list

        $Awfif::codelet-> {l} [$codelet] [0] = $rtlink;
        $Awfif::codelet-> {l} [$codelet] [1] = $rhlink;
        $Awfif::codelet-> {l} [$rcodelet] [0] = $tlink;
        $Awfif::codelet-> {l} [$rcodelet] [1] = $hlink;
        if ( ($codelet == $Awfif::memes-> {codelett})
        && ($rcodelet == $Awfif::memes-> {codeleth})
        ){

          $Awfif::memes-> {codeleth} = $codelet;
          $Awfif::codelet-> {l} [$rtlink] [1] = $codelet;
          $Awfif::memes->{codelett} = $rcodelet;
          $Awfif::codelet-> {l} [$hlink] [0] = $rcodelet;
          }#if
        elsif ( ($codelet == $Awfif::memes-> {codelett})
        ){

          $Awfif::codelet-> {l} [$rhlink] [0] = $codelet;
          $Awfif::codelet-> {l} [$rtlink] [1] = $codelet;
          $Awfif::memes-> {codelett} = $rcodelet;
          $Awfif::codelet-> {l} [$hlink] [0] = $rcodelet;
          }#elsif
        elsif ( ($codelet == $Awfif::memes->{codeleth})
        ){

          $Awfif::memes-> {codeleth} = $codelet;
          $Awfif::codelet-> {l} [$rtlink] [1] = $codelet;
          $Awfif::codelet-> {l} [$tlink] [1] = $rcodelet;
          $Awfif::codelet-> {l} [$hlink] [0] = $rcodelet;
          }#elsif
        else {

          $Awfif::codelet-> {l} [$rhlink] [0] = $codelet;
          $Awfif::codelet-> {l} [$rtlink] [1] = $codelet;
          $Awfif::codelet-> {l} [$tlink] [1] = $rcodelet;
          $Awfif::codelet-> {l} [$hlink] [0] = $rcodelet;
          };#else
        };#else
      };#if

if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freeswitch34tailx ");
      if ($result) {
        print ("codelet($codelet) switched with($rcodelet)");
        };#switched
      print ("pseudo tail($Awfif::memes->{codeletpt}) ");
      if (defined ($newcodeletpt) ){
        print ("becomes($newcodeletpt) ");
        };#if
      print ("ret ($result)\n");
      };
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
    or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == $Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1]))
    ){

      &break ();
      };# check for circular references
    if ( (($rcodelet > 0) && ($Awfif::codelet-> {l} [$rcodelet][0] == $Awfif::codelet-> {l} [$rcodelet][1]))
    ){

      &break ();
      };# check for circular references
    if ( (($codelet > 0) && ($Awfif::codelet-> {l} [$codelet][0] == $Awfif::codelet-> {l} [$codelet][1]))
    ){

      &break ();
      };# check for circular references
    if (defined ($newcodeletpt) ){

      $Awfif::memes-> {codeletpt} = $newcodeletpt;
      if (($newcodeletpt > 0) && ($Awfif::codelet-> {t} [$Awfif::memes-> {codeletpt}] == $Awfif::memes-> {snnh}{deferred} )
      or ($newcodeletpt < 0) && ($Awfif::codelet-> {t} [(-1 * $Awfif::memes-> {codeletpt})] == $Awfif::memes-> {snnh}{deferred} )
      ){ &break ();};
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# freeswitch34tail
#
#<!-- start tag inh -->
#
sub freescheckcantd {
    my($codelet, $mode)=@_;
    my ($cantd, $cwsbi, $ws, $i);
# check the local squares for a match with the desired situation, relative to current position

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freescheckcantd codelet($codelet) ");
      };#if
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

# handle codelets that can't be deleted due to activation or inhibition
    $cantd = '';

    if ($Awfif::codelet->{l} [$codelet] [34] != 0) {#catalysed so can't be deleted

      $cantd = 't';
      };#if
# activation
# activstdel
    if (($Awfif::codelet-> {l} [$codelet] [19] != 0)) {

      $ws = $Awfif::codelet-> {l} [$codelet][19];
      }
    else {#default to current ws

      $ws = $Awfif::memes-> {currentwsbi};
      };
# freebldup1
    if (($mode != 1) #this has not been run
    && (!$cantd)
    && ($Awfif::codelet-> {l} [$codelet][2] =~ /builder/) #if got to be builder ensure runs
    ){

      $cantd = 't';
      }
# freecjhlsiup1
    elsif (($mode != 1) #this has not been run
    && (!$cantd)
    && (($Awfif::codelet-> {l} [$codelet][23] != 0)
    && ($Awfif::memes-> {snw} [$ws]-> {snna} {$Awfif::memes-> {snnih} {$Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet] [23]] [6]}} > $Awfif::memes-> {killth}))
    ){

      $cantd = 't';
      }
# freecjhlsoiup1
    elsif (($mode != 1)
    && (!$cantd)
    && ($Awfif::codelet-> {l} [$codelet][30] != 0)
    && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet][30]] [14] [2] <= 1)
    ){

      $cantd = 't';
      }
# freectfreeup1
    elsif (($mode != 1)
    && (!$cantd)
    && ($Awfif::codelet-> {l} [$codelet][32] != 0)
    ){#cascade sponsor can't be freed

      $cantd = 't';
      }
# freectrunpu1
    elsif (($Awfif::memes-> {cruna}[0] > 0)
    && (!$cantd)
    && (matchaelement (\@{$Awfif::memes-> {cruna}}, $codelet) != 0 )
    ){#running codelet can't be freed

      $cantd = 't';
      }
    elsif (($mode != 1)
    && (!$cantd)
    && (($Awfif::codelet-> {l} [$codelet][2] eq 'tgoalscout')
    or ($Awfif::codelet-> {l} [$codelet][2] eq 'goalevaluator'))
    ){#groupcomplete signals should work

      $cantd = 't';
      };
# freecinhcdu1
# inhibition
    for ($i = 1; (($i < $Awfif::inhibl-> {p}) && (!$cantd)); $i++) {
      if ($Awfif::inhibl-> {l} [$i][3] == $codelet) {

        $cantd = 't';
        $Awfif::codelet-> {l} [$codelet] [3] *= ($Awfif::memes-> {inhuramp} * $Awfif::wsbl->{p});
        };#if
      };#for

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("freescheckcantdx ");
      print ("ret $cantd\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $cantd
    }# freescheckcantd
#
#<!-- end tag inh -->
#
sub waitonwalls {
    my($myli, $sponsor, $cws, $bcwso, $north, $south, $east, $west)=@_;
    my ($proceed, $cwsbi);
# check the local squares for walls, relative to current position. if find issue wait

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("waitonwalls myli $myli cws($cws) bcwso($bcwso) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $proceed = '';
    if ( ($north == $Awfif::memes-> {snnh} {wall})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {north}, $north);
      $proceed = 't';
      };#if
    if ( ($south == $Awfif::memes-> {snnh} {wall})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {south}, $south);
      $proceed = 't';
      };#if
    if ( ($east == $Awfif::memes-> {snnh} {wall})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {east}, $east);
      $proceed = 't';
      };#if
    if ( ($west == $Awfif::memes-> {snnh} {wall})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {west}, $west);
      $proceed = 't';
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("waitonwallsx ");
      print ("ret ($proceed) \n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $proceed
    }# waitonwalls
#
sub activatevbtm {
    my($myli, $cws, $abcwso, $north, $south, $east, $west, $stay)=@_;
    my ($proceed, $cwsbi, $wosdsc);
# issue synced descriptor to activate in region models, reporting first wall, first can or stay when all empty

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr, $pr2, $pr3, $pr4, $pr5);
      $pr = $Awfif::memes-> {snnih} {$north};
      $pr2 = $Awfif::memes-> {snnih} {$south};
      $pr3 = $Awfif::memes-> {snnih} {$east};
      $pr4 = $Awfif::memes-> {snnih} {$west};
      $pr5 = $Awfif::memes-> {snnih} {$stay};
      print ("activatevbtm myli $myli cws($cws) abcwso($abcwso) north($pr($north)) south($pr2($south)) east($pr3($east)) west($pr4($west)) stay($pr5($stay)) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $proceed = 't';
    $wosdsc = 0; #define so it will be setup
    if ( ($north == $Awfif::memes-> {snnh} {wall})
    ){

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {north}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $north), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {north},#sltype
        $north,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $north;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {north};
      $proceed = '';
      };#if
    if ( ($south == $Awfif::memes-> {snnh} {wall})
    ){

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {south}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $south), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {south},#sltype
        $south,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $south;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {south};
      $proceed = '';
      };#if
    if ( ($east == $Awfif::memes-> {snnh} {wall})
    ){

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {east}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $east), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {east},#sltype
        $east,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $east;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {east};
      $proceed = '';
      };#if
    if ( ($west == $Awfif::memes-> {snnh} {wall})
    ){

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {west}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $west), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {west},#sltype
        $west,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $west;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {west};
      $proceed = '';
      };#if
    if ($proceed) {#force wait on desc for each can found

      if ( ($north == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {north}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $north), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {north},#sltype
          $north,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $north;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {north};
        $proceed = '';
        };#if
      if ( ($south == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {south}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $south), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {south},#sltype
          $south,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $south;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {south};
        $proceed = '';
        };#if
      if ( ($east == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {east}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $east), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {east},#sltype
          $east,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $east;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {east};
        $proceed = '';
        };#elsif
      if ( ($west == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {west}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $west), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {west},#sltype
          $west,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $west;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {west};
        $proceed = '';
        };#if
      if ( ($stay == $Awfif::memes-> {snnh} {can})
      ){

        $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
          = inccounter ( $Awfif::memes-> {snnh} {stay}, #pltype
          ($Awfif::memes-> {snnh} {wsi} + $stay), #pto
          $Awfif::memes-> {snnh} {waitonsquare}, #from
          $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
          $abcwso,#awso
          't',#synccod
          $Awfif::memes-> {snnh} {stay},#sltype
          $stay,#spto
          undef (), #transmgrid
          undef (), #$atelhwso
          undef (), #active
          \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
        $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $stay;
        $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {stay};
        $proceed = '';
        };#if
      };#if
    if ($proceed) {#force wait on desc for stay empty

      $Awfif::wsol-> {l} [$abcwso][2] #now force the waitondesc to complete
        = inccounter ( $Awfif::memes-> {snnh} {stay}, #pltype
        ($Awfif::memes-> {snnh} {wsi} + $stay), #pto
        $Awfif::memes-> {snnh} {waitonsquare}, #from
        $Awfif::wsol-> {l} [$abcwso] [2],#dlinkh
        $abcwso,#awso
        't',#synccod
        $Awfif::memes-> {snnh} {stay},#sltype
        $stay,#spto
        undef (), #transmgrid
        undef (), #$atelhwso
        undef (), #active
        \$wosdsc );#used counteri
# counter so ensure 2/3 got setup
      $Awfif::workspace-> {l} [$wosdsc] [2] = $Awfif::memes-> {snnh} {wsi} + $stay;
      $Awfif::workspace-> {l} [$wosdsc] [3] = $Awfif::memes-> {snnh} {stay};
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("activatevbtmx \n");
      };
    }# activatevbtm
#
sub waitoncans {
    my($myli, $sponsor, $cws, $bcwso, $north, $south, $east, $west, $stay)=@_;
    my ($proceed, $cwsbi);
# check the local squares for cans, relative to current position. if find issue wait

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("waitoncans myli $myli cws($cws) bcwso($bcwso) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $proceed = '';
    if ( ($north == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {north}, $north);
      $proceed = 't';
      };#if
    if ( ($south == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {south}, $south);
      $proceed = 't';
      };#if
    if ( ($east == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {east}, $east);
      $proceed = 't';
      };#if
    if ( ($west == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {west}, $west);
      $proceed = 't';
      };#if
    if ( ($stay == $Awfif::memes-> {snnh} {can})
    ){

      &waitforsquare ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {stay}, $stay);
      $proceed = 't';
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("waitoncansx ");
      print ("ret ($proceed) \n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $proceed
    }# waitoncans
#
sub getmappedvbttrns {
    my($myli)=@_;
    my ($cwsbi, $i, $i2);
    my (@list);
# generate a list of transaction mapped model to action codelet jhls entries

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getmappedvbttrns myli $myli ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    for ($i = 1; $i < $Awfif::jhls-> {p}; $i++){
      if (($Awfif::jhls-> {l} [$i] [4] == $Awfif::memes-> {snnh} {operon}) && ($Awfif::jhls-> {l} [$i] [18] [0] > 0)){

        for ($i2 = 1; (($i2 <= $Awfif::jhls-> {l} [$i] [18] [0]) && ($list [$list [0]] != $i)); $i2++){
          if ($Awfif::jhls-> {l} [$i] [18] [$i2] =~ /vbttoa(.+)*builder/i){

            $list [++$list [0]] = $i;
            };#if
          };#for
        }#if
      };#for
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("getmappedvbttrnsx ");
      print ("@list");
      print ("\n");
      };
    return @list
    }# getmappedvbttrns
#
#<!-- end tag sia -->
#<!-- end tag scc -->
#<!-- end tag uts -->
#
sub cscmapieval {
    my ($myli, $vbotscmapie, $vbotscmapij)=@_;
    my ($cwsbi, $i, @i2, $linkp, @conceptid, $sigcount, $requirementfailed);
    my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge );# first null attribute is taken as end
# generate a list of csc mapped ievaluator hashes %Awfif::vbotcscmapiev

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("cscmapieval myli $myli ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state
# To compute get the schematic strings from vbotscmap [0][0][i] jhls entry
    $requirementfailed = '';
    for ($i = 1; $i <= $Awfif::vbotga-> {scmap0} [0] [0]; $i++){

      $linkp = $Awfif::jhls-> {l} [ $Awfif::vbotga-> {scmap0} [0] [$i] ] [5];
      $i2[$i] = 3;
      if ($linkp != 0) {

        $linkp = $Awfif::attribs-> {l} [$linkp][1];# move past the attribs
        };
      while (($linkp != 0) && ($Awfif::attribs-> {l} [$linkp][2] != $Awfif::memes-> {snnh} {attribe})) {# have not reached end of the attribute tupple list

        $conceptid[$i][$i2 [$i]] = $Awfif::attribs-> {l} [$linkp][3];
        $i2 [$i]++;
        $linkp = $Awfif::attribs-> {l} [$linkp][1];# move forward until run into an attribe
        };# while there are active codelets

      };#for $i
# and replace <vbt><schema> by <vbt><for><vbot><process>
    for ($i = 1; $i <= $Awfif::vbotga-> {scmap0} [0] [0]; $i++){

      $conceptid [$i] [1] = $Awfif::memes-> {snnh} {vbt};
      $conceptid [$i] [2] = $Awfif::memes-> {snnh} {for};
      $conceptid [$i] [3] = $Awfif::memes-> {snnh} {vbot};
      $conceptid [$i] [4] = $Awfif::memes-> {snnh} {process};
      };#for
# and obtain the pseudoconcept -> evaluator.
    for ($i = 1; (($i <= $Awfif::vbotga-> {scmap0} [0] [0]) && (!$requirementfailed)) ; $i++){

      my ($i3, $snl, $found);
      $sigcount = labinv2 ($myli, \@{$conceptid [$i]}, $i2[$i], \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, 'notoporstbinding');
# now filter as in operonlmatch

      if ($sigcount > 0) {

        for ($i3 = 0; $i3 < $sigcount; $i3++) {

          if ($lomatchs[$i3]) {#there is a link use the association
# if not remove it from the match set (set $lomatchs[$i] false
            if (($Awfif::jhls-> {l} [$lola [$i3]] [3] != $Awfif::memes-> {snnh} {spsignal})
            ) {

              $lomatchs [$i3] = '';
              }
            else {

              $snl = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::jhls-> {l} [$lola [$i3]] [6] ];
              $found = '';
              while ((!$found) && ($snl != 0)){

                if ($Awfif::slipnet-> {l} [$snl] [3] == $Awfif::memes-> {snnh}{evaluator}){

                  $found = 't';
                  $$vbotscmapie [$i] = $Awfif::slipnet-> {l} [$snl] [2];
                  $Awfif::vbotha-> {scmapehi}-> {$Awfif::slipnet-> {l} [$snl] [2]} = $i;
                  };#if

                $snl = $Awfif::slipnet-> {l}[$snl][0];
                };#while
              };#else
            };#
          };#for
        };#if
# and now find the deployed operon
      $sigcount = labinv2 ($myli, \@{$conceptid [$i]}, $i2[$i], \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, 'opbinding');
# now filter as in operonlmatch

      if ($sigcount > 0) {

        my ($finished);
        $finished = '';
        for ($i3 = 0; (($i3 < $sigcount) && (!$finished)); $i3++) {

          if ($lomatchs[$i3]) {#there is a link use the association
# if its for a deployed operon then record it
            if (($Awfif::jhls-> {l} [$lola [$i3]] [4] == $Awfif::memes-> {snnh} {operon})
            && ($Awfif::jhls-> {l} [$lola [$i3]] [3] == $Awfif::memes-> {snnh} {groupcategory}) #this is a group completed operon
            && (defined ($Awfif::jhls-> {l} [$lola [$i3]] [7]))
            && (defined ($Awfif::jhls-> {l} [$lola [$i3]] [8]))
            && (defined ($Awfif::jhls-> {l} [$lola [$i3]] [9]))
            ) {

              $$vbotscmapij [$i] = $lola [$i3];
              $finished = 't';
              };#if
            };#if
          };#for
        if (!$finished) {#missing a required item

          $requirementfailed = 't';
          };#if
        };#if

      };#for
# Add i to front and this is the evaluator name that equates to the i element of vbotscmap
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("cscmapievalx ");
      print ("$requirementfailed");
      print ("\n");
      };
    return $requirementfailed
    }# cscmapieval
#
sub resetcans {
    my($myli, $sponsor, $grkwp, $grkwpr)=@_;
    my ($cansf, $bcount, $cansws, $cansbasewso, $cansstartwso, $canwso, $acanwso, $candsc,
    $nextws, $nextwso, $anextwso, $cwsbi, $stwso, $astwso);
# reset any picked up cans to not picked up

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("resetcans myli $myli ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $stwso = getmystatement ($myli, $sponsor, $grkwp, $grkwpr);
    $astwso = awsoadr ($stwso);
    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    my ($worldf, $wws, $worldstartwso, $counteri);
    if ( !defined ($Awfif::vbotworld-> {worldf}) ){

      $worldf = ifindb ($myli, $stwso, 'vworldb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
      $Awfif::vbotworld-> {worldbasewso} = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$wws);
      $Awfif::vbotworld-> {worldf} = $worldf;
      $Awfif::vbotworld-> {wws} = $wws;
      }
    else {

      $worldf = $Awfif::vbotworld-> {worldf};
      $wws = $Awfif::vbotworld-> {wws};
      };#else

    if ($worldf == 1) {

      if ( !defined ($Awfif::vbotworld-> {vwxstart})){

        $bcount = ifindb ($myli, $stwso, 'vwxstartb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), undef (), $wws);
        $worldstartwso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $wws);
        $Awfif::vbotworld-> {vwxstart} = $bcount;
        $Awfif::vbotworld-> {worldstartwso} = $worldstartwso;
        }
      else {

        $bcount = $Awfif::vbotworld-> {vwxstart};
        $worldstartwso = $Awfif::vbotworld-> {worldstartwso};
        };#else
      if ( !defined ($Awfif::vbotworld-> {cansf})){

        $cansf = ifindb ($myli, $stwso, 'vcansb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
        $cansbasewso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cansws);
        $Awfif::vbotworld-> {cansf} = $cansf;
        $Awfif::vbotworld-> {cansbasewso} = $cansbasewso;
        $Awfif::vbotworld-> {cansws} = $cansws;
        }
      else {

        $cansf = $Awfif::vbotworld-> {cansf};
        $cansbasewso = $Awfif::vbotworld-> {cansbasewso};
        $cansws = $Awfif::vbotworld-> {cansws};
        };#else
      if ($cansf == 1) {

        if ( !defined ($Awfif::vbotworld-> {vwxstartc})){

          $bcount = ifindb ($myli, $stwso, 'vwxstartb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), undef (), $cansws);#, undef (), undef (), undef (), 't');
          $cansstartwso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $cansws);
          $Awfif::vbotworld-> {vwxstartc} = $bcount;
          $Awfif::vbotworld-> {cansstartwso} = $cansstartwso;
          }
        else {

          $bcount = $Awfif::vbotworld-> {vwxstartc};
          $cansstartwso = $Awfif::vbotworld-> {cansstartwso};
          };#else
        if (($bcount == 1) #can distribute cans
        ){#

          my ($conformstoresource, $descfits);
          $Awfif::memes-> {currentwsbi} = $cansws;
          $canwso = $cansstartwso;
          do {#for each can

            $Awfif::memes-> {currentwsbi} = $cansws;
            $canwso = trwsoadr ($canwso, 1);
            $acanwso = awsoadr ($canwso);
            if( (($candsc = findtdesc ($Awfif::wsol-> {l} [ ($acanwso)] [2], $Awfif::memes-> {snnh} {canposition})) != 0)
            && ($Awfif::workspace-> {l} [$candsc] [2] != $Awfif::memes-> {snnh} {wsi})
            && ($Awfif::workspace-> {l} [$candsc] [3] != $Awfif::memes-> {snnh} {wsi})
            ){#proceed with identifying the next can

              $nextws = ($Awfif::workspace-> {l} [$candsc] [3] - $Awfif::memes-> {snnh} {wsi});
              $nextwso = ($Awfif::workspace-> {l} [$candsc] [2] - $Awfif::memes-> {snnh} {wsi});
              $Awfif::memes-> {currentwsbi} = $nextws;
              $anextwso = awsoadr ($nextwso);
              if (findcounter ($Awfif::wsol-> {l} [$anextwso][2], $Awfif::memes-> {snnh} {wascan}, \$counteri)) {

                $Awfif::workspace-> {l} [$counteri] [4]--;
                };#if
              };#if
            $Awfif::memes-> {currentwsbi} = $cansws;
            }#do
          while (
          (ipartseqcount ('onematch', $myli, trwsoadr ($canwso,1), trwsoadr ($canwso,2), \$descfits, \$conformstoresource, $Awfif::wsbl->{wsoh} [$cansws], $cansstartwso,
            $Awfif::memes-> {snnh} {tokencategory}, $Awfif::memes-> {snnh} {wall}, $Awfif::memes-> {snnh} {invalidatescategory}, $Awfif::memes-> {snnh} {hname}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {verb}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {msuccgstart}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {msuccgend}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {msuccgedges}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {msuccgedgee},
            )==0)
          && ($conformstoresource)
          );
          };#if
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("resetcansx cansws($cansws) \n");
      };
    }# resetcans
#
sub actvbotdesc {
    my($myli, $sponsor, $cws, $bcwso, $abcwso, $grkwp, $grkwpr)=@_;
    my ($north, $south, $east, $west, $stay, $cwsbi);
# given a structural context workspace see if there is a match of descriptor at the move wso, relative to current position

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("actvbotdesc myli $myli sponsor ($sponsor) cws($cws) bcwso($bcwso) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    if ( ($Awfif::memes-> {usewaitonsquare})
    ){

      if ( ($Awfif::memes-> {usewaitonsbreak})
      ){

        &break ()};
#mask all current descriptors
      &maskcounter ($Awfif::memes-> {snnh}{waitonsquare}, $abcwso, undef(), $Awfif::memes-> {snnh} {north});
      &maskcounter ($Awfif::memes-> {snnh}{waitonsquare}, $abcwso, undef(), $Awfif::memes-> {snnh} {south});
      &maskcounter ($Awfif::memes-> {snnh}{waitonsquare}, $abcwso, undef(), $Awfif::memes-> {snnh} {east});
      &maskcounter ($Awfif::memes-> {snnh}{waitonsquare}, $abcwso, undef(), $Awfif::memes-> {snnh} {west});
      &maskcounter ($Awfif::memes-> {snnh}{waitonsquare}, $abcwso, undef(), $Awfif::memes-> {snnh} {stay});
#describe the new situation in total
      if (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {north}, $Awfif::memes-> {snnh} {can}, $grkwp, $grkwpr) ){

        $north = $Awfif::memes-> {snnh} {can};
        }#stay is can
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {north}, $Awfif::memes-> {snnh} {wall}, $grkwp, $grkwpr) ){

        $north = $Awfif::memes-> {snnh} {wall};
        }#elsif
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {north}, $Awfif::memes-> {snnh} {empty}, $grkwp, $grkwpr) ){

        $north = $Awfif::memes-> {snnh} {empty};
        };#elsif
      if (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {south}, $Awfif::memes-> {snnh} {can}, $grkwp, $grkwpr) ){

        $south = $Awfif::memes-> {snnh} {can};
        }#stay is can
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {south}, $Awfif::memes-> {snnh} {wall}, $grkwp, $grkwpr) ){

        $south = $Awfif::memes-> {snnh} {wall};
        }#elsif
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {south}, $Awfif::memes-> {snnh} {empty}, $grkwp, $grkwpr) ){

        $south = $Awfif::memes-> {snnh} {empty};
        };#elsif
      if (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {east}, $Awfif::memes-> {snnh} {can}, $grkwp, $grkwpr) ){

        $east = $Awfif::memes-> {snnh} {can};
        }#stay is can
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {east}, $Awfif::memes-> {snnh} {wall}, $grkwp, $grkwpr) ){

        $east = $Awfif::memes-> {snnh} {wall};
        }#elsif
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {east}, $Awfif::memes-> {snnh} {empty}, $grkwp, $grkwpr) ){

        $east = $Awfif::memes-> {snnh} {empty};
        };#elsif
      if (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {west}, $Awfif::memes-> {snnh} {can}, $grkwp, $grkwpr) ){

        $west = $Awfif::memes-> {snnh} {can};
        }#stay is can
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {west}, $Awfif::memes-> {snnh} {wall}, $grkwp, $grkwpr) ){

        $west = $Awfif::memes-> {snnh} {wall};
        }#elsif
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {west}, $Awfif::memes-> {snnh} {empty}, $grkwp, $grkwpr) ){

        $west = $Awfif::memes-> {snnh} {empty};
        };#elsif
      if (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {stay}, $Awfif::memes-> {snnh} {can}, $grkwp, $grkwpr) ){

        $stay = $Awfif::memes-> {snnh} {can};
        }#stay is can
      elsif (checkvbotwso ($myli, $sponsor, $cws, $bcwso, $Awfif::memes-> {snnh} {stay}, $Awfif::memes-> {snnh} {empty}, $grkwp, $grkwpr) ){

        $stay = $Awfif::memes-> {snnh} {empty};
        };#elsif

      &activatevbtm ($myli, $cws, $abcwso, $north, $south, $east, $west, $stay);
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("actvbotdescx ");
      print ("\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    }# actvbotdesc
#
sub suwwfcdef {
    my($myli, $codeletdef, $acwso, $direction, $desstate, $desname)=@_;
    my ($cwsbi, $result, @cpids);
# setup an add of a wfcdef element including the wait details

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("suwwfcdef myli $myli acwso($acwso) direction($direction) desired state($desstate) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state
    $result = '';

    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [19];
    if (!defined($Awfif::memes-> {wfcdef}) ){ $Awfif::memes-> {wfcdef} = 0};#setup a queue head for the deferred codelets
    if ((iwfccount (setupprocname ($myli), \@cpids, $direction, $desstate, $desname, 't', $myli) == 0)#expect the calling codelet to be removed from this count
    ){

      $result = 't';
      my ($nlink);
      $nlink = addwfcdef ($myli, $$codeletdef, $Awfif::memes-> {wfcdef});
      if ($Awfif::wfcdefl-> {l} [$nlink] [0] == $Awfif::memes-> {wfcdef}) {

        $Awfif::memes-> {wfcdef} = $nlink;
        };#update the head pointer
      $Awfif::wfcdefl-> {l} [$nlink] [3] = $direction;
      $Awfif::wfcdefl-> {l} [$nlink] [4] = $desstate;
      $Awfif::wfcdefl-> {l} [$nlink] [5] = $desname;
      $Awfif::wfcdefl-> {l} [$nlink] [6] = '';#codelet not activated
      $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [19];
      if (defined ($direction)) {

        &waitondesc ($myli, $acwso, ($desstate + $Awfif::memes-> {snnh} {wsi}), $direction, $Awfif::memes-> {snnh} {waitonsquare}, undef(), undef(), undef(), undef(), \$$codeletdef, \$Awfif::wfcdefl-> {l} [$nlink] [6]);
        }#if
      else {

        &waitondesc ($myli, $acwso, ($desname + $Awfif::memes-> {snnh} {wsi}), 1, $Awfif::memes-> {snnh} {waitonsquare}, undef(), undef(), undef(), undef(), \$$codeletdef, \$Awfif::wfcdefl-> {l} [$nlink] [6]);
        };#else
# at this point the $$codeletdef will be the head of its own deferred queue
      if (($Awfif::wfcdefl-> {hash} {$$codeletdef})
      && ($Awfif::wfcdefl-> {l} [$Awfif::wfcdefl-> {hash} {$$codeletdef}] [6])
      ){#remove any stale wfcdefl item still hanging around

        $Awfif::memes-> {wfcdef} = freewfcdef ($$codeletdef, $Awfif::wfcdefl-> {hash} {$$codeletdef}, $Awfif::memes-> {wfcdef});
        }#if
      elsif (($Awfif::wfcdefl-> {hash} {$$codeletdef})
      && ($Awfif::memes-> {waitfhashbreak})
      ){#inconsistant item still using codeletdef

        &break ();
# hopefully means that the old referenced wfcdefl element [6] had been true and the element was freed and reused so should just be able to reset this old hash as below
        };#elsif
      $Awfif::wfcdefl-> {hash} {$$codeletdef} = $nlink;#hash the codelet to the wfcdef index
# suwwfcinwfcu1
# hash the schematic operon against codeletname for nuclabmbuilder checks

      my ($operon, $vbotg, $vboti, $mapi);
      $operon = wsolistaschst ($Awfif::codelet-> {l} [$myli] [21], $Awfif::codelet-> {l} [$myli] [22], $Awfif::codelet-> {l} [$myli] [19]);
      if (! defined ($Awfif::wfcdefl-> {operon} {$operon}) ){
# watch out we move the operon to builder mappings about so normalise to gen 0 vbot 1 settings

        $vbotg = $Awfif::memes-> {vbottgenmax} - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [3] - $Awfif::memes->{snnh}{wsi});
        $vboti = $Awfif::memes-> {vbottpopmax} + 1 - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [2] - $Awfif::memes->{snnh}{wsi});
        if ( ($vboti > 1)
        && ( (defined ($Awfif::vbotha-> { gens} [0] [1]-> {vbotscbh} {$Awfif::codelet-> {l} [$$codeletdef] [2]}))) #ensure it will find the builder in array
        && ( ($mapi = matchsaelement (\@{$Awfif::vbotga-> {scmapc} [$vboti]}, $Awfif::codelet-> {l} [$$codeletdef] [2]) ) > 0 )#find the first reference in the mapped set
        ){

          $Awfif::wfcdefl-> {operon} {$operon} = $Awfif::vbotga-> {scmap0} [1] [$mapi];#now make the codeletname the unmapped equivalent which means the builder may not be the one in wfc!
          }#if
        else {

          $Awfif::wfcdefl-> {operon} {$operon} = $Awfif::codelet-> {l} [$$codeletdef] [2];
          };#else
        };#if
      $Awfif::wfcdefl-> {l} [$nlink] [2] = $$codeletdef;
      $Awfif::wfcdefl-> {l} [$nlink] [7] = addwfchchain ($nlink, $Awfif::codelet-> {l} [$$codeletdef] [2]);#codelet not activated
      };#already have outstanding codelet deferred for this situation

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("suwwfcdefx ($result)");
      print ("\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# suwwfcdef
#
sub replacecans {
    my($myli, $sponsor, $vbottrial, $nexttrial, $grkwp, $grkwpr)=@_;
    my ($cansf, $bcount, $cansws, $cansbasewso, $cansstartwso, $canwso, $acanwso, $candsc,
    $nextws, $nextwso, $anextwso, $cwsbi, $stwso, $astwso);
# reset any picked up cans to not picked up

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("replacecans myli $myli ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    $stwso = getmystatement ($myli, $sponsor, $grkwp, $grkwpr);
    $astwso = awsoadr ($stwso);
    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    my ($worldf, $wws, $worldstartwso);
    if ( !defined ($Awfif::vbotworld-> {worldf})){

      $worldf = ifindb ($myli, $stwso, 'vworldb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
      $Awfif::vbotworld-> {worldbasewso} = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$wws);
      $Awfif::vbotworld-> {worldf} = $worldf;
      $Awfif::vbotworld-> {wws} = $wws;
      }
    else {

      $worldf = $Awfif::vbotworld-> {worldf};
      $wws = $Awfif::vbotworld-> {wws};
      };#else
    if ($worldf == 1) {

      if ( !defined ($Awfif::vbotworld-> {vwxstart})){

        $bcount = ifindb ($myli, $stwso, 'vwxstartb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), undef (), $wws);
        $worldstartwso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $wws);
        $Awfif::vbotworld-> {vwxstart} = $bcount;
        $Awfif::vbotworld-> {worldstartwso} = $worldstartwso;
        }
      else {

        $bcount = $Awfif::vbotworld-> {vwxstart};
        $worldstartwso = $Awfif::vbotworld-> {worldstartwso};
        };#else
      if ( !defined ($Awfif::vbotworld-> {cansf})){

        $cansf = ifindb ($myli, $stwso, 'vcansb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge);
        $cansbasewso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cansws);
        $Awfif::vbotworld-> {cansf} = $cansf;
        $Awfif::vbotworld-> {cansbasewso} = $cansbasewso;
        $Awfif::vbotworld-> {cansws} = $cansws;
        }
      else {

        $cansf = $Awfif::vbotworld-> {cansf};
        $cansbasewso = $Awfif::vbotworld-> {cansbasewso};
        $cansws = $Awfif::vbotworld-> {cansws};
        };#else
      if ($cansf == 1) {

        if ( !defined ($Awfif::vbotworld-> {vwxstartc})){

          $bcount = ifindb ($myli, $stwso, 'vwxstartb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), undef (), $cansws);#, undef (), undef (), undef (), 't');
          $cansstartwso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $cansws);
          $Awfif::vbotworld-> {vwxstartc} = $bcount;
          $Awfif::vbotworld-> {cansstartwso} = $cansstartwso;
          }
        else {

          $bcount = $Awfif::vbotworld-> {vwxstartc};
          $cansstartwso = $Awfif::vbotworld-> {cansstartwso};
          };#else
        if (($bcount == 1) #can replace cans
        ){#

          my ($conformstoresource, $descfits);
          $Awfif::memes-> {currentwsbi} = $cansws;
          $canwso = $cansstartwso;
          do {#for each can

            $Awfif::memes-> {currentwsbi} = $cansws;
            $canwso = trwsoadr ($canwso, 1);
            $acanwso = awsoadr ($canwso);
# replaccsasu1

            if( (($candsc = findtdesc ($Awfif::wsol-> {l} [ ($acanwso)] [2], $Awfif::memes-> {snnh} {canposition})) != 0)
            && ($Awfif::workspace-> {l} [$candsc] [2] != $Awfif::memes-> {snnh} {wsi})
            && ($Awfif::workspace-> {l} [$candsc] [3] != $Awfif::memes-> {snnh} {wsi})
            ){#proceed with recording the position and removing the can

              $nextws = ($Awfif::workspace-> {l} [$candsc] [3] - $Awfif::memes-> {snnh} {wsi});
              $nextwso = ($Awfif::workspace-> {l} [$candsc] [2] - $Awfif::memes-> {snnh} {wsi});
              if( ((findtdesc ($Awfif::wsol-> {l} [ ($acanwso)] [2], $Awfif::memes-> {snnh} {canattrib}, $vbottrial)) == 0)
              ){

                my ($attribs);
                $attribs = addattrib ($Awfif::memes-> {snnh} {attribs},'');
                &addattrib ($Awfif::memes-> {snnh} {attrib}, $Awfif::memes->{snnh}{canattrib}, '');
                &addattrib ($Awfif::memes-> {snnh} {attrib}, $nextws, '');
                &addattrib ($Awfif::memes-> {snnh} {attrib}, $nextwso, '');
                &addattrib ($Awfif::memes-> {snnh} {attrib}, $vbottrial, '');
                &addattrib ($Awfif::memes-> {snnh} {attribe},'');
                $Awfif::wsol-> {l} [$acanwso][2]
                  = setupdesc ( $vbottrial,
                      ($Awfif::memes-> {snnh} {wsi} + $attribs),
                      $Awfif::memes-> {snnh} {canattrib},
                      $Awfif::wsol-> {l} [$acanwso][2],
                      $acanwso);
                };#setup can attrib and descriptor
              $Awfif::memes-> {currentwsbi} = $nextws;
              $anextwso = awsoadr ($nextwso);

              &maskcounter ($Awfif::memes-> {snnh} {can}, $anextwso);
              };#if
            $Awfif::memes-> {currentwsbi} = $cansws;
            }#do
          while (
          (ipartseqcount ('onematch', $myli, trwsoadr ($canwso,1), trwsoadr ($canwso,2), \$descfits, \$conformstoresource, $Awfif::wsbl->{wsoh} [$cansws], $cansstartwso,
            $Awfif::memes-> {snnh} {tokencategory}, $Awfif::memes-> {snnh} {wall}, $Awfif::memes-> {snnh} {invalidatescategory}, $Awfif::memes-> {snnh} {hname}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {verb}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {msuccgstart}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {msuccgend}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {msuccgedges}, $Awfif::memes-> {snnh} {failscategory}, $Awfif::memes-> {snnh} {msuccgedgee},
            )==0)
          && ($conformstoresource)
          );

          $Awfif::memes-> {candsc} [0] = 0;#will be reloading the cans
          $Awfif::memes-> {canx} [0] = 0;
          $Awfif::memes-> {cany} [0] = 0;
          &setupcans ($myli, $sponsor, $grkwp, $grkwpr, $nexttrial);
          };#if
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("replacecansx cansws($cansws) \n");
      };
    }# replacecans
#
sub mmevolution {
    my($myli, $vbotgen)=@_;
    my ($cwsbi);
# melanie mitchell's apply evolution procedure

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mmevolution myli $myli vbotgen($vbotgen) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    my ($i, $pop, $parent1, $parent2, $crossover);
    &selsalvbtp ($myli, $vbotgen, undef (), 't');#initialize salience
# setup the next generation codelet model action transaction maps

    for ($pop = 1; $pop <= $Awfif::memes-> {vbottpopmax}; $pop = $pop + 2) {
# mmevolsalselu1
# select salient parents parent1 and parent2

      $parent1 = selsalvbtp ($myli, $vbotgen);
      $Awfif::vbotga-> {parent} [$vbotgen] [ ++$Awfif::vbotga-> {parent} [$vbotgen] [0] ] = $parent1;
      $parent2 = selsalvbtp ($myli, $vbotgen, $parent1);
      $Awfif::vbotga-> {parent2} [$vbotgen] [ ++$Awfif::vbotga-> {parent2} [$vbotgen] [0] ] = $parent2;

      $Awfif::vbotga-> {scmapn} [$pop] [0] = $Awfif::vbotga-> {scmapc} [$pop] [0];
      $Awfif::vbotga-> {scmapn} [$pop + 1] [0] = $Awfif::vbotga-> {scmapc} [$pop] [0];
# mmevolcou1
# cross over the saliently selected parents to generate two children

      $crossover = 1 + int (rand ($Awfif::vbotga-> {scmapc} [$pop] [0]));
      for ($i = 1; $i <= $crossover; $i++){
        $Awfif::vbotga-> {scmapn} [$pop] [$i] = $Awfif::vbotga-> {scmapc} [$parent2] [$i];
        };#for

      for ($i = $crossover + 1; $i <= $Awfif::vbotga-> {scmapc} [$pop] [0]; $i++){
        $Awfif::vbotga-> {scmapn} [$pop] [$i] = $Awfif::vbotga-> {scmapc} [$parent1] [$i];
        };#for

      for ($i = 1; $i <= $crossover; $i++){
        $Awfif::vbotga-> {scmapn} [$pop + 1] [$i] = $Awfif::vbotga-> {scmapc} [$parent1] [$i];
        };#for

      for ($i = $crossover + 1; $i <= $Awfif::vbotga-> {scmapc} [$pop] [0]; $i++){
        $Awfif::vbotga-> {scmapn} [$pop + 1] [$i] = $Awfif::vbotga-> {scmapc} [$parent2] [$i];
        };#for
# mmevolmutu1

      &vbotmutate ($myli, 'scmapn', $pop);
      &vbotmutate ($myli, 'scmapn', $pop + 1);
      };#for each pair of children
    $Awfif::vbotga-> {gen}++;
    &selsalvbtp ($myli, $vbotgen, undef (), '');#terminate salience
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mmevolutionx \n");
      };
    }# mmevolution
#
sub selsalvbtp {
    my($myli, $vbotgen, $ignorevbot, $initialize)=@_;
    my ($cwsbi, $vbot, $vfind, $pvfind, $normval, $saltotal, $finished);
# select a salient member from the current vbot generation fittest

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsalvbtp myli $myli ");
      if (defined ($vbotgen)){
        print ("vbotgen($vbotgen) ");
        };#if
      if (defined ($ignorevbot)){
        print ("ignorevbot($ignorevbot) ");
        };#if
      if (defined ($initialize)){
        print ("initialize($initialize) ");
        };#if
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state
# calculate the sum of all the vbots contributions
    if ((defined ($initialize)) && ($initialize) ){

      $Awfif::memes-> {vbotsalsum} = ();
# calculate the most negative value

      &uvgfithist ($vbotgen);
      $Awfif::memes-> {negoffset} = 0;
      $vfind = $Awfif::vfhist-> {h};
      while ($vfind != 0){

        if ($Awfif::memes-> {negoffset} > $Awfif::vbotga-> {fitness} [$vbotgen] [ $Awfif::vfhist-> {l} [$vfind] [2] ]){

          $Awfif::memes-> {negoffset} = $Awfif::vbotga-> {fitness} [$vbotgen] [ $Awfif::vfhist-> {l} [$vfind] [2] ];
          };#if
        $vfind = $Awfif::vfhist-> {l} [$vfind] [0];
        };#while
      if ($Awfif::memes-> {negoffset} < 0) {

        $Awfif::memes-> {negoffset} = -$Awfif::memes-> {negoffset};
        }#if
      else {

        $Awfif::memes-> {negoffset} = 0;
        };
      }#if
    elsif ((defined ($initialize)) && (!$initialize)) {#terminate

      $vfind = $Awfif::vfhist-> {h};
      while ($vfind != 0){

        $vfind = freehli ($vfind, \$Awfif::vfhist);
        $Awfif::vfhist-> {h} = $vfind;
        $Awfif::vfhist-> {tvf}--;
        };#while

      $Awfif::vfhist-> {t} = 0;
      }#terminate
    else {

      if (!defined ($Awfif::memes-> {vbotsalsum})){#setup for this generation

        $vfind = $Awfif::vfhist-> {h};
        while ($vfind != 0){

          $Awfif::memes-> {vbotsalsum} = $Awfif::memes-> {vbotsalsum} + $Awfif::vbotga-> {fitness} [$vbotgen] [ $Awfif::vfhist-> {l} [$vfind] [2] ] + $Awfif::memes-> {negoffset};
          $vfind = $Awfif::vfhist-> {l} [$vfind] [0];
# selsalvbhou1
# handle overflow

          if ($Awfif::memes-> {vbotsalsum} < 0) { &break ()};
          };#while
        };#if
# find normalized random item

      $normval = int (rand ($Awfif::memes-> {vbotsalsum})) + 1;
      $saltotal = 0;
      $vfind = $Awfif::vfhist-> {h};
      $vbot = $Awfif::vfhist-> {l} [$vfind] [2];
      $finished = '';
      while ( !$finished ){

        $saltotal = $saltotal + $Awfif::vbotga-> {fitness} [$vbotgen] [ $Awfif::vfhist-> {l} [$vfind] [2] ] + $Awfif::memes-> {negoffset};
        if ( ( ($saltotal >= $normval) && ((!defined ($ignorevbot)) or ($vbot != $ignorevbot)) )
        or ( (($pvfind = $vfind) > 0) && (($vfind = $Awfif::vfhist-> {l} [$vfind] [0]) == 0) && ($vbot = $Awfif::vfhist-> {l} [$Awfif::vfhist-> {l} [$pvfind] [1]] [2])) # can't use final vfind as its the ignore so use previous
        or (($vbot = $Awfif::vfhist-> {l} [$vfind] [2]) > $Awfif::memes-> {vbottpopmax})) {$finished = 't'};
        };#while
      if (($vbot < 1) or ($vbot > $Awfif::memes-> {vbottpopmax}) ){&break ();};
      };#else
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsalvbtpx negoffset($Awfif::memes->{negoffset}) vbotsalsum($Awfif::memes->{vbotsalsum}) ret($vbot) \n");
      };
    return $vbot
    }# selsalvbtp
#
sub vbotmutate {
    my($myli, $gen, $pop)=@_;
    my ($cwsbi, $i, $act, @sacta, %ssymbh, $build);
# mutation based on vbotscmap transactional binding replacement

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("vbotmutate myli $myli gen($gen) pop($pop) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state

    @sacta = qw (n s e w r pc);
# vbotmprobu1

    $act = int (rand (100));#this should be changed to a really low probability
# vbotmutateprbu1
# make probability customizable

    if ($act > $Awfif::memes-> {vbotmutateprb}){

      $ssymbh {n} = 'vbttoamnbuilder';
      $ssymbh {s} = 'vbttoamsbuilder';
      $ssymbh {e} = 'vbttoamebuilder';
      $ssymbh {w} = 'vbttoamwbuilder';
      $ssymbh {r} = 'vbttoamrbuilder';
      $ssymbh {pc} = 'vbttoapcbuilder';
      $i = int(rand ($Awfif::vbotga-> {$gen} [$pop] [0])) + 1;
      $Awfif::vbotga-> {$gen} [$pop] [$i] = $ssymbh {($build = $sacta [rand (6)])};
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("vbotmutatex ret($i) \n");
      };
    return $i
    }# vbotmutate
#
sub vbotga {
    my($myli, $sponsor, $sponsortype, $cws, $bcwso, $abcwso, $astwso, $grkwp, $grkwpr)=@_;
    my ($gen, $vbot, $step, $trial, $cwsbi, $fitnessdsc, $succeeded, $failed, $action, $noswstype, $fbinderc, $ibu, $wzd, $vbotxyd);
    my (@vbotscmapie, @vbotscmapij, $cchmdefga);
# apply specific von Neumann computed genetic algorithm at most once

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("vbotga myli $myli sponsor ($sponsor) cws($cws) bcwso($bcwso) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};# to later restore current state
# vbotgaconf1

    if ( ($Awfif::memes-> {usevbotga})
    ){

      if ( ($Awfif::memes-> {usevbotgabreak})
      ){

        &break ()};
# generate model evaluator vbotscmap [i] mapping

      if (!cscmapieval ($myli, \@vbotscmapie, \@vbotscmapij)){#get all maps or give up this attempt
# Iterate for $Awfif::memes-> {vbottgenmax} and do

        my ($i);
        $failed = '';
        $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [19];
        $Awfif::memes-> {nomapnonsubtotm} = 't';
        $fitnessdsc = findtdesc ($Awfif::wsol-> {l} [ $abcwso] [2], $Awfif::memes-> {snnh} {fitness});
# vbotgagenupd1
# if vbotscmap already has gens then setup the gen ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [3])

        $gen = $Awfif::vbotga-> {gen};

        if ($gen > 0){
# setup the gen to skip the already processed generations

          $Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [3] = $Awfif::memes-> {vbottgenmax} + $Awfif::memes->{snnh}{wsi} - $gen;
# ensure start with vbot 1

          $Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [2] = $Awfif::memes-> {vbottpopmax} + $Awfif::memes->{snnh}{wsi};
          };#if

        $cchmdefga = $Awfif::memes-> {chmdefga};
        $Awfif::memes-> {chmdefga} = 't';#the GA instructs chmdefis to use caching
        for ($gen = $Awfif::memes-> {vbottgenmax} - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [3] - $Awfif::memes->{snnh}{wsi}); (($gen <= $Awfif::memes-> {vbottgenmax}) && (!$failed));$gen = $Awfif::memes-> {vbottgenmax} - ((--$Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [3]) - $Awfif::memes->{snnh}{wsi})){
# Iterate for each can deployment $Awfif::memes-> {vbottrialmax} and

          for ($trial = $Awfif::memes-> {vbottrialmax} + 1 - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotatpdsc} ] [3] - $Awfif::memes->{snnh}{wsi}); (($trial < $Awfif::memes-> {vbottrialmax}) && (!$failed)) ; $trial = $Awfif::memes-> {vbottrialmax} - ((--$Awfif::workspace-> {l} [$Awfif::memes-> {vbotatpdsc} ] [3]) - $Awfif::memes->{snnh}{wsi})){
# Iterate for each vbot in population $Awfif::memes-> {vbottpopmax} and do

            for ($vbot = $Awfif::memes-> {vbottpopmax} + 1 - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [2] - $Awfif::memes->{snnh}{wsi}); (($vbot <= $Awfif::memes-> {vbottpopmax}) && (!$failed)); $vbot = $Awfif::memes-> {vbottpopmax} + 1 - ((--$Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [2]) - $Awfif::memes->{snnh}{wsi})){
              my ($laststep);
              $laststep = -1;
# while actions $Awfif::memes-> {vbottstepsmax} available

              for ($step = ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotatpdsc} ] [2] - $Awfif::memes->{snnh}{wsi}); (($step > 0) && (!$failed)) ; $step = ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotatpdsc} ] [2]) - $Awfif::memes->{snnh}{wsi}){#step should be decremented indirectly by the action codelet builders
# indirectly call, for each i in vbotscmap, vbot indirect models and for applicable model compute and apply actions and record its final fitness

                if ($step == $laststep) {

                  if ($Awfif::memes-> {vbotlstepbreak} ){

                    &break();
                    }#if
                  else {

                    $Awfif::memes-> {fgtp}--;
                    };#else
                  };#if - incase step is not decremented in action codelet
                $laststep = $step;
                $succeeded = '';
                $i = 0;
                my ($ws, $start, $end, $name, $notewaitonsquare);
                $ws = $Awfif::codelet-> {l} [$myli] [20];
                $start = $Awfif::codelet-> {l} [$myli] [21];
                $end = $Awfif::codelet-> {l} [$myli] [22];
                $name = $Awfif::codelet-> {l} [$myli] [2];
                while ( (!$failed) && (!$succeeded) && (++$i <= $Awfif::vbotga-> {scmap0} [0] [0]) ){

                  $Awfif::memes-> {fgtp}--;
                  $ibu = 'i'. $Awfif::memes-> {snnih} {$vbotscmapie [$i]};
                  if (defined ($vbotscmapij [$i])){

                    $notewaitonsquare = $Awfif::memes-> {usewaitonsquare};
                    $Awfif::memes-> {usewaitonsquare} = '';
                    $Awfif::codelet-> {l} [$myli] [20] = $Awfif::jhls-> {l} [$vbotscmapij [$i]][7];
                    $Awfif::codelet-> {l} [$myli] [21] = $Awfif::jhls-> {l} [$vbotscmapij [$i]][8];
                    $Awfif::codelet-> {l} [$myli] [22] = $Awfif::jhls-> {l} [$vbotscmapij [$i]][9];

                    $succeeded = $Awfif::memes-> {binds}-> {$ibu}-> ($myli, $Awfif::jhls-> {l} [$vbotscmapij [$i]][8], undef (), undef (), undef (), $grkwp, $grkwpr, \@{$Awfif::memes-> {sactset}}, $noswstype, \$fbinderc);
                    if ($gen == $Awfif::memes-> {vbottgenmax}){#on last generation prepare for beyond GA by enabling structurally enhanced state

                      $Awfif::memes-> {usewaitonsquare} = $notewaitonsquare;
                      };#if
                    if (($succeeded)
                    ){

                      $action = "*Awfif::" . $Awfif::vbotga-> {scmapc} [$vbot] [$i] . "ga1";
    no strict 'refs';
                      $Awfif::codelet-> {l} [$myli] [2] = $Awfif::vbotga-> {scmapc} [$vbot] [$i] . 'ga';
                      &$action ($myli, \$grkwp, $grkwpr, \@{$Awfif::memes-> {sactset}}, $sponsor, $sponsortype, $cws, $bcwso);
                      };#if
# vbotgaldlearn

                    $Awfif::memes-> {ldsignal} = ldlearning ();
                    if ($gen != $Awfif::memes-> {vbottgenmax}){

                      $Awfif::memes-> {usewaitonsquare} = $notewaitonsquare;
                      };#if
                    }#if was a deployed codelet
                  else {#give up for now

                    $failed = 't';
                    };#else
                  };#while

                $Awfif::codelet-> {l} [$myli] [2] = $name;
                $Awfif::codelet-> {l} [$myli] [20] = $ws;
                $Awfif::codelet-> {l} [$myli] [21] = $start;
                $Awfif::codelet-> {l} [$myli] [22] = $end;
                if ($Awfif::memes-> {vbotgadispcans}){#if want feedback on progress show vbot, world and cans

                  &itcanpoutput ();
                  };#if
                };#for step
# reset the steps to start for next vbot

              $Awfif::workspace-> {l} [$Awfif::memes-> {vbotatpdsc} ] [2] = $Awfif::memes-> {vbottstepsmax} + $Awfif::memes->{snnh}{wsi};
# vbotgarfu1
# record the fitness

              $Awfif::vbotga-> {fitness} [$gen] [$vbot] = $Awfif::vbotga-> {fitness} [$gen] [$vbot] + ($Awfif::workspace-> {l} [$fitnessdsc ] [2] - $Awfif::memes->{snnh}{wsi});
# reset the fitness for the start of the next vbot
              $Awfif::workspace-> {l} [$fitnessdsc ] [2] = $Awfif::memes->{snnh}{wsi};
# vbotgavzu1
# return the vbot to start of world

              if (!$failed){

                if ( (!defined ($vbotxyd = $Awfif::vbotgaxyd))
                or (!defined ($wzd = $Awfif::vbotgawzd))
                ){#ga induced caches to avoid repeated findtdesc

                  $wzd = findtdesc ($Awfif::wsol-> {l} [($astwso)] [2], $Awfif::memes-> {snnh} {wsposition});#find the statements initial wsposition desc
                  $vbotxyd = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition});#find the vbots wsposition desc
                  $Awfif::vbotgawzd = $wzd;
                  $Awfif::vbotgaxyd = $vbotxyd;
                  };#if
                $Awfif::workspace -> {l} [$vbotxyd] [2] = $Awfif::workspace -> {l} [$wzd] [2];
                $Awfif::workspace -> {l} [$vbotxyd] [3] = $Awfif::workspace -> {l} [$wzd] [3];
                &resetcans ($myli, $sponsor, $grkwp, $grkwpr);
                };#if
              };#for vbot
# reset the vbot index to start for next trial

            $Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [2] = $Awfif::memes-> {vbottpopmax} + $Awfif::memes->{snnh}{wsi};
# vbotgarepcu1
# replace cans

            if (!$failed){

              &replacecans ($myli, $sponsor, $trial, $trial + 1, $grkwp, $grkwpr);
              };#if
            };#for trial
# reset the trial to start for next gen

          $Awfif::workspace-> {l} [$Awfif::memes-> {vbotatpdsc} ] [3] = $Awfif::memes-> {vbottrialmax} + $Awfif::memes->{snnh}{wsi};
# vbotgammevu1

# vbotgapersu1
# persist the vbotscmap fitness aggregate and the generation number at the end of each generation

# vbotgascmapntocu1
# move the vbotscmap n ext gen to c urrent gen at the end of each generation

          my ($i, $pop);
          for ($pop = 1; $pop <= $Awfif::memes-> {vbottpopmax}; $pop++) {
            for ($i = 1; $i <= $Awfif::vbotga-> {scmapc} [$pop] [0]; $i++){
              $Awfif::vbotga-> {scmapc} [$pop] [$i] = $Awfif::vbotga-> {scmapn} [$pop] [$i];
              };#for
            };#for
          };#for gen
        $Awfif::memes-> {chmdefga} = $cchmdefga;
        }#if
      else {

        $failed = 't';
        };#else

      $Awfif::memes-> {nomapnonsubtotm} = '';#set mapnonsubtotm back to regular operation
      if (!$failed){
        $Awfif::memes-> {usevbotga} = '';#only apply successfully once
        };#if
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("vbotgax ");
      print ("\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    }# vbotga
#
#<!-- end tag vbt -->
#<!-- start tag swp -->
#
sub selsaltypedwso {
    my ($myli, $swstype, $nextinstance, $twso, $kwp, $kwpr, $sactset)=@_;
    my ($found, $stfound, @typelist, $i, $i1, $term, $tstring);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih}{$swstype};
      print ("selsaltypedwso myli $myli, swstype $pr kwp $kwp kwpr $kwpr ");
      };

    $stfound = ltypedwso ($myli, $swstype, \@typelist, $kwp, $kwpr, \@$sactset);
# filter out wso that do not have modeling requests

    for ($i = 0; $i < $stfound;$i++) {
      if ((!findbond ($Awfif::wsol-> {l} [ awsoadr ($typelist[$i])] [2], $Awfif::memes-> {snnh} {start}, $swstype, $Awfif::memes-> {snnh} {model}))
      or (findbond ($Awfif::wsol-> {l} [ awsoadr ($typelist[$i])] [2], $Awfif::memes-> {snnh} {dropthreshold}, $swstype, $Awfif::memes-> {snnh} {model}))){

        for ($i1 = $i+1; $i1 < $stfound; $i1++) {
          $typelist[$i1-1] = $typelist[$i1];
          };# for move rest down

        $stfound--;
        $i--;
        };#if discard
      };# for
# ensure that the wso group is terminated

    $tstring = '/'."$Awfif::memes->{snnih}{$swstype}";
    for ($i = 0; $i < $stfound;$i++) {

      $found = '';
      if ($i == ($stfound -1)) {

        $term = $kwp;
        }#if use kwp
      else {

        $term = $typelist[$i+1];
        };# else use typelist

      for ($i1 = trwsoadr ($typelist[$i],1);
        (($i1 < $term) && (!$found)); $i1 = trwsoadr ($i1, 1)) {
# check for match with /keyword


          $found = 't';
          $$twso = $i1;
          };#if match
        };#for

      if (!$found) {

        for ($i1 = $i+1; $i1 < $stfound; $i1++) {

          $typelist[$i1-1] = $typelist[$i1];
          };# for move rest down

        $stfound--;
        };
      };# for check each candidate has a terminal keyword match prior to kwp
# select one item from the list at random

    if ($stfound > 0) {
      $$nextinstance = $typelist [int (rand ($stfound))];
      };#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsaltypedwso nextinstance $$nextinstance twso $$twso ret $stfound\n");
      };

    return ($stfound);
    };# selsaltypedwso
#
#<!-- end tag vbt -->
#<!-- end tag swp -->
#<!-- start tag stm -->
#<!-- start tag sca -->
#<!-- start tag ca -->
#
sub selsalwsitem {# select a salient workspace item
    my($myli, $nextinstance, $tinstances, $kwp, $kwpr, $sactset, $strategy, $omeric)=@_;
    my ($i, $i2, $found, @ca, $change, $thenextinstance, $loadcache, $usecache, $concept, $nobackoff, $ni, $ikwp, $akwp,
    $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsalwsitem myli $myli, strategy $strategy sactset($$sactset[0]) ");
      if (defined ($$omeric)) {
        print ("oligomeric ($$omeric) ");
        };
      };
# updated for merged workspaces

    if ($Awfif::memes-> {trace} == $Awfif::memes-> {tracehrtime}) {
      use Time::HiRes 'time';
      ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdat) = localtime(time);
      };
    $akwp = awsoadr ($kwp);
# move the kwp out of the inactive histone
    if (($Awfif::wsol-> {l}[$akwp][ $Awfif::memes-> {wsohistbp}] != 0) #*** submacrok ***#
    && ($Awfif::histonel-> {l} [$Awfif::wsol-> {l}[$akwp][ $Awfif::memes-> {wsohistbp}]] [2] == 1)) {#*** submacrok ***#

      $ikwp = nextihistone ($kwp, \$akwp);

      }#if
    else {

      $ikwp = $kwp;
      };#else
    $nobackoff = '';
    if ((defined ($$omeric)) && ($$omeric > 1) ){
      $$omeric = 1;
      }#if
    elsif ((defined ($$omeric)) && ($$omeric == 1) ){
      $nobackoff = 't';
      };# elsif
    $found = '';
    $$tinstances = 0;
    $i2 = 0;
    $ni = 1;
    $loadcache = 2;
    $concept = $Awfif::codelet-> {l}[$myli][10];
    if (
      (!defined($Awfif::codelet-> {l}[$myli][10])) or
      ( toofewwso($kwp, $kwpr, 5))) {#list based ckecking

      $usecache = '';
      }
    else {

      $usecache = 't';
      $concept = conmsalb ($myli, $Awfif::codelet-> {l}[$myli][10], $strategy);
      };
    &itwscachecor ($strategy, $concept, 'seq', 'selsalwsitem');

# selsalcdelup1
    if (($usecache)
    && ( ($strategy ne 'tdgroup')
    && (checkcache ($strategy, $concept, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}) != 2))

    or ( (($strategy eq 'tdgroup') && (!$nobackoff) && (checkcache ($strategy, 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}) != 2) ) #should only be nobackoff if repeat call inside of tdgroupscoute so external conditions can not have changed

    or ( ($strategy eq 'tdgroup') && ($nobackoff) && (checkcache ($strategy, 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}) != 5)
      && (checkcache ($strategy, 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}) != 2) ) )
    ) {# cache must be loaded

      if (
      (($strategy eq 'tdgroup') && (checkcache ($strategy, 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}) != 0))
      ) {# if cache is partly invalid this is indicated by a 1 or 4

        $loadcache = checkcache ($strategy, 0, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid});
        }#if
      elsif ((checkcache ($strategy, $concept, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}) != 0)
      ) {# if cache is partly invalid this is indicated by a 1 or 4

        $loadcache = checkcache ($strategy, $concept, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid});
        }#elsif
      else {

        $loadcache = 0 + $Awfif::memes-> {backoffactive} {$strategy};#cache must be reloaded
        };#else

      &setcache ($strategy, $concept, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}, 2 + $Awfif::memes-> {backoffactive} {$strategy});
      if (($strategy =~ /^t/)
      ){
# selsalomerup1

        &setanywscache ($strategy, 2, $nobackoff);
        };
      if ((defined($Awfif::norml-> {t}[$Awfif::memes-> {currentwsbi}][ $Awfif::cache-> {h}{$strategy}]))
      ) {

        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}] = time ();

        while ($Awfif::norml-> {t}[$Awfif::memes-> {currentwsbi}][ $Awfif::cache-> {h}{$strategy}] != 0) {# clear out the old set of items

          &freenormitem ($Awfif::norml-> {t}[$Awfif::memes-> {currentwsbi}][ $Awfif::cache-> {h}{$strategy}], $strategy);
          };#while

        &freenormiteme ($strategy);

        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] = time ();
        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswinsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswinsum}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}];
        };#if
      };#control the loading of the cache
    if (($usecache) && ($Awfif::norml-> {h}[$Awfif::memes-> {currentwsbi}][ $Awfif::cache-> {h}{$strategy}] != 0)) {#can use the normalisation cache
# ******** ****** the next instance is obtained directly from the norlalized list ****** ****

      $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}] = time ();

      $$nextinstance = $Awfif::norml-> {l} [$Awfif::norml-> {t}[$Awfif::memes-> {currentwsbi}][ $Awfif::cache-> {h}{$strategy}]][4];
      &freenormitem ($Awfif::norml-> {t}[$Awfif::memes-> {currentwsbi}][ $Awfif::cache-> {h}{$strategy}], $strategy);
      &freenormiteme ($strategy);
      $found = 't';
      if (($$nextinstance == 0) or (!defined($$nextinstance))) {

        &break ();
        $found = '';
        };

      $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] = time ();
      $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswinsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswinsum}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}];
      }
    else {

      if (($usecache) && ($loadcache == 2)
      or (($usecache) && ($loadcache == 5) && ($nobackoff))
      ) {# cache for this concept is correctly loaded
# ******** ******* can get the total salience and i2 values from the cache ******* ********

        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}] = time ();

        $i2 = checkcache ($strategy, $concept, undef(), undef(), $Awfif::memes-> {ci2});
        $$tinstances = checkcache ($strategy, $concept, undef(), undef(), $Awfif::memes-> {ctinst});

        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] = time ();
        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswicsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswicsum}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}];
        }
      else {# at best cache partly loaded (per wso)
        my($ai, $gdeltachange);
# ****** ******* ********** main workspace salience iterative calculation ****** ****
        $i = $kwpr;
        while (($i != 0) && ($i != $ikwp)) {#updated for merged workspaces

          $gdeltachange = undef ();
          if (($strategy eq 'tdgroup')
          && (defined ($Awfif::memes-> {gdeltachange} {($ai = awsoadr ($i))}))
          ){
            $gdeltachange = $Awfif::memes-> {gdeltachange} {$ai};
            $Awfif::memes-> {gdeltachange} {$ai} = undef();
            };

          if (($usecache)
          && ($Awfif::wsol-> {ni} [awsoadr ($i)] == 1)
          && ((!defined ($gdeltachange))
            or (($strategy eq 'tdgroup') && (!$gdeltachange))
            or ($strategy ne 'tdgroup'))
          && (notcsponsor ($Awfif::memes-> {currentwsbi}, $i, $loadcache))
          && (checkcache ($strategy, $concept, undef(), awsoadr ($i), $Awfif::memes-> {cvpcwso}) != 0) ){

            $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}] = time ();

            $change = checkcache ($strategy, $concept, undef(), awsoadr($i), $Awfif::memes-> {cchange});

            $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswicsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswicsum}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}];
            }
          else {#if active these wso will have to be re calculated invalidating the caches-for-all-concepts at this wso position.
            my($change1);

            $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}] = time ();
            $ai = awsoadr ($i);
# salwsitemihist
# no salience calculation on inactive histone
            if (($Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsohistbp}] != 0) #*** submacrok ***#
            && ($Awfif::histonel-> {l} [
              $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsohistbp}]] [2] == 1)#*** submacrok ***#
                ) {#ignore this inactive histone
              $change = 0;
              if ($usecache) {

                &setcache ($strategy, $concept, undef(), $ai, $Awfif::memes-> {cvpcwso}, 1);

                &setcache ($strategy, $concept, undef(), $ai, $Awfif::memes-> {cchange}, $change);
                };
              if ($Awfif::histonel-> {l} [
                $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsohistbp}]#*** submacrok ***#
                  ] [3] != 0){

                $i = $Awfif::histonel-> {l} [
                  $Awfif::wsol-> {l}[$ai][ $Awfif::memes-> {wsohistbp}]#*** submacrok ***#
                    ] [3];
                }#if
              else {#some histones are not contiguous

                $i = trwsoadr ($i, 1);
                };
              }#if
# salwsitemichar
            elsif (wsbasetype ($i) == $Awfif::memes->{snnh}{ichar}) {#ignore this wso
              $change = 0;
              if ($usecache) {

                &setcache ($strategy, $concept, undef(), $ai, $Awfif::memes-> {cvpcwso}, 1);

                &setcache ($strategy, $concept, undef(), $ai, $Awfif::memes-> {cchange}, $change);
                };
              }#if
# salwsitemietrmgrgu1
            elsif ((($strategy eq 'tdgroup') or ($strategy eq 'bugroup')) && (tmgiegsponsor ($i) > 1)) {#special processing of this whole group

              $change = tmgiegsalience ($myli, $i, $kwp, $kwpr, $strategy, \$ni);
              if ($ni > 1) {

                $Awfif::wsol-> {ni}[$ai] = $ni;
                };
              if ($usecache) {

                &setcache ($strategy, $concept, undef(), $ai, $Awfif::memes-> {cvpcwso}, 1);

                &setcache ($strategy, $concept, undef(), $ai, $Awfif::memes-> {cchange}, $change);
                if ($loadcache != (0 + $Awfif::memes-> {backoffactive} {$strategy})) {

                  &setcache ($strategy, $concept, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}, (1 + $Awfif::memes-> {backoffactive} {$strategy}));
                  };#if
                };#if
              }#if
            else {#active wso

              $change = $Awfif::memes-> {binds}-> {$strategy}->
              ($myli, $i, $kwp, $kwpr, \$change1);#mean change
              if ($usecache) {

                &setcache ($strategy, $concept, undef(), $ai, $Awfif::memes-> {cvpcwso}, 1);

                &setcache ($strategy, $concept, undef(), $ai, $Awfif::memes-> {cchange}, $change);
                if ($loadcache != (0 + $Awfif::memes-> {backoffactive} {$strategy})) {

                  &setcache ($strategy, $concept, $Awfif::memes-> {currentwsbi}, undef(), $Awfif::memes-> {cvalid}, (1 + $Awfif::memes-> {backoffactive} {$strategy}));
                  };#if
                };
              };#else

            $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] = time ();
            $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiisum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiisum}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}];
            };#else
          if ($change > 0) {

            $$tinstances = $$tinstances + $change;
            $i2++;
            $ca[$i2] = $i;# record which items contribute
            if (($usecache) ) {# cache loaded

              &setcache ($strategy, $concept, undef(), $i2, $Awfif::memes-> {cvpci}, $i);
              };#if cache in use
            };#if

          if (($strategy eq 'tdgroup') or ($strategy eq 'bugroup')) {

            $i = trwsoadr ($i, $Awfif::wsol-> {ni} [awsoadr ($i)]);#get the next wso
            }#if
          else {

            $i = trwsoadr ($i, 1);
            };#else
          $ni = 1;
          if (matchbreaksalwso ($i) > 0) {

            &break();
            };#if
          }# for -> while
# ******* *********** ********* end of main workspace salience iterative calculation ****** *******
        if (($usecache) ) {# cache loaded

          &setcache ($strategy, $concept, undef(), undef(), $Awfif::memes-> {ci2}, $i2);
          &setcache ($strategy, $concept, undef(), undef(), $Awfif::memes-> {ctinst}, $$tinstances);
          };#if cache in use
        };#else
# if try to normalize too small a population the results will bias
# towards some items
# This routine aims to stop this by switching to a random selection method
#

      if (($$tinstances > 0) && ($i2 >= $Awfif::memes-> {minnorm})) {#active objects to select
        my ($i5, $nslinkh);

        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}] = time ();

        for ($i5 = 1; $i5 <= $Awfif::memes-> {maxnormitems}; $i5++) {

          $$nextinstance = 1 + int (rand ($$tinstances));
          $nslinkh = addnormitem ($$nextinstance, $strategy);
          }; #create the set of tinstances
        &ordnormlist ( $nslinkh, $strategy);
# now match the list of t elements with wsoids provided by normwsitem


        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] = time ();
        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswinsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswinsum}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}];

        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}] = time ();

        $$nextinstance = normwsitem ($myli, $$nextinstance, $kwp, $kwpr, $strategy);

        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] = time ();
        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiisum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiisum}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}];

# know now have a nextinstance - throw away this item from the tail of the cache
        $$nextinstance = $Awfif::norml-> {l} [$Awfif::norml-> {t}[$Awfif::memes-> {currentwsbi}][ $Awfif::cache-> {h}{$strategy}]][4];
        &freenormitem ($Awfif::norml-> {t}[$Awfif::memes-> {currentwsbi}][ $Awfif::cache-> {h}{$strategy}], $strategy);
        &freenormiteme ($strategy);

        $found = 't';
        if (($$nextinstance == 0) or (!defined($$nextinstance))) {

          &break ();
          $found = '';
          };

        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] = time ();
        $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswinsum}] = $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswinsum}] + $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswiet}] - $Awfif::memes-> {time} [$Awfif::memes-> {spctime}] [$Awfif::memes-> {ch}{$Awfif::codelet-> {l} [$myli] [2]}] [$Awfif::memes-> {sswist}];
        }#active objects found
      elsif ($$tinstances > 0 ) {

        $thenextinstance = 1 + int (rand ($i2));
        if (($usecache) && ($loadcache == 2)) {# cache loaded

          $$nextinstance = checkcache ($strategy, $concept, undef(), $thenextinstance, $Awfif::memes-> {cvpci});
          }
        else {

          $$nextinstance = $ca[$thenextinstance];
          };
        $found = 't';
        if (($$nextinstance == 0) or (!defined($$nextinstance))) {

          &break ();
          $found = '';
          };
        }
      else {

        $$nextinstance = 0;
        };#else
      };#else
    if ((defined ($$omeric)) && ($$omeric > 1) ){

      $$omeric = 1;
      }#if
    elsif ((defined ($$omeric)) && ($$omeric == 1) ){

      $nobackoff = 't';
      };# elsif
    if (($strategy =~ /^t/)
    ){

      &setanywscache ($strategy, 2, $nobackoff);
      };
    &uwsohist ($$nextinstance);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsalwsitem nextinstance $$nextinstance ret($found)\n");
      };
    return $found
    }# selsalwsitem
#
#<!-- end tag ca -->
#<!-- end tag stm -->
#<!-- end tag sca -->
#
sub selwspair {
    my($myli, $nextinstance, $partneri, $kwp, $kwpr, $sactset, $strategy, $model, $omeric)=@_;
    my ($tinstances, $found);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selwspair myli $myli, strategy $strategy ");
      };
    if (($Awfif::memes-> {trace} == $Awfif::memes-> {tracephase})
    or ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry})) {
      print ("iphase $Awfif::memes->{iphase} ");
      };
    if ($Awfif::memes-> {trace} == $Awfif::memes-> {tracephase}) {
      print ("\n");
      };

    if ($Awfif::memes-> {iphase} < $Awfif::memes-> {iphasecomp}) {# initial phase
      $found = '';
      }
    else {

      $found = selsalwsitem ($myli, \$$nextinstance, \$tinstances, $kwp, $kwpr, \@$sactset, $strategy, \$$omeric);
      if (($found) && ($$nextinstance == 0)) {

        &break ();#found must be set seperately to $$nextinstance -> 0
        }#if
      elsif ($found) {

        if (($strategy eq 'bugroup') or ($strategy eq 'tdgroup')) {# group logging expects codelet to know ni

          $Awfif::codelet-> {l} [$myli][4] = $$nextinstance;
          };
        do {

          $found = chdespi ($myli, \$$nextinstance, \$$partneri, $kwp, $kwpr, \@$sactset, $strategy, \$$model, \$$omeric);
          }# do
        while (($$nextinstance == $$partneri) && ($found)
        or ($$partneri == 0) && ($found));
        };
      };#else general phase
#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selwspair ni $$nextinstance, pi $$partneri model $$model ret $found\n");
      };

    return $found
    }# selwspair
#
sub selsalact {
    my($myli, $sws, $wss, $wse, $operoncount, $lomatchs, $lola, $loends, $lostrts, $loge, $logb, $sactset)=@_;
    my (@found);
# select a candidate for an goal's operation using normalisation
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsalact myli $myli sws $sws ");
      };

    @found = selsaliam ($myli, $sws, $wss, $wse, $operoncount, \@$lomatchs, \@$lola, \@$loends, \@$lostrts, \@$loge, \@$logb, \@$sactset, $Awfif::memes-> {snnh}{actioncategory});

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsalactx ret (0:$found[0] 1:$found[1] 2:$found[2] 3:$found[3] 4:$found[4] 5:$found[5] 6:$found[6])\n");
      };

    return @found
    }# selsalact
#
sub selsalmod {
    my($myli, $sws, $wss, $wse, $operoncount, $lomatchs, $lola, $loends, $lostrts, $loge, $logb, $sactset)=@_;
    my (@found);
# select a candidate for a model's operation using normalisation
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsalmod myli $myli sws $sws ");
      };

    @found = selsaliam ($myli, $sws, $wss, $wse, $operoncount, \@$lomatchs, \@$lola, \@$loends, \@$lostrts, \@$loge, \@$logb, \@$sactset, $Awfif::memes-> {snnh}{model});

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsalmodx ret (0:$found[0] 1:$found[1] 2:$found[2] 3:$found[3] 4:$found[4] 5:$found[5] 6:$found[6] 7:$found[7])\n");
      };

    return @found
    }# selsalmod
#
#<!-- start tag smo -->
#
sub selsaliam {
    my($myli, $sws, $wss, $wse, $operoncount, $lomatchs, $lola, $loends, $lostrts, $loge, $logb, $sactset, $strategy)=@_;
    my ($vs, @v, @vt, $vsi, $vmax, $t, $i, $i2, @found, $fn, @lopcs, $linkp, $operation, $cwsbi, $sgcount, @lotype, @loconc);
# select a candidate for an goal's operation using normalisation
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsaliam myli $myli sws $sws ");
      };
# This routine uses normalization to select a candidate for goal (action or model) implementation
    $cwsbi = $Awfif::memes-> {currentwsbi};
# initialise the normalisation variables

    $vs = 0;#tinstances in other salience normalisation procedures
    $vsi = $Awfif::memes-> {maxoper} + $Awfif::memes->{maxact} + 1; # case target consumed else
    for ($i = 1; $i <= $vsi; $i++) {
      $v[$i] = 0;#Assume a negative response is unsure
      $vt[$i][0] = '';#Assume a negative response is no activity
      };

    $i2 = 1;
    $linkp = $Awfif::memes->{snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::memes->{snnh}{opercategory}];
    @found = ();

    while (($linkp != 0)) {
      if ((($strategy == $Awfif::memes-> {snnh} {actioncategory}) && ($sgcount = tokenactives ($myli, $sws, $wss, $wse, $linkp, \@lopcs, $operoncount, \$operation, \@$lomatchs, \@$lola, \@$loends, \@$lostrts, \@$loge, \@$logb, \@lotype, \@loconc, \@$sactset)) != 0 )
      or (($strategy == $Awfif::memes-> {snnh} {model}) && ($sgcount = tokenactivem ($myli, $sws, $wss, $wse, $linkp, \@lopcs, $operoncount, \$operation, \@$lomatchs, \@$lola, \@$loends, \@$lostrts, \@$loge, \@$logb, \@lotype, \@loconc, \@$sactset)) != 0 )) {# physical attribute salient

        for ($i = 0; $i < $sgcount; $i++) {

          $v[$i2] = int(($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snna} {$Awfif::memes-> {snnih} {$lopcs [$i]}})
            * ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnd} [$lopcs [$i]])/2);
          if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
            print ("v[$i2]:$v[$i2] ");
            };
          $vt [$i2][0] = $operation;
          $vt [$i2][1] = $lotype [$i];#ltype
          $vt [$i2][2] = $loconc [$i];#concept
          $vt [$i2][3] = $$lostrts [$i];#start address
          $vt [$i2][4] = $$loends [$i];#end address
          $vt [$i2][5] = $$logb [$i];#gap start address
          $vt [$i2][6] = $$loge [$i];#gap end address
# nuclabmieuse1
          $vt [$i2][7] = $$lola [$i];#jhlsi
          $fn = 't';
          $vs = $vs + $v [$i2];
          $i2++;
          }; #for
        };#physical token active

      $linkp = $Awfif::slipnet-> {l} [$linkp][0];
      }#while operational tokens to check

# or grow something
# or model something
# or compare requestor to something (scout)
# or move requestor somewhere
# or change rate of flow
# or signal
# or exchange something
# or replicate
# else {# dont change
# although nothing can be sure and Samuel would argue we have to learn from mistakes for this
# strategy to be OK this weak force will be an ifluence when nothing else can contribute strongly
#

    if ($i2 < $vsi) {

      $vmax = $i2;
      }
    else {

      $vmax = $vsi;
      };

    $v[$vmax] = 2;
    $vt [$vmax][0] = '';
    $vt [$vmax][1] = 0;
    $vt [$vmax][2] = 0;
    $vt [$vmax][3] = 0;
    $vt [$vmax][4] = 0;
    $vs = $vs + $v [$vmax];
# normalize

    $fn = '';
    $t = 0;
    $i2 = 1 + int (rand ($vs));
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("vs($vs) -> i2($i2) ");
      };
    $i = 1;

    while (($i <= $vmax) && (!$fn)) {
      $t = $t + $v [$i];
      if ($t >= $i2 ) {

        if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
          print ("selected i($i) ");
          };#if
        $found[0] = $vt [$i][0];#operation
        $found[1] = $vt [$i][1];#ltype
        $found[2] = $vt [$i][2];#concept
        $found[3] = $vt [$i][3];#start address
        $found[4] = $vt [$i][4];#end address
# nuclabmieuse2
        $found[5] = $vt [$i][5];#gap start
        $found[6] = $vt [$i][6];#gap end
        $found[7] = $vt [$i][7];#jhlsi
        $fn = 't';
        };#if
      $i++;
      };#while

    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("selsaliamx ret (0:$found[0] 1:$found[1] 2:$found[2] 3:$found[3] 4:$found[4] 5:$found[5] 6:$found[6] 7:$found[7])\n");
      };

    return @found
    }# selsaliam
#
sub tokenactives {
    my($myli, $sws, $wss, $wse, $linkp, $lopcs, $operoncount, $nextinstance, $lomatchs, $lola, $loends, $lostrts, $loge, $logb, $lotype, $loconc, $sactset)=@_;
    my($i2, $desclink, $cwsbi, $sgcount, $opertype);
#
# checked for merged workspaces

    $opertype = $Awfif::slipnet-> {l} [$linkp][2];
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$opertype};
      print ("tokenactives linkp $linkp opertype $pr operoncount $operoncount ");
      };
    $sgcount = 0;
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $$nextinstance = '';
# using cytosolic label's descriptor matches to the input member of the operation set as a kinase like control if present the proceed
    $Awfif::memes-> {currentwsbi} = $sws;

    for ($i2 = $wss; $i2 <= $wse; $i2 = trwsoadr ($i2, 1)) {
      $desclink = $Awfif::wsol-> {l} [ awsoadr($i2)] [2]; #index to head of descriptor list
      while (($desclink != 0) && ($$nextinstance eq '')) {# more descriptors in this chain
# Now have the node that is head of links that should be matching matchtoo

        if ($opertype == $Awfif::workspace-> {l} [$desclink][2] ) {# slipnet to matches
# return a codelet strategy

          $$nextinstance = 't'.$Awfif::memes-> {snnih} {$opertype}.'scout';
          };#if match
        $desclink = $Awfif::workspace-> {l} [$desclink][0]; # walk back down chain
        };# while
      }# for
# with the presence of a cytosolic match now find a salient part of the sub-chema

    if ($$nextinstance ne '') {
      $sgcount = tokenactive ($myli, $sws, $wss, $wse, $linkp, \@$lopcs, $operoncount, \$$nextinstance, \@$lomatchs, \@$lola, \@$loends, \@$lostrts, \@$loge, \@$logb, \@$lotype, \@$loconc, \@$sactset)
      };#if kinase has phosphorylated the sponsor
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tokenactivesx lopcs[0] $$lopcs[0] nextinstance $$nextinstance ret ($sgcount)\n");
      };

    return $sgcount
    }# tokenactives
#
sub tokenactivem {
    my($myli, $sws, $wss, $wse, $linkp, $lopcs, $operoncount, $nextinstance, $lomatchs, $lola, $loends, $lostrts, $loge, $logb, $lotype, $loconc, $sactset)=@_;
    my($cwsbi, $sgcount, $opertype);
#
# checked for merged workspaces

    $opertype = $Awfif::slipnet-> {l} [$linkp][2];
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$opertype};
      print ("tokenactivem linkp $linkp opertype $pr operoncount $operoncount ");
      };
    $sgcount = 0;
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $$nextinstance = '';
# no kinase for model instantiation

    $$nextinstance = 't'.'nsdep'.'scout';
# Deploy from the nucleus to the core workspace a salient part of the sub-chema

    if ($$nextinstance ne '') {
      $sgcount = tokenactive ($myli, $sws, $wss, $wse, $linkp, \@$lopcs, $operoncount, \$$nextinstance, \@$lomatchs, \@$lola, \@$loends, \@$lostrts, \@$loge, \@$logb, \@$lotype, \@$loconc, \@$sactset)
      };#if kinase has phosphorylated the sponsor
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tokenactivemx lopcs[0] $$lopcs[0] nextinstance $$nextinstance ret ($sgcount)\n");
      };

    return $sgcount
    }# tokenactivem
#
sub tokenactive {
    my($myli, $sws, $wss, $wse, $linkp, $lopcs, $operoncount, $nextinstance, $lomatchs, $lola, $loends, $lostrts, $loge, $logb, $lotype, $loconc, $sactset)=@_;
    my($i, $i2, $sponsor, $sgdi, $cwsbi, $sgcount);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tokenactive sws($sws) wss($wss) wse($wse) linkp($linkp) operoncount($operoncount) sactset($$sactset[0]) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $sgcount = 0;

    for ($i2 = 0; $i2 < $operoncount; $i2++) {#scan the full set of operons
      if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
        my ($pr );
        print ("lomatchs ($i2 = $$lomatchs[$i2]) ");
        if ($$lomatchs[$i2]) {
          $pr = $Awfif::jhls-> {l} [$$lola[$i2]] [8];
          print ("jhlsi [$$lola[$i2]] [8]=$pr ");
          $pr = $Awfif::jhls-> {l} [$$lola[$i2]] [9];
          print ("jhlsi [$$lola[$i2]] [9]=$pr ");
          };#if
        };
      if ($$lomatchs[$i2]) {

        my ($end, $start);
# $$lola[$i2] has the jhls index of the matching label
# ws is [7] start is [8] end is [9]
        $Awfif::memes-> {currentwsbi} = $Awfif::jhls-> {l} [$$lola[$i2]] [7];
        $start = $Awfif::jhls-> {l} [$$lola[$i2]] [8];# start is in operon and can get us to the group sponsor and hence group info
        $i = trwsoadr ($Awfif::jhls-> {l} [$$lola[$i2]] [9], 1);#want to check the items after the operon until the group end
# the end will be one link before the group end
        &fgrpd ($myli, $start, \$sgdi, $Awfif::memes->{snnh}{groupcategory});
        $sponsor = fgrpsponsor ($start, $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory});
        $end = fgrpend ($sponsor);# of the group
#
# now can find any salient sub-schema between $i and $end
# nuclabmieuta1

        &rtokenmatch ($i, $end, \$sgcount, \@$lopcs, \@$lola, \@$loends, \@$lostrts, \@$loge, \@$logb, \@$lotype, \@$loconc, $$lola[$i2]);

        };# if
      };# for
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("tokenactivex lopcs $$lopcs[0] nextinstance $$nextinstance ret ($sgcount)\n");
      };

    return $sgcount
    }# tokenactive
#
sub rtokenmatch {
    my($i, $end, $sgcount, $lopcs, $lola, $loends, $lostrts, $loge, $logb, $lotype, $loconc, $sjhls)=@_;
    my($i3, $i2);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("rtokenmatch i $i end $end sgcount $$sgcount ");
      };

# now can find any salient sub-schema between $i and $end
    if ((defined ($Awfif::memes-> {fjhls8})) && ($Awfif::memes-> {fjhls8} != 0)
    ) {#worth checking jhls 8,9
# nuclabmvbotu1
# if the jhls is in the vbotscmap then can just respond with the associated action jhls

      my ($vbotg, $vboti);
      if ((defined ($Awfif::memes-> {vbottgenmax}))
      && (defined ($vbotg = $Awfif::memes-> {vbottgenmax} - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [3] - $Awfif::memes->{snnh}{wsi}) ) )
      && ( ($vboti = $Awfif::memes-> {vbottpopmax} + 1 - ($Awfif::workspace-> {l} [$Awfif::memes-> {vbotpgdsc} ] [2] - $Awfif::memes->{snnh}{wsi}) ) > 1)# to ensure that have run first vbot
      && (defined ($Awfif::vbotga-> {scmaph}-> {$sjhls}))
      ){

        $i3 = $Awfif::vbotha-> {gens} [0] [1]-> {vbotscbh}{$Awfif::vbotga-> {scmapc} [$vboti][$Awfif::vbotga-> {scmaph}-> {$sjhls}]};
        $$lostrts [$$sgcount] = $Awfif::jhls-> {l} [$i3][8];
        $$loends [$$sgcount] = $Awfif::jhls-> {l} [$i3][9];
        $$logb [$$sgcount] = $Awfif::jhls-> {l} [$i3][11];#gap start
        $$loge [$$sgcount] = $Awfif::jhls-> {l} [$i3][12];# gap end
        $$lotype [$$sgcount] = $Awfif::jhls-> {l} [$i3][3];#ltype such as operon & spsignal
        $$loconc [$$sgcount] = $Awfif::jhls-> {l} [$i3][4];#concept such as groupcategory
        $$lola [$$sgcount] = $i3;#jhlsi
        $$lopcs [$$sgcount++] = $Awfif::jhls-> {l} [$i3][6];#pseudo concept
        }#if its a vbot model action mapping
      else {
# nuclabmvbotu3

        if ( defined($Awfif::jhls-> {l} [$sjhls][20][0]) ){

          for ($i2 = 1; $i2 <= $Awfif::jhls-> {l} [$sjhls][20][0]; $i2++){

            $i3 = $Awfif::jhls-> {l} [$sjhls][20][$i2];
            $$lostrts [$$sgcount] = $Awfif::jhls-> {l} [$i3][8];
            $$loends [$$sgcount] = $Awfif::jhls-> {l} [$i3][9];
            $$logb [$$sgcount] = $Awfif::jhls-> {l} [$i3][11];#gap start
            $$loge [$$sgcount] = $Awfif::jhls-> {l} [$i3][12];# gap end
            $$lotype [$$sgcount] = $Awfif::jhls-> {l} [$i3][3];#ltype such as operon & spsignal
            $$loconc [$$sgcount] = $Awfif::jhls-> {l} [$i3][4];#concept such as groupcategory
            $$lola [$$sgcount] = $i3;#jhlsi
            $$lopcs [$$sgcount++] = $Awfif::jhls-> {l} [$i3][6];#pseudo concept
            };#for
          }#if
        else {

          for ($i3 = $Awfif::memes-> {fjhls8}; $i3 <= $Awfif::jhls-> {p}; $i3++) {
# nuclabmvbotu2
            if (($Awfif::jhls-> {l} [$i3][7] == $Awfif::memes->{currentwsbi})
            && (ainbtoc ($Awfif::jhls-> {l} [$i3][8], $i, $end, $Awfif::jhls-> {l} [$i3][7]))
            && (ainbtoc ($Awfif::jhls-> {l} [$i3][9], $i, $end, $Awfif::jhls-> {l} [$i3][7]))
            ) {#match assuming lists

              $$lostrts [$$sgcount] = $Awfif::jhls-> {l} [$i3][8];
              $$loends [$$sgcount] = $Awfif::jhls-> {l} [$i3][9];
              $$logb [$$sgcount] = $Awfif::jhls-> {l} [$i3][11];#gap start
              $$loge [$$sgcount] = $Awfif::jhls-> {l} [$i3][12];# gap end
              $$lotype [$$sgcount] = $Awfif::jhls-> {l} [$i3][3];#ltype such as operon & spsignal
              $$loconc [$$sgcount] = $Awfif::jhls-> {l} [$i3][4];#concept such as groupcategory
# nuclabmieurt1
              $$lola [$$sgcount] = $i3;#jhlsi
              $$lopcs [$$sgcount++] = $Awfif::jhls-> {l} [$i3][6];#pseudo concept
              };#if proximate jhlabel
            };#for each jhls
          };#else
        };#else
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("rtokenmatchx sgcount ($$sgcount)\n");
      };

    }# rtokenmatch
#
sub consumed {
    my($facettype, $kwp, $kwpr, $sactset)=@_;
    my($nextinstance);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$facettype};
      print ("consumed facettype $pr kwp $kwp kwpr $kwpr sactset $$sactset[0] ");
      };
    $nextinstance = 0;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$nextinstance};
      print ("consumedx ret $pr\n");
      };

    return $nextinstance;
    }# consumed
#
#<!-- end tag smo -->
#
sub countgjhlabels {
    my($myli, $gsponsor)=@_;
    my($end, $start, $i, $cwsbi, $jhlc);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("countgjhlabels myli $myli gsponsor $gsponsor ");
      };
    $jhlc = 0;
    $cwsbi = $Awfif::memes-> {currentwsbi};


# ws is [7] start is [8] end is [9]
    $start = fgrpstart ($gsponsor);# of the group
# the end will be one link before the group end
    $end = fgrpend ($gsponsor);# of the group
#
# now can find any salient sub-schema between $i and $end

    for ($i = 1; $i <= $Awfif::jhls-> {p}; $i++) {
      if (($Awfif::jhls-> {l} [$i][7] == $Awfif::memes->{currentwsbi})
      && ($Awfif::jhls-> {l} [$i][8] >= $start)
      && ($Awfif::jhls-> {l} [$i][9] <= $end)) {#this jhlabel is proximate record it

        $jhlc++;
        };#proximate jhlabel
      };#for each jhls
# finally switch back the current ws

    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("countgjhlabelsx start $start end $end ret ($jhlc)\n");
      };

    return $jhlc
    }# countgjhlabels
#
#<!-- start tag sca -->
#<!-- start tag ca -->
#
sub selfacet {
    my($facettype, $kwp, $kwpr, $sactset)=@_;
    my ($i, $ai, $i2, $nextinstance, $bflinkp, $tinstances, $linstances,
      $notreached, $matchtoo, $desclink, $snlink, $ci, $bfc, $change, $ikwp, $akwp,
      $thenextinstance, $loadcache, $usecache, $tblock, $ciblock );
# Choose a facet as a probabalistic function of its activation and number of descriptors linked to it
# each facet has ci links back to slipnet node categories that link from ws descriptors
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$facettype};
      print ("selfacet facettype $pr ");
      };

# bondfacets are keyed via:
# *memes {snnh}{bondfacet}
# *head of node link list memes {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [head index]
# *with attributes in slipnet link list
#
    $akwp = awsoadr ($kwp);
# move the kwp out of the inactive histone
    if (($Awfif::wsol-> {l}[$akwp][ $Awfif::memes-> {wsohistbp}] != 0) #*** submacrok ***#
    && ($Awfif::histonel-> {l} [$Awfif::wsol-> {l}[$akwp][ $Awfif::memes-> {wsohistbp}]] [2] == 1)) {#*** submacrok ***#

      $ikwp = nextihistone ($kwp, \$akwp);
      }#if
    else {

      $ikwp = $kwp;
      };#else
    $bflinkp = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$facettype];
    $tinstances = 0;
    $i = 0;
    $notreached = "T";
    $ci = 0;
    $bfc = 0;
    $loadcache = '';
    $usecache = 't';# only relevent if there are some situations where the cache addresses are invalidated
# by the state of the caller

    if (($bflinkp != 0) && ($Awfif::slipnet-> {l} [$bflinkp] [0] == 0 )) {# just one child
      $nextinstance = $Awfif::slipnet-> {l} [$bflinkp] [2];
      }
    else {# check other cases

      if (($usecache)
      && (checkcache ('selfacetc', undef(), $bflinkp, undef (), $Awfif::memes-> {selcv}) == 0) ){
        $loadcache = 't';
        &setcache ('selfacetc', undef(), $bflinkp, undef (), $Awfif::memes-> {selcv}, 1);
        };
      do {

        if ($bflinkp == 0) {#end of chain of slipnet links from bondfacet

          $notreached = "";
          }#scanned all items that are known
        else {#still able to check more slipnet links from bondfacet

          $bfc++;
          $matchtoo = $Awfif::slipnet-> {l} [$bflinkp] [2];# return link node id
# Now for each node id look through the wsobjects for descriptors with this as to id
          if (($usecache) && (!$loadcache)) {# cache loaded

            $tblock = checkcache ('selfacetc', undef(), $bflinkp, undef (), $Awfif::memes-> {selctinst});
            $ciblock = checkcache ('selfacetc', undef(), $bflinkp, undef (), $Awfif::memes-> {selcchange});
            $tinstances = $tinstances + $tblock;
            $ci = $ci + $ciblock;
            }
          else {

            if ($usecache) {#so loadcache should be true

              &setcache ('selfacetc', undef(), $bflinkp, undef (), $Awfif::memes-> {selcv}, 1);
              };
            $tblock = $tinstances;
            $ciblock = $ci;
            $i = $kwpr;
            $ai = awsoadr ($i);
            while (($i != $ikwp) && ($i != 0)) {#updated for merged workspaces

              if ((checkwsmd ($ai, $Awfif::memes-> {wsohistbp}) != 0)
              && ($Awfif::histonel-> {l} [checkwsmd ($ai, $Awfif::memes-> {wsohistbp})] [2] == 1)) {#ignore this inactive histone

                if ($Awfif::histonel-> {l} [checkwsmd ($ai, $Awfif::memes-> {wsohistbp})] [3] != 0){

                  $i = $Awfif::histonel-> {l} [checkwsmd ($ai, $Awfif::memes-> {wsohistbp})] [3];
                  }#if
                else {#some histones are not contiguous

                  $i = trwsoadr ($i, 1);
                  };
                }#if
              else {

                $linstances = 1;
                $desclink = $Awfif::wsol-> {l} [ awsoadr($i)] [2]; #index to head of descriptor list
                while ($desclink != 0) {# more descriptors in this chain
# Now have the node that is head of links that should be matching matchtoo

                  $snlink = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$Awfif::workspace-> {l} [$desclink] [2]];#head
                  while ($snlink != 0) {
                    if ($matchtoo == $Awfif::slipnet-> {l} [$snlink][2] ) {# slipnet to matches

                      $linstances++;
                      };#if match
                    $snlink = $Awfif::slipnet-> {l} [$snlink][0]; #get next link
                    };# while sn links to traverse
                  $desclink = $Awfif::workspace-> {l} [$desclink][0]; # walk back down chain
                  };# while
                $change = ($linstances * $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snna} {@$sactset[ $Awfif::slipnet-> {l} [$bflinkp] [2]]});
                if ($change > 0) {

                  $ci++;
                  $tinstances = $tinstances + $change;
                  };
                $i = trwsoadr ($i, 1);
                };#else
              $ai = awsoadr ($i);
              }# for
            if ($usecache) {#load the cache with tinstance change over this slipnet concept

              &setcache ('selfacetc', undef(), $bflinkp, undef (), $Awfif::memes-> {selctinst}, $tinstances - $tblock);
              $tblock = $tinstances;
              &setcache ('selfacetc', undef(), $bflinkp, undef (), $Awfif::memes-> {selcchange}, $ci - $ciblock);
              $ciblock = $ci;
              };
            };#else not cached
          $bflinkp = $Awfif::slipnet-> {l}[$bflinkp] [0];#next bf linked node
          }# else
        }# do
      while ($notreached);
#

      if (($tinstances > 0) && ($ci >= $Awfif::memes-> {minnorm})) {

        $nextinstance = int (rand ($tinstances)); # is between 0 and (totalwsobjects -1);
#
        $nextinstance = normfacet ($nextinstance, $facettype, $kwp, $kwpr, \@$sactset);
        }
      elsif ($tinstances > 0) {

        $i2 = 1;
        $thenextinstance = 1 + int (rand ($bfc));
        $bflinkp = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$facettype];
        while (( $bflinkp > 0) && ($i2 <= $thenextinstance )) {

          $nextinstance = $Awfif::slipnet-> {l} [$bflinkp] [2];
          $bflinkp = $Awfif::slipnet-> {l} [$bflinkp][0];
          $i2++
          }; #while
        };# elsif
      }; #else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$nextinstance};
      print ("selfacet ret $pr\n");
      };

    return $nextinstance;
    }# selfacet
#
#<!-- end tag ca -->
#<!-- end tag sca -->
#
sub selbondfacet {
    my($kwp, $kwpr, $sactset)=@_;
    my ($nextinstance);
#
# checked for merged workspaces

    $nextinstance = selfacet ($Awfif::memes-> {snnh} {bondfacet}, $kwp, $kwpr, \@$sactset);
    return $nextinstance;
    }# selbondfacet
#
sub seldescproperty {
    my($kwp, $kwpr, $sactset)=@_;
    my ($nextinstance );
#
# checked for merged workspaces

    $nextinstance = selfacet ($Awfif::memes-> {snnh} {descfacet}, $kwp, $kwpr, \@$sactset);
    return $nextinstance;
    }#seldescproperty
#
#<!-- start tag ca -->
#
sub usedescproperty {
    my ($nidl, $matches, $matchns, $sncval, $ifrom) = @_;
    my ($needmatch, $havematch, $bclinkp, $stilll, $matchtoo, $snlink,
    $match, $i, $i1, $loadcache, $usecache);
# Check of a concept of nidl and its tree of siblings and children are connected to
# descriptor concept sncval
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih}{$sncval};
      print ("usedescproperty nidl $nidl using sncval $pr ");
      };

    $needmatch = 'T';
    $havematch = '';
    $i1 = 0;
    $stilll = 'T';
    $loadcache = '';
    $usecache = 't';
# look through each of the SN nodes linked TO parent link category - via CI return
    $bclinkp = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$sncval];

    &itmcachecor ($nidl, $sncval, 'seq', 'usedescproperty');
    if (($usecache)
    && (checkcache ('usedescpc', $sncval, undef(), $nidl, $Awfif::memes-> {udpcv}) == 0)) {

      $loadcache = 't';
      &setcache ('usedescpc', $sncval, undef(), $nidl, $Awfif::memes-> {udpcv}, 1);
      };
    if (($usecache) && (!$loadcache)) {# cache loaded on entry to this procedure

      $i1 = checkcache ('usedescpc', $sncval, undef(), $nidl, $Awfif::memes-> {udpcit});
      for ($i = 0;$i < $i1; $i++) {

        $$matches[$i] = checkcache ('usedescpc', $sncval, $i, $nidl, $Awfif::memes-> {udpcme});
        $$matchns[$i] = checkcache ('usedescpc', $sncval, $i, $nidl, $Awfif::memes-> {udpcmn});
        };
      }#if cache
    else {
      do {

        if (($bclinkp == 0) or (!($needmatch))) {#end of chain of slipnet links from bondcategory
          $stilll = "";
          }#scanned all items that are known or found a match
        else {#still able to check more slipnet direct children of sncval
# if ANY of these is linked FROM the slipnet nodes FROM the descriptor
# nidl match is true

          if ($Awfif::slipnet-> {l} [$bclinkp][3] == $Awfif::memes-> {snnh}{cibp}) {
            $matchtoo = $Awfif::slipnet-> {l} [$bclinkp][2]; # return link node id
            $snlink = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$Awfif::workspace-> {l} [$nidl][2]]; #head
# recurse through the slipnet nodes FROM here looking for the most active match

            $match = matchtree ($snlink, $matchtoo, $ifrom);
            $snlink = $Awfif::slipnet-> {l} [$snlink] [0]; #check siblings
            if ($match != 0 ) {

              $havematch = "t";
              $$matches[$i1] = $match;
              &setcache ('usedescpc', $sncval, $i1, $nidl, $Awfif::memes-> {udpcme}, $match);
              $$matchns[$i1] = $matchtoo;
              &setcache ('usedescpc', $sncval, $i1, $nidl, $Awfif::memes-> {udpcmn}, $matchtoo);
              $i1++;
              $match = 0;
              }#if match found
            else {
              while (($snlink != 0) && ($match == 0)) {#decend the tree

                $match = matchtree ($snlink, $matchtoo, $ifrom);#
                $snlink = $Awfif::slipnet-> {l} [$snlink] [0]; #setup to check next sibling
                if ($match !=0 ) {# nlink had no children to search

                  $havematch = "t";
                  $$matches[$i1] = $match;
                  &setcache ('usedescpc', $sncval, $i1, $nidl, $Awfif::memes-> {udpcme}, $match);
                  $$matchns[$i1] = $matchtoo;
                  &setcache ('usedescpc', $sncval, $i1, $nidl, $Awfif::memes-> {udpcmn}, $matchtoo);
                  $i1++;
                  $match = 0;
                  };# otherwise match so will terminate the while
                };# while sn links to traverse
              }; #else
            };# if back pointer

          $bclinkp = $Awfif::slipnet-> {l} [$bclinkp][0]; #match to next child of sncval
          }# else
        }#do
      while ($stilll);# still links from sncval

      &setcache ('usedescpc', $sncval, undef(), $nidl, $Awfif::memes-> {udpcit}, $i1);
      };#else dont use cache
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr, $ti);
      print ("usedescproperty ");
      for ($ti = 0; $ti<$i1;$ti++) {
        $pr = $Awfif::memes-> {snnih}{$$matchns[$ti]};
        print ("con $pr ");
        print ("act $$matchns[$ti] ");
        };#for
      print ("ret $i1\n");
      };
    return ($i1); #how many matches there are in the match arrays
    }#usedescproperty

#
#<!-- end tag ca -->
#
sub userdesc {
    my ($ni, $nidl, $pi, $pidl, $bc, $facettype) = @_;
    my ($desclink, $bposs, $matchtoo, $bflinked, $needmatch, $needmatch2);
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$bc};
      print ("userdesc ni $ni pi $pi bc $pr ");
      $pr = $Awfif::memes-> {snnih} {$$facettype};
      print ("facettype $pr ");
      };
# setup defaults for the nidl and pidl. When a bond is found that nidl/pidl will be updated
    $$nidl = 0;
    $$pidl = 0;
    $bposs = "";
    $bflinked = 0;
    $needmatch = "T";

    $matchtoo = $$facettype; #inverted
# ensure the wsobject ni and pi link to [bond] facet - i.e. are allowed to bond
# if get a match then bposs is true
#
    $desclink = $Awfif::wsol-> {l} [ awsoadr($ni)][2]; #index to head of descriptor list

    while (($desclink != 0)) {# more descriptors in this chain
#
# must work through the set of bond facets checking if any of these match the descriptor list's "from"s
# can recurse through the backpointer tree to ensure that the workspace object has a bondfacet
# ignore non base type descriptors
      if (($Awfif::workspace-> {l} [$desclink][3] == $Awfif::memes-> {snnh}{wsil})
      && (($bflinked == 0))) {

        $bflinked = matchbptree ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$$facettype], $Awfif::workspace-> {l} [$desclink][2]);
        };# check the bond facet
#
      if (($needmatch) && ($bflinked != 0)) {
# Must also Validate bonding conditions of the two descriptors with a bond of sponsors type

        $needmatch = "";
        $$nidl = $desclink;
        };# needmatch

      $desclink = $Awfif::workspace-> {l} [$desclink] [0];# walk back down chain
      };# while
#
    $desclink = $Awfif::wsol-> {l} [ awsoadr($pi)][2];#index to head of descriptor list
    if ($bflinked != 0) {#worth checking the second item

      $needmatch2 = "T"; # both must have the facet
      $bflinked = 0; #both descripter sets must support bonding
      while (($desclink != 0)) {# more descriptors in this chain
#
# must work through the set of bond facets checking if any of these match the descriptor list's "from"s
# can recurse through the backpointer tree to ensure that the workspace object has a bondfacet
# ignore non-wsi descriptors

        if (($Awfif::workspace-> {l} [$desclink][3] == $Awfif::memes-> {snnh} {wsil})
        && (($bflinked == 0))) {
          $bflinked = matchbptree ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$$facettype], $Awfif::workspace-> {l}[$desclink] [2]);
          };# check the bond facet
#
        $needmatch2 = "";
        $$pidl = $desclink;

        $desclink = $Awfif::workspace-> {l} [$desclink][0];# walk back down chain
        };# while
      if ((!($needmatch) && ($bflinked != 0)) # valid bond found in first descriptor list
      or (!($needmatch2) && ($bflinked != 0))) {

        $needmatch = "";
        };# if
      };# if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("userdesc nidl $$nidl pidl $$pidl ret !($needmatch)\n");
      };
    return (!($needmatch));
    }# userdesc
#
sub usefacet {
    my ($ni, $nidl, $facet) = @_;
    my ($desclink, $snlink, $bposs, $matchtoo, $needmatch);
# compare the wsobject ni with the bondfacet
# constraint is that it must have a descriptor that has this bondfacet
# if get a match then bposs is true
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$facet};
      print ("usefacet ni $ni facet $pr ");
      };
    $bposs = "";
    $needmatch = "T";
    $matchtoo = $facet;

    $desclink = $Awfif::wsol-> {l} [ awsoadr($ni)][2];#index to head of descriptor list
    while (($desclink != 0) && ($needmatch)) {# more descriptors in this chain
# Now have the node that is head of links that should be matching $facet
# $snlink = $Awfif::slipnet-> {l} [$Awfif::workspace-> {l} [$desclink] [2]][2];

      $snlink = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$Awfif::workspace-> {l} [$desclink] [2]];#head
      while (($snlink != 0) && ($needmatch)) {
        if ($matchtoo == $Awfif::slipnet-> {l} [$snlink][2] ) {# slipnet to matches

          $needmatch = "";
          $$nidl = $desclink;
          };#if match
        $snlink = $Awfif::slipnet-> {l} [$snlink] [0];#get next link
        };# while sn links to traverse

      $desclink = $Awfif::workspace-> {l} [$desclink] [0];# walk back down chain
      };# while
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("usefacet nidl $$nidl ret !($needmatch)\n");
      };
    return (!($needmatch));
    }# usefacet
#
sub usebondfacet {
    my ($ni, $nidl, $pi, $pidl, $facet) = @_;
    my ($desclink, $snlink, $needmatch);
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$facet};
      print ("usebondfacet ni $ni pi $pi facet $pr ");
      };

    $needmatch = !(usefacet ($ni, \$$nidl, $facet));
    $desclink = $Awfif::wsol-> {l} [ awsoadr($pi)][2];#index to head of descriptor list
    if (!($needmatch)) {#worth checking the second item

      $needmatch = "T"; # both must have the facet
      while (($desclink != 0) && ($needmatch)) {# more descriptors in this chain
# Now have the node that is head of links that should be matching $facet

        $snlink = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$Awfif::workspace-> {l} [$desclink][2]]; #head
        while (($snlink != 0) && ($needmatch)) {
          if ($facet == $Awfif::slipnet-> {l}[$snlink][2] ) {# slipnet to matches
            $needmatch = "";
            $$pidl = $desclink;
            };#if match

          $snlink = $Awfif::slipnet-> {l} [$snlink] [0]; #get next link
          };# while sn links to traverse
        $desclink = $Awfif::workspace-> {l} [$desclink] [0]; # walk back down chain
        };# while
      }# if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("usebondfacet nidl $$nidl pidl $$pidl ret !($needmatch)\n");
      };

    return (!($needmatch));
    }# usebondfacet
#
sub uselinkfacet {
    my ($ni, $nidl, $pi, $pidl, $facet) = @_;
    my ($needmatch);
#
# checked for merged workspaces

    $needmatch = !( usebondfacet ($ni, \$$nidl, $pi, \$$pidl, $facet));
    return (!($needmatch));
    }# uselinkfacet
#
sub usegroupfacet {
    my ($ni, $nidl, $pi, $pidl, $facet) = @_;
    my ($needmatch);
#
# checked for merged workspaces

    $needmatch = !( usebondfacet ($ni, \$$nidl, $pi, \$$pidl, $facet));
    return (!($needmatch));
    }# usegroupfacet
#
#
# ------------ ----------- sort strategy routines ----------
sub dsortr1 {
    my ($gap, $j, $sorta) = @_;#all sort strategy routines have same parameter block
    my ($r);
#
# checked for merged workspaces

    $r = int(rand (2));
    return $r
    }#dsortr1 randomizing sort
sub dsortqs1 {
    my ($gap, $j, $sorta) = @_;#all sort strategy routines have same parameter block
#
# checked for merged workspaces

    return ($$sorta [$j] <= $$sorta [$j+$gap])
    }#dsortqs1 shellsort
sub dsortqs2 {# for strings
    my ($gap, $j, $sorta) = @_;#all sort strategy routines have same parameter block
#
# checked for merged workspaces

    return ($$sorta [$j] le $$sorta [$j+$gap])
    }#dsortqs2 shellsort
# ------------- --------------------- ------------ ---------
#
sub dsort {# my imp of shell sort p108 Kernighan & Ritchie
    my ($sa, $l, $ra, $strategy) = @_;
    my ($i, $j, $gap, $temp, $tempa, @sorta);
#
# checked for merged workspaces

    if ($l < 1) {# no need to sort
      } # array of length 0
    elsif ($l == 1) {# no need to sort but copy result index
      $$ra[0] = 0;
      } # array of length 1
    else {
      for ($i = 0; $i<$l; $i++) {
        $$ra[$i] = $i;
        $sorta[$i] = $$sa[$i];
        };#for
      for ($gap = int ($l/2); $gap > 0; $gap = int ($gap/2)) {
        for ($i = $gap; $i < $l; $i++) {
          for ($j = $i-$gap; $j >= 0; $j -= $gap) {
            if ($Awfif::memes-> {binds}-> {$strategy}-> ($gap, $j, \@sorta)) {
# since goto screws up for logic goto dsbreak;
              $j = -1;
              } # don't swop
            else {# swop
              $temp = $sorta [$j];
              $tempa = $$ra [$j];
              $sorta [$j] = $sorta [$j+$gap];
              $$ra [$j] = $$ra [$j+$gap];
              $sorta [$j+$gap] = $temp;
              $$ra [$j+$gap] = $tempa;
              };# do swop
            };#for
          dsbreak:
          };#for
        };#for
      };#do the sort
    }# dsort
#
sub qsort {# my imp of quick sort p121 Horowitz & Sahni
    my ($sa, $l, $ra, $strategy) = @_;
    my ($i, @sorta );
#
# checked for merged workspaces
# $inf must be a number larger than any to be sorted
# $l is the length of the array to be sorted. It is q in Horowitz & Sahni

    if ($l < 1) {# no need to sort
      } # array of length 0
    elsif ($l == 1) {# no need to sort but copy result index

      $$ra[0] = 0;
      } # array of length 1
    else {

      my ($bgst);
      $bgst = 0;
      for ($i = 1; $i<=$l; $i++) {
        $$ra[$i] = $i-1;
        $sorta[$i] = $$sa[$i-1];
        if ($bgst < $sorta[$i]) {
          $bgst = $sorta[$i];
          };#if
        };#for
      $sorta[$l+1] = $bgst+1;#must be the largest
      $$ra[$l+1] = $l;

      &quicksort (1, $l, \@sorta, \@$ra, $strategy);
      for ($i = 0; $i<$l; $i++) {
        $$ra[$i] = $$ra[$i+1];
        };#for
      };#else
    };#qsort
#
sub quicksort {# quicksort partitioning
    my ($p, $q, $sorta, $ra, $strategy) = @_;
    my ($j );
    if ($p < $q) {

      $j = $q + 1;
      &partition ($p, \$j, \@$sorta, \@$ra);
      &quicksort ($p, $j-1, \@$sorta, \@$ra, $strategy);
      &quicksort ($j+1, $q, \@$sorta, \@$ra, $strategy);
      };
    }# quicksort
#
sub partition {# quicksort partitioning
    my ($m, $p, $sorta, $ra) = @_;
    my ($i, $vs, $vr, $exit );

    $vs = $$sorta [$m];
    $vr = $$ra [$m];
    $i = $m;
    $exit = '';
    do {

      do {

        $i = $i + 1;
        } until ($$sorta[$i] >= $vs);
      do {

        $$p = $$p - 1;
        } until ($$sorta[$$p] <= $vs);
      if ($i < $$p) {

        my ($temp, $tempa);
        $temp = $$sorta [$$p];
        $tempa = $$ra [$$p];
        $$sorta [$$p] = $$sorta [$i];
        $$ra [$$p] = $$ra [$i];
        $$sorta [$i] = $temp;
        $$ra [$i] = $tempa;
        }# if
      else {

        $exit = 't';
        };#else
      } while (!$exit);

    $$sorta [$m] = $$sorta [$$p];
    $$ra [$m] = $$ra [$$p];
    $$sorta [$$p] = $vs;
    $$ra [$$p] = $vr;
    }# partition
#
#
#
#<!-- start tag al -resweb -->
#
sub rdup {# remove duplicates without sorting
    my ($sa, $l, $ra) = @_;
    my ($i, $noc );
#
# this uses a hash to collapse the duplicates and then returns the collapsed set

    if ($l < 1) {# no need to collapse
      $noc = 0;
      } # array of length 0
    elsif ($l == 1) {# no need to collaps but copy result index

      $$ra[0] = $$sa[0];
      $noc = 1;
      } # array of length 1
    else {

      $Awfif::memes-> {ha} = ();
      $noc = 0;
      for ($i = 0; $i < $l; $i++) {#load hash
        if (!defined ($Awfif::memes-> {ha}-> {$$sa[$i]})) {
          $Awfif::memes-> {ha}-> {$$sa[$i]} = $i;
          $$ra[$noc++] = $$sa[$i];
          };#if
        };#for
      $Awfif::memes-> {ha} = ();
      };#else
    return $noc
    }#rdup
#
#<!-- end tag al -->
#
sub userbondcategory {
    my ($ni, $nidl, $pi, $pidl, $nsnn, $psnn, $structure) = @_;
    my (@abond, @aacts, @saacts, $acceptable );
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$structure};
      print ("userbondcategory ni $ni pi $pi structure $pr ");
      };
#
    $acceptable = '';

      $abond [0] = $structure;
      $aacts [0] = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snna} {$Awfif::memes-> {snnih} {$structure}};
# Since there are a small number of bond types use a randomized order
# to find any descriptors that match

    &dsort (\@aacts, 1, \@saacts,'rsort');
# target is a concept to which this descriptor applies.
    $acceptable = usebondci ($ni, \$$nidl, $pi, \$$pidl, \$$nsnn, \$$psnn,\@abond, \@saacts, 0);
#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("userbondcategory nidl $$nidl pidl $$pidl nsnn $$nsnn psnn $$psnn ret $acceptable\n");
      };
    return ( $acceptable);
    }# userbondcategory
#
#
sub isccbond {
    my($lindex, $matchtoo, $ifrom, $uslipnet)=@_;
    my ($itsabond, $itemref);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {tracefull}) {
      my ($pr );
      $pr = $Awfif::memes-> {snnih} {$matchtoo};
      print ("isccbond lindex $lindex matchtoo $pr ifrom $ifrom using slipnet? $uslipnet ");
      };

    $itsabond = '';
    if ($uslipnet) {
      $itemref = \$Awfif::slipnet;
      }
    else {
      $itemref = \$Awfif::workspace;
      };
    if ($matchtoo != 0) {
      if (($matchtoo == $$itemref-> {l} [$lindex][2])
      && ($$itemref-> {l} [$lindex][3] != $Awfif::memes-> {snnh} {cibp})
# added or to support usual case i.e. successor bond - likely to create issues watch out for wobble
# probably needs more conditionals
      or ($matchtoo == $$itemref-> {l} [$lindex][3])
      or (($matchtoo == $$itemref-> {l} [$lindex][4]) && ($ifrom != 0))) {

        $itsabond = 'T';
        };
      };# not 0
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {tracefull}) {
      print ("isccbond ret $itsabond\n");
      };

    return $itsabond
    } #isccbond
#
sub usebondcategory {
    my ($ni, $nidl, $pi, $pidl, $nsnn, $psnn) = @_;
    my ($bclinkp, $i, $i2, @abond, @aacts, @saacts, $acceptable );
# This must match a bonding item, if any exists, from the current wspace
# attributes of the from (ni) item that does link to the too (pi) concept.
# If the from concept can be bonded then other workers will eventually place the
# descriptor in the workspace list. So if we find a bonding descriptor we just
# to check it applies to the too node. getwsic should check that.
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("usebondcategory ni $ni pi $pi ");
      };
# Get a list of activated bonding types
    $acceptable = '';
    $bclinkp = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::memes-> {snnh}{bondcategory}];
    $i = 0;
    do {

      if ($Awfif::slipnet-> {l} [$bclinkp][3] == $Awfif::memes-> {snnh}{cibp}) {#its a backpointer of a bonding relation
        $abond [$i] = $Awfif::slipnet-> {l} [$bclinkp][2];
        $aacts [$i] = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snna} {$Awfif::memes-> {snnih} {$Awfif::slipnet-> {l} [$bclinkp][2]}};
        $i++;
        };
      $bclinkp = $Awfif::slipnet-> {l} [$bclinkp][0];
      }
    while ($bclinkp != 0);
# Since there are a small number of bond types use a randomized order
# to find any descriptors that match

    &dsort (\@aacts, $i, \@saacts,'rsort');
# for each descriptor that matches use getwsic result to ensure that the
# target is a concept to which this descriptor applies.
    $i2 = 0;
    while (!($acceptable) && ($i2 < $i)) {
      $acceptable = usebondci ($ni, \$$nidl, $pi, \$$pidl, \$$nsnn, \$$psnn,\@abond, \@saacts, $i2);
      if (!$acceptable) {
        $i2++;
        };
      }; # for-> while
#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("usebondcategory nidl $$nidl pidl $$pidl nsnn $$nsnn psnn $$psnn ret $acceptable\n");
      };
    return ( $acceptable);
    }# usebondcategory
#
sub usebondci {
    my ($ni, $nidl, $pi, $pidl, $nsnn, $psnn, $abond, $saacts, $i2) = @_;
    my ($acceptable, $found );
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("usebondci ni $ni pi $pi ");
      };
# updated for merged workspaces

    $acceptable = '';
    $$nidl = $Awfif::wsol-> {l}[ awsoadr($ni)][2];
    $$pidl = 0;
    $$psnn = 0;
    $$nsnn = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [$$abond [$$saacts [$i2]]];
# setup the while loop to iterate over the full set of descriptors

# if find a match then check it against the target to see it applies to this object
    while (($$nidl != 0) && (!$acceptable)) {
      $$nidl = getwsrel ($$nidl, $$abond [$$saacts [$i2]], \$acceptable);
      if (($acceptable) # have a sponsor's element index that works with the ni base

      && (wsocrel ($ni, $$abond [$$saacts [$i2]], \$$nidl))) {
        $acceptable = 't';
        }
      else {# move on to the next descriptor

        $acceptable = '';
        $$nidl = $Awfif::workspace-> {l} [$$nidl][0];
        };
      };#while

    $found = '';
    $$pidl = $Awfif::wsol-> {l} [ awsoadr($pi)][2];
    while (($$pidl != 0) && (!$found)) {

      if (($Awfif::workspace-> {l} [$$pidl][4] == $Awfif::memes-> {snnh} {wsi})
      && ($Awfif::workspace-> {l} [$$pidl][3] == $Awfif::memes-> {snnh} {wsil}) ) {

        $found = 't';
        }
      else {

        $$pidl = $Awfif::workspace-> {l} [$$pidl][0];
        };
      };

    if ($acceptable) {
      $$nsnn = $Awfif::workspace-> {l} [$$nidl] [3];
      $$psnn = $Awfif::workspace-> {l} [$$pidl] [3];
      }; # if matched
#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("usebondci nidl $$nidl pidl $$pidl nsnn $$nsnn psnn $$psnn ret $acceptable\n");
      };
    return ( $acceptable);
    }# usebondci
#
sub usegroupcategory {
    my ($myli, $ni, $nidl, $pi, $pidl, $nsnn, $psnn, $model) = @_;
    my ($fnidl, $found, $acceptable );
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my($pr);
      if ($model < 0) {

        $pr = 'g add->'.$Awfif::memes->{snnih}{-$model};
        }
      elsif ($model == $Awfif::memes-> {snnh} {indequiv}) {

        $pr = 'ie telomere';
        }
      elsif ($model == $Awfif::memes->{groupsponsor}) {

        $pr = 'g sponsor';
        }
      elsif ($model != 0) {

        $pr = 'g mem->'.$Awfif::memes->{snnih}{$model};
        }
      else {

        $pr = 'no model';
        };

      print ("usegroupcategory ni $$ni pi $pi model $pr ");
      };

    $acceptable = '';
    if ($model != 0) {#worth accepting

      if ($model == $Awfif::memes-> {groupsponsor}) {

# ni and pi are ok
        $acceptable = 't';
# assign nidl & pidl
# find the bond in $ni which will become the $nidl
        &fgrpd ($myli, $$ni, \$fnidl, $Awfif::memes-> {snnh} {bondcategory});
        $$nidl = $fnidl;
        $$pidl = 0;
        }# if groupsponsor
      elsif ($model == $Awfif::memes->{snnh} {indequiv}) {#ie telomeric

        $acceptable = 't';
# assign nidl & pidl
# find the bond in $ni which will become the $nidl
        &fgrpd ($myli, $$ni, \$fnidl, $Awfif::memes-> {snnh} {bondcategory});
        $$nidl = $fnidl;
        $$pidl = 0;
        }# elsif
      elsif ($model == $Awfif::memes->{snnh}{predgroup}) {#member

# ni and pi are ok
        $acceptable = 't';
        $fnidl = $Awfif::wsol-> {l} [ awsoadr($$ni)][2];
        $found = '';
        while (($fnidl != 0) && (!($found))) {
          if (( $Awfif::workspace-> {l} [$fnidl][3] == ($Awfif::memes->{snnh}{predgroup}))
          && ($Awfif::workspace-> {l}[$fnidl] [4] == $Awfif::memes-> {snnh} {groupcategory})) {

            $found = 't';
            $$nidl = $fnidl;#this can be used to get the sponsor - [2]
            };#found

          $fnidl = $Awfif::workspace-> {l} [$fnidl][0];
          };# look through ni descriptors for group
        }# member
      elsif ($model == -($Awfif::memes->{snnh}{predgroup})) {#add

# find the predgroup in $pi and hence its sponsor
        $acceptable = 't';
        $fnidl = $Awfif::wsol-> {l} [ awsoadr($pi)][2];
        $found = '';
        while (($fnidl != 0) && (!($found))) {

          if (( $Awfif::workspace-> {l} [$fnidl][3] == ($Awfif::memes->{snnh}{predgroup}))
          && ($Awfif::workspace-> {l}[$fnidl] [4] == $Awfif::memes-> {snnh} {groupcategory})) {

            $found = 't';
            $$nidl = $fnidl;#this can be used to get the sponsor - [2]
            };#found

          $fnidl = $Awfif::workspace-> {l} [$fnidl][0];
          };# look through ni descriptors for group
# put a predgroup descriptor at pi
        }# pred add
      elsif ($model == $Awfif::memes->{snnh}{succgroup}) {#member
# ni and pi are ok

        $acceptable = 't';
        $fnidl = $Awfif::wsol-> {l} [ awsoadr($$ni)][2];
        $found = '';
        while (($fnidl != 0) && (!($found))) {
          if (( $Awfif::workspace-> {l} [$fnidl][3] == ($Awfif::memes->{snnh}{succgroup}))
          && ($Awfif::workspace-> {l}[$fnidl] [4] == $Awfif::memes-> {snnh} {groupcategory})) {

            $found = 't';
            $$nidl = $fnidl;#this can be used to get the sponsor - [2]
            };#found

          $fnidl = $Awfif::workspace-> {l} [$fnidl][0];
          };# look through ni descriptors for group
        }# member
      elsif ($model == -($Awfif::memes->{snnh}{succgroup})) {#add
# find the succgroup in $pi and hence its sponsor

        $acceptable = 't';
        $fnidl = $Awfif::wsol-> {l} [ awsoadr($pi)][2];
        $found = '';
        while (($fnidl != 0) && (!($found))) {

          if (( $Awfif::workspace-> {l} [$fnidl][3] == ($Awfif::memes->{snnh}{succgroup}))
          && ($Awfif::workspace-> {l}[$fnidl] [4] == $Awfif::memes-> {snnh} {groupcategory})) {

            $found = 't';
            $$nidl = $fnidl;#this can be used to get the sponsor - [2]
            };#found

          $fnidl = $Awfif::workspace-> {l} [$fnidl][0];
          };# look through ni descriptors for group
# put a succgroup descriptor at $pi
        }# succ add
      elsif ($model == $Awfif::memes->{snnh}{adjgroup}) {#member
# ni and pi are ok

        $acceptable = 't';
        $fnidl = $Awfif::wsol-> {l} [ awsoadr($$ni)][2];
        $found = '';
        while (($fnidl != 0) && (!($found))) {
          if (( $Awfif::workspace-> {l} [$fnidl][3] == ($Awfif::memes->{snnh}{adjgroup}))
          && ($Awfif::workspace-> {l}[$fnidl] [4] == $Awfif::memes-> {snnh} {groupcategory})) {

            $found = 't';
            $$nidl = $fnidl;#this can be used to get the sponsor - [2]
            };#found

          $fnidl = $Awfif::workspace-> {l} [$fnidl][0];
          };# look through ni descriptors for group
        }# member
      elsif ($model == -($Awfif::memes->{snnh}{adjgroup})) {#add
# find the adjgroup in $pi and hence its sponsor

        $acceptable = 't';
        $fnidl = $Awfif::wsol-> {l} [ awsoadr($pi)][2];
        $found = '';
        while (($fnidl != 0) && (!($found))) {
          if (( $Awfif::workspace-> {l} [$fnidl][3] == ($Awfif::memes->{snnh}{adjgroup}))
          && ($Awfif::workspace-> {l}[$fnidl] [4] == $Awfif::memes-> {snnh} {groupcategory})) {

            $found = 't';
            $$nidl = $fnidl;#this can be used to get the sponsor - [2]
            };#found

          $fnidl = $Awfif::workspace-> {l} [$fnidl][0];
          };# look through ni descriptors for group
# put a adjgroup descriptor at $pi
        };# adj add
      };# acceptable group models

    if (($acceptable) && ($$nidl == 0)) {

      &break();
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("usegroupcategory nidl $$nidl pidl $$pidl nsnn $$nsnn psnn $$psnn ret $acceptable\n");
      };

    return ( $acceptable);
    }# usegroupcategory
#
sub fgrpd {# find if there is a group descriptor deployed in this workspace object
    my ($myli, $ni, $grpind, $catid) = @_;
    my ($i, $linki, $found, @agrp, $ani);
# find the set of group descriptors that are present in $ni wso
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes->{snnih}{$catid};
      print ("fgrpd ");
      if ( (defined ($myli)) ){

        print ("myli $myli ");
        };#if
      print ("ni $ni category $pr ");
      };#if

    $found = '';
    $i = 0;
# fgrpdnog
    $ani = awsoadr($ni);
# find out the number of group types
    if (defined($Awfif::memes-> {nogtypes})) {# already known
      }#if
    else {#set it up

      $linki = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl} [ $Awfif::memes-> {snnh} {groupcategory}];
      $Awfif::memes-> {nogtypes} = 0;
      while ($linki != 0) {
        if ( $Awfif::slipnet-> {l} [$linki] [3] == $Awfif::memes-> {snnh} {cibp} ) {

          $Awfif::memes-> {nogtypes} ++;
          };
        $linki = $Awfif::slipnet-> {l} [$linki][0];
        };
      };#else
# fgrpdcgd
    if (($catid == $Awfif::memes-> {snnh} {groupcategory}) && ($Awfif::memes-> {nogtypes} == 1)
    && ($Awfif::wsol-> {l}[ $ani][ $Awfif::memes-> {wsofgrp}] != 0) #*** submacrok ***#
    ){

      $found = 't';
      $$grpind = $Awfif::wsol-> {l}[ $ani][ $Awfif::memes-> {wsofgrp}]; #*** submacrok ***#
      }#if
    else {
      $linki = $Awfif::wsol-> {l}[ $ani][2];
      while ($linki != 0) {# build a list of group descriptors
        if ($Awfif::workspace-> {l} [$linki][4] == $catid) {#record this item

          $agrp[$i] = $linki;
          $i++;
          $found = 't';
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#check all the descriptors
# now randomly select one of the groups to work with
      if ($found) {

        $$grpind = $agrp[int(rand($i))];
        if (($catid == $Awfif::memes-> {snnh} {groupcategory}) && ($Awfif::memes-> {nogtypes} == 1)
        && ($Awfif::wsol-> {l}[ $ani][ $Awfif::memes-> {wsofgrp}] == 0) #*** submacrok ***#
        ){
          $Awfif::memes-> {gtype} = $Awfif::workspace-> {l} [$$grpind][3];
          $Awfif::wsol-> {l}[ $ani][ $Awfif::memes-> {wsofgrp}] = $$grpind; #*** submacrok ***#
          };#if
        };#if
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fgrpdx grpind $$grpind ret ($found)\n");
      };
    return ( $found);
    }# fgrpd
#
sub fgrpsponsor {
    my ($wso, $bondc, $structure) = @_;
    my ($linkp, $gsponsor, $awso, $bondpresent);
# find the sponsor in a group
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fgrpsponsor wso ($wso) bondc $bondc structure $structure ");
      &itwsoutput ( trwsoadr ($wso, 1), $wso);
      };

    $awso = awsoadr ($wso);
# note the sponsor of the group
    if ( $Awfif::wsol-> {l}[$awso][ $Awfif::memes-> {wsogcsponsor}] != 0 ){ #*** submacrok ***#
      $gsponsor = $Awfif::wsol-> {l}[$awso][ $Awfif::memes-> {wsogcsponsor}];#*** submacrok ***#
      }#if
    elsif ( $Awfif::wsol-> {l}[$awso][ $Awfif::memes-> {wsogcsponsored}] != 0 ){ #*** submacrok ***#
      $gsponsor = $Awfif::wsol-> {l}[$awso][ $Awfif::memes-> {wsogcsponsored}];#*** submacrok ***#
      }#elsif
    else {
      $linkp = $Awfif::wsol-> {l}[$awso][2];
      $bondpresent = '';
      while (($linkp != 0) && (!($bondpresent))) {

        if (($Awfif::workspace-> {l} [$linkp] [2] > ($Awfif::memes-> {snnh} {wsi}))
        && ($Awfif::workspace-> {l} [$linkp] [3] == $bondc)
        && ($Awfif::workspace-> {l} [$linkp] [4] == $structure)){

          $bondpresent = "T";# reward for same bonds in proximity
          $gsponsor = $Awfif::workspace-> {l}[$linkp][2] - $Awfif::memes-> {snnh}{wsi};
          };#if

        $linkp = $Awfif::workspace-> {l}[$linkp][0];
        };#while
      };#else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {currentwsbi};
      print ("fgrpsponsorx ret ($pr:$gsponsor)\n");
      };
    return $gsponsor
    }#fgrpsponsor
#
sub fgrpstart {
    my ($sponsor) = @_;
    my ($linkp, $gstart, $asponsor);
# find the last wso in a group
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fgrpstart sponsor ($sponsor) ");
      &itwsoutput ( trwsoadr ($sponsor, 1), $sponsor);
      };

    $asponsor = awsoadr ($sponsor);
# note the end of the group
    $linkp = $Awfif::wsol-> {l}[$asponsor][2];
    while (($linkp != 0) && ($Awfif::workspace-> {l}[$linkp][4] != $Awfif::memes-> {snnh}{groupstart})) {

      $linkp = $Awfif::workspace-> {l}[$linkp][0];
      };
    if ($linkp != 0) {#found group start descriptor

      $gstart = $Awfif::workspace-> {l}[$linkp][2] - $Awfif::memes-> {snnh}{wsi};
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fgrpstartx ret $gstart\n");
      };
    return $gstart
    }#fgrpstart
#
sub fgrpend {
    my ($sponsor) = @_;
    my ($linkp, $gend, $asponsor, $usecache);
# find the last wso in a group
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fgrpend sponsor ($sponsor) ");
      &itwsoutput ( trwsoadr ($sponsor, 1), $sponsor);
      };

    $asponsor = awsoadr ($sponsor);
    if (defined ($Awfif::grpends-> {$asponsor}) ){$gend = $Awfif::grpends-> {$asponsor}}
    else {
# note the end of the group

      $linkp = $Awfif::wsol-> {l}[$asponsor][2];
      while (($linkp != 0)
      && ($Awfif::workspace-> {l}[$linkp][4] != $Awfif::memes-> {snnh}{groupend})
      && ($Awfif::workspace-> {l}[$linkp][4] != $Awfif::memes-> {snnh}{wasgroupend})
      ) {

        if (($Awfif::memes-> {usegrpends}) && ($Awfif::workspace-> {l}[$linkp][4] == $Awfif::memes-> {snnh}{indequiv}) ) {$usecache = 't'};
        $linkp = $Awfif::workspace-> {l}[$linkp][0];
        };#while
      if ($linkp != 0) {#found group end descriptor

        $gend = $Awfif::workspace-> {l}[$linkp][2] - $Awfif::memes-> {snnh}{wsi};
        if ($usecache) {

          $Awfif::grpends-> {$asponsor} = $gend;
          };#if
        };#if

      };#else
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fgrpendx ret $gend\n");
      };
    return $gend
    }#fgrpend
#
sub fpartend {
    my ($sponsor) = @_;
    my ($linkp, $pend, $asponsor);
# find the descriptor indicating the part end
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fpartend sponsor ($sponsor) ");
      &itwsoutput ( trwsoadr ($sponsor, 1), $sponsor);
      };

    $asponsor = awsoadr ($sponsor);
# note the end of the part
    $linkp = $Awfif::wsol-> {l}[$asponsor][2];
    while (($linkp != 0) && ($Awfif::workspace-> {l}[$linkp][3] != $Awfif::memes-> {snnh}{stop})&& ($Awfif::workspace-> {l}[$linkp][4] != $Awfif::memes-> {snnh}{associative})) {

      $linkp = $Awfif::workspace-> {l}[$linkp][0];
      };
    if ($linkp != 0) {#found part end descriptor

      $pend = $Awfif::workspace-> {l}[$linkp][2] - $Awfif::memes-> {snnh}{wsi};
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fpartendx ret $pend\n");
      };
    return $pend
    }#fpartend
#
sub mdescriptor {
    my ($sponsor, $i4, $i3, $delta, $count) = @_;
    my ($linkp, $match, $asponsor);
# find a descriptor matching i3 at pos 3 and i4 at pos 4. return true with pos 2 in count and decrement pos 2
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mdescriptor sponsor ($sponsor) ");
      &itwsoutput ( trwsoadr ($sponsor, 1), $sponsor);
      };

    $asponsor = awsoadr ($sponsor);
    $match = '';
# find a match
    $linkp = $Awfif::wsol-> {l}[$asponsor][2];
    while (($linkp != 0) && ($Awfif::workspace-> {l}[$linkp][3] != $i3) && ($Awfif::workspace-> {l}[$linkp][4] != $i4)) {

      $linkp = $Awfif::workspace-> {l}[$linkp][0];
      };
    if ($linkp != 0) {#found matching descriptor

      $match = 't';
      $$count = $Awfif::workspace-> {l}[$linkp][2] - $Awfif::memes-> {snnh}{wsi};
      if (($delta != 0) && (($$count = $$count + $delta) > 0)) {
        $Awfif::workspace-> {l}[$linkp][2] = $$count + $Awfif::memes-> {snnh}{wsi};
        };
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mdescriptorx count $$count ret ($match)\n");
      };
    return $match
    }#mdescriptor
#
sub fsgrpd {# find if there is a specificgroup descriptor deployed in this workspace object
    my ($myli, $ni, $grpind, $catid, $groupid, $sbind) = @_;
    my ($i, $linki, $found, $ani);
# find the group descriptors if its present in $ni wso
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes->{snnih}{$catid};
      print ("fsgrpd myli $myli ni $ni category $pr ");
      $pr = $Awfif::memes->{snnih}{$groupid};
      print ("group $pr ");
      };

    $found = '';
    if ($ni != 0) {
# fsgrpdcgd
      $ani = awsoadr($ni);
      if (($catid == $Awfif::memes-> {snnh} {groupcategory})
      && ($Awfif::memes-> {nogtypes} == 1)
      && ($Awfif::wsol-> {l}[ $ani][ $Awfif::memes-> {wsofgrp}] != 0)#*** submacrok ***#
      ){

        $found = 't';
        $$grpind = $Awfif::wsol-> {l}[ $ani][ $Awfif::memes-> {wsofgrp}];#*** submacrok ***#
        $$sbind = 0;
        }#if
      else {

        $i = 0;
        $linki = $Awfif::wsol-> {l}[ $ani][2];
        while (($linki != 0)) {#
          if (($Awfif::workspace-> {l} [$linki][4] == $catid) && ($Awfif::workspace-> {l} [$linki][3] == $groupid)) {#found the item

            if (!$found) {

              $found = 't';
              $$grpind = $linki;
              $$sbind = 0;
              }
            else {# second adj bond should be present

              $$sbind = $linki;
              };
            };

          $linki = $Awfif::workspace-> {l} [$linki][0];
          }#stop if found
        };#else
      };#if ni == 0

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("fsgrpd grpind($$grpind) sbind($$sbind) ret ($found)\n");
      };
    return ( $found);
    }# fsgrpd
#
sub arrayng {# deploy in order in an array each non grouped item in a part
    my ($myli, $ni, $rnga) = @_;
    my ($i, $linki, $found, @nga);
# deploy in order in an array each non grouped item in a part
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("arrayng myli $myli ni $ni ");
      };

    $found = '';
    $i = 0;
    $linki = $Awfif::wsol-> {l}[ awsoadr($ni)][2];
    while ($linki != 0) {# build a list of group descriptors
      if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes-> {snnh} {model})
      && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes-> {snnh} {outgroup}) ){#record this item

        $nga[$i] = $Awfif::workspace-> {l} [$linki][2] - $Awfif::memes-> {snnh} {wsi};
        $i++;
        $found = 't';
        };
      $linki = $Awfif::workspace-> {l} [$linki][0];
      }#check all the descriptors
# sort them
    if ($found) {

      @$rnga = sort (@nga);
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("arrayngx found ($found) ret ($i)\n");
      };
    return ( $i);
    }# arrayng
#
#<!-- start tag uts -->
#
sub chdespi {
    my ($myli, $ni, $pi, $kwp, $kwpr, $sactset, $strategy, $model, $omeric) = @_;
    my ($found, $tinstances, $ub, $lb, $sgdi, $ling);
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("chdespi ni $$ni strategy $strategy ");
      };

    $$model = 0;# if this is a group then this will be used to indicate predecessor implying swop ni & pi
# if its the initial phase of coderack activity force use of descriptors
    if ($Awfif::memes-> {iphase} < $Awfif::memes-> {iphasecomp}) {

      $$pi = 0;
      $found = 'T';
      }
    else {# general case

      if (($strategy ne 'bugroup') && ($strategy ne 'tdgroup')) {#not group

        if (toofewwso ($kwp, $$ni, 2)) {
          $ub = $kwp;
          }
        else {

          $ub = trwsoadr($$ni,2);
          };

        if ($$ni == $kwpr) {

          $lb = $kwpr;
          }
        else {

          $lb = trwsoadr($$ni,-1);
          };

        if ( selsalwsitem ($myli, \$$pi, \$tinstances, $ub, $lb, \@$sactset, $strategy, \$$omeric)) {
          if ($$pi == $$ni) {
            $$pi = int (rand (3));# 0 to 2
            if ($$pi == 1) {

              $$pi = 0;
              }#if
            else {

              $$pi = trwsoadr($$ni, $$pi - 1);
              if ($$pi == $kwp) {$$pi = 0};
              };
            } # use simple random choice to overcome problem sample size
          $found = 'T';
          }
        else {

          $found = '';
          };
        } #not group
      else {
# probably a group - some bonding scenarios could fool this test but they will be thrown out in evaluator

        my ($rn, $ltype, $sponsor, $sbind, $gssal);
        if ($strategy eq 'bugroup') {

          $ltype = 'gs';
          }
        else {

          $ltype = 'tgs';
          };
# to do logging in this procedure for groups must initialise it here

        $Awfif::wsol-> {l}[ awsoadr($$ni)][8] = setuplog ($myli, #indexing to codelet
                    $ltype, #method
                    $$ni, #workspace object
                    $$pi); #linked workspace object or 0
        $Awfif::codelet-> {l}[$myli][4] = $$ni;# updatelog needs this setup
        if ((($Awfif::codelet-> {l} [$myli][13] == 0) or (!defined($Awfif::codelet-> {l} [$myli][13]))) && ($Awfif::wsol-> {l} [awsoadr ($$ni)][8] != 0) ) {

          $Awfif::codelet-> {l} [$myli][13] = $Awfif::wsol-> {l} [awsoadr ($$ni)][8];
          };
# chdiegsu1
        if (($gssal = tmgiegsponsor ($$ni)) > 2) {#groupsponsor of ie subprogram telomere

          $$pi = trwsoadr ($$ni, 1);
          $$model = $Awfif::memes-> {snnh}{indequiv};
          $Awfif::codelet-> {l} [$myli] [36] = $Awfif::wsol-> {l}[awsoadr ($$ni)][ $Awfif::memes-> {wsosubpid}]; #*** submacrok ***#
          $Awfif::codelet-> {l} [$myli] [37] = mapsubtotmgrid (awsoadr (trwsoadr ($$ni, -1)), $Awfif::memes-> {snnh} {rtran},
            $Awfif::wsol-> {l}[awsoadr ($$ni)][ $Awfif::memes-> {wsosubpid}] #*** submacrok ***#
            );
          $Awfif::codelet-> {l} [$myli] [35] = gettmgrcslice (awsoadr (trwsoadr ($$ni, -1)), $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l} [$myli] [37], 35);
          $found = 't';
          }#if
        elsif ($gssal == 2) {#groupsponsor of ie telomere

          $$pi = trwsoadr ($$ni, 1);
          $$model = $Awfif::memes-> {snnh}{indequiv};
          $found = 't';
          $Awfif::codelet-> {l} [$myli] [37] = mapnonsubtotmgrid (awsoadr (trwsoadr ($$ni, -1)), $Awfif::memes-> {snnh} {rtran},
            $Awfif::wsol-> {l}[awsoadr ($$ni)][ $Awfif::memes-> {wsosubpid}] #*** submacrok ***#
            );
          $Awfif::codelet-> {l} [$myli] [35] = gettmgrcslice (awsoadr (trwsoadr ($$ni, -1)), $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l} [$myli] [37], 35);
          }#elsif
        elsif (($Awfif::memes-> {strbcont} < bugroup1 ($myli, $$ni, $kwp, $kwpr))
        or (($$ni != $kwpr) && ($Awfif::memes->{strbcont} < bugroup1 ($myli, trwsoadr($$ni,-1), $kwp, $kwpr)))
        or (($$ni != $kwp) && ($Awfif::memes->{strbcont} < bugroup1 ($myli, trwsoadr($$ni,1), $kwp, $kwpr)))) {
# at least a relation present
# worth trying to find the edges of a grouping

          my ($rnc, $first);
          $found = 't';
# will reset if all options fail
          $rn = sgdir1();
          $rnc = flip1 ($rn);
          if (fgrpd ($myli, $$ni, \$sgdi, $Awfif::memes-> {snnh} {groupcategory})) {

# got a group in ni randomly pick a direction and find the edge of the group

            $$model = (-$Awfif::workspace-> {l}[$sgdi][3]);#add assumed until know better
            $sponsor = $Awfif::workspace-> {l}[$sgdi][2];
            $$pi = $$ni;
            $ling = 't';
# make pi the wso next to the edge
            if ($rn > 0) {

              while ($ling eq 't') {
                $$pi = trwsoadr ($$pi,1);
                if (!fsgrpd ($myli, $$pi, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, -$$model, \$sbind)) {
# no group in pi

                  $ling = chdespie ($myli, \$$ni, \$$pi, 0, -1, 'predgroup', \$$model, $ltype);
# now setup correct polarity
                  }#if
                else {#next to this model group. If its not sponsored by sponsor its an edge - do member join?

                  if ($Awfif::workspace-> {l}[$sgdi][2] != $sponsor) {
                    $ling = chdespie ($myli, \$$ni, \$$pi, 0, -1, 'predgroup', \$$model, $ltype);
                    };#member
                  };#next to a group
                };#while
              }#if
            else {#go down

              while ($ling eq 't') {
                $$pi = trwsoadr ($$pi,-1);
                if (!fsgrpd ($myli, $$pi, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, -$$model, \$sbind)) {
# no group in pi

                  $ling = chdespie ($myli, \$$ni, \$$pi, 0, 1, 'succgroup', \$$model, $ltype);
# now setup correct polarity
                  }#if
                else {#next to this model group. If its not sponsored by sponsor its an edge - do member join?

                  if ($Awfif::workspace-> {l}[$sgdi][2] != $sponsor) {
                    $ling = chdespie ($myli, \$$ni, \$$pi, 0, 1, 'succgroup', \$$model, $ltype);
                    };#member
                  };#next to a group
                };#while
              };#else down
            }# if group in ni
          else {
# maybe beyond ni+1 has a pred/adj bond which can sponsor a pred/adj group to ni

            &updatelog ($myli, $ltype,10,'49.13.11.0');
            $ling = 't';
            $first = 2;
            while ($first > 0) {
            $first--;
            $rnc = flip1 ($rnc);
            if (($rnc > 0) && ($ling) && ($$ni != $kwp) && (trwsoadr($$ni, 1) != $kwp)
            && (fgrpd ($myli, trwsoadr($$ni, 1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}))) {

              $ling = chdespw ($myli, \$$ni, \$$pi, 1, 'predgroup', \$$model, $ltype, $ling, 't');
              }#if
# adj like pred
            if (($rnc > 0) && ($ling) && ($$ni != $kwp) && (trwsoadr($$ni, 1) != $kwp)
            && (fgrpd ($myli, trwsoadr($$ni, 1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}))) {

              $ling = chdespw ($myli, \$$ni, \$$pi, 1, 'adjgroup', \$$model, $ltype, $ling, '');
              }#if
# or ni - 1 has a succ/adj bond which can sponsor a succ/adj group to ni
# succ
            if (($rnc <= 0) && ($ling) && ($$ni != $kwpr) && (fgrpd ($myli, trwsoadr ($$ni, -1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}))) {

              $ling = chdespw ($myli, \$$ni, \$$pi, -1, 'succgroup', \$$model, $ltype, $ling, 't');
              }#if
# adj like succ
            if (($rnc <= 0) && ($ling) && ($$ni != $kwpr) && (fgrpd ($myli, trwsoadr ($$ni, -1), \$sgdi, $Awfif::memes-> {snnh} {groupcategory}))) {

              $ling = chdespw ($myli, \$$ni, \$$pi, -1, 'adjgroup', \$$model, $ltype, $ling, '');
              }#if
              };#while first > 0
# or ni may contain a bond
            if (($ling) && (fgrpd ($myli, $$ni, \$sgdi, $Awfif::memes-> {snnh} {bondcategory}))) {#looking for bond in ni

              $$model = $Awfif::memes-> {groupsponsor};
              &updatelog ($myli, $ltype,12, $$model);

              $$pi = ($Awfif::workspace-> {l}[$sgdi][2]-$Awfif::memes-> {snnh}{wsi});
              }# found a bond
            elsif ($ling) {#no group activity

              &updatelog ($myli, $ltype,10,'49.13.11.10');
              $found = '';
              };# no group opportunity

            };#else
          }# if relation or greater probably present
        elsif ($ling) {#no group activity

          &updatelog ($myli, $ltype,10,'49.13.11.12.1');
          $found = '';
          }#elseif
        else {

          $$pi = 0;
          &updatelog ($myli, $ltype,10,'49.13.13');
          };# no group opportunity yet
        if ($Awfif::codelet-> {l}[$myli][4] != $$ni) {# log must move again
          $Awfif::wsol-> {l}[ awsoadr($$ni)][8] = setuplog ($myli, #indexing to codelet
                      $ltype, #method
                      $$ni, #workspace object
                      $$pi); #linked workspace object or 0
          $Awfif::codelet-> {l}[$myli][4] = $$ni;# updatelog needs this setup
          if (($Awfif::wsol-> {l} [awsoadr ($$ni)][8] != 0) && ($Awfif::codelet-> {l} [$myli][13] != $Awfif::wsol-> {l} [awsoadr ($$ni)][8])) {
            $Awfif::codelet-> {l} [$myli][13] = $Awfif::wsol-> {l} [awsoadr ($$ni)][8];
            };
          };
        };#of else group
      };#general case

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("chdespix ni $$ni pi $$pi model $$model ret $found\n");
      };
    return $found
    }# chdespi
#
#<!-- end tag uts -->
#
sub chdespie {
    my ($myli, $ni, $pi, $adir, $bdir, $gtype, $model, $ltype) = @_;
    my ($ling);
#
# inverted if else

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("chdespie ni $$ni pi $$pi a $adir b $bdir gt $gtype m $model ");
      };

    $ling = '';
# now setup correct polarity
    if (-$$model == $Awfif::memes-> {snnh} {$gtype}) {#ni & pi should reverse so evaluator can use standard bond checks

      $$ni = trwsoadr ($$pi, $adir);
      $$pi = trwsoadr ($$pi, $bdir);
      &updatelog ($myli, $ltype,12, $$model);
      }
    else {#polarity ok move ni to edge

      $$model = -$$model; #its a member
      $$ni = trwsoadr ($$pi, $bdir);
      &updatelog ($myli, $ltype,12, $$model);
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("chdespiex ni $$ni pi $$pi model $$model ret $ling\n");
      };
    return $ling
    }# chdespie
#
sub chdespw {
    my ($myli, $ni, $pi, $adir, $gtype, $model, $ltype, $iling, $ig2) = @_;
    my ($ling, $linki);
#
# inverted while

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("chdespw ni $$ni pi $$pi a $adir gt $gtype m $model ling $iling ig2 $ig2 ");
      };

    $ling = $iling;
    $linki = $Awfif::wsol-> {l} [awsoadr (trwsoadr ($$ni, $adir))][2];
    while (($linki != 0) && ($ling)) {
      if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{groupcategory})
      && (($ig2) or ($Awfif::workspace-> {l} [$linki][2] == $$ni+$Awfif::memes->{snnh}{wsi}))
      && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{$gtype})) {# found an adj group that could include ni

        $$pi = $$ni;
        $$ni = trwsoadr ($$ni, $adir);
        $$model = $Awfif::memes-> {snnh} {$gtype};
        $ling = '';# terminate since we found it
        &updatelog ($myli, $ltype,12, $$model);
                  };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("chdespwx ni $$ni pi $$pi model $$model ret $ling\n");
      };
    return $ling
    }# chdespw
#
sub chtdespi {#chdespi for top down group
    my ($myli, $ni, $pi, $nidl, $kwp, $kwpr, $sactset, $model) = @_;
    my ($found, $sgdi, $ling, $sbind);
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("chtdespi ni $$ni model $model kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
    $found = '';
    $ling = 't';
# ni and model are specified
# if model is group sponsor then pi and nidl are assigned relative to a bond in ni
    if (($ling) && ($model == $Awfif::memes-> {groupsponsor}) && (fgrpd ($myli, $$ni, \$sgdi, $Awfif::memes-> {snnh} {bondcategory}) eq 't')) {
# can use the idl to get the bond type & hence direction etc

      $$nidl = $sgdi;
      $$pi = ($Awfif::workspace-> {l}[$sgdi][2] - $Awfif::memes-> {snnh}{wsi});
      $ling = '';# stop any while loops
      }# group sponsor
# elsif model is predgroup member search for edge of group towards 0 and set pi beyond edge
    elsif (($ling) && ($model == $Awfif::memes-> {predgroup}) ) {

      my ($linki);
      $$pi = trwsoadr($$ni, - 1);
      while (($ling) && ($$pi != 0) && (fsgrpd ($myli, $$pi, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::memes-> {snnh} {predgroup}, \$sbind) eq 't')) {
      $$pi = trwsoadr($$pi, - 1);
        };#while looking for edge of group
      if (($$pi) != 0) {
        $linki = $Awfif::wsol-> {l} [ awsoadr( trwsoadr($$pi, -1))][2];
        }
      else {
        $linki = 0;
        };
      while (($linki != 0) && ($ling)) {
        if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{bondcategory})
        && ($Awfif::workspace-> {l} [$linki][2] == trwsoadr($$pi, -2) + $Awfif::memes->{snnh}{wsi})
        && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{predecessor})) {# found a succ group that could include ni

          $$ni = $$pi;
          $$pi = trwsoadr($$pi, - 1);
          $$model = $Awfif::memes-> {snnh} {predgroup};
          $$nidl = $linki;
          $ling = '';# terminate since we found it
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while
      }
# elsif model is predgroup add find pred nidl in ni and set pi to ni - 1;
    elsif (($ling) && ($model == (-$Awfif::memes-> {predgroup})) ) {

      my ($linki);
      if (($$ni) != 0) {
        $linki = $Awfif::wsol-> {l} [ awsoadr( $$ni)][2];
        }
      else {
        $linki = 0;
        };
      while (($linki != 0) && ($ling)) {
        if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{bondcategory})
        && ($Awfif::workspace-> {l} [$linki][2] == trwsoadr($$ni, -1) + $Awfif::memes->{snnh}{wsi})
        && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{predecessor})) {# found a succ group that could include ni

          $$pi = trwsoadr($$ni, -1);
          $$nidl = $linki;
          $ling = '';# terminate since we found it
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while
      }
# elsif model is succgroup member search for edge of group towards $kwp and set pi beyond edge
    elsif (($ling) && ($model == $Awfif::memes-> {succgroup}) ) {

      my ($linki);
      $$pi = trwsoadr($$ni, 1);
      while (($ling) && ($$pi != $kwp) && (fsgrpd ($myli, $$pi, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::memes-> {snnh} {succgroup}, \$sbind) eq 't')) {
        $$pi = trwsoadr($$pi, 1);
        };#while looking for edge of group
      if (($$pi+1) < $kwp) {
        $linki = $Awfif::wsol-> {l} [ awsoadr( trwsoadr($$pi, 1))][2];
        }
      else {
        $linki = 0;
        };
      while (($linki != 0) && ($ling)) {
        if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{bondcategory})
        && ($Awfif::workspace-> {l} [$linki][2] == trwsoadr ($$pi, 2) + $Awfif::memes->{snnh}{wsi})
        && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{successor})) {# found a succ group that could include ni

          $$ni = $$pi;
          $$pi = trwsoadr($$pi, 1);
          $$nidl = $linki;
          $ling = '';# terminate since we found it
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while
      }
# elsif model is succgroup add find succ nidl in ni and set pi to ni + 1;
    elsif (($ling) && ($model == (-$Awfif::memes-> {succgroup})) ) {

      my ($linki);
      if (($$ni != $kwp) && (trwsoadr($$ni, 1) != $kwp)) {
        $linki = $Awfif::wsol-> {l} [ awsoadr ($$ni)] [2];
        }
      else {
        $linki = 0;
        };
      while (($linki != 0) && ($ling)) {
        if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{bondcategory})
        && ($Awfif::workspace-> {l} [$linki][2] == trwsoadr($$ni, 1) + $Awfif::memes->{snnh}{wsi})
        && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{successor})) {# found a succ group that could include ni

          $$pi = trwsoadr($$ni, 1);
          $$nidl = $linki;
          $ling = '';# terminate since we found it
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while
      }
# elsif model is adjgroup member search for edges and if find bond which will extend group set pi beyond that edge
    elsif (($ling) && ($model == $Awfif::memes-> {adjgroup}) ) {

      my ($linki, $ned, $neu, $nedlu, $nedld, $ped, $peu, $nefoundd, $nefoundu);
      $ped = trwsoadr($$ni, -1);
      $nefoundd = $ling;
      while (($nefoundd) && ($ped != 0) && (fsgrpd ($myli, $ped, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::memes-> {snnh} {adjgroup}, \$sbind) eq 't')) {
        $ped = trwsoadr($ped, -1);
        };#while looking for edge of group
      if (($ped) != 0) {
        $linki = $Awfif::wsol-> {l} [ awsoadr( trwsoadr($ped, -1))][2];
        }
      else {
        $linki = 0;
        };
      while (($linki != 0) && ($nefoundd)) {
        if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{bondcategory})
        && ($Awfif::workspace-> {l} [$linki][2] == trwsoadr($ped, -2) + $Awfif::memes->{snnh}{wsi})
        && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{adjgroup})) {# found a adj group that could include ni

          $ned = $ped;
          $ped = trwsoadr($ped, -1);
          $nedld = $linki;
          $nefoundd = '';# terminate since we found it
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while
      $peu = trwsoadr($$ni, 1);
      $nefoundu = $ling;
      while (($nefoundu) && ($peu != $kwp) && (fsgrpd ($myli, $peu, \$sgdi, $Awfif::memes-> {snnh} {groupcategory}, $Awfif::memes-> {snnh} {adjgroup}, $sbind) eq 't')) {
        $peu = trwsoadr($peu, 1);
        };#while looking for edge of group
      if ((trwsoadr($peu, 1)) != $kwp) {
        $linki = $Awfif::wsol-> {l} [ awsoadr( trwsoadr($peu, 1))][2];
        }
      else {
        $linki = 0;
        };
      while (($linki != 0) && ($nefoundu)) {
        if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{bondcategory})
        && ($Awfif::workspace-> {l} [$linki][2] == trwsoadr($peu, 2) + $Awfif::memes->{snnh}{wsi})
        && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{adjgroup})) {# found a adj group that could include ni

          $neu = $peu;
          $peu = trwsoadr($peu, 1);
          $nedlu = $linki;
          $nefoundu = '';# terminate since we found it
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while
      if ((!$nefoundu) or (!$nefoundd)) {#found a adj that can extend the group
        $ling = '';# we found something
        if ((!$nefoundu) && (!$nefoundd)) {#pick a direction randomly
          if (int(rand (2)) > 0) {#up
            $$ni = $neu;
            $$nidl = $nedlu;
            $$pi = $peu;
            }
          else {#down
            $$ni = $ned;
            $$nidl = $nedld;
            $$pi = $ped;
            };
          }
        elsif ((!$nefoundu)) {#up
          $$ni = $neu;
          $$nidl = $nedlu;
          $$pi = $peu;
          }
        else {#down
          $$ni = $ned;
          $$nidl = $nedld;
          $$pi = $ped;
          };
        }
      }
# elsif model is adjgroup add find the adj bond in ni setup pi;
    elsif (($ling) && ($model == (-$Awfif::memes-> {adjgroup})) ) {

      my ($linki, $nidld, $nidlu, $piu, $pid, $nfoundd, $nfoundu);
      $nfoundd = 't';
      if ($$ni != 0) {
        $linki = $Awfif::wsol-> {l} [ awsoadr($$ni)][2];
        }
      else {
        $linki = 0;
        };
      while (($linki != 0) && ($nfoundd)) {
        if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{bondcategory})
        && ($Awfif::workspace-> {l} [$linki][2] == trwsoadr($$ni, -1) + $Awfif::memes->{snnh}{wsi})
        && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{adjacent})) {# found a adj that could include ni

          $pid = trwsoadr($$ni, -1);
          $nidld = $linki;
          $nfoundd = '';# terminate since we found it
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while
      $nfoundu = 't';
      if (($$ni != $kwp) && (trwsoadr($$ni, 1) != $kwp)) {
        $linki = $Awfif::wsol-> {l} [ awsoadr($$ni)] [2];
        }
      else {
        $linki = 0;
        };
      while (($linki != 0) && ($nfoundu)) {
        if (($Awfif::workspace-> {l} [$linki][4] == $Awfif::memes->{snnh}{bondcategory})
        && ($Awfif::workspace-> {l} [$linki][2] == trwsoadr($$ni, 1) + $Awfif::memes->{snnh}{wsi})
        && ($Awfif::workspace-> {l} [$linki][3] == $Awfif::memes->{snnh}{adjacent})) {# found a adj that could include ni

          $pid = trwsoadr( $$ni, 1);
          $nidlu = $linki;
          $nfoundu = '';# terminate since we found it
          };
        $linki = $Awfif::workspace-> {l} [$linki][0];
        }#while
      if ((!$nfoundu) or (!$nfoundd)) {#found an adj group
        $ling = '';# we found something
        if ((!$nfoundu) && (!$nfoundd)) {#pick a direction randomly
          if (int(rand (2)) > 0) {#up
            $$pi = $piu;
            $$nidl = $nidlu;
            }
          else {#down
            $$pi = $pid;
            $$nidl = $nidld;
            };
          }
        elsif (!$nfoundu) {#up
          $$pi = $piu;
          $$nidl = $nidlu;
          }
        else {
          $$pi = $pid;
          $$nidl = $nidld;
          };
        };# found an adj group add
      }
#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("chtdespi ni $$ni pi $$pi ret $found\n");
      };
    return $found
    }#chtdespi
#
# for propertyappies
#
sub propertyapplies {
    my ($myli, $concept, $kwp, $kwpr, $sactset) = @_;
    my ($applies);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("propertyapplies myli $myli concept $concept ");
      };
    $applies = "";
    $applies = $Awfif::memes-> {binds}-> {$concept} ($myli, $kwp, $kwpr, \@$sactset);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("propertyapplies ret $applies\n");
      };
    return $applies
    }#propertyappies
#
sub clwsaevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;
    my ($acceptable, $snni, $wso, $cwsi, $too, $logn);
# ensure that the proposed descriptor matches the current workspace situation
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("clwsaevaluator1 myli $myli ");
      };

    $acceptable = "";
    if ($Awfif::codelet-> {l} [$myli][2] eq 'relevaluator') {

      $wso = $Awfif::codelet-> {l} [$myli][4];
      $snni = $Awfif::codelet-> {l} [$myli][6];
      $cwsi = $wso;
      $too = $Awfif::codelet-> {l} [$myli][7];
      $logn = 're';
      }
    else {

      $wso = $Awfif::codelet-> {l} [$myli][4];
      $cwsi = $wso;
      $too = 0;
      $snni = $Awfif::codelet-> {l} [$myli][12];
      $logn = 'de';
      };
    if ((defined($too))
    && ( awsoadr($too) > 0)) {
      if ((greaterwso ($wso, $too))
      && ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {successor})) {# swop since succ, pred etc assume assending order

        $wso = $too;
        $too = $Awfif::codelet-> {l} [$myli][4];
        &updatelog ($myli, $logn, 13, $wso);
        }
      elsif (( greaterwso($too, $wso))
      && ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {predecessor})) {# swop since succ, pred etc assume assending order

        $wso = $too;
        $too = $Awfif::codelet-> {l} [$myli][4];
        &updatelog ($myli, $logn, 13, $wso);
        };
      };

    &updatelog ($myli, $logn, 16, $wso);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("wso $wso too $too snni $snni ");
      };

    $acceptable = clwsaeinv1 ($myli, $wso, $snni, $too, $logn, 't', $kwp, $kwpr, \@$sactset);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("clwsaevaluator ret $acceptable\n");
      };
    return $acceptable
    } #clwsaevaluator1
#
sub clievaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;
    my ($dowork, $linki, $starti, $i, $ai, $count);
# validate structure of salient objects from the workspace & adjust temperature
#
# from the strength of the individuals structure decide if it should proceed
# strength assessment has two facets:
# depth of the concepts connected to the workspace structure
# how well proposed structure fits in with surroundings
# i.e. presence of similar descriptors or bonds in the neighbourhood
#
# if the structures in the workspace look synergistic lower the temperature
#
# updated for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("clievaluator1 myli $myli kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
#

    $dowork = 0;
# look at the depth of the concepts attached to the workspace structure
    $dowork = $dowork + $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnd} [$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [11]] [3]];# depth of relation
# Reflect the suroundings: same bonds in vicinity, next to each other in ws (my requirement)
# set the limits of surroundings


    $starti = trwsoadr($Awfif::codelet-> {l} [$myli][4], -5);

    $i = $starti;
    $count = 10;
    while (($count-- > 0) && (($ai = awsoadr ($i)) != 0) ) {
      $linki = $Awfif::wsol-> {l} [$ai][2];#the head attribute
# all objects should have at least one descriptor - but ....
      if ($linki != 0) {# at least one descriptor for this object

        while ($linki !=0 ) {
          if ($Awfif::workspace-> {l} [$linki] [2] == $Awfif::codelet-> {l} [$myli][11]){#
            $dowork = $dowork + $Awfif::memes-> {desrwd};# reward for same relations in proximity
            };#if
          $linki = $Awfif::workspace-> {l} [$linki] [0];
          };#while
        }# there are descriptors to check
      $i = trwsoadr ($i,1);
      }#walk each object in the proximate workspace; for -> while
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("clievaluator1 ret $dowork\n");
      };
    return $dowork
    }# clievaluator1
#
sub clrevaluator1 {
    my ($myli, $amp, $rwd, $kwp, $kwpr, $sactset) = @_;
    my ($dowork, $linki, $starti, $i, $ai, $count);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("clrevaluator1 amp $amp rwd $rwd kwp($kwp) kwpr($kwpr) sactset($$sactset[0]) ");
      };
# validate structure of salient objects from the workspace & adjust temperature
#
# from the strength of the relational structure decide if it should proceed
# strength assessment has two facets:
# depth of the concepts connected to the workspace structure
# how well proposed structure fits in with surroundings
# i.e. presence of similar descriptors or bonds in the neighbourhood
# Free energy (Temperature and high energy intermediates) are a
# more general enabler
#
# if the structures in the workspace look synergistic lower the temperature
#
#
# updated for merged workspaces

    $dowork = 0;
# look at the depth of the concepts attached to the workspace structure
    $dowork = $dowork + $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnd} [$Awfif::workspace-> {l} [$Awfif::codelet-> {l} [$myli] [5]][3]];# nidl relation's depth
    $dowork = $dowork + $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnd} [$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [6]][3]];# nsnn relation's depth
    $dowork = $dowork + $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnd} [$Awfif::workspace-> {l} [$Awfif::codelet-> {l} [$myli] [8]][3]];# pidl relation's depth
    $dowork = $dowork + $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnd} [$Awfif::slipnet-> {l} [$Awfif::codelet-> {l} [$myli] [9]][3]];# psnn relation's depth
# Reflect the suroundings: same bonds in vicinity, next to each other in ws (my requirement)
# set the limits of surroundings

    if (greaterwso ($Awfif::codelet-> {l} [$myli][4], $Awfif::codelet-> {l} [$myli][7])) {# ni > pi
      $starti = trwsoadr ($Awfif::codelet-> {l} [$myli][7], -5);
      }
    else {
      $starti = trwsoadr ($Awfif::codelet-> {l} [$myli][4], -5);
      };

    $i = $starti;
    $count = 10;
    while (($count-- > 0) && (($ai = awsoadr ($i)) != 0) ) {
      $linki = $Awfif::wsol-> {l} [$ai][2];#the head attribute
# all objects should have at least one descriptor - but ....
      if ($linki != 0) {# at least one descriptor for this object

        while ($linki !=0 ) {
          if ($Awfif::workspace-> {l} [$linki] [2] == $Awfif::codelet-> {l} [$myli][6]){# nsnn
            $dowork = $dowork + $rwd;# reward for same relations in proximity
            };#if
          $linki = $Awfif::workspace-> {l} [$linki] [0];
          };#while
        }# there are descriptors to check
      $i = trwsoadr ($i, 1);
      }#walk each object in the proximate workspace for -> while
    if ((trwsoadr($Awfif::codelet-> {l} [$myli][4],1) == $Awfif::codelet-> {l} [$myli][7])
    or (trwsoadr($Awfif::codelet-> {l} [$myli][4],-1) == $Awfif::codelet-> {l} [$myli][7])){

      $dowork = $dowork * $amp;
      };
    if ($Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] - $Awfif::memes-> {rtemp} > 0) {
      $dowork = $dowork * int(($Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] - $Awfif::memes-> {rtemp})/10);
      };
    if (($Awfif::memes-> {fatp} > 0) && ($dowork < $Awfif::memes-> {bondbar})) {
      $dowork = $Awfif::memes-> {bondbar}+1;
      };
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("clrevaluator1 ret $dowork\n");
      };
    return $dowork
    }# clrevaluator1
#
sub clwsaeinv1 {
    my ($myli, $wso, $snni, $too, $logn, $uselog, $kwp, $kwpr, $sactset) = @_;
    my ($acceptable, $cwsdp, $pwsi, $pwsp, $pwsp2, $pfound, $sni);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("clwsaeinv1 myli $myli wso $wso snni $snni too $too logn $logn uselog $uselog ");
      };

    $acceptable = "";
# ensure that the proposed descriptor matches the current workspace situation
#
# updated for merged workspaces

    $pwsp = 0;
    $pwsi = -1;#note when not set specifically
    if ($logn eq 'de' ) {
      $cwsdp = getwsic ($wso, $snni, \$acceptable);
      if ($uselog) {
      }
    else {

      $cwsdp = wsbaseind($wso);# current work spaces base object defaulted
      $acceptable = 't';
      };
    if ($Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {lateral}) {
      $acceptable = 't';
      };

    if ($uselog) {
    if ($acceptable) {
      $acceptable = '';
# If the node has a bonding link eg successor link to the concept equals then check if this is true for example.

      if (( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {successor})
      or ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {iname})
      or ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {dname})) {

        $pwsi = trwsoadr($wso, 1);
        }
      elsif ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {predecessor}) {

        $pwsi = trwsoadr($wso,-1);
        }
      elsif ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {cfile}) {

        $pwsi = $wso;
        }
      elsif ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {adjacent}) {

        if ($too == trwsoadr($wso,1)) {
          $pwsi = trwsoadr($wso, 1);;
          }
        else {
          $pwsi = trwsoadr($wso,-1);
          };
        };
      $pfound = "";
      if ($pwsi == $wso) {

        $pwsp = $Awfif::wsol-> {l} [ awsoadr($pwsi)][2];
        $pwsp2 = $Awfif::wsol-> {l} [ awsoadr( trwsoadr($wso, 1))][2];
        }
      elsif ($pwsi != 0) {

        $pwsp = $Awfif::wsol-> {l} [ awsoadr($pwsi)][2];
        if (( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {dname})
        or ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {cfile})
        or ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {crecord})
        or ( $Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {iname})) {
          $pwsp2 = 0;
          }
        else {
          $pwsp2 = $Awfif::wsol-> {l} [ awsoadr($wso)][2];
          };
        }
      else {

        $pwsp = 0;
        };
      if ($uselog) {
      do {
        while (($pwsp != 0) && (!($pfound))) {
          if (($Awfif::slipnet-> {l} [$snni][2] == $Awfif::workspace-> {l} [$pwsp][2])
          && ($Awfif::slipnet-> {l} [$snni][4] == $Awfif::workspace-> {l} [$cwsdp][2])){

            $pfound = 'T';
            $acceptable = 'T';
            if ($uselog) {
              &updatelog ($myli, $logn, 12, 'pi-mtch');
              };
            $pwsp = 0;# so terminate do
            }# found valid partner
          elsif ((srelgrp ($Awfif::slipnet-> {l} [$snni][2])) && ($logn eq 'de')) {

            $pfound = 'T';
            $acceptable = 'T';
            if ($uselog) {
              &updatelog ($myli, $logn, 12, 'pi-grp-de');
              };
            $pwsp = 0;# so terminate do
            }# found valid partner
          elsif (($Awfif::slipnet-> {l} [$snni][2] == $Awfif::memes-> {snnh} {identity})
          && ($Awfif::workspace-> {l} [$cwsdp][2] == $Awfif::workspace-> {l} [$pwsp][2])) {

            $pfound = 'T';
            $acceptable = 'T';
            if ($uselog) {
              &updatelog ($myli, $logn, 12, 'pi-idnt');
              };
            $pwsp = 0;# so terminate do
            }# found valid partner
          elsif (($Awfif::slipnet-> {l} [$snni] [3] == $Awfif::memes-> {snnh} {cfile})
          && ($Awfif::workspace-> {l} [$cwsdp] [2] == $Awfif::workspace-> {l} [$pwsp] [4])) {

            $pfound = 'T';
            $acceptable = 'T';
            if ($uselog) {
              &updatelog ($myli, $logn, 12, 'pi-cfle');
              };
            $pwsp = 0;# so terminate do
            }# found valid partner

          else {
            $pwsp = $Awfif::workspace-> {l} [$pwsp][0];
            };
          };#while partner descriptors
        } # do
      while ($pwsp != 0);
      if ($uselog) {
        &updatelog ($myli, $logn, 9, $acceptable);
        };
# if the node has an opposite link then check if the opposite concept is saliently in focus. (Not likely in test assertion space).
      if ($Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh}{opposite}) {
# get the too ws object
# find the base type
        if (wsbasetype ($too) == $Awfif::slipnet-> {l}[$snni][2]) {
          $acceptable = 'T';
          if ($uselog) {
          };
# check it matches the opposite concept specified by the snn
# if it is then this is acceptable
        };
# if the node has a property link it should be verified that the property's strategy currently holds for the workspace object.
      if ($Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh}{property}) {

        if (propertyapplies ($myli, $Awfif::memes-> {snnih}{$Awfif::slipnet-> {l}[$snni][2]}, $kwp, $kwpr, \@$sactset)) {
          $acceptable = 'T';
          if ($uselog) {
          };
        };
# if the node has an associative link it will be true.
      if ($Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh} {associative}) {

        $acceptable = 'T';
        if ($uselog) {
        };
# if the node has a slip link it will be true.
      if ($Awfif::slipnet-> {l} [$snni] [3] == $Awfif::memes-> {snnh} {slip}) {

        $acceptable = 'T';
        if ($uselog) {
        };
# if the node has an exists link it will be true.
      if ($Awfif::slipnet-> {l} [$snni] [3] == $Awfif::memes-> {snnh} {exists}) {

        $acceptable = 'T';
        if ($uselog) {
        };
# if the node has a cinstance link it will be true for descriptors.
      if (($Awfif::slipnet-> {l} [$snni] [3] == $Awfif::memes-> {snnh} {cinstance})
      && ($logn eq 'de')) {

        $acceptable = 'T';
        if ($uselog) {
        };
# enforce relations requirements for previous deployment of descriptors
# dname should not be specified here it should be a child of a category
      if (($Awfif::slipnet-> {l} [$snni] [3] == $Awfif::memes-> {snnh} {dname})
      && ($logn eq 're')
      && ($acceptable)) {#too matches the snni[2] check already

        $acceptable = '';
# dname should not be specified here it should be a child of a category
        if (wsocontains ( trwsoadr($wso,1), $Awfif::memes-> {snnh}{property}, $Awfif::memes-> {dname})) {
          $acceptable = 'T';
          if ($uselog) {
          };
        };
# if the node has a contains link it will be true if there is an instance of the linked concept that is bonded and grouped to this node.

      $sni = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$Awfif::memes-> {snnh} {indirectcategory}];
      while ($sni != 0) {
        if (($Awfif::slipnet-> {l}[$snni][3] == $Awfif::slipnet-> {l}[$sni][2])
        && ($Awfif::slipnet-> {l}[$sni][3]== $Awfif::memes-> {snnh}{cibp})
        && ($logn eq 're')) {
# placeholder - the wso will be for the group beyond this not the wso beyond
          if (groupcontains ($myli, $wso, +1, $Awfif::slipnet-> {l}[$snni][4], $Awfif::slipnet-> {l}[$sni][2], $kwp, $kwpr, \@$sactset)) {

            $acceptable = 'T';
            if ($uselog) {
            };
          };
        $sni = $Awfif::slipnet-> {l} [$sni][0];
        };#while
# if the node has a cfile link it will be true if there is an instance of the to concept that is the base group of this wso.
# each indirect link will require a check here - cfile, adjacent, adjgroup...

      if (($Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh}{cfile})
      && ($logn eq 'de')) {
        $acceptable = 'T';
        if ($uselog) {
          &updatelog ($myli, $logn, 12, 'd-cfle');
          };
        };
# if the node has a *group link it will be true if there is an instance of the to concept that is the base group of this wso.

      if ((srelgrp($Awfif::slipnet-> {l}[$snni][3]))
      && ($logn eq 'de')) {
        $acceptable = 'T';
        if ($uselog) {
          &updatelog ($myli, $logn, 12, 'd-sgrp');
          };
        };
# enforce relations requirements for previous deployment of descriptors
# dname should not be specified here it should be a child of a category
      if (($Awfif::slipnet-> {l}[$snni][3] == $Awfif::memes-> {snnh}{lateral})
      && ($logn eq 'de')) {#
# lateral links to groups are valid if the too group has a bond in wso and from is the bond

        if ((findbond ($Awfif::wsol-> {l} [ awsoadr($wso)] [2], trwsoadr($wso, 1), $Awfif::slipnet-> {l}[$snni][4], $Awfif::memes-> {snnh} {bondcategory}))
        or (findbond ($Awfif::wsol-> {l} [ awsoadr($wso)] [2], trwsoadr($wso, -1), $Awfif::slipnet-> {l}[$snni][4], $Awfif::memes-> {snnh} {bondcategory}))) {
          $acceptable = 'T';
          if ($uselog) {
            &updatelog ($myli, $logn, 12, 'd-latg');
            };
          };
        };
      };# consistant

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("clwsaeinv1x ret $acceptable\n");
      };
    return $acceptable
    } #clwsaeinv1
#
#<!-- start tag inh -->
#<!-- start tag sia -->
#<!-- start tag ds -resweb -->
#
sub unpackclp {
    my ($myli, $clp, $link) = @_;
    my ($i, $result);
    $result = 0;
# clean up old data
#
# checked for merged workspaces

    for ($i = 2;$i <= $Awfif::memes-> {cpmax}; $i++) {
      $Awfif::codelet-> {l} [$link][$i] = 0;
      };
    $Awfif::codelet-> {l} [$link][27] = '';
    $Awfif::codelet-> {l} [$link][2] = $$clp-> {strategy};
    $Awfif::codelet-> {l} [$link][3] = $$clp-> {urgency};
    $Awfif::codelet-> {l} [$link][13] = $$clp-> {log};
    if (defined ($$clp-> {wsi})) {
      $Awfif::codelet-> {l} [$link][19] = $$clp-> {wsi};
      };
# paramdelayselect
    if (defined ($$clp-> {delayselect})) {
      $Awfif::codelet-> {l} [$link][33] = ($$clp-> {delayselect} * $Awfif::memes-> {delayamp});
      };
    if (defined ($$clp-> {rework})) {
      $Awfif::codelet-> {l} [$link][14] = $$clp-> {rework};
      };

    if ($$clp-> {bond}-> {ni} != 0 ) {
      $Awfif::codelet-> {l} [$link][4] = $$clp-> {bond}-> {ni};
      };
    if ($$clp-> {bond}-> {nidl} != 0 ) {
      $Awfif::codelet-> {l} [$link][5] = $$clp-> {bond}-> {nidl};
      };
    if ($$clp-> {bond}-> {nsnn} != 0 ) {
      $Awfif::codelet-> {l} [$link][6] = $$clp-> {bond}-> {nsnn};
      };
    if ($$clp-> {bond}-> {pi} != 0 ) {
      $Awfif::codelet-> {l} [$link][7] = $$clp-> {bond}-> {pi};
      };
    if ($$clp-> {bond}-> {pidl} != 0 ) {
      $Awfif::codelet-> {l} [$link][8] = $$clp-> {bond}-> {pidl};
      };
    if ($$clp-> {bond}-> {psnn} != 0 ) {
      $Awfif::codelet-> {l} [$link][9] = $$clp-> {bond}-> {psnn};
      };
    if ($$clp-> {bond}-> {category} != 0 ) {
      $Awfif::codelet-> {l} [$link][10] = $$clp-> {bond}-> {category};
      };

    if ($$clp-> {descriptor}-> {property} != 0 ) {# not the slipnet property link
      $Awfif::codelet-> {l} [$link][11] = $$clp-> {descriptor}-> {property};
      };
    if ($$clp-> {descriptor}-> {sponsor} != 0 ) {# original sponsoring concept
      $Awfif::codelet-> {l} [$link][15] = $$clp-> {descriptor}-> {sponsor};
      };
    if ($$clp-> {relation}-> {sponsor} != 0 ) {# original sponsoring concept
      $Awfif::codelet-> {l} [$link][15] = $$clp-> {relation}-> {sponsor};
      };
    if ($$clp-> {descriptor}-> {ni} != 0 ) {
      $Awfif::codelet-> {l} [$link][4] = $$clp-> {descriptor}-> {ni};
      };
    if ($$clp-> {descriptor}-> {snnode} != 0 ) {
      $Awfif::codelet-> {l} [$link][12] = $$clp-> {descriptor}-> {snnode};
      };

    if ($$clp-> {relation}-> {ni} != 0 ) {
      $Awfif::codelet-> {l} [$link][4] = $$clp-> {relation}-> {ni};
      };
    if ($$clp-> {relation}-> {nidl} != 0 ) {
      $Awfif::codelet-> {l} [$link][5] = $$clp-> {relation}-> {nidl};
      };
    if ($$clp-> {relation}-> {nsnn} != 0 ) {
      $Awfif::codelet-> {l} [$link][6] = $$clp-> {relation}-> {nsnn};
      };
    if ($$clp-> {relation}-> {pi} != 0 ) {
      $Awfif::codelet-> {l} [$link][7] = $$clp-> {relation}-> {pi};
      };
    if ($$clp-> {relation}-> {pidl} != 0 ) {
      $Awfif::codelet-> {l} [$link][8] = $$clp-> {relation}-> {pidl};
      };
    if ($$clp-> {relation}-> {psnn} != 0 ) {
      $Awfif::codelet-> {l} [$link][9] = $$clp-> {relation}-> {psnn};
      };
    if ($$clp-> {relation}-> {category} != 0 ) {
      $Awfif::codelet-> {l} [$link][10] = $$clp-> {relation}-> {category};
      };

    if ($$clp-> {group}-> {model} != 0 ) {# group is being modelled
      $Awfif::codelet-> {l} [$link][16] = $$clp-> {group}-> {model};
      };
    if ($$clp-> {group}-> {sponsor} != 0 ) {# group sponsoring wso
      $Awfif::codelet-> {l} [$link][17] = $$clp-> {group}-> {sponsor};
      };

    if ($$clp-> {action}-> {ref} != 0 ) {
      $Awfif::codelet-> {l} [$link][4] = $$clp-> {action}-> {ref};
      };
# paramssgws
    if ($$clp-> {action}-> {ssgws} != 0 ) {
      $Awfif::codelet-> {l} [$link][5] = $$clp-> {action}-> {ssgws};
      };
    if ($$clp-> {action}-> {ssgoid} != 0 ) {
      $Awfif::codelet-> {l} [$link][6] = $$clp-> {action}-> {ssgoid};
      };
    if ($$clp-> {action}-> {signal} != 0 ) {# action is linked to signal
      $Awfif::codelet-> {l} [$link][16] = $$clp-> {action}-> {signal};
      };
    if ($$clp-> {action}-> {sponsor} != 0 ) {# group sponsoring wso
      $Awfif::codelet-> {l} [$link][17] = $$clp-> {action}-> {sponsor};
      };
    if ($$clp-> {action}-> {schema} != 0 ) {# actions start point
      $Awfif::codelet-> {l} [$link][18] = $$clp-> {action}-> {schema};
      };
    if ($$clp-> {action}-> {sws} != 0 ) {# refs schemas workspace index
      $Awfif::codelet-> {l} [$link][20] = $$clp-> {action}-> {sws};
      };
    if ($$clp-> {action}-> {wss} != 0 ) {# refs schemas wso start index
      $Awfif::codelet-> {l} [$link][21] = $$clp-> {action}-> {wss};
      };
    if ($$clp-> {action}-> {wsoname} != 0 ) {# refs schemas wso name
      $Awfif::codelet-> {l} [$link][25] = $$clp-> {action}-> {wsoname};
      };
    if ($$clp-> {action}-> {wse} != 0 ) {# refs schemas wso end index
      $Awfif::codelet-> {l} [$link][22] = $$clp-> {action}-> {wse};
      };
# paramjhlsiref
    if ($$clp-> {action}-> {jhlabeli} != 0 ) {# refs schemas wso label
      $Awfif::codelet-> {l} [$link][23] = $$clp-> {action}-> {jhlabeli};
      };
    if ($$clp-> {action}-> {pmman} != 0 ) {# refs schemas wso end index
      $Awfif::codelet-> {l} [$link][26] = $$clp-> {action}-> {pmman};
      };
    if ($$clp-> {action}-> {wss} != 0 ) {# refs schemas wso gap start index
      $Awfif::codelet-> {l} [$link][28] = $$clp-> {action}-> {wsgs};
      };
    if ($$clp-> {action}-> {wss} != 0 ) {# refs schemas wso gap end index
      $Awfif::codelet-> {l} [$link][29] = $$clp-> {action}-> {wsge};
      };
    if ($$clp-> {action}-> {jhlabeloi} != 0 ) {# refs schemas original sponsor wso operon
      $Awfif::codelet-> {l} [$link][30] = $$clp-> {action}-> {jhlabeloi};
      $result = $$clp-> {action}-> {jhlabeloi};
      };
# paramsgjhlsiref
    if ($$clp-> {action}-> {sgjhlsi} != 0 ) {# refs schemas nuclear subgroup wso operon
      $Awfif::codelet-> {l} [$link][31] = $$clp-> {action}-> {sgjhlsi};
      };
# paramtfree
    if ($$clp-> {action}-> {tfree} != 0 ) {# transaction sponsor cant free
      $Awfif::codelet-> {l} [$link][32] = $$clp-> {action}-> {tfree};
      };
# paramtransid
    if ($$clp-> {action}-> {transid} != 0 ) {# transaction id protected
      $Awfif::codelet-> {l} [$link][35] = $$clp-> {action}-> {transid};
      };
# paramsubpi
    if ($$clp-> {action}-> {subpi} != 0 ) {# subprogram
      $Awfif::codelet-> {l} [$link][36] = $$clp-> {action}-> {subpi};
      };
# unpacktrmgru1
    if ((($Awfif::codelet-> {l} [$link][35] != 0 ) or ($Awfif::codelet-> {l} [$link][36] != 0 ))
    && ($Awfif::codelet-> {l} [$link][35] != $Awfif::codelet-> {l} [$myli][35])#if these are the same a clone of self is being produced - so already has a transaction
    ){# subprogram

      &transmgr ($myli, $link, $Awfif::memes-> {snnh} {begin}, $Awfif::memes-> {snnh} {rtran});
      };
# paramtransmgrid
    if ($$clp-> {action}-> {transmgrid} != 0 ) {# transaction manager index
      $Awfif::codelet-> {l} [$link][37] = $$clp-> {action}-> {transmgrid};
# have to record that builder is submitted to trun
      if ($Awfif::codelet-> {l} [$myli] [2] =~ /evaluator/i) {
        $Awfif::tmassl-> {submitted} [$Awfif::codelet-> {l}[$link][37]] = $Awfif::codelet-> {l} [$link] [2];
        };#if
      };
# paramusepooling
    if ($$clp-> {action}-> {usepooling} != 0 ) {# schematic pooling of codelets
      $Awfif::codelet-> {l} [$link][38] = $$clp-> {action}-> {usepooling};
      };#if

    if ($$clp-> {inhib}-> {ilinkp} != 0 ) {# inhibitor link pointer
      $Awfif::codelet-> {l} [$link][24] = $$clp-> {inhib}-> {ilinkp};
      };
    return $result;
    } # unpackclp
#
#<!-- end tag sia -->
#<!-- end tag ds -->
#
sub copyclp {
    my ($myli, $clp, $copy, $index) = @_;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("copyclp myli $myli index $index ");
      };
    $$copy [$index][1] = $$clp-> {strategy};
    $$copy [$index][2] = $$clp-> {urgency};
    $$copy [$index][3] = $$clp-> {log};
    $$copy [$index][4] = $$clp-> {wsi};
    $$copy [$index][5] = $$clp-> {rework};
    $$copy [$index][6] = $$clp-> {bond}-> {ni};
    $$copy [$index][7] = $$clp-> {bond}-> {nidl};
    $$copy [$index][8] = $$clp-> {bond}-> {nsnn};
    $$copy [$index][9] = $$clp-> {bond}-> {pi};
    $$copy [$index][10] = $$clp-> {bond}-> {pidl};
    $$copy [$index][11] = $$clp-> {bond}-> {psnn};
    $$copy [$index][12] = $$clp-> {bond}-> {category};
    $$copy [$index][13] = $$clp-> {descriptor}-> {property};
    $$copy [$index][14] = $$clp-> {descriptor}-> {sponsor};
    $$copy [$index][15] = $$clp-> {relation}-> {sponsor};
    $$copy [$index][16] = $$clp-> {descriptor}-> {ni};
    $$copy [$index][17] = $$clp-> {descriptor}-> {snnode};
    $$copy [$index][18] = $$clp-> {relation}-> {ni};
    $$copy [$index][19] = $$clp-> {relation}-> {nidl};
    $$copy [$index][20] = $$clp-> {relation}-> {nsnn};
    $$copy [$index][21] = $$clp-> {relation}-> {pi};
    $$copy [$index][22] = $$clp-> {relation}-> {pidl};
    $$copy [$index][23] = $$clp-> {relation}-> {psnn};
    $$copy [$index][24] = $$clp-> {relation}-> {category};
    $$copy [$index][25] = $$clp-> {group}-> {model};
    $$copy [$index][26] = $$clp-> {group}-> {sponsor};
    $$copy [$index][27] = $$clp-> {action}-> {ref};
    $$copy [$index][28] = $$clp-> {action}-> {signal};
    $$copy [$index][29] = $$clp-> {action}-> {sponsor};
    $$copy [$index][30] = $$clp-> {action}-> {schema};
    $$copy [$index][31] = $$clp-> {action}-> {sws};
    $$copy [$index][32] = $$clp-> {action}-> {wss};
    $$copy [$index][33] = $$clp-> {action}-> {wse};
    $$copy [$index][34] = $$clp-> {action}-> {jhlabeli};
    $$copy [$index][35] = $$clp-> {inhib}-> {ilinkp};
    $$copy [$index][36] = $$clp-> {action}-> {pmman};
    $$copy [$index][37] = $$clp-> {action}-> {jhlabeloi};
    $$copy [$index][38] = $$clp-> {action}-> {sgjhlsi};
    $$copy [$index][39] = $$clp-> {action}-> {tfree};
    $$copy [$index][40] = $$clp-> {delayselect};
    $$copy [$index][41] = $$clp-> {action}-> {transid};
    $$copy [$index][42] = $$clp-> {action}-> {subpi};
    $$copy [$index][43] = $$clp-> {action}-> {usepooling};

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("copyclpx \n");
      };
    }# copyclp
#
sub loadclp {
    my ($myli, $clp, $copy, $index) = @_;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("loadclp myli $myli index $index ");
      };
    $$clp-> {strategy} = $$copy [$index][1];
    $$clp-> {urgency} = $$copy [$index][2];
    $$clp-> {log} = $$copy [$index][3];
    $$clp-> {wsi} = $$copy [$index][4];
    $$clp-> {rework} = $$copy [$index][5];
    $$clp-> {bond}-> {ni} = $$copy [$index][6];
    $$clp-> {bond}-> {nidl} = $$copy [$index][7];
    $$clp-> {bond}-> {nsnn} = $$copy [$index][8];
    $$clp-> {bond}-> {pi} = $$copy [$index][9];
    $$clp-> {bond}-> {pidl} = $$copy [$index][10];
    $$clp-> {bond}-> {psnn} = $$copy [$index][11];
    $$clp-> {bond}-> {category} = $$copy [$index][12];
    $$clp-> {descriptor}-> {property} = $$copy [$index][13];
    $$clp-> {descriptor}-> {sponsor} = $$copy [$index][14];
    $$clp-> {relation}-> {sponsor} = $$copy [$index][15];
    $$clp-> {descriptor}-> {ni} = $$copy [$index][16];
    $$clp-> {descriptor}-> {snnode} = $$copy [$index][17];
    $$clp-> {relation}-> {ni} = $$copy [$index][18];
    $$clp-> {relation}-> {nidl} = $$copy [$index][19];
    $$clp-> {relation}-> {nsnn} = $$copy [$index][20];
    $$clp-> {relation}-> {pi} = $$copy [$index][21];
    $$clp-> {relation}-> {pidl} = $$copy [$index][22];
    $$clp-> {relation}-> {psnn} = $$copy [$index][23];
    $$clp-> {relation}-> {category} = $$copy [$index][24];
    $$clp-> {group}-> {model} = $$copy [$index][25];
    $$clp-> {group}-> {sponsor} = $$copy [$index][26];
    $$clp-> {action}-> {ref} = $$copy [$index][27];
    $$clp-> {action}-> {signal} = $$copy [$index][28];
    $$clp-> {action}-> {sponsor} = $$copy [$index][29];
    $$clp-> {action}-> {schema} = $$copy [$index][30];
    $$clp-> {action}-> {sws} = $$copy [$index][31];
    $$clp-> {action}-> {wss} = $$copy [$index][32];
    $$clp-> {action}-> {wse} = $$copy [$index][33];
    $$clp-> {action}-> {jhlabeli} = $$copy [$index][34];
    $$clp-> {action}-> {pmman} = $$copy [$index][36];
    $$clp-> {inhib}-> {ilinkp} = $$copy [$index][35];
    $$clp-> {action}-> {jhlabeloi} = $$copy [$index][37];
    $$clp-> {action}-> {sgjhlsi} = $$copy [$index][38];
    $$clp-> {action}-> {tfree} = $$copy [$index][39];
    $$clp-> {delayselect} = $$copy [$index][40];
    $$clp-> {action}-> {transid} = $$copy [$index][41];
    $$clp-> {action}-> {subpi} = $$copy [$index][42];
    $$clp-> {action}-> {usepooling} = $$copy [$index][43];

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("loadclpx \n");
      };
    }# loadclp
#
sub newcodeletl {
    my ($myli, $clp, $deferred) = @_;
# strategy is a codeaddress
# urgency is an integer
#
#
# checked for merged workspaces

    my ($link, $tt, $h, $f, $jhlsoi, $type);
    $tt = $Awfif::memes-> {codelett};
    $h = $Awfif::memes-> {codeleth};
    $f = $Awfif::memes-> {codeletf};
    if (defined ($deferred) && ($deferred) ){#deferred queue

      $link = $Awfif::memes-> {codeletdef};
      $type = $Awfif::memes-> {snnh} {deferred};
      }#if
    elsif (defined ($Awfif::clp-> {delayselect}) && ($Awfif::clp-> {delayselect} > 0) ){#wait queue

      $link = $Awfif::memes-> {codeletw};
      $type = $Awfif::memes-> {snnh} {wait};
      }#elsif
    else {

      $link = $Awfif::memes-> {codeleth};
      $type = $Awfif::memes-> {snnh} {active};
      };#else
    $link = newlink ($link, \$Awfif::codelet);
    $Awfif::codelet-> {t} [$link] = $type;
    if (($jhlsoi = unpackclp ($myli, \$$clp, $link)) != 0) {

      $Awfif::jhls-> {l} [$jhlsoi] [14] [2]++;
      };#if
    return $link;
    } # newcodeletl
#
#<!-- start tag scc -->
#
sub submitcodelet {
    my ($myli, $clp, $deferred, $addbreak) = @_;
#
    my ($pflink, $plink, $utail, $tt, $f, $h, $w, $jhlsoi, $bcindex);
# create an active codelet
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("submitcodelet ");
      };
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if

    $tt = $Awfif::memes-> {codelett};
    $h = $Awfif::memes-> {codeleth};
    $w = $Awfif::memes-> {codeletw};
    $f = $Awfif::memes-> {codeletf};
    $utail = '';
    if (($Awfif::memes-> {codelett} == 0)
    && ($Awfif::memes-> {codeleth} == 0)) {

      $utail = 'T';
      }; #note need to update tail
    $pflink = $Awfif::memes-> {codeletf};
    if ($pflink != 0 ) {
# can reclaim one from the inactive list

      $Awfif::memes-> {submitted} = $pflink;
      $Awfif::memes-> {fcodelets}--;
      $plink = $Awfif::codelet-> {l} [$pflink][0];
      if ($plink != 0) {

        $Awfif::codelet-> {l} [$plink ][1]=0; #sentinal
        $Awfif::memes-> {codeletf} = $plink;
        }# if
      else {#zero the free head ptr

        $Awfif::memes-> {codeletf} = 0;
        }; # else
      if ((defined ($deferred)) && ($deferred)) {

        $Awfif::codelet-> {l} [$pflink][0] = $Awfif::memes-> {codeletdef};
        if ($Awfif::memes-> {codeletdef} != 0) {

          $Awfif::codelet-> {l} [$Awfif::memes-> {codeletdef}] [1] = $pflink;
          };#if
        $Awfif::memes-> {codeletdef} = $pflink;
        $Awfif::codelet-> {t} [$pflink] = $Awfif::memes-> {snnh} {deferred};
        }#if
# submitcudsel
      elsif (defined ($Awfif::clp-> {delayselect}) && ($Awfif::clp-> {delayselect} > 0) ){#wait queue

        $Awfif::codelet-> {l} [$pflink][0] = $Awfif::memes-> {codeletw};
        if ($Awfif::memes-> {codeletw} != 0) {

          $Awfif::codelet-> {l} [$Awfif::memes-> {codeletw}] [1] = $pflink;
          };#if
        $Awfif::memes-> {codeletw} = $pflink;
        $Awfif::codelet-> {t} [$pflink] = $Awfif::memes-> {snnh} {wait};
        }#if
      else {

        $Awfif::codelet-> {l} [$pflink][0] = $Awfif::memes-> {codeleth};
        $Awfif::memes-> {acodelets} ++;#new active codelet
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        if ($Awfif::memes-> {codeleth} != 0) {

          $Awfif::codelet-> {l} [$Awfif::memes-> {codeleth}] [1] = $pflink;
          };#if
        $Awfif::memes-> {codeleth} = $pflink;
        $Awfif::codelet-> {t} [$pflink] = $Awfif::memes-> {snnh} {active};
        };#else
# submitcmbcul
      if (($bcindex = matchbreakcodelet ($myli)) > 0) {

        if ((defined ($addbreak)) && ($addbreak) ){

          $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $pflink;
          if ($$clp-> {action}-> {subpi} != 0) {

            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $$clp-> {action}-> {subpi};
            }#if
          else {

            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          }#if
        else {
          $Awfif::memes-> {breakcodelet} [$bcindex] = $pflink;
          if ($$clp-> {action}-> {subpi} != 0) {

            $Awfif::memes-> {breaksubp} [$bcindex] = $$clp-> {action}-> {subpi};
            }#if
          else {

            $Awfif::memes-> {breaksubp} [$bcindex] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          };#else
        };#if
      &trackcodelet ($myli, $pflink, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36], $$clp);
      if (($jhlsoi = unpackclp ($myli, \$$clp, $pflink)) != 0) {

        $Awfif::jhls-> {l} [$jhlsoi] [14] [2]++;
        };#if
# submitcafbu2

      if (($Awfif::codelet-> {t} [$pflink] == $Awfif::memes-> {snnh} {active})
      &&($Awfif::codelet-> {l} [$pflink] [2] eq 'groupbuilder')
      ){

        &addfb ($pflink);#list added codelets by name
        };#if
      }# found free links
    else {
# if there weren't any then get a newone

      my ($transtype);
      $Awfif::memes-> {tcodelets}++;
# submitcietu1
      if (($$clp-> {action}-> {subpi} != 0) or ($$clp-> {action}-> {transid} != 0) ) {
        $transtype = $Awfif::memes-> {snnh} {rtran};
        }#if
      else {
        $transtype = $Awfif::memes-> {snnh} {indequiv};
        };#else
      if ((defined ($deferred)) && ($deferred)) {

        $Awfif::memes-> {codeletdef} = newcodeletl ($myli, \$$clp, $deferred);
        $Awfif::memes-> {submitted} = $Awfif::memes-> {codeletdef};
# submitcietu2
        &transmgr (undef(), $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {begin}, $transtype);
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        if (($bcindex = matchbreakcodelet ($myli)) > 0) {

          if ((defined ($addbreak)) && ($addbreak) ){

            $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {codeletdef};
            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l}[$myli][36];
            }#if
          else {

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::memes-> {codeletdef};
            $Awfif::memes-> {breaksubp} [$bcindex] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          };#if
        &trackcodelet ($myli, $Awfif::memes-> {codeletdef}, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36]);
        }#if
      elsif (defined ($Awfif::clp-> {delayselect}) && ($Awfif::clp-> {delayselect} > 0) ){#wait queue

        $Awfif::memes-> {codeletw} = newcodeletl ($myli, \$$clp);
        $Awfif::memes-> {submitted} = $Awfif::memes-> {codeletw};
# submitcietu3
        &transmgr (undef(), $Awfif::memes-> {codeletw}, $Awfif::memes-> {snnh} {begin}, $transtype);
        if (($bcindex = matchbreakcodelet ($myli)) > 0) {

          if ((defined ($addbreak)) && ($addbreak) ){

            $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {codeletw};
            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l}[$myli][36];
            }#if
          else {

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::memes-> {codeletw};
            $Awfif::memes-> {breaksubp} [$bcindex] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          };#if
        &trackcodelet ($myli, $Awfif::memes-> {codeletw}, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36]);
        }#elsif
      else {

        $Awfif::memes-> {acodelets} ++;#new active codelet
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        $Awfif::memes-> {codeleth} = newcodeletl ($myli, \$$clp);
        $Awfif::memes-> {submitted} = $Awfif::memes-> {codeleth};
# submitcietu4
        if (($bcindex = matchbreakcodelet ($myli)) > 0) {

          if ((defined ($addbreak)) && ($addbreak) ){

            $Awfif::memes-> {breakcodelet} [++$Awfif::memes-> {breakcodelet} [0]] = $Awfif::memes-> {codeleth};
            $Awfif::memes-> {breaksubp} [++$Awfif::memes-> {breaksubp} [0]] = $Awfif::codelet-> {l}[$myli][36];
            }#if
          else {

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::memes-> {codeleth};
            $Awfif::memes-> {breaksubp} [$bcindex] = $Awfif::codelet-> {l}[$myli][36];
            };#else
          };#if
        &trackcodelet ($myli, $Awfif::memes-> {codeleth}, $Awfif::memes-> {snnh} {assocf1}, undef(), undef(), $Awfif::codelet-> {l} [$myli] [36]);
# submitcafbul

        if ($Awfif::codelet-> {l} [$Awfif::memes-> {codeleth}] [2] eq 'groupbuilder'){

          &addfb ($Awfif::memes-> {codeleth});#list added codelets by name
          };#if
        };#else
      }; #else
    if ($utail) {

      $Awfif::memes-> {codelett} = $Awfif::memes-> {codeleth};
      };# update tail
    $tt = $Awfif::memes-> {codelett};
    $h = $Awfif::memes-> {codeleth};
    $f = $Awfif::memes-> {codeletf};
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if
    if (($Awfif::memes-> {submitted} > 0) && (($Awfif::codelet-> {l} [$Awfif::memes-> {submitted}][0] == $Awfif::memes-> {submitted}) or ($Awfif::codelet-> {l} [$Awfif::memes-> {submitted}][1] == $Awfif::memes-> {submitted})) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr, $pr2);
      if ((defined ($deferred)) && ($deferred)) {
        $pr = $Awfif::memes-> {codeletdef};
        }#if
      else {
        $pr = $Awfif::memes-> {codeleth};
        };#else
      print ("submitcodeletx h $pr ");
      $pr2 = $Awfif::codelet-> {l} [$pr] [19];
      print ("ws($pr2)\n");
      };
    }#submitcodelet
#
#<!-- end tag scc -->
#
sub cdsubmitcodelet {
    my ($myli, $clp, $deferred, $addbreak) = @_;
#
    my ($newli, $wait);
# create an active codelet preserving rework count
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("cdsubmitcodelet myli $myli ");
      };
    $wait = (defined ($Awfif::clp-> {delayselect}) && ($Awfif::clp-> {delayselect} > 0));
    &submitcodelet ($myli, \$$clp, $deferred, $addbreak);

    if ((defined ($deferred)) && ($deferred)) {
      $newli = $Awfif::memes-> {codeletdef};
      }#if
    elsif ($wait) {
      $newli = $Awfif::memes-> {codeletw};
      }#elsif
    else {
      $newli = $Awfif::memes-> {codeleth};
      };
    $Awfif::codelet-> {l} [$newli][14] = $Awfif::codelet-> {l} [$myli][14];
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::codelet-> {l} [$newli][14];
      print ("cdsubmitcodeletx rework $pr ret($newli)\n");
      };
    return $newli
    }#cdsubmitcodelet
#
#<!-- end tag inh -->
#
sub mcdsubmitcodelet {
    my ($myli, $clp, $mparams) = @_;
#
    my (@mask, @madd, $i, $i2, $mstring, $commafound, $param, $newli);
# create an active codelet masking clp params
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mcdsubmitcodelet myli $myli mparams $mparams ");
      };

    if ((defined($mparams))) {

      $commafound = 't';
      $i = 0;
      $mstring = $mparams;# should be a string of the form 32[,37]
      while (($mstring ne '') && ($commafound)) {

        if ($mstring =~ /^(\d*)?,/i) {

          $param = $1;
          $madd[$i] = int ($param);
          $mask[$i] = $Awfif::codelet-> {l} [$myli][int($param)];
          $commafound = 't';
          $mstring =~ s/$param,//;
          }#if
        else {

          $madd[$i] = int ($mstring);
          $mask[$i] = $Awfif::codelet-> {l} [$myli] [int($mstring)];
          $commafound = '';
          };#else
    $Awfif::codelet-> {l} [$myli][$madd[$i++]] = 0;
        };#while

      };#if
    $newli = cdsubmitcodelet ($myli, \$$clp);
    if ((defined($mparams))) {

      for ($i2 = 0; $i2 < $i;$i2++) {

        $Awfif::codelet-> {l} [$myli] [$madd [$i2]] = $mask [$i2];
        };#for
      };#if

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mcdsubmitcodeletx ret($newli)\n");
      };
    return $newli
    }#mcdsubmitcodelet
#<!-- start tag scc -->
#<!-- start tag aso -->
#<!-- start tag ds -resweb -->
#
sub cascadesponsor {
    my ($myli, $sponsor, $option, $strategy, $transid, $transtatus) = @_;
#
    my ($cwsbi, $realsponsor, $asponsor, $desci, $result, $found, $drefi, $href, $lhref, $group, $atelhwso, $csstate);
# manage description of cascade ownership
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$option};
      print ("cascadesponsor myli $myli sponsor $sponsor option $pr($option) ");
      };

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = 0;
    $realsponsor = 0;
# The cascade sponsor descriptors are deployed to the real sponsor wso
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $asponsor = awsoadr ($sponsor);

    $desci = $Awfif::wsol-> {l} [$asponsor][2];
    while (($desci != 0) && ($realsponsor == 0)) {
      if (($Awfif::workspace-> {l} [$desci][4] == $Awfif::memes-> {snnh}{groupcategory})
      ){

        $realsponsor = ($Awfif::workspace-> {l} [$desci][2] - $Awfif::memes-> {snnh} {wsi});
        $asponsor = awsoadr ($realsponsor);
        $atelhwso = awsoadr (trwsoadr ($realsponsor, -1));
        $group = $Awfif::workspace-> {l} [$desci][3];
        };
      $desci = $Awfif::workspace-> {l} [$desci][0];
      };
# cascmdesc1

    if (($realsponsor != 0)
    && (($option == $Awfif::memes-> {snnh}{cassponsor})
      or ($option == $Awfif::memes-> {snnh} {casrelay}))
    ){

      if ( (($csstate = findtdesc ($Awfif::wsol-> {l} [ $asponsor] [2], $Awfif::memes-> {snnh} {cassponsor})) == 0)
      ){

        $Awfif::wsol-> {l} [$asponsor][2]
        = setupmdesc ( $Awfif::memes-> {snnh}{wsi},
            $Awfif::memes-> {snnh}{wsi},
            $Awfif::memes-> {snnh}{cassponsor},
            $Awfif::wsol-> {l} [$asponsor] [2],
            $asponsor);
        if ($option == $Awfif::memes-> {snnh} {casrelay}) {#flag that this cassponsor is a relay

          $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor][2]] [12] = $option;
          };#if relay
        if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

          $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor][2]] [11] = $Awfif::codelet-> {l} [$myli] [37];
          };#if
        }#if
      elsif ($Awfif::workspace-> {l} [$csstate][3] == (1 + $Awfif::memes-> {snnh}{wsi})
      ) {

          $Awfif::workspace-> {l} [$csstate] [3]--;
          if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

            $Awfif::workspace-> {l} [$csstate] [2] = aligncassphl ($myli, $atelhwso);#must align the cswso headlink
            };#if
        };#elsif
      &findmdesc ($Awfif::wsol-> {l} [$asponsor][2], ($Awfif::memes-> {snnh}{cassponsor}), $Awfif::memes-> {snnh}{wsi}, \$drefi);
      $href = ($Awfif::workspace-> {l} [$drefi] [2] - $Awfif::memes-> {snnh}{wsi});
      if (($href == 0) ) {

        my ($start, $end, $i, $pastend, $grefi);
        if (($Awfif::workspace-> {l} [$drefi] [12] != $Awfif::memes-> {snnh} {casrelay})) {

          &findmdesc ($Awfif::wsol-> {l} [$asponsor][2], ($Awfif::memes-> {snnh}{groupstart}), $group, \$grefi);#watchout this is a special use of findmdesc - groupstart does not conform in general to the setupmdesc framework. Its part of inccounter framework
          $start = ($Awfif::workspace-> {l} [$grefi] [2] - $Awfif::memes-> {snnh}{wsi});
          &findmdesc ($Awfif::wsol-> {l} [$asponsor][2], ($Awfif::memes-> {snnh}{groupend}), $group, \$grefi);#watchout this is a special use of findmdesc - groupend does not conform in general to the setupmdesc framework. Its part of inccounter framework
          $end = ($Awfif::workspace-> {l} [$grefi] [2] - $Awfif::memes-> {snnh}{wsi});
          $pastend = '';
          for ($i = $start; !$pastend; $i = trwsoadr ($i,1)) {

            $href = addcswso ($Awfif::codelet-> {l} [$myli] [20], $i, $href);
            $Awfif::workspace-> {l} [$drefi] [2] = $href + $Awfif::memes-> {snnh}{wsi};
            if ($i == $end) {

              $pastend = 't';
              };#if
            };#for
          };#if
# cascusubp1
# if this is a subpid then record the cassponsorship in a tmassl entry
        if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

          if (($Awfif::workspace-> {l} [$drefi] [12] != $Awfif::memes-> {snnh} {casrelay})) {
            &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoccspon}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), undef (), $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$drefi] [2]);
            }#if
          else {
            &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {assoccrel}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), undef (), $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$drefi] [2]);
            };#else
          };
        };#if
# cascumaskbo1
# since will now own the cascade remove backoffs for the previous cascade driver
      if (($Awfif::workspace-> {l} [$drefi] [12] != $Awfif::memes-> {snnh} {casrelay})) {

      $Awfif::codelet-> {l} [$myli] [32] = 1;
      }#if
    elsif ( ($realsponsor != 0)
    && (($option == $Awfif::memes-> {snnh}{wascassponsor}) or ($option == $Awfif::memes-> {snnh}{wascasrelay}))
    ){

      $found = '';
      $desci = $Awfif::wsol-> {l} [$asponsor][2];
      while (($desci != 0) && (!$found)) {
        if (($Awfif::workspace-> {l} [$desci][4] == $Awfif::memes-> {snnh}{cassponsor})
        ){
# cascusubp2

          if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

            if (($Awfif::workspace-> {l} [$desci] [12] != $Awfif::memes-> {snnh} {casrelay})) {

              &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {disassoccspon}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), undef (), $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$desci] [2]);
              }#if
            else {

              &transmgr ($myli, $myli, $Awfif::memes-> {snnh} {update}, $Awfif::memes-> {snnh} {disassoccrel}, $atelhwso, $Awfif::memes-> {snnh} {rtran}, undef(), undef (), $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$desci] [2]);
              };
            };
# if this is the last subpid, or its not a subpid, then
          if (($Awfif::codelet-> {l} [$myli] [36] == 0) or (!anysubpidcsponsor ($myli, $atelhwso))) {

            if ($Awfif::workspace-> {l} [$desci][3] == (0 + $Awfif::memes-> {snnh}{wsi})) {

              $Awfif::workspace-> {l} [$desci][3]++;
              };#if
            $Awfif::codelet-> {l} [$myli] [32] = 0;
            $found = 't';
            if (defined ($Awfif::workspace-> {l} [$desci] [2])) {

              $href = ($Awfif::workspace-> {l} [$desci] [2] - $Awfif::memes-> {snnh}{wsi});
              while ($href != 0) {

                if ($href > 0) {

                  $lhref = $href;
                  $href = freecswso ($href);
                  }#if
                else {#some how its unexpectedly gone negative - look into it

                  &break ();
                  };#else
                };#while
              $Awfif::workspace-> {l} [$desci] [2] = $Awfif::memes-> {snnh}{wsi};
              }#if
            else {

              &break();
              };#else
            }#if
          elsif ($Awfif::codelet-> {l} [$myli] [36] > 0) {#set this instance to '0'

            $Awfif::workspace-> {l} [$desci] [2] = $Awfif::memes-> {snnh}{wsi}; };#elsif
          };#if
        $desci = $Awfif::workspace-> {l} [$desci][0];
        };#while
# cascumaskbo2
# since giving up ownership of cascade mask the suppressor descriptor link
      if (($option == $Awfif::memes-> {snnh}{wascassponsor})
      ){

        &mdropsalience ($asponsor);
        if ((defined ( $$transid)) && (defined ($$transtatus)) ){

          $$transid = transalloc ($myli, $Awfif::memes-> {snnh} {wascassponsor}, undef(), $$transid, \$$transtatus);
          };#if
        }#if
      else {

        if ((defined ( $$transid)) && (defined ($$transtatus)) ){

          $$transid = transalloc ($myli, $Awfif::memes-> {snnh} {wascasrelay}, undef(), $$transid, \$$transtatus);
          };#if
        };#else relay
      }#elsif
    elsif (($realsponsor != 0)
    && ($option == $Awfif::memes-> {snnh}{getcassponsor})
    ){
      $desci = $Awfif::wsol-> {l} [$asponsor][2];

      while (($desci != 0) && ($result == 0)) {
        if (($Awfif::workspace-> {l} [$desci][4] == $Awfif::memes-> {snnh}{cassponsor})
        && ($Awfif::workspace-> {l} [$desci][3] == (0+ $Awfif::memes-> {snnh}{wsi}))
        ){

          $result = 1;
          };
        $desci = $Awfif::workspace-> {l} [$desci][0];
        };
      }#elsif
    else {# reached here in error

      &break ();
      };#else
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("cascadesponsorx ret ($result)\n");
      };
    return $result
    }#cascadesponsor
#
#<!-- end tag ds -->
#<!-- end tag scc -->
#<!-- end tag aso -->
#
sub crsubmitcodelets {
    my ($wait) = @_;
    my($wslp, $cwsbi, $iwait);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("crsubmitcodelets ");
      };

    $wslp = $Awfif::wsbl->{h};
    $cwsbi = $Awfif::memes-> {currentwsbi};
    while (($wslp != 1) && ($wslp != $Awfif::wsbl->{t})) {#submit across workspaces

      if ($Awfif::wsbl-> {wsactive} [$wslp]) {
# respond to the instantaneous temperature
# if the temperature is > {destthreshold} then submit destructor codelets
      if ($Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] > $Awfif::memes-> {destthreshold}) {
        } # if > $Awfif::memes-> {destthreshold}
# else if its the early phase of coderack development then add just description scout codelets
      elsif ($Awfif::memes-> {iphase} < $Awfif::memes-> {iphasecomp}) {# initial phase

        $Awfif::clp = ();
        $Awfif::clp-> {urgency} = $Awfif::memes-> {buscu};
        $Awfif::clp-> {wsi} = $wslp;
        $Awfif::clp-> {strategy} = "descscout"; #descscout
        &Awfif::submitcodelet ('',\$Awfif::clp);
        }#greater than descthreshold
      elsif ($Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] > $Awfif::memes-> {manthreshold}) {

        if ($Awfif::memes-> {temp} [$Awfif::memes-> {currentwsbi}] > $Awfif::memes-> {bondthreshold}) {
          if (!$Awfif::memes-> {subgrouponly}){

            $Awfif::clp = ();
            $Awfif::clp-> {urgency} = $Awfif::memes-> {buscu};
            $Awfif::clp-> {wsi} = $wslp;
            $Awfif::clp-> {strategy} = "descscout"; #descscout
            &Awfif::submitcodelet ('',\$Awfif::clp);
            $Awfif::clp = ();
            $Awfif::clp-> {urgency} = $Awfif::memes-> {buscu};
            $Awfif::clp-> {wsi} = $wslp;
            $Awfif::clp-> {strategy} = "bondscout";
            &Awfif::submitcodelet ('',\$Awfif::clp);
            };#if
          $Awfif::clp = ();
          $Awfif::clp-> {urgency} = $Awfif::memes-> {buscu};
          $Awfif::clp-> {wsi} = $wslp;
          $Awfif::clp-> {strategy} = "groupscout";
          &Awfif::submitcodelet ('',\$Awfif::clp);
          };#if

        $iwait = int((int ($wait/$Awfif::memes-> {mmratio}))*$Awfif::memes-> {mmratio});
        if ($wait == $iwait) {
          $Awfif::clp = ();
          $Awfif::clp-> {urgency} = $Awfif::memes-> {bumscu};
          $Awfif::clp-> {wsi} = $wslp;
          $Awfif::clp-> {strategy} = "partscout";
          &Awfif::submitcodelet ('',\$Awfif::clp);
          $Awfif::clp = ();
          $Awfif::clp-> {urgency} = $Awfif::memes-> {bumscu};
          $Awfif::clp-> {wsi} = $wslp;
          $Awfif::clp-> {strategy} = "statementscout";
          &Awfif::submitcodelet ('',\$Awfif::clp);
          };#if

        $iwait = int((int ($Awfif::memes-> {drwait}/$Awfif::memes-> {dmratio}))*$Awfif::memes-> {dmratio});
        if ($Awfif::memes-> {drwait} == $iwait) {
          $Awfif::clp = ();
          $Awfif::clp-> {urgency} = $Awfif::memes-> {budestscu};
          $Awfif::clp-> {wsi} = $wslp;
          $Awfif::clp-> {strategy} = "destructionscout";
          &Awfif::submitcodelet ('',\$Awfif::clp);
          };#if
        };#greater than bond threshold
# else top down mechanisms should do the submission
      };#active workspace
      $wslp = $Awfif::wsbl->{l}[$wslp][0];
      };#while each active workspace
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("crsubmitcodeletsx \n");
      };
    } #crsubmitcodelets
#
#<!-- start tag inh -->
#
sub icdsubmitcodelet {
    my ($myli, $clp, $inhibh, $grkwp, $grkwpr, $sactset) = @_;
#
    my ($newli);
# create an active codelet preserving rework count
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("icdsubmitcodelet myli $myli inhibh ($inhibh) grkwp $grkwp grkwpr $grkwpr ");
      };
# is there any active competitive inhibitor for this operon in which case run it. It will launch the action scout when inhibition ends

    if ($inhibh ne '') {

      my ($icpt, $found, $noinhibition, $linkp, $ilinkp);
      &copyclp ($myli, \$$clp, \@{$Awfif::inhibl-> {clpa}}, $inhibh);
      $ilinkp = $inhibh;
      $found = '';
      while (($ilinkp != 0) && (!$found)) {
        $icpt = $Awfif::inhibl-> {l} [$ilinkp] [2];
        $linkp = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnl}[$icpt];

        while (($linkp != 0) && (!$found)) {
          if (($Awfif::slipnet-> {l}[$linkp][3] == $Awfif::memes-> {snnh}{inhibitor})
          && (defined($Awfif::memes-> {binds}-> {$Awfif::memes->{snnih}{$Awfif::slipnet-> {l} [$linkp][2]}}))) {#can launch the real routine

            my ($jhls);
            $jhls = $$clp-> {action}-> {jhlabeloi};
            $found = 't';
            $Awfif::codelet-> {l} [$myli] [24] = $ilinkp;
            &ucsehist ($Awfif::memes->{snnih}{$Awfif::slipnet-> {l} [$linkp][2]});
            no strict 'refs';
            $noinhibition = $Awfif::memes-> {binds}-> {$Awfif::memes->{snnih}{$Awfif::slipnet-> {l} [$linkp][2]}}-> ($myli, \$grkwp, $grkwpr, \@$sactset);
            if (!$noinhibition) {

              $Awfif::jhls-> {l} [$jhls] [14] [2] --;#get rid of the record of this dummy cdsubmit
              };
            }
          $linkp = $Awfif::slipnet-> {l} [$linkp] [0];
          };#while
        $ilinkp = $Awfif::inhibl-> {l} [$ilinkp] [0];
        };#while
      if ((!$found)) {#failed so submit the codelet
        &cdsubmitcodelet ($myli, \$$clp);
        $Awfif::inhibl-> {clpa} [ $inhibh] = ();
        }#if not found
      elsif (($noinhibition)) {
        };#else
      }# of inhibitor control
    else {


    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::codelet-> {l} [$newli][14];
      print ("icdsubmitcodeletx rework $pr\n");
      };
    }#icdsubmitcodelet
#
#
#<!-- start tag scc -->
#<!-- start tag uts -->
#<!-- start tag sia -->
#<!-- start tag ds -resweb -->
#<!-- start tag vbt -->
#
sub freecodelet {
    my ($codelet, $mode, $rcantd) = @_;
    my ($plink, $tt, $h, $f, $cantd, $ws, $cwsbi, $bcindex, $transmgd, $doremarrent, $response, $ctype);
#
# move the codelet datastructure to the inactive list
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $codelet;
      print ("freecodelet codelet $pr ");
      $pr = $Awfif::codelet-> {l} [$codelet] [19];
      print ("ws($pr) mode ($mode)\n");
      };
    $response = 1;#can keep deleting
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if
# break if codelet matches breakcodelet
    if ( (($bcindex = matchbreakcodelet ($codelet)) > 0)
    && (($mode != 1) #this has been run
    or ($Awfif::codelet-> {l} [$codelet][23] == 0)
    or ( ($Awfif::codelet-> {l} [$codelet][23] != 0) && ($Awfif::memes-> {snw} [$ws]-> {snna} {$Awfif::memes-> {snnih} {$Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet] [23]] [6]}} > $Awfif::memes-> {killth}) ) )
    ){

      break ();
      $doremarrent = $bcindex;
      };#if
    $Awfif::memes-> {listrelinking} = 't';
    $ctype = $Awfif::codelet-> {t} [$codelet];
# freectmu1
# note if codelet is transaction managed
    if ($Awfif::codelet->{l} [$codelet] [37] > 0) {

      $transmgd = 't';
      }#if
    else {

      $transmgd = '';
      };#else
# handle codelets that can't be deleted due to activation or inhibition
# freecmdfup4

      if ((defined ($Awfif::memes-> {usetdfmod}))
      && ($Awfif::memes-> {usetdfmod})
      && ((!defined ($mode)) or ($mode != 1)) #failed to run
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgroupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tmodelscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnuclabmscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnsdepscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgoalscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'goalevaluator')
      ){#update transactional deployment failures

        if ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        && ($Awfif::codelet-> {l} [$codelet][36] > 0)
        ){#update transactional deployment failures

          if ($Awfif::subpl-> {q} [1] [ $Awfif::codelet-> {l} [$codelet][36] ] < $Awfif::memes-> {freeampth}) {
            $Awfif::subpl-> {q} [1] [ $Awfif::codelet-> {l} [$codelet][36] ]++;
            }#if
          else {

            if ( (defined ($Awfif::memes-> {freecabreak}))
            && ($Awfif::memes-> {freecabreak} )
            ){

              &break();
              };#if
            $Awfif::subpl-> {q} [1] [ $Awfif::codelet-> {l} [$codelet][36] ] = 0;
            $Awfif::subpl-> {q} [0] [ $Awfif::codelet-> {l} [$codelet][36] ] ++;
            };#else
          }#if
        elsif ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        ){

          $Awfif::memes-> {mainco} = $Awfif::memes-> {mainco} + 1;
          };#elsif
        }#if

      my ($nlink);
# freecmtailup1
      if (($Awfif::codelet->{l} [$codelet] [34] == 0)
      && (($codelet != $Awfif::memes-> {codeleth})
      or ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth}))) {# move to head
        if ($codelet == $Awfif::memes-> {codelett}) {#tail so special move

          $nlink = $Awfif::codelet-> {l} [$codelet][1];#nearer the head
          $Awfif::codelet-> {l} [$codelet][0] = $Awfif::memes->{codeleth};
          $Awfif::codelet-> {l} [$Awfif::memes->{codeleth}][1] = $codelet;
          $Awfif::memes->{codeleth} = $codelet;
          $Awfif::codelet-> {l} [$codelet][1] = 0;
          $Awfif::memes-> {codelett} = $nlink;
          $Awfif::codelet-> {l} [$nlink][0] = 0;
          }#if
        else {

          $plink = $Awfif::codelet-> {l} [$codelet][0];#towards the tail
          $nlink = $Awfif::codelet-> {l} [$codelet][1];#nearer the head
          $Awfif::codelet-> {l} [$codelet][0] = $Awfif::memes->{codeleth};
          $Awfif::codelet-> {l} [$Awfif::memes->{codeleth}][1] = $codelet;
          $Awfif::memes->{codeleth} = $codelet;
          $Awfif::codelet-> {l} [$codelet][1] = 0;
          $Awfif::codelet-> {l} [$plink][1] = $nlink;
          $Awfif::codelet-> {l} [$nlink][0] = $plink;
          };#else general move
        }# if can move
# frees34tup1
      elsif ( ($Awfif::codelet->{l} [$codelet] [34] != 0)
      && ($codelet == $Awfif::memes-> {codelett})
      && (freeswitch34tail ($codelet, $mode))
      ){

        my ($ltail);
        $ltail = $Awfif::memes-> {codelett};
        if ((freescheckcantd ($ltail)) ){

          if (($Awfif::memes-> {freectcantdbreak}) ){ &break ()};
          $response = 0;#stop delete or will just loop
          }#if
        else {

          $response = -1;
          };#else
        }#elsif
      else {

        $response = 0;#should stop trying to delete as waste of time
        };#else failed to move undeletable tail
      }#$cantd
    else {
# freecmdfup1

      if ((defined ($Awfif::memes-> {usetdfmod}))
      && ($Awfif::memes-> {usetdfmod})
      && ((!defined ($mode)) or ($mode != 1)) #failed to run
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgroupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tmodelscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnuclabmscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnsdepscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgoalscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'goalevaluator')
      ){#update transactional deployment failures

        if ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        && ($Awfif::codelet-> {l} [$codelet][36] > 0)
        ){#update transactional deployment failures

          $Awfif::subpl-> {q} [0] [ $Awfif::codelet-> {l} [$codelet][36] ]++;
          }#if
# freecmdfup2
        elsif ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        ){

          $Awfif::memes-> {mainco} = $Awfif::memes-> {mainco} + $Awfif::memes-> {maininc};
          };#elsif
        }#if
      elsif ((defined ($Awfif::memes-> {usetdfmod}))
      && ($Awfif::memes-> {usetdfmod})
      && ($mode == 1) #codelet has run
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgroupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'groupbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tmodelscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'modelbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnuclabmscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nuclabmbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tnsdepscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepevaluator')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'nsdepbuilder')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'tgoalscout')
      && ($Awfif::codelet-> {l} [$codelet][2] ne 'goalevaluator')
      ){

        if ( ($Awfif::codelet-> {l} [$codelet][35] > 0)
        && ($Awfif::codelet-> {l} [$codelet][36] == 0)
        && ($Awfif::memes-> {mainco} > 0)
        ){#update transactional deployment failures
# freecmdfup3

          $Awfif::memes-> {mainco} --;
          }#if
        };#elsif
      &trackcodelet ($codelet, $codelet, $Awfif::memes-> {snnh} {free}, $mode);
# freecfbu1

      if (($ctype == $Awfif::memes-> {snnh} {active})
      && ($Awfif::codelet-> {l} [$codelet] [2] eq 'groupbuilder')
      ){

        &freefb ($codelet);
        };#if its a free from the active list
# freecupoolup1
      if ($Awfif::codelet-> {l} [$codelet] [38] > 0) {#remove the initial pool reference

        my ($i, $found, $linki);
        $found = '';
        for ($i = 0;((!$found) && ($i < $Awfif::memes-> {totup})); $i++){#use head reference to check the list of elements for a match
          $linki = $Awfif::subpl-> {q} [3] [$i] [$Awfif::codelet-> {l} [$codelet] [36] ];#linki is an index into $Awfif::poolcl-> {l} list
          while (($linki != 0 ) && (!$found)){
            if ($Awfif::poolcl-> {l} [$linki ][2] == $codelet){#found this codelet

              if ((defined ($Awfif::memes-> {freecupoolb})) && ($Awfif::memes-> {freecupoolb} == $Awfif::codelet-> {l} [$codelet] [36]) ){

                &break ();
                };#if
              $found = 't';
              $Awfif::subpl-> {q} [3] [$i] [$Awfif::codelet-> {l} [$codelet] [36] ] = freepoolc ($linki);
              }#if
            else {

              $linki = $Awfif::poolcl-> {l} [$linki ][0];
              };#
            };#while
          };#for
        $Awfif::codelet-> {l} [$codelet] [38] = 0;
        };#if
      if ($doremarrent > 0) {

        &remarrent ($doremarrent, \@{$Awfif::memes-> {breakcodelet}});
        &remarrent ($doremarrent, \@{$Awfif::memes-> {breaksubp}});
        };#if
# freecjhlsoiup2
      if (($Awfif::codelet-> {l} [$codelet][30] != 0)
      && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet][30]] [14] [2] > 0)
      ) {

        $Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet][30]] [14] [2] --;
        };#if
      &transmgr (undef(), $codelet, $Awfif::memes-> {snnh} {end}, $Awfif::memes-> {snnh} {indequiv});
# freecjhlsoiup3
      my ($sgdi, $gsponsor, $telni, $dcount, $dtelcount, $atelni, $ntelni, $transmgrid, $currentwsbi);

      $cwsbi = $Awfif::memes-> {currentwsbi};
      if (($Awfif::codelet-> {l} [$codelet][19] > 0)
      && ($Awfif::codelet-> {l} [$codelet][19] != $Awfif::codelet-> {l} [$codelet][20])
      ){

        $currentwsbi = $Awfif::codelet-> {l} [$codelet][19];
        }#if
      else {

        $currentwsbi = $Awfif::codelet-> {l} [$codelet][20];
        };#else
      $dcount = 0;
      $dtelcount = 0;
      if (($Awfif::codelet-> {l} [$codelet][37] > 0)
      ){

        $transmgrid = $Awfif::codelet-> {l} [$codelet][37];
        };
      $Awfif::codelet-> {l} [$codelet][32] = 0; #don't leave tfree floating in the free codelets
      if (($Awfif::codelet-> {l} [$codelet][30] != 0)
      && ($Awfif::jhls-> {l} [$Awfif::codelet-> {l} [$codelet][30]] [14] [2] <= 0)
      && (($Awfif::memes-> {currentwsbi} = $currentwsbi) != 0)
# and this codelets sponsoring wso has group complete set
      && (fgrpd ($codelet, $Awfif::codelet-> {l} [$codelet][21], \$sgdi, $Awfif::memes->{snnh}{groupcategory}))
      && (($gsponsor = fgrpsponsor ($Awfif::codelet-> {l} [$codelet][21], $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory})) != 0)
      && (gcompleted ($gsponsor, $transmgrid))
      && (($telni = trwsoadr ($gsponsor, -1)) != 0)
      && (($ntelni = $telni) != 0)
# and is telomeric
      && (istelwso (\$ntelni, \$dcount, \$dtelcount))
# freectmu2
      && (!$transmgd)
      ) {
# write a destruction ok descriptor

        $atelni = awsoadr ($telni);
        $Awfif::wsol-> {l} [$atelni][2]
          = setupdesc ( $Awfif::memes-> {snnh} {destroyok},
              ($Awfif::memes-> {snnh} {wsi} + $Awfif::codelet-> {l} [$codelet] [30]),
              $Awfif::memes-> {snnh} {telomere},
              $Awfif::wsol-> {l} [$atelni][2],
              $atelni);
        };#if
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      &countcdel ($codelet, $mode);# count the deletion
# get the current free head

      $tt = $Awfif::memes-> {codelett};
      $h = $Awfif::memes-> {codeleth};
      $f = $Awfif::memes-> {codeletf};
      &mactcodelettolist ($codelet, 't', $f);

      $tt = $Awfif::memes-> {codelett};
      $h = $Awfif::memes-> {codeleth};
      $f = $Awfif::memes-> {codeletf};
      };#can delete
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references
    if ( ($Awfif::codelet-> {t} [$codelet] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$codelet] [2]))
    ){

      break ();
      }#if
    if (defined ($$rcantd)){

      $$rcantd = $cantd;
      };#if
    $Awfif::memes-> {listrelinking} = '';
    return $response
    }#freecodelet
#
#<!-- end tag ds -->
#<!-- start tag scc -->
#<!-- start tag aso -->
#
sub mactcodelettolist {
    my ($codelet, $tofree, $oldhead, $type) = @_;
    my ($pflink, $plink, $pt, $ph, $cstate);
#
# move an active codelet datastructure to another list - if old head is not free list then reply is the new head value
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $codelet;
      print ("mactcodelettolist codelet $pr ");
      $pr = $Awfif::codelet-> {l} [$codelet] [19];
      print ("ws($pr)");
      $pr = $Awfif::memes-> {snnih} {$Awfif::codelet-> {t} [$codelet]};
      print ("-$pr");
      $pr = $Awfif::memes-> {acodelets};
      print ("as($pr)");
      };
    $cstate = $Awfif::codelet-> {t} [$codelet];
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
    or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

      &break ();
      };# check for circular references
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if
# get the current free head

    $pflink = $oldhead;
    if ( ( (($tofree) or (!defined ($oldhead)) or (($oldhead == $Awfif::memes-> {codeletf}) && ($oldhead != 0))) && ($Awfif::codelet-> {t} [$codelet] == $Awfif::memes-> {snnh} {free}))
    or ( ((($oldhead == $Awfif::memes-> {codeletdef}) && ($oldhead != 0)) or ($type == $Awfif::memes-> {snnh} {deferred})) && ($Awfif::codelet-> {t} [$codelet] == $Awfif::memes-> {snnh} {deferred}))
    or ( ((($oldhead == $Awfif::memes-> {codeletw}) && ($oldhead != 0)) or ($type == $Awfif::memes-> {snnh} {wait})) && ($Awfif::codelet-> {t} [$codelet] == $Awfif::memes-> {snnh} {wait}))
    ){#don't move its already in the desired queue
      }#if
    elsif ($codelet != 0 ) {

      $pt = $Awfif::memes-> {codelett};
      $ph = $Awfif::memes-> {codeleth};

      if ( (($tofree) or (!defined ($oldhead)) or (($oldhead == $Awfif::memes-> {codeletf}) && ($oldhead != 0)) ) ){
        $Awfif::codelet-> {t} [$codelet] = $Awfif::memes-> {snnh} {free};
        }#if
      elsif ( ((($oldhead == $Awfif::memes-> {codeletdef}) && ($oldhead != 0)) or ($type == $Awfif::memes-> {snnh} {deferred})) ){
        $Awfif::codelet-> {t} [$codelet] = $Awfif::memes-> {snnh} {deferred};
        }#elsif
      elsif ( ((($oldhead == $Awfif::memes-> {codeletw}) && ($oldhead != 0)) or ($type == $Awfif::memes-> {snnh} {wait})) ){
        $Awfif::codelet-> {t} [$codelet] = $Awfif::memes-> {snnh} {wait};
        };#elsif
      if ($cstate == $Awfif::memes-> {snnh} {active}) {
        $Awfif::memes-> {acodelets}--;
        };#if
      if ($tofree) {
# can reclaim it to the inactive list

        $Awfif::memes-> {fcodelets}++;
        }#freeing codelet
      else {
# this is no longer directly active so better remove it from the active count

        $Awfif::memes-> {tcodeletmax}++;
        };#else
# link its neighbours together
      $plink = $Awfif::codelet-> {l} [$codelet][0];
      if (($plink != 0)
      && ($codelet == $pt)
      ){#tail but has tail link - corrupt

        &break ();
        };#if
      if ($plink != 0) {

        if ($Awfif::codelet-> {l} [$codelet][1] == 0) {
# This is a head sentinal relink head
# did check if the $oldhead == codeleth but that makes no sense

          if (($codelet == $Awfif::memes-> {codeleth})
          && ($tofree)
          ){

            $Awfif::memes-> {codeleth} = $plink;
            };
          $Awfif::codelet-> {l} [$plink ][1] = 0;
          }
        else {# normal case - not either sentinal

          $Awfif::codelet-> {l} [$plink ][1] =
            $Awfif::codelet-> {l} [$codelet][1];
          $Awfif::codelet-> {l} [$Awfif::codelet-> {l} [$codelet][1] ][0] =
            $Awfif::codelet-> {l} [$codelet][0];
          };
        }#if
      else {
# this is a tail sentinal

        if ($Awfif::codelet-> {l} [$codelet][1] == 0) {
# This is a head sentinal as well relink head
# did check if the $oldhead == codeleth but that makes no sense

          if (($codelet == $Awfif::memes-> {codeleth})
          && ($tofree)
          ){

            $Awfif::memes-> {codeleth} = $plink;
            };#if
          }#if
        else {# just tail sentinal
# did check if the $oldhead == codeleth but that makes no sense

          if (($codelet == $pt)
          && ($tofree)
          ){

            $Awfif::memes-> {codelett} = $Awfif::codelet-> {l} [$codelet][1];
            };#if
          $Awfif::codelet-> {l} [$Awfif::codelet-> {l} [$codelet][1] ][0] = 0;
          };#else
        };#else
# relink this to become the head of the inactive list
      if ($tofree) {

        $Awfif::codelet-> {l} [$codelet] [1] = 0; #sentinal
        $Awfif::codelet-> {l} [$codelet] [0] = $pflink;
        if ($pflink != 0) {

          $Awfif::codelet-> {l} [$pflink][1] = $codelet;
          };# if
        $Awfif::codelet-> {l} [$codelet] [2] = 0;
        $Awfif::codelet-> {l} [$codelet] [3] = 0;
        $Awfif::memes-> {codeletf} = $codelet;
        }#if
      else {

        $Awfif::codelet-> {l} [$codelet] [1] = 0; #sentinal
        $Awfif::codelet-> {l} [$codelet] [0] = $oldhead;
        if ($oldhead != 0) {

          $Awfif::codelet-> {l} [$oldhead][1] = $codelet;
          };# if
        };#else
      };# ok to relink

    if (($codelet == $Awfif::memes-> {codeleth})
    && ($codelet == $Awfif::memes-> {codelett})
    ){

      &break ();
      };#if
    if ((defined ($Awfif::codelet-> {l} [0] [1]))
    ){

      &break ();
      };#if
    if ( (($codelet > 0) && ($Awfif::codelet-> {l} [$codelet][0] == $codelet))
    or (($codelet > 0) && ($Awfif::codelet-> {l} [$Awfif::codelet-> {l} [$codelet][1] ][1] == $codelet)) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
    or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references
    if ( ($Awfif::codelet-> {t} [$codelet] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$codelet] [2]))
    ){

      break ();
      }#if
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      print ("mactcodelettolistx ");
      $pr = $Awfif::memes-> {acodelets};
      print ("as($pr) ret($codelet)\n");
      };
    return $codelet
    }#mactcodelettolist
#
#<!-- end tag vbt -->
#<!-- end tag uts -->
#<!-- end tag inh -->
#
sub mhcodelettoactltail {
    my ($codelet) = @_;
    my ($ot, $oh, $pc, $nc);
#
# move a grabbed codelet datastructure to the tail of the active list
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $codelet;
      print ("mhcodelettoactltail codelet $pr ");
      $pr = $Awfif::codelet-> {l} [$codelet] [19];
      print ("ws($pr)\n");
      };
    $pc = 0;
    if ($codelet != 0 ) {

      $oh = $Awfif::memes-> {codeleth};
      $ot = $Awfif::memes-> {codelett};
      $pc = $Awfif::codelet-> {l} [$codelet][0];
      $nc = $Awfif::codelet-> {l} [$codelet][1];
      $Awfif::memes-> {codelett} = $codelet;
# check if the active list head must be altered
      if ($Awfif::memes-> {codeleth} == 0) {

        $Awfif::memes-> {codeleth} = $codelet;
        };
      if ($Awfif::codelet-> {t} [$codelet] != $Awfif::memes-> {snnh} {active}) {

        $Awfif::memes-> {acodelets}++;
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        };#if
      $Awfif::codelet-> {t} [$codelet] = $Awfif::memes-> {snnh} {active};
# relink the codelets previous partners
      if ($pc != 0) {

        $Awfif::codelet-> {l} [$pc][1] = $nc;
        };
      if ($nc != 0) {

        $Awfif::codelet-> {l} [$nc][0] = $pc;
        };
# link the codelet in at the tail of the active list
      $Awfif::codelet-> {l} [$codelet][0] = 0;
      if ($ot == 0) {
# This is a head sentinal

        $Awfif::codelet-> {l} [$codelet][1] = 0;
        }#if
      else {# make the link

        $Awfif::codelet-> {l} [$codelet][1] = $ot;
        $Awfif::codelet-> {l} [$ot][0] = $codelet;
        };#else
      };# ok to relink
    if ( (($ot > 0) && ($Awfif::codelet-> {l} [$ot][0] == $ot)) or (($codelet > 0) && ($Awfif::codelet-> {l} [$codelet][0] == $codelet)) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
    or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

      &break ();
      };# check for circular references
    if ( (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][0] == 0))
    && (($Awfif::memes-> {codelett} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codelett}][1] == 0))
    && ($Awfif::memes-> {codelett} != $Awfif::memes-> {codeleth})
    ){

      &break ();
      };# check for circular references

    return $pc
    }#mhcodelettoactltail
#
#<!-- end tag aso -->
#<!-- start tag vbt -->
#
sub mdefscodelettolist {
    my ($oldhead, $singleton) = @_;

#
sub mdefhcodelettolist {
    my ($oldhead, $singleton) = @_;#index of the head of the list to move too
    my ($plink, $ph);
#
# move deferred head codelet datastructure to another list - if old head is not free list then reply is the new head value
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("mdefhcodelettolist oldhead($oldhead) ");
      if (defined ($singleton)){
        print ("singleton($singleton) ");
        };#if
      print ("\n");
      };

    if (defined ($singleton) ){
      $ph = $singleton;
      }#if
    else {
      $ph = $Awfif::memes-> {codeletdef};
      };#else

    if ( (defined ($singleton))
    or ($Awfif::memes-> {codeletdef} > 0)
    ){#worth doing the move

      if ($Awfif::codelet-> {t} [$ph] != $Awfif::memes-> {snnh}{deferred}) {&break ();};
      if ((defined ($singleton))
      && ($Awfif::codelet-> {l} [$ph] [0] == 0)
      && ($Awfif::codelet-> {l} [$ph] [1] == 0)
      ){#no relinking needed

        }#if
      elsif ((defined ($singleton)) ){

        &break ();#singleton had friends
        }#elsif
      else {#standard deferred
# link its neighbours together

        $plink = $Awfif::codelet-> {l} [$ph][0];
        $Awfif::memes-> {codeletdef} = $plink;
        if ($plink != 0) {

          if ($Awfif::codelet-> {l} [$ph][1] == 0) {
# This is a head sentinal relink head
            $Awfif::codelet-> {l} [$plink ][1] = 0;
            }
          else {# normal case - not either sentinal

            &break();#should not occur since we are working with codeletdef
            };
          }#if plink non 0
        else {#codeletdef was singleton

# this is a tail sentinal
          if ($Awfif::codelet-> {l} [$ph][1] != 0) {

            &break();#should not occur since we are working with codeletdef
            };#if
          };#else
        };#else
# relink this to become the head of the oldhead list

      $Awfif::codelet-> {l} [$ph] [1] = 0; #sentinal
      $Awfif::codelet-> {l} [$ph] [0] = $oldhead;

      if ((defined ($singleton)) && ($Awfif::codelet-> {l} [$ph] [0] == 0)) { &break ();};
      if ($oldhead != 0) {

        $Awfif::codelet-> {l} [$oldhead][1] = $ph;
        };# if

      if ( (($ph > 0) && ($Awfif::codelet-> {l} [$ph][0] == $ph))
      or (($ph > 0) && ($Awfif::codelet-> {l} [$Awfif::codelet-> {l} [$ph][1] ][1] == $ph)) ) {

        &break ();
        };# check for circular references
      if ( (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][0] == $Awfif::memes-> {codeletpt}))
      or (($Awfif::memes-> {codeletpt} > 0) && ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletpt}][1] == $Awfif::memes-> {codeletpt})) ) {

        &break ();
        };# check for circular references
      };#if codelet to move
    if ( ( ($singleton > 0)
    && ($Awfif::codelet-> {t} [$singleton] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$singleton] [2])) )
    or ( ($Awfif::memes-> {codeletdef} > 0)
    && ($Awfif::codelet-> {t} [$Awfif::memes-> {codeletdef}] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletdef}] [2])) )
    ){

      break ();
      }#if

    if ((defined ($singleton)) && ($Awfif::codelet-> {l} [$ph] [0] == 0) && ($Awfif::codelet-> {l} [$ph] [1] == 0)) { &break ();};
    return $ph
    }#mdefhcodelettolist
#
#<!-- end tag vbt -->
#<!-- end tag sia -->
#
sub newdescl {
    my ($dlinkh) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($link);
#
# checked for merged workspaces

    $link = newlink ($dlinkh, \$Awfif::workspace);
    return $link;
    }#newdescl
#
#<!-- start tag ds -resweb -->
#<!-- start tag inh -->
#<!-- start tag phe -->
#<!-- start tag vbt -->
#
sub setupdesc {
    my ($ltype, $to, $from, $dlinkh, $awso, $synccod) = @_;# must be the workspace head's index for this descriptor list or 0

# create an active descriptor
#
# checked for merged workspaces
    my ($ndlinkh);
# setupdescuf

    $Awfif::wsolfbs [$awso] [23 - $Awfif::memes-> {flagsoffset}] = 2;
    $Awfif::wsolfbs [$awso] [24 - $Awfif::memes-> {flagsoffset}] = 2;
    if (($Awfif::wsolfbs [$awso] [25 - $Awfif::memes-> {flagsoffset}]) != 3) {

      $Awfif::wsolfbs [$awso] [25 - $Awfif::memes-> {flagsoffset}] = 2;
      };
    $Awfif::wsolfbs [$awso] [27 - $Awfif::memes-> {flagsoffset}] = 2;
    $Awfif::wsolfbs [$awso] [28 - $Awfif::memes-> {flagsoffset}] = 2;
    $ndlinkh = addhli ($dlinkh, \$Awfif::workspace);
# setup the links data
    $Awfif::workspace-> {l} [$ndlinkh][2] = $to;
    $Awfif::workspace-> {l} [$ndlinkh][3] = $ltype;
    $Awfif::workspace-> {l} [$ndlinkh][4] = $from;
# setupdsyncu1
    &isetupsync ($ltype, $to, $from, $awso, $synccod);
# setupdsyncu2
# setupdsyncu3
# setupd34u2
# setupdsyncu4
## inverted in isetupsync
    return $ndlinkh
    }# setupdesc
#
sub isetupsync {
    my ($ltype, $to, $from, $awso, $synccod) = @_;# must be the workspace head's index for this descriptor list or 0

    if ((defined ($synccod))
    && ($synccod)
    && ((defined ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}])) && ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] > 0))
    ) {
# isetupdsyncu2

      my ($linki, $found);
      $found = 0;
      $linki = $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}];

      while (($found == 0) && ($linki != 0)) {
        if (($Awfif::syncl-> {l} [$linki] [2] == $to)
        && ($Awfif::syncl-> {l} [$linki] [3] == $ltype)
        && ($Awfif::syncl-> {l} [$linki] [4] == $from)
        ){

          $found = $linki;
          };#if
        $linki = $Awfif::syncl-> {l} [$linki] [0];
        };#while
# isetupdsyncu3
# Move codelet's from the sublist associated with the specific descriptor to the active list.
      if ($found != 0) {

        $linki = $Awfif::syncl-> {l} [$found] [5];# index of synccodl element
# isetupd34u2

        &ilwaiting ($linki, 't', \$Awfif::syncl-> {l} [$found] [5], \$Awfif::syncl-> {l} [$found] [6]);#
# isetupdsyncu4
## inverted in ilwaiting
        };#if
      };#if
    }# isetupsync
#
#<!-- end tag vbt -->
#<!-- end tag phe -->
#<!-- end tag ds -->
#
sub isetupdescc {
    my ($awso) = @_;# must be the workspace head's index for this descriptor list or 0

# set the wso cache for addition of an active descriptor

    &setwsbf ($awso, 23, 2);
    &setwsbf ($awso, 24, 2);
# isetupdescu253
    if (checkwsbf ( $awso, 25) != 3) {
      &setwsbf ($awso, 25, 2);
      };#if
    &setwsbf ($awso, 27, 2);
    &setwsbf ($awso, 28, 2);
    }# isetupdescc
#
#<!-- end tag inh -->
#<!-- start tag ds -resweb -->
#<!-- start tag sca -->
#
sub setupframe {
    my ($ltype, $to, $from, $dlinkh, $awso) = @_;# must be the workspace head's index for this descriptor list or 0

# if the frame descriptor exists in the ws:wso defined and frame ref [2] is initialised to 0 then initialise the frame array for use, set descriptor [2] to 1 and set descriptor [3] to 0 (so will be sentinal for addframe)
#
# checked for merged workspaces
    my ($ndlinkh, $dlinki);
    $ndlinkh = 0;
    if ( ((findtdesc ($dlinkh, $from)) == 0) ){

      $dlinki
      = setupdesc ( 0,
          0, #indicates no frame in use yet
          $from,
          $dlinkh,
          $awso);
      $Awfif::workspace-> {l} [$dlinki] [2] = 0;
      $Awfif::workspace-> {l} [$dlinki] [3] = 0;
      &addframe ($dlinki, $ltype, $to);
      }#if
    else {

      $dlinki = $dlinkh;
      };#else
    return $dlinki
    }# setupframe
#
sub addframe {
    my ($framedi, $ltype, $to) = @_;
# setup the structures to support linked frames
    my ($nslinkh);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr2, $pr3);
      $pr2 = $Awfif::workspace-> {l} [$framedi] [2];
      $pr3 = $Awfif::workspace-> {l} [$framedi] [3];
      print ("addframe framedi($framedi)->2[$pr2]3[$pr3] ltype($ltype) to($to) ");
      };
# create an active descriptor
    $nslinkh = addhli ($Awfif::workspace-> {l} [$framedi] [3], \$Awfif::framel);
    $Awfif::workspace-> {l} [$framedi] [2]++;
    $Awfif::workspace-> {l} [$framedi] [3] = $nslinkh;
    $Awfif::framel-> {l} [$nslinkh][2] = $to;
    $Awfif::framel-> {l} [$nslinkh][3] = $ltype;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("addframex ret $nslinkh\n");
      };

    return $nslinkh
    }# addframe
#
sub freeframe {
    my ($framedi) = @_;
#
# checked for merged workspaces

# move the codelet datastructure to the inactive list
    my ($framei);
    $Awfif::workspace-> {l} [$framedi] [3] = freehli (($framei = $Awfif::workspace-> {l} [$framedi] [3]), \$Awfif::framel);#slipnet cache manager coordinates the head of the list
    $Awfif::workspace-> {l} [$framedi] [2]--;
    $Awfif::framel-> {l} [$framei] [2] = 0;
    $Awfif::framel-> {l} [$framei] [3] = 0;
    $Awfif::framel-> {l} [$framei] [14] = ();
    $Awfif::framel-> {l} [$framei] [15] = ();
    return $Awfif::workspace-> {l} [$framedi] [3]
    }#freeframe
#
#<!-- end tag sca -->
#<!-- start tag al -resweb -->
#
sub addifb {
    my ($myli, $strategy, $sarraylength, $sarray, $biceid, $subp, $stws, $srws, $erws) = @_;

# create an active ifindb cache element
#
# checked for merged workspaces
    my ($ndlinkh);

    $ndlinkh = iaddifb ($myli, $strategy, $sarraylength, \@$sarray, $biceid, $subp, \$Awfif::ifbhcl, $stws, $srws, $erws);

    return $ndlinkh
    }# addifb
#
sub iaddifb {
    my ($myli, $strategy, $sarraylength, $sarray, $biceid, $subp, $larrayref, $stws, $srws, $erws) = @_;

# create an active ifindb/ilaunchnc cache element
#
# checked for merged workspaces
    my ($ndlinkh, $hchain, $i);

    $ndlinkh = 0;
    $ndlinkh = igetifb ($myli, $strategy, $sarraylength, \@$sarray, \$hchain, $subp, \$$larrayref, $stws, $srws, $erws);
    if ($ndlinkh == 0) {

      $ndlinkh = addhli ($hchain, \$$larrayref);
# setup the links data
      $$larrayref-> {l} [$ndlinkh][2] = $sarraylength;
      for ($i = 1; $i <= $sarraylength; $i++) {

        $$larrayref-> {l} [$ndlinkh][3][$i] = $$sarray[$i];
        };#for
      $$larrayref-> {l} [$ndlinkh][4] = $biceid;
# handle sub-program structures
      if ((defined ($subp)) && ($subp > 0) ) {

        $$larrayref-> {l} [$ndlinkh][5] = $subp;
        }#if
      elsif ((defined ($myli)) && ($Awfif::codelet-> {l} [$myli] [36] > 0)) {

        $$larrayref-> {l} [$ndlinkh][5] = $Awfif::codelet-> {l} [$myli] [36];
        }#elsif
      else {

        $$larrayref-> {l} [$ndlinkh][5] = 0;
        };#else
# handle specific workspace filter
      if ((defined ($stws)) && ($stws > 0) ) {

        $$larrayref-> {l} [$ndlinkh][6] = $stws;
        }#if
# handle relative workspace sequence filter
      if ((defined ($srws)) && ($srws > 0) && (defined ($erws)) && ($erws > 0)) {

        $$larrayref-> {l} [$ndlinkh][7] = $srws;
        $$larrayref-> {l} [$ndlinkh][8] = $erws;
        }#if

      $$larrayref-> {hc} {$strategy} = $ndlinkh;
      };#if

    return $ndlinkh
    }# iaddifb
#
sub addilab {
    my ($myli, $strategy, $sarraylength, $sarray, $biceid, $subp) = @_;
    my ($ndlinkh);

# create an active ilaunchnc cache element
#
    $ndlinkh = iaddifb ($myli, $strategy, $sarraylength, \@$sarray, $biceid, $subp, \$Awfif::ilabhcl);

    return $ndlinkh
    }# addilab
#
sub getifb {
    my ($myli, $strategy, $sarraylength, $sarray, $hchain, $subp, $stws, $srws, $erws) = @_;

# create an active ifindb cache element
#
# checked for merged workspaces
    my ($ndlinkh);

    $ndlinkh = igetifb ($myli, $strategy, $sarraylength, \@$sarray, \$$hchain, $subp, \$Awfif::ifbhcl, $stws, $srws, $erws);

    return $ndlinkh
    }# getifb
#
sub igetifb {
    my ($myli, $strategy, $sarraylength, $sarray, $hchain, $subp, $larrayref, $stws, $srws, $erws) = @_;

# create an active ifindb/ilaunchnc cache element
#
# checked for merged workspaces
    my ($nomatch, $linki, $ndlinkh, $i, $failed);

    $ndlinkh = 0;
    $nomatch = 't';
    $$hchain = 0;
    if (defined ($$larrayref-> {hc} {$strategy})) {# larrayref (ifbhcl/ ilabhcl) l 2 -> sarraylength, 3 -> sarray contents == strategy string to match, 4 -> biceid, 5 -> subpid, 6 -> stws, 7 -> srws, 8 -> erws

      $$hchain = $$larrayref-> {hc} {$strategy};
      $linki = $$hchain;
      while (($nomatch) && ($linki != 0)) {
        if ( ($$larrayref-> {l} [$linki][2] == $sarraylength)
        && ( (!defined ($stws)) or ( (defined ($stws)) && ($$larrayref-> {l} [$linki][6] == $stws) ) )
        && ( ( (defined ($subp)) && ($subp != 0) && ($$larrayref-> {l} [$linki][5] == $subp) )
          or ( (!defined ($subp)) && (defined ($myli)) && ($$larrayref-> {l} [$linki][5] == $Awfif::codelet-> {l} [$myli] [36]) && ($$larrayref-> {l} [$linki][5] != 0) )
          or ( (!defined ($subp)) && (defined ($myli)) && ($$larrayref-> {l} [$linki][5] == $Awfif::codelet-> {l} [$myli] [36]) && ($$larrayref-> {l} [$linki][5] == 0) ) )
        or ((!defined ($subp)) && (!defined ($myli)) && ($$larrayref-> {l} [$linki][5] == 0) )
        or (checkrhc ($sarraylength, $linki, $subp, \$$larrayref, $stws, $srws, $erws))
        ){

          $failed = '';
          for ($i = 1; (($i <= $sarraylength) && (!$failed)); $i++) {
            if ($$larrayref-> {l} [$linki][3][$i] != $$sarray[$i]) {

              $failed = 't';
              };
            };#for
          if (!$failed) {

            $ndlinkh = $linki;
            $nomatch = '';
            };#if
          };#if
        $linki = $$larrayref-> {l} [$linki][0];
        };#while
      };# if

    return $ndlinkh
    }# igetifb
#
sub getilab {
    my ($myli, $strategy, $sarraylength, $sarray, $hchain, $subp) = @_;
    my ($ndlinkh);

# get an active ilaunchnc cache element
#
    $ndlinkh = igetifb ($myli, $strategy, $sarraylength, \@$sarray, \$$hchain, $subp, \$Awfif::ilabhcl);

    return $ndlinkh
    }# getilab
#
sub checkrhc {
    my ($sarraylength, $linki, $subp, $larrayref, $stws, $srws, $erws) = @_;
    my ($found);

    $found = '';
# match relative hash chain entry
#
    if ( (defined ($srws)) && (defined ($erws))
    && ($$larrayref-> {l} [$linki][2] == $sarraylength)
    && ( (!defined ($stws)) )
    && ((!defined ($subp)) && ($$larrayref-> {l} [$linki][5] == 0) )
    && ( ($$larrayref-> {l} [$linki][7] == $srws) && ($$larrayref-> {l} [$linki][8] == $erws))
    ){

      $found = 't';
      };#if

    return $found
    }# checkrhc
#
sub relifindb {
    my ($myli, $larrayref, $srws, $erws) = @_;
    my ($found, $extdsc, $nucdsc, $stwso, $astwso);

    $found = '';
# if this ifindb is in a statement relative situation setup srws(external) and erws(nuclear)
#
    if ( (defined ($$srws)) && (defined ($$erws)) && ($Awfif::wsbl-> {relorabs} [ $Awfif::memes-> {currentwsbi} ] == $Awfif::memes-> {snnh} {relative}) && (defined ($astwso = $$larrayref-> {astwso} { $Awfif::memes-> {currentwsbi} }) ) && (defined ($nucdsc = $$larrayref-> {nuclear} {($astwso)}) ) && (defined ($extdsc = $$larrayref-> {external} {($astwso)}) )
    ){

      $found = 't';
      $$srws = $Awfif::workspace-> {l} [$extdsc] [2] - $Awfif::memes-> {snnh} {wsi};
      $$erws = $Awfif::workspace-> {l} [$nucdsc] [2] - $Awfif::memes-> {snnh} {wsi};
      }#if
    elsif ( (defined ($$srws)) && (defined ($$erws)) && ($Awfif::wsbl-> {relorabs} [ $Awfif::memes-> {currentwsbi} ] == $Awfif::memes-> {snnh} {relative})
    ){#its relative but the cache data is not setup so need to find the statement descriptors
# first find the statement wso

      $stwso = getnstatement ($myli, $Awfif::wsbl-> {wsot} [$Awfif::memes-> {currentwsbi}], $Awfif::memes-> {currentwsbi});
      $astwso = awsoadr ($stwso);
# then read the descriptors from the statement

      if ( ( ($nucdsc = findtdesc ($Awfif::wsol-> {l} [ $astwso] [2], $Awfif::memes-> {snnh} {membrane}, $Awfif::memes-> {snnh} {nuclear})) != 0 )#indicating that the nuclear membrane has been described
      && ( ($extdsc = findtdesc ($Awfif::wsol-> {l} [ $astwso] [2], $Awfif::memes-> {snnh} {membrane}, $Awfif::memes-> {snnh} {external})) != 0 )#indicating that the external membrane has been described
      ){
# then setup the cache elements and the return values

        $$larrayref-> {astwso} { $Awfif::memes-> {currentwsbi} } = $astwso;
        $$larrayref-> {nuclear} {($astwso)} = $nucdsc;
        $$larrayref-> {external} {($astwso)} = $extdsc;
        $found = 't';
        $$srws = $Awfif::workspace-> {l} [$extdsc] [2] - $Awfif::memes-> {snnh} {wsi};
        $$erws = $Awfif::workspace-> {l} [$nucdsc] [2] - $Awfif::memes-> {snnh} {wsi};
        }#if
      else {#not supposed to happen

        &break ();
        };#else
      }#elseif
    elsif ( (defined ($$srws)) && ($$srws == 0) && (defined ($$erws)) && ($$erws == 0) && ($Awfif::wsbl-> {relorabs} [ $Awfif::memes-> {currentwsbi} ] != $Awfif::memes-> {snnh} {relative}) #not a relative case so undefine the envelope parameters
    ){

      $$srws = undef ();
      $$erws = undef ();
      };#elsif

    return $found
    }# relifindb
#
#<!-- end tag al -->
#<!-- start tag aso -->
#
sub storeds {
    my ($myli, $p, $filestring) = @_;
    my ($result, $unlinked);

# store all key data sets to files for later resume
#
    use Storable qw (store);
    if (defined ($$p)) {

      $result = eval { store ($$p, $filestring)};
      if ($@){

        &break ();#serious error from storable
        print ("storeds myli $myli storable error($@)");
        }
      elsif (!defined ($result)) {

        &break ();#i/o error from storable
        print ("storeds myli $myli storable i/o error($!)");
        };#elsif
      }#if defined
# storedsunlinku1
    else {#unlink the file

      $unlinked = unlink ($filestring);
      };#else

    return $result
    }# storeds
#
sub storetofiles {
    my ($myli, $dirprefix) = @_;
    my ($result, $testfname, $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks);
# store all key data sets to files for later resume
#

    print ("storetofiles started\n");
    $Awfif::mapped-> {scalers} [0] = $Awfif::memes-> {codeleth};
    $Awfif::mapped-> {scalers} [1] = $Awfif::memes-> {codeletw};
    $Awfif::mapped-> {scalers} [2] = $Awfif::memes-> {codelett};
    $Awfif::mapped-> {scalers} [3] = $Awfif::memes-> {codeletf};
    $Awfif::mapped-> {scalers} [4] = $Awfif::codelet-> {p};
    $Awfif::mapped-> {scalers} [5] = $Awfif::wsbl-> {h};
    $Awfif::mapped-> {scalers} [6] = $Awfif::wsbl-> {t};
    $Awfif::mapped-> {scalers} [7] = $Awfif::wsbl-> {f};
    $Awfif::mapped-> {scalers} [8] = $Awfif::wsbl-> {flistl};
    $Awfif::mapped-> {scalers} [9] = $Awfif::wsbl-> {tlistl};
    $Awfif::mapped-> {scalers} [10] = $Awfif::wsbl-> {p};
    $Awfif::mapped-> {scalers} [11] = $Awfif::wsol-> {h};
    $Awfif::mapped-> {scalers} [12] = $Awfif::wsol-> {t};
    $Awfif::mapped-> {scalers} [13] = $Awfif::wsol-> {f};
    $Awfif::mapped-> {scalers} [14] = $Awfif::wsol-> {flistl};
    $Awfif::mapped-> {scalers} [15] = $Awfif::wsol-> {tlistl};
    $Awfif::mapped-> {scalers} [16] = $Awfif::wsol-> {p};
    $Awfif::mapped-> {scalers} [17] = $Awfif::workspace-> {h};
    $Awfif::mapped-> {scalers} [18] = $Awfif::workspace-> {t};
    $Awfif::mapped-> {scalers} [19] = $Awfif::workspace-> {f};
    $Awfif::mapped-> {scalers} [20] = $Awfif::workspace-> {flistl};
    $Awfif::mapped-> {scalers} [21] = $Awfif::workspace-> {tlistl};
    $Awfif::mapped-> {scalers} [22] = $Awfif::workspace-> {p};
    $Awfif::mapped-> {scalers} [23] = $Awfif::wontgroupc-> {h};
    $Awfif::mapped-> {scalers} [24] = $Awfif::wontgroupc-> {t};
    $Awfif::mapped-> {scalers} [25] = $Awfif::wontgroupc-> {f};
    $Awfif::mapped-> {scalers} [26] = $Awfif::wontgroupc-> {flistl};
    $Awfif::mapped-> {scalers} [27] = $Awfif::wontgroupc-> {tlistl};
    $Awfif::mapped-> {scalers} [28] = $Awfif::wontgroupc-> {caller};
    $Awfif::mapped-> {scalers} [29] = $Awfif::wontgroupc-> {p};
    $Awfif::mapped-> {scalers} [30] = $Awfif::bicl-> {h};
    $Awfif::mapped-> {scalers} [31] = $Awfif::bicl-> {t};
    $Awfif::mapped-> {scalers} [32] = $Awfif::bicl-> {f};
    $Awfif::mapped-> {scalers} [33] = $Awfif::bicl-> {flistl};
    $Awfif::mapped-> {scalers} [34] = $Awfif::bicl-> {tlistl};
    $Awfif::mapped-> {scalers} [35] = $Awfif::bicl-> {cp};
    $Awfif::mapped-> {scalers} [36] = $Awfif::bicl-> {p};
    $Awfif::mapped-> {scalers} [37] = $Awfif::norml-> {f};
    $Awfif::mapped-> {scalers} [38] = $Awfif::norml-> {flistl};
    $Awfif::mapped-> {scalers} [39] = $Awfif::norml-> {tlistl};
    $Awfif::mapped-> {scalers} [40] = $Awfif::norml-> {p};
    $Awfif::mapped-> {scalers} [41] = $Awfif::ifbhcl-> {h};
    $Awfif::mapped-> {scalers} [42] = $Awfif::ifbhcl-> {t};
    $Awfif::mapped-> {scalers} [43] = $Awfif::ifbhcl-> {f};
    $Awfif::mapped-> {scalers} [44] = $Awfif::ifbhcl-> {flistl};
    $Awfif::mapped-> {scalers} [45] = $Awfif::ifbhcl-> {tlistl};
    $Awfif::mapped-> {scalers} [46] = $Awfif::ifbhcl-> {p};
    $Awfif::mapped-> {scalers} [47] = $Awfif::ilabhcl-> {h};
    $Awfif::mapped-> {scalers} [48] = $Awfif::ilabhcl-> {t};
    $Awfif::mapped-> {scalers} [49] = $Awfif::ilabhcl-> {f};
    $Awfif::mapped-> {scalers} [50] = $Awfif::ilabhcl-> {flistl};
    $Awfif::mapped-> {scalers} [51] = $Awfif::ilabhcl-> {tlistl};
    $Awfif::mapped-> {scalers} [52] = $Awfif::ilabhcl-> {p};
    $Awfif::mapped-> {scalers} [53] = $Awfif::framel-> {h};
    $Awfif::mapped-> {scalers} [54] = $Awfif::framel-> {t};
    $Awfif::mapped-> {scalers} [55] = $Awfif::framel-> {f};
    $Awfif::mapped-> {scalers} [56] = $Awfif::framel-> {flistl};
    $Awfif::mapped-> {scalers} [57] = $Awfif::framel-> {tlistl};
    $Awfif::mapped-> {scalers} [58] = $Awfif::framel-> {p};
    $Awfif::mapped-> {scalers} [59] = $Awfif::subpl-> {h};
    $Awfif::mapped-> {scalers} [60] = $Awfif::subpl-> {t};
    $Awfif::mapped-> {scalers} [61] = $Awfif::subpl-> {f};
    $Awfif::mapped-> {scalers} [62] = $Awfif::subpl-> {flistl};
    $Awfif::mapped-> {scalers} [63] = $Awfif::subpl-> {tlistl};
    $Awfif::mapped-> {scalers} [64] = $Awfif::subpl-> {p};
    $Awfif::mapped-> {scalers} [65] = $Awfif::amoffl-> {h};
    $Awfif::mapped-> {scalers} [66] = $Awfif::amoffl-> {t};
    $Awfif::mapped-> {scalers} [67] = $Awfif::amoffl-> {f};
    $Awfif::mapped-> {scalers} [68] = $Awfif::amoffl-> {flistl};
    $Awfif::mapped-> {scalers} [69] = $Awfif::amoffl-> {tlistl};
    $Awfif::mapped-> {scalers} [70] = $Awfif::amoffl-> {p};
    $Awfif::mapped-> {scalers} [71] = $Awfif::poolcl-> {h};
    $Awfif::mapped-> {scalers} [72] = $Awfif::poolcl-> {t};
    $Awfif::mapped-> {scalers} [73] = $Awfif::poolcl-> {f};
    $Awfif::mapped-> {scalers} [74] = $Awfif::poolcl-> {flistl};
    $Awfif::mapped-> {scalers} [75] = $Awfif::poolcl-> {tlistl};
    $Awfif::mapped-> {scalers} [76] = $Awfif::poolcl-> {p};
    $Awfif::mapped-> {scalers} [77] = $Awfif::syncl-> {h};
    $Awfif::mapped-> {scalers} [78] = $Awfif::syncl-> {t};
    $Awfif::mapped-> {scalers} [79] = $Awfif::syncl-> {f};
    $Awfif::mapped-> {scalers} [80] = $Awfif::syncl-> {flistl};
    $Awfif::mapped-> {scalers} [81] = $Awfif::syncl-> {tlistl};
    $Awfif::mapped-> {scalers} [82] = $Awfif::syncl-> {p};
    $Awfif::mapped-> {scalers} [83] = $Awfif::synccodl-> {h};
    $Awfif::mapped-> {scalers} [84] = $Awfif::synccodl-> {t};
    $Awfif::mapped-> {scalers} [85] = $Awfif::synccodl-> {f};
    $Awfif::mapped-> {scalers} [86] = $Awfif::synccodl-> {flistl};
    $Awfif::mapped-> {scalers} [87] = $Awfif::synccodl-> {tlistl};
    $Awfif::mapped-> {scalers} [88] = $Awfif::synccodl-> {p};
    $Awfif::mapped-> {scalers} [89] = $Awfif::cswsol-> {h};
    $Awfif::mapped-> {scalers} [90] = $Awfif::cswsol-> {t};
    $Awfif::mapped-> {scalers} [91] = $Awfif::cswsol-> {f};
    $Awfif::mapped-> {scalers} [92] = $Awfif::cswsol-> {flistl};
    $Awfif::mapped-> {scalers} [93] = $Awfif::cswsol-> {tlistl};
    $Awfif::mapped-> {scalers} [94] = $Awfif::cswsol-> {p};
    $Awfif::mapped-> {scalers} [95] = $Awfif::subpscdefl-> {h};
    $Awfif::mapped-> {scalers} [96] = $Awfif::subpscdefl-> {t};
    $Awfif::mapped-> {scalers} [97] = $Awfif::subpscdefl-> {f};
    $Awfif::mapped-> {scalers} [98] = $Awfif::subpscdefl-> {flistl};
    $Awfif::mapped-> {scalers} [99] = $Awfif::subpscdefl-> {tlistl};
    $Awfif::mapped-> {scalers} [100] = $Awfif::subpscdefl-> {p};
    $Awfif::mapped-> {scalers} [101] = $Awfif::veccol-> {h};
    $Awfif::mapped-> {scalers} [102] = $Awfif::veccol-> {t};
    $Awfif::mapped-> {scalers} [103] = $Awfif::veccol-> {f};
    $Awfif::mapped-> {scalers} [104] = $Awfif::veccol-> {flistl};
    $Awfif::mapped-> {scalers} [105] = $Awfif::veccol-> {tlistl};
    $Awfif::mapped-> {scalers} [106] = $Awfif::veccol-> {p};
    $Awfif::mapped-> {scalers} [107] = $Awfif::veccol-> {vcstate};
    $Awfif::mapped-> {scalers} [108] = $Awfif::histonel-> {h};
    $Awfif::mapped-> {scalers} [109] = $Awfif::histonel-> {t};
    $Awfif::mapped-> {scalers} [110] = $Awfif::histonel-> {f};
    $Awfif::mapped-> {scalers} [111] = $Awfif::histonel-> {flistl};
    $Awfif::mapped-> {scalers} [112] = $Awfif::histonel-> {tlistl};
    $Awfif::mapped-> {scalers} [113] = $Awfif::histonel-> {p};
    $Awfif::mapped-> {scalers} [114] = $Awfif::hnamel-> {h};
    $Awfif::mapped-> {scalers} [115] = $Awfif::hnamel-> {t};
    $Awfif::mapped-> {scalers} [116] = $Awfif::hnamel-> {f};
    $Awfif::mapped-> {scalers} [117] = $Awfif::hnamel-> {flistl};
    $Awfif::mapped-> {scalers} [118] = $Awfif::hnamel-> {tlistl};
    $Awfif::mapped-> {scalers} [119] = $Awfif::hnamel-> {p};
    $Awfif::mapped-> {scalers} [120] = $Awfif::itswsall-> {h};
    $Awfif::mapped-> {scalers} [121] = $Awfif::itswsall-> {t};
    $Awfif::mapped-> {scalers} [122] = $Awfif::itswsall-> {f};
    $Awfif::mapped-> {scalers} [123] = $Awfif::itswsall-> {flistl};
    $Awfif::mapped-> {scalers} [124] = $Awfif::itswsall-> {tlistl};
    $Awfif::mapped-> {scalers} [125] = $Awfif::itswsall-> {p};
    $Awfif::mapped-> {scalers} [126] = $Awfif::inhibl-> {h};
    $Awfif::mapped-> {scalers} [127] = $Awfif::inhibl-> {t};
    $Awfif::mapped-> {scalers} [128] = $Awfif::inhibl-> {f};
    $Awfif::mapped-> {scalers} [129] = $Awfif::inhibl-> {flistl};
    $Awfif::mapped-> {scalers} [130] = $Awfif::inhibl-> {tlistl};
    $Awfif::mapped-> {scalers} [131] = $Awfif::inhibl-> {p};
    $Awfif::mapped-> {scalers} [132] = $Awfif::trfl-> {h};
    $Awfif::mapped-> {scalers} [133] = $Awfif::trfl-> {t};
    $Awfif::mapped-> {scalers} [134] = $Awfif::trfl-> {f};
    $Awfif::mapped-> {scalers} [135] = $Awfif::trfl-> {flistl};
    $Awfif::mapped-> {scalers} [136] = $Awfif::trfl-> {tlistl};
    $Awfif::mapped-> {scalers} [137] = $Awfif::trfl-> {p};
# $Awfif::mapped-> {scalers} [138] = $Awfif::kmbracketd-> {bmec};- 437
# $Awfif::mapped-> {scalers} [139] = $Awfif::kmbracketd-> {ibmec};
# $Awfif::mapped-> {scalers} [140] = $Awfif::kmbracketd-> {smsc};
# $Awfif::mapped-> {scalers} [141] = $Awfif::kmbracketd-> {incb};
# $Awfif::mapped-> {scalers} [142] = $Awfif::kmbracketd-> {incs};
    $Awfif::mapped-> {scalers} [143] = $Awfif::tral-> {h};
    $Awfif::mapped-> {scalers} [144] = $Awfif::tral-> {t};
    $Awfif::mapped-> {scalers} [145] = $Awfif::tral-> {f};
    $Awfif::mapped-> {scalers} [146] = $Awfif::tral-> {flistl};
    $Awfif::mapped-> {scalers} [147] = $Awfif::tral-> {tlistl};
    $Awfif::mapped-> {scalers} [148] = $Awfif::tral-> {p};
    $Awfif::mapped-> {scalers} [149] = $Awfif::tmassl-> {h};
    $Awfif::mapped-> {scalers} [150] = $Awfif::tmassl-> {t};
    $Awfif::mapped-> {scalers} [151] = $Awfif::tmassl-> {f};
    $Awfif::mapped-> {scalers} [152] = $Awfif::tmassl-> {flistl};
    $Awfif::mapped-> {scalers} [153] = $Awfif::tmassl-> {tlistl};
    $Awfif::mapped-> {scalers} [154] = $Awfif::tmassl-> {p};
    $Awfif::mapped-> {scalers} [155] = $Awfif::kwl-> {h};
    $Awfif::mapped-> {scalers} [156] = $Awfif::kwl-> {t};
    $Awfif::mapped-> {scalers} [157] = $Awfif::kwl-> {f};
    $Awfif::mapped-> {scalers} [158] = $Awfif::kwl-> {flistl};
    $Awfif::mapped-> {scalers} [159] = $Awfif::kwl-> {tlistl};
    $Awfif::mapped-> {scalers} [160] = $Awfif::kwl-> {p};
    $Awfif::mapped-> {scalers} [161] = $Awfif::mkwl-> {h};
    $Awfif::mapped-> {scalers} [162] = $Awfif::mkwl-> {t};
    $Awfif::mapped-> {scalers} [163] = $Awfif::mkwl-> {f};
    $Awfif::mapped-> {scalers} [164] = $Awfif::mkwl-> {flistl};
    $Awfif::mapped-> {scalers} [165] = $Awfif::mkwl-> {tlistl};
    $Awfif::mapped-> {scalers} [166] = $Awfif::mkwl-> {p};
    $Awfif::mapped-> {scalers} [167] = $Awfif::aspl-> {h};
    $Awfif::mapped-> {scalers} [168] = $Awfif::aspl-> {t};
    $Awfif::mapped-> {scalers} [169] = $Awfif::aspl-> {f};
    $Awfif::mapped-> {scalers} [170] = $Awfif::aspl-> {flistl};
    $Awfif::mapped-> {scalers} [171] = $Awfif::aspl-> {tlistl};
    $Awfif::mapped-> {scalers} [172] = $Awfif::aspl-> {p};
# clp is transient
    $Awfif::mapped-> {scalers} [173] = $Awfif::sametl-> {h};
    $Awfif::mapped-> {scalers} [174] = $Awfif::sametl-> {t};
    $Awfif::mapped-> {scalers} [175] = $Awfif::sametl-> {f};
    $Awfif::mapped-> {scalers} [176] = $Awfif::sametl-> {flistl};
    $Awfif::mapped-> {scalers} [177] = $Awfif::sametl-> {tlistl};
    $Awfif::mapped-> {scalers} [178] = $Awfif::sametl-> {p};
    $Awfif::mapped-> {scalers} [179] = $Awfif::memes-> {actamp};
    $Awfif::mapped-> {scalers} [180] = $Awfif::memes-> {actth};
    $Awfif::mapped-> {scalers} [181] = $Awfif::memes-> {actramp};
    $Awfif::mapped-> {scalers} [182] = $Awfif::memes-> {actmax};
    $Awfif::mapped-> {scalers} [183] = $Awfif::memes-> {actdamper};
    $Awfif::mapped-> {scalers} [184] = $Awfif::memes-> {acteu};
    $Awfif::mapped-> {scalers} [185] = $Awfif::memes-> {actfocus};
    $Awfif::mapped-> {scalers} [186] = $Awfif::memes-> {actweight};
    $Awfif::mapped-> {scalers} [187] = $Awfif::memes-> {batp};
    $Awfif::mapped-> {scalers} [188] = $Awfif::memes-> {bondafrom};
    $Awfif::mapped-> {scalers} [189] = $Awfif::memes-> {bondato};
    $Awfif::mapped-> {scalers} [190] = $Awfif::memes-> {bondatype};
    $Awfif::mapped-> {scalers} [191] = $Awfif::memes-> {bondamp};
    $Awfif::mapped-> {scalers} [192] = $Awfif::memes-> {bondbar};
    $Awfif::mapped-> {scalers} [193] = $Awfif::memes-> {bondrwd};
    $Awfif::mapped-> {scalers} [194] = $Awfif::memes-> {usedesc};
    $Awfif::mapped-> {scalers} [195] = $Awfif::memes-> {igdesc};
    $Awfif::mapped-> {scalers} [196] = $Awfif::memes-> {userel};
    $Awfif::mapped-> {scalers} [197] = $Awfif::memes-> {igrel};
    $Awfif::mapped-> {scalers} [198] = $Awfif::memes-> {buscu};
    $Awfif::mapped-> {scalers} [199] = $Awfif::memes-> {budescu};
    $Awfif::mapped-> {scalers} [200] = $Awfif::memes-> {tdbsurg};
    $Awfif::mapped-> {scalers} [201] = $Awfif::memes-> {tddsurg};
    $Awfif::mapped-> {scalers} [202] = $Awfif::memes-> {tdgsurg};
    $Awfif::mapped-> {scalers} [203] = $Awfif::memes-> {coordmax};
    $Awfif::mapped-> {scalers} [204] = $Awfif::memes-> {coordamp};
    $Awfif::mapped-> {scalers} [205] = $Awfif::memes-> {critical};
    $Awfif::mapped-> {scalers} [206] = $Awfif::memes-> {crwait};
    $Awfif::mapped-> {scalers} [207] = $Awfif::memes-> {csehih};
    $Awfif::mapped-> {scalers} [208] = $Awfif::memes-> {cpmax};
    $Awfif::mapped-> {scalers} [209] = $Awfif::memes-> {currentwsbi};
    $Awfif::mapped-> {scalers} [210] = $Awfif::memes-> {depthamp};
    $Awfif::mapped-> {scalers} [211] = $Awfif::memes-> {depthslp};
    $Awfif::mapped-> {scalers} [212] = $Awfif::memes-> {depththamp};
    $Awfif::mapped-> {scalers} [213] = $Awfif::memes-> {desbar};
    $Awfif::mapped-> {scalers} [214] = $Awfif::memes-> {desrwd};
    $Awfif::mapped-> {scalers} [215] = $Awfif::memes-> {descafrom};
    $Awfif::mapped-> {scalers} [216] = $Awfif::memes-> {descato};
    $Awfif::mapped-> {scalers} [217] = $Awfif::memes-> {descatype};
    $Awfif::mapped-> {scalers} [218] = $Awfif::memes-> {datp};
    $Awfif::mapped-> {scalers} [219] = $Awfif::memes-> {fatigue};
    $Awfif::mapped-> {scalers} [220] = $Awfif::memes-> {fatp};
    $Awfif::mapped-> {scalers} [221] = $Awfif::memes-> {fcodelets};
    $Awfif::mapped-> {scalers} [222] = $Awfif::memes-> {gatp};
    $Awfif::mapped-> {scalers} [223] = $Awfif::memes-> {halomax};
    $Awfif::mapped-> {scalers} [224] = $Awfif::memes-> {ldav};
    $Awfif::mapped-> {scalers} [225] = $Awfif::memes-> {ldoav};
    $Awfif::mapped-> {scalers} [226] = $Awfif::memes-> {lderr};
    $Awfif::mapped-> {scalers} [227] = $Awfif::memes-> {ldlcycle};
    $Awfif::mapped-> {scalers} [228] = $Awfif::memes-> {ldlcyclemax};
    $Awfif::mapped-> {scalers} [229] = $Awfif::memes-> {ldmcycle};
    $Awfif::mapped-> {scalers} [230] = $Awfif::memes-> {ldmcyclemax};
    $Awfif::mapped-> {scalers} [231] = $Awfif::memes-> {ldsignal};
    $Awfif::mapped-> {scalers} [232] = $Awfif::memes-> {iphase};
    $Awfif::mapped-> {scalers} [233] = $Awfif::memes-> {iphasecomp};
    $Awfif::mapped-> {scalers} [234] = $Awfif::memes-> {minnorm};
    $Awfif::mapped-> {scalers} [235] = $Awfif::memes-> {mrework};
    $Awfif::mapped-> {scalers} [236] = $Awfif::memes-> {maxact};
    $Awfif::mapped-> {scalers} [237] = $Awfif::memes-> {maxoper};
    $Awfif::mapped-> {scalers} [238] = $Awfif::memes-> {ndecay};
    $Awfif::mapped-> {scalers} [239] = $Awfif::memes-> {ntact};
    $Awfif::mapped-> {scalers} [240] = $Awfif::memes-> {openafrom};
    $Awfif::mapped-> {scalers} [241] = $Awfif::memes-> {openato};
    $Awfif::mapped-> {scalers} [242] = $Awfif::memes-> {openatype};
    $Awfif::mapped-> {scalers} [243] = $Awfif::memes-> {pstream};
    $Awfif::mapped-> {scalers} [244] = $Awfif::memes-> {peaksal};
    $Awfif::mapped-> {scalers} [245] = $Awfif::memes-> {groupsponsor};
    $Awfif::mapped-> {scalers} [246] = $Awfif::memes-> {jhlp};
    $Awfif::mapped-> {scalers} [247] = $Awfif::memes-> {lbbase};
    $Awfif::mapped-> {scalers} [248] = $Awfif::memes-> {lebase};
    $Awfif::mapped-> {scalers} [249] = $Awfif::memes-> {lsbase};
    $Awfif::mapped-> {scalers} [250] = $Awfif::memes-> {lsnbase};
    $Awfif::mapped-> {scalers} [251] = $Awfif::memes-> {log};
    $Awfif::mapped-> {scalers} [252] = $Awfif::memes-> {logentry};
    $Awfif::mapped-> {scalers} [253] = $Awfif::memes-> {relafrom};
    $Awfif::mapped-> {scalers} [254] = $Awfif::memes-> {relato};
    $Awfif::mapped-> {scalers} [255] = $Awfif::memes-> {relatype};
    $Awfif::mapped-> {scalers} [256] = $Awfif::memes-> {relamp};
    $Awfif::mapped-> {scalers} [257] = $Awfif::memes-> {relbar};
    $Awfif::mapped-> {scalers} [258] = $Awfif::memes-> {relrwd};
    $Awfif::mapped-> {scalers} [259] = $Awfif::memes-> {rtemp};
    $Awfif::mapped-> {scalers} [260] = $Awfif::memes-> {bondthreshold};
    $Awfif::mapped-> {scalers} [261] = $Awfif::memes-> {descthreshold};
    $Awfif::mapped-> {scalers} [262] = $Awfif::memes-> {destthreshold};
    $Awfif::mapped-> {scalers} [263] = $Awfif::memes-> {structamp};
    $Awfif::mapped-> {scalers} [264] = $Awfif::memes-> {strbcont};
    $Awfif::mapped-> {scalers} [265] = $Awfif::memes-> {strnbcont};
    $Awfif::mapped-> {scalers} [266] = $Awfif::memes-> {tcodelets};
    $Awfif::mapped-> {scalers} [267] = $Awfif::memes-> {tcodeletmax};
    $Awfif::mapped-> {scalers} [268] = $Awfif::memes-> {trace};
    $Awfif::mapped-> {scalers} [269] = $Awfif::memes-> {traceentry};
    $Awfif::mapped-> {scalers} [270] = $Awfif::memes-> {tracetemp};
    $Awfif::mapped-> {scalers} [271] = $Awfif::memes-> {traceurg};
    $Awfif::mapped-> {scalers} [272] = $Awfif::memes-> {tracefull};
    $Awfif::mapped-> {scalers} [273] = $Awfif::memes-> {tracephase};
    $Awfif::mapped-> {scalers} [274] = $Awfif::memes-> {tracetree};
    $Awfif::mapped-> {scalers} [275] = $Awfif::memes-> {tracemcache};
    $Awfif::mapped-> {scalers} [276] = $Awfif::memes-> {tracescache};
    $Awfif::mapped-> {scalers} [277] = $Awfif::memes-> {tracewscache};
    $Awfif::mapped-> {scalers} [278] = $Awfif::memes-> {tmcacheth};
    $Awfif::mapped-> {scalers} [279] = $Awfif::memes-> {tscacheth};
    $Awfif::mapped-> {scalers} [280] = $Awfif::memes-> {twscacheth};
    $Awfif::mapped-> {scalers} [281] = $Awfif::memes-> {kwmi};
    $Awfif::mapped-> {scalers} [282] = $Awfif::memes-> {kwmir};
    $Awfif::mapped-> {scalers} [283] = $Awfif::memes-> {kwwsbi};
    $Awfif::mapped-> {scalers} [284] = $Awfif::memes-> {kwp};
    $Awfif::mapped-> {scalers} [285] = $Awfif::memes-> {kwpr};
    $Awfif::mapped-> {scalers} [286] = $Awfif::memes-> {mtsnlvl};
    $Awfif::mapped-> {scalers} [287] = $Awfif::memes-> {mtsnstate};
    $Awfif::mapped-> {scalers} [288] = $Awfif::memes-> {shout};
    $Awfif::mapped-> {scalers} [289] = $Awfif::memes-> {slipth};
    $Awfif::mapped-> {scalers} [290] = $Awfif::memes-> {snehih};
    $Awfif::mapped-> {scalers} [291] = $Awfif::memes-> {uhmax};
    $Awfif::mapped-> {scalers} [292] = $Awfif::memes-> {uhth};
    $Awfif::mapped-> {scalers} [293] = $Awfif::memes-> {wsohih};
    $Awfif::mapped-> {scalers} [294] = $Awfif::slipnet-> {p};
    $Awfif::mapped-> {scalers} [295] = $Awfif::slehist-> {p};
    $Awfif::mapped-> {scalers} [296] = $Awfif::wsohist-> {p};
    $Awfif::mapped-> {scalers} [297] = $Awfif::jhls-> {p};
    $Awfif::mapped-> {scalers} [298] = $Awfif::attribs-> {p};
    $Awfif::mapped-> {scalers} [299] = $Awfif::csehist-> {p};
    $Awfif::mapped-> {scalers} [300] = $Awfif::clnk-> {h};
    $Awfif::mapped-> {scalers} [301] = $Awfif::clnk-> {t};
    $Awfif::mapped-> {scalers} [302] = $Awfif::clnk-> {f};
    $Awfif::mapped-> {scalers} [303] = $Awfif::clnk-> {flistl};
    $Awfif::mapped-> {scalers} [304] = $Awfif::clnk-> {p};
    $Awfif::mapped-> {scalers} [305] = $Awfif::memes-> {loopcheck};
    $Awfif::mapped-> {scalers} [306] = $Awfif::memes-> {loopth};
    $Awfif::mapped-> {scalers} [307] = $Awfif::memes-> {ptrace};
    $Awfif::mapped-> {scalers} [308] = $Awfif::memes-> {failatpr};
    $Awfif::mapped-> {scalers} [309] = $Awfif::memes-> {traceadentry};
    $Awfif::mapped-> {scalers} [310] = $Awfif::memes-> {telomeretrace};
    $Awfif::mapped-> {scalers} [311] = $Awfif::memes-> {tracedpcache};
    $Awfif::mapped-> {scalers} [312] = $Awfif::memes-> {tracevcentry};
    $Awfif::mapped-> {scalers} [313] = $Awfif::memes-> {traceclogentry};
    $Awfif::mapped-> {scalers} [314] = $Awfif::memes-> {ratcoth};
    $Awfif::mapped-> {scalers} [315] = $Awfif::memes-> {abscoth};
    $Awfif::mapped-> {scalers} [316] = $Awfif::memes-> {nomcrsmgrab};
    $Awfif::mapped-> {scalers} [317] = $Awfif::memes-> {ssiasslncusetmass};
    $Awfif::mapped-> {scalers} [318] = $Awfif::memes-> {tracetime};
    $Awfif::mapped-> {scalers} [319] = $Awfif::memes-> {tracehrtime};
    $Awfif::mapped-> {scalers} [320] = $Awfif::memes-> {tellifeth};
    $Awfif::mapped-> {scalers} [321] = $Awfif::memes-> {telcountth};
    $Awfif::mapped-> {scalers} [322] = $Awfif::memes-> {inhuramp};
    $Awfif::mapped-> {scalers} [323] = $Awfif::memes-> {usewcf1d};
    $Awfif::mapped-> {scalers} [324] = $Awfif::memes-> {usetdfmod};
    $Awfif::mapped-> {scalers} [325] = $Awfif::memes-> {tdfsampth};
    $Awfif::mapped-> {scalers} [326] = $Awfif::memes-> {tdfsampds};
    $Awfif::mapped-> {scalers} [327] = $Awfif::memes-> {tdfsampacc};
    $Awfif::mapped-> {scalers} [328] = $Awfif::memes-> {mainco};
    $Awfif::mapped-> {scalers} [329] = $Awfif::memes-> {maininc};
    $Awfif::mapped-> {scalers} [330] = $Awfif::memes-> {freeampth};
    $Awfif::mapped-> {scalers} [331] = $Awfif::memes-> {maxusefree};
    $Awfif::mapped-> {scalers} [332] = $Awfif::memes-> {bcsubpsindex};
    $Awfif::mapped-> {scalers} [333] = $Awfif::memes-> {ivalwindex};
    $Awfif::mapped-> {scalers} [334] = $Awfif::memes-> {crsmindex};
    $Awfif::mapped-> {scalers} [335] = $Awfif::memes-> {totup};
    $Awfif::mapped-> {scalers} [336] = $Awfif::memes-> {bugsmax};
    $Awfif::mapped-> {scalers} [337] = $Awfif::memes-> {killth};
    $Awfif::mapped-> {scalers} [338] = $Awfif::memes-> {ampramp};
    $Awfif::mapped-> {scalers} [339] = $Awfif::memes-> {waitamp};
    $Awfif::mapped-> {scalers} [340] = $Awfif::memes-> {convfrom};
    $Awfif::mapped-> {scalers} [341] = $Awfif::memes-> {groupatype};
    $Awfif::mapped-> {scalers} [342] = $Awfif::memes-> {groupato};
    $Awfif::mapped-> {scalers} [343] = $Awfif::memes-> {groupafrom};
    $Awfif::mapped-> {scalers} [344] = $Awfif::memes-> {bumscu};
    $Awfif::mapped-> {scalers} [345] = $Awfif::memes-> {tdgsramp};
    $Awfif::mapped-> {scalers} [346] = $Awfif::memes-> {geramp};
    $Awfif::mapped-> {scalers} [347] = $Awfif::memes-> {gerhiamp};
    $Awfif::mapped-> {scalers} [348] = $Awfif::memes-> {budestscu};
    $Awfif::mapped-> {scalers} [349] = $Awfif::memes-> {pappbu};
    $Awfif::mapped-> {scalers} [350] = $Awfif::memes-> {parteu};
    $Awfif::mapped-> {scalers} [351] = $Awfif::memes-> {evlaunchm};
    $Awfif::mapped-> {scalers} [352] = $Awfif::memes-> {evlaunchhim};
    $Awfif::mapped-> {scalers} [353] = $Awfif::memes-> {blaunchm};
    $Awfif::mapped-> {scalers} [354] = $Awfif::memes-> {ilaunchm};
    $Awfif::mapped-> {scalers} [355] = $Awfif::memes-> {icompdlaunchm};
    $Awfif::mapped-> {scalers} [356] = $Awfif::memes-> {manthreshold};
    $Awfif::mapped-> {scalers} [357] = $Awfif::memes-> {pstment};
    $Awfif::mapped-> {scalers} [358] = $Awfif::memes-> {pactive};
    $Awfif::mapped-> {scalers} [359] = $Awfif::memes-> {psubprogram};
    $Awfif::mapped-> {scalers} [360] = $Awfif::memes-> {acodelets};
    $Awfif::mapped-> {scalers} [361] = $Awfif::memes-> {mincodelets};
    $Awfif::mapped-> {scalers} [362] = $Awfif::memes-> {breakmyli};
    $Awfif::mapped-> {scalers} [363] = $Awfif::memes-> {bmbcindex};
    $Awfif::mapped-> {scalers} [364] = $Awfif::memes-> {drwait};
    $Awfif::mapped-> {scalers} [365] = $Awfif::memes-> {crfocuswin};
    $Awfif::mapped-> {scalers} [366] = $Awfif::memes-> {grcompaward};
    $Awfif::mapped-> {scalers} [367] = $Awfif::memes-> {salthr};
    $Awfif::mapped-> {scalers} [368] = $Awfif::memes-> {mmratio};
    $Awfif::mapped-> {scalers} [369] = $Awfif::memes-> {dmratio};
    $Awfif::mapped-> {scalers} [370] = $Awfif::memes-> {verbsrcws};
    $Awfif::mapped-> {scalers} [371] = $Awfif::memes-> {verbtaws};
    $Awfif::mapped-> {scalers} [372] = $Awfif::memes-> {clogbplist};
    $Awfif::mapped-> {scalers} [373] = $Awfif::memes-> {clogeplist};
    $Awfif::mapped-> {scalers} [374] = $Awfif::memes-> {clogs};
    $Awfif::mapped-> {scalers} [375] = $Awfif::memes-> {comprocessing};
    $Awfif::mapped-> {scalers} [376] = $Awfif::memes-> {cbprocessing};
    $Awfif::mapped-> {scalers} [377] = $Awfif::memes-> {maxnormitems};
    $Awfif::mapped-> {scalers} [378] = $Awfif::memes-> {cpcountth};
    $Awfif::mapped-> {scalers} [379] = $Awfif::memes-> {maxtdgloop};
    $Awfif::mapped-> {scalers} [380] = $Awfif::memes-> {itswsallc};
    $Awfif::mapped-> {scalers} [381] = $Awfif::memes-> {wsoname};
    $Awfif::mapped-> {scalers} [382] = $Awfif::memes-> {buildfbth};
    $Awfif::mapped-> {scalers} [383] = $Awfif::memes-> {delayselcount};
    $Awfif::mapped-> {scalers} [384] = $Awfif::memes-> {delayamp};
    $Awfif::mapped-> {scalers} [385] = $Awfif::memes-> {tgnth};
    $Awfif::mapped-> {scalers} [386] = $Awfif::memes-> {doprsib};
    $Awfif::mapped-> {scalers} [387] = $Awfif::memes-> {chckadd};
    $Awfif::mapped-> {scalers} [388] = $Awfif::memes-> {checktransidnz};
    $Awfif::mapped-> {scalers} [389] = $Awfif::memes-> {checksubpidnz};
    $Awfif::mapped-> {scalers} [390] = $Awfif::memes-> {tral};
    $Awfif::mapped-> {scalers} [391] = $Awfif::memes-> {applycmin};
    $Awfif::mapped-> {scalers} [392] = $Awfif::memes-> {iapplycth};
    $Awfif::mapped-> {scalers} [393] = $Awfif::memes-> {applycth};
    $Awfif::mapped-> {scalers} [394] = $Awfif::memes-> {iapplyramp};
    $Awfif::mapped-> {scalers} [395] = $Awfif::memes-> {applyramp};
    $Awfif::mapped-> {scalers} [396] = $Awfif::memes-> {applycount};
    $Awfif::mapped-> {scalers} [397] = $Awfif::memes-> {applyactive};
    $Awfif::mapped-> {scalers} [398] = $Awfif::memes-> {applyspigdiv};
    $Awfif::mapped-> {scalers} [399] = $Awfif::memes-> {newdep};
    $Awfif::mapped-> {scalers} [400] = $Awfif::memes-> {bnotsalient};
    $Awfif::mapped-> {scalers} [401] = $Awfif::memes-> {bsalient};
    $Awfif::mapped-> {scalers} [402] = $Awfif::memes-> {submult};
    $Awfif::mapped-> {scalers} [403] = $Awfif::memes-> {submitted};
    $Awfif::mapped-> {scalers} [404] = $Awfif::memes-> {casetrmcws};
    $Awfif::mapped-> {scalers} [405] = $Awfif::memes-> {casetrmbcwso};
    $Awfif::mapped-> {scalers} [406] = $Awfif::memes-> {subptrachcount};
    $Awfif::mapped-> {scalers} [407] = $Awfif::memes-> {acaseoutputps};
    $Awfif::mapped-> {scalers} [408] = $Awfif::memes-> {subprefctr};
    $Awfif::mapped-> {scalers} [409] = $Awfif::memes-> {allowspigrabmax};
    $Awfif::mapped-> {scalers} [410] = $Awfif::memes-> {veccah};
    $Awfif::mapped-> {scalers} [411] = $Awfif::memes-> {veccab};
    $Awfif::mapped-> {scalers} [412] = $Awfif::memes-> {usewsodirect};
    $Awfif::mapped-> {scalers} [413] = $Awfif::memes-> {usewsobfdirect};

    $Awfif::mapped-> {scalers} [414] = $Awfif::cstruct-> {istringf};
    $Awfif::mapped-> {scalers} [415] = $Awfif::memes-> {codeletdef};
    $Awfif::mapped-> {scalers} [416] = $Awfif::memes-> {jhldesf};
    $Awfif::mapped-> {scalers} [417] = $Awfif::memes-> {attribdesf};
    $Awfif::mapped-> {scalers} [418] = $Awfif::memes-> {attribdesh};
    $Awfif::mapped-> {scalers} [419] = $Awfif::costatel-> {fclnk};
    $Awfif::mapped-> {scalers} [420] = $Awfif::costatel-> {h};
    $Awfif::mapped-> {scalers} [421] = $Awfif::costatel-> {t};
    $Awfif::mapped-> {scalers} [422] = $Awfif::costatel-> {f};
    $Awfif::mapped-> {scalers} [423] = $Awfif::costatel-> {flistl};
    $Awfif::mapped-> {scalers} [424] = $Awfif::costatel-> {tlistl};
    $Awfif::mapped-> {scalers} [425] = $Awfif::costatel-> {p};
    $Awfif::mapped-> {scalers} [426] = $Awfif::memes-> {allwsstr};
    $Awfif::mapped-> {scalers} [427] = $Awfif::memes-> {npconc};
    $Awfif::mapped-> {scalers} [428] = $Awfif::memes-> {maxpconcs};
    $Awfif::mapped-> {scalers} [429] = $Awfif::memes-> {smlscstate};
    $Awfif::mapped-> {scalers} [430] = $Awfif::memes-> {srfsmcstate};
    $Awfif::mapped-> {scalers} [431] = $Awfif::memes-> {trfsmcstate};
    $Awfif::mapped-> {scalers} [432] = $Awfif::memes-> {nfsmcstate};
    $Awfif::mapped-> {scalers} [433] = $Awfif::kwbracketd->{incb};
    $Awfif::mapped-> {scalers} [434] = $Awfif::kwbracketd->{incs};
    $Awfif::mapped-> {scalers} [435] = $Awfif::kwbracketd->{bmec};
    $Awfif::mapped-> {scalers} [436] = $Awfif::kwbracketd->{ibmec};
    $Awfif::mapped-> {scalers} [437] = $Awfif::kwbracketd->{smsc};
    $Awfif::mapped-> {scalers} [438] = $Awfif::kwjhl-> {jhlp};
    $Awfif::mapped-> {scalers} [439] = $Awfif::starttime-> {sec};
    $Awfif::mapped-> {scalers} [440] = $Awfif::starttime-> {min};
    $Awfif::mapped-> {scalers} [441] = $Awfif::starttime-> {hour};
    $Awfif::mapped-> {scalers} [442] = $Awfif::starttime-> {mday};
    $Awfif::mapped-> {scalers} [443] = $Awfif::starttime-> {mon};
    $Awfif::mapped-> {scalers} [444] = $Awfif::starttime-> {year};
    $Awfif::mapped-> {scalers} [445] = $Awfif::starttime-> {wday};
    $Awfif::mapped-> {scalers} [446] = $Awfif::starttime-> {yday};
    $Awfif::mapped-> {scalers} [447] = $Awfif::starttime-> {isdat};
    $Awfif::mapped-> {scalers} [448] = $Awfif::memes-> {fjhls8};
    $Awfif::mapped-> {scalers} [449] = $Awfif::memes-> {nwsi};
# storetofilesvbtu01
    $Awfif::mapped-> {scalers} [450] = $Awfif::wfcdefl-> {h};
    $Awfif::mapped-> {scalers} [451] = $Awfif::wfcdefl-> {t};
    $Awfif::mapped-> {scalers} [452] = $Awfif::wfcdefl-> {f};
    $Awfif::mapped-> {scalers} [453] = $Awfif::wfcdefl-> {flistl};
    $Awfif::mapped-> {scalers} [454] = $Awfif::wfcdefl-> {tlistl};
    $Awfif::mapped-> {scalers} [455] = $Awfif::wfcdefl-> {p};
    $Awfif::mapped-> {scalers} [456] = $Awfif::jhlchl-> {h};
    $Awfif::mapped-> {scalers} [457] = $Awfif::jhlchl-> {t};
    $Awfif::mapped-> {scalers} [458] = $Awfif::jhlchl-> {f};
    $Awfif::mapped-> {scalers} [459] = $Awfif::jhlchl-> {flistl};
    $Awfif::mapped-> {scalers} [460] = $Awfif::jhlchl-> {tlistl};
    $Awfif::mapped-> {scalers} [461] = $Awfif::jhlchl-> {p};
    $Awfif::mapped-> {scalers} [462] = $Awfif::memes-> {worldews};
    $Awfif::mapped-> {scalers} [463] = $Awfif::memes-> {worldsws};
    $Awfif::mapped-> {scalers} [464] = $Awfif::memes-> {worldewso};
    $Awfif::mapped-> {scalers} [465] = $Awfif::memes-> {worldswso};
    $Awfif::mapped-> {scalers} [466] = $Awfif::memes-> {vbotwspdsc};
    $Awfif::mapped-> {scalers} [467] = $Awfif::memes-> {vbotatpdsc};
    $Awfif::mapped-> {scalers} [468] = $Awfif::memes-> {vbotfitnessdsc};
    $Awfif::mapped-> {scalers} [469] = $Awfif::memes-> {candsc};
    $Awfif::mapped-> {scalers} [470] = $Awfif::memes-> {iwfccountdelbreak};
    $Awfif::mapped-> {scalers} [471] = $Awfif::memes-> {listrelinking};
    $Awfif::mapped-> {scalers} [472] = $Awfif::memes-> {msublnocop};
    $Awfif::mapped-> {scalers} [473] = $Awfif::memes-> {vbottstepsmax};
    $Awfif::mapped-> {scalers} [474] = $Awfif::memes-> {vbottgenmax};
    $Awfif::mapped-> {scalers} [475] = $Awfif::memes-> {vbottpopmax};
    $Awfif::mapped-> {scalers} [476] = $Awfif::memes-> {vbotwspdsc};
    $Awfif::mapped-> {scalers} [477] = $Awfif::memes-> {vbotatpdsc};
    $Awfif::mapped-> {scalers} [478] = $Awfif::memes-> {vbotfitnessdsc};
    $Awfif::mapped-> {scalers} [479] = $Awfif::memes-> {vbottrialmax};
    $Awfif::mapped-> {scalers} [480] = $Awfif::memes-> {vbotpgdsc};
    $Awfif::mapped-> {scalers} [481] = $Awfif::memes-> {vbotgacat};
    $Awfif::mapped-> {scalers} [482] = $Awfif::memes-> {usewaitonsquare};
    $Awfif::mapped-> {scalers} [483] = $Awfif::memes-> {usewaitonsbreak};
    $Awfif::mapped-> {scalers} [484] = $Awfif::memes-> {wfscdef};
    $Awfif::mapped-> {scalers} [485] = $Awfif::memes-> {selcptrbreak};
    $Awfif::mapped-> {scalers} [486] = $Awfif::memes-> {vbttoamxmult};
    $Awfif::mapped-> {scalers} [487] = $Awfif::memes-> {vbtcmaxamp};
    $Awfif::mapped-> {scalers} [488] = $Awfif::memes-> {iteratejhlchbreak};

    $testfname = 'test/'. $Awfif::cstruct-> {istringf};
    ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat ($testfname);
    $Awfif::mapped-> {scalers} [439] = $mtime;

    $result = storeds ($myli, \$Awfif::mapped-> {scalers}, $dirprefix . 'dcache/mapped_scalers.dat');

    $result = storeds ($myli, \$Awfif::harray-> {tce}, $dirprefix . 'dcache/harray_tce.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {statement}, $dirprefix . 'dcache/wsbl_statement.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {sgmfile}, $dirprefix . 'dcache/wsbl_sgmfile.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {l}, $dirprefix . 'dcache/wsbl_l.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {winkwp}, $dirprefix . 'dcache/wsbl_winkwp.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {winkwpr}, $dirprefix . 'dcache/wsbl_winkwpr.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsactive}, $dirprefix . 'dcache/wsbl_wsactive.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsoh}, $dirprefix . 'dcache/wsbl_wsoh.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsot}, $dirprefix . 'dcache/wsbl_wsot.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsoto}, $dirprefix . 'dcache/wsbl_wsoto.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsft}, $dirprefix . 'dcache/wsbl_wsft.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsbloh}, $dirprefix . 'dcache/wsbl_wsbloh.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsblot}, $dirprefix . 'dcache/wsbl_wsblot.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsohih}, $dirprefix . 'dcache/wsbl_wsohih.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsas}, $dirprefix . 'dcache/wsbl_wsas.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {wsss}, $dirprefix . 'dcache/wsbl_wsss.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {newhead}, $dirprefix . 'dcache/wsbl_newhead.dat');

    $result = storeds ($myli, \$Awfif::wsbl-> {ofssum}, $dirprefix . 'dcache/wsbl_ofssum.dat');

    $result = storeds ($myli, \$Awfif::wsol-> {l}, $dirprefix . 'dcache/wsol_l.dat');

    $result = storeds ($myli, \$Awfif::wsol-> {ni}, $dirprefix . 'dcache/wsol_ni.dat');

    $result = storeds ($myli, \$Awfif::workspace-> {l}, $dirprefix . 'dcache/workspace_l.dat');

    $result = storeds ($myli, \$Awfif::wontgroupc-> {l}, $dirprefix . 'dcache/wontgroupc_l.dat');

    $result = storeds ($myli, \$Awfif::wontgroupc-> {i}, $dirprefix . 'dcache/wontgroupc_i.dat');

    $result = storeds ($myli, \$Awfif::bicl-> {l}, $dirprefix . 'dcache/bicl_l.dat');

    $result = storeds ($myli, \$Awfif::bicl-> {rec}, $dirprefix . 'dcache/bicl_rec.dat');

    $result = storeds ($myli, \$Awfif::norml-> {h}, $dirprefix . 'dcache/norml_h.dat');

    $result = storeds ($myli, \$Awfif::norml-> {t}, $dirprefix . 'dcache/norml_t.dat');

    $result = storeds ($myli, \$Awfif::norml-> {l}, $dirprefix . 'dcache/norml_l.dat');

    $result = storeds ($myli, \$Awfif::norml-> {min}, $dirprefix . 'dcache/norml_min.dat');

    $result = storeds ($myli, \$Awfif::norml-> {max}, $dirprefix . 'dcache/norml_max.dat');

    $result = storeds ($myli, \$Awfif::ifbhcl-> {l}, $dirprefix . 'dcache/ifbhcl_l.dat');

    $result = storeds ($myli, \$Awfif::ifbhcl-> {hc}, $dirprefix . 'dcache/ifbhcl_hc.dat');

    $result = storeds ($myli, \$Awfif::ilabhcl-> {l}, $dirprefix . 'dcache/ilabhcl_l.dat');

    $result = storeds ($myli, \$Awfif::ilabhcl-> {hc}, $dirprefix . 'dcache/ilabhcl_hc.dat');

    $result = storeds ($myli, \$Awfif::framel-> {l}, $dirprefix . 'dcache/framel_l.dat');

    $result = storeds ($myli, \$Awfif::subpl-> {l}, $dirprefix . 'dcache/subpl_l.dat');

    $result = storeds ($myli, \$Awfif::subpl-> {q}, $dirprefix . 'dcache/subpl_q.dat');

    $result = storeds ($myli, \$Awfif::subpl-> {w}, $dirprefix . 'dcache/subpl_w.dat');

    $result = storeds ($myli, \$Awfif::costatel-> {l}, $dirprefix . 'dcache/costatel_l.dat');

    $result = storeds ($myli, \$Awfif::costatel-> {hash}, $dirprefix . 'dcache/costatel_hash.dat');

    $result = storeds ($myli, \$Awfif::amoffl-> {l}, $dirprefix . 'dcache/amoffl_l.dat');

    $result = storeds ($myli, \$Awfif::poolcl-> {l}, $dirprefix . 'dcache/poolcl_l.dat');

    $result = storeds ($myli, \$Awfif::syncl-> {l}, $dirprefix . 'dcache/syncl_l.dat');

    $result = storeds ($myli, \$Awfif::synccodl-> {l}, $dirprefix . 'dcache/synccodl_l.dat');

    $result = storeds ($myli, \$Awfif::cswsol-> {l}, $dirprefix . 'dcache/cswsol_l.dat');

    $result = storeds ($myli, \$Awfif::subpscdefl-> {l}, $dirprefix . 'dcache/subpscdefl_l.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {l}, $dirprefix . 'dcache/veccol_l.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {head}, $dirprefix . 'dcache/veccol_head.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {index}, $dirprefix . 'dcache/veccol_index.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {strategy}, $dirprefix . 'dcache/veccol_strategy.dat');

    $result = storeds ($myli, \$Awfif::veccol-> {ststate}, $dirprefix . 'dcache/veccol_ststate.dat');

    $result = storeds ($myli, \$Awfif::histonel-> {l}, $dirprefix . 'dcache/histonel_l.dat');

    $result = storeds ($myli, \$Awfif::hnamel-> {l}, $dirprefix . 'dcache/hnamel_l.dat');

    $result = storeds ($myli, \$Awfif::itswsall-> {l}, $dirprefix . 'dcache/itswsall_l.dat');

    $result = storeds ($myli, \$Awfif::inhibl-> {l}, $dirprefix . 'dcache/inhibl_l.dat');

    $result = storeds ($myli, \$Awfif::inhibl-> {clpa}, $dirprefix . 'dcache/inhibl_clpa.dat');

    $result = storeds ($myli, \$Awfif::trfl-> {l}, $dirprefix . 'dcache/trfl_l.dat');

    $result = storeds ($myli, \$Awfif::trfl-> {clpa}, $dirprefix . 'dcache/trfl_clpa.dat');

    $result = storeds ($myli, \$Awfif::tral-> {l}, $dirprefix . 'dcache/tral_l.dat');

    $result = storeds ($myli, \$Awfif::tral-> {i}, $dirprefix . 'dcache/tral_i.dat');

    $result = storeds ($myli, \$Awfif::tral-> {w}, $dirprefix . 'dcache/tral_w.dat');

    $result = storeds ($myli, \$Awfif::tral-> {wt}, $dirprefix . 'dcache/tral_wt.dat');

    $result = storeds ($myli, \$Awfif::tral-> {sameash}, $dirprefix . 'dcache/tral_sameash.dat');

    $result = storeds ($myli, \$Awfif::tral-> {sameast}, $dirprefix . 'dcache/tral_sameast.dat');

    $result = storeds ($myli, \$Awfif::tral-> {sameas}, $dirprefix . 'dcache/tral_sameas.dat');

    $result = storeds ($myli, \$Awfif::tral-> {sameasaadd}, $dirprefix . 'dcache/tral_sameasaadd.dat');

    $result = storeds ($myli, \$Awfif::tral-> {c}, $dirprefix . 'dcache/tral_c.dat');

    $result = storeds ($myli, \$Awfif::tral-> {r}, $dirprefix . 'dcache/tral_r.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {l}, $dirprefix . 'dcache/tmassl_l.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {r}, $dirprefix . 'dcache/tmassl_r.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {s}, $dirprefix . 'dcache/tmassl_s.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {wsoh}, $dirprefix . 'dcache/tmassl_wsoh.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {wsot}, $dirprefix . 'dcache/tmassl_wsot.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {first}, $dirprefix . 'dcache/tmassl_first.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {salience}, $dirprefix . 'dcache/tmassl_salience.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {submitted}, $dirprefix . 'dcache/tmassl_submitted.dat');

    $result = storeds ($myli, \$Awfif::tmassl-> {proc}, $dirprefix . 'dcache/tmassl_proc.dat');

    $result = storeds ($myli, \$Awfif::kwl-> {l}, $dirprefix . 'dcache/kwl_l.dat');

    $result = storeds ($myli, \$Awfif::kwl-> {i}, $dirprefix . 'dcache/kwl_i.dat');

    $result = storeds ($myli, \$Awfif::kwl-> {w}, $dirprefix . 'dcache/kwl_w.dat');

    $result = storeds ($myli, \$Awfif::mkwl-> {l}, $dirprefix . 'dcache/mkwl_l.dat');

    $result = storeds ($myli, \$Awfif::mkwl-> {i}, $dirprefix . 'dcache/mkwl_i.dat');

    $result = storeds ($myli, \$Awfif::aspl-> {l}, $dirprefix . 'dcache/aspl_l.dat');

    $result = storeds ($myli, \$Awfif::aspl-> {i}, $dirprefix . 'dcache/aspl_i.dat');

    $result = storeds ($myli, \$Awfif::aspl-> {ws}, $dirprefix . 'dcache/aspl_ws.dat');

    $result = storeds ($myli, \$Awfif::aspl-> {nws}, $dirprefix . 'dcache/aspl_nws.dat');
# clp is transient so no reason to store

    $result = storeds ($myli, \$Awfif::sametl-> {l}, $dirprefix . 'dcache/sametl_l.dat');

    $result = storeds ($myli, \$Awfif::memes-> {backoffactive}, $dirprefix . 'dcache/memes_backoffactive.dat');

    $result = storeds ($myli, \$Awfif::memes-> {backoffactives}, $dirprefix . 'dcache/memes_backoffactives.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breakcodelet}, $dirprefix . 'dcache/memes_breakcodelet.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breaksubp}, $dirprefix . 'dcache/memes_breaksubp.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breakthwso}, $dirprefix . 'dcache/memes_breakthwso.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breakthsubp}, $dirprefix . 'dcache/memes_breakthsubp.dat');

    $result = storeds ($myli, \$Awfif::memes-> {ldbuffer}, $dirprefix . 'dcache/memes_ldbuffer.dat');

    $result = storeds ($myli, \$Awfif::memes-> {jhip}, $dirprefix . 'dcache/memes_jhip.dat');

    $result = storeds ($myli, \$Awfif::memes-> {jhlabel}, $dirprefix . 'dcache/memes_jhlabel.dat');

    $result = storeds ($myli, \$Awfif::memes-> {jhlg}, $dirprefix . 'dcache/memes_jhlg.dat');

    $result = storeds ($myli, \$Awfif::memes-> {temp}, $dirprefix . 'dcache/memes_temp.dat');

    $result = storeds ($myli, \$Awfif::memes-> {time}, $dirprefix . 'dcache/memes_time.dat');

    $result = storeds ($myli, \$Awfif::memes-> {keywordh}, $dirprefix . 'dcache/memes_keywordh.dat');

    $result = storeds ($myli, \$Awfif::memes-> {keywordl}, $dirprefix . 'dcache/memes_keywordl.dat');

    $result = storeds ($myli, \$Awfif::memes-> {keywordwsih}, $dirprefix . 'dcache/memes_keywordwsih.dat');

    $result = storeds ($myli, \$Awfif::memes-> {mtsnlc}, $dirprefix . 'dcache/memes_mtsnlc.dat');

    $result = storeds ($myli, \$Awfif::memes-> {sactset}, $dirprefix . 'dcache/memes_sactset.dat');

    $result = storeds ($myli, \$Awfif::memes-> {snnh}, $dirprefix . 'dcache/memes_snnh.dat');

    $result = storeds ($myli, \$Awfif::memes-> {snnih}, $dirprefix . 'dcache/memes_snnih.dat');

    $result = storeds ($myli, \$Awfif::memes-> {snw}, $dirprefix . 'dcache/memes_snw.dat');

    $result = storeds ($myli, \$Awfif::memes-> {wsm}, $dirprefix . 'dcache/memes_wsm.dat');

    $result = storeds ($myli, \$Awfif::memes-> {wslocality}, $dirprefix . 'dcache/memes_wslocality.dat');

    $result = storeds ($myli, \$Awfif::slipnet-> {l}, $dirprefix . 'dcache/slipnet_l.dat');

    $result = storeds ($myli, \$Awfif::slehist-> {l}, $dirprefix . 'dcache/slehist_l.dat');

    $result = storeds ($myli, \$Awfif::wsohist-> {l}, $dirprefix . 'dcache/wsohist_l.dat');

    $result = storeds ($myli, \$Awfif::jhls-> {l}, $dirprefix . 'dcache/jhls_l.dat');

    $result = storeds ($myli, \$Awfif::attribs-> {l}, $dirprefix . 'dcache/attribs_l.dat');

    $result = storeds ($myli, \$Awfif::codelet-> {l}, $dirprefix . 'dcache/codelet_l.dat');

    $result = storeds ($myli, \$Awfif::codelet-> {t}, $dirprefix . 'dcache/codelet_t.dat');

    $result = storeds ($myli, \$Awfif::csehist-> {cseh}, $dirprefix . 'dcache/csehist_cseh.dat');

    $result = storeds ($myli, \$Awfif::csehist-> {cseih}, $dirprefix . 'dcache/csehist_cseih.dat');

    $result = storeds ($myli, \$Awfif::csehist-> {d}, $dirprefix . 'dcache/csehist_d.dat');

    $result = storeds ($myli, \$Awfif::csehist-> {l}, $dirprefix . 'dcache/csehist_l.dat');

    $result = storeds ($myli, \$Awfif::cache-> {l}, $dirprefix . 'dcache/cache_l.dat');

    $result = storeds ($myli, \$Awfif::cache-> {h}, $dirprefix . 'dcache/cache_h.dat');

    $result = storeds ($myli, \$Awfif::pcache-> {l}, $dirprefix . 'dcache/pcache_l.dat');

    $result = storeds ($myli, \$Awfif::pcache-> {t}, $dirprefix . 'dcache/pcache_t.dat');

    $result = storeds ($myli, \$Awfif::pcache-> {accessed}, $dirprefix . 'dcache/pcache_accessed.dat');

    $result = storeds ($myli, \$Awfif::pcache-> {p}, $dirprefix . 'dcache/pcache_p.dat');

    $result = storeds ($myli, \$Awfif::clnk-> {l}, $dirprefix . 'dcache/clnk_l.dat');

    $result = storeds ($myli, \$Awfif::memes-> {crsmesubpspbreak}, $dirprefix . 'dcache/memes_crsmesubpspbreak.dat');

    $result = storeds ($myli, \$Awfif::memes-> {cruna}, $dirprefix . 'dcache/memes_cruna.dat');

    $result = storeds ($myli, \$Awfif::memes-> {activationchange}, $dirprefix . 'dcache/memes_activationchange.dat');

    $result = storeds ($myli, \$Awfif::memes-> {breaksalwso}, $dirprefix . 'dcache/memes_breaksalwso.dat');

    $result = storeds ($myli, \$Awfif::memes-> {leavein}, $dirprefix . 'dcache/memes_leavein.dat');

    $result = storeds ($myli, \$Awfif::memes-> {ch}, $dirprefix . 'dcache/memes_ch.dat');

    $result = storeds ($myli, \$Awfif::memes-> {cseh}, $dirprefix . 'dcache/memes_cseh.dat');

    $result = storeds ($myli, \$Awfif::memes-> {cseih}, $dirprefix . 'dcache/memes_cseih.dat');

    $result = storeds ($myli, \$Awfif::memes-> {streh}, $dirprefix . 'dcache/memes_streh.dat');

    $result = storeds ($myli, \$Awfif::memes-> {streih}, $dirprefix . 'dcache/memes_streih.dat');

    $result = storeds ($myli, \$Awfif::memes-> {strbool}, $dirprefix . 'dcache/memes_strbool.dat');

    $result = storeds ($myli, \$Awfif::cussnl, $dirprefix . 'dcache/cussnl.dat');

    $result = storeds ($myli, \$Awfif::kwjhl-> {jhip}, $dirprefix . 'dcache/kwjhl_jhip.dat');

    $result = storeds ($myli, \$Awfif::kwjhl-> {jhlabel}, $dirprefix . 'dcache/kwjhl_jhlabel.dat');

    $result = storeds ($myli, \$Awfif::kwjhl-> {jhlg}, $dirprefix . 'dcache/kwjhl_jhlg.dat');

    $result = storeds ($myli, \$Awfif::memes-> {dcodeletc}, $dirprefix . 'dcache/memes_dcodeletc.dat');

    $result = storeds ($myli, \$Awfif::memes-> {ieowner}, $dirprefix . 'dcache/memes_ieowner.dat');

    $result = storeds ($myli, \$Awfif::memes-> {gdeltachange}, $dirprefix . 'dcache/memes_gdeltachange.dat');
# storetofilesvbtu02

    $result = storeds ($myli, \$Awfif::wfcdefl-> {l}, $dirprefix . 'dcache/wfcdefl_l.dat');

    $result = storeds ($myli, \$Awfif::wfcdefl-> {hash}, $dirprefix . 'dcache/wfcdefl_hash.dat');

    $result = storeds ($myli, \$Awfif::wfcdefl-> {hashb}, $dirprefix . 'dcache/wfcdefl_hashb.dat');

    $result = storeds ($myli, \$Awfif::wfcdefl-> {operon}, $dirprefix . 'dcache/wfcdefl_operon.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {l}, $dirprefix . 'dcache/jhlchl_l.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {chash}, $dirprefix . 'dcache/jhlchl_chash.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {chasht}, $dirprefix . 'dcache/jhlchl_chasht.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {pchash}, $dirprefix . 'dcache/jhlchl_pchash.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {pchasht}, $dirprefix . 'dcache/jhlchl_pchasht.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {jhclmax}, $dirprefix . 'dcache/jhlchl_jhclmax.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {jhclmin}, $dirprefix . 'dcache/jhlchl_jhclmin.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {jhpclmax}, $dirprefix . 'dcache/jhlchl_jhpclmax.dat');

    $result = storeds ($myli, \$Awfif::jhlchl-> {jhpclmin}, $dirprefix . 'dcache/jhlchl_jhpclmin.dat');

    $result = storeds ($myli, \$Awfif::memes-> {canx}, $dirprefix . 'dcache/memes_canx.dat');

    $result = storeds ($myli, \$Awfif::memes-> {cany}, $dirprefix . 'dcache/memes_cany.dat');
# storetofilesscmapu1

# scmap, fitness and gens are stored in vbot with storecscmap and should not be stored here

    print ("storetofiles completed\n");
    return $result
    }# storetofiles
#
#<!-- end tag aso -->
#
sub retrieveds {
    my ($myli, $p, $filestring) = @_;
    my ($result);

# store all key data sets to files for later resume
#
    use Storable qw (retrieve);
    $$p = eval { retrieve ($filestring)};
    if ($@){

      if ($@ !~ /No such file or directory/) {
        &break ();#serious error from storable
        };
      print ("retrieveds myli $myli storable retrieve error($@)");
      }
    elsif (!defined ($$p)) {

      &break ();#i/o error from storable
      print ("retrieveds myli $myli storable i/o error($!)");
      }#elsif
    else {

      $result = 't';
      };#else

    return $result
    }# retrieveds
#
sub retrievefromfiles {
    my ($myli) = @_;
    my ($test, $proceed, $result, $testfname, $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks, $dirprefix);
# retrieve all key data sets to files for later resume
#

    $test = chdir("My Documents");
    $proceed = '';
    $dirprefix = '';#change to vbt for vbot
    &retrieveds ($myli, \$Awfif::mapped-> {scalers}, $dirprefix . 'dcache/mapped_scalers.dat');
    if (($test) && ($proceed) && (defined ($Awfif::mapped-> {scalers} [414])) ){

      $testfname = 'test/'. $Awfif::mapped-> {scalers} [414];
      ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat ($testfname);
      if (
      ($mtime == $Awfif::mapped-> {scalers} [439])
      ){#retrieve from persisted state

        $result = 't';
        $Awfif::memes-> {codeleth} = $Awfif::mapped-> {scalers} [0];
        $Awfif::memes-> {codeletw} = $Awfif::mapped-> {scalers} [1];
        $Awfif::memes-> {codelett} = $Awfif::mapped-> {scalers} [2];
        $Awfif::memes-> {codeletf} = $Awfif::mapped-> {scalers} [3];
        $Awfif::codelet-> {p} = $Awfif::mapped-> {scalers} [4];
        $Awfif::wsbl-> {h} = $Awfif::mapped-> {scalers} [5];
        $Awfif::wsbl-> {t} = $Awfif::mapped-> {scalers} [6];
        $Awfif::wsbl-> {f} = $Awfif::mapped-> {scalers} [7];
        $Awfif::wsbl-> {flistl} = $Awfif::mapped-> {scalers} [8];
        $Awfif::wsbl-> {tlistl} = $Awfif::mapped-> {scalers} [9];
        $Awfif::wsbl-> {p} = $Awfif::mapped-> {scalers} [10];
        $Awfif::wsol-> {h} = $Awfif::mapped-> {scalers} [11];
        $Awfif::wsol-> {t} = $Awfif::mapped-> {scalers} [12];
        $Awfif::wsol-> {f} = $Awfif::mapped-> {scalers} [13];
        $Awfif::wsol-> {flistl} = $Awfif::mapped-> {scalers} [14];
        $Awfif::wsol-> {tlistl} = $Awfif::mapped-> {scalers} [15];
        $Awfif::wsol-> {p} = $Awfif::mapped-> {scalers} [16];
        $Awfif::workspace-> {h} = $Awfif::mapped-> {scalers} [17];
        $Awfif::workspace-> {t} = $Awfif::mapped-> {scalers} [18];
        $Awfif::workspace-> {f} = $Awfif::mapped-> {scalers} [19];
        $Awfif::workspace-> {flistl} = $Awfif::mapped-> {scalers} [20];
        $Awfif::workspace-> {tlistl} = $Awfif::mapped-> {scalers} [21];
        $Awfif::workspace-> {p} = $Awfif::mapped-> {scalers} [22];
        $Awfif::wontgroupc-> {h} = $Awfif::mapped-> {scalers} [23];
        $Awfif::wontgroupc-> {t} = $Awfif::mapped-> {scalers} [24];
        $Awfif::wontgroupc-> {f} = $Awfif::mapped-> {scalers} [25];
        $Awfif::wontgroupc-> {flistl} = $Awfif::mapped-> {scalers} [26];
        $Awfif::wontgroupc-> {tlistl} = $Awfif::mapped-> {scalers} [27];
        $Awfif::wontgroupc-> {caller} = $Awfif::mapped-> {scalers} [28];
        $Awfif::wontgroupc-> {p} = $Awfif::mapped-> {scalers} [29];
        $Awfif::bicl-> {h} = $Awfif::mapped-> {scalers} [30];
        $Awfif::bicl-> {t} = $Awfif::mapped-> {scalers} [31];
        $Awfif::bicl-> {f} = $Awfif::mapped-> {scalers} [32];
        $Awfif::bicl-> {flistl} = $Awfif::mapped-> {scalers} [33];
        $Awfif::bicl-> {tlistl} = $Awfif::mapped-> {scalers} [34];
        $Awfif::bicl-> {cp} = $Awfif::mapped-> {scalers} [35];
        $Awfif::bicl-> {p} = $Awfif::mapped-> {scalers} [36];
        $Awfif::norml-> {f} = $Awfif::mapped-> {scalers} [37];
        $Awfif::norml-> {flistl} = $Awfif::mapped-> {scalers} [38];
        $Awfif::norml-> {tlistl} = $Awfif::mapped-> {scalers} [39];
        $Awfif::norml-> {p} = $Awfif::mapped-> {scalers} [40];
        $Awfif::ifbhcl-> {h} = $Awfif::mapped-> {scalers} [41];
        $Awfif::ifbhcl-> {t} = $Awfif::mapped-> {scalers} [42];
        $Awfif::ifbhcl-> {f} = $Awfif::mapped-> {scalers} [43];
        $Awfif::ifbhcl-> {flistl} = $Awfif::mapped-> {scalers} [44];
        $Awfif::ifbhcl-> {tlistl} = $Awfif::mapped-> {scalers} [45];
        $Awfif::ifbhcl-> {p} = $Awfif::mapped-> {scalers} [46];
        $Awfif::ilabhcl-> {h} = $Awfif::mapped-> {scalers} [47];
        $Awfif::ilabhcl-> {t} = $Awfif::mapped-> {scalers} [48];
        $Awfif::ilabhcl-> {f} = $Awfif::mapped-> {scalers} [49];
        $Awfif::ilabhcl-> {flistl} = $Awfif::mapped-> {scalers} [50];
        $Awfif::ilabhcl-> {tlistl} = $Awfif::mapped-> {scalers} [51];
        $Awfif::ilabhcl-> {p} = $Awfif::mapped-> {scalers} [52];
        $Awfif::framel-> {h} = $Awfif::mapped-> {scalers} [53];
        $Awfif::framel-> {t} = $Awfif::mapped-> {scalers} [54];
        $Awfif::framel-> {f} = $Awfif::mapped-> {scalers} [55];
        $Awfif::framel-> {flistl} = $Awfif::mapped-> {scalers} [56];
        $Awfif::framel-> {tlistl} = $Awfif::mapped-> {scalers} [57];
        $Awfif::framel-> {p} = $Awfif::mapped-> {scalers} [58];
        $Awfif::subpl-> {h} = $Awfif::mapped-> {scalers} [59];
        $Awfif::subpl-> {t} = $Awfif::mapped-> {scalers} [60];
        $Awfif::subpl-> {f} = $Awfif::mapped-> {scalers} [61];
        $Awfif::subpl-> {flistl} = $Awfif::mapped-> {scalers} [62];
        $Awfif::subpl-> {tlistl} = $Awfif::mapped-> {scalers} [63];
        $Awfif::subpl-> {p} = $Awfif::mapped-> {scalers} [64];
        $Awfif::amoffl-> {h} = $Awfif::mapped-> {scalers} [65];
        $Awfif::amoffl-> {t} = $Awfif::mapped-> {scalers} [66];
        $Awfif::amoffl-> {f} = $Awfif::mapped-> {scalers} [67];
        $Awfif::amoffl-> {flistl} = $Awfif::mapped-> {scalers} [68];
        $Awfif::amoffl-> {tlistl} = $Awfif::mapped-> {scalers} [69];
        $Awfif::amoffl-> {p} = $Awfif::mapped-> {scalers} [70];
        $Awfif::poolcl-> {h} = $Awfif::mapped-> {scalers} [71];
        $Awfif::poolcl-> {t} = $Awfif::mapped-> {scalers} [72];
        $Awfif::poolcl-> {f} = $Awfif::mapped-> {scalers} [73];
        $Awfif::poolcl-> {flistl} = $Awfif::mapped-> {scalers} [74];
        $Awfif::poolcl-> {tlistl} = $Awfif::mapped-> {scalers} [75];
        $Awfif::poolcl-> {p} = $Awfif::mapped-> {scalers} [76];
        $Awfif::syncl-> {h} = $Awfif::mapped-> {scalers} [77];
        $Awfif::syncl-> {t} = $Awfif::mapped-> {scalers} [78];
        $Awfif::syncl-> {f} = $Awfif::mapped-> {scalers} [79];
        $Awfif::syncl-> {flistl} = $Awfif::mapped-> {scalers} [80];
        $Awfif::syncl-> {tlistl} = $Awfif::mapped-> {scalers} [81];
        $Awfif::syncl-> {p} = $Awfif::mapped-> {scalers} [82];
        $Awfif::synccodl-> {h} = $Awfif::mapped-> {scalers} [83];
        $Awfif::synccodl-> {t} = $Awfif::mapped-> {scalers} [84];
        $Awfif::synccodl-> {f} = $Awfif::mapped-> {scalers} [85];
        $Awfif::synccodl-> {flistl} = $Awfif::mapped-> {scalers} [86];
        $Awfif::synccodl-> {tlistl} = $Awfif::mapped-> {scalers} [87];
        $Awfif::synccodl-> {p} = $Awfif::mapped-> {scalers} [88];
        $Awfif::cswsol-> {h} = $Awfif::mapped-> {scalers} [89];
        $Awfif::cswsol-> {t} = $Awfif::mapped-> {scalers} [90];
        $Awfif::cswsol-> {f} = $Awfif::mapped-> {scalers} [91];
        $Awfif::cswsol-> {flistl} = $Awfif::mapped-> {scalers} [92];
        $Awfif::cswsol-> {tlistl} = $Awfif::mapped-> {scalers} [93];
        $Awfif::cswsol-> {p} = $Awfif::mapped-> {scalers} [94];
        $Awfif::subpscdefl-> {h} = $Awfif::mapped-> {scalers} [95];
        $Awfif::subpscdefl-> {t} = $Awfif::mapped-> {scalers} [96];
        $Awfif::subpscdefl-> {f} = $Awfif::mapped-> {scalers} [97];
        $Awfif::subpscdefl-> {flistl} = $Awfif::mapped-> {scalers} [98];
        $Awfif::subpscdefl-> {tlistl} = $Awfif::mapped-> {scalers} [99];
        $Awfif::subpscdefl-> {p} = $Awfif::mapped-> {scalers} [100];
        $Awfif::veccol-> {h} = $Awfif::mapped-> {scalers} [101];
        $Awfif::veccol-> {t} = $Awfif::mapped-> {scalers} [102];
        $Awfif::veccol-> {f} = $Awfif::mapped-> {scalers} [103];
        $Awfif::veccol-> {flistl} = $Awfif::mapped-> {scalers} [104];
        $Awfif::veccol-> {tlistl} = $Awfif::mapped-> {scalers} [105];
        $Awfif::veccol-> {p} = $Awfif::mapped-> {scalers} [106];
        $Awfif::veccol-> {vcstate} = $Awfif::mapped-> {scalers} [107];
        $Awfif::histonel-> {h} = $Awfif::mapped-> {scalers} [108];
        $Awfif::histonel-> {t} = $Awfif::mapped-> {scalers} [109];
        $Awfif::histonel-> {f} = $Awfif::mapped-> {scalers} [110];
        $Awfif::histonel-> {flistl} = $Awfif::mapped-> {scalers} [111];
        $Awfif::histonel-> {tlistl} = $Awfif::mapped-> {scalers} [112];
        $Awfif::histonel-> {p} = $Awfif::mapped-> {scalers} [113];
        $Awfif::hnamel-> {h} = $Awfif::mapped-> {scalers} [114];
        $Awfif::hnamel-> {t} = $Awfif::mapped-> {scalers} [115];
        $Awfif::hnamel-> {f} = $Awfif::mapped-> {scalers} [116];
        $Awfif::hnamel-> {flistl} = $Awfif::mapped-> {scalers} [117];
        $Awfif::hnamel-> {tlistl} = $Awfif::mapped-> {scalers} [118];
        $Awfif::hnamel-> {p} = $Awfif::mapped-> {scalers} [119];
        $Awfif::itswsall-> {h} = $Awfif::mapped-> {scalers} [120];
        $Awfif::itswsall-> {t} = $Awfif::mapped-> {scalers} [121];
        $Awfif::itswsall-> {f} = $Awfif::mapped-> {scalers} [122];
        $Awfif::itswsall-> {flistl} = $Awfif::mapped-> {scalers} [123];
        $Awfif::itswsall-> {tlistl} = $Awfif::mapped-> {scalers} [124];
        $Awfif::itswsall-> {p} = $Awfif::mapped-> {scalers} [125];
        $Awfif::inhibl-> {h} = $Awfif::mapped-> {scalers} [126];
        $Awfif::inhibl-> {t} = $Awfif::mapped-> {scalers} [127];
        $Awfif::inhibl-> {f} = $Awfif::mapped-> {scalers} [128];
        $Awfif::inhibl-> {flistl} = $Awfif::mapped-> {scalers} [129];
        $Awfif::inhibl-> {tlistl} = $Awfif::mapped-> {scalers} [130];
        $Awfif::inhibl-> {p} = $Awfif::mapped-> {scalers} [131];
        $Awfif::trfl-> {h} = $Awfif::mapped-> {scalers} [132];
        $Awfif::trfl-> {t} = $Awfif::mapped-> {scalers} [133];
        $Awfif::trfl-> {f} = $Awfif::mapped-> {scalers} [134];
        $Awfif::trfl-> {flistl} = $Awfif::mapped-> {scalers} [135];
        $Awfif::trfl-> {tlistl} = $Awfif::mapped-> {scalers} [136];
        $Awfif::trfl-> {p} = $Awfif::mapped-> {scalers} [137];
- 142 missing
        $Awfif::tral-> {h} = $Awfif::mapped-> {scalers} [143];
        $Awfif::tral-> {t} = $Awfif::mapped-> {scalers} [144];
        $Awfif::tral-> {f} = $Awfif::mapped-> {scalers} [145];
        $Awfif::tral-> {flistl} = $Awfif::mapped-> {scalers} [146];
        $Awfif::tral-> {tlistl} = $Awfif::mapped-> {scalers} [147];
        $Awfif::tral-> {p} = $Awfif::mapped-> {scalers} [148];
        $Awfif::tmassl-> {h} = $Awfif::mapped-> {scalers} [149];
        $Awfif::tmassl-> {t} = $Awfif::mapped-> {scalers} [150];
        $Awfif::tmassl-> {f} = $Awfif::mapped-> {scalers} [151];
        $Awfif::tmassl-> {flistl} = $Awfif::mapped-> {scalers} [152];
        $Awfif::tmassl-> {tlistl} = $Awfif::mapped-> {scalers} [153];
        $Awfif::tmassl-> {p} = $Awfif::mapped-> {scalers} [154];
        $Awfif::kwl-> {h} = $Awfif::mapped-> {scalers} [155];
        $Awfif::kwl-> {t} = $Awfif::mapped-> {scalers} [156];
        $Awfif::kwl-> {f} = $Awfif::mapped-> {scalers} [157];
        $Awfif::kwl-> {flistl} = $Awfif::mapped-> {scalers} [158];
        $Awfif::kwl-> {tlistl} = $Awfif::mapped-> {scalers} [159];
        $Awfif::kwl-> {p} = $Awfif::mapped-> {scalers} [160];
        $Awfif::mkwl-> {h} = $Awfif::mapped-> {scalers} [161];
        $Awfif::mkwl-> {t} = $Awfif::mapped-> {scalers} [162];
        $Awfif::mkwl-> {f} = $Awfif::mapped-> {scalers} [163];
        $Awfif::mkwl-> {flistl} = $Awfif::mapped-> {scalers} [164];
        $Awfif::mkwl-> {tlistl} = $Awfif::mapped-> {scalers} [165];
        $Awfif::mkwl-> {p} = $Awfif::mapped-> {scalers} [166];
        $Awfif::aspl-> {h} = $Awfif::mapped-> {scalers} [167];
        $Awfif::aspl-> {t} = $Awfif::mapped-> {scalers} [168];
        $Awfif::aspl-> {f} = $Awfif::mapped-> {scalers} [169];
        $Awfif::aspl-> {flistl} = $Awfif::mapped-> {scalers} [170];
        $Awfif::aspl-> {tlistl} = $Awfif::mapped-> {scalers} [171];
        $Awfif::aspl-> {p} = $Awfif::mapped-> {scalers} [172];
# clp is transient
        $Awfif::sametl-> {h} = $Awfif::mapped-> {scalers} [173];
        $Awfif::sametl-> {t} = $Awfif::mapped-> {scalers} [174];
        $Awfif::sametl-> {f} = $Awfif::mapped-> {scalers} [175];
        $Awfif::sametl-> {flistl} = $Awfif::mapped-> {scalers} [176];
        $Awfif::sametl-> {tlistl} = $Awfif::mapped-> {scalers} [177];
        $Awfif::sametl-> {p} = $Awfif::mapped-> {scalers} [178];
        $Awfif::memes-> {actamp} = $Awfif::mapped-> {scalers} [179];
        $Awfif::memes-> {actth} = $Awfif::mapped-> {scalers} [180];
        $Awfif::memes-> {actramp} = $Awfif::mapped-> {scalers} [181];
        $Awfif::memes-> {actmax} = $Awfif::mapped-> {scalers} [182];
        $Awfif::memes-> {actdamper} = $Awfif::mapped-> {scalers} [183];
        $Awfif::memes-> {acteu} = $Awfif::mapped-> {scalers} [184];
        $Awfif::memes-> {actfocus} = $Awfif::mapped-> {scalers} [185];
        $Awfif::memes-> {actweight} = $Awfif::mapped-> {scalers} [186];
        $Awfif::memes-> {batp} = $Awfif::mapped-> {scalers} [187];
        $Awfif::memes-> {bondafrom} = $Awfif::mapped-> {scalers} [188];
        $Awfif::memes-> {bondato} = $Awfif::mapped-> {scalers} [189];
        $Awfif::memes-> {bondatype} = $Awfif::mapped-> {scalers} [190];
        $Awfif::memes-> {bondamp} = $Awfif::mapped-> {scalers} [191];
        $Awfif::memes-> {bondbar} = $Awfif::mapped-> {scalers} [192];
        $Awfif::memes-> {bondrwd} = $Awfif::mapped-> {scalers} [193];
        $Awfif::memes-> {usedesc} = $Awfif::mapped-> {scalers} [194];
        $Awfif::memes-> {igdesc} = $Awfif::mapped-> {scalers} [195];
        $Awfif::memes-> {userel} = $Awfif::mapped-> {scalers} [196];
        $Awfif::memes-> {igrel} = $Awfif::mapped-> {scalers} [197];
        $Awfif::memes-> {buscu} = $Awfif::mapped-> {scalers} [198];
        $Awfif::memes-> {budescu} = $Awfif::mapped-> {scalers} [199];
        $Awfif::memes-> {tdbsurg} = $Awfif::mapped-> {scalers} [200];
        $Awfif::memes-> {tddsurg} = $Awfif::mapped-> {scalers} [201];
        $Awfif::memes-> {tdgsurg} = $Awfif::mapped-> {scalers} [202];
        $Awfif::memes-> {coordmax} = $Awfif::mapped-> {scalers} [203];
        $Awfif::memes-> {coordamp} = $Awfif::mapped-> {scalers} [204];
        $Awfif::memes-> {critical} = $Awfif::mapped-> {scalers} [205];
        $Awfif::memes-> {crwait} = $Awfif::mapped-> {scalers} [206];
        $Awfif::memes-> {csehih} = $Awfif::mapped-> {scalers} [207];
        $Awfif::memes-> {cpmax} = $Awfif::mapped-> {scalers} [208];
        $Awfif::memes-> {currentwsbi} = $Awfif::mapped-> {scalers} [209];
        $Awfif::memes-> {depthamp} = $Awfif::mapped-> {scalers} [210];
        $Awfif::memes-> {depthslp} = $Awfif::mapped-> {scalers} [211];
        $Awfif::memes-> {depththamp} = $Awfif::mapped-> {scalers} [212];
        $Awfif::memes-> {desbar} = $Awfif::mapped-> {scalers} [213];
        $Awfif::memes-> {desrwd} = $Awfif::mapped-> {scalers} [214];
        $Awfif::memes-> {descafrom} = $Awfif::mapped-> {scalers} [215];
        $Awfif::memes-> {descato} = $Awfif::mapped-> {scalers} [216];
        $Awfif::memes-> {descatype} = $Awfif::mapped-> {scalers} [217];
        $Awfif::memes-> {datp} = $Awfif::mapped-> {scalers} [218];
        $Awfif::memes-> {fatigue} = $Awfif::mapped-> {scalers} [219];
        $Awfif::memes-> {fatp} = $Awfif::mapped-> {scalers} [220];
        $Awfif::memes-> {fcodelets} = $Awfif::mapped-> {scalers} [221];
        $Awfif::memes-> {gatp} = $Awfif::mapped-> {scalers} [222];
        $Awfif::memes-> {halomax} = $Awfif::mapped-> {scalers} [223];
        $Awfif::memes-> {ldav} = $Awfif::mapped-> {scalers} [224];
        $Awfif::memes-> {ldoav} = $Awfif::mapped-> {scalers} [225];
        $Awfif::memes-> {lderr} = $Awfif::mapped-> {scalers} [226];
        $Awfif::memes-> {ldlcycle} = $Awfif::mapped-> {scalers} [227];
        $Awfif::memes-> {ldlcyclemax} = $Awfif::mapped-> {scalers} [228];
        $Awfif::memes-> {ldmcycle} = $Awfif::mapped-> {scalers} [229];
        $Awfif::memes-> {ldmcyclemax} = $Awfif::mapped-> {scalers} [230];
        $Awfif::memes-> {ldsignal} = $Awfif::mapped-> {scalers} [231];
        $Awfif::memes-> {iphase} = $Awfif::mapped-> {scalers} [232];
        $Awfif::memes-> {iphasecomp} = $Awfif::mapped-> {scalers} [233];
        $Awfif::memes-> {minnorm} = $Awfif::mapped-> {scalers} [234];
        $Awfif::memes-> {mrework} = $Awfif::mapped-> {scalers} [235];
        $Awfif::memes-> {maxact} = $Awfif::mapped-> {scalers} [236];
        $Awfif::memes-> {maxoper} = $Awfif::mapped-> {scalers} [237];
        $Awfif::memes-> {ndecay} = $Awfif::mapped-> {scalers} [238];
        $Awfif::memes-> {ntact} = $Awfif::mapped-> {scalers} [239];
        $Awfif::memes-> {openafrom} = $Awfif::mapped-> {scalers} [240];
        $Awfif::memes-> {openato} = $Awfif::mapped-> {scalers} [241];
        $Awfif::memes-> {openatype} = $Awfif::mapped-> {scalers} [242];
        $Awfif::memes-> {pstream} = $Awfif::mapped-> {scalers} [243];
        $Awfif::memes-> {peaksal} = $Awfif::mapped-> {scalers} [244];
        $Awfif::memes-> {groupsponsor} = $Awfif::mapped-> {scalers} [245];
        $Awfif::memes-> {jhlp} = $Awfif::mapped-> {scalers} [246];
        $Awfif::memes-> {lbbase} = $Awfif::mapped-> {scalers} [247];
        $Awfif::memes-> {lebase} = $Awfif::mapped-> {scalers} [248];
        $Awfif::memes-> {lsbase} = $Awfif::mapped-> {scalers} [249];
        $Awfif::memes-> {lsnbase} = $Awfif::mapped-> {scalers} [250];
        $Awfif::memes-> {log} = $Awfif::mapped-> {scalers} [251];
        $Awfif::memes-> {logentry} = $Awfif::mapped-> {scalers} [252];
        $Awfif::memes-> {relafrom} = $Awfif::mapped-> {scalers} [253];
        $Awfif::memes-> {relato} = $Awfif::mapped-> {scalers} [254];
        $Awfif::memes-> {relatype} = $Awfif::mapped-> {scalers} [255];
        $Awfif::memes-> {relamp} = $Awfif::mapped-> {scalers} [256];
        $Awfif::memes-> {relbar} = $Awfif::mapped-> {scalers} [257];
        $Awfif::memes-> {relrwd} = $Awfif::mapped-> {scalers} [258];
        $Awfif::memes-> {rtemp} = $Awfif::mapped-> {scalers} [259];
        $Awfif::memes-> {bondthreshold} = $Awfif::mapped-> {scalers} [260];
        $Awfif::memes-> {descthreshold} = $Awfif::mapped-> {scalers} [261];
        $Awfif::memes-> {destthreshold} = $Awfif::mapped-> {scalers} [262];
        $Awfif::memes-> {structamp} = $Awfif::mapped-> {scalers} [263];
        $Awfif::memes-> {strbcont} = $Awfif::mapped-> {scalers} [264];
        $Awfif::memes-> {strnbcont} = $Awfif::mapped-> {scalers} [265];
        $Awfif::memes-> {tcodelets} = $Awfif::mapped-> {scalers} [266];
        $Awfif::memes-> {tcodeletmax} = $Awfif::mapped-> {scalers} [267];
        $Awfif::memes-> {trace} = $Awfif::mapped-> {scalers} [268];
        $Awfif::memes-> {traceentry} = $Awfif::mapped-> {scalers} [269];
        $Awfif::memes-> {tracetemp} = $Awfif::mapped-> {scalers} [270];
        $Awfif::memes-> {traceurg} = $Awfif::mapped-> {scalers} [271];
        $Awfif::memes-> {tracefull} = $Awfif::mapped-> {scalers} [272];
        $Awfif::memes-> {tracephase} = $Awfif::mapped-> {scalers} [273];
        $Awfif::memes-> {tracetree} = $Awfif::mapped-> {scalers} [274];
        $Awfif::memes-> {tracemcache} = $Awfif::mapped-> {scalers} [275];
        $Awfif::memes-> {tracescache} = $Awfif::mapped-> {scalers} [276];
        $Awfif::memes-> {tracewscache} = $Awfif::mapped-> {scalers} [277];
        $Awfif::memes-> {tmcacheth} = $Awfif::mapped-> {scalers} [278];
        $Awfif::memes-> {tscacheth} = $Awfif::mapped-> {scalers} [279];
        $Awfif::memes-> {twscacheth} = $Awfif::mapped-> {scalers} [280];
        $Awfif::memes-> {kwmi} = $Awfif::mapped-> {scalers} [281];
        $Awfif::memes-> {kwmir} = $Awfif::mapped-> {scalers} [282];
        $Awfif::memes-> {kwwsbi} = $Awfif::mapped-> {scalers} [283];
        $Awfif::memes-> {kwp} = $Awfif::mapped-> {scalers} [284];
        $Awfif::memes-> {kwpr} = $Awfif::mapped-> {scalers} [285];
        $Awfif::memes-> {mtsnlvl} = $Awfif::mapped-> {scalers} [286];
        $Awfif::memes-> {mtsnstate} = $Awfif::mapped-> {scalers} [287];
        $Awfif::memes-> {shout} = $Awfif::mapped-> {scalers} [288];
        $Awfif::memes-> {slipth} = $Awfif::mapped-> {scalers} [289];
        $Awfif::memes-> {snehih} = $Awfif::mapped-> {scalers} [290];
        $Awfif::memes-> {uhmax} = $Awfif::mapped-> {scalers} [291];
        $Awfif::memes-> {uhth} = $Awfif::mapped-> {scalers} [292];
        $Awfif::memes-> {wsohih} = $Awfif::mapped-> {scalers} [293];
        $Awfif::slipnet-> {p} = $Awfif::mapped-> {scalers} [294];
        $Awfif::slehist-> {p} = $Awfif::mapped-> {scalers} [295];
        $Awfif::wsohist-> {p} = $Awfif::mapped-> {scalers} [296];
        $Awfif::jhls-> {p} = $Awfif::mapped-> {scalers} [297];
        $Awfif::attribs-> {p} = $Awfif::mapped-> {scalers} [298];
        $Awfif::csehist-> {p} = $Awfif::mapped-> {scalers} [299];
        $Awfif::clnk-> {h} = $Awfif::mapped-> {scalers} [300];
        $Awfif::clnk-> {t} = $Awfif::mapped-> {scalers} [301];
        $Awfif::clnk-> {f} = $Awfif::mapped-> {scalers} [302];
        $Awfif::clnk-> {flistl} = $Awfif::mapped-> {scalers} [303];
        $Awfif::clnk-> {p} = $Awfif::mapped-> {scalers} [304];
        $Awfif::memes-> {loopcheck} = $Awfif::mapped-> {scalers} [305];
        $Awfif::memes-> {loopth} = $Awfif::mapped-> {scalers} [306];
        $Awfif::memes-> {ptrace} = $Awfif::mapped-> {scalers} [307];
        $Awfif::memes-> {failatpr} = $Awfif::mapped-> {scalers} [308];
        $Awfif::memes-> {traceadentry} = $Awfif::mapped-> {scalers} [309];
        $Awfif::memes-> {telomeretrace} = $Awfif::mapped-> {scalers} [310];
        $Awfif::memes-> {tracedpcache} = $Awfif::mapped-> {scalers} [311];
        $Awfif::memes-> {tracevcentry} = $Awfif::mapped-> {scalers} [312];
        $Awfif::memes-> {traceclogentry}= $Awfif::mapped-> {scalers} [313];
        $Awfif::memes-> {ratcoth} = $Awfif::mapped-> {scalers} [314];
        $Awfif::memes-> {abscoth} = $Awfif::mapped-> {scalers} [315];
        $Awfif::memes-> {nomcrsmgrab} = $Awfif::mapped-> {scalers} [316];
        $Awfif::memes-> {ssiasslncusetmass}= $Awfif::mapped-> {scalers} [317];
        $Awfif::memes-> {tracetime} = $Awfif::mapped-> {scalers} [318];
        $Awfif::memes-> {tracehrtime} = $Awfif::mapped-> {scalers} [319];
        $Awfif::memes-> {tellifeth} = $Awfif::mapped-> {scalers} [320];
        $Awfif::memes-> {telcountth} = $Awfif::mapped-> {scalers} [321];
        $Awfif::memes-> {inhuramp} = $Awfif::mapped-> {scalers} [322];
        $Awfif::memes-> {usewcf1d} = $Awfif::mapped-> {scalers} [323];
        $Awfif::memes-> {usetdfmod} = $Awfif::mapped-> {scalers} [324];
        $Awfif::memes-> {tdfsampth} = $Awfif::mapped-> {scalers} [325];
        $Awfif::memes-> {tdfsampds} = $Awfif::mapped-> {scalers} [326];
        $Awfif::memes-> {tdfsampacc} = $Awfif::mapped-> {scalers} [327];
        $Awfif::memes-> {mainco} = $Awfif::mapped-> {scalers} [328];
        $Awfif::memes-> {maininc} = $Awfif::mapped-> {scalers} [329];
        $Awfif::memes-> {freeampth} = $Awfif::mapped-> {scalers} [330];
        $Awfif::memes-> {maxusefree} = $Awfif::mapped-> {scalers} [331];
        $Awfif::memes-> {bcsubpsindex} = $Awfif::mapped-> {scalers} [332];
        $Awfif::memes-> {ivalwindex} = $Awfif::mapped-> {scalers} [333];
        $Awfif::memes-> {crsmindex} = $Awfif::mapped-> {scalers} [334];
        $Awfif::memes-> {totup} = $Awfif::mapped-> {scalers} [335];
        $Awfif::memes-> {bugsmax} = $Awfif::mapped-> {scalers} [336];
        $Awfif::memes-> {killth} = $Awfif::mapped-> {scalers} [337];
        $Awfif::memes-> {ampramp} = $Awfif::mapped-> {scalers} [338];
        $Awfif::memes-> {waitamp} = $Awfif::mapped-> {scalers} [339];
        $Awfif::memes-> {convfrom} = $Awfif::mapped-> {scalers} [340];
        $Awfif::memes-> {groupatype} = $Awfif::mapped-> {scalers} [341];
        $Awfif::memes-> {groupato} = $Awfif::mapped-> {scalers} [342];
        $Awfif::memes-> {groupafrom} = $Awfif::mapped-> {scalers} [343];
        $Awfif::memes-> {bumscu} = $Awfif::mapped-> {scalers} [344];
        $Awfif::memes-> {tdgsramp} = $Awfif::mapped-> {scalers} [345];
        $Awfif::memes-> {geramp} = $Awfif::mapped-> {scalers} [346];
        $Awfif::memes-> {gerhiamp} = $Awfif::mapped-> {scalers} [347];
        $Awfif::memes-> {budestscu} = $Awfif::mapped-> {scalers} [348];
        $Awfif::memes-> {pappbu} = $Awfif::mapped-> {scalers} [349];
        $Awfif::memes-> {parteu} = $Awfif::mapped-> {scalers} [350];
        $Awfif::memes-> {evlaunchm} = $Awfif::mapped-> {scalers} [351];
        $Awfif::memes-> {evlaunchhim} = $Awfif::mapped-> {scalers} [352];
        $Awfif::memes-> {blaunchm} = $Awfif::mapped-> {scalers} [353];
        $Awfif::memes-> {ilaunchm} = $Awfif::mapped-> {scalers} [354];
        $Awfif::memes-> {icompdlaunchm} = $Awfif::mapped-> {scalers} [355];
        $Awfif::memes-> {manthreshold} = $Awfif::mapped-> {scalers} [356];
        $Awfif::memes-> {pstment} = $Awfif::mapped-> {scalers} [357];
        $Awfif::memes-> {pactive} = $Awfif::mapped-> {scalers} [358];
        $Awfif::memes-> {psubprogram} = $Awfif::mapped-> {scalers} [359];
        $Awfif::memes-> {acodelets} = $Awfif::mapped-> {scalers} [360];
        $Awfif::memes-> {mincodelets} = $Awfif::mapped-> {scalers} [361];
        $Awfif::memes-> {breakmyli} = $Awfif::mapped-> {scalers} [362];
        $Awfif::memes-> {bmbcindex} = $Awfif::mapped-> {scalers} [363];
        $Awfif::memes-> {drwait} = $Awfif::mapped-> {scalers} [364];
        $Awfif::memes-> {crfocuswin} = $Awfif::mapped-> {scalers} [365];
        $Awfif::memes-> {grcompaward} = $Awfif::mapped-> {scalers} [366];
        $Awfif::memes-> {salthr} = $Awfif::mapped-> {scalers} [367];
        $Awfif::memes-> {mmratio} = $Awfif::mapped-> {scalers} [368];
        $Awfif::memes-> {dmratio} = $Awfif::mapped-> {scalers} [369];
        $Awfif::memes-> {verbsrcws} = $Awfif::mapped-> {scalers} [370];
        $Awfif::memes-> {verbtaws} = $Awfif::mapped-> {scalers} [371];
        $Awfif::memes-> {clogbplist} = $Awfif::mapped-> {scalers} [372];
        $Awfif::memes-> {clogeplist} = $Awfif::mapped-> {scalers} [373];
        $Awfif::memes-> {clogs} = $Awfif::mapped-> {scalers} [374];
        $Awfif::memes-> {comprocessing} = $Awfif::mapped-> {scalers} [375];
        $Awfif::memes-> {cbprocessing} = $Awfif::mapped-> {scalers} [376];
        $Awfif::memes-> {maxnormitems} = $Awfif::mapped-> {scalers} [377];
        $Awfif::memes-> {cpcountth} = $Awfif::mapped-> {scalers} [378];
        $Awfif::memes-> {maxtdgloop} = $Awfif::mapped-> {scalers} [379];
        $Awfif::memes-> {itswsallc} = $Awfif::mapped-> {scalers} [380];
        $Awfif::memes-> {wsoname} = $Awfif::mapped-> {scalers} [381];
        $Awfif::memes-> {buildfbth} = $Awfif::mapped-> {scalers} [382];
        $Awfif::memes-> {delayselcount} = $Awfif::mapped-> {scalers} [383];
        $Awfif::memes-> {delayamp} = $Awfif::mapped-> {scalers} [384];
        $Awfif::memes-> {tgnth} = $Awfif::mapped-> {scalers} [385];
        $Awfif::memes-> {doprsib} = $Awfif::mapped-> {scalers} [386];
        $Awfif::memes-> {chckadd} = $Awfif::mapped-> {scalers} [387];
        $Awfif::memes-> {checktransidnz}= $Awfif::mapped-> {scalers} [388];
        $Awfif::memes-> {checksubpidnz} = $Awfif::mapped-> {scalers} [389];
        $Awfif::memes-> {tral} = $Awfif::mapped-> {scalers} [390];
        $Awfif::memes-> {applycmin} = $Awfif::mapped-> {scalers} [391];
        $Awfif::memes-> {iapplycth} = $Awfif::mapped-> {scalers} [392];
        $Awfif::memes-> {applycth} = $Awfif::mapped-> {scalers} [393];
        $Awfif::memes-> {iapplyramp} = $Awfif::mapped-> {scalers} [394];
        $Awfif::memes-> {applyramp} = $Awfif::mapped-> {scalers} [395];
        $Awfif::memes-> {applycount} = $Awfif::mapped-> {scalers} [396];
        $Awfif::memes-> {applyactive} = $Awfif::mapped-> {scalers} [397];
        $Awfif::memes-> {applyspigdiv} = $Awfif::mapped-> {scalers} [398];
        $Awfif::memes-> {newdep} = $Awfif::mapped-> {scalers} [399];
        $Awfif::memes-> {bnotsalient} = $Awfif::mapped-> {scalers} [400];
        $Awfif::memes-> {bsalient} = $Awfif::mapped-> {scalers} [401];
        $Awfif::memes-> {submult} = $Awfif::mapped-> {scalers} [402];
        $Awfif::memes-> {submitted} = $Awfif::mapped-> {scalers} [403];
        $Awfif::memes-> {casetrmcws} = $Awfif::mapped-> {scalers} [404];
        $Awfif::memes-> {casetrmbcwso} = $Awfif::mapped-> {scalers} [405];
        $Awfif::memes-> {subptrachcount}= $Awfif::mapped-> {scalers} [406];
        $Awfif::memes-> {acaseoutputps} = $Awfif::mapped-> {scalers} [407];
        $Awfif::memes-> {subprefctr} = $Awfif::mapped-> {scalers} [408];
        $Awfif::memes-> {allowspigrabmax}= $Awfif::mapped-> {scalers} [409];
        $Awfif::memes-> {veccah} = $Awfif::mapped-> {scalers} [410];
        $Awfif::memes-> {veccab} = $Awfif::mapped-> {scalers} [411];
        $Awfif::memes-> {usewsodirect} = $Awfif::mapped-> {scalers} [412];
        $Awfif::memes-> {usewsobfdirect}= $Awfif::mapped-> {scalers} [413];

        $Awfif::cstruct-> {istringf} = $Awfif::mapped-> {scalers} [414];
        $Awfif::memes-> {codeletdef} = $Awfif::mapped-> {scalers} [415];
        $Awfif::memes-> {jhldesf} = $Awfif::mapped-> {scalers} [416];
        $Awfif::memes-> {attribdesf} = $Awfif::mapped-> {scalers} [417];
        $Awfif::memes-> {attribdesh} = $Awfif::mapped-> {scalers} [418];
        $Awfif::costatel-> {fclnk} = $Awfif::mapped-> {scalers} [419];
        $Awfif::costatel-> {h} = $Awfif::mapped-> {scalers} [420];
        $Awfif::costatel-> {t} = $Awfif::mapped-> {scalers} [421];
        $Awfif::costatel-> {f} = $Awfif::mapped-> {scalers} [422];
        $Awfif::costatel-> {flistl} = $Awfif::mapped-> {scalers} [423];
        $Awfif::costatel-> {tlistl} = $Awfif::mapped-> {scalers} [424];
        $Awfif::costatel-> {p} = $Awfif::mapped-> {scalers} [425];
        $Awfif::memes-> {allwsstr} = $Awfif::mapped-> {scalers} [426];
        $Awfif::memes-> {npconc} = $Awfif::mapped-> {scalers} [427];
        $Awfif::memes-> {maxpconcs} = $Awfif::mapped-> {scalers} [428];
        $Awfif::memes-> {smlscstate} = $Awfif::mapped-> {scalers} [429];
        $Awfif::memes-> {srfsmcstate} = $Awfif::mapped-> {scalers} [430];
        $Awfif::memes-> {trfsmcstate} = $Awfif::mapped-> {scalers} [431];
        $Awfif::memes-> {nfsmcstate} = $Awfif::mapped-> {scalers} [432];
        $Awfif::kwbracketd->{incb} = $Awfif::mapped-> {scalers} [433];
        $Awfif::kwbracketd->{incs} = $Awfif::mapped-> {scalers} [434];
        $Awfif::kwbracketd->{bmec} = $Awfif::mapped-> {scalers} [435];
        $Awfif::kwbracketd->{ibmec} = $Awfif::mapped-> {scalers} [436];
        $Awfif::kwbracketd->{smsc} = $Awfif::mapped-> {scalers} [437];
        $Awfif::kwjhl-> {jhlp} = $Awfif::mapped-> {scalers} [438];
        $Awfif::starttime-> {sec} = $Awfif::mapped-> {scalers} [439];
        $Awfif::starttime-> {min} = $Awfif::mapped-> {scalers} [440];
        $Awfif::starttime-> {hour} = $Awfif::mapped-> {scalers} [441];
        $Awfif::starttime-> {mday} = $Awfif::mapped-> {scalers} [442];
        $Awfif::starttime-> {mon} = $Awfif::mapped-> {scalers} [443];
        $Awfif::starttime-> {year} = $Awfif::mapped-> {scalers} [444];
        $Awfif::starttime-> {wday} = $Awfif::mapped-> {scalers} [445];
        $Awfif::starttime-> {yday} = $Awfif::mapped-> {scalers} [446];
        $Awfif::starttime-> {isdat} = $Awfif::mapped-> {scalers} [447];
        $Awfif::memes-> {fjhls8} = $Awfif::mapped-> {scalers} [448];
        $Awfif::memes-> {nwsi} = $Awfif::mapped-> {scalers} [449];

        &retrieveds ($myli, \$Awfif::memes-> {sactset}, $dirprefix . 'dcache/memes_sactset.dat');

        &retrieveds ($myli, \$Awfif::memes-> {snnih}, $dirprefix . 'dcache/memes_snnih.dat');

        &retrieveds ($myli, \$Awfif::codelet-> {l}, $dirprefix . 'dcache/codelet_l.dat');

        &retrieveds ($myli, \$Awfif::codelet-> {t}, $dirprefix . 'dcache/codelet_t.dat');

        &retrieveds ($myli, \$Awfif::harray-> {tce}, $dirprefix . 'dcache/harray_tce.dat');

        &retrieveds ($myli, \$Awfif::mapped-> {scalers}, $dirprefix . 'dcache/mapped_scalers.dat');

        &retrieveds ($myli, \$Awfif::harray-> {tce}, $dirprefix . 'dcache/harray_tce.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {statement}, $dirprefix . 'dcache/wsbl_statement.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {sgmfile}, $dirprefix . 'dcache/wsbl_sgmfile.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {l}, $dirprefix . 'dcache/wsbl_l.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {winkwp}, $dirprefix . 'dcache/wsbl_winkwp.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {winkwpr}, $dirprefix . 'dcache/wsbl_winkwpr.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsactive}, $dirprefix . 'dcache/wsbl_wsactive.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsoh}, $dirprefix . 'dcache/wsbl_wsoh.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsot}, $dirprefix . 'dcache/wsbl_wsot.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsoto}, $dirprefix . 'dcache/wsbl_wsoto.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsft}, $dirprefix . 'dcache/wsbl_wsft.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsbloh}, $dirprefix . 'dcache/wsbl_wsbloh.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsblot}, $dirprefix . 'dcache/wsbl_wsblot.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsohih}, $dirprefix . 'dcache/wsbl_wsohih.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsas}, $dirprefix . 'dcache/wsbl_wsas.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {wsss}, $dirprefix . 'dcache/wsbl_wsss.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {newhead}, $dirprefix . 'dcache/wsbl_newhead.dat');

        &retrieveds ($myli, \$Awfif::wsbl-> {ofssum}, $dirprefix . 'dcache/wsbl_ofssum.dat');

        &retrieveds ($myli, \$Awfif::wsol-> {l}, $dirprefix . 'dcache/wsol_l.dat');

        &retrieveds ($myli, \$Awfif::wsol-> {ni}, $dirprefix . 'dcache/wsol_ni.dat');

        &retrieveds ($myli, \$Awfif::workspace-> {l}, $dirprefix . 'dcache/workspace_l.dat');

        &retrieveds ($myli, \$Awfif::wontgroupc-> {l}, $dirprefix . 'dcache/wontgroupc_l.dat');

        &retrieveds ($myli, \$Awfif::wontgroupc-> {i}, $dirprefix . 'dcache/wontgroupc_i.dat');

        &retrieveds ($myli, \$Awfif::bicl-> {l}, $dirprefix . 'dcache/bicl_l.dat');

        &retrieveds ($myli, \$Awfif::bicl-> {rec}, $dirprefix . 'dcache/bicl_rec.dat');

        &retrieveds ($myli, \$Awfif::norml-> {h}, $dirprefix . 'dcache/norml_h.dat');

        &retrieveds ($myli, \$Awfif::norml-> {t}, $dirprefix . 'dcache/norml_t.dat');

        &retrieveds ($myli, \$Awfif::norml-> {l}, $dirprefix . 'dcache/norml_l.dat');

        &retrieveds ($myli, \$Awfif::norml-> {min}, $dirprefix . 'dcache/norml_min.dat');

        &retrieveds ($myli, \$Awfif::norml-> {max}, $dirprefix . 'dcache/norml_max.dat');

        &retrieveds ($myli, \$Awfif::ifbhcl-> {l}, $dirprefix . 'dcache/ifbhcl_l.dat');

        &retrieveds ($myli, \$Awfif::ifbhcl-> {hc}, $dirprefix . 'dcache/ifbhcl_hc.dat');

        &retrieveds ($myli, \$Awfif::ilabhcl-> {l}, $dirprefix . 'dcache/ilabhcl_l.dat');

        &retrieveds ($myli, \$Awfif::ilabhcl-> {hc}, $dirprefix . 'dcache/ilabhcl_hc.dat');

        &retrieveds ($myli, \$Awfif::framel-> {l}, $dirprefix . 'dcache/framel_l.dat');

        &retrieveds ($myli, \$Awfif::subpl-> {l}, $dirprefix . 'dcache/subpl_l.dat');

        &retrieveds ($myli, \$Awfif::subpl-> {q}, $dirprefix . 'dcache/subpl_q.dat');

        &retrieveds ($myli, \$Awfif::subpl-> {w}, $dirprefix . 'dcache/subpl_w.dat');

        &retrieveds ($myli, \$Awfif::costatel-> {l}, $dirprefix . 'dcache/costatel_l.dat');

        &retrieveds ($myli, \$Awfif::costatel-> {hash}, $dirprefix . 'dcache/costatel_hash.dat');

        &retrieveds ($myli, \$Awfif::amoffl-> {l}, $dirprefix . 'dcache/amoffl_l.dat');

        &retrieveds ($myli, \$Awfif::poolcl-> {l}, $dirprefix . 'dcache/poolcl_l.dat');

        &retrieveds ($myli, \$Awfif::syncl-> {l}, $dirprefix . 'dcache/syncl_l.dat');

        &retrieveds ($myli, \$Awfif::synccodl-> {l}, $dirprefix . 'dcache/synccodl_l.dat');

        &retrieveds ($myli, \$Awfif::cswsol-> {l}, $dirprefix . 'dcache/cswsol_l.dat');

        &retrieveds ($myli, \$Awfif::subpscdefl-> {l}, $dirprefix . 'dcache/subpscdefl_l.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {l}, $dirprefix . 'dcache/veccol_l.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {head}, $dirprefix . 'dcache/veccol_head.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {index}, $dirprefix . 'dcache/veccol_index.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {strategy}, $dirprefix . 'dcache/veccol_strategy.dat');

        &retrieveds ($myli, \$Awfif::veccol-> {ststate}, $dirprefix . 'dcache/veccol_ststate.dat');

        &retrieveds ($myli, \$Awfif::histonel-> {l}, $dirprefix . 'dcache/histonel_l.dat');

        &retrieveds ($myli, \$Awfif::hnamel-> {l}, $dirprefix . 'dcache/hnamel_l.dat');

        &retrieveds ($myli, \$Awfif::itswsall-> {l}, $dirprefix . 'dcache/itswsall_l.dat');

        &retrieveds ($myli, \$Awfif::inhibl-> {l}, $dirprefix . 'dcache/inhibl_l.dat');

        &retrieveds ($myli, \$Awfif::inhibl-> {clpa}, $dirprefix . 'dcache/inhibl_clpa.dat');

        &retrieveds ($myli, \$Awfif::trfl-> {l}, $dirprefix . 'dcache/trfl_l.dat');

        &retrieveds ($myli, \$Awfif::trfl-> {clpa}, $dirprefix . 'dcache/trfl_clpa.dat');

        &retrieveds ($myli, \$Awfif::tral-> {l}, $dirprefix . 'dcache/tral_l.dat');

        &retrieveds ($myli, \$Awfif::tral-> {i}, $dirprefix . 'dcache/tral_i.dat');

        &retrieveds ($myli, \$Awfif::tral-> {w}, $dirprefix . 'dcache/tral_w.dat');

        &retrieveds ($myli, \$Awfif::tral-> {wt}, $dirprefix . 'dcache/tral_wt.dat');

        &retrieveds ($myli, \$Awfif::tral-> {sameash}, $dirprefix . 'dcache/tral_sameash.dat');

        &retrieveds ($myli, \$Awfif::tral-> {sameast}, $dirprefix . 'dcache/tral_sameast.dat');

        &retrieveds ($myli, \$Awfif::tral-> {sameas}, $dirprefix . 'dcache/tral_sameas.dat');

        &retrieveds ($myli, \$Awfif::tral-> {sameasaadd}, $dirprefix . 'dcache/tral_sameasaadd.dat');

        &retrieveds ($myli, \$Awfif::tral-> {c}, $dirprefix . 'dcache/tral_c.dat');

        &retrieveds ($myli, \$Awfif::tral-> {r}, $dirprefix . 'dcache/tral_r.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {l}, $dirprefix . 'dcache/tmassl_l.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {r}, $dirprefix . 'dcache/tmassl_r.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {s}, $dirprefix . 'dcache/tmassl_s.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {wsoh}, $dirprefix . 'dcache/tmassl_wsoh.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {wsot}, $dirprefix . 'dcache/tmassl_wsot.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {first}, $dirprefix . 'dcache/tmassl_first.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {salience}, $dirprefix . 'dcache/tmassl_salience.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {submitted}, $dirprefix . 'dcache/tmassl_submitted.dat');

        &retrieveds ($myli, \$Awfif::tmassl-> {proc}, $dirprefix . 'dcache/tmassl_proc.dat');

        &retrieveds ($myli, \$Awfif::kwl-> {l}, $dirprefix . 'dcache/kwl_l.dat');

        &retrieveds ($myli, \$Awfif::kwl-> {i}, $dirprefix . 'dcache/kwl_i.dat');

        &retrieveds ($myli, \$Awfif::kwl-> {w}, $dirprefix . 'dcache/kwl_w.dat');

        &retrieveds ($myli, \$Awfif::mkwl-> {l}, $dirprefix . 'dcache/mkwl_l.dat');

        &retrieveds ($myli, \$Awfif::mkwl-> {i}, $dirprefix . 'dcache/mkwl_i.dat');

        &retrieveds ($myli, \$Awfif::aspl-> {l}, $dirprefix . 'dcache/aspl_l.dat');

        &retrieveds ($myli, \$Awfif::aspl-> {i}, $dirprefix . 'dcache/aspl_i.dat');

        &retrieveds ($myli, \$Awfif::aspl-> {ws}, $dirprefix . 'dcache/aspl_ws.dat');

        &retrieveds ($myli, \$Awfif::aspl-> {nws}, $dirprefix . 'dcache/aspl_nws.dat');
# clp is transient so no reason to store

        &retrieveds ($myli, \$Awfif::sametl-> {l}, $dirprefix . 'dcache/sametl_l.dat');

        &retrieveds ($myli, \$Awfif::memes-> {backoffactive}, $dirprefix . 'dcache/memes_backoffactive.dat');

        &retrieveds ($myli, \$Awfif::memes-> {backoffactives}, $dirprefix . 'dcache/memes_backoffactives.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breakcodelet}, $dirprefix . 'dcache/memes_breakcodelet.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breaksubp}, $dirprefix . 'dcache/memes_breaksubp.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breakthwso}, $dirprefix . 'dcache/memes_breakthwso.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breakthsubp}, $dirprefix . 'dcache/memes_breakthsubp.dat');

        &retrieveds ($myli, \$Awfif::memes-> {ldbuffer}, $dirprefix . 'dcache/memes_ldbuffer.dat');

        &retrieveds ($myli, \$Awfif::memes-> {jhip}, $dirprefix . 'dcache/memes_jhip.dat');

        &retrieveds ($myli, \$Awfif::memes-> {jhlabel}, $dirprefix . 'dcache/memes_jhlabel.dat');

        &retrieveds ($myli, \$Awfif::memes-> {jhlg}, $dirprefix . 'dcache/memes_jhlg.dat');

        &retrieveds ($myli, \$Awfif::memes-> {temp}, $dirprefix . 'dcache/memes_temp.dat');

        &retrieveds ($myli, \$Awfif::memes-> {time}, $dirprefix . 'dcache/memes_time.dat');

        &retrieveds ($myli, \$Awfif::memes-> {keywordh}, $dirprefix . 'dcache/memes_keywordh.dat');

        &retrieveds ($myli, \$Awfif::memes-> {keywordl}, $dirprefix . 'dcache/memes_keywordl.dat');

        &retrieveds ($myli, \$Awfif::memes-> {keywordwsih}, $dirprefix . 'dcache/memes_keywordwsih.dat');

        &retrieveds ($myli, \$Awfif::memes-> {mtsnlc}, $dirprefix . 'dcache/memes_mtsnlc.dat');

        &retrieveds ($myli, \$Awfif::memes-> {sactset}, $dirprefix . 'dcache/memes_sactset.dat');

        &retrieveds ($myli, \$Awfif::memes-> {snnh}, $dirprefix . 'dcache/memes_snnh.dat');

        &retrieveds ($myli, \$Awfif::memes-> {snnih}, $dirprefix . 'dcache/memes_snnih.dat');

        &retrieveds ($myli, \$Awfif::memes-> {snw}, $dirprefix . 'dcache/memes_snw.dat');

        &retrieveds ($myli, \$Awfif::memes-> {wsm}, $dirprefix . 'dcache/memes_wsm.dat');

        &retrieveds ($myli, \$Awfif::memes-> {wslocality}, $dirprefix . 'dcache/memes_wslocality.dat');

        &retrieveds ($myli, \$Awfif::slipnet-> {l}, $dirprefix . 'dcache/slipnet_l.dat');

        &retrieveds ($myli, \$Awfif::slehist-> {l}, $dirprefix . 'dcache/slehist_l.dat');

        &retrieveds ($myli, \$Awfif::wsohist-> {l}, $dirprefix . 'dcache/wsohist_l.dat');

        &retrieveds ($myli, \$Awfif::jhls-> {l}, $dirprefix . 'dcache/jhls_l.dat');

        &retrieveds ($myli, \$Awfif::attribs-> {l}, $dirprefix . 'dcache/attribs_l.dat');

        &retrieveds ($myli, \$Awfif::codelet-> {l}, $dirprefix . 'dcache/codelet_l.dat');

        &retrieveds ($myli, \$Awfif::codelet-> {t}, $dirprefix . 'dcache/codelet_t.dat');

        &retrieveds ($myli, \$Awfif::csehist-> {cseh}, $dirprefix . 'dcache/csehist_cseh.dat');

        &retrieveds ($myli, \$Awfif::csehist-> {cseih}, $dirprefix . 'dcache/csehist_cseih.dat');

        &retrieveds ($myli, \$Awfif::csehist-> {d}, $dirprefix . 'dcache/csehist_d.dat');

        &retrieveds ($myli, \$Awfif::csehist-> {l}, $dirprefix . 'dcache/csehist_l.dat');

        &retrieveds ($myli, \$Awfif::cache-> {l}, $dirprefix . 'dcache/cache_l.dat');

        &retrieveds ($myli, \$Awfif::cache-> {h}, $dirprefix . 'dcache/cache_h.dat');

        &retrieveds ($myli, \$Awfif::pcache-> {l}, $dirprefix . 'dcache/pcache_l.dat');

        &retrieveds ($myli, \$Awfif::pcache-> {t}, $dirprefix . 'dcache/pcache_t.dat');

        &retrieveds ($myli, \$Awfif::pcache-> {accessed}, $dirprefix . 'dcache/pcache_accessed.dat');

        &retrieveds ($myli, \$Awfif::pcache-> {p}, $dirprefix . 'dcache/pcache_p.dat');

        &retrieveds ($myli, \$Awfif::clnk-> {l}, $dirprefix . 'dcache/clnk_l.dat');

        &retrieveds ($myli, \$Awfif::memes-> {crsmesubpspbreak}, $dirprefix . 'dcache/memes_crsmesubpspbreak.dat');

        &retrieveds ($myli, \$Awfif::memes-> {cruna}, $dirprefix . 'dcache/memes_cruna.dat');

        &retrieveds ($myli, \$Awfif::memes-> {activationchange}, $dirprefix . 'dcache/memes_activationchange.dat');

        &retrieveds ($myli, \$Awfif::memes-> {breaksalwso}, $dirprefix . 'dcache/memes_breaksalwso.dat');

        &retrieveds ($myli, \$Awfif::memes-> {leavein}, $dirprefix . 'dcache/memes_leavein.dat');

        &retrieveds ($myli, \$Awfif::memes-> {ch}, $dirprefix . 'dcache/memes_ch.dat');

        &retrieveds ($myli, \$Awfif::memes-> {cseh}, $dirprefix . 'dcache/memes_cseh.dat');

        &retrieveds ($myli, \$Awfif::memes-> {cseih}, $dirprefix . 'dcache/memes_cseih.dat');

        &retrieveds ($myli, \$Awfif::memes-> {streh}, $dirprefix . 'dcache/memes_streh.dat');

        &retrieveds ($myli, \$Awfif::memes-> {streih}, $dirprefix . 'dcache/memes_streih.dat');

        &retrieveds ($myli, \$Awfif::memes-> {strbool}, $dirprefix . 'dcache/memes_strbool.dat');

        &retrieveds ($myli, \$Awfif::cussnl, $dirprefix . 'dcache/cussnl.dat');

        &retrieveds ($myli, \$Awfif::kwjhl-> {jhip}, $dirprefix . 'dcache/kwjhl_jhip.dat');

        &retrieveds ($myli, \$Awfif::kwjhl-> {jhlabel}, $dirprefix . 'dcache/kwjhl_jhlabel.dat');

        &retrieveds ($myli, \$Awfif::kwjhl-> {jhlg}, $dirprefix . 'dcache/kwjhl_jhlg.dat');

        &retrieveds ($myli, \$Awfif::memes-> {dcodeletc}, $dirprefix . 'dcache/memes_dcodeletc.dat');

        &retrieveds ($myli, \$Awfif::memes-> {ieowner}, $dirprefix . 'dcache/memes_ieowner.dat');

        &retrieveds ($myli, \$Awfif::memes-> {gdeltachange}, $dirprefix . 'dcache/memes_gdeltachange.dat');
# retrieveffilesvbtu02


        &retrieveds ($myli, \$Awfif::wfcdefl-> {operon}, $dirprefix . 'dcache/wfcdefl_operon.dat');
        $test = chdir("..");
        };#if
      }#if
    elsif ($test) {
      $test = chdir("..");
      };#if

    return $result
    }# retrievefromfiles
#
#<!-- start tag vbt -->
#
sub storevbtgmtofiles {
    my ($dirprefix) = @_;
    my ($result);
# store all key data sets to files for later resume
#

    print ("storevbtgmtofiles started\n");

    $result = &storecscmap ($dirprefix . 'c' . 'dcache/vbotga_scmap.dac');

    $result = &storecfitness ($dirprefix . 'c' . 'dcache/vbotga_fitness.dat');

    $result = &storecparent ($dirprefix . 'c' . 'dcache/vbotga_parent.dat', 'parent');

    $result = &storecparent ($dirprefix . 'c' . 'dcache/vbotga_parent2.dat', 'parent2');

    print ("storevbtgmtofiles completed\n");
    return $result
    }# storevbtgmtofiles
#
sub retrievevbtgmfromfiles {
    my ($dirprefix) = @_;
    my ($result);
# retrieve all vbotga data sets from files
#

    $result = '';
    print ("retrievevbtgmfromfiles started\n");
    &retrievecscmap ($dirprefix . 'c' . 'dcache/vbotga_scmap.da');
    if ((defined ($Awfif::vbotga-> {scmap0} [0] [0])) ){

      $result = 't';
      &retrievecfitness ($dirprefix . 'c' . 'dcache/vbotga_fitness.dat');
      &retrievecparent ($dirprefix . 'c' . 'dcache/vbotga_parent.dat', 'parent');
      &retrievecparent ($dirprefix . 'c' . 'dcache/vbotga_parent2.dat', 'parent2');
      };#if
    print ("retrievevbtgmfromfiles completed\n");

    return $result
    }# retrievevbtgmfromfiles
#
sub storecscmap {
    my ($filestring) = @_;
# store scmap data set to comma seperated files for later resume
#
    my ($result, $i1, $i2, $i3, $i4);
    my (@file, %ssymbh);

    $result = '';
    print ("storecscmap entered\n");
# setup the output file

    $ssymbh {vbttoamnbuilder} = 'n';
    $ssymbh {vbttoamsbuilder} = 's';
    $ssymbh {vbttoamebuilder} = 'e';
    $ssymbh {vbttoamwbuilder} = 'w';
    $ssymbh {vbttoamrbuilder} = 'r';
    $ssymbh {vbttoapcbuilder} = 'c';
    $i3 = $Awfif::vbotga-> {gen};#new generation
    $i4 = 0; #output record counter
    $i1 = 0;#pop zero only exists in the 0 gen

    if ($Awfif::vbotga-> {gen} <= 0){
      $file [$i4] = '' . $i3;#generation number recorded at start of each of its records
      $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {scmap0} [$i1] [0];#count of items
      for ($i2 = 1; $i2 < $Awfif::vbotga-> {scmap0} [$i1] [0]; $i2++){

        $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {scmap0} [$i1] [$i2];
        };#for
      $i1++;
      $i4++;
      while ( defined($Awfif::vbotga-> {scmap0} [1] [0]) ){# zero record is special

        while ( defined($Awfif::vbotga-> {scmap0} [$i1] [0]) ){

          $file [$i4] = '' . $i3;#generation number recorded at start of each of its records
          $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {scmap0} [$i1] [0];#count of items
          for ($i2 = 1; $i2 < $Awfif::vbotga-> {scmap0} [$i1] [0]; $i2++){

            $file [$i4] = $file [$i4] . ',' . $ssymbh {$Awfif::vbotga-> {scmap0} [$i1] [$i2]};
            };#for

          $file [$i4] = $file [$i4] . ";\n";#newline
          $i1++;
          $i4++;
          };#while

        $i3++;
        $i1 = 1;
        };#while
      }# gen 0
    else {

      $i1++;#vbot

      while ( defined($Awfif::vbotga-> {scmapn} [$i1] [0]) ){

        $file [$i4] = '' . $i3;#generation number recorded at start of each of its records
        $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {scmapn} [$i1] [0];#count of items
        for ($i2 = 1; $i2 < $Awfif::vbotga-> {scmapn} [$i1] [0]; $i2++){

          $file [$i4] = $file [$i4] . ',' . $ssymbh {$Awfif::vbotga-> {scmapn} [$i1] [$i2]};
          };#for

        $file [$i4] = $file [$i4] . ";\n";#newline
        $i1++;
        $i4++;
        };#while

      $i3++;
      $i1 = 1;
      };#else

    open (FILE, ">>$filestring");#append
    if (-e FILE) {

# storecscmapapu1
      $result = 't';
      print ("storecscmap started\n");
      print FILE "@file";
      close (FILE);
      print ("storecscmap completed\n");
      } #got a file to output to
    else {

      print ("storecscmap failed\n");
      };

    return $result
    }# storecscmap
#
sub retrievecscmap {
    my ($ifilestring) = @_;
    my ($result, $records, $buffer, $filestring, $usedat, $othergen, $bgen, $gen, $bcount, $jhlsid, $i, $i2, $zerodone, $dset, $bname);
    my (@file, %ssymbh);
# retrieve vbotga scmap data sets from comma seperated files
#

    $result = '';
    print ("retrievecscmap started\n");
# get the records from the file

    @file = ();
    $records = 0;#no records yet
    $zerodone = '';#first data set is special
    $dset = 0;
    $gen = 0;
    $filestring = $ifilestring . 'c';#first see if there is a compressed .dac file

    &includesource (
      $filestring,
      \@file,
      \$records
      );
    if ($records <= 0) {

      $filestring = $ifilestring . 't';#if not see if there is a regular .dat file
      &includesource (
        $filestring,
        \@file,
        \$records
        );
      $usedat = 't';
      }#if
    else {#decompress the data

      $ssymbh {n} = 'vbttoamnbuilder';
      $ssymbh {s} = 'vbttoamsbuilder';
      $ssymbh {e} = 'vbttoamebuilder';
      $ssymbh {w} = 'vbttoamwbuilder';
      $ssymbh {r} = 'vbttoamrbuilder';
      $ssymbh {c} = 'vbttoapcbuilder';
      };#else
# load each record into the scmap structure

    $result = 't';
    $othergen = '';
    foreach $buffer (@file) {
# process the generation number

      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      $buffer =~ s/$1$2$3//;
      if ($bgen != $gen){

        $dset = 0;
        $gen = $bgen;
        last;# break out of the loop
        };#other generations
# process generation zero

      do {#for each dataset in the buffer

        if (!$zerodone){

          $zerodone = 't';
# get the count
          $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
          $bcount = $2;
          $buffer =~ s/$1$2$3$4//;
# on initial record load count in item 0
          $Awfif::vbotga-> {scmap0} [0] [0] = $bcount;
# get each item and load into scmap
          for ($i = 1; $i <= $bcount; $i++) {

            $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
            $jhlsid = $2;
            $buffer =~ s/$1$2$3$4//;
            $Awfif::vbotga-> {scmap0} [0] [$i] = $jhlsid;
            };
          }#if 0 data set
# process other generations
        else {
# get the count

          $dset++;
          $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
          $bcount = $2;
          $buffer =~ s/$1$2$3$4//;
# on initial record load count in item 0
          if ($bgen == 0) {

            $Awfif::vbotga-> {scmap0} [$dset] [0] = $bcount;
            }#if
          else {

            $Awfif::vbotga-> {scmapc} [$dset] [0] = $bcount;
            };#else
# get each item and load into scmap
          for ($i = 1; $i <= $bcount; $i++) {

            $buffer =~ /(\W*)? (\w*) (^,)* (,)?/x;
            if (!$usedat){

              $bname = $ssymbh {$2};
              }#if
            else {#original uncompressed file format

              $bname = $2;
              };#else
            $buffer =~ s/$1$2$3$4//;
            if ($bgen == 0) {

              $Awfif::vbotga-> {scmap0} [$dset] [$i] = $bname;
              }#if
            else {

              $Awfif::vbotga-> {scmapc} [$dset] [$i] = $bname;
              };#else
            };
          };#else other generations

        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $bcount = $2;
        } while ($bcount > 0);#may be more than one data set in the record
      };#for each
# walk back from the last record in the file finding the first record of the last generation. Then load all of that generation into scmapc

    my ($start, $end);
    $end = $#file;
    $start = 0;
    $buffer = $file [$end];
    $buffer =~ /(\d*) (^,)* (,)/x;
    $gen = $1;

    for ($i = $end; ($i > 0 & $start == 0);$i--){
      $buffer = $file [$i];
      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      if ($bgen != $gen){

        $start = $i + 1;
        };#other generations
      };# finished walk back

    $Awfif::vbotga-> {gen} = $gen;
# load the last generation found

    for ($i2 = $start; $i2 <= $end; $i2++) {
# process the generation number

      $buffer = $file [$i2];
      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      $buffer =~ s/$1$2$3//;

      do {#for each dataset in the buffer
# process other generations
# get the count

        $dset++;
        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $bcount = $2;
        $buffer =~ s/$1$2$3$4//;
# on initial record load count in item 0
        $Awfif::vbotga-> {scmapc} [$dset] [0] = $bcount;
# get each item and load into scmap
        for ($i = 1; $i <= $bcount; $i++) {

          $buffer =~ /(\W*)? (\w*) (^,)* (,)?/x;
          if (!$usedat){

            $bname = $ssymbh {$2};
            }#if
          else {#original uncompressed file format

            $bname = $2;
            };#else
          $buffer =~ s/$1$2$3$4//;
          $Awfif::vbotga-> {scmapc} [$dset] [$i] = $bname;
          };

        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $bcount = $2;
        } while ($bcount > 0);#may be more than one data set in the record
      };#for

    @file = ();#free up this large file
    print ("retrievecscmap completed\n");

    return $result
    }# retrievecscmap
#
sub storecfitness {
    my ($filestring) = @_;
# store fitness data set to comma seperated files for later resume
#
    my ($result, $vbot, $gen, $i4);
    my (@file);

    $result = '';
    print ("storecfitness entered\n");
# setup the output file

    $gen = 0;#generation
    $i4 = 0; #output record counter
    while ( defined($Awfif::vbotga-> {fitness} [$gen] [1]) ){#

      $file [$i4] = '' . $gen;#generation number recorded at start of each of its records
      for ($vbot = 1; $vbot <= $Awfif::memes-> {vbottpopmax}; $vbot++){

        $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {fitness} [$gen] [$vbot];
        };#for

      $file [$i4] = $file [$i4] . ";\n";#newline
      $i4++;
      $gen++;
      };#while

    open (FILE, ">$filestring");
    if (-e FILE) {

      $result = 't';
      print ("storecfitness started\n");
      print FILE "@file";
      close (FILE);
      print ("storecfitness completed\n");
      } #got a file to output to
    else {

      print ("storecfitness failed\n");
      };

    return $result
    }# storecfitness
#
sub retrievecfitness {
    my ($filestring) = @_;
    my ($result, $records, $buffer, $bgen, $gen, $fitness, $vbot, $neg);
    my (@file);
# retrieve vbotga fitness data sets from comma seperated files
#

    $result = '';
    print ("retrievecfitness started\n");
# get the records from the file

    @file = ();
    $records = 0;#no records yet
    $gen = 0;
    &includesource (
      $filestring,
      \@file,
      \$records
      );
# load each record into the fitness structure

    $result = 't';
    foreach $buffer (@file) {
# process the generation number

      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      $buffer =~ s/$1$2$3//;

# get each item and load into fitness
      for ($vbot = 1; $vbot <= $Awfif::memes-> {vbottpopmax}; $vbot++) {

        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $fitness = $2;
        $neg = $1;
        if ((defined ($neg)) && ($neg eq '-') ){

          $fitness = -1 * $fitness;
          };#if
        $buffer =~ s/$1$2$3$4//;
        $Awfif::vbotga-> {fitness} [$bgen] [$vbot] = $fitness;
        };#for each vbot

      }; #for each record

    print ("retrievecfitness completed\n");

    return $result
    }# retrievecfitness
#
sub storecparent {
    my ($filestring, $parent) = @_;
# store fitness data set to comma seperated files for later resume
# $parent should be parent or parent2
    my ($result, $i1, $gen, $i4);
    my (@file);

    $result = '';
    print ("storecparent $parent entered\n");
# setup the output file

    $gen = 0;#generation
    $i4 = 0; #output record counter
# @p should be $Awfif::vbotga-> {parent[2]}
    while ( defined($Awfif::vbotga-> {$parent} [$gen] [1]) ){#

      $file [$i4] = '' . $gen;#generation number recorded at start of each of its records
      for ($i1 = 0; $i1 <= $Awfif::vbotga-> {$parent} [$gen] [0]; $i1++){

        $file [$i4] = $file [$i4] . ',' . $Awfif::vbotga-> {$parent} [$gen] [$i1];
        };#for

      $file [$i4] = $file [$i4] . ";\n";#newline
      $i4++;
      $gen++;
      };#while

    open (FILE, ">$filestring");
    if (-e FILE) {

      $result = 't';
      print ("storecparent started\n");
      print FILE "@file";
      close (FILE);
      print ("storecparent completed\n");
      } #got a file to output to
    else {

      print ("storecparent failed\n");
      };

    return $result
    }# storecparent
#
sub retrievecparent {
    my ($filestring, $parent) = @_;
    my ($result, $records, $buffer, $bgen, $gen, $parentid, $i4, $neg);
    my (@file);
# retrieve vbotga parent data sets from comma seperated files
#

    $result = '';
    print ("retrievecparent $parent started\n");
# get the records from the file

    @file = ();
    $records = 0;#no records yet
    $gen = 0;
    &includesource (
      $filestring,
      \@file,
      \$records
      );
# load each record into the parent structure

    $result = 't';
    foreach $buffer (@file) {
# process the generation number

      $buffer =~ /(\d*) (^,)* (,)/x;
      $bgen = $1;
      $buffer =~ s/$1$2$3//;

# get each item and load into parent
      $i4 = 0;
      do {

        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $parentid = $2;
        $neg = $1;
        if ((defined ($neg)) && ($neg eq '-') ){

          $parentid = -1 * $parentid;
          };#if
        $buffer =~ s/$1$2$3$4//;
        $Awfif::vbotga-> {$parent} [$bgen] [$i4] = $parentid;
        $buffer =~ /(\D*)? (\d*) (^,)* (,)?/x;
        $parentid = $2;
        $i4++;
        } while ($parentid > 0);#may be more than one data set in the record

      $i4 = 0;
      }; #for each record

    print ("retrievecparent $parent completed\n");

    return $result
    }# retrievecparent
#
#<!-- start tag aso -->
#<!-- start tag inh -->
#<!-- start tag phe -->
#
sub waitondesc {
    my ($myli, $awso, $desc2, $desc3, $desc4, $iprocname, $kwp, $kwpr, $sactset, $codeletdef, $actref) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($trace, $nlinki);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a description event
# submitcodelet the caller, into a deferred codelet queue,
# waitondesciqu1

    &queinhordef ($myli, $iprocname, $kwp, $kwpr, \@$sactset, \$$codeletdef);

    if ((defined ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}])) && ($Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] > 0)) {
      my ($linki, $found);
      $found = '';
      $linki = $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}];
      while ((!$found) && ($linki != 0)) {
        if (($Awfif::syncl-> {l} [$linki] [2] == $desc2)
        && ($Awfif::syncl-> {l} [$linki] [3] == $desc3)
        && ($Awfif::syncl-> {l} [$linki] [4] == $desc4)
        ){
          $found = 't';
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

          $Awfif::syncl-> {l} [$linki] [5] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::syncl-> {l} [$linki] [5], \$Awfif::syncl-> {l} [$linki] [6]));
          if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = $$codeletdef;
            if (defined ($actref)){

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [3] = $actref;
              };#if
            }#if
          elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

            if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2])) {

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = 0;
              };#if
            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [2]));
            if (defined ($actref)){

              $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$linki] [5]] [3] = $actref;
              };#if
            };#else
          };
        $linki = $Awfif::syncl-> {l} [$linki] [0];
        };#while
      if (!$found) {#new descriptor list to be setup

        $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = addli (\$Awfif::syncl, \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}], \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}]);
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [2] = $desc2;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [3] = $desc3;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [4] = $desc4;
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = 0; #Each descriptor should have its own list of codelets with a unique head
        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6] = 0; #Each descriptor should have its own list of codelets with a unique tail
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5], \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6]));
        if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = $$codeletdef;
          if (defined ($actref)){

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
            };#if
          }#if
        elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

          if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2])) {

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = 0;
            };#if
          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2]));
          if (defined ($actref)){

            $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
            };#if
          };#else
        };#if
      }#if
    else {

      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = 0;
      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}] = 0;
      $Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}] = addli (\$Awfif::syncl, \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}], \$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosynclt}]);
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [2] = $desc2;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [3] = $desc3;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [4] = $desc4;
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = 0; #Each descriptor should have its own list of codelets with a unique head
      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6] = 0; #Each descriptor should have its own list of codelets with a unique tail
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

      $Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5] = ($nlinki = addli ( \$Awfif::synccodl, \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5], \$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [6]));
      if (!defined ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2])) {

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = 0;
        };#if
      if (($$codeletdef != $Awfif::memes-> {codeletdef}) && ($$codeletdef != 0)) {#the submitted codelet has been moved to its own queue

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = $$codeletdef;
        if (defined ($actref)){

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
          };#if
        }#if
      elsif (($$codeletdef == $Awfif::memes-> {codeletdef})) {#still have to move the codelet to its own queue

        $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2] = ($$codeletdef = mdefhcodelettolist ($Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [2]));
        if (defined ($actref)){

          $Awfif::synccodl-> {l} [$Awfif::syncl-> {l} [$Awfif::wsol-> {l} [$awso] [$Awfif::memes-> {wsosyncl}]] [5]] [3] = $actref;
          };#if
        };#else
      };#else
    if ( ( ($$codeletdef > 0)
    && ($Awfif::codelet-> {t} [$$codeletdef] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$$codeletdef] [2])) )
    ){

      break ();
      }#if

    $Awfif::memes-> {trace} = $trace;
    return ($nlinki)
    }# waitondesc
#
#<!-- end tag vbt -->
#
sub waitonstrancomp {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#
    my ($trace, $nlinki, $stran, $subp11i, $cdef);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a sub transaction complete event
# submitcodelet the caller, into a deferred codelet queue,

    &queinhordef ($myli, undef(), $kwp, $kwpr, \@$sactset, \$cdef);
    if (($cdef != 0) && ($cdef == $Awfif::memes-> {codeletdef})) {#the submitted codelet has not been moved to its own queue yet

# find the sub transaction - its the tral entry referred in the subpl [11] set that has the requester referenced in the tral->{i} data structure
      $subp11i = findsubpicnm ($myli, $Awfif::codelet-> {l} [$myli] [36], $Awfif::codelet-> {l} [$myli] [2]);
      $stran = $Awfif::subpl-> {l} [$Awfif::codelet-> {l} [$myli][36]] [11] [$subp11i];
# waitonstrancomh
# and get the head entry at the required tral identifying a synchronization list.
# its in the 0 item of the $Awfif::tral-> {w} if its present

      if ( (defined ($Awfif::tral-> {w} [$stran] [0]))
      && ($Awfif::tral-> {w} [$stran] [0] > 0)
      ){#already got a sync head setup
# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::tral-> {w} [$stran] [0] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::tral-> {w} [$stran] [0], \$Awfif::tral-> {wt} [$stran] [0]));
        $Awfif::synccodl-> {l} [$nlinki] [2] = mdefhcodelettolist ($Awfif::synccodl-> {l} [$nlinki] [2]);
        }#if
      else {#setup a new sync head for the request

# The codelet would be added to this list as the head of a sublist associated with the specific descriptor.

        $Awfif::tral-> {w} [$stran] [0] = 0;
        $Awfif::tral-> {wt} [$stran] [0] = 0;
        $Awfif::tral-> {w} [$stran] [0] = ($nlinki = addli (\$Awfif::synccodl, \$Awfif::tral-> {w} [$stran] [0], \$Awfif::tral-> {wt} [$stran] [0]));
        $Awfif::synccodl-> {l} [$nlinki] [2] = mdefhcodelettolist (0);
        };#else
      };#if

    $Awfif::memes-> {trace} = $trace;
    return ($nlinki)
    }# waitonstrancomp
#
#<!-- end tag ds -->
#<!-- start tag vbt -->
#
sub queinhordef {
    my ($myli, $iprocname, $kwp, $kwpr, $sactset, $codeletdef) = @_;#
    my ($trace, $procname, $submiticodelet);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;
# process request for synchronization with a sub transaction complete event
# submitcodelet the caller, into a deferred codelet queue,

    $submiticodelet = '';
    $Awfif::clp = ();
    if ((defined ($iprocname)) ) {

      $submiticodelet = 't';
      }#if
    $procname = setupprocname ($myli, $iprocname);
    $$codeletdef = $Awfif::memes-> {codeletdef};
    if ($submiticodelet) {
# this codelet is going in the deferred queue. It is not active but won't age out until moved back to the active queue

      &loadclp ($myli, \$Awfif::clp, \@{$Awfif::inhibl-> {clpa}}, $Awfif::codelet-> {l} [$myli] [24]);
      $Awfif::clp-> {inhib}-> {ilinkp} = $Awfif::codelet-> {l} [$myli] [24];
      $Awfif::clp-> {urgency} = ($Awfif::clp-> {urgency} * $Awfif::memes-> {ilaunchm});
      $Awfif::clp-> {strategy} = $procname;
      &groupsinv1 ($myli, undef(), undef(), undef(), undef(),undef(), $procname, $kwp, $kwpr, $sactset, 't');
# when the codelet is made active it won't age out and will be raised in priority until it runs
      if ($$codeletdef != $Awfif::memes-> {codeletdef}) {

        if (!defined ($Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3])) {

          $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3] = 0;
          };#if
        $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3] = ($$codeletdef = mdefhcodelettolist ($Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [3]));
        $Awfif::inhibl-> {l} [$Awfif::codelet-> {l} [$myli] [24]] [4] = $procname;
        }#if
      else {

        $$codeletdef = 0;
        };#else
      }#if
    else {

      $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
      $Awfif::clp-> {urgency} = $Awfif::codelet-> {l} [$myli][3];
      $Awfif::clp-> {strategy} = $procname;
      $Awfif::clp-> {action}-> {sponsor} = $Awfif::codelet-> {l} [$myli][17];
      $Awfif::clp-> {action}-> {signal} = $Awfif::codelet-> {l} [$myli][16];
      $Awfif::clp-> {action}-> {schema} = $Awfif::codelet-> {l} [$myli][18];
      $Awfif::clp-> {action}-> {ref} = $Awfif::codelet-> {l} [$myli][4];
      $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l} [$myli] [20];
      $Awfif::clp-> {action}-> {wss} = $Awfif::codelet-> {l} [$myli][21];
      $Awfif::clp-> {action}-> {wse} = $Awfif::codelet-> {l} [$myli][22];
      &groupsinv1 ($myli, undef(), undef(), undef(), undef(),undef(), $procname, $kwp, $kwpr, $sactset, 't');
      if ($$codeletdef != $Awfif::memes-> {codeletdef}) {

        $$codeletdef = $Awfif::memes-> {codeletdef};
        }#if
      else {

        $$codeletdef = 0;
        };#else
      };#else
    if ( ( ($$codeletdef > 0)
    && ($Awfif::codelet-> {t} [$$codeletdef] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$$codeletdef] [2])) )
    or ( ($Awfif::memes-> {codeletdef} > 0)
    && ($Awfif::codelet-> {t} [$Awfif::memes-> {codeletdef}] != $Awfif::memes-> {snnh} {free})
    && (!defined ($Awfif::codelet-> {l} [$Awfif::memes-> {codeletdef}] [2])) )
    ){

      break ();
      }#if

    $Awfif::memes-> {trace} = $trace;
    }# queinhordef
#
#<!-- end tag vbt -->
#<!-- start tag sia -->
#<!-- start tag ds -resweb -->
#
sub notwaitonelkd {
    my ($myli, $sponsor, $grkwp, $grkwpr, $sactset) = @_;# start index into synccodl list of codelets all waiting on this event
    my ($dontwait, $cwsbi, $atelhwso, $asponsor, $stwso, $astwso);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notwaitonelkd sponsor($sponsor) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $dontwait = 't';
    $Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli] [20];
    $atelhwso = awsoadr (trwsoadr ($sponsor,-1));
    $asponsor = awsoadr ($sponsor);
# Find the statement wso and obtain the statement's wso type
    $stwso = igetmynowner ($myli, $sponsor, 'bustatement', $grkwp, $grkwpr);
    $astwso = awsoadr ($stwso);

    my ($bcount, $cws, $bcwso, $abcwso, $sldesc, $reportdesc, $areportwso, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $bcount = ifindb ($myli, $stwso, 'binderc', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $grkwp, $grkwpr, \@$sactset);
    $bcwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$cws);
    $Awfif::memes-> {currentwsbi} = $cws;
    $abcwso = awsoadr ($bcwso);
# find the transcription factor binding
    if ($bcount == 1) {

      if ( ( ($sldesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {wsposition})) != 0 )
      && (($reportdesc = findtdesc ($Awfif::wsol-> {l} [($abcwso)] [2], $Awfif::memes-> {snnh} {initiate})) != 0 )
      ){

        $Awfif::memes-> {currentwsbi} = ($Awfif::workspace-> {l} [$reportdesc] [3] - $Awfif::memes-> {snnh} {wsi});
        $areportwso = awsoadr (($Awfif::workspace-> {l} [$reportdesc] [2] - $Awfif::memes-> {snnh} {wsi}));
# if end list kw has not reached end of list then if not issued waitondesc do so
        if ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) == 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] == 0)
        ){#wait

          my ($bcindex);
          &waitondesc ($myli, $areportwso, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi}), $Awfif::memes-> {snnh} {found}, $Awfif::memes-> {snnh} {model}, undef(), undef(), undef(), undef(), \$Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]);
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [35] = $Awfif::codelet-> {l} [$myli] [35];
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [36] = $Awfif::codelet-> {l} [$myli] [36];
          $Awfif::codelet-> {l} [ $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]] ] [37] = $Awfif::codelet-> {l} [$myli] [37];
          $Awfif::subpl-> {q} [2] [0]++;#stops amplifier inhibition while positive
          $dontwait = '';
# notwaitbcu1
          $bcindex = matchbreakcodelet ($myli);
          if (($bcindex > 0) #handle break codelet
          && (matchbreakcodelet ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]) == 0) #not already in list
          ){

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]];
            }#if
          elsif ($bcindex > 0){#just remove the myli reference from the break datastructure

            &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
            if ($Awfif::codelet-> {l} [$myli] [36] > 0){#remove subprogram reference

              &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
              };#if
            };#elsif
          }#if
        elsif ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) == 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] != 0)
        ){#wait

          $dontwait = '';
          my ($bcindex);
          $bcindex = matchbreakcodelet ($myli);
          if (($bcindex > 0) #handle break codelet
          && (matchbreakcodelet ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]]) == 0) #not already in list
          ){

            $Awfif::memes-> {breakcodelet} [$bcindex] = $Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36]];
            }#if
          elsif ($bcindex > 0){#just remove the myli reference from the break datastructure

            &remarrent ($bcindex, \@{$Awfif::memes-> {breakcodelet}});
            if ($Awfif::codelet-> {l} [$myli] [36] > 0){#remove subprogram reference

              &remarrent ($bcindex, \@{$Awfif::memes-> {breaksubp}});
              };#if
            };#elsif
          }#elsif
        elsif ((findtdesc ($Awfif::wsol-> {l} [$areportwso][2], $Awfif::memes-> {snnh} {model}, $Awfif::memes-> {snnh} {found}, ($Awfif::memes-> {snnh} {endlistkwevaluator} + $Awfif::memes-> {snnh} {wsi})) != 0)
        && ($Awfif::subpl-> {q} [2][$Awfif::codelet-> {l} [$myli] [36] ] != 0)
        ){#wait

          $Awfif::subpl-> {q} [2] [$Awfif::codelet-> {l} [$myli] [36] ] = undef ();
          $Awfif::subpl-> {q} [2] [0]--;
          };#elsif
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notwaitonelkdx ret($dontwait) ");
      };
    return $dontwait;
    }# notwaitonelkd
#
#<!-- end tag ds -->
#<!-- end tag sia -->
#<!-- start tag vbt -->
#
sub ilwaiting {
    my ($ilinki, $set34, $head, $tail) = @_;# start index into synccodl list of codelets all waiting on this event
    my ($plinki,$linki);

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ilwaiting ilinki($ilinki) ");
      };
    $linki = $ilinki;#modifiable local copy
    while ($linki != 0) {
# move the codelet to the active queue

      my ($linkp, $oh, $olp0, $olp1);
      $linkp = $Awfif::synccodl-> {l} [$linki][2];#the codelet id
# ilwaitactu1
      if (($Awfif::wfcdefl-> {hash} {$linkp} > 0)
      && (defined ($Awfif::synccodl-> {l} [$linki][3]))
      ){

        ${$Awfif::synccodl-> {l} [$linki][3]} = 't';
        };#if
      $oh = $Awfif::memes-> {codeleth};
      if ($oh != 0) {

        $Awfif::codelet-> {l} [$oh] [1] = $linkp;
        };#if
      $olp0 = $Awfif::codelet-> {l} [$linkp] [0];
      $olp1 = $Awfif::codelet-> {l} [$linkp] [1];
      $Awfif::codelet-> {l} [$linkp] [0] = $oh;
      $Awfif::codelet-> {l} [$linkp] [1] = 0;
      if ($Awfif::codelet-> {t} [$linkp] != $Awfif::memes-> {snnh} {active} ){

        $Awfif::codelet-> {t} [$linkp] = $Awfif::memes-> {snnh} {active};
        $Awfif::memes-> {acodelets} ++;
        if ($Awfif::memes-> {acodelets} > $Awfif::memes-> {tcodelets} ){ &break ();};
        };#if
      if ($set34) {

        $Awfif::codelet-> {l} [$linkp] [34] = 1;
        };
      $Awfif::memes-> {codeleth} = $linkp;
      if (($Awfif::memes-> {codeletdef} == $linkp)) {

        if ($olp0 != 0) {

          $Awfif::codelet-> {l} [$olp0] [1] = 0;
          };#if
        $Awfif::memes-> {codeletdef} = $olp0;
        }#if
      else {

        if ($olp0 != 0) {

          $Awfif::codelet-> {l} [$olp0] [1] = $olp1;
          };#if
        if ($olp1 != 0) {

          $Awfif::codelet-> {l} [$olp1] [0] = $olp0;
          };#if
        }# else
# report if new active head is circular

      if (($Awfif::codelet-> {l} [$linkp] [0] == $Awfif::codelet-> {l} [$linkp] [1]) && ($linkp != $Awfif::memes-> {codelett})) { &break ();};
# and delete the synccodl entry

      $plinki = $linki;
      $linki = $Awfif::synccodl-> {l} [$linki] [0];
      &freeli ($plinki, \$Awfif::synccodl, \$$head, \$$tail);
      $Awfif::synccodl-> {l} [$plinki] [2] = 0;#remove the codelet index
      $Awfif::synccodl-> {l} [$plinki] [3] = ();#remove the activated pointer if set
      };#while
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ilwaitingx ret($linki) ");
      };
    return $linki;
    }# ilwaiting
#
#<!-- end tag vbt -->
#<!-- end tag phe -->
#
sub setupprocname {
    my ($myli, $iprocname) = @_;#
    my ($trace, $procname);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;

    if ((defined ($iprocname)) ) {

      $procname = $iprocname;
      }#if
    elsif ((defined ($Awfif::codelet-> {l} [$myli] [27]) )
    && ($Awfif::codelet-> {l} [$myli] [27] =~ /evaluator/i)
    ){

      $procname = $Awfif::codelet-> {l} [$myli] [27];
      }#elsif
    else {

      $procname = $Awfif::codelet-> {l} [$myli] [2];
      };

    $Awfif::memes-> {trace} = $trace;
    return $procname
    }# setupprocname
#
sub setupbuildername {
    my ($procname) = @_;#
    my ($trace, $buildername, $f1);

    $trace = $Awfif::memes-> {trace};
    $Awfif::memes-> {trace} = 0;

    if ($procname =~ /^(.+)*evaluator/i) {
      $f1 = $1;
      if ($f1 ne '') {

        $buildername = $f1 . 'builder';
        }#if
      else {

        $buildername = $procname;
        };#else
      }#if
    else {

        $buildername = $procname;
      };#else

    $Awfif::memes-> {trace} = $trace;
    return $buildername
    }# setupbuildername
#
#<!-- end tag inh -->
#<!-- end tag aso -->
#
sub freedesc {

    my ($desc) = @_;
# move the buffer list structure to the inactive list
    my ($plink, $a0, $a1);
#
# checked for merged workspaces

    $plink = freehli ($desc, \$Awfif::workspace);#descriptors are in a list whose head is wso [2]
    $a0 = $Awfif::workspace-> {l} [$desc] [0];
    $a1 = $Awfif::workspace-> {l} [$desc] [1];
    $Awfif::workspace-> {l} [$desc] = ();
    $Awfif::workspace-> {l} [$desc] [0] = $a0;
    $Awfif::workspace-> {l} [$desc] [1] = $a1;
    return $plink;
    }# freedesc
#
#<!-- start tag ds -resweb -->
#<!-- start tag vbt -->
#<!-- start tag phe -->
#
sub inccounter {
    my ($pltype, $pto, $from, $dlinkh, $awso, $synccod, $sltype, $spto, $transmgrid, $atelhwso, $active, $rcounteri) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($ltype, $to, $ndlinkh, $mcounteri, $counteri, $mp, $nmp, $subpid, $mask, $val);

    if (!defined ($pltype)) {

      $ltype = $Awfif::memes-> {snnh} {iterator};
      }# if
    else {

      $ltype = $pltype;
      };
    if (!defined ($pto)) {

      $to = ($Awfif::memes-> {snnh} {wsi} + 1);
      }# if
    else {

      $to = $pto;
      };
    if ((defined ($transmgrid)) && (defined ($atelhwso)) && (defined ($active))) {

      $subpid = maptmgrtosubpid ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid);
      };# if
    if ((!($mp = findcounter ($Awfif::wsol-> {l} [$awso][2], ($from+1), \$mcounteri, ($spto), $sltype)))# using the param form of to and type to leverage the define state
    && (!($nmp = findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri, ($spto), $sltype)))
    ){#no counter so create a new one

      $ndlinkh
        = setupdesc (
          $ltype,
          $to,
          $from,
          $dlinkh,
          $awso,
          $synccod);
      $Awfif::workspace-> {l} [$ndlinkh] [8] = $Awfif::memes-> {snnh} {iterator};
      $Awfif::workspace-> {l} [$ndlinkh] [9] = ($Awfif::memes-> {snnh} {wsi} + 1);
      if (defined ($transmgrid)) {

        $Awfif::workspace-> {l} [$ndlinkh] [11] = ($transmgrid * $active);
        &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$ndlinkh] [9]);
        };#if
      if (defined ($$rcounteri)){

        $$rcounteri = $ndlinkh;
        };#if
      }#if
    elsif (($mp) #if $mp is true it means was a masked item so update here if its false then there was a non-masked item handle in next clause
    ){#currently masked

      if ((!defined ($transmgrid)) or (!defined ($subpid))) {

        $Awfif::workspace->{l} [$mcounteri][4]--;
        }#if
      else {

        if (!defined ($Awfif::workspace-> {l} [$mcounteri] [11])) {

          $Awfif::workspace-> {l} [$mcounteri] [11] = ($transmgrid * $active);
          &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$mcounteri] [9]);
          }#if
        else {

          $mask = -1;
          $val = -1;
          &gettmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, \$mask, \$val);#gettmgrdesc has an odd interface true means the value in trans mgr exists and is unmasked.
          if ($mask >= 0) {
# found values so deploy them and then update them removing any mask

            $Awfif::workspace-> {l} [$mcounteri] [9] = $val;
            if ($mask == 0) {#inc the val since was not masked in trans storage

              $Awfif::workspace-> {l} [$mcounteri] [9]++;
              };#if
            &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$mcounteri] [9]);
            };#if
          };#else
        $Awfif::workspace->{l} [$mcounteri][4]--;
        };#else
# inccountsusu1
      &isetupsync ($ltype, $to, $from, $awso, $synccod);
      $ndlinkh = $dlinkh;
      if (defined ($$rcounteri)){

        $$rcounteri = $mcounteri;
        };#if
      }# elsif
    else {# found active descriptor increment counter

      if ((!defined ($transmgrid)) or (!defined ($subpid))) {#if this isnt backed up by tmass data then just increment

        $Awfif::workspace->{l} [$counteri][9]++;
        }#if
      else {#need to see if there is tmass data for this transaction manager id

        if ((!defined ($Awfif::workspace-> {l} [$counteri] [11])) # transaction binding never setup so do it now
        ){

          $Awfif::workspace-> {l} [$counteri] [11] = ($transmgrid * $active);
          &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$counteri] [9]);
          }#if
        else {#these are transaction managed but must ensure that this transaction manager record is setup

          $mask = -1;
          $val = -1;
          &gettmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, \$mask, \$val);
          if ($mask >= 0) {
# found values so deploy them and then update them removing any mask

            $Awfif::workspace-> {l} [$counteri] [9] = $val;
            &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, $Awfif::workspace-> {l} [$counteri] [9]);
            }#if
          else {#this manager transaction has not been setup so add it

            &addtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, 0, 0);
            $Awfif::workspace-> {l} [$counteri] [11] = ($transmgrid * $active);
            $Awfif::workspace->{l} [$counteri][9] = ($Awfif::memes-> {snnh} {wsi} + 0);
            };#else
          $Awfif::workspace->{l} [$counteri][9]++;
          };#else
        };#else
# inccountsusu2
      &isetupsync ($ltype, $to, $from, $awso, $synccod);
      $ndlinkh = $dlinkh;
      if ((defined ($transmgrid)) && (defined ($subpid)) && ($Awfif::workspace->{l} [$counteri][11] != 0)) {

        &updtmgrdesc ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $transmgrid, $from, undef (), $Awfif::workspace->{l} [$counteri][9]);
        };#if
      if (defined ($$rcounteri)){

        $$rcounteri = $counteri;
        };#if
      };#else
    if ((!defined ($ndlinkh)) or ($ndlinkh == 0)) {&break()};
    if ((defined ($$rcounteri)) && ($$rcounteri == 0)) {&break()};
    return $ndlinkh
    }# inccounter
#
#<!-- end tag phe -->
#<!-- end tag vbt -->
#
sub setupmdesc {
    my ($ltype, $to, $from, $dlinkh, $awso) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($ndlinkh, $drefi);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("setupmdesc ltype $ltype to $to from $from dlinkh $dlinkh awso $awso ");
      };

    if ((findmdesc ($Awfif::wsol-> {l} [$awso][2], ($from), $ltype, \$drefi) == 0)
    ){

      $ndlinkh
        = setupdesc ( ($ltype),
          ($to),
          $from,
          $dlinkh,
          $awso);
      }#if
    elsif (findmdesc ($Awfif::wsol-> {l} [$awso][2], ($from), $ltype, \$drefi) == 2){#currently masked

      $Awfif::workspace->{l} [$drefi][3]--;
      $ndlinkh = $dlinkh;
      }# elsif
    else {# found active descriptor

      $ndlinkh = $dlinkh;
      };#else
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::workspace->{l} [$drefi][3];
      print ("setupmdescx desc3 ($pr) ret ($ndlinkh)\n");
      };
    return $ndlinkh
    }# setupmdesc
#
#<!-- end tag ds -->
#
sub maskmdesc {
    my ($from, $to, $awso) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($drefi);

    if ((findmdesc ($Awfif::wsol-> {l} [$awso][2], ($from), $to, \$drefi)==1)
    ){

      $Awfif::workspace->{l} [$drefi][3]++;
      };#if
    }# maskmdesc
#
#<!-- start tag phe -->
#
sub maskcounter {
    my ($from, $awso, $tooconc, $type) = @_;# must be the workspace head's index for this descriptor list or 0
    my ($counteri);

    if ((findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri, $tooconc, $type))
    ){

      $Awfif::workspace->{l} [$counteri][4]++;
      $Awfif::workspace->{l} [$counteri][9] = ($Awfif::memes-> {snnh} {wsi} + 1);#get rid of the bias for unmasking
      };#if
    }# maskcounter
#<!-- end tag phe -->
#<!-- start tag scc -->
#<!-- start tag aso -->
#
sub ifindupri {
    my ($myli, $sponsor, $strategy, $checksubp, $subpcstws, $issubp, $subpid, $dontccsponsor, $dontcallbreak) = @_;#

    my ($result, $sigcount, $gsws, $gswso, $agswso, $cwsbi, $counteri, $istrategy, $issubp, $i, $atelhwso);
    my (@f1sub, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ifindupri myli $myli sponsor($sponsor) strategy($strategy) checksubp($checksubp) subpcstws($subpcstws) issubp($issubp) subpid($subpid) dontccsponsor($dontccsponsor) dontcallbreak($dontcallbreak) ");
      };
    $result = '';
# ifindupri may be called by an initiator of sub-programs - checksubp should then be true
    if ((defined ($checksubp))
    && ($checksubp)
    && (defined ($subpid))
    ){

      $atelhwso = awsoadr (trwsoadr ($sponsor, -1));
      @f1sub = getf1list ($myli, $atelhwso, $subpid, 't');
      if ($f1sub [0] > 0) {

        $result = 't';#if all have backoff set then slow down the builder
# see if any sub in the list has its backoff masked if so return false
        for ($i = 1; (($i <= $f1sub [0]) && ($result)); $i++) {
          if (!(ifindupri ($myli, $sponsor, $strategy, undef(), $Awfif::subpl-> {l} [$f1sub[$i]] [6], $Awfif::memes-> {snnh} {subpstbinding} , $f1sub[$i], undef(), $dontcallbreak)) ) {

            $result = '';
            };#if
          };#for each sub in list
        };#if
      }#if
    else {
# ivalbtfu1
      if ( (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $subpcstws, $issubp, $subpid, $dontcallbreak) == 1)
      ){#

        $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws, undef(), $subpcstws, $subpid);
        if ((defined ($strategy)) && ($strategy ne '')) {
          $istrategy = $strategy;
          }#if
        else {
          $istrategy = 'goalscon';
          };#else
        if ( (ifindb ($myli, 1, $istrategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $gsws, $issubp, $subpid, $dontcallbreak) == 1)
        ){#

          $gswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $gsws, $subpcstws, $subpid);
          $Awfif::memes-> {currentwsbi} = $gsws;
          $agswso = awsoadr ($gswso);
# if find a backoff and am the cascade sponsor then slow down the builder
          if (findcounter ($Awfif::wsol-> {l} [$agswso][2], $Awfif::memes-> {snnh} {backoff}, \$counteri)
          && (((defined ($dontccsponsor)) && ($dontccsponsor)) or (cascadesponsor ($myli, $sponsor, $Awfif::memes-> {snnh}{getcassponsor}) == 1))
          ) {

            $result = 't';
            };#if
          };#if
        };#if
      };#else
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ifinduprix ");

      print ("ret ($result)\n");
      };

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# ifindupri
#
sub initschcon {
    my ($myli, $buffers, $kwp, $kwpr, $sponsor, $stws, $issubp, $subp) = @_;#

    my ($result, $sigcount, $gsws, $gswso, $agswso, $cwsbi, $binding);
    my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, @inmsymbol);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    if ( (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@{$Awfif::memes-> {sactset}}, $stws, $issubp, $subp) == 1)
    ){#

      $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws, undef(), $stws, $subp);
      $Awfif::memes-> {currentwsbi} = $gsws;
      $agswso = awsoadr ($gswso);
      my ($buffer, $depstag, $depttag, $dephtag, $insymbol, @started, $end, $setwsclinv);
      $buffer = '(<rhlmspg>';
      $buffer = $buffer . $$buffers;
      $buffer = $buffer . '<selector><schema></rhlmspg>)';
      $depstag = '';
      $depttag = 0;
      $dephtag = 0;
      $insymbol = '';
      @inmsymbol = ();
      $started[0] = 0;
      $started[1] = 't';
      $setwsclinv = '';

      if (defined ($issubp)) {

        $binding = $issubp;
        }#if
      elsif ($Awfif::codelet-> {l} [$myli] [36] > 0) {

        $binding = $Awfif::memes-> {snnh} {subpstbinding};
        }#elsif
      else {

        $binding = $Awfif::memes-> {snnh} {stbinding};
        };#else
      &convbws ($myli, \$buffer, \$$kwp, $kwpr, $Awfif::memes-> {kwmi}, $Awfif::memes-> {kwmir}, $sponsor, \$insymbol, \@inmsymbol, \@started, \$end, \$depstag, \$depttag, \$dephtag, $gsws, $binding,
        $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {budesc}],
        '', #dont energize the base types
        \$setwsclinv
        );
      $result = 't';
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# initschcon
#
sub initschwar {
    my ($myli, $buffers, $sponsor, $stws) = @_;#

    my ($result, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $warwso, $cwsbi, $binding);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    if ( (ifindb ($myli, 1, 'warb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@{$Awfif::memes-> {sactset}}, $stws) >= 1)
    ){#

      my ($warws, $bcount, $awarwso, $warmatchswso, $awarmatchswso);
      $warwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$warws, undef(), $stws);
# initschwarscpu1
# if requested schema already exists then mask any descriptors that are present and return

      $Awfif::memes-> {currentwsbi} = $warws;
      $awarwso = awsoadr ($warwso);

      $bcount = ifindb ($myli, $$buffers, 'warmab', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef(), undef(), \@{$Awfif::memes-> {sactset}}, $warws, undef (), undef (), 't');
      if ($bcount > 0) {

        $warmatchswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $warws);
        $result = 't';
        $awarmatchswso = awsoadr ($warmatchswso);
        &maskcounter ($Awfif::memes-> {snnh}{model}, $awarmatchswso, $Awfif::memes-> {snnh}{completed}, $Awfif::memes-> {snnh}{waitarelay});
        }#if
# else deploy the requested schema
      else {#buffer did not match

        my ($dummy, $buffer, $depstag, $depttag, $dephtag, $insymbol, @inmsymbol, @started, $end, $setwsclinv);
        $buffer = '(<rhlmspg><waitarelay><schema>';
        $buffer = $buffer . $$buffers;
        $buffer = $buffer . '</rhlmspg>)';
        $depstag = '';
        $depttag = 0;
        $dephtag = 0;
        $insymbol = '';
        @inmsymbol = ();
        $started[0] = 0;
        $started[1] = 't';
        $setwsclinv = '';

        $binding = $Awfif::memes-> {snnh} {stbinding};
        &convbws ($myli, \$buffer, \$dummy, undef(), $Awfif::memes-> {kwmi}, $Awfif::memes-> {kwmir}, $sponsor, \$insymbol, \@inmsymbol, \@started, \$end, \$depstag, \$depttag, \$dephtag, $warws, $binding,
          $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {budesc}],
          '', #dont energize the base types
          \$setwsclinv
          );
        $result = 't';
        };#else
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# initschwar
#
sub listunmsubp {
    my ($myli, $awso, $nsubs) = @_;#
# look for 1. subpref initiation which is deployed by ivalbuilder during go-in subprogram setup
# 2. subpref completed which is deployed by bcsubpcbuilder and which description launches the deferred endlistkw/f0-bcsubpc codelet too

    my (@result, $cwsbi, $listi, $imax);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listunmsubp myli $myli awso $awso ");
      };
    $result [0] = 0;
# build a list of subpid<-({initiation})-{subpref} descriptors
    $listi = $Awfif::wsol-> {l} [$awso] [2];

    while ($listi != 0) {
      if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {initiation})
      ){

        $result [++$result[0]] = ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi});
        };#if
      $listi = $Awfif::workspace-> {l} [$listi] [0];
      };#while
    if (defined ($$nsubs)){

      $$nsubs = $result [0];#indicate that there were subs
      };#if
# now remove any with matching ({completed})-{subpref} descriptors

    $imax = $result [0];
    $listi = $Awfif::wsol-> {l} [$awso] [2];
    while (($result [0] > 0) && ($listi != 0)) {
      if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {completed})
      ){

        my ($i, $i2, $found);
        $found = '';
        for ($i = 1;((!$found) && ($i <= $imax)); $i++) {

          if ($result [$i] == ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi})) {

            $found = 't';
            for ($i2 = $i;$i2 < $imax; $i2++) {

              $result [$i2] = $result [$i2+1];
              };#for
            $result [$result[0]--] = undef ();
            };#if
          };#for
        };#if
      $listi = $Awfif::workspace-> {l} [$listi] [0];
      };#while
# return the array

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listunmsubpx ");
      if (defined ($$nsubs)){
        print ("nsubs($$nsubs) ");
        };#if
      print ("ret ($result[0])\n");
      };
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return @result
    }# listunmsubp
#
sub newunmsubp {
    my ($myli, $awso) = @_;#

    my (@subpl, $result, $cwsbi, $i);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("newunmsubp myli $myli awso $awso ");
      };#if
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    @subpl = listunmsubp ($myli, $awso);
# now check for any items which do not have a waiting procedure allocated

    for ($i = 1; (($i <= $subpl[0]) && (!$result)); $i++) {
      if ((defined ($subpl [$i]))
      && ($subpl [$i] > 0)
      && ((! defined ($Awfif::subpl-> {l} [$subpl [$i]][9])) or ($Awfif::subpl-> {l} [$subpl [$i]][9] == 0))
      ) {

        $result = 't';
        };#if
      };#for
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("newunmsubpx ret ($result)\n");
      };
# return the array

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# newunmsubp
#
sub listcsubp {
    my ($myli, $awso) = @_;#
# look for subpref completed which is deployed by bcsubpcbuilder and which description launches the deferred endlistkw/f0-bcsubpc codelet too

    my (@result, $cwsbi, $listi);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listcsubp myli $myli awso ($awso) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result [0] = 0;
# build a list of subpid<-({completed})-{subpref} descriptors
    $listi = $Awfif::wsol-> {l} [$awso] [2];

    while ($listi != 0) {
      if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {completed})
      ){

        $result [++$result[0]] = ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi});
        };#if
      $listi = $Awfif::workspace-> {l} [$listi] [0];
      };#while
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("listcsubpx ret($result[0]) \n");
      };
# return the array

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return @result
    }# listcsubp
#
sub remarrent {
    my ($index, $arrayp) = @_;#

    my ($i2);
# remove an array entry $arrayp[$index] from array

    if ($index <= $$arrayp [0]) {

      for ($i2 = $index;$i2 < $$arrayp[0]; $i2++) {

        $$arrayp [$i2] = $$arrayp [$i2+1];
        };#for
      $$arrayp[$$arrayp[0]--] = undef();
      };#if

    }# remarrent
#
sub subpinitiated {
    my ($myli, $awso, $subpid, $hiurg) = @_;#
# look for 1. subpref initiation which is deployed by ivalbuilder during go-in subprogram setup
# it is given a count in [9] which will be decremented each time subpinitiated checks for active codelets of this subpid
# once the count [9] reaches 0 subpinitiated will instead see if the bcsubpsbuilder has described running with check 2.
# 2. subprogram initiate which is deployed by bcsubpsbuilder demonstrating that it has run starting the subprogram operation.

    my ($result, $found, $listi, $cwsbi);
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpinitiated myli $myli awso($awso) subpid($subpid) ");
      };
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    $found = '';
    $listi = $Awfif::wsol-> {l} [$awso] [2];

    while (($listi != 0) && (!$found)) {
      if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {initiation})
      && ($subpid == ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi}))
      && ($Awfif::workspace-> {l} [$listi] [9] > 0)
      ){

        $result = subpcltpresent ($subpid);#if there are no codelets in the subprogram then don't delay
        $found = 't';
        $Awfif::workspace-> {l} [$listi] [9]--;
# in retrospect seems if can't find the signaled codelets descriptor it needs to be signalled with more priority
        if ((!$result)
        && (defined ($$hiurg))
        ){

          $$hiurg = 't';
          };#if
        }#if
      elsif ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subpref})
      && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {initiation})
      && ($subpid == ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi}))
      && ($Awfif::workspace-> {l} [$listi] [9] == 0)
      ){

        if ($Awfif::memes-> {subpinitdb}) {&break()};
        $listi = $Awfif::wsol-> {l} [$awso] [2];
        while (($listi != 0) && (!$found)) {

          if ( ($Awfif::workspace-> {l} [$listi] [4] == $Awfif::memes-> {snnh} {subprogram})
          && ($Awfif::workspace-> {l} [$listi] [3] == $Awfif::memes-> {snnh} {initiate})
          && ($subpid == ($Awfif::workspace-> {l} [$listi] [2] - $Awfif::memes-> {snnh} {wsi}))
          ){

            $result = 't';
            $found = 't';
            };#if
          $listi = $Awfif::workspace-> {l} [$listi] [0];
          };#while
# in retrospect seems if can't find the signaled codelets descriptor it needs to be signalled with more priority
        if ((!$result)
        && (defined ($$hiurg))
        ){

          $$hiurg = 't';
          };#if
        }#elsif

      $listi = $Awfif::workspace-> {l} [$listi] [0];
      };#while

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpinitiatedx ");
      if ((defined($$hiurg))
      ){
        print ("hiurg($$hiurg) ");
        };#if

      print ("ret ($result)\n");
      };
    return $result
    }# subpinitiated
#
sub subpcltpresent {
    my ($subpid) = @_;
    my ($found, $listi, $cwsbi);
# look for evidence of the subprogram codelet being present as a deferred or active queue codelet
#
# checked for merged workspaces
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpcltpresent subpid($subpid) ");
      };

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $found = '';

    if ((!$found)
    && (defined ($Awfif::subpl-> {q} [2] [$subpid]) )
    && ($Awfif::subpl-> {q} [2] [$subpid] > 0)
    ){

      $found = 't';
      };#if deferred waiting on endlistkwbuilder end of list
# list the cached codelets associated with this subprogram

    if ((!$found)
    &&($Awfif::subpl-> {l} [$subpid] [15][0] > 0)
    ){

      $found = 't';
      };#if
# list the deferred codelets associated with this subprogram

    if ((!$found) && (defined($Awfif::subpl-> {w} [$subpid])) && ($Awfif::subpl-> {w} [$subpid] != 0) ){#there is a deferred codelet waited on f1 completion

      $found = 't';
      };#if

    if ((!$found) && (defined ($Awfif::memes-> {bcsubpscdef})) && ($Awfif::memes-> {bcsubpscdef} > 0) ){

      my ($bccodelet);
      $listi = $Awfif::memes-> {bcsubpscdef};

      while ((!$found) && ($listi != 0) && ($listi != $Awfif::subpscdefl-> {l} [$listi] [0])) {
        $bccodelet = $Awfif::subpscdefl-> {l} [$listi] [2];
        if ($Awfif::codelet-> {l} [$bccodelet] [36] == $subpid){

          $found = 't';
          };#if
        $listi = $Awfif::subpscdefl-> {l} [$listi] [0];
        };#while
      };#if
    $listi = $Awfif::memes-> {codeletdef};

    while ((!$found) && ($listi != 0) && ($listi != $Awfif::codelet-> {l} [$listi] [0])) {
      if ($Awfif::codelet-> {l} [$listi] [36] == $subpid){

        $found = 't';
        };#if
      $listi = $Awfif::codelet-> {l} [$listi] [0];
      };#while
# list the active codelets associated with this subprogram

    $listi = $Awfif::memes-> {codeleth};
    while ((!$found) && ($listi != 0)) {
      if ($Awfif::codelet-> {l} [$listi] [36] == $subpid){

        $found = 't';
        };#if
      $listi = $Awfif::codelet-> {l} [$listi] [0];
      };#while

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("subpcltpresentx ");
      print ("ret ($found)\n");
      };

    return $found
    }# subpcltpresent
#
sub nof1in15 {
    my ($myli, $subpid, $transid) = @_;
    my ($found, $cwsbi, $i, $result);
#
# checked for merged workspaces
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("nof1in15 myli $myli subpid($subpid) transid($transid) ");
      };

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $found = '';

    for ($i = 1; ((!$found) && ($i <= $Awfif::tral-> {i} [$transid][0])); $i++){#each builder string in {18}
      if ((matchicsaelement ((\@{$Awfif::subpl-> {l} [$subpid][15]} ), $Awfif::tral-> {i} [$transid][$i]) != 0)
      ){

        $found = 't';
        };#if
      };#for i
    $result = !$found;

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("nof1in15x ");
      print ("ret ($result)\n");
      };

    return $result
    }# nof1in15
#
#<!-- end tag aso -->
#
sub imasksupp {
    my ($myli, $strategy) = @_;#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("imasksupp myli($myli) ");
      };
    my ($sigcount, $gsws, $gswso, $agswso, $cwsbi, $istrategy);
    my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);
    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ( (!matchsibs ($myli, $Awfif::memes-> {currentwsbi}))
    && (($Awfif::memes-> {currentwsbi} = $Awfif::codelet-> {l} [$myli][19]) != 0)
    && (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}) == 1)
    ){#

      $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws);
      if ((defined ($strategy)) && ($strategy ne '')) {
        $istrategy = $strategy;
        }#if
      else {
        $istrategy = 'goalscon';
        };#else
      if ( (ifindb ($myli, 1, $istrategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $gsws) == 1)
      ){#
        $gswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $gsws);
        $Awfif::memes-> {currentwsbi} = $gsws;
        $agswso = awsoadr ($gswso);
# mask any backoff or notgcompleted descriptors in the suppressor region
        &maskcounter ($Awfif::memes-> {snnh} {backoff}, $agswso);
        &maskcounter ($Awfif::memes-> {snnh} {notgcompleted}, $agswso);
# kick the cascade sponsors
        &icskick ($cwsbi);
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("imasksuppx \n");
      };
    }# imasksupp
#
sub resetcounter {
    my ($from, $awso) = @_;#
    my ($mcounteri, $counteri);

    if ((!findcounter ($Awfif::wsol-> {l} [$awso][2], ($from+1), \$mcounteri))
    && (!findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri))
    ){

# no counter deployed
      }#if
    elsif (!findcounter ($Awfif::wsol-> {l} [$awso][2], ($from), \$counteri)){#currently masked

      $Awfif::workspace->{l} [$mcounteri][9] = $Awfif::memes-> {snnh} {wsi};
      }# elsif
    else {# found active descriptor increment counter

      $Awfif::workspace->{l} [$counteri][9] = $Awfif::memes-> {snnh} {wsi};
      };#else
    }# resetcounter
#
sub getabdwso {
    my ($myli, $sponsor, $binding, $abdwso) = @_;#

    my ($found, $bdwso, $sigcount, $cwsbi2);
    my (@lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge);

    $cwsbi2 = $Awfif::memes-> {currentwsbi};
    $found = '';
    if ( ifindb ($myli, $sponsor, $binding, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}) == 1) {
      my ($tws);
      $bdwso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$tws);
      $Awfif::memes-> {currentwsbi} = $tws;
      $$abdwso = awsoadr ($bdwso);
      $Awfif::memes-> {currentwsbi} = $cwsbi2;
      };#if
    return $found
    }# getabdwso
#
sub dropsalience {
    my ($myli, $sponsor, $strategy, $stws, $issubp, $subp) = @_;#

    my ($result, $sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $asponsor, $atelhwso, $gsws, $gswso, $agswso, $cwsbi, $counteri, $istrategy);
# if detect a backoff descriptor then deploy a dropsalience descriptorlink in the sponsor workspace object
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $result = '';
    if ( (ifindb ($myli, 1, 'goalsupp', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $stws, $issubp, $subp) == 1)
    ){#

      $gswso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$gsws, undef(), $stws, $subp);
      if ((defined ($strategy)) && ($strategy ne '')) {

        $istrategy = $strategy;
        }#if
      else {

        $istrategy = 'goalscon';
        };#else
      if ( (ifindb ($myli, 1, $istrategy, \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, undef (), undef (), \@{$Awfif::memes-> {sactset}}, $gsws, $issubp, $subp) == 1)
      ){#

        $gswso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $gsws, $stws, $subp);
        $Awfif::memes-> {currentwsbi} = $gsws;
        $agswso = awsoadr ($gswso);
# if find a backoff and am the cascade sponsor then slow down the builder
        if (findcounter ($Awfif::wsol-> {l} [$agswso][2], $Awfif::memes-> {snnh} {backoff}, \$counteri)
        ) {

          $Awfif::memes-> {currentwsbi} = $cwsbi;
          $asponsor = awsoadr ($sponsor);
          $atelhwso = awsoadr (trwsoadr ($sponsor, -1));
# dropsal253u1
          if (checkwsbf ($asponsor, 25) != 3) {indicates that this wso salience must not be cached since part of the value is generated dynamically

            &setwsbf ($asponsor, 25, 3);
            $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsotdg}] = 0;#*** submacrok ***##hence get rid of any cache value
            if ($Awfif::memes-> {backoffactives} {'tdgroup'} <= 0) {

              $Awfif::memes-> {backoffactive} {'tdgroup'} = 3;#note that backoff has active links
              };#if
            $Awfif::memes-> {backoffactives} {'tdgroup'} ++;#semophore assumes that each codelet incs and decs only once
            };#if
          $Awfif::wsol-> {l} [$asponsor] [2]
          = setupmdesc ( ($Awfif::memes-> {snnh} {dropsalience}),
            ($Awfif::memes-> {snnh} {wsi} + $counteri), #seems like you want to start from 1
            $Awfif::memes-> {snnh} {descriptorlink},
            $Awfif::wsol-> {l} [$asponsor] [2],
            $asponsor);
# dropsaltrmu1
# if transaction managed sup-program record the descriptor creation in trans managed state
          if ($Awfif::codelet-> {l} [$myli] [36] > 0) {

            &addtmgrdropsal ($atelhwso, $Awfif::memes-> {snnh} {rtran}, $Awfif::codelet-> {l} [$myli] [37], $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor] [2]] [4], 0, $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor] [2]] [3], $Awfif::workspace-> {l} [$Awfif::wsol-> {l} [$asponsor] [2]] [2]);
            };#if
          };#if
        };#if
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# dropsalience
#
sub linkeddsalience {
    my ($wso) = @_;#
    my ($drefi, $result, $awso, $cwsbi, $backoffi);

    $result = '';
    $cwsbi = $Awfif::memes-> {currentwsbi};
    $awso = awsoadr ($wso);
    if ((findmdesc ($Awfif::wsol-> {l} [$awso][2], $Awfif::memes-> {snnh} {descriptorlink}, $Awfif::memes-> {snnh} {dropsalience}, \$drefi) == 1) # link descriptor exists
    ){

      $backoffi = $Awfif::workspace-> {l} [$drefi][2] - $Awfif::memes-> {snnh} {wsi};
      if ($Awfif::workspace-> {l} [$backoffi][4] == $Awfif::memes-> {snnh} {backoff}) {

        $result = 't';
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    return $result
    }# linkeddsalience
#
sub mdropsalience {
    my ($awso) = @_;#

    if ($Awfif::memes-> {backoffactives} {'tdgroup'} > 1) {
      $Awfif::memes-> {backoffactives} {'tdgroup'}--;#semophore assumes that each codelet incs and decs only once
      }# if
    else {
      $Awfif::memes-> {backoffactives} {'tdgroup'}--;#semophore assumes that each codelet incs and decs only once
      $Awfif::memes-> {backoffactive} {'tdgroup'} = 0;#note that backoff has active links
      };#if
    &maskmdesc ($Awfif::memes-> {snnh} {descriptorlink}, $Awfif::memes-> {snnh} {dropsalience}, $awso);
    }# mdropsalience
#<!-- end tag scc -->
#<!-- start tag ds -resweb -->
#
sub mlog {# migrate log sponsor since now better informed
    my ($myli, $method, $ni, $pi) = @_;

# create an active descriptor
#
# checked for merged workspaces
#
    if ((defined ($Awfif::codelet-> {l}[$myli][13])) && ($Awfif::codelet-> {l}[$myli][13] != 0)) {#logging in use so can migrate it

      $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][6]++;#update into reuse items
      $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][2][$Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][6]] = 6;
      $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][3][$Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][6]] = $method;
      $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][4] = $ni;
      $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][5] = $pi;
      $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][7] = 't';#flag special case of reuse
      }; #if
    }# mlog
#
#<!-- end tag ds -->
#
sub setuplog {
    my ($myli, $method, $ni, $pi) = @_;

# requested by a codelet to create an active log element
    my ($ndlinkh, $ani);
#
# updated for merged workspaces
#

    $ani = awsoadr($ni);
    $ndlinkh = $Awfif::wsol-> {l}[$ani][8];# just in case we do nothing put current info back
    if ((
    ($Awfif::wsol-> {l}[$ani][ $Awfif::memes-> {wsologucount}] > 0)#*** submacrok ***#
    or ($Awfif::memes-> {clogs}))
    && ($Awfif::memes-> {log} == $Awfif::memes-> {logentry})) {#build a log element

      $ndlinkh = addhli ($Awfif::wsol-> {l}[$ani][8], \$Awfif::workspace);
# setup the links data

      if ($Awfif::wsol-> {l}[$ani][8] != 0) {#update the previous head to link to this item
        $Awfif::workspace-> {l} [$Awfif::wsol-> {l}[$ani][8]][1] = $ndlinkh;#how can this be right when it could be 0 ???
        };
      if (($Awfif::wsol-> {l}[$ani][8] != 0)
      && (notinlogchain ($Awfif::wsol-> {l}[$ani][8] , $ndlinkh))) {&break};

      $Awfif::workspace-> {l} [$ndlinkh][2][0] = 6;
      $Awfif::workspace-> {l} [$ndlinkh][3][0] = $method;
      $Awfif::workspace-> {l} [$ndlinkh][4] = $ni;
      $Awfif::workspace-> {l} [$ndlinkh][5] = $pi;
      $Awfif::workspace-> {l} [$ndlinkh][6] = 0;#first time through use
      $Awfif::workspace-> {l} [$ndlinkh][7] = '';#set true in mlog
      if ($Awfif::wsol-> {l}[$ani][ $Awfif::memes-> {wsologucount}] > 0) {#*** submacrok ***#

        $Awfif::wsol-> {l}[$ani][ $Awfif::memes-> {wsologucount}] = ($Awfif::wsol-> {l}[$ani][$ani]-1);#*** submacrok ***#
        };#if
      };#use logging
# the log head may exist even if no more logging can be performed

    $Awfif::codelet-> {l} [$myli][13] = $ndlinkh;
    return $ndlinkh
    }# setuplog
#
sub reuselog {
    my ($myli) = @_;

# requested by a codelet to reuse an active log element with additional indexing
#
# updated for merged workspaces
    my ($ndlinkh);
    $ndlinkh = $Awfif::codelet-> {l} [$myli][13];
    if (($Awfif::wsol-> {l}[awsoadr ($Awfif::codelet-> {l} [$myli][4])][ $Awfif::memes-> {wsologucount}] > 0)#*** submacrok ***#
    && ($Awfif::memes-> {log} == $Awfif::memes-> {logentry})) {#ok to reuse a log element
      if (!$Awfif::workspace-> {l} [$ndlinkh][7]) {
        $Awfif::workspace-> {l} [$ndlinkh][6]++;#reusing element so index those we want to preserve
        $Awfif::workspace-> {l} [$ndlinkh][3][$Awfif::workspace-> {l} [$ndlinkh][6]] = $Awfif::workspace-> {l} [$ndlinkh][3][$Awfif::workspace-> {l} [$ndlinkh][6]-1];
        }
      else {#mlog has already incremented 6 and updated method etc
        $Awfif::workspace-> {l} [$ndlinkh][7] = '';#back to normal situation for reuse
        };
      };# ok to reuse
    }# reuselog
#
sub logrui {
    my ($logi, $base, $i) = @_;
    my ($index, @sact, $ndlinkh);
# requested by a codelet to define its reuse index
#
# checked for merged workspaces

    $index = 0;
    $ndlinkh = $logi;
    $sact[$Awfif::memes-> {lsbase}][1] = 't';
    $sact[$Awfif::memes-> {lsbase}][2] = 't';
    $sact[$Awfif::memes-> {lsbase}][3] = 't';
    $sact[$Awfif::memes-> {lsbase}][4] = 't';
    $sact[$Awfif::memes-> {lsbase}][7] = 't';
    $sact[$Awfif::memes-> {lsnbase}][2] = 't';
    $sact[$Awfif::memes-> {lsnbase}][4] = 't';
    $sact[$Awfif::memes-> {lsnbase}][8] = 't';
    $sact[$Awfif::memes-> {lebase}][6] = 't';
    $sact[$Awfif::memes-> {lebase}][14] = 't';
    if ($sact [$base][$i] eq 't') {
      $index = $Awfif::workspace-> {l}[$ndlinkh][6];
      };

    return $index
    }# logrui
#
sub updatelog {
    my ($myli, $method, $i, $data) = @_;
    my ($base, $imethod);
# requested by a codelet to update an active log element
#
# updated for merged workspaces

    if ((
    ($Awfif::wsol-> {l}[awsoadr ($Awfif::codelet-> {l} [$myli][4])][ $Awfif::memes-> {wsologucount}] > 0)#*** submacrok ***#
    or ($Awfif::memes-> {clogs}))
    && ($Awfif::memes-> {log} == $Awfif::memes-> {logentry})) {#ok to reuse a log element
      if ($method =~ /e$/i) {

        $base = $Awfif::memes-> {lebase};
        }
      elsif (($method eq 'ssnl')) {

        $base = $Awfif::memes-> {lsnbase};
        }
      elsif ($method =~ /b$/i) {

        $base = $Awfif::memes-> {lbbase};
        }
      elsif ($method =~ /s(i)*$/i) {

        $base = $Awfif::memes-> {lsbase};
        }
      else {
# dont log

        $base = 0;
        };
      if ($base > 0) {
        $imethod = $method;
        if ($method eq 'dsi') {
          if (defined ($Awfif::codelet-> {l}[$myli][10])) {

            $imethod = 'tds';
            }
          else {

            $imethod = 'ds';
            };
          };# transform dsi
        if ($Awfif::codelet-> {l}[$myli][13] != 0) {
          $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][$base][logrui($Awfif::codelet-> {l}[$myli][13], $base, 0)] = $imethod;
          if (!defined ($data)) {

            $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][$base + $i][logrui($Awfif::codelet-> {l}[$myli][13], $base, $i)] = 'f';
            }
          elsif (($data eq 't')or($data eq 'T')) {

            $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][$base + $i][logrui($Awfif::codelet-> {l}[$myli][13], $base, $i)] = 't';
            }
          else {

            $Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][$base + $i][logrui($Awfif::codelet-> {l}[$myli][13], $base, $i)] = $data;
            };
          if ($Awfif::workspace-> {l}[$Awfif::codelet-> {l}[$myli][13]][2][$Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][6]] < ($base + $i)) {

            $Awfif::workspace-> {l}[$Awfif::codelet-> {l}[$myli][13]][2][$Awfif::workspace-> {l} [$Awfif::codelet-> {l}[$myli][13]][6]] = ($base + $i);
            };#update end of log attributes
          };#ensure don't use logging if [13] not setup
        if (($Awfif::wsol-> {l}[awsoadr ($Awfif::codelet-> {l} [$myli][4])][ $Awfif::memes-> {wsologucount}] > 0)) {#*** submacrok ***#

          &setwsmd (awsoadr ($Awfif::codelet-> {l} [$myli][4]), $Awfif::memes-> {wsologucount}, (
            $Awfif::wsol-> {l}[awsoadr ($Awfif::codelet-> {l} [$myli][4])][ $Awfif::memes-> {wsologucount}]-1)#*** submacrok ***#
            );
          };
        };#worth logging
      };#use logging
    }# updatelog
#
sub notinlogchain {
    my ($hl, $nhl) = @_;
    my ($link, $result);
# check that h links to nhl
#

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notinlogchain head $hl newhead $nhl ");
      };

    $link = $hl;
    $result = 't';
    while (($Awfif::workspace-> {l} [$link][0] != 0) && ($result)) {
      if ($Awfif::workspace-> {l} [$link] == $nhl) {

        $result = '';
        }
      else {
        $link = $Awfif::workspace-> {l} [$link][0];
        };
      }; #activated node

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("notinlogchainx ret ($result)\n");
      };
    }# notinlogchain
#
sub redcrit {
    my ($sponsor) = @_;
# reduce the criticality of the sponsor
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$sponsor};
      print ("redcrit sponsor $pr ");
      };

    if ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnac} {$Awfif::memes->{snnih}{$sponsor}} > 0) {
      $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnac} {$Awfif::memes->{snnih}{$sponsor}} --;
      if ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnac} {$Awfif::memes->{snnih}{$sponsor}} == 0) {

        $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnaf} {$Awfif::memes->{snnih}{$sponsor}} = $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnafm} {$Awfif::memes->{snnih}{$sponsor}};
        };
      }; #activated node

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("redcritx\n");
      };
    }# redcrit
#
sub setinhib {
    my ($sponsor, $inhib) = @_;
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr);
      $pr = $Awfif::memes-> {snnih} {$sponsor};
      print ("setinhib sponsor $pr inhibition $inhib ");
      };
# set the max inhibition of the sponsor

    if (($inhib >= 0) && ($inhib <= $Awfif::memes-> {fatigue})) {
      $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnafm} {$Awfif::memes->{snnih}{$sponsor}} = $inhib;
      if ($Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnaf} {$Awfif::memes->{snnih}{$sponsor}} > $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnafm} {$Awfif::memes->{snnih}{$sponsor}}) {
        $Awfif::memes-> {snw} [$Awfif::memes-> {currentwsbi}]-> {snnaf} {$Awfif::memes->{snnih}{$sponsor}} = $inhib;
        };# if
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("setinhibx\n");
      };
    }# setinhib
#
sub gettjhlsoi {
    my ($asponsor, $wso37) = @_;
    my ($result, $telwso, $wsl, $found, $cwsbi);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gettjhlsoi asponsor $asponsor wso37 ($wso37) ");
      };
# reply with telomers jhlsoi if set
    $cwsbi = $Awfif::memes-> {currentwsbi};

    $telwso = $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsoprev}];#*** submacrok ***#
    $Awfif::memes-> {currentwsbi} = $Awfif::wsol-> {l}[$asponsor][ $Awfif::memes-> {wsowsi}];#*** submacrok ***#
    $wsl = $Awfif::wsol-> {l} [awsoadr ($telwso) ] [2];
    $result = $wso37;
    $found = '';
    while (($wsl != 0) && (!$found)) {
      if ( ($Awfif::workspace-> {l} [$wsl] [3] == $Awfif::memes-> {snnh} {jhlsoi}) && ($Awfif::workspace-> {l} [$wsl] [4] == $Awfif::memes-> {snnh} {telomere})) {

        $found = 't';
        $result = $Awfif::workspace-> {l} [$wsl] [2] - $Awfif::memes-> {snnh} {wsi};
        }#if
      else {
        $wsl = $Awfif::workspace-> {l} [$wsl] [0];
        };#else
      };#while

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("gettjhlsoix ret ($result)\n");
      };
    return $result
    }# gettjhlsoi
#
sub kwmccon {
    my ($cws, $pwso, $aws, $wso) = @_;
    my ($result, $cwsbi);
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("kwmccon cws $cws pwso ($pwso) aws $aws wso $wso ");
      };
# reply with true if keyword in aws wso is in can contain descriptor set of ccontext ws parent pwso
    $cwsbi = $Awfif::memes-> {currentwsbi};

    $result = 't';
# $found = '';
# while (($wsl != 0) && (!$found)) {
# if ( ($Awfif::workspace-> {l} [$wsl] [3] == $Awfif::memes-> {snnh} {jhlsoi}) && ($Awfif::workspace-> {l} [$wsl] [4] == $Awfif::memes-> {snnh} {telomere})) {

# $found = 't';
# $result = $Awfif::workspace-> {l} [$wsl] [2] - $Awfif::memes-> {snnh} {wsi};
# }#if
# else {
# $wsl = $Awfif::workspace-> {l} [$wsl] [0];
# };#else
# };#while

    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("kwmcconx ret ($result)\n");
      };
    return $result
    }# kwmccon
#
#<!-- start tag stm -->
#
sub dnamechars {
    my ($sponsor, $chartype, $wsi) = @_;
    my ($rbuffer, $linkp, $i, $gend, $gendp1, $asponsor, $cwsi);
# get the character stream from a workspace groups chars
# with special handling of case attributes
#
# updated for merged workspaces

    if (defined($wsi)) {#different workspace
      $cwsi = $Awfif::memes-> {currentwsbi};
      $Awfif::memes-> {currentwsbi} = $wsi;
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("dnamechars sponsor ($sponsor) wsi ($wsi) ");
      &itwsoutput ( trwsoadr ($sponsor, 1), $sponsor);
      };

    $rbuffer = '';
    $asponsor = awsoadr ($sponsor);
# from the sponsor wso find the start of the group
    $linkp = $Awfif::wsol-> {l}[$asponsor][2];
    while (($linkp != 0) && ($Awfif::workspace-> {l}[$linkp][4] != $Awfif::memes-> {snnh}{groupstart})) {

      $linkp = $Awfif::workspace-> {l}[$linkp][0];
      };
    if ($linkp != 0) {#found group start descriptor

      $i = $Awfif::workspace-> {l}[$linkp][2] - $Awfif::memes-> {snnh}{wsi};
      };
# note the end of the group
    $gend = fgrpend ($sponsor);
    $gendp1 = trwsoadr ($gend, 1);# to enable while until gend reached
# look at the base type for a char
    while (($i != $gendp1) && ($i != 0) && (wsbasetype ($i) != $Awfif::memes-> {snnh}{char})) {

      $i = trwsoadr ($i, 1);
      };
    $rbuffer = rbufchars ($i, $gendp1, \$$chartype, $wsi);

    if ($wsi ne '') {#different workspace
      $Awfif::memes-> {currentwsbi} = $cwsi;
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("dnamecharsx chartype $$chartype ret $rbuffer\n");
      };
    return $rbuffer
    }# dnamechars
#
#<!-- end tag stm -->
#
sub rbufchars {
    my ($swso, $twso, $chartype, $wsi) = @_;
    my ($rbuffer, $i, $cwsi);
# pack the buffer from a workspace groups chars
# with special handling of case attributes
#
# updated for merged workspaces

    if (defined($wsi)) {#different workspace
      $cwsi = $Awfif::memes-> {currentwsbi};
      $Awfif::memes-> {currentwsbi} = $wsi;
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("rbufchars swso ($swso) wsi ($wsi) ");
      &itwsoutput ( trwsoadr ($swso, 1), $swso);
      };

    $rbuffer = '';
    $i = $swso;
# while the base type is char obtain the real character from each adjoining wso
    while (($i != $twso) && (wsbasetype ($i) == $Awfif::memes-> {snnh}{char}) && (($$chartype = wscharprop ($i)) != $Awfif::memes-> {snnh}{indirectcategory})) {
      my ($i2);
      $i2 = $i;


      $i = trwsoadr ($i, 1);
      };#while
# concatenate the char into the rbuffer.

    if (defined($wsi)) {#different workspace
      $Awfif::memes-> {currentwsbi} = $cwsi;
      };

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("rbufcharsx chartype $$chartype ret $rbuffer\n");
      };
    return $rbuffer
    }# rbufchars
#
sub initarray {
    my ($array) = @_;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("initarray ");
      };
# set an array to empty using ability to input a reference
#
# checked for merged workspaces

    @$array = ();

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("initarrayx\n");
      };
    }# initarray
#
#<!-- start tag swp -->
#
sub operonmatch {
    my ($myli, $sws, $wss, $wse, $lomatchs, $lola, $loconcs, $lostrts, $loends, $logb, $loge, $filstrategy) = @_;
    my ($i, $i2, $label, $type, $ltype, $sigcount, $cwsbi, $iend);
# find all the groups in the current ws that match the source ws string sequence
# the jhlabels for these groups should have been loaded by lbbuilder
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("operonmatch myli $myli ");
      &itcpoutput ($myli);
      };

    $label = '';
    $ltype = '';
    $i2 = 0;

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $Awfif::memes-> {currentwsbi} = $sws;
# compare the cytosolic ws schema to the nuclear ws operons return any matching operons for this ws
    $i = $wss;
    $iend = trwsoadr ($wse, 1);
    while (($i != $iend) && ( awsoadr ($i) != 0)) {
      $type = ' ' . wsbasetype ($i);
      if ($type eq ' '.wsbasetype ( trwsoadr ($i, 1))) {#note repeat

        $type = '_' . wsbasetype ($i);
        };#repeat
      if ($ltype ne $type) {# ignore repeats

        $label = $label.$type;
        $$lostrts[$i2++] = $i;
        };#build direct label
      $ltype = $type;
      $i = trwsoadr ($i, 1);
      };#for
# apply the linking function of group completion
# if the groups labels result in a match with a signal then raise the signal
#

    $sigcount = msublabel1 ($myli, \$label, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge, $filstrategy);
# delete the non current ws & non operon matches
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($sigcount > 0) {

      for ($i = 0; $i < $sigcount; $i++) {

        if ($$lomatchs[$i]) {#there is a link validate the association
# matching jhlabel check if it is for operon and for current ws
# if not remove it from the match set (set $lomatchs[$i] false
          if ( ($Awfif::jhls-> {l} [$$lola[$i]][7] != $Awfif::memes-> {currentwsbi})
          or (($Awfif::jhls-> {l} [$$lola[$i]][4] != $Awfif::memes-> {snnh}{operon})
            && ($Awfif::jhls-> {l} [$$lola[$i]][4] != $Awfif::memes-> {snnh}{stbinding})
            && ($Awfif::jhls-> {l} [$$lola[$i]][4] != $Awfif::memes-> {snnh}{subpstbinding}))
          ) {

            $$lomatchs[$i] = '';
            };
          };#if link
        };#for
      };#if


    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("operonmatchx ret $sigcount\n");
      };
    return $sigcount
    }# operonmatch
#
#<!-- end tag swp -->
#<!-- start tag sia -->
#<!-- start tag smo -->
#
sub operonlmatch {
    my ($myli, $jhlabeli, $lomatchs, $lola, $loconcs, $lostrts, $loends, $logb, $loge, $filstrategy, $stws) = @_;
    my ($i, $i2, $label, $type, $ltype, $sigcount, $cwsbi);
# find all the operon controlled groups in the current ws that match the source jhlabel
# the jhlabels for these operons should have been loaded by lbbuilder
#
# checked for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("operonlmatch myli $myli jhlabeli $jhlabeli ");
      &itcpoutput ($myli);
      };

    $label = '';
    $ltype = '';
    $i2 = 0;

# $Awfif::memes-> {currentwsbi} = $sws;
# compare the jhlabel to the nuclear ws operons return any matching operons for this ws
#
# create an input label for msublabel from the jhlabel's attrib list
    $i = $Awfif::jhls-> {l} [$jhlabeli] [5];
    $i = $Awfif::attribs-> {l} [$i][1];#move past the start attribute
    while (($Awfif::attribs-> {l} [$i][2]) != $Awfif::memes-> {snnh}{attribe}) {
      my ($nexti);
      $type = ' ' . $Awfif::attribs-> {l} [$i][3];
      $nexti = $Awfif::attribs-> {l} [$i][1];
      if( ($Awfif::attribs-> {l} [$i][4]) #note repeat
      or ($type eq ' ' . $Awfif::attribs-> {l} [$nexti][3]) #in case repeats not encoded in attrib list - it happens
      ){#note repeat

        $type = '_' . $Awfif::attribs-> {l} [$i][3];
        };#repeat
      if ($ltype ne $type) {# ignore repeats

        $label = $label.$type;
        $$lostrts[$i2++] = $i;
        };#build direct label
      $ltype = $type;
      $i = $Awfif::attribs-> {l} [$i][1];#next
      };#while
# apply the linking function of group completion
# if the groups labels result in a match with a signal then raise the signal
#

    $sigcount = msublabel1 ($myli, \$label, \@$lomatchs, \@$lola, \@$loconcs, \@$lostrts, \@$loends, \@$logb, \@$loge, $filstrategy, $stws);
# delete the non current ws & non operon matches
    $Awfif::memes-> {currentwsbi} = $cwsbi;
    if ($sigcount > 0) {

      for ($i = 0; $i < $sigcount; $i++) {

        if ($$lomatchs[$i]) {#there is a link validate the association
# matching jhlabel check if it is for operon and for current ws & operon includes the group sponsor
# if not remove it from the match set (set $lomatchs[$i] false
          if (($Awfif::jhls-> {l} [$$lola[$i]][4] != $Awfif::memes-> {snnh}{operon})
          or ($Awfif::jhls-> {l} [$$lola[$i]][7] != $Awfif::memes-> {currentwsbi})
          or (!ophasgs ($myli, $$lola[$i]))
          ) {

            $$lomatchs[$i] = '';
            };
          };#if link
        };#for
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("operonlmatchx ret $sigcount\n");
      };
    return $sigcount
    }# operonlmatch
#
#<!-- end tag smo -->
#<!-- end tag sia -->
#<!-- start tag vbt -->
#
sub ophasgs {
    my ($myli, $jhlsid) = @_;
    my ($cwsbi, $succeeded, $sgdi, $sponsor, $i);
# Operon can only be a group owner if its start(-1) to end includes the group sponsor - which should by this time be at the front of the group?
# If find the group sponsor within range of 8 - 9 then reply succeeded
# group completed.
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr7, $pr8, $pr9);
      $pr7 = $Awfif::jhls-> {l} [$jhlsid][7];
      $pr8 = $Awfif::jhls-> {l} [$jhlsid][8];
      $pr9 = $Awfif::jhls-> {l} [$jhlsid][9];
      print ("ophasgs jhlsid $jhlsid -> ws $pr7: start $pr8 - end $pr9 ");
      };

    $succeeded = '';

    $cwsbi = $Awfif::memes-> {currentwsbi};

    $Awfif::memes-> {currentwsbi} = $Awfif::jhls-> {l} [$jhlsid][7];
    &fgrpd ($myli, $Awfif::jhls-> {l} [$jhlsid][8], \$sgdi, $Awfif::memes->{snnh}{groupcategory});
    $sponsor = fgrpsponsor ($Awfif::jhls-> {l} [$jhlsid][8], $Awfif::workspace-> {l} [$sgdi] [3], $Awfif::memes-> {snnh} {groupcategory});
#

    $i = trwsoadr ($Awfif::jhls-> {l} [$jhlsid][8], -1);
    $succeeded = ainbtoc ($sponsor, $i, $Awfif::jhls-> {l} [$jhlsid][9], $Awfif::jhls-> {l} [$jhlsid][7]);

    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ophasgsx ret ($succeeded)\n");
      };
    return $succeeded
    }# ophasgs
#
#<!-- end tag vbt -->
#
sub depssast {
    my ($myli, $sponsor, $tws, $sgstarti, $sgstopi, $sws) = @_;
    my ($cwsbi, $succeeded, $telhd, $buffer, $grkwp, $grkwpr, $insymbol, @inmsymbol, @started, $end, $depstag, $depttag, $dephtag, $setwsclinv);
# Deployment of isolated, inactive, schematic subgroups allows for their activation within
# a group completion. By placing them in telomers they can be destroyed once they have
# group completed.
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("depssast tws $tws sws $sws [$sgstarti : $sgstopi] ");
      };

    $succeeded = '';
    $depstag = '';
    $depttag = 0;
    $dephtag = 0;
    $started[0] = 0;
    $started[1] = 't';
    $grkwp = $Awfif::wsbl-> {wsbloh}[$Awfif::memes-> {currentwsbi}];
    $grkwpr = $Awfif::wsbl-> {wsot}[$Awfif::memes-> {currentwsbi}];
    $setwsclinv = '';

    $cwsbi = $Awfif::memes-> {currentwsbi};
# check the target ws exists
# and has a telomeric head

    if (($telhd = findtelhd ($tws)) > 0) {
# if so
# check if a source workspace is specified

      if (defined($sws)) {
        $Awfif::memes-> {currentwsbi} = $sws;
        };# if source workspace requested
      $buffer = '<telstring><rhlmsge>'. wsolistaschst ($sgstarti, $sgstopi, $sws) . '</rhlmsge></telstring>';
# depscdeltau

      &convbws ($myli, \$buffer, \$grkwp, $grkwpr, $Awfif::memes-> {kwmi}, $Awfif::memes-> {kwmir}, $sponsor, \$insymbol, \@inmsymbol, \@started, \$end, \$depstag, \$depttag, \$dephtag, $tws, $Awfif::memes-> {snnh} {operon}, ($Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bugroup}] ^ $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {tdgroup}] ^ $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {bustatement}] ^ $Awfif::memes-> {strbool}[$Awfif::memes-> {streh} {delta}]),
        't',#energize the base type
        \$setwsclinv
        );
      $succeeded = 't';
      };#telomeric head descriptor available
#

    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("depssastx ret ($succeeded)\n");
      };
    return $succeeded
    }# depssast
#
#
sub opcontinie {
    my ($jhlsid, $i, $e) = @_;
    my ($cwsbi, $succeeded);
# return success if 8 to 9 are both found within $i to $e
# If find the group sponsor within range of 8 - 9 then reply succeeded
# group completed.
#
# checked for merged workspaces

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      my ($pr7, $pr8, $pr9);
      $pr7 = $Awfif::jhls-> {l} [$jhlsid][7];
      $pr8 = $Awfif::jhls-> {l} [$jhlsid][8];
      $pr9 = $Awfif::jhls-> {l} [$jhlsid][9];
      print ("opcontinie jhlsid $jhlsid -> ws $pr7: start $pr8 - end $pr9 within i $i - e $e ");
      };

    $succeeded = '';

    $cwsbi = $Awfif::memes-> {currentwsbi};

    if ((ainbtoc ($Awfif::jhls-> {l} [$jhlsid][8], $i, $e, $Awfif::jhls-> {l} [$jhlsid][7]))
    && (ainbtoc ($Awfif::jhls-> {l} [$jhlsid][9], $i, $e, $Awfif::jhls-> {l} [$jhlsid][7]))
    ){
      $succeeded = 't';
      };#if

    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("opcontiniex ret ($succeeded)\n");
      };
    return $succeeded
    }# opcontinie
#
#<!-- start tag smo -->
#<!-- start tag vbt -->
#
sub ainbtoc {
    my ($a, $b, $c, $ws) = @_;
    my ($cwsbi, $succeeded, $i);
# If find a within range of b - c then reply succeeded
#
# checked for merged workspaces

# if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
# print ("ainbtoc a($a) in ws $ws: b $b - c $c ");
# };

    $succeeded = '';

    $cwsbi = $Awfif::memes-> {currentwsbi};

    if ((defined ($a))
    && ($a != 0)
    && (defined ($b))
    && ($b != 0)
    && (defined ($c))
    && ($c != 0)
    && (defined ($ws))
    && ($ws != 0)
    ){
      $Awfif::memes-> {currentwsbi} = $ws;
#

      $i = $b;
      while (($i != $c) && (!$succeeded) && ($i != 0)) {
        if ($i == $a) {
          $succeeded = 't';
          };#if
        $i = trwsoadr ($i, 1);
        };#while
        if ($a == $c) {
          $succeeded = 't';
          };#if
      };

    $Awfif::memes-> {currentwsbi} = $cwsbi;

# if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
# print ("ainbtocx ret ($succeeded)\n");
# };
    return $succeeded
    }# ainbtoc
#
#<!-- end tag vbt -->
#<!-- end tag smo -->
#
# ******* codelet shells *******
#
sub icsevaluator1 {
    my ($myli, $evaluator, $strategy, $kwp, $kwpr, $sactset, $getspi) = @_;
    my ($sponsor, $signal, $schema, $spi, $ssgws, $ssgoid, $swstype, $noswstype,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# checked for merged workspaces

# inverted codelet shell for investigation codelets
    $noswstype = 't';
    my ($cwsbi, $launchev, $fbinderc);
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)) {

      $cwsbi = $Awfif::memes-> {currentwsbi};
      if ((defined ($getspi)) && ($getspi)) {

        $launchev = &$evaluator ($myli, $sponsor, $signal, $schema, $swstype, $grkwp, $grkwpr, \@$sactset, $noswstype, \$fbinderc, \$spi, \$ssgws, \$ssgoid);
        }#if
      else {

        $launchev = &$evaluator ($myli, $sponsor, $signal, $schema, $swstype, $grkwp, $grkwpr, \@$sactset, $noswstype, \$fbinderc);
        };#else
      if (($fbinderc > 0)
      ){#

        if (($launchev)
        ){

          $Awfif::clp = ();
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
          $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {blaunchm});
          if (defined ($Awfif::codelet-> {l}[$myli][19])) {

            $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
            }#wsi set
          else {

            $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
            };
          $Awfif::clp-> {strategy} = $strategy;
          $Awfif::clp-> {action}-> {sponsor} = $sponsor;
          $Awfif::clp-> {action}-> {signal} = $Awfif::codelet-> {l} [$myli][16];
          $Awfif::clp-> {action}-> {schema} = $Awfif::codelet-> {l} [$myli][18];
          $Awfif::clp-> {action}-> {ref} = $spi;
          if ((defined ($getspi)) && ($getspi)) {

            $Awfif::clp-> {action}-> {ssgws} = $ssgws;
            $Awfif::clp-> {action}-> {ssgoid} = $ssgoid;
            };#if
          $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l} [$myli] [20];
          $Awfif::clp-> {action}-> {wss} = $Awfif::codelet-> {l} [$myli][21];
          $Awfif::clp-> {action}-> {wse} = $Awfif::codelet-> {l} [$myli][22];
          $Awfif::clp-> {action}-> {wsoname} = 0;
          &groupsinv1 ($myli, undef(), undef(), undef(), undef(),undef(), $strategy, $$kwp, $kwpr, \@$sactset);
          };#if
        };#if
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      };#got buffer

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ();
    }# icsevaluator1
#
sub icsrioevaluator1 {
    my ($myli, $evaluator, $strategy, $kwp, $kwpr, $sactset) = @_;
    my ($sponsor, $signal, $schema, $spi, $swstype, $noswstype,
    $grkwp, $grkwpr, $cdn, $cdnx);
#
# checked for merged workspaces

# inverted codelet shell with role in & out for investigation codelets
    $noswstype = 't';
    my ($cwsbi, $launchev, $fbinderc);
    if (getcontext ($myli, \$sponsor, \$signal, \$schema, \$swstype, \$grkwp, \$grkwpr, $noswstype, \$cdn, \$cdnx, 3)) {

      $cwsbi = $Awfif::memes-> {currentwsbi};
# icrsmebfu2
      if ( ($Awfif::codelet-> {l} [$myli] [36] > 0)
      && ((matchaelement(\@{$Awfif::memes-> {crsmesubpspbreak}}, $Awfif::codelet-> {l} [$myli][36])) > 0)
      ){

        &break();
        };#if
# looks like can get rid of signal, schema, swstype, and noswstype but needs careful pdca of other callers of callee
      $launchev = &$evaluator ($myli, $sponsor, $signal, $schema, $swstype, $grkwp, $grkwpr, \@$sactset, $noswstype, \$fbinderc);
      if (($fbinderc > 0)
      ){#

        if (($launchev)
        ){

          $Awfif::clp = ();
          $Awfif::clp-> {log} = $Awfif::codelet-> {l} [$myli][13];
          $Awfif::clp-> {urgency} = ($Awfif::codelet-> {l} [$myli][3] * $Awfif::memes-> {blaunchm});
          if (defined ($Awfif::codelet-> {l}[$myli][19])) {

            $Awfif::clp-> {wsi} = $Awfif::codelet-> {l}[$myli][19];
            }#wsi set
          else {

            $Awfif::clp-> {wsi} = $Awfif::memes-> {currentwsbi};
            };
          $Awfif::clp-> {strategy} = $strategy;
          $Awfif::clp-> {action}-> {sponsor} = $sponsor;
          $Awfif::clp-> {action}-> {signal} = $Awfif::codelet-> {l} [$myli][16];
          $Awfif::clp-> {action}-> {schema} = $Awfif::codelet-> {l} [$myli][18];
          $Awfif::clp-> {action}-> {ref} = $spi;
          $Awfif::clp-> {action}-> {sws} = $Awfif::codelet-> {l} [$myli] [20];
          $Awfif::clp-> {action}-> {wss} = $Awfif::codelet-> {l} [$myli][21];
          $Awfif::clp-> {action}-> {wse} = $Awfif::codelet-> {l} [$myli][22];
          $Awfif::clp-> {action}-> {wsoname} = 0;
          &groupsinv1 ($myli, undef(), undef(), undef(), undef(),undef(), $strategy, $$kwp, $kwpr, \@$sactset);
          };#if
        };#if
      $Awfif::memes-> {currentwsbi} = $cwsbi;
      };#got buffer

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("$cdnx\n");
      };
    &clogstatx ($myli);
    }# icsrioevaluator1
#
#<!-- start tag scl -->
#
sub spdcascevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture

    &icsevaluator1 ($myli, \&Awfif::ispdcaevaluator1, 'spdcascbuilder', $kwp, $kwpr, \@$sactset);
    }# spdcascevaluator1
#
#<!-- end tag scl -->
#<!-- start tag scs -->
#
sub spdcaevaluator1 {
    my ($myli, $kwp, $kwpr, $sactset) = @_;#The ignored parameters are required by the codelet calling architecture
# cyclins operate a Shewhart cycle in the eucaryotic cell. The spdca codelet signals initiation of a similar PDCA cycle controlled by Awf cyclin codelets

    &icsevaluator1 ($myli, \&Awfif::ispdcaevaluator1, 'spdcabuilder', $kwp, $kwpr, \@$sactset);
    }# spdcaevaluator1
#
#<!-- start tag scl -->
#
sub ispdcaevaluator1 {
    my ($myli, $sponsor, $signal, $schema, $swstype, $kwp, $kwpr, $sactset, $noswstype, $fbinderc) = @_;#bsmodeler requires the ignored parameters for its general interface
    my ($dolaunch, $bcount, $pdcawso, $pws, $stwso, $astwso, $twso, $asponsor, $cwsbi,
    $grkwp, $grkwpr);
#
# cyclins operate a Shewhart cycle in the eucaryotic cell. The spdca codelet signals initiation of a similar PDCA cycle controlled by Awf cyclin codelets
# checked for merged workspaces

    $cwsbi = $Awfif::memes-> {currentwsbi};
    $dolaunch = '';
    $twso = trwsoadr (fgrpend ($sponsor), 1);
    $asponsor = awsoadr ($sponsor);

    $stwso = getmystatement ($myli, $sponsor, $grkwp, $grkwpr);
    $astwso = awsoadr ($stwso);
    my ($sigcount, @lomatchs, @lola, @loconcs, @lostrts, @loends, @logb, @loge, $e2fwso);
    $$fbinderc = ifindb ($myli, $stwso, 'pdcab', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset);
    $pdcawso = getfbws ($myli, $sigcount, \@lomatchs, \@lola, \$pws);
# find the inhibitor binding
    if ($$fbinderc == 1) {

      $bcount = ifindb ($myli, $stwso, 'e2finhibb', \$sigcount, \@lomatchs, \@lola, \@loconcs, \@lostrts, \@loends, \@logb, \@loge, $kwp, $kwpr, \@$sactset, $pws);
      $e2fwso = getstsbws ($myli, $sigcount, \@lomatchs, \@lola, $pws);
      if ( ($bcount == 1) #call in the builder
      ){#launch builder
        $dolaunch = 't';
        };#if
      };#if
    $Awfif::memes-> {currentwsbi} = $cwsbi;

    if ($Awfif::memes-> {trace} > $Awfif::memes-> {traceentry}) {
      print ("ispdcaevaluatorx ret ($dolaunch)\n");
      };
    return $dolaunch
    }# ispdcaevaluator1
#
#<!-- end tag scs -->
#
sub spdcascbsmodeler1 {
    my ($myli, $kwp, $kwpr, $sactset, $and) = @_;
    my ($salience);

    $salience = ievalbsmodeler1 ($myli, \$$kwp, $kwpr, \@$sactset, \$$and, 'ispdcaevaluator');
    $$and = 't';
    return $salience
    }# spdcascbsmodeler1
#
#<!-- end tag scl -->
#<!-- start tag scs -->
#
sub spdcabsmodeler1 {
    my ($myli, $kwp, $kwpr, $sactset, $and) = @_;
    my ($salien