[ << ] | [ < ] | [ 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 (
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_parse_textw (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:
void
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_line (HMGL
gr,HMPR
p,const char *
str,int
pos) - C function:
int
mgl_parse_linew (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
:mglData
Calc (const char *
formula) - Method on
mglParse
:mglData
Calc (const wchar_t *
formula) - C function:
HMDT
mgl_parser_calc (HMPR
p,const char *
formula) - C function:
HMDT
mgl_parser_calcw (HMPR
p,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
:void
AddParam (int
n,const char *
str) - Method on
mglParse
:void
AddParam (int
n,const wchar_t *
str) - C function:
void
mgl_parser_add_param (HMPR
p,int
id,const char *
val) - C function:
void
mgl_parser_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
:mglVar *
FindVar (const char *
name) - Method on
mglParse
:mglVar *
FindVar (const wchar_t *
name) - C function:
HMDT
mgl_parser_find_var (HMPR
p,const char *
name) - C function:
HMDT
mgl_parser_find_varw (HMPR
p,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:
HMDT
mgl_parser_add_var (HMPR
p,const char *
name) - C function:
HMDT
mgl_parser_add_varw (HMPR
p,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++):void
DeleteVar (const char *
name) - Method on
mglParse
(C++):void
DeleteVar (const wchar_t *
name) - C function:
void
mgl_parser_del_var (HMPR
p,const char *
name) - C function:
void
mgl_parser_del_varw (HMPR
p,const wchar_t *
name) Function delete the variable with given name.
- Method on
mglParse
(C++):void
DeleteAll () - C function:
void
mgl_parser_del_all (HMPR
p) Function delete all variables in this parser.
- Method on
mglParse
:void
RestoreOnce () - C function:
void
mgl_parser_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
AllowFileIO (bool
a) - C function:
void
mgl_parser_allow_file_io (HMPR
p,int
a) Allow reading/saving files 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
:long
GetCmdNum () - C function:
long
mgl_parser_cmd_num (HMPR
p) Return the number of registered MGL commands.
- Method on
mglParse
:const char *
GetCmdName (long
id) - C function:
const char *
mgl_parser_cmd_name (HMPR
p,long
id) Return the name of command with given id.
- Method on
mglParse
:int
CmdType (const char *
name) - C function:
int
mgl_parser_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 - 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 (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_parser_cmd_desc (HMPR
p,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.