misc.cpp

changeset 78
c190fe218506
parent 72
5755c02d89f0
child 104
6e29bb0e83c5
equal deleted inserted replaced
77:7c2f500405fe 78:c190fe218506
49 // If there was only zeroes in the decimal place, remove 49 // If there was only zeroes in the decimal place, remove
50 // the decimal point now. 50 // the decimal point now.
51 if (zRep[~zRep - 1] == '.') 51 if (zRep[~zRep - 1] == '.')
52 zRep -= 1; 52 zRep -= 1;
53 53
54 // Reset the locale
55 setlocale (LC_NUMERIC, "");
56 return zRep; 54 return zRep;
57 } 55 }
58 56
59 // ============================================================================= 57 // =============================================================================
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 58 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
101 return (dPos == -1); 99 return (dPos == -1);
102 } 100 }
103 101
104 // ----------------------------------------------------------------------------- 102 // -----------------------------------------------------------------------------
105 bool stringparser::atEnd () { 103 bool stringparser::atEnd () {
106 return (dPos == zaTokens.size() - 1); 104 return (dPos == (signed)zaTokens.size() - 1);
107 } 105 }
108 106
109 // ----------------------------------------------------------------------------- 107 // -----------------------------------------------------------------------------
110 bool stringparser::getToken (str& zVal, const ushort uInPos) { 108 bool stringparser::getToken (str& zVal, const ushort uInPos) {
111 if (uInPos < 0 || uInPos >= zaTokens.size()) 109 if (uInPos >= zaTokens.size())
112 return false; 110 return false;
113 111
114 zVal = zaTokens[uInPos]; 112 zVal = zaTokens[uInPos];
115 return true; 113 return true;
116 } 114 }
125 return getToken (zVal, dPos + 1); 123 return getToken (zVal, dPos + 1);
126 } 124 }
127 125
128 // ----------------------------------------------------------------------------- 126 // -----------------------------------------------------------------------------
129 bool stringparser::findToken (short& dResult, char const* sNeedle, short dArgs) { 127 bool stringparser::findToken (short& dResult, char const* sNeedle, short dArgs) {
130 for (short i = 0; i < (zaTokens.size() - dArgs); ++i) { 128 for (ushort i = 0; i < (zaTokens.size() - dArgs); ++i) {
131 if (zaTokens[i] == sNeedle) { 129 if (zaTokens[i] == sNeedle) {
132 dResult = i; 130 dResult = i;
133 return true; 131 return true;
134 } 132 }
135 } 133 }

mercurial