[jawsscripts] Re: New import compiler directive

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Thu, 15 Mar 2012 00:30:20 -0400

If a feature exists but is neither documented nor often used, and this
condition long persists, there's sometimes a good reason. :-)

In this case, I think the Prototype directivve is useful, but not in
very many situations as compared to an actual jsd entry. Most of the
functions you'd want to call are declared in builtin.jsd, default.jsd,
or directly in scripts you'd be chaining onto. Complex solutions like
the scripts for Office applications are of course notable exceptions
to this, but even there, the jsd files declaring the functions you
want might load because they're downstream of your script file, unless
you're doing something really outlandish like putting a wrapper of
your own around a script file like WordFunc.jsb. I've been scripting
for 12 years and have never had to pull a stunt quite like that.

So my advice is to consider first whether there's a more sensible
solution, but if not, feel free to use Prototype, as long as you're
fine with your scripts not compiling under anything older than JAWS
11, or maybe even JAWS 12 to be safe (in case early JAWS 11 versions
don't support Prototype).

On Wed, Mar 14, 2012 at 10:39:34PM -0500, Jim Snowbarger wrote:
Doug,
What I would like to know is how the heck did you "stumble" across that. 
I've never seen that anywhere.
You could make a jsh that just had lots of prototype statements, and in 
clude them in a host of jss files that all wanted to use those functions, , 
and get around a lot of headaches.




----- Original Message ----- 
From: "Doug Lee" <doug.lee@xxxxxxxxxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Wednesday, March 14, 2012 8:09 AM
Subject: [jawsscripts] Re: New import compiler directive


I believe the usage and function of the Import directive was explained
in subsequent messages to this one. Someone raised the question of
backward compatibility though.

Import will probably not work before JAWS 13. There is an undocumented
alternative though, one I found years ago but that seems not to have
started working until JAWS 11:

prototype string function f1(int a, string b)

can be used in a jss file to declare a function that is not declared
in a jsd file in scope.  Practically, this means you can handle a
compile error on a function call by copying its first line from its
originating jss file into your jss file and putting the word
"prototype" in front of the new line.

On Wed, Mar 14, 2012 at 12:13:09AM -0300, Andrew Hart wrote:
Hi folks,

I stumbled across the following line of code in QuickSet.jsd recently,
and a rather terse explanation buried in FileIO.jss.  However, it seems
to be undocumented in the FSDN.  Grepping the all users settings\enu
directory, There are a pile of scripts that use the Import directive.

I can't say I truely grok it, but it appears that the Import command is
used for getting the Script Manager to load up function declarations
(from jsd files) that are deeply nested in the script binary load scope.
 I always thought that the Script Manager automatically loaded the jsd
files associated with binaries referenced using the Use directive.  I am
assuming that Import is needed because the compiler isn't actually
clever enough to recursively scan through "Used" jsb files to find all
the associated jsd files necessary to provide all the required function
declarations, in case the top level script file calls a function buried
2 or more levels down in the scope (excluding functions in default.jss
whose documentation one would expect the Script Manager to always have
on hand).

Is anyone else aware of this or have I just been living on another
planet for the last few years?

Cheers,
Andrew.


__________???

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________???

View the list's information and change your settings at
//www.freelists.org/list/jawsscripts



__________???

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

-- 
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________�

View the list's information and change your settings at 
//www.freelists.org/list/jawsscripts

Other related posts: