Ejemplo n.º 1
0
 // Function:      Displays welcome and takes in users char choice for menu.
 // Input:         Continually prompts user until a correct char is entered.
 // Output:        Displays a welcome: if a user exists will display a specific
 //                welcome for them. Otherwise, a generic welcome display. Then
 //                posts the textual menu display.
 // Description:   Displays generic welcome and prompts user to log on. displays welcome to current user. Takes in users int choice and 
 //                determines if it is valid. Continually prompts user for a valid char. Once a valid choice has been made, choice is handed 
 //                to handleChoice() function.
 int Menu::startMenu()  
 {
    //cin.ignore(1000,'\n');
    // Login
    int quitValue = 0;
    while(1)
    {
       if(!userExists)  
       {
          displayWelcome();
          promptLogin();
       }
       // User has logged on previously
       else if(userExists) 
       {
          updateWelcome();
          while(1)
          {
             char option = promptMenuChoice();
             quitValue = handleChoice(option);
             if( quitValue == 1)
             {
                return 1;
             } 
          }
       }
    }
 } 
Ejemplo n.º 2
0
void mainWelcome()
{
	displayBounderay(BOUNDERAYTPYE);
	displayWelcome();
	//displayExpense(TODAY,totalToday);
	displayExpense(MONTH,totalMonth);
    //displayExpense(YEAR,totalYear);
    //displayExpense(HISTORY,totalHistory);
	displayBounderay(BOUNDERAYTPYE);
	displayMenu();
	return;
}
Ejemplo n.º 3
0
int main() {
	setup();
	displayWelcome();
	displayBattery();
	lineCalibration();

	followLineLaps(4);

	play_from_program_space(success);
	clear();
	print("Done.");
	while (true); // prevent exit from main
	return 0; // dead code
}
Ejemplo n.º 4
0
/**
	Procedure: commandHandler

	Purpose: Handles User Commands & Command Execution

	Parameters: None  

	Return value: None

	Calls: displayWelcome, keyboardInput, cmpP2S, handler_help, handler_version, handler_set_date, handler_get_date, handler_display_mpx, 
		handler_display_history, handler_terminate_mpx, change_prompt, handler_help_function, handler_create_pcb, handler_delete_pcb, 
		handler_block, handler_unblock, handler_suspend, handler_resume, handler_set_priority, handler_show_pcb, handler_show, displayClosing, 
		commandCleanup, sys_exit

	Globals: comDone, userCommand

	Errors: None
**/
void commandHandler(){
	int userCommandSize;
	displayWelcome();							//2.1 Display the Welcome Message

	while(comDone !=1){							//2.2 Begin While Loop for User Commands
		userCommand = NULL;
		printf("\nPlease enter the command to be executed(case sensitive).\n");
		userCommand = keyboardInput(0);      	//2.2.1 Request User Input & Accept Command from User
		printf("\n");
		//Decision Statement
		if(cmpP2S(userCommand, "help") == 1 || cmpP2S(userCommand, "/?") == 1){
			handler_help();
		} 
		else if(cmpP2S(userCommand, "version") == 1){
			handler_version();
		} 
		else if(cmpP2S(userCommand, "set_date") == 1){
			handler_set_date();
			//fix = 1;
		} 
		else if(cmpP2S(userCommand, "get_date") == 1){
			handler_get_date();
		} 
		else if(cmpP2S(userCommand, "display_mpx") == 1){
			handler_display_mpx();
		} 
		//else if(cmpP2S(userCommand, "display_history") == 1){
		//	handler_display_history();
		//}
		else if(cmpP2S(userCommand, "terminate_mpx") == 1||cmpP2S(userCommand, "exit") == 1||cmpP2S(userCommand, "quit") == 1){
			handler_terminate_mpx();
		} 
		else if(cmpP2S(userCommand, "change_prompt") == 1){
			change_prompt();
			//fix = 1;
		} 
		else if(cmpP2S(userCommand, "help_version")==1){
			handler_help_function("version");
		}
		else if(cmpP2S(userCommand, "help_set_date")==1){
			handler_help_function("set_date");
		}
		else if(cmpP2S(userCommand, "help_get_date")==1){
			handler_help_function("get_date");
		}
		else if(cmpP2S(userCommand, "help_display_mpx")==1){
			handler_help_function("display_mpx");
		}
		else if(cmpP2S(userCommand, "help_terminate_mpx")==1){
			handler_help_function("terminate_mpx");
		}
		else if(cmpP2S(userCommand, "help_change_prompt")==1){
			handler_help_function("change_prompt");
		}
		else if(cmpP2S(userCommand, "help_create_pcb")==1){
			handler_help_function("create_pcb");
		}
		else if(cmpP2S(userCommand, "create_pcb")==1){
			handler_create_pcb();
		}
		else if(cmpP2S(userCommand, "help_delete_pcb")==1){
			handler_help_function("delete_pcb");
		}
		else if(cmpP2S(userCommand, "delete_pcb")==1){
			handler_delete_pcb();
		}
		else if(cmpP2S(userCommand, "help_block")==1){
			handler_help_function("block");
		}
		else if(cmpP2S(userCommand, "block")==1){
			handler_block();
		}
		else if(cmpP2S(userCommand, "help_unblock")==1){
			handler_help_function("unblock");
		}
		else if(cmpP2S(userCommand, "unblock")==1){
			handler_unblock();
		}
		else if(cmpP2S(userCommand, "help_suspend")==1){
			handler_help_function("suspend");
		}
		else if(cmpP2S(userCommand, "suspend")==1){
			handler_suspend();
		}
		else if(cmpP2S(userCommand, "help_resume")==1){
			handler_help_function("resume");
		}
		else if(cmpP2S(userCommand, "resume")==1){
			handler_resume();
		}
		else if(cmpP2S(userCommand, "help_set_priority")==1){
			handler_help_function("set_priority");
		}
		else if(cmpP2S(userCommand, "set_priority")==1){
			handler_set_priority();
		}
		else if(cmpP2S(userCommand, "help_show_pcb")==1){
			handler_help_function("show_pcb");
		}
		else if(cmpP2S(userCommand, "show_pcb")==1){
			handler_show_pcb();
		}
		else if(cmpP2S(userCommand, "help_show_all")==1){
			handler_help_function("show_all");
		}
		else if(cmpP2S(userCommand, "show_all")==1){
			handler_show(0);
		}
		else if(cmpP2S(userCommand, "help_show_ready")==1){
			handler_help_function("show_ready");
		}
		else if(cmpP2S(userCommand, "show_ready")==1){
			handler_show(4);
			handler_show(6);
		}
		else if(cmpP2S(userCommand, "help_show_blocked")==1){
			handler_help_function("show_blocked");
		}
		else if(cmpP2S(userCommand, "show_blocked")==1){
			handler_show(5);
			handler_show(7);
		}
		else {
			printf("Invalid Command.\n");
		}//end if - Decision
		
		
	}//end while
	displayClosing();						//2.2.4 Display closing message
	commandCleanup();						//2.2.5 Cleanup Allocated Memory
	keyboardInput(0);
	
	sys_exit();								//2.2.6 Return to host system
}