win-demo.red 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. procedure BufferNames;
  2. Mapcar(WindowList,'cdar);
  3. BufferNames();
  4. procedure FindWindowName N;
  5. FindWindowField('WindowsBufferName,N);
  6. procedure FindWindowField(F,N);
  7. begin scalar x;
  8. x:=WindowList;
  9. l: if null x then return NIL;
  10. if Cdr atsoc(F,car x) eq N then return car x;
  11. x:=cdr x;
  12. goto l
  13. end;
  14. procedure SelectName N;
  15. Begin scalar x;
  16. x:=FindWindowName N;
  17. SelectWindow x;
  18. end;
  19. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  20. % Following stuff is used to set up a BREAK window
  21. <<
  22. % Create the BREAK buffer
  23. BreakBuffer:=CreateBuffer('!B!r!e!a!k, eval DefaultMode);
  24. % Create the window to look into the buffer.
  25. BreakWindow :=
  26. FramedWindowDescriptor('!B!r!e!a!k,
  27. % Starts at column 50, Near top of screen
  28. Coords(50,1),
  29. % Dimensions are roughly 29 by 10?
  30. Coords(28,9));
  31. % Set up the buffer text.
  32. SelectBuffer '!B!r!e!a!k;
  33. !$CRLF();
  34. Insert_string("q % To quit");
  35. !$CRLF();
  36. Insert_string("t % To traceback");
  37. !$CRLF();
  38. Insert_string("i % Trace interpreted stuff");
  39. !$CRLF();
  40. Insert_string("r % Retry");
  41. !$CRLF();
  42. Insert_string("c %Continue,");
  43. !$CRLF();
  44. Insert_string(" %using last value");
  45. !$CRLF();
  46. DeselectBuffer '!B!r!e!a!k;
  47. CopyD('Oldbreak,'Break);
  48. Flag('(Break),'User);
  49. >>;
  50. procedure Break;
  51. Begin Scalar W;
  52. W:=CurrentWindowdescriptor;
  53. SelectWindow BreakWindow$
  54. !$BeginningOfBuffer(); % Place point at start of buffer.
  55. % Transfer control to the original break handler.
  56. Catch(NIL, OldBreak() );
  57. % When finished, "pop" our screen off of the physical screen.
  58. DeselectScreen CurrentVirtualScreen;
  59. SelectWindow W; % Back to the window we originally had.
  60. % If !*QuitBreak then StdError "exit"; % ????
  61. end;
  62. car 1; % Execute this to test the system.