> From: Matthew Brand
> 'output pdf /tmp/Capital/test.pdf' plot i.10
> 
> goes into /tmp/capital/test.pdf. Is there a way to make it respect the
> capital letter in the file name?

Not with without changing the current code. 
Currently pd_show_jzplot_ lowercases the whole "output" option. I don't think 
this is necessary though. The following changes work for me and leave the case 
of the filename unchanged.

To test: load plot as normal then define the verbs in either Option A or Option 
B in your session.

Option A) Conservative fix:

pd_show_jzplot_=: 3 : 0
ndx=. ({."1 PCmd) i. <'output'
if. ndx < #PCmd do.
  OUTPUT=: 1 pick ndx{PCmd
end.
NB. out=. deb tolower OUTPUT
out=. deb OUTPUT               NB. new
ndx=. out i. ' '
NB. fn=. 'pd_', ndx {. out
fn=. 'pd_',tolower ndx {. Out  NB. new
arg=. (ndx+1) }. out
fn~arg
EMPTY
)

Option B)
The following changes to pd_show and qchop are a more radical fix that leave 
filenames as unchanged as possible to that provided by the user.
Works for all plots in plot demo.

pd_show_jzplot_=: 3 : 0
ndx=. ({."1 PCmd) i. <'output'
if. ndx < #PCmd do.
  OUTPUT=: 1 pick ndx{PCmd
end.
out=. dlb OUTPUT
fn=. 'pd_', tolower ' ' taketo out
arg=. ' ' takeafter out
fn~arg
EMPTY
)

NB. Fix to qchop prevents deletion of extraneous blanks inside double-quoted 
strings.
NB. Handles multiple consecutive spaces in dquoted strings
qchop_jzplot_=: 3 : 0
q=. dquoted y
s=. ' '=y
qs=. q*.s
y=. DEL (inxb qs)}y
NB. deb each unquot each ((DEL,' ')&charsub) each chop y
unquot each ((DEL,' ')&charsub) each deb each chop y  NB. new
)

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to