Rat* getStrategies(Equilibrium eq) { int n = eq.lcpdim; Rat* strat; strat = malloc((n) * sizeof(Rat)); int i, row; gmpt num, den; ginit(num); ginit(den); for (i=1; i<=n; i++) { if((row = eq.bascobas[Z(i)]) < n) /* If Z(i) is basic */ { /* value of Z(i): scfa[Z(i)]*rhs[row] / (scfa[RHS]*det) */ gmulint(eq.scfa[Z(i)], eq.A[row][RHS(n)], num); gmulint(eq.det, eq.scfa[RHS(n)], den); greduce(num, den); strat[i-1] = ratinit(); gset(strat[i-1].num, num); gset(strat[i-1].den, den); } else if((row = eq.bascobas[W(i,n)]) < n) { strat[i-1] = ratfromi(0); /* value of W(i-n) is rhs[row] / (scfa[RHS]*det) copy(num, eq.A[row][RHS(n)]); mulint(eq.det, eq.scfa[RHS(n)], den); reduce(num, den); copy(strat[i-1].num, num); copy(strat[i-1].den, den);*/ } else { strat[i-1] = ratfromi(0); } } /* end of for (i=...) */ gclear(num); gclear(den); return strat; }
/* * Convert the screen to graphics-mode in preparation for the * running of a GEM-based graphic application. */ void sh_tographic() { /* retake ints that may */ /* have been stepped */ /* on by char. appl. */ /* including err. */ /* handler and gem.int*/ cli(); retake(); sti(); /* convert to graphic */ gsx_graphic(TRUE); /* set initial clip rect*/ gsx_sclip(&gl_rscreen); /* allocate screen space*/ gsx_malloc(); /* start up the mouse */ ratinit(); /* put mouse to hourglass*/ gsx_mfset(ad_hgmice); }
void ct_mouse(WORD grabit) { if (grabit) { wm_update(TRUE); gl_ctmown = TRUE; gl_mowner = rlr; gsx_mfset(ad_armice); gl_tmpmoff = gl_moff; if (gl_tmpmoff) ratinit(); } else { if (gl_tmpmoff) gsx_moff(); gl_moff = gl_tmpmoff; gsx_mfset(&gl_mouse); gl_ctmown = FALSE; wm_update(FALSE); } }
void sh_ldapp() { WORD ret, badtry, retry; SHELL *psh; psh = &sh[rlr->p_pid]; strcpy(sh_apdir, D.s_cdir); /* initialize sh_apdir */ badtry = 0; /* Set default DESKTOP if there isn't any yet: */ if(psh->sh_desk[0] == 0) { strcpy(&psh->sh_desk[0], DEF_DESKTOP); strcpy(&psh->sh_cdir[0], &D.s_cdir[0]); } do { sh_chdef(psh); /* set up so that we */ /* will exec the */ /* default next time */ /* unless the */ /* application does */ /* a set command */ psh->sh_dodef = TRUE; /* init graph/char mode */ sh_chgrf(psh); if (gl_shgem) { wm_start(); ratinit(); } /* fix up/parse cmd tail*/ sh_fixtail(psh->sh_fullstep == 2); sh_draw(D.s_cmd, 0, 0); /* redraw the desktop */ /* clear his desk field */ desk_tree[rlr->p_pid] = 0x0L; /* exec it */ /* handle bad try msg */ if (badtry) { ret = fm_show(badtry, NULLPTR, 1); if (badtry == ALNOFIT) break; badtry = 0; } do { retry = FALSE; Dprintf(("sh_ldapp: Starting %s\n", D.s_cmd)); if(psh->sh_isdef && strcmp(D.s_cmd, DEF_DESKTOP) == 0) { /* Start the ROM desktop: */ sh_show(D.s_cmd); p_nameit(rlr, sh_name(&D.s_cmd[0])); p_setappdir(rlr, D.s_cmd); aes_run_rom_program(deskstart); } #if WITH_CLI != 0 else if(strcmp(D.s_cmd, "EMUCON") == 0) { /* start the EmuCON shell: */ aes_run_rom_program(coma_start); } #endif else if ( sh_find(D.s_cmd) ) { /* Run a normal application: */ sh_show(D.s_cmd); p_nameit(rlr, sh_name(&D.s_cmd[0])); p_setappdir(rlr, D.s_cmd); if (psh->sh_fullstep == 0) { dos_exec(0, D.s_cmd, ad_stail, ad_envrn); /* Run the APP */ /* If the user ran an alternative desktop and quitted it, return now to the default desktop: (experimental) */ if(psh->sh_isdef && psh->sh_dodef) { Dprintf(("sh_ldapp: Returning to ROM desktop!\n")); strcpy(&psh->sh_desk[0], DEF_DESKTOP); strcpy(&psh->sh_cdir[0], &D.s_cdir[0]); } } else if (psh->sh_fullstep == 1) { dos_exec(0, D.s_cmd, ad_stail, ad_envrn); DOS_ERR = psh->sh_doexec = FALSE; } if (DOS_ERR) badtry = (psh->sh_isdef) ? ALNOFIT : AL08ERR; /* 02/11/86 LKW begin */ if (wind_spb.sy_owner == rlr) /* if he still owns screen*/ unsync(&wind_spb); /* then take him off. */ /* 02/11/86 LKW end */ } else { if ( (gl_shgem) && (psh->sh_isdef) ) { ret = fm_show(ALOKDESK, NULLPTR, 1); if (ret == 1) retry = TRUE; else retry = psh->sh_doexec = FALSE; } else badtry = AL18ERR; } } while (retry && !badtry); desk_tree[rlr->p_pid] = 0x0L; /* clear his desk field */ } while(psh->sh_doexec && !gl_changerez); }