jln@eecs.nwu.edu (John Norstad) (11/17/88)
A programmer came to me with a problem I couldn't solve. Perhaps
one of you knows the answer. The SlotVInstall function is returning
error code -2 (invalid queue element) even though the qType field
of the VBLTask record is properly set to vType (1). IM V-566 states
explicitly that qType should be set to vType. I wrote a very
simple MPW C tool that fails in this way (prints -2) when run
on a Mac II:
#define __ALLNU__ 1
#include <Types.h>
#include <OSUtils.h>
#include <Retrace.h>
VBLTask myTask;
pascal void doit() {}
main() {
myTask.qType = vType;
myTask.vblAddr = doit;
myTask.vblCount = 10;
myTask.vblPhase = 0;
printf("%d\n", SlotVInstall(myTask, 0));
}
I know absolutely nothing about slots or the slot manager, but it seems
to me that my little test program above should have worked. The program
works fine if I replace the call to SlotVInstall with a call to VInstall.
Could the problem be a bad slot number in the call?
Please respond at the address below. The address in the header of this
posting is bogus.
John Norstad
Academic Computing and Network Services
Northwestern University
Bitnet: jln@nuacc
Internet: jln@nuacc.acns.nwu.edu
alexis@ccnysci.UUCP (Alexis Rosen) (11/18/88)
Is it possible that you're working with bad glue code? There was some discussion of this a few months back. There is a fairly recent tech note on the subject which was _wrong_ and another which corrected the mistake. If you can't find the references I can try to track it down. ---- Alexis Rosen alexis@dasys1.UUCP or alexis@ccnysci.UUCP Writing from {allegra,philabs,cmcl2}!phri\ The Big Electric Cat uunet!dasys1!alexis Public UNIX {portal,well,sun}!hoptoad/
jln@eecs.nwu.edu (John Norstad) (11/19/88)
I discovered the reason why my SlotVInstall call failed in MPW C - it's bad glue in the MPW library {Libraries}Interface.o. I thought it worthwhile to alert people to the problem, hence this follow-up posting. The header file Retrace.h defines SlotVInstall as follows: pascal OSErr SlotVInstall (VBLBlockPtr, theSlot) QElemPtr VBLBLockPtr; short theSlot; extern; I set a breakpoint on the SlotVInstall trap using MacsBug and discovered that the glue code is the following: movea.l (a7)+,a1 movea.l (a7)+,a0 move.w (a7)+,d0 _SlotVInstall move.w d0,(a7) jmp (a1) This glue code is popping the two parameters in the wrong order. The trap is getting both a bad pointer to the parameter block and a bad slot number. The second and third lines of code above should be interchanged. I've checked both the MPW 2.0 and 2.0.2 Interface.o libraries, and the have the same bad glue. I don't use MPW Pascal, but it seems to me that it would have the same problem, since it uses the same glue routine as MPW C in this case. This doesn't completely solve my problem, because the programmer I'm trying to help is actually using LS Pascal, not MPW C! It's probably something similar, and I'll have to investigate further. Thanks to the folks who sent me notes and pointed out the missing & in my test program. This wasn't the problem, however - I had the & in my test program, but it mysteriously disappeared in my posting. John Norstad Academic Computing and Network Services Northwestern University Bitnet: jln@nuacc Internet: jln@nuacc.acns.nwu.edu
mjohnson@Apple.COM (Mark Johnson) (11/19/88)
In article <10050050@eecs.nwu.edu> jln@eecs.nwu.edu (John Norstad) writes: > >I discovered the reason why my SlotVInstall call failed in MPW C - >it's bad glue in the MPW library {Libraries}Interface.o. I thought >it worthwhile to alert people to the problem, hence this follow-up posting. > >The header file Retrace.h defines SlotVInstall as follows: > >pascal OSErr SlotVInstall (VBLBlockPtr, theSlot) > QElemPtr VBLBLockPtr; > short theSlot; > extern; > >I set a breakpoint on the SlotVInstall trap using MacsBug and >discovered that the glue code is the following: > > movea.l (a7)+,a1 > movea.l (a7)+,a0 > move.w (a7)+,d0 > _SlotVInstall > move.w d0,(a7) > jmp (a1) > >This glue code is popping the two parameters in the wrong order. >The trap is getting both a bad pointer to the parameter block and >a bad slot number. The second and third lines of code above >should be interchanged. > >I've checked both the MPW 2.0 and 2.0.2 Interface.o libraries, and >the have the same bad glue. > This problem with the MPW interface file is documented in Tech Note #200 on page 13. It has been corrected in MPW 3.0 which is available from APDA in beta form.