void dispatchPage() /* Look at command variables in cart and figure out which * page to draw. */ { struct sqlConnection *conn = hAllocConn(database); if (checkAndClear(hggConfigure)) { configurePage(); } else if (checkAndClear(hggConfigureOne)) { configureOnePage(); } else if (checkAndClear(hggUpload)) { uploadPage(); } else if (checkAndClear(hggSubmitUpload)) { submitUpload(conn); } else if (checkAndClear(hggImport)) { importPage(conn); } else if (checkAndClear(hggSubmitImport)) { submitImport(); } else if (checkAndClear(hggCorrelate)) { correlatePage(conn); } else if (checkAndClear(hggBrowse)) { browseRegions(conn); } else if (checkAndClear(hggSort)) { sortGenes(conn); } else { /* Default case - start fancy web page. */ if (cgiVarExists(hggPsOutput)) handlePostscript(conn); else mainPage(conn); } cartRemovePrefix(cart, hggDo); }
int main(void) { ledsInit(); timerInit(); //move interruptvectors to the Boot sector // this strange sequence ( two separate lines ) is necessary MCUCR = _BV(IVCE); MCUCR = _BV(IVSEL); sei(); motorsInit(); uartInit( UART_BAUD_SELECT( 115200, F_CPU ) ); uartFlowControlOn( 0 ); uartPutStringCRLF( PROMPT ); while(1) { // if more than a second has elapsed if ( s_timeoutExpired && !s_stayInBootLoader ) { jumpToApplication(); } if ( getLine() ) { if ( !strcmp( s_buffer, UPLOAD_PAGE_COMMAND ) ) { s_stayInBootLoader = 1; uploadPage(); } else if ( !strcmp( s_buffer, CHECK_PAGE_COMMAND ) ) { s_stayInBootLoader = 1; checkPage(); } else if ( !strcmp( s_buffer, QUIT_COMMAND ) ) { jumpToApplication(); } else if ( !strcmp( s_buffer, "" ) ) { s_stayInBootLoader = 1; // don't do anything for blank lines } else { uartPutStringCRLF( CMD_UNKNOWN ); } uartPutStringCRLF( PROMPT ); } } return 0; }