mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 14:13:30 -07:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
0fa7049184
20 changed files with 175 additions and 227 deletions
|
@ -5,7 +5,6 @@ root = true
|
|||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = crlf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*.{xaml,cpp,h}]
|
||||
charset = utf-8-bom
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[*.{cpp,h}]
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include "Header Files/CalcEngine.h"
|
||||
#include "Header Files/CalcUtils.h"
|
||||
|
||||
bool IsOpInRange(WPARAM op, uint32_t x, uint32_t y)
|
||||
{
|
||||
|
|
|
@ -2,18 +2,25 @@
|
|||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#pragma once
|
||||
#include "Header Files/CalcEngine.h"
|
||||
#include "Command.h"
|
||||
#include "CalculatorVector.h"
|
||||
#include "ExpressionCommand.h"
|
||||
#include "CalcException.h"
|
||||
|
||||
constexpr int ASCII_0 = 48;
|
||||
|
||||
using namespace std;
|
||||
using namespace CalcEngine;
|
||||
|
||||
namespace {
|
||||
void IFT(HRESULT hr)
|
||||
{
|
||||
if (FAILED(hr))
|
||||
{
|
||||
throw hr;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CHistoryCollector::ReinitHistory()
|
||||
{
|
||||
m_lastOpStartIndex = -1;
|
||||
|
|
|
@ -26,28 +26,30 @@
|
|||
using namespace std;
|
||||
using namespace CalcEngine;
|
||||
|
||||
// NPrecedenceOfOp
|
||||
//
|
||||
// Returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
||||
// 0 is returned. Higher the number, higher the precedence of the operator.
|
||||
INT NPrecedenceOfOp(int nopCode)
|
||||
{
|
||||
static BYTE rgbPrec[] = { 0,0, IDC_OR,0, IDC_XOR,0, IDC_AND,1,
|
||||
IDC_ADD,2, IDC_SUB,2, IDC_RSHF,3, IDC_LSHF,3,
|
||||
IDC_MOD,3, IDC_DIV,3, IDC_MUL,3, IDC_PWR,4, IDC_ROOT, 4 };
|
||||
int iPrec;
|
||||
namespace {
|
||||
// NPrecedenceOfOp
|
||||
//
|
||||
// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
||||
// 0 is returned. Higher the number, higher the precedence of the operator.
|
||||
INT NPrecedenceOfOp(int nopCode)
|
||||
{
|
||||
static BYTE rgbPrec[] = { 0,0, IDC_OR,0, IDC_XOR,0, IDC_AND,1,
|
||||
IDC_ADD,2, IDC_SUB,2, IDC_RSHF,3, IDC_LSHF,3,
|
||||
IDC_MOD,3, IDC_DIV,3, IDC_MUL,3, IDC_PWR,4, IDC_ROOT, 4 };
|
||||
int iPrec;
|
||||
|
||||
iPrec = 0;
|
||||
while ((iPrec < ARRAYSIZE(rgbPrec)) && (nopCode != rgbPrec[iPrec]))
|
||||
{
|
||||
iPrec += 2;
|
||||
}
|
||||
if (iPrec >= ARRAYSIZE(rgbPrec))
|
||||
{
|
||||
iPrec = 0;
|
||||
}
|
||||
return rgbPrec[iPrec + 1];
|
||||
while ((iPrec < ARRAYSIZE(rgbPrec)) && (nopCode != rgbPrec[iPrec]))
|
||||
{
|
||||
iPrec += 2;
|
||||
}
|
||||
if (iPrec >= ARRAYSIZE(rgbPrec))
|
||||
{
|
||||
iPrec = 0;
|
||||
}
|
||||
return rgbPrec[iPrec + 1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// HandleErrorCommand
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
class CalcException : public std::exception
|
||||
{
|
||||
public:
|
||||
CalcException(HRESULT hr)
|
||||
{
|
||||
m_hr = hr;
|
||||
}
|
||||
HRESULT GetException()
|
||||
{
|
||||
return m_hr;
|
||||
}
|
||||
private:
|
||||
HRESULT m_hr;
|
||||
};
|
||||
|
||||
void IFT(HRESULT hr)
|
||||
{
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CalcException exception(hr);
|
||||
throw(exception);
|
||||
}
|
||||
}
|
|
@ -119,7 +119,6 @@
|
|||
<ClInclude Include="Ratpack\ratpak.h">
|
||||
<Filter>RatPack</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CalcException.h" />
|
||||
<ClInclude Include="CalculatorVector.h" />
|
||||
<ClInclude Include="Header Files\CalcEngine.h">
|
||||
<Filter>Header Files</Filter>
|
||||
|
|
|
@ -61,7 +61,7 @@ void* zmalloc(size_t a)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void _dupnum(_In_ PNUMBER dest, _In_ PNUMBER src)
|
||||
void _dupnum(_In_ PNUMBER dest, _In_ const NUMBER * const src)
|
||||
{
|
||||
memcpy(dest, src, (int)(sizeof(NUMBER) + ((src)->cdigit)*(sizeof(MANTTYPE))));
|
||||
}
|
||||
|
|
|
@ -1,480 +1,482 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_one= {
|
||||
#pragma once
|
||||
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_one= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_two= {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_two= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 2,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_five= {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_five= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 5,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_six= {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_six= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 6,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_ten= {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_ten= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 10,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_smallest = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_smallest = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_smallest = {
|
||||
inline const NUMBER init_q_rat_smallest = {
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
{ 0, 190439170, 901055854, 10097,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_negsmallest = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_negsmallest = {
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_negsmallest = {
|
||||
inline const NUMBER init_q_rat_negsmallest = {
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
{ 0, 190439170, 901055854, 10097,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_pt_eight_five = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_pt_eight_five = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 85,}
|
||||
};
|
||||
NUMBER init_q_pt_eight_five = {
|
||||
inline const NUMBER init_q_pt_eight_five = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 100,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_six = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_six = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 6,}
|
||||
};
|
||||
NUMBER init_q_rat_six = {
|
||||
inline const NUMBER init_q_rat_six = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_two = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_two = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 2,}
|
||||
};
|
||||
NUMBER init_q_rat_two = {
|
||||
inline const NUMBER init_q_rat_two = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_zero = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_zero = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 0,}
|
||||
};
|
||||
NUMBER init_q_rat_zero = {
|
||||
inline const NUMBER init_q_rat_zero = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_one = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_one = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_one = {
|
||||
inline const NUMBER init_q_rat_one = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_neg_one = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_neg_one = {
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_neg_one = {
|
||||
inline const NUMBER init_q_rat_neg_one = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_half = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_half = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_half = {
|
||||
inline const NUMBER init_q_rat_half = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 2,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_ten = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_ten = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 10,}
|
||||
};
|
||||
NUMBER init_q_rat_ten = {
|
||||
inline const NUMBER init_q_rat_ten = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_pi = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 125527896, 283898350, 1960493936, 1672850762, 1288168272, 8,}
|
||||
};
|
||||
NUMBER init_q_pi = {
|
||||
inline const NUMBER init_q_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1288380402, 1120116153, 1860424692, 1944118326, 1583591604, 2,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_two_pi = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_two_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 251055792, 567796700, 1773504224, 1198217877, 428852897, 17,}
|
||||
};
|
||||
NUMBER init_q_two_pi = {
|
||||
inline const NUMBER init_q_two_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1288380402, 1120116153, 1860424692, 1944118326, 1583591604, 2,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_pi_over_two = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_pi_over_two = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 125527896, 283898350, 1960493936, 1672850762, 1288168272, 8,}
|
||||
};
|
||||
NUMBER init_q_pi_over_two = {
|
||||
inline const NUMBER init_q_pi_over_two = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 429277156, 92748659, 1573365737, 1740753005, 1019699561, 5,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_one_pt_five_pi = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_one_pt_five_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1241201312, 270061909, 1051574664, 1924965045, 1340320627, 70,}
|
||||
};
|
||||
NUMBER init_q_one_pt_five_pi = {
|
||||
inline const NUMBER init_q_one_pt_five_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1579671539, 1837970263, 1067644340, 523549916, 2119366659, 14,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_e_to_one_half = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_e_to_one_half = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 256945612, 216219427, 223516738, 477442596, 581063757, 23,}
|
||||
};
|
||||
NUMBER init_q_e_to_one_half = {
|
||||
inline const NUMBER init_q_e_to_one_half = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1536828363, 698484484, 1127331835, 224219346, 245499408, 14,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_exp = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_exp = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 943665199, 1606559160, 1094967530, 1759391384, 1671799163, 1123581,}
|
||||
};
|
||||
NUMBER init_q_rat_exp = {
|
||||
inline const NUMBER init_q_rat_exp = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 879242208, 2022880100, 617392930, 1374929092, 1367479163, 413342,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_ln_ten = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_ln_ten = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 2086268922, 165794492, 1416063951, 1851428830, 1893239400, 65366841,}
|
||||
};
|
||||
NUMBER init_q_ln_ten = {
|
||||
inline const NUMBER init_q_ln_ten = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 26790652, 564532679, 783998273, 216030448, 1564709968, 28388458,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_ln_two = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_ln_two = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1789230241, 1057927868, 715399197, 908801241, 1411265331, 3,}
|
||||
};
|
||||
NUMBER init_q_ln_two = {
|
||||
inline const NUMBER init_q_ln_two = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1559869847, 1930657510, 1228561531, 219003871, 593099283, 5,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rad_to_deg = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rad_to_deg = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 2127722024, 1904928383, 2016479213, 2048947859, 1578647346, 492,}
|
||||
};
|
||||
NUMBER init_q_rad_to_deg = {
|
||||
inline const NUMBER init_q_rad_to_deg = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 125527896, 283898350, 1960493936, 1672850762, 1288168272, 8,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rad_to_grad = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rad_to_grad = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 2125526288, 684931327, 570267400, 129125085, 1038224725, 547,}
|
||||
};
|
||||
NUMBER init_q_rad_to_grad = {
|
||||
inline const NUMBER init_q_rad_to_grad = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 125527896, 283898350, 1960493936, 1672850762, 1288168272, 8,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_qword = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_qword = {
|
||||
1,
|
||||
3,
|
||||
0,
|
||||
{ 2147483647, 2147483647, 3,}
|
||||
};
|
||||
NUMBER init_q_rat_qword = {
|
||||
inline const NUMBER init_q_rat_qword = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_dword = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_dword = {
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
{ 2147483647, 1,}
|
||||
};
|
||||
NUMBER init_q_rat_dword = {
|
||||
inline const NUMBER init_q_rat_dword = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_max_long = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_max_long = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 2147483647,}
|
||||
};
|
||||
NUMBER init_q_rat_max_long = {
|
||||
inline const NUMBER init_q_rat_max_long = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_min_long = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_min_long = {
|
||||
-1,
|
||||
2,
|
||||
0,
|
||||
{ 0, 1,}
|
||||
};
|
||||
NUMBER init_q_rat_min_long = {
|
||||
inline const NUMBER init_q_rat_min_long = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_word = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_word = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 65535,}
|
||||
};
|
||||
NUMBER init_q_rat_word = {
|
||||
inline const NUMBER init_q_rat_word = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_byte = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_byte = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 255,}
|
||||
};
|
||||
NUMBER init_q_rat_byte = {
|
||||
inline const NUMBER init_q_rat_byte = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_400 = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_400 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 400,}
|
||||
};
|
||||
NUMBER init_q_rat_400 = {
|
||||
inline const NUMBER init_q_rat_400 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_360 = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_360 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 360,}
|
||||
};
|
||||
NUMBER init_q_rat_360 = {
|
||||
inline const NUMBER init_q_rat_360 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_200 = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_200 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 200,}
|
||||
};
|
||||
NUMBER init_q_rat_200 = {
|
||||
inline const NUMBER init_q_rat_200 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_180 = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_180 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 180,}
|
||||
};
|
||||
NUMBER init_q_rat_180 = {
|
||||
inline const NUMBER init_q_rat_180 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_max_exp = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_max_exp = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 100000,}
|
||||
};
|
||||
NUMBER init_q_rat_max_exp = {
|
||||
inline const NUMBER init_q_rat_max_exp = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_min_exp = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_min_exp = {
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
{ 100000,}
|
||||
};
|
||||
NUMBER init_q_rat_min_exp = {
|
||||
inline const NUMBER init_q_rat_min_exp = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_max_fact = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_max_fact = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 3249, }
|
||||
};
|
||||
NUMBER init_q_rat_max_fact = {
|
||||
inline const NUMBER init_q_rat_max_fact = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1, }
|
||||
};
|
||||
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_min_fact = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_min_fact = {
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
{ 1000, }
|
||||
};
|
||||
NUMBER init_q_rat_min_fact = {
|
||||
inline const NUMBER init_q_rat_min_fact = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
|
|
|
@ -411,7 +411,7 @@ extern void tanrat( _Inout_ PRAT *px, uint32_t radix, int32_t precision);
|
|||
// angle type
|
||||
extern void tananglerat( _Inout_ PRAT *px, ANGLE_TYPE angletype, uint32_t radix, int32_t precision);
|
||||
|
||||
extern void _dupnum(_In_ PNUMBER dest, _In_ PNUMBER src);
|
||||
extern void _dupnum(_In_ PNUMBER dest, _In_ const NUMBER * const src);
|
||||
|
||||
extern void _destroynum( _In_ PNUMBER pnum );
|
||||
extern void _destroyrat( _In_ PRAT prat );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -31,8 +31,8 @@ static int cbitsofprecision = 0;
|
|||
#define READRAWNUM(v)
|
||||
#define DUMPRAWRAT(v) _dumprawrat(#v,v, wcout)
|
||||
#define DUMPRAWNUM(v) fprintf( stderr, \
|
||||
"// Autogenerated by _dumprawrat in support.c\n" ); \
|
||||
fprintf( stderr, "NUMBER init_" #v "= {\n" ); \
|
||||
"// Autogenerated by _dumprawrat in support.cpp\n" ); \
|
||||
fprintf( stderr, "inline const NUMBER init_" #v "= {\n" ); \
|
||||
_dumprawnum(v, wcout); \
|
||||
fprintf( stderr, "};\n" )
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace UnitConversionManager
|
|||
// null checks.
|
||||
//
|
||||
// unitId, name, abbreviation, isConversionSource, isConversionTarget, isWhimsical
|
||||
const Unit EMPTY_UNIT = Unit{ -1, L"", L"", true, true, false };
|
||||
inline const Unit EMPTY_UNIT = Unit{ -1, L"", L"", true, true, false };
|
||||
|
||||
struct Category
|
||||
{
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
#include "AppResourceProvider.h"
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ String^ CopyPasteManager::ValidatePasteExpression(String^ pastedText, ViewMode m
|
|||
if (pastedText->Length() > MaxPasteableLength)
|
||||
{
|
||||
// return NoOp to indicate don't paste anything.
|
||||
TraceLogger::GetInstance().LogInvalidInputPasted(L"PastedExpressionSizeGreaterThanMaxAllowed", L"MoreThanMaxInput", mode, programmerNumberBase, bitLengthType);
|
||||
TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"PastedExpressionSizeGreaterThanMaxAllowed", mode, programmerNumberBase, bitLengthType);
|
||||
return StringReference(PasteErrorString);
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ String^ CopyPasteManager::ValidatePasteExpression(String^ pastedText, ViewMode m
|
|||
// validate each operand with patterns for different modes
|
||||
if (!ExpressionRegExMatch(operands, mode, modeType, programmerNumberBase, bitLengthType))
|
||||
{
|
||||
TraceLogger::GetInstance().LogInvalidInputPasted(L"InvalidExpressionForPresentMode", pastedText->Data(), mode, programmerNumberBase, bitLengthType);
|
||||
TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"InvalidExpressionForPresentMode", mode, programmerNumberBase, bitLengthType);
|
||||
return StringReference(PasteErrorString);
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ vector<wstring> CopyPasteManager::ExtractOperands(const wstring& pasteExpression
|
|||
|
||||
if (operands.size() >= MaxOperandCount)
|
||||
{
|
||||
TraceLogger::GetInstance().LogInvalidInputPasted(L"OperandCountGreaterThanMaxCount", pasteExpression.c_str(), mode, programmerNumberBase, bitLengthType);
|
||||
TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"OperandCountGreaterThanMaxCount", mode, programmerNumberBase, bitLengthType);
|
||||
operands.clear();
|
||||
return operands;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ vector<wstring> CopyPasteManager::ExtractOperands(const wstring& pasteExpression
|
|||
// to disallow pasting of 1e+12345 as 1e+1234, max exponent that can be pasted is 9999.
|
||||
if (expLength > MaxExponentLength)
|
||||
{
|
||||
TraceLogger::GetInstance().LogInvalidInputPasted(L"ExponentLengthGreaterThanMaxLength", pasteExpression.c_str(), mode, programmerNumberBase, bitLengthType);
|
||||
TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"ExponentLengthGreaterThanMaxLength", mode, programmerNumberBase, bitLengthType);
|
||||
operands.clear();
|
||||
return operands;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
#include "TraceLogger.h"
|
||||
#include "NetworkManager.h"
|
||||
|
@ -59,7 +57,7 @@ namespace CalculatorApp
|
|||
constexpr auto EVENT_NAME_MEMORY_FLYOUT_OPEN_BEGIN = L"MemoryFlyoutOpenBegin";
|
||||
constexpr auto EVENT_NAME_MEMORY_FLYOUT_OPEN_END = L"MemoryFlyoutOpenEnd";
|
||||
constexpr auto EVENT_NAME_MEMORY_CLEAR_ALL = L"MemoryClearAll";
|
||||
constexpr auto EVENT_NAME_INVALID_INPUT_PASTED = L"InvalidInputPasted";
|
||||
constexpr auto EVENT_NAME_INVALID_PASTED_INPUT_OCCURRED = L"InvalidPastedInputOccurred";
|
||||
constexpr auto EVENT_NAME_VALID_INPUT_PASTED = L"ValidInputPasted";
|
||||
constexpr auto EVENT_NAME_BITFLIP_PANE_CLICKED = L"BitFlipPaneClicked";
|
||||
constexpr auto EVENT_NAME_BITFLIP_BUTTONS_USED = L"BitFlipToggleButtonUsed";
|
||||
|
@ -81,6 +79,9 @@ namespace CalculatorApp
|
|||
|
||||
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
||||
|
||||
constexpr auto PDT_PRIVACY_DATA_TAG = L"PartA_PrivTags";
|
||||
constexpr auto PDT_PRODUCT_AND_SERVICE_USAGE = 0x0000'0000'0200'0000u;
|
||||
|
||||
#ifdef SEND_TELEMETRY
|
||||
// c.f. WINEVENT_KEYWORD_RESERVED_63-56 0xFF00000000000000 // Bits 63-56 - channel keywords
|
||||
// c.f. WINEVENT_KEYWORD_* 0x00FF000000000000 // Bits 55-48 - system-reserved keywords
|
||||
|
@ -641,17 +642,17 @@ namespace CalculatorApp
|
|||
LogTelemetryEvent(EVENT_NAME_SINGLE_MEMORY_USED, fields);
|
||||
}
|
||||
|
||||
void TraceLogger::LogInvalidInputPasted(wstring_view reason, wstring_view pastedExpression, ViewMode mode, int programmerNumberBase, int bitLengthType)
|
||||
void TraceLogger::LogInvalidPastedInputOccurred(wstring_view reason, ViewMode mode, int programmerNumberBase, int bitLengthType)
|
||||
{
|
||||
if (!GetTraceLoggingProviderEnabled()) return;
|
||||
|
||||
LoggingFields fields{};
|
||||
fields.AddString(L"Mode", NavCategory::GetFriendlyName(mode)->Data());
|
||||
fields.AddString(L"Reason", reason);
|
||||
fields.AddString(L"PastedExpression", pastedExpression);
|
||||
fields.AddString(L"ProgrammerNumberBase", GetProgrammerType(programmerNumberBase).c_str());
|
||||
fields.AddString(L"BitLengthType", GetProgrammerType(bitLengthType).c_str());
|
||||
LogTelemetryEvent(EVENT_NAME_INVALID_INPUT_PASTED, fields);
|
||||
fields.AddUInt64(PDT_PRIVACY_DATA_TAG, PDT_PRODUCT_AND_SERVICE_USAGE);
|
||||
LogTelemetryEvent(EVENT_NAME_INVALID_PASTED_INPUT_OCCURRED, fields);
|
||||
}
|
||||
|
||||
void TraceLogger::LogValidInputPasted(ViewMode mode) const
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace CalculatorApp
|
|||
void LogMemoryFlyoutOpenBegin(unsigned int) const;
|
||||
void LogDebug(std::wstring_view debugData);
|
||||
void LogMemoryFlyoutOpenEnd(unsigned int) const;
|
||||
void LogInvalidInputPasted(std::wstring_view reason, std::wstring_view pastedExpression, CalculatorApp::Common::ViewMode mode, int ProgrammerNumberBase, int bitLengthType);
|
||||
void LogInvalidPastedInputOccurred(std::wstring_view reason, CalculatorApp::Common::ViewMode mode, int ProgrammerNumberBase, int bitLengthType);
|
||||
void LogValidInputPasted(CalculatorApp::Common::ViewMode mode) const;
|
||||
void UpdateFunctionUsage(int func);
|
||||
void LogFunctionUsage(int);
|
||||
|
|
|
@ -9,7 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CalcManager", "CalcManager\
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3A5DF651-B8A1-45CA-9135-964A6FC7F5D1}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
nuget.config = nuget.config
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
|
|
@ -506,13 +506,8 @@
|
|||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
IsActive="{Binding Value1Active, Mode=TwoWay}"
|
||||
KeyDown="OnValueKeyDown"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
Selected="OnValueSelected"
|
||||
TabIndex="1">
|
||||
<controls:CalculationResult.RenderTransform>
|
||||
<CompositeTransform/>
|
||||
</controls:CalculationResult.RenderTransform>
|
||||
</controls:CalculationResult>
|
||||
TabIndex="1"/>
|
||||
</Grid>
|
||||
|
||||
<ComboBox x:Name="Units1"
|
||||
|
@ -561,13 +556,8 @@
|
|||
FlowDirection="{x:Bind LayoutDirection}"
|
||||
IsActive="{Binding Value2Active, Mode=TwoWay}"
|
||||
KeyDown="OnValueKeyDown"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
Selected="OnValueSelected"
|
||||
TabIndex="3">
|
||||
<controls:CalculationResult.RenderTransform>
|
||||
<CompositeTransform/>
|
||||
</controls:CalculationResult.RenderTransform>
|
||||
</controls:CalculationResult>
|
||||
TabIndex="3"/>
|
||||
</Grid>
|
||||
|
||||
<ComboBox x:Name="Units2"
|
||||
|
|
|
@ -25,30 +25,17 @@ namespace CalculatorUnitTests
|
|||
|
||||
#define ASSERT_POSITIVE_TESTCASES(func, dataSet) \
|
||||
{\
|
||||
int size = sizeof(dataSet)/sizeof(*dataSet);\
|
||||
while(--size)\
|
||||
for(auto data : dataSet)\
|
||||
{\
|
||||
VERIFY_ARE_EQUAL(func(dataSet[size]), dataSet[size]);\
|
||||
VERIFY_ARE_EQUAL(func(data), data);\
|
||||
}\
|
||||
}
|
||||
|
||||
#define ASSERT_NEGATIVE_TESTCASES(func, dataSet) \
|
||||
{\
|
||||
int size = sizeof(dataSet)/sizeof(*dataSet);\
|
||||
while(--size)\
|
||||
for(auto data : dataSet)\
|
||||
{\
|
||||
VERIFY_ARE_EQUAL(func(dataSet[size]), StringReference(L"NoOp"));\
|
||||
}\
|
||||
}
|
||||
|
||||
// returns a iterator from end
|
||||
#define START_LOOP(dataSet)\
|
||||
{\
|
||||
int size = sizeof(dataSet)/sizeof(*dataSet);\
|
||||
while(--size)\
|
||||
{
|
||||
|
||||
#define END_LOOP\
|
||||
VERIFY_ARE_EQUAL(func(data), StringReference(L"NoOp"));\
|
||||
}\
|
||||
}
|
||||
|
||||
|
@ -450,15 +437,16 @@ namespace CalculatorUnitTests
|
|||
// Doesn't have test where converter is involved. Will add such a test later.
|
||||
StandardCalculatorViewModel^ scvm = ref new StandardCalculatorViewModel();
|
||||
scvm->IsStandard = true;
|
||||
String^ input[] = { L"123", L"12345", L"123+456", L"1,234", L"1 2 3", L"\n\r1,234\n", L"\n 1+\n2 ", L"1\"2" };
|
||||
String^ inputs[] = { L"123", L"12345", L"123+456", L"1,234", L"1 2 3", L"\n\r1,234\n", L"\n 1+\n2 ", L"1\"2" };
|
||||
|
||||
START_LOOP(input)
|
||||
for (String^ &input : inputs)
|
||||
{
|
||||
// paste number in standard mode and then validate the pastability of displayed number for other modes
|
||||
scvm->OnPaste(input[size], ViewMode::Standard);
|
||||
scvm->OnPaste(input, ViewMode::Standard);
|
||||
VERIFY_ARE_EQUAL(ValidateStandardPasteExpression(scvm->DisplayValue), scvm->DisplayValue);
|
||||
VERIFY_ARE_EQUAL(ValidateScientificPasteExpression(scvm->DisplayValue), scvm->DisplayValue);
|
||||
VERIFY_ARE_EQUAL(ValidateProgrammerHexQwordPasteExpression(scvm->DisplayValue), scvm->DisplayValue);
|
||||
END_LOOP
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
#include "CurrencyHttpClient.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue