[news.software.anu-news] rot13 utility in DCL.

brodie@fps.mcw.edu (12/22/89)

In article <8912200842.AA22375@uunet.uu.net>, munnari!csc.anu.oz.au!gih900@UUNET.UU.NET (Geoff Huston) writes:

[stuff deleted about my dcl rot13 utility)

> I'm impressed!!!

thanks, geoff!!

>>READ/ROT13, so it shouldn't be TOO tough....)
>      
> Wouldn't it be better to have a TPU edit procedure called rot13 to allow you
> to rot the necessary bits??
> (said he trying to avoid having to add the code)
>      
> Geoff

hey, now THERE's a neat idea.   The tricky part is to tell TPU to do the
ROT13 stuff when WRITING the file upon exit.  Sounds neat, and I'm sure
it's pretty easy to do.  Unfortunately, I don't know tpu programming
at ALL...  never had time do learn it (I really should... maybe this would
be a good project?)

unless someone ELSE wants to do it.....
-------------------------------------------------------------------------------
Kent C. Brodie - Systems Manager		brodie@mcw.edu
Medical College of Wisconsin			+1 414 778 4500

"Gee, I hope these are the right coordinates..."  -Chief O'Brian; STTNG

fac2@dayton.saic.com (Earle Ake) (12/23/89)

In article <3286.2590eeeb@fps.mcw.edu>, brodie@fps.mcw.edu writes:
> In article <8912200842.AA22375@uunet.uu.net>, munnari!csc.anu.oz.au!gih900@UUNET.UU.NET (Geoff Huston) writes:
>
>> Wouldn't it be better to have a TPU edit procedure called rot13 to allow you
>> to rot the necessary bits??
>> (said he trying to avoid having to add the code)

I wasn't doing much today so I took out the TPU manual and discovered that TPU 
has a function called TRANSLATE which will do what I wanted.  The example even 
shows a way to use it to rotate every character by 13 to 'encrypt' them!  
Sounds like just what I have been looking for.  I am using Ted Nieland's 
EDT-Plus editor so the procedure will have to be modified slightly for use 
with an other TPU based editor.  I started with the procedure that changes the 
case of the letters either one at a time or those within the select range.  
Instead of using the change_case function, I made it the TRANSLATE function.  
I have defined the key to be GOLD-T as that was not being used.

Let me know what you think.

-- 
_____________________________________________________________________________
             ____ ____    ___
Earle Ake   /___ /___/ / /     Science Applications International Corporation
           ____//   / / /__                 Dayton, Ohio
-----------------------------------------------------------------------------
Internet: fac2%dayton.saic.com@uunet.uu.net    uucp: uunet!dayvb!fac2

!EDTP ROT13
!
PROCEDURE EDTP$rot13		!gold r (rot13)
	
LOCAL	 character ;
!check for active select
EDTP$select_range;
if EDTP$x_select_range <> 0 
then
    TRANSLATE (EDTP$x_select_range,
               "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm",
               "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
    EDTP$x_select_range:=0;
    return;
endif;

!change case of current character

if current_character <> EDTP$x_empty
then
     character :=current_character;
     TRANSLATE (character,
                "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm",
                "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
     erase_character(1);
     copy_text(character);
     if current_direction <> forward
     then
	 move_horizontal(-2);
     endif;
     return
endif;
ENDPROCEDURE 

DEFINE_KEY('EDTP$rot13',key_name('T',shift_key),"rot13");	! rot13