When I first started using version 6.01, I experimented with installing it
under the standard Windows location for software location "C:\Program
Files\"
in spite of having been told there's still problems with this.  I want to be

able to do this so J can fit in better with the other children in spite of
her special abilities.

It mostly worked, with a couple of small tweaks to "xlutil.ijs" in
~system\examples\ole\excel:

1) I changed the "JMACRO" definition to be
JMACROS=: '"',~'"',jpath '~system\examples\ole\excel\jmacros.xls'
because path names with embedded spaces need to be surrounded by
double-quotes.

2) I changed the line, in "xlutil.ijs", from
 if. 0 = 1!:4 :: 0: <JMACROS do.
to
 if. 0 = 1!:4 :: 0: <JMACROS-.'"' do.
because the double-quotes apparently confuse "1!:4 :: 0:"; this
confusion also subverts "fexist".

3) Finally, and it took a fair amount of debugging to figure this
out, I changed the line in "xljmacro" from
  jm=. JMACROS }.~ >: JMACROS i: PATHSEP_j_
to
  jm=. '"'-.~JMACROS }.~ >: JMACROS i: PATHSEP_j_

So, my initial fix causes 2 errors.  Since the double quotes are needed
only for the opening of the spreadsheet, perhaps the change should be
to all instances of "wb open", e.g. change the line in "xlopen" from
  wd 'olemethod xl wb open ',JMACROS
to
  wd 'olemethod xl wb open ','"',JMACROS,'"'

A search for other instances of "wb open" turns up two other sites
in which this change should be made:
xldemo.ijs: xlcmd 'wb open ',DEMOFILE
xlextract.ijs: xlcmd 'wb open ',flnm                NB. Open workbook

A look at these two pieces of code reveals that the latter already
has my fingerprints on it from an earlier fix dealing with this same
problem.  That is, it's already fixed, perhaps in a better fashion,
by a line preceding the above:

  flnm=. quoteIfSp flnm

where

quoteIfSp=: 3 : 0
NB.* quoteIfSp: surround name with '"'s if embedded spaces
ifsp=. '"'#~' ' e. y
flnm=. ifsp,(y-.'"'),ifsp
)

which could be rendered tacitly as
quoteIfSp=: ((]-.&'"') (] , ,) '"' #~ ' ' e. ])

This subfunction would be appropriately placed in "xlutil.ijs" as
this is included by the other two files.  The result might look like this:

NB.* quoteIfSp: surround name with '"'s if embedded spaces
quoteIfSp=: ((]-.&'"') (] , ,) '"' #~ ' ' e. ])
quoteIfSp_test_=: 3 : 0
  ans=. '"one space"';'NOSPACE';'"Spaces but already quoted"'
  assert. ans-:quoteIfSp&.>'one space';'NOSPACE';'"Spaces but already
quoted"'
)

I've gone ahead and made these changes in my own copy.
Perhaps they can be added to the distribution?

Devon

--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to