[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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
).
mglParse
:
mglParse (bool
setsize=false
)mglParse
:
mglParse (HMPR
pr)mglParse
:
mglParse (mglParse &
pr)HMPR
mgl_create_parser ()Constructor initializes all values with zero and set AllowSetSize value.
mglParse
:
~mglParse ()void
mgl_delete_parser (HMPR
p)Destructor delete parser
mglParse
: HMPR
Self ()Returns the pointer to internal object of type HMPR
.
mglParse
: void
Execute (mglGraph *
gr, const char *
text)mglParse
: void
Execute (mglGraph *
gr, const wchar_t *
text)void
mgl_parse_text (HMGL
gr, HMPR
p, const char *
text)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.
mglParse
: void
Execute (mglGraph *
gr, FILE *
fp, bool
print=false
)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.
mglParse
: int
Parse (mglGraph *
gr, const char *
str, long
pos=0
)mglParse
: int
Parse (mglGraph *
gr, const wchar_t *
str, long
pos=0
)int
mgl_parse_line (HMGL
gr, HMPR
p, const char *
str, int
pos)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.
mglParse
: mglData
Calc (const char *
formula)mglParse
: mglData
Calc (const wchar_t *
formula)HMDT
mgl_parser_calc (HMPR
p, const char *
formula)HMDT
mgl_parser_calcw (HMPR
p, const wchar_t *
formula)Function parses the string formula and return resulting data array. In difference to AddVar()
or FindVar()
, it is usual data array which should be deleted after usage.
mglParse
: void
AddParam (int
n, const char *
str)mglParse
: void
AddParam (int
n, const wchar_t *
str)void
mgl_parser_add_param (HMPR
p, int
id, const char *
val)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.
mglParse
: mglVar *
FindVar (const char *
name)mglParse
: mglVar *
FindVar (const wchar_t *
name)HMDT
mgl_parser_find_var (HMPR
p, const char *
name)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!
mglParse
: mglVar *
AddVar (const char *
name)mglParse
: mglVar *
AddVar (const wchar_t *
name)HMDT
mgl_parser_add_var (HMPR
p, const char *
name)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!
mglParse
(C++): void
DeleteVar (const char *
name)mglParse
(C++): void
DeleteVar (const wchar_t *
name)void
mgl_parser_del_var (HMPR
p, const char *
name)void
mgl_parser_del_varw (HMPR
p, const wchar_t *
name)Function delete the variable specified by its name or by its pointer.
mglParse
(C++): void
DeleteAll ()void
mgl_parser_del_all (HMPR
p)Function delete all variables in this parser.
mglParse
: void
RestoreOnce ()void
mgl_parser_restore_once (HMPR
p)Restore Once flag.
mglParse
: void
AllowSetSize (bool
a)void
mgl_parser_allow_setsize (HMPR
p, int
a)Allow to parse ’setsize’ command or not.
mglParse
: void
AllowFileIO (bool
a)void
mgl_parser_allow_file_io (HMPR
p, int
a)Allow reading/saving files or not.
mglParse
: void
Stop ()void
mgl_parser_stop (HMPR
p)Sends stop signal which terminate execution at next command.
mglParse
: long
GetCmdNum ()long
mgl_parser_cmd_num (HMPR
p)Return the number of registered MGL commands.
mglParse
: const char *
GetCmdName (long
id)const char *
mgl_parser_cmd_name (HMPR
p, long
id)Return the name of command with given id.
mglParse
: int
CmdType (const char *
name)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.
mglParse
: const char *
CmdFormat (const char *
name)const char *
mgl_parser_cmd_frmt (HMPR
p, const char *
name)Return the format of arguments for MGL command name.
mglParse
: const char *
CmdDesc (const char *
name)const char *
mgl_parser_cmd_desc (HMPR
p, const char *
name)Return the description of MGL command name.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] |
This document was generated by Dimitrios Eftaxiopoulos on August 18, 2013 using texi2html 1.82.