/* GEMAPLIB.C 03/15/84 - 08/21/85 Lee Lorenzen */ /* 3.0 6/23/86 MDF */ /* * Copyright 1999, Caldera Thin Clients, Inc. * This software is licenced under the GNU Public License. * Please see LICENSE.TXT for further information. * * Historical Copyright * ------------------------------------------------------------- * GEM Application Environment Services Version 3.0 * Serial No. XXXX-0000-654321 All Rights Reserved * Copyright (C) 1986 Digital Research Inc. * ------------------------------------------------------------- */ #include #include #include #include #include #include #define TCHNG 0 #define BCHNG 1 #define MCHNG 2 #define KCHNG 3 /* in PD88.C */ EXTERN PD *fpdnm(); EXTERN WORD tchange(); EXTERN WORD bchange(); EXTERN WORD mchange(); EXTERN WORD kchange(); EXTERN WORD gl_ticktime; EXTERN LONG ad_valstr; EXTERN LONG ad_armice; EXTERN LONG menu_tree[NUM_PDS]; GLOBAL WORD gl_play; GLOBAL WORD gl_recd; GLOBAL WORD gl_rlen; GLOBAL LONG gl_rbuf; GLOBAL WORD gl_mnpds[NUM_PDS]; #if MULTIAPP EXTERN LONG gl_efnorm, gl_efsave; EXTERN PD *gl_mnppd; EXTERN SHELL sh[]; EXTERN UWORD dos_gpsp(); #endif /* * Routine to initialize the application */ WORD ap_init(isgem) WORD isgem; { WORD pid; #if MULTIAPP SHELL *psh; UWORD chseg; #endif pid = rlr->p_pid; #if MULTIAPP dbg("ap_init, pid = %d\r\n", pid); psh = &sh[pid]; if ( psh->sh_state & SHRINK ) { chseg = dos_gpsp(); /* get seg of acc's PSP */ dbg("calling dos_stblk, seg = %x, size = %x\r\n", chseg, psh->sh_shrsz); dos_stblk(chseg, psh->sh_shrsz); /* size down acc */ } #endif return( pid ); } /* * APplication READ or WRITE */ VOID ap_rdwr(code, p, length, pbuff) WORD code; REG PD *p; WORD length; LONG pbuff; { QPB m; /* do quick version if */ /* it is standard 16 */ /* byte read and the */ /* pipe has only 16 */ /* bytes inside it */ if ( (code == MU_MESAG) && (p->p_qindex == length) && (length == 16) ) { LBCOPY(pbuff, p->p_qaddr, p->p_qindex); p->p_qindex = 0; } else { m.qpb_ppd = p; m.qpb_cnt = length; m.qpb_buf = pbuff; ev_block(code, ADDR(&m)); } } /* * APplication FIND */ WORD ap_find(pname) LONG pname; { REG PD *p; BYTE temp[9]; LSTCPY(ADDR(&temp[0]), pname); p = fpdnm(&temp[0], 0x0); return( ((p) ? (p->p_pid) : (-1)) ); } /* * APplication Tape PLAYer */ VOID ap_tplay(pbuff, length, scale) REG LONG pbuff; WORD length; WORD scale; { REG WORD i; FPD f; LONG ad_f; ad_f = ADDR(&f); gl_play = TRUE; for(i=0; ip_qindex) ap_rdwr(MU_MESAG, rlr, rlr->p_qindex, ad_valstr); gsx_mfset(ad_armice); wm_update(FALSE); all_run(); #if MULTIAPP if (isgem) dos_term(); #endif } #if MULTIAPP /* * special abort for accessories */ VOID ap_accexit() { ap_exit(TRUE); } #endif