Ejemplo n.º 1
0
VOID trans_obj(LONG tree, WORD obj)
{
	WORD	type, wb, hl;
	LONG	taddr, obspec;

	type = LLOBT(GET_TYPE(tree, obj));
	if ( (obspec = GET_SPEC(tree, obj)) != -1L)
	{
		switch (type)
		{
			case G_IMAGE:
				trans_bitblk(obspec);
				break;
			case G_ICON:
				hl = LWGET(IB_HICON(obspec));
				wb = (LWGET(IB_WICON(obspec)) + 7) >> 3;
				if ( (taddr = LLGET(IB_PDATA(obspec))) != -1L)
					gsx_trans(taddr, wb, taddr, wb, hl);
				if ( (taddr = LLGET(IB_PMASK(obspec))) != -1L)
					gsx_trans(taddr, wb, taddr, wb, hl);
				break;
			default:
				break;
		}
	}
}
Ejemplo n.º 2
0
VOID ted_set(LONG taddr, BYTE *tmplt, BYTE *valid, BYTE *text)
{
	WORD	imap, itmp;

	if (!tmplt[0])
	{
		tmplt[0] = '@';
		LLSTRCPY(LLGET(TE_PVALID(taddr)), (LONG)ADDR(valid));
		LLSTRCPY(LLGET(TE_PTEXT(taddr)), (LONG)ADDR(text));
		if (!valid[0])
			valid[0] = '@';
		if (!text[0])
			text[0] = '@';
	}
	else
	{
		for (imap = itmp = 0; tmplt[itmp]; itmp++)
			if (tmplt[itmp] == '_')
			{
				tmplt[itmp] = '~';
				valid[itmp] = LBGET(imap + LLGET(TE_PVALID(taddr)));
				text[itmp] = LBGET(imap + LLGET(TE_PTEXT(taddr)));
				imap++;
			}
			else
				valid[itmp] = text[itmp] = '~';
		valid[itmp] = text[itmp] = '\0';
	}
}
Ejemplo n.º 3
0
WORD save_icn(VOID)
{    
	LONG	daddr, maddr;
	WORD	ret;
					    
	save_fat(FALSE);
	rast_op(3,&hold_area, &hold_mfdb, &hold_area, &save_mfdb);
	if(gl_isicon)
		rast_op(3, &hold_area, &hld2_mfdb, &hold_area, &sav2_mfdb);
	daddr = GET_SPEC(ad_pbx, DATAWIND); 
	if (gl_isicon)
	{
		/* write data and mask */
		maddr = GET_SPEC(ad_pbx, MASKWIND);
		ret = writ_icon(LLGET(BI_PDATA(daddr)),
			gl_wimage, gl_himage, gl_datasize,
			TRUE) ;
		if (ret )
			return( writ_icon(LLGET(BI_PDATA(maddr)),
			gl_wimage, gl_himage, gl_datasize,
			FALSE) );
		else 
			return( ret );
	}
	else	 
		/* write data only */
		return(	writ_icon(LLGET(BI_PDATA(daddr)),
			gl_wimage, gl_himage, gl_datasize,
			TRUE) );
}
Ejemplo n.º 4
0
VOID update_if(LONG taddr, BYTE *naddr)
{
	if (!LLSTRCMP(LLGET(taddr), (LONG)ADDR(naddr)))
	{
		LLSET(taddr, get_mem( (UWORD) strlen(naddr)+1));
		LLSTRCPY((LONG)ADDR(naddr), LLGET(taddr));
	}
}
Ejemplo n.º 5
0
void forker(void)
{
        register FPD    *f;
        register PD     *oldrl;
        register LONG   amt;
        FPD             g;
        
        oldrl = rlr;
        rlr = (PD *) -1;
        while(fpcnt)
        {
/* critical area        */
          cli();
          fpcnt--;
          f = &D.g_fpdx[fph++];
                                        /* copy FPD so an interrupt     */
                                        /*  doesn't overwrite it.       */
          LBCOPY(ADDR(&g), ADDR(f), sizeof(FPD) );
          if (fph == NFORKS) 
            fph = 0;
          sti();
/* */
                                                /* see if recording     */
          if (gl_recd)
          {
                                                  /* check for stop key */
            if ( ((void *)g.f_code == (void *)kchange) &&
                 ((g.f_data & 0x0000ffffL) == KEYSTOP) )
              gl_recd = FALSE;
                                                /* if still recording   */
                                                /*   then handle event  */
            if (gl_recd)
            {
                                                /* if its a time event &*/
                                                /*   previously recorded*/
                                                /*   was a time event   */
                                                /*   then coalesce them */ 
                                                /*   else record the    */
                                                /*   event              */
              if ( ((void *)g.f_code == (void *)tchange) &&
                   (LLGET(gl_rbuf - sizeof(FPD)) == (LONG)tchange) )
              {
                amt = g.f_data + LLGET(gl_rbuf-sizeof(LONG));
                LLSET(gl_rbuf - sizeof(LONG), amt);           
              }
              else
              {
                LBCOPY(gl_rbuf, ADDR(f), sizeof(FPD));
                gl_rbuf += sizeof(FPD);
                gl_rlen--;
                gl_recd = gl_rlen;
              }
            }
          }
          (*g.f_code)(g.f_data);
        }
        rlr = oldrl;
}
Ejemplo n.º 6
0
VOID text_wh(LONG taddr, WORD type, WORD *w, WORD *h)
{
	WORD	font;

	font = LWGET(TE_FONT(taddr));
	taddr = LLGET( (type == G_TEXT || type == G_BOXTEXT)? TE_PTEXT(taddr): TE_PTMPLT(taddr) );
	*h = ch_height(font);
	*w = ch_width(font) * (WORD)LSTRLEN(taddr);
}
Ejemplo n.º 7
0
VOID icon_set(LONG taddr, BYTE *text, BYTE *chr)
{
	LLSTRCPY(LLGET(IB_PTEXT(taddr)), (LONG)ADDR(text));
	if (!text[0])
		text[0] = '@';
	chr[0] = LLOBT(LWGET(IB_CHAR(taddr))); 
	if (!chr[0])
		chr[0] = '@';
	chr[1] = '\0';
}
Ejemplo n.º 8
0
VOID trans_bitblk(LONG obspec)
{
	LONG	taddr;
	WORD	wb, hl;

	if ( (taddr = LLGET(BI_PDATA(obspec))) != -1L)
	{
		wb = LWGET(BI_WB(obspec));
		hl = LWGET(BI_HL(obspec));
		gsx_trans(taddr, wb, taddr, wb, hl);
	}
}
Ejemplo n.º 9
0
VOID edit_box(LONG tree, WORD sobj)
{
	LONG	obspec; 
	WORD	where, type, exitobj, ok, nilok;
	BYTE	name[9], text[2], bxchar;
	GRECT	p;

	if (rcs_state != ALRT_STATE)
	{
		get_fields(tree, sobj, &type, &obspec, &p);

		ini_tree(&tree, BOXDIAL);
		where = set_obname(tree, BOXNAME, name, ad_view, sobj);
		if ( where != NIL && tree_view() && tree_kind( get_kind(where)) )
			nilok = FALSE;
		else
			nilok = TRUE;
		bxchar = LHIBT(LHIWD(LLGET(obspec)));
		set_text(tree, OCHRITEM, (LONG)ADDR(&text[0]), 2);
		text[0] = bxchar? bxchar: '@';
		text[1] = '\0';

		do {
			exitobj = hndl_dial(tree, OCHRITEM, &p);
			desel_obj(tree, exitobj);
			ok = DEFAULT & GET_FLAGS(tree, exitobj);
		} while (ok && !name_ok(name, where, nilok));

		if (ok)
		{
			rcs_edited = TRUE;
			get_obname(name, ad_view, sobj);
			bxchar = (text[0] == '@')? '\0': text[0];
			LLSET(obspec, (LLGET(obspec) & 0xffffffL) | 
				((LONG) ((UWORD) bxchar) << 24));
		}
	}
}
Ejemplo n.º 10
0
LONG str_addr(WORD n)
{
	return LLGET(str_ptr(n));
}
Ejemplo n.º 11
0
LONG tree_addr(WORD n)
{
	return LLGET(tree_ptr(n));
}  
Ejemplo n.º 12
0
/* ins_app */
WORD ins_app(BYTE *pfname, ANODE *pa)
{			       
	LONG	tree;
	ANODE	*newpa;
	BYTE	pname[12];
	BYTE	ntypes[6*8];
	WORD	oicon, nicon;
	WORD	oflag, nflag;
	WORD	change, field;
	WORD	uninstalled, h;
#if MULTIAPP
	BYTE	memszstr[4];
	WORD	omemsz, nmemsz;
#endif

	tree = G.a_trees[ADINSAPP];
#if MULTIAPP
	LWSET(OB_NEXT(APMEMBOX),APMEMSZ);
#endif
	h = LWGET(OB_HEIGHT(APSCRLBA));
	LWSET(OB_HEIGHT(APFUPARO), gl_hbox + 2);
	LWSET(OB_Y(APFSVSLI), gl_hbox + 2);
	LWSET(OB_HEIGHT(APFSVSLI), h - (2 * (gl_hbox + 2)));
	LWSET(OB_Y(APFDNARO), h - (gl_hbox + 2));
	LWSET(OB_HEIGHT(APFDNARO), gl_hbox + 2);

	uninstalled = !is_installed(pa);
	LWSET(OB_STATE(APREMV), (uninstalled) ? DISABLED : NORMAL );
	/* stuff in appl name */
	fmt_str(pfname, &pname[0]);
	inf_sset(tree, APNAME, &pname[0]);
	/* stuff in docu types */
	insa_stypes(tree, pa->a_pdata);
	LWSET(OB_STATE(APYMEM), NORMAL);
	oflag = pa->a_flags;
	if (pa->a_flags & AF_ISCRYS)
	{
		field = APGEM;
		LWSET(OB_STATE(APYMEM), DISABLED);
	}
	else
		field = (pa->a_flags & AF_ISPARM) ? APPARMS : APDOS;
	LWSET(OB_STATE(field), SELECTED);

	field = (pa->a_flags & AF_ISFMEM) ? APYMEM : APNMEM;
	LWSET(OB_STATE(field), SELECTED);

	oicon = pa->a_aicon - IA_GENERIC;

#if MULTIAPP
	omemsz = pa->a_memreq;
	merge_str(&memszstr[0], "%W", &omemsz);
	inf_sset(tree, APMEMSZ, &memszstr[0]);
#endif

	insa_elev(tree, oicon, gl_numics);
	nicon = insa_dial(tree, oicon, gl_numics);
	change = FALSE;

#if MULTIAPP
	nmemsz = ins_latoi(LLGET(LLGET(OB_SPEC(APMEMSZ))));
#endif

	/* set memory flag */
	field = inf_gindex(tree, APYMEM, 2);
	nflag = (field == 0) ? AF_ISFMEM : 0;
	LWSET(OB_STATE(APYMEM + field), NORMAL);
	/* set type flags */
	field = inf_gindex(tree, APGEM, 3);
	if (field == 0)
		nflag = AF_ISCRYS | AF_ISGRAF;
	if (field == 2)
		nflag |= AF_ISPARM;
	LWSET(OB_STATE(APGEM + field), NORMAL);
	/* get button selection	*/
	field = inf_gindex(tree, APINST, 3);
	LWSET(OB_STATE(APINST + field), NORMAL);

	if ( field == 0 )
	{
		/* install the appl. if its uninstalled or has new types */
		insa_gtypes(tree, &ntypes[0]);
		if ( (uninstalled) || (!strcmp(&ntypes[0], pa->a_pdata)) )
		{
			newpa = (uninstalled) ? app_alloc(TRUE) : pa;

			if (newpa)
			{
				if ( (uninstalled) || (!strcmp(&ntypes[0], pa->a_pdata)) )
				{
					change = TRUE;
					ntypes[ strlen(&ntypes[0]) ] = '@';
					scan_str(&ntypes[0], &newpa->a_pdata);
				}

				if (newpa != pa)
				{
					uninstalled = change = TRUE;
					strcpy(&ntypes[0], pfname);
					ntypes[ strlen(&ntypes[0]) ] = '@';
					scan_str(&ntypes[0], &newpa->a_pappl);
					newpa->a_flags = nflag;
					newpa->a_type = AT_ISFILE;
					newpa->a_obid = NIL;
					newpa->a_letter = '\0';
					newpa->a_xspot = 0x0;
					newpa->a_yspot = 0x0;
				}
				pa = newpa;
			}
			else
				fun_alert(1, STAPGONE, NULL);
		}
		/* see if icon changed or flags changed */
		if ( (uninstalled) ||
#if MULTIAPP
			(omemsz != nmemsz) ||
#endif
			(oicon != nicon) ||
			(oflag != nflag) )
		{
			change = TRUE;
			pa->a_aicon = nicon + IA_GENERIC;
			pa->a_dicon = nicon + ID_GENERIC;
			pa->a_flags = nflag;
#if MULTIAPP
			pa->a_memreq = nmemsz;
#endif
		}
	}
	else if ( field == 1 )
	{
		/* remove installed app	*/
		if ( !uninstalled )
		{
			app_free(pa);
			change = TRUE;
		}
	}
	return(change);
} /* ins_app */
Ejemplo n.º 13
0
VOID edit_icon(LONG tree, WORD sobj)
{
	LONG	obspec, taddr; 
	WORD	where, type, itmp, exitobj, ok;
	GRECT	p;
	BYTE	text[14], valid[2], name[9]; 
	WORD	trule, crule, w, h;

	if (rcs_state != ALRT_STATE)
	{
		get_fields(tree, sobj, &type, &obspec, &p);

		ini_tree(&tree, ICONDIAL);
		where = set_obname(tree, ICONNAME, name, ad_view, sobj);
		taddr = LLGET(obspec);
		set_text(tree, IBTEXT, (LONG)ADDR(&text[0]), 13);
		set_text(tree, IBCHAR, (LONG)ADDR(&valid[0]), 2);
		icon_set(taddr, &text[0], &valid[0]);
		trule = icon_twhich(LWGET(IB_YTEXT(taddr)), LWGET(IB_HICON(taddr)));
		sel_obj(tree, IBTPOS0 + trule);
		itmp = icon_cwhich(LWGET(IB_YCHAR(taddr)),
			gl_hschar, LWGET(IB_HICON(taddr)));
		crule = icon_cwhich(LWGET(IB_XCHAR(taddr)),
			gl_wschar, LWGET(IB_WICON(taddr)));
		crule += 3 * itmp;
		sel_obj(tree, IBCPOS0 + crule);

		do {
			exitobj = hndl_dial(tree, IBTEXT, &p);
			desel_obj(tree, exitobj);
			ok = DEFAULT & GET_FLAGS(tree, exitobj);
		} while (ok && !name_ok(name, where, TRUE));

		if (ok)
		{
			rcs_edited = TRUE;
			get_obname(name, ad_view, sobj);
			icon_get(taddr, &text[0], &valid[0]);
			itmp = encode(tree, IBTPOS0, 3);
			if (itmp != trule)
			{		
				itmp = icon_tapply(itmp, gl_hschar,
					LWGET(IB_HICON(taddr)));
				LWSET(IB_YTEXT(taddr), itmp);
			}
			LWSET(IB_WTEXT(taddr), (WORD)(gl_wschar * strlen(text)));
			icon_tfix(taddr);
			itmp = encode(tree, IBCPOS0, 9);
			if (itmp != crule)
			{
				crule = itmp;
				itmp = icon_capply(crule / 3, gl_hschar,
					LWGET(IB_HICON(taddr)));
				LWSET(IB_YCHAR(taddr), itmp);
				itmp = icon_capply(crule % 3, gl_wschar,
					LWGET(IB_WICON(taddr)));
				LWSET(IB_XCHAR(taddr), itmp);
			}
			icon_wh(taddr, &w, &h);
			newsize_obj(ad_view, sobj, w, h, FALSE);
		}
		map_tree(tree, ROOT, NIL, (fkt_parm)desel_obj);	/* clear radio buttons */
	}
}
Ejemplo n.º 14
0
VOID edit_str(LONG tree, WORD sobj)
{
	LONG	obspec; 
	WORD	where, type, exitobj, ok;
	GRECT	p;
	WORD	min_width, neww, len; 
	BYTE	text[73], name[9]; 

	get_fields(tree, sobj, &type, &obspec, &p);
	len = (WORD)LSTRLEN(LLGET(obspec));
	if (len <= 72)
	{
		ini_tree(&tree, STRDIAL);
		where = set_obname(tree, STRNAME, name, ad_view, sobj);
		set_text(tree, OSTRITEM, (LONG)ADDR(&text[0]), 73);
		LLSTRCPY(LLGET(obspec), (LONG)ADDR(&text[0]));
		if ( rcs_state == ALRT_STATE )
			hide_obj( tree, STRNAME);
		if (!text[0])
			text[0] = '@';
		do {
			exitobj = hndl_dial(tree, OSTRITEM, &p);
			desel_obj(tree, exitobj);
			ok = DEFAULT & GET_FLAGS(tree, exitobj);
		} while ( ok && !name_ok(name, where, TRUE));

		if (ok)
		{
			rcs_edited = TRUE;
			get_obname(name, ad_view, sobj);
			if (text[0] == '@')
				text[0] = '\0';

			if (rcs_state == ALRT_STATE)
			{		
				if (strlen(text) > 40 )
				{
					hndl_alert(1, string_addr(STOOLONG));
					text[40] = '\0';
				}
				update_if(obspec, &text[0]);
				fix_alert(ad_view);
				unhide_obj(tree, STRNAME);
			}
			else
			{
				neww = (WORD)(gl_wchar * strlen(text));
				if (rcs_state == MENU_STATE)
				{
					if (type == G_TITLE)
					{
						if (!newsize_obj(ad_view, sobj, neww,gl_hchar, TRUE))
							text[len] = '\0';
						fix_menu_bar(ad_view);
					}
					else if (in_which_menu(ad_view, sobj) == 1
						&& in_menu(ad_view, sobj) == 1
						&& strlen(text) > 20 )
		    		{
						hndl_alert(1, string_addr(STOOLONG));	
						text[20] = '\0';
					}
					else  if(!newsize_obj(ad_view, sobj, neww,gl_hchar, FALSE))
						text[len] = '\0';
				}
				else if (type == G_STRING || type == G_BUTTON )
				{
					min_width = GET_WIDTH(ad_view, sobj);
					if( neww > min_width )
						if(!newsize_obj(ad_view, sobj, neww,gl_hchar, FALSE))
							text[len] = '\0';
				}
			}
			if( rcs_state != ALRT_STATE)
				update_if(obspec, &text[0]);
		}
	}
}
Ejemplo n.º 15
0
LONG GET_SPEC(LONG tree, WORD x)
{
	return LLGET(obj_addr(tree, x, 12));
}
Ejemplo n.º 16
0
LONG img_addr(WORD n)
{
	return LLGET(img_ptr(n));
}
Ejemplo n.º 17
0
VOID edit_text(LONG tree, WORD sobj)
{
	LONG	obspec, taddr; 
	WORD	min_width, where, type, deftext, w, h, exitobj, ok;
	GRECT	p;
	BYTE	text[73], valid[73], tmplt[73], name[9]; 

	if (rcs_state != ALRT_STATE)
	{
		get_fields(tree, sobj, &type, &obspec, &p);
		taddr = LLGET(obspec);
		if (type == G_FTEXT || type == G_FBOXTEXT)
			if (LSTRLEN(LLGET(TE_PTMPLT(taddr))) > 72)
				return;
		ini_tree(&tree, TEXTDIAL);
		where = set_obname(tree, TEXTNAME, name, ad_view, sobj);
		set_text(tree, OTMPITEM, (LONG)ADDR(&tmplt[0]), 73);
		set_text(tree, OVALITEM, (LONG)ADDR(&valid[0]), 73);
		set_text(tree, OTEXITEM, (LONG)ADDR(&text[0]), 73);
		LLSTRCPY(LLGET(TE_PTMPLT(taddr)), (LONG)ADDR(&tmplt[0]));
		ted_set(taddr, &tmplt[0], &valid[0], &text[0]);

		if (type == G_TEXT || type == G_BOXTEXT)
		{
			if (LSTRLEN(LLGET(TE_PTEXT(taddr))) > 72)
				return;
			hide_obj(tree, TMPLTTAG);
			hide_obj(tree, OTMPITEM);
			hide_obj(tree, VALIDTAG);
			hide_obj(tree, OVALITEM);
			deftext = OTEXITEM;
		}		   
		else
			deftext = (tmplt[0] != '@')? OTMPITEM: OTEXITEM;
		do {
			exitobj = hndl_dial(tree, deftext, &p);
			desel_obj(tree, exitobj);
			ok = DEFAULT & GET_FLAGS(tree, exitobj);
		} while (ok && !name_ok(name, where, TRUE));

		if (ok)
		{
			rcs_edited = TRUE;
			get_obname(name, ad_view, sobj);
			ted_get(taddr, &tmplt[0], &valid[0], &text[0]);
			if (type == G_TEXT || type == G_FTEXT || type == G_BOXTEXT)
			{
				text_wh(taddr, type, &w, &h);
				min_width = GET_WIDTH(ad_view, sobj);
				if ( w > min_width)
					newsize_obj(ad_view, sobj, w, h, TRUE);
			}
		}

		unhide_obj(tree,TMPLTTAG);
		unhide_obj(tree,OTMPITEM);
		unhide_obj(tree, VALIDTAG);
		unhide_obj(tree,OVALITEM);
		map_tree(tree, ROOT, NIL, (fkt_parm)desel_obj);	/* clear radio buttons */
	}
}
Ejemplo n.º 18
0
static UWORD crysbind(WORD opcode, LONG pglobal, WORD control[], WORD int_in[], WORD int_out[], LONG addr_in[])
{
        LONG    maddr;
        LONG    tree;
        WORD    mouse, ret;
        WORD    unsupported = FALSE;

        maddr = 0;
        ret = TRUE;

        switch(opcode)
        {       
                                /* Application Manager                  */
          case APPL_INIT:
#if DBG_GEMSUPER
                aestrace("appl_init()");
#endif
                LWSET(pglobal, AES_VERSION);    /* version number       */
                LWSET(pglobal+2, 0x0001);       /* num of concurrent procs*/
/*              LLSET(pglobal, 0x00010200L);
*/
                LWSET(pglobal+4, rlr->p_pid);
                sh_deskf(0, pglobal+6);
                LWSET(pglobal+20, gl_nplanes);
                LLSET(pglobal+22, ADDR(&D));
                                                /* reset dispatcher     */
                                                /*  count to let the app*/
                                                /*  run a while.        */
                dspcnt = 0;
                ret = ap_init();
                break;
          case APPL_READ:
          case APPL_WRITE:
                ap_rdwr(opcode == APPL_READ ? MU_MESAG : MU_SDMSG, 
                        fpdnm(NULLPTR, AP_RWID), AP_LENGTH, AP_PBUFF);
                break;
          case APPL_FIND:
                ret = ap_find( AP_PNAME );
                break;
          case APPL_TPLAY:
                ap_tplay(AP_TBUFFER, AP_TLENGTH, AP_TSCALE);
                break;
          case APPL_TRECORD:
                ret = ap_trecd(AP_TBUFFER, AP_TLENGTH);
                break;
#if CONF_WITH_PCGEM
          case APPL_YIELD:
                dsptch();
                break;
#endif
          case APPL_EXIT:
#if DBG_GEMSUPER
                aestrace("appl_exit()");
#endif
                ap_exit();
                break;
                                /* Event Manager                        */
          case EVNT_KEYBD:
                  ret = ev_block(MU_KEYBD, 0x0L);
                break;
          case EVNT_BUTTON:
                ret = ev_button(B_CLICKS, B_MASK, B_STATE, &EV_MX);
                break;
          case EVNT_MOUSE:
                ret = ev_mouse((MOBLK *)&MO_FLAGS, &EV_MX);
                break;
          case EVNT_MESAG:
#if DBG_GEMSUPER
                aestrace("evnt_mesag()");
#endif
                ap_rdwr(MU_MESAG, rlr, 16, ME_PBUFF);
                break;
          case EVNT_TIMER:
                ev_timer( HW(T_HICOUNT) + LW(T_LOCOUNT) );
                break;
          case EVNT_MULTI:
#if DBG_GEMSUPER
                aestrace("evnt_multi()");
#endif
                if (MU_FLAGS & MU_TIMER)
                  maddr = HW(MT_HICOUNT) + LW(MT_LOCOUNT);
                tree = HW(MB_CLICKS) | LW((MB_MASK << 8) | MB_STATE);
                ret = ev_multi(MU_FLAGS, (MOBLK *)&MMO1_FLAGS, (MOBLK *)&MMO2_FLAGS, 
                        maddr, tree, MME_PBUFF, &EV_MX);
                break;
          case EVNT_DCLICK:
                ret = ev_dclick(EV_DCRATE, EV_DCSETIT);
                break;
                                /* Menu Manager                         */
          case MENU_BAR:
                if (gl_mnppd == rlr || gl_mnppd == NULL)
                  mn_bar(MM_ITREE, SHOW_IT, rlr->p_pid);
                else
                  menu_tree[rlr->p_pid] = (SHOW_IT) ? MM_ITREE : 0x0L;
                break;
          case MENU_ICHECK:
                do_chg(MM_ITREE, ITEM_NUM, CHECKED, CHECK_IT, FALSE, FALSE);
                break;
          case MENU_IENABLE:
                do_chg(MM_ITREE, (ITEM_NUM & 0x7fff), DISABLED, 
                        !ENABLE_IT, ((ITEM_NUM & 0x8000) != 0x0), FALSE);
                break;
          case MENU_TNORMAL:
                if (gl_mntree == menu_tree[rlr->p_pid])
                  do_chg(MM_ITREE, TITLE_NUM, SELECTED, !NORMAL_IT, 
                                TRUE, TRUE);
                break;
          case MENU_TEXT:
                tree = MM_ITREE;
                strcpy((char *)LLGET(OB_SPEC(ITEM_NUM)), 
                         (char *)MM_PTEXT);   
                break;
          case MENU_REGISTER:
                ret = mn_register(MM_PID, MM_PSTR);
                break;
          case MENU_UNREGISTER:
#if CONF_WITH_PCGEM
                /* distinguish between menu_unregister() and menu_popup() */
                if (IN_LEN == 1)
                  mn_unregister( MM_MID );
                else
#endif
                  unsupported = TRUE;
                break;
          case MENU_CLICK:
                /* distinguish between menu_click() and menu_attach() */
                /*
                 * although menu_click() is PC-GEM only, it's always
                 * enabled because the desktop uses it.
                 */
                if (IN_LEN == 2) {
                  if (MN_SETIT)
                    gl_mnclick = MN_CLICK;
                  ret = gl_mnclick;
                } else
                  unsupported = TRUE;
                break;
                                /* Object Manager                       */
          case OBJC_ADD:
                ob_add(OB_TREE, OB_PARENT, OB_CHILD);
                break;
          case OBJC_DELETE:
                ob_delete(OB_TREE, OB_DELOB);
                break;
          case OBJC_DRAW:
                gsx_sclip((GRECT *)&OB_XCLIP);
                ob_draw(OB_TREE, OB_DRAWOB, OB_DEPTH);
                break;
          case OBJC_FIND:
                ret = ob_find(OB_TREE, OB_STARTOB, OB_DEPTH, 
                                OB_MX, OB_MY);
                break;
          case OBJC_OFFSET:
                ob_offset(OB_TREE, OB_OBJ, &OB_XOFF, &OB_YOFF);
                break;
          case OBJC_ORDER:
                ob_order(OB_TREE, OB_OBJ, OB_NEWPOS);
                break;
          case OBJC_EDIT:
                gsx_sclip(&gl_rfull);
                OB_ODX = OB_IDX;
                ret = ob_edit(OB_TREE, OB_OBJ, OB_CHAR, &OB_ODX, OB_KIND);
                break;
          case OBJC_CHANGE:
                gsx_sclip((GRECT *)&OB_XCLIP);
                ob_change(OB_TREE, OB_DRAWOB, OB_NEWSTATE, OB_REDRAW);
                break;
                                /* Form Manager                         */
          case FORM_DO:
                ret = fm_do(FM_FORM, FM_START);
                break;
          case FORM_DIAL:
                ret = fm_dial(FM_TYPE, (GRECT *)&FM_X);
                break;
          case FORM_ALERT:
                ret = fm_alert(FM_DEFBUT, FM_ASTRING);
                break;
          case FORM_ERROR:
                ret = fm_error(FM_ERRNUM);
                break;
          case FORM_CENTER:
                ob_center(FM_FORM, (GRECT *)&FM_XC);
                break;
          case FORM_KEYBD:
                gsx_sclip(&gl_rfull);
                FM_OCHAR = FM_ICHAR;
                FM_ONXTOB = FM_INXTOB;
                ret = fm_keybd(FM_FORM, FM_OBJ, &FM_OCHAR, &FM_ONXTOB);
                break;
          case FORM_BUTTON:
                gsx_sclip(&gl_rfull);
                ret = fm_button(FM_FORM, FM_OBJ, FM_CLKS, &FM_ONXTOB);
                break;
                                /* Graphics Manager                     */
          case GRAF_RUBBOX:
                gr_rubbox(GR_I1, GR_I2, GR_I3, GR_I4, 
                          &GR_O1, &GR_O2);
                break;
          case GRAF_DRAGBOX:
                gr_dragbox(GR_I1, GR_I2, GR_I3, GR_I4, (GRECT *)&GR_I5, 
                           &GR_O1, &GR_O2);
                break;
          case GRAF_MBOX:
                gr_movebox(GR_I1, GR_I2, GR_I3, GR_I4, GR_I5, GR_I6);
                break;
          case GRAF_GROWBOX:
                gr_growbox((GRECT *)&GR_I1, (GRECT *)&GR_I5);
                break;
          case GRAF_SHRINKBOX:
                gr_shrinkbox((GRECT *)&GR_I1, (GRECT *)&GR_I5);
                break;
          case GRAF_WATCHBOX:
                ret = gr_watchbox(GR_TREE, GR_OBJ, GR_INSTATE, GR_OUTSTATE);
                break;
          case GRAF_SLIDEBOX:
                ret = gr_slidebox(GR_TREE, GR_PARENT, GR_OBJ, GR_ISVERT);
                break;
          case GRAF_HANDLE:
                GR_WCHAR = gl_wchar;
                GR_HCHAR = gl_hchar;
                GR_WBOX = gl_wbox;
                GR_HBOX = gl_hbox;
                ret = gl_handle;
                break;
          case GRAF_MOUSE:
                if (GR_MNUMBER > 255)
                {
                  if (GR_MNUMBER == M_OFF)
                    gsx_moff();
                  if (GR_MNUMBER == M_ON)
                    gsx_mon();
                }
                else
                {
                  if (GR_MNUMBER != 255)                
                  {
                    switch(GR_MNUMBER) {
                      case 1:
                        mouse = MICE01;
                        break;
                      case 2:
                        mouse = MICE02;
                        break;
                      case 3:
                        mouse = MICE03;
                        break;
                      case 4:
                        mouse = MICE04;
                        break;
                      case 5:
                        mouse = MICE05;
                        break;
                      case 6:
                        mouse = MICE06;
                        break;
                      case 7:
                        mouse = MICE07;
                        break;
                      default:
                        mouse = MICE00;
                        break;
                    }
                    maddr = *(LONG *) &rs_bitblk[mouse];
                  }
                  else
                    maddr = GR_MADDR;
                  gsx_mfset(maddr);
                }
                break;
          case GRAF_MKSTATE:
                gr_mkstate(&GR_MX, &GR_MY, &GR_MSTATE, &GR_KSTATE);
                break;
                                /* Scrap Manager                        */
          case SCRP_READ:
                ret = sc_read((BYTE*)SC_PATH);
                break;
          case SCRP_WRITE:
                ret = sc_write((const BYTE*)SC_PATH);
                break;
#if CONF_WITH_PCGEM
          case SCRP_CLEAR:
                ret = sc_clear();
                break;
#endif
                                /* File Selector Manager                */
          case FSEL_INPUT:
                ret = fs_input((BYTE*)FS_IPATH, (BYTE*)FS_ISEL, &FS_BUTTON, NULL);
                break;
          case FSEL_EXINPUT:
                ret = fs_input((BYTE*)FS_IPATH, (BYTE*)FS_ISEL, &FS_BUTTON, (BYTE *)FS_ILABEL);
                break;
                                /* Window Manager                       */
          case WIND_CREATE:
                ret = wm_create(WM_KIND, (GRECT *)&WM_WX);
                break;
          case WIND_OPEN:
                wm_open(WM_HANDLE, (GRECT *)&WM_WX);
                break;
          case WIND_CLOSE:
                wm_close(WM_HANDLE);
                break;
          case WIND_DELETE:
                wm_delete(WM_HANDLE);
                break;
          case WIND_GET:
                wm_get(WM_HANDLE, WM_WFIELD, &WM_OX);
                break;
          case WIND_SET:
                  wm_set(WM_HANDLE, WM_WFIELD, &WM_IX);
                  break;
          case WIND_FIND:
                ret = wm_find(WM_MX, WM_MY);
                break;
          case WIND_UPDATE:
                wm_update(WM_BEGUP);
                break;
          case WIND_CALC:
                wm_calc(WM_WCTYPE, WM_WCKIND, WM_WCIX, WM_WCIY, 
                        WM_WCIW, WM_WCIH, &WM_WCOX, &WM_WCOY, 
                        &WM_WCOW, &WM_WCOH);
                break;
          case WIND_NEW:
                wm_new();
                break;
                                /* Resource Manager                     */
          case RSRC_LOAD:
                ret = rs_load(pglobal, RS_PFNAME);
                break;
          case RSRC_FREE:
                ret = rs_free(pglobal);
                break;
          case RSRC_GADDR:
                ret = rs_gaddr(pglobal, RS_TYPE, RS_INDEX, &ad_rso);
                break;
          case RSRC_SADDR:
                ret = rs_saddr(pglobal, RS_TYPE, RS_INDEX, RS_INADDR);
                break;
          case RSRC_OBFIX:
                rs_obfix(RS_TREE, RS_OBJ);
                break;
                                /* Shell Manager                        */
          case SHEL_READ:
                sh_read((BYTE*)SH_PCMD, (BYTE*)SH_PTAIL);
                break;
          case SHEL_WRITE:
                ret = sh_write(SH_DOEX, SH_ISGR, SH_ISCR, (const BYTE*)SH_PCMD, (const BYTE*)SH_PTAIL);
                break;
          case SHEL_GET:
                sh_get((void*)SH_PBUFFER, SH_LEN);
                break;
          case SHEL_PUT:
                sh_put((const void *)SH_PDATA, SH_LEN);
                break;
          case SHEL_FIND:
                ret = sh_find((BYTE*)SH_PATH);
                break;
          case SHEL_ENVRN:
                sh_envrn((BYTE**)SH_PATH, (const BYTE*)SH_SRCH);
                break;
#if CONF_WITH_PCGEM
          case SHEL_RDEF:
                sh_rdef((BYTE*)SH_LPCMD, (BYTE*)SH_LPDIR);
                break;
          case SHEL_WDEF:
                sh_wdef((const BYTE*)SH_LPCMD, (const BYTE*)SH_LPDIR);
                break;
#endif
          default:
                unsupported = TRUE;
                break;
        }

        if (unsupported) {
            kprintf("Bad AES function %d\n", opcode);
            if (opcode != 0)    /* Ignore the 0 since some PRGs are this call */
                fm_show(ALNOFUNC, &opcode, 1);
            ret = -1;
        }

        return(ret);
}