HomeCurrent UR
|
NAME
dangerousMacros.pl --- located in the courseScripts directory
SYNPOSIS
loadMacros(macrofile1,macrofile2,...)
insertGraph(graphObject);
returns a path to the file containing the graph image.
tth(texString)
returns an HTML version of the tex code passed to it.
alias(pathToFile);
returns URL which links to that file
DESCRIPTION
Sharing modules:Most modules are loaded by dangerousMacros.pl The modules must be loaded using require (not use) since the courseScriptsDirectory is defined at run time. The following considerations come into play.
* One needs to limit the access to modules for safety -- hence only
modules in the F<courseScriptsDirectory> can be loaded.
* Loading them in dangerousMacros.pl is wasteful, since the modules
would need to be reloaded everytime a new safe compartment is created.
(I believe that using require takes care of this.)
* Loading GD within a safeCompartment creates infinite recurrsion in AUTOLOAD
(probably a bug)
hence this module is loaded by translate.pl and then shared with
the safe compartment.
* Other modules loaded by translate.pl are C<Exporter> and C<DynaLoader.
* PGrandom is loaded by F<PG.pl> , since it is needed there.
The module name spaces loaded in dangerousMacros are:
PGrandom (if not previously loaded)
WWPlot
Fun
Label
Circle
in addition the subroutine &evaluate_units is shared from the module Units.
loadMacros
loadMacros takes a list of file names and evaluates the contents of each file. This
is used to load macros
which define and augment the PG language. The macro files are searched for in the
directories specified by
An individual course can modify the PG language, for that course only, by duplicating one of the macro files in the courseScripts directory and placing this file in the macro directory for the course. The new file in the course macro directory will now be used instead of the file in the courseScripts directory. The new file in the course macro directory can by modified by adding macros or modifying existing macros. Modifying macros is for users with some experience. Modifying existing macros might break other standard macros or problems which depend on the unmodified behavior of these macors so do this with great caution. In addition problems which use new macros defined in these files or which depend on the modified behavior of existing macros will not work in other courses unless the macros are also transferred to the new course. It helps to document the problems by indicating any special macros which the problems require. There is no facility for modifying or overloading a single macro. The entire file containing the macro must be overloaded. Modifications to files in the course macros directory affect only that course, they will not interfere with the normal behavior of WeBWorK in other courses.
insertGraph
$filePath = insertGraph(graphObject);
returns a path to the file containing the graph image.
The permissions and ownership of the file are controlled by Returns: A string containing the full path to the temporary file containing the GIF image. InsertGraph draws the object $graph, stores it in "${tempDirectory}gif/$gifName.gif (or .png)" where the $imageName is obtained from the graph object. ConvertPath and surePathToTmpFile are used to insure that the correct directory separators are used for the platform and that the necessary directories are created if they are not already present. The directory address to the file is the result. This is most often used in the construct
TEXT(alias(insertGraph($graph)) );
where alias converts the directory address to a URL when serving HTML pages and insures that an eps file is generated when creating TeX code for downloading.
tth
tth(texString)
returns an HTML version of the tex code passed to it.
This macro sends the texString to the filter program The purpose of The contents of the file This macro contains code which is system dependent and may need to be modified to run on different systems. The link totth for non-commerical is
http://hutchinson.belmont.ma.us/tth/.
Binaries for many operating systems are available as well as the source code. Links
describing how to obtain tth for commerical use are also available on this page.
math2img
alias
alias(pathToFile);
returns A string describing the URL which links to GIF or html file
(in HTML and Latex2HTML modes).
or a path to the appropriate eps version of a GIF file
(TeX Mode)
As a rule auxiliary files that are used by
a number of problems in a course should be placed in
File path = /ww/webwork/pg/macros/dangerousMacros.pl
|
||
Last update: Wednesday, January 10, 2007 at 9:54:33 PM.
This site maintained using Manila and Frontier software. |
|||