Re: Simple EDT or TPU init file

From: Big John (john.powers_at_airwidesolutions.com)
Date: 12/16/04


Date: 16 Dec 2004 02:35:05 -0800

Hi,

> Big John,

- John will do! When Google groups asked me for a nickname, I
didn't think how it would stick that on all my entries. I
now regret it!

I have to admit that I cannot replicate either of the problems
problems you experience. The keys work whether I type set term
/numeric, or set term/application. I tried hitting a lot of
undefined keys - I even rested my phone on the space bar and
went off to make a cup of coffee - but when I returned and hit
a correct key, it worked fine!

What terminal emulator are you using? It sounds like it is not
fully doing the job. I use Reflections here, but we also still
have some people using Hummingbird Exceed. I tried it on that
and it still worked fine. I have heard that the basic terminal
emulator supplied by Micros**t is a pile of 'soft', but I have
never used it.

Let me know which terminal emulator you use, and if I can find
a copy here I will try it out to see if I get the same problem
as you.

Filling the screen instead of using the first 21 lines is very
easy. The command get_info(screen,"length") gets the info you
need, so you can amend simple .tpu as below.

Cheers, John

SIMPLE.TPU follows..

input_file := GET_INFO (COMMAND_LINE, "file_name");
main_buffer:= CREATE_BUFFER ("main", input_file);
window_size := GET_INFO(screen,"length");

position (BEGINNING_OF (main_buffer));
main_window := create_window(1,window_size,off);

the_key_map := create_key_map ("user_keys");
the_key_map_list := create_key_map_list ("the_keylist", the_key_map);

set (UNDEFINED_KEY, the_key_map_list, "return");
set (KEY_MAP_LIST, the_key_map_list, main_buffer);
set (SELF_INSERT, the_key_map_list, OFF);

MAP (main_window,main_buffer);
message (ascii(27)+"[?25l");

