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

Re: Making XyWrite even more convenient with $X



Carl, absolutely no preemption of running native commands and U2 frames.
It's just a matter of testing things in the right order.
If there's a frame TEST and a pgm TEST, then TEST{ENTER} will run the
frame. So in that case of name overlap, if you want to run the pgm, you go
back to: RUN TEST.PGM{ENTER}.
But there doesn't happen to be any frame TEST, so it's only a theoretical
possibility.
If you find that you get a help frame when you wanted a program, you can
just choose a new name for the program--but this just name-conflict just
doesn't seem to arise, in practice.
The way I have it set up, a native command (like SAVE) takes precedence
over any user-written program of the same name (I tested by writing a SAVE.PGM)
So these things are just an issue of which condition is tested first. I
chose this hierarchy:
1. if NB was entered, treat it as an intent to do CD \Dropbox\NB not as a
call to the NB help frame (which I never use), so change the directory,
then exit
2. if first word entered was HELP{Space}, put the argument of it into s/g
50 and do: JM 2.HELPQ2, then exit
3. if first word is RUN{Space} but there's no file extension add .pgm to
what's on the command line (e.g., change RUN MYPROGRAM) ==> RUN
MYPROGRAM.EXE)--but don't exit because next line eXeCutes it.
4. Try to just XC what's on the CM line.
5. If can execute it, you're done--exit.
6. If won't execute (cuz not a native command), try it as a U2 frame
7. If that fails, try it as an intent to change directories, and invoke the frame HBCD
8. If still fails, give an error message
So, as the example of NB shows, I just put in a bandaid for the (very) rare cases of name-conflict.

There's a little more to it, so here's the two frames:

