这篇教程C++ stricmp函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stricmp函数的典型用法代码示例。如果您正苦于以下问题:C++ stricmp函数的具体用法?C++ stricmp怎么用?C++ stricmp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stricmp函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ifFState *FStateDefinitions::ResolveGotoLabel (AActor *actor, PClassActor *mytype, char *name){ PClassActor *type = mytype; FState *state; char *namestart = name; char *label, *offset, *pt; int v; // Check for classname if ((pt = strstr (name, "::")) != NULL) { const char *classname = name; *pt = '/0'; name = pt + 2; // The classname may either be "Super" to identify this class's immediate // superclass, or it may be the name of any class that this one derives from. if (stricmp (classname, "Super") == 0) { type = dyn_cast<PClassActor>(type->ParentClass); actor = GetDefaultByType(type); } else { // first check whether a state of the desired name exists PClass *stype = PClass::FindClass (classname); if (stype == NULL) { I_Error ("%s is an unknown class.", classname); } if (!stype->IsDescendantOf (RUNTIME_CLASS(AActor))) { I_Error ("%s is not an actor class, so it has no states.", stype->TypeName.GetChars()); } if (!stype->IsAncestorOf (type)) { I_Error ("%s is not derived from %s so cannot access its states.", type->TypeName.GetChars(), stype->TypeName.GetChars()); } if (type != stype) { type = static_cast<PClassActor *>(stype); actor = GetDefaultByType (type); } } } label = name; // Check for offset offset = NULL; if ((pt = strchr (name, '+')) != NULL) { *pt = '/0'; offset = pt + 1; } v = offset ? strtol (offset, NULL, 0) : 0; // Get the state's address. if (type == mytype) { state = FindState (label); } else { state = type->FindStateByString(label, true); } if (state != NULL) { state += v; } else if (v != 0) { I_Error ("Attempt to get invalid state %s from actor %s.", label, type->TypeName.GetChars()); } else { Printf (TEXTCOLOR_RED "Attempt to get invalid state %s from actor %s./n", label, type->TypeName.GetChars()); } delete[] namestart; // free the allocated string buffer return state;}
开发者ID:Jayman2000,项目名称:zdoom-pull,代码行数:81,
示例2: stricmpbool SString::BeginsWithI(const SString& strOther) const{ return stricmp(Left((int)strOther.length()), strOther) == 0;}
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:4,
示例3: findTokenIdstatic TA_RetCode findTokenId( TA_Libc *libHandle, const char *str, TA_TokenId *id, TA_Integer *optionalParam ){ TA_PROLOG; unsigned int i; const char *cmp_str; TA_TokenId tokenId; unsigned int extractedParam; TA_RetCode retCode; TA_TRACE_BEGIN( libHandle, findTokenId ); *id = TA_TOK_END; *optionalParam = 0; tokenId = TA_TOK_END; extractedParam = 0; /* First check for token directly mapping to a simple string. */ for( i=0; (i < TA_NB_TOKEN_ID) && (tokenId == TA_TOK_END); i++ ) { cmp_str = TA_TokenString( libHandle, (TA_TokenId)i ); if( cmp_str ) { #if defined( WIN32 ) if( stricmp( str, cmp_str ) == 0 ) #else if( strcasecmp( str, cmp_str ) == 0 ) #endif { tokenId = (TA_TokenId)i; extractedParam = 1; } } } /* If not found, look for more advanced token taking * optional "=n" parameters. */ if( tokenId == TA_TOK_END ) { retCode = findTokenIdWithParam( libHandle, &str[0], &tokenId, &extractedParam ); if( retCode != TA_SUCCESS ) { TA_TRACE_RETURN( retCode ); } } /* Make sure it is a valid field for a file description. */ switch( tokenId ) { case TA_TOK_YYYY: case TA_TOK_YY: case TA_TOK_Y: case TA_TOK_M: case TA_TOK_MM: case TA_TOK_MMM: case TA_TOK_D: case TA_TOK_DD: case TA_TOK_OPEN: case TA_TOK_HIGH: case TA_TOK_LOW: case TA_TOK_CLOSE: case TA_TOK_VOLUME: case TA_TOK_OPENINTEREST: case TA_TOK_HOUR: case TA_TOK_MIN: case TA_TOK_SEC: case TA_TOK_HH: case TA_TOK_MN: case TA_TOK_SS: case TA_TOK_SKIP_N_CHAR: case TA_TOK_SKIP_N_HEADER_LINE: case TA_TOK_SKIP_N_REAL: case TA_TOK_SKIP_N_INTEGER: break; default: TA_TRACE_RETURN( TA_INVALID_FIELD ); } /* Everything is fine, return the information. */ *id = tokenId; *optionalParam = extractedParam; TA_TRACE_RETURN( TA_SUCCESS );}
开发者ID:royratcliffe,项目名称:ta-lib,代码行数:90,
示例4: Cmd_Argv//-----------------------------------------------------------------------------// Purpose: Handle "cd" console command//-----------------------------------------------------------------------------void CCDAudio::CD_f ( void ){ char *command; int ret; int n; if ( Cmd_Argc() < 2 ) return; command = Cmd_Argv (1); if (stricmp(command, "on") == 0) { m_bEnabled = true; return; } if (stricmp(command, "off") == 0) { if (m_bIsPlaying) Stop(); m_bEnabled = false; return; } if (stricmp(command, "reset") == 0) { m_bEnabled = true; if (m_bIsPlaying) Stop(); for (n = 0; n < 100; n++) m_rgRemapCD[n] = n; GetAudioDiskInfo(); return; } if (stricmp(command, "remap") == 0) { ret = Cmd_Argc() - 2; if ( ret > 0) { for (n = 1; n <= ret; n++) { m_rgRemapCD[n] = atoi(Cmd_Argv (n+1)); } } return; } if (stricmp(command, "close") == 0) { CloseDoor(); return; } if (!m_bIsValid) { GetAudioDiskInfo(); if (!m_bIsValid) { return; } } if (stricmp(command, "play") == 0) { Play( atoi(Cmd_Argv (2)), false ); return; } if (stricmp(command, "loop") == 0) { Play( atoi(Cmd_Argv (2)), true ); return; } if (stricmp(command, "stop") == 0) { Stop(); return; } if (stricmp(command, "pause") == 0) { Pause(); return; } if (stricmp(command, "resume") == 0) { Resume(); return; } if (stricmp(command, "eject") == 0) { if (m_bIsPlaying)//.........这里部分代码省略.........
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:101,
示例5: whileint WinEDA_BasePcbFrame::ReadGeneralDescrPcb(wxDC * DC, FILE * File, int * LineNum)/**********************************************************************************/{char Line[1024], *data;BASE_SCREEN * screen = m_CurrentScreen; while( GetLine(File, Line, LineNum ) != NULL ) { data = strtok(Line," =/n/r"); if(strnicmp(data,"$EndGENERAL",10) == 0) break; if( strncmp(data, "Ly", 2) == 0 ) // Old format for Layer count { int Masque_Layer = 1, ii; data = strtok(NULL," =/n/r"); sscanf(data,"%X",&Masque_Layer); // Setup layer count m_Pcb->m_BoardSettings->m_CopperLayerCount = 0; for ( ii = 0; ii < NB_COPPER_LAYERS; ii++ ) { if ( Masque_Layer & 1 ) m_Pcb->m_BoardSettings->m_CopperLayerCount++; Masque_Layer >>= 1; } continue; } if(strnicmp(data, "Links", 5) == 0) { data = strtok(NULL," =/n/r"); m_Pcb->m_NbLinks = atoi(data); continue; } if(strnicmp(data, "NoConn", 6) == 0) { data = strtok(NULL," =/n/r"); m_Pcb->m_NbNoconnect = atoi(data); continue; } if(strnicmp(data, "Di", 2) == 0) { int ii, jj, bestzoom; wxSize pcbsize, screensize; data = strtok(NULL," =/n/r"); m_Pcb->m_BoundaryBox.SetX(atoi(data)); data = strtok(NULL," =/n/r"); m_Pcb->m_BoundaryBox.SetY(atoi(data)); data = strtok(NULL," =/n/r"); m_Pcb->m_BoundaryBox.SetWidth(atoi(data) - m_Pcb->m_BoundaryBox.GetX()); data = strtok(NULL," =/n/r"); m_Pcb->m_BoundaryBox.SetHeight(atoi(data) - m_Pcb->m_BoundaryBox.GetY()); /* calcul du zoom optimal */ pcbsize = m_Pcb->m_BoundaryBox.GetSize(); screensize = DrawPanel->GetClientSize(); ii = pcbsize.x/screensize.x; jj = pcbsize.y/screensize.y; bestzoom = max(ii, jj); screen->m_Curseur = m_Pcb->m_BoundaryBox.Centre(); screen->SetZoom(bestzoom); // la position des tracés a changé: mise a jour dans le DC courant wxPoint org; DrawPanel->GetViewStart(&org.x, &org.y); DrawPanel->GetScrollPixelsPerUnit(&ii, &jj); org.x *= ii; org.y *= jj;#ifdef WX_ZOOM DC->SetUserScale(1.0/(double)screen->GetZoom(), 1.0/screen->GetZoom()); org.x *= screen->GetZoom(); org.y *= screen->GetZoom(); DC->SetDeviceOrigin(-org.x, -org.y);#endif DrawPanel->SetBoundaryBox(); Recadre_Trace(TRUE); continue; } /* Lecture du nombre de segments type DRAW , TRACT, ZONE */ if(stricmp(data, "Ndraw") == 0) { data = strtok(NULL," =/n/r"); NbDraw = atoi(data);; continue; } if(stricmp(data, "Ntrack") == 0) { data = strtok(NULL," =/n/r"); NbTrack = atoi(data); continue; } if(stricmp(data, "Nzone") == 0) { data = strtok(NULL," =/n/r"); NbZone = atoi(data); continue; } if(stricmp(data, "Nmodule") == 0)//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:101,
示例6: PLP_scatterplot//.........这里部分代码省略.........strcpy( textdetails, "" );lblfield = -1;strcpy( selex, "" );sizefield = -1;sizescale = 0.5/72.0; /* correspond roughly with pt size */clusterfact = 0.01;verttext = 0;strcpy( legendlabel, "" );strcpy( xrange, "" );strcpy( yrange, "" );clustevery = 0;clusterdiff = 0.001;clustermeth = 0;symfield = -1;dupsleg = 0;symfield_userange = 0;strcpy( mapurl, "" ); strcpy( expurl, "" );strcpy( maplabel, "" ); strcpy( explabel, "" );dorect = 0;rectoutline = 0;linedir = reqlinedir = '/0'; /* scg 3/4/03 */clickmap_on = 0;strcpy( labelword, "@VAL" );vennden = 0.0;/* get attributes.. */first = 1;while( 1 ) { line = getnextattr( first, attr, val, &lvp, &nt ); if( line == NULL ) break; first = 0; lineval = &line[lvp]; if( stricmp( attr, "xfield" )==0 ) xfield = fref( val ) -1; else if( stricmp( attr, "yfield" )==0 ) yfield = fref( val ) -1; else if( stricmp( attr, "labelfield" )==0 ) lblfield = fref( val ) -1; else if( stricmp( attr, "symbol" )==0 ) strcpy( symbol, lineval ); else if( stricmp( attr, "text" )==0 ) strcpy( text, val ); else if( stricmp( attr, "textdetails" )==0 ) strcpy( textdetails, lineval ); else if( stricmp( attr, "sizefield" )==0 ) sizefield = fref( val ) -1; else if( stricmp( attr, "sizescale" )==0 ) sizescale = atof( val ) * 0.5/72.0; else if( stricmp( attr, "xrange" )==0 ) strcpy( xrange, lineval ); else if( stricmp( attr, "yrange" )==0 ) strcpy( yrange, lineval ); else if( stricmp( attr, "clickmapurl" )==0 ) { if( PLS.clickmap ) { strcpy( mapurl, val ); clickmap_on = 1; } } else if( stricmp( attr, "clickmaplabel" )==0 ) { if( PLS.clickmap ) { strcpy( maplabel, lineval ); clickmap_on = 1; } } else if( stricmp( attr, "clickmaplabeltext" )==0 ) { if( PLS.clickmap ) { getmultiline( "clickmaplabeltext", lineval, MAXTT, maplabel ); clickmap_on = 1; } } else if( stricmp( attr, "linelen" )==0 ) { if( val[0] == '/0' ) linelen = -1.0; else { linelen = atof( val ); if( PLS.usingcm ) linelen /= 2.54; } } else if( stricmp( attr, "linedir" )==0 ) reqlinedir = tolower( val[0] ); else if( stricmp( attr, "linedetails" )==0 ) strcpy( linedetails, lineval );
开发者ID:skrieder,项目名称:falkon,代码行数:66,
示例7: AddInfoTextvoid ModelPoseDebugInfo::AddInfoText( InfoText *x, ModelPoseDebugInfo *pOld ){ if ( x ) { // Try to set the proper flags on the info text x->m_uiFlags &= ~F_SEEN_LAST_FRAME; x->m_uiFlags |= F_SEEN_THIS_FRAME; } // If we have smth to compare against if ( pOld ) { // Search for the same activity/label in the other model pose debug info ModelPoseDebugInfo &o = *pOld; int k = o.m_iCurrentText; if ( x ) { for ( ; k < o.m_arrTxt.Count(); ++ k ) { InfoText &txt = o.m_arrTxt[k]; if ( ( txt.m_uiFlags & F_SEEN_THIS_FRAME ) && !stricmp( x->m_chActivity, txt.m_chActivity ) && !stricmp( x->m_chLabel, txt.m_chLabel ) && ( x->m_iActivity == txt.m_iActivity ) ) { x->m_flTimeAlive = txt.m_flTimeAlive; break; } } } else { k = o.m_arrTxt.Count(); } // Range of finished activities int iFinishedRange[2] = { o.m_iCurrentText, k }; // Check whether this is a new message if ( k == o.m_arrTxt.Count() ) { if ( !x ) { o.m_iCurrentText = k; } else { // Don't update the current when insertion happens and don't have finished commands iFinishedRange[1] = iFinishedRange[0]; } } else { o.m_iCurrentText = k + 1; if ( x ) { x->m_uiFlags |= F_SEEN_LAST_FRAME; x->m_flTimeAlive += gpGlobals->frametime; } } // Everything before finished for ( int iFinished = iFinishedRange[0]; iFinished < iFinishedRange[1]; ++ iFinished ) { InfoText &txtFinished = o.m_arrTxt[ iFinished ]; if ( txtFinished.m_uiFlags & F_SEEN_THIS_FRAME ) txtFinished.m_uiFlags |= F_SEEN_LAST_FRAME; txtFinished.m_uiFlags &= ~F_SEEN_THIS_FRAME; txtFinished.m_flTimeToLive -= gpGlobals->frametime; txtFinished.m_flTimeAlive += gpGlobals->frametime; if ( txtFinished.m_flTimeToLive >= 0.0f ) m_arrTxt.AddToTail( txtFinished ); } } if ( x ) { // Now add it to the array x->m_flTimeToLive = ui_posedebug_fade_out_time.GetFloat(); m_arrTxt.AddToTail( *x ); }}
开发者ID:AeroHand,项目名称:dota2-lua-engine,代码行数:86,
示例8: ChangeLevel/*==============ChangeLevelServer is changing to a new level, check mapcycle.txt for map name and setup info==============*/void CHalfLifeMultiplay :: ChangeLevel( void ){ static char szPreviousMapCycleFile[ 256 ]; static mapcycle_t mapcycle; char szNextMap[32]; char szFirstMapInList[32]; char szCommands[ 1500 ]; char szRules[ 1500 ]; int minplayers = 0, maxplayers = 0; strcpy( szFirstMapInList, "hldm1" ); // the absolute default level is hldm1 int curplayers; BOOL do_cycle = TRUE; // find the map to change to char *mapcfile = (char*)CVAR_GET_STRING( "mapcyclefile" ); ASSERT( mapcfile != NULL ); szCommands[ 0 ] = '/0'; szRules[ 0 ] = '/0'; curplayers = CountPlayers(); // Has the map cycle filename changed? if ( stricmp( mapcfile, szPreviousMapCycleFile ) ) { strcpy( szPreviousMapCycleFile, mapcfile ); DestroyMapCycle( &mapcycle ); if ( !ReloadMapCycleFile( mapcfile, &mapcycle ) || ( !mapcycle.items ) ) { ALERT( at_console, "Unable to load map cycle file %s/n", mapcfile ); do_cycle = FALSE; } } if ( do_cycle && mapcycle.items ) { BOOL keeplooking = FALSE; BOOL found = FALSE; mapcycle_item_s *item; // Assume current map strcpy( szNextMap, STRING(gpGlobals->mapname) ); strcpy( szFirstMapInList, STRING(gpGlobals->mapname) ); // Traverse list for ( item = mapcycle.next_item; item->next != mapcycle.next_item; item = item->next ) { keeplooking = FALSE; ASSERT( item != NULL ); if ( item->minplayers != 0 ) { if ( curplayers >= item->minplayers ) { found = TRUE; minplayers = item->minplayers; } else { keeplooking = TRUE; } } if ( item->maxplayers != 0 ) { if ( curplayers <= item->maxplayers ) { found = TRUE; maxplayers = item->maxplayers; } else { keeplooking = TRUE; } } if ( keeplooking ) continue; found = TRUE; break; } if ( !found ) { item = mapcycle.next_item; } //.........这里部分代码省略.........
开发者ID:6779660,项目名称:halflife,代码行数:101,
示例9: mainvoid main( int argc, char *argv[] ) {//====================================== int rc; char *wfl_env; char *p; char *q; char *cmd; argc = argc; __InitResource(); __ErrorInit( argv[0] ); CmpOpts[0] = '/0'; SwitchChars[0] = '-'; SwitchChars[1] = _dos_switch_char(); SwitchChars[2] = '/0'; Word = MemAlloc( MAX_CMD ); cmd = MemAlloc( 2*MAX_CMD ); // for "WFL" environment variable and command line // add "WFL" environment variable to "cmd" unless "/y" is specified // in "cmd" or the "WFL" environment string wfl_env = getenv( WFLENV ); if( wfl_env != NULL ) { strcpy( cmd, wfl_env ); strcat( cmd, " " ); p = cmd + strlen( cmd ); getcmd( p ); for( q = cmd; (q = strpbrk( q, SwitchChars )) != NULL; ) { if( tolower( *(++q) ) == 'y' ) { getcmd( cmd ); p = cmd; break; } } } else { getcmd( cmd ); p = cmd; } p = SkipSpaces( p ); if( ( *p == '/0' ) || ( strncmp( p, "? ", 2 ) == NULL ) ) { Usage(); rc = 1; } else { Fp = fopen( TEMPFILE, "w" ); if( Fp == NULL ) { PrintMsg( CL_ERROR_OPENING_TMP_FILE ); rc = 1; } else { ObjName = NULL; rc = Parse( cmd ); if( rc == 0 ) { if( !Flags.quiet ) { PrtBanner(); } rc = CompLink(); } if( rc == 1 ) fclose( Fp ); if( LinkName != NULL ) { if( stricmp( LinkName, TEMPFILE ) != 0 ) { remove( LinkName ); rename( TEMPFILE, LinkName ); } } else { remove( TEMPFILE ); } } } free( Word ); free( cmd ); wfl_exit( rc == 0 ? 0 : 1 );}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:77,
示例10: Parse//.........这里部分代码省略......... } break; case 'k': // stack size option if( ( Word[0] == '=' ) || ( Word[0] == '#' ) ) { fputs( "option stack=", Fp ); Fputnl( Word + 1, Fp ); cmp_option = 0; } break; case 'c': // compile only if( Word[0] == '/0' ) { Flags.no_link = 1; cmp_option = 0; } break; case 'y': if( Word[0] == '/0' ) { cmp_option = 0; } break; case 'p': // ignore the /p option - we now only // have a protect-mode compiler if( Word[0] == '/0' ) { cmp_option = 0; } break; case 'l': if( ( Word[0] == '=' ) || ( Word[0] == '#' ) ) { Flags.link_for_sys = 1; SystemName = strdup( &Word[1] ); cmp_option = 0;#if _CPU == 8086 } else if( stricmp( Word, "r" ) == 0 ) { Flags.link_for_dos = 1; Flags.link_for_os2 = 0; cmp_option = 0; } else if( stricmp( Word, "p" ) == 0 ) { Flags.link_for_os2 = 1; Flags.link_for_dos = 0; cmp_option = 0;#endif } break; case '"': Fputnl( &Word[0], Fp ); ++end; // skip over closing quote cmp_option = 0; break; // compiler options that affect the linker#if _CPU != 8086 case 'b': if( stricmp( Word, "w" ) ) { Flags.default_win = 1; } break;#endif case 'q': if( IsOption( cmd, len + sizeof(char), "Quiet" ) ) { Flags.quiet = 1; } break; case 'd':
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:67,
示例11: ReadSettingsint ReadSettings(ONScripterLabel *pOns, const char *file){ FILE *fp; char key[256]; char value[256]; int rt; //FILE *fp2;#if defined(PSP) int value_int; putenv("SDL_ASPECT_RATIO=4:3");#endif fp = fopen(file,"rt"); //fp2 = fopen("setting.log","wb"); if (!fp) return -1; while (!feof(fp)) { rt = fscanf(fp, "%[^=/n]=%[^=/n]/n", key, value); if (rt==0 || rt==EOF) break; //fprintf(fp2, "KEY=%s, VALUE=%s/n", key, value); if (!stricmp(key, "FONT")) { pOns->setFontFile(value); } else if (!stricmp(key, "registry")) { pOns->setRegistryFile(value); } else if (!stricmp(key, "dll")) { pOns->setDLLFile(value); } else if (!stricmp(key, "root")) { pOns->setArchivePath(value); } else if (!stricmp(key, "fullscreen")) { if (!stricmp(value, "yes")) pOns->setFullscreenMode(); else if (!stricmp(value, "no")) pOns->setWindowMode(); } #if defined(PSP) if (!stricmp(key, "RESOLUTION")) { value_int = atoi(value); if (value_int > 0 && value_int <= 360) os_screen_width=value_int; } else if (!stricmp(key, "SCREENSIZE")) { if (!stricmp(value,"NORMAL")) { putenv("SDL_ASPECT_RATIO=4:3"); } else if (!stricmp(value,"FULL")) { putenv("SDL_ASPECT_RATIO="); } } else if (!stricmp(key, "CPUCLOCK")) { value_int = atoi(value); if (value_int > 0 && value_int <= 333) scePowerSetCpuClockFrequency(value_int); } else if (!stricmp(key, "BUSCLOCK")) { value_int = atoi(value); if (value_int > 0 && value_int <= 167) scePowerSetBusClockFrequency(value_int); } else if (!stricmp(key, "LMB_ONCE")) { MapButton(SDLK_SPACE, value); } else if (!stricmp(key, "LMB")) { MapButton(SDLK_RETURN, value); } else if (!stricmp(key, "RMB")) { MapButton(SDLK_ESCAPE, value); } else if (!stricmp(key, "CURSOR_PREV")) { MapButton(SDLK_UP ,value); } else if (!stricmp(key, "CURSOR_NEXT")) { MapButton(SDLK_DOWN, value); } else if (!stricmp(key, "SKIP")) {//.........这里部分代码省略.........
开发者ID:nuo0024,项目名称:onscripter-zh,代码行数:101,
示例12: m_currentChapterTutorial::Tutorial( int _startChapter ): m_currentChapter(-1), m_nextChapter(-1), m_nextChapterTimer(0.0f), m_objectHighlight(-1), m_miscTimer(-1.0f), m_worldInitialised(false), m_startLevel(_startChapter){ m_levelName[0] = '/x0'; SetCurrentLevel(1); // // Parse the tutorial data file TextReader *reader = g_fileSystem->GetTextReader( "data/tutorial.txt" ); AppAssert( reader && reader->IsOpen() ); while( reader->ReadLine() ) { if( !reader->TokenAvailable() ) continue; char *chapterHeading = reader->GetNextToken(); AppAssert( stricmp( chapterHeading, "CHAPTER" ) == 0 ); TutorialChapter *chapter = new TutorialChapter(); m_chapters.PutData( chapter ); chapter->m_name = strdup( reader->GetNextToken() ); char temp[256]; sprintf( temp, "tutorial_%s", chapter->m_name ); chapter->m_message = strdup( temp ); sprintf( temp, "tutorial_%s_obj", chapter->m_name ); chapter->m_objective = strdup( temp ); while( reader->ReadLine() ) { if( !reader->TokenAvailable() ) continue; char *field = reader->GetNextToken(); if( stricmp( field, "END" ) == 0 ) break; char *value = reader->GetRestOfLine(); if( value ) value[ strlen(value) - 1 ] = '/x0'; if( stricmp( field, "MESSAGE" ) == 0 ) chapter->m_message = strdup(value); if( stricmp( field, "OBJECTIVE" ) == 0 ) chapter->m_objective = strdup(value); if( stricmp( field, "WINDOWHIGHLIGHT" ) == 0 ) chapter->m_windowHighlight = strdup(value); if( stricmp( field, "BUTTONHIGHLIGHT" ) == 0 ) chapter->m_buttonHighlight = strdup(value); if( stricmp( field, "NEXTCLICKABLE" ) == 0 ) { chapter->m_nextClickable = true; chapter->m_objective = strdup( "tutorial_clicknext" ); } if( stricmp( field, "RESTARTCLICKABLE" ) == 0 ) { chapter->m_restartClickable = true; chapter->m_objective = strdup("tutorial_restart_mission"); } } }}
开发者ID:BITINT,项目名称:DEFCON2,代码行数:63,
示例13: get_option/*---------------------------------------------------------------------- Parameters: Description: ----------------------------------------------------------------------*/static intget_option(int argc, char *argv[]){ int nargs = 0 ; char *option ; option = argv[1] + 1 ; /* past '-' */ if (!stricmp(option, "dt")) { } else if (!stricmp(option, "debug_voxel")) { Gx = atoi(argv[2]) ; Gy = atoi(argv[3]) ; Gz = atoi(argv[4]) ; nargs = 3 ; printf("debugging voxel (%d, %d, %d)/n", Gx, Gy, Gz) ; } else if (!stricmp(option, "remove")) { lta = LTAread(argv[2]) ; if (lta == NULL) ErrorExit(ERROR_NOFILE, "%s: could not read transform from %s/n", Progname, argv[2]) ; printf("removing determinant of transform %s/n", argv[2]) ; nargs = 1 ; } else if (!stricmp(option, "tm3d")) { tm3dfile = 1; printf("The input morph originated from a tm3d (mri_cvs_register file)./n") ; } else switch (toupper(*option)) { case 'A': atlas = 1 ; printf("outputing in atlas coords/n") ; break ; case 'W': write_areas = 1 ; printf("writing area volumes/n") ; break ; case 'L': use_log = 1 ; printf("taking log of jacobian values before saving/n") ; break ; case 'S': sigma = atof(argv[2]) ; printf("smoothing jacobian volume with sigma=%2.2f/n", sigma) ; nargs = 1 ; break ; case 'Z': zero_mean = 1 ; use_log = 1 ; printf("making log jacobian zero mean/n") ; break ; case '?': case 'U': usage_exit(0) ; break ; default: fprintf(stderr, "unknown option %s/n", argv[1]) ; exit(1) ; break ; } return(nargs) ;}
开发者ID:ewong718,项目名称:freesurfer,代码行数:70,
示例14: ExportImagesFromDictionarystatic void ExportImagesFromDictionary( rw::TexDictionary *texDict, CFileTranslator *outputRoot, const filePath& txdFileName, const filePath& relPathFromRoot, MassExportModule::eOutputType outputType, const std::string& imgFormat){ rw::Interface *rwEngine = texDict->GetEngine(); for ( rw::TexDictionary::texIter_t iter( texDict->GetTextureIterator() ); !iter.IsEnd(); iter.Increment() ) { rw::TextureBase *texHandle = iter.Resolve(); if ( rw::Raster *texRaster = texHandle->GetRaster() ) { // Construct the target filename. filePath targetFileName = relPathFromRoot; if ( outputType == MassExportModule::OUTPUT_PLAIN ) { // We are a plain path, which is just the texture name appended. } else if ( outputType == MassExportModule::OUTPUT_TXDNAME ) { // Also put the TexDictionary name before it. targetFileName += txdFileName; targetFileName += "_"; } else if ( outputType == MassExportModule::OUTPUT_FOLDERS ) { // Instead put it inside folders. targetFileName += txdFileName; targetFileName += "/"; } targetFileName += texHandle->GetName(); targetFileName += "."; std::string lower_ext = imgFormat; std::transform( lower_ext.begin(), lower_ext.end(), lower_ext.begin(), ::tolower ); targetFileName += lower_ext; // Create the target stream. CFile *targetStream = outputRoot->Open( targetFileName, "wb" ); if ( targetStream ) { try { rw::Stream *rwStream = RwStreamCreateTranslated( rwEngine, targetStream ); if ( rwStream ) { try { // Write it! try { if ( stricmp( imgFormat.c_str(), "RWTEX" ) == 0 ) { rwEngine->Serialize( texHandle, rwStream ); } else { texRaster->writeImage( rwStream, imgFormat.c_str() ); } } catch( rw::RwException& ) { // If we failed to write it, just live with it. } } catch( ... ) { rwEngine->DeleteStream( rwStream ); throw; } rwEngine->DeleteStream( rwStream ); } } catch( ... ) { delete targetStream; throw; } delete targetStream; } } }}
开发者ID:basecq,项目名称:magic-txd,代码行数:95,
示例15: GetToken//.........这里部分代码省略......... // strip single line comments if (*script->script_p == ';' || *script->script_p == '#' || // semicolon and # is comment field (*script->script_p == '/' && *((script->script_p)+1) == '/')) // also make // a comment field { if (!crossline) Error ("Line %i is incomplete/n",scriptline); while (*script->script_p++ != '/n') { if (script->script_p >= script->end_p) { return EndOfScript (crossline); } } scriptline = ++script->line; goto skipspace; } // strip out matching /* */ comments if (*script->script_p == '/' && *((script->script_p)+1) == '*') { script->script_p += 2; while (*script->script_p != '*' || *((script->script_p)+1) != '/') { if (*script->script_p++ != '/n') { if (script->script_p >= script->end_p) { return EndOfScript (crossline); } scriptline = ++script->line; } } script->script_p += 2; goto skipspace; } // copy token to buffer token_p = token; if (*script->script_p == '"') { // quoted token script->script_p++; while (*script->script_p != '"') { *token_p++ = *script->script_p++; if (script->script_p == script->end_p) break; if (token_p == &token[MAXTOKEN]) Error ("Token too large on line %i/n",scriptline); } script->script_p++; } else // regular token while ( *script->script_p > 32 && *script->script_p != ';') { if ( !ExpandMacroToken( token_p ) ) { if ( !ExpandVariableToken( token_p ) ) { *token_p++ = *script->script_p++; if (script->script_p == script->end_p) break; if (token_p == &token[MAXTOKEN]) Error ("Token too large on line %i/n",scriptline); } } } // add null to end of token *token_p = 0; // check for other commands if (!stricmp (token, "$include")) { GetToken (false); AddScriptToStack (token); return GetToken (crossline); } else if (!stricmp (token, "$definemacro")) { GetToken (false); DefineMacro(token); return GetToken (crossline); } else if (!stricmp (token, "$definevariable")) { GetToken (false); DefineVariable(token); return GetToken (crossline); } else if (AddMacroToStack( token )) { return GetToken (crossline); } return true;}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:101,
示例16: strcasecmpint strcasecmp(const char* s1, const char* s2){ return stricmp(s1, s2);}
开发者ID:Aj0Ay,项目名称:lldb,代码行数:4,
示例17: GetExprToken//.........这里部分代码省略......... } if (script->script_p >= script->end_p) return EndOfScript (crossline); tokenready = false;//// skip space//skipspace: while (*script->script_p <= 32) { if (script->script_p >= script->end_p) return EndOfScript (crossline); if (*script->script_p++ == '/n') { if (!crossline) Error ("Line %i is incomplete/n",scriptline); scriptline = ++script->line; } } if (script->script_p >= script->end_p) return EndOfScript (crossline); if (*script->script_p == ';' || *script->script_p == '#' || // semicolon and # is comment field (*script->script_p == '/' && *((script->script_p)+1) == '/')) // also make // a comment field { if (!crossline) Error ("Line %i is incomplete/n",scriptline); while (*script->script_p++ != '/n') if (script->script_p >= script->end_p) return EndOfScript (crossline); goto skipspace; }//// copy token// token_p = token; if (*script->script_p == '"') { // quoted token script->script_p++; while (*script->script_p != '"') { *token_p++ = *script->script_p++; if (script->script_p == script->end_p) break; if (token_p == &token[MAXTOKEN]) Error ("Token too large on line %i/n",scriptline); } script->script_p++; } else { if ( isalpha( *script->script_p ) || *script->script_p == '_' ) { // regular token while ( isalnum( *script->script_p ) || *script->script_p == '_' ) { *token_p++ = *script->script_p++; if (script->script_p == script->end_p) break; if (token_p == &token[MAXTOKEN]) Error ("Token too large on line %i/n",scriptline); } } else if ( isdigit( *script->script_p ) || *script->script_p == '.' ) { // regular token while ( isdigit( *script->script_p ) || *script->script_p == '.' ) { *token_p++ = *script->script_p++; if (script->script_p == script->end_p) break; if (token_p == &token[MAXTOKEN]) Error ("Token too large on line %i/n",scriptline); } } else { // single char *token_p++ = *script->script_p++; } } *token_p = 0; if (!stricmp (token, "$include")) { GetToken (false); AddScriptToStack (token); return GetToken (crossline); } return true;}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:101,
示例18: Host_Say//// HOST_SAY// String comes in as// say blah blah blah// or as// blah blah blah//void Host_Say( edict_t *pEntity, int teamonly ){ CBasePlayer *client; int j; char *p; char text[128]; char szTemp[256]; const char *cpSay = "say"; const char *cpSayTeam = "say_team"; const char *pcmd = CMD_ARGV(0); // We can get a raw string now, without the "say " prepended if ( CMD_ARGC() == 0 ) return; entvars_t *pev = &pEntity->v; CBasePlayer* player = GetClassPtr((CBasePlayer *)pev); //Not yet. if ( player->m_flNextChatTime > gpGlobals->time ) return; if ( !stricmp( pcmd, cpSay) || !stricmp( pcmd, cpSayTeam ) ) { if ( CMD_ARGC() >= 2 ) { p = (char *)CMD_ARGS(); } else { // say with a blank message, nothing to do return; } } else // Raw text, need to prepend argv[0] { if ( CMD_ARGC() >= 2 ) { sprintf( szTemp, "%s %s", ( char * )pcmd, (char *)CMD_ARGS() ); } else { // Just a one word command, use the first word...sigh sprintf( szTemp, "%s", ( char * )pcmd ); } p = szTemp; }// remove quotes if present if (*p == '"') { p++; p[strlen(p)-1] = 0; }// make sure the text has content char *pc = NULL; for ( pc = p; pc != NULL && *pc != 0; pc++ ) { if ( isprint( *pc ) && !isspace( *pc ) ) { pc = NULL; // we've found an alphanumeric character, so text is valid break; } } if ( pc != NULL ) return; // no character found, so say nothing// turn on color set 2 (color on, no sound) if ( teamonly ) sprintf( text, "%c(TEAM) %s: ", 2, STRING( pEntity->v.netname ) ); else sprintf( text, "%c%s: ", 2, STRING( pEntity->v.netname ) ); j = sizeof(text) - 2 - strlen(text); // -2 for /n and null terminator if ( (int)strlen(p) > j ) p[j] = 0; strcat( text, p ); strcat( text, "/n" ); player->m_flNextChatTime = gpGlobals->time + CHAT_INTERVAL; // loop through all players // Start with the first player. // This may return the world in single player if the client types something between levels or during spawn // so check it, or it will infinite loop client = NULL; while ( ((client = (CBasePlayer*)UTIL_FindEntityByClassname( client, "player" )) != NULL) && (!FNullEnt(client->edict())) ) { if ( !client->pev ) continue;//.........这里部分代码省略.........
开发者ID:HoLyCoWzOrZ,项目名称:sing-engine,代码行数:101,
示例19: strcpy//-----------------------------------------------------------------------------// Purpose: Get list of files from current path that match pattern//-----------------------------------------------------------------------------int CScriptLib::GetFileList( const char* pDirPath, const char* pPattern, CUtlVector< fileList_t > &fileList ){ char sourcePath[MAX_PATH]; char fullPath[MAX_PATH]; bool bFindDirs; fileList.Purge(); strcpy( sourcePath, pDirPath ); int len = (int)strlen( sourcePath ); if ( !len ) { strcpy( sourcePath, ".//" ); } else if ( sourcePath[len-1] != '//' ) { sourcePath[len] = '//'; sourcePath[len+1] = '/0'; } strcpy( fullPath, sourcePath ); if ( pPattern[0] == '//' && pPattern[1] == '/0' ) { // find directories only bFindDirs = true; strcat( fullPath, "*" ); } else { // find files, use provided pattern bFindDirs = false; strcat( fullPath, pPattern ); } struct _finddata_t findData; intptr_t h = _findfirst( fullPath, &findData ); if ( h == -1 ) { return 0; } do { // dos attribute complexities i.e. _A_NORMAL is 0 if ( bFindDirs ) { // skip non dirs if ( !( findData.attrib & _A_SUBDIR ) ) continue; } else { // skip dirs if ( findData.attrib & _A_SUBDIR ) continue; } if ( !stricmp( findData.name, "." ) ) continue; if ( !stricmp( findData.name, ".." ) ) continue; char fileName[MAX_PATH]; strcpy( fileName, sourcePath ); strcat( fileName, findData.name ); int j = fileList.AddToTail(); fileList[j].fileName.Set( fileName ); fileList[j].timeWrite = findData.time_write; } while ( !_findnext( h, &findData ) ); _findclose( h ); return fileList.Count();}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:80,
示例20: SetTitle//.........这里部分代码省略......... { int seasonNumber; std::string seasonName = namedSeason->ValueStr(); if (!seasonName.empty() && namedSeason->Attribute("number", &seasonNumber) != nullptr) m_namedSeasons.insert(std::make_pair(seasonNumber, seasonName)); namedSeason = thumb->NextSiblingElement("namedseason"); } // cast node = movie->FirstChildElement("actor"); if (node && node->FirstChild() && prioritise) m_cast.clear(); while (node) { const TiXmlNode *actor = node->FirstChild("name"); if (actor && actor->FirstChild()) { SActorInfo info; info.strName = actor->FirstChild()->Value(); if (XMLUtils::GetString(node, "role", value)) info.strRole = StringUtils::Trim(value); XMLUtils::GetInt(node, "order", info.order); const TiXmlElement* thumb = node->FirstChildElement("thumb"); while (thumb) { info.thumbUrl.ParseElement(thumb); thumb = thumb->NextSiblingElement("thumb"); } const char* clear=node->Attribute("clear"); if (clear && stricmp(clear,"true")) m_cast.clear(); m_cast.push_back(info); } node = node->NextSiblingElement("actor"); } // Pre-Jarvis NFO file: // <set>A set</set> if (XMLUtils::GetString(movie, "set", value)) SetSet(value); // Jarvis+: // <set><name>A set</name><overview>A set with a number of movies...</overview></set> node = movie->FirstChildElement("set"); if (node) { // No name, no set if (XMLUtils::GetString(node, "name", value)) { SetSet(value); if (XMLUtils::GetString(node, "overview", value)) SetSetOverview(value); } } std::vector<std::string> tags(m_tags); if (XMLUtils::GetStringArray(movie, "tag", tags, prioritise, g_advancedSettings.m_videoItemSeparator)) SetTags(tags); std::vector<std::string> studio(m_studio); if (XMLUtils::GetStringArray(movie, "studio", studio, prioritise, g_advancedSettings.m_videoItemSeparator)) SetStudio(studio);
开发者ID:pkdevboxy,项目名称:xbmc,代码行数:66,
示例21: dcon_ReplaceTextures// Note : This can't use CEditRegion::RenameTexture because that initializes the texture space. Which we don't want.// (It also counts the number of instances, which doesn't give nearly as much information...)static void dcon_ReplaceTextures(int argc, char *argv[]){ if (argc < 2) { // Display an error. Must have 2 arguments AddDebugMessage("Not enough texture arguments specified. Please use the form:"); AddDebugMessage(" ReplaceTex CurrentTexture NewTexture"); return; } // Get the current region CRegionDoc *pDoc = GetActiveRegionDoc(); if (!pDoc) { AddDebugMessage("No active document available."); return; } CEditRegion *pRegion = pDoc->GetRegion(); if (!pRegion) { AddDebugMessage("No active region available."); return; } // Tell the user what we're doing.. AddDebugMessage("Searching %d brushes for replacement...", pRegion->m_Brushes.GetSize()); // Keep track of the replacement count uint32 nReplaceCount = 0; // Point into the brush list LPOS iPos = pRegion->m_Brushes.GetHeadPosition(); // Replace textures on all brush matching argv[0] with argv[1] while (iPos) { // Get the brush CEditBrush *pBrush = pRegion->m_Brushes.GetNext(iPos); // Did we find a match on this brush? bool bFoundMatch = false; // For every polygon.. for (uint32 nPolyLoop = 0; nPolyLoop < pBrush->m_Polies; ++nPolyLoop) { CEditPoly *pPoly = pBrush->m_Polies[nPolyLoop]; for(uint32 nCurrTex = 0; nCurrTex < CEditPoly::NUM_TEXTURES; nCurrTex++) { // Is this your texture? if (stricmp(pPoly->GetTexture(nCurrTex).m_pTextureName, argv[0]) == 0) { // Replace it... pPoly->GetTexture(nCurrTex).m_pTextureName = pRegion->m_pStringHolder->AddString(argv[1]); pPoly->GetTexture(nCurrTex).UpdateTextureID(); // Found a match.. bFoundMatch = true; } } } if (bFoundMatch) ++nReplaceCount; } // And the results were...? AddDebugMessage("Done. Replaced texture on %d brushes", nReplaceCount); // Redraw the region & mark it as changed if necessary if (nReplaceCount) { pDoc->Modify(); pDoc->RedrawAllViews(); }}
开发者ID:Joincheng,项目名称:lithtech,代码行数:79,
示例22: CmdStartupvoid CmdStartup(int iSignal){ bool bLoop = true, bEnvUser = false; int cRead = 0, cCMD = 0, cOPT = 0, iEnvPos = 0, iEnvLen = 0; unsigned char szEnv[50]; debug(DEBUGLEVEL_INFO, "CmdStartup entry %d/n", iSignal); printf("%c%c%c%c%c%c%c%c%c", IAC, WILL, TELOPT_ECHO, IAC, WILL, TELOPT_SGA, IAC, DO, TELOPT_NEW_ENVIRON); fflush(stdout); while(bLoop == true) { cRead = CmdInputGet(); debug(DEBUGLEVEL_DEBUG, "CmdStartup read %d, length %d/n", cRead, CmdInputLen()); if(cRead == IAC && CmdInputLen() >= 2) { debug(DEBUGLEVEL_DEBUG, "CmdStartup IAC (%d more chars)", CmdInputLen(), cRead); cCMD = CmdInputGet(); cOPT = CmdInputGet(); debug(DEBUGLEVEL_DEBUG, " [%d][%d]/n", cCMD, cOPT); if(cCMD == WILL && cOPT == TELOPT_NEW_ENVIRON) { iEnvLen = 0; szEnv[iEnvLen++] = IAC; szEnv[iEnvLen++] = SB; szEnv[iEnvLen++] = TELOPT_NEW_ENVIRON; szEnv[iEnvLen++] = TELQUAL_SEND; iEnvLen = CmdStartupEnv(szEnv, iEnvLen, NEW_ENV_VAR, "USER"); iEnvLen = CmdStartupEnv(szEnv, iEnvLen, ENV_USERVAR, "TERM"); // iEnvLen = CmdStartupEnv(szEnv, iEnvLen, ENV_USERVAR, "COLUMNS"); // iEnvLen = CmdStartupEnv(szEnv, iEnvLen, ENV_USERVAR, "LINES"); szEnv[iEnvLen++] = IAC; szEnv[iEnvLen++] = SE; debug(DEBUGLEVEL_DEBUG, "CmdStartup env request: "); for(iEnvPos = 0; iEnvPos < iEnvLen; iEnvPos++) { if(isalnum(szEnv[iEnvPos])) { debug(DEBUGLEVEL_DEBUG, "%c", szEnv[iEnvPos]); } else { debug(DEBUGLEVEL_DEBUG, "[%d]", szEnv[iEnvPos]); } } debug(DEBUGLEVEL_DEBUG, "/n"); fwrite(szEnv, sizeof(char), iEnvLen, stdout); fflush(stdout); // sleep(2); } else if(cCMD == SB && cOPT == TELOPT_NEW_ENVIRON) { debug(DEBUGLEVEL_DEBUG, "CmdStartup env settings/n"); cRead = CmdInputGet(); if(cRead == TELQUAL_IS) { iEnvPos = 0; do { cRead = CmdInputGet(); if(cRead == IAC || cRead == NEW_ENV_VAR || cRead == ENV_USERVAR) { if(iEnvPos > 0) { szEnv[iEnvPos] = '/0'; debug(DEBUGLEVEL_DEBUG, ", value '%s'/n", szEnv); if(bEnvUser == true) { g_szEnvUser = strmk((char *)szEnv); bEnvUser = false; } } // debug("CmdStartup env setting reset/n"); iEnvPos = 0; } else if(cRead == NEW_ENV_VALUE) { if(iEnvPos > 0) { szEnv[iEnvPos] = '/0'; debug(DEBUGLEVEL_DEBUG, "CmdStartup env '%s'", szEnv); if(stricmp((char *)szEnv, "USER") == 0) { bEnvUser = true; } }//.........这里部分代码省略.........
开发者ID:snaxnet,项目名称:qUAck,代码行数:101,
示例23: M2TS_FlushRequestedstatic void M2TS_FlushRequested(M2TSIn *m2ts){ u32 i, j, req_prog_count, count, prog_id, found; gf_mx_p(m2ts->mx); found = 0; count = gf_list_count(m2ts->ts->requested_pids); for (i=0; i<count; i++) { M2TSIn_Prog *req_pid = gf_list_get(m2ts->ts->requested_pids, i); GF_M2TS_ES *es = m2ts->ts->ess[req_pid->pid]; if (es==NULL) continue; /*move to skip mode for all PES until asked for playback*/ if (!(es->flags & GF_M2TS_ES_IS_SECTION) && !es->user) gf_m2ts_set_pes_framing((GF_M2TS_PES *)es, GF_M2TS_PES_FRAMING_SKIP); MP2TS_DeclareStream(m2ts, (GF_M2TS_PES *)es, NULL, 0); gf_list_rem(m2ts->ts->requested_pids, i); gf_free(req_pid); i--; count--; found++; } req_prog_count = gf_list_count(m2ts->ts->requested_progs); for (i = 0; i < req_prog_count; i++) { M2TSIn_Prog *req_prog = gf_list_get(m2ts->ts->requested_progs, i); prog_id = atoi(req_prog->fragment); count = gf_list_count(m2ts->ts->SDTs); for (j=0; j<count; j++) { GF_M2TS_SDT *sdt = gf_list_get(m2ts->ts->SDTs, j); if (!stricmp((const char *) sdt->service, req_prog->fragment)) req_prog->id = sdt->service_id; else if (sdt->service_id==prog_id) req_prog->id = sdt->service_id; } if (req_prog->id) { GF_M2TS_Program *ts_prog; count = gf_list_count(m2ts->ts->programs); for (j=0; j<count; j++) { ts_prog = gf_list_get(m2ts->ts->programs, j); if (ts_prog->number==req_prog->id) { MP2TS_SetupProgram(m2ts, ts_prog, 0, 0); found++; gf_free(req_prog->fragment); gf_free(req_prog); gf_list_rem(m2ts->ts->requested_progs, i); req_prog_count--; i--; break; } } } } if (m2ts->epg_requested) { if (!m2ts->has_eit) { GF_ObjectDescriptor *od = M2TS_GenerateEPG_OD(m2ts); /*declare but don't regenerate scene*/ gf_term_add_media(m2ts->service, (GF_Descriptor*)od, 0); m2ts->has_eit = 1; } } else { /*force scene regeneration only when EPG is not requested*/ if (found) gf_term_add_media(m2ts->service, NULL, 0); } gf_mx_v(m2ts->mx);}
开发者ID:fcsteagu,项目名称:gpac-1,代码行数:67,
示例24: whileLRESULT CBackEndDialog::OnActivateTask(WPARAM wParam, LPARAM lParam){ //get the text char* pszTaskName = (char*)wParam; //track the old task CTask* pOldTask = m_pCurrTask; //run through the list and find the task CTask* pCurr = m_pHeadTask; while(pCurr) { if(stricmp(pszTaskName, pCurr->GetName()) == 0) { m_pCurrTask = pCurr; break; } pCurr = pCurr->GetNextTask(); } //clean up the name now delete [] pszTaskName; pszTaskName = NULL; //see if we didn't find the task if(pCurr == NULL) { return false; } //set the active task name around the progress bar CStatic* pTaskName = (CStatic*)GetDlgItem(IDC_STATIC_TASK_NAME); CString sText; sText.Format("Task: %s", (m_pCurrTask) ? m_pCurrTask->GetName() : "None"); ((CStatic*)GetDlgItem(IDC_STATIC_TASK_NAME))->SetWindowText(sText); //also update the progress bar to reflect the change SetTaskProgress((m_pCurrTask) ? m_pCurrTask->GetProgress() : 0.0f); //if the user was viewing the previous task, then we want to start viewing the new //task, the same goes for if the user isn't viewing any tasks CTask* pViewedTask = GetViewedTask(); if((pOldTask == pViewedTask) || (pViewedTask == NULL)) { //find this new task for(uint32 nCurrTask = 0; nCurrTask < (uint32)GetTaskList()->GetCount(); nCurrTask++) { if((CTask*)GetTaskList()->GetItemData(nCurrTask) == m_pCurrTask) { //this is a match, select it GetTaskList()->SetCurSel(nCurrTask); ResetMessageList(); break; } } } //save this task as our current subtask m_sSubTaskName = (m_pCurrTask) ? m_pCurrTask->GetName() : ""; //update the title bar UpdateTitleNonIconic(); return 0;}
开发者ID:Joincheng,项目名称:lithtech,代码行数:67,
示例25: Initializevoid CSoundMng::LoadSoundConfig( char* filename ){ char* token; char soundName[128]; int idx, is3D, dup, resType = 0, type, eventType, soundID; float fraction, freq; Initialize(); g_script.Load( filename ); g_script.BeginParse(); m_maxIdx = 0; while( 1 ) { token = g_script.GetNextToken( true ); if( token[0] == 0 ) break; if( !stricmp( token, "RESOURCE" ) ) resType = 0; if( !stricmp( token, "MATCHING" ) ) resType = 1; else if( token[0] == '{' ) { while( 1 ) { token = g_script.GetNextToken( true ); if( token[0] == '}' ) break; if( !resType ) { if( !stricmp( token, "NORMAL" ) ) type = 0; else if( !stricmp( token, "ITEM" ) ) type = 1; else if( !stricmp( token, "EVENT_IDLE" ) ) { type = 2; eventType = ANIM_ITEM_IDLE; } else if( !stricmp( token, "EVENT_DAMAGE" ) ) { type = 2; eventType = ANIM_ITEM_DEFENSE; } else if( !stricmp( token, "EVENT_DIE" ) ) { type = 2; eventType = ANIM_ITEM_DYING_0; } else if( !stricmp( token, "EVENT_WALK" ) ) { type = 2; eventType = ANIM_ITEM_WALK; } else if( !stricmp( token, "EVENT_RUN" ) ) { type = 2; eventType = ANIM_ITEM_RUN; } else if( !stricmp( token, "EVENT_ATTACK" ) ) { type = 2; eventType = ANIM_ITEM_ATTACK_0; } else if( !stricmp( token, "EVENT_SHOCK" ) ) { type = 2; eventType = ANIM_ITEM_ATTACKED_0; } else if( token[0] == '{' ) { while( 1 ) { token = g_script.GetNextToken( true ); if( token[0] == '}' ) break; idx = atoi( token ); token = g_script.GetNextToken( true ); strcpy( soundName, token ); token = g_script.GetNextToken( true ); is3D = atoi( token ); token = g_script.GetNextToken( true ); dup = atoi( token ); if( type == 0 ) { m_soundResource.normalID[idx].idx = idx; strcpy( m_soundResource.normalID[idx].filename, soundName ); m_soundResource.normalID[idx].is3D = is3D; m_soundResource.normalID[idx].numDup = dup; m_soundResource.numNoramlID ++; m_maxIdx ++; } else if( type == 1 ) { m_soundResource.itemID[idx].idx = idx; strcpy( m_soundResource.itemID[idx].filename, soundName ); m_soundResource.itemID[idx].is3D = is3D; m_soundResource.itemID[idx].numDup = dup; m_soundResource.numItemID ++; m_maxIdx ++; } else if( type == 2 ) { m_soundResource.eventID[eventType][idx].idx = idx; strcpy( m_soundResource.eventID[eventType][idx].filename, soundName ); m_soundResource.eventID[eventType][idx].is3D = is3D; m_soundResource.eventID[eventType][idx].numDup = dup; m_soundResource.numEventID[eventType] ++; m_maxIdx ++; } } } } else { if( !stricmp( token, "ITEM" ) ) type = 0; else if( !stricmp( token, "PC" ) ) type = 1; else if( !stricmp( token, "MONSTER" ) ) type = 2; else if( token[0] == '{' ) { while( 1 ) {//.........这里部分代码省略.........
开发者ID:gthgame,项目名称:gth,代码行数:101,
示例26: tinytest_maininttinytest_main(int c, const char **v, struct testgroup_t *groups){ int i, j, n=0;#ifdef _WIN32 const char *sp = strrchr(v[0], '.'); const char *extension = ""; if (!sp || stricmp(sp, ".exe")) extension = ".exe"; /* Add an exe so CreateProcess will work */ snprintf(commandname, sizeof(commandname), "%s%s", v[0], extension); commandname[MAX_PATH]='/0';#endif for (i=1; i<c; ++i) { if (v[i][0] == '-') { if (!strcmp(v[i], "--RUNNING-FORKED")) { opt_forked = 1; } else if (!strcmp(v[i], "--no-fork")) { opt_nofork = 1; } else if (!strcmp(v[i], "--quiet")) { opt_verbosity = -1; verbosity_flag = "--quiet"; } else if (!strcmp(v[i], "--verbose")) { opt_verbosity = 2; verbosity_flag = "--verbose"; } else if (!strcmp(v[i], "--terse")) { opt_verbosity = 0; verbosity_flag = "--terse"; } else if (!strcmp(v[i], "--help")) { usage(groups, 0); } else if (!strcmp(v[i], "--list-tests")) { usage(groups, 1); } else { printf("Unknown option %s. Try --help/n",v[i]); return -1; } } else { int r = process_test_option(groups, v[i]); if (r<0) return -1; n += r; } } if (!n) tinytest_set_flag_(groups, "..", 1, TT_ENABLED_);#ifdef _IONBF setvbuf(stdout, NULL, _IONBF, 0);#endif ++in_tinytest_main; for (i=0; groups[i].prefix; ++i) for (j=0; groups[i].cases[j].name; ++j) if (groups[i].cases[j].flags & TT_ENABLED_) testcase_run_one(&groups[i], &groups[i].cases[j]); --in_tinytest_main; if (opt_verbosity==0) puts(""); if (n_bad) printf("%d/%d TESTS FAILED. (%d skipped)/n", n_bad, n_bad+n_ok,n_skipped); else if (opt_verbosity >= 1) printf("%d tests ok. (%d skipped)/n", n_ok, n_skipped); return (n_bad == 0) ? 0 : 1;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:70,
示例27: mainint main(int argc, char *argv[]) { pnamestruct pn; FILE *fd; unsigned int off; int len; int count = 0; char pack[4], *fname = NULL, *pbor = NULL, *p; setbuf(stdin, NULL); setbuf(stdout, NULL); setbuf(stderr, NULL); fputs("/n" "BOR music player v"VER"/n" "v0.1 by Luigi Auriemma/n" "e-mail: [email C++ strict_strtoul函数代码示例 C++ strhash函数代码示例
|