[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7.3 mglParse class
Class for parsing and executing MGL script. This class is defined in #include <mgl2/mgl.h>
.
Class mglParse is the interpreter for MGL scripts. The main function of mglParse class is Execute()
. Exactly this function parses and executes the script string-by-string. Also there are subservient functions for the finding and creation of a variable. These functions can be useful for displaying values of variables (arrays) in some external program (in window, for example). Function AllowSetSize()
allows one to prevent changing the size of the picture inside the script (forbids the MGL command setsize
).
- Constructor on
mglParse
:mglParse (
bool
setsize=false
) - Constructor on
mglParse
:mglParse (
HMPR
pr) - Constructor on
mglParse
:mglParse (
mglParse &
pr) - C function:
HMPR
mgl_create_parser () Constructor initializes all values with zero and set AllowSetSize value.
- Destructor on
mglParse
:~mglParse ()
- C function:
void
mgl_delete_parser (HMPR
p) Destructor delete parser
- Method on
mglParse
:void
Execute (mglGraph *
gr,const char *
text) - Method on
mglParse
:void
Execute (mglGraph *
gr,const wchar_t *
text) - C function:
void
mgl_parse_text (HMGL
gr,HMPR
p,const char *
text) - C function:
void
mgl_parsew_text (HMGL
gr,HMPR
p,const wchar_t *
text) Main function in the class. Function parse and execute line-by-line MGL script in array text. Lines are separated by newline symbol ‘\n’ as usual.
- Method on
mglParse
:void
Execute (mglGraph *
gr,FILE *
fp,bool
print=false
) - C function:
int
mgl_parse_file (HMGL
gr,HMPR
p,FILE *
fp,int
print) The same as previous but read script from the file fp. If print=
true
then all warnings and information will be printed in stdout.
- Method on
mglParse
:int
Parse (mglGraph *
gr,const char *
str,long
pos=0
) - Method on
mglParse
:int
Parse (mglGraph *
gr,const wchar_t *
str,long
pos=0
) - C function:
int
mgl_parse (HMGL
gr,HMPR
p,const char *
str,int
pos) - C function:
int
mgl_parsew (HMGL
gr,HMPR
p,const wchar_t *
str,int
pos) Function parses the string str and executes it by using gr as a graphics plotter. Returns the value depending on an error presence in the string str: 0 – no error, 1 – wrong command argument(s), 2 – unknown command, 3 – string is too long. Optional argument pos allows to save the string position in the document (or file) for using
for|next
command.
- Method on
mglParse
:void
AddParam (int
n,const char *
str) - Method on
mglParse
:void
AddParam (int
n,const wchar_t *
str) - C function:
void
mgl_add_param (HMPR
p,int
id,const char *
val) - C function:
void
mgl_add_paramw (HMPR
p,int
id,const wchar_t *
val) Function set the value of n-th parameter as string str (n=0, 1 ... ’z’-’a’+10). String str shouldn’t contain ‘$’ symbol.
- Method on
mglParse
:mglData *
FindVar (const char *
name) - C function:
HMDT
mgl_find_var (HMPR
p,const char *
name) Function returns the pointer to variable with name name or zero if variable is absent. Use this function to put external data array to the script or get the data from the script. You must not delete obtained data arrays!
- Method on
mglParse
:mglData *
AddVar (const char *
name) - C function:
HMDT
mgl_add_var (HMPR
p,const char *
name) Function returns the pointer to variable with name name. If variable is absent then new variable is created with name name. Use this function to put external data array to the script or get the data from the script. You must not delete obtained data arrays!
- Method on
mglParse
(C++):void
DeleteVar (const char *
name) - C function:
void
mgl_del_var (HMPR
p,const char *
name) Function delete the variable specified by its name or by its pointer.
- Method on
mglParse
:void
RestoreOnce () - C function:
void
mgl_restore_once (HMPR
p) Restore Once flag.
- Method on
mglParse
:void
AllowSetSize (bool
a) - C function:
void
mgl_parser_allow_setsize (HMPR
p,int
a) Allow to parse ’setsize’ command or not.
- Method on
mglParse
:void
Stop () - C function:
void
mgl_parser_stop (HMPR
p) Sends stop signal which terminate execution at next command.
- Method on
mglParse
:int
CmdType (const char *
name) - C function:
int
mgl_cmd_type (HMPR
p,const char *
name) Return the type of MGL command name. Type of commands are: 0 – not the command, 1 - data plot, 2 - other plot, 3 - setup, 4 - data handle, 5 - create data, 6 - define subplot, 7 - program flow.
- Method on
mglParse
:const char *
CmdFormat (const char *
name) - C function:
const char *
mgl_cmd_frmt (HMPR
p,const char *
name) Return the format of arguments for MGL command name.
- Method on
mglParse
:const char *
CmdDesc (const char *
name) - C function:
const char *
mgl_cmd_desc (HMPR
p,const char *
name) Return the description of MGL command name.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 13, 2012 using texi2html 5.0.