Numworks Epsilon  1.4.1
Graphing Calculator Operating System
Code Namespace Reference

Namespaces

 Helpers
 

Classes

class  App
 
class  ConsoleController
 
class  ConsoleEditCell
 
class  ConsoleLine
 
class  ConsoleLineCell
 
class  ConsoleStore
 
class  EditorController
 
class  MenuController
 
class  PythonToolbox
 
class  SandboxController
 
class  Script
 
class  ScriptNode
 
class  ScriptNodeCell
 
class  ScriptParameterController
 
class  ScriptStore
 
class  ScriptTemplate
 
class  VariableBoxController
 

Functions

constexpr ScriptTemplate emptyScriptTemplate (".py", R"(from math import * )")
 
constexpr ScriptTemplate factorialScriptTemplate ("factorial.py", R"(def factorial(n): if n == 0: return 1 else: return n * factorial(n-1))")
 
constexpr ScriptTemplate fibonacciScriptTemplate ("fibonacci.py", R"(def fibo(n): a=0 b=1 for i in range(1,n+1): c=a+b a=b b=c return a def fibo2(n): if n==0: return 0 elif n==1 or n==2: return 1 return fibo2(n-1)+fibo2(n-2))")
 
constexpr ScriptTemplate mandelbrotScriptTemplate ("mandelbrot.py", R"(# This script draws a Mandelbrot fractal set # N_iteration: degree of precision import kandinsky def mandelbrot(N_iteration): for x in range(320): for y in range(222): # Compute the mandelbrot sequence for the point c = (c_r, c_i) with start value z = (z_r, z_i) z = complex(0,0) # Rescale to fit the drawing screen 320x222 c = complex(3.5*x/319-2.5, -2.5*y/221+1.25) i = 0 while (i < N_iteration) and abs(z) < 2: i = i + 1 z = z*z+c # Choose the color of the dot from the Mandelbrot sequence rgb = int(255*i/N_iteration) col = kandinsky.color(int(rgb),int(rgb*0.75),int(rgb*0.25)) # Draw a pixel colored in 'col' at position (x,y) kandinsky.set_pixel(x,y,col))")
 
constexpr ScriptTemplate polynomialScriptTemplate ("polynomial.py", R"(from math import * # roots(a,b,c) computes the solutions of the equation a*x**2+b*x+c=0 def roots(a,b,c): delta = b*b-4*a*c if delta == 0: return -b/(2*a) elif delta > 0: x_1 = (-b-sqrt(delta))/(2*a) x_2 = (-b+sqrt(delta))/(2*a) return x_1, x_2 else: return None)")
 

Variables

const ToolboxMessageTree forLoopChildren [forLoopChildrenCount]
 
const ToolboxMessageTree ifStatementChildren [ifStatementChildrenCount]
 
const ToolboxMessageTree whileLoopChildren [whileLoopChildrenCount]
 
const ToolboxMessageTree conditionsChildren [conditionsChildrenCount]
 
const ToolboxMessageTree loopsAndTestsChildren [loopsAndTestsChildrenCount]
 
const ToolboxMessageTree MathModuleChildren [MathModuleChildrenCount]
 
const ToolboxMessageTree KandinskyModuleChildren [KandinskyModuleChildrenCount]
 
const ToolboxMessageTree RandomModuleChildren [RandomModuleChildrenCount]
 
const ToolboxMessageTree CMathModuleChildren [CMathModuleChildrenCount]
 
const ToolboxMessageTree modulesChildren [modulesChildrenCount]
 
const ToolboxMessageTree catalogChildren [catalogChildrenCount]
 
const ToolboxMessageTree functionsChildren [functionsChildrenCount]
 
const ToolboxMessageTree menu [menuChildrenCount]
 
const ToolboxMessageTree toolboxModel = ToolboxMessageTree(I18n::Message::Toolbox, I18n::Message::Default, I18n::Message::Default, menu, menuChildrenCount)
 

Function Documentation

◆ emptyScriptTemplate()

constexpr ScriptTemplate Code::emptyScriptTemplate ( ".py"  ,
R"(from math import *)"   
)

◆ factorialScriptTemplate()

constexpr ScriptTemplate Code::factorialScriptTemplate ( "factorial.py"  ,
R"(def factorial(n): if n == 0: return 1 else: return n * factorial(n-1))"   
)

◆ fibonacciScriptTemplate()

constexpr ScriptTemplate Code::fibonacciScriptTemplate ( "fibonacci.py"  ,
R"(def fibo(n): a=0 b=1 for i in range(1,n+1): c=a+b a=b b=c return adef fibo2(n): if n==0: return 0 elif n==1 or n==2: return 1 return fibo2(n-1)+fibo2(n-2))"   
)

◆ mandelbrotScriptTemplate()

