foresight_expression
foresight_expression, arithmetic expressions of gnuplot
usingfields and plotted functions.
An expression such as ($2*1e3) or ($3 > 0 ? log10($3) : 1/0) is compiled once into stack code and evaluated on each data row; compiled with a dummy variable, sin(x)/x is a function evaluated at sample abscissae (value_at), where columns are errors. The semantics are gnuplot's:
- operators, loosest first:
?:,||,&&,== !=,< <= > >=,+ -,* / %, unary- + !,**(right associative, so-2**2is -4 and2**3**2is 512);&&,||and?:evaluate only what they need; - operands: numbers,
$Nandcolumn(N)(column N of the row, 0 is the point number),column("name")(the column of that header, seeresolve),pi, and the functionsabs acos asin atan atan2 ceil cos cosh exp floor int log log10 sgn sin sinh sqrt tan tanh, and gnuplot's special functions of foresight_mathlib (erf,gamma,igamma,besj0,lambertw, ...); - with a
symbols_object, user variables (a = 2: their value when the expression is compiled, integer or real) and user functions (f(x, y) = ...: compiled inline where called, the arguments read from their stack slots; a call of a function already being compiled, a recursion, jumps to a copy of its body compiled once after the main code, run on a call stack: past 251 nested calls, gnuplot'srecursion depth limit exceeded), as gnuplot'sa = 2andf(x) = a*sin(x); - integer constants are integers:
1/2is 0,-5/2is -2,7/2.is 3.5; an integer overflow gives a real; columns are real;floor,ceil,int,sgn, comparisons and logical operators give integers; an integer overflow of+,-,*and**followsoverflow_mode(gnuplotset|unset overflow, global as gnuplot's): a real (default), wrapped (+and-only,unset overflow), NaN or undefined; - a missing cell, a division by zero, a domain error (
sqrt(-1),log(0)) or an overflow make the whole value undefined: NaN, a gap in the plot, as gnuplot's1/0; - compiled with
degrees(gnuplotset angles degrees),sin,cos,tantake degrees andasin,acos,atan,atan2return them.
Strings, as gnuplot's: literals in double quotes (\t, \n, \", \\ escapes) or single quotes (literal), string user variables and functions; a . b joins (b a string or an integer), eq and ne compare, s[i:j] is a substring (1-based, ends clamped, * or nothing for an open end); sprintf (C conversions, from the exact binary value), gprintf, strlen, substr, strstrt, words, word, trim; value("name"), exists("name") (quoted names only). Arrays (symbols_object%declare_array): A[i] an element (an index known now resolved now, else on each row), |A| the size, index(A, value); datablocks (string variables named $NAME): $NAME[i] a line, |$NAME| their number; gnuplot 6.0's split(s [, sep]) (an array: assigned, printed, sized |split(s)|, in index and join) and join(A, sep), their arguments known when compiled. Arithmetic and == read a string's leading number ("3" + 1 is 4); a string as a condition, or where a number cannot be read, is an error of a constant expression and a gap on a data row.
Complex numbers, as gnuplot's: constants {re, im} and I ({0,1}); + - * / ** (gnuplot's formulas: powers in polar form, a negative base with a fractional exponent complex), abs, arg, real, imag, conj, sqrt, exp, log, log10 (of negative reals too), sin, cos, tan, sinh, cosh, tanh, asin, acos, atan, asinh, acosh, atanh (asin, acos off [-1:1] and acosh below 1 too); comparisons <... of the real parts, == != of both; a plotted value whose imaginary part exceeds 1e-8 is undefined (gnuplot's set zero); the other functions of a complex argument are undefined.
Accepted beyond gnuplot: % and the logical operators on reals (gnuplot rejects them), and overflows give a gap where gnuplot stops the plot. Every floating point operation is checked beforehand, so evaluation never raises an IEEE invalid, division by zero or overflow exception.
Source: src/lib/foresight_expression.F90
Dependencies
Contents
- value_object
- instruction_object
- name_object
- frame_object
- user_variable
- user_function
- saved_variable
- value_list
- user_array
- saved_array
- symbols_object
- expression_object
- push
- compile
- compile_expression
- assign
- define
- constant
- text_of
- clear
- set_value
- set_string
- save_variable
- restore
- remove
- remove_prefix
- string_of
- put
- get
- store
- define_block
- value_of
- declare_array
- assign_element
- set_element
- learn_assigned
- get_element
- evaluate_constant
- set_array
- save_array
- restore_array
- datablock_names
- array_value
- store_array
- set_time
- table_cell
- run
- set_column
- set_name
- single_instruction
- check_name
- binary
- integer_binary
- unary_degrees
- unary
- complex_binary
- complex_unary
- inverse_trig
- safe_add
- safe_power
- random_next
- bitwise
- special
- numeric
- condition
- string_binary
- substring
- whole
- string_function
- sprintf_value
- push_instruction
- index_of
- push_array
- push_list
- push_value
- push_name
- push_variable
- push_function
- push_expression
- is_block
- is_array
- array_size
- array_text
- defined
- array_data
- array_index
- variable_index
- function_index
- evaluate
- cells_time
- evaluate_text
- uses_text
- first_column
- plain_column
- reads_column
- name_count
- name_of
- resolve
- value_at
- present_true
- in_level
- binary_code
- real_of
- truth
- logical_value
- int_value
- fits_product
- magnitude
- angle
- complex_value
- divisible
- closing
- top_comma
- split_list
- string_value
- number_text
- undefined_value
- operands
- error_text
- count_words
- nth_word
- trim_blanks
- is_blank
- to_lower
- list_text
- slice_list
- lines_list
- any_name
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
OP_CONSTANT | integer(kind=I4P) | parameter | Push the constant. |
OP_COLUMN | integer(kind=I4P) | parameter | Push column arg. |
OP_COLUMN_OF | integer(kind=I4P) | parameter | Replace the top with the column it numbers. |
OP_NEGATE | integer(kind=I4P) | parameter | Unary minus. |
OP_NOT | integer(kind=I4P) | parameter | Logical not. |
OP_TRUTH | integer(kind=I4P) | parameter | Replace the top with 0 or 1. |
OP_ADD | integer(kind=I4P) | parameter | +; binary operators run from here to OP_NE. |
OP_SUBTRACT | integer(kind=I4P) | parameter | -. |
OP_MULTIPLY | integer(kind=I4P) | parameter | *. |
OP_DIVIDE | integer(kind=I4P) | parameter | /. |
OP_MODULO | integer(kind=I4P) | parameter | %. |
OP_POWER | integer(kind=I4P) | parameter | **. |
OP_ATAN2 | integer(kind=I4P) | parameter | atan2(y, x). |
OP_LT | integer(kind=I4P) | parameter | <. |
OP_LE | integer(kind=I4P) | parameter | <=. |
OP_GT | integer(kind=I4P) | parameter | >. |
OP_GE | integer(kind=I4P) | parameter | >=. |
OP_EQ | integer(kind=I4P) | parameter | ==. |
OP_NE | integer(kind=I4P) | parameter | !=. |
OP_FUNCTION | integer(kind=I4P) | parameter | Function arg of the top. |
OP_JUMP | integer(kind=I4P) | parameter | Jump to arg. |
OP_JUMP_UNLESS | integer(kind=I4P) | parameter | Pop; jump to arg if false. |
OP_AND_JUMP | integer(kind=I4P) | parameter | If the top is false: make it 0, jump to arg; else pop. |
OP_OR_JUMP | integer(kind=I4P) | parameter | If the top is true: make it 1, jump to arg; else pop. |
OP_COLUMN_NAMED | integer(kind=I4P) | parameter | Push the column of header names(arg): undefined until resolved. |
OP_LOAD | integer(kind=I4P) | parameter | Push a copy of stack slot arg (a user function argument). |
SUM_FRAME | character(len=*) | parameter | Frame name of a sum variable (no function is named so). |
OP_COLLAPSE | integer(kind=I4P) | parameter | Drop the arg values under the top (a call's arguments). |
OP_CONCAT | integer(kind=I4P) | parameter | .: string join. |
OP_STREQ | integer(kind=I4P) | parameter | eq. |
OP_STRNE | integer(kind=I4P) | parameter | ne. |
OP_SUBSTRING | integer(kind=I4P) | parameter | s[i:j]: the string and both ends on the stack. |
OP_CALL | integer(kind=I4P) | parameter | String function arg of the top v%i values. |
OP_STRCOL | integer(kind=I4P) | parameter | Replace the top with the text of the column it numbers or names. |
OP_COLUMNHEAD | integer(kind=I4P) | parameter | Replace the top with the header text of the column it numbers. |
OP_TIMECOLUMN | integer(kind=I4P) | parameter | Column (under the top) read as a time with the format (top). |
OP_ELEMENT | integer(kind=I4P) | parameter | Replace the top (an index) with that element of lists(arg). |
OP_RECURSE | integer(kind=I4P) | parameter | Call the body at arg on its v%i arguments (a recursion). |
OP_RETURN | integer(kind=I4P) | parameter | End of a called body: its value replaces its arguments. |
OP_STOP | integer(kind=I4P) | parameter | End of the main code, before the called bodies. |
OP_DEPTH | integer(kind=I4P) | parameter | A call inlined in a called body: check the nested calls. |
OP_BAND | integer(kind=I4P) | parameter | &; the bitwise operators of integers run from here to OP_SHR. |
OP_BOR | integer(kind=I4P) | parameter | |. |
OP_BXOR | integer(kind=I4P) | parameter | ^. |
OP_SHL | integer(kind=I4P) | parameter | <<. |
OP_SHR | integer(kind=I4P) | parameter | >>, logical (gnuplot's on x86). |
OP_BNOT | integer(kind=I4P) | parameter | ~, unary. |
OP_BLOCK | integer(kind=I4P) | parameter | Call the function block blocks(arg) on its v%i arguments. |
OP_RAND | integer(kind=I4P) | parameter | gnuplot's rand(x) of the top: the next pseudo-random number. |
OP_SPECIAL | integer(kind=I4P) | parameter | A special function MATH_FUNCTIONS(arg) (foresight_mathlib) of its MATH_ARGS(arg) arguments. |
OP_ASSIGN | integer(kind=I4P) | parameter | name = value inside an expression: the top stored in the user variable stores(arg) (store_hook), and kept. |
OP_FETCH | integer(kind=I4P) | parameter | Push the user variable stores(arg) as it is now (fetch_hook), v its value when compiled if none (calls 1 when it had one). |
OP_ASSIGN_ELEMENT | integer(kind=I4P) | parameter | name[i] = value inside an expression: the top stored in element i (below it) of the array stores(arg) (element_hook); the index dropped, the value kept. |
OP_VOXEL | integer(kind=I4P) | parameter | voxel(x, y, z): the three tops replaced by the active voxel grid's value there (voxel_hook), gnuplot 6.0's. |
OP_FETCH_ELEMENT | integer(kind=I4P) | parameter | Replace the top (an index) with that element of the array stores(arg) as it is now (element_fetch_hook). |
ROW_FUNCTIONS | character(len=*) | parameter | |
NO_COLUMN | integer(kind=I4P) | parameter | Column of a header name found nowhere: reads nothing. |
DEFAULT_TIMEFMT | character(len=*) | parameter | gnuplot's default set timefmt. |
FUNCTIONS | character(len=*) | parameter | |
STRING_FUNCTIONS | character(len=*) | parameter | |
LEAST_ARGS | integer(kind=I4P) | parameter | |
MOST_ARGS | integer(kind=I4P) | parameter | |
E_NONE | integer(kind=I4P) | parameter | No error. |
E_NONNUMERIC | integer(kind=I4P) | parameter | A string without a leading number in arithmetic. |
E_NOTSTRING | integer(kind=I4P) | parameter | A number given to a string operator or function. |
E_BOOLEAN | integer(kind=I4P) | parameter | A string as a condition. |
E_FORMAT | integer(kind=I4P) | parameter | A bad sprintf/gprintf format. |
E_STRING_ARG | integer(kind=I4P) | parameter | A string printed with a numeric conversion. |
E_NUMBER_ARG | integer(kind=I4P) | parameter | A number printed with %s. |
E_INDEX | integer(kind=I4P) | parameter | An array index out of range. |
E_UNSET | integer(kind=I4P) | parameter | An array element never set. |
E_DEPTH | integer(kind=I4P) | parameter | Too many nested calls of recursive user functions. |
E_BITWISE | integer(kind=I4P) | parameter | A real or a string given to a bitwise operator. |
E_BLOCK | integer(kind=I4P) | parameter | A function block failed: its message in block_message. |
E_UNDEF | integer(kind=I4P) | parameter | The value is gnuplot's undefined one (print shows ``). |
E_UNINIT | integer(kind=I4P) | parameter | An operation on gnuplot's undefined value. |
E_SEED | integer(kind=I4P) | parameter | rand(x): x not an integer seed. |
E_ORDER | integer(kind=I4P) | parameter | A real order of besjn, besyn, besin or expint (order_message). |
E_NOVAR | integer(kind=I4P) | parameter | A variable assigned by an expression read before it has a value. |
E_NOVOXEL | integer(kind=I4P) | parameter | voxel() without an active voxel grid. |
LEVELS | character(len=*) | parameter | C's, as gnuplot. |
MAX_NESTING | integer(kind=I4P) | parameter | Deepest parentheses and unary chains. |
MAX_CALLS | integer(kind=I4P) | parameter | Most nested user function calls (gnuplot's). |
MOST | integer(kind=I8P) | parameter | Largest integer. |
LEAST | integer(kind=I8P) | parameter | Smallest integer. |
OVERFLOW_IGNORE | integer(kind=I4P) | parameter | unset overflow: + and - wrap, * and ** give a real. |
OVERFLOW_FLOAT | integer(kind=I4P) | parameter | set overflow [float]: a real (gnuplot's default). |
OVERFLOW_UNDEFINED | integer(kind=I4P) | parameter | set overflow undefined: the value is undefined. |
OVERFLOW_NAN | integer(kind=I4P) | parameter | set overflow NaN: NaN. |
overflow_mode | integer(kind=I4P) | save | Integer overflow handling, gnuplot's global setting. |
HUGE_REAL | real(kind=R8P) | parameter | Largest real. |
LOG_HUGE | real(kind=R8P) | parameter | Largest safe exp argument. |
LOG_TINY | real(kind=R8P) | parameter | exp of less is 0. |
INT_LIMIT | real(kind=R8P) | parameter | Reals from here on are not I8P integers. |
INT_GUARANTEED | real(kind=R8P) | parameter | gnuplot's LARGEST_GUARANTEED_NONOVERFLOW: int(). |
EXACT_HALF | real(kind=R8P) | parameter | gnuplot's LARGEST_EXACT_INT/2: floor(), ceil(). |
PI | real(kind=R8P) | parameter | pi. |
ZERO_IMAG | real(kind=R8P) | parameter | gnuplot's set zero: a larger imaginary part makes a plotted value undefined. |
block_hook | procedure(block_call_interface) | pointer | The interpreter's runner of function blocks. |
store_hook | procedure(store_interface) | pointer | The interpreter's store of a user variable. |
fetch_hook | procedure(fetch_interface) | pointer | The interpreter's value of a user variable. |
voxel_hook | procedure(voxel_interface) | pointer | The interpreter's active voxel grid. |
element_hook | procedure(element_store_interface) | pointer | The interpreter's store of an array element. |
element_fetch_hook | procedure(element_fetch_interface) | pointer | The interpreter's array element now. |
rand_seeds | integer(kind=I8P) | save | gnuplot's rand seeds (L'Ecuyer's combined generator). |
block_message | character(len=:) | allocatable | Message of the last function block failure. |
Derived Types
value_object
Stack value: an integer, a real or a string, as in gnuplot.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
r | real(kind=R8P) | Real value. | |
i | integer(kind=I8P) | Integer value. | |
is_int | logical | Integer. | |
is_string | logical | String, in s. | |
is_undef | logical | gnuplot's undefined value: an array element without one, a function block's missing return. | |
im | real(kind=R8P) | Imaginary part of a complex value, gnuplot's {re, im}. | |
s | character(len=:) | allocatable | String value. |
instruction_object
Stack code instruction.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
op | integer(kind=I4P) | Operation code. | |
arg | integer(kind=I4P) | Column, function or jump target. | |
v | type(value_object) | Constant. | |
calls | integer(kind=I4P) | OP_RECURSE: the nested calls it adds (the inline ones it is inside). |
name_object
Column header name.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
text | character(len=:) | allocatable | Name. |
frame_object
A user function being compiled inline: its parameters read the stack slots from base.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
name | character(len=:) | allocatable | Function name. |
params | type(name_object) | allocatable | Parameter names. |
base | integer(kind=I4P) | Stack slot of the first argument. |
user_variable
User variable, gnuplot a = 2.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
name | character(len=:) | allocatable | Name. |
v | type(value_object) | Value, integer or real. | |
block | logical | A function block, function $f << EOF (its body the value). |
user_function
User function, gnuplot f(x, y) = ....
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
name | character(len=:) | allocatable | Name. |
params | type(name_object) | allocatable | Parameter names. |
body | character(len=:) | allocatable | Body text. |
saved_variable
A variable's state, kept to be restored: the variable of a do for loop is local to the loop, as gnuplot's.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
name | character(len=:) | allocatable | Name. |
found | logical | It existed. | |
v | type(value_object) | Its value. |
value_list
The elements of an array (gnuplot array A[N]) or the lines of a datablock, indexed at run time.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
items | type(value_object) | allocatable | Elements. |
set | logical | allocatable | The element has a value (an array element may have none). |
user_array
User array, gnuplot array A[N]: elements of any type, some possibly without a value.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
name | character(len=:) | allocatable | Name. |
list | type(value_list) | Elements. |
saved_array
An array's state, kept to be restored: call sets ARGV and restores it after the script.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
a | type(user_array) | The array. | |
found | logical | It existed. |
symbols_object
User variables and functions of a script, gnuplot's: a = 2 stores the value now (integer or real), f(x) = a*x stores the text, compiled inline where it is called, so its variables take their values at that moment (plot time); recursive functions run on a call stack.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
variables | type(user_variable) | allocatable | Variables. |
functions | type(user_function) | allocatable | Functions. |
arrays | type(user_array) | allocatable | Arrays, gnuplot array A[N]. |
timefmt | character(len=:) | allocatable | Time format of timecolumn(N) (gnuplot set timefmt), %d/%m/%y,%H:%M if unallocated. |
assigned | type(name_object) | allocatable | Variables a user function body assigns (f(x) = (a = x, a)): read at run time wherever compiled. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
assign | pass(self) | name = expression. |
put | pass(self) | Set a variable to a typed value (an assignment run by an expression). |
get | pass(self) | Typed value of a variable. |
assign_element | pass(self) | name[index] = expression. |
set_element | pass(self) | Set an array element to a typed value. |
get_element | pass(self) | Typed value of an array element. |
learn_assigned | pass(self) | Read the variables an expression assigns at run time from now on. |
evaluate_constant | pass(self) | Typed value of a constant expression. |
array_data | pass(self) | An array as the lines of a data file (index and value). |
array_text | pass(self) | An array as gnuplot's print shows it. |
array_value | pass(self) | An array or a slice A[i:j] given as text. |
store_array | pass(self) | Set an array to elements. |
declare_array | pass(self) | array name[N] [= [...]], array name = [...]. |
is_array | pass(self) | Whether a name is an array. |
defined | pass(self) | Whether a name is a variable, an array or pi, NaN. |
datablock_names | pass(self) | Names of the datablocks. |
array_size | pass(self) | Size of an array. |
set_array | pass(self) | Set an array to strings (ARGV). |
clear | pass(self) | Forget every symbol. |
constant | pass(self) | Value of a constant expression. |
define | pass(self) | name(params) = body. |
value_of | pass(self) | Value of a variable. |
set_value | pass(self) | Set a variable to a number. |
set_string | pass(self) | Set a variable to a string. |
define_block | pass(self) | Define a function block. |
is_block | pass(self) | Whether a name is a function block. |
save_variable | pass(self) | Keep a variable's state. |
save_array | pass(self) | Keep an array's state. |
restore_array | pass(self) | Restore a kept array's state. |
restore | pass(self) | Restore a kept variable's state. |
remove | pass(self) | Forget a variable. |
remove_prefix | pass(self) | Forget the variables whose name starts with a prefix. |
string_of | pass(self) | Value of a string variable. |
text_of | pass(self) | Value of a constant expression as text. |
array_index | pass(self) | Index of an array, 0 if none. |
function_index | pass(self) | Index of a function, 0 if none. |
store | pass(self) | Set a variable to a typed value. |
variable_index | pass(self) | Index of a variable, 0 if none. |
expression_object
Compiled expression.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
text | character(len=:) | allocatable | Source text. |
code | type(instruction_object) | allocatable | Stack code. |
names | type(name_object) | allocatable | Column header names, column("name"). |
depth | integer(kind=I4P) | Stack size needed. | |
recursive | logical | Calls of recursive functions (OP_RECURSE). | |
degrees | logical | Angles of the trigonometric functions in degrees (gnuplot set angles degrees), else radians. | |
timefmt | character(len=:) | allocatable | Time format of a time field (set xdata time): a plain column then reads a time with it. |
lists | type(value_list) | allocatable | Arrays and datablocks indexed at run time (A[$1]). |
blocks | type(name_object) | allocatable | Function blocks called (OP_BLOCK). |
stores | type(name_object) | allocatable | User variables assigned or read at run time (OP_ASSIGN, OP_FETCH). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
compile | pass(self) | Compile an expression. |
set_time | pass(self) | Read a plain column as a time. |
evaluate | pass(self) | Value on a data row. |
evaluate_text | pass(self) | Text on a data row (a label). |
table_cell | pass(self) | Text of a plot with table field on a data row. |
uses_text | pass(self) | Whether the row cell texts are read. |
first_column | pass(self) | First data column read. |
name_count | pass(self) | Number of column header names. |
name_of | pass(self) | A column header name. |
reads_column | pass(self) | Whether a data column is read. |
plain_column | pass(self) | The data column of a plain column field, 0 if none. |
resolve | pass(self) | Header names to column numbers. |
set_column | pass(self) | Plain column. |
set_name | pass(self) | Plain column of a header name. |
value_at | pass(self) | Value of a function at its variable value. |
Interfaces
push
Append an item through a temporary: nvfortran 26.9 corrupts list = [list, item] (and any list = f(list)) when the items hold deferred-length characters.
Module procedures: push_name, push_variable, push_function, push_expression, push_instruction, push_array, push_list, push_value
Subroutines
compile
Compile text; on error iostat is not 0 and iomsg names the problem and its position.
With variable (gnuplot's dummy x) the expression is a function of it, evaluated by value_at; columns are then errors. The variable is held as the only cell of the row evaluate receives. With degrees true the trigonometric functions work in degrees. With symbols, user variables are constants of their current values and user functions are compiled inline (the dummy variable wins over a user variable of its name, as gnuplot). With sampled (blank-separated names), each name reads the data column of its position, everywhere: gnuplot's sample variables of the '+' and '++' pseudo-files (plot sample [t=0:1] '+' using (t):(t**2)).
subroutine compile(self, text, iostat, iomsg, variable, degrees, symbols, sampled)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | inout | Expression. | |
text | character(len=*) | in | Source text. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
variable | character(len=*) | in | optional | Dummy variable name, for a function. |
degrees | logical | in | optional | Angles in degrees. |
symbols | type(symbols_object) | in | optional | User variables and functions. |
sampled | character(len=*) | in | optional | Sample variables, columns 1, 2, ... |
Call graph
compile_expression
compile, and the syntax check of a user function body: parameters of the function frame_name read the stack slots from 1, and with lenient unknown names and functions are accepted (resolved when called).
Not recursive (nvfortran 26.9 -O2 then loops on a syntax error): the code it runs while compiling (system, the ends of a slice) calls no function block, so it is never entered again.
subroutine compile_expression(self, text, iostat, iomsg, variable, degrees, symbols, frame_name, parameters, lenient, sampled)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | inout | Expression. | |
text | character(len=*) | in | Source text. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
variable | character(len=*) | in | optional | Dummy variable name, for a function. |
degrees | logical | in | optional | Angles in degrees. |
symbols | type(symbols_object) | in | optional | User variables and functions. |
frame_name | character(len=*) | in | optional | Function whose body text is. |
parameters | type(name_object) | in | optional | Its parameters. |
lenient | logical | in | optional | Unknown names accepted. |
sampled | character(len=*) | in | optional | Sample variables, columns 1, 2, ... |
Call graph
assign
gnuplot name = text: the value of the expression now, integer, real or string, kept as a constant (a redefinition replaces it). Columns, undefined values (1/0), type errors and bad names are errors.
Attributes: recursive
subroutine assign(self, name, text, iostat, iomsg, degrees)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | target | Symbols. |
name | character(len=*) | in | Variable name. | |
text | character(len=*) | in | Expression. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
degrees | logical | in | optional | Angles in degrees. |
Call graph
define
gnuplot name(params) = body: the body is checked now, its names resolved when the function is called (a redefinition replaces it). Builtin function names, repeated or bad parameter names and recursion are errors.
subroutine define(self, name, params, body, iostat, iomsg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Function name. | |
params | character(len=*) | in | Parameter names. | |
body | character(len=*) | in | Body. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
Call graph
constant
Value of the constant expression text (numbers, user variables and functions, pi), as a range end [0:2*pi]; columns and undefined values are errors.
Attributes: recursive
subroutine constant(self, text, v, iostat, iomsg, degrees)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | target | Symbols. |
text | character(len=*) | in | Expression. | |
v | real(kind=R8P) | out | Value. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
degrees | logical | in | optional | Angles in degrees. |
Call graph
text_of
Value of the constant expression text as text: a string as it is (is_string), a number as gnuplot's print shows it (3, 2.5, 100.0, 1e+20). Columns, undefined values and type errors are errors.
Attributes: recursive
subroutine text_of(self, text, value, is_string, iostat, iomsg, degrees)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | target | Symbols. |
text | character(len=*) | in | Expression. | |
value | character(len=:) | out | allocatable | Value as text. |
is_string | logical | out | A string. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
degrees | logical | in | optional | Angles in degrees. |
Call graph
clear
Forget every variable and function.
Attributes: pure
subroutine clear(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. |
Call graph
set_value
Set the variable name to the real v (an integer with is_int), creating it: fit sets its parameters and results so. The name is not checked.
Attributes: pure
subroutine set_value(self, name, v, is_int)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Variable name. | |
v | real(kind=R8P) | in | Value. | |
is_int | logical | in | Integer value. |
Call graph
set_string
Set the variable name to the string text, creating it. The name is not checked.
Attributes: pure
subroutine set_string(self, name, text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Variable name. | |
text | character(len=*) | in | Value. |
Call graph
save_variable
The state of the variable name (its value, or that it does not exist), for restore.
Attributes: pure
subroutine save_variable(self, name, saved)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Variable name. | |
saved | type(saved_variable) | out | State. |
Call graph
restore
Restore a variable kept by save_variable: its value, or remove it if it did not exist.
Attributes: pure
subroutine restore(self, saved)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
saved | type(saved_variable) | in | State. |
Call graph
remove
Forget the variable name, if it exists.
Attributes: pure
subroutine remove(self, name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Variable name. |
Call graph
remove_prefix
Forget every variable whose name starts with prefix (gnuplot undefine prefix*).
Attributes: pure
subroutine remove_prefix(self, prefix)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
prefix | character(len=*) | in | Name prefix. |
Call graph
string_of
Value of the string variable name; found false (and text empty) if there is none or it is a number.
Attributes: pure
subroutine string_of(self, name, text, found)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Variable name. | |
text | character(len=:) | out | allocatable | Value. |
found | logical | out | A string variable found. |
Call graph
put
Set the variable name to the typed value v, creating it: an assignment run by an expression (store_hook).
Attributes: pure
subroutine put(self, name, v)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Variable name. | |
v | type(value_object) | in | Value. |
Call graph
get
Typed value of the variable name, found false (and v empty) if none.
Attributes: pure
subroutine get(self, name, v, found)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Variable name. | |
v | type(value_object) | out | Value. | |
found | logical | out | A variable of that name. |
Call graph
store
Set the variable name to v, creating it (by components: nvfortran 26.9 corrupts constructors of types holding deferred-length characters).
Attributes: pure
subroutine store(self, name, v)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Variable name. | |
v | type(value_object) | in | Value. |
Call graph
define_block
gnuplot 6.0 function $name << EOF ... EOF: the function block name, its body the lines body.
Attributes: pure
subroutine define_block(self, name, body)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Block name, $f. | |
body | character(len=*) | in | Its lines, each ended by a new line. |
Call graph
value_of
Value of the variable name (real), found false (and NaN) if none; is_int whether an integer. Its number. A number read. Type error.
Attributes: pure
subroutine value_of(self, name, v, found, is_int)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Variable name. | |
v | real(kind=R8P) | out | Value. | |
found | logical | out | Variable found. | |
is_int | logical | out | optional | Integer value. |
Call graph
declare_array
gnuplot array name[size_text], its elements without a value, or with the values of the constant expressions items (array A[3] = [1, 2, 3], array A = [...], size_text empty: the items' number). A redeclaration replaces the array; a variable of the name is removed.
Attributes: recursive
subroutine declare_array(self, name, size_text, items, iostat, iomsg, degrees)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | target | Symbols. |
name | character(len=*) | in | Array name. | |
size_text | character(len=*) | in | Size expression, empty for the items' number. | |
items | character(len=*) | in | optional | Element expressions. |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
degrees | logical | in | optional | Angles in degrees. |
Call graph
assign_element
gnuplot name[index_text] = text: the element of the array set to the value of the expression now.
Attributes: recursive
subroutine assign_element(self, name, index_text, text, iostat, iomsg, degrees)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | target | Symbols. |
name | character(len=*) | in | Array name. | |
index_text | character(len=*) | in | Index expression. | |
text | character(len=*) | in | Value expression. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
degrees | logical | in | optional | Angles in degrees. |
Call graph
set_element
Set element i of the array name to the typed value v, ok false if no such array or i is out of range.
Attributes: pure
subroutine set_element(self, name, i, v, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Array name. | |
i | integer(kind=I8P) | in | Element. | |
v | type(value_object) | in | Value. | |
ok | logical | out | Set. |
Call graph
learn_assigned
The variables the expression e assigns (name = value) read at run time wherever compiled from now on, as those of a user function body: using (Total = $2 + $3):($4 / Total).
Attributes: pure
subroutine learn_assigned(self, e)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
e | type(expression_object) | in | Compiled expression. |
Call graph
get_element
Typed value of element i of the array name, found false if no such array or i is out of range, set false if the element has no value.
Attributes: pure
subroutine get_element(self, name, i, v, found, set)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Array name. | |
i | integer(kind=I8P) | in | Element. | |
v | type(value_object) | out | Value. | |
found | logical | out | In range. | |
set | logical | out | With a value. |
Call graph
evaluate_constant
Typed value of the constant expression text: columns, undefined values and type errors are errors; with undefined gnuplot's undefined value is not (v%is_undef, a function block's return A[9]).
Attributes: recursive
subroutine evaluate_constant(self, text, v, iostat, iomsg, degrees, undefined)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | target | Symbols. |
text | character(len=*) | in | Expression. | |
v | type(value_object) | out | Value. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
degrees | logical | in | optional | Angles in degrees. |
undefined | logical | in | optional | gnuplot's undefined value accepted. |
Call graph
set_array
Set the array name to the strings texts (gnuplot's ARGV), replacing it. The name is not checked.
Attributes: pure
subroutine set_array(self, name, texts)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Array name. | |
texts | character(len=*) | in | Elements, trailing blanks dropped. |
Call graph
save_array
The state of the array name (its elements, or that it does not exist), for restore_array.
Attributes: pure
subroutine save_array(self, name, saved)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Array name. | |
saved | type(saved_array) | out | State. |
Call graph
restore_array
Restore an array kept by save_array: its elements, or remove it if it did not exist.
Attributes: pure
subroutine restore_array(self, saved)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
saved | type(saved_array) | in | State. |
Call graph
datablock_names
Names of the datablocks (the variables named $NAME).
Attributes: pure
subroutine datablock_names(self, names)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
names | character(len=:) | out | allocatable | Names, blank padded. |
array_value
The elements of text if it is an array, A, or a slice, A[i:j] (gnuplot 6.0: ends known now, an empty or * end the first or the last element, clamped, [] when empty); found false for anything else (A[i], A + 1). String and separator. The top-level comma, 0 if none.
Attributes: recursive
subroutine array_value(self, text, list, found, iostat, iomsg, degrees)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | target | Symbols. |
text | character(len=*) | in | Expression. | |
list | type(value_list) | out | Elements. | |
found | logical | out | An array or a slice. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
degrees | logical | in | optional | Angles in degrees. |
Call graph
store_array
Set the array name to the elements list (gnuplot's B = A[2:3]), replacing a variable or an array of the name.
Attributes: pure
subroutine store_array(self, name, list, iostat, iomsg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | inout | Symbols. | |
name | character(len=*) | in | Array name. | |
list | type(value_list) | in | Elements. | |
iostat | integer(kind=I4P) | out | 0 on success. | |
iomsg | character(len=:) | out | allocatable | Error message. |
Call graph
set_time
Make the field a time field: a plain column is read with timefmt (empty: a number again).
Attributes: pure
subroutine set_time(self, timefmt)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | inout | Expression. | |
timefmt | character(len=*) | in | Time format. |
Call graph
table_cell
A field of gnuplot's plot ... with table on a data row (arguments as evaluate): a string as it is, a number as %g, nan if undefined.
Attributes: recursive
subroutine table_cell(self, row, point, text, is_string, cells, heads, place)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. | |
row | real(kind=R8P) | in | Row cells. | |
point | integer(kind=I4P) | in | Point number. | |
text | character(len=:) | out | allocatable | Text. |
is_string | logical | out | A string value. | |
cells | type(name_object) | in | optional | Row cell texts. |
heads | type(name_object) | in | optional | Header cell texts of the row's dataset. |
place | integer(kind=I4P) | in | optional | Block within the dataset and dataset, from 0. |
Call graph
run
Run the stack code on a data row: top is the typed value, defined false if undefined; error the type error that made it undefined (E_NONE if none: a missing cell, a domain error); cells, heads, place as evaluate. The point. The value. A grid active.
With a value.
The variable has a value.
Attributes: recursive
subroutine run(self, row, point, top, defined, error, cells, heads, place)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. | |
row | real(kind=R8P) | in | Row cells. | |
point | integer(kind=I4P) | in | Point number. | |
top | type(value_object) | out | Value. | |
defined | logical | out | Defined. | |
error | integer(kind=I4P) | out | optional | Type error. |
cells | type(name_object) | in | optional | Row cell texts. |
heads | type(name_object) | in | optional | Header cell texts of the dataset. |
place | integer(kind=I4P) | in | optional | Block within the dataset and dataset. |
Call graph
set_column
Make the expression the plain column c (0 is the point number).
Attributes: pure
subroutine set_column(self, c)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | inout | Expression. | |
c | integer(kind=I4P) | in | Column. |
Call graph
set_name
Make the expression the plain column of header name, as gnuplot using 1:"name".
Attributes: pure
subroutine set_name(self, name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | inout | Expression. | |
name | character(len=*) | in | Column header name. |
Call graph
single_instruction
Make the code the one instruction op arg (by components: nvfortran 26.9 crashes copying an array constructor of a structure constructor whose components hold a deferred-length character, [instruction_object(...)]).
Attributes: pure
subroutine single_instruction(self, op, arg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | inout | Expression. | |
op | integer(kind=I4P) | in | Operation code. | |
arg | integer(kind=I4P) | in | Argument. |
Call graph
check_name
A user symbol name: a letter or _, then letters, digits, _.
Attributes: pure
subroutine check_name(name, iostat, iomsg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | Name. | |
iostat | integer(kind=I4P) | out | 0 if valid. | |
iomsg | character(len=:) | out | allocatable | Error message. |
Call graph
binary
c = a op b: an integer when both are and the result fits, else a real; ok false if undefined.
Attributes: pure
subroutine binary(op, a, b, c, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
op | integer(kind=I4P) | in | Operation code. | |
a | type(value_object) | in | Left operand. | |
b | type(value_object) | in | Right operand. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. |
Call graph
integer_binary
c = i op j on integers; done false when the result is not an integer (overflow, negative power, atan2).
Attributes: pure
subroutine integer_binary(op, i, j, c, done, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
op | integer(kind=I4P) | in | Operation code. | |
i | integer(kind=I8P) | in | Left operand. | |
j | integer(kind=I8P) | in | Right operand. | |
c | type(value_object) | inout | Result. | |
done | logical | out | Integer result computed. | |
ok | logical | inout | Defined. |
Call graph
unary_degrees
c = FUNCTIONS(f)(a) with the angles of the trigonometric functions in degrees; ok false if undefined. The argument in radians, both parts.
Attributes: pure
subroutine unary_degrees(f, a, c, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
f | integer(kind=I4P) | in | Function index. | |
a | type(value_object) | in | Argument. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. |
Call graph
unary
c = FUNCTIONS(f)(a); ok false if undefined.
Attributes: pure, recursive
subroutine unary(f, a, c, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
f | integer(kind=I4P) | in | Function index. | |
a | type(value_object) | in | Argument. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. |
Call graph
complex_binary
c = a op b, one of them complex, by gnuplot's formulas (internal.c); ok false if undefined.
Attributes: pure
subroutine complex_binary(op, a, b, c, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
op | integer(kind=I4P) | in | Operation code. | |
a | type(value_object) | in | Left operand. | |
b | type(value_object) | in | Right operand. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. |
Call graph
complex_unary
c = name(a) for a complex argument (or a negative real one of sqrt, log, log10), by gnuplot's formulas (standard.c); the functions with no complex form here are undefined.
Attributes: pure, recursive
subroutine complex_unary(name, a, c, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | Function name. | |
a | type(value_object) | in | Argument. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. |
Call graph
inverse_trig
c = name(re + i im) of the inverse circular and hyperbolic functions, gnuplot 6.0's formulas (standard.c: f_asin, f_acos, f_atan, f_asinh, f_acosh, f_atanh), their branch cuts and their undefined points included.
Attributes: pure
subroutine inverse_trig(name, re, im, c, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
name | character(len=*) | in | asin, acos, atan, asinh, acosh or atanh. | |
re | real(kind=R8P) | in | Real part. | |
im | real(kind=R8P) | in | Imaginary part. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. |
Call graph
safe_add
z = x + y, undefined on overflow.
Attributes: pure
subroutine safe_add(x, y, z, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
x | real(kind=R8P) | in | Addend. | |
y | real(kind=R8P) | in | Addend. | |
z | real(kind=R8P) | out | Sum. | |
ok | logical | inout | Defined. |
Call graph
safe_power
z = x ** y on reals; undefined when complex (negative base, fractional exponent), infinite or overflowing.
Attributes: pure
subroutine safe_power(x, y, z, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
x | real(kind=R8P) | in | Base. | |
y | real(kind=R8P) | in | Exponent. | |
z | real(kind=R8P) | out | Power. | |
ok | logical | inout | Defined. |
Call graph
random_next
gnuplot 6.0's rand(x) on a, replaced by its value: x = 0 the next number of L'Ecuyer's combined generator (from seeds 1234567890), x < 0 the generator reset first, x > 0 an integer seed first; another x is "Illegal seed value".
subroutine random_next(a, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | inout | Argument, then value. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
bitwise
c = a op b for the bitwise operators, of integers only (gnuplot: "non-integer passed to boolean operator"); the shifts as gnuplot's on x86: the count modulo 64, >> logical.
Attributes: pure
subroutine bitwise(op, a, b, c, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
op | integer(kind=I4P) | in | Operation code. | |
a | type(value_object) | in | Left operand. | |
b | type(value_object) | in | Right operand. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
special
c = special function f (MATH_FUNCTIONS) of args: strings read as numbers; an order (besjn, besyn, besin, expint) must be an integer, as gnuplot (E_ORDER); undefined (ok false) where gnuplot's is, and for a NaN or an infinity.
Attributes: pure
subroutine special(f, args, c, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
f | integer(kind=I4P) | in | Function. | |
args | type(value_object) | inout | Arguments. | |
c | type(value_object) | out | Value. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
numeric
Replace the string a by its leading number, as gnuplot reads a string in arithmetic: blanks, a sign, 0x and hex digits, or digits with a point and a lower case e exponent (an integer without point nor exponent); the rest is ignored. No number: ok false, E_NONNUMERIC.
Attributes: pure
subroutine numeric(a, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | inout | Value. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
condition
A condition must be a number: a string is an error (gnuplot: non-integer passed to boolean operator).
Attributes: pure
subroutine condition(a, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | in | Value. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
string_binary
c = a . b (a a string, b a string or an integer), a eq b, a ne b (strings).
Attributes: pure
subroutine string_binary(op, a, b, c, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
op | integer(kind=I4P) | in | Operation code. | |
a | type(value_object) | in | Left operand. | |
b | type(value_object) | in | Right operand. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
substring
c = a[first:last], 1-based, the ends clamped to the string, empty if they cross.
Attributes: pure
subroutine substring(a, first, last, c, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | in | String. | |
first | type(value_object) | in | First character. | |
last | type(value_object) | in | Last character. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
whole
Integer value of a (a real truncated, a string read as a number), for indices and counts.
Attributes: pure
subroutine whole(a, i, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | in | Value. | |
i | integer(kind=I8P) | out | Integer. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
string_function
c = STRING_FUNCTIONS(f)(args), as gnuplot's. SVG color, #rrggbb or #rrggbbaa (opacity). Value. Read status. A color.
Time read. Text matched.
Attributes: pure
subroutine string_function(f, args, c, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
f | integer(kind=I4P) | in | Function index. | |
args | type(value_object) | in | Arguments. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
sprintf_value
gnuplot's sprintf(format, ...): each C conversion takes the next argument (%s a string, the others a number: d i u o x X c its integer part, f F e E g G its real value), %% is %; once the arguments are used up the rest of the format is copied as it is, extra arguments are ignored.
Attributes: pure
subroutine sprintf_value(args, c, ok, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
args | type(value_object) | in | Format and values. | |
c | type(value_object) | out | Result. | |
ok | logical | inout | Defined. | |
error | integer(kind=I4P) | inout | Type error. |
Call graph
push_instruction
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_instruction(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(instruction_object) | inout | allocatable | List. |
item | type(instruction_object) | in | New item. |
index_of
v as an array index (a real truncated, a string's leading number): false if it is not a number.
Attributes: pure
subroutine index_of(v, i, ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
v | type(value_object) | in | Value. | |
i | integer(kind=I8P) | out | Index. | |
ok | logical | out | A number. |
Call graph
push_array
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_array(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(user_array) | inout | allocatable | List. |
item | type(user_array) | in | New item. |
push_list
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_list(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(value_list) | inout | allocatable | List. |
item | type(value_list) | in | New item. |
push_value
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_value(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(value_object) | inout | allocatable | List. |
item | type(value_object) | in | New item. |
Call graph
push_name
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_name(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(name_object) | inout | allocatable | List. |
item | type(name_object) | in | New item. |
Call graph
push_variable
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_variable(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(user_variable) | inout | allocatable | List. |
item | type(user_variable) | in | New item. |
push_function
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_function(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(user_function) | inout | allocatable | List. |
item | type(user_function) | in | New item. |
push_expression
Append item to list (an unallocated list is empty), through a temporary: see push.
Attributes: pure
subroutine push_expression(list, item)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(expression_object) | inout | allocatable | List. |
item | type(expression_object) | in | New item. |
Functions
is_block
Whether name is a function block.
Attributes: pure
Returns: logical
function is_block(self, name) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Name. |
Call graph
is_array
Whether name is an array.
Attributes: pure
Returns: logical
function is_array(self, name) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Name. |
Call graph
array_size
Size of the array name, 0 if there is none.
Attributes: pure
Returns: integer(kind=I4P)
function array_size(self, name) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Name. |
Call graph
array_text
The array name as gnuplot's print shows it: [1,2.5,"x",] (strings quoted, an element without a value empty); empty if there is no such array.
Attributes: pure
Returns: character(len=:)
function array_text(self, name) result(text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Array name. |
Call graph
defined
Whether name is a user variable, an array, or one of gnuplot's predefined pi and NaN.
Attributes: pure
Returns: logical
function defined(self, name) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Name. |
Call graph
array_data
The array name as data lines (gnuplot's plot A): the index, then the value (a string quoted, NaN for an element without a value); empty if there is no such array.
Attributes: pure
Returns: character(len=:)
function array_data(self, name) result(text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Array name. |
Call graph
array_index
Index of the array name, 0 if none.
Attributes: pure
Returns: integer(kind=I4P)
function array_index(self, name) result(k)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Name. |
Call graph
variable_index
Index of the variable name, 0 if none.
Attributes: pure
Returns: integer(kind=I4P)
function variable_index(self, name) result(k)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Name. |
Call graph
function_index
Index of the function name, 0 if none.
Attributes: pure
Returns: integer(kind=I4P)
function function_index(self, name) result(k)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(symbols_object) | in | Symbols. | |
name | character(len=*) | in | Name. |
Call graph
evaluate
Value on a data row: row holds its cells (NaN if missing), point is its point number (column 0).
cells are the texts of the row cells (strcol), heads those of the first row of its dataset (columnhead), place its block within the dataset and its dataset (the pseudo-columns -1 and -2), all from 0; without them those functions and pseudo-columns are undefined. A complex value is undefined, or its real part with real_part (gnuplot's fit).
NaN if undefined. Every floating point operation is checked beforehand, so no IEEE exception is raised.
Attributes: recursive
Returns: real(kind=R8P)
function evaluate(self, row, point, cells, heads, place, real_part) result(v)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. | |
row | real(kind=R8P) | in | Row cells. | |
point | integer(kind=I4P) | in | Point number. | |
cells | type(name_object) | in | optional | Row cell texts. |
heads | type(name_object) | in | optional | Header cell texts of the row's dataset. |
place | integer(kind=I4P) | in | optional | Block within the dataset and dataset, from 0. |
real_part | logical | in | optional | A complex value's real part, not undefined. |
Call graph
cells_time
The time format reads from cell c on, the following cells joined by a blank as many times as the format has blanks (a time 2024-03-01 10:00 spans two whitespace separated cells, as gnuplot reads it); NaN if it does not match.
Attributes: pure
Returns: real(kind=R8P)
function cells_time(cells, c, format) result(t)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
cells | type(name_object) | in | Row cell texts. | |
c | integer(kind=I4P) | in | First cell. | |
format | character(len=*) | in | Time format. |
Call graph
evaluate_text
Text on a data row (arguments as evaluate), as gnuplot's label and tick label fields: a string value as it is; a number, the text of the first column the expression reads (gnuplot's using 1:2:($2*2) with labels writes the text of column 2), or the number as %g if it reads none; empty if undefined.
Attributes: recursive
Returns: character(len=:)
function evaluate_text(self, row, point, cells, heads, place) result(text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. | |
row | real(kind=R8P) | in | Row cells. | |
point | integer(kind=I4P) | in | Point number. | |
cells | type(name_object) | in | optional | Row cell texts. |
heads | type(name_object) | in | optional | Header cell texts of the row's dataset. |
place | integer(kind=I4P) | in | optional | Block within the dataset and dataset, from 0. |
Call graph
uses_text
Whether the expression reads the texts of the row cells (strcol), which the data must then keep.
Attributes: elemental
Returns: logical
function uses_text(self) result(uses)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. |
Call graph
first_column
First data column (from 1) the expression reads, 0 if none (an unresolved name is none): the column whose header titles the item, as gnuplot title columnhead.
Attributes: pure
Returns: integer(kind=I4P)
function first_column(self) result(c)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. |
Call graph
plain_column
The data column (from 1) of a plain column field (using 2, using "name" once resolved), 0 for any other expression ($2, ($2*2), column 0): gnuplot skips a point whose plain column holds no number, and leaves an expression on it undefined.
Attributes: pure
Returns: integer(kind=I4P)
function plain_column(self) result(c)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. |
Call graph
reads_column
Whether the expression reads the data column c (from 1): as a plain column or $c. A column read through column(expr) is known only when evaluated: a missing cell there reads as undefined (gnuplot reads the column the expression asks for, histograms.dem's column(i) with set datafile missing).
Attributes: pure
Returns: logical
function reads_column(self, c) result(reads)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. | |
c | integer(kind=I4P) | in | Column. |
name_count
Number of column header names used.
Attributes: elemental
Returns: integer(kind=I4P)
function name_count(self) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. |
Call graph
name_of
The k-th column header name.
Attributes: pure
Returns: character(len=:)
function name_of(self, k) result(name)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. | |
k | integer(kind=I4P) | in | Name index. |
Call graph
resolve
The expression with its column header names replaced by their column numbers in header (the names of columns 1, 2, ...; trailing blanks ignored); a name not in it reads no column: undefined.
Attributes: pure
Returns: type(expression_object)
function resolve(self, header) result(resolved)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. | |
header | character(len=*) | in | Column names. |
Call graph
value_at
Value of an expression compiled with a dummy variable at the variable value x; NaN if undefined (a complex value too, unless real_part: its real part).
Attributes: recursive
Returns: real(kind=R8P)
function value_at(self, x, real_part) result(v)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(expression_object) | in | Expression. | |
x | real(kind=R8P) | in | Variable value. | |
real_part | logical | in | optional | A complex value's real part. |
Call graph
present_true
Whether the optional flag is present and true.
Attributes: pure
Returns: logical
function present_true(flag) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
flag | logical | in | optional | Flag. |
Call graph
in_level
Whether operator is a binary operator of grammar level level.
Attributes: pure
Returns: logical
function in_level(operator, level) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
operator | character(len=*) | in | Operator. | |
level | integer(kind=I4P) | in | Level in LEVELS. |
binary_code
Operation code of a binary operator.
Attributes: pure
Returns: integer(kind=I4P)
function binary_code(operator) result(op)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
operator | character(len=*) | in | Operator. |
real_of
Real value of a.
Attributes: pure
Returns: real(kind=R8P)
function real_of(a) result(r)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | in | Value. |
Call graph
truth
Whether a is not zero.
Attributes: pure
Returns: logical
function truth(a) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | in | Value. |
Call graph
logical_value
Integer 1 or 0.
Attributes: pure
Returns: type(value_object)
function logical_value(yes) result(a)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
yes | logical | in | Truth. |
Call graph
int_value
Integer value.
Attributes: pure
Returns: type(value_object)
function int_value(i) result(a)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
i | integer(kind=I8P) | in | Integer. |
Call graph
fits_product
Whether i*j fits an I8P integer.
Attributes: pure
Returns: logical
function fits_product(i, j) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
i | integer(kind=I8P) | in | Factor. | |
j | integer(kind=I8P) | in | Factor. |
Call graph
magnitude
gnuplot's magnitude of a complex value, without spurious overflow.
Attributes: pure
Returns: real(kind=R8P)
function magnitude(a) result(m)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | in | Value. |
Call graph
angle
gnuplot's angle of a complex value: 0 or pi for a real, atan2 else.
Attributes: pure
Returns: real(kind=R8P)
function angle(a) result(t)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | in | Value. |
Call graph
complex_value
The value {re, im} (a real when im is 0).
Attributes: pure
Returns: type(value_object)
function complex_value(re, im) result(c)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
re | real(kind=R8P) | in | Real part. | |
im | real(kind=R8P) | in | Imaginary part. |
Call graph
divisible
Whether x / y is finite.
Attributes: pure
Returns: logical
function divisible(x, y) result(ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
x | real(kind=R8P) | in | Dividend. | |
y | real(kind=R8P) | in | Divisor. |
Call graph
closing
Position of the parenthesis closing the one at open in text (quotes skipped), 0 if none.
Attributes: pure
Returns: integer(kind=I4P)
function closing(text, open) result(k)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text. | |
open | integer(kind=I4P) | in | Opening parenthesis. |
Call graph
top_comma
Position of the first comma of text outside quotes and brackets, 0 if none.
Attributes: pure
Returns: integer(kind=I4P)
function top_comma(text) result(k)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text. |
Call graph
split_list
gnuplot 6.0's split: the pieces of string between occurrences of sep (each kept, blanks too), or its words for a blank or empty sep (runs of white space between them); none for an empty string.
Attributes: pure
Returns: type(value_list)
function split_list(string, sep) result(list)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
string | character(len=*) | in | String. | |
sep | character(len=*) | in | Separator. |
Call graph
string_value
String value.
Attributes: pure
Returns: type(value_object)
function string_value(text) result(a)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text. |
Call graph
number_text
a as text: a string as it is, an integer in decimal, a real as gnuplot's print (%.15g, .0 if integral).
Attributes: pure
Returns: character(len=:)
function number_text(a) result(text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | type(value_object) | in | Value. |
Call graph
undefined_value
gnuplot's undefined value (by components: nvfortran 26.9 crashes on its constructor here).
Attributes: pure
Returns: type(value_object)
function undefined_value() result(a)Call graph
operands
Stack values the operation op reads (nargs, its v%i, for a string function call), 0 for those that only move them (a load, a call's arguments, a return).
Attributes: pure
Returns: integer(kind=I4P)
function operands(op, nargs) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
op | integer(kind=I4P) | in | Operation code. | |
nargs | integer(kind=I4P) | in | Arguments of OP_CALL. |
Call graph
error_text
Message of a type error.
Attributes: pure
Returns: character(len=:)
function error_text(error) result(text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
error | integer(kind=I4P) | in | Error code. |
Call graph
count_words
Number of blank-separated words of text.
Attributes: pure
Returns: integer(kind=I4P)
function count_words(text) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text. |
Call graph
nth_word
Word k (from 1) of text, empty if none.
Attributes: pure
Returns: character(len=:)
function nth_word(text, k) result(w)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text. | |
k | integer(kind=I8P) | in | Word number. |
Call graph
trim_blanks
text without leading and trailing blanks (spaces, tabs, new lines).
Attributes: pure
Returns: character(len=:)
function trim_blanks(text) result(t)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Text. |
Call graph
is_blank
Whether c is a space, a tab or a new line.
Attributes: elemental
Returns: logical
function is_blank(c) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
c | character(len=1) | in | Character. |
Call graph
to_lower
Lower case of an ASCII letter.
Attributes: pure
Returns: character(len=1)
function to_lower(c) result(l)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
c | character(len=1) | in | Character. |
Call graph
list_text
Elements as gnuplot's print shows an array: [1,2.5,"x",] (strings quoted, an element without a value empty).
Attributes: pure
Returns: character(len=:)
function list_text(list) result(text)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(value_list) | in | Elements. |
Call graph
slice_list
Elements first to last of list, clamped to it (gnuplot's A[0:9]), none if first > last.
Attributes: pure
Returns: type(value_list)
function slice_list(list, first, last) result(piece)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(value_list) | in | Elements. | |
first | integer(kind=I8P) | in | First index. | |
last | integer(kind=I8P) | in | Last index. |
Call graph
lines_list
The lines of a datablock text (each ended by a newline) as string elements.
Attributes: pure
Returns: type(value_list)
function lines_list(text) result(list)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
text | character(len=*) | in | Datablock text. |
Call graph
any_name
Whether list holds name.
Attributes: pure
Returns: logical
function any_name(list, name) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
list | type(name_object) | in | List. | |
name | character(len=*) | in | Name. |
Call graph