- Timestamp:
- 06/01/04 18:51:37 (21 years ago)
- Location:
- ps/trunk/source
- Files:
-
- 13 edited
-
maths/MathUtil.cpp (modified) (16 diffs)
-
maths/MathUtil.h (modified) (5 diffs)
-
ps/CStr.cpp (modified) (23 diffs)
-
ps/CStr.h (modified) (5 diffs)
-
ps/Config.cpp (modified) (2 diffs)
-
ps/Encryption.cpp (modified) (4 diffs)
-
ps/Encryption.h (modified) (2 diffs)
-
ps/LogFile.cpp (modified) (2 diffs)
-
ps/LogFile.h (modified) (4 diffs)
-
ps/Parser.cpp (modified) (10 diffs)
-
ps/Parser.h (modified) (5 diffs)
-
ps/Prometheus.cpp (modified) (1 diff)
-
ps/Prometheus.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/source/maths/MathUtil.cpp
r322 r332 18 18 // FL_FP_TOLERANCE of each other. 19 19 // 20 _bool MathUtil::CompareFloat(const _double &num1, const _double &num2)20 bool MathUtil::CompareFloat(const double &num1, const double &num2) 21 21 { 22 22 if( Abs(num1 - num2) < FL_FP_TOLERANCE ) … … 31 31 // PURPOSE: Converts from Radians to Degrees 32 32 // 33 inline _double MathUtil::RadiansToDegrees(const _double &num)33 inline double MathUtil::RadiansToDegrees(const double &num) 34 34 { 35 35 return num*(PI/180); … … 41 41 // PURPOSE: Converts from Degrees to Radians 42 42 // 43 inline _double MathUtil::DegreesToRadians(const _double &num)43 inline double MathUtil::DegreesToRadians(const double &num) 44 44 { 45 45 return (num*180)/PI; … … 53 53 // NOTES: returns -1 if lowerBound >= upperBound 54 54 // 55 _float MathUtil::Random(const _float &lowerBound, const _float &upperBound)55 float MathUtil::Random(const float &lowerBound, const float &upperBound) 56 56 { 57 57 … … 64 64 65 65 // finds a floating point number between 0 and 1.0 66 _float randVar = ( static_cast<_float>( rand() )/RAND_MAX );66 float randVar = ( static_cast<float>( rand() )/RAND_MAX ); 67 67 68 68 // maps the number onto the set from 0 to upperBound … … 82 82 // NOTES: returns -1 if lowerBound >= upperBound 83 83 // 84 _int MathUtil::Random(const _int &lowerBound,const _int &upperBound)84 int MathUtil::Random(const int &lowerBound,const int &upperBound) 85 85 { 86 86 if( lowerBound >= upperBound) … … 92 92 93 93 // find a random variable between 0 and range size 94 _int randVar = rand()%( Abs(upperBound - lowerBound) + 1);94 int randVar = rand()%( Abs(upperBound - lowerBound) + 1); 95 95 96 96 // translate to proper range … … 108 108 // float version. 109 109 // 110 _int MathUtil::Round(const float &num)110 int MathUtil::Round(const float &num) 111 111 { 112 112 if( num > 0 ) 113 return static_cast< _int>(num + .5);113 return static_cast<int>(num + .5); 114 114 else if (num < 0 ) 115 return static_cast< _int>(num - .5);115 return static_cast<int>(num - .5); 116 116 else 117 117 return 0; … … 125 125 // double version. 126 126 // 127 _int MathUtil::Round(const double &num)127 int MathUtil::Round(const double &num) 128 128 { 129 129 if( num > 0 ) 130 return static_cast< _int>(num + .5);130 return static_cast<int>(num + .5); 131 131 else if (num < 0 ) 132 return static_cast< _int>(num - .5);132 return static_cast<int>(num - .5); 133 133 else 134 134 return 0; … … 140 140 // PURPOSE: returns a mathematically correct modulus for int 141 141 // 142 _int MathUtil::SignedModulus(const _int &num, const _int &n)142 int MathUtil::SignedModulus(const int &num, const int &n) 143 143 { 144 144 if( num >= 0 ) … … 149 149 // we have to multiply by -1 to reflect it back. This method 150 150 // is faster than calling Abs() and then doing the modulus. 151 _int Tnum = -1*(num%n);151 int Tnum = -1*(num%n); 152 152 153 153 // if num%n equals 0, then n - Tnum will be n, which, logically … … 167 167 // PURPOSE: returns a mathematically correct modulus for long 168 168 // 169 _long MathUtil::SignedModulus(const _long &num, const _long &n)169 long MathUtil::SignedModulus(const long &num, const long &n) 170 170 { 171 171 if( num >= 0 ) … … 176 176 // we have to multiply by -1 to reflect it back. This method 177 177 // is faster than calling Abs() and then doing the modulus. 178 _long Tnum = -1*(num%n);178 long Tnum = -1*(num%n); 179 179 180 180 // if num%n equals 0, then n - Tnum will be n, which, logically … … 195 195 // NOTES: uses fmod() in math.h, which returns the modulus of floats 196 196 // 197 _float MathUtil::SignedModulus(const _float &num, const _float &n)197 float MathUtil::SignedModulus(const float &num, const float &n) 198 198 { 199 199 if( num >=0 ) 200 return static_cast< _float>( fmod(num,n) );201 else 202 { 203 // the % operator reflects the range if num < 0, so 204 // we have to multiply by -1 to reflect it back. This method 205 // is faster than calling Abs() and then doing the modulus. 206 _float Tnum = -1*( static_cast<_float>( fmod(num,n) ) );200 return static_cast<float>( fmod(num,n) ); 201 else 202 { 203 // the % operator reflects the range if num < 0, so 204 // we have to multiply by -1 to reflect it back. This method 205 // is faster than calling Abs() and then doing the modulus. 206 float Tnum = -1*( static_cast<float>( fmod(num,n) ) ); 207 207 208 208 // if num%n equals 0, then n - Tnum will be n, which, logically … … 224 224 // NOTES: uses fmod() in math.h, which returns the modulus of floats 225 225 // 226 _double MathUtil::SignedModulus(const _double &num, const _double &n)226 double MathUtil::SignedModulus(const double &num, const double &n) 227 227 { 228 228 if( num >=0 ) … … 233 233 // we have to multiply by -1 to reflect it back. This method 234 234 // is faster than calling Abs() and then doing the modulus. 235 _double Tnum = -1*( fmod(num,n) );235 double Tnum = -1*( fmod(num,n) ); 236 236 237 237 // if num%n equals 0, then n - Tnum will be n, which, logically -
ps/trunk/source/maths/MathUtil.h
r322 r332 55 55 namespace MathUtil 56 56 { 57 const _double PI = 3.14159265358932384;58 const _double FL_FP_TOLERANCE = .000000001;57 const double PI = 3.14159265358932384; 58 const double FL_FP_TOLERANCE = .000000001; 59 59 60 60 … … 86 86 // 87 87 template <typename T> 88 T Clamp(T &num, const _int &lowerBound,const _int &upperBound)88 T Clamp(T &num, const int &lowerBound,const int &upperBound) 89 89 { 90 90 if(num <= lowerBound) … … 129 129 // 130 130 template <typename T> 131 _int Sign(const T &num)131 int Sign(const T &num) 132 132 { 133 133 if( num > 0 ) … … 147 147 // 148 148 template <typename T> 149 inline _double Square(const T &num)149 inline double Square(const T &num) 150 150 { 151 151 return num*num; … … 192 192 //-------------------------------------------------------- 193 193 194 _int Ceiling(const float &num);195 _int Ceiling(const double &num);196 197 _bool CompareFloat(const _double &, const _double &);198 199 _int Floor(const float &num);200 _int Floor(const double &num);201 202 inline _double RadiansToDegrees(const _double &num);203 inline _double DegreesToRadians(const _double &num);204 205 _float Random(const _float &, const _float &);206 _int Random(const _int &,const _int &);207 208 _int Round(const float &num);209 _int Round(const double &num);210 211 _int SignedModulus(const _int &num, const _int &n);212 _long SignedModulus(const _long &num, const _long &n);213 _float SignedModulus(const _float &num, const _float &n);214 _double SignedModulus(const _double &num, const _double &n);194 int Ceiling(const float &num); 195 int Ceiling(const double &num); 196 197 bool CompareFloat(const double &, const double &); 198 199 int Floor(const float &num); 200 int Floor(const double &num); 201 202 inline double RadiansToDegrees(const double &num); 203 inline double DegreesToRadians(const double &num); 204 205 float Random(const float &, const float &); 206 int Random(const int &,const int &); 207 208 int Round(const float &num); 209 int Round(const double &num); 210 211 int SignedModulus(const int &num, const int &n); 212 long SignedModulus(const long &num, const long &n); 213 float SignedModulus(const float &num, const float &n); 214 double SignedModulus(const double &num, const double &n); 215 215 } 216 216 -
ps/trunk/source/ps/CStr.cpp
r289 r332 30 30 } 31 31 32 CStr::CStr( _int Number)32 CStr::CStr(int Number) 33 33 { 34 34 // Creates CStr from a int … … 36 36 } 37 37 38 CStr::CStr( _uint Number)38 CStr::CStr(unsigned int Number) 39 39 { 40 40 // Creates CStr from a uint … … 43 43 44 44 45 CStr::CStr( _long Number)45 CStr::CStr(long Number) 46 46 { 47 47 // Creates CStr from a long … … 50 50 51 51 52 CStr::CStr( _ulong Number)52 CStr::CStr(unsigned long Number) 53 53 { 54 54 // Creates CStr from a ulong … … 57 57 58 58 59 CStr::CStr( _float Number)59 CStr::CStr(float Number) 60 60 { 61 61 // Creates CStr from a float … … 64 64 } 65 65 66 CStr::CStr( _double Number)66 CStr::CStr(double Number) 67 67 { 68 68 // Creates CStr from a double … … 77 77 78 78 79 _int CStr::ToInt() const79 int CStr::ToInt() const 80 80 { 81 81 return _ttoi(m_String.c_str()); 82 82 } 83 83 84 _uint CStr::ToUInt() const85 { 86 return _uint(_ttoi(m_String.c_str()));87 } 88 89 _long CStr::ToLong() const84 unsigned int CStr::ToUInt() const 85 { 86 return unsigned int(_ttoi(m_String.c_str())); 87 } 88 89 long CStr::ToLong() const 90 90 { 91 91 return _ttol(m_String.c_str()); 92 92 } 93 93 94 _ulong CStr::ToULong() const95 { 96 return _ulong(_ttol(m_String.c_str()));97 } 98 99 100 _float CStr::ToFloat() const101 { 102 return ( _float)_tstod(m_String.c_str(), NULL);103 } 104 105 _double CStr::ToDouble() const94 unsigned long CStr::ToULong() const 95 { 96 return unsigned long(_ttol(m_String.c_str())); 97 } 98 99 100 float CStr::ToFloat() const 101 { 102 return (float)_tstod(m_String.c_str(), NULL); 103 } 104 105 double CStr::ToDouble() const 106 106 { 107 107 return _tstod(m_String.c_str(), NULL); … … 116 116 117 117 //Search the string for another string 118 _long CStr::Find(const CStr &Str) const119 { 120 _long Pos = (_long)m_String.find(Str.m_String, 0);118 long CStr::Find(const CStr &Str) const 119 { 120 long Pos = (long)m_String.find(Str.m_String, 0); 121 121 122 122 if (Pos != tstring::npos) … … 127 127 128 128 //Search the string for another string 129 _long CStr::Find(const TCHAR &tchar) const130 { 131 _long Pos = (_long)m_String.find(tchar, 0);129 long CStr::Find(const TCHAR &tchar) const 130 { 131 long Pos = (long)m_String.find(tchar, 0); 132 132 133 133 if (Pos != tstring::npos) … … 138 138 139 139 //Search the string for another string 140 _long CStr::Find(const int &start, const TCHAR &tchar) const141 { 142 _long Pos = (_long)m_String.find(tchar, start);140 long CStr::Find(const int &start, const TCHAR &tchar) const 141 { 142 long Pos = (long)m_String.find(tchar, start); 143 143 144 144 if (Pos != tstring::npos) … … 148 148 } 149 149 150 _long CStr::ReverseFind(const CStr &Str) const151 { 152 _long Pos = (_long)m_String.rfind(Str.m_String, m_String.length() );150 long CStr::ReverseFind(const CStr &Str) const 151 { 152 long Pos = (long)m_String.rfind(Str.m_String, m_String.length() ); 153 153 154 154 if (Pos != tstring::npos) … … 199 199 200 200 //Retreive the substring of the first n characters 201 CStr CStr::Left( _long len) const201 CStr CStr::Left(long len) const 202 202 { 203 203 return CStr( m_String.substr(0, len) ); … … 205 205 206 206 //Retreive the substring of the last n characters 207 CStr CStr::Right( _long len) const207 CStr CStr::Right(long len) const 208 208 { 209 209 return CStr( m_String.substr(m_String.length()-len, len) ); … … 299 299 } 300 300 301 CStr &CStr::operator=( _int Number)301 CStr &CStr::operator=(int Number) 302 302 { 303 303 m_String = _itot(Number, m_ConversionBuffer, 10); … … 305 305 } 306 306 307 CStr &CStr::operator=( _long Number)307 CStr &CStr::operator=(long Number) 308 308 { 309 309 m_String = _ltot(Number, m_ConversionBuffer, 10); … … 311 311 } 312 312 313 CStr &CStr::operator=( _uint Number)313 CStr &CStr::operator=(unsigned int Number) 314 314 { 315 315 m_String = _ultot(Number, m_ConversionBuffer, 10); … … 317 317 } 318 318 319 CStr &CStr::operator=( _ulong Number)319 CStr &CStr::operator=(unsigned long Number) 320 320 { 321 321 m_String = _ultot(Number, m_ConversionBuffer, 10); … … 324 324 325 325 326 CStr &CStr::operator=( _float Number)326 CStr &CStr::operator=(float Number) 327 327 { 328 328 _tsprintf(m_ConversionBuffer, FLOAT_CONVERSION, Number); … … 331 331 } 332 332 333 CStr &CStr::operator=( _double Number)333 CStr &CStr::operator=(double Number) 334 334 { 335 335 _tsprintf(m_ConversionBuffer, FLOAT_CONVERSION, Number); … … 338 338 } 339 339 340 _bool CStr::operator==(const CStr &Str) const340 bool CStr::operator==(const CStr &Str) const 341 341 { 342 342 return (m_String == Str.m_String); 343 343 } 344 344 345 _bool CStr::operator!=(const CStr &Str) const345 bool CStr::operator!=(const CStr &Str) const 346 346 { 347 347 return (m_String != Str.m_String); 348 348 } 349 349 350 _bool CStr::operator<(const CStr &Str) const350 bool CStr::operator<(const CStr &Str) const 351 351 { 352 352 return (m_String < Str.m_String); 353 353 } 354 354 355 _bool CStr::operator<=(const CStr &Str) const355 bool CStr::operator<=(const CStr &Str) const 356 356 { 357 357 return (m_String <= Str.m_String); 358 358 } 359 359 360 _bool CStr::operator>(const CStr &Str) const360 bool CStr::operator>(const CStr &Str) const 361 361 { 362 362 return (m_String > Str.m_String); 363 363 } 364 364 365 _bool CStr::operator>=(const CStr &Str) const365 bool CStr::operator>=(const CStr &Str) const 366 366 { 367 367 return (m_String >= Str.m_String); … … 392 392 393 393 394 TCHAR &CStr::operator[]( _int n)394 TCHAR &CStr::operator[](int n) 395 395 { 396 396 assert((size_t)n < m_String.length()); … … 398 398 } 399 399 400 TCHAR &CStr::operator[]( _uint n)400 TCHAR &CStr::operator[](unsigned int n) 401 401 { 402 402 assert(n < m_String.length()); 403 403 return m_String[n]; 404 404 } 405 TCHAR &CStr::operator[]( _long n)405 TCHAR &CStr::operator[](long n) 406 406 { 407 407 assert((size_t)n < m_String.length()); … … 409 409 } 410 410 411 TCHAR &CStr::operator[]( _ulong n)411 TCHAR &CStr::operator[](unsigned long n) 412 412 { 413 413 assert(n < m_String.length()); -
ps/trunk/source/ps/CStr.h
r289 r332 13 13 14 14 CStr MyString = _T("Hello, World."); 15 _int MyNum = 126;15 int MyNum = 126; 16 16 MyString += _T(" I'm the number ") += CStr(MyNumber); 17 17 … … 103 103 CStr(const TCHAR* String); // Creates CStr from C-Style TCHAR string 104 104 CStr(TCHAR Char); // Creates CStr from a TCHAR 105 CStr( _int Number); // Creates CStr from a int106 CStr( _uint Number); // Creates CStr from a uint107 CStr( _long Number); // Creates CStr from a long108 CStr( _ulong Number); // Creates CStr from a ulong109 CStr( _float Number); // Creates CStr from a float110 CStr( _double Number); // Creates CStr from a double105 CStr(int Number); // Creates CStr from a int 106 CStr(unsigned int Number); // Creates CStr from a uint 107 CStr(long Number); // Creates CStr from a long 108 CStr(unsigned long Number); // Creates CStr from a ulong 109 CStr(float Number); // Creates CStr from a float 110 CStr(double Number); // Creates CStr from a double 111 111 ~CStr(); // Destructor 112 112 113 113 // Conversions 114 _int ToInt() const;115 _uint ToUInt() const;116 _long ToLong() const;117 _ulong ToULong() const;118 _float ToFloat() const;119 _double ToDouble() const;114 int ToInt() const; 115 unsigned int ToUInt() const; 116 long ToLong() const; 117 unsigned long ToULong() const; 118 float ToFloat() const; 119 double ToDouble() const; 120 120 121 121 size_t Length() const {return m_String.length();} … … 124 124 125 125 //Search the string for another string 126 _long Find(const CStr &Str) const;126 long Find(const CStr &Str) const; 127 127 128 128 //Search the string for another string 129 _long Find(const TCHAR &tchar) const;129 long Find(const TCHAR &tchar) const; 130 130 131 131 //Search the string for another string 132 _long Find(const int &start, const TCHAR &tchar) const;132 long Find(const int &start, const TCHAR &tchar) const; 133 133 134 134 //You can also do a "ReverseFind"- i.e. search starting from the end 135 _long ReverseFind(const CStr &Str) const;135 long ReverseFind(const CStr &Str) const; 136 136 137 137 // Lowercase and uppercase … … 144 144 145 145 // Retreive the substring of the first n characters 146 CStr Left( _long len) const;146 CStr Left(long len) const; 147 147 148 148 // Retreive the substring of the last n characters 149 CStr Right( _long len) const;149 CStr Right(long len) const; 150 150 151 151 //Remove all occurences of some character or substring … … 162 162 CStr &operator=(const TCHAR* String); 163 163 CStr &operator=(TCHAR Char); 164 CStr &operator=( _int Number);165 CStr &operator=( _long Number);166 CStr &operator=( _uint Number);167 CStr &operator=( _ulong Number);168 CStr &operator=( _float Number);169 CStr &operator=( _double Number);170 171 _bool operator==(const CStr &Str) const;172 _bool operator!=(const CStr &Str) const;173 _bool operator<(const CStr &Str) const;174 _bool operator<=(const CStr &Str) const;175 _bool operator>(const CStr &Str) const;176 _bool operator>=(const CStr &Str) const;164 CStr &operator=(int Number); 165 CStr &operator=(long Number); 166 CStr &operator=(unsigned int Number); 167 CStr &operator=(unsigned long Number); 168 CStr &operator=(float Number); 169 CStr &operator=(double Number); 170 171 bool operator==(const CStr &Str) const; 172 bool operator!=(const CStr &Str) const; 173 bool operator<(const CStr &Str) const; 174 bool operator<=(const CStr &Str) const; 175 bool operator>(const CStr &Str) const; 176 bool operator>=(const CStr &Str) const; 177 177 CStr &operator+=(const CStr &Str); 178 178 CStr operator+(const CStr &Str); 179 179 operator const TCHAR*(); 180 180 operator const TCHAR*() const; // Gee, I've added this, Maybe the one above should be removed? 181 TCHAR &operator[]( _int n);182 TCHAR &operator[]( _uint n);183 TCHAR &operator[]( _long n);184 TCHAR &operator[]( _ulong n);181 TCHAR &operator[](int n); 182 TCHAR &operator[](unsigned int n); 183 TCHAR &operator[](long n); 184 TCHAR &operator[](unsigned long n); 185 185 186 186 inline const char *c_str() -
ps/trunk/source/ps/Config.cpp
r157 r332 111 111 PS_RESULT CConfig::Update() 112 112 { 113 _int slice = 0;114 _int failed = 0;113 int slice = 0; 114 int failed = 0; 115 115 struct stat FileInfo; 116 116 … … 212 212 { 213 213 // Mostly identical to Update(), above. 214 _int failed = 0;215 _int notfound = 0;214 int failed = 0; 215 int notfound = 0; 216 216 struct stat FileInfo; 217 217 -
ps/trunk/source/ps/Encryption.cpp
r5 r332 9 9 // to call delete[]. 10 10 //-------------------------------------------------------------------- 11 _byte *EncryptData(_byte *Data, _long DataLength, _byte *Key, _long KeyLength)11 char *EncryptData(char *Data, long DataLength, char *Key, long KeyLength) 12 12 { 13 13 // Allocate space for new Encrypted data 14 _byte *NewData = new _byte[DataLength];14 char *NewData = new char[DataLength]; 15 15 16 16 // A counter to hold our absolute position in data 17 _long DataOffset = 0;17 long DataOffset = 0; 18 18 19 19 // Loop through Data until end is reached … … 21 21 { 22 22 // Loop through the key 23 for ( _long KeyOffset = 0; KeyOffset < KeyLength; KeyOffset++)23 for (long KeyOffset = 0; KeyOffset < KeyLength; KeyOffset++) 24 24 { 25 25 // If were at end of data break and the the while loop should end as well. … … 51 51 // to call delete[]. 52 52 //-------------------------------------------------------------------- 53 _byte *DecryptData(_byte *Data, _long DataLength, _byte *Key, _long KeyLength)53 char *DecryptData(char *Data, long DataLength, char *Key, long KeyLength) 54 54 { 55 55 // Allocate space for new Decrypted data 56 _byte *NewData = new _byte[DataLength];56 char *NewData = new char[DataLength]; 57 57 58 58 // A counter to hold our absolute position in data 59 _long DataOffset = 0;59 long DataOffset = 0; 60 60 61 61 // Loop through Data until end is reached … … 63 63 { 64 64 // Loop through the key 65 for ( _long KeyOffset = 0; KeyOffset < KeyLength; KeyOffset++)65 for (long KeyOffset = 0; KeyOffset < KeyLength; KeyOffset++) 66 66 { 67 67 // If were at end of data break and the the while loop should end as well. -
ps/trunk/source/ps/Encryption.h
r5 r332 8 8 advice using 128bit keys which you can define as such. 9 9 10 _byte MyKey[16] = { _byte(0xAF), _byte(0x2B), _byte(0x80), _byte(0x7E),11 _byte(0x09), _byte(0x23), _byte(0xCC), _byte(0x95),12 _byte(0xB4), _byte(0x2D), _byte(0xF4), _byte(0x90),13 _byte(0xB3), _byte(0xC4), _byte(0x2A), _byte(0x3B) };10 char MyKey[16] = { char(0xAF), char(0x2B), char(0x80), char(0x7E), 11 char(0x09), char(0x23), char(0xCC), char(0x95), 12 char(0xB4), char(0x2D), char(0xF4), char(0x90), 13 char(0xB3), char(0xC4), char(0x2A), char(0x3B) }; 14 14 15 15 There may be a better way to do this but this looks alright to me. … … 23 23 24 24 // Simple Encryption function 25 _byte *EncryptData(_byte *Data, _long DataLength, _byte *Key, _long KeyLength);25 char *EncryptData(char *Data, long DataLength, char *Key, long KeyLength); 26 26 27 27 // Simple Decryption function 28 _byte *DecryptData(_byte *Data, _long DataLength, _byte *Key, _long KeyLength);28 char *DecryptData(char *Data, long DataLength, char *Key, long KeyLength); 29 29 30 30 #endif -
ps/trunk/source/ps/LogFile.cpp
r157 r332 53 53 // 3rd parameter determines whether the error frame is shown. 54 54 //------------------------------------------------- 55 CLogFile::CLogFile(string FileName, string PageTitle, _bool WithFrame)55 CLogFile::CLogFile(string FileName, string PageTitle, bool WithFrame) 56 56 { 57 57 … … 105 105 //Opens an error file. If WithFrame is true then it constructs a framed page. 106 106 //------------------------------------------------- 107 PS_RESULT CLogFile::Open(string FileName, string PageTitle, _bool WithFrame)107 PS_RESULT CLogFile::Open(string FileName, string PageTitle, bool WithFrame) 108 108 { 109 109 if(m_IsFileOpen) -
ps/trunk/source/ps/LogFile.h
r5 r332 70 70 public: 71 71 72 PS_DISPLAY_SETTINGS( _int Line, _char *File, _char *Date, PS_DISPLAY_MODE DisplayMode)72 PS_DISPLAY_SETTINGS(int Line, char *File, char *Date, PS_DISPLAY_MODE DisplayMode) 73 73 { 74 74 line=Line; … … 78 78 } 79 79 80 _int line;81 _char *file;82 _char *date;80 int line; 81 char *file; 82 char *date; 83 83 PS_DISPLAY_MODE displayMode; 84 84 }; … … 95 95 CLogFile(); 96 96 ~CLogFile(); 97 CLogFile(string FileName, string PageTitle, _bool WithFrame=false);97 CLogFile(string FileName, string PageTitle, bool WithFrame=false); 98 98 99 99 //Opens a file for output the 3rd parameter can be set to true to enable the error frame. 100 PS_RESULT Open(string FileName, string PageTitle, _bool WithFrame=false);100 PS_RESULT Open(string FileName, string PageTitle, bool WithFrame=false); 101 101 102 102 //Closes the file. … … 134 134 135 135 private: 136 _bool m_IsFileOpen; //Is the file open.137 _bool m_HasFrame; //Have frames been enabled.136 bool m_IsFileOpen; //Is the file open. 137 bool m_HasFrame; //Have frames been enabled. 138 138 ofstream m_TheFile; //The main file. 139 139 ofstream m_ErrorFile; //The error link file, used only for frames. 140 140 string m_CurrentColour; //The current colour. 141 141 string m_FileName; //The name of the main file. 142 _int m_ErrNo; //The error number.142 int m_ErrNo; //The error number. 143 143 144 144 //Sets the current alignment of the text. -
ps/trunk/source/ps/Parser.cpp
r287 r332 21 21 bool CParserValue::func_name(type &ret) \ 22 22 { \ 23 _double d; \23 double d; \ 24 24 if (GetDouble(d)) \ 25 25 return ret = (type)d, true; \ … … 43 43 //------------------------------------------------- 44 44 45 static bool _IsStrictNameChar(const _char& c);46 static bool _IsValueChar(const _char& c);45 static bool _IsStrictNameChar(const char& c); 46 static bool _IsValueChar(const char& c); 47 47 48 48 … … 51 51 52 52 // Checks ident 53 static bool _IsStrictNameChar(const _char& c)53 static bool _IsStrictNameChar(const char& c) 54 54 { 55 55 return ((c >= 'a' && c <= 'z') || … … 59 59 60 60 // Checks value 61 static bool _IsValueChar(const _char& c)61 static bool _IsValueChar(const char& c) 62 62 { 63 63 return ((c >= 'a' && c <= 'z') || … … 112 112 113 113 // double 114 bool CParserValue::GetDouble( _double &ret)114 bool CParserValue::GetDouble(double &ret) 115 115 { 116 116 // locals 117 _double TempRet = 0.0;117 double TempRet = 0.0; 118 118 int Size = (int)m_String.size(); 119 119 int i; … … 190 190 // the function in the macro argument for CParserValue 191 191 // They use GetDouble, and then type-cast it 192 FUNC_IMPL_CAST_GETDOUBLE(GetFloat, _float)193 FUNC_IMPL_CAST_GETDOUBLE(GetChar, _char)194 FUNC_IMPL_CAST_GETDOUBLE(GetShort, _short)192 FUNC_IMPL_CAST_GETDOUBLE(GetFloat, float) 193 FUNC_IMPL_CAST_GETDOUBLE(GetChar, char) 194 FUNC_IMPL_CAST_GETDOUBLE(GetShort, short) 195 195 FUNC_IMPL_CAST_GETDOUBLE(GetInt, int) 196 FUNC_IMPL_CAST_GETDOUBLE(GetLong, _long)197 FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedShort, _ushort)198 FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedInt, _uint)199 FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedLong, _ulong)196 FUNC_IMPL_CAST_GETDOUBLE(GetLong, long) 197 FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedShort, unsigned short) 198 FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedInt, unsigned int) 199 FUNC_IMPL_CAST_GETDOUBLE(GetUnsignedLong, unsigned long) 200 200 201 201 // CParserTaskTypeNode … … 277 277 FUNC_IMPL_GETARG(GetArgString, GetString, string) 278 278 FUNC_IMPL_GETARG(GetArgBool, GetBool, bool) 279 FUNC_IMPL_GETARG(GetArgChar, GetChar, _char)280 FUNC_IMPL_GETARG(GetArgShort, GetShort, _short)279 FUNC_IMPL_GETARG(GetArgChar, GetChar, char) 280 FUNC_IMPL_GETARG(GetArgShort, GetShort, short) 281 281 FUNC_IMPL_GETARG(GetArgInt, GetInt, int) 282 FUNC_IMPL_GETARG(GetArgLong, GetLong, _long)283 FUNC_IMPL_GETARG(GetArgUnsignedShort, GetUnsignedShort, _ushort)284 FUNC_IMPL_GETARG(GetArgUnsignedInt, GetUnsignedInt, _uint)285 FUNC_IMPL_GETARG(GetArgUnsignedLong, GetUnsignedLong, _ulong)286 FUNC_IMPL_GETARG(GetArgFloat, GetFloat, _float)287 FUNC_IMPL_GETARG(GetArgDouble, GetDouble, _double)282 FUNC_IMPL_GETARG(GetArgLong, GetLong, long) 283 FUNC_IMPL_GETARG(GetArgUnsignedShort, GetUnsignedShort, unsigned short) 284 FUNC_IMPL_GETARG(GetArgUnsignedInt, GetUnsignedInt, unsigned int) 285 FUNC_IMPL_GETARG(GetArgUnsignedLong, GetUnsignedLong, unsigned long) 286 FUNC_IMPL_GETARG(GetArgFloat, GetFloat, float) 287 FUNC_IMPL_GETARG(GetArgDouble, GetDouble, double) 288 288 289 289 // ParseString … … 308 308 bool Extract=false; 309 309 int ExtractPos=0; 310 _char Buffer[256];311 _char Letter[] = {'\0','\0'}; // Letter as string310 char Buffer[256]; 311 char Letter[] = {'\0','\0'}; // Letter as string 312 312 vector<string> Segments; 313 313 string strSub; … … 339 339 Extract = true; 340 340 ExtractPos = i; 341 memset((void*)Buffer, '\0', sizeof( _char)*256);341 memset((void*)Buffer, '\0', sizeof(char)*256); 342 342 } 343 343 else … … 827 827 Extract = true; 828 828 ExtractPos = i+1; // Skip $ 829 memset((void*)Buffer, '\0', sizeof( _char)*REGULAR_MAX_LENGTH);829 memset((void*)Buffer, '\0', sizeof(char)*REGULAR_MAX_LENGTH); 830 830 831 831 // We don't want to extract '$' so we'll just continue to next loop run -
ps/trunk/source/ps/Parser.h
r157 r332 76 76 77 77 // return is error status 78 _bool GetString(std::string &ret);79 _bool GetBool(_bool &ret);80 _bool GetChar(_char &ret); // As number! otherwise use GetString make sure size=181 _bool GetShort(_short &ret);82 _bool GetInt(_int &ret);83 _bool GetLong(_long &ret);84 _bool GetUnsignedShort(_ushort &ret);85 _bool GetUnsignedInt(_uint &ret);86 _bool GetUnsignedLong(_ulong &ret);87 _bool GetFloat(float &ret);88 _bool GetDouble(double &ret);78 bool GetString(std::string &ret); 79 bool GetBool(bool &ret); 80 bool GetChar(char &ret); // As number! otherwise use GetString make sure size=1 81 bool GetShort(short &ret); 82 bool GetInt(int &ret); 83 bool GetLong(long &ret); 84 bool GetUnsignedShort(unsigned short &ret); 85 bool GetUnsignedInt(unsigned int &ret); 86 bool GetUnsignedLong(unsigned long &ret); 87 bool GetFloat(float &ret); 88 bool GetDouble(double &ret); 89 89 90 90 // Memory regardless if it's an int, real, string or whatever … … 117 117 // Either the node is a letter or a type, if m_Leter is '\0' 118 118 // then check m_Type what it is 119 _char m_Letter;119 char m_Letter; 120 120 _ParserValueType m_Type; 121 121 std::string m_String; // Used for diverse storage … … 130 130 // true means AltNode can be looped <...> 131 131 // false means AltNode is just an optional part [...] 132 _bool m_AltNodeRepeatable;132 bool m_AltNodeRepeatable; 133 133 134 134 // Whenever a dynamic argument is used, it's first node is stored in this … … 171 171 172 172 std::deque<CParserValue> m_Arguments; 173 _bool m_ParseOK; // same as ParseString will return173 bool m_ParseOK; // same as ParseString will return 174 174 std::string m_TaskTypeName; // Name of the task type found 175 175 176 176 protected: 177 _bool ClearArguments();177 bool ClearArguments(); 178 178 179 179 public: 180 180 // Interface 181 _bool ParseString(const CParser& parser, std::string line);181 bool ParseString(const CParser& parser, std::string line); 182 182 183 183 // Methods for getting arguments 184 184 // it returns success 185 _bool GetArgString (const _int& arg, std::string &ret);186 _bool GetArgBool (const _int& arg, _bool &ret);187 _bool GetArgChar (const _int& arg, _char &ret);188 _bool GetArgShort (const _int& arg, _short &ret);189 _bool GetArgInt (const _int& arg, _int &ret);190 _bool GetArgLong (const _int& arg, _long &ret);191 _bool GetArgUnsignedShort (const _int& arg, _ushort &ret);192 _bool GetArgUnsignedInt (const _int& arg, _uint &ret);193 _bool GetArgUnsignedLong (const _int& arg, _ulong &ret);194 _bool GetArgFloat (const _int& arg, float &ret);195 _bool GetArgDouble (const _int& arg, double &ret);185 bool GetArgString (const int& arg, std::string &ret); 186 bool GetArgBool (const int& arg, bool &ret); 187 bool GetArgChar (const int& arg, char &ret); 188 bool GetArgShort (const int& arg, short &ret); 189 bool GetArgInt (const int& arg, int &ret); 190 bool GetArgLong (const int& arg, long &ret); 191 bool GetArgUnsignedShort (const int& arg, unsigned short &ret); 192 bool GetArgUnsignedInt (const int& arg, unsigned int &ret); 193 bool GetArgUnsignedLong (const int& arg, unsigned long &ret); 194 bool GetArgFloat (const int& arg, float &ret); 195 bool GetArgDouble (const int& arg, double &ret); 196 196 197 197 // Get Argument count … … 211 211 212 212 // Interface 213 _bool InputTaskType(const std::string& strName, const std::string& strSyntax);213 bool InputTaskType(const std::string& strName, const std::string& strSyntax); 214 214 }; 215 215 -
ps/trunk/source/ps/Prometheus.cpp
r74 r332 3 3 // Globals 4 4 int g_xres = 800, g_yres = 600; 5 int g_bpp = 32; 6 int g_freq = 60; 5 7 6 8 DEFINE_ERROR(PS_OK, "OK"); -
ps/trunk/source/ps/Prometheus.h
r208 r332 10 10 #define PROMETHEUS_H 11 11 12 #pragma warning (disable : 4786) // VC6 template warning spew13 #pragma warning (disable : 4291)14 12 15 13 #include <stdio.h> … … 20 18 // Globals 21 19 extern int g_xres, g_yres; 20 extern int g_bpp; 21 extern int g_freq; 22 22 23 24 // Standard typedefs25 26 typedef int _int;27 typedef unsigned int _unsigned_int;28 29 typedef long _long;30 typedef unsigned long _unsigned_long;31 32 typedef bool _bool;33 34 typedef char _char;35 typedef unsigned char _unsigned_char;36 37 typedef char _byte;38 typedef unsigned char _unsigned_byte;39 40 typedef float _float;41 typedef double _double;42 43 typedef unsigned short _unsigned_short;44 typedef unsigned short _ushort;45 typedef short _short;46 typedef unsigned long _ulong;47 typedef unsigned int _uint;48 23 49 24 // Error handling
Note:
See TracChangeset
for help on using the changeset viewer.