constexpr ScriptTemplate Code::mandelbrotScriptTemplate ( "mandelbrot.py"  ,
R"(# This script draws a Mandelbrot fractal set# N_iteration: degree of precisionimport kandinskydef mandelbrot(N_iteration): for x in range(320): for y in range(222):# Compute the mandelbrot sequence for the point c = (c_r, c_i) with start value z = (z_r, z_i) z = complex(0,0)# Rescale to fit the drawing screen 320x222 c = complex(3.5*x/319-2.5, -2.5*y/221+1.25) i = 0 while (i < N_iteration) and abs(z) < 2: i = i + 1 z = z*z+c# Choose the color of the dot from the Mandelbrot sequence rgb = int(255*i/N_iteration) col = kandinsky.color(int(rgb),int(rgb*0.75),int(rgb*0.25))# Draw a pixel colored in 'col' at position (x,y) kandinsky.set_pixel(x,y,col))"   
)

◆ polynomialScriptTemplate()

constexpr ScriptTemplate Code::polynomialScriptTemplate ( "polynomial.py"  ,
R"(from math import *# roots(a,b,c) computes the solutions of the equation a*x**2+b*x+c=0def roots(a,b,c): delta = b*b-4*a*c if delta == 0: return -b/(2*a) elif delta > 0: x_1 = (-b-sqrt(delta))/(2*a) x_2 = (-b+sqrt(delta))/(2*a) return x_1, x_2 else: return None)"   
)

Variable Documentation

◆ catalogChildren

const ToolboxMessageTree Code::catalogChildren[catalogChildrenCount]

Definition at line 147 of file python_toolbox.cpp.

◆ CMathModuleChildren

const ToolboxMessageTree Code::CMathModuleChildren[CMathModuleChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::PythonCommandImportCmath, I18n::Message::PythonImportCmath, I18n::Message::PythonCommandImportCmath),
ToolboxMessageTree(I18n::Message::PythonCommandImportFromCmath, I18n::Message::PythonImportFromCmath, I18n::Message::PythonCommandImportFromCmath),
ToolboxMessageTree(I18n::Message::PythonCommandCmathFunction, I18n::Message::PythonCmathFunction, I18n::Message::PythonCommandCmathFunctionWithoutArg),
ToolboxMessageTree(I18n::Message::PythonCommandConstantE, I18n::Message::PythonConstantE, I18n::Message::PythonCommandConstantE),
ToolboxMessageTree(I18n::Message::PythonCommandConstantPi, I18n::Message::PythonConstantPi, I18n::Message::PythonCommandConstantPi),
ToolboxMessageTree(I18n::Message::PythonCommandPhase, I18n::Message::PythonPhase, I18n::Message::PythonCommandPhase),
ToolboxMessageTree(I18n::Message::PythonCommandPolar, I18n::Message::PythonPolar, I18n::Message::PythonCommandPolar),
ToolboxMessageTree(I18n::Message::PythonCommandRect, I18n::Message::PythonRect, I18n::Message::PythonCommandRect),
ToolboxMessageTree(I18n::Message::PythonCommandExpComplex, I18n::Message::PythonExp, I18n::Message::PythonCommandExp),
ToolboxMessageTree(I18n::Message::PythonCommandLogComplex, I18n::Message::PythonLog, I18n::Message::PythonCommandLog),
ToolboxMessageTree(I18n::Message::PythonCommandSqrtComplex, I18n::Message::PythonSqrt, I18n::Message::PythonCommandSqrt),
ToolboxMessageTree(I18n::Message::PythonCommandCosComplex, I18n::Message::PythonCos, I18n::Message::PythonCommandCos),
ToolboxMessageTree(I18n::Message::PythonCommandSinComplex, I18n::Message::PythonSin, I18n::Message::PythonCommandSin)}

Definition at line 126 of file python_toolbox.cpp.

◆ conditionsChildren

const ToolboxMessageTree Code::conditionsChildren[conditionsChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::EqualityConditionWithArg, I18n::Message::Default, I18n::Message::EqualityCondition),
ToolboxMessageTree(I18n::Message::NonEqualityConditionWithArg, I18n::Message::Default, I18n::Message::NonEqualityCondition),
ToolboxMessageTree(I18n::Message::SuperiorStrictConditionWithArg, I18n::Message::Default, I18n::Message::SuperiorStrictCondition),
ToolboxMessageTree(I18n::Message::InferiorStrictConditionWithArg, I18n::Message::Default, I18n::Message::InferiorStrictCondition),
ToolboxMessageTree(I18n::Message::SuperiorConditionWithArg, I18n::Message::Default, I18n::Message::SuperiorCondition),
ToolboxMessageTree(I18n::Message::InferiorConditionWithArg, I18n::Message::Default, I18n::Message::InferiorCondition),
ToolboxMessageTree(I18n::Message::ConditionAnd, I18n::Message::Default, I18n::Message::ConditionAnd),
ToolboxMessageTree(I18n::Message::ConditionOr, I18n::Message::Default, I18n::Message::ConditionOr),
ToolboxMessageTree(I18n::Message::ConditionNot, I18n::Message::Default, I18n::Message::ConditionNot)}

