Path: utzoo!mnetor!uunet!oddjob!ncar!ames!mailrus!husc6!im4u!ut-sally!utah-cs!thomson From: thomson@utah-cs.UUCP (Richard A Thomson) Newsgroups: comp.sys.amiga.tech Subject: WaitPort, GetMsg, ReplyMsg Message-ID: <5416@utah-cs.UUCP> Date: 18 Apr 88 05:42:47 GMT Reply-To: thomson@cs.utah.edu.UUCP (Richard A Thomson) Followup-To: comp.sys.amiga.tech Distribution: comp Organization: University of Utah CS Dept Lines: 46 Keywords: FORTH IDCMP WaitPort GetMsg ReplyMsg Summary: Why do WaitPort and GetMsg return different pointers? I have been playing around with parsing IntuiMessages in FORTH and I've noticed something a little peculiar. I use WaitPort on the window's IDCMP and then GetMsg to get the message itself. I then copy the code and class fields and then reply to the message via ReplyMsg. The ROM Kernel docs describe the behavior of WaitPort as follows: message = WaitPort(port); port: Pointer to message port to wait on message: Pointer to first message in the port's message list This tells me that after the WaitPort call, message will point to the first message in the list. The funny thing is that when I do a GetMsg(port) I get a different address, although it also is listed as returning a pointer to the first message in the port's message list. What's going on here? I wanted to see if I could do just the following: message = WaitPort(port); code = message->Code; class = message->Class; ReplyMsg(message); Basically I thought that if WaitPort gives me the pointer to the first message in the list, then I could use that pointer to ReplyMsg after I got out the things from the message I cared about. Since the pointers returned by WaitPort and GetMsg are different, I'm still doing the GetMsg while assuming that GetMsg is doing some internal list manipulation. Any clues as to why these two give different pointers? [ FORTH Plug ] By the way, it was easy to figure this out using the interactive capavbilities of the FORTH interpreter; I just called the routines and looked at their results on the stack! I have found FORTH to be a really productive environment on the Amiga so far; and yes, I tried C first. On a 512K dual floppy system C just took tooooooo loooooong. In the same amount of time I spent trying to get a beginning C program to compile [and I'm no novice to C] and run properly, I've been able to understand ALOT about the Amiga internals even though I'm learning FORTH in the process. This isn't the combination for everyone, but I find it really great! [ End plug ] -- Rich Thomson -- -- Rich Richard Thomson 3190 MEB, University of Utah, Salt Lake City, UT 84112 thomson@cs.utah.edu (801) 584-4555: Talk to a machine, they're lonely.