示例#1
0
void CSharpFTabCodeGen::writeData()
{
	if ( redFsm->anyConditions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxCondOffset), CO() );
		COND_OFFSETS();
		CLOSE_ARRAY() <<
		"\n";

		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxCondLen), CL() );
		COND_LENS();
		CLOSE_ARRAY() <<
		"\n";

		OPEN_ARRAY( WIDE_ALPH_TYPE(), CK() );
		COND_KEYS();
		CLOSE_ARRAY() <<
		"\n";

		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxCondSpaceId), C() );
		COND_SPACES();
		CLOSE_ARRAY() <<
		"\n";
	}

	OPEN_ARRAY( ARRAY_TYPE(redFsm->maxKeyOffset), KO() );
	KEY_OFFSETS();
	CLOSE_ARRAY() <<
	"\n";

	OPEN_ARRAY( WIDE_ALPH_TYPE(), K() );
	KEYS();
	CLOSE_ARRAY() <<
	"\n";

	OPEN_ARRAY( ARRAY_TYPE(redFsm->maxSingleLen), SL() );
	SINGLE_LENS();
	CLOSE_ARRAY() <<
	"\n";

	OPEN_ARRAY( ARRAY_TYPE(redFsm->maxRangeLen), RL() );
	RANGE_LENS();
	CLOSE_ARRAY() <<
	"\n";

	OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndexOffset), IO() );
	INDEX_OFFSETS();
	CLOSE_ARRAY() <<
	"\n";

	if ( useIndicies ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndex), I() );
		INDICIES();
		CLOSE_ARRAY() <<
		"\n";

		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxState), TT() );
		TRANS_TARGS_WI();
		CLOSE_ARRAY() <<
		"\n";

		if ( redFsm->anyActions() ) {
			OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActListId), TA() );
			TRANS_ACTIONS_WI();
			CLOSE_ARRAY() <<
			"\n";
		}
	}
	else {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxState), TT() );
		TRANS_TARGS();
		CLOSE_ARRAY() <<
		"\n";

		if ( redFsm->anyActions() ) {
			OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActListId), TA() );
			TRANS_ACTIONS();
			CLOSE_ARRAY() <<
			"\n";
		}
	}

	if ( redFsm->anyToStateActions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), TSA() );
		TO_STATE_ACTIONS();
		CLOSE_ARRAY() <<
		"\n";
	}

	if ( redFsm->anyFromStateActions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), FSA() );
		FROM_STATE_ACTIONS();
		CLOSE_ARRAY() <<
		"\n";
	}

	if ( redFsm->anyEofActions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActListId), EA() );
		EOF_ACTIONS();
		CLOSE_ARRAY() <<
		"\n";
	}

	if ( redFsm->anyEofTrans() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndexOffset+1), ET() );
		EOF_TRANS();
		CLOSE_ARRAY() <<
		"\n";
	}

	STATE_IDS();
}
示例#2
0
/* Replaces x with the nearest number to x in the direction of y.
 *
 * This implementation is not exactly right, but it should be good
 * enough for Executor 2.  In particular, it doesn't handle
 * denormalized numbers well and it doesn't signal exceptions.
 *
 * Note that most SANE traps replace the dst operand with the
 * result.  This one replaces the src operand (really!)
 */
