Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!homxb!mtuxo!mtune!rutgers!psuvax1!vu-vlsi!cbmvax!carolyn From: carolyn@cbmvax.UUCP Newsgroups: comp.sys.amiga Subject: Re: MsgPorts, DOS, ACTION_SCREEN_MODE help needed Message-ID: <2663@cbmvax.UUCP> Date: Fri, 30-Oct-87 09:57:40 EST Article-I.D.: cbmvax.2663 Posted: Fri Oct 30 09:57:40 1987 Date-Received: Sun, 1-Nov-87 09:26:13 EST References: <378NU105451@NDSUVM1> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Organization: Commodore Technology, West Chester, PA Lines: 107 In article <378NU105451@NDSUVM1> NU105451@NDSUVM1.BITNET (Walter Reed) writes: >I am working on a version of MicroEmacs that would support either opening >a new window or useing the current window and setting its mode to RAW. >My problem is that I don't know how to get a processes message port. You want the MsgPort ("ProcessID" in BCPLese) of the CON: window. ----- /* sendpkt code - A. Finkel, P. Lindsay, C. Scheppner CBM */ LONG setRawCon(toggle) LONG toggle; /* DOSTRUE (-1L) or DOSFALSE (0L) */ { struct MsgPort *conid; struct Process *me; LONG myargs[8] ,nargs, res1; me = (struct Process *) FindTask(NULL); conid = (struct MsgPort *) me->pr_ConsoleTask; myargs[0]=toggle; nargs = 1; res1 = (LONG)sendpkt(conid,ACTION_SCREEN_MODE,myargs,nargs); return(res1); } LONG findWindow() /* inits conWindow and conUnit (global vars) */ { struct InfoData *id; struct MsgPort *conid; struct Process *me; LONG myargs[8] ,nargs, res1; /* Alloc to insure longword alignment */ id = (struct InfoData *)AllocMem(sizeof(struct InfoData), MEMF_PUBLIC|MEMF_CLEAR); if(! id) return(0); me = (struct Process *) FindTask(NULL); conid = (struct MsgPort *) me->pr_ConsoleTask; myargs[0]=((ULONG)id) >> 2; nargs = 1; res1 = (LONG)sendpkt(conid,ACTION_DISK_INFO,myargs,nargs); conWindow = (struct Window *)id->id_VolumeNode; conUnit = (struct ConUnit *) ((struct IOStdReq *)id->id_InUse)->io_Unit; FreeMem(id,sizeof(struct InfoData)); return(res1); } LONG sendpkt(pid,action,args,nargs) struct MsgPort *pid; /* process indentifier ... (handlers message port ) */ LONG action, /* packet type ... (what you want handler to do ) */ args[], /* a pointer to a argument list */ nargs; /* number of arguments in list */ { struct MsgPort *replyport; struct StandardPacket *packet; LONG count, *pargs, res1; replyport = (struct MsgPort *) CreatePort(NULL,0); if(!replyport) return(NULL); packet = (struct StandardPacket *) AllocMem((long)sizeof(struct StandardPacket),MEMF_PUBLIC|MEMF_CLEAR); if(!packet) { DeletePort(replyport); return(NULL); } packet->sp_Msg.mn_Node.ln_Name = (char *)&(packet->sp_Pkt); packet->sp_Pkt.dp_Link = &(packet->sp_Msg); packet->sp_Pkt.dp_Port = replyport; packet->sp_Pkt.dp_Type = action; /* copy the args into the packet */ pargs = &(packet->sp_Pkt.dp_Arg1); /* address of first argument */ for(count=0;count < nargs;count++) pargs[count]=args[count]; PutMsg(pid,packet); /* send packet */ WaitPort(replyport); GetMsg(replyport); res1 = packet->sp_Pkt.dp_Res1; FreeMem(packet,(long)sizeof(struct StandardPacket)); DeletePort(replyport); return(res1); } /* end */ -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CATS >>Commodore Amiga Technical Support<< UUCP ...{allegra,ihnp4,rutgers}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=