[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

XYENCode and -DECode: Some additional U2 apps



Here are variants of frame XYENC*,XYDEC* and RUNN that I think are
potentially useful. You'll recall that XYENC and XYDEC encodes or
decodes the DeFined block or entire file in the current window; RUNN
runs the encoded DeFined block or file in the current window.

The new variants, ENC50, DEC50 and RUNN50, are similar, except that
they take input from Save/Get 50 and, in the case of ENC50 and
DEC50, write output to S/G 50. They're intended for use as
subroutines in other XPL programs. There are examples further below.
To run them, you first need to decode the following, DeFine it and
issue ADD2U2 to add the new frames to U2. Frame
ENC50,DEC50,RUNN50 are the new variants I just described. The second
frame, SV50, is called by the others; it reads the contents of a
file into S/G 50. (U2 already has a similar routine, SVfile, but
SV50 is leaner and meaner.)

Once you have these frames installed in U2, you can proceed to the
examples below.

{{5enc50,dec50,runn50}}_Encode|Decode|RUN_XYENCoded_code_con
tained_in_S/G_50_[CLD_1/18/09]'^~B~~>~)~>~~>'JM2.GetPath'Q2~+"\"~>~+~+".IN"~>'BXsa_'/01,~
'Q2'BXwt'Q2~+~+".OUT"~>'BXernv_~
'Q2'BXwt'Q2~~~="EN"~>~~
'BXdos/nv/x/z_/c_~XY~.COM_._~<~'Q2
~~'BXexist_~'Q2~)~>~<
GLa~>~'BXp'Q2~'BXernv_~'Q2'BXwt'Q2~<0~>~~>'JM2.SV50'Q2'BXernv_~'Q2
'BXwt'Q2~~="ENC"~>~+"~N("~>~~~~~'FF'BXrun_~

'Q2~B'^'^{{5SV50}}_SaVe_file_contents_to_S/G_50_(S/G_50 _in&out'._d'.\path\filename_in',_file_contents_out)_[CLD_1/1 8/09]'^~B~>0~>'BXexist_~'Q2~ )~>~<0~>~~>'JM2.UsurpB'Q2~< SX51,"~<0~>~+",~>~~+"~>~>"~>~'BXldpm_~,~'Q2'BXwt'Q2 ~+"~>+""""~>~<0~>'BXr emove_"+~+"'Q2~~+",~~>"~>~

~~>~~~+",50"~>'JM 2.ldnb'Q2~~~~~B'^'^ Now, here are some simple XPL applications using the new frames. If you XYDECode the examples, read them in eXPanded view. You can run each example by DeFining it and issuing RUNCODE. If you elect not to XYDECode the examples, you can still run each one by DeFining it and issuing RUNN. (Be sure to DeFine each example in its entirety, using eXPanded view. In draft or other views the initial Ascii-126 may be omitted, which will, of course, bolix the decoding.) ENC50: ~'JM2.enc50'Q2~~'^'^ RUNN50: ~'`BXp'`Q2'?'?>'`BD'`BD'`BD'^'`FF'?<'?'?>'? '?'?~>'JM2.runn50'Q2~'^'^ DEC50: ',*',_Convert_2-byte_func_mnemonic_to_3-byte_func'^ ~',*',______________Input'._S/G_50_=_"BC"'^ ~~>',*',______Add_XYENCode_prefix_for_func'^ 'JM2.dec50'Q2',*',__________XYDECode_to_3-byte_func'^ ~~',*',____________Output'._S/G_50_=_"'BC"'^'^ ',*',_Convert_1-byte_character_to_hexadecimal_value'^ ~',*',_______________Input'._S/G_50_=_1-byte_"A"'^ ~~>',*',______Add_XYENCode_prefix_for_3-byte_char'^ 'JM2.dec50'Q2',*',__________XYDECode_to_actual_3-byte_char'^ 'JM2.g3b'Q2',*',____________Get_bytes_2_and_3_into_S/Gs_51_and_52'^ ~+~~>',*',___Concatenate_bytes_2_and_3_into_S/G_50'^ ~~',*',____________Output'._S/G_50_=_"41"'^'^ ',*',_Convert_3-byte_character_to_hexadecimal_value'^ ~',*',_______________Input'._S/G_50_=_3-byte_":~Z"_(26d|1Ah)'^ ~~>',*',______Add_XYENCode_prefix_for_3-byte_char'^ 'JM2.dec50'Q2',*',__________XYDECode_to_actual_3-byte_char'^ 'JM2.g3b'Q2',*',____________Get_bytes_2_and_3_into_S/Gs_51_and_52'^ ~+~~>',*',___Concatenate_bytes_2_and_3_into_S/G_50'^ ~~',*',____________Output'._S/G_50_=_"1A"'^'^ ',*',_Convert_1-byte_character_to_decimal_value'^ ~',*',_______________Input'._S/G_50_=_1-byte_18d|12h'^ ~~>',*',______Add_XYENCode_prefix_for_3-byte_char'^ 'JM2.dec50'Q2',*',__________XYDECode_to_actual_3-byte_char'^ 'JM2.g3b'Q2',*',____________Get_bytes_2_and_3_into_S/Gs_51_and_52'^ ~+~~>',*',___Concatenate_bytes_2_and_3_into_S/G_50'^ ~+",16,10"~>',*',_Prepare_arg_for_conversion_frame_B236C'^ 'JM2.b236c'Q2',*',__________Convert_hex_to_decimal'^ ~~',*',____________Output'._S/G_50_=_"18"'^'^ ',*',_Convert_3-byte_character_to_decimal_value'^ ~',*',_______________Input'._S/G_50_=_3-byte_255d|FFh'^ ~~>',*',______Add_XYENCode_prefix_for_3-byte_char'^ 'JM2.dec50'Q2',*',__________XYDECode_to_actual_3-byte_char'^ 'JM2.g3b'Q2',*',____________Get_bytes_2_and_3_into_S/Gs_51_and_52'^ ~+~~>',*',___Concatenate_bytes_2_and_3_into_S/G_50'^ ~+",16,10"~>',*',_Prepare_arg_for_conversion_frame_B236C'^ 'JM2.b236c'Q2',*',__________Convert_hex_to_decimal'^ ~~',*',____________Output'._S/G_50_=_"255"'^'^ Enjoy! -- Carl Distefano cld@xxxxxxxx