P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_FnextX,
		  uint8 *, x, uint8 *, y, unsigned short, sel)
{
  CCRElement saved_ccc, saved_ccn, saved_ccv, saved_ccnz, saved_ccx;
  INTEGER x_class, y_class, x_class_swapped, y_class_swapped;
  x80_t x80_x;
  int byte_size;
  int x_sign, y_sign;
  boolean_t normalize_x80_p;
  ieee_t xv, yv;

  saved_ccnz = cpu_state.ccnz;
  saved_ccn  = cpu_state.ccn;
  saved_ccc  = cpu_state.ccc;
  saved_ccv  = cpu_state.ccv;
  saved_ccx  = cpu_state.ccx;

  /* Determine the classes of both X and Y. */
  ROMlib_Fclassx (x, &x_class_swapped, sel);
  x_class = CW (x_class_swapped);
  ROMlib_Fclassx (y, &y_class_swapped, sel);
  y_class = CW (y_class_swapped);

  normalize_x80_p = FALSE;  /* default, avoid gcc warnings. */

  switch (sel & OPCODE_MASK)
    {
    case FX_OPERAND:
      xv = x80_to_ieee ((const x80_t *) x);
      yv = x80_to_ieee ((const x80_t *) y);
      normalize_x80_p = ((x[2] & 0x80) != 0);
      byte_size = 10;
      break;
    case FD_OPERAND:
      xv = f64_to_ieee ((const f64_t *) x);
      yv = f64_to_ieee ((const f64_t *) y);
      byte_size = 8;
      break;
    case FS_OPERAND:
      xv = f32_to_ieee ((const f32_t *) x);
      yv = f32_to_ieee ((const f32_t *) y);
      byte_size = 4;
      break;
    case FI_OPERAND:
      xv = CW (*(short *)x);
      yv = CW (*(short *)y);
      byte_size = 2;
      break;
    case FL_OPERAND:
      xv = CL(*(long *)x);
      yv = CL(*(long *)y);
      byte_size = 4;
      break;
    case FC_OPERAND:
      xv = comp_to_ieee ((const comp_t *) x);
      yv = comp_to_ieee ((const comp_t *) y);
      byte_size = 8;
      break;
    default:
      gui_abort ();
      xv = yv = 0;  /* avoid gcc warnings */
      goto done;
    }

  /* If either number is a NaN, the result is a NaN.  Technically it
   * should be a quiet NaN and we should signal if a signaling
   * NaN made it here, but we don't do that yet.
   */
  if (y_class == SNaN || y_class == QNaN)
    {
      memcpy (x, y, byte_size);
      goto done;
    }
  if (x_class == SNaN || x_class == QNaN)
    goto done;
  
  /* Compare x and y. */
  ROMlib_Fx2X (x, &x80_x, sel & OPCODE_MASK);
  ROMlib_Fcmpx (y, &x80_x, sel & OPCODE_MASK);

  /* If x == y, just return x unchanged. */
  if (!cpu_state.ccnz)
    goto done;

  /* Fetch the sign of x and y. */
  x_sign = x[0] & 0x80;
  y_sign = y[0] & 0x80;

  if (x_class == ZeroNum)
    {
      memset (x, 0, byte_size);
      x[0] = y_sign;
      x[byte_size - 1] |= 1;	/* smallest normalized number. */
    }
  else /* x != 0 */
    {
      if (!cpu_state.ccn ^ !x_sign)
	mp_increment_big_endian (x, byte_size);
      else
	{
	  if (normalize_x80_p)
	    x[2] &= 0x7F; /* make sure borrow goes through normalize bit */
	  mp_decrement_big_endian (x, byte_size);
	}

      /* Restore the sign in case of carry. */
      x[0] = (x[0] & 0x7F) | x_sign;
    }

  /* Restore normalize bit, which may have gotten carried through or
   * borrowed through, etc.
   */
  if (normalize_x80_p)
    x[2] |= 0x80;

 done:

#if ERROR_SUPPORTED_P (ERROR_FLOATING_POINT)
  {
    ieee_t result;
    
    switch (sel & OPCODE_MASK)
      {
      case FX_OPERAND:
	result = x80_to_ieee ((const x80_t *) x);
	break;
      case FD_OPERAND:
	result = f64_to_ieee ((const f64_t *) x);
	break;
      case FS_OPERAND:
	result = f32_to_ieee ((const f32_t *) x);
	break;
      case FI_OPERAND:
	result = CW (*(short *)x);
	break;
      case FL_OPERAND:
	result = CL (*(long *)x);
	break;
      case FC_OPERAND:
	result = comp_to_ieee ((const comp_t *) x);
	break;
      default:
	gui_abort ();
	result = 0;
      }

    warning_floating_point ("nextafter(%.30f, %.30f) == %.30f",
			    (double) xv, (double) yv, (double) result);
  }
#endif /* ERROR_SUPPORTED_P (ERROR_FLOATING_POINT) */

  cpu_state.ccnz = saved_ccnz;
  cpu_state.ccn  = saved_ccn;
  cpu_state.ccc  = saved_ccc;
  cpu_state.ccv  = saved_ccv;
  cpu_state.ccx  = saved_ccx;
}
GroupBattleRule::GroupBattleRule(GroupBattleRule const& other) : GC::GroupBattleRule(other), revealDeoxysForm(other.revealDeoxysForm),
nbPkm(other.nbPkm), isBattleOpen(other.isBattleOpen) {
	CL(customName);
}
示例#4
0
文件: qColor.c 项目: LarBob/executor
P1 (PUBLIC pascal trap, CTabHandle, GetCTable,
    INTEGER, ctab_res_id)
{
  CTabHandle ctab;
  clut_res_handle clut;
  int32 ctab_id;

  ctab_id = ctab_res_id;
  switch (ctab_id)
    {
      /* grayscale */
    case 33:
    case 34:
    case 36:
    case 40:
      {
	/* number of elements in the color table minus 1 */
	int ctab_size;
	int  i;
	uint32 stride, c;
	ColorSpec *table;
	
	ctab_size = (1 << (ctab_id - 32)) - 1;
	
	/* #### should we first check for a 'clut' resource of
	   `ctab_id' before creating a grayscale clut? */
	
	/* #### are we to make a new copy every time? */
	ctab = (CTabHandle) NewHandle (CTAB_STORAGE_FOR_SIZE (ctab_size));
	
	/* if the color table is b/w, set the seed to be the b/w clut
	   seed */
	/* #### ctab_id or a new seed? */
	CTAB_SEED_X (ctab)  = CL (ctab_id == 33 ? 1 : ctab_id);
	CTAB_SIZE_X (ctab)  = CW (ctab_size);
	CTAB_FLAGS_X (ctab) = CTAB_GDEVICE_BIT_X;
	
	table = CTAB_TABLE (ctab);
	
	stride = 0xFFFF0000UL / ctab_size;
	for (c = 0xFFFF0000UL, i = 0; i < ctab_size; c -= stride, i ++)
	  {
	    table[i].value = CW (i);
	    table[i].rgb.red = table[i].rgb.green = table[i].rgb.blue
	      = CW ((c + 0x8000) >> 16);
	  }
	
	/* Make sure the last entry is _exactly_ black. */
	table[ctab_size].value = CW (ctab_size);
	table[ctab_size].rgb.red = table[ctab_size].rgb.green
	  = table[ctab_size].rgb.blue = CWC (0);
	
	return ctab;
      }
      
      /* just like 1-8 */
    case 65:
    case 66:
    case 68:
    case 72:
      ctab_id -= 64;
      /* fall through */
    default:
      {
	clut = (clut_res_handle) ROMlib_getrestid (TICK ("clut"), ctab_res_id);
	
	if (clut)
	  {
	    int ctab_handle_size;
	    
	    ctab_handle_size
	      = sizeof (ColorTable) + (sizeof (ColorSpec) * CTAB_SIZE (clut));
	    ctab = (CTabHandle) NewHandle (ctab_handle_size);
	    
	    BlockMove ((Ptr) STARH (clut), (Ptr) STARH (ctab),
		       ctab_handle_size);
	    
	    /* #### ctab_id or a new seed? */
	    CTAB_SEED_X (ctab) = CL (ctab_id);
	  }
	else if (ctab_id >= 0 && ctab_id <= 8)
	  {
	    /* if there is no clut, use the ``rom'' default values */
	    int ctab_size;
	    ColorSpec *ctab_table;
	    
	    ctab_size = (1 << ctab_id) - 1;
	    ctab = (CTabHandle) NewHandle (CTAB_STORAGE_FOR_SIZE (ctab_size));
	    
	    CTAB_SIZE_X (ctab) = CW (ctab_size);
	    CTAB_FLAGS_X (ctab) = CTAB_GDEVICE_BIT_X;
	    CTAB_SEED_X (ctab) = CL (ctab_id);
	    
	    ctab_table = CTAB_TABLE (ctab);
	    memcpy (ctab_table, default_ctab_colors[ROMlib_log2[ctab_id]],
		    (1 << ctab_id) * sizeof *ctab_table);
	  }
	else
	  ctab = NULL;
	return ctab;
      }
    }
}
示例#5
0
inline void
SUMMA_NNA
( T alpha, const DistMatrix<T>& A,
           const DistMatrix<T>& B,
  T beta,        DistMatrix<T>& C )
{
#ifndef RELEASE
    CallStackEntry entry("gemm::SUMMA_NNA");
    if( A.Grid() != B.Grid() || B.Grid() != C.Grid() )
        LogicError("{A,B,C} must have the same grid");
    if( A.Height() != C.Height() ||
        B.Width()  != C.Width()  ||
        A.Width()  != B.Height() )
    {
        std::ostringstream msg;
        msg << "Nonconformal matrices: \n"
            << "  A ~ " << A.Height() << " x " << A.Width() << "\n"
            << "  B ~ " << B.Height() << " x " << B.Width() << "\n"
            << "  C ~ " << C.Height() << " x " << C.Width() << "\n";
        LogicError( msg.str() );
    }
#endif
    const Grid& g = A.Grid();

    // Matrix views
    DistMatrix<T> BL(g), BR(g),
                  B0(g), B1(g), B2(g);
    DistMatrix<T> CL(g), CR(g),
                  C0(g), C1(g), C2(g);

    // Temporary distributions
    DistMatrix<T,VR,STAR> B1_VR_STAR(g);
    DistMatrix<T,STAR,MR> B1Trans_STAR_MR(g);
    DistMatrix<T,MC,STAR> D1_MC_STAR(g);

    B1_VR_STAR.AlignWith( A );
    B1Trans_STAR_MR.AlignWith( A );
    D1_MC_STAR.AlignWith( A );

    // Start the algorithm
    Scale( beta, C );
    LockedPartitionRight( B, BL, BR, 0 );
    PartitionRight( C, CL, CR, 0 );
    while( BR.Width() > 0 )
    {
        LockedRepartitionRight
        ( BL, /**/     BR,
          B0, /**/ B1, B2 );

        RepartitionRight
        ( CL, /**/     CR,
          C0, /**/ C1, C2 );

        //--------------------------------------------------------------------//
        B1_VR_STAR = B1;
        B1Trans_STAR_MR.TransposeFrom( B1_VR_STAR );

        // D1[MC,*] := alpha A[MC,MR] B1[MR,*]
        LocalGemm( NORMAL, TRANSPOSE, alpha, A, B1Trans_STAR_MR, D1_MC_STAR );

        // C1[MC,MR] += scattered result of D1[MC,*] summed over grid rows
        C1.SumScatterUpdate( T(1), D1_MC_STAR );
        //--------------------------------------------------------------------//

        SlideLockedPartitionRight
        ( BL,     /**/ BR,
          B0, B1, /**/ B2 );

        SlidePartitionRight
        ( CL,     /**/ CR,
          C0, C1, /**/ C2 );
    }
}
示例#6
0
A8(PUBLIC, OSErr,  ROMlib_hiddenbyname, GetOrSetType, gors,	/* INTERNAL */
		   char *, pathname, char *, rpathname, Single_dates *, datep,
		   FInfo *, finfop, FXInfo *, fxinfop, LONGINT *, lenp,
							      LONGINT *, rlenp)
{
    LONGINT rfd;
    struct stat sbuf;
    Single_finfo sfinfo;
    Single_descriptor d;
    OSErr retval;
    BOOLEAN done;

    retval = noErr;
    if (Ustat(pathname, &sbuf) < 0)
	retval = ROMlib_maperrno();
    else {
	done = FALSE;
	rfd = Uopen(rpathname, O_BINARY|(gors == Set ? O_RDWR : O_RDONLY), 0);
/*
if (rfd == -1)
fprintf(stderr, "%s(%d): open '%s' fails\n", __FILE__, __LINE__, rpathname);
*/
	if (rfd < 0) {
	    done = TRUE;
	    if (errno == ENOENT) {
		/* no resource fork (or AppleSingle) */
		/* right now we ignore that it could be AppleSingle */
		switch (gors) {
		case Get:
		    memset(datep,   0, sizeof(*datep));
		    memset(finfop,  0, sizeof(*finfop));
		    memset(fxinfop, 0, sizeof(*fxinfop));
		    *lenp = CL(sbuf.st_size);
		    *rlenp = 0;
		    break;
		case Set:
		    retval = ROMlib_newresfork(rpathname, &rfd, FALSE);
		    done = FALSE;
		    break;
		default:
		    gui_assert(0);
		    break;
		}
	    } else
		retval = ROMlib_maperrno();
	}
	if (!done && retval == noErr) {
	    switch (gors) {
	    case Get:
		if (getsetentry(Get, rfd, File_Dates_Info_ID, &d, NULL))
		  getsetpiece(Get, rfd, &d, (char *) datep, sizeof(*datep));
		else
		  {
		    datep->crdat = CL (UNIXTIMETOMACTIME (MIN (sbuf.st_ctime, sbuf.st_mtime)));
		    datep->moddat = CL (UNIXTIMETOMACTIME (sbuf.st_mtime));
		    datep->accessdat = CL (UNIXTIMETOMACTIME (sbuf.st_atime));
		    datep->backupdat = 0;
		  }

		if (!getsetentry(Get, rfd, Finder_Info_ID,   &d, NULL))
		  warning_unexpected ("no finder info");
		else
		  {
		    getsetpiece(Get, rfd, &d, (char *) &sfinfo, sizeof(sfinfo));

		    if (finfop)
		      *finfop  = sfinfo.finfo;
		    if (fxinfop)
		      *fxinfop = sfinfo.fxinfo;

		    *lenp  = CL(sbuf.st_size);
		  }
		if (getsetentry(Get, rfd, Resource_Fork_ID,   &d, NULL))
		    *rlenp = d.length;
		else
		    *rlenp = 0;
		break;
	    case Set:
		if (getsetentry(Get, rfd, File_Dates_Info_ID, &d, NULL))
		  getsetpiece(Set, rfd, &d, (char *) datep, sizeof(*datep));

		if (!getsetentry(Get, rfd, Finder_Info_ID,   &d, NULL))
		  warning_unexpected ("no finfo");
		else
		  {
		    if (!finfop || !fxinfop) {
		      sfinfo.finfo.fdCreator = TICKX("UNIX");
		      sfinfo.finfo.fdType    = TICKX("TEXT");
		      getsetpiece(Get, rfd, &d, (char *) &sfinfo,
							       sizeof(sfinfo));
		    }

		    if (finfop)
		      sfinfo.finfo  = *finfop;
		    if (fxinfop)
		      sfinfo.fxinfo = *fxinfop;
		    getsetpiece(Set, rfd, &d, (char *) &sfinfo, sizeof(sfinfo));
		  }
		break;
	    default:
		gui_assert(0);
		break;
	    }
	}
	Uclose(rfd);
    }
    fs_err_hook (retval);
    return retval;
}
#define CC_PROFILER_START_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingBeginTimingBlock(__name__); } while(0)
#undef CC_PROFILER_STOP_CATEGORY
#define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingEndTimingBlock(__name__); } while(0)
#undef CC_PROFILER_RESET_CATEGORY
#define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingResetTimingBlock(__name__); } while(0)

