logic toolbox with logic functions

This commit is contained in:
Joe Crop
2022-12-05 20:07:45 -08:00
parent 1bf164e1e3
commit 42d8fea8c6
23 changed files with 1864 additions and 3 deletions

View File

@@ -97,7 +97,7 @@ public:
AdditionalInformationType additionalInformationType(Poincare::Context * context);
private:
static constexpr KDCoordinate k_heightComputationFailureHeight = 50;
static constexpr const char * k_maximalIntegerWithAdditionalInformation = "10000000000000000";
static constexpr const char * k_maximalIntegerWithAdditionalInformation = "18446744073709551617"; // 2^64 + 1
void setHeights(KDCoordinate height, KDCoordinate expandedHeight);

View File

@@ -81,7 +81,35 @@ const ToolboxMessageTree matricesChildren[] = {
const ToolboxMessageTree vectorsChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::DotCommandWithArg, I18n::Message::Dot),
ToolboxMessageTree::Leaf(I18n::Message::CrossCommandWithArg, I18n::Message::Cross),
ToolboxMessageTree::Leaf(I18n::Message::NormVectorCommandWithArg, I18n::Message::NormVector),
ToolboxMessageTree::Leaf(I18n::Message::NormVectorCommandWithArg, I18n::Message::NormVector)
};
const ToolboxMessageTree logicExplicitChildren[] = {
ToolboxMessageTree::Leaf(I18n::Message::LogicalNotExplicitCommandWithArg, I18n::Message::LogicalNot),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftLeftExplicitCommandWithArg, I18n::Message::LogicalShiftLeft),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftRightExplicitCommandWithArg, I18n::Message::LogicalShiftRight),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftRightArithmeticExplicitCommandWithArg, I18n::Message::LogicalShiftRightArithmetic),
ToolboxMessageTree::Leaf(I18n::Message::LogicalRotateLeftExplicitCommandWithArg, I18n::Message::LogicalRotateLeft),
ToolboxMessageTree::Leaf(I18n::Message::LogicalRotateRightExplicitCommandWithArg, I18n::Message::LogicalRotateRight),
ToolboxMessageTree::Leaf(I18n::Message::LogicalBitsClearExplicitCommandWithArg, I18n::Message::LogicalBitsClear)};
const ToolboxMessageTree logicChildren[] = {
ToolboxMessageTree::Node(I18n::Message::ExplicitNumberOfBits, logicExplicitChildren),
ToolboxMessageTree::Leaf(I18n::Message::LogicalAndCommandWithArg, I18n::Message::LogicalAnd),
ToolboxMessageTree::Leaf(I18n::Message::LogicalOrCommandWithArg, I18n::Message::LogicalOr),
ToolboxMessageTree::Leaf(I18n::Message::LogicalXorCommandWithArg, I18n::Message::LogicalXor),
ToolboxMessageTree::Leaf(I18n::Message::LogicalNotCommandWithArg, I18n::Message::LogicalNot),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftLeftCommandWithArg, I18n::Message::LogicalShiftLeft),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftRightCommandWithArg, I18n::Message::LogicalShiftRight),
ToolboxMessageTree::Leaf(I18n::Message::LogicalShiftRightArithmeticCommandWithArg, I18n::Message::LogicalShiftRightArithmetic),
ToolboxMessageTree::Leaf(I18n::Message::LogicalRotateLeftCommandWithArg, I18n::Message::LogicalRotateLeft),
ToolboxMessageTree::Leaf(I18n::Message::LogicalRotateRightCommandWithArg, I18n::Message::LogicalRotateRight),
ToolboxMessageTree::Leaf(I18n::Message::LogicalBitGetCommandWithArg, I18n::Message::LogicalBitGet),
ToolboxMessageTree::Leaf(I18n::Message::LogicalBitSetCommandWithArg, I18n::Message::LogicalBitSet),
ToolboxMessageTree::Leaf(I18n::Message::LogicalBitClearCommandWithArg, I18n::Message::LogicalBitClear),
ToolboxMessageTree::Leaf(I18n::Message::LogicalBitFlipCommandWithArg, I18n::Message::LogicalBitFlip),
ToolboxMessageTree::Leaf(I18n::Message::LogicalBitsClearCommandWithArg, I18n::Message::LogicalBitsClear),
ToolboxMessageTree::Leaf(I18n::Message::TwosComplementToBitsCommandWithArg, I18n::Message::TwosComplementToBits)
};
#if LIST_ARE_DEFINED
@@ -853,6 +881,7 @@ const ToolboxMessageTree menu[] = {
ToolboxMessageTree::Leaf(I18n::Message::RootCommandWithArg, I18n::Message::NthRoot),
ToolboxMessageTree::Leaf(I18n::Message::LogCommandWithArg, I18n::Message::BasedLogarithm),
ToolboxMessageTree::Node(I18n::Message::Calculation, calculChildren),
ToolboxMessageTree::Node(I18n::Message::Logic, logicChildren),
ToolboxMessageTree::Node(I18n::Message::ComplexNumber, complexChildren),
ToolboxMessageTree::Node(I18n::Message::Unit, unitChildren),
ToolboxMessageTree::Node(I18n::Message::Arithmetic, arithmeticChildren),

View File

@@ -485,3 +485,29 @@ Rstvt_Water = "1.01·10^3_Ω_m"
Rstvt_Air = "1.00·10^9_Ω_m"
Rstvt_Glass = "5.00·10^14_Ω_m"
Rstvt_Wood = "1.00·10^3_Ω_m"
LogicalAnd = "a AND b"
LogicalAndCommandWithArg = "and(a,b)"
LogicalBitClearCommandWithArg = "bclr(a,b)"
LogicalBitFlipCommandWithArg = "bflp(a,b)"
LogicalBitGetCommandWithArg = "bit(a,b)"
LogicalBitSetCommandWithArg = "bset(a,b)"
LogicalBitsClearCommandWithArg = "bic(a,b)"
LogicalBitsClearExplicitCommandWithArg = "bic(a,b,n)"
LogicalNot = "NOT a"
LogicalNotCommandWithArg = "not(a)"
LogicalNotExplicitCommandWithArg = "not(a,n)"
LogicalOr = "a OR b"
LogicalOrCommandWithArg = "or(a,b)"
LogicalShiftLeftCommandWithArg = "sll(a,s)"
LogicalShiftLeftExplicitCommandWithArg = "sll(a,s,n)"
LogicalShiftRightArithmeticCommandWithArg = "sra(a,s)"
LogicalShiftRightArithmeticExplicitCommandWithArg = "sra(a,s,n)"
LogicalShiftRightCommandWithArg = "srl(a,s)"
LogicalShiftRightExplicitCommandWithArg = "srl(a,s,n)"
LogicalRotateLeftCommandWithArg = "rol(a,r)"
LogicalRotateLeftExplicitCommandWithArg = "rol(a,r,n)"
LogicalRotateRightCommandWithArg = "ror(a,r)"
LogicalRotateRightExplicitCommandWithArg = "ror(a,r,n)"
LogicalXor = "a XOR b"
LogicalXorCommandWithArg = "xor(a,r)"
TwosComplementToBitsCommandWithArg = "tc(a,n)"

View File

@@ -510,3 +510,16 @@ HartreeConstantTag = "Hartbaum-Konstante"
MagneticFluxQuantumTag = "Magnetisches Fluss-Quantum"
ConductanceQuantumTag = "Leitwertquantum"
CirculationQuantumTag = "Auflage-Quantum"
Logic = "Logik"
LogicalBitClear = "Bit b in a löschen"
LogicalBitFlip = "Bit b in a umkehren"
LogicalBitGet = "Bit b aus a lesen"
LogicalBitSet = "Bit b in a setzen"
LogicalBitsClear = "a AND NOT b"
LogicalShiftLeft = "Bitverschiebung links von a um s"
LogicalShiftRightArithmetic = "Arithm. Versch. rechts von a um s"
LogicalShiftRight = "Bitverschiebung rechts von a um s"
LogicalRotateLeft = "Rotieren von a um r Bit n. links"
LogicalRotateRight= "Rotieren von a um r Bit n. rechts"
TwosComplementToBits = "Äquivalent im Zweierkomplement"
ExplicitNumberOfBits = "Explizite Bitbreite"

View File

@@ -510,3 +510,16 @@ HartreeConstantTag = "Hartree Constant"
MagneticFluxQuantumTag = "Magnetic Flux Quantum"
ConductanceQuantumTag = "Conductance Quantum"
CirculationQuantumTag = "Circulation Quantum"
Logic = "Logic"
LogicalBitClear = "Clear bit b in a"
LogicalBitFlip = "Flip bit b in a"
LogicalBitGet = "Get bit b in a"
LogicalBitSet = "Set bit b in a"
LogicalBitsClear = "Clear a with b [a AND NOT b]"
LogicalShiftLeft = "Logical shift left [a << s]"
LogicalShiftRightArithmetic = "Arithmetic shift right [a >>> s]"
LogicalShiftRight = "Logical shift right [a >> s]"
LogicalRotateLeft = "Rotate r bits of a to the left"
LogicalRotateRight= "Rotate r bits of a to the right"
TwosComplementToBits = "Two's complement equivalent"
ExplicitNumberOfBits = "Explicit number of bits"

View File

@@ -510,3 +510,16 @@ HartreeConstantTag = "Constante de Hartree"
MagneticFluxQuantumTag = "Flujo Magnético Cuántico"
ConductanceQuantumTag = "Conductancia Quantum"
CirculationQuantumTag = "Circulación Quantum"
Logic = "Lógico"
LogicalBitClear = "Borrar bit número b en a"
LogicalBitFlip = "Voltear el bit número b en a"
LogicalBitGet = "Obtener el bit número b en a"
LogicalBitSet = "Establecer el número de bit b en a"
LogicalBitsClear = "Borrar a con bits en b"
LogicalShiftLeft = "Desplazamiento lógico izquierda"
LogicalShiftRightArithmetic = "Desplazamiento aritmético derecha"
LogicalShiftRight = "Desplazamiento lógico derecha"
LogicalRotateLeft = "Gire r bits de a hacia izquierda"
LogicalRotateRight= "Gire r bits de a hacia derecha"
TwosComplementToBits = "Equivalente en complemento a dos"
ExplicitNumberOfBits = "Número explícito de bits"

View File

@@ -514,3 +514,16 @@ HartreeConstantTag = "Constante de Hartree"
MagneticFluxQuantumTag = "Quantum de Flux Magnétique"
ConductanceQuantumTag = "Quantum de Conductance"
CirculationQuantumTag = "Quantum de Circulation"
Logic = "Logic"
LogicalBitClear = "Effacer le bit numéro b dans a"
LogicalBitFlip = "Inverser le bit numéro b dans a"
LogicalBitGet = "Obtenir le bit numéro b dans a"
LogicalBitSet = "Allumer le bit numéro b dans a"
LogicalBitsClear = "Effacer bits b ds a [a AND NOT b]"
LogicalShiftLeft = "Décalage logique gauche [a << s]"
LogicalShiftRightArithmetic = "Décalage arith. droite [a >>> s]"
LogicalShiftRight = "Décalage logique droite [a >> s]"
LogicalRotateLeft = "Rotation gauche de a par r bits"
LogicalRotateRight= "Rotation droite de a par r bits"
TwosComplementToBits = "Equivalent en complément à deux"
ExplicitNumberOfBits = "Nombre indiqué de bits"

View File

@@ -510,3 +510,16 @@ HartreeConstantTag = "Hartree Állandó"
MagneticFluxQuantumTag = "Mágneses Fluxuskvantum"
ConductanceQuantumTag = "Vezetőképesség Kvantum"
CirculationQuantumTag = "Keringési Kvantum"
Logic = "Logika"
LogicalBitClear = "Tiszta bit b ban ben a"
LogicalBitFlip = "Flip bit b ban ben a"
LogicalBitGet = "Kap bit b ban ben a"
LogicalBitSet = "Készlet bit b ban ben a"
LogicalBitsClear = "Tiszta a val vel b [a AND NOT b]"
LogicalShiftLeft = "Logikai eltolás balra [a << s]"
LogicalShiftRightArithmetic = "Aritmetikai eltolás jobbra [a >>> s]"
LogicalShiftRight = "Logikai eltolás jobbra [a >> s]"
LogicalRotateLeft = "Forog r bitek nak a balra"
LogicalRotateRight= "Forog r bitek nak a jobbra"
TwosComplementToBits = "Kettő komplementere egyenértékű"
ExplicitNumberOfBits = "Explicit bitszám"

View File

@@ -510,3 +510,16 @@ HartreeConstantTag = "Costante di Hartree"
MagneticFluxQuantumTag = "Flusso magnetico quantico"
ConductanceQuantumTag = "Conduttanza quantistica"
CirculationQuantumTag = "Circolazione quantistica"
Logic = "Logica"
LogicalBitClear = "Cancella il numero di bit b in a"
LogicalBitFlip = "Capovolgere il bit numero b in a"
LogicalBitGet = "Ottieni il bit numero b in a"
LogicalBitSet = "Impostare il numero di bit b in a"
LogicalBitsClear = "Cancella a con b [a AND NOT b]"
LogicalShiftLeft = "Spostamento logico a sinistra"
LogicalShiftRightArithmetic = "Spostamento aritmetico a destra"
LogicalShiftRight = "Spostamento logico a destra"
LogicalRotateLeft = "Ruota r bit di a verso sinistra"
LogicalRotateRight= "Ruota r bit di a verso destra"
TwosComplementToBits = "Equivalente in complemento di due"
ExplicitNumberOfBits = "Numero esplicito di bit"

View File

@@ -510,3 +510,16 @@ HartreeConstantTag = "Hartreeconstante"
MagneticFluxQuantumTag = "Magnetische flux kwantum"
ConductanceQuantumTag = "Kwantumgeleiding"
CirculationQuantumTag = "Kwantumcirculatie"
Logic = "Logica"
LogicalBitClear = "Wis bitnummer b in a"
LogicalBitFlip = "Draai bitnummer b om in a"
LogicalBitGet = "Haal bit nummer b op in a"
LogicalBitSet = "Stel bitnummer b in a"
LogicalBitsClear = "Wis a met bits in b [a AND NOT b]"
LogicalShiftLeft = "Logische verschuiving naar links"
LogicalShiftRightArithmetic = "Rekenkundige verschuiving naar rechts"
LogicalShiftRight = "Logische verschuiving naar rechts"
LogicalRotateLeft = "Draai r stukjes a naar links"
LogicalRotateRight= "Draai r stukjes a naar rechts"
TwosComplementToBits = "Tweeën vullen equivalent aan"
ExplicitNumberOfBits = "Expliciet aantal bits"

View File

@@ -510,3 +510,16 @@ HartreeConstantTag = "Constante de Hartree"
MagneticFluxQuantumTag = "Fluxo Magnético Quântico"
ConductanceQuantumTag = "Quantum de Conduta"
CirculationQuantumTag = "Quantum de Circulação"
Logic = "Lógica"
LogicalBitClear = "Limpar o bit b em a"
LogicalBitFlip = "Virar o bit em a"
LogicalBitGet = "Obter o bit b em a"
LogicalBitSet = "Definir o bit b em a"
LogicalBitsClear = "Limpar a com b [a AND NOT b]"
LogicalShiftLeft = "Mudar lógica à esquerda"
LogicalShiftRightArithmetic = "Mudar aritmético para a direita"
LogicalShiftRight = "Mudar lógica para a direita"
LogicalRotateLeft = "Girar r bits de a para a esquerda"
LogicalRotateRight= "Girar r bits de a para a direita"
TwosComplementToBits = "Complementar de dois equivalente"
ExplicitNumberOfBits = "Número explícito de bits"