The scriptdoc function is pretty neat and I would like to use it to
display my own scripts.
However, if I give it the full path to my script (in a user/projects
directory) it returns an error. My reading of the code suggests that it
is not designed to handle scripts that aren't in the J system directory.
A user specified file is parsed fine, but the code to write the script
name as part of output (partname and jdirname) is constrained to the
files specified in PUBLIC.  Is this by design or could it be rejigged to
enable support for other-than-system scripts?

scriptdoc jpath '~user/projects/myproject/test.ijs'
|domain error: fmtfile
|   'script: '    ,partname y

The error occurs in:
sdoc_show ''
 
when it tries to execute the sentence:
txt=. fn~ SDEF

In partname if the file isn't found in PUBLIC the ndx (#PUBLIC) is
returned rather than the original file name.

partname=: 3 : 0
f=. jdirname y
ndx=. ({:"1 PUBLIC) i. <f
if. ndx < #PUBLIC do.
  f=. 0 pick ndx { PUBLIC
end.
) 

In jdirname I think it is trying to chop of the first part of a full
filename so that it matches with the format of the first column of
PUBLIC. However the function assumes there are only two possible
directories within jpath 'system' or 'binary'.

jdirname=: 3 : 0
y=. jhostpath y
if. 
  p=. jpath '~system/'
  p -: (#p) {. y do.
  y=. '~system',(<:#p) }. y
elseif.
  p=. jpath '~binary/'
  p -: (#p) {. y do.
  y=. '~binary',(<:#p) }. y
end.
)

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

Reply via email to