Example #1
0
static const char *
chunk_name(int type)
{
#define CASE(x) case x: s = #x; break
    const char *s = "unknown";
    switch (type)
    {
        CASE(DATA);
        CASE(INIT);
        CASE(INIT_ACK);
        CASE(SACK);
        CASE(HEARTBEAT);
        CASE(HEARTBEAT_ACK);
        CASE(ABORT);
        CASE(SHUTDOWN);
        CASE(SHUTDOWN_ACK);
        CASE(SCTP_ERROR);
        CASE(COOKIE_ECHO);
        CASE(COOKIE_ACK);
        CASE(ECNE);
        CASE(CWR);
        CASE(SHUT_COMPLETE);
        CASE(AUTH);
        CASE(NR_SACK);
        CASE(ASCONF_ACK);
        CASE(PKTDROP);
        CASE(FORWARD_TSN);
        CASE(ASCONF);
    }
    return s;
}
Example #2
0
static const char *
hook_to_str(int hook)
{
	switch (hook) {
	CASE(HOOK_CONNECT);
	CASE(HOOK_HELO);
	CASE(HOOK_MAIL);
	CASE(HOOK_RCPT);
	CASE(HOOK_DATA);
	CASE(HOOK_EOM);
	CASE(HOOK_RESET);
	CASE(HOOK_DISCONNECT);
	CASE(HOOK_COMMIT);
	CASE(HOOK_ROLLBACK);
	CASE(HOOK_DATALINE);
	default:
		return ("HOOK_???");
	}
}
Example #3
0
static const char *
traceCgsEnum(CgsEnum value)
{
    const char *result = "?";
    switch (value) {
	CASE(Norm);
	CASE(Bold);
	CASE(NormReverse);
	CASE(BoldReverse);
#if OPT_BOX_CHARS
	CASE(Line);
	CASE(Dots);
#endif
#if OPT_DEC_CHRSET
	CASE(CNorm);
	CASE(CBold);
#endif
#if OPT_WIDE_CHARS
	CASE(Wide);
	CASE(WBold);
	CASE(WideReverse);
	CASE(WBoldReverse);
#endif
	CASE(VTcursNormal);
	CASE(VTcursFilled);
	CASE(VTcursReverse);
	CASE(VTcursOutline);
#if OPT_TEK4014
	CASE(TKcurs);
#endif
	CASE(MAX);
    }
    return result;
}
Example #4
0
void BuildErrorMessage( char* buffer, int size ) {
	char minibuffer[256];

	switch ( m_seCode ) {
	case EXCEPTION_ACCESS_VIOLATION:
		Com_sprintf(    minibuffer, sizeof( minibuffer ),
						"Exception ACCESS_VIOLATION (0x%.8x) at address 0x%.8x trying to %s address 0x%.8x.", EXCEPTION_ACCESS_VIOLATION,
						m_exPointers->ExceptionRecord->ExceptionAddress,
						m_exPointers->ExceptionRecord->ExceptionInformation[0] ? "write" : "read",
						m_exPointers->ExceptionRecord->ExceptionInformation[1] );
		break;
		CASE( DATATYPE_MISALIGNMENT );
		CASE( BREAKPOINT );
		CASE( SINGLE_STEP );
		CASE( ARRAY_BOUNDS_EXCEEDED );
		CASE( FLT_DENORMAL_OPERAND );
		CASE( FLT_DIVIDE_BY_ZERO );
		CASE( FLT_INEXACT_RESULT );
		CASE( FLT_INVALID_OPERATION );
		CASE( FLT_OVERFLOW );
		CASE( FLT_STACK_CHECK );
		CASE( FLT_UNDERFLOW );
		CASE( INT_DIVIDE_BY_ZERO );
		CASE( INT_OVERFLOW );
		CASE( PRIV_INSTRUCTION );
		CASE( IN_PAGE_ERROR );
		CASE( ILLEGAL_INSTRUCTION );
		CASE( NONCONTINUABLE_EXCEPTION );
		CASE( STACK_OVERFLOW );
		CASE( INVALID_DISPOSITION );
		CASE( GUARD_PAGE );
		CASE( INVALID_HANDLE );
	default:
		Com_sprintf( minibuffer, sizeof( minibuffer ), "Unknown exception." );
		break;
	}

	Q_strcat( buffer, size, minibuffer );
}
Example #5
0
NCerror
dapconvert(nc_type srctype, nc_type dsttype, char* memory0, char* value0, size_t count)
{
    NCerror ncstat = NC_NOERR;
    size_t i;
    char* memory = memory0;
    char* value = value0;

    /* In order to deal with the DAP upgrade problem,
	try to preserve the bit patterns
    */

    /* Provide space and pointer casts for intermediate results */
    signed char ncbyte;
    signed char* ncbytep;
    char ncchar;
    char* nccharp;
    short ncshort;
    short* ncshortp;
    int ncint;
    int* ncintp;
    float ncfloat;
    float* ncfloatp;
    double ncdouble;
    double* ncdoublep;
    unsigned char ncubyte;
    unsigned char* ncubytep;
    unsigned short ncushort;
    unsigned short* ncushortp;
    unsigned int ncuint;
    unsigned int* ncuintp;
    long long ncint64;
    long long* ncint64p;
    unsigned long long ncuint64;
    unsigned long long* ncuint64p;


#define CASE(nc1,nc2) (nc1*256+nc2)
#define CUT8(e) ((unsigned char)((e) & 0xff))
#define CUT16(e) ((unsigned short)((e) & 0xffff))
#define CUT32(e) ((unsigned int)((e) & 0xffffffff))
#define ARM(vs,ncs,ts,vd,ncd,td) \
case CASE(ncs,ncd):\
    vs##p = (ts *)value;\
    vs = *vs##p;\
    vd##p = (td *)memory;\
    *vd##p = (td)vs;\
    break;

    for(i=0;i<count;i++) {

        switch (CASE(srctype,dsttype)) {
ARM(ncchar,NC_CHAR,char,ncchar,NC_CHAR,char)
ARM(ncchar,NC_CHAR,char,ncbyte,NC_BYTE,signed char)
ARM(ncchar,NC_CHAR,char,ncubyte,NC_UBYTE,unsigned char)
ARM(ncchar,NC_CHAR,char,ncshort,NC_SHORT,short)
ARM(ncchar,NC_CHAR,char,ncushort,NC_USHORT,unsigned short)
ARM(ncchar,NC_CHAR,char,ncint,NC_INT,int)
ARM(ncchar,NC_CHAR,char,ncuint,NC_UINT,unsigned int)
ARM(ncchar,NC_CHAR,char,ncint64,NC_INT64,long long)
ARM(ncchar,NC_CHAR,char,ncuint64,NC_UINT64,unsigned long long)
ARM(ncchar,NC_CHAR,char,ncfloat,NC_FLOAT,float)
ARM(ncchar,NC_CHAR,char,ncdouble,NC_DOUBLE,double)
ARM(ncbyte,NC_BYTE,signed char,ncchar,NC_CHAR,char)
ARM(ncbyte,NC_BYTE,signed char,ncbyte,NC_BYTE,signed char)
ARM(ncbyte,NC_BYTE,signed char,ncubyte,NC_UBYTE,unsigned char)
ARM(ncbyte,NC_BYTE,signed char,ncshort,NC_SHORT,short)
ARM(ncbyte,NC_BYTE,signed char,ncushort,NC_USHORT,unsigned short)
ARM(ncbyte,NC_BYTE,signed char,ncint,NC_INT,int)
ARM(ncbyte,NC_BYTE,signed char,ncuint,NC_UINT,unsigned int)
ARM(ncbyte,NC_BYTE,signed char,ncint64,NC_INT64,long long)
ARM(ncbyte,NC_BYTE,signed char,ncuint64,NC_UINT64,unsigned long long)
ARM(ncbyte,NC_BYTE,signed char,ncfloat,NC_FLOAT,float)
ARM(ncbyte,NC_BYTE,signed char,ncdouble,NC_DOUBLE,double)
ARM(ncubyte,NC_UBYTE,unsigned char,ncchar,NC_CHAR,char)
ARM(ncubyte,NC_UBYTE,unsigned char,ncbyte,NC_BYTE,signed char)
ARM(ncubyte,NC_UBYTE,unsigned char,ncubyte,NC_UBYTE,unsigned char)
ARM(ncubyte,NC_UBYTE,unsigned char,ncshort,NC_SHORT,short)
ARM(ncubyte,NC_UBYTE,unsigned char,ncushort,NC_USHORT,unsigned short)
ARM(ncubyte,NC_UBYTE,unsigned char,ncint,NC_INT,int)
ARM(ncubyte,NC_UBYTE,unsigned char,ncuint,NC_UINT,unsigned int)
ARM(ncubyte,NC_UBYTE,unsigned char,ncint64,NC_INT64,long long)
ARM(ncubyte,NC_UBYTE,unsigned char,ncuint64,NC_UINT64,unsigned long long)
ARM(ncubyte,NC_UBYTE,unsigned char,ncfloat,NC_FLOAT,float)
ARM(ncubyte,NC_UBYTE,unsigned char,ncdouble,NC_DOUBLE,double)
ARM(ncshort,NC_SHORT,short,ncchar,NC_CHAR,char)
ARM(ncshort,NC_SHORT,short,ncbyte,NC_BYTE,signed char)
ARM(ncshort,NC_SHORT,short,ncubyte,NC_UBYTE,unsigned char)
ARM(ncshort,NC_SHORT,short,ncshort,NC_SHORT,short)
ARM(ncshort,NC_SHORT,short,ncushort,NC_USHORT,unsigned short)
ARM(ncshort,NC_SHORT,short,ncint,NC_INT,int)
ARM(ncshort,NC_SHORT,short,ncuint,NC_UINT,unsigned int)
ARM(ncshort,NC_SHORT,short,ncint64,NC_INT64,long long)
ARM(ncshort,NC_SHORT,short,ncuint64,NC_UINT64,unsigned long long)
ARM(ncshort,NC_SHORT,short,ncfloat,NC_FLOAT,float)
ARM(ncshort,NC_SHORT,short,ncdouble,NC_DOUBLE,double)
ARM(ncushort,NC_USHORT,unsigned short,ncchar,NC_CHAR,char)
ARM(ncushort,NC_USHORT,unsigned short,ncbyte,NC_BYTE,signed char)
ARM(ncushort,NC_USHORT,unsigned short,ncubyte,NC_UBYTE,unsigned char)
ARM(ncushort,NC_USHORT,unsigned short,ncshort,NC_SHORT,short)
ARM(ncushort,NC_USHORT,unsigned short,ncushort,NC_USHORT,unsigned short)
ARM(ncushort,NC_USHORT,unsigned short,ncint,NC_INT,int)
ARM(ncushort,NC_USHORT,unsigned short,ncuint,NC_UINT,unsigned int)
ARM(ncushort,NC_USHORT,unsigned short,ncint64,NC_INT64,long long)
ARM(ncushort,NC_USHORT,unsigned short,ncuint64,NC_UINT64,unsigned long long)
ARM(ncushort,NC_USHORT,unsigned short,ncfloat,NC_FLOAT,float)
ARM(ncushort,NC_USHORT,unsigned short,ncdouble,NC_DOUBLE,double)
ARM(ncint,NC_INT,int,ncchar,NC_CHAR,char)
ARM(ncint,NC_INT,int,ncbyte,NC_BYTE,signed char)
ARM(ncint,NC_INT,int,ncubyte,NC_UBYTE,unsigned char)
ARM(ncint,NC_INT,int,ncshort,NC_SHORT,short)
ARM(ncint,NC_INT,int,ncushort,NC_USHORT,unsigned short)
ARM(ncint,NC_INT,int,ncint,NC_INT,int)
ARM(ncint,NC_INT,int,ncuint,NC_UINT,unsigned int)
ARM(ncint,NC_INT,int,ncint64,NC_INT64,long long)
ARM(ncint,NC_INT,int,ncuint64,NC_UINT64,unsigned long long)
ARM(ncint,NC_INT,int,ncfloat,NC_FLOAT,float)
ARM(ncint,NC_INT,int,ncdouble,NC_DOUBLE,double)
ARM(ncuint,NC_UINT,unsigned int,ncchar,NC_CHAR,char)
ARM(ncuint,NC_UINT,unsigned int,ncbyte,NC_BYTE,signed char)
ARM(ncuint,NC_UINT,unsigned int,ncubyte,NC_UBYTE,unsigned char)
ARM(ncuint,NC_UINT,unsigned int,ncshort,NC_SHORT,short)
ARM(ncuint,NC_UINT,unsigned int,ncushort,NC_USHORT,unsigned short)
ARM(ncuint,NC_UINT,unsigned int,ncint,NC_INT,int)
ARM(ncuint,NC_UINT,unsigned int,ncuint,NC_UINT,unsigned int)
ARM(ncuint,NC_UINT,unsigned int,ncint64,NC_INT64,long long)
ARM(ncuint,NC_UINT,unsigned int,ncuint64,NC_UINT64,unsigned long long)
ARM(ncuint,NC_UINT,unsigned int,ncfloat,NC_FLOAT,float)
ARM(ncuint,NC_UINT,unsigned int,ncdouble,NC_DOUBLE,double)
ARM(ncint64,NC_INT64,long long,ncchar,NC_CHAR,char)
ARM(ncint64,NC_INT64,long long,ncbyte,NC_BYTE,signed char)
ARM(ncint64,NC_INT64,long long,ncubyte,NC_UBYTE,unsigned char)
ARM(ncint64,NC_INT64,long long,ncshort,NC_SHORT,short)
ARM(ncint64,NC_INT64,long long,ncushort,NC_USHORT,unsigned short)
ARM(ncint64,NC_INT64,long long,ncint,NC_INT,int)
ARM(ncint64,NC_INT64,long long,ncuint,NC_UINT,unsigned int)
ARM(ncint64,NC_INT64,long long,ncint64,NC_INT64,long long)
ARM(ncint64,NC_INT64,long long,ncuint64,NC_UINT64,unsigned long long)
ARM(ncint64,NC_INT64,long long,ncfloat,NC_FLOAT,float)
ARM(ncint64,NC_INT64,long long,ncdouble,NC_DOUBLE,double)
ARM(ncuint64,NC_UINT64,unsigned long long,ncchar,NC_CHAR,char)
ARM(ncuint64,NC_UINT64,unsigned long long,ncbyte,NC_BYTE,signed char)
ARM(ncuint64,NC_UINT64,unsigned long long,ncubyte,NC_UBYTE,unsigned char)
ARM(ncuint64,NC_UINT64,unsigned long long,ncshort,NC_SHORT,short)
ARM(ncuint64,NC_UINT64,unsigned long long,ncushort,NC_USHORT,unsigned short)
ARM(ncuint64,NC_UINT64,unsigned long long,ncint,NC_INT,int)
ARM(ncuint64,NC_UINT64,unsigned long long,ncuint,NC_UINT,unsigned int)
ARM(ncuint64,NC_UINT64,unsigned long long,ncint64,NC_INT64,long long)
ARM(ncuint64,NC_UINT64,unsigned long long,ncuint64,NC_UINT64,unsigned long long)
ARM(ncuint64,NC_UINT64,unsigned long long,ncfloat,NC_FLOAT,float)
ARM(ncuint64,NC_UINT64,unsigned long long,ncdouble,NC_DOUBLE,double)
ARM(ncfloat,NC_FLOAT,float,ncchar,NC_CHAR,char)
ARM(ncfloat,NC_FLOAT,float,ncbyte,NC_BYTE,signed char)
ARM(ncfloat,NC_FLOAT,float,ncubyte,NC_UBYTE,unsigned char)
ARM(ncfloat,NC_FLOAT,float,ncshort,NC_SHORT,short)
ARM(ncfloat,NC_FLOAT,float,ncushort,NC_USHORT,unsigned short)
ARM(ncfloat,NC_FLOAT,float,ncint,NC_INT,int)
ARM(ncfloat,NC_FLOAT,float,ncuint,NC_UINT,unsigned int)
ARM(ncfloat,NC_FLOAT,float,ncint64,NC_INT64,long long)
ARM(ncfloat,NC_FLOAT,float,ncuint64,NC_UINT64,unsigned long long)
ARM(ncfloat,NC_FLOAT,float,ncfloat,NC_FLOAT,float)
ARM(ncfloat,NC_FLOAT,float,ncdouble,NC_DOUBLE,double)
ARM(ncdouble,NC_DOUBLE,double,ncchar,NC_CHAR,char)
ARM(ncdouble,NC_DOUBLE,double,ncbyte,NC_BYTE,signed char)
ARM(ncdouble,NC_DOUBLE,double,ncubyte,NC_UBYTE,unsigned char)
ARM(ncdouble,NC_DOUBLE,double,ncshort,NC_SHORT,short)
ARM(ncdouble,NC_DOUBLE,double,ncushort,NC_USHORT,unsigned short)
ARM(ncdouble,NC_DOUBLE,double,ncint,NC_INT,int)
ARM(ncdouble,NC_DOUBLE,double,ncuint,NC_UINT,unsigned int)
ARM(ncdouble,NC_DOUBLE,double,ncint64,NC_INT64,long long)
ARM(ncdouble,NC_DOUBLE,double,ncuint64,NC_UINT64,unsigned long long)
ARM(ncdouble,NC_DOUBLE,double,ncfloat,NC_FLOAT,float)
ARM(ncdouble,NC_DOUBLE,double,ncdouble,NC_DOUBLE,double)
	
        default: ncstat = NC_EINVAL; THROWCHK(ncstat); goto fail;
        }
        value += nctypesizeof(srctype);
        memory += nctypesizeof(dsttype);
    }

fail:
    return THROW(ncstat);
}
const char *getDxgiFormatString(DXGI_FORMAT dxgiFormat) {
	
#define CASE(format) case DXGI_FORMAT_ ## format: return # format
	switch (dxgiFormat) {
			CASE(UNKNOWN);
			
			CASE(R32G32B32A32_TYPELESS);
			CASE(R32G32B32A32_FLOAT);
			CASE(R32G32B32A32_UINT);
			CASE(R32G32B32A32_SINT);
			
			CASE(R32G32B32_TYPELESS);
			CASE(R32G32B32_FLOAT);
			CASE(R32G32B32_UINT);
			CASE(R32G32B32_SINT);
			
			CASE(R16G16B16A16_TYPELESS);
			CASE(R16G16B16A16_FLOAT);
			CASE(R16G16B16A16_UNORM);
			CASE(R16G16B16A16_UINT);
			CASE(R16G16B16A16_SNORM);
			CASE(R16G16B16A16_SINT);
			
			CASE(R32G32_TYPELESS);
			CASE(R32G32_FLOAT);
			CASE(R32G32_UINT);
			CASE(R32G32_SINT);
			
			CASE(R32G8X24_TYPELESS);
			CASE(D32_FLOAT_S8X24_UINT);
			CASE(R32_FLOAT_X8X24_TYPELESS);
			CASE(X32_TYPELESS_G8X24_UINT);
			
			CASE(R10G10B10A2_TYPELESS);
			CASE(R10G10B10A2_UNORM);
			CASE(R10G10B10A2_UINT);
			
			CASE(R11G11B10_FLOAT);
			
			CASE(R8G8B8A8_TYPELESS);
			CASE(R8G8B8A8_UNORM);
			CASE(R8G8B8A8_UNORM_SRGB);
			CASE(R8G8B8A8_UINT);
			CASE(R8G8B8A8_SNORM);
			CASE(R8G8B8A8_SINT);
			
			CASE(R16G16_TYPELESS);
			CASE(R16G16_FLOAT);
			CASE(R16G16_UNORM);
			CASE(R16G16_UINT);
			CASE(R16G16_SNORM);
			CASE(R16G16_SINT);
			
			CASE(R32_TYPELESS);
			CASE(D32_FLOAT);
			CASE(R32_FLOAT);
			CASE(R32_UINT);
			CASE(R32_SINT);
			
			CASE(R24G8_TYPELESS);
			CASE(D24_UNORM_S8_UINT);
			CASE(R24_UNORM_X8_TYPELESS);
			CASE(X24_TYPELESS_G8_UINT);
			
			CASE(R8G8_TYPELESS);
			CASE(R8G8_UNORM);
			CASE(R8G8_UINT);
			CASE(R8G8_SNORM);
			CASE(R8G8_SINT);
			
			CASE(R16_TYPELESS);
			CASE(R16_FLOAT);
			CASE(D16_UNORM);
			CASE(R16_UNORM);
			CASE(R16_UINT);
			CASE(R16_SNORM);
			CASE(R16_SINT);
			
			CASE(R8_TYPELESS);
			CASE(R8_UNORM);
			CASE(R8_UINT);
			CASE(R8_SNORM);
			CASE(R8_SINT);
			CASE(A8_UNORM);
			
			CASE(R1_UNORM);
			
			CASE(R9G9B9E5_SHAREDEXP);
			
			CASE(R8G8_B8G8_UNORM);
			CASE(G8R8_G8B8_UNORM);
			
			CASE(BC1_TYPELESS);
			CASE(BC1_UNORM);
			CASE(BC1_UNORM_SRGB);
			
			CASE(BC2_TYPELESS);
			CASE(BC2_UNORM);
			CASE(BC2_UNORM_SRGB);
			
			CASE(BC3_TYPELESS);
			CASE(BC3_UNORM);
			CASE(BC3_UNORM_SRGB);
			
			CASE(BC4_TYPELESS);
			CASE(BC4_UNORM);
			CASE(BC4_SNORM);
			
			CASE(BC5_TYPELESS);
			CASE(BC5_UNORM);
			CASE(BC5_SNORM);
			
			CASE(B5G6R5_UNORM);
			CASE(B5G5R5A1_UNORM);
			CASE(B8G8R8A8_UNORM);
			CASE(B8G8R8X8_UNORM);
			
		default:
			return "UNKNOWN";
	}
#undef CASE
}
void 
TimeZoneRegressionTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
    // if (exec) logln((UnicodeString)"TestSuite NumberFormatRegressionTest");
    switch (index) {

        CASE(0, Test4052967);
        CASE(1, Test4073209);
        CASE(2, Test4073215);
        CASE(3, Test4084933);
        CASE(4, Test4096952);
        CASE(5, Test4109314);
        CASE(6, Test4126678);
        CASE(7, Test4151406);
        CASE(8, Test4151429);
        CASE(9, Test4154537);
        CASE(10, Test4154542);
        CASE(11, Test4154650);
        CASE(12, Test4154525);
        CASE(13, Test4162593);
        CASE(14, TestJ186);
        CASE(15, TestJ449);
        CASE(16, TestJDK12API);
        CASE(17, Test4176686);
        CASE(18, Test4184229);
        default: name = ""; break;
    }
}
Example #8
0
gchar *
_gdk_win32_rop2_to_string (int rop2)
{
  switch (rop2)
    {
#define CASE(x) case R2_##x: return #x
      CASE (BLACK);
      CASE (COPYPEN);
      CASE (MASKNOTPEN);
      CASE (MASKPEN);
      CASE (MASKPENNOT);
      CASE (MERGENOTPEN);
      CASE (MERGEPEN);
      CASE (MERGEPENNOT);
      CASE (NOP);
      CASE (NOT);
      CASE (NOTCOPYPEN);
      CASE (NOTMASKPEN);
      CASE (NOTMERGEPEN);
      CASE (NOTXORPEN);
      CASE (WHITE);
      CASE (XORPEN);
#undef CASE
    default: return static_printf ("illegal_%x", rop2);
    }
  /* NOTREACHED */
  return NULL;
}
Example #9
0
gchar *
_gdk_win32_message_to_string (UINT msg)
{
  switch (msg)
    {
#define CASE(x) case x: return #x
      CASE (WM_NULL);
      CASE (WM_CREATE);
      CASE (WM_DESTROY);
      CASE (WM_MOVE);
      CASE (WM_SIZE);
      CASE (WM_ACTIVATE);
      CASE (WM_SETFOCUS);
      CASE (WM_KILLFOCUS);
      CASE (WM_ENABLE);
      CASE (WM_SETREDRAW);
      CASE (WM_SETTEXT);
      CASE (WM_GETTEXT);
      CASE (WM_GETTEXTLENGTH);
      CASE (WM_PAINT);
      CASE (WM_CLOSE);
      CASE (WM_QUERYENDSESSION);
      CASE (WM_QUERYOPEN);
      CASE (WM_ENDSESSION);
      CASE (WM_QUIT);
      CASE (WM_ERASEBKGND);
      CASE (WM_SYSCOLORCHANGE);
      CASE (WM_SHOWWINDOW);
      CASE (WM_WININICHANGE);
      CASE (WM_DEVMODECHANGE);
      CASE (WM_ACTIVATEAPP);
      CASE (WM_FONTCHANGE);
      CASE (WM_TIMECHANGE);
      CASE (WM_CANCELMODE);
      CASE (WM_SETCURSOR);
      CASE (WM_MOUSEACTIVATE);
      CASE (WM_CHILDACTIVATE);
      CASE (WM_QUEUESYNC);
      CASE (WM_GETMINMAXINFO);
      CASE (WM_PAINTICON);
      CASE (WM_ICONERASEBKGND);
      CASE (WM_NEXTDLGCTL);
      CASE (WM_SPOOLERSTATUS);
      CASE (WM_DRAWITEM);
      CASE (WM_MEASUREITEM);
      CASE (WM_DELETEITEM);
      CASE (WM_VKEYTOITEM);
      CASE (WM_CHARTOITEM);
      CASE (WM_SETFONT);
      CASE (WM_GETFONT);
      CASE (WM_SETHOTKEY);
      CASE (WM_GETHOTKEY);
      CASE (WM_QUERYDRAGICON);
      CASE (WM_COMPAREITEM);
      CASE (WM_GETOBJECT);
      CASE (WM_COMPACTING);
      CASE (WM_WINDOWPOSCHANGING);
      CASE (WM_WINDOWPOSCHANGED);
      CASE (WM_POWER);
      CASE (WM_COPYDATA);
      CASE (WM_CANCELJOURNAL);
      CASE (WM_NOTIFY);
      CASE (WM_INPUTLANGCHANGEREQUEST);
      CASE (WM_INPUTLANGCHANGE);
      CASE (WM_TCARD);
      CASE (WM_HELP);
      CASE (WM_USERCHANGED);
      CASE (WM_NOTIFYFORMAT);
      CASE (WM_CONTEXTMENU);
      CASE (WM_STYLECHANGING);
      CASE (WM_STYLECHANGED);
      CASE (WM_DISPLAYCHANGE);
      CASE (WM_GETICON);
      CASE (WM_SETICON);
      CASE (WM_NCCREATE);
      CASE (WM_NCDESTROY);
      CASE (WM_NCCALCSIZE);
      CASE (WM_NCHITTEST);
      CASE (WM_NCPAINT);
      CASE (WM_NCACTIVATE);
      CASE (WM_GETDLGCODE);
      CASE (WM_SYNCPAINT);
      CASE (WM_NCMOUSEMOVE);
      CASE (WM_NCLBUTTONDOWN);
      CASE (WM_NCLBUTTONUP);
      CASE (WM_NCLBUTTONDBLCLK);
      CASE (WM_NCRBUTTONDOWN);
      CASE (WM_NCRBUTTONUP);
      CASE (WM_NCRBUTTONDBLCLK);
      CASE (WM_NCMBUTTONDOWN);
      CASE (WM_NCMBUTTONUP);
      CASE (WM_NCMBUTTONDBLCLK);
      CASE (WM_NCXBUTTONDOWN);
      CASE (WM_NCXBUTTONUP);
      CASE (WM_NCXBUTTONDBLCLK);
      CASE (WM_KEYDOWN);
      CASE (WM_KEYUP);
      CASE (WM_CHAR);
      CASE (WM_DEADCHAR);
      CASE (WM_SYSKEYDOWN);
      CASE (WM_SYSKEYUP);
      CASE (WM_SYSCHAR);
      CASE (WM_SYSDEADCHAR);
      CASE (WM_KEYLAST);
      CASE (WM_IME_STARTCOMPOSITION);
      CASE (WM_IME_ENDCOMPOSITION);
      CASE (WM_IME_COMPOSITION);
      CASE (WM_INITDIALOG);
      CASE (WM_COMMAND);
      CASE (WM_SYSCOMMAND);
      CASE (WM_TIMER);
      CASE (WM_HSCROLL);
      CASE (WM_VSCROLL);
      CASE (WM_INITMENU);
      CASE (WM_INITMENUPOPUP);
      CASE (WM_MENUSELECT);
      CASE (WM_MENUCHAR);
      CASE (WM_ENTERIDLE);
      CASE (WM_MENURBUTTONUP);
      CASE (WM_MENUDRAG);
      CASE (WM_MENUGETOBJECT);
      CASE (WM_UNINITMENUPOPUP);
      CASE (WM_MENUCOMMAND);
      CASE (WM_CHANGEUISTATE);
      CASE (WM_UPDATEUISTATE);
      CASE (WM_QUERYUISTATE);
      CASE (WM_CTLCOLORMSGBOX);
      CASE (WM_CTLCOLOREDIT);
      CASE (WM_CTLCOLORLISTBOX);
      CASE (WM_CTLCOLORBTN);
      CASE (WM_CTLCOLORDLG);
      CASE (WM_CTLCOLORSCROLLBAR);
      CASE (WM_CTLCOLORSTATIC);
      CASE (WM_MOUSEMOVE);
      CASE (WM_LBUTTONDOWN);
      CASE (WM_LBUTTONUP);
      CASE (WM_LBUTTONDBLCLK);
      CASE (WM_RBUTTONDOWN);
      CASE (WM_RBUTTONUP);
      CASE (WM_RBUTTONDBLCLK);
      CASE (WM_MBUTTONDOWN);
      CASE (WM_MBUTTONUP);
      CASE (WM_MBUTTONDBLCLK);
      CASE (WM_MOUSEWHEEL);
      CASE (WM_XBUTTONDOWN);
      CASE (WM_XBUTTONUP);
      CASE (WM_XBUTTONDBLCLK);
      CASE (WM_PARENTNOTIFY);
      CASE (WM_ENTERMENULOOP);
      CASE (WM_EXITMENULOOP);
      CASE (WM_NEXTMENU);
      CASE (WM_SIZING);
      CASE (WM_CAPTURECHANGED);
      CASE (WM_MOVING);
      CASE (WM_POWERBROADCAST);
      CASE (WM_DEVICECHANGE);
      CASE (WM_MDICREATE);
      CASE (WM_MDIDESTROY);
      CASE (WM_MDIACTIVATE);
      CASE (WM_MDIRESTORE);
      CASE (WM_MDINEXT);
      CASE (WM_MDIMAXIMIZE);
      CASE (WM_MDITILE);
      CASE (WM_MDICASCADE);
      CASE (WM_MDIICONARRANGE);
      CASE (WM_MDIGETACTIVE);
      CASE (WM_MDISETMENU);
      CASE (WM_ENTERSIZEMOVE);
      CASE (WM_EXITSIZEMOVE);
      CASE (WM_DROPFILES);
      CASE (WM_MDIREFRESHMENU);
      CASE (WM_IME_SETCONTEXT);
      CASE (WM_IME_NOTIFY);
      CASE (WM_IME_CONTROL);
      CASE (WM_IME_COMPOSITIONFULL);
      CASE (WM_IME_SELECT);
      CASE (WM_IME_CHAR);
      CASE (WM_IME_REQUEST);
      CASE (WM_IME_KEYDOWN);
      CASE (WM_IME_KEYUP);
      CASE (WM_MOUSEHOVER);
      CASE (WM_MOUSELEAVE);
      CASE (WM_NCMOUSEHOVER);
      CASE (WM_NCMOUSELEAVE);
      CASE (WM_CUT);
      CASE (WM_COPY);
      CASE (WM_PASTE);
      CASE (WM_CLEAR);
      CASE (WM_UNDO);
      CASE (WM_RENDERFORMAT);
      CASE (WM_RENDERALLFORMATS);
      CASE (WM_DESTROYCLIPBOARD);
      CASE (WM_DRAWCLIPBOARD);
      CASE (WM_PAINTCLIPBOARD);
      CASE (WM_VSCROLLCLIPBOARD);
      CASE (WM_SIZECLIPBOARD);
      CASE (WM_ASKCBFORMATNAME);
      CASE (WM_CHANGECBCHAIN);
      CASE (WM_HSCROLLCLIPBOARD);
      CASE (WM_QUERYNEWPALETTE);
      CASE (WM_PALETTEISCHANGING);
      CASE (WM_PALETTECHANGED);
      CASE (WM_HOTKEY);
      CASE (WM_PRINT);
      CASE (WM_PRINTCLIENT);
      CASE (WM_APPCOMMAND);
      CASE (WM_HANDHELDFIRST);
      CASE (WM_HANDHELDLAST);
      CASE (WM_AFXFIRST);
      CASE (WM_AFXLAST);
      CASE (WM_PENWINFIRST);
      CASE (WM_PENWINLAST);
      CASE (WM_APP);
      CASE (WT_PACKET);
      CASE (WT_CSRCHANGE);
      CASE (WT_PROXIMITY);
#undef CASE
    default:
      if (msg >= WM_HANDHELDFIRST && msg <= WM_HANDHELDLAST)
	return static_printf ("WM_HANDHELDFIRST+%d", msg - WM_HANDHELDFIRST);
      else if (msg >= WM_AFXFIRST && msg <= WM_AFXLAST)
	return static_printf ("WM_AFXFIRST+%d", msg - WM_AFXFIRST);
      else if (msg >= WM_PENWINFIRST && msg <= WM_PENWINLAST)
	return static_printf ("WM_PENWINFIRST+%d", msg - WM_PENWINFIRST);
      else if (msg >= WM_USER && msg <= 0x7FFF)
	return static_printf ("WM_USER+%d", msg - WM_USER);
      else if (msg >= 0xC000 && msg <= 0xFFFF)
	return static_printf ("reg-%#x", msg);
      else
	return static_printf ("unk-%#x", msg);
    }
  /* NOTREACHED */
  return NULL;
}
Example #10
0
gchar *
_gdk_win32_cf_to_string (UINT format)
{
  char buf[100];

  switch (format)
    {
#define CASE(x) case CF_##x: return "CF_" #x
      CASE (BITMAP);
      CASE (DIB);
      CASE (DIBV5);
      CASE (DIF);
      CASE (DSPBITMAP);
      CASE (DSPENHMETAFILE);
      CASE (DSPMETAFILEPICT);
      CASE (DSPTEXT);
      CASE (ENHMETAFILE);
      CASE (HDROP);
      CASE (LOCALE);
      CASE (METAFILEPICT);
      CASE (OEMTEXT);
      CASE (OWNERDISPLAY);
      CASE (PALETTE);
      CASE (PENDATA);
      CASE (RIFF);
      CASE (SYLK);
      CASE (TEXT);
      CASE (WAVE);
      CASE (TIFF);
      CASE (UNICODETEXT);
    default:
      if (format >= CF_GDIOBJFIRST &&
	  format <= CF_GDIOBJLAST)
	return static_printf ("CF_GDIOBJ%d", format - CF_GDIOBJFIRST);
      if (format >= CF_PRIVATEFIRST &&
	  format <= CF_PRIVATELAST)
	return static_printf ("CF_PRIVATE%d", format - CF_PRIVATEFIRST);
      if (GetClipboardFormatName (format, buf, sizeof (buf)))
	return static_printf ("'%s'", buf);
      else
	return static_printf ("unk-%#lx", format);
    }
}
Example #11
0
gchar *
_gdk_win32_function_to_string (GdkFunction function)
{
  switch (function)
    {
#define CASE(x) case GDK_##x: return #x
    CASE (COPY);
    CASE (INVERT);
    CASE (XOR);
    CASE (CLEAR);
    CASE (AND);
    CASE (AND_REVERSE);
    CASE (AND_INVERT);
    CASE (NOOP);
    CASE (OR);
    CASE (EQUIV);
    CASE (OR_REVERSE);
    CASE (COPY_INVERT);
    CASE (OR_INVERT);
    CASE (NAND);
    CASE (SET);
#undef CASE
    default: return static_printf ("illegal_%d", function);
    }
  /* NOTREACHED */
  return NULL; 
}
Example #12
0
//
// ACS_translateThingVarACS0
//
// Translates an ACS0 opdata into a THINGVAR to access.
//
static int32_t ACS_translateThingVarACS0(const acs0_opdata_t *opdata)
{
   #define CASE(OP,VAR) case ACS0_OP_##OP: return ACS_THINGVAR_##VAR

   switch(opdata->op)
   {
   CASE(ACTIVATORARMOR,          Armor);
   CASE(ACTIVATORFRAGS,          Frags);
   CASE(ACTIVATORHEALTH,         Health);
   CASE(ACTIVATORTID,            TID);
   CASE(CHK_THINGCEILINGTEXTURE, CeilingTexture);
   CASE(CHK_THINGFLOORTEXTURE,   FloorTexture);
   CASE(GET_THINGANGLE,          Angle);
   CASE(GET_THINGCEILINGZ,       CeilingZ);
   CASE(GET_THINGFLOORZ,         FloorZ);
   CASE(GET_THINGLIGHTLEVEL,     LightLevel);
   CASE(GET_THINGPITCH,          Pitch);
   CASE(GET_THINGX,              X);
   CASE(GET_THINGY,              Y);
   CASE(GET_THINGZ,              Z);
   CASE(PLAYERNUMBER,            PlayerNumber);
   CASE(SET_THINGANGLE,          Angle);
   CASE(SET_THINGPITCH,          Pitch);
   CASE(SIGILPIECES,             SigilPieces);

   default: return ACS_THINGVARMAX;
   }

   #undef CASE
}
Example #13
0
//
// ACS_translateFuncACS0
//
// Translates an ACS0 opdata into a CALLFUNC func/argc pair.
//
static void ACS_translateFuncACS0(int32_t *&codePtr, const acs0_opdata_t *opdata)
{
   acs_funcnum_t funcnum;
   uint32_t argc;

   #define CASE(OP,FUNC,ARGC) \
      case ACS0_OP_##OP: funcnum = ACS_FUNC_##FUNC; argc = ARGC; break
   #define CASE_IMM(OP,FUNC,ARGC) \
      case ACS0_OP_##OP##_IMM: CASE(OP, FUNC, ARGC)

   switch(opdata->op)
   {
   CASE(ACTIVATORSOUND,         ActivatorSound,         2);
   CASE(AMBIENTSOUND,           AmbientSound,           2);
   CASE(AMBIENTSOUNDLOCAL,      AmbientSoundLocal,      2);
   CASE(CLASSIFYTHING,          ClassifyThing,          1);
   CASE(GETPLAYERINPUT,         GetPlayerInput,         2);
   CASE(GET_THINGARR,           GetThingVar,            2);
   CASE(GETSECTORCEILINGZ,      GetSectorCeilingZ,      3);
   CASE(GETSECTORFLOORZ,        GetSectorFloorZ,        3);
   CASE(GETSECTORLIGHTLEVEL,    GetSectorLightLevel,    1);
   CASE(REPLACETEXTURES,        ReplaceTextures,        3);
   CASE(SECTORDAMAGE,           SectorDamage,           5);
   CASE(SECTORSOUND,            SectorSound,            2);
   CASE(SETLINEBLOCKING,        SetLineBlocking,        2);
   CASE(SETLINEMONSTERBLOCKING, SetLineMonsterBlocking, 2);
   CASE(SETLINESPECIAL,         SetLineSpecial,         7);
   CASE(SETLINETEXTURE,         SetLineTexture,         4);
   CASE(SETMUSIC_ST,            SetMusic,               1);
   CASE(SETTHINGPOSITION,       SetThingPosition,       5);
   CASE(SETTHINGSPECIAL,        SetThingSpecial,        7);
   CASE(SETTHINGSTATE,          SetThingState,          3);
   CASE(SET_THINGARR,           SetThingVar,            3);
   CASE(SOUNDSEQUENCE,          SoundSequence,          1);
   CASE(SPAWNPROJECTILE,        SpawnProjectile,        7);
   CASE(SPAWNSPOTANGLE,         SpawnSpotAngle,         3);
   CASE(THINGCOUNTNAME,         ThingCountName,         2);
   CASE(THINGCOUNTNAMESECTOR,   ThingCountNameSector,   3);
   CASE(THINGCOUNTSECTOR,       ThingCountSector,       3);
   CASE(THINGDAMAGE,            ThingDamage,            3);
   CASE(THINGPROJECTILE,        ThingProjectile,        7);
   CASE(THINGSOUND,             ThingSound,             3);

   CASE_IMM(CHANGECEILING, ChangeCeiling, 2);
   CASE_IMM(CHANGEFLOOR,   ChangeFloor,   2);
   case ACS0_OP_RANDOM_IMM_BYTE:
   CASE_IMM(RANDOM,        Random,        2);
   CASE_IMM(SETMUSIC,      SetMusic,      3);
   CASE_IMM(SETMUSICLOCAL, SetMusicLocal, 3);
   CASE_IMM(SPAWNPOINT,    SpawnPoint,    6);
   CASE_IMM(SPAWNSPOT,     SpawnSpot,     4);
   CASE_IMM(THINGCOUNT,    ThingCount,    2);

   default: opdata = &ACS0opdata[ACS_OP_KILL]; CASE(NOP, NOP, 0);
   }

   #undef CASE_IMM
   #undef CASE

   *codePtr++ = opdata->opdata->op;
   *codePtr++ = funcnum;
   *codePtr++ = argc;
}
Example #14
0
static WORD
make_langid (PangoLanguage *lang)
{
#define CASE(t,p,s) if (pango_language_matches (lang, t)) return MAKELANGID (LANG_##p, SUBLANG_##p##_##s)
#define CASEN(t,p) if (pango_language_matches (lang, t)) return MAKELANGID (LANG_##p, SUBLANG_NEUTRAL)

  /* Languages that most probably don't affect Uniscribe have been
   * left out. Uniscribe is documented to use
   * SCRIPT_CONTROL::uDefaultLanguage only to select digit shapes, so
   * just leave languages with own digits.
   */

  CASEN ("ar", ARABIC);
  CASEN ("hy", ARMENIAN);
  CASEN ("as", ASSAMESE);
  CASEN ("az", AZERI);
  CASEN ("bn", BENGALI);
  CASE ("zh-tw", CHINESE, TRADITIONAL);
  CASE ("zh-cn", CHINESE, SIMPLIFIED);
  CASE ("zh-hk", CHINESE, HONGKONG);
  CASE ("zh-sg", CHINESE, SINGAPORE);
  CASE ("zh-mo", CHINESE, MACAU);
  CASEN ("dib", DIVEHI);
  CASEN ("fa", FARSI);
  CASEN ("ka", GEORGIAN);
  CASEN ("gu", GUJARATI);
  CASEN ("he", HEBREW);
  CASEN ("hi", HINDI);
  CASEN ("ja", JAPANESE);
  CASEN ("kn", KANNADA);
  CASE ("ks-in", KASHMIRI, INDIA);
  CASEN ("ks", KASHMIRI);
  CASEN ("kk", KAZAK);
  CASEN ("kok", KONKANI);
  CASEN ("ko", KOREAN);
  CASEN ("ky", KYRGYZ);
  CASEN ("ml", MALAYALAM);
  CASEN ("mni", MANIPURI);
  CASEN ("mr", MARATHI);
  CASEN ("mn", MONGOLIAN);
  CASE ("ne-in", NEPALI, INDIA);
  CASEN ("ne", NEPALI);
  CASEN ("or", ORIYA);
  CASEN ("pa", PUNJABI);
  CASEN ("sa", SANSKRIT);
  CASEN ("sd", SINDHI);
  CASEN ("syr", SYRIAC);
  CASEN ("ta", TAMIL);
  CASEN ("tt", TATAR);
  CASEN ("te", TELUGU);
  CASEN ("th", THAI);
  CASE ("ur-pk", URDU, PAKISTAN);
  CASE ("ur-in", URDU, INDIA);
  CASEN ("ur", URDU);
  CASEN ("uz", UZBEK);

#undef CASE
#undef CASEN

  return MAKELANGID (LANG_NEUTRAL, SUBLANG_NEUTRAL);
}
Example #15
0
int main (int argc, char* argv[])
{
    char *servicename = NULL;
    char *address = NULL;
    DBusMessage* message = NULL;
    DBusConnection* conn = NULL;
    int c;
    int ret = 1;
    int messageType = FCITX_DBUS_GET_CURRENT_STATE;
    char *imname = NULL;
    while ((c = getopt(argc, argv, "chortTeam:s:")) != -1) {
        switch (c) {
        case 'o':
            messageType = FCITX_DBUS_ACTIVATE;
            break;

        case 'c':
            messageType = FCITX_DBUS_INACTIVATE;
            break;

        case 'r':
            messageType = FCITX_DBUS_RELOAD_CONFIG;
            break;

        case 't':
        case 'T':
            messageType = FCITX_DBUS_TOGGLE;
            break;

        case 'e':
            messageType = FCITX_DBUS_EXIT;
            break;

        case 'm':
            messageType = FCITX_DBUS_GET_IM_ADDON;
            imname = strdup(optarg);
            break;

        case 's':
            messageType = FCITX_DBUS_SET_CURRENT_IM;
            imname = strdup(optarg);
            break;

        case 'a':
            address = _fcitx_get_address();
            if (address) {
                printf("%s\n", address);
                return 0;
            }
            else
                return 1;
            break;

        case 'h':
            usage(stdout);
            return 0;
        default:
            usage(stderr);
            return 1;
            break;
        }
    }

#define CASE(ENUMNAME, MESSAGENAME) \
        case FCITX_DBUS_##ENUMNAME: \
            message = dbus_message_new_method_call(servicename, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, #MESSAGENAME); \
            break;

    asprintf(&servicename, "%s-%d", FCITX_DBUS_SERVICE, fcitx_utils_get_display_number());
    switch(messageType) {
        CASE(ACTIVATE, ActivateIM);
        CASE(INACTIVATE, InactivateIM);
        CASE(RELOAD_CONFIG, ReloadConfig);
        CASE(EXIT, Exit);
        CASE(TOGGLE, ToggleIM);
        CASE(GET_CURRENT_STATE, GetCurrentState);
        CASE(GET_IM_ADDON, GetIMAddon);
        CASE(SET_CURRENT_IM, SetCurrentIM);

        default:
            goto some_error;
    };
    if (!message) {
        goto some_error;
    }
    address = _fcitx_get_address();
    do {
        if (!address)
            break;
        conn = dbus_connection_open(address, NULL);
        if (!conn)
            break;
        if (!dbus_bus_register(conn, NULL)) {
            dbus_connection_unref(conn);
            conn = NULL;
            break;
        }
    } while(0);

    if (!conn) {
        conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);

        if (!conn) {
            goto some_error;
        }

        dbus_connection_set_exit_on_disconnect(conn, FALSE);
    }

    if (messageType == FCITX_DBUS_GET_CURRENT_STATE) {
        DBusMessage* reply = dbus_connection_send_with_reply_and_block(conn, message, 1000, NULL);
        int result = 0;
        if (reply && dbus_message_get_args(reply, NULL, DBUS_TYPE_INT32, &result, DBUS_TYPE_INVALID)) {
            printf("%d\n", result);
            ret = 0;
        } else {
            fprintf(stderr, "Not get reply\n");
        }
    }
    else if (messageType == FCITX_DBUS_GET_IM_ADDON) {
        do {
            if (!fcitx_utf8_check_string(imname))
                break;
            dbus_message_append_args(message, DBUS_TYPE_STRING, &imname, DBUS_TYPE_INVALID);
            DBusMessage* reply = dbus_connection_send_with_reply_and_block(conn, message, 1000, NULL);
            char *result = NULL;
            if (reply && dbus_message_get_args(reply, NULL, DBUS_TYPE_STRING, &result, DBUS_TYPE_INVALID)) {
                printf("%s\n", result);
                ret = 0;
            } else {
                fprintf(stderr, "Not get reply\n");
            }
        } while(0);

    }
    else if (messageType == FCITX_DBUS_SET_CURRENT_IM) {
        do {
            if (!fcitx_utf8_check_string(imname))
                break;
            dbus_message_append_args(message, DBUS_TYPE_STRING, &imname, DBUS_TYPE_INVALID);
            dbus_connection_send(conn, message, NULL);
            dbus_connection_flush(conn);
            ret = 0;
        } while(0);
    } else {
        dbus_connection_send(conn, message, NULL);
        dbus_connection_flush(conn);
        ret = 0;
    }

some_error:
    if (message)
        dbus_message_unref(message);
    if (conn)
        dbus_connection_unref(conn);
    fcitx_utils_free(address);
    fcitx_utils_free(servicename);
    fcitx_utils_free(imname);
    return ret;
}
Example #16
0
void
SoGate::evaluate()
//
////////////////////////////////////////////////////////////////////////
{
    trigger.getValue();	// Force evaluation

    // For efficiency and to reduce bloat, we don't use the standard
    // SO_ENGINE_OUTPUT macro:

    if (!output->isEnabled()) return;

    for (int i = 0; i < output->getNumConnections(); i++) {
	SoMField *outField = (SoMField *)(*output)[i];
	if (outField->isReadOnly()) continue;
	
// Handy macro for doing type-correct setValues(getValues())
#define CASE(class) \
  case class: ((SO__CONCAT(SoMF,class) *)outField)-> \
    setValues(0, input->getNum(), \
	((SO__CONCAT(SoMF,class) *)input)->getValues(0)); \
    break
				 
	switch(conversionCase) {
	    CASE(BitMask);
	    CASE(Bool);
	    CASE(Color);
	    CASE(Enum);
	    CASE(Float);
	    CASE(Int32);
	    CASE(Matrix);
	    CASE(Name);
	    CASE(Node);
	    CASE(Path);
	    CASE(Plane);
	    CASE(Rotation);
	    CASE(Short);
	    CASE(String);
	    CASE(Time);
	    CASE(UInt32);
	    CASE(UShort);
	    CASE(Vec2f);
	    CASE(Vec3f);
	    CASE(Vec4f);
#undef CASE
	  case BAD_TYPE:
	    ; // Do nothing, already complained
	    break;
	  default:
	    // Something is seriously wrong:
#ifdef DEBUG
	    SoDebugError::post("SoGate::evaluate",
			   "conversionCase is %d!", conversionCase);
#endif
	    break;
	}
	outField->setNum(input->getNum());
    }

    output->enable(enable.getValue());
}
Example #17
0
/**************************************************************************
 * 			MCI_MessageToString			[internal]
 */
