[code] time module

This commit is contained in:
Damien Nicolet
2018-11-03 16:07:01 +01:00
parent 940270e78a
commit 79bfc7f112
14 changed files with 227 additions and 8 deletions

View File

@@ -93,3 +93,13 @@ PythonTan = "Tangent"
PythonTanh = "Hyperbolic tangent"
PythonTrunc = "x truncated to an integer"
PythonUniform = "Floating point number in [a,b]"
PythonImportFromTime = "Import time module"
PythonImportTime = "Import time module"
PythonTimeFunction = "time module function prefix"
PythonTimeSleepMs = "Sleep for the given duration"
PythonTimeSleep = "Sleep for the given duration"
PythonTimeSleepUs = "Sleep for the given duration"
PythonTimeTicksAdd = "Offset ticks value"
PythonTimeTicksDiff = "Measure ticks difference"
PythonTimeTicksMs = "Increasing millisecond counter"
PythonTimeTicksUs = "Increasing microsecond counter"

View File

@@ -93,3 +93,13 @@ PythonTan = "Tangent"
PythonTanh = "Hyperbolic tangent"
PythonTrunc = "x truncated to an integer"
PythonUniform = "Floating point number in [a,b]"
PythonImportFromTime = "Import time module"
PythonImportTime = "Import time module"
PythonTimeFunction = "time module function prefix"
PythonTimeSleepMs = "Sleep for the given duration"
PythonTimeSleep = "Sleep for the given duration"
PythonTimeSleepUs = "Sleep for the given duration"
PythonTimeTicksAdd = "Offset ticks value"
PythonTimeTicksDiff = "Measure ticks difference"
PythonTimeTicksMs = "Increasing millisecond counter"
PythonTimeTicksUs = "Increasing microsecond counter"

View File

@@ -93,3 +93,13 @@ PythonTan = "Tangent"
PythonTanh = "Hyperbolic tangent"
PythonTrunc = "x truncated to an integer"
PythonUniform = "Floating point number in [a,b]"
PythonImportFromTime = "Import time module"
PythonImportTime = "Import time module"
PythonTimeFunction = "time module function prefix"
PythonTimeSleepMs = "Sleep for the given duration"
PythonTimeSleep = "Sleep for the given duration"
PythonTimeSleepUs = "Sleep for the given duration"
PythonTimeTicksAdd = "Offset ticks value"
PythonTimeTicksDiff = "Measure ticks difference"
PythonTimeTicksMs = "Increasing millisecond counter"
PythonTimeTicksUs = "Increasing microsecond counter"

View File

@@ -93,3 +93,13 @@ PythonTan = "Tangente"
PythonTanh = "Tangente hyperbolique"
PythonTrunc = "Troncature entière"
PythonUniform = "Nombre décimal dans [a,b]"
PythonImportFromTime = "Importation du module time"
PythonImportTime = "Importation du module time"
PythonTimeFunction = "Prefixe fonction du module time"
PythonTimeSleep = "Effectuer une pause"
PythonTimeSleepMs = "Effectuer une pause"
PythonTimeSleepUs = "Effectuer une pause"
PythonTimeTicksAdd = "Ajouter une valeur à un compteur"
PythonTimeTicksDiff = "Différence entre compteurs"
PythonTimeTicksMs = "Compteur croissant (millisecondes)"
PythonTimeTicksUs = "Compteur croissant (microsecondes)"

View File

@@ -93,3 +93,13 @@ PythonTan = "Tangent"
PythonTanh = "Hyperbolic tangent"
PythonTrunc = "x truncated to an integer"
PythonUniform = "Floating point number in [a,b]"
PythonImportFromTime = "Import time module"
PythonImportTime = "Import time module"
PythonTimeFunction = "time module function prefix"
PythonTimeSleepMs = "Sleep for the given duration"
PythonTimeSleep = "Sleep for the given duration"
PythonTimeSleepUs = "Sleep for the given duration"
PythonTimeTicksAdd = "Offset ticks value"
PythonTimeTicksDiff = "Measure ticks difference"
PythonTimeTicksMs = "Increasing millisecond counter"
PythonTimeTicksUs = "Increasing microsecond counter"

View File

@@ -104,3 +104,15 @@ PythonCommandReal = "z.real"
PythonCommandImagWithoutArg = "ø.imag"
PythonCommandRealWithoutArg = "ø.real"
PythonCommandUniform = "uniform(a,b)"
PythonCommandImportFromTime = "from time import *"
PythonCommandImportTime = "import time"
PythonCommandTimeFunction = "time.function"
PythonCommandTimeFunctionWithoutArg = "time.ø"
PythonCommandTimeSleepMs = "sleep_ms(milliseconds)"
PythonCommandTimeSleep = "sleep(seconds)"
PythonCommandTimeSleepUs = "sleep_us(microseconds)"
PythonCommandTimeTicksAdd = "ticks_add(ticks,delta)"
PythonCommandTimeTicksDiff = "ticks_diff(end,start)"
PythonCommandTimeTicksMs = "ticks_ms()"
PythonCommandTimeTicksUs = "ticks_us()"
TimeModule = "time"

View File

