void ProcessCurrentDirectory( void ) { DIR *dirh; struct dirent *dp; dirstack *stack; if( !Options.depthfirst ) { ExecuteCommands(); } if( Options.levels != 0 ) { dirh = opendir( "." ); if( dirh != NULL ) { --Options.levels; for( ;; ) { if( DoneFlag ) return; dp = readdir( dirh ); if( dp == NULL ) break; #ifdef __UNIX__ { struct stat buf; stat( dp->d_name, &buf ); if( !S_ISDIR( buf.st_mode ) ) continue; } #else if( !( dp->d_attr & _A_SUBDIR ) ) continue; #endif if( dp->d_name[0] == '.' ) { if( dp->d_name[1] == '.' || dp->d_name[1] == '\0' ) continue; } stack = SafeMalloc( sizeof( *stack ) ); if( DoneFlag ) return; stack->name_len = strlen( dp->d_name ); memcpy( stack->name, dp->d_name, stack->name_len + 1 ); stack->prev = Stack; Stack = stack; chdir( stack->name ); ProcessCurrentDirectory(); chdir( ".." ); Stack = stack->prev; free( stack ); } ++Options.levels; closedir( dirh ); } } if( Options.depthfirst ) { ExecuteCommands(); } }
logical DLInterpreter :: ExecuteCommands (OPBase *op_node ) { logical term = NO; BEGINSEQ current_node = op_node; UpdateDatasource(); if ( ExecuteCommands() ) ERROR RECOVER term = YES; ENDSEQ return(term); }
ExecReturnCodes DLInterpreter :: Debug (OPBase *op_node ) { OPBase *last_node; logical debug = YES; ExecReturnCodes rc = ERC_success; BEGINSEQ switch ( mode ) { case DM_terminate : rc = ERC_terminate; case DM_undefined : debug = NO; break; case DM_step_over : if ( expression == op_node->GetExpressionDecl() ) { mode = DM_break_point; break; } case DM_break_point : if ( !op_node->IsDebug() ) debug = NO; break; case DM_jump_over : case DM_first_statement : case DM_step_in : mode = DM_break_point; case DM_always : break; } if ( debug ) if ( ExecuteCommands(op_node) ) ERROR last_node = current_node; if ( mode == DM_jump_over ) rc = ERC_success; else if ( mode == DM_terminate ) { rc = ERC_terminate; mode = DM_step_in; } else rc = op_node->Execute(); current_node = last_node; RECOVER rc = ERC_terminate; ENDSEQ return(rc); }
void FPhysCommandHandler::Flush() { check(IsInGameThread()); ExecuteCommands(); PendingCommands.Empty(); }
bool CMassiveGitTaskBase::Execute(BOOL& cancel) { assert(m_bUnused); m_pathList.RemoveDuplicates(); return ExecuteCommands(cancel); }
static Err Menu(ClientManager* _clientManager) { int option; char group[MAX_NAME_SIZE],ip[MAX_NAME_SIZE],port[MAX_NAME_SIZE]; char message[MAX_SIZE_OF_MESSAGE]; unsigned short length; Data data; char* ptr = NULL; if (! _clientManager) { return ERROR_NOT_INITIALIZED; } printf("welcome %s!!!\nplease choose one of the following options:\n1. open group\n2. join group\n3. leave group\n4. get all groups\n5. get members of group\n6. log out\n7. unregister\n8. printf groups im in\n9. quit\n",_clientManager->m_name); select(FD_SETSIZE, &_clientManager->m_fd, NULL, NULL, NULL); if (FD_ISSET(0, &_clientManager->m_fd) == 1) { scanf("%d",&option); getchar(); switch(option) { case 1: DEBUG_PRINT("%s","going to open group"); printf("please enter the group name you wish to create\n"); if (ERROR_OK == ExecuteCommands(_clientManager,TAG_OPEN_GROUP,group,message,&length)) { ptr = message; strcpy(ip,ptr); ptr += MAX_NAME_SIZE; strcpy(port,ptr); OpenGroup(_clientManager,ip,port,group); return ERROR_OK; } return ERROR_END_MAIN; case 2: DEBUG_PRINT("%s","going to join group"); printf("please enter the group name you wish to join\n"); if (ERROR_OK == ExecuteCommands(_clientManager,TAG_JOIN_GROUP,group,message,&length)) { ptr = message; strcpy(ip,ptr); ptr += MAX_NAME_SIZE; strcpy(port,ptr); OpenGroup(_clientManager,ip,port,group); return ERROR_OK; } return ERROR_OK; case 3: DEBUG_PRINT("%s","going to leave group"); if (ERROR_OK == ExecuteCommands(_clientManager,TAG_LEAVE_GROUP,group,message,&length)) { HashRemove(_clientManager->m_groups,group,&data); return ERROR_OK; } return ERROR_OK; case 4: DEBUG_PRINT("%s","going to get all groups"); if (ERROR_OK == ExecuteCommands(_clientManager,TAG_GET_GROUPS,NULL,message,&length)) { PrintData(length,message); return ERROR_OK; } return ERROR_OK; case 5: DEBUG_PRINT("%s","going to get members of group"); printf("please enter the name of the group you wish to see members from\n"); if (ERROR_OK == ExecuteCommands(_clientManager,TAG_GET_MEMBERS,group,message,&length)) { PrintData(length,message); return ERROR_OK; } return ERROR_OK; case 6: DEBUG_PRINT("%s","going to log out"); if (ERROR_OK == ExecuteCommands(_clientManager,TAG_LOGOUT,NULL,message,&length)) { LogOut(_clientManager); return ERROR_END_MENU; } case 7: if (ERROR_OK == ExecuteCommands(_clientManager,TAG_UNREGISTER,group,message,&length)) { printf("unregistered succsesfully\n"); return ERROR_END_MENU; } return ERROR_OK; case 8: HashPrint(_clientManager->m_groups,PrintGroupsImIn); return ERROR_OK; case 9: return ERROR_END_MAIN; default: printf("i'm sorry, no such option, please try again\n"); return ERROR_OK; } } else if (FD_ISSET(_clientManager->m_socket, &_clientManager->m_fd) == 1) {} return ERROR_OK; }