ir230@sdcc6.ucsd.edu (john wavrik) (08/26/90)
Dennis Ruffer writes, > I would be hard pressed to alter the size of either stack in most > Forths without recompiling their nucleus' so I wouldn't expect that > to be portable. -2000 SP0 +! will increase the size of the return stack by 2000 bytes on systems laid out in the traditional fashion (with the parameter stack growing downward below the return stack). > However, in ANS Forth, I can at least determine how big the return > stack is so that I can write an application that can tell if it can > run. This is a wonderful idea 8-) It reminds me of the word : OOPs ." You can't do that on this system " ABORT ; All we need to do is find a Standard way of patching OOPs into the outer interpreter and everything will be portable 8-) >> Along the same lines: will there be words analogous to RP0, SP0, >> RP@, SP@? > I can see uses for these operators in defining ways to dump the > stack contents, but I've never had a need for them in application > words. I wouldn't consider debugging aids to be very portable. Can > you cite a specific application need for these words? See the above example for temporarily changing the size of the return stack to allow running a recursive algorithm. Both Len Morgenstern and Mitch Bradley have recently posted error handling mechanisms using these words. I've seen several variations on local variables over the years that use them. They are used in debugging tools and programming aides. (I wouldn't be too quick to dismiss debugging tools as inherently non-portable.) Obviously words like this are mostly used to add language features to Forth; to create programming and diagnostic tools; and to alter the state of the system. They are part of Forth's ability to control Forth. John J Wavrik jjwavrik@ucsd.edu Dept of Math C-012 Univ of Calif - San Diego La Jolla, CA 92093
dwp@willett.pgh.pa.us (Doug Philips) (08/29/90)
In <12412@sdcc6.ucsd.edu>, ir230@sdcc6.ucsd.edu (john wavrik) writes: > -2000 SP0 +! will increase the size of the return stack by 2000 bytes > on systems laid out in the traditional fashion (with the parameter > stack growing downward below the return stack). Since, as others have already pointed out, addressable Parameter and Return stacks aren't possible on Forth Chips, would anyone care to comment on how one *might* write BASIS Forth code to alter those sizes? I would definitely want to hide John's code behind a word, such as 2000 CELLS STACK-ADJUST ( or to be perverse ) -500 CELLS STACK-ADJUST Is stack adjustment really a portability problem in general, or is it *just* the way John wants to do it. -Doug --- Preferred: ( dwp@willett.pgh.pa.us OR ...!{sei,pitt}!willett!dwp ) Daily: ...!{uunet,nfsun}!willett!dwp [last resort: dwp@vega.fac.cs.cmu.edu]