@@ -8,7 +8,7 @@ extern "C" {
namespace Code {
static constexpr int catalogChildrenCount = 95;
static constexpr int catalogChildrenCount = 96;
static constexpr int MathModuleChildrenCount = 43;
static constexpr int KandinskyModuleChildrenCount = 7;
static constexpr int CMathModuleChildrenCount = 13;
@@ -19,8 +19,9 @@ static constexpr int functionsChildrenCount = 2;
static constexpr int ifStatementChildrenCount = 5;
static constexpr int loopsAndTestsChildrenCount = 4;
static constexpr int menuChildrenCount = 4;
static constexpr int modulesChildrenCount = 4;
static constexpr int modulesChildrenCount = 5;
static constexpr int whileLoopChildrenCount = 1;
static constexpr int TimeModuleChildrenCount = 10;
const ToolboxMessageTree forLoopChildren[forLoopChildrenCount] = {
@@ -123,6 +124,19 @@ const ToolboxMessageTree RandomModuleChildren[RandomModuleChildrenCount] = {
ToolboxMessageTree(I18n::Message::PythonCommandUniform, I18n::Message::PythonUniform, I18n::Message::PythonCommandUniform)
};
const ToolboxMessageTree TimeModuleChildren[TimeModuleChildrenCount] = {
ToolboxMessageTree(I18n::Message::PythonCommandImportTime, I18n::Message::PythonImportTime, I18n::Message::PythonCommandImportTime),
ToolboxMessageTree(I18n::Message::PythonCommandImportFromTime, I18n::Message::PythonImportFromTime, I18n::Message::PythonCommandImportFromTime),
ToolboxMessageTree(I18n::Message::PythonCommandTimeFunction, I18n::Message::PythonTimeFunction, I18n::Message::PythonCommandTimeFunctionWithoutArg),
ToolboxMessageTree(I18n::Message::PythonCommandTimeSleep, I18n::Message::PythonTimeSleep, I18n::Message::PythonCommandTimeSleep),
ToolboxMessageTree(I18n::Message::PythonCommandTimeSleepMs, I18n::Message::PythonTimeSleepMs, I18n::Message::PythonCommandTimeSleepMs),
ToolboxMessageTree(I18n::Message::PythonCommandTimeSleepUs, I18n::Message::PythonTimeSleepUs, I18n::Message::PythonCommandTimeSleepUs),
ToolboxMessageTree(I18n::Message::PythonCommandTimeTicksMs, I18n::Message::PythonTimeTicksMs, I18n::Message::PythonCommandTimeTicksMs),
ToolboxMessageTree(I18n::Message::PythonCommandTimeTicksUs, I18n::Message::PythonTimeTicksUs, I18n::Message::PythonCommandTimeTicksUs),
ToolboxMessageTree(I18n::Message::PythonCommandTimeTicksDiff, I18n::Message::PythonTimeTicksDiff, I18n::Message::PythonCommandTimeTicksDiff),
ToolboxMessageTree(I18n::Message::PythonCommandTimeTicksAdd, I18n::Message::PythonTimeTicksAdd, I18n::Message::PythonCommandTimeTicksAdd),
};
const ToolboxMessageTree CMathModuleChildren[CMathModuleChildrenCount] = {
ToolboxMessageTree(I18n::Message::PythonCommandImportCmath, I18n::Message::PythonImportCmath, I18n::Message::PythonCommandImportCmath),
ToolboxMessageTree(I18n::Message::PythonCommandImportFromCmath, I18n::Message::PythonImportFromCmath, I18n::Message::PythonCommandImportFromCmath),
@@ -142,6 +156,7 @@ const ToolboxMessageTree modulesChildren[modulesChildrenCount] = {
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::TimeModule, I18n::Message::Default, I18n::Message::Default, TimeModuleChildren, TimeModuleChildrenCount),
ToolboxMessageTree(I18n::Message::KandinskyModule, I18n::Message::Default, I18n::Message::Default, KandinskyModuleChildren, KandinskyModuleChildrenCount)};
const ToolboxMessageTree catalogChildren[catalogChildrenCount] = {
@@ -196,6 +211,7 @@ const ToolboxMessageTree catalogChildren[catalogChildrenCount] = {
ToolboxMessageTree(I18n::Message::PythonCommandImportKandinsky, I18n::Message::PythonImportKandinsky, I18n::Message::PythonCommandImportKandinsky),
ToolboxMessageTree(I18n::Message::PythonCommandImportMath, I18n::Message::PythonImportMath, I18n::Message::PythonCommandImportMath),
ToolboxMessageTree(I18n::Message::PythonCommandImportRandom, I18n::Message::PythonImportRandom, I18n::Message::PythonCommandImportRandom),
ToolboxMessageTree(I18n::Message::PythonCommandImportTime, I18n::Message::PythonImportTime, I18n::Message::PythonCommandImportTime),
ToolboxMessageTree(I18n::Message::PythonCommandInput, I18n::Message::PythonInput, I18n::Message::PythonCommandInput),
ToolboxMessageTree(I18n::Message::PythonCommandInt, I18n::Message::PythonInt, I18n::Message::PythonCommandInt),
ToolboxMessageTree(I18n::Message::PythonCommandIsFinite, I18n::Message::PythonIsFinite, I18n::Message::PythonCommandIsFinite),
@@ -349,4 +365,3 @@ void PythonToolbox::scrollToAndSelectChild(int i) {
}
}