/* * CPU specific stuff for putting a thread into execution for the * first time. We have to arrange a stack frame such that the function * thinks it needs to return to thp->args.wa->exitfunc, and that it has * been passed thp->args.wa.arg. * * As it happens, this is already done on the x86, because of the * position of the thread local storage at the top of the thread's stack. */ void cpu_thread_waaa(THREAD *thp) { // We set the task switched bit before a new thread runs. // This will ensure a trap if it attempts to use the fpu // even if nobody else is using it. setts(); }
// nn_initのあとに呼び出す // _tsと_tvをnnins->ts, tvに代入し、teacher_nを1増やす。 // ts, tvが足りなくなったらreallocする。 void nn_add_teacher_vect(nn_sys_t *nnins, float *_ts, float *_tv) { int i; int n = (nnins->teacher_n++); if (n > nnins->teacher_n_max - 1) { nnins->teacher_n_max *= 2; nnins->ts = (float*)realloc(nnins->ts, nnins->teacher_n_max*nnins->input_n*sizeof(float)); nnins->tv = (float*)realloc(nnins->tv, nnins->teacher_n_max*nnins->output_n*sizeof(float)); } for (i = 0; i < nnins->input_n; i++) { printf("ts: %d %d %f\n", n, i, _ts[i]); setts(nnins, n, i, _ts[i]); } for (i = 0; i < nnins->output_n; i++) { printf("tv: %d %d %f\n", n, i, _tv[i]); settv(nnins, n, i, _tv[i]); } }
int main(int argc, char* argv[]) { try { char* testname_args[] = {"program.exe","width=640 height=480 window_name", " =GL WINDOW TEST 1 is_fullscreen=false"}; GLWindow::Settings setts(3, testname_args) ; GLWindow glWindow = GLWindow(setts); setts.width=1280; setts.height=720; setts.is_fullscreen=true; setts.is_antialiased = true; setts.antialias_amount = 8; //setts.match_resolution_exactly=true; PCInputBinding b; b.bindButtonDown('a', playBeep); std::function< void () > quit = std::bind(&GLWindow::close, &glWindow); b.bindButtonDown(PCInputBinding::ESCAPE, quit); glWindow.use_binding(b); std::cout<<"Supported resolutions "<<std::endl; std::set<std::pair<int,int>> resolutions = glWindow.getResolutions(); for(std::set<std::pair<int,int>>::const_iterator it = resolutions.begin(); it != resolutions.end(); it++){ std::cout<<it->first<<"::"<<it->second<<std::endl; } glWindow.recreate(setts); glClearColor(0,1,0,1); std::cout<<"Recreated window width is "<<glWindow.getWidth()<<":::"<<glWindow.getHeight()<<std::endl; while(glWindow.isValid()) { // glViewport(0,0,glWindow.getWidth(),glWindow.getHeight()); //glWindow.bind(); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_TRIANGLES); glClearColor(1.0,0.0,0.0,1.0); glClear(GL_COLOR_BUFFER_BIT); glColor3f(1.0,0.0,0.0); glVertex3f(-1.0,1.0,0.0); glColor3f(0.0,1.0,0.0); glVertex3f(-1.0,-1.0,0.0); glColor3f(0.0,0.0,1.0); glVertex3f(1.0,-1.0,0.0); glEnd(); glWindow.update(); glWindow.flush(); // } } catch(std::exception& e) { std::cerr << e.what() << std::endl; } system("pause"); return 0; }