From: Arthur N. <ac...@ca...> - 2012-01-29 08:24:29
|
On Sun, 29 Jan 2012, Andrey G. Grozin wrote: > Hello *, > > In psl reduce I can do > > ------------------------------------------------ > grozin@elrond ~/reduce-1535/bin $ ./redpsl > Reduce (Free PSL version), 21-Dec-2011 ... > > 1: lisp$ > > 2* copyd('setpchar!-orig,'setpchar)$ > > 3* procedure setpchar!-my(c); > 3* begin scalar w; > 3* w:=setpchar!-orig(c); > 3* promptstring!*:="xx "; > 3* return w > 3* end$ > > 4* copyd('setpchar,'setpchar!-my)$ > *** Function `setpchar' has been redefined > > xx bye; > > Quitting > grozin@elrond ~/reduce-1535/bin $ > ------------------------------------------------ > > In csl reduce this does not work: > > ------------------------------------------------ > grozin@elrond ~/reduce-1535/bin $ ./redcsl -w > Reduce (Free CSL version), 21-Dec-11 ... > > 1: lisp$ > > 2* copyd('setpchar!-orig,'setpchar)$ > > 3* procedure setpchar!-my(c); > 3* begin scalar w; > 3* w:=setpchar!-orig(c); > 3* promptstring!*:="xx "; > 3* return w > 3* end$ > > 4* copyd('setpchar,'setpchar!-my)$ > > 5* bye; > grozin@elrond ~/reduce-1535/bin $ > ------------------------------------------------ > > Is there some equivalent trick for csl reduce? It seems that libreduce.red > and redfront.red use something similar for both psl and csl, e.g. > > if redfront_pslp() then > copyd('setpchar,'redfront_setpchar!-psl) > else > copyd('setpchar,'redfront_setpchar!-csl); > > but I don't see how to make it work in csl. > > Andrey > Your problem is that you are acting as if a variable called promptstring!* has some special meaning. In PSL I guess that that is what actually controls prompts, but in CSL it really is the setpchar function that changes what prompts are generated, so the line you have that goes "promptstring := "xx ";" has no useful effect at all. If you go setpchar!-orig "xx "; instead you may get what you want. I note that several packages clobber setpchar in the sort of way you are trying to - certainly libreduce, redfront and tmprint. The places where I can see it used from older code are in misc/cedit (never used these days???), rlisp/inter.red and rlisp/superv.red (the "real" places where Reduce as such decides what prompt it wants to display). I rather wonder whether some good generic change in rlisp/inter.red and rlisp/superv.red could provide a clean generic hook for people like you to use that did not involve redefining functions and risks of delving down below the level of abstaction there CSL and PSL had come to agreement? Arthur |