#undef CC_PROFILER_START_INSTANCE
#define CC_PROFILER_START_INSTANCE(__id__, __name__) do{ ProfilingBeginTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
#undef CC_PROFILER_STOP_INSTANCE
#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do{ ProfilingEndTimingBlock(    String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
#undef CC_PROFILER_RESET_INSTANCE
#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do{ ProfilingResetTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)

static std::function<PerformceAllocScene*()> createFunctions[] =
{
    CL(NodeCreateTest),
    CL(NodeDeallocTest),
    CL(SpriteCreateEmptyTest),
    CL(SpriteCreateTest),
    CL(SpriteDeallocTest),
};

#define MAX_LAYER    (sizeof(createFunctions) / sizeof(createFunctions[0]))

enum {
    kTagInfoLayer = 1,

    kTagBase = 20000,
};

enum {
示例#8
0
文件: syserr.c 项目: nobled/executor
A4(PRIVATE, void, dobuttons, INTEGER, id, INTEGER, offsetx,
   INTEGER, offsety, BOOLEAN, demo_button_p)
{
    struct bdef *bp;
    struct sdef *sp;
    struct pdef *pp;
    int i;
    EventRecord evt;
    int done;
    int tcnt, twid;
    Point p;
#define BILLBUTTONS /*  */
#if defined (BILLBUTTONS)
    INTEGER h, v;
#endif /* BILLBUTTONS */
    char *textp;

    if ((bp = (struct bdef *) findid(id))) {
        for (i = 0; i < Cx(bp->nbut); i++) {

            /* Offset buttons; this hack is to center the splash screen
             * on non-512x342 root windows...yuck!
             */

            C_OffsetRect (&bp->buts[i].butloc, offsetx, offsety);
            if ((sp = (struct sdef *)findid(CW(bp->buts[i].butstrid)))) {
                if (demo_button_p && sp->text[0] == 'O' && sp->text[1] == 'K')
                    textp = "Demo";
                else
                    textp = sp->text;
                tcnt = strlen(textp);
                twid = TextWidth((Ptr) textp, 0, tcnt);
                MoveTo((CW(bp->buts[i].butloc.left)  +
                        CW(bp->buts[i].butloc.right) - twid) / 2,
                       (CW(bp->buts[i].butloc.top)   +
                        CW(bp->buts[i].butloc.bottom)) / 2 + 4);
                DrawText((Ptr) textp, 0, tcnt);
            }
#if defined (BILLBUTTONS)
            h = CW(bp->buts[i].butloc.right) - CW(bp->buts[i].butloc.left);
            v = (CW(bp->buts[i].butloc.bottom) - CW(bp->buts[i].butloc.top))/2;
            if (h > v)
                h = v;
            if (!(ROMlib_options & ROMLIB_RECT_SCREEN_BIT))
                FrameRoundRect(&bp->buts[i].butloc, h, v);
            else
                FrameRect(&bp->buts[i].butloc);
#else /* BILLBUTTONS */
            if (!(ROMlib_options & ROMLIB_RECT_SCREEN_BIT))
                FrameRoundRect(&bp->buts[i].butloc, 10, 10);
            else
                FrameRect(&bp->buts[i].butloc);
#endif /* BILLBUTTONS */
        }

        for (done = 0; !done;) {
            C_GetNextEvent(mDownMask|keyDownMask, &evt);
            if (evt.what == CWC(mouseDown) || evt.what == CWC(keyDown)) {
                p.h = CW(evt.where.h);
                p.v = CW(evt.where.v);
                for (i = 0; !done && i < CW(bp->nbut); i++) {
                    if (PtInRect(p, &bp->buts[i].butloc) ||
                            ((evt.what == CWC(keyDown)) &&
                             (((CL(evt.message) & charCodeMask) == '\r') ||
                              ((CL(evt.message) & charCodeMask) == NUMPAD_ENTER)))
                       ) {
                        if ((pp = (struct pdef *)
                                  findid(CW(bp->buts[i].butprocid))))
                            /* NOTE:  we will have to do a better
                                  job here sometime */
                            (*(void (*)(void))MR(pp->proc))();
                        done = 1;
                    }
                }
                if (!done)
                    SysBeep(1);
            }
        }
        if (evt.what == CWC(mouseDown))
            while (!C_GetNextEvent(mUpMask, &evt))
                ;

        /* Move all buttons back. */
        for (i = 0; i < Cx(bp->nbut); i++)
            C_OffsetRect (&bp->buts[i].butloc, -offsetx, -offsety);
    }
}
示例#9
0
#include "RenderTextureTest.h"
#include "../testBasic.h"

// Test #1 by Jason Booth (slipster216)
// Test #3 by David Deaco (ddeaco)


static std::function<Layer*()> createFunctions[] = {
    CL(RenderTextureSave),
    CL(RenderTextureIssue937),
    CL(RenderTextureZbuffer),
    CL(RenderTextureTestDepthStencil),
    CL(RenderTextureTargetNode),
    CL(SpriteRenderTextureBug),
    CL(RenderTexturePartTest),
};

#define MAX_LAYER   (sizeof(createFunctions)/sizeof(createFunctions[0]))
static int sceneIdx = -1; 

static Layer* nextTestCase()
{
    sceneIdx++;
    sceneIdx = sceneIdx % MAX_LAYER;

    auto layer = (createFunctions[sceneIdx])();
    return layer;
}

static Layer* backTestCase()
{
示例#10
0
Layer* nextCocosNodeAction();
Layer* backCocosNodeAction();
Layer* restartCocosNodeAction();

//------------------------------------------------------------------
//
// TestCocosNodeDemo
//
//------------------------------------------------------------------

static int sceneIdx = -1; 


static std::function<Layer*()> createFunctions[] =
{
    CL(CameraTest1),
    // TODO: Camera has been removed from CCNode, add new feature to support it
    // CL(CameraTest2),
    CL(CameraCenterTest),
    CL(Test2),
    CL(Test4),
    CL(Test5),
    CL(Test6),
    CL(StressTest1),
    CL(StressTest2),
    CL(NodeToWorld),
    CL(NodeToWorld3D),
    CL(SchedulerTest1),
    CL(CameraOrbitTest),
    // TODO: Camera has been removed from CCNode, add new feature to support it
    //CL(CameraZoomTest),
示例#11
0
#include <unistd.h>
#else
#include <io.h>
#endif

//------------------------------------------------------------------
//
// EaseSpriteDemo
//
//------------------------------------------------------------------

static int sceneIdx = -1;

static std::function<Layer*()> createFunctions[] =
{
    CL(ConsoleTCP),
    CL(ConsoleCustomCommand),
};

#define MAX_LAYER    (sizeof(createFunctions) / sizeof(createFunctions[0]))

Layer* nextConsoleTest()
{
    sceneIdx++;
    sceneIdx = sceneIdx % MAX_LAYER;

    auto layer = (createFunctions[sceneIdx])();
    return layer;
}

Layer* backConsoleTest()
示例#12
0
enum
{
    IDC_NEXT = 100,
    IDC_BACK,
    IDC_RESTART
};

Layer* nextAtlasAction();
Layer* backAtlasAction();
Layer* restartAtlasAction();

static int sceneIdx = -1; 

static std::function<Layer*()> createFunctions[] =
{
    CL(LabelAtlasTest),
    CL(LabelAtlasColorTest),
    CL(Atlas3),
    CL(Atlas4),
    CL(Atlas5),
    CL(Atlas6),
    CL(AtlasBitmapColor),
    CL(AtlasFastBitmap),
    CL(BitmapFontMultiLine),
    CL(LabelsEmpty),
    CL(LabelBMFontHD),
    CL(LabelAtlasHD),
    CL(LabelGlyphDesigner),
    CL(LabelTTFTest),
    CL(LabelTTFMultiline),
    CL(LabelTTFChinese),
#define CC_PROFILER_START_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingBeginTimingBlock(__name__); } while(0)
#undef CC_PROFILER_STOP_CATEGORY
#define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingEndTimingBlock(__name__); } while(0)
#undef CC_PROFILER_RESET_CATEGORY
#define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingResetTimingBlock(__name__); } while(0)

#undef CC_PROFILER_START_INSTANCE
#define CC_PROFILER_START_INSTANCE(__id__, __name__) do{ ProfilingBeginTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
#undef CC_PROFILER_STOP_INSTANCE
#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do{ ProfilingEndTimingBlock(    String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
#undef CC_PROFILER_RESET_INSTANCE
#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do{ ProfilingResetTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)

static std::function<PerformanceContainerScene*()> createFunctions[] =
{
    CL(TemplateVectorPerfTest),
    CL(ArrayPerfTest),
    CL(TemplateMapStringKeyPerfTest),
    CL(DictionaryStringKeyPerfTest),
    CL(TemplateMapIntKeyPerfTest),
    CL(DictionaryIntKeyPerfTest)
};

#define MAX_LAYER    (sizeof(createFunctions) / sizeof(createFunctions[0]))

enum {
    kTagInfoLayer = 1,

    kTagBase = 20000,
};
#include "MultipleTimelineTest.h"
#include "../testResource.h"

static std::function<Layer*()> createFunctions[] = {
    CL(MultipleTimelineTest),
};

static int sceneIdx = -1;
#define MAX_LAYER (sizeof(createFunctions) / sizeof(createFunctions[0]))

DEFAULT_NEXT_ACTION;
DEFAULT_BACK_ACTION;
DEFAULT_RESTART_ACTION;

/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////

bool MultipleTimelineTest::init()
{
    if (BaseTest::init())
    {
        m_scene = SCENE_DEFAULT;

        m_gafObject = gaf_object();
        this->addChild(m_gafObject, -1);

        this->setup();
        return true;
    }
    return false;
示例#15
0
#include <algorithm>
#include "../testResource.h"

enum
{
    IDC_NEXT = 100,
    IDC_BACK,
    IDC_RESTART
};

static int sceneIdx = -1;


static std::function<Layer*()> createFunctions[] =
{
    CL(Sprite3DBasicTest),
    CL(Sprite3DEffectTest)
};

#define MAX_LAYER    (sizeof(createFunctions) / sizeof(createFunctions[0]))

static Layer* nextSpriteTestAction()
{
    sceneIdx++;
    sceneIdx = sceneIdx % MAX_LAYER;
    
    auto layer = (createFunctions[sceneIdx])();
    return layer;
}

static Layer* backSpriteTestAction()
示例#16
0
文件: NTNT.hpp 项目: certik/Elemental
inline void
Trr2kNTNT
( UpperOrLower uplo,
  Orientation orientationOfB, Orientation orientationOfD,
  T alpha, const DistMatrix<T,MC,MR>& A, const DistMatrix<T,MC,MR>& B,
           const DistMatrix<T,MC,MR>& C, const DistMatrix<T,MC,MR>& D,
  T beta,        DistMatrix<T,MC,MR>& E )
{
#ifndef RELEASE
    PushCallStack("internal::Trr2kNTNT");
    if( E.Height() != E.Width()  || A.Width()  != C.Width()  ||
        A.Height() != E.Height() || C.Height() != E.Height() ||
        B.Height() != E.Width()  || D.Height() != E.Width()  ||
        A.Width()  != B.Width()  || C.Width()  != D.Width() )
        throw std::logic_error("Nonconformal Trr2kNTNT");
#endif
    const Grid& g = E.Grid();

    DistMatrix<T,MC,MR> AL(g), AR(g),
                        A0(g), A1(g), A2(g);
    DistMatrix<T,MC,MR> BL(g), BR(g),
                        B0(g), B1(g), B2(g);

    DistMatrix<T,MC,MR> CL(g), CR(g),
                        C0(g), C1(g), C2(g);
    DistMatrix<T,MC,MR> DL(g), DR(g),
                        D0(g), D1(g), D2(g);

    DistMatrix<T,MC,  STAR> A1_MC_STAR(g);
    DistMatrix<T,VR,  STAR> B1_VR_STAR(g);
    DistMatrix<T,STAR,MR  > B1AdjOrTrans_STAR_MR(g);
    DistMatrix<T,MC,  STAR> C1_MC_STAR(g);
    DistMatrix<T,VR,  STAR> D1_VR_STAR(g);
    DistMatrix<T,STAR,MR  > D1AdjOrTrans_STAR_MR(g);

    A1_MC_STAR.AlignWith( E );
    B1_VR_STAR.AlignWith( E );
    B1AdjOrTrans_STAR_MR.AlignWith( E );
    C1_MC_STAR.AlignWith( E );
    D1_VR_STAR.AlignWith( E );
    D1AdjOrTrans_STAR_MR.AlignWith( E );

    LockedPartitionRight( A, AL, AR, 0 );
    LockedPartitionRight( B, BL, BR, 0 );
    LockedPartitionRight( C, CL, CR, 0 );
    LockedPartitionRight( D, DL, DR, 0 );
    while( AL.Width() < A.Width() )
    {
        LockedRepartitionRight
        ( AL, /**/ AR,
          A0, /**/ A1, A2 );
        LockedRepartitionRight
        ( BL, /**/ BR,
          B0, /**/ B1, B2 );
        LockedRepartitionRight
        ( CL, /**/ CR,
          C0, /**/ C1, C2 );
        LockedRepartitionRight
        ( CL, /**/ CR,
          C0, /**/ C1, C2 );

        //--------------------------------------------------------------------//
        A1_MC_STAR = A1;
        C1_MC_STAR = C1;
        B1_VR_STAR = B1;
        D1_VR_STAR = D1;
        if( orientationOfB == ADJOINT )
            B1AdjOrTrans_STAR_MR.AdjointFrom( B1_VR_STAR );
        else
            B1AdjOrTrans_STAR_MR.TransposeFrom( B1_VR_STAR );
        if( orientationOfD == ADJOINT )
            D1AdjOrTrans_STAR_MR.AdjointFrom( D1_VR_STAR );
        else
            D1AdjOrTrans_STAR_MR.TransposeFrom( D1_VR_STAR );
        LocalTrr2k
        ( uplo, 
          alpha, A1_MC_STAR, B1AdjOrTrans_STAR_MR, 
                 C1_MC_STAR, D1AdjOrTrans_STAR_MR,
          beta,  E );
        //--------------------------------------------------------------------//

        SlideLockedPartitionRight
        ( DL,     /**/ DR,
          D0, D1, /**/ D2 );
        SlideLockedPartitionRight
        ( CL,     /**/ CR,
          C0, C1, /**/ C2 );
        SlideLockedPartitionRight
        ( BL,     /**/ BR,
          B0, B1, /**/ B2 );
        SlideLockedPartitionRight
        ( AL,     /**/ AR,
          A0, A1, /**/ A2 );
    }
#ifndef RELEASE
    PopCallStack();
#endif
}
示例#17
0
void OCamlTabCodeGen::writeData()
{
	/* If there are any transtion functions then output the array. If there
	 * are none, don't bother emitting an empty array that won't be used. */
	if ( redFsm->anyActions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActArrItem), A() );
		ACTIONS_ARRAY();
		CLOSE_ARRAY() <<
		"\n";
	}

	if ( redFsm->anyConditions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxCondOffset), CO() );
		COND_OFFSETS();
		CLOSE_ARRAY() <<
		"\n";

		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxCondLen), CL() );
		COND_LENS();
		CLOSE_ARRAY() <<
		"\n";

