diff SSR.c @ 78:0d04c3e608cc

Creating a new branch for development of the DKU Pattern
author Sean Halle <seanhalle@yahoo.com>
date Sun, 26 Aug 2012 02:49:34 -0700
parents 8882e795016d
children ee8510009267
line diff
     1.1 --- a/SSR.c	Mon Mar 19 10:02:54 2012 -0700
     1.2 +++ b/SSR.c	Sun Aug 26 02:49:34 2012 -0700
     1.3 @@ -603,6 +603,65 @@
     1.4   }
     1.5  
     1.6  
     1.7 +//==============================  DKU  ================================
     1.8 +
     1.9 +/*The DKU pattern is instantiated by registering a divider, a kernel,
    1.10 + * and an undivider.  These are done by appropriate VMS_App__ calls.
    1.11 + *For now, think that things like WorkTable will want their own interface
    1.12 + * for divider and undivider.. so here, just do traditional DKU, with the
    1.13 + * DKUPiece data struct (include a field for passing info from divider
    1.14 + * to unidivider)
    1.15 + */
    1.16 +void
    1.17 +VMS_App__register_DKU_divider( DKUID ID, DKUDividerFn dividerFn, 
    1.18 +                               SlaveVP *animSlv )
    1.19 + {
    1.20 +   
    1.21 + }
    1.22 +
    1.23 +/*The kernel has no context, so it's created as a task, but it can
    1.24 + * communicate, so a suspendable task, just like in VSs.
    1.25 + *Will put this DKU into VSs first.. and thinking about forcing every
    1.26 + * language to support both tasks and VPs. 
    1.27 + */
    1.28 +void
    1.29 +VMS_App__register_DKU_kernel( DKUID ID, DKUKernelFn kernelFn, 
    1.30 +                              SlaveVP *animSlv )
    1.31 + {
    1.32 +   
    1.33 + }
    1.34 +
    1.35 +void
    1.36 +VMS_App__register_DKU_undivider( DKUID ID, DKUUndividerFn undividerFn,
    1.37 +                                 SlaveVP *animSlv )
    1.38 + {
    1.39 +   
    1.40 + }
    1.41 +
    1.42 +DKUInst *
    1.43 +VMS_DKU__make_DKU_Instance( DKUInstID DKU_INST_ID )
    1.44 + { int oldSz, i;
    1.45 +   DKUInstStruc **oldArray;
    1.46 +   
    1.47 +   DKUEnvironStruc *E = BLIS__BLISEnvironment->DKUEnvironment;
    1.48 +   
    1.49 +   if( E->numDKUInstances <= DKU_INST_ID) E->numDKUInstances = DKU_INST_ID+1;
    1.50 +   if( DKU_INST_ID >= E->instArraySz )
    1.51 +    { //full, so make bigger
    1.52 +      oldSz            = E->instArraySz;
    1.53 +      oldArray         = E->DKUInstStrucs;
    1.54 +      E->instArraySz  *= 2;
    1.55 +      E->DKUInstStrucs = malloc( E->instArraySz * sizeof(DKUInstStruc *) );
    1.56 +      for( i = 0; i < oldSz; i++ )
    1.57 +       { E->DKUInstStrucs[i] = oldArray[i];
    1.58 +       }
    1.59 +      free( oldArray );
    1.60 +    }
    1.61 +   E->DKUInstStrucs[ DKU_INST_ID ] = makeDKUInstStruc( DKU_INST_ID );
    1.62 +   return E->DKUInstStrucs[ DKU_INST_ID ];
    1.63 + }
    1.64 +
    1.65 +
    1.66  //===========================================================================
    1.67  //
    1.68  /*A function singleton is a function whose body executes exactly once, on a