Definition at line 42 of file python_toolbox.cpp.

◆ forLoopChildren

const ToolboxMessageTree Code::forLoopChildren[forLoopChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::ForInRange1ArgLoopWithArg, I18n::Message::Default, I18n::Message::ForInRange1ArgLoop),
ToolboxMessageTree(I18n::Message::ForInRange2ArgsLoopWithArg, I18n::Message::Default, I18n::Message::ForInRange2ArgsLoop),
ToolboxMessageTree(I18n::Message::ForInRange3ArgsLoopWithArg, I18n::Message::Default, I18n::Message::ForInRange3ArgsLoop),
ToolboxMessageTree(I18n::Message::ForInListLoopWithArg, I18n::Message::Default, I18n::Message::ForInListLoop)}

Definition at line 26 of file python_toolbox.cpp.

◆ functionsChildren

const ToolboxMessageTree Code::functionsChildren[functionsChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::PythonCommandDefWithArg, I18n::Message::Default, I18n::Message::PythonCommandDef),
ToolboxMessageTree(I18n::Message::PythonCommandReturn, I18n::Message::Default, I18n::Message::PythonCommandReturn)}

Definition at line 244 of file python_toolbox.cpp.

◆ ifStatementChildren

const ToolboxMessageTree Code::ifStatementChildren[ifStatementChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::IfElseStatementWithArg, I18n::Message::Default, I18n::Message::IfElseStatement),
ToolboxMessageTree(I18n::Message::IfThenStatementWithArg, I18n::Message::Default, I18n::Message::IfThenStatement),
ToolboxMessageTree(I18n::Message::IfElifElseStatementWithArg, I18n::Message::Default, I18n::Message::IfElifElseStatement),
ToolboxMessageTree(I18n::Message::IfAndIfElseStatementWithArg, I18n::Message::Default, I18n::Message::IfAndIfElseStatement),
ToolboxMessageTree(I18n::Message::IfOrIfElseStatementWithArg, I18n::Message::Default, I18n::Message::IfOrIfElseStatement)}

Definition at line 32 of file python_toolbox.cpp.

◆ KandinskyModuleChildren

const ToolboxMessageTree Code::KandinskyModuleChildren[KandinskyModuleChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::PythonCommandImportKandinsky, I18n::Message::PythonImportKandinsky, I18n::Message::PythonCommandImportKandinsky),
ToolboxMessageTree(I18n::Message::PythonCommandImportFromKandinsky, I18n::Message::PythonImportFromKandinsky, I18n::Message::PythonCommandImportFromKandinsky),
ToolboxMessageTree(I18n::Message::PythonCommandKandinskyFunction, I18n::Message::PythonKandinskyFunction, I18n::Message::PythonCommandKandinskyFunctionWithoutArg),
ToolboxMessageTree(I18n::Message::PythonCommandGetPixel, I18n::Message::PythonGetPixel, I18n::Message::PythonCommandGetPixel),
ToolboxMessageTree(I18n::Message::PythonCommandSetPixel, I18n::Message::PythonSetPixel, I18n::Message::PythonCommandSetPixel),
ToolboxMessageTree(I18n::Message::PythonCommandColor, I18n::Message::PythonColor, I18n::Message::PythonCommandColor),
ToolboxMessageTree(I18n::Message::PythonCommandDrawString, I18n::Message::PythonDrawString, I18n::Message::PythonCommandDrawString)}

Definition at line 104 of file python_toolbox.cpp.

◆ loopsAndTestsChildren

const ToolboxMessageTree Code::loopsAndTestsChildren[loopsAndTestsChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::ForLoopMenu, I18n::Message::Default, I18n::Message::Default, forLoopChildren, forLoopChildrenCount),
ToolboxMessageTree(I18n::Message::IfStatementMenu, I18n::Message::Default, I18n::Message::Default, ifStatementChildren, ifStatementChildrenCount),
ToolboxMessageTree(I18n::Message::WhileLoopMenu, I18n::Message::Default, I18n::Message::Default, whileLoopChildren, whileLoopChildrenCount),
ToolboxMessageTree(I18n::Message::ConditionsMenu, I18n::Message::Default, I18n::Message::Default, conditionsChildren, conditionsChildrenCount)}
const ToolboxMessageTree whileLoopChildren[whileLoopChildrenCount]
const ToolboxMessageTree forLoopChildren[forLoopChildrenCount]
const ToolboxMessageTree conditionsChildren[conditionsChildrenCount]
const ToolboxMessageTree ifStatementChildren[ifStatementChildrenCount]

