main() { printf("MTX starts in main()\n"); init(); // initialize and create P0 as running set_vec(80,int80h); set_vec(15, pinit); kfork("/bin/u1"); // P0 kfork() P1 while(1){ if (readyQueue) tswitch(); else halt(); } }
main() { vid_init(); printf("MTX starts in main()\n"); init(); // initialize and create P0 as running set_vec(80,int80h); kfork("/bin/u1"); // P0 kfork() P1 lock(); set_vec(8,tinth); timer_init(); while(1){ printf("P0 running\n"); if (nproc==2 && proc[1].status != READY) printf("no runable process, system halts\n"); while(!readyQueue); printf("P0 switch process\n"); tswitch(); // P0 switch to run P1 } }
main(){ printf("MTX starts in main()\n"); init(); // initialize and create P0 as running set_vec(80, int80h); kfork("/bin/u1"); // P0 kfork() P1 while(1){ printf("P0 running\n"); while(!readyQueue); printf("P0 switch process\n"); tswitch(); // P0 switch to run P1 } }
int py_shader_param_set(PyShaderParamObject *self, PyObject *val) { const struct ShaderParam *p = self->param; int ok = 0; if (PyObject_TypeCheck(val, &py_mat_type)) { ok = set_mat(p, val); } else if (PyObject_TypeCheck(val, &py_vec_type)) { ok = set_vec(p, val); } else if (PyFloat_Check(val)) { ok = set_float(p, val); } else if (PyLong_Check(val)) { ok = set_int(p, val); } else if (PyObject_TypeCheck(val, &py_array_type)) { ok = set_array(p, (PyArrayObject*)val); } else { PyErr_Format( PyExc_TypeError, "unsupported type '%s' for shader param '%s'", Py_TYPE(val)->tp_name, p->name ); return 0; } if (!ok) { PyErr_Format( PyExc_RuntimeError, "failed to set shader param '%s'", p->name ); error_print_tb(); error_clear(); return 0; } return 1; }
void frame_dump_outline(char *file, struct map *in) { int x = 0; int y = 0; double ret = 0.0; struct list l; struct vec v; list_init(&l); for (x = 0; x < in->xpoints; x++) { for (y = in->ypoints - 1; y >= 0; y--) { ret = in->data[x][y]; if (ret != 0.0) { set_vec(&v, in->x[x], in->y[y], 0.0); list_add_no_rep(&l, &v); break; } } } for (x = in->xpoints - 1; x >= 0; x--) { for (y = 0; y < in->ypoints; y++) { ret = in->data[x][y]; if (ret != 0.0) { set_vec(&v, in->x[x], in->y[y], 0.0); list_add_no_rep(&l, &v); break; } } } list_cog_cal(&l); list_minmax_cal(&l); list_free(&l); list_init(&l); int count; for (x = 0; x < in->xpoints; x++) { count = 0.0; for (y = in->ypoints - 1; y >= 0; y--) { if (in->data[x][y] != 0.0) count++; } for (y = in->ypoints - 1; y >= 0; y--) { ret = in->data[x][y]; if (ret != 0.0) { if (count < 2) { if (fabs(l.min_y - in->y[y]) > fabs(l.max_y - in->y[y])) { set_vec(&v, in->x_fake[x], in->y_fake[y], 0.0); list_add_no_rep(&l, &v); } } else { set_vec(&v, in->x_fake[x], in->y_fake[y], 0.0); list_add_no_rep(&l, &v); } break; } } } //list_add(&l,-22.0, -22.0); for (x = 0; x < 20; x++) { list_remove_bump_down(&l, 0); } int pos = l.length; for (x = in->xpoints - 1; x >= 0; x--) { count = 0.0; for (y = 0; y < in->ypoints; y++) { if (in->data[x][y] != 0.0) count++; } for (y = 0; y < in->ypoints; y++) { ret = in->data[x][y]; if (ret != 0.0) { if (count < 2) { if (fabs(l.min_y - in->y[y]) < fabs(l.max_y - in->y[y])) { set_vec(&v, in->x_fake[x], in->y_fake[y], 0.0); list_add_no_rep(&l, &v); } } else { set_vec(&v, in->x_fake[x], in->y_fake[y], 0.0); list_add_no_rep(&l, &v); } break; } } } for (x = 0; x < 20; x++) { list_remove_bump_up(&l, pos); } //list_smooth_y(&l); //list_smooth_y(&l); list_add(&l, l.list[0].x, l.list[0].y); list_dump_2d(file, &l); list_free(&l); }
int main( void ) { set_vec( 0 ); ptr_cvt( Ptr ); _PASS; }