Path: utzoo!utgpu!water!watmath!clyde!att!att-ih!pacbell!ames!pasteur!ucbvax!decwrl!hplabs!hpda!hpcuhb!hpcllla!hpclisp!hpclscu!shankar From: shankar@hpclscu.HP.COM (Shankar Unni) Newsgroups: comp.sys.hp Subject: Re: Traps Message-ID: <1340015@hpclscu.HP.COM> Date: 27 Apr 88 20:51:52 GMT References: <4654@cup.portal.com> Organization: HP NSG/ISD Computer Language Lab Lines: 42 > ................................................. I used the general > scheme described in my (old) copy of the Pascal/3000 manual (p10-19) and it > worked fine. The slightly tricky bit in Pascal is that you can't go > branching off to anywhere, you have to either exit the program or set a > flag which is checked edxternally (good programming practice anyway). > but that's the language. You also won't be able to "return normally" with absolute certainty. Apparently, when you hit a Control-Y, a variable number of words is pushed onto (or left on) the stack. The stack layout looks vaguely like this (pp 4-38..4-42 of the MPE Intrinsics Manual (30000-90010)): | | | User prog stack | |-----------------------| | | | User stack marker | <--- Q-2 = relative P | | | | |-----------------------| <--- Q | | n | <--- Q+1 (n = number of words) |-----------------------| | | | | |-----------------------| <--- S | | | ControlY proc data | | | The value of "n" will be > 0 if the Cntl-Y interrupted a system intrinsic, and it is then the user program's responsibility to peel back the stack (the control-Y will *not* return to the intrinsic (I don't think so)). There is no way of doing this reliably in Pascal, and if the "n" words are not popped, then the stack will sooner or later be trashed. The above mentioned reference (the Intrinsics manual) has an interesting description of the exact workings of the Control-Y trap (morbidly fascinating, if you enjoy this kind of stuff). Enjoy, --Shankar Unni