static const char* MCI_MessageToString(UINT wMsg)
{
    static char buffer[100];

#define CASE(s) case (s): return #s

    switch (wMsg) {
        CASE(DRV_LOAD);
        CASE(DRV_ENABLE);
        CASE(DRV_OPEN);
        CASE(DRV_CLOSE);
        CASE(DRV_DISABLE);
        CASE(DRV_FREE);
        CASE(DRV_CONFIGURE);
        CASE(DRV_QUERYCONFIGURE);
        CASE(DRV_INSTALL);
        CASE(DRV_REMOVE);
        CASE(DRV_EXITSESSION);
        CASE(DRV_EXITAPPLICATION);
        CASE(DRV_POWER);
	CASE(MCI_BREAK);
	CASE(MCI_CLOSE);
	CASE(MCI_CLOSE_DRIVER);
	CASE(MCI_COPY);
	CASE(MCI_CUE);
	CASE(MCI_CUT);
	CASE(MCI_DELETE);
	CASE(MCI_ESCAPE);
	CASE(MCI_FREEZE);
	CASE(MCI_PAUSE);
	CASE(MCI_PLAY);
	CASE(MCI_GETDEVCAPS);
	CASE(MCI_INFO);
	CASE(MCI_LOAD);
	CASE(MCI_OPEN);
	CASE(MCI_OPEN_DRIVER);
	CASE(MCI_PASTE);
	CASE(MCI_PUT);
	CASE(MCI_REALIZE);
	CASE(MCI_RECORD);
	CASE(MCI_RESUME);
	CASE(MCI_SAVE);
	CASE(MCI_SEEK);
	CASE(MCI_SET);
	CASE(MCI_SOUND);
	CASE(MCI_SPIN);
	CASE(MCI_STATUS);
	CASE(MCI_STEP);
	CASE(MCI_STOP);
	CASE(MCI_SYSINFO);
	CASE(MCI_UNFREEZE);
	CASE(MCI_UPDATE);
	CASE(MCI_WHERE);
	CASE(MCI_WINDOW);
	/* constants for digital video */
	CASE(MCI_CAPTURE);
	CASE(MCI_MONITOR);
	CASE(MCI_RESERVE);
	CASE(MCI_SETAUDIO);
	CASE(MCI_SIGNAL);
	CASE(MCI_SETVIDEO);
	CASE(MCI_QUALITY);
	CASE(MCI_LIST);
	CASE(MCI_UNDO);
	CASE(MCI_CONFIGURE);
	CASE(MCI_RESTORE);
#undef CASE
    default:
	sprintf(buffer, "MCI_<<%04X>>", wMsg);
	return buffer;
    }
}
Example #18
0
static u32 sal_Input(int held)
{
#if 1
    SDL_Event event;
    int i=0;
    u32 timer=0;
#ifdef GCW_JOYSTICK
    int    deadzone = 10000;
    Sint32 x_move   = 0;
    Sint32 y_move   = 0;

#endif

    if (!SDL_PollEvent(&event))
    {
        if (held)
            return inputHeld;
        return 0;
    }

    Uint8 type = (event.key.state == SDL_PRESSED);
    switch(event.key.keysym.sym)
    {
        CASE( LCTRL,     A      );
        CASE( LALT,      B      );
        CASE( SPACE,     X      );//this triggers for some reason on the gcw0 when analogue joystick is on and in a diagonal position if sdl_updatejoystick is called before this point.
        CASE( LSHIFT,    Y      );
        CASE( TAB,       L      );
        CASE( BACKSPACE, R      );
        CASE( RETURN,    START  );
        CASE( ESCAPE,    SELECT );
        CASE( UP,        UP     );
        CASE( DOWN,      DOWN   );
        CASE( LEFT,      LEFT   );
        CASE( RIGHT,     RIGHT  );
        CASE( HOME,      MENU   );
    default:
        break;
    }
#ifdef GCW_JOYSTICK
    if(analogJoy && !key_repeat_enabled)
    {
        static int j_left = 0;
        static int j_right = 0;
        static int j_up = 0;
        static int j_down = 0;

        //Update joystick position
        if (SDL_NumJoysticks() > 0)
        {
            SDL_Joystick *joy;
            joy    = SDL_JoystickOpen(0);
            SDL_JoystickUpdate();
            x_move = SDL_JoystickGetAxis(joy, 0);
            y_move = SDL_JoystickGetAxis(joy, 1);
        }

        //Emulate keypresses with joystick
        if (x_move < -deadzone || x_move > deadzone)
        {
            if (x_move < -deadzone) inputHeld |= SAL_INPUT_LEFT;
            if (x_move >  deadzone) inputHeld |= SAL_INPUT_RIGHT;
            if (x_move < -deadzone) j_left     = 1;
            if (x_move >  deadzone) j_right    = 1;
        } else
        {
            //stop movement if previously triggered by analogue stick
            if (j_left)
            {
                j_left = 0;
                inputHeld &= ~(SAL_INPUT_LEFT );
            }
            if (j_right)
            {
                j_right = 0;
                inputHeld &= ~(SAL_INPUT_RIGHT );
            }
        }

        if (y_move < -deadzone || y_move > deadzone)
        {
            if (y_move < -deadzone) inputHeld |= SAL_INPUT_UP;
            if (y_move >  deadzone) inputHeld |= SAL_INPUT_DOWN;
            if (y_move < -deadzone) j_up       = 1;
            if (y_move >  deadzone) j_down     = 1;
        } else
        {
            //stop movement if previously triggered by analogue stick
            if (j_up)
            {
                j_up = 0;
                inputHeld &= ~(SAL_INPUT_UP );
            }
            if (j_down)
            {
                j_down = 0;
                inputHeld &= ~(SAL_INPUT_DOWN );
            }
        }
    }
#endif

    mInputRepeat = inputHeld;

#else
    int i=0;
    u32 inputHeld=0;
    u32 timer=0;
    u8 *keystate;

    SDL_PumpEvents();

    keystate = SDL_GetKeyState(NULL);

    if ( keystate[SDLK_LCTRL] ) inputHeld|=SAL_INPUT_A;
    if ( keystate[SDLK_LALT] ) inputHeld|=SAL_INPUT_B;
    if ( keystate[SDLK_SPACE] ) inputHeld|=SAL_INPUT_X;
    if ( keystate[SDLK_LSHIFT] ) inputHeld|=SAL_INPUT_Y;
    if ( keystate[SDLK_TAB] ) inputHeld|=SAL_INPUT_L;
    if ( keystate[SDLK_BACKSPACE] ) inputHeld|=SAL_INPUT_R;
    if ( keystate[SDLK_RETURN] ) inputHeld|=SAL_INPUT_START;
    if ( keystate[SDLK_ESCAPE] ) inputHeld|=SAL_INPUT_SELECT;
    if ( keystate[SDLK_UP] ) inputHeld|=SAL_INPUT_UP;
    if ( keystate[SDLK_DOWN] ) inputHeld|=SAL_INPUT_DOWN;
    if ( keystate[SDLK_LEFT] ) inputHeld|=SAL_INPUT_LEFT;
    if ( keystate[SDLK_RIGHT] ) inputHeld|=SAL_INPUT_RIGHT;

    // Process key repeats
    timer=sal_TimerRead();
    for (i=0; i<32; i++)
    {
        if (inputHeld&(1<<i))
        {
            if(mInputFirst&(1<<i))
            {
                if (mInputRepeatTimer[i]<timer)
                {
                    mInputRepeat|=1<<i;
                    mInputRepeatTimer[i]=timer+10;
                }
                else
                {
                    mInputRepeat&=~(1<<i);
                }
            }
            else
            {
                //First press of button
                //set timer to expire later than usual
                mInputFirst|=(1<<i);
                mInputRepeat|=1<<i;
                mInputRepeatTimer[i]=timer+50;
            }
        }
        else
        {
            mInputRepeatTimer[i]=timer-10;
            mInputRepeat&=~(1<<i);
            mInputFirst&=~(1<<i);
        }

    }

    if(mInputIgnore)
    {
        //A request to ignore all key presses until all keys have been released has been made
        //check for release and clear flag, otherwise clear inputHeld and mInputRepeat
        if (inputHeld == 0)
        {
            mInputIgnore=0;
        }
        inputHeld=0;
        mInputRepeat=0;
    }
#endif

    return inputHeld;
}
Example #19
0
const char *
session_strstate(int state)
{
	static char	buf[32];

	switch (state) {
	CASE(S_NEW);
	CASE(S_CONNECTED);
	CASE(S_INIT);
	CASE(S_GREETED);
	CASE(S_TLS);
	CASE(S_AUTH_INIT);
	CASE(S_AUTH_USERNAME);
	CASE(S_AUTH_PASSWORD);
	CASE(S_AUTH_FINALIZE);
	CASE(S_RSET);
	CASE(S_HELO);
	CASE(S_MAIL_MFA);
	CASE(S_MAIL_QUEUE);
	CASE(S_MAIL);
	CASE(S_RCPT_MFA);
	CASE(S_RCPT);
	CASE(S_DATA);
	CASE(S_DATA_QUEUE);
	CASE(S_DATACONTENT);
	CASE(S_DONE);
	CASE(S_QUIT);
	CASE(S_CLOSE);
	default:
		snprintf(buf, sizeof(buf), "S_??? (%d)", state);
		return buf;
	}
}
Example #20
0
void lefiGeometries::addClass(const char* name) {
  char* c = (char*)lefMalloc(strlen(name)+1);
  strcpy(c, CASE(name));
  this->lefiGeometries::add((void*)c, lefiGeomClassE);
}
Example #21
0
static const char *
token_name(int token)
{
    const char *result;
#define CASE(name) case name: result = #name; break
    switch (token) {
	CASE(T_NONE);
	CASE(T_OR);
	CASE(T_CAT);
	CASE(T_STAR);
	CASE(T_PLUS);
	CASE(T_Q);
	CASE(T_LP);
	CASE(T_RP);
	CASE(T_START);
	CASE(T_END);
	CASE(T_ANY);
	CASE(T_CLASS);
	CASE(T_SLASH);
	CASE(T_CHAR);
	CASE(T_STR);
	CASE(T_U);
    default:
	result = "?";
	break;
    }
#undef CASE
    return result;
}
Example #22
0
  const char * Error::typeToString( Type t ) {
    switch ( t ) {
#define CASE(x) case x: return #x
      CASE( None );
      CASE( Custom );

      CASE( CRWithoutLF );
      CASE( SlashWithoutAsterisk );
      CASE( IllegalCharacter );
      CASE( UnexpectedCharacter );
      CASE( NoLeadingDigits );
      CASE( NonCWSAfterTextColon );

      CASE( NumberOutOfRange );
      CASE( InvalidUTF8 );

      CASE( UnfinishedBracketComment );
      CASE( PrematureEndOfMultiLine );
      CASE( PrematureEndOfQuotedString );
      CASE( PrematureEndOfStringList );
      CASE( PrematureEndOfTestList );
      CASE( PrematureEndOfBlock );
      CASE( MissingWhitespace );
      CASE( MissingSemicolonOrBlock );

      CASE( ExpectedBlockOrSemicolon );
      CASE( ExpectedCommand );
      CASE( ConsecutiveCommasInStringList );
      CASE( ConsecutiveCommasInTestList );
      CASE( MissingCommaInTestList );
      CASE( MissingCommaInStringList );
      CASE( NonStringInStringList );
      CASE( NonCommandInCommandList );
      CASE( NonTestInTestList );

      CASE( RequireNotFirst );
      CASE( RequireMissingForCommand );
      CASE( RequireMissingForTest );
      CASE( RequireMissingForComparator );
      CASE( UnsupportedCommand );
      CASE( UnsupportedTest );
      CASE( UnsupportedComparator );
      CASE( TestNestingTooDeep );
      CASE( BlockNestingTooDeep );
      CASE( InvalidArgument );
      CASE( ConflictingArguments );
      CASE( ArgumentsRepeated );
      CASE( CommandOrderingConstraintViolation );

      CASE( IncompatibleActionsRequested );
      CASE( MailLoopDetected );
      CASE( TooManyActions );
#undef CASE
    default:
      return "<unknown>";
    }
  }
Example #23
0
static u32 sal_Input(int held)
{
#if 1
	SDL_Event event;
	int i=0;
	u32 timer=0;

	if (!SDL_PollEvent(&event)) {
		if (held)
			return inputHeld;
		return 0;
	}

	Uint8 type = (event.key.state == SDL_PRESSED);
	switch(event.key.keysym.sym) {
		CASE(LCTRL, A);
		CASE(LALT, B);
		CASE(SPACE, X);
		CASE(LSHIFT, Y);
		CASE(TAB, L);
		CASE(BACKSPACE, R);
		CASE(RETURN, START);
		CASE(ESCAPE, SELECT);
		CASE(UP, UP);
		CASE(DOWN, DOWN);
		CASE(LEFT, LEFT);
		CASE(RIGHT, RIGHT);
	}

	mInputRepeat = inputHeld;

#else
	int i=0;
	u32 inputHeld=0;
	u32 timer=0;
	u8 *keystate;

	SDL_PumpEvents();

	keystate = SDL_GetKeyState(NULL);
	
	if ( keystate[SDLK_LCTRL] ) inputHeld|=SAL_INPUT_A;
	if ( keystate[SDLK_LALT] ) inputHeld|=SAL_INPUT_B;
	if ( keystate[SDLK_SPACE] ) inputHeld|=SAL_INPUT_X;
	if ( keystate[SDLK_LSHIFT] ) inputHeld|=SAL_INPUT_Y;
	if ( keystate[SDLK_TAB] ) inputHeld|=SAL_INPUT_L;
	if ( keystate[SDLK_BACKSPACE] ) inputHeld|=SAL_INPUT_R;
	if ( keystate[SDLK_RETURN] ) inputHeld|=SAL_INPUT_START;
	if ( keystate[SDLK_ESCAPE] ) inputHeld|=SAL_INPUT_SELECT;
	if ( keystate[SDLK_UP] ) inputHeld|=SAL_INPUT_UP;
	if ( keystate[SDLK_DOWN] ) inputHeld|=SAL_INPUT_DOWN;
	if ( keystate[SDLK_LEFT] ) inputHeld|=SAL_INPUT_LEFT;
	if ( keystate[SDLK_RIGHT] ) inputHeld|=SAL_INPUT_RIGHT;

	// Process key repeats
	timer=sal_TimerRead();
	for (i=0;i<32;i++)
	{
		if (inputHeld&(1<<i)) 
		{
			if(mInputFirst&(1<<i))
			{
				if (mInputRepeatTimer[i]<timer)
				{
					mInputRepeat|=1<<i;
					mInputRepeatTimer[i]=timer+10;
				}
				else
				{
					mInputRepeat&=~(1<<i);
				}
			}
			else
			{
				//First press of button
				//set timer to expire later than usual
				mInputFirst|=(1<<i);
				mInputRepeat|=1<<i;
				mInputRepeatTimer[i]=timer+50;
			}
		}
		else			
		{
			mInputRepeatTimer[i]=timer-10;
			mInputRepeat&=~(1<<i);
			mInputFirst&=~(1<<i);
		}
		
	}

	if(mInputIgnore)
	{
		//A request to ignore all key presses until all keys have been released has been made
		//check for release and clear flag, otherwise clear inputHeld and mInputRepeat
		if (inputHeld == 0)
		{
			mInputIgnore=0;
		}
		inputHeld=0;
		mInputRepeat=0;
	}
#endif

	return inputHeld;
}
Example #24
0
/*
 * Converts a debug_action into a string.
 */
