Class: MathGL::MglParse

Inherits:
Object
  • Object
show all
Defined in:
../lib/mathgl/doc/libdoc_parse_en.rb

Overview

MglParse class

Instance Method Summary (collapse)

Instance Method Details

- (nil) add_param(n, str)

Function set the value of n-th parameter as string str (n=0, 1 … 'z'-'a'+10). String str shouldn't contain '$' symbol.

Parameters:

  • n (Integer)
  • str (String)

Returns:

  • (nil)


56
57
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 56

def add_param
end

- (MglVar) add_var(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!

Parameters:

  • name (String)

Returns:

  • (MglVar)


74
75
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 74

def add_var
end

- (nil) allow_dll_call(a)

Allow to parse load command or not.

Parameters:

  • a (bool)

Returns:

  • (nil)


126
127
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 126

def allow_dll_call
end

- (nil) allow_file_io(a)

Allow reading/saving files or not.

Parameters:

  • a (bool)

Returns:

  • (nil)


117
118
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 117

def allow_file_io
end

- (nil) allow_set_size(a)

Allow to parse setsize command or not.

Parameters:

  • a (bool)

Returns:

  • (nil)


108
109
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 108

def allow_set_size
end

- (MglData) calc(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.

Parameters:

  • formula (String)

Returns:



46
47
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 46

def calc
end

- (String) cmd_desc(name)

Return the description of MGL command name.

Parameters:

  • name (String)

Returns:

  • (String)


178
179
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 178

def cmd_desc
end

- (String) cmd_format(name)

Return the format of arguments for MGL command name.

Parameters:

  • name (String)

Returns:

  • (String)


169
170
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 169

def cmd_format
end

- (Integer) cmd_type(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.

Parameters:

  • name (String)

Returns:

  • (Integer)


160
161
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 160

def cmd_type
end

- (nil) delete_all

Function delete all variables and reset list of commands to default one in this parser.

Returns:

  • (nil)


91
92
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 91

def delete_all
end

- (nil) delete_var(name)

Function delete the variable with given name.

Parameters:

  • name (String)

Returns:

  • (nil)


83
84
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 83

def delete_var
end

- (nil) execute(gr, fp, print = false)

The same as previous but read script from the file fp. If print=true then all warnings and information will be printed in stdout.

Parameters:

  • gr (MglGraph)
  • fp (FILE)
  • print (bool) (defaults to: false)

    default=false

Returns:

  • (nil)


15
16
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 15

def execute
end

- (MglVar) find_var(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!

Parameters:

  • name (String)

Returns:

  • (MglVar)


65
66
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 65

def find_var
end

- (String) get_cmd_name(id)

Return the name of command with given id.

Parameters:

  • id (long)

Returns:

  • (String)


151
152
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 151

def get_cmd_name
end

- (long) get_cmd_num

Return the number of registered MGL commands.

Returns:

  • (long)


142
143
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 142

def get_cmd_num
end

- (Integer) parse(gr, str, pos = 0)

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, 4 – strings is not closed. Optional argument pos allows to save the string position in the document (or file) for using for|next command.

Parameters:

  • gr (MglGraph)
  • str (String)
  • pos (long) (defaults to: 0)

    default=0

Returns:

  • (Integer)


37
38
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 37

def parse
end

- (nil) restore_once

Restore Once flag.

Returns:

  • (nil)


99
100
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 99

def restore_once
end

- (nil) stop

Sends stop signal which terminate execution at next command.

Returns:

  • (nil)


134
135
# File '../lib/mathgl/doc/libdoc_parse_en.rb', line 134

def stop
end