|
|
|
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| |
Using PV-WAVE® as a Web Browser
Helper Application
The goal of a helper app is to allow users to distribute PV-WAVE.pro and .cpr files over the Web. Click on a UR,L which links to a Wave file, and WOW! Wave fires up and executes the application on your machine!
Here is how it works:
Client-Side PV-WAVE Helper App Benefits
If a server-side implementation seems more appropriate, go to Wapplet . For a complete discussion and comparison of the implementations, go to PV-WAVE Net Possibilities The one requirement for creating a helper app which is a PV-WAVE procedure (.pro) or compiled procedure (.cpr) but NOT a command file (.cmd), as implemented here, is that the PV-WAVE code that you want to serve must include a procedure called MAIN, as this will be the entry point executed when PV-WAVE runs the code. Also, the a procedure file should have the extension .wpr (for Wave PRocedure) rather than .pro, so that downloading source procedure files from our ftp site or other sites is not affected. (Note: The name of the file does not have to be main.xxx, it just has to have the extension .wpr or .cpr) A PV-WAVE command file, which is usually executed by typing "@filename" at the Wave prompt, cannot contain procedures so this is not an issue for .cmd files.
The first goal in the Helper App Implementation was to define a Wave MIME type. A MIME type maps a file distributed over the Web to an application that interprets and uses the file. For Wave, there are two types, one for .pro files and the other for .cpr files. Basically, defining a MIME type is a two-step process; you need to configure both the server and the browser for the MIME type so that they both know what to do. Server ConfigurationTo configure the server for the WAVE MIME type, do the following (This was done with CERN 3.0, but the idea is similar for other servers).
Browser ConfigurationUNIX InstructionsOn UNIX machines, there are two files which map MIME types, your .mime.types and .mailcap files in your home directory are used by Netscape (and other applications such as exmh...) to map MIME types. The latest version of Netscape will help you through this by editing your files for you, but you can edit the files manually as well. Below are shell scripts that will fire up PV-WAVE and pass it a .cmd file, .wpr file or .cpr file respectively. These scripts start up an xterm and run PV-WAVE in it, so that you will have a Wave prompt in addition to any graphics/widgets the code might create. For the compiled procedure script, you could also specify a runtime license to be used for PV-WAVE, in which case you would see the stdout from Wave in the xterm but would not get a Wave prompt. The wavepro and wavecpr scripts require that a trivial two-line PV-WAVE command file be created to tell PV-WAVE to run the MAIN procedure. This file can be placed anywhere, but the WAVE_PATH environment variable must include the directory in which it is placed. WAVE_PATH also needs to include the /tmp directory, as this is where the downloaded code will be placed. WAVE_PATH is modified in the wavepro and wavecpr scripts to do this. Below are the scripts discussed above. All are executable scripts saved somewhere in your PATH:
You need to replace <path> above with the appropriate paths to where your PV-WAVE installation exists and to where you have placed the gomain.pro file. (One suggestion would be to place it in $WAVE_DIR/LIB/USER, as this directory is already in the PV-WAVE search path). Basically what happens here is that the script will rename the unique file created by the browser in /tmp to /tmp/main.pro or /tmp/main.cpr as appropriate. If a PV-WAVE procedure is being served, Wave is started and executes the commands in gomain.pro, which just causes main.pro to be compiled and run. In the case of .cpr files, Wave can be run using a runtime license with the .cpr file passed as an argument (or just run in the same way as wavepro if desired). Configuring your UNIX MIME types
If you have a new verison of Navigator, then you can try to let the
helper app widget adjust your mailcap and mime.types files
automatically. If not, make the following changes.
Add the following to .mime.types
And to your .mailcap file
You can replace "wavepro" and "wavecpr" with the full path to these scripts if the directory they are placed in is not in your PATH. Windows® InstructionsFor Windows it's pretty much the same as for UNIX, in that you tell Internet Explorer or Netscape to run a script somewhere that copies the temporary file to "main.pro" or "main.cpr" and runs Wave. The instructions below assume that PV-WAVE is installed in C:\VNI (adjust the paths as neccessary). Also, you need to create the directory C:\VNI\helper-1_0 and under it a \bin and \lib directory. There are other ways to accomplish the same, but creating a directory like this ensures that Wave will find the procedures needed without having to modify the !PATH environment variable in Wave to look somewhere else. The alternative is to place the files anywhere you want but make sure you edit C:\VNI\wave\bin\wavestartup so that !PATH points to the directory where the .pro and .cpr files are located. Below are batch files needed to fire up Wave:
Configuring your Windows MIME types
The instructions below are for Microsoft's Internet Explorer version
3.0. Similar instructions could be used with Netscape or other browsers
(but we do not have them right now).
In Internet Explorer select: View-> Options -> Programs tab ->
File Types -> New Type
Here is a demo of a PV-WAVE helper app in action that you can test with:
|
|
|
|
| © Copyright 2010 Visual Numerics, Inc. All Rights Reserved |