const char *dbg_action_2_str(dbg_action a)
{
#define CASE(a) case a: return #a

	switch (a) {
	CASE(dbg_error);
	CASE(dbg_opt_ssa);
	CASE(dbg_opt_auxnode);
	CASE(dbg_const_eval);
	CASE(dbg_opt_cse);
	CASE(dbg_straightening);
	CASE(dbg_if_simplification);
	CASE(dbg_algebraic_simplification);
	CASE(dbg_write_after_write);
	CASE(dbg_write_after_read);
	CASE(dbg_read_after_write);
	CASE(dbg_read_after_read);
	CASE(dbg_read_a_const);
	CASE(dbg_rem_poly_call);
	CASE(dbg_dead_code);
	CASE(dbg_opt_confirm);
	CASE(dbg_gvn_pre);
	CASE(dbg_combo);
	CASE(dbg_jumpthreading);
	CASE(dbg_backend);
	default:
		if (a <= dbg_max)
			return "string conversion not implemented";
		else
			panic("Missing debug action");
	}
#undef CASE
}
Example #25
0
int
nccrconvert(nc_type srctype, nc_type dsttype,
            void* value0, void* memory0,
            size_t count, int byteswap)
{
    size_t i;
    char* memory = memory0;
    char* value = value0;
    unsigned char tmp[8];
    size_t srcsize = nccrtypelen(srctype);
    size_t dstsize = nccrtypelen(dsttype);

    /* Provide space and pointer casts for intermediate results */
    signed char ncbyte;
    char ncchar;
    short ncshort;
    int ncint;
    float ncfloat;
    double ncdouble;
    unsigned char ncubyte;
    unsigned short ncushort;
    unsigned int ncuint;
    long long ncint64;
    unsigned long long ncuint64;

    signed char* ncbytep = (signed char*)tmp;
    char* nccharp = (char*)tmp;
    short* ncshortp = (short*)tmp;
    int* ncintp = (int*)tmp;
    float* ncfloatp = (float*)tmp;
    double* ncdoublep = (double*)tmp;
    unsigned char* ncubytep = (unsigned char*)tmp;
    unsigned short* ncushortp = (unsigned short*)tmp;
    unsigned int* ncuintp = (unsigned int*)tmp;
    long long* ncint64p = (long long*)tmp;
    unsigned long long* ncuint64p = (unsigned long long*)tmp;

#define CASE(nc1,nc2) (nc1*256+nc2)
#define ARM(vs,ts,vd,td) \
    vs = *vs##p;\
    vd##p = (td *)memory;\
    *vd##p = (td)vs;

    /* Do special cases when srctype == dsttype or both types have size 1*/
    if(srcsize == 1 && dstsize == 1) {
	 memcpy(memory,value,count); /* No swapping or conversion needed */
    } else {
        for(i=0;i<count;i++) {
            /* Stored src item into tmp; optionally swap */
            switch (srcsize) {
            case 2:
		if(byteswap) {
		    tmp[1] = value[0]; tmp[0] = value[1];
		} else {
		    tmp[1] = value[1]; tmp[0] = value[0];
		}
                break;
            case 4:
		if(byteswap) {
		    tmp[3] = value[0]; tmp[2] = value[1];
                    tmp[1] = value[2]; tmp[0] = value[3];
		} else {
		    tmp[0] = value[0]; tmp[1] = value[1];
                    tmp[2] = value[2]; tmp[3] = value[3];
		}
		break;
            case 8:
		if(byteswap) {
		    tmp[7] = value[0]; tmp[6] = value[1];
                    tmp[5] = value[2]; tmp[4] = value[3];
                    tmp[3] = value[4]; tmp[2] = value[5];
                    tmp[1] = value[6]; tmp[0] = value[7];
		} else {
		    tmp[0] = value[0]; tmp[1] = value[1];
                    tmp[2] = value[2]; tmp[3] = value[3];
                    tmp[4] = value[4]; tmp[5] = value[5];
                    tmp[6] = value[6]; tmp[7] = value[7];
		}
	        break;
            default: abort();
            }

	    if(srctype == dsttype) { /* Just move tmp to *memory */
                /*assert(srcsize == dstsize)*/
                switch (srcsize) {
                case 2:
                        memory[0] = tmp[0]; memory[1] = tmp[1];
                        break;
                case 4:
                        memory[0] = tmp[0]; memory[1] = tmp[1];
                        memory[2] = tmp[2]; memory[3] = tmp[3];
                        break;
                case 8:
                        memory[0] = tmp[0]; memory[1] = tmp[1];
                        memory[2] = tmp[2]; memory[3] = tmp[3];
                        memory[4] = tmp[4]; memory[5] = tmp[5];
                        memory[6] = tmp[6]; memory[7] = tmp[7];
                        break;
                default: abort();
                }
            } else {/* srctype != dsttype => We must do the conversion */
		switch (CASE(srctype,dsttype)) {

                case CASE(NC_CHAR,NC_SHORT):
	            ARM(ncchar,char,ncshort,short)
	            break;
                case CASE(NC_CHAR,NC_USHORT):
	            ARM(ncchar,char,ncushort,unsigned short)
	            break;
                case CASE(NC_CHAR,NC_INT):
	            ARM(ncchar,char,ncint,int)
	            break;
                case CASE(NC_CHAR,NC_UINT):
	            ARM(ncchar,char,ncuint,unsigned int)
	            break;
                case CASE(NC_CHAR,NC_INT64):
	            ARM(ncchar,char,ncint64,long long)
	            break;
                case CASE(NC_CHAR,NC_UINT64):
	            ARM(ncchar,char,ncuint64,unsigned long long)
	            break;
                case CASE(NC_CHAR,NC_FLOAT):
	            ARM(ncchar,char,ncfloat,float)
	            break;
                case CASE(NC_CHAR,NC_DOUBLE):
	            ARM(ncchar,char,ncdouble,double)
	            break;
                case CASE(NC_BYTE,NC_SHORT):
	            ARM(ncbyte,signed char,ncshort,short)
	            break;
                case CASE(NC_BYTE,NC_USHORT):
	            ARM(ncbyte,signed char,ncushort,unsigned short)
	            break;
                case CASE(NC_BYTE,NC_INT):
	            ARM(ncbyte,signed char,ncint,int)
	            break;
                case CASE(NC_BYTE,NC_UINT):
	            ARM(ncbyte,signed char,ncuint,unsigned int)
	            break;
                case CASE(NC_BYTE,NC_INT64):
	            ARM(ncbyte,signed char,ncint64,long long)
	            break;
                case CASE(NC_BYTE,NC_UINT64):
	            ARM(ncbyte,signed char,ncuint64,unsigned long long)
	            break;
                case CASE(NC_BYTE,NC_FLOAT):
	            ARM(ncbyte,signed char,ncfloat,float)
	            break;
                case CASE(NC_BYTE,NC_DOUBLE):
	            ARM(ncbyte,signed char,ncdouble,double)
	            break;
                case CASE(NC_UBYTE,NC_SHORT):
	            ARM(ncubyte,unsigned char,ncshort,short)
	            break;
                case CASE(NC_UBYTE,NC_USHORT):
	            ARM(ncubyte,unsigned char,ncushort,unsigned short)
	            break;
                case CASE(NC_UBYTE,NC_INT):
	            ARM(ncubyte,unsigned char,ncint,int)
	            break;
                case CASE(NC_UBYTE,NC_UINT):
	            ARM(ncubyte,unsigned char,ncuint,unsigned int)
	            break;
                case CASE(NC_UBYTE,NC_INT64):
	            ARM(ncubyte,unsigned char,ncint64,long long)
	            break;
                case CASE(NC_UBYTE,NC_UINT64):
	            ARM(ncubyte,unsigned char,ncuint64,unsigned long long)
	            break;
                case CASE(NC_UBYTE,NC_FLOAT):
	            ARM(ncubyte,unsigned char,ncfloat,float)
	            break;
                case CASE(NC_UBYTE,NC_DOUBLE):
	            ARM(ncubyte,unsigned char,ncdouble,double)
	            break;
                case CASE(NC_SHORT,NC_CHAR):
	            ARM(ncshort,short,ncchar,char)
	            break;
                case CASE(NC_SHORT,NC_BYTE):
	            ARM(ncshort,short,ncbyte,signed char)
	            break;
                case CASE(NC_SHORT,NC_UBYTE):
	            ARM(ncshort,short,ncubyte,unsigned char)
	            break;
                case CASE(NC_SHORT,NC_USHORT):
	            ARM(ncshort,short,ncushort,unsigned short)
	            break;
                case CASE(NC_SHORT,NC_INT):
	            ARM(ncshort,short,ncint,int)
	            break;
                case CASE(NC_SHORT,NC_UINT):
	            ARM(ncshort,short,ncuint,unsigned int)
	            break;
                case CASE(NC_SHORT,NC_INT64):
	            ARM(ncshort,short,ncint64,long long)
	            break;
                case CASE(NC_SHORT,NC_UINT64):
	            ARM(ncshort,short,ncuint64,unsigned long long)
	            break;
                case CASE(NC_SHORT,NC_FLOAT):
	            ARM(ncshort,short,ncfloat,float)
	            break;
                case CASE(NC_SHORT,NC_DOUBLE):
	            ARM(ncshort,short,ncdouble,double)
	            break;
                case CASE(NC_USHORT,NC_CHAR):
	            ARM(ncushort,unsigned short,ncchar,char)
	            break;
                case CASE(NC_USHORT,NC_BYTE):
	            ARM(ncushort,unsigned short,ncbyte,signed char)
	            break;
                case CASE(NC_USHORT,NC_UBYTE):
	            ARM(ncushort,unsigned short,ncubyte,unsigned char)
	            break;
                case CASE(NC_USHORT,NC_SHORT):
	            ARM(ncushort,unsigned short,ncshort,short)
	            break;
                case CASE(NC_USHORT,NC_INT):
	            ARM(ncushort,unsigned short,ncint,int)
	            break;
                case CASE(NC_USHORT,NC_UINT):
	            ARM(ncushort,unsigned short,ncuint,unsigned int)
	            break;
                case CASE(NC_USHORT,NC_INT64):
	            ARM(ncushort,unsigned short,ncint64,long long)
	            break;
                case CASE(NC_USHORT,NC_UINT64):
	            ARM(ncushort,unsigned short,ncuint64,unsigned long long)
	            break;
                case CASE(NC_USHORT,NC_FLOAT):
	            ARM(ncushort,unsigned short,ncfloat,float)
	            break;
                case CASE(NC_USHORT,NC_DOUBLE):
	            ARM(ncushort,unsigned short,ncdouble,double)
	            break;
                case CASE(NC_INT,NC_CHAR):
	            ARM(ncint,int,ncchar,char)
	            break;
                case CASE(NC_INT,NC_BYTE):
	            ARM(ncint,int,ncbyte,signed char)
	            break;
                case CASE(NC_INT,NC_UBYTE):
	            ARM(ncint,int,ncubyte,unsigned char)
	            break;
                case CASE(NC_INT,NC_SHORT):
	            ARM(ncint,int,ncshort,short)
	            break;
                case CASE(NC_INT,NC_USHORT):
	            ARM(ncint,int,ncushort,unsigned short)
	            break;
                case CASE(NC_INT,NC_UINT):
	            ARM(ncint,int,ncuint,unsigned int)
	            break;
                case CASE(NC_INT,NC_INT64):
	            ARM(ncint,int,ncint64,long long)
	            break;
                case CASE(NC_INT,NC_UINT64):
	            ARM(ncint,int,ncuint64,unsigned long long)
	            break;
                case CASE(NC_INT,NC_FLOAT):
	            ARM(ncint,int,ncfloat,float)
	            break;
                case CASE(NC_INT,NC_DOUBLE):
	            ARM(ncint,int,ncdouble,double)
	            break;
                case CASE(NC_UINT,NC_CHAR):
	            ARM(ncuint,unsigned int,ncchar,char)
	            break;
                case CASE(NC_UINT,NC_BYTE):
	            ARM(ncuint,unsigned int,ncbyte,signed char)
	            break;
                case CASE(NC_UINT,NC_UBYTE):
	            ARM(ncuint,unsigned int,ncubyte,unsigned char)
	            break;
                case CASE(NC_UINT,NC_SHORT):
	            ARM(ncuint,unsigned int,ncshort,short)
	            break;
                case CASE(NC_UINT,NC_USHORT):
	            ARM(ncuint,unsigned int,ncushort,unsigned short)
	            break;
                case CASE(NC_UINT,NC_INT):
	            ARM(ncuint,unsigned int,ncint,int)
	            break;
                case CASE(NC_UINT,NC_INT64):
	            ARM(ncuint,unsigned int,ncint64,long long)
	            break;
                case CASE(NC_UINT,NC_UINT64):
	            ARM(ncuint,unsigned int,ncuint64,unsigned long long)
	            break;
                case CASE(NC_UINT,NC_FLOAT):
	            ARM(ncuint,unsigned int,ncfloat,float)
	            break;
                case CASE(NC_UINT,NC_DOUBLE):
	            ARM(ncuint,unsigned int,ncdouble,double)
	            break;
                case CASE(NC_INT64,NC_CHAR):
	            ARM(ncint64,long long,ncchar,char)
	            break;
                case CASE(NC_INT64,NC_BYTE):
	            ARM(ncint64,long long,ncbyte,signed char)
	            break;
                case CASE(NC_INT64,NC_UBYTE):
	            ARM(ncint64,long long,ncubyte,unsigned char)
	            break;
                case CASE(NC_INT64,NC_SHORT):
	            ARM(ncint64,long long,ncshort,short)
	            break;
                case CASE(NC_INT64,NC_USHORT):
	            ARM(ncint64,long long,ncushort,unsigned short)
	            break;
                case CASE(NC_INT64,NC_INT):
	            ARM(ncint64,long long,ncint,int)
	            break;
                case CASE(NC_INT64,NC_UINT):
	            ARM(ncint64,long long,ncuint,unsigned int)
	            break;
                case CASE(NC_INT64,NC_UINT64):
	            ARM(ncint64,long long,ncuint64,unsigned long long)
	            break;
                case CASE(NC_INT64,NC_FLOAT):
	            ARM(ncint64,long long,ncfloat,float)
	            break;
                case CASE(NC_INT64,NC_DOUBLE):
	            ARM(ncint64,long long,ncdouble,double)
	            break;
                case CASE(NC_UINT64,NC_CHAR):
	            ARM(ncuint64,long long,ncchar,char)
	            break;
                case CASE(NC_UINT64,NC_BYTE):
	            ARM(ncuint64,long long,ncbyte,signed char)
	            break;
                case CASE(NC_UINT64,NC_UBYTE):
	            ARM(ncuint64,long long,ncubyte,unsigned char)
	            break;
                case CASE(NC_UINT64,NC_SHORT):
	            ARM(ncuint64,long long,ncshort,short)
	            break;
                case CASE(NC_UINT64,NC_USHORT):
	            ARM(ncuint64,long long,ncushort,unsigned short)
	            break;
                case CASE(NC_UINT64,NC_INT):
	            ARM(ncuint64,long long,ncint,int)
	            break;
                case CASE(NC_UINT64,NC_UINT):
	            ARM(ncuint64,long long,ncuint,unsigned int)
	            break;
                case CASE(NC_UINT64,NC_FLOAT):
	            ARM(ncuint64,long long,ncfloat,float)
	            break;
                case CASE(NC_UINT64,NC_DOUBLE):
	            ARM(ncuint64,long long,ncdouble,double)
	            break;
                case CASE(NC_FLOAT,NC_CHAR):
	            ARM(ncfloat,float,ncchar,char)
	            break;
                case CASE(NC_FLOAT,NC_BYTE):
	            ARM(ncfloat,float,ncbyte,signed char)
	            break;
                case CASE(NC_FLOAT,NC_UBYTE):
	            ARM(ncfloat,float,ncubyte,unsigned char)
	            break;
                case CASE(NC_FLOAT,NC_SHORT):
	            ARM(ncfloat,float,ncshort,short)
	            break;
                case CASE(NC_FLOAT,NC_USHORT):
	            ARM(ncfloat,float,ncushort,unsigned short)
	            break;
                case CASE(NC_FLOAT,NC_INT):
	            ARM(ncfloat,float,ncint,int)
	            break;
                case CASE(NC_FLOAT,NC_UINT):
	            ARM(ncfloat,float,ncuint,unsigned int)
	            break;
                case CASE(NC_FLOAT,NC_INT64):
	            ARM(ncfloat,float,ncint64,long long)
	            break;
                case CASE(NC_FLOAT,NC_UINT64):
	            ARM(ncfloat,float,ncuint64,unsigned long long)
	            break;
                case CASE(NC_FLOAT,NC_DOUBLE):
	            ARM(ncfloat,float,ncdouble,double)
	            break;
                case CASE(NC_DOUBLE,NC_CHAR):
	            ARM(ncdouble,double,ncchar,char)
	            break;
                case CASE(NC_DOUBLE,NC_BYTE):
	            ARM(ncdouble,double,ncbyte,signed char)
	            break;
                case CASE(NC_DOUBLE,NC_UBYTE):
	            ARM(ncdouble,double,ncubyte,unsigned char)
	            break;
                case CASE(NC_DOUBLE,NC_SHORT):
	            ARM(ncdouble,double,ncshort,short)
	            break;
                case CASE(NC_DOUBLE,NC_USHORT):
	            ARM(ncdouble,double,ncushort,unsigned short)
	            break;
                case CASE(NC_DOUBLE,NC_INT):
	            ARM(ncdouble,double,ncint,int)
	            break;
                case CASE(NC_DOUBLE,NC_UINT):
	            ARM(ncdouble,double,ncuint,unsigned int)
	            break;
                case CASE(NC_DOUBLE,NC_INT64):
	            ARM(ncdouble,double,ncint64,long long)
	            break;
                case CASE(NC_DOUBLE,NC_UINT64):
	            ARM(ncdouble,double,ncuint64,unsigned long long)
	            break;
                case CASE(NC_DOUBLE,NC_FLOAT):
	            ARM(ncdouble,double,ncfloat,float)
	            break;

	        default: return NC_EINVAL;
	        }
	    }
	    value += srcsize;
	    memory += dstsize;
	}
    }
    return NC_NOERR;
}
Example #26
0
void 
MessageFormatRegressionTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
{
    // if (exec) logln((UnicodeString)"TestSuite MessageFormatRegressionTest");
    switch (index) {
        CASE(0,Test4074764)
        CASE(1,Test4058973)
        CASE(2,Test4031438)
        CASE(3,Test4052223)
        CASE(4,Test4104976)
        CASE(5,Test4106659)
        CASE(6,Test4106660)
        CASE(7,Test4111739)
        CASE(8,Test4114743)
        CASE(9,Test4116444)
        CASE(10,Test4114739)
        CASE(11,Test4113018)
        CASE(12,Test4106661)
        CASE(13,Test4094906)
        CASE(14,Test4118592)
        CASE(15,Test4118594)
        CASE(16,Test4105380)
        CASE(17,Test4120552)
        CASE(18,Test4142938)
        CASE(19,TestChoicePatternQuote)
        CASE(20,Test4112104)
        CASE(21,TestAPI)

        default: name = ""; break;
    }
}
Example #27
0
static String
tracePixel(XtermWidget xw, Pixel value)
{
#define CASE(name) { name, #name }
    static struct {
	TermColors code;
	String name;
    } t_colors[] = {
	CASE(TEXT_FG),
	    CASE(TEXT_BG),
	    CASE(TEXT_CURSOR),
	    CASE(MOUSE_FG),
	    CASE(MOUSE_BG),
#if OPT_TEK4014
	    CASE(TEK_FG),
	    CASE(TEK_BG),
#endif
#if OPT_HIGHLIGHT_COLOR
	    CASE(HIGHLIGHT_BG),
	    CASE(HIGHLIGHT_FG),
#endif
#if OPT_TEK4014
	    CASE(TEK_CURSOR),
#endif
    };
    TScreen *screen = TScreenOf(xw);
    String result = 0;
    int n;

    for (n = 0; n < NCOLORS; ++n) {
	if (value == T_COLOR(screen, t_colors[n].code)) {
	    result = t_colors[n].name;
	    break;
	}
    }

    if (result == 0) {
	for (n = 0; n < MAXCOLORS; ++n) {
#if OPT_COLOR_RES
	    if (screen->Acolors[n].mode > 0
		&& value == screen->Acolors[n].value) {
		result = screen->Acolors[n].resource;
		break;
	    }
#else
	    if (value == screen->Acolors[n]) {
		char temp[80];
		sprintf(temp, "Acolors[%d]", n);
		result = x_strdup(temp);
		break;
	    }
#endif
	}
    }

    if (result == 0) {
	char temp[80];
	sprintf(temp, "%#lx", value);
	result = x_strdup(temp);
    }

    return result;
}
Example #28
0
BOOL CSeException::GetErrorMessage(string & CsErrDescr, PUINT pnHelpContext /*= NULL*/)
{
	BOOL rc = TRUE;

	if (pnHelpContext != NULL)
		*pnHelpContext = 0;
	char  buffer[514];
	switch (m_nSeCode)    {   
		CASE(ACCESS_VIOLATION,buffer);
		CASE(DATATYPE_MISALIGNMENT,buffer);
		CASE(BREAKPOINT,buffer);
		CASE(SINGLE_STEP,buffer);
		CASE(ARRAY_BOUNDS_EXCEEDED,buffer);
		CASE(FLT_DENORMAL_OPERAND,buffer);
		CASE(FLT_DIVIDE_BY_ZERO,buffer);
		CASE(FLT_INEXACT_RESULT,buffer);
		CASE(FLT_INVALID_OPERATION,buffer);
		CASE(FLT_OVERFLOW,buffer);
		CASE(FLT_STACK_CHECK,buffer);
		CASE(FLT_UNDERFLOW,buffer);
		CASE(INT_DIVIDE_BY_ZERO,buffer);
		CASE(INT_OVERFLOW,buffer);
		CASE(PRIV_INSTRUCTION,buffer);
		CASE(IN_PAGE_ERROR,buffer);
		CASE(ILLEGAL_INSTRUCTION,buffer);
		CASE(NONCONTINUABLE_EXCEPTION,buffer);
		CASE(STACK_OVERFLOW,buffer);
		CASE(INVALID_DISPOSITION,buffer);
		CASE(GUARD_PAGE,buffer);
		CASE(INVALID_HANDLE,buffer);
	default:
		CsErrDescr = _T("Unknown exception.");
		rc = FALSE;
		break;
	}
	
	CsErrDescr=buffer;

	g_log.log(CsErrDescr.c_str(),DEBUG_ONLY_LEVEL);
	return rc;
}
Example #29
0
static String restrictionName(MediaElementSession::BehaviorRestrictions restriction)
{
    StringBuilder restrictionBuilder;
#define CASE(restrictionType) \
    if (restriction & MediaElementSession::restrictionType) { \
        if (!restrictionBuilder.isEmpty()) \
            restrictionBuilder.append(", "); \
        restrictionBuilder.append(#restrictionType); \
    } \

    CASE(NoRestrictions);
    CASE(RequireUserGestureForLoad);
    CASE(RequireUserGestureForVideoRateChange);
    CASE(RequireUserGestureForAudioRateChange);
    CASE(RequireUserGestureForFullscreen);
    CASE(RequirePageConsentToLoadMedia);
    CASE(RequirePageConsentToResumeMedia);
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
    CASE(RequireUserGestureToShowPlaybackTargetPicker);
    CASE(WirelessVideoPlaybackDisabled);
#endif
    CASE(RequireUserGestureForAudioRateChange);
    CASE(InvisibleAutoplayNotPermitted);
    CASE(OverrideUserGestureRequirementForMainContent);

    return restrictionBuilder.toString();
}
Example #30
0
static const char *
xloper_type_name (const XLOPER*x)
{
	if (NULL != x) {
		switch (x->xltype & xltypeType) {
		CASE(xltypeNum);
		CASE(xltypeStr);
		CASE(xltypeBool);
		CASE(xltypeRef);
		CASE(xltypeErr);
		CASE(xltypeFlow);
		CASE(xltypeMulti);
		CASE(xltypeMissing);
		CASE(xltypeNil);
		CASE(xltypeSRef);
		CASE(xltypeInt);
		default: return "<unknown>";
		}
	}
	return "(nil)";
}