		OPEN_ARRAY( WIDE_ALPH_TYPE(), CK() );
		COND_KEYS();
		CLOSE_ARRAY() <<
		"\n";

		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxCondSpaceId), C() );
		COND_SPACES();
		CLOSE_ARRAY() <<
		"\n";
	}

	OPEN_ARRAY( ARRAY_TYPE(redFsm->maxKeyOffset), KO() );
	KEY_OFFSETS();
	CLOSE_ARRAY() <<
	"\n";

	OPEN_ARRAY( WIDE_ALPH_TYPE(), K() );
	KEYS();
	CLOSE_ARRAY() <<
	"\n";

	OPEN_ARRAY( ARRAY_TYPE(redFsm->maxSingleLen), SL() );
	SINGLE_LENS();
	CLOSE_ARRAY() <<
	"\n";

	OPEN_ARRAY( ARRAY_TYPE(redFsm->maxRangeLen), RL() );
	RANGE_LENS();
	CLOSE_ARRAY() <<
	"\n";

	OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndexOffset), IO() );
	INDEX_OFFSETS();
	CLOSE_ARRAY() <<
	"\n";

	if ( useIndicies ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndex), I() );
		INDICIES();
		CLOSE_ARRAY() <<
		"\n";

		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxState), TT() );
		TRANS_TARGS_WI();
		CLOSE_ARRAY() <<
		"\n";

		if ( redFsm->anyActions() ) {
			OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), TA() );
			TRANS_ACTIONS_WI();
			CLOSE_ARRAY() <<
			"\n";
		}
	}
	else {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxState), TT() );
		TRANS_TARGS();
		CLOSE_ARRAY() <<
		"\n";

		if ( redFsm->anyActions() ) {
			OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), TA() );
			TRANS_ACTIONS();
			CLOSE_ARRAY() <<
			"\n";
		}
	}

	if ( redFsm->anyToStateActions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), TSA() );
		TO_STATE_ACTIONS();
		CLOSE_ARRAY() <<
		"\n";
	}

	if ( redFsm->anyFromStateActions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), FSA() );
		FROM_STATE_ACTIONS();
		CLOSE_ARRAY() <<
		"\n";
	}

	if ( redFsm->anyEofActions() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxActionLoc), EA() );
		EOF_ACTIONS();
		CLOSE_ARRAY() <<
		"\n";
	}

	if ( redFsm->anyEofTrans() ) {
		OPEN_ARRAY( ARRAY_TYPE(redFsm->maxIndexOffset+1), ET() );
		EOF_TRANS();
		CLOSE_ARRAY() <<
		"\n";
	}

	STATE_IDS();

  out << "type " << TYPE_STATE() << " = { mutable keys : int; mutable trans : int; mutable acts : int; mutable nacts : int; }"
    << TOP_SEP();

  out << "exception Goto_match" << TOP_SEP();
  out << "exception Goto_again" << TOP_SEP();
  out << "exception Goto_eof_trans" << TOP_SEP();
}
示例#18
0
文件: syserr.c 项目: nobled/executor
P1(PUBLIC pascal, void, SysError, short, errorcode)
{
    GrafPort alertport;
    Region viscliprgn;
    HIDDEN_RgnPtr rp;
    Rect r;
    struct adef *ap;
    char quickbytes[grafSize];
    INTEGER offsetx, offsety;
    Rect main_gd_rect;

#if defined (BINCOMPAT)
    LONGINT tmpa5;
#endif /* BINCOMPAT */

    main_gd_rect = PIXMAP_BOUNDS (GD_PMAP (MR (MainDevice)));

    if (!DSAlertTab) {
#if defined (CLIFF_CENTERING_ALGORITHM)
        DSAlertTab = CL((Ptr) &myalerttab);
        DSAlertRect.top    = CWC(64);
        DSAlertRect.left   = CWC(32);
        DSAlertRect.bottom = CWC(190);
        DSAlertRect.right  = CWC(480);
#else
        INTEGER screen_width = CW (main_gd_rect.right);
        INTEGER screen_height = CW (main_gd_rect.bottom);

        DSAlertTab = RM((Ptr) &myalerttab);
        DSAlertRect.top    = CW((screen_height - 126) / 3);
        DSAlertRect.left   = CW((screen_width - 448) / 2);
        DSAlertRect.bottom = CW(CW(DSAlertRect.top) + 126);
        DSAlertRect.right  = CW(CW(DSAlertRect.left) + 448);
#endif

        offsetx = CW (DSAlertRect.left) - 32;
        offsety = CW (DSAlertRect.top) - 64;
    }
    else {
        offsetx = offsety = 0;
    }

    /* IM-362 */
    /* 1. Save registers and Stack Pointer */
    /*	  NOT DONE YET... signal handlers sort of do that anyway */

    /* 2. Store errorcode in DSErrCode */
    DSErrCode = CW(errorcode);

    /* 3. If no Cx(DSAlertTab), bitch */
    if (!DSAlertTab) {
        write(2, "This machine thinks its a sadmac\n",
              sizeof("This machine thinks its a sadmac\n")-1);
        exit(255);
    }

    /* 4. Allocate and re-initialize QuickDraw */
#if defined (BINCOMPAT)
    a5 = (LONGINT) (long) US_TO_SYN68K (&tmpa5);
    CurrentA5 = (Ptr) (long) CL(a5);
#endif /* BINCOMPAT */
    InitGraf((Ptr) quickbytes + sizeof(quickbytes) - 4);
    ROMlib_initport(&alertport);
    SetPort(&alertport);
    InitCursor();
    rp.p = RM(&viscliprgn);
    alertport.visRgn = alertport.clipRgn = RM(&rp);
    viscliprgn.rgnSize = CWC(10);
#if 0 && !defined(MSDOS)
    viscliprgn.rgnBBox = DSAlertRect;
#else
    viscliprgn.rgnBBox = main_gd_rect;
#endif

    /* 5, 6. Draw alert box if the errorcode is >= 0 */
    TRAPBEGIN();
    if (errorcode < 0)
        errorcode = -errorcode;
    else {
        r = DSAlertRect;
        FillRect(&r, white);
#if defined (OLDSTYLEALERT)
        r.right = CW(CW(r.right) - (2));
        r.bottom = CW(CW(r.bottom) - (2));
        FrameRect(&r);
        PenSize(2, 2);
        MoveTo(CW(r.left)+2, CW(r.bottom));
        LineTo(CW(r.right), CW(r.bottom));
        LineTo(CW(r.right), CW(r.top)+2);
        PenSize(1, 1);
#else /* OLDSTYLEALERT */
        FrameRect(&r);
        InsetRect(&r, 3, 3);
        PenSize(2, 2);
        FrameRect(&r);
        PenSize(1, 1);
#endif /* OLDSTYLEALERT */
    }

    /* find appropriate entry */

    ap = (struct adef *) findid(errorcode);
    if (!ap)
        ap = (struct adef *) ((INTEGER *) MR(DSAlertTab) + 1);

    /* 7. text strings */
    drawtextstring(CW(ap->primetextid), offsetx, offsety);
    drawtextstring(CW(ap->secondtextid), offsetx, offsety);

    /* 8. icon */
    drawicon(CW(ap->iconid), offsetx, offsety);

    /* 9. TODO: figure out what to do with the proc ... */

    /* 10, 11, 12, 13. check for non-zero button id */
    /* #warning We blow off ResumeProc until we can properly handle it */
    if (ap->buttonid)
        dobuttons(/* CL(ResumeProc) ? Cx(ap->buttonid) + 1 : */ Cx(ap->buttonid),
                offsetx, offsety, false);

    TRAPEND();
}
示例#19
0
//

