Commit 9746e1fe authored by Over_score's avatar Over_score

Fixed double decimal separator when entering a number

parent c7bec72e
...@@ -376,7 +376,7 @@ void addItemToNimBuffer(int16_t item) { ...@@ -376,7 +376,7 @@ void addItemToNimBuffer(int16_t item) {
calcModeNim(NOPARAM); calcModeNim(NOPARAM);
nimBuffer[0] = '+'; nimBuffer[0] = '+';
nimBuffer[1] = '1'; nimBuffer[1] = '1';
nimBuffer[2] = radixMark == RM_PERIOD ? '.' : ','; nimBuffer[2] = '.';
nimBuffer[3] = 0; nimBuffer[3] = 0;
nimNumberPart = NP_REAL_FLOAT_PART; nimNumberPart = NP_REAL_FLOAT_PART;
lastIntegerBase = 0; lastIntegerBase = 0;
...@@ -965,7 +965,7 @@ void addItemToNimBuffer(int16_t item) { ...@@ -965,7 +965,7 @@ void addItemToNimBuffer(int16_t item) {
if(done) { if(done) {
//Convert nimBuffer to display string //Convert nimBuffer to display string
strcpy(nimBufferDisplay, NUM_SPACE_HAIR); strcpy(nimBufferDisplay, STD_SPACE_HAIR);
nimInputRealPartIsReal34 = false; nimInputRealPartIsReal34 = false;
nimInputImaginaryPartIsReal34 = false; nimInputImaginaryPartIsReal34 = false;
...@@ -987,10 +987,10 @@ void addItemToNimBuffer(int16_t item) { ...@@ -987,10 +987,10 @@ void addItemToNimBuffer(int16_t item) {
exponentToDisplayString(atoi(nimBuffer + exponentSignLocation), nimBufferDisplay + stringByteLength(nimBufferDisplay), true); exponentToDisplayString(atoi(nimBuffer + exponentSignLocation), nimBufferDisplay + stringByteLength(nimBufferDisplay), true);
if(nimBuffer[exponentSignLocation + 1] == 0 && nimBuffer[exponentSignLocation] == '-') { if(nimBuffer[exponentSignLocation + 1] == 0 && nimBuffer[exponentSignLocation] == '-') {
strcat(nimBufferDisplay, NUM_SUP_MINUS); strcat(nimBufferDisplay, STD_SUP_MINUS);
} }
else if(nimBuffer[exponentSignLocation + 1] == '0' && nimBuffer[exponentSignLocation] == '+') { else if(nimBuffer[exponentSignLocation + 1] == '0' && nimBuffer[exponentSignLocation] == '+') {
strcat(nimBufferDisplay, NUM_SUP_0); strcat(nimBufferDisplay, STD_SUP_0);
} }
nimInputRealPartIsReal34 = isRealDp(nimBuffer + 1); nimInputRealPartIsReal34 = isRealDp(nimBuffer + 1);
...@@ -998,7 +998,7 @@ void addItemToNimBuffer(int16_t item) { ...@@ -998,7 +998,7 @@ void addItemToNimBuffer(int16_t item) {
case NP_FRACTION_DENOMINATOR : // +123 12/7 case NP_FRACTION_DENOMINATOR : // +123 12/7
nimBufferToDisplayBuffer(nimBuffer, nimBufferDisplay + 2); nimBufferToDisplayBuffer(nimBuffer, nimBufferDisplay + 2);
strcat(nimBufferDisplay, NUM_SPACE_4_PER_EM); strcat(nimBufferDisplay, STD_SPACE_4_PER_EM);
for(index=2; nimBuffer[index]!=' '; index++); // The ending semi colon is OK here for(index=2; nimBuffer[index]!=' '; index++); // The ending semi colon is OK here
supNumberToDisplayString(atoi(nimBuffer + index + 1), nimBufferDisplay + stringByteLength(nimBufferDisplay), true); supNumberToDisplayString(atoi(nimBuffer + index + 1), nimBufferDisplay + stringByteLength(nimBufferDisplay), true);
...@@ -1033,10 +1033,10 @@ void addItemToNimBuffer(int16_t item) { ...@@ -1033,10 +1033,10 @@ void addItemToNimBuffer(int16_t item) {
if(nimNumberPart == NP_REAL_EXPONENT) { if(nimNumberPart == NP_REAL_EXPONENT) {
exponentToDisplayString(atoi(nimBuffer + exponentSignLocation), nimBufferDisplay + stringByteLength(nimBufferDisplay), true); exponentToDisplayString(atoi(nimBuffer + exponentSignLocation), nimBufferDisplay + stringByteLength(nimBufferDisplay), true);
if(nimBuffer[exponentSignLocation + 1] == 0 && nimBuffer[exponentSignLocation] == '-') { if(nimBuffer[exponentSignLocation + 1] == 0 && nimBuffer[exponentSignLocation] == '-') {
strcat(nimBufferDisplay, NUM_SUP_MINUS); strcat(nimBufferDisplay, STD_SUP_MINUS);
} }
else if(nimBuffer[exponentSignLocation + 1] == '0' && nimBuffer[exponentSignLocation] == '+') { else if(nimBuffer[exponentSignLocation + 1] == '0' && nimBuffer[exponentSignLocation] == '+') {
strcat(nimBufferDisplay, NUM_SUP_0); strcat(nimBufferDisplay, STD_SUP_0);
} }
} }
...@@ -1044,8 +1044,8 @@ void addItemToNimBuffer(int16_t item) { ...@@ -1044,8 +1044,8 @@ void addItemToNimBuffer(int16_t item) {
// Complex "separator" // Complex "separator"
if(complexMode == CM_RECTANGULAR) { if(complexMode == CM_RECTANGULAR) {
if(strncmp(nimBufferDisplay + stringByteLength(nimBufferDisplay) - 2, NUM_SPACE_HAIR, 2) != 0) { if(strncmp(nimBufferDisplay + stringByteLength(nimBufferDisplay) - 2, STD_SPACE_HAIR, 2) != 0) {
strcat(nimBufferDisplay, NUM_SPACE_HAIR); strcat(nimBufferDisplay, STD_SPACE_HAIR);
} }
if(nimBuffer[imaginaryMantissaSignLocation] == '-') { if(nimBuffer[imaginaryMantissaSignLocation] == '-') {
...@@ -1058,7 +1058,7 @@ void addItemToNimBuffer(int16_t item) { ...@@ -1058,7 +1058,7 @@ void addItemToNimBuffer(int16_t item) {
strcat(nimBufferDisplay, PRODUCT_SIGN); strcat(nimBufferDisplay, PRODUCT_SIGN);
} }
else { else {
strcat(nimBufferDisplay, NUM_SPACE_4_PER_EM NUM_MEASURED_ANGLE NUM_SPACE_4_PER_EM); strcat(nimBufferDisplay, STD_SPACE_4_PER_EM STD_MEASURED_ANGLE STD_SPACE_4_PER_EM);
if(nimBuffer[imaginaryMantissaSignLocation] == '-') { if(nimBuffer[imaginaryMantissaSignLocation] == '-') {
strcat(nimBufferDisplay, "-"); strcat(nimBufferDisplay, "-");
} }
...@@ -1085,10 +1085,10 @@ void addItemToNimBuffer(int16_t item) { ...@@ -1085,10 +1085,10 @@ void addItemToNimBuffer(int16_t item) {
if(nimNumberPart == NP_REAL_EXPONENT) { if(nimNumberPart == NP_REAL_EXPONENT) {
exponentToDisplayString(atoi(nimBuffer + imaginaryExponentSignLocation), nimBufferDisplay + stringByteLength(nimBufferDisplay), true); exponentToDisplayString(atoi(nimBuffer + imaginaryExponentSignLocation), nimBufferDisplay + stringByteLength(nimBufferDisplay), true);
if(nimBuffer[imaginaryExponentSignLocation + 1] == 0 && nimBuffer[imaginaryExponentSignLocation] == '-') { if(nimBuffer[imaginaryExponentSignLocation + 1] == 0 && nimBuffer[imaginaryExponentSignLocation] == '-') {
strcat(nimBufferDisplay, NUM_SUP_MINUS); strcat(nimBufferDisplay, STD_SUP_MINUS);
} }
else if(nimBuffer[imaginaryExponentSignLocation + 1] == '0' && nimBuffer[imaginaryExponentSignLocation] == '+') { else if(nimBuffer[imaginaryExponentSignLocation + 1] == '0' && nimBuffer[imaginaryExponentSignLocation] == '+') {
strcat(nimBufferDisplay, NUM_SUP_0); strcat(nimBufferDisplay, STD_SUP_0);
} }
} }
...@@ -1116,17 +1116,15 @@ void addItemToNimBuffer(int16_t item) { ...@@ -1116,17 +1116,15 @@ void addItemToNimBuffer(int16_t item) {
for(int i=stringByteLength(nimBufferDisplay); i>=index; i--) { for(int i=stringByteLength(nimBufferDisplay); i>=index; i--) {
nimBufferDisplay[i + 1] = nimBufferDisplay[i]; nimBufferDisplay[i + 1] = nimBufferDisplay[i];
} }
//strncpy(nimBufferDisplay + index, NUM_PERIOD34, 2); *(nimBufferDisplay + index) = *(STD_PERIOD34);
*(nimBufferDisplay + index) = *(NUM_PERIOD34); *(nimBufferDisplay + index + 1) = *(STD_PERIOD34 + 1);
*(nimBufferDisplay + index + 1) = *(NUM_PERIOD34 + 1);
} }
else if(nimBufferDisplay[index] == ',') { else if(nimBufferDisplay[index] == ',') {
for(int i=stringByteLength(nimBufferDisplay); i>=index; i--) { for(int i=stringByteLength(nimBufferDisplay); i>=index; i--) {
nimBufferDisplay[i + 1] = nimBufferDisplay[i]; nimBufferDisplay[i + 1] = nimBufferDisplay[i];
} }
//strncpy(nimBufferDisplay + index, NUM_COMMA34, 2); *(nimBufferDisplay + index) = *(STD_COMMA34);
*(nimBufferDisplay + index) = *(NUM_COMMA34); *(nimBufferDisplay + index + 1) = *(STD_COMMA34 + 1);
*(nimBufferDisplay + index + 1) = *(NUM_COMMA34 + 1);
} }
} }
} }
...@@ -1155,7 +1153,7 @@ static int16_t insertGapIP(char *displayBuffer, int16_t numDigits, int16_t nth) ...@@ -1155,7 +1153,7 @@ static int16_t insertGapIP(char *displayBuffer, int16_t numDigits, int16_t nth)
if(nth + 1 == numDigits) return 0; // no gap after the last digit if(nth + 1 == numDigits) return 0; // no gap after the last digit
if((numDigits - nth) % groupingGap == 1 || groupingGap == 1) { if((numDigits - nth) % groupingGap == 1 || groupingGap == 1) {
strcpy(displayBuffer, NUM_SPACE_PUNCTUATION); strcpy(displayBuffer, STD_SPACE_PUNCTUATION);
return 2; return 2;
} }
...@@ -1168,7 +1166,7 @@ static int16_t insertGapFP(char *displayBuffer, int16_t numDigits, int16_t nth) ...@@ -1168,7 +1166,7 @@ static int16_t insertGapFP(char *displayBuffer, int16_t numDigits, int16_t nth)
if(nth + 1 == numDigits) return 0; // no gap after the last digit if(nth + 1 == numDigits) return 0; // no gap after the last digit
if(nth % groupingGap == groupingGap - 1) { if(nth % groupingGap == groupingGap - 1) {
strcpy(displayBuffer, NUM_SPACE_PUNCTUATION); strcpy(displayBuffer, STD_SPACE_PUNCTUATION);
return 2; return 2;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -32,10 +32,10 @@ void showShiftState(void) { ...@@ -32,10 +32,10 @@ void showShiftState(void) {
if(calcMode != CM_REGISTER_BROWSER && calcMode != CM_FLAG_BROWSER && calcMode != CM_FONT_BROWSER) { if(calcMode != CM_REGISTER_BROWSER && calcMode != CM_FLAG_BROWSER && calcMode != CM_FONT_BROWSER) {
if(shiftStateChanged) { if(shiftStateChanged) {
if(shiftF) { if(shiftF) {
showGlyph(NUM_SUP_f, &numericFont, 0, Y_POSITION_OF_REGISTER_T_LINE, vmNormal, true, true); // f is pixel 4+8+3 wide showGlyph(STD_SUP_f, &numericFont, 0, Y_POSITION_OF_REGISTER_T_LINE, vmNormal, true, true); // f is pixel 4+8+3 wide
} }
else if(shiftG) { else if(shiftG) {
showGlyph(NUM_SUP_g, &numericFont, 0, Y_POSITION_OF_REGISTER_T_LINE, vmNormal, true, true); // g is pixel 4+10+1 wide showGlyph(STD_SUP_g, &numericFont, 0, Y_POSITION_OF_REGISTER_T_LINE, vmNormal, true, true); // g is pixel 4+10+1 wide
} }
else { else {
refreshRegisterLine(REGISTER_T); refreshRegisterLine(REGISTER_T);
......
...@@ -826,7 +826,7 @@ void showCursor(void) { ...@@ -826,7 +826,7 @@ void showCursor(void) {
showGlyph(STD_CURSOR, &standardFont, xCursor, yCursor, vmNormal, true, false); showGlyph(STD_CURSOR, &standardFont, xCursor, yCursor, vmNormal, true, false);
} }
else { else {
showGlyph(NUM_CURSOR, &numericFont, xCursor, yCursor, vmNormal, true, false); showGlyph(STD_CURSOR, &numericFont, xCursor, yCursor, vmNormal, true, false);
} }
} }
......
...@@ -299,12 +299,12 @@ typedef int16_t calcRegister_t; ...@@ -299,12 +299,12 @@ typedef int16_t calcRegister_t;
// Complex unit 1 bit // Complex unit 1 bit
#define CU_I 0 #define CU_I 0
#define CU_J 1 #define CU_J 1
#define COMPLEX_UNIT (complexUnit == CU_I ? NUM_i : NUM_j) #define COMPLEX_UNIT (complexUnit == CU_I ? STD_i : STD_j)
// Product sign 1 bit // Product sign 1 bit
#define PS_DOT 0 #define PS_DOT 0
#define PS_CROSS 1 #define PS_CROSS 1
#define PRODUCT_SIGN (productSign == PS_CROSS ? NUM_CROSS : NUM_DOT) #define PRODUCT_SIGN (productSign == PS_CROSS ? STD_CROSS : STD_DOT)
// Fraction type 1 bit // Fraction type 1 bit
#define FT_PROPER 0 // a b/c #define FT_PROPER 0 // a b/c
...@@ -315,7 +315,7 @@ typedef int16_t calcRegister_t; ...@@ -315,7 +315,7 @@ typedef int16_t calcRegister_t;
#define RM_COMMA 1 #define RM_COMMA 1
#define RADIX16_MARK_CHAR (radixMark == RM_PERIOD ? '.' : ',') #define RADIX16_MARK_CHAR (radixMark == RM_PERIOD ? '.' : ',')
#define RADIX16_MARK_STRING (radixMark == RM_PERIOD ? "." : ",") #define RADIX16_MARK_STRING (radixMark == RM_PERIOD ? "." : ",")
#define RADIX34_MARK_STRING (radixMark == RM_PERIOD ? NUM_PERIOD34 : NUM_COMMA34) #define RADIX34_MARK_STRING (radixMark == RM_PERIOD ? STD_PERIOD34 : STD_COMMA34)
// Stack size 1 bit // Stack size 1 bit
#define SS_4 0 #define SS_4 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment