| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
7.3 mglParse class
Class for parsing and executing MGL script. This class is defined in #include <mgl2/mgl.h>.
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 (object derived from mglData class, see MGL variables). These functions can be useful for displaying values of variables (arrays) in some external object (like, window) or for providing access to internal data. Function AllowSetSize() allows one to prevent changing the size of the picture inside the script (forbids the MGL command setsize).
- Constructor on
mglParse:mglParse (boolsetsize=false) - Constructor on
mglParse:mglParse (HMPRpr) - Constructor on
mglParse:mglParse (mglParse &pr) - C function:
HMPRmgl_create_parser () Constructor initializes all values with zero and set AllowSetSize value.
- Destructor on
mglParse:~mglParse () - C function:
voidmgl_delete_parser (HMPRp) Destructor delete parser
- Method on
mglParse:voidExecute (mglGraph *gr,const char *text) - Method on
mglParse:voidExecute (mglGraph *gr,const wchar_t *text) - C function:
voidmgl_parse_text (HMGLgr,HMPRp,const char *text) - C function:
voidmgl_parse_textw (HMGLgr,HMPRp,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:voidExecute (mglGraph *gr,FILE *fp,boolprint=false) - C function:
voidmgl_parse_file (HMGLgr,HMPRp,FILE *fp,intprint) The same as previous but read script from the file fp. If print=
truethen all warnings and information will be printed in stdout.
- Method on
mglParse:intParse (mglGraph *gr,const char *str,longpos=0) - Method on
mglParse:intParse (mglGraph *gr,const wchar_t *str,longpos=0) - C function:
intmgl_parse_line (HMGLgr,HMPRp,const char *str,intpos) - C function:
intmgl_parse_linew (HMGLgr,HMPRp,const wchar_t *str,intpos) 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|nextcommand.
- Method on
mglParse:mglDataCalc (const char *formula) - Method on
mglParse:mglDataCalc (const wchar_t *formula) - C function:
HMDTmgl_parser_calc (HMPRp,const char *formula) - C function:
HMDTmgl_parser_calcw (HMPRp,const wchar_t *formula) Function parses the string formula and return resulting data array. In difference to
AddVar()orFindVar(), it is usual data array which should be deleted after usage.
- Method on
mglParse:voidAddParam (intn,const char *str) - Method on
mglParse:voidAddParam (intn,const wchar_t *str) - C function:
voidmgl_parser_add_param (HMPRp,intid,const char *val) - C function:
voidmgl_parser_add_paramw (HMPRp,intid,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:mglVar *FindVar (const char *name) - Method on
mglParse:mglVar *FindVar (const wchar_t *name) - C function:
HMDTmgl_parser_find_var (HMPRp,const char *name) - C function:
HMDTmgl_parser_find_varw (HMPRp,const wchar_t *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:mglVar *AddVar (const char *name) - Method on
mglParse:mglVar *AddVar (const wchar_t *name) - C function:
HMDTmgl_parser_add_var (HMPRp,const char *name) - C function:
HMDTmgl_parser_add_varw (HMPRp,const wchar_t *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++):voidDeleteVar (const char *name) - Method on
mglParse(C++):voidDeleteVar (const wchar_t *name) - C function:
voidmgl_parser_del_var (HMPRp,const char *name) - C function:
voidmgl_parser_del_varw (HMPRp,const wchar_t *name) Function delete the variable with given name.
- Method on
mglParse(C++):voidDeleteAll () - C function:
voidmgl_parser_del_all (HMPRp) Function delete all variables in this parser.
- Method on
mglParse:voidRestoreOnce () - C function:
voidmgl_parser_restore_once (HMPRp) Restore Once flag.
- Method on
mglParse:voidAllowSetSize (boola) - C function:
voidmgl_parser_allow_setsize (HMPRp,inta) Allow to parse ’setsize’ command or not.
- Method on
mglParse:voidAllowFileIO (boola) - C function:
voidmgl_parser_allow_file_io (HMPRp,inta) Allow reading/saving files or not.
- Method on
mglParse:voidStop () - C function:
voidmgl_parser_stop (HMPRp) Sends stop signal which terminate execution at next command.
- Method on
mglParse:longGetCmdNum () - C function:
longmgl_parser_cmd_num (HMPRp) Return the number of registered MGL commands.
- Method on
mglParse:const char *GetCmdName (longid) - C function:
const char *mgl_parser_cmd_name (HMPRp,longid) Return the name of command with given id.
- Method on
mglParse:intCmdType (const char *name) - C function:
intmgl_parser_cmd_type (HMPRp,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 - data create, 6 - subplot, 7 - program, 8 - 1d plot, 9 - 2d plot, 10 - 3d plot, 11 - dd plot, 12 - vector plot, 13 - axis, 14 - primitives, 15 - axis setup, 16 - text/legend, 17 - data transform.
- Method on
mglParse:const char *CmdFormat (const char *name) - C function:
const char *mgl_parser_cmd_frmt (HMPRp,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_parser_cmd_desc (HMPRp,const char *name) Return the description of MGL command name.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on March 21, 2014 using texi2html 5.0.