Definition at line 53 of file python_toolbox.cpp.

◆ MathModuleChildren

const ToolboxMessageTree Code::MathModuleChildren[MathModuleChildrenCount]

Definition at line 59 of file python_toolbox.cpp.

◆ menu

const ToolboxMessageTree Code::menu[menuChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::LoopsAndTests, I18n::Message::Default, I18n::Message::Default, loopsAndTestsChildren, loopsAndTestsChildrenCount),
ToolboxMessageTree(I18n::Message::Modules, I18n::Message::Default, I18n::Message::Default, modulesChildren, modulesChildrenCount),
ToolboxMessageTree(I18n::Message::Catalog, I18n::Message::Default, I18n::Message::Default, catalogChildren, catalogChildrenCount),
ToolboxMessageTree(I18n::Message::Functions, I18n::Message::Default, I18n::Message::Default, functionsChildren, functionsChildrenCount)}
const ToolboxMessageTree modulesChildren[modulesChildrenCount]
const ToolboxMessageTree catalogChildren[catalogChildrenCount]
const ToolboxMessageTree functionsChildren[functionsChildrenCount]
const ToolboxMessageTree loopsAndTestsChildren[loopsAndTestsChildrenCount]

Definition at line 248 of file python_toolbox.cpp.

◆ modulesChildren

const ToolboxMessageTree Code::modulesChildren[modulesChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::MathModule, I18n::Message::Default, I18n::Message::Default, MathModuleChildren, MathModuleChildrenCount),
ToolboxMessageTree(I18n::Message::CmathModule, I18n::Message::Default, I18n::Message::Default, CMathModuleChildren, CMathModuleChildrenCount),
ToolboxMessageTree(I18n::Message::RandomModule, I18n::Message::Default, I18n::Message::Default, RandomModuleChildren, RandomModuleChildrenCount),
ToolboxMessageTree(I18n::Message::KandinskyModule, I18n::Message::Default, I18n::Message::Default, KandinskyModuleChildren, KandinskyModuleChildrenCount)}
const ToolboxMessageTree CMathModuleChildren[CMathModuleChildrenCount]
const ToolboxMessageTree MathModuleChildren[MathModuleChildrenCount]
const ToolboxMessageTree KandinskyModuleChildren[KandinskyModuleChildrenCount]
const ToolboxMessageTree RandomModuleChildren[RandomModuleChildrenCount]

Definition at line 141 of file python_toolbox.cpp.

◆ RandomModuleChildren

const ToolboxMessageTree Code::RandomModuleChildren[RandomModuleChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::PythonCommandImportRandom, I18n::Message::PythonImportRandom, I18n::Message::PythonCommandImportRandom),
ToolboxMessageTree(I18n::Message::PythonCommandImportFromRandom, I18n::Message::PythonImportFromRandom, I18n::Message::PythonCommandImportFromRandom),
ToolboxMessageTree(I18n::Message::PythonCommandRandomFunction, I18n::Message::PythonRandomFunction, I18n::Message::PythonCommandRandomFunctionWithoutArg),
ToolboxMessageTree(I18n::Message::PythonCommandGetrandbits, I18n::Message::PythonGetrandbits, I18n::Message::PythonCommandGetrandbits),
ToolboxMessageTree(I18n::Message::PythonCommandSeed, I18n::Message::PythonSeed, I18n::Message::PythonCommandSeed),
ToolboxMessageTree(I18n::Message::PythonCommandRandrange, I18n::Message::PythonRandrange, I18n::Message::PythonCommandRandrange),
ToolboxMessageTree(I18n::Message::PythonCommandRandint, I18n::Message::PythonRandint, I18n::Message::PythonCommandRandint),
ToolboxMessageTree(I18n::Message::PythonCommandChoice, I18n::Message::PythonChoice, I18n::Message::PythonCommandChoice),
ToolboxMessageTree(I18n::Message::PythonCommandRandom, I18n::Message::PythonRandom, I18n::Message::PythonCommandRandom),
ToolboxMessageTree(I18n::Message::PythonCommandUniform, I18n::Message::PythonUniform, I18n::Message::PythonCommandUniform)
}

Definition at line 113 of file python_toolbox.cpp.

◆ toolboxModel

const ToolboxMessageTree Code::toolboxModel = ToolboxMessageTree(I18n::Message::Toolbox, I18n::Message::Default, I18n::Message::Default, menu, menuChildrenCount)

Definition at line 254 of file python_toolbox.cpp.

◆ whileLoopChildren

const ToolboxMessageTree Code::whileLoopChildren[whileLoopChildrenCount]
Initial value:
= {
ToolboxMessageTree(I18n::Message::WhileLoopWithArg, I18n::Message::Default, I18n::Message::WhileLoop)}

Definition at line 39 of file python_toolbox.cpp.