本文整理汇总了C++中CASE函数的典型用法代码示例。如果您正苦于以下问题:C++ CASE函数的具体用法?C++ CASE怎么用?C++ CASE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CASE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hook_to_str
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_???");
}
}
示例2: traceCgsEnum
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;
}
示例3: BuildErrorMessage
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 );
}
示例4: dapconvert
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)
//.........这里部分代码省略.........
示例5: CASE
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);
//.........这里部分代码省略.........
示例6: switch
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;
}
}
示例7: _gdk_win32_rop2_to_string
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;
}
示例8: _gdk_win32_message_to_string
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);
//.........这里部分代码省略.........
示例9: _gdk_win32_cf_to_string
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);
}
}
示例10: _gdk_win32_function_to_string
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;
}
示例11: ACS_translateThingVarACS0
//
// 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
}
示例12: ACS_translateFuncACS0
//
// 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;
}
示例13: make_langid
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);
}
示例14: main
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) {
//.........这里部分代码省略.........
示例15: CASE
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());
}