#include "ClippingNodeTest.h"
#include "../testResource.h"
#include "renderer/CCRenderer.h"

enum {
    kTagTitleLabel = 1,
    kTagSubtitleLabel = 2,
    kTagStencilNode = 100,
    kTagClipperNode = 101,
    kTagContentNode = 102,
};

static std::function<Layer*()> createFunctions[] = {
    CL(ScrollViewDemo),
    CL(HoleDemo),
    CL(ShapeTest),
    CL(ShapeInvertedTest),
    CL(SpriteTest),
    CL(SpriteNoAlphaTest),
    CL(SpriteInvertedTest),
    CL(NestedTest),
    CL(RawStencilBufferTest),
    CL(RawStencilBufferTest2),
    CL(RawStencilBufferTest3),
    CL(RawStencilBufferTest4),
    CL(RawStencilBufferTest5),
    CL(RawStencilBufferTest6)
};
示例#20
0
inline void 
SUMMA_NNDot
( T alpha, const DistMatrix<T>& A,
           const DistMatrix<T>& B,
  T beta,        DistMatrix<T>& C )
{
#ifndef RELEASE
    CallStackEntry entry("gemm::SUMMA_NNDot");
    if( A.Grid() != B.Grid() || B.Grid() != C.Grid() )
        LogicError("{A,B,C} must have the same grid");
    if( A.Height() != C.Height() ||
        B.Width()  != C.Width()  ||
        A.Width()  != B.Height() )
    {
        std::ostringstream msg;
        msg << "Nonconformal matrices: \n"
            << "  A ~ " << A.Height() << " x " << A.Width() << "\n"
            << "  B ~ " << B.Height() << " x " << B.Width() << "\n"
            << "  C ~ " << C.Height() << " x " << C.Width() << "\n";
        LogicError( msg.str() );
    }
#endif
    const Grid& g = A.Grid();

    if( A.Height() > B.Width() )
    {
        // Matrix views
        DistMatrix<T> AT(g), AB(g),
                      A0(g), A1(g), A2(g);         
        DistMatrix<T> BL(g),  B0(g),
                      BR(g),  B1(g),
                              B2(g);
        DistMatrix<T> CT(g), C0(g), C1L(g), C1R(g),
                      CB(g), C1(g), C10(g), C11(g), C12(g),
                             C2(g);

        // Temporary distributions
        DistMatrix<T,STAR,VC> A1_STAR_VC(g);
        DistMatrix<T,VC,STAR> B1_VC_STAR(g);
        DistMatrix<T,STAR,STAR> C11_STAR_STAR(g);

        // Star the algorithm
        Scale( beta, C );
        LockedPartitionDown
        ( A, AT,
             AB, 0 );
        PartitionDown
        ( C, CT,
             CB, 0 );
        while( AB.Height() > 0 )
        {
            LockedRepartitionDown
            ( AT,  A0,
             /**/ /**/
                   A1,
              AB,  A2 );

            RepartitionDown
            ( CT,  C0,
             /**/ /**/
                   C1,
              CB,  C2 );

            A1_STAR_VC = A1; 
            B1_VC_STAR.AlignWith( A1_STAR_VC );

            LockedPartitionRight( B, BL, BR, 0 );
            PartitionRight( C1, C1L, C1R, 0 );
            while( BR.Width() > 0 )
            {
                LockedRepartitionRight
                ( BL, /**/ BR,
                  B0, /**/ B1, B2 );

                RepartitionRight
                ( C1L, /**/ C1R,
                  C10, /**/ C11, C12 );

                //------------------------------------------------------------//
                B1_VC_STAR = B1;
                LocalGemm
                ( NORMAL, NORMAL, 
                  alpha, A1_STAR_VC, B1_VC_STAR, C11_STAR_STAR );
                C11.SumScatterUpdate( T(1), C11_STAR_STAR );
                //------------------------------------------------------------//

                SlideLockedPartitionRight
                ( BL,     /**/ BR,
                  B0, B1, /**/ B2 );

                SlidePartitionRight
                ( C1L,      /**/ C1R,
                  C10, C11, /**/ C12 );
            }

            SlideLockedPartitionDown
            ( AT,  A0,
                   A1,
             /**/ /**/
              AB,  A2 );

            SlidePartitionDown
            ( CT,  C0,
                   C1,
             /**/ /**/
              CB,  C2 );
        }
    }
    else
    {
        // Matrix views
        DistMatrix<T> AT(g), AB(g),
                      A0(g), A1(g), A2(g);         
        DistMatrix<T> BL(g),  B0(g),
                      BR(g),  B1(g),
                              B2(g);
        DistMatrix<T> 
            CL(g), CR(g),         C1T(g),  C01(g),
            C0(g), C1(g), C2(g),  C1B(g),  C11(g),
                                           C21(g);

        // Temporary distributions
        DistMatrix<T,STAR,VR> A1_STAR_VR(g);
        DistMatrix<T,VR,STAR> B1_VR_STAR(g);
        DistMatrix<T,STAR,STAR> C11_STAR_STAR(g);

        // Star the algorithm
        Scale( beta, C );
        LockedPartitionRight( B, BL, BR, 0 );
        PartitionRight( C, CL, CR, 0 );
        while( BR.Width() > 0 )
        {
            LockedRepartitionRight
            ( BL, /**/ BR,
              B0, /**/ B1, B2 );

            RepartitionRight
            ( CL, /**/ CR,
              C0, /**/ C1, C2 );

            B1_VR_STAR = B1;
            A1_STAR_VR.AlignWith( B1_VR_STAR );

            LockedPartitionDown
            ( A, AT,
                 AB, 0 );
            PartitionDown
            ( C1, C1T,
                  C1B, 0 );
            while( AB.Height() > 0 )
            {
                LockedRepartitionDown
                ( AT,  A0,
                 /**/ /**/
                       A1,
                  AB,  A2 );

                RepartitionDown
                ( C1T,  C01,
                 /***/ /***/
                        C11,
                  C1B,  C21 );

                //------------------------------------------------------------//
                A1_STAR_VR = A1;
                LocalGemm
                ( NORMAL, NORMAL, 
                  alpha, A1_STAR_VR, B1_VR_STAR, C11_STAR_STAR );
                C11.SumScatterUpdate( T(1), C11_STAR_STAR );
                //------------------------------------------------------------//

                SlideLockedPartitionDown
                ( AT,  A0,
                       A1,
                 /**/ /**/
                  AB,  A2 );

                SlidePartitionDown
                ( C1T,  C01,
                        C11,
                 /***/ /***/
                  C1B,  C21 );
            }

            SlideLockedPartitionRight
            ( BL,     /**/ BR,
              B0, B1, /**/ B2 ); 

            SlidePartitionRight
            ( CL,     /**/ CR,
              C0, C1, /**/ C2 );
        }
    }
}
示例#21
0
#include <algorithm>
#include "../testResource.h"

