!! used as default html header if there is none in the selected theme.

This document is currently under integral style. You may change it to indexed or folding style. There is also a general help and a paper on WIMS.

### Development

WIMS (Www Interactive Multipurpose Server) is an internet server system designed for mathematical and other educational purposes.

The Wims server is composed of a kernel program which is a cgi program (wims.cgi), plus various activity units called modules''.

The client browser accesses the server via a http request to wims.cgi, with parameters specifying the name of the module to request, the type of the request, and possibly parameters for the module ; wims.cgi processes the requested module, passing the user parameters to it, and sends the result returned by the module back to the client.

A module may consist of a number of script files grouped in one directory. These scripts are written in a special scripting language: the WIMS language.

The WIMS language contains commands which allow it to call external programs (especially various mathematical softwares) to make sophisticated computations. Such commands are processed by wims.cgi and sent through interface programs which filter the request, check for security breaches, and send back a filtered output.

## Examples of what you can do with WIMS

The current version 4.21e of wims has several applications which demonstrates (non-exhaustively) what one can do with a wims system.
• Take a look at the animated plotter: it allows you to plot curves and surfaces with zooming, deforming and rotating effects, more easily as you may possibly imagine.
• The game Q-Puzzle gives a very good idea of how wims can provide a convenient way to combine multimedia means and abstract mathematical notions.
• The game-exercise Coincidence-freehand shows the possibility to create interactive graphic exercises of a new style.
• The exercise Correspondance gives an idea of the possibility of embedding javascript interactivity into a wims application.
• The exercise Accordance shows the possibility of linking different wims applications: except for the easiest level, such an exercise is practical only if the user can use computer to solve a linear system. Now such a solver (another wims application) is available directly in the exercise page, via a hypertext link. In order to teach the student to choose the appropriate tool, some irrelevant links are also added.
Please notice that the lack of direct data communication between the two modules is only a choice of the design of the module, in order to make the student type the matrices.
• The tool Function illustrates the possibility to create pages which are at the same time powerful and easy to use. By linking a plotter (gnuplot), a symbolic calculator (Maxima) and a numerical calculator (pari) at backend level, it allows the user to click on a root (or a local extremum) he sees on the curve, and get the value of the root (or local extremum) at arbitrary precision.
To achieve this, softwares are dynamically called at backend. First, gnuplot is used to draw the curve in the given interval. When the user clicks on a point, gp is called to try to find a root in the neighborhood of the point. If it fails, Maxima is called to compute the formal derivative of the function, and gp is called again to find a root of the derivative in the neighborhood (which will be the local extremum).
• This document itself is an illustration to the fact that wims can provide an easy way to dynamically reorganise contents of a document. By changing a parameter, contents of the document can be grouped, split, or chosen, in various ways. (Remark that this document is itself a wims module.)

## Comparison with other approaches

1. #### No need of software installation and/or update by users.

All installation and/or update of background software is done on the server side, which can be anywhere on the internet. On the client machine, only a common web browser is required (which needs not to be very up to date).
2. #### No need to learn the usage and the syntax of a particular software package.

As wims uses the html standard for user interface, a user, in particular a student, has only to use his usual knowledge of html browsing (which is now a common knowledge), in order to work on wims applications.
This is not the case for any of current mathematics softwares; all of them require a training period before the user can work on it. This training period may be more or less lengthy, but we remark that the knowledge of using a particular software is not a universal knowledge, and such a knowledge usually has a short lifespan. Moreover, teaching knowledge about a commercial software contradicts with the principle of commercial neutrality of a public education institution.
3. #### It provides a means to collect the knowledge and experience of the whole educational community.

Wims is a modular system, where each application is a separated module whose links with other modules are done in the usual html way. This allows modules to be developped independently and remotely. It is our hope that as many educators as possible will add their knowledge and experience to the system by contributions in the form of new modules or improvements of existing ones.
4. #### It allows student - teacher interactions in several ways.

Organized under the structure of classes, a wims system allows teacher to assign works for his students, and get reliable informations about the progress (and/or difficulty) of the student in real time. This may allow the teacher to give more personalised guide to the student. The big advantage of such a system based on internet is that there is no site restriction: any work done from any site (local or remote) is valid, and is taken into account.
5. #### It provides a dynamic interaction between different components, e.g. between exercises and computing tools.

For example, practically no software dedicated to exercises can interface a computational tool as easily as wims does.
6. #### It can be more powerful than any given software for certain works.

Because wims can use different (dedicated) software as backend engine, even several softwares for one application or one request.

1. #### Low speed of reaction.

Because usually every wims response has to travel through internet. This will improve when internet speed improves.
2. #### Limited computational power and programming capability.

If a user has a heavy computational job and/or has to design a complicated script to get his job done, he should work directly on the appropriate software. It is not at all the intention of wims to interface such activities.
3. #### Limited capability of the graphical interface.

The html graphical user interface is not very suited for interactive works.

1. #### Easier to use.

A html page used by wims for user interface is much more comprehensible than any hand calculator.

1. #### Non-portability.

Wims is accessible only to computers connected to internet.

### Advantage of wims versus interactive web applications based only on java or javascript

1. #### More powerful and more versatile.

As wims can embed java or javascript programs in its applications, a wisely designed wims application just extends the capability of java or javascript.
And wims can really do more: even if it is theoretically possible to develop java applications which has the same power as a software used as a backend engine for wims, it would take too much effort to develop (is it reasonable to re-write TeX in java?), and would be so big that it would take forever for an http query to load.
2. #### Easier to develop.

Because wims language is first based on html (easy to learn), with an extension specifically designed for this purpose.
3. #### Allows student-supervisor interaction.

The design of server-based interactivity for users allows the back-end communication with supervisors, and much more (performance analysis, automatic intervention from supervisors, etc).

### Disadvantage of wims versus interactive web applications based on java or javascript

1. #### Lower speed of reaction.

Because usually every wims response has to travel through internet. This will improve when internet speed improves. One can also use embedded javascript or java in a wims application, in places where response speed is important.

1. #### Write html pages with a programmability extension: substitution of variables, conditional branching, etc.

This wims programmability extension to html does not require any addon or plugin at the browser side, as all the wims commands are treated by the wims server before sending the result to the browser, which will be a standard html page.
For example, this allows you to define style macros which can be dynamically changed.
And this extension can cohabit with all the current (and hopefully future) html standards, including java applets, javascripts, embedded objects, dhtml... This is because the wims extension follows a strict line discipline (i.e. a wims command must start at the first word of a line), while html standard is not line-oriented.
This means that you can even embed wims extensions into javascripts, applets, dhtml...

Upon execution of this line, the variable will be replaced by its current value, then the software package PARI' will be called with the string print(factor(<value of $number>))' as command to execute. The output of the program, with the overheads stripped, will be placed as the value of the variable factor'. Interfaces provided in version 4.21e of wims: PARI, Maxima, MuPAD, Coq, Povray, gnuplot, PostgreSQL, Fly (gif drawing), CALC (by Keith Matthew). 5. #### Simple and versatile language. The language used for wims modules is an extension of the existing and popular html language. This extension is designed to be simple, easy to use and close to natural language. Synonymes are accepted whenever necessary. For example, to include the content of another file, you don't have to remember whether the command is include as in C, or input as in TeX, because both are valid. 6. #### Convenient directives for string manipulations: replace with regular expression capability, extraction of a subset from a list of items, shuffle, evaluation of mathematical expressions, etc. 7. #### Easy inline mathematical symbols: simply type$m_pi for , $m_RR for ,$m_le for , $m_Rightarrow for , etc. 8. #### Intelligent treatment of mathematical expressions: built-in translation routines to allow error-tolerant expressions like 2y (instead of 2*y) or (x+1)(x-1) (instead of (x+1)*(x-1)), and translations of raw mathematical expressions into beautified html sources (x^3-3*x^2+1*x-5 will become x3-3x2+x-5 , etc.), or TeX sources, etc. 9. #### Powerful random capabilities: random permutation (shuffle), random record from a datafile, random filename, etc. Table of Contents ## Online development of activities The system includes several facilities allowing you to create and develop WIMS activities directly online. To do so, you have only to click on the respective links from the home page of the server. The easiest is the creation of simple interactive exercises which does not really require the knowledge about a computer language, but exercises that can be written in this way have limited power and versatility. On the other hand, you can also develop full-power WIMS modules by working entirely on line. For obvious security reasons, you will need a login/password pair which you must ask the site manager to attribute to you. Once logged in, you can create and modify as many modules as you like, in a special development zone. When you have finished the development of a module, you can ask the site manager to move it to a public place. Table of Contents ## Basic structure of WIMS The central piece of a wims server is a cgi program, usually in the name of wims.cgi. It takes all the http calls to the server, then does the following work: 1. Call the module asked by the user, and process parameters and variables according to what is defined in the module. 2. Session management. 3. Send the result of the process to the user. 4. Write to different log files. #### Modules of wims A wims server is a modular system, with different applications as modules. At each new call to wims, the user has to specify which module he want to access. A wims module may be an interactive course or interactive exercise (of any level), a computational tool, a dictionary, a mathematical game, a database, or a mixture of the above. Wims modules are independent from each other. Each module has its own directory, which serves as its address, and contains all the files of this module. Different modules have different authors and different maintainers, and may follow different copyright policies. There is no relation between modules in a same wims site, except hypertext links which allows one module to access another in various ways. #### How to access a wims server Wims is accessed by a request to the main cgi program, for example https://wims.univ-cotedazur.fr/wims/wims.cgi  which usually should be followed by parameters. A call to the main wims.cgi program without parameter will bring up the wims homepage of the site. Parameters of wims.cgi is a usual http name=value pair, where the name field may be one of the following: • cmd: the value is the command of the call. Valid commands: Parameter stringMeaning cmd=introget introduction page of the module cmd=newopen new working session cmd=renewrestart working session cmd=replysend reply to the module cmd=nextget next exercise (in a working session) cmd=configset preferences cmd=helpget contextual help cmd=hintget contextual hint cmd=resumeresume work (e.g. after help) cmd=getinsget dynamic insertions: internal use by the server. Not to be used by modules. • module. the value is the name of the module which the user wants to access. • session: the value is the number of the current session of the user. The session number is automatically generated by wims.cgi, and is usually automatically contained in the pages sent by the server. Tampering with this parameter by the user (e.g. in order to spy into others' work) is not allowed and has practically no chance to get through. • lang: the value defines the prefered language of the user. • user: the value is the user name (for registered users; reserved for internal use). • useropts: the value contains user options for the server. The format is coded and may varie from version to version. • worksheet: reserved for internal use, for determining user works assigned by worksheets. • special_parm: this parameter is reserved for special requests (help, etc). • Any variables accepted by the module on which the user is working on (or wants to work on). Example: https://wims.univ-cotedazur.fr/~wims/wims.cgi?cmd=new&+module=tool/algebra/factor.en  calls the wims server at wims.univ-cotedazur.fr, with new' as the value of cmd', tool/algebra/factor.en' as the module name. #### How to use the supervisor-side interface Supervisors of registered classes can maintain their classes and consult results of students via the same web address (the main cgi program), just by logging in as supervisor. All the options are then available via html links and buttons. Table of Contents ## Structure of a WIMS module Each wims module has a private home directory in which go all the files of this module. A module must have at least the following files: • #### A variable definition file var.def. This file defines external variables of the module. A parameter given by the user must have a name declared in this file, except parameter names reserved by wims (cmd, session, module, ...). And exactly variables declared in this file will be saved in the session directory (to be recalled at the next request from the same session). • #### A variable processing file var.proc. This file is processed at EACH request of the module (except special requests: when cmd=intro or getins). • #### A main phtml file main.phtml. This file will be processed at avery request to the module, except under special commands (when cmd=intro or getins). • #### An indexing file INDEX, which defines the application's nature. This file will be used by wims database for searching available modules. And it may often contain the following (optional) files too: • #### A variable initialisation file var.init. This file has the same syntax as the file var.proc, and is processed exactly at requests with cmd=new or cmd=renew. • #### A introductory page intro.phtml. This is a phtml file, which is processed when the module is accessed with cmd=intro. It is usually used to introduce the content of the module, and to let the user choose starting options. There may be any number of other files, like a README.md file, one or more help pages, an about page, one or more graphics files, files called by one of the above mandatory or optional files, etc. #### Variable processing files The files var.init and var.proc, as well as any files called by these two files, are variable processing files. A variable processing file is divided into lines, separated by non-escaped new-line characters. A new-line character can be escaped by the character \, in which case it does not separate the two lines before and after it. Every line of a variable processing file must be one of the following: 1. A comment line, whose first non-space character is either the character #, or ! followed by another !. 2. A variable definition line, in the form of name=value. The content of value may be a string (if this string contains a new-line character, it must be escaped by the character \), or a wims variable command (which must then start with the character !). 3. A command line, whose first non-space character is the character !, followed by the command name and optional parameters. If the command produces an output string, this output will be ignored. 4. A label line, whose first non-space character is the character :, followed by the name of the label. Anything following the label name will be considered as comment and ignored by the interpreter. Label is used in conjunction with the jumping command !goto. A label starting with the character '*' is catch-all, matching any !goto label. 5. Any line not fitting into one of the above 4 will generate a wims error message. #### Phtml files The files main.phtml and intro.phtml, as well as any files called by these two files, are phtml files (programmable html). A phtml file is an ordinary html file, except for lines whose first non-space character is a ! or a :. Lines can be escaped by \, just as in the case of a variable processing file. A line starting with : is a label line, as in the case of a variable processing file. A line starting with ! is a command line, as in the case of a variable processing file. To the difference that if the command produces an output string, this output will be inserted into the html page, at the place of the line. Lines not of the above two types will be sent to the http client, after substitution of variables. Table of Contents ## Variables in a module #### Definition and substitution of variables Wims variables have only one type: they are all string variables. Numerical evaluation can be done on variables via the variable command !eval. A variable may be defined or modified in a variable processing file, or by the commands !let and !default. Variable names can contain any alphanumeric character, as well as the underscore character _. There is a limit to the length of variable names, and a limit to the length of values. (Limits depending on server configuration.) Variable substitution can be done anywhere in a variable processing file or a phtml file (even in the name field of a variable definition line). A word preceeded by the character$ is considered to be a variable name, and will be replaced by its value when the line containing it is processed.

Special rules of variable substitution:

• If the character $is followed by a space, it will be discarded. • The string$$is replaced by a single$.
• If the character $is followed by the left parenthesis (, the matching ) will be located, the content of the pair of parentheses substituted. The result of the substitution will then be used as the name of variable, and finally the whole thing will be replaced by the value of the last variable. This allows nested substitutions, as well as substitution of a variable which is followed by an alphanumeric character. Example: if the variable i has value 3 and the variable alpha3beta has value pi, the string 3*$(alpha$(i)beta)*x will become 3*pi*x after substitution. Array addressing: if the variable l contains a comma-separated list a,b,c,d,e, then the string$(i[3]) gives c after substitution, and $(i[2 to 4]) tives b,c,d, etc. Two-dimensional array addressing is also available: if $M=x,y,z;a,b,c
(a 2x3 matrix), then
$(M[1;3,2])=z,y • If the character$ is followed by the left bracket [, the matching ] will be located, the content of the pair of brackets substituted then evaluated to a real number value whose precision depends on the value of print_precision. This value will replace the whole thing together with the leading $. It can be used for array subscripts. Example: if the variable i has value 3 and the variables a1 has value 3 and a2 has value pi, then the string $(a$[$i-1])*x+$(a$[$i-2]) will become  pi*x+3 after substitution. • If the value of a variable being substituted contains the character$, this value will again be substituted, until no more substitution is needed. The server has a built-in limit of nested substitutions; infinite nested substitions will violate this limit and generate an error message.

#### Reserved variable names

The following names are reserved for their special meanings. They should not be used for internal needs of any module.
• Do not use variables with names consisting only of numbers. They are reserved for future enhancements of the language.
• Variables named cmd, module, session, lang, special_parm, user, useropts, worksheet, are reserved for special parameter passing by the user. A module's variable processing files or phtml files can read but cannot set them.
Refer to the section Basic structure of WIMS for the meaning of these variables.
• The variable no_name has a special use:
Parameters in the user query string with no name (for example when the coordinate of a mappable image is passed this way to the http server) will be registered under this variable. For this reason, it should not be used for other purposes.
• All variable names starting with wims_ will have special meanings for wims server. A module should read or write them only for the special meanings they are designed for.
• Variable names starting with m_ are reserved for inline mathematical fonts. The module programmer may redefine them, but then their original meaning will be lost.
• The variable module_dir has a value preset to the directory of the current module (with respect to the public home directory of the server). This value is usually $module_dir=module/$module (but may vary with the config of the installation).
• Variable names starting with module_ will have special meanings: they are used to hold variables defined in the module's INDEX file. Currently implemented variables:
VariablesMeaning
module_titletitle of the module
module_descriptionshort description of the module
module_authorname(s) of author(s) of the module
module_maintainername of the actual maintainer
module_versioncurrent version of the module
to run this module
module_languagelanguage of the module
(en, fr, de, or ...)
module_categorycategory of the module
(exercise, tool, course, pedia, recreation, adm, other)
module_levellevel of the module
module_domainalgebra, analysis, geometry, ...
module_keywordskeywords, to be placed in the html header
module_scoring= yes if the module gives scores according to wims standard
Also, variables module_has_intro, module_has_help and module_has_about have value "yes" if the module's directory contains the respective .phtml file. These variables are used in the command !homeref.
• Certain environment variables setup by httpd are readable by wims modules under names starting with httpd_. For example, the environment variable REMOTE_HOST becomes httpd_REMOTE_HOST under wims.
Please refer to httpd protocol specifications for details of such variables.
• All variable names starting with ins_, insplot_, instex_ will have special meanings for the corresponding dynamic insertion engines. A module should read or write them only for the special meanings they are designed for.
• If your module uses an external package (e.g. pari), variable names starting with the name of the interface to that external package followed by _ will have special meanings for that interface, and should be reserved for that purpose.

## Variables with special meanings

 ins_align defines the manner in which the inline picture is aligned with respect to the line. Possible values: bottom, middle or top. Default is empty (which means bottom). ins_attr is used to define miscallaneous attributes of a dynamic insertion. Examples:  ins_attr = align=middle (aligns the middle of the image with the baseline for the current textline), or  ins_attr = ismap (coordinates of the click will be passed back to the server; if the link of the element is the wims server, the coordinates will be registered under the variable no_name.) This variable is reset to empty after a dynamic insertion. ins_border is used to define border width of the html element IMG resulted from the dynamic insertion. Its value should be a positive number. This variable is reset to empty after a dynamic insertion. ins_density is used to define the density of the dynamic insertions. Default value: 100x100 . Avoid using this variable! We are planning to suppress it. Will be replaced by a server-managed variable. ins_format can be used to determine the format of the graphics file of the dynamic insertion: its value should be either gif or jpg. The default value of this variable is gif (which can be changed by modifying the file wims.conf; but such change is not recommended). Some types of dynamic insertions may not be affected by this variable. ins_quality is used to define quality of the graphics convertion used in dynamic insertions. Its value should be between 0 and 100. Affects only dynamic insertions whose graphics format is jpg. ins_tag is used for dynamic insertions within a form. In this case define ins_tag=form name where name is the name of the html element IMG within the form (optional). This variable is reset to empty after a dynamic insertion. insdraw_size is the size in pixels for the dynamic insertion. ins_filename is the name of the graphics file of the dynamic insertion (generated by wims). It must be taken just after the command !insdraw ins_url is the url of the graphics file of the dynamic insertion. It must be taken just after the command !insdraw insplot_data is ... insplot_font is ... insplot_set is ... insplot_split is ... insplot_transparent is used to define transparent color for insertions. Default is empty (no transparency). Usual value: 255,255,255(white is transparent).

 wims_backslash_insmath if the value is yes, it is possible to use the notation  to insert mathematical expressions. force_mathml if the value is yes, force mathml output of tex formulas. disable_mathml If the value is 1, disable mathml output of tex formulas. The variable disable_mathml has priority on force_mathml. pari_precision give the pari precision of the computation with Pari/GP print_precision give the precision of the computed number at the end of the computation. maxima_precision give the maxima precision of the computation with Maxima. wims_multiexec If the value is yes, allow the multiexecution of the mathematical software use_comma If value is 1 moneyprint will use a decimal comma. Any other value or no value will use the decimal point notation. Only to be used for presentation purposes.

## Data structure

#### Arrays

There is no special syntax in wims language for arrays. However, it is possible to design array-like variable structures, with integer or even string subscripts. This can be done using nested variable substitutions. For example, ...

#### Fields in a string

Wims variables are all string variables. There are three different ways to split a string into fields:
• As a list of words, separated by white-space characters. Consecutive white-spaces are considered as one field separator.
• As a list of lines, separated by new-line characters. Consecutive new-lines are considered as separating empty lines.
• As a list of items, separated by commas ( , ). Consecutive commas are considered as separating empty items.

This section is not yet finished. Sorry.

## List of commands

WIMS commands can be used in variable processing files and phtml files. A command is a word preceeded by the character !.

Commands has two types:

• Execution commands, which are placed as the first word of a line.
• Variable commands, which are placed at the beginning of a definition of a variable.

Some commands can be used both as execution command and as variable command.

Commands may accept parameters which are words following it. Parameter fields are separated by white spaces or special words (depending on the command).

### Here is the list of all commands.

• #### append

Type: both execution and variable command
Syntax: !append object s1 to str
Meaning: String manipulation: append object s1 to the string str; object may be item, word, line, colon or semicolon. The object s1 should not be empty before evaluation.
• #### bound

Type: execution command
Syntax: !bound vname between [integer] v1 and v2 [default defaultvalue]
!bound vname within list [default defaultvalue]
Meaning: bound the range of the variable vname. Usually this is used on user-submitted variables.
The first syntax is usually for numerical variables (integer or real, defaults to real). In this case v1 and v2 supplies the lower and upper bounds for the value of vname.
In the second syntax, the value of vname is compared with each item of list. If no occurrence is found, the value of vname is replaced either by defaultvalue or the first item of list, according to whether defaultvalue is defined.
In any case, defaultvalue is optional.
• #### nocache

Type: execution command; only for trusted modules (in particular administrative modules).
Syntax: !nocache
• #### changeto

Type: execution command
Syntax: !changeto file [parm]
Meaning: Abandon the current file, changing processing to file. file is as in read.
The parameter parm can be accessed from within the new file under the variable name wims_read_parm.
• #### char

Type: both execution and variable command
Syntax: !char numlist of string
Aliases: chars
Meaning: Outputs selected characters of string, according to numlist.
numlist can be a single integer, a comma-separated list of integers, or a range of integers.
A positive integer denotes the number of character in string counted from the beginning, with 1 corresponding to the first character. A negative integer denotes the number of character from the end of string: -1 means the last character, -2 means the next-to-last character, etc.

The syntax for a range of integers is n1 to n2. For example, 2 to -2 means the whole string except the first and the last characters.

• #### charcnt

Type: variable command
Syntax: !charcnt string
Aliases: charcount, charno, charnum, lengthof
Meaning: Returns the number of characters in string.
• #### checkallpar

Type: only for trusted modules (in particular administrative modules).
Syntax: !checkallpar string
Meaning: check if parentheses (all types) are balanced in string and return yes if it is the case and no if not.
• #### checkdata

Type: variable command
Syntax: !checkdata
Aliases: checkdatamodule
Meaning: This command is used to check whether datamodules required by the present module are installed on the server. It returns "yes" if every required datamodule is installed or if no datamodule is required. Otherwise it returns the address of the first missing datamodule.

If your module depends on datamodules to run, declare them in the INDEX file, then use this command to check the presence of the datamodules. If the answer is "no", you can take actions to lock further access to your module and/or show error messages.

• #### checkhost

Type: both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax: !checkhost
• #### column

Type: both execution and variable command
Syntax: !column numlist of string
Aliases: columns
Meaning: Outputs selected (comma-separated) columns of a matrix string, according to numlist. Rows of the matrix can be separated either by new lines or by semi-colon ;.
numlist can be a single integer, a comma-separated list of integers, or a range of integers.
A positive integer denotes the number of column in string counted from the beginning, with 1 corresponding to the first column. A negative integer denotes the number of column from the end of string: -1 means the last column, -2 means the next-to-last column, etc.

The syntax for a range of integers is n1 to n2. For example, 2 to -2 means the whole string except the first and the last columns.

The output is separated by commas if only one column is selected, or separated in the same way as the matrix string otherwise.
• #### comment

Type: only for trusted modules (in particular administrative modules).
Syntax: !comment
Aliases: rem remark
• #### date

Type: both execution and variable command
Syntax: !date parm
Meaning: This is simply an interface to the Linux date utility. parm is the parameter string to the Linux command date, please refer to the man page of date for its syntax. The command returns the output of the date utility.
• #### deaccent

Type: both execution and variable command
Syntax: !deaccent string
Meaning: Returns string with all accented letters (such as é, à, ï) folded to their unaccented counterparts.
• #### debug

Type: both execution and variable command
Syntax: !debug parms
Meaning: This command is for debugging purposes: it substitutes the parameter parms, and stops the execution with a module error sent to the user. The content of the error message contains the result of the substitution.
• #### declosing

Type: both execution and variable command
Syntax: !declosing string
Meaning: Strips off enclosing pair of parentheses ((),[],{}) in string. Useful for treatment of user-input vectors or sets, where some users use enclosing parentheses and other do not.
• #### default

Type: execution command
Syntax: !default name=value
Meaning: put value into the variable name, if name is not already defined. value may be a variable command (together with optional parameters).
• #### defof

Type: both execution and variable command
Syntax: !defof vname in fname
Aliases: definitionof, getdef
Meaning: Returns the definition of variables vname in the file fname.

When vname contains several names, the values of each will be returned with the same separators as for the names.

• #### detag

Type: both execution and variable command
Syntax: !detag string
Meaning: Removes html tags in string. It is very rudimentary and should be used with care. Very useful for security enhancement in some occasions (apply to user-supplied strings).
• #### detrust

Type: only for trusted modules (in particular administrative modules).
Syntax: !detrust
Aliases: distrust
• #### distribute

Type: execution command
Syntax: !distribute type string into namelist
Meaning: Distribute the content of string into variables namelist. The distribution can be done word by word, item by item, character by character or line by line, according to the word type where type can be one of the following: words, items, lines, chars.

For example, if type is words, then the first (resp. second, etc.) variable in namelist will be set to the first (resp. second, etc.) word of string.

• #### embraced

Type: both execution and variable command
Syntax: !embraced opword string
Meaning: executes an operation opword in each substring of string enclosed in a pair of curly braces.

The curly braces in string can be nested, but the execution runs from outmost pair to innermost pair.

Available opword:

• randitem. Random item in every embraced text.
• randrow. Random row in every embraced text.
• linkedranditem. Random item in every embraced text such that for each level of curly braces, the position of the choosen item is the same.
• extract. Extracts the first (outmost) embraced text.
• delete. Deletes all embraced contents (encluding the curly braces).
• #### eval

Type: variable command
Syntax: !eval expr
Aliases: evalue
Meaning: Returns the numerical value of the expression expr. expr must evaluate to a real number (under the current version of wims). The evaluation is internally done in double precision, but the print precision can be changed by setting the variable wims_print_precision (whose default value is 8).
If an error is found in the expression expr, 0 is returned. (I know that this is very bad; I just have no time to make everything right.)
• #### evalsubst

Type: both execution and variable command
Syntax: !evalsubst name=val in expr
Aliases: evalsubstit, evalsubstitute, evaluesubst, evaluesubstit, evaluesubstitute
Meaning: Manipulation of mathematical expressions: substitute variable name by val in expr, then evaluate the expression to a real number. No regular expression is allowed in name.
• #### examscore

Type: both execution and variable command
Syntax: !examscore
• #### exchange

Type: execution command
Syntax: !exchange var1 and var2
!exchange var1, var2
Meaning: Exchanges the values of the variables var1 and var2.
• #### exec

Type: both execution and variable command
Syntax: !exec command parms
Aliases: execute, run, call
Meaning: execute external command command with optional parameters parms. command must be a valid program name in the wims-public directory bin.
When used as variable command, returns the output of the called program.
• #### exit

Type: execution command
Syntax: !exit
Aliases: return
Meaning: Abandon the current file. If current file is called by another file, return to the latter.
• #### fileappend

Type: execution command
Syntax: !fileappend fname content
Aliases: appendfile
Meaning: Append content to file fname. fname is a file residing in directory of the module, under the subdirectory writable.
A new line will be added at the end of the content.

Special case: if the file name starts with getfile/, the file is written to the getfile subdirectory of the session. This file is then accessible via the command

!href cmd=getfile&special_parm=fname_without_getfile_prefix
or a complete url
$wims_ref_name?session=$session&+cmd=getfile&+special_parm=fname_without_getfile_prefix
• #### fileexists

Type: variable command
Syntax: !fileexists file
Aliases: filexists
Meaning: return yes if file is a file in the base directory public_html in the case of a non trusted module. If the command is executed from a trusted module, file may be of the form wimshome/address. For example,
!fileexists themes/standard/_procs/tt.phtml
or for a trusted module,
!fileexists wimshome/log/classes/2001/Exindex
• #### filewrite

Type: execution command
Syntax: !filewrite fname content
Aliases: writefile
Meaning: Write content to file fname. fname is a file residing in the module's directory, under the subdirectory writable.
A new-line character will be added at the end of the content.

Special case: if the file name starts with getfile, the file is written to the getfile subdirectory of the session. This file is then accessible via the command

!href cmd=getfile&special_parm=fname_without_getfile_prefix
, or a complete url
$wims_ref_name?session=$session&+cmd=getfile&+special_parm=fname_without_getfile_prefix
• #### for

Type: execution command
Syntax: !for var = start to end [step st ]
!for var from start to end [step st ]
!for var in list

... (multi-line content)

!next
Meaning: For loop. In the first two forms, var goes from start to end, with optional step st.
In the last form, var takes successively items in the list list. list is a list of items separated by commas.
The command
!break
within the for loop breaks it. continue is not yet implemented in this version.
It is recommended that the variable name var be added to the !next line. This has no effect for the time being, but may be used in future versions of wims.
• #### form

Type: execution command
Syntax: !form cmdvar
Meaning: Creates a html form pointing to the wims server.
Whenever possible, this command should be used instead of a direct use of html tag <form>.
This command will create a <form> tag pointing to the wims server, adding <input> fields to pass session number (and other reserved things in the future). In lines which follow, other input (or select) fields may be added to the form. A final !formend must also be added by the programmer.
cmdvar is an optional parameter. Its value should be a valid value for the variable cmd. In this case the value cmdvar will be automatically submitted to the variable cmd. If this parameter is missing or is invalid, then the programmer should add a <input type="hidden" name="cmd" value="..." /> tag before the final </form>.

The target of the form can be controlled by the variable wims_ref_target. It can also be defined via an optional word target=.... Note that in this case the target must start with wims_.

The variable wims_form_method which must be either get or post controls the method of the form. This method defaults to post for tool modules, and to get for all other modules.

• #### formbar

Type: execution command
Syntax: !formbar name from n1 to n2
!formbar name list selectlist
Meaning: Creates a bar of radio buttons under a previously defined html form.
This bar should be arranged to represent values from small to big. No prompt is given to the user, except the indication that left is smaller. In the parameters, name defines the name field of the menu, and the values of the menu are either integers going from n1 to n2 (in the first syntax), or items in the list selectlist.
The default of the menu will be the current value of the variable $name. • #### formcheckbox Type: execution command Syntax: !formcheckbox name from n1 to n2 prompt promptlist !formcheckbox name list selectlist prompt promptlist Aliases: htmlcheckbox Meaning: Creates a checkbox list menu under a previously defined html form. This command speeds up the creation of checkboxed menus, as well as simplifies the source files. In the parameters, name defines the name field of the menu, and the values of the menu are either integers going from n1 to n2 (in the first syntax), or items in the list selectlist. The optional parameter promptlist can be used to generate user prompts for each items in the list. If promptlist is empty or is shorter than selectlist, the undefined prompts will be replaced by the value. If it is longer, the rest will be ignored. An id is created automatically, except if the variable wims_ref_id is specified just before. If the variable wims_html_mode has a value as div, li, td, the different items of the html form will be in the corresponding html environmment. If the variable wims_ref_class is non empty, the class of this html environment is the value of this variable. The default of the menu will be the current value of the variable$name.
Sample(s):
CommandResult
!formcheckbox varCHK1 from 1 to 3 prompt txt1,txt2,txt3 , ,
!formcheckbox varCHK2 list a,b,c prompt txtA,txtB,txtC , ,
<ol>!set wims_html_mode=li !formcheckbox varCHK3 list apple,pear prompt &#x1f34e;,&#x1f350; </ol>
• #### formend

Type: execution command
Syntax: !formend
Meaning: Creates the balise which closes the form created by !form

Type: execution command
Syntax: !formradio name from n1 to n2 prompt promptlist
!formradio name list selectlist prompt promptlist
Meaning: Creates a radio button list menu under a previously defined html form.
This command speeds up the creation of radio buttoned menus, as well as simplifies the source files. In the parameters, name defines the name field of the menu, and the values of the menu are either integers going from n1 to n2 (in the first syntax), or items in the list selectlist.
The optional parameter promptlist can be used to generate user prompts for each items in the list. If promptlist is empty or is shorter than selectlist, the undefined prompts will be replaced by the value. If it is longer, the rest will be ignored.
• #### listintersect

Type: both execution and variable command
Syntax: !listintersect list1 and list2
Aliases: listintersection
Meaning: Returns items appearing in both list1 and list2. Repetitive occurrences are eliminated.
• #### listunion

Type: both execution and variable command
Syntax: !listunion list1 and list2
Meaning: Returns items appearing in either list1 or list2. Repetitive occurrences are eliminated.
• #### listuniq

Type: both execution and variable command
Syntax: !listuniq list
Aliases: listunique
Meaning: Returns items in list, with repetitive occurrences eliminated.
• #### lookup

Type: both execution and variable command
Syntax: !lookup defname in fname
Meaning: Returns the definition of word defname in the file fname which must be a dictionary file in the same syntax as for the program translator (not necessarily sorted).
fname may be either in the module directory (in this case the module directory need not be specified), or in the directory bases.
• #### lower

Type: both execution and variable command
Syntax: !lower string
Aliases: lowercase, tolower
Meaning: Returns string with all upper case letters replaced by their lowercase counterparts.
• #### mailto

Type: execution command; only for trusted modules (in particular administrative modules).
Syntax: !mailto ...
Meaning: sends an email to a person whose address is the first line of the parameter. The second line (optional) is the sender The third line is the subject of the message. And the remaining lines constitute the body of the message.
• #### mailurl

Type: both execution and variable command
Meaning: Creates a javascript-crypted email interface that is difficult for spammer-robot to decrypt.

The first word of the first line in the parameter should be the email address.
The rest of the first line is the recepient name (default to email address).
The second line and up is the mail subject.

This command calls, in the order of priority, one of the following files:

1. "mailurl.proc" in the module directory.
2. "mailurl.proc" in the current theme.
3. "scripts/mailurl.proc".
This allows site managers and authors to define different address encryption methods.
Mail addresses are not encrypted when the user is within a virtual class.
This command collapses some variables beginning with "mailurl_".
• #### makelist

Type: both execution and variable command
Syntax: !makelist templ for v=v1 to v2 [step st], or
!makelist templ for v in v1,v2,v3,...
Meaning: Outputs a list consisting of templ with variable v successively substituted by values v1, ..., v2.
In the second syntax, the substitutions are done with respect to each item in the list v1,v2,....
The variable v should appear in templ as a math variable (that is, with no preceeding character).
Sample(s):
CommandResult
!makelist [x;x+1;xx] for x in a,x and y,1,(2,3)
[a;a+1;xx],[x and y;x and y+1;xx],[1;1+1;xx],[(2,3);(2,3)+1;xx]  
• #### mathmlmath

Type: both execution and variable command
Syntax: !mathmlmath expr
Aliases: math2mathml
Meaning: Translate the raw mathematical expression expr, into a form which can be best possibly rendered via mathml tags. The transformations are the same as in htmlmath command and the result is in html if mathml is not available. If the expression is not a "machine-understandable mathematical expression", there is no garanty on the result (today and in the future !).
• All digits or + or - following a ^ or _ are considered as in exponent/subscript; expression with ( ) following a ^ or _ are considered as in exponent/subscript; parenthesis are remove (if no sign before) except in case of exponent and only digits.
• Get rid of 1*.. ..*1. example: in 1 * x, x/1, the 1 is removed.
• Replace scientific notation (for example) 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless.
• Replace some names as greek letters by their equivalents.
• Remove * or replace by multiplication sign.
• Replace <=, >=, ->, =>, <=> by their html/mathml equivalents if possible.
Sample(s):
CommandResult
!mathmlmath 1*x+3*y = 35E-05 $x+3y=35×{10}^{-5}$
• #### mathsubst

Type: both execution and variable command
Syntax: !mathsubst name=val in expr
Aliases: mathsubstit, mathsubstitute
Meaning: Manipulation of mathematical expressions: substitute variable name by val in expr.
No regular expression is allowed in name.
• #### mexec

Type: both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax: !mexec command parms
Meaning: execute a module-private external command command with optional parameters parms. command must be a valid program name in the module's home directory. But the command is executed from the base directory of the server.
When used as variable command, returns the output of the called program.
• #### module

Type: both execution and variable command
Syntax: !module defname modname
Meaning: Returns the definition for defname of the module modname. The most common use of this command is to get the title of a module (defname is then title).
The INDEX file of the module modname will be parsed to look for the definition of defname.
• #### msg

Type: execution command
Syntax: !msg error [parm]
Meaning: Put an error message of type error, with eventual parm depending on error.
• #### nocache

Type: execution command; only for trusted modules (in particular administrative modules).
Syntax: !nocache
• #### nonempty

Type: both execution and variable command
Syntax: !nonempty obj content
Aliases: non_empty
Meaning: obj can be item or line. The non-empty items or lines in content will be extracted.
• #### nospace

Type: both execution and variable command
Syntax: !nospace string
Meaning: Collapses all space characters (' ', tab, newline) in string.
• #### nosubst

Type: variable command
Syntax: !nosubst string
Meaning: Returns string as-is, without variable substitution.
• #### passcheck

Type: only for trusted modules (in particular administrative modules).
Syntax: !passcheck word and list2
Meaning: compare the (non crypted) word to the list of crypted words list2 (crypted words begin by *) and return yes if its crypted version is equal to one of them
• #### passcrypt

Type: only for trusted modules (in particular administrative modules).
Syntax: !passcrypt word
Meaning: return word crypted (an * is added at the beginning of the crypted result); word must contain only alphanumeric characters.
• #### pedia

Type: both execution and variable command
Syntax: !pedia keyword, name
Aliases: encyclopedia, encyclo
Meaning: Creates a hypertext link pointing to an online encyclopedia. keyword will be the name under which the reference is looked for, and should be a phrase with one or several words separated by space. Examples: finite field or linear transformation.
name is the name of the link (i.e. what people see in their page, and can click on).

Actually wims use Wikipedia as the standard reference encyclopedia.

• #### perl

Type: both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax: !perl
• #### positionof

Type: both execution and variable command
Syntax: !positionof [type] s in string
Aliases: position, positions
Meaning: Reports the positions of the object s in string. The word type can be char, word, item, line or row. If it is specified, then the comparison only takes place for corresponding objects of string which are identical to s. The output of the command is a list of positions (char, word, item, line or row, according to the value of type) where s is found in string. Here, rows are separated by semi-colon ; and lines by new lines.
If type is missing, then s is searched in string as a substring, and the positions reported are character positions (more precisely, the positions of the previous character of s in string).
• #### product

Type: both execution and variable command
Syntax: !product fn for v=v1 to v2 [step st]
!product fn for v in v1,v2,v3,...
Aliases: prod, multiply
Meaning: Computes the product of a function fn(v) with variable v replaced successively by values v1, ..., v2.

In the second syntax, the values are given with respect to each item in the list v1,v2,....

• #### randchar

Type: variable command
Syntax: !randchar str
Meaning: Returns a random character in str.
• #### randfile

Type: variable command
Syntax: !randfile fname
Aliases: randrecord
Meaning: Returns a random record in the datafile fname.
• #### randint

Type: variable command
Syntax: !randint n1, n2
!randint n1, n2 repeat i
Meaning: Returns a random integer between n1 and n2 (inclusive).
Substitution and evaluation are done on n1 and n2 before applying random.
If n2 is missing, returns random integer between 1 and n1 (inclusive).
If both n1 and n2 are missing, returns 0.
You can also type !randint n1, n2 repeat i to repeatedly generate i random integers.
• #### randitem

Type: variable command
Syntax: !randitem list
Meaning: Returns a random item in list. Items are separated by commas.
• #### randline

Type: variable command
Syntax: !randline str
Meaning: Returns a random line in str.
• #### random

Type: variable command
Syntax: !random n1, n2
Aliases: randdouble, randfloat
Meaning: Returns a random real number between n1 and n2.
Substitution and evaluation are done on n1 and n2 before applying random.
If n2 is missing, returns random number between 0 and n1.
If both n1 and n2 are missing, returns 0.
You can also type !random n1,n2 repeat i to repeatedly generate i random numbers.
• #### randword

Type: variable command
Syntax: !randword str
Meaning: Returns a random word in str.
• #### rawmath

Type: both execution and variable command
Syntax: !rawmath expr
Meaning: Translate the mathematical expression expr, possibly with common user errors, into a machine-understandable mathematical expression.
It will replace (x+1)(x-1) into (x+1)*(x-1), 5x^3 into 5*x^3, etc. More precisely,
• Replace some badcharacters as **, ², ³.
• translate ++, +-, -+, ... into one sign
• translate | | in abs
• replace new lines or tabs by spaces
• add zero in case of decimal digits if necessary: for example, replace 4. by 4.0 and .5 -> 0.5
• replace justapositions by multiplications if rawmatheasy=yes
• #### rawmatrix

Type: both execution and variable command
Syntax: !rawmatrix expr
Meaning: Translate the matrix expr, possibly with common user errors, into a machine-understandable matrix expression.
• #### reaccent

Type: both execution and variable command
Syntax: !reaccent string
Meaning: Replace accented letter compositions in string by accented letters (replacing e' by é, a by à, i" by ï, o^ by ô, etc.) The only exception is that ç and Ç are composed from c~ and C~ respectivement.

Type: execution command
Aliases: include, input
Meaning: Insert the content of file, and process it. file must be a valid file name with the module's home directory as base directory. (directory structure may be specified in file, but backtracing to parent directories is prohibited.)
And the parameter parm can be accessed from within the called file under the variable name wims_read_parm.
WIMS will try to cache the file for repeated use, unless the filename is preceded by "./".

Type: execution command; only for trusted modules (in particular administrative modules).

Type: execution command
Meaning: Include a variable processing file file. file must be a valid file name with the module's home directory as base directory. (directory structure may be specified in file, but backtracing to parent directories is prohibited.)
And the parameter parm can be accessed from within the called file under the variable name wims_read_parm.
• #### record

Type: both execution and variable command
Syntax: !record numlist of fname
Aliases: records
Meaning: Outputs selected records of the datafile fname, according to numlist.
numlist can be a single integer, a comma-separated list of integers, or a range of integers.
A positive integer denotes the number of record in fname counted from the beginning, with 1 corresponding to the first record. A negative integer denotes the number of record from the end of fname: -1 means the last record, -2 means the next-to-last record, etc.

The syntax for a range of integers is n1 to n2. For example, 2 to -2 means the whole fname except the first and the last records.

• #### recordcnt

Type: variable command
Syntax: !recordcnt fname
Aliases: recordcount, recordno, recordnum
Meaning: Returns the number of records in the datafile fname.
• #### recursion

Type: both execution and variable command
Syntax: !recursion fn for v=v1 to v2 [step st]
!recursion fn for v in v1,v2,v3,...
Meaning: Computes the outcome of a recursion using the function fn in which the variable v is replaced successively by values v1, ..., v2.

In the second syntax, the values are given with respect to each item in the list v1,v2,....

The function fn should use the variable last to indicate the value of the previous recursion step. And the starting value can be put into the WIMS variable $recursion_start. • #### reinput Type: both execution and variable command Syntax: !reinput string Meaning: Prepares string to be inserted into a form input or textarea. Browsers translate & primitives into corresponding (special) characters even when these primitives occur in input or textarea fields. Also, if string contains html tags, they may confuse browsers. You can use this command on the string (usually derived from an earlier user input) before inserting them back into a input or textarea, to avoid the above problems. • #### rename Type: both execution and variable command Syntax: !rename f Meaning: Changes the reference to a file f, such as a graphics file reachable by direct http, into one with a different name using the method !getfile. This command is useful with exercises where important information is carried by multimedia files (pictures, audios, movies). It can be used to hide the name of the multimedia file that otherwise would give clues to the solution of the problem. The renamed file must be located within the module, and the filename f should start with$module_dir.

The command returns a string which is the new URL. The file is not effectively copied or renamed on the server.

• #### replace

Type: both execution and variable command
Syntax: !replace [internal] s1 by s2 in string
!replace obj ident by s in string
Meaning: String manipulation.

Under the first syntax, variable substitution is first done on string. Then all occurences of substring s1 are replaced by s2.
When the keyword internal is absent, the Linux utility sed is called to make the replacements, therefore regular expressions are accepted in s1 and s2. Please refer to the man page of sed for details.

Under the second syntax, obj can be char, word, item or line. Then the word, item or line identified by ident in string is replaced by s, after variable substitutions.
ident can be a string, in this case all objects (words, items or lines) matching ident will be replaced. It can also be a number (positive or negative integer n), preceded by the word number. In this case the object number n will be replaced. (In the case where n<0, it is the last -n th object which is replaced.)

• #### reset

Type: execution command
Syntax: !reset name1 [ ,name2,...] names[1O]
Meaning: erase the content of the variable(s) name1, name2, ..., names1, names2,..., names10
• #### restart

Type: execution command; only for trusted modules (in particular administrative modules).
Syntax: !restart parm
Meaning: Restart from a new request with parameters parm, usually for jumping to another module.

This command can be only used before output starts. Repeated restart is disabled, to avoid infinite loops.

• #### robotrap

Type: execution command; only for trusted modules (in particular administrative modules).
Syntax: !robotrap
Aliases: robottrap
• #### lines2rows

Type: both execution and variable command
Syntax: !rows2lines string
Meaning: This command changes multiple rows in string into lines (the separator is
• #### select

Type: both execution and variable command
Syntax: !select data where condition
Meaning: Outputs rows of a matrix data, according to condition. Rows of the matrix can be separated either by new lines or by semi-colon ;.

The condition can use words column 1, column 2, etc. to designate comma-separated columns in each row.

• #### setdef

Type: execution command
Syntax: !setdef defstr in fname
Meaning: Set definitions defstr in the file fname.
• #### setseed

Type: execution command; only for trusted modules (in particular administrative modules).
Syntax: !setseed
• #### sh

Type: both execution and variable command; only for trusted modules (in particular administrative modules).
Syntax: !sh
• #### shortout

Type: execution command; only for trusted modules (in particular administrative modules).
Syntax: !shortout
• #### shuffle

Type: variable command
Syntax: !shuffle [even|odd] n
!shuffle [even|odd] list
Aliases: randperm, randpermute
Meaning: Randomly permutes a set of n elements. n must be a positive integer not greater than 1024 in the first usage, or is the number of items in list in the second usage.
For the first usage, the command returns a comma-separated list i1, i2, ..., in, where the items ik are randomly ordered elements of the set {1,2,...,n}.
This command can be used in conjunction with commands !item, !line, !word, !char, to randomly permute items, lines, words, or characters in a string.
For the second usage, a new list with randomly permuted items in list is returned.
In any case, the variable wims_shuffle_order is set to be the list i1, i2, ..., in.
When the optional word even or odd is present, only even/odd permutations are produced.
• #### singlespace

Type: both execution and variable command
Syntax: !singlespace string
Meaning: Returns string with all space characters (space, tab, newline) replaced by , and multiple occurrences of space characters collapsed into single one.
Leading and ending spaces are not removed. You can use this command in conjunction with trim if you want also to remove leading and ending spaces.
This command is especially useful for comparisons between multi-word strings.
• #### solve

Type: both execution and variable command
Syntax: !solve fn for v=v1 to v2
Aliases: rootof
Meaning: Find out (real simple) roots of the function/equation fn for the variable v between v1 andv2.

fn may have several roots in the interval [v1,v2], but roots too close to each other may be overlooked.

• #### sort

Type: both execution and variable command
Syntax: !sort [nocase] [reverse] [numeric] type [of] string
Meaning: Sort string. The type of the sort may be char, word, list or line.
After this command is executed, the sort order is stored in the variable wims_sort_order (as a list). This can therefore be used for relational sorting, in conjunction with commands !item, !line, !word or !char.
• #### sum

Type: both execution and variable command
Syntax: !sum fn for v=v1 to v2 [step st]
!sum fn for v in v1,v2,v3,...
Meaning: Computes the sum of a function fn(v) with variable v replaced successively by values v1, ..., v2.

In the second syntax, the values are given with respect to each item in the list v1,v2,....

• #### tail

Type: execution command
Syntax: !tail parm
Meaning: Standardized ending for html page outputs. Includes the command !homeref.

parm is reserved for future implementation.

• #### texmath

Type: both execution and variable command
Syntax: !texmath expr
Aliases: TeXmath, math2tex
Meaning: Translate the mathematical expression expr into a TeX source. If the expression is not a "machine-understandable mathematical expression", there is no garanty on the result (at the moment and in the future !). The transformations made are the following:
• Transforms computer matrix as [ 4,5;6,7] in latex matrix.
• Transforms A/B in {1 over B} A or { A over B} according to the priority of the presume type of A and B (integer, numeric, variable, poly, transcend).
• transforms <=, <=> =>, -> in tex/latex codes.
• Transforms a relation without a second member by adding 1.
• Replace scientific notation 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless.
• Remove the stars *.
• Replace some names as greek letters by their equivalents.
• interpret sum(), integrate, prod () (coming from maxima ) in tex/latex codes.
• #### text

Type: both execution and variable command
Syntax: !text operation parameter
Meaning: This is intended to be a very powerful text manipulation tool, allowing very sophisticated processing of long text strings with high speed.
Many of the operations accept masks. A mask is a string composed of 0s and 1s. For operations which accept a mask, only characters at positions whose corresponding character in the mask is not a 0 are processed. (In this sense positions corresponding to 0s are masked.) Empty mask is considered as of being entirely composed of 1s.
A mask which is too short repeats itself, unless it terminates with a +, in which case it fills the rest with 1s, or with a -, in which case it fills the rest with 0s.
For the time being, implemented operations are as follows.
Extracts characters in text1 one by one, for those identical to the corresponding characters in text2 and whose positions are not masked by maskstring.
• !text compare text1 and text2
Compares the strings text1 and text2 character by character, and returns a mask string with 0s on positions where the corresponding characters in text1 and text2 are equal, and 1s otherwise.
Returns the number of characters in text whose positions are not masked by maskstring, and who appear in charlist.
Extracts characters in text1 one by one, for those different to the corresponding characters in text2 and whose positions are not masked by maskstring.
(Synonyme of diff: differ).
• !text expand text using maskstring
Produces a string, where positions corresponding to 0s in maskstring are filled by   (the space character), and where positions corresponding to 1s in maskstring are filled by characters of text. The characters in text are used one by one, and the resulting string stops when all the characters in text are exhausted (or when the string reaches the length limit).
Returns text2 with non-masked characters replaced by characters text1. Characters in text1 are used one by one (without taking into account the masking), and the replacement stops when there is no character left in text1.
Returns a new text which is result of interactions of characters in corresponding positions in text1 and text2. The rule of the interaction is defined in itab.
itab contains n+1 lines, each of n characters. The first line defines the characters corresponding to each position in the following n lines which defines the multiplication table.
The multiplication table needs not to be symmetric. In this case, the rows correspond to characters in text1, and the columns correspond to characters in text2.
If text1 or text2 contains a character not in the first line of itab, the interaction at the corresponding position is considered as empty. Also, masked positions are ignored.
If text1 and text2 have different lengths, the longer is cut to fit the shorter.
• !text mark charlist in text
Returns a mask string with 1s on positions where the corresponding character in text appears in charlist, and with 0s on other positions.
Returns a string which at each position is the character with highest ASCII code between corresponding characters in text1 and text2. The length of the result is that of the longest of the two. Masked positions are skipped.
Returns a string which at each position is the character with lowest ASCII code between corresponding characters in text1 and text2. The length of the result is that of the shortest of the two. Masked positions are skipped.
Returns characters in charlist which occur in unmasked positions in text.
(Synonymes of occur: appear, occurrence).
Returns text in which masked characters and characters appearing in charlist are removed.
(Synonymes of remove: drop, delete).
• !text reorder text by orderlist
Returns a reordered text using the order list orderlist. Reordering is cyclic if orderlist is shorter than text.
orderlist must be a list of n positive integers, which is a permutation of the set {1,...,n}. If orderlist contains items other than integers within the bound, empty string is returned. However, unicity check is not performed on items of orderlist.
• !text repeat text to len
Repeat the string text cyclicly, up to length len.
• !text reverse text
Reverse the order of text, with the last character coming first, etc.
Returns text in which masked characters and characters not appearing in charlist are removed.
(Synonymes of select: pick, pickup).
• #### title

Type: execution command
Syntax: !title parm
Meaning: Puts page's title in a standardized format. parm is reserved for future implementation.
• #### translate

Type: both execution and variable command
Syntax: !translate [internal] s1 to s2 in string
!translate [internal] s1 in string to s2
Meaning: String manipulation: variable substitution is first done on string. Then all occurences of the first (resp. second, ...) character of s1 is replaced by the first (resp. second, ...) character of s2.
When the keyword internal is absent, the Linux utility tr is called to make the translations, therefore regular expressions are accepted in s1 and s2. Please refer to the man page of tr for details.
• #### trim

Type: variable command
Syntax: !trim string
Meaning: Returns string with leading and trailing spaces stripped off.
• #### upper

Type: both execution and variable command
Syntax: !upper string
Aliases: uppercase, toupper
Meaning: Returns string with all lower case letters replaced by their uppercase counterparts.
• #### usererror

Type: execution command; only for trusted modules (in particular administrative modules).
Syntax: !test
• #### values

Type: both execution and variable command
Syntax: !values fns for v=v1 to v2 [step st]
!values fns for v in v1,v2,v3,...
Meaning: Outputs a list of values of fns with variable v replaced successively by values v1, ..., v2.

In the second syntax, the values are given with respect to each item in the list v1,v2,....

fns may be a comma-separated list of functions.

This command can also be used to make recursions. If the functions fns contain a variable named last, this variable will take the value of the last step each time. And the starting value can be put into the WIMS variable $recursion_start. • #### varlist Type: both execution and variable command Syntax: !varlist [nofn] formula Aliases: listvar Meaning: Manipulation of mathematical expressions: returns list of variable names (and function names) appearing in the formula. If the switch nofn is present, function names will not be listed. • #### warn Type: execution command Syntax: !warn subject Aliases: warning Meaning: Outputs a warning message related to subject. Does nothing if no warning message about subject is present. • #### while Type: execution command Syntax: !while string1 relation string2 Meaning: Conditional branching: execute the multi-line content between !while line and !endwhile line, until relation is no longer verified. The leading and trailing spaces of string1 and string2 will be stripped before making comparisons. The syntax is the same as for if. • #### whileval Type: execution command Syntax: Same as the command while, but = (==), != compares the numerical values of string1 and string2 rather than the strings themselves. • #### word Type: both execution and variable command Syntax: !word numlist of string Aliases: words Meaning: Outputs selected words of string, according to numlist. numlist can be a single integer, a comma-separated list of integers, or a range of integers. A positive integer denotes the number of word in string counted from the beginning, with 1 corresponding to the first word. A negative integer denotes the number of word from the end of string: -1 means the last word, -2 means the next-to-last word, etc. The syntax for a range of integers is n1 to n2. For example, 2 to -2 means the whole string except the first and the last words. • #### wordcnt Type: variable command Syntax: !wordcnt string Aliases: wordcount, wordno, wordnum Meaning: Returns the number of words in string. • #### words2items Type: both execution and variable command Syntax: !words2items string Aliases: wordstoitems, words2list, wordstolist Meaning: This command changes multiple words in string into multiple items. • #### words2lines Type: both execution and variable command Syntax: !words2lines string Aliases: wordstolines Meaning: This command changes multiple words in string into multiple lines. Table of Contents ## List of inline mathematical symbols The symbol names are based on corresponding TeX names. SymbolName tt , , , ... , ...$m_alpha, $m_beta,$m_gamma, ... $m_pi, ...$m_omega
, , , , , , , , , , $m_Gamma,$m_Delta, $m_Lambda,$m_Phi, $m_Psi,$m_Pi, $m_Sigma,$m_Theta, $m_Upsilon,$m_Xi, $m_Omega , , , , ,$m_varepsilon, $m_varphi,$m_wp, $m_ell,$m_Re, $m_Im , , ,$m_aleph, $m_infty,$m_nabla, $m_partial , , , , ...$m_AA, $m_CC,$m_RR, $m_QQ,$m_ZZ ...
, ,... ,... $m_calA,$m_calB,... $m_calM,...$m_calZ
, ,... ,... $m_eufA,$m_eufB,... $m_eufM,...$m_eufZ
, ,... ,... $m_eufa,$m_eufb,... $m_eufm,...$m_eufz
, , , , $m_le,$m_ge, $m_pm,$m_times, $m_div , , ,$m_neq, $m_equiv,$m_cong, $m_approx , , , , ,$m_leftarrow, $m_rightarrow,$m_mapsto, $m_Leftarrow,$m_Rightarrow, $m_Leftrightarrow , , ,$m_exists, $m_forall,$m_in, $m_emptyset , , , , , , ,$m_subset, $m_supset,$m_subseteq, $m_supseteq,$m_cap, $m_cup,$m_prec, $m_succ , , ,$m_sum, $m_prod,$m_coprod, $m_surd , , , ,$m_int, $m_oint,$m_Vert, $m_oplus,$m_otimes
, , , $m_bigtriangleup,$m_bigtriangledown, $m_bigvee,$m_bigwedge
Besides, large parentheses are available under the name of $m_leftpar2,$m_leftpar3,..., $m_leftpar10 and$m_rightpar2, $m_rightpar3,...,$m_rightpar10. They can be used to inclose matrices of 2,3,...,10 rows. Ditto for leftbrace and rightbrace.

## List of slib (library of scripts)

Script
text/sigunits
Make a representation of a physical quantity with a given number of significative digits

### Appel à partir d'un module

!readproc slib/text/sigunits [parameters] (le résultat est dans la variable slib_out)

### Appel à partir de OEF / Doc

slib(text/sigunits [parameters])

### Paramètres

jusqu'à 4, séparés par des virgules.
1. #### Paramètre 1

physical quantity
(défaut: 1m)
2. #### Paramètre 2

number of significative digits
(défaut: 3)
3. #### Paramètre 3

optional: order of magnitude of the digit before the decimal dot; only valid if the quantity is dimensionless, just a number with no unit.
4. #### Paramètre 4

optional: the desired physical unit to show (possibly a multiple or sub-multiple).

### Résultat

the physical quantity with the right number of digits, or a numeric value which would be equal to the result with the right number of digits.
the default means: 1 meter with three significative digits. The last example shows how the numeric value may lack some trailing zeros after the dot.

Known bug:
if the third parameter is used, the output may have a wrong syntax. Ensure that the resulting number has its decimal dot near its significant digits.

units-filter

### OEF

\text{A=slib(text/sigunits 1.2345A,2)}

Résultat:

\text{A=slib(text/sigunits 1.2V,5)}

Résultat:

\text{A=slib(text/sigunits 12,3)}

Résultat:

\text{A=slib(text/sigunits 12,3,4)}

Résultat:

\text{A=slib(text/sigunits 0.50A.h)}

Résultat:

\text{A=slib(text/sigunits 1800C,3,,A.h)}

Résultat:

\text{A=slib(text/sigunits 1.8°,5,,rad)}

Résultat:

List of slib scripts

## Flydraw Documentation

Chaque commande prend une ligne.

Dans la table suivante [color] peut être un nom de couleur ou 3 entiers 0 entre 255, séparés par des virgules, correspondant aux valeurs de rouge, vert, bleu.

Commandes
-
Synonymes
affine a,b,c,d,tx,ty
Applique la transformation affine (x ;y) -> [a,b ;c,d](x ;y)+(tx ;ty) aux objets définis ultérieurement.
animate fra,del,rep
Cette commande est seulement valable pour les exercices OEF et les documents. Elle doit apparaître sur la première ligne de commande. Il s'agit d'une animation de l'image de fra plans, d'intervalle de del secondes, rep fois; si rep=0, répétition en boucle infinie.
animstep n
Set up an integer which can be called in any evaluation. Used for animation. Direct use of this command must be avoided under WIMS.
arc x,y,w,h,a1,a2,[color]
Arc de l'ellipse de largeur w et de hauteur h centrée en (x,y) (coordonnées mathématiques) entre l'angle a1 et l'angle a2 en degrés.
arrow x1,y1,x2,y2,l,[color]
Flèche allant du point (x1; y1) vers le point (x2; y2) et dont la tête est de longueur l pixels.
arrow2 x1,y1,x2,y2,l,[color]
Flèche entre les points (x1; y1) et (x2; y2) ayant deux têtes de longueur l pixels.
circle x,y,d,[color]
Cercle de centre (x; y) et de diamètre d pixels.
comment
Ligne de commentaire.
copy x,y,x1,y1,x2,y2,[filename]
insert  Insère le rectangle de diagonale (x1; y1) et (x2; y2) (dans le repère en pixels) du fichier filename au point (x; y) : l'extrémité en haut à gauche de l'image est au point (x; y). Si x1 = y1 = x2 = y2 = -1, tout le fichier est copié. [filename] est l'adresse du fichier à partir du répertoire wims/public_html/gifs ou du répertoire indiqué dans common_images pour les modules OEF.
copyresized x1,y1,x2,y2,dx1,dy1,dx2,dy2,[filename]
Insère le rectangle de diagonale (x1; y1) et (x2; y2) du fichier filename dans le rectangle de diagonale (dx1; dy1) et (dx2; dy2) (remise à la taille réalisée). si x1 = y1 = x2 = y2 = -1, tout le fichier filename est copié
crosshair x1,y1,[color]
dessine une croix au point (x1,y1)
crosshairs [color], x1,y1,x2,y2,...
dessine des croix aux points de coordonnées (x1,y1), (x2,y2), ...
crosshairsize w
Règle la taille des croix à w (en pixels).
darrow x1,y1,x2,y2,l,[color]
dasharrow dashedarrow  Flèche en pointillés allant du point (x1; y1) vers le point (x2; y2) dont la tête est de longueur l pixels.
darrow2 x1,y1,x2,y2,l,[color]
dasharrow2 dashedarrow2  Flèche en pointillés entre les points (x1; y1) et (x2; y2) et à deux têtes de longueur l pixels.
dhline x,y,[color]
dashedhorizontalline dashhorizontalline hdline horizontaldashedline  Droite horizontale en pointillés passant par le point (x; y).
diamondfill x,y,nx,ny,[color]
diafill  Remplit la région contenant le point (x; y) avec des lignes de couleur color (quadrillage oblique). (nx; ny) est la distance verticale et horizontale (en pixels) entre deux lignes.
dline x1,y1,x2,y2,[color]
dashedline dashline  Segment en pointillés entre les points de coordonnées (x1; y1) et (x2; y2).
dlines [color],x1,y1,x2,y2,x3,y3...
dashedlines dashlines  Ligne polygonale en pointillés joignant les points (x1; y1), (x2; y2), (x3; y3) ...
dotfill x,y,nx,ny,[color]
pointfill diskfill  Remplit la région contenant le point (x; y) avec des gros points de couleur color. (nx; ny) est la distance verticale et horizontale entre deux points.
dvline x,y,[color]
dashedverticaline dashverticalline vdline verticaldashedline  Droite verticale en pointillés passant par le point (x; y).
ellipse x,y,w,h,[color]
Ellipse de largeur w et de hauteur h centrée en (x,y).
fcircle x,y,d,[color]
ball disk filledcircle  Disque de centre (x; y) et de diamètre d pixels.
fellipse x,y,w,h,[color]
filledellipse  Ellipse de largeur w et de hauteur h centrée en (x,y) et remplie avec la couleur color.
fill x,y,[color]
flood floodfill  Colorie la région contenant le point (x; y) avec la couleur color
filltoborder x,y,[color1],[color2]
Colorie avec la couleur color2 la région contenant (x; y) et délimitée par la couleur color1.
fpoly [color],x1,y1,x2,y2,x3,y3...
filledpoly filledpolygon fpolygon  Polygone de sommets (x1; y1), (x2; y2), (x3; y3) ... et rempli avec la couleur color
frect x1,y1,x2,y2,[color]
filledrect fillecrectangle frectangle  Rectangle de diagonale (x1; y1) et (x2; y2) et rempli avec la couleur color.
fsquare x,y,s,[color]
filledsquare  Carré de coin supérieur gauche (x; y) et de côté de longueur s, rempli avec la couleur color.
ftriangle x1,y1,x2,y2,x3,y3,[color]
filledtriangle  Triangle de sommets (x1; y1), (x2; y2), (x3; y3) et rempli avec la couleur color.
gridfill x,y,nx,ny,[color]
Remplit la région contenant le point (x; y) avec des lignes de couleur color (quadrillage droit) . (nx; ny) est la distance verticale et horizontale entre deux lignes.
hatchfill x,y,nx,ny,[color]
Remplit la région contenant le point (x; y) avec des lignes (simples) de couleur color. (nx; ny) est la distance verticale et horizontale entre deux lignes.
hline x,y,[color]
horizontalline  Droite horizontale passant par le point (x; y).
interlace
Set interlaced image
killaffine
Réinitialise la transformation affine à l'identité.
killbrush
Turns off brush selection for line drawing.
killlinear
killrotation,killrotate  Réinitialise la transformation linéaire à l'identité.
killtile
Désactive la sélection de pavage pour le remplissage.
killtranslation
killtranslate  Réinitialise la translation au vecteur nul.
lattice x0,y0,x1,y1,x2,y2,n1,n2,[color]
Réseau de n1xn2 points partant de (x0,y0), avec n1 lignes dans la direction de (x1,y1) et n2 colonnes dans la direction de( x2,y2).
levelcurve [color],[expression],l1,l2,...
Dessine des courbes de niveau de la surface décrite par une expression de niveaux l1, l2,...
levelstep n
Règle le nombre d'étapes en pixels utilisé pour le dessin des courbes de niveaux. Entre 1 and 16, defaut : 4.
segment x1,y1,x2,y2,[color]
seg line (deprecated)  Segment entre les points de coordonnées (x1; y1) et (x2; y2).
linear a,b,c,d
Applique la transformation linéaire (x;y) -> [a,b;c,d](x;y) aux objets définis ultérieurement..
polyline [color],x1,y1,x2,y2,x3,y3...
lines (deprecated)  Ligne polygonale joignant les points (x1; y1), (x2; y2), (x3; y3) ...
linewidth w
Epaisseur des traits à w pixels.
multicopy n1,n2,...,nk, [filename]
Copie l'image [filename] dans le parallélogramme donné par la commande setparallelogram et applique à l'image les transformations n1, ..., nk (au maximum 19). Si n1 ... ne sont pas donnés, toutes les transformations définies précédemment sont appliquées. Attention, setparallelogram et au moins un setvector ou setmatrix ou settransform doivent d'abord avoir été définis.
new x,y
Fait une nouvelle image de taille x,y (en pixels).
output [filename]
Sauve l'image dans le fichier [filename].
parallel x1,y1,x2,y2,xv,yv,n,[color]
n segments parallèles partant du segment d'extrémités (x1; y1) et (x2; y2) avec le déplacement de vecteur (xv; yv).
pixels [color],x1,y1,x2,y2,...
Points de diamètre 1 aux coordonnées (x1; y1), (x2; y2), ...
plot [color],[formula]
curve  Courbe représentative de formula qui peut être soit une fonction explicit en x, soit une paire de fonctions paramétriques en t.
plotjump j
Saut de la courbe tracée si deux points consécutifs ont une distance de plus de j pixels. Utile afin d'éviter de dessiner des fonctions discontinues comme des fonctions continues. Valeur par défaut : 200.
plotstep n
plotsteps tstep tsteps  Nombre de points calculés dans le tracé de courbes. Valeur par défaut : 100.
point x,y,[color]
Point de coordonnées (x; y) et de diamètre l'épaisseur de trait.
points [color],x1,y1,x2,y2,...
Points de coordonnées (x1; y1), (x2; y2), ... et de diamètre l'épaisseur de trait.
polygon [color],x1,y1,x2,y2,x3,y3...
poly  Polygone de sommets (x1; y1), (x2; y2), (x3; y3)...
range x1,x2,y1,y2
Détermine les coordonnées des bords de l'image.
rays [color],x0,y0,x1,y1,x2,y2...
Segments joignant (x0; y0) et (x1; y1), (x0; y0) et (x2; y2), ...
rect x1,y1,x2,y2,[color]
rectangle  Rectangle de diagonale (x1; y1) et (x2; y2).
resetmatrix n
Réinitialise la n-ième transformation linéaire à l'identité.
resetparallelogram
Réinitialise setparallelogram
resetvector n
Réinitialise la n-ième translation à l'identité.
resettransform n
Réinitialise la n-ième transformation linéaire ou affine ou la n-ième translation aux valeurs initiales (identité ou vector nul).
rotation d
rotate  Rotation des objets définis ultérieurement de d degrés dans le sens inverse des aiguilles d'une montre, de centre (0;0)
setbrush [filename]
Utilise l'image [filename] comme "brush" pour tous les dessins de ligne.
setmatrix n,a,b,c,d
Définit la transformation linéaire pour les objets de multicopy (x;y) -> [a,b;c,d](x;y).
setparallelogram xs,ys,xu,yu,xv,yv
Prépare l'endroit où l'image sera copiée par multicopy (coordonnées mathématiques) : xs,ys coordonnées mathématiques de l'origine, xu,yu coordonnées mathématique de la "ligne horizontale de l'image" à copier, xv,yv coordonnées mathématique de la "ligne verticale de l'image" à copier.
setpixel x,y,[color]
Point de coordonnées (x; y) et de diamètre 1.
setstyle [color1],[color2],...
Définit la couleur des lignes the line style comme color1,color2,...
settile [filename]
Utilise l'image [filename] comme modèle pour toutes les commandes de remplissages.
settransform n,a,b,c,d,tx,ty
Définit la n-ième transformation linéaire pour les objets de multicopy (x;y) -> [a,b;c,d](x;y) + (tx;ty).
setvector n,tx,ty
Définit la n-ième translation transformation linéaire pour les objets de multicopy: (x;y) -> (tx,ty).
size x,y
Set the image size to x pixels horizontally and y pixels vertically.
square x,y,s,[color]
Carré de coin supérieur gauche (x; y) et de côté s (en pixels).
text [color],x,y,[font],[string]
print string write  Ecrit string au point de coordonnées (x; y) avec la police font=small,medium,large ou giant.
textup [color],x,y,[font],[string]
stringup writeup  Ecrit string de bas en haut au point de coordonnées (x; y) avec la police font=small,medium,large ou giant.
trange t1,t2
ranget  Intervalle du paramètre pour le tracé des courbes paramétriques (par défaut 0 et 1).
translation tx,ty
translate  Applique la translation (x;y) -> (x;y)+(tx;ty) aux objets définis ultérieurement.
transparent [color]
Définit la couleur color comme transparente.
triangle x1,y1,x2,y2,x3,y3,[color]
Triangle de sommet (x1; y1), (x2; y2), (x3; y3).
vimg n
Active (1) ou désactive (0) la sortie en graphique vectorielle (défaut 0)
vimgfile [filename]
Sortie en graphique vectorielle (pour l'instant seulement DXF) dans le fichier [filename].
vline x,y,[color]
Droite verticale passant par le point (x; y).
xrange x1,x2
rangex  Détermine les coordonnées horizontales mathématiques des bords de l'image.
yrange y1,y2
rangey  Détermine les coordonnées verticales mathématiques des bords de l'image.

## Canvasdraw Documentation

• Store canvas in variable "A":  \text{A=canvasdraw(xsize,ysize commande...)} 
• Direct display canvas in statement:  \canvasdraw{xsize,ysize}{commande...} 
Canvasdraw versus Flydraw

## Implemented canvasdraw commands (29-12-2020)

### canvasdraw ↑

 canvasdraw
• Canvasdraw will try use the same basic syntax structure as flydraw
• General syntax
• The transparency of all objects can be controlled by command opacity [0-255],[0,255]
• line width of any object can be controlled by command linewidth int
• any may be dashed by using keyword dashed before the object command.
the dashing type can be controled by command dashtype int,int
• a fillable object can be set fillable by starting the object command with an f (like frect,fcircle,ftriangle ...) or by using the keyword filled before the object command.
The fill colour of non_userdraw objects will be the stroke colour...(flydraw harmonization 19/10/2013)
non-solid filling (grid,hatch,diamond,dot,text) is provided using command fillpattern a_pattern
note: do not use a f with this non-solid pattern filling !
for filltoborder x0,y0,color or fill x0,y0,color type filling (eg fill a region around x0,y0 with color until a border is encountered),
there are non-solid pattern fill analogues:
• all draggable objects may have a slider for translation / rotation; several objects may be translated / rotated by a single slider
• a draggable object can be set draggable by a preceding command drag x/y/xy
The translation can be read by javascript:read_dragdrop();The replyformat is: object_number : x-orig : y-orig : x-drag : y-drag
The x-orig/y-orig will be returned in maximum precision (javascript float)...
the x-drag/y-drag will be returned in defined precision number of decimals
Multiple objects may be set draggable / clickable (no limit)
not all flydraw objects may be dragged / clicked
Only draggable / clickable objects will be scaled on zoom and will be translated in case of panning.
• a onclick object can be set clickable by the preceding keyword onclick
not all flydraw objects can be set clickable
• remarks using a ; as command separator. Commands with only numeric or colour arguments may be using a ; as command separator (instead of a new line). Commands with a string argument may not use a ; as command separator !
these exceptions are not really straight forward... so keep this in mind.
• almost every userdraw object,color or multidraw command family may be combined with keywords "snaptogrid | xsnaptogrid | ysnaptogrid | snaptofunction or command snaptopoints x1,y1,x2,y2,...
• every draggable | onclick object may be combined with keywords snaptogrid | xsnaptogrid | ysnaptogrid | snaptofunction or command snaptopoints x1,y1,x2,y2,...
• almost every command for a single object has a multiple objects counterpart:
general syntax rule:
• object x1,y1,...,color
• objects color,x1,y1,...
• All inputfields or textareas generated, can be styled individually using command css some_css
the fontsize used for labeling these elements can be controlled by command fontsize int
command fontfamily is not active for these elements
• If needed multiple interactive scripts (*) may be used in a single webpage.
A function read_canvas() and / or read_dragdrop() can read all interactive userdata from these images.
The global array canvas_scriptswill contain all unique random "canvas_root_id" of the included scripts.
e.g. canvas_scripts[0] will be the random id of the first script in the page and will thus provide a function
fun = eval("read_canvas"+canvas_scripts[0]) to read user based drawings / inputfield in this first image.
If the default reply formatting is not suitable, use command replyformat to format the replies for an individual canvas script,
To read all user interactions from all included canvas scripts, use something like:
function read_all_canvas_images(){ var script_len = canvas_scripts.length; var draw_reply = ""; var found_result = false; for(var p = 0 ; p < script_len ; p++){  var fun = eval("read_canvas"+canvas_scripts[p]);  if( typeof fun === 'function'){   var result = fun();   if( result  && result.length != 0){    if(script_len == 1 ){.return result;};     found_result = true;     draw_reply = draw_reply + result + "newline";    };   };  }; if( found_result ){return draw_reply;}else{return null;};};
(*) Note: the speed advantage over canvas-do-it-all libraries is reduced to zero, when multiple canvasdraw scripts are present in a single page...
For example a typical canvasdraw script is between 5 and 40 kB...a large library like JSXgraph is approx 600 kB
In these cases it would be much faster to load a static general HTML5 canvas javascript draw library and parse it multiple raw fly instructions !
• Canvasdraw can be used to paint a html5 bitmap image
by generating a tailor-made javascript include file: providing only the js-functionality needed to perform the job.
thus ensuring a minimal strain on the client browser
(unlike some popular canvas-do-it-all libraries, who have proven to be not suitable for low-end computers found in schools...)
• You can check the javascript reply format in the wims tool direct exec
• For usage within OEF (without anstype draw), something like this (a popup function plotter) will work:
 ext{popup_grapher=wims(exec canvasdraw popupsize 400,400xrange -10,10yrange -10,10axisaxisnumberingopacity 100,100grid 2,2,grey,2,2,6,blacksnaptogridlinewidth 2jsplot red,5*sin(1/x)strokecolor greenfunctionlabel f(x)=userinput functionmouse blue,22)}\statement{\popup_grapher}.
• Be aware that older browsers will probably not work correctly
no effort has been undertaken to add glue code for older browsers !!
in any case it is not wise to use older browsers...not just for canvasdraw.
• Be aware that combining several different objects and interactivity may lead to problems.
• If you find flaws, errors or other incompatibilities -not those mentioned in this document- send me an email with screenshots and the generated javascript include file.
• There is limited support for touch devices: touchstart, touchmove and touchend in commands userdraw primitives , multidraw primitives , protractor ,ruler and probably a few others...
Only single finger gestures are supported (for now).
The use of a special pen is advised for interactive drawing on touch devices.
For more accurate user-interaction (numeric, eg keyboard driven drawings) with canvasdraw on touch devices: use the command family userinput.

### affine ↑

 affine a,b,c,d,tx,ty
• defines a transformation matrix for subsequent objects
• use keyword killaffine to end the transformation...the next objects will be drawn in the original x/y-range
• a: Scales the drawings horizontally
• b: Skews the drawings horizontally
• c: Skews the drawings vertically
• d: Scales the drawings vertically
• tx: Moves the drawings horizontally in xrange coordinate system
• ty: Moves the drawings vertically in yrange coordinate system
• the data precision may be set by preceding command precision int
• note: not all affine operations on canvasdraw objects will be identical to flydraw's behaviour. Make sure to check !
• : affine : affine+latex

### duplicates ↑

 duplicates || allowdups
• keyword (no arguments)
• only usefull in case of a multidraw student reply.
• only usefull in default replyformat (eg in case of a not specified replyformat).
• if set, duplicate (x:y) coordinates will not be removed from the student reply.
• techical: a javascript variable "allow_duplicate_answer = 1;" is declared.
• default for command multidraw is : removal of duplicates.

### angle ↑

 angle xc,yc,width,start_angle,end_angle,color
• width is in x-range
• angles are in degrees
• not compatible with flydraw
• will zoom in/out
• if angle size is controlled by command slider, use radians to set limits of slider
• angle and arc are exceptions in case of sliders...they are always active (e.g. not click-activated)
• : angle : angle_slider

### animate ↑

 animate
• keyword
• if set, it will animate a point on a curve
• all other canvas object or group of objects (like lines,circles,rects,points...images,svg,latex,mathml etc)
may be animated using command slider with keyword 'anim'
• the animated point is a filled rectangle ; adjust colour with command fillcolor colorname/hexnumber
• use linewidth to adjust size of the points
• will animate a point on -only- the next jsplot/jscurve command. Only a single call to animate is allowed...in case of multiple animate keywords, only the last one is valid
• only usable in combination with command jsplot (normal functions or parametric)
• moves repeatedly from xmin to xmax or in case of a parametric function from tmin to tmax
• use commands multilinewidth, multistrokecolor etc in case of multiple animated functions.
use multiple functions as argument in a single call to jsplot color,fun1,fun2,fun3...fun_n
• : animate_1 : animate_2

### arc ↑

 arc xc,yc,x-width,y-height,start_angle,end_angle,color
• can not be set onclick or drag xy
• compatible with flydraw
• attention: width & height in x/y-range
• better use command angle for use with a slider
• : arc : arc_filled

### arrow ↑

 arrow x1,y1,x2,y2,h,color
• alternative: vector
• draw a single headed arrow / vector from (x1:y1) to (x2:y2)
with arrowhead size h in px and in color color
• use command linewidth int to adjust thickness of the arrow
• may be set draggable / onclick
• : arrow_drag : arrow_click

### arrows ↑

 arrows color,head (px),x1,y1,x2,y2...x_n,y_n
• alternative: vectors
• draw single headed arrows / vectors from (x1:y1) to (x2:y2) ... (x3:y3) to (x4:y4) etc ... in color 'color'
• use command linewidth int to adjust thickness of the arrow
• may be set draggable / onclick individually
• : arrows_click : arrows_drag : arrows_drag_slider

### arrow2 ↑

 arrow2 x1,y1,x2,y2,h,color
• draw a double headed arrow/vector from (x1:y1) to (x2:y2)
with arrowhead size h in px and in color color
• use command arrowhead int to adjust the arrow head size
• use command linewidth int to adjust thickness of the arrow
• may be set draggable / onclick
• : arrow2

### arrows2 ↑

 arrows2 color,head (px),x1,y1,x2,y2...x_n,y_n
• draw double headed arrows / vectors from (x1:y1) to (x2:y2) ... (x3:y3) to (x4:y4) etc ... in color color
• use command linewidth int to adjust thickness of the arrows
• may be set draggable / onclick individually
• : arrows2

 arrowhead int
• default 8 (pixels)

### audio ↑

 audio x,y,w,h,loop,visible,audiofile location
• x,y: left top corner of audio element (in xrange / yrange)
• w,y: width and height in pixels
• loop: 0 or 1 ( 1 = loop audio fragment)
• visible: 0 or 1 (1 = show controls)
• audio format may be in *.mp3 or *.ogg
• If you are using *.mp3: be aware that FireFox will not (never) play this ! (Pattented format)
• if you are using *.ogg: be aware that Microsoft based systems not support it natively
• To avoid problems supply both types (mp3 and ogg) of audiofiles.
the program will use both as source tag

### axisnumbering ↑

 axisnumbering

### axis ↑

 axis
• keyword (no arguments required)
• to be used before command grid (see command grid)

### barchart ↑

 barchart x_1:y_1:color_1:x_2:y_2:color_2:...x_n:y_n:color_n
• may only to be used together with command grid
• can be used together with freestyle x-axis/y-axis texts: see commands xaxis,xaxisup and yaxis
• use command legend to provide an optional legend in right-top-corner
• multiple barchart command may be used in a single script
• also see command piechart
• note: your arguments are not checked by canvasdraw: use your javascript console in case of trouble...
• : barchart

### bezier ↑

 bezier color,x_start,y_start,x_first,y_first,x_second,y_second,x_end,y_end
• draw a bezier curve between points, starting from (x_start:y_start)
• can not be dragged or set onclick

### bgcolor ↑

 bgcolor colorname or #hex
• use this color as background of the "div" containing the canvas(es)
• : bgcolor

### bgimage ↑

 bgimage image_location
• use an image as background; technical: we use the background of canvas_div
• the background image will be resized to match "width = xsize" and "height = ysize"
• : bgimage
 blink time(seconds)
• NOT IMPLEMETED -YET

### boxplot ↑

 boxplot x_or_y,box-height_or_box-width,position,min,Q1,median,Q3,max
• example:
xrange 0,300yrange 0,10boxplot x,4,8,120,160,170,220,245
meaning: create a boxplot in x-direction, with height 4 (in yrange) and centered around line y=8
• example:
xrange 0,10yrange 0,300boxplot y,4,8,120,160,170,220,245
meaning: create a boxplot in y-direction, with width 4 (in xrange) and centered around line x=8
• use command filled to fill the box
note: the strokecolor is used for filling Q1, the fillcolor is used for filling Q3
• use command fillpattern some_pattern to use a (diamond for Q1, hatch for Q3) pattern.
• use command opacity to adjust fill_opacity of stroke and fill colours
• use command legend to automatically create a legend
unicode allowed in legend
use command fontfamily to set the font of the legend.
• there is no limit to the number of boxplots used.
• can not be set draggable and onclick is not ready yet
• use keyword userboxplot before command boxplot, if a pupil must draw a boxplot (using his own min,Q1,median,Q3,max data)
• use keyword userboxplotdata before command boxplot, if a pupil must generate the data by some means.
• use command boxplotdata when the boxplot should be drawn from wims-generated raw statistical date
• : boxplot_1 : boxplot_2 : boxplot_3

### boxplotdata ↑

 boxplotdata some_data
• 'some_data' are a list of numbers separated by a comma "," (items)
• only be used before command boxplot: the command boxplot will provide the boxplot drawing of the data.
• xrange 0,100
yrange 0,10
boxplotdata 11,22,13,15,23,43,12,12,14,2,45,32,44,13,21,24,13,19,35,21,24,23
boxplot x,4,5
• note: wims will not check your data input | format. use js-error console to debug any problems.
• a javascript function statistics() will parse the data and calculate the values [min,Q1,median,Q3,max] and hand them to the boxplot draw function.
• only a single call to boxplotdata can be made. If multiple boxplots should be present in a single canvas, then use multiple calls to command boxplot
• : boxplotdata

### canvastype ↑

 canvastype TYPE
• for now only useful before commands filltoborder / floodfill / clickfill etc operations
Only the images of this TYPE will be scanned and filled
• default value of TYPE is DRAG_CANVAS e.g. 5 (all clickable / draggable object are in this canvas)
• use another TYPE, if you know what you are doing...
• other possible canvasses (e.g. transparent PNG pictures, xsize × ysize on top of each other)
• EXTERNAL_IMAGE_CANVAS 0
• BG_CANVAS 1
• STATIC_CANVAS 2
• MOUSE_CANVAS 3
• GRID_CANVAS 4
• DRAG_CANVAS 5
• DRAW_CANVAS 6
• TEXT_CANVAS 7
• CLOCK_CANVAS 8
• ANIMATE_CANVAS 9
• TRACE_CANVAS 10
• BOXPLOT_CANVAS 11
• JSPLOT_CANVAS 100, will increase with every call
• FILL_CANVAS 200, will increase with every call
• USERDRAW_JSPLOT 300, will increase with every call
• CLICKFILL_CANVAS 400, will increase with every call/click
• BOXPLOT_CANVAS 500, will increase with every call

### centered ↑

 centered
• keyword ; to place the text centered (in width and height) on the text coordinates(x:y)
• may be used for text exactly centered on its (x;y)
• use fontfamily for setting the font
• may be active for commands text and string (e.g. objects in the drag/drop/onclick-library)
• : centered

### centerstring ↑

 centerstring color,y-value,the text string
• title color,y-value,the text string
• draw a string centered on the canvas at y = y-value
• can not be set onclick or drag xy (...)
• unicode supported: centerstring red,5,\u2232
• use a command like fontfamily italic 24pt Arial to set fonts on browser that support font change
• : centerstring

### circle ↑

 circle xc,yc,width (2*r in pixels),color
• use command fcircle xc,yc,d,color
• alternative: disk for a filled circle
• use command fillcolor color to set the fillcolor
• may be set draggable / onclick
• will shrink / expand on zoom out / zoom in
• : circle

### circles ↑

 circles color,xc1,yc1,r1,xc2,yc2,r2...xc_n,yc_n,r_n
• attention r = radius in x-range (!)
• use keyword filled or command fcircles to produce solid circles
• alternative: disks for filled circles
• use command fillcolor color to set the fillcolor
• may be set draggable / onclick (individually)
• will shrink / expand on zoom out / zoom in
• : circles_drag : circles_onclick : circles_drag_slider

### clearbutton ↑

 clearbutton value
• alternative: delete
• alternative: erase
• adds a button to clear the userdraw canvas with text value
• attention command clearbutton is incompatible with multidraw based drawings
(in multidraw there is always a remove_object_button for every draw primitive)
• normally userdraw primitives have the option to use middle/right mouse button on
a point of the object to remove this specific object...this clear button will remove all drawings
• uses the tooltip placeholder div element: may not be used with command intooltip
• use command css to style the button...
• the clearbutton will have id="canvas_scripts[%d]" ; starting with %d=0 for the first script
to change the style of all clearbutton of all included canvasdraw scripts, use something like
if(document.getElementById("clearbutton"+canvas_scripts[0])){ var p = 0; while(document.getElementById("clearbutton"+canvas_scripts[p])){  document.getElementById("clearbutton"+canvas_scripts[p]).className="some_class_name";  <!−− or document.getElementById("clearbutton"+canvas_scripts[p]).setAttribute("style","some_style"); −−>  p++; };};
• : clearbutton

### clock ↑

 clock x,y,r(px),H,M,S,type hourglass,interactive [ ,H_color,M_color,S_color,background_color,foreground_color ]
• use command opacity stroke-opacity,fill-opacity to adjust foreground (stroke) and background (fill) transparency
• type hourglass:
type = 0: only segments
type = 1: only numbers
type = 2: numbers and segments
• colors are optional: if not defined, default values will be used
default colours: clock 0,0,60,4,35,45,1,2
custom colours: clock 0,0,60,4,35,45,1,2,,,,yellow,red
custom colours: clock 0,0,60,4,35,45,1,2,white,green,blue,black,yellow
• if you don't want a seconds hand (or minutes...), just make it invisible by using the background color of the hourglass...
• interactive
• 0: not interactive, just clock(s)
• 1: function read_canvas() will read all active clocks in H:M:S format
The active clock(s) can be adjusted by pupils
• 2: function read_canvas() will return the clicked clock
(like multiplechoice; first clock in script in nr. 0 )
• 3: no prefab buttons...create your own buttons (or other means) to make the clock(s) adjustable by javascript function set_clock(num,type,diff)
wherein: num = clock id (starts with 0) ; type = 1 (hours) ; type = 2 (minutes) ; type = 3 (seconds)
and diff = the increment of 'type' (positive or negative)
• canvasdraw will not check validity of colornames...the javascript console is your best friend
• no combinations with other reply_types allowed, for now
• if interactive is set to 1, 6 buttons per clock will be displayed for adjusting a clock (H+ M+ S+ H- M- S-)
set_clock(clock_id,type,incr)
first clock has clock_id=0 ; type: H=1,M=2,S=3 ; incr: increment integer
• note: if you need multiple -interactive- clocks on a webpage, use multiple clock commands in a single script !
and not multiple canvas scripts in a single page
• note: clocks will not zoom or pan, when using command zoom
• : clock_1 : clock_2 : clock_3 : clock_4 : clock_5 : clock_6 : clock_7

### colorpalette ↑

 colorpalette color_name_1,color_name_2,...,color_name_8
• opacity will be the same for all colors and is set by command opacity [0-255],[0-255]
• can be used with command userdraw clickfill,color when more than one fillcolor is wanted.
the pupil can choose from the given colors by clicking small coloured buttons.
the click coordinates and corresponding fillcolor will be stored in read_canvas()...when using the appropriate replyformat.
the first color of the palette is color=0
• make sure to include the remove button by using command clearbutton some_text

### copy ↑

 copy x,y,x1,y1,x2,y2,[filename URL]
• The image may be "bitmap" or "SVG"
• Insert the region from (x1,y1) to (x2,y2) (in pixels) of [filename] to (x,y) in x/y-range
• If x1=y1=x2=y2=-1, the whole [filename URL] is copied.
• [filename] is the URL of the image
• TODO:move special image functions to generic 'dragstuff' library
• URL is normal URL of network reachable image file location
• if command drag x/y/xy is set before command copy, the images will be draggable
javascript function read_canvas(); will return the x/y coordinate data in xrange/yrange of all -including non draggable- images
the command drag is only valid for the next image
draggable / non-draggable images may be mixed
may be used together with preceding keywords snaptogrid, xsnaptogrid, ysnaptogrid or snaptopoints x1,y1,x2,y2....
• if keyword onclick is set before command copy the image(s) is clickable (marked with a green rectangle around the image)
use 'read_dragdrop' to get the number of the clicked image(s)
use command 'clearbutton some_text' to reset the reply/click array.
example: 4 images; student clicked on image 2 and 3: reply = 0,1,1,0
after clicking the clear button: reply = 0,0,0,0
May be mixed with commands drag x|y|xy (use javascript read_canvas to get the new coordinates
• onclick for external images may be mixed with canvas generated stuff (like lines,curves, embeded XML etc)
• you may draw / userdraw / drag other stuff on top of an "imported" image
• the use of a slider is not possible: if needed ,use command html x,y,<img src=my_image.svg />
• use keyword centered before command copy to place image center at given coordinates.
• : copy_onclick : copy_drag_xy : copy_drag_xy_snaptogrid

### copyresized ↑

 copyresized x1,y2,x2,y2,dx1,dy1,dx2,dy2,image_file_url
• The image may be any "bitmap" or "SVG"
• Insert the region from (x1,y1) to (x2,y2) (in pixels) of [ filename],
possibly resized,
to the region of (dx1,dy1) to (dx2,dy2) in x/y-range
• (dx1:dy1) must be left top corner; (dx2:dy2) must be right bottom corner of inserted image
• If x1=y1=x2=y2=-1, the whole [filename / URL ] is copied and resized.
• URL is normal URL of network reachable image file location
(as seen from public_html-root or network reachable 'http://some_server/my_images/test.gif'
(eg no special wims paths are searched !!)
• if command drag x/y/xy is set before command copy, the images will be draggable
javascript function read_canvas(); will return the x/y coordinate data in xrange/yrange of all -including non draggable- images
the command drag is only valid for the next image
draggable / non-draggable images may be mixed
may be used together with preceding keywords snaptogrid,xsnaptogrid,ysnaptogrid or snaptopoints x1,y1,x2,y2...
• if keyword onclick is set before command copy the image(s) is clickable (marked with a green rectangle around the image)
use read_dragdrop to get the number of the clicked image(s)
use command 'clearbutton some_text' to reset the reply/click array.
example: 4 images; student clicked on image 2 and 3: reply = 0,1,1,0
after clicking the clear button: reply = 0,0,0,0
May be mixed with commands drag x|y|xy (use javascript read_canvas to get the new coordinates
• onclick for external images may be mixed with canvas generated stuff (like lines,curves etc)
• you may draw / userdraw / drag stuff on top of an "imported" image
• when set draggable, there will be special function 'read_canvas_images()'
now dragging external images may be combined with 'read_canvas()' from userdraw or multidraw
set command precision before command copy
• use keyword centered before command 'copyresized' to place image center at given coordinates.
• TODO:move special image functions to generic 'dragstuff' library

### crosshair ↑

 crosshair x,y,color
• draw a single crosshair point at (x;y) in color color
• use command crosshairsize int and / or linewidth int to adjust
• may be set draggable / onclick
• : crosshair

### crosshairs ↑

 crosshairs color,x1,y1,x2,y2,...,x_n,y_n
• draw multiple crosshair points at given coordinates in color color
• use command crosshairsize int and / or linewidth int to adjust
• may be set draggable / onclick individually (!)
• : crosshairs_1 : crosshairs_2

### crosshairsize ↑

 crosshairsize int
• default 8 (px)

### css ↑

 css css_class
• may be used before any style-able html object (like inputfields or buttons) or some html objects that are generated by some canvasdraw commands
• in case of multidraw this command must be a table css class, for example "wimstable"
• : css

### cursor ↑

 cursor some CSS cursor_style
• alternative: pointer
• style can be any valid CSS property value
• choose from these types:
ew-resize,grab,grabbing,help,move,n-resize,ne-resize,nesw-resize,ns-resize,nw-resize,
nwse-resize,no-drop,none,not-allowed,pointer,progress,row-resize,s-resize,se-resize,
sw-resize,text,url(myBall.cur),auto,vertical-text,w-resize,wait,zoom-in,zoom-out,initial
• note: wims will not check the validity of your cursor declaration
• : cursor_css

### curve ↑

 curve color,formula(x)
• alternative: plot color,formula(x)
• use command trange in parametric functions before every command curve / plot trange -pi,picurve color,formula1(t),formula2(t)
A next parametric curve will only be correctly plot when trange is set again !
this is a design flaw and not a feature...
• use command precision to increase the number of digits of the plotted points
• use command plotsteps to increase / decrease the amount of plotted points (default 150)
• may be set draggable / onclick
• if you need a plot beyond xrange / yrange, use jsplot (command curve will only calculate points within the xrange)
• : curve

### curvedarrow ↑

 curvedarrow x1,y1,xc,yc,x2,y2,color
• draw a single headed curved arrow from (x1:y1) in direction of (xc:yc) to point (x2:y2)
note: the curve will not go through point (xc:yc)
• use command arrowhead to set the size of the arrow head.
• use command linewidth int to adjust thickness of the arrow
• may be set draggable / onclick
• : curvedarrow_drag : curvedarrow_click

### curvedarrow2 ↑

 curvedarrow2 x1,y1,xc,yc,x2,y2,color
• draw a double headed curved arrow from (x1:y1) in direction of (xc:yc) to point (x2:y2)
note: the curve will not go through point (xc:yc)
• use command arrowhead to set the size of the arrow head.
• use command linewidth int to adjust thickness of the arrow
• may be set draggable / onclick
• : curvedarrow_drag : curvedarrow_click

### curvedarrows ↑

 curvedarrows color,x1,y1,xc,yc,x2,y2,...,x_(n-1),y_(n-1),xc,yc,x_n,y_n
• draw curved arrows from (x1:y1) in direction of (xc:yc) to point (x2:y2), etc
note: the curve will not go through point (xc:yc)
• use command arrowhead to set the size of the arrow head.
• use command linewidth int to adjust thickness of the arrow
• may be set draggable / onclick
• : curvedarrows_drag : curvedarrows_click

### curvedarrows2 ↑

 curvedarrows2 color,x1,y1,xc,yc,x2,y2,...x_(n-1),y_(n-1),xc,yc,x_n,y_n
• draw double headed curved arrows from (x1:y1) in direction of (xc:yc) to point (x2:y2), etc.
note: the curve will not go through point (xc:yc)
• use command arrowhead to set the size of the arrow head.
• use command linewidth int to adjust thickness of the arrow
• may be set draggable / onclick
• : curvedarrows2_drag : curvedarrows2_click

### dashed ↑

 dashed
• keyword (no arguments required)
• next object will be drawn with a dashed line
• change dashing scheme by using command dashtype
• : dashed

### dashtype ↑

 dashtype line_width_px,space_width_px
• every indiviual object may have its own dashtype, if needed...
• When keyword dashed is set, the objects will be drawn with this dashtype
• default value dashtype 2,2 e.g. 2px line and 2px space
• HTML5 canvas specification supports more arguments (dashing schemes) ... but not all modern browsers are yet capable
• : dashtype

### diamondfill ↑

 diamondfill x0,y0,dx,dy,color

### dotfill ↑

 dotfill x0,y0,dx,dy,color
• x0,y0 in xrange / yrange
• distances dx,dy in pixels
• radius of dots is linewidth
• there is also a command userdraw dotfill,color
• : dotfill

### drag ↑

 drag [x][y][xy]
• the next object will be draggable in x / y / xy direction
• the displacement can be read by javascript:read_dragdrop();
• the precision (default 2 decimals) in the student reply may be set with command precision.
Use this 'precision' command before this command 'drag x|y|xy' !
• onclick and drag x|y|xy may be combined (for different objects: a single object can either be onclick or drag, not both )
• multi_objects will be numbered in the given x/y-sequence (example: points red,0,0,1,1,2,2,3,3: point (0:0) is object_number 1)
• attention: static objects and onclick/drag objects of the same type (like point,circle,etc) with the same coordinates (e.g. objects that overlap) will give problems in the recognition algorithm) in this example
linewidth 4point 0,0,reddrag xypoint 0,0,blue
the red point will not be recognised as draggable ! in the example
linewidth 4drag xypoint 0,0,reddrag xypoint 0,0,blue
both points will be recognised
• the answer is: drag_or_onclick_object_number : Xorg : Yorg : Xnew : Ynew
wherein object_number is the sequence number of the draggable & onclick objects in your script.
Only draggable & onclick objects will have an object_number (e.g things like point,crosshair,line,segment,circle,rect,triangle...etc)
• use keyword snaptogrid, xsnaptogrid, ysnaptogrid or command snaptopoints x1,y1,x2,y2,... to switch from free to discrete movement
• in case of external images (commands copy / copyresized) the external image can be set draggable ; always xy.
The function javascript;read_canvas() will return the xy-coordinates of all images.
• : drag_x : drag_y : drag_xy

### ellipse ↑

 ellipse xc,yc,radius_x,radius_y,color
• ellipses with center xc/yc and radius in x/y-range etc (this differs from flydraw syntax!)
• may be set draggable / onclick
• will shrink / expand on zoom out / zoom in
• : ellipse

### ellipses ↑

 ellipses color,xc1,yc1,radius_x1,radius_y1,xc2,yc2,radius_x2,radius_y2,xc3,yc3,radius_x3,radius_y3,...
• ellipses with center and radius in x/y-range etc (this differs from flydraw syntax!)
• may be set draggable / onclick
• will shrink / expand on zoom out / zoom in
• : ellipses

### fillall ↑

 fillall color,x1,y1,x2,y2...x_n,y_n
• fill all region containing points (x1:y1),(x2:y2)...(x_n:y_n) with color 'color'
• any other colors (objects) in the canvastype to fill another canvas (default should be fine: DRAG_CANVAS = 5)
• note: the fill-family of commands are very (client) cpu intensive operations!
filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data.
on every data a few operations / comparisons are done...
So have pity on your students CPU..
• : fillall

### filled ↑

 filled
• keyword (no arguments required)
• the next fillable object (only the next !) will be filled
• use command fillcolor color to set fillcolor
• use fillpattern for non-solid color filling.
• use command opacity 0-255,0-255 to set stroke and fill-opacity
• use command fill x,y,color or floodfill x,y,color to fill the space around (x;y) with color
pixel operation implemented in javascript: use with care !

### fillcolor ↑

 fillcolor colorname or #hex
• set the color: mainly used for command 'userdraw obj,stroke_color'
• all fillable massive objects will have a fillcolor == strokecolor (just to be compatible with flydraw...)
• see fillpattern for non-solid color filling.

### fillpattern ↑

 fillpattern grid | hatch | diamond | dot | image_url
• alternative: settile image_url (e.g. flydraw syntax for filling using a tiled image)
• use a pattern as fillstyle
• suitable for all fillable object including the userdraw objects' family
• note: do not use the f for a fillable object : this is used exclusively for solid colour filling.
• the fillcolor is set by the object command, for example:
size 370,370xrange -5,5yrange -5,5opacity 165,150fillpattern gridfcircle -6,3,160,bluefillpattern dotfcircle -3,-3,160,redfillpattern hatchfcircle 0,3,160,greenfilpattern diamondfcircle 3,-3,160,cyanuserdraw dotfill,bluezoom red
• the pattern dimensions are hardcoded (linewidth, radius,dx,dy are fixed)
• the pattern color is set by command fillcolor and opacity
• see fillcolor for solid color filling.
• when using an image-url, make sure it contains an / in the filename...fillpattern $module_dir/gifs/test.jpg will fill the next fillable object with this image.| the argument to html5 canvas routine 'createPattern(img,argument)' is set to repeat e.g. if the image is smaller then the canvas, multiple copies will be used to fill the area ( e.g. ctx.fillStyle() = pattern) for example: size 150,150xrange -5,5yrange -5,5drag xyfillpattern gifs/en.giffcircle 0,0,100,redfillpattern gifs/nl.gifdrag xyfcircle -3,2,100,greenfillpattern gifs/cn.gifdrag xyfcircle 3,2,100,green • fillpattern is also active for userdraw object,color... the userdraw family a has also clickfill type (e.g. an object gets filled between boundaries, when clicked) commands like: 'userdraw dotfill,color' 'userdraw hatchfill,color' etc • : fillpattern_1 : fillpattern_2 ### filltoborder ↑  filltoborder x,y,bordercolor,color • fill the region of point (x:y) with color 'color' • any other color will not act as border to the bucket fill • use this command after all boundary objects are declared. • use command canvastype to fill another canvas (default should be fine: DRAG_CANVAS = 5) • note: filltoborder is a very (client) cpu intensive operation! filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data. on every data a few operations / comparisons are done... So have pity on your students CPU.. • maybe used together with command userdraw clickfill,color • : filltoborder ### floodfill ↑  floodfill x,y,color • alternative: fill x,y,color • fill the region of point (x:y) with color 'color' • any other color or size of picture (borders of picture) will act as border to the bucket fill • use this command after all boundary objects are declared. • Use command userdraw clickfill,color for user click driven flood fill. • use command canvastype to fill another canvas (default should be fine: DRAG_CANVAS = 5) • note: floodfill is a very (client) cpu intensive operation! filling is done pixel by pixel e.g. image size of 400x400 uses 160000 pixels: each pixel contains 4 data (R,G,B,Opacity) = 640000 data. on every data a few operations / comparisons are done... So have pity on your students CPU.. • : floodfill ### fontcolor ↑  fontcolor color ### fontsize ↑  fontsize font_size • default value 12 • note: for some macros (like grid | legend | xaxistext | xlabel etc) sometimes command fontfamily can be used for some specific font-setting this is however not always very straight forward... so just try and see what happens ### functionlabel ↑  functionlabel label_1:label_2:label_3... • alternative: functionlabels • default value f(x)=:g(x)=:h(x)=:i(x)=:j(x)=:k(x)=:m(x)=:n(x)= • no mathml allowed (just ascii string) • use command fontsize int to adjust the size • use command strokecolor colorname to adjust the labels (individually, if needed) • if needed, use before every command userinput function | inputfield | textarea • no limit in amount of inputfields for userbased function plotting • : function_label ### grid ↑  grid step_x,step_y,gridcolor • if keywords axis or axisnumbering are set, use: grid step_x,step_y,major_color,minor_x,minor_y,tics height in px,axis_color minor x step = step_x / minor_x • in that case, use command fontcolor, fontsize and / or fontfamily to adjust font; defaults: black,12,Arial • if xmin > 0 and/or ymin > 0 and zooming / panning is not active: be aware that the x/y-axis numbering and x/y major/minor tic marks will not be visual as they are placed under the x-axis and left to the y-axis (in Quadrant II and IV) • can not be set onclick or drag xy • use commands xlabel some_string and/or ylabel some_string to label axis; use command fontsize to adjust size: the font family is non-configurable 'italic your_fontsize px Arial' ! • see commands xaxis or xaxistext, yaxis or yaxistext to set tailormade values on axis (the used font is set by command fontfamily; default '12px Arial') • see command legend to set a legend for the graph; use command fontsize to adjust size (the font family is non-configurable 'bold your_fontsize px Arial') • : grid : grid_axis : grid_axis_axisnumbering : grid_axis_axisnumbering ### gridfill ↑  gridfill x0,y0,dx,dy,color ### demiline ↑  demiline x1,y1,x2,y2,color • alternative: halfline • draws a halfline starting in (x1:y1) and through (x2:y2) in color 'color' (colorname or hex) • may be set draggable / onclick • : halfline ### demilines ↑  demilines color,x1,y1,x2,y2,.... • alternative: halflines • draws halflines starting in (x1:y1) and through (x2:y2) in color 'color' (colorname or hex) etc • may be set draggable / onclick indiviually • : halflines ### hatchfill ↑  hatchfill x0,y0,dx,dy,color ### hline ↑  hline x,y,color • alternative: horizontalline • draw a horizontal line through point (x:y) in color 'color' • or use command curve color,formula to draw the line (uses more points to draw the line; is however better draggable) • may be set draggable / onclick • : hline ### hlines ↑  hlines color,x1,y1,x2,y2,... • alternative: horizontallines • draw horizontal lines through points (x1:y1)...(xn:yn) in color 'color' • may be set draggable / onclick individually • : hlines ### http ↑  http x1,y1,x2,y2,http://some_adress.com • an active html-page will be displayed in an "iframe" rectangle left top (x1:y1), right bottom (x2:y2) • do not use interactivity (or mouse) if the mouse needs to be active in the iframe • can not be set onclick or drag xy • : http ### html ↑  html x1,y1,html_string • all tags are allowed, html code using inputfields could be read using your own javascript code. Do not use ids like 'canvas_input0' etc. • can be set onclick and drag&drop • command affine will produce CSS3 matrix transformations • command rotate will rotate the object • use keyword centered to center the html object on (x1:y1) • note: using drag&drop for all external P,SPAN,DIV,IMG,SVG-images onto a canvasdraw element, use onclick=javascript:place_image_on_canvas(this.id) • : html-text : html-image-slider ### imagefill ↑  imagefill x,y,scaling to xsize × ysize?,image_url • The next suitable filled object will be filled with "image_url" tiled • scaling to xsize × ysize ? ... 1 = yes 0 = no • After pattern filling, the fill-color should be reset ! • wims getins / image from class directory: imagefill 80,80,my_image.gif • normal url: imagefill 80,80,0,$module_dir/gifs/my_image.gif
• if dx,dy is larger than the image, the whole image will be background to the next object.
• : imagefill_tile : imagefill_scale

### imagepalette ↑

 imagepalette image1,image2,image3,...
• if used before and together with command multidraw images,..,..., etc the image will be presented in a small table in the control panel.
• : imagepalette

### input ↑

 input x,y,size,editable,value
• to set inputfield "readonly", use editable = 0
• if no preset 'value' is needed...use a 'space' as last item argument
• only active inputfields (editable = 1) will be read with read_canvas();
• if $status=done (e.g. in answer.phtml) the inputfield will be cleared and set readonly override this by keyword status • may be further controlled by css • if mathml inputfields are present and / or some userdraw is performed, these data will not be send as well (javascript:read_canvas();) • use keyword xoffset | centered if the inputfield should be centered on (x:y) default is the left top corner is (x:y) • if the student must place an inputfield(s) somewhere on the canvas, use command userdraw input,color or make use of a command like userdraw text,color • : input ### intooltip ↑  intooltip link_text • link_text is a single line (span-element) • link_text may also be an image URL http://some_server/images/my_image.png or$module_dir/gifs/my_image.jpg
• link_text may contain HTML markup
• the canvas will be displayed in a tooltip on link_text
• the canvas is default transparent: use command bgcolor color to adjust background-color, the link text will also be shown with this 'bgcolor'.
• many userinput stuff will use the tooltip_placeholder_div element...only one is defined in the wims-page
and are therefore these commands are mutually exclusive.
keep this in mind...
• : intooltip

### jscurve ↑

 jscurve color,formula1(x),formula2(x),formula3(x),...
• alternative: jsplot color,formula(x)
• alternative: userdraw function,color
• your function will be plotted by the javascript engine of the client browser
• if trange is defined, the two functions will be plotted parametric
note: use x as variable...and not t. Use keyword animate to animate a point on the curve
• use only basic math in your curve: sqrt,^,asin,acos,atan,log,pi,abs,sin,cos,tan,e
• use parenthesis and rawmath: use 2*x instead of 2x ; use 2^(sin(x))...etc etc (use error console to debug any errors...)
• attention: last precision command in the canvasdraw script determines the calculation precision of the javascript curve plot !
• no validity check is done by wims.
• zooming & panning are implemented:
use command zoom color for mouse driven zooming
or use keyword 'setlimits' for inputfields setting xmin/xmax, ymin/ymax
• zooming & panning is better than for curves produced by command curve color,formula because for avery change in x/y-range the curve is recalculated in javascript
• zooming & panning in case of userbased functionplot: reclick the OK button to re-plot curve onto the resized grid
• use keyword animate for animating a point on the curve
• use command trace_jscurve formula(x) for tracing
• use command jsmath formula(x) for calculating and displaying indiviual points on the curve
• can not be set draggable / onclick (yet)
• commands plotjump / plotstep are not active for jscurve
• every command jscurve will produce a new canvas (canvastype 111,112,113...) for this one curve.
• plotting multiple js-curves on the same canvas (for example if you want to use 'userdraw clickfill,color' on canvastype number 111, use:
jscurve red,fun1(x),fun2(x)...fun_n(x), you must specify individual multistrokecolors & multistrokeopacity & multilinewidth for these multiple js-curves to use different colors. Otherwise all curves will be the same color... Use commands like: multistrokecolors, multilinewidth, multidash, multistroke, color given for the command jscurve color,formulas(x) will not be used in that case... but the color argument must still be given in any case (otherwise syntax error...)
• : jscurve

### jsmath ↑

 jsmath some_math_function
• will calculate an y-value from a userinput x-value and draws a crosshair on these coordinates.
• default labels x and y; the commands xlabel some_x_axis_name and ylabel some_y_axis_name will set the label for the input fields
• use command 'css some_css' for styling the display fields. Use command 'fontsize int' to size the labels x and y
• the client browser will convert your math function to javascript math.
use parenthesis and rawmath: use 2*x instead of 2x etc etc
no check is done on the validity of your function and/or syntax
use error console to debug any errors...
• be aware that the formula's of the plotted function(s) can be found in the page javascript source
• : jsmath

### killaffine ↑

 killaffine
• keyword: resets the transformation matrix to 1,0,0,1,0,0
• note: any active linear transformation will also be reset: tx=0 , ty=0

### killlinear ↑

 killlinear
• keyword: resets the transformation matrix to 1,0,0,1,tx,ty
• note:any active transformation or rotation will not be killed (tx,ty remain active)

### killrotate ↑

 killrotate
• will set the rotation angle to 0.
• will also reset the command rotationcenter to the first (x;y) of the next rotatable/slidable object(s)
eg a following rotate command will have the first object point as rotation center
• if not set, the rotation center will remain unchanged
• note:any active transformation or linear will not be killed (e.g an active transformation matrix remains active)
• : killrotate

### killslider ↑

 killslider
• keyword (no arguments required)
• ends grouping of object under a previously defined slider

### killtranslation ↑

 killtranslation
• alternative: killtranslate
• note: a active linear or affine transformation will not be 100% reset...only tx=0,ty=0
• resets the translation matrix a,b,c,d,tx,ty to a,b,c,d,0,0

### latex ↑

 latex x,y,tex string
• alternative:math x,y,tex string
• you may also use command mathml for xml strings generated with wims commmand mathmlmath (will not work on KaTeX enabled WIMS)
• transformation commands affine , translation and rotate are supported.(onclick and drag will work)
• can be set onclick: javascript:read_dragdrop(); will return click numbers of mathml-objects
if 4 clickable object are drawn, the reply could be 1,0,1,0 ... meaning clicked on the first and third object
• can be set draggable:javascript:read_dragdrop(); will return all coordinates in the same order as the canvas script: unmoved object will have their original coordinates...
• can be moved/rotated with command slider
• snaptogrid is supported
• when clicked, the colour of the 'div background' of the 'mathobject' will be determined by the fillcolor and opacity settings
• userdraw may be combined with 'latex' ; the js-function 'read_canvas()' will contain the coordinates of the drawing.
• userdraw may be combined; the read_canvas() will contain the drawing.
• draggable or onclick 'external images' from command copy or copyresized and all objects from commands html or obabel can be combined with drag and/or onclick mathml
• other drag objects (circles/rects etc) are supported, but read_dragdrop() will probably be difficult to interpret...
• if inputfields are incorporated in mathml (with id's: id='mathml0',id='mathml1',...id='mathml_n')
the user_input values will be read by javascript:read_mathml();. attention: if after this mathml-input object other user-interactions are included, these will read mathml too using "read_canvas();"
• If other inputfields (command input / command textarea) or userdraw are performed, the function read_canvas() will not read mathml. Use some generic function to read it....
• use keyword centered to center the katex div object on (x1:y1)
this may not work as expected for MathJaX [TO BE TESTED]
• note: if you want to include external TeX via drag&drop onto a canvasdraw element, use \mmlid{integer} in the tex-command:!insmath \mmlid{1} rac{1}{pi}
• note: the same is true for all external P,SPAN,DIV,IMG,SVG-images via drag&drop onto a canvasdraw element, use onclick=javascript:place_image_on_canvas(this.id)
• : latex_drag : latex

### lattice ↑

 lattice x0,y0,xv1,yv1,xv2,yv2,n1,n2,color
• can not be set onclick or drag xy
• : lattice

### linear ↑

 linear a,b,c,d
• defines a transformation matrix for subsequent objects
• use keyword killlinear to end the transformation...the next objects will be drawn in the original x/y-range
• a: Scales the drawings horizontally
• b: Skews the drawings horizontally
• c: Skews the drawings vertically
• d: Scales the drawings vertically
• the data precision may be set by preceding command precision int
• note: any active translation (tx,ty) is not changed
• : linear

### line ↑

 line x1,y1,x2,y2,color
• draw a line through points (x1:y1)--(x2:y2) in color color
• or use command curve color,formula to draw the line (uses more points to draw the line; is however better draggable)
• may be set draggable / onclick
• : line

### lines ↑

 lines color,x1,y1,x2,y2...x_n-1,y_n-1,x_n,y_n
• draw multiple lines through points (x1:y1)--(x2:y2) ...(x_n-1:y_n-1)--(x_n:y_n) in color 'color'
• or use multiple commands curve color,formula or jscurve color,formule to draw the line
(uses more points to draw the line; is however better draggable)
• may be set draggable / onclick
• attention: the flydraw command lines is equivalent to canvasdraw command polyline
• : lines

### linewidth ↑

 linewidth int
• default 1
• : linewidth

### levelcurve ↑

 levelcurve color,expression in x/y,l1,l2,...
• draws very primitive level curves for expression, with levels l1,l2,l3,...,l_n
• the quality is not to be compared with the Flydraw levelcurve.
(choose flydraw if you want quality...)
• every individual level curve may be set 'onclick / drag xy'
e.g. every single level curve (l1,l2,l3...l_n) has a unique identifier
• note: the arrays for holding the javascript data are limited in size
• note: reduce image size if javascript data arrays get overloaded
(command 'plotsteps int' will not control the data size of the plot...)
• : levelcurve

### legend ↑

 legend string1:string2:string3....string_n
• will be used to create a legend for a graph
• also see command piechart
• will use the same colors per default as used in the graphs; use command legendcolors to override the default
• use command fontsize to adjust. (command fontfamily is not active for command legend)
• : legend

### legendcolors ↑

 legendcolors color1:color2:color3:...:color_n
• will be used to color a legend: use this command after the legend command ! e.g. legend test1:test2:test3legendcolors blue:red:orange.
• make sure the number of colors match the number of legend items
• command legend in case of piechart and barchart will use these colours per default (no need to specify legendcolors)
• : legendcolors

### linegraph ↑

 linegraph x1:y1:x2:y2...x_n:y_n
• will plot your data in a graph
• may only to be used together with command grid
• can be used together with freestyle x-axis/y-axis texts: see commands xaxis,xaxisup and yaxis
• use command legend to provide an optional legend in right-top-corner
• also see command piechart
• multiple linegraphs may be used in a single plot
• note: your arguments are not checked by canvasdraw: use your javascript console in case of trouble...
• use command strokecolor before a command linegraph to set the color of this graph
• use command linewidth before command linegraph to set linewidth of this graph
• use keyword dashed before command linegraph to set dashing of the graph
• if dashing is set, use command dashtype before command linegraph to set the type of dashing of the (individual) graph
• : linegraph

### mathml ↑

 mathml x1,y1,mathml_string
• this command is special for GECKO browsers, and it makes use of Native Mathml
• For general use with all browsers, use command latex
• can be set onclick and drag&drop
Note: dragging is fairly primitive dragging of the div-element, and is not done using the dragstuff library
• command affine will produce CSS3 matrix transformations
• command rotate will rotate the object
• the mathml object is centered at (x1:y1)
• the mathml_string can be produced using WIMS commands like texmath followed by mathmlmath... or write correct TeX and use only mathmlmath
• mathml will be displayed in a rectangle left top (x1:y1)
• can be set onclick javascript:read_dragdrop(); will return click numbers of mathml-objects; if 4 clickable object are drawn, the reply could be 1,0,1,0 ... meaning clicked on the first and third object
• can be set draggable: javascript:read_dragdrop() will return all coordinates in same order as the canvas script: unmoved objects will have their original coordinates...
• snaptogrid is supported...snaptopoints will work, but use with care... due to the primitive dragging. Technically: the dragstuff library is not used... the mathml is embedded in a new div element and not in the html5-canvas.
• when clicked, the mathml object will be drawn in red color; the div background color will be determined by the fillcolor and opacity settings.
• userdraw may be combined with 'mathml' ; the read_canvas() will contain the drawing.
• draggable or onclick 'external images' from command copy or copyresized can be combined with drag and/or onclick mathml
• other drag objects (circles/rects etc) are supported, but read_dragdrop() will probably be difficult to interpret...
• if inputfields are incorporated in mathml (with id's: id='mathml0',id='mathml1',...id='mathml_n')
attention: if after this mathml-input object other user-interactions are included, these will read mathml too using "read_canvas();"
• If other inputfields (command input / command textarea) or userdraw is performed, the function read_canvas() will not read mathml. Use some generic function to read it....
• use keyword centered to center the mathml/xml object on (x1:y1)
• : mathml_onclick : mathml_drag

### mouse ↑

 mouse color,fontsize
• will display the cursor (x:y) coordinates in color and fontsize using default fontfamily Arial
• note: use command mouse at the end of your script code (the same is true for command zoom)
• : mouse

### mouse_degree ↑

 mouse_degree color,fontsize
• will display the angle in degrees between x-axis, (0:0) and the cursor (x:y) in 'color' and 'font size'
using a fontfamily Arial
• The angle is positive in QI and QIII and the angle value is negative in QII and QIV
• note: use command 'mouse' at the end of your script code (the same is true for command 'zoom')
• : mouse_degree

### display ↑

 display TYPE,color,fontsize
• TYPE may be x | y | xy | degree | radian | radius
• will display the mouse cursor coordinates as x-only,y-only,(x:y), the radius of a circle (this only in case 'userdraw circle(s),color') or the angle in degrees or radians for commands userdraw arc,color or protractor, ruler (if set dynamic).
• use commands xunit and / or yunit to add the units to the mouse values. The degree | radian will always have the appropriate symbol).
• just like commands mouse, mousex, mousey, mouse_degree... only other name
• : display_x : display_y : display_xy : display_deg : display_rad : display_radius

### precision ↑

 precision int
• 1 = no decimals ; 10 = 1 decimal ; 100 = 2 decimals etc
• may be used / changed before every object
• In case of user interaction (like userdraw or multidraw), this value will be used to determine the amount of decimals in the reply / answer
• : precision

### mousex ↑

 mousex color,fontsize
• will display the cursor x-coordinate in color and font size using the fontfamily Arial.
• note: use command mouse at the end of your script code (the same is true for command zoom).

### mousey ↑

 mousey color,fontsize
• will display the cursor y-coordinate in color and font size using default fontfamily Arial.
• note: use command mouse at the end of your script code (the same is true for command zoom).

### multidash ↑

 multidash 0,1,1
• meaning draw objects no. 2 (circle) and 3 (segments), in the list of command like multifill points,circle,segments, are dashed
• use before command multidraw
• if not set all objects will be set not dashed... unless a generic keyword dashed was given before command multidraw
• the dash-type is not -yet- adjustable
(e.g. command dashtype line_px,space_px will give no control over multidraw objects)
• wims will not check if the number of 0 or 1's matches the amount of draw primitives...
• always use the same sequence as is used for multidraw

### multidraw ↑

 multidraw obj_type_1,obj_type_2...obj_type_11
• for simple single object user drawings you could also use command userdraw
• implemented obj_types:
• point | points
• circle | circles
• line | lines
• segment | segments
• arrow | arrows (use command 'arrowhead int' for size (default value 8 pixels))
• curvedarrow | curvedarrows
• rect | rects
• closedpoly
only one closedpolygon may be drawn.The number of corner points is not preset (e.g. not limited, freestyle), the polygon is closed when clicking on the first point again..(+/- 10px)
• triangle | triangles
• parallelogram | parallelograms
• poly[3-9] | polys[3-9] draw 3...9 point polygone(s): polys3 is of course triangles
• images
• crosshair | crosshairs
• additionally objects may be user labelled, using obj_type text...
in this case allways a text input field and if multiuserinput=1 also (x:y) inputfields will be added to the page.
use commands fontfamily and fontcolor to adjust (command multistrokeopacity may be set to adjust text opacity)
note: text is always centered on the mouse-click or user-input coordinates !
note: no keyboard listeners are used
• it makes no sense using something like multidraw point,points ...
something like "multidraw polys4,polys7" will only result in drawing a 4 point polygone and not a 7 point polygone: this is a design flaw and not a feature...
• note: mouselisteners are only active if "$status != done " (eg only drawing in an active/non-finished exercise) to overrule use command/keyword "status" (no arguments required) • buttons for changing the obj_type (and in case of multiuserinput, some inputfields and buttons) will be present in the reserved div tooltip_div and can be styled using command 'css some_css' • the button label will be default the object primitive name (like point, circles). If you want a different label (e.g. an other language), use command multilabel for example in dutch: multilabel cirkel,lijnstuk,punten,STOPmultidraw circle,segment,points (see command multilabel for more details) • a right mouse button click will remove the last drawn object of the selected drawing type. All other type of objects are not removed • multidraw is incompatible with command tooltip (the reserved div_area is used for the multidraw control buttons) • all multidraw drawings will scale on zooming. this in contrast to the command userdraw. • wims will not check the amount or validity of your command arguments ! ( use javascript console to debug any typo's ) • a local function read_canvas%d will read all userbased drawings. The output is always a 16 lines string with fixed sequence. line 1 = points_x+";"+points_y+" " line 2 = circles_x+";"+circles_y+";"+multi_radius+" " line 3 = segments_x+";"+segments_y+" " line 4 = arrows_x+";"+arrows_y+" " line 5 = lines_x+";"+lines_y+" " line 6 = triangles_x+";"+triangles_y+" " line 7 = polys[3-9]_x+";"+polys[3-9]_y+" " line 8 = rects_x +";"+rects_y+" " line 9 = closedpoly_x+";"+closedpoly_y+" " line 10 = parallelogram_x+";"+parallelogram_y" " line 11 = text_x+";"+text_y+";"+text" " line 12 = image_x+";"+image_y+";"+image_id line 13 = curvedarrows_x +";"+ curvedarrows_y +" " line 14 = curvedarrows2_x +";"+ curvedarrows2_y +" " line 15 = crosshairs_x +";"+ crosshairs_y +" " line 16 = userdraw_x +";"+userdraw_y + " " note: this is for single userdraw object,color and replyformat 29 line 17 = userdraw_x +";"+userdraw_y +";"+userdraw_radius + " " note: this is for single userdraw object,color and replyformat 29 The x/y-data are in x/y-coordinate system and display precision may be set by a previous command precision 0 | 10 | 100 | 1000... In case of circles the radius is -for the time being- rounded to pixels use the wims "direct exec" tool to see the format of the reply • It is best to prepare / format the student reply in clientside javascript. However in wims language you could use something like this for example you are interested in the polys5 drawings of a pupil (the pupil may draw multiple poly5 objects...) note: the reply for 2 poly5's is: x11,x12,x13,x14,x15,x21,x22,x23,x24,x25 ; y11,y12,y13,y14,y15,y21,y22,y23,y24,y25 rep = !line 7 of reply rep = !translate ';' to ' ' in$rep
pts = 5 # 5 points for polygon
x_rep = !line 1 of $rep y_rep = !line 2 of$rep
tot = !itemcnt $x_rep num_poly =$[$tot/$pts]
idx = 0
!for p=1 to $num_poly !for s=1 to$pts
!increase idx
X = !item $idx of$x_rep
Y = !item $idx of$y_rep
# do some checking
!next s
!next p
• attention: for command argument closedpoly, only one polygone can be drawn. The last point (e.g. the point clicked near the first point) of the array is removed.
• technical: all 10 draw primitives + text will have their own -transparent- PNG bitmap canvas.
So for example there can be a points_canvas entirely separated from a line_canvas.
This to avoid the need for a complete redraw when something is drawn to the canvas...(eg only the object_type_canvas is redrawn), this in contrast too many very slow do-it-all HTML5 canvas javascript libraries.
The mouselisteners are attached to the canvas-div element.
• a special object type is images.
if used together with imagepalette a image table will be integrated in the 'control section' of multidraw (set multiuserinput 1 for images) if not used with imagepalette, provide the images or div's (<img> tag with bitmap or SVG or anything in a div element) somewhere on the html exercise page, with an onclick handler like:
<img src='gifs/images/dog.svg' onclick='javascript:place_image_on_canvas(this.id);' id="ext_image_1" /><img src='gifs/fish.png' onclick='javascript:place_image_on_canvas(this.id);' id="another" />
etc ... when activating the multidraw image button, the images can be selected
(left mouse button/onclick) and placed on the canvas...left mouse click.
using div's will enable you -amongst other content- to add math typesetting from the exercise page onto the canvas.
• When you are not content with the default multidraw control panel, you can create your own interface, using a few javascript functions to call the drawprimitives, delete things and stop drawing in case you also want to drag&drop stuff...
To activate this feature, use multilabel NOCONTROLS
The object types are internally represented by the following numbers (making typos will render your exercise null and void)
point = 0
points =1
circle = 2
circles = 3
line = 4
lines = 5
segment = 6
segments = 7
arrow = 8
arrows = 9
triangle = 10
triangles = 11
closedspoly = 12
text = 13
rect = 14
rects = 15
poly[3-9] = 16
polys[3-9] = 17
parallelogram = 18
parallelograms = 19
images = 20
curvedarrow = 21
curvedarrows = 22
curvedarrow2 = 23
curvedarrows2 = 24
crosshair = 25
crosshairs = 26
controls for example:
<input type='button' onclick='javascript:userdraw_primitive=null' value='STOP DRAWING' /><input type='button' onclick='javascript:userdraw_primitive=24;multidraw_object_cnt = 0;' value='start drawing curvedarrows2' /> <input type='button' onclick='javascript:var fun=eval("clear_draw_area"+canvas_scripts[0]);fun(24,0);' value='REMOVE LAST CURVEDARROW ' />
If using multiple canvas scripts in a single page, loop through the canvas_scripts[n]
note: if using NOCONTROLS and just a single draw primitive (for example, just: 'multidraw circles'), the object may be drawn directly. (analogue to 'userdraw circles,color')
And since a right mouse button click will always remove the last drawn object of the current object type, there is no need for a special "remove button"
• : multidraw : multidraw_images : multidraw_demo : multidraw_NOCONTROLS

### multilabel ↑

 multilabel button_label_1,button_label_2,...,button_label_8,'stop drawing text'
• use before command multidraw
• if not set all labels (e.g. the value of input type 'button') will be set by the english names for the draw_primitives (like 'point','circle'...)
• the stop drawing button text must be the last item on the multilabel -list
for example:
multilabel punten,lijnen,Stop met Tekenenmultidraw points,lines
• all buttons can be styled by using command css
note:If you want to add some CSS style to the buttons...
the id's of the draw buttons are their english command argument
(e.g. id="canvasdraw_points" for the draw points button).
the id of the stop drawing button is "canvasdraw_stop_drawing".
the id of the "OK" button is canvasdraw_ok_button
• wims will not check the amount or validity of your input
• always use the same sequence as is used for multidraw
• if you don't want the controls, and want to write your own interface, set multilabel NOCONTROLS

### multilinewidth ↑

 multilinewidth linewidth_1,linewidth_2,...,linewidth_8
• use before command multidraw
• if not set all line widths will be set by a previous command linewidth int
• use these up to 7 different line widths for the draw primitives used by command multidraw obj_type_1,obj_type_2...obj_type_7
• wims will not check if the number of 0 or 1's matches the amount of draw primitives...
• always use the same sequence as is used for multidraw

### multifill ↑

 multifill 0,0,1,0,1,0,0
• meaning draw objects no. 3 and 5, in the list of command multifill, are filled (if the object is fillable...and not a line,segment,arrow or point...)
• using a fillpattern: multifill 0,1,2,5,3,4
meaning: first object is not filled...second object is solid color filled...2=grid | 3=hatch | 4=diamond | 5=dot
• use before command multidraw
• if not set all objects -except point|points- will be set not filled... unless a command filled was given before command multifill
• only suitable for draw_primitives like circle | circles, triangle | triangles. rect | rects , poly[3-9] | polys[3-9] and polygon
• wims will not check if the number of 0 or 1's matches the amount of draw primitives...
• always use the same sequence as is used for multidraw

### multifillcolors ↑

 multifillcolors color_name_1,color_name_2,...,color_name_8
• use before command multidraw
• if not set all fillcolors (for circle | triangle | poly[3-9] | closedpoly ) will be stroke_color, fill_opacity
• use these up to 6 colors for the draw primitives used by command multidraw obj_type_1,obj_type_2...obj_type_n
• wims will not check if the number of colours matches the amount of draw primitives...
• always use the same sequence as is used for multidraw
• can also be used with command userdraw clickfill,color when more than one fillcolor is wanted.
the colors will restart at the first color, when there are more fill-clicks than multi-fill-colors
if more control over the used colours is wanted, see command colorpalette color1,color2...

### multifillopacity ↑

 multifillopacity fill_opacity_1,fill_opacity_2,...,fill_opacity_8
• float values 0 - 1 or integer values 0 - 255
• use before command multidraw
• if not set all fill opacity_ will be set by previous command opacity int,int and keyword filled
• use these up to 7 different stroke opacities for the draw primitives used by command multidraw obj_type_1,obj_type_2...obj_type_y
• wims will not check the amount or validity of your input
• always use the same sequence as is used for multidraw

### multisnaptogrid ↑

 multisnaptogrid 0,1,1
• alternative: multisnap
• meaning draw objects no. 2 (circle) and 3 (segments), in the list of command like multifill points,circle,segments, will snap to the xy-grid (default 1 in x/y-coordinate system: see command snaptogrid)
• freehand drawing...specify precision for reply: all objects snap to grid multisnaptogrid 1,1,1,...
• only the xy-values snap_to_grid: all objects snap to grid multisnaptogrid 1,1,1,...
• only the x-values snap_to_grid: all objects snap to x-grid multisnaptogrid 2,2,2,...
• only the y-values snap_to_grid: all objects snap to y-grid multisnaptogrid 3,3,3,...
• if snaptopoints is defined: all objects snap to points multisnaptogrid 4,4,4,...
make sure to define the points to snap on... use command snaptopoints
• multisnaptogrid 0,1,2,3,4multidraw text,arrow,line,circle,image
text is free hand, arrow is snap to grid, line is snap to x-grid, circle is snap to y-grid, image is snap to points defined by command snaptopoints
• use before command multidraw
• attention: if not set all objects will be set no snap... unless a generic command snaptogrid was given before command multidraw
• commands xsnaptogrid, ysnaptogrid, snaptofunction are not supported amd only functional for command userdraw
• always use the same sequence as is used for multidraw
• wims will not check if the number of 0 or 1's matches the amount of draw primitives...

### multistrokecolors ↑

 multistrokecolors color_name_1,color_name_2,...,color_name_8
• use before command multidraw
• if not set all colors will be stroke_color, stroke_opacity
• use these up to 6 colors for the draw primitives used by command multidraw obj_type_1,obj_type_2...obj_type_7
• wims will not check if the number of colours matches the amount of draw primitives...
• always use the same sequence as is used for multidraw

### multistrokeopacity ↑

 multistrokeopacity stroke_opacity_1,stroke_opacity_2,...,stroke_opacity_7
• float values 0 - 1 or integer values 0 - 255
• use before command multidraw
• if not set all stroke opacity_ will be set by previous command opacity int,int
• use these up to 7 different stroke opacities for the draw primitives used by command multidraw obj_type_1,obj_type_2...obj_type_7
• wims will not check the amount or validity of your input
• always use the same sequence as is used for multidraw

### multiuserinput ↑

 multiuserinput 0,1,1,0
• alternative: multiinput
• meaning, when the command multidraw is used multidraw circles,points,lines,triangles
objects points and lines may additionally be drawn by direct input (inputfields)
all other objects must be drawn with a mouse
• in case of circle | circles a third inputfield for Radius (R) is added. The radius must be in the x/y coordinate system (x-range) and not in pixels...students don't think in pixels.
note: R-values will not snap-to-grid
• in case of line(s) | segment(s) | arrow(s) the user should write x1:y1 in the first inputfield and x2:y2 in the second.
These hints are pre-filled into the input field.
Other coordinate delimiters are ; and , e.g. x1;y1 or x1,y1.
An error message (alert box) will popup when things are not correctly...
• in case of a triangle | poly3, three inputfields are provided.
• in case of text and multiuserinput=1, 3 inputfields will be shown: x,y,text
• in case of text and multiuserinput=0, 1 inputfield will be shown: text ... a mouse click will place the text on the canvas.
• may be styled using command css
• an additional button stop drawing may be used to combine userbased drawings with drag∧drop or onclick elements
• when exercise if finished (status=done) the buttons will not be shown.
To override this default behaviour use command / keyword status
• use before command multidraw
• always use the same sequence as is used for multidraw

### killreset ↑

 killreset
• alternative: noreset
• keyword
• may come in handy if canvas script code is generated using loops
• if used the following properties will remain to be valid
• filled
• dash settings
• onclick or drag settings
• centering or offset
• if used again, these properies will be reset to the default values and normal behaviour is continued (e.g. the above properties will be reset after 'use' on a canvas object)
• etc etc
• commands slider ,linear ,rotate ,translate ,affine are always active until the 'kill' commands are given:
killlinear ,killrotate ,killtranslate and killaffine
• commands like 'opacity' ,'linewidth', 'fontsize', 'fontfamily' are only changed when redefined again
• : noreset

### noxaxis ↑

 noxaxis
• keyword
• if set, the automatic x-axis numbering will be ignored
• use command axis to have a visual x/y-axis lines (see command grid)
• to be used before command grid (see command grid)

### noyaxis ↑

 noyaxis
• keyword
• if set, the automatic y-axis numbering will be ignored
• use command axis to have a visual x/y-axis lines (see command grid)
• to be used before command grid (see command grid)

### numberline ↑

 numberline x0,x1,xmajor,xminor,y0,y1
• numberline is using xrange/yrange system for all dimensions
• multiple numberlines are allowed ; combinations with command grid is allowed; multiple commands xaxis numbering are allowed
• x0 is start x-value in xrange
• x1 is end x-value in xrange
• xmajor is step for major division
• xminor is divisor of xmajor; using small (30% of major tick) tick marks: this behaviour is hardcoded
• is xminor is an even divisor, an extra tickmark (60% of major tick) is added to the numberline: this behaviour is hardcoded
• y0 is bottom of numberline; y1 endpoint of major tics
• use command linewidth to control appearance
• use strokecolor and opacity to controle measure line
• for all ticks linewidth and color / opacity are identical.
• if command xaxis or xaxisup is not defined, the labeling will be on major ticks: x0...x1
• use fontfamily and fontcolor to control fonts settings
• may be used together with userdraw, multidraw and user drag command family for the extra object drawn onto the numberline
• snaptogrid, snaptopoints etc and zooming and panning is supported
• onclick and dragging of the numberline are not -yet- supported
• note: in case of multiple numberlines, make sure the numberline without special x-axis numbering (e.g. ranging from xmin to xmax) comes first !
• : numberline

### obabel ↑

 obabel x,y,type input,molecule smiles-code or file location, extra arguments,extra arguments,...
• will call the obabel program , if installed.
• output will be an svg file
• see documentation of obabel for specail keys
• command affine will produce CSS3 matrix transformations
• command rotate will rotate the object
• can be set onclick: javascript:read_dragdrop(); will return click numbers of mathml-objects
if 4 clickable object are drawn, the reply could be 1,0,1,0 ... meaning clicked on the first and third object
• can be set draggable: javascript:read_dragdrop(); will return all coordinates in the same order as the canvas script: unmoved object will have their original coordinates...
• snaptogrid is supported...snaptopoints will work, but use with care...due to the primitive dragging
technically: the dragstuff library is not used...the mathml is embedded in a new div element and not in the html5-canvas
• external files may be loaded if they are present on the server or in the modules
for example:

### string ↑

 string color,x,y,the text string
• may be set onclick or drag xy
• note: when set onclick ,use an extra command fontsize (default: fontsize=12) to adjust the size of the clicked text-string
note: a clicked text string will be hardcoded : fontsize+10 in the font family courier
• unicode supported: string red,0,0,\u2232
• use a command like fontfamily italic 24px Arial to set fonts on browser that support font change
• : string

### stringup ↑

 stringup color,x,y,rotation_degrees,the text string
• may be set onclick or drag xy
• note: when set onclick ,use an extra command fontsize (default: fontsize=12) to adjust the size of the clicked text-string
note: a clicked text string will be hardcoded : fontsize+10 in the font family courier
• unicode supported: stringup red,0,0,45,\u2232
• use a command like fontfamily bold 34px Courier to set fonts on browser that support font change
• you could use keyword yoffset to -sometimes- do a small correction of text placement under/above a point (e.g. text & point have thesame coordinates)
• note: no need to killrotate after stringup
onclickrotate 45string red,0,0,AAAAAAkillrotatestring red,4,4,BBBBBB
is identical with:
onclickstringup red,0,0,45,AAAAAAstring red,4,4,BBBBBB
• : stringup

### highlight ↑

 highlight color,opacity,linewidth
• NOT IMPLEMENTED
• use command onclick: when the object receives a userclick it will increase its linewidth

### strokecolor ↑

 strokecolor colorname or #hex
• to be used for commands that do not supply a color argument (like command linegraph)

### text ↑

 text fontcolor,x,y,font,text_string
• font may be described by keywords: giant,huge,normal,small,tiny
• use command fontsize to increase base fontsize for these keywords
• may be set onclick or drag xy
• backwards compatible with flydraw
• unicode supported: text red,0,0,huge,\u2232
• use command string combined with fontfamily for a more fine grained control over html5 canvas text element
• Avoid mixing old flydraw commands text, textup with new canvasdraw commands string, stringup. If the fontfamily was set completely like fontfamily italic 24px Arial. In that case reset fontfamily to something lke fontfamily Arial before the old flydraw commands.
• : text

### textarea ↑

 textarea x,y,cols,rows,readonly,value
• may be further controlled by css
• if $status=done (e.g. in answer.phtml) the inputfield will be cleared and set readonly. Override this by keyword status. • if mathml inputfields are present and / or some userdraw is performed, these data will not be send as well (javascript:read_canvas();) • keyword xoffset | centered is not active for command textarea • : textarea ### textfill ↑  textfill x0,y0,color,some_text ### textup ↑  textup fontcolor,x,y,font,text_string • can not be set onclick or drag xy (because of translaton matrix...mouse incompatible) • font may be described by keywords: giant,huge,normal,small,tiny • use command fontsize to increase base fontsize for the keywords • backwards compatible with flydraw • unicode supported: textup red,0,0,huge,\u2232 • use command stringup and fontfamily for a more fine grained control over html5 canvas text element • Avoid mixing old flydraw commands text, textup with new canvasdraw commands string; stringup. If the fontfamily was set completely like fontfamily italic 24px Arial. In that case reset fontfamily to something like fontfamily Arial before the old flydraw commands. ### trace_jscurve ↑  trace_jscurve some_math_function • will use a crosshair to trace the jsmath curve • two inputfields will display the current x/y-values (numerical evaluation by javascript) • default labels x and y; use commands xlabel some_x_axis_name and ylabel some_y_axis_name to customize the labels for the input fields • use commands fontsize and css to format the fonts for labels and inputfields. • use commands linewidth, strokecolor, crosshairsize to adjust the corsshair. • the client browser will convert your math function to javascript math. use parenthesis and rawmath: use 2*x instead of 2x etc etc no check is done on the validity of your function and/or syntax (use error console to debug any errors...) • be aware that the formulas of the plotted function(s) can be found in the page javascript source • : trace_jscurve ### trange ↑  trange tmin,tmax • alternative: ranget • default -2,2 ### translation ↑  translation tx,ty • alternative: translate • will translate the next objects tx in xrange and ty in yrange • use command killtranstation to end the command • : translation ### triangle ↑  triangle x1,y1,x2,y2,x3,y3,color ### triangles ↑  triangles color,x1,y1,x2,y2,x3,y3,... • use ftriangles or keyword filled for solid triangles • may be set draggable / onclick individually (!) • : triangles ### userboxplot ↑  userboxplot • keyword, no arguments • use before command boxplot x_or_y,box-height_or_box-width,x_or_y-position • if set, the student will have to calculate "min,Q1,median,Q3,max" and feed these data into the draw_boxplot function • for example: put the canvas-script into a html element with id='boxplot' and set style='display:none' define a variable called student_boxplot and fill it with the 5 student-data (from inputfields or something) var student_boxplot = new Array(5)function show_boxplot(){student_boxplot[0] = min;student_boxplot[1] = Q1;student_boxplot[2] = median;student_boxplot[3] = Q3;student_boxplot[4] = max;document.getElementById('boxplot').style.display = "block";draw_boxplot(12345,1,2.00,5.00,[0,0,0,0,0],4,"0,0,255",0.78,"255,165,0",0.60,1,0,1,1);}; In the canvas-script the function draw_boxplot has the following arguments: draw_boxplot=function(canvas_type,xy,hw,cxy,data,line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype0,dashtype1) ### userboxplotdata ↑  userboxplotdata • keyword, no arguments • use before command boxplot x_or_y,box-height_or_box-width,x_or_y-position • if set, the student will have to generate some statistical data. These data should be put in a named array student_boxplot_data • min,Q1,median,Q3,max are calculated by a js-function and the 'draw_boxplot' function will draw a boxplot. • see command userboxplot for calling 'draw_boxplot()' ### userdraw ↑  userdraw object_type,color • only a single object_type is allowed. • right mouse click will remove last drawn object. • for multiple different 'userdraw' objects in an exercise, use command multidraw • implemented object_type: • point • points • crosshair • crosshairs • line • lines • vline • vlines • hline • hlines • demiline • demilines • segment • segments • polyline | brokenline • circle • circles • arrow • arrow2 (double arrow) • arrows • arrows2 (double arrows) • curvedarrow • curvedarrows • curvedarrow2 • curvedarrows2 • triangle • polygon • poly[3-9] (e.g poly3 ... poly7...poly9 • rect • roundrect • rects • roundrects • freehandline | path • freehandlines | paths • clickfill: fill the clicked area with color multiple areas may be selected multiple colors may be provided using commands colorpalette color1,color2,color3,... use replyformat 10 for checking the user click color ... reply=x1:y1:color1,x2:y2:color2... attention: this will not work for pattern filling, because the pattern image is only generated once and after creation can not be changed ! the opacity of this image on a separate canvas is set to 0.01 and not 0 (!!)...in the fill algorithm the opacity of the matching pixels is set to 1 • dotfill: fill the clicked area with a dot pattern; use command linewidth to change dot size • diamondfill: fill the clicked area with a diamond pattern • hatchfill: fill the clicked area with a hatch pattern • gridfill: fill the clicked area with a grid pattern • textfill: fill the clicked area with a repeating string userdraw textfill,blue,some_text use command fontfamily to adjust text style and size • clickfill | pattern filling in general: the clicks may be set snaptogrid can be used together with command floodfill or fill always use together with command clearbutton some_text for removal of all click_colored areas the function read_canvas() will return the click coordinates in the sequence of the user clicks use command canvastype to fill another canvas (default should be fine: DRAG_CANVAS = 5) • text an inputfield is provided, unicode allowed. The text is drawn a the mouse click, or if used with command userinput inputfield also at the given x/y-coordonates • arc • arcs • image only a single "image" of every supported type(*) may be added to canvas window from the surrounding html page. the image should have an 'id' and an onclick handler. (*) supported types are svg,bitmap,p-element,div-element and mathml/tex-code with \mmlid{int}. • images • input place a single inputfield on canvas use commands 'css' for css styling: use command linewidth for adjusting the input field size (default 1) • inputs place multiple inputfield: placing inputfields on top of each other is not possible • function : identical to userinput function • note: mouselisteners are only active if$status != done (eg only drawing in an active/non-finished exercise)
to overrule use command/keyword status (no arguments required)
• note: object_type text: Any string or multiple strings may be placed anywhere on the canvas.
Use command fontfamily to set font
• note: object_type polygone: Will be finished (the object is closed) when clicked on the first point of the polygone again.
• note: all objects will be removed -after a javascript confirm box- when clicked on an object point with middle or right mouse button (e.g. event.button != 1: all buttons but left)
• use a prefix filled or f to set fillable objects filled. (fcircles,filledcircles etc)
in case of fillpattern do not use the f prefix !
• for non solid filling, use command fillpattern grid,hatch,diamond,dot
• use opacity int,int and fillcolor color to trigger coloured filling of fillable objects
• use command dashed and/or dashtype int,int to trigger dashing
• use command replyformat int to control / adjust output formatting of javascript function read_canvas(); (the defaults should be fine...)
• may be combined with onclick or drag xy of other components of flyscript objects (although not very useful...)
• may be combined with keyword userinput_xy
• may be combined width the snaptogrid snaptopoints etc, to simplify the checking of the student reply
• the cursor may be appropriately styled using command cursor
• note: when zooming / panning after a drawing, the drawing will NOT be zoomed / panned...this is a "design" flaw and not a feature
To avoid trouble do not use zooming / panning together width userdraw.!
use command multidraw is this is a problem for you...
• note: the default replyformat for userdraw input(s),color used format x1;y1;text1 n x2;y2;test2 n x_n;y_n;text_n (e.g. it is not a comma separated array...use direct exec to test)
• note: a special case is userdraw image,boguscolor. Images (bitmap or svg or div) present in the exercise page and the img/svg/div-tag with an unique 'id' and onclick='javascript:place_image_on_canvas(this.id)' can be placed onto the canvas.
The id and (x;y) coordinates will be returned using read_canvas();
native MathML, MathJax or KaTeX typesetting may be included in div's.(experiments; wims_modules svn version only!)
• note: command
userdraw function,color is identical to acombination of strokecolor color and userinput function
• note: commands :
multicolors red,green,bluemultilabel f(x)=:g(x)=:h(x)=userdraw functions3,color
is identical to commands :
functionlabel f(x)=:p(x)=:w(x)=strokecolor reduserinput function strokecolor greenuserinput function strokecolor blueuserinput function
• : userdraw_canvastype_a : userdraw_canvastype_b : userdraw_rect : userdraw_rects : userdraw_frect : userdraw_frects : userdraw_roundrect : userdraw_roundrects : userdraw_froundrect : userdraw_froundrects : userdraw_line : userdraw_lines : userdraw_vline : userdraw_vlines : userdraw_hline : userdraw_hlines : userdraw_demiline : userdraw_demilines : userdraw_arc : userdraw_arcs : userdraw_point : userdraw_points : userdraw_arrow : userdraw_arrows : userdraw_arrow2 : userdraw_arrows2 : userdraw_curvedarrow : userdraw_curvedarrows : userdraw_curvedarrow2 : userdraw_curvedarrows2 : userdraw_crosshair : userdraw_crosshairs : userdraw_circle : userdraw_circles : userdraw_segment : userdraw_segments : userdraw_line : userdraw_lines : userdraw_triangle : userdraw_poly5 : userdraw_filled_poly5 : userdraw_poly7 : userdraw_filled_poly7 : userdraw_polyline : userdraw_freehandline : userdraw_filled_freehandline : userdraw_freehandlines : userdraw_input : userdraw_inputs : userdraw_text : userdraw_function : userdraw_clickfill_colorpalette : userdraw_clickfill_1 : userdraw_clickfill_2 : userdraw_clickfill_2

### userinput ↑

 userinput function inputfield
• alternative: userinput_function
• alternative: userinput_xy
• inputfield is only usable in combination with some userdraw draw_type
• note: the input fields are not cleared after the object is drawn...be aware of multiple idential drawings (many clicks on the ok button)
• userinput function may be used any time (e.g. without userdraw)
• multiple userinput function commands may be used.
• use command functionlabel some_string to define the inputfield text: default value "f(x)="
• use command strokecolor some_color to adjust the plot / functionlabel color
• use command css some_css to adjust the inputfields
• use command fontsize int to adjust the label fonts. (default 12px)
• the user input for the function will be corrected by a simple rawmath implementation...
an error message will be shown if javascript can not interpret the user input
• : userinput_function : userinput_points : userinput_arrows : userinput_combined

### userinput_xy ↑

 userinput_xy
• keyword (no arguments required)
• to be used in combination with command "userdraw object_type,color"
• if set two (or three) input fields are added to the document
(one for x-values, one for y-values and in case of drawing circle one for radius-values)
• the student may use this as correction for (x:y) on a drawing (or to draw without mouse, using just the coordinates)
• math input is allowed (e.g something like: 1+3,2*6,1/3,sqrt(3), sin(pi/4),10^-2,log(2)...)
eval function is protected against code injection.
• can not be combined with command intooltip tiptext
note: the tooltip div element is used for placing inputfields
• user drawings will not zoom on zooming (or pan on panning)
• use command css some_css to adjust the inputarea.
• use command fontsize int to adjust the text labels (if needed)
• : userinput_xy

### userinput_function ↑

 userinput_function
• alternative: userinput function
• keyword (no arguments required)
• if set, a inputfield will be added to the page
• repeat keyword for more function input fields
• the userinput value will be plotted in the canvas
• this value may be read with read_canvas().
for do it yourself js-scripters: If this is the first inputfield in the script, its id is canvas_input0
• use before this command userinput_function,
commands like css some_css, xlabel some_description, opacity int,int, linewidth int, dashed and dashtype int,int to modify
• fontsize can be set using command fontsize int
• incompatible with command intooltip link_text_or_image: it uses the tooltip div for adding the inputfield
• : userinput_function

### vline ↑

 vline x,y,color
• alternative: verticalline
• draw a vertical line through point (x:y) in color 'color'
• may be set draggable / onclick
• : vline

### vlines ↑

 vlines color,x1,y1,x2,y2....
• alternative: verticallines
• draw vertical lines through points (x1:y1),(x2:y2)... in color 'color'
• may be set draggable / onclick individually
• : vlines

### video ↑

 video x,y,w,h,videofile location
• x,y: left top corner of audio element (in xrange / yrange)
• w,y: width and height in pixels
• video format may be in *.mp4 (todo: other formats)
• : video

### xaxis ↑

 xaxis num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string_n
• alternative: xaxistext num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string_n
• usable for commands numberline and grid or combinations thereof
• use these x-axis num1...num_n values instead of default xmin...xmax
• in case of command grid. there is no need to use keyword axisnumbering
• use command axis to have visual x/y-axis lines (see command grid
• use command fontcolor, fontfamily to adjust font
defaults: black,12,Arial
note: command fontsize is not active for this command.(fontsize can be used for the legend in a grid)
• a javascript error message will flag non-matching value:name pairs
• if the x-axis words are too big and will overlap, a simple alternating offset will be applied
• to be used before command grid (see command grid)
• xmajor steps should be synchronised with numbers eg. 1 in the next example grid 1,100,grey,1,4,6,grey
• : xaxistext

### xaxisup ↑

 xaxisup num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string_n
• alternative: xaxistextup num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string_n
• the text will be rotated 90° up
• no need to use keyword axisnumbering
• use command axis to have visual x/y-axis lines (see command grid
• use these x-axis num1...num_n values instead of default xmin...xmax
• use command fontcolor, fontfamily to adjust font
defaults: black,12,Arial
note: command fontsize is not active for this command.(fontsize can be used for the legend in a grid)
• a javascript error message will flag non-matching value:name pairs
• if the x-axis words are too big, they will overlap the graph
(in this case the text will start from ysize upwards)
• to be used before command grid (see command grid)
• xmajor steps should be synchronised with numbers eg. "1" in the next example grid 1,100,grey,1,4,6,grey
• : xaxistextup

### xerrorbars ↑

 xerrorbars color,E1,E2,x1,y1,x2,y2,...,x_n,y_n
• draw multiple points with x-errorbars E1 (error value left from point) and E2 (error value right from point) at given coordinates in color 'color'
• the errors E1 and E2 values are in xrange.
• use command linewidth int to adust size
• may be set draggable / onclick individually (!)
• : xerrorbars

### xrange ↑

 xrange xmin,xmax
• alternative: rangex
• if not given: 0,xsize (eg in pixels)

### xsnaptogrid ↑

 xsnaptogrid
• keyword (no arguments required)
• a draggable object (use command drag x|y|xy) will snap to the given x-grid values when dragged (mouseup)
• in case of userdraw the drawn points will snap to xmajor grid
• if no grid is defined, points will snap to every integer xrange value. (eg snap_x=1)
• if you do not want a visible grid, but you only want a snaptogrid with some value...define this grid with opacity 0.
• if xminor is defined (use keyword axis to activate xminor), the drawing will snap to xminor
use only even dividers in x-minor...for example
xsnaptogridaxisgrid 2,1,grey,4,4,7,red
will snap on x=0, x=0.5, x=1, x=1.5 ....
will snap on y=0, y=0.25 y=0.5 y=0.75 ...
• : xsnaptogrid_1 : xsnaptogrid_2

### xoffset ↑

 xoffset
• keyword ; to place the text centered above the text coordinates(x:y) ...
• may be used for points or other things requiring centered labels
• use fontfamily for setting the font
• may be active for commands text and string (e.g. objects in the drag/drop/onclick-library)
• : xoffset

### xyoffset ↑

 xyoffset
• keyword ; to place the text (x:y) to (x+dx:y+dy)... dx/dy are dependent on fontsize/fontfamily
• may be used for points or other things requiring labels
• use fontfamily for setting the font
• only active for commands text and string (e.g. objects in the drag/drop/onclick-librariy
• in case of inputfields the inputfield will be centered x and y on its coordinates.
for example:
inputs 1,1,10,?
point 1,1,red
the point will be completely invisible
note: keyword xyoffset will also provide centering if used with input(s),color
• : xyoffset

### xunit ↑

 xunit some_unit_for_x-values
• unicode allowed (no html code)
• use together with command display or mouse
• will display the cursor x-coordinate in unit
• : xunit

### xlabel ↑

 xlabel some_string
• will be used to create a label for the x-axis (label is in quadrant I)
• can only be used together with command grid
not depending on keywords axis and axisnumbering
• font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
(command fontfamily is not active for this command)
• use ylabel
• : xlabel

### xlogbase ↑

 xlogbase number
• sets the logbase number for the x-axis
• default value 10
• use together with commands xlogscale / xylogscale

### xlogscale ↑

 xlogscale ymajor,yminor,majorcolor,minorcolor
• the x/y-range are set using commands xrange xmin,xmax and yrange ymin,ymax
• ymajor is the major step on the y-axis; yminor is the divisor for the y-step
• the linewidth is set using command linewidth int
• the opacity of major / minor grid lines is set by command opacity
• default logbase number = 10 ... when needed, set the logbase number with command xlogbase number
• the x/y- axis numbering is triggered by keyword axisnumbering
• use command precision before xlogscale command to set the precision (decimals) of the axis numbering
• use commands xlabel some_text and/or ylabel some_text for text on axis: use command fontsize int to set the fontsize (default 12px)
• use command fontfamily fnt_family_string to set the fonts for axis-numbering
• use command fontcolor to set the colour
• note: the complete canvas will be used for the log paper
• note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
• note: command mouse color,fontsize will show the real values in the logpaper.
• note: when using something like xrange 0.0001,0.01...combined with commands mouse and/or userdraw...
make sure the precision is set accordingly
• note: in case of userdraw, the use of keyword userinput_xy may be handy !
• attention: keyword snaptogrid may not lead to the desired result...
• attention: do not use command zoom
• : xlogscale

### xylogscale ↑

 xylogscale majorcolor,minorcolor
• the x/y-range are set using commands xrange xmin,xmax and yrange ymin,ymax
• the linewidth is set using command linewidth int
• the opacity of major / minor grid lines is set by command opacity [0-255],[0-255]
• default logbase number = 10 ... when needed, set the logbase number with command xlogbase number and/or ylogbase number
• the x/y- axis numbering is triggered by keyword axisnumbering
• use commands xlabel some_text and/or ylabel some_text for text on axis: use command fontsize int to set the fontsize (default 12px)
• use command fontfamily fnt_family_string to set the fonts for axis-numbering
• use command fontcolor to set the colour
• note: the complete canvas will be used for the log paper
• note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
• note: command mouse color,fontsize will show the real values in the logpaper.
• note: when using something like yrange 0.0001,0.01...combined with commands mouse color,fontsize and/or userdraw type,color...
make sure the precision is set accordingly (eg command precision 10000)
• note: in case of userdraw, the use of keyword userinput_xy may be handy !
• attention: keyword snaptogrid may not lead to the desired result...
• attention: do not use command zoom
• : xylogscale

### yaxis ↑

 yaxis num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string_n
• alternative: yaxistext num1:string1:num2:string2:num3:string3:num4:string4:....num_n:string_n
• use command fontcolor, fontfamily to adjust font
defaults: black,12,Arial
note: command fontsize is not active for this command.(fontsize can be used for the legend in a grid)
• no need to use keyword axisnumbering
• use command axis to have visual x/y-axis lines (see command grid
• use these y-axis num1...num_n values instead of default ymin...ymax
• a javascript error message will flag non-matching value:name pairs
• to be used before command grid (see command grid)
• : yaxistext

### yerrorbars ↑

 yerrorbars color,E1,E2,x1,y1,x2,y2,...,x_n,y_n
• draw multiple points with y-errorbars E1 (error value under point) and E2 (error value above point) at given coordinates in color 'color'
• the errors E1 and E2 values are in yrange.
• use command linewidth int to adust size
• may be set draggable / onclick individually (!)
• : yerrorbars

### yoffset ↑

 yoffset
• keyword; to place the text centered above the text coordinates(x:y) ...
• may be used for points or other things requiring centered labels
• use fontfamily for setting the font
• may be active for commands text and string (e.g. objects in the drag/drop/onclick-library)
• : yoffset

### yrange ↑

 yrange ymin,ymax
• alternative: rangey
• if not given 0,ysize (eg in pixels)

### ysnaptogrid ↑

 ysnaptogrid
• keyword (no arguments required)
• a draggable object (use command drag x|y|xy) will snap to the given y-grid values when dragged (mouseup)
• in case of userdraw the drawn points will snap to ymajor grid
• if no grid is defined, points will snap to every integer yrange value. (eg snap_y=1)
• if you do not want a visible grid, but you only want a snaptogrid with some value...define this grid with opacity 0.
• if yminor is defined (use keyword axis to activate yminor), the drawing will snap to yminor
use only even dividers in y-minor...for example
ysnaptogridaxisgrid 2,1,grey,4,4,7,red
will snap on x=0, x=0.5, x=1, x=1.5 ....
will snap on y=0, y=0.25 y=0.5 y=0.75 ...
• : ysnaptogrid_1 : ysnaptogrid_2

### ylabel ↑

 ylabel some_string
• will be used to create a (vertical) label for the y-axis (label is in quadrant I)
• can only be used together with command grid
not depending on keywords axis and axisnumbering
• font setting: italic Courier, fontsize will be slightly larger (fontsize + 4)
use command fontsize to adjust (command fontsize is not active for this command)
• use xlabel
• : ylabel

### ylogbase ↑

 ylogbase number
• sets the logbase number for the y-axis
• default value 10
• use together with commands ylogscale / xylogscale

### ylogscale ↑

 ylogscale xmajor,xminor,majorcolor,minorcolor
• the x/y-range are set using commands xrange xmin,xmax and yrange ymin,ymax
• xmajor is the major step on the x-axis; xminor is the divisor for the x-step
• the linewidth is set using command linewidth int
• the opacity of major / minor grid lines is set by command opacity [0-255],[0-255]
• default logbase number = 10 ... when needed, set the logbase number with command ylogbase number
• the x/y- axis numbering is triggered by keyword axisnumbering
• use command precision before ylogscale command to set the precision (decimals) of the axis numbering
• use commands xlabel some_text and/or ylabel some_text for text on axis: use command fontsize int to set the fontsize (default 12px)
• use command fontfamily fnt_family_string to set the fonts for axis-numbering
• use command fontcolor to set the color
• note: the complete canvas will be used for the log paper
• note: userdrawings are done in the log paper, e.g. javascript:read_canvas() will return the real values
• note: command mouse color,fontsize will show the real values in the logpaper.
• note: when using something like yrange 0.0001,0.01...combined with commands mouse color,fontsize and/or userdraw type,color...
make sure the precision is set accordingly (eg command precision 10000)
• note: in case of userdraw, the use of keyword userinput_xy may be handy !
• attention: do not use command zoom
• attention: keyword snaptogrid may not lead to the desired result...

### yunit ↑

 yunit some_unit_for_y-values
• unicode allowed (no html code)
• use together with command mousey
• will display the cursor y-coordinate in unit

### zoom ↑

 zoom button_color
• introduce a very small controlpanel at the lower right corner (font size of the panel is fixed to: 22px Arial)
• giving six 15×15px active rectangle areas
(×,↓,↑,←,→,−,+) for zooming and/or panning of the image
• a mouse wheel is active for in/out zooming. Drag panning is not supported (this will conflict with many userdraw or multidraw primitives)
• the controlpanel is not active for a userdraw mousedown (but it can interfere with some userdraw types)
• the × symbol will reset to your original xmax/xmin ymax/ymin values.
• choose an appropriate color, so the small ×,↓,↑,←,→,−,+ are clearly visible
• command opacity may be used to set stroke_opacity of buttons
• note: on zooming, text will not increase / decrease the font size (todo??)
• note: adding zooming will increase the size of the javascript include with approx. 11 kb

## Interfaces to external software packages

This documentation is yet not finished ... WIMS provides interfaces for some software packages which must be installed independantly.
 pari the PARI group http://pari.math.u-bordeaux1.fr/ PARI/GP est un système de calcul formel très répandu, conçu pour des calculs rapides en arithmétique (factorisations, théorie algébrique des nombres, courbes elliptiques...) mais contient aussi un grand nombre de fonctions pour le calcul matriciel, sur les développements limités, les nombres algébriques, etc. ainsi que de nombreuses fonctions transcendantes.

 maxima http://maxima.sourceforge.net/ Maxima is a system for the manipulation of symbolic and numerical expressions, including differentiation, integration, Taylor series, Laplace transforms, ordinary differential equations, systems of linear equations, polynomials, and sets, lists, vectors, matrices, and tensors. Maxima yields high precision numeric results by using exact fractions, arbitrary precision integers, and variable precision floating point numbers.

 graphviz Credits http://www.graphviz.org/ Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. Automatic graph drawing has many important applications in software engineering, database and web design, networking, and in visual interfaces for many other domains.

 gap The GAP Group http://www.gap-system.org/ GAP is a system for computational discrete algebra, with particular emphasis on Computational Group Theory. GAP provides a programming language, a library of thousands of functions implementing algebraic algorithms written in the GAP language as well as large data libraries of algebraic objects. See also the overview and the description of the mathematical capabilities. GAP is used in research and teaching for studying groups and their representations, rings, vector spaces, algebras, combinatorial structures, and more.

 float_calc,integer_calc http://www.gnu.org/software/bc/ interface to bc ; bc -l

 yacas Credits http://yacas.sourceforge.net/homepage.html YACAS is an easy to use, general purpose Computer Algebra System, a program for symbolic manipulation of mathematical expressions. It uses its own programming language designed for symbolic as well as arbitrary-precision numerical computations. The system has a library of scripts that implement many of the symbolic algebra operations; new algorithms can be easily added to the library. YACAS comes with extensive documentation (hundreds of pages) covering the scripting language, the functionality that is already implemented in the system, and the algorithms we used.

 jmol

 geogebra

 checkmol Norbert Haider, norbert.haider@univie.ac.at, modified by Ernst-Georg Schmid

 curvecomp Xiao Gang Compare two curves Input parameters: environment. w_curvecomp_1 and w_curvecomp_2: curves to compare, as lists of points. w_curvecomp_xrange and w_curvecomp_yrange: list of 2 integers each. w_curvecomp_tolerance: Maximal tolerance of distances. Output: 10 double numbers separated by white spaces.- Average distance of curve 1 with respect to curve 2. - Average distance of curve 2 with respect to curve 1. - Maximal distance of curve 1 with respect to curve 2. - Maximal distance of curve 2 with respect to curve 1. - Proportion of curve 1 close to curve 2. - Proportion of curve 2 close to curve 1. - Maximal jump of curve 1. - Maximal jump of curve 2. - Ratio of repetitions found in curve 1. Number 10: Ratio of repetitions found in curve 2. Furthermore, words "fnofx" and/or "fnofy" will appear if curve 2 represents the graph of a function of x (and/or y). Returns empty if one of the curves is degenerated.  curvecomp_1=0,92,1,92,2,92,3,92 curvecomp_2=46,41,48,41,50,45 curvecomp_tolerance=40 curvecomp_xrange=11,208 curvecomp_yrange=0,220 curvecomp  

 cyclicode Xiao Gang This program generates cyclic code from a polynomial defined over a prime field. It does not check whether the polynomial is primitive or irreducible. Accepted parameter: 3 words Word 1: field characteristics, limited to 2,3,5,7 Word 2: The polynomial coefficients (except the leading one, from lower degree to higher).Word 3: The starting status (starting from the first bit).  cyclicode 3 22 10 

 dicfind Xiao Gang for adm modules

 dicsort Xiao Gang Sort dictionary for adm modules

 huffman Xiao Gang This program computes an optimal coding of variable lengths on a given distribution of probabilities, using Huffman algorithm. Two environment variables wims_exec_parm is a comma-separated list of probability distributions Limited to MAX_ITEMSThe input data will be scaled to unit sum w_huffman_radix is the encoding radix, between 2 and MAX_RADIX. two lines Line 1: Entropy and Average code length, comma-separated Line 2: comma-separated list of codes.  huffman_radix=4 huffman 0.16, 0.39, 0.55 

 lceb Lucas Nussbaum, lucas@lucas-nussbaum.net jeu "le compte est bon" 7 integers How to obtain the first number from the six other ones by addition, multiplication, division, substraction  lceb 598 6 8 2 5 10 12 

 matchmol Norbert Haider, norbert.haider@univie.ac.at, modified by Ernst-Georg Schmid

 mathexp Xiao Gang Mathematical expression manipulations for WIMS For the moment, use only in deductio

 moneyprint prints a number with fixed amount of decimal places Usage:!exec moneyprint number1,number2,number3,....number_n decimal_placesor !exec moneyprint number1,number2,number3;....number_n decimal_places\text{A=wims(exec moneyprint number1,number2,number3....number_n decimal_places)}default value "decimal_places = 2"A=!exec moneyprint 123,43.5,23.45665A=123.00,43.50,23.47A=!exec moneyprint 1.000,6.234;8.4567A=1.00,6.23;8.46or specified a last "word"A=!exec moneyprint 123,43.5,23.45665 3 A=123.000,43.500,23.457

 shortpath Xiao Gang Finds the shortest paths linking given points wims_exec_parm is ... . w_shortpath_style : 0: loop to the start 1: arbitrary open path 2: open path with fixed start 3: open path with fixed end 4: open path with fixed start and end  shortpath_style=0 shortpath 1,3 5,1 3,4 1,1 3,1 4,5 

 scienceprint J.M. Evers Prints a number in scientific notation. Usage: !exec scienceprint number,significant_digits,output_type\text{A=wims(exec scienceprint number,significant_digits,output_type )}output_type can be0 : calculating format : 1.234*10^-41 : html format :1.234×10-42 : latex format : 1.234\times10^{-4}3 : prefix format : 1.234×10-1 m4 : mathml format : $1.234×{10}^{-4}$5 : long prefix format : 1.234×10-1 milli

 voronoi Steve J. Fortune compute Voronoi diagram or Delaunay triangulation. Voronoi reads the standard input for a set of points in the plane and writes either the Voronoi diagram or the Delaunay triangulation to the standard output. Each input line should consist of two real numbers, separated by white space. If option -t is present, the Delaunay triangulation is produced. Each output line is a triple i j k which are the indices of the three points in a Delaunay triangle. Points are numbered starting at 0. If this option is not present, the Voronoi diagram is produced. There are four output record types. s a b indicates that an input point at coordinates l a b c indicates a line with equation ax + by = c. v a b indicates a vertex at a b. e l v1 v2 indicates a Voronoi segment which is a subsegment of line number l; with endpoints numbered v1 and v2. If v1 or v2 is -1, the line extends to infinity.  voronoi -t 5 7 2 8 7 6 3 5 1 2 8 1 4 3 6 4 

 translator Xiao Gang Versatile translation according to a dictionary for adm modules

 oncechar Xiao Gang This special program selects words composed by selected characters, each selected character being used at most once in the word. Used in the shell script public_html/bin/dicfind Selected characters are entered by the env var 'oncechar'. Words entered by stdin. Output to stdout.

 msg2wims Xiao Gang transforms a text in a file and save it in another file (administrative module). Transforms some commands of the form \ in wims equivalence. By default, the commands are  (replace by !insmath) and translation in html of $, !, (to complete). More commands can be translated by the configuration of the variable msg2wims_primitives. Usage:!sh cd$wims_home; bin/msg2wims file_in > file_out name of a file modified text of the input file

## Template files

Some files in the distribution are template. They can be changed and used for global configuration. They are local so will not be erased by WIMS update. Preliminary version

## How to do an anstype

# How to add a new anstype (called here _name) Each anstype contains two files, _name.input is the input form element, and _name is the answer processing file. Specific anstypes need not be put into this directory. One can create a subdirectory "anstype" in the module, then put the files there. Any name will do, but we recommend that module-specific anstypes use a specific prefix for its names, like "mynumeric", "myfunction", ..., in order to avoid possible confusions. In an oef exercise, the anstype is called by the line \answer{xxx}{yyy}{type=_name}{option=zzz} see later for the intern variables corresponding to the values. The input file should contain the following two definitions: 1. define anstype=yes. Otherwise the OEF manager will not recognize the existence of the anstype. 2. define the form style using the variable anstyle. Here are the possible words to declare in this variable: * mc: multiple choice style. * symtext: allows symtext processing. * numeric: the data is numeric or with an input field * dprompt: correct answer prompt given under double-underlined variable (internal reply__$i); in this mode, the correct answer is not present by default. * nogood: never present correct answer (because there cannot be). * noanswer: never present the answer analysis (because there is no correct or wrong answer) These scripts accept the following input variables: * i: The number of the reply field. * replyname$i: The prompt of the form element. * reply$i: The answer given by the student. * replygood$i: The correct answer given by the author. so the value of the second field of \answer{}{}. * replyoption$i: Option words. Anstypes are more or less free to define their own recognized option words. In oef exercises, it correspond to the value zzz in {option=zzz} * inputsize: the second item of the field \embed{} (the first one is * r$i ou reply$i). In general, it contains the size of the form element. Moreover, if no comparison is wanted, the answer processing file can have a calling parameter "nocompare" (not useful in oef exercices). Output variables of the answer processing file: * Test: Put bad$i if the correct answer given by the author is not understandable. * test: Put NaN followed possibly by an error indicator, if the answer given by the student is not understandable. some available error indicators: * badsize (following by a number) * badform * badform noreduced * nocompute * nocomputecomplex * notunit * bad_variable * unknownword followed by some words * chemdraw_empty_data * chemclick_empty_data * diareply$i: Diagnostics result. Possible values: good, bad. * precreply$i: If the answer misses the correct result just by a problem of precision, put yes to this variable and put bad to diareply$i. In the computation of the score, a coefficient depending on the level is introduced. In thise case, one must not advance freegot at all. * partialgood$i: If the answer should be considered as partially correct, put yes to this variable and put good to diareply$i. It has no consequence on the calculation of the real score (use freegot for that). * freegot: This is a numerical variable. Its content is incremented by 1 if the answer is 100% OK, none if it is false, or anything between 0 and 1 for partially correct answer. It is not recommended to decrement this value, nor to increment it more than 1. The real score is computed using it. So, partialgood$i=yes + diareply$i=good + freegot advances of a number strictly between 0 and 1 or !advance precgood + diareply$i=bad + fregot=0 + precreply$i=yes There are also some optional output variables (they can be left empty). * replyGood$i: This variable can be defined for the correct answer shown to the students after replying to the exercise, It should be different than the real replygood$i. It is not shown in the analysis of the answer for false student answer if dprompt is declared in anstyle. * m_reply$i: This variable can be defined for the answer shown back in the oef variable reply$i, if it should be different than the real answer typed in. * reply_$i: The answer of the student shown in the html page in place of \embed{} or in the analysis zone (for oef exercises). * reply__$i: A special prompt in the analysis of the answer to show when dprompt is declared in anstyle. If it is empty, its value is the value of reply_$i. If the variable noshow$i is yes, the student reply is not shown in the answer analysis. * m_sc_reply$i: by default 0, 0.5 or 1 according to diareply$i, partialgood$i and freegot. Can be set to special values. Give the possibility to the developer of exercises to give feedbacks without testing again. There are also some variables which can be used (new/2009) * oef_formnosubmit: if yes, no "Send answer" button appear. * oef_js_submit: can be used to put javascript in the answer button, the line onclick="javascript:$oef_js_submit;" will be present in this button (in test). * oef_anstype_css: style css (what is inside ) will be include at the end of the web page. If the following variables are defined in the file _name.input, they can be reused in the file _name: oef_applet_option,oef_applet_command,oef_fill_option,oef_answer_option1..., (for reuse applet options or embed options for example, if one wants to use the anstype several times in the same html page, it is recommanded to use oef_answer_option$i indexed by the answer's number). If you use an external software, use the variable ans_require (best if there is a version number). Add the help in scripts/help/anstype and scripts/help/anstype.$lang and in the list help/$lang/reply.phtml.
See the lists of the anstype in the OEF documentation even if they can be used in any pedagogical modules (with adaptation of the syntax).

## Themes

# To add a theme:

1. Decide on the name of the theme. If the theme is not intended for
publication, please put it under the subdirectory "local":
local/1, local/YourName, etc.

Say the name is local/1.

2. Copy the content of public_html/themes/standard to
public_html/themes/local/1, and modify.

- un fichier css global est créé par le script mkcss.pl dans themes.
Ce script concatene et minimise les fichiers css dont la liste est dans le fichier css.css.template (respecter la syntaxe ...).
Vous pouvez ainsi utiliser des fichiers css communs dans themes/_css des fichiers d'autres thèmes (à manier avec précaution) ou dans le répertoire local/1/_css de votre thème.

- Si vous désirez garder certains fichiers sans changement,
il est conseillé de faire plutôt un changement de fichiers.
Par exemple, si vous désirez conserver sans modification le fichier supervisor.phtml
créez-le en écrivant simplement par exemple
!changeto themes/standard/supervisor.phtml

- Le fichier local.phtml.template une fois changé en local_phtml.fr

- vous pouvez changer le "vocabulaire" dans la version de langue xx
(par exemple xx=fr) de la manière suivante :
créez un répertoire lang.
Si vous désirez changer la définition des noms
définis dans html, faites-le dans un fichier
lang/home_names.xx.
Si les définitions sont faites dans un module administratif,
par exemple dans modules/adm/class/exam/lang/names.phtml.xx, faites-le dans un fichier de nom
adm_class_exam_lang_names.phtml.xx

- il est possible d'utiliser les "widgets" du répertoire themes/_widgets

widget front.phtml:
!read themes/_widgets/frontmsg.phtml local/data/news.fr blocnews blocexamples
argument: nom_du_module nom_du_bloc_news nom_du_bloc_exemple
(le module doit être dans local/data)
css nécessaires (à rajouter dans css.css.template)
_css/news.css _css/foundation_button.css _css/foundation_animation.css

À faire :

- nettoyer un peu plus les fichiers pour n'avoir qu'une succession
de widgets.
- bientôt un appel du type
!read themes/_widgets/visitormenubox.phtml
lira s'il existe themes/local/1/_widgets/visitormenubox.phtml dans themes/local/1/_widgets et sinon dans themes/_widgets.

* wims_homeref_n1 : lien sur feuille, séquence, aide, about, resume, divers ! print
* wims_homeref_n3 : était prévu pour des tabs, ne contient rien à supprimer
* wims_homeref_n4 : contrôle des scores par l'élève
* wims_homeref_n5 contient pour l'instant uniquement l'aide feedback des exos


See here

See here

## Icones

See here and See here

## Help for script library

# Model for an slib
The first part (before :proc) is for the documentation.

You can also put the documentation part (everything except slib_author)
in multiple files, one per lang in scripts/help/lang/slib/...
if you want it to be translated.
##############

!if $wims_read_parm!=slib_header !goto proc !endif slib_author=Firstname, Lastname slib_parms=3\ default, explanation\ default, explanation\ default, explanation slib_example=example1\ example2 slib_require= slib_out= result of the slib slib_comment= more explanation !exit :proc proc !distribute items$wims_read_parm into slib_xx, slib_yy, slib_zz, and so on

...

calculation

slib_out=

##############

The result must be in the variable slib_out.

Please prefix all the variables names by slib_.


## Debugging methods

We list here some debugging methods of an administrative module.
• You can add anywhere in a module file writen in wims language (this excludes for instance shell files) a line starting with the command !debug , followed by a string that may contain variable names (preceeded by a $sign) to get their values. For instance : !debug The score of$user is \$score
If the program execution tries to execute such a line, it will stop there, displaying an error message containing your string with the variable names replaced by their values. In the above example, the program displays for instance a debugging message containing
The score of Ted Watson is 7
• All files and line numbers processed when we issue a wims command can be stored for debugging purposes in a special file named trace.txt in the tmp/sessions/XXXX directory where XXXX is the session number. This debugging trace is in action each time the wims command is executed from a server administrator IP and the debug mode is enabled (it is then written tmp_debug=yes in log/wims.conf). You can add a tmp_debug_var variable to the log/wims.conf file and assign to it as values the list of variables whose evolution you want to know when running the program. You can also add a tmp_debug_use_var variable to the log/wims.conf file and assign to it as values a list of variables: each time one of this variable is used, its value is put in the debugging trace.
• When the server is configured to be in debug mode, peripheral software error messages are displayed at the bottom of the html page.

## Change log

See here

Afin de tester le navigateur que vous utilisez, veuillez taper le mot wims ici : puis appuyez sur Entrer''.