'%--_XYENCode_start--
{{5$H}}_HB_mod_of_CLD_rev.9/29/08._HB'._11/26/12._NB'._calls_'`
hbcd'`_frame'^~B~:~M~~',*',_if_in_
text,_put_a_carriage-return+line-feed'^',*',_TEMPORARY(?)_t_=_
call_tcomp.pgm_April_6,_2015_'^',*',~=="t"~>'BXca/1
00_x'.tcomp.pgm'Q2~~',*',_April_1,_2015_temp?'^~~>~~>~~>',*',_store_var
iables'^',*',_next_2_lines_are_only_way_to_handle_these_comman
ds'._exit_before_rest'^~)==0'|"D_WA"~{
@upr(~)==0~>'XC~~',*',_exit_now'^~)==0'|"VA/NV_WA"~{@upr(~)==0~>'XC~
~',*','^',*',_next_line_is_a_kludge_so_that_NB_isn
'`t_taken_as_"non-break"_'^~=="nb~>'BXc'.'Q2'BXcd_\
db\nb'Q2~~',*',_'^'BXd_eb=0,0'Q2'BXd_wa=0'Q2',*',_wi
ll_be_reset_on_exit'^~',*',_must_have_this_in_a_s
/g_for_next_XS'^~~{@upr(~)==0~>~',*',_put_argument_of_HELP_in_50'^'JM2.HELP'Q2~~
',*',_get_help_and_exit'^',*',≫≫≫≫≫≫≫≫≫≫≫_REAL_STUF
F_STARTS_BELOW_HERE_≪≪≪≪≪≪≪<'^~==0&"
%."~{~<0~>'BC~.pgm~',*',_run_x_==>_run_x.pg
m'^',*','XC~~>'BCca_~>~~',*','^'XC',*',__XC
_to_execute_native_Xy_commands_(like_CA_foo.bar)'^~)~>~~',*',_native_cmd_executed_ok',_reset_&_exit'^
',*',_Below_here'._one_of_the_cases_numbered_below'^',*',_1)_f
or_"regular"_errors_(e.g.,_"not_found")'._display_as_prompt_&_
exit'^~<>12~>~~>~~~',*','^~=="ftp"~>'BXrun_y'.ftp.pgm'Q2~~
',*',KLUGE_6/15/2015_"ftp"_weird'^',*',_2)_The_biggie'._try_it
_as_a_U2_call'^'JM2.PrsCMline'Q2~<>21290~>~~<
EI~>',*',unless_"no_U2_frame"_am_done'^'JM2.hbcd'Q2~~>
'BC~~~~',*','^~<
LB'-~>',*','BXd_wa=~'Q2'BXd_eb=~'Q2',*','JM2.nil
'Q2',*',need_this?'^~~B'^'^{{5hbcd,hbRunIt}}_Harry'._disp
lays_maybe_wiped_out_by_subsequent_lines_in_$H'^~B~)~>',*','^',*',~=="CSS"~>'BXc'.'Q2'BXca_\db
\htdocs\nhbl\wp-con'?1\themes\builde'?1\style.css'Q2~>~~~',*',
'^~=="NBD"~>'BXc'.'Q2'BXcd_\db\nb\users\default'Q2~<
EX~>~',*','^~=="FTD"~>'BXca_c'.\db\ar\ftd'Q2'BC
se_~179~179'CL~~',*','^~=="ITOE"~>'BXca_c
'.\db\ar\itoe'Q2'BCse_~179~179'CL~~',*','^~=="I"~>'BXca_c'.\db\oac\itoe'Q2~~',*','^~==""~>~~',*','^~=="ARI"~>~~~',*','^~=="ATT"~>~~~',*','^~=="FORBES"~>~~~',*','^~=="CONF"~>~<
SV50,\db\confer~>~~',*','^~=="MM"~>~~~',*','^~=="OCON"~>~~~',*','^~=="OA
C"~>~~~',*','^~=="HPY"~>~<
SV50,\py~>~~',*','^~=="XFR"~>~~~',*','^~=="X"~>~~~',*','^~=="XY"~>~
~~',*','^~=="R"~>~~~<
EI~>',*','^~=="RCM"~>~~~
',*','^~=="M"~>~~~',
*','^~=="MY"~>~~~',*','^
~=="NB"~>~~~',*','^~=="NBD"~>~~~',*','^~<
IF~=="W32"~>~~~',
*','^~=="W"~>~~~',*','^
~=="HB"~>~~~',*','^
~=="HBL"~>~~~',*','^~=="TA"~>~
~~',*','^~=="PROG"'|~=="PGM"~>~<
SV50,\progra'?1~>~~',*','^~=="DOC"~>~<
SV50,dropbox\docume'?1\HarryB'?1\~>~~',*','^~=="U"~>~~~',*','^',*',below_here,
_tries_to_run_what'`s_on_the_CM_line,_if_n'`work,_ca_it'^',*',
~'BCrun_~'XC~~',*',eg
,_foo.pgm_==>_run_foo.pgm'^~<0&"_"~{~<0
&","~{~<0~>'BXrun_~.pgm'Q2~~>~~~~',*',_could_run_it_so_now_done'^'BXca
_~'Q2~)~>~~',*',_'^',*',~<>","~>~<'BCrun_~.pgm'XC~~_',*',_why_ha
ve_comma_part?'^~',*','^'BXc'.'Q2~',*','^~',*','^'BXcd_~'Q2',*',_'^',*','BCcd_~~',
*','Q2',*',_'^~~>'BCcd_\~'XC~',*','Q2'BC~<
EI~>',*','^~~>'BCcd_\db\~'XC~',*','Q2'BC~<
EI~>'^~B'^
'%--_XYENCode___end--

Reply to note from Harry Binswanger  Tue, 30 Jun 2015
16:18:13 -0400

Harry,

> With the modifications, I can also just hit Enter to:
>
> --Run programs without prefixing them by "RUN " and without typing ".PGM"
>   E.g., TEST{Enter} is executed as RUN TEST.PGM

But can you do this without pre-empting frame $X's ability to run U2 frames?
Or native commands, for that matter? For example, how does $X distinguish
between file TEST.PGM and frame TEST? And suppose the filename is SAVE.PGM.
How does $X know that SAVE refers to the file SAVE.PGM and not the native
SAVE command? Pray explain.

--
Carl Distefano
cld@xxxxxxxx