void CParser::ParseNumber() { double num = 0.0; char curSymb = src[pos]; // integer while(pos<sz) { const char curSymb = src[pos]; if (!IsDigit(curSymb)) { break; } num = num*10.0 + (double)CharToNumber(curSymb); ++pos; } // fraction if (pos < sz && src[pos] == '.') { ++pos; double factor = 1.0; double fraction = 0.0; while (pos < sz) { const char curSymb = src[pos]; if (!IsDigit(curSymb)) { break; } fraction = fraction*10.0 + (double)CharToNumber(curSymb); factor *= 10.0; ++pos; } num += fraction/factor; } AST::LiteralExpr* pLit = new AST::LiteralExpr((float)num); st.push_back(pLit); }
char STRBLK::GetTinyValue(int n) { bool m; ulonglong val = CharToNumber(Strp[n], strlen(Strp[n]), INT_MAX8, false, &m); return (m && val < INT_MAX8) ? (char)(-(signed)val) : (char)val; } // end of GetTinyValue
int STRBLK::GetIntValue(int n) { bool m; ulonglong val = CharToNumber(Strp[n], strlen(Strp[n]), INT_MAX32, false, &m); return (m && val < INT_MAX32) ? (int)(-(signed)val) : (int)val; } // end of GetIntValue
longlong CHRBLK::GetBigintValue(int n) { bool m; ulonglong val = CharToNumber((char*)GetValPtr(n), Long, INT_MAX64, false, &m); return (m && val < INT_MAX64) ? (longlong)(-(signed)val) : (longlong)val; } // end of GetBigintValue
int CHRBLK::GetIntValue(int n) { bool m; ulonglong val = CharToNumber((char*)GetValPtr(n), Long, INT_MAX32, false, &m); return (m && val < INT_MAX32) ? (int)(-(signed)val) : (int)val; } // end of GetIntValue
char CHRBLK::GetTinyValue(int n) { bool m; ulonglong val = CharToNumber((char*)GetValPtr(n), Long, INT_MAX8, false, &m); return (m && val < INT_MAX8) ? (char)(-(signed)val) : (char)val; } // end of GetTinyValue
longlong STRBLK::GetBigintValue(int n) { bool m; ulonglong val = CharToNumber(Strp[n], strlen(Strp[n]), INT_MAX64, false, &m); return (m && val < INT_MAX64) ? (-(signed)val) : (longlong)val; } // end of GetBigintValue
void TYPBLK<TYPE>::SetValue(PSZ p, int n) { ChkIndx(n); if (Check) { PGLOBAL& g = Global; strcpy(g->Message, MSG(BAD_SET_STRING)); longjmp(g->jumper[g->jump_level], Type); } // endif Check bool minus; ulonglong maxval = MaxVal(); ulonglong val = CharToNumber(p, strlen(p), maxval, Unsigned, &minus); if (minus && val < maxval) Typp[n] = (TYPE)(-(signed)val); else Typp[n] = (TYPE)val; SetNull(n, false); } // end of SetValue
ushort STRBLK::GetUShortValue(int n) { return (ushort)CharToNumber(Strp[n], strlen(Strp[n]), UINT_MAX16, true); } // end of GetUshortValue
uchar STRBLK::GetUTinyValue(int n) { return (uchar)CharToNumber(Strp[n], strlen(Strp[n]), UINT_MAX8, true); } // end of GetUTinyValue
ulonglong CHRBLK::GetUBigintValue(int n) { return CharToNumber((char*)GetValPtr(n), Long, ULONGLONG_MAX, true); } // end of GetUBigintValue
uint CHRBLK::GetUIntValue(int n) { return (uint)CharToNumber((char*)GetValPtr(n), Long, UINT_MAX32, true); } // end of GetIntValue
ushort CHRBLK::GetUShortValue(int n) { return (ushort)CharToNumber((char*)GetValPtr(n), Long, UINT_MAX16, true); } // end of GetShortValue
uchar CHRBLK::GetUTinyValue(int n) { return (uchar)CharToNumber((char*)GetValPtr(n), Long, UINT_MAX8, true); } // end of GetTinyValue
ulonglong STRBLK::GetUBigintValue(int n) { return CharToNumber(Strp[n], strlen(Strp[n]), ULONGLONG_MAX, true); } // end of GetUBigintValue
uint STRBLK::GetUIntValue(int n) { return (uint)CharToNumber(Strp[n], strlen(Strp[n]), UINT_MAX32, true); } // end of GetUintValue