enum
{
    IDC_NEXT = 100,
    IDC_BACK,
    IDC_RESTART
};

static int sceneIdx = -1;


static std::function<Layer*()> createFunctions[] =
{
    CL(Sprite3DBasicTest),
    CL(Sprite3DHitTest),
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
    // 3DEffect use custom shader which is not supported on WP8/WinRT yet. 
    CL(Sprite3DEffectTest),
    CL(Sprite3DUVAnimationTest),
#endif
    CL(Sprite3DWithSkinTest),
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WP8) && (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT)
    CL(Sprite3DWithSkinOutlineTest),
#endif
    CL(Animate3DTest),
    CL(AttachmentTest),
    CL(Sprite3DReskinTest),
    CL(Sprite3DWithOBBPerfromanceTest),
    CL(Sprite3DMirrorTest)
#define CC_PROFILER_START_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingBeginTimingBlock(__name__); } while(0)
#undef CC_PROFILER_STOP_CATEGORY
#define CC_PROFILER_STOP_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingEndTimingBlock(__name__); } while(0)
#undef CC_PROFILER_RESET_CATEGORY
#define CC_PROFILER_RESET_CATEGORY(__cat__, __name__) do{ if(__cat__) ProfilingResetTimingBlock(__name__); } while(0)

#undef CC_PROFILER_START_INSTANCE
#define CC_PROFILER_START_INSTANCE(__id__, __name__) do{ ProfilingBeginTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
#undef CC_PROFILER_STOP_INSTANCE
#define CC_PROFILER_STOP_INSTANCE(__id__, __name__) do{ ProfilingEndTimingBlock(    String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)
#undef CC_PROFILER_RESET_INSTANCE
#define CC_PROFILER_RESET_INSTANCE(__id__, __name__) do{ ProfilingResetTimingBlock( String::createWithFormat("%08X - %s", __id__, __name__)->getCString() ); } while(0)

static std::function<PerformanceCallbackScene*()> createFunctions[] =
{
    CL(SimulateNewSchedulerCallbackPerfTest),
    CL(InvokeMemberFunctionPerfTest),
    CL(InvokeStdFunctionPerfTest),
};

#define MAX_LAYER    (sizeof(createFunctions) / sizeof(createFunctions[0]))


static int g_curCase = 0;

////////////////////////////////////////////////////////
//
// CallbackBasicLayer
//
////////////////////////////////////////////////////////
示例#23
0
文件: RU.hpp 项目: mcg1969/Elemental
inline void
SymmRUC
( T alpha, const DistMatrix<T>& A, const DistMatrix<T>& B,
  T beta,        DistMatrix<T>& C,
  bool conjugate=false )
{
#ifndef RELEASE
    PushCallStack("internal::SymmRUC");
    if( A.Grid() != B.Grid() || B.Grid() != C.Grid() )
        throw std::logic_error("{A,B,C} must be distributed on the same grid");
#endif
    const Grid& g = A.Grid();
    const Orientation orientation = ( conjugate ? ADJOINT : TRANSPOSE );

    // Matrix views
    DistMatrix<T> 
        ATL(g), ATR(g),  A00(g), A01(g), A02(g),  AColPan(g),
        ABL(g), ABR(g),  A10(g), A11(g), A12(g),  ARowPan(g),
                         A20(g), A21(g), A22(g);
    DistMatrix<T> BL(g), BR(g),
                  B0(g), B1(g), B2(g);
    DistMatrix<T> CL(g), CR(g),
                  C0(g), C1(g), C2(g),
                  CLeft(g), CRight(g);

    // Temporary distributions
    DistMatrix<T,MC,  STAR> B1_MC_STAR(g);
    DistMatrix<T,VR,  STAR> AColPan_VR_STAR(g);
    DistMatrix<T,STAR,MR  > AColPanTrans_STAR_MR(g);
    DistMatrix<T,MR,  STAR> ARowPanTrans_MR_STAR(g);

    B1_MC_STAR.AlignWith( C );

    // Start the algorithm
    Scale( beta, C );
    LockedPartitionDownDiagonal
    ( A, ATL, ATR,
         ABL, ABR, 0 );
    LockedPartitionRight( B, BL, BR, 0 );
    PartitionRight( C, CL, CR, 0 );
    while( CR.Width() > 0 )
    {
        LockedRepartitionDownDiagonal
        ( ATL, /**/ ATR,  A00, /**/ A01, A02,
         /*************/ /******************/
               /**/       A10, /**/ A11, A12,
          ABL, /**/ ABR,  A20, /**/ A21, A22 );

        LockedRepartitionRight
        ( BL, /**/ BR,
          B0, /**/ B1, B2 );

        RepartitionRight
        ( CL, /**/ CR,
          C0, /**/ C1, C2 );

        LockedView1x2( ARowPan, A11, A12 );
        LockedView2x1
        ( AColPan, A01,
                   A11 );

        View1x2( CLeft, C0, C1 );
        View1x2( CRight, C1, C2 );

        AColPan_VR_STAR.AlignWith( CLeft );
        AColPanTrans_STAR_MR.AlignWith( CLeft );
        ARowPanTrans_MR_STAR.AlignWith( CRight );
        //--------------------------------------------------------------------//
        B1_MC_STAR = B1;

        AColPan_VR_STAR = AColPan;
        AColPanTrans_STAR_MR.TransposeFrom( AColPan_VR_STAR, conjugate );
        ARowPanTrans_MR_STAR.TransposeFrom( ARowPan, conjugate );
        MakeTriangular( LOWER, ARowPanTrans_MR_STAR );
        MakeTrapezoidal( RIGHT, LOWER, -1, AColPanTrans_STAR_MR );

        LocalGemm
        ( NORMAL, orientation, 
          alpha, B1_MC_STAR, ARowPanTrans_MR_STAR, T(1), CRight );

        LocalGemm
        ( NORMAL, NORMAL,
          alpha, B1_MC_STAR, AColPanTrans_STAR_MR, T(1), CLeft );
        //--------------------------------------------------------------------//
        AColPan_VR_STAR.FreeAlignments();
        AColPanTrans_STAR_MR.FreeAlignments();
        ARowPanTrans_MR_STAR.FreeAlignments();

        SlideLockedPartitionDownDiagonal
        ( ATL, /**/ ATR,  A00, A01, /**/ A02,
               /**/       A10, A11, /**/ A12,
         /*************/ /******************/
          ABL, /**/ ABR,  A20, A21, /**/ A22 );

        SlideLockedPartitionRight
        ( BL,     /**/ BR,
          B0, B1, /**/ B2 );

        SlidePartitionRight
        ( CL,     /**/ CR,
          C0, C1, /**/ C2 );
    }
#ifndef RELEASE
    PopCallStack();
#endif
}