!
define_key ("message(ascii(27)+'[?25h');QUIT (OFF,1)",
kp1,the_key_map);
define_key ("scroll (current_window, 1)", kp2, the_key_map);
define_key ("scroll (current_window, -1)", kp8, the_key_map);
define_key ("scroll (current_window, window_size-1)", kp6,
the_key_map);
define_key ("scroll (current_window, -window_size+1)",kp4,
the_key_map);
define_key ("scroll (current_window, 1)", down, the_key_map);
define_key ("scroll (current_window, -1)", up, the_key_map);
!
Fred Bach wrote:
> Big John,
>
> Thank you for your TPU insight. I don't do much TPU.
>
> I copied your code directly into SIMPLE.TPU in my login
> directory. Right now my SIMPLE symbol is:
>
> SIMPLE ==
"edit/tpu/read/command=SYS$LOGIN:SIMPLE.TPU/noinit/nosection/nojournal"
>
> There are a couple of problems.
>
> First, using SHOW TERMINAL/FULL I find the keypad is usually
> in numeric mode by default to start with. It needs to be in
> application mode before you call SIMPLE or else the keypad
> doesn't work and you can't get out except with a CONTROL-Y.
>
> Second, if you type enough of the undefined keys, there is a
> buffer that gets full somewhere and the terminal beeps and
> nothing happens each time you hit another key, even a legit
> key. This requires me to clear the communications on my
> VT300 X-window on my PC via the Commands pulldown menu, and
> that causes the cursor to show up again. Perhaps the
> type-ahead buffer needs to be zero?? Something needs to be
> done to throw those keys away properly and to make sure they
> do not pile up.
>
> Unlike the original request, it would be nice if SIMPLE could
> fill the existing screen whatever length / width it is. We
> should pick the screen lengths and widths from the existing DCL
> window size before SIMPLE is called. It would still work for
> the size of screen originally specified by the original poster.
>
> Clearly we need to put the necessary DCL setup commands into
> a tidy foolproof little .COM file, SIMPLE.COM . What setup
> commands do you advise? And if one has to change something
> at the DCL level, perhaps one should put it back after SIMPLE
> has finished.
>
> Thanks in advance.
>
> .. fred bach .. music@triumf.ca
>
>
> Big John wrote:
>
> > Peter Weaver wrote
> >
> >
> >>Mike Buchanan wrote:
> >>
> >>>...
> >>>1) Can I make the cursor invisible?
> >>>...
> >>
> >>The only way I can think of doing this depends on how good your
> >
> > terminal
> >
> >>emulator is;
> >>
> >>$ esc[0,8]=27
> >>$ write sys$output "''esc'[?25l"
> >>$ assign sys$command sys$input/user_mode
> >>$ edit/tpu/nosec/comm=sys$login:simple.tpu 'P1
> >>$ write sys$output "''esc'[?25h"
> >>
> >>--
> >
> >
> > This is fine, but you can do it very simply, entirely within the
TPU
> > command. This would make it much easier to set up if you do decide
> > to use the callable TPU directly, instead of spawning out. There
> > are two ways to do it. The 'proper' way would be to set the window
> > not to translate escape sequences, but put them straight out, with
a
> > command like:
> > set (TEXT, main_window, NO_TRANSLATE)
> > - then copy_text the escape sequence, and update the window.
> >
> > However here, there is a simpler solution. Since we are not
trapping
> > messages, but splashing them unaltered straight on to the screen,
we
> > can output the escape sequences with a couple of MESSAGE commands.
> >
> > (There, I believe I said before that it was a much better idea to
> > start from scratch and build, instead of stripping down the EVE
> > section :-).
> >
> > So all you need to do, after you have mapped the window to the
> > buffer is to add the line..
> > message (ascii(27)+"[?25l");
> > .. and change the kp1 key to execute the 2-command sequence..
> > message(ascii(27)+'[?25h');QUIT (OFF,1)
> > .. to switch the cursor back on when exiting.
> >
> >
> > One other point worth mentioning..
> >
> > If you don't care about the cursor position, then you can move the
> > screen about more simply with the SCROLL command instead of the
> > MOVE_VERTICAL command. SCROLL changes the editing point by leaving
> > the cursor position unchanged on the screen and adjusting the file
> > window display. This is exactly what you want here, and you do not
> > need to adjust the cursor to the top/bottom before moving up/down
> > a line, making the whole thing simpler.
> >
> > Also, SCROLL does not report an error if you scroll too far.
> > (Instead it returns a value of the amount actually scrolled, if you
> > need it. It's a shame, I think, that MOVE_VERTICAL does not do the
> > same). Thus, you will not need any on_error processing, so you can
> > simplify it further by removing the SIMPLE_MOVE procedure.
> >
> >
> > So here is a really cool stripped down version of SIMPLE.TPU that
> > displays the file, moves the display, and hides the cursor..
> >
> >
> > input_file := GET_INFO (COMMAND_LINE, "file_name");
> > main_buffer:= CREATE_BUFFER ("main", input_file);
> >
> > position (BEGINNING_OF (main_buffer));
> > main_window := create_window(1,21,off);
> >
> > the_key_map := create_key_map ("user_keys");
> > the_key_map_list := create_key_map_list ("the_keylist",
the_key_map);
> >
> > set (UNDEFINED_KEY, the_key_map_list, "return");
> > set (KEY_MAP_LIST, the_key_map_list, main_buffer);
> > set (SELF_INSERT, the_key_map_list, OFF);
> >
> > MAP (main_window,main_buffer);
> > message (ascii(27)+"[?25l");
> >
> > !
> > define_key ("message(ascii(27)+'[?25h');QUIT (OFF,1)", kp1,
> > the_key_map);
> > define_key ("scroll (current_window, 1)", kp2, the_key_map);
> > define_key ("scroll (current_window, -1)", kp8, the_key_map);
> > define_key ("scroll (current_window, 20)", kp6, the_key_map);
> > define_key ("scroll (current_window, -20)",kp4, the_key_map);
> > define_key ("scroll (current_window, 1)", down, the_key_map);
> > define_key ("scroll (current_window, -1)", up, the_key_map);
> > !
> >
> > Cheers, John --
> >



Relevant Pages