How to compile and run servicesThere are five sample WIG compilers available:
You will probably find that
Currently there are binary versions for FreeBSD, Linux, and
Solaris available, with wrapper scripts that attempt to select
the right one automatically for you. We have the source code
and can possibly compile a version for a different system if it
would help you. The
In order to actually compile CGI scripts from the generated
C-based WIG services, required for all compilers except
1. Making sure prerequisites are installedBefore you can use these instructions, you should first follow the instructions on using Subversion in this class and setting up your environment for JOOS programs. This will ensure that Java 1.5 is on your PATH and that you have a local copy of the example WIG binaries.
2. Setting up your environmentAs usual, we need to set up some additional environment variables:
WIGDIRAssuming you have checked out the public_html directory from the class SVN repository to$HOME/cs520/public_html ,
add the following:
setenv WIGDIR $HOME/cs520/public_html/wig or
export WIGDIR=$HOME/cs520/public_html/wig
to your PATHWe want to be able to execute the WIG compiler binaries from anywhere. Add the following:
setenv PATH $WIGDIR/bin:$PATH or
export PATH=$WIGDIR/bin:$PATH
to your Note that we can possibly make binaries for other platforms available, just send your request to your instructor or TA. cgi-bin directoryFinally, in order for WIG services to execute within a browser they need to be placed in a sub-directory of$HOME/public_html/ on the SOCS machines. The WIG
installation scripts assume that this directory has the
conventional name cgi-bin .
$ cd $HOME $ mkdir -p public_html/cgi-bin $ chmod 711 public_html/ $ chmod 711 public_html/cgi-binYou can access this directory by pointing your web browser at the URL http://www.cs.mcgill.ca/~`whoami`/cgi-bin/ .
3. Compiling your WIG service
4. Running your WIG serviceYou can now run your service by using one of the following URLs:http://www.cs.mcgill.ca/~`whoami`/cgi-bin/foo4.cgi?SessionName http://www.cs.mcgill.ca/~`whoami`/cgi-bin/foo10.cgi?SessionName http://www.cs.mcgill.ca/~`whoami`/cgi-bin/foo18.cgi?SessionName http://www.cs.mcgill.ca/~`whoami`/cgi-bin/foo.cgi?SessionName http://www.cs.mcgill.ca/~`whoami`/cgi-bin/foo.pl?SessionNamewhere `whoami` expands to your CS user ID, and
SessionName is one of the sessions defined in
foo.wig .
For example, consider the following service
that might be in service { const html ... const html ... ... session Init() { ... } session Doit() { ... } session Report() { ... } }Here there are three different sessions, Init ,
Doit , and Report that can substitute
for SessionName in the above links. Note that the
better WIG compilers provide links to all available sessions.
(It may be an interesting language extension to have public and
private sessions.)
5. Batch compilation and installation of WIG examplesWIG compilers come with their examples. You may want to compile and run them to check how they manage to parse files and generate codes. The examples have been already listed in benchmark lists:
5.1 CompilingIn the $WIGDIR, just run: ./compile <a_benchmark_list> This will try to compile all examples listed in the benchmark list file using all possible compilers. Note that some of the examples may fail because these compilers are not completely compatible. 5.2 InstallingAfter compiling, run: ./install <a_benchmark_list> This will try to install all compiled codes listed in the benchmark list file into your public_html/cgi-bin and generate an index.html in that folder. If you've already put your own index.html in cgi-bin, please backup first. 5.3 RunningAfter installing, just go to this URL: http://cs.mcgill.ca/~`whoami`/cgi-bin/index.html If you've got some error message saying "permission denied", please try to change the permission of the index.html generated in setp 2: chmod a+r $HOME/public_html/cgi-bin/index.html 5.4 Benchmark list file formatYou may want to write your own benchmark list file so that it will save a lot of your time when debugging your wig compiler. Actually it is quite easy, the format of benchimark_list is just a plain text file in which one line defines a wig program: wig_program_id <tab> path <tab> wig_file_name<line break> the wig_program id is used in script only; path should tell the script where your .wig located wig_file_name is the wig file you want to compile, DO NOT annex the file extension(.wig). For example, you want to compile wig programs in $HOME/yourwig/foo.wig and bar.wig, you should write a "my_benchmark_list" like this: foo $HOME/yourwig foo and then you can compile and install codes using: ./compile my_benchmark_list |
Maintained by Chris Pickett. [HOME] |