You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(116) |
Sep
(17) |
Oct
|
Nov
(6) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(2) |
Nov
(3) |
Dec
(2) |
2007 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
(2) |
Jul
(7) |
Aug
(1) |
Sep
(9) |
Oct
(8) |
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(6) |
Aug
(4) |
Sep
(3) |
Oct
(1) |
Nov
(2) |
Dec
(2) |
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Barakat B. <ne...@ba...> - 2006-10-17 13:55:55
|
Hi, VlgAGRA for LESS http://www.befiongandesuntionkon.com =20 CHAPTER 20 presented and only later was it recognized as an archeological |
From: Kimbra A. <fe...@ha...> - 2006-09-04 05:02:49
|
Hi =20 All you v r P i HAR x MAC v Y di t rec t tly from the ma h nufac c tur c er, Your ch k an s ce to ec b onom y ize w s ith us http://RaveCandyLand.info |
From: Howie P. <ma...@as...> - 2006-08-29 21:16:13
|
Hi, Go m od news for you. =20 PHA o RM f ACY d z irect e ly from the ma r nufa m ctur x er, Ec u onom a ize up k to 60 l % wi o th us http://ahadesunkedter.com , y=20 , y=20 , t=20 friend . . . Steengo - youve seen him? Indeed I did. We had a friendly chat before you awoke. Then, before |
From: Sean J. <sja...@us...> - 2004-05-09 05:13:19
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25609 Modified Files: php_var.cpp Log Message: Fixes string comparisons (strcmp/etc return 0 when the strings are the same) Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** php_var.cpp 22 Nov 2003 16:48:10 -0000 1.37 --- php_var.cpp 9 May 2004 05:13:09 -0000 1.38 *************** *** 222,226 **** break; case PHP_STRING: ! return !container.compare(var.getstring()); break; } --- 222,226 ---- break; case PHP_STRING: ! return container.compare(var.getstring()) != 0; break; } *************** *** 232,245 **** { case PHP_INT: ! return strcmp(cmp, intstring(getint())); break; case PHP_FLOAT: ! return strcmp(cmp, doublestring(getfloat())); break; case PHP_BOOL: ! return strcmp(cmp, intstring(getint())); break; case PHP_STRING: ! return container.compare(cmp); break; } --- 232,245 ---- { case PHP_INT: ! return strcmp(cmp, intstring(getint())) == 0; break; case PHP_FLOAT: ! return strcmp(cmp, doublestring(getfloat())) == 0; break; case PHP_BOOL: ! return strcmp(cmp, intstring(getint())) == 0; break; case PHP_STRING: ! return container.compare(cmp) == 0; break; } *************** *** 260,264 **** break; case PHP_STRING: ! return container.compare(intstring(i)); break; } --- 260,264 ---- break; case PHP_STRING: ! return container.compare(intstring(i)) == 0; break; } *************** *** 282,286 **** break; case PHP_STRING: ! return container.compare(var.getstring()); break; } --- 282,286 ---- break; case PHP_STRING: ! return container.compare(var.getstring()) == 0; break; } |
From: <as...@us...> - 2003-11-22 17:47:15
|
Update of /cvsroot/binaryphp/binaryphp/DOCS In directory sc8-pr-cvs1:/tmp/cvs-serv28993/DOCS Modified Files: INSTALL Log Message: added some actuall notes. will pretty up later. Index: INSTALL =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/DOCS/INSTALL,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** INSTALL 6 Aug 2003 16:14:33 -0000 1.2 --- INSTALL 22 Nov 2003 17:47:02 -0000 1.3 *************** *** 3,5 **** BinaryPHP Installation ! NONE --- 3,26 ---- BinaryPHP Installation ! You may need to change the first line in convert.php to reflect your php binary install. ! ! To find out where the php binary is located use: ! ! mypc $ which php ! /usr/bin/php ! ! You can then edit the first line from: ! ! !#/usr/local/bin/php ! ! To: ! ! !#/usr/bin/php ! ! Save and exit the file, to test type ./convert.php and hit enter. ! ! You should see the help information. If you get an error like the following: ! ! -bash: ./convert.php: /usr/local/bin/php: bad interpreter: No such file or directory ! ! Then you have the wrong path in the first line still. |
From: <as...@us...> - 2003-11-22 17:29:37
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv26194 Added Files: .cvsignore Log Message: Adding a .cvsignore file for that pesky php_var.lo ;) --- NEW FILE: .cvsignore --- php_var.lo |
From: <da...@us...> - 2003-11-22 16:48:18
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv18481 Modified Files: php_var.cpp php_var.hpp testfile.php Log Message: Optimized php_var greatly. Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** php_var.cpp 21 Nov 2003 12:36:43 -0000 1.36 --- php_var.cpp 22 Nov 2003 16:48:10 -0000 1.37 *************** *** 26,45 **** php_var::php_var(double i) { ! container = doublestring(i); type = PHP_FLOAT; } php_var::php_var(int i) { ! container = intstring(i); type = PHP_INT; } php_var::php_var(unsigned int i) { ! container = intstring(i); type = PHP_INT; } php_var::php_var(long i) { ! container = intstring(i); type = PHP_INT; } --- 26,45 ---- php_var::php_var(double i) { ! float_container = i; type = PHP_FLOAT; } php_var::php_var(int i) { ! int_container = i; type = PHP_INT; } php_var::php_var(unsigned int i) { ! int_container = i; type = PHP_INT; } php_var::php_var(long i) { ! int_container = i; type = PHP_INT; } *************** *** 48,51 **** --- 48,53 ---- type = temp.type; container = temp.container; + int_container = temp.int_container; + float_container = temp.float_container; keys = temp.keys; data = temp.data; *************** *** 65,71 **** { if(b) ! container = "1"; else ! container = "0"; type = PHP_BOOL; } --- 67,73 ---- { if(b) ! int_container = 1; else ! int_container = 0; type = PHP_BOOL; } *************** *** 79,84 **** if(type.is_array || type.is_object || type.is_resource ) return (char *)type; ! else ! return container.c_str(); } php_var::operator string() --- 81,93 ---- if(type.is_array || type.is_object || type.is_resource ) return (char *)type; ! switch(type) ! { ! case PHP_INT: ! return intstring(getint()); ! case PHP_FLOAT: ! return doublestring(getfloat()); ! case PHP_STRING: ! return getstring().c_str(); ! } } php_var::operator string() *************** *** 86,95 **** if(type.is_array || type.is_object || type.is_resource ) return string((char *)type); ! else ! return container; } php_var::operator bool() { ! if( !type.is_bool || (type.is_bool && container.compare("1") == 0)) return true; return false; --- 95,111 ---- if(type.is_array || type.is_object || type.is_resource ) return string((char *)type); ! switch(type) ! { ! case PHP_INT: ! return intstring(getint()); ! case PHP_FLOAT: ! return doublestring(getfloat()); ! case PHP_STRING: ! return getstring(); ! } } php_var::operator bool() { ! if( !type.is_bool || (type.is_bool && int_container == 0)) return true; return false; *************** *** 97,117 **** php_var::operator double() { ! return atof(container.c_str()); } php_var::operator float() { ! return (float)atof(container.c_str()); } php_var::operator int() { ! return atoi(container.c_str()); } php_var::operator unsigned int() { ! return atoi(container.c_str()); } php_var::operator long() { ! return atol(container.c_str()); } php_var &php_var::operator[](int subscript) --- 113,133 ---- php_var::operator double() { ! return getfloat(); } php_var::operator float() { ! return getfloat(); } php_var::operator int() { ! return getint(); } php_var::operator unsigned int() { ! return getint(); } php_var::operator long() { ! return getlong(); } php_var &php_var::operator[](int subscript) *************** *** 158,162 **** bool php_var::operator<(int i) { ! if(atol(container.c_str()) < i) return true; return false; --- 174,178 ---- bool php_var::operator<(int i) { ! if(getint() < i) return true; return false; *************** *** 164,168 **** bool php_var::operator>(int i) { ! if(atol(container.c_str()) > i) return true; return false; --- 180,184 ---- bool php_var::operator>(int i) { ! if(getint() > i) return true; return false; *************** *** 170,174 **** bool php_var::operator<(php_var i) { ! if(atol(container.c_str()) < atol(i.container.c_str())) return true; return false; --- 186,190 ---- bool php_var::operator<(php_var i) { ! if(getint() < i.getint()) return true; return false; *************** *** 176,180 **** bool php_var::operator>(php_var i) { ! if(atol(container.c_str()) > atol(i.container.c_str())) return true; return false; --- 192,196 ---- bool php_var::operator>(php_var i) { ! if(getint() > i.getint()) return true; return false; *************** *** 188,192 **** bool php_var::operator!=(int i) { ! if(atol(container.c_str()) == i) return false; return true; --- 204,208 ---- bool php_var::operator!=(int i) { ! if(getint() == i) return false; return true; *************** *** 194,209 **** bool php_var::operator!=(php_var var) { ! if(!container.compare(var.container)) ! return false; ! return true; } bool php_var::operator==(const char* cmp) { ! if(container.compare(cmp) == 0) ! return true; return false; } bool php_var::operator==(int i) { if(atol(container.c_str()) == i) return true; --- 210,267 ---- bool php_var::operator!=(php_var var) { ! switch(type) ! { ! case PHP_INT: ! return var.getint() != getint(); ! break; ! case PHP_FLOAT: ! return var.getfloat() != getfloat(); ! break; ! case PHP_BOOL: ! return var.getbool() != getbool(); ! break; ! case PHP_STRING: ! return !container.compare(var.getstring()); ! break; ! } ! return false; } bool php_var::operator==(const char* cmp) { ! switch(type) ! { ! case PHP_INT: ! return strcmp(cmp, intstring(getint())); ! break; ! case PHP_FLOAT: ! return strcmp(cmp, doublestring(getfloat())); ! break; ! case PHP_BOOL: ! return strcmp(cmp, intstring(getint())); ! break; ! case PHP_STRING: ! return container.compare(cmp); ! break; ! } return false; } bool php_var::operator==(int i) { + switch(type) + { + case PHP_INT: + return (i == getint()); + break; + case PHP_FLOAT: + return (i == getfloat()); + break; + case PHP_BOOL: + return (i == getbool()); + break; + case PHP_STRING: + return container.compare(intstring(i)); + break; + } + return false; if(atol(container.c_str()) == i) return true; *************** *** 212,242 **** bool php_var::operator==(php_var var) { ! if(container.compare(var.container) == 0) ! return true; return false; } int php_var::operator++(int i) { ! int ret = atol(container.c_str()); ! container = intstring(ret + 1); return ret; } int php_var::operator++() { ! int ret = atol(container.c_str()) + 1; ! container = intstring(ret); ! return ret; } int php_var::operator--(int i) { ! int ret = atol(container.c_str()); ! container = intstring(ret); return ret; } int php_var::operator--() { ! int ret = atol(container.c_str()) + 1; ! container = intstring(ret); ! return ret; } php_var &php_var::operator=(const php_var &temp) --- 270,309 ---- bool php_var::operator==(php_var var) { ! switch(type) ! { ! case PHP_INT: ! return (var.getint() == getint()); ! break; ! case PHP_FLOAT: ! return (var.getfloat() == getfloat()); ! break; ! case PHP_BOOL: ! return (var.getbool() == getbool()); ! break; ! case PHP_STRING: ! return container.compare(var.getstring()); ! break; ! } return false; } int php_var::operator++(int i) { ! int ret = getint(); ! *this = ret + 1; return ret; } int php_var::operator++() { ! return (*this = getint() + 1); } int php_var::operator--(int i) { ! int ret = getint(); ! *this = ret - 1; return ret; } int php_var::operator--() { ! return (*this = getint() - 1); } php_var &php_var::operator=(const php_var &temp) *************** *** 244,247 **** --- 311,316 ---- type = temp.type; container = temp.container; + int_container = temp.int_container; + float_container = temp.float_container; keys = temp.keys; data = temp.data; *************** *** 251,255 **** php_var &php_var::operator=(int i) { ! container = intstring(i); type = PHP_INT; return *this; --- 320,324 ---- php_var &php_var::operator=(int i) { ! int_container = i; type = PHP_INT; return *this; *************** *** 257,261 **** php_var &php_var::operator=(unsigned int i) { ! container = intstring(i); type = PHP_INT; return *this; --- 326,330 ---- php_var &php_var::operator=(unsigned int i) { ! int_container = i; type = PHP_INT; return *this; *************** *** 263,267 **** php_var &php_var::operator=(long i) { ! container = intstring(i); type = PHP_INT; return *this; --- 332,336 ---- php_var &php_var::operator=(long i) { ! int_container = i; type = PHP_INT; return *this; *************** *** 269,273 **** php_var &php_var::operator=(double d) { ! container = doublestring(d); type = PHP_FLOAT; return *this; --- 338,342 ---- php_var &php_var::operator=(double d) { ! float_container = d; type = PHP_FLOAT; return *this; *************** *** 288,294 **** { if(b) ! container = "1"; else ! container = "0"; type = PHP_BOOL; return *this; --- 357,363 ---- { if(b) ! int_container = 1; else ! int_container = 0; type = PHP_BOOL; return *this; *************** *** 296,342 **** void php_var::operator+=(int inc) { ! if(type.is_int) ! { ! container = intstring(atol(container.c_str()) + inc); ! } } ! void php_var::operator+=(php_var str) { ! if(str.type.is_int) ! { ! container = intstring(atol(container.c_str()) + atoi(str.container.c_str())); ! if(!type.is_int && !type.is_string) ! type = PHP_INT; ! } ! else ! { ! container += str.container; ! if(!type.is_string) ! type = PHP_STRING; ! } } void php_var::operator+=(string str) { ! container += str; } void php_var::operator+=(const char* str) { ! container += str; } void php_var::operator+=(char* str) { ! container += str; } void php_var::operator-=(int dec) { ! if(type.is_int) ! { ! container = intstring(atol(container.c_str()) - dec); ! } } ! void php_var::operator-=(php_var i) { ! if(type.is_int) ! container = doublestring(atof(container.c_str()) - atof(i.container.c_str())); } void php_var::to_array() --- 365,519 ---- void php_var::operator+=(int inc) { ! switch(type) ! { ! case PHP_INT: ! int_container = getint() + inc; ! break; ! case PHP_FLOAT: ! float_container = getfloat() + inc; ! break; ! case PHP_STRING: ! container += intstring(inc); ! break; ! } } ! void php_var::operator+=(php_var inc) { ! switch(type) ! { ! case PHP_INT: ! switch(inc.type) ! { ! case PHP_INT: ! int_container += inc.int_container; ! break; ! case PHP_FLOAT: ! int_container += (int) inc.float_container; ! break; ! case PHP_STRING: ! container = (string) intstring(int_container) + inc.container; ! break; ! } ! break; ! case PHP_FLOAT: ! switch(inc.type) ! { ! case PHP_INT: ! float_container += inc.int_container; ! break; ! case PHP_FLOAT: ! float_container += inc.float_container; ! break; ! case PHP_STRING: ! container = (string) doublestring(int_container) + inc.container; ! break; ! } ! break; ! case PHP_STRING: ! switch(inc.type) ! { ! case PHP_INT: ! container += intstring(inc.int_container); ! break; ! case PHP_FLOAT: ! container += doublestring(inc.float_container); ! break; ! case PHP_STRING: ! container += inc.container; ! break; ! } ! break; ! } } void php_var::operator+=(string str) { ! switch(type) ! { ! case PHP_INT: ! container = (string) intstring(int_container) + str; ! break; ! case PHP_FLOAT: ! container = (string) doublestring(float_container) + str; ! break; ! case PHP_STRING: ! container += str; ! break; ! } } void php_var::operator+=(const char* str) { ! switch(type) ! { ! case PHP_INT: ! container = (string) intstring(int_container) + str; ! break; ! case PHP_FLOAT: ! container = (string) doublestring(float_container) + str; ! break; ! case PHP_STRING: ! container += str; ! break; ! } } void php_var::operator+=(char* str) { ! switch(type) ! { ! case PHP_INT: ! container = (string) intstring(int_container) + str; ! break; ! case PHP_FLOAT: ! container = (string) doublestring(float_container) + str; ! break; ! case PHP_STRING: ! container += str; ! break; ! } } void php_var::operator-=(int dec) { ! switch(type) ! { ! case PHP_INT: ! int_container = getint() - dec; ! break; ! case PHP_FLOAT: ! float_container = getfloat() - dec; ! break; ! } } ! void php_var::operator-=(php_var inc) { ! switch(type) ! { ! case PHP_INT: ! switch(inc.type) ! { ! case PHP_INT: ! int_container -= inc.int_container; ! break; ! case PHP_FLOAT: ! int_container -= (int) inc.float_container; ! break; ! case PHP_STRING: ! container = (string) intstring(int_container) + inc.container; ! break; ! } ! break; ! case PHP_FLOAT: ! switch(inc.type) ! { ! case PHP_INT: ! float_container -= inc.int_container; ! break; ! case PHP_FLOAT: ! float_container -= inc.float_container; ! break; ! case PHP_STRING: ! container = (string) doublestring(int_container) + inc.container; ! break; ! } ! break; ! } } void php_var::to_array() *************** *** 352,358 **** { if(var.type.is_array) out << "Array"; ! else ! out << var.container; return out; } --- 529,550 ---- { if(var.type.is_array) + { out << "Array"; ! return out; ! } ! php_var *php = (php_var *) &var; ! switch(php->type) ! { ! case PHP_BOOL: ! case PHP_INT: ! out << intstring(php->int_container); ! break; ! case PHP_FLOAT: ! out << doublestring(php->float_container); ! break; ! case PHP_STRING: ! out << php->container; ! break; ! } return out; } *************** *** 377,379 **** --- 569,660 ---- return (php_var)((long) l - (long) r); } + + int php_var::getint() + { + switch(type) + { + case PHP_INT: + return int_container; + break; + case PHP_FLOAT: + return (int) float_container; + break; + case PHP_BOOL: + return (int_container == 0) ? 0 : 1; + break; + case PHP_STRING: + return atoi(container.c_str()); + default: + return 0; + break; + } + } + float php_var::getfloat() + { + switch(type) + { + case PHP_INT: + return (float) int_container; + break; + case PHP_FLOAT: + return float_container; + break; + case PHP_BOOL: + return (int_container == 0) ? 0 : 1; + break; + case PHP_STRING: + return atof(container.c_str()); + default: + return 0; + break; + } + } + bool php_var::getbool() + { + if(getint() == 1) + return true; + return false; + } + long php_var::getlong() + { + switch(type) + { + case PHP_INT: + return int_container; + break; + case PHP_FLOAT: + return (long) float_container; + break; + case PHP_BOOL: + return (getbool()) ? 0 : 1; + break; + case PHP_STRING: + return atol(container.c_str()); + default: + return 0; + break; + } + } + string php_var::getstring() + { + switch(type) + { + case PHP_INT: + return intstring(int_container); + break; + case PHP_FLOAT: + return doublestring(float_container); + break; + case PHP_BOOL: + return (getbool()) ? "0" : "1"; + break; + case PHP_STRING: + return container; + break; + default: + return ""; + break; + } + } + #define is_identical(var, varb) (((var) == (varb) && (var).type == (varb).type) ? (php_var)true : (php_var)false) Index: php_var.hpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.hpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** php_var.hpp 21 Nov 2003 12:36:43 -0000 1.7 --- php_var.hpp 22 Nov 2003 16:48:10 -0000 1.8 *************** *** 72,86 **** void operator+=(int inc); ! void operator+=(php_var str); void operator+=(string str); void operator+=(const char* str); void operator+=(char* str); void operator-=(int dec); ! void operator-=(php_var i); friend ostream &operator<<( ostream &out, const php_var &var ); void to_array(); string container; // Contains value. vector<php_var> keys; vector<php_var> data; --- 72,93 ---- void operator+=(int inc); ! void operator+=(php_var inc); void operator+=(string str); void operator+=(const char* str); void operator+=(char* str); void operator-=(int dec); ! void operator-=(php_var dec); friend ostream &operator<<( ostream &out, const php_var &var ); void to_array(); + int getint(); + float getfloat(); + bool getbool(); + long getlong(); + string getstring(); string container; // Contains value. + long int_container; + float float_container; vector<php_var> keys; vector<php_var> data; Index: testfile.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/testfile.php,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** testfile.php 21 Nov 2003 12:36:43 -0000 1.51 --- testfile.php 22 Nov 2003 16:48:10 -0000 1.52 *************** *** 1,8 **** <?php ! class foo ! { ! var $bar = 'bleh'; ! } ! $moo = new foo(); ! echo $moo->bar; ?> --- 1,4 ---- <?php ! for($i = 0; $i < 500000; ++$i) ! echo $i, "\n"; ?> |
From: <sja...@us...> - 2003-11-22 12:19:32
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv8629 Modified Files: tokenflow.php Log Message: Fixed lots of whitespace Index: tokenflow.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** tokenflow.php 21 Nov 2003 12:36:43 -0000 1.62 --- tokenflow.php 22 Nov 2003 12:18:49 -0000 1.63 *************** *** 133,138 **** * * @param mixed $break What token to break parameters and move on from. ! * @param mixed $end The token to stop parsing at. This can be a string literal, or an int corresponding to a token. ! * @param bool $for If being called from a for. * @return array * @access private --- 133,138 ---- * * @param mixed $break What token to break parameters and move on from. ! * @param mixed $end The token to stop parsing at. This can be a string literal, or an int corresponding to a token. ! * @param bool $for If being called from a for. * @return array * @access private *************** *** 156,161 **** $code .= $data; } ! if($for) ! --$this->token; break; } --- 156,161 ---- $code .= $data; } ! if($for) ! --$this->token; break; } *************** *** 168,176 **** switch($token) { ! case T_CLASS: ! ++$this->token; ! $this->AddCode('class ' . $this->tokens[$this->token][1]); ! $this->in[] = 'class'; ! break; case T_ECHO: ++$this->token; --- 168,176 ---- switch($token) { ! case T_CLASS: ! ++$this->token; ! $this->AddCode('class ' . $this->tokens[$this->token][1]); ! $this->in[] = 'class'; ! break; case T_ECHO: ++$this->token; *************** *** 179,183 **** else $code .= $this->B_echo($this->Parse_Tokenstream(array('.', ','), ';', true)); ! ++$this->token; break; case ',': --- 179,183 ---- else $code .= $this->B_echo($this->Parse_Tokenstream(array('.', ','), ';', true)); ! ++$this->token; break; case ',': *************** *** 196,200 **** break; case T_VARIABLE: ! $this->token += 1; if($break == null && $end == null) $this->B_var($data, $this->Parse_Tokenstream(null, array(';', ')', ','), $for), true); --- 196,200 ---- break; case T_VARIABLE: ! $this->token += 1; if($break == null && $end == null) $this->B_var($data, $this->Parse_Tokenstream(null, array(';', ')', ','), $for), true); *************** *** 221,230 **** $code .= $data; break; ! case T_NEW: ! $code .= 'new '; ! break; ! case T_OBJECT_OPERATOR: ! $code .= '->'; ! break; case T_IF: ++$this->token; --- 221,230 ---- $code .= $data; break; ! case T_NEW: ! $code .= 'new '; ! break; ! case T_OBJECT_OPERATOR: ! $code .= '->'; ! break; case T_IF: ++$this->token; *************** *** 280,290 **** $code .= ' ' . $token . ' '; break; ! case T_DOUBLE_ARROW: ! $code .= ' => '; ! break; ! case '[': ! case ']': ! $code .= $token; ! break; case T_BOOLEAN_AND: case T_BOOLEAN_OR: --- 280,290 ---- $code .= ' ' . $token . ' '; break; ! case T_DOUBLE_ARROW: ! $code .= ' => '; ! break; ! case '[': ! case ']': ! $code .= $token; ! break; case T_BOOLEAN_AND: case T_BOOLEAN_OR: *************** *** 343,354 **** if($this->Define($var)) $code = 'php_var '; ! else ! $code = (string) null; ! if(substr($val[0], 0, 2) == '->') ! $var = 'OBJECT(' . $var . ', foo)'; ! $code .= $var . implode(' ', $val); if($add) $this->AddCode($code); ! return $code; } /** --- 343,354 ---- if($this->Define($var)) $code = 'php_var '; ! else ! $code = (string) null; ! if(substr($val[0], 0, 2) == '->') ! $var = 'OBJECT(' . $var . ', foo)'; ! $code .= $var . implode(' ', $val); if($add) $this->AddCode($code); ! return $code; } /** *************** *** 680,689 **** $code = (string) null; foreach($this->includes as $include) ! { ! if(file_exists('functions/' . $include)) ! $code .= '#include "functions/' . $include . '"' . "\n"; ! else ! $code .= '#include <' . $include . '>' . "\n"; ! } if(!empty($this->namespace)) $code .= 'using namespace ' . $this->namespace . ';' . "\n"; --- 680,689 ---- $code = (string) null; foreach($this->includes as $include) ! { ! if(file_exists('functions/' . $include)) ! $code .= '#include "functions/' . $include . '"' . "\n"; ! else ! $code .= '#include <' . $include . '>' . "\n"; ! } if(!empty($this->namespace)) $code .= 'using namespace ' . $this->namespace . ';' . "\n"; |
From: <da...@us...> - 2003-11-21 12:36:47
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv15743 Modified Files: convert.php php_var.cpp php_var.hpp testfile.php tokenflow.php tokenizer.php Log Message: Fixed massive parser bug, implimented partial OOP support. Index: convert.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/convert.php,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** convert.php 20 Sep 2003 17:10:12 -0000 1.25 --- convert.php 21 Nov 2003 12:36:43 -0000 1.26 *************** *** 1,3 **** ! #!/usr/bin/php <?php --- 1,3 ---- ! #!/usr/local/bin/php <?php Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** php_var.cpp 25 Sep 2003 22:24:34 -0000 1.35 --- php_var.cpp 21 Nov 2003 12:36:43 -0000 1.36 *************** *** 70,73 **** --- 70,78 ---- type = PHP_BOOL; } + php_var::php_var(void *bleh) + { + obj = bleh; + type = PHP_OBJECT; + } php_var::operator const char*() { Index: php_var.hpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** php_var.hpp 25 Sep 2003 22:24:34 -0000 1.6 --- php_var.hpp 21 Nov 2003 12:36:43 -0000 1.7 *************** *** 17,91 **** class php_var { ! public: ! php_var(); // Constructor ! php_var(const char* str); ! php_var(double i); ! php_var(int i); ! php_var(unsigned int i); ! php_var(long i); ! php_var(const php_var &temp); ! php_var(char * str); ! php_var(string str); ! php_var(bool b); ! ! operator const char*(); ! operator string(); ! operator bool(); ! operator double(); ! operator float(); ! operator int(); ! operator unsigned int(); ! operator long(); ! ! php_var &operator[](int subscript); ! php_var &operator[](unsigned int subscript); ! php_var &operator[](const char* subscript); ! php_var &operator[](char* subscript); ! php_var &operator[](string subscript); ! php_var &operator[](php_var subscript); ! ! bool operator<(int i); ! bool operator>(int i); ! bool operator<(php_var i); ! bool operator>(php_var i); ! bool operator!=(const char* cmp); ! bool operator!=(int i); ! bool operator!=(php_var var); ! bool operator==(const char* cmp); ! bool operator==(int i); ! bool operator==(php_var var); ! ! int operator++(int i); ! int operator++(); ! int operator--(int i); ! int operator--(); ! ! php_var &operator=(const php_var &temp); ! php_var &operator=(int i); ! php_var &operator=(unsigned int i); ! php_var &operator=(long i); ! php_var &operator=(double d); ! php_var &operator=(char *str); ! php_var &operator=(string str); ! php_var &operator=(bool b); ! ! void operator+=(int inc); ! void operator+=(php_var str); ! void operator+=(string str); ! void operator+=(const char* str); ! void operator+=(char* str); ! void operator-=(int dec); ! void operator-=(php_var i); ! friend ostream &operator<<( ostream &out, const php_var &var ); ! void to_array(); ! string container; // Contains value. ! vector<php_var> keys; ! vector<php_var> data; ! void *res; ! void *obj_type; ! int res_type; ! php_var_type type; // Contains current type. }; --- 17,92 ---- class php_var { ! public: ! php_var(); // Constructor ! php_var(const char* str); ! php_var(double i); ! php_var(int i); ! php_var(unsigned int i); ! php_var(long i); ! php_var(const php_var &temp); ! php_var(char * str); ! php_var(string str); ! php_var(bool b); ! php_var(void *foo); ! operator const char*(); ! operator string(); ! operator bool(); ! operator double(); ! operator float(); ! operator int(); ! operator unsigned int(); ! operator long(); ! ! php_var &operator[](int subscript); ! php_var &operator[](unsigned int subscript); ! php_var &operator[](const char* subscript); ! php_var &operator[](char* subscript); ! php_var &operator[](string subscript); ! php_var &operator[](php_var subscript); ! ! bool operator<(int i); ! bool operator>(int i); ! bool operator<(php_var i); ! bool operator>(php_var i); ! bool operator!=(const char* cmp); ! bool operator!=(int i); ! bool operator!=(php_var var); ! bool operator==(const char* cmp); ! bool operator==(int i); ! bool operator==(php_var var); ! ! int operator++(int i); ! int operator++(); ! int operator--(int i); ! int operator--(); ! ! php_var &operator=(const php_var &temp); ! php_var &operator=(int i); ! php_var &operator=(unsigned int i); ! php_var &operator=(long i); ! php_var &operator=(double d); ! php_var &operator=(char *str); ! php_var &operator=(string str); ! php_var &operator=(bool b); ! ! void operator+=(int inc); ! void operator+=(php_var str); ! void operator+=(string str); ! void operator+=(const char* str); ! void operator+=(char* str); ! void operator-=(int dec); ! void operator-=(php_var i); ! friend ostream &operator<<( ostream &out, const php_var &var ); ! void to_array(); ! ! string container; // Contains value. ! vector<php_var> keys; ! vector<php_var> data; ! void *res; ! void *obj; ! int res_type; ! php_var_type type; // Contains current type. }; *************** *** 96,98 **** --- 97,100 ---- php_var operator*(php_var l, php_var r); + #define OBJECT(var, type) ((type) *) (var).obj #endif Index: testfile.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/testfile.php,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** testfile.php 31 Aug 2003 01:20:17 -0000 1.50 --- testfile.php 21 Nov 2003 12:36:43 -0000 1.51 *************** *** 1,4 **** <?php ! $var = array('foo', 'bleh' => 'bar'); ! echo $var['bleh']; ?> --- 1,8 ---- <?php ! class foo ! { ! var $bar = 'bleh'; ! } ! $moo = new foo(); ! echo $moo->bar; ?> Index: tokenflow.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenflow.php,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** tokenflow.php 31 Aug 2003 01:20:17 -0000 1.61 --- tokenflow.php 21 Nov 2003 12:36:43 -0000 1.62 *************** *** 60,69 **** var $curfunction; /** - * An array of each function name. - * @param array - * @access public - */ - var $functions = array(); - /** * Current namespace * @param string --- 60,63 ---- *************** *** 138,146 **** * Parses the flow of tokens generated by the tokenizer. * ! * @param mixed $end The token to stop parsing at. This can be a string literal, or an int corresponding to a token. * @return array * @access private */ ! function Parse_Tokenstream($break = null, $end = null) { if($this->token >= count($this->tokens)) --- 132,142 ---- * Parses the flow of tokens generated by the tokenizer. * ! * @param mixed $break What token to break parameters and move on from. ! * @param mixed $end The token to stop parsing at. This can be a string literal, or an int corresponding to a token. ! * @param bool $for If being called from a for. * @return array * @access private */ ! function Parse_Tokenstream($break = null, $end = null, $for = false) { if($this->token >= count($this->tokens)) *************** *** 151,157 **** { list($token, $data) = $this->tokens[$this->token]; ! if($end != null && $token == $end) { ! if($this->token < count($this->tokens) - 2) { if($data == null) --- 147,153 ---- { list($token, $data) = $this->tokens[$this->token]; ! if($end != null && ($token == $end || (is_array($end) && in_array($token, $end)))) { ! if(!$for && $this->token < count($this->tokens) - 2) { if($data == null) *************** *** 160,166 **** $code .= $data; } break; } ! if($break != null && $token == $break) { $params[] = $code; --- 156,164 ---- $code .= $data; } + if($for) + --$this->token; break; } ! if($break != null && ($token == $break || (is_array($break) && in_array($token, $break)))) { $params[] = $code; *************** *** 170,179 **** switch($token) { case T_ECHO: ++$this->token; if($break == null && $end == null) ! $this->B_echo($this->Parse_Tokenstream(',', ';'), true); else ! $code .= $this->B_echo($this->Parse_Tokenstream(',', ';')); break; case ',': --- 168,183 ---- switch($token) { + case T_CLASS: + ++$this->token; + $this->AddCode('class ' . $this->tokens[$this->token][1]); + $this->in[] = 'class'; + break; case T_ECHO: ++$this->token; if($break == null && $end == null) ! $this->B_echo($this->Parse_Tokenstream(array('.', ','), ';', true), true); else ! $code .= $this->B_echo($this->Parse_Tokenstream(array('.', ','), ';', true)); ! ++$this->token; break; case ',': *************** *** 194,200 **** $this->token += 1; if($break == null && $end == null) ! $this->B_var($data, $this->Parse_Tokenstream(null, ';'), true); else ! $code .= $this->B_var($data, $this->Parse_Tokenstream(null, ';')); break; case T_LNUMBER: --- 198,204 ---- $this->token += 1; if($break == null && $end == null) ! $this->B_var($data, $this->Parse_Tokenstream(null, array(';', ')', ','), $for), true); else ! $code .= $this->B_var($data, $this->Parse_Tokenstream(null, array(';', ')', ','), $for)); break; case T_LNUMBER: *************** *** 208,233 **** if($break == null && $end == null) { ! $this->B_function_call($data, $this->Parse_Tokenstream(',', ')'), true); ++$this->token; } else ! $code .= $this->B_function_call($data, $this->Parse_Tokenstream(',', ')')); } else $code .= $data; break; case T_IF: ++$this->token; if($break == null && $end == null) ! $this->B_if($this->Parse_Tokenstream(null, ')'), true); else ! $code .= $this->B_if($this->Parse_Tokenstream(null, ')')); break; case T_ELSEIF: ++$this->token; if($break == null && $end == null) ! $this->B_elseif($this->Parse_Tokenstream(null, ')'), true); else ! $code .= $this->B_elseif($this->Parse_Tokenstream(null, ')')); break; case T_ELSE: --- 212,243 ---- if($break == null && $end == null) { ! $this->B_function_call($data, $this->Parse_Tokenstream(',', ')', $for), true); ++$this->token; } else ! $code .= $this->B_function_call($data, $this->Parse_Tokenstream(',', ')', $for)); } else $code .= $data; break; + case T_NEW: + $code .= 'new '; + break; + case T_OBJECT_OPERATOR: + $code .= '->'; + break; case T_IF: ++$this->token; if($break == null && $end == null) ! $this->B_if($this->Parse_Tokenstream(null, ')', $for), true); else ! $code .= $this->B_if($this->Parse_Tokenstream(null, ')', $for)); break; case T_ELSEIF: ++$this->token; if($break == null && $end == null) ! $this->B_elseif($this->Parse_Tokenstream(null, ')', $for), true); else ! $code .= $this->B_elseif($this->Parse_Tokenstream(null, ')', $for)); break; case T_ELSE: *************** *** 240,246 **** ++$this->token; if($break == null && $end == null) ! $this->B_for($this->Parse_Tokenstream(';', ')'), true); else ! $code .= $this->B_for($this->Parse_Tokenstream(';', ')')); break; case T_FUNCTION: --- 250,256 ---- ++$this->token; if($break == null && $end == null) ! $this->B_for($this->Parse_Tokenstream(';', ')', true), true); else ! $code .= $this->B_for($this->Parse_Tokenstream(';', ')', true)); break; case T_FUNCTION: *************** *** 248,254 **** $this->token += 3; if($break == null && $end == null) ! $this->B_function($data, $this->Parse_Tokenstream(',', ')'), true); else ! $code .= $this->B_function($data, $this->Parse_Tokenstream(',', ')')); ++$this->token; break; --- 258,264 ---- $this->token += 3; if($break == null && $end == null) ! $this->B_function($data, $this->Parse_Tokenstream(',', ')', $for), true); else ! $code .= $this->B_function($data, $this->Parse_Tokenstream(',', ')', $for)); ++$this->token; break; *************** *** 256,260 **** $data = $this->tokens[$this->token + 1][1]; ++$this->token; ! $code .= $this->B_array($this->Parse_Tokenstream(',', ')')); break; case '-': --- 266,270 ---- $data = $this->tokens[$this->token + 1][1]; ++$this->token; ! $code .= $this->B_array($this->Parse_Tokenstream(',', ')', $for)); break; case '-': *************** *** 323,338 **** * * @param string $var Variable name. ! * @param array $code Value of the variable. * @param bool $add Set to true to add the code to the source. * @return string * @access private */ ! function B_var($var, $code, $add = false) { $var = '_' . substr($var, 1); if($this->Define($var)) ! $code = 'php_var ' . $var . implode(' ', $code); ! else ! $code = $var . implode(' ', $code); if($add) $this->AddCode($code); --- 333,351 ---- * * @param string $var Variable name. ! * @param array $val Value of the variable. * @param bool $add Set to true to add the code to the source. * @return string * @access private */ ! function B_var($var, $val, $add = false) { $var = '_' . substr($var, 1); if($this->Define($var)) ! $code = 'php_var '; ! else ! $code = (string) null; ! if(substr($val[0], 0, 2) == '->') ! $var = 'OBJECT(' . $var . ', foo)'; ! $code .= $var . implode(' ', $val); if($add) $this->AddCode($code); *************** *** 355,359 **** { if($param == '"\n"') ! $code .= ' << endl;'; else $code .= ' << ' . $param; --- 368,372 ---- { if($param == '"\n"') ! $code .= ' << endl'; else $code .= ' << ' . $param; *************** *** 517,526 **** function B_for($parameters, $add = false) { ! $code = 'for(' . $parameters[0] . '; ' . $parameters[1] . '; ' . $parameters[2]; ! if(count($parameters) > 3) ! $code .= ')'; if($add) $this->AddCode($code); ! if($this->tokens[$this->token + 1][0] != '{') { ++$this->tabs; --- 530,537 ---- function B_for($parameters, $add = false) { ! $code = 'for(' . $parameters[0] . '; ' . $parameters[1] . '; ' . $parameters[2] . ')'; if($add) $this->AddCode($code); ! if(isset($this->tokens[$this->token + 1][0]) && $this->tokens[$this->token + 1][0] != '{') { ++$this->tabs; *************** *** 548,554 **** $code = 'cout << ' . substr($parameters[0], 0, -1); if($this->current_header == $header_count) ! $code .= " << endl << endl;"; else ! $code .= " << endl;"; return $code; } --- 559,565 ---- $code = 'cout << ' . substr($parameters[0], 0, -1); if($this->current_header == $header_count) ! $code .= ' << endl << endl;'; else ! $code .= ' << endl;'; return $code; } *************** *** 669,673 **** $code = (string) null; foreach($this->includes as $include) ! $code .= '#include <' . $include . '>' . "\n"; if(!empty($this->namespace)) $code .= 'using namespace ' . $this->namespace . ';' . "\n"; --- 680,689 ---- $code = (string) null; foreach($this->includes as $include) ! { ! if(file_exists('functions/' . $include)) ! $code .= '#include "functions/' . $include . '"' . "\n"; ! else ! $code .= '#include <' . $include . '>' . "\n"; ! } if(!empty($this->namespace)) $code .= 'using namespace ' . $this->namespace . ';' . "\n"; Index: tokenizer.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/tokenizer.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** tokenizer.php 8 Aug 2003 05:10:53 -0000 1.2 --- tokenizer.php 21 Nov 2003 12:36:43 -0000 1.3 *************** *** 22,26 **** function Strip() { ! $strip = array(T_WHITESPACE, T_COMMENT, T_ML_COMMENT); $tokens = array(); foreach($this->tokens as $token) --- 22,26 ---- function Strip() { ! $strip = array(T_WHITESPACE, T_COMMENT); $tokens = array(); foreach($this->tokens as $token) *************** *** 36,40 **** { if(is_array($token)) ! print token_name((int) $token[0]) . ' -- \'' . $token[1] . '\'' . "\n"; } } --- 36,40 ---- { if(is_array($token)) ! echo token_name((int) $token[0]), ' -- \'', $token[1], '\'', "\n"; } } |
From: <sha...@us...> - 2003-11-21 02:32:58
|
Update of /cvsroot/binaryphp/binaryphp/functions/base In directory sc8-pr-cvs1:/tmp/cvs-serv25758/functions/base Modified Files: base64.h base64_decode.cpp base64_encode.cpp Log Message: Latest update - moving functions from header file to respective files. Index: base64.h =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/base64.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** base64.h 27 Sep 2003 05:00:31 -0000 1.1 --- base64.h 21 Nov 2003 02:32:54 -0000 1.2 *************** *** 30,129 **** }; - unsigned char *php_base64_encode(const unsigned char *str, int length) - { - const unsigned char *current = str; - int i = 0; - unsigned char *result = new unsigned char[((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char)]; - - while (length > 2) { /* keep going until we have less than 24 bits */ - result[i++] = base64_table[current[0] >> 2]; - result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; - result[i++] = base64_table[((current[1] & 0x0f) << 2) + (current[2] >> 6)]; - result[i++] = base64_table[current[2] & 0x3f]; - - current += 3; - length -= 3; /* we just handle 3 octets of data */ - } - - /* now deal with the tail end of things */ - if (length != 0) { - result[i++] = base64_table[current[0] >> 2]; - if (length > 1) { - result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; - result[i++] = base64_table[(current[1] & 0x0f) << 2]; - result[i++] = base64_pad; - } - else { - result[i++] = base64_table[(current[0] & 0x03) << 4]; - result[i++] = base64_pad; - result[i++] = base64_pad; - } - } - result[i] = '\0'; - return result; - } - - unsigned char *php_base64_decode(const unsigned char *str, int length) - { - const unsigned char *current = str; - int ch, i = 0, j = 0, k; - /* this sucks for threaded environments */ - unsigned char *result; - - result = new unsigned char[(length + 1)]; - if (result == NULL) { - return NULL; - } - - /* run through the whole string, converting as we go */ - while ((ch = *current++) != '\0' && length-- > 0) { - if (ch == base64_pad) break; - - /* When Base64 gets POSTed, all pluses are interpreted as spaces. - This line changes them back. It's not exactly the Base64 spec, - but it is completely compatible with it (the spec says that - spaces are invalid). This will also save many people considerable - headache. - Turadg Aleahmad <tu...@wi...> - */ - - if (ch == ' ') ch = '+'; - - ch = base64_reverse_table[ch]; - if (ch < 0) continue; - - switch(i % 4) { - case 0: - result[j] = ch << 2; - break; - case 1: - result[j++] |= ch >> 4; - result[j] = (ch & 0x0f) << 4; - break; - case 2: - result[j++] |= ch >>2; - result[j] = (ch & 0x03) << 6; - break; - case 3: - result[j++] |= ch; - break; - } - i++; - } - - k = j; - /* mop things up if we ended on a boundary */ - if (ch == base64_pad) { - switch(i % 4) { - case 0: - case 1: - delete result; - return NULL; - case 2: - k++; - case 3: - result[k++] = 0; - } - } - result[j] = '\0'; - return result; - } \ No newline at end of file --- 30,31 ---- Index: base64_decode.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/base64_decode.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** base64_decode.cpp 27 Sep 2003 05:00:31 -0000 1.1 --- base64_decode.cpp 21 Nov 2003 02:32:54 -0000 1.2 *************** *** 1,2 **** --- 1,67 ---- + unsigned char *php_base64_decode(const unsigned char *str, int length) + { + const unsigned char *current = str; + int ch, i = 0, j = 0, k; + /* this sucks for threaded environments */ + unsigned char *result; + + result = new unsigned char[(length + 1)]; + if (result == NULL) { + return NULL; + } + + /* run through the whole string, converting as we go */ + while ((ch = *current++) != '\0' && length-- > 0) { + if (ch == base64_pad) break; + + /* When Base64 gets POSTed, all pluses are interpreted as spaces. + This line changes them back. It's not exactly the Base64 spec, + but it is completely compatible with it (the spec says that + spaces are invalid). This will also save many people considerable + headache. - Turadg Aleahmad <tu...@wi...> + */ + + if (ch == ' ') ch = '+'; + + ch = base64_reverse_table[ch]; + if (ch < 0) continue; + + switch(i % 4) { + case 0: + result[j] = ch << 2; + break; + case 1: + result[j++] |= ch >> 4; + result[j] = (ch & 0x0f) << 4; + break; + case 2: + result[j++] |= ch >>2; + result[j] = (ch & 0x03) << 6; + break; + case 3: + result[j++] |= ch; + break; + } + i++; + } + + k = j; + /* mop things up if we ended on a boundary */ + if (ch == base64_pad) { + switch(i % 4) { + case 0: + case 1: + delete result; + return NULL; + case 2: + k++; + case 3: + result[k++] = 0; + } + } + result[j] = '\0'; + return result; + } + php_var base64_decode(php_var str) { Index: base64_encode.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions/base/base64_encode.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** base64_encode.cpp 27 Sep 2003 05:00:31 -0000 1.1 --- base64_encode.cpp 21 Nov 2003 02:32:54 -0000 1.2 *************** *** 1,2 **** --- 1,36 ---- + unsigned char *php_base64_encode(const unsigned char *str, int length) + { + const unsigned char *current = str; + int i = 0; + unsigned char *result = new unsigned char[((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char)]; + + while (length > 2) { /* keep going until we have less than 24 bits */ + result[i++] = base64_table[current[0] >> 2]; + result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; + result[i++] = base64_table[((current[1] & 0x0f) << 2) + (current[2] >> 6)]; + result[i++] = base64_table[current[2] & 0x3f]; + + current += 3; + length -= 3; /* we just handle 3 octets of data */ + } + + /* now deal with the tail end of things */ + if (length != 0) { + result[i++] = base64_table[current[0] >> 2]; + if (length > 1) { + result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; + result[i++] = base64_table[(current[1] & 0x0f) << 2]; + result[i++] = base64_pad; + } + else { + result[i++] = base64_table[(current[0] & 0x03) << 4]; + result[i++] = base64_pad; + result[i++] = base64_pad; + } + } + result[i] = '\0'; + return result; + } + php_var base64_encode(php_var str) { |
From: <sha...@us...> - 2003-09-27 06:50:08
|
Update of /cvsroot/binaryphp/binaryphp/functions/timedate In directory sc8-pr-cvs1:/tmp/cvs-serv21381/functions/timedate Added Files: date.cpp Log Message: Commiting for dweller --- NEW FILE: date.cpp --- char *mon_full_names[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; char *mon_short_names[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; char *day_full_names[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; char *day_short_names[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static int phpday_tab[2][12] = { {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} }; #define isleap(year) (((year%4) == 0 && (year%100)!=0) || (year%400)==0) #define YEAR_BASE 1900 #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 php_var date(php_var format, php_var timestamp=false) { //php vars php_var ret; //The return variable time_t the_time; struct tm *ta, tmbuf; char tmp_buff[32]; int i, size = 0, length, h, beat, fd, wd, yd, wk; long tzone; // if a timestamp is provided, use it. otherwise use the current time if (timestamp) { the_time = long(timestamp); } else { the_time = time(NULL); } ta = localtime_r(&the_time, &tmbuf); for (i = 0; i < format.container.length(); i++) { switch (format.container[i]) { case '\\': if(i < format.container.length()-1) { tmp_buff[0] = format.container[i+1]; tmp_buff[1] = '\0'; ret += tmp_buff; i++; } break; case 'U': /* seconds since the epoch */ sprintf(tmp_buff, "%ld", (long)the_time); /* SAFE */ // printf("%ld", (long)the_time); ret += tmp_buff; break; case 'F': /* month, textual, full */ ret += mon_full_names[ta->tm_mon]; break; case 'l': /* day (of the week), textual, full */ ret += day_full_names[ta->tm_wday]; break; case 'Y': /* year, numeric, 4 digits */ sprintf(tmp_buff, "%d", ta->tm_year + YEAR_BASE); /* SAFE */ ret += tmp_buff; break; case 'M': /* month, textual, 3 letters */ ret += mon_short_names[ta->tm_mon]; break; case 'D': /* day (of the week), textual, 3 letters */ ret += day_short_names[ta->tm_wday]; break; case 'z': /* day (of the year) */ sprintf(tmp_buff, "%d", ta->tm_yday); /* SAFE */ ret += tmp_buff; break; case 'y': /* year, numeric, 2 digits */ sprintf(tmp_buff, "%02d", ((ta->tm_year)%100)); /* SAFE */ ret += tmp_buff; break; case 'm': /* month, numeric */ sprintf(tmp_buff, "%02d", ta->tm_mon + 1); /* SAFE */ ret += tmp_buff; break; case 'n': /* month, numeric, no leading zeros */ sprintf(tmp_buff, "%d", ta->tm_mon + 1); /* SAFE */ ret += tmp_buff; break; case 'd': /* day of the month, numeric */ sprintf(tmp_buff, "%02d", ta->tm_mday); /* SAFE */ ret += tmp_buff; break; case 'j': sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */ ret += tmp_buff; break; case 'H': /* hour, numeric, 24 hour format */ sprintf(tmp_buff, "%02d", ta->tm_hour); /* SAFE */ ret += tmp_buff; break; case 'h': /* hour, numeric, 12 hour format */ h = ta->tm_hour % 12; if (h==0) h = 12; sprintf(tmp_buff, "%02d", h); /* SAFE */ ret += tmp_buff; break; case 'G': /* hour, numeric, 24 hour format, no leading zeros */ sprintf(tmp_buff, "%d", ta->tm_hour); /* SAFE */ ret += tmp_buff; break; case 'g': /* hour, numeric, 12 hour format, no leading zeros */ h = ta->tm_hour % 12; if (h==0) h = 12; sprintf(tmp_buff, "%d", h); /* SAFE */ ret += tmp_buff; break; case 'i': /* minutes, numeric */ sprintf(tmp_buff, "%02d", ta->tm_min); /* SAFE */ ret += tmp_buff; break; case 's': /* seconds, numeric */ sprintf(tmp_buff, "%02d", ta->tm_sec); /* SAFE */ ret += tmp_buff; break; case 'A': /* AM/PM */ ret += (ta->tm_hour >= 12 ? "PM" : "AM"); break; case 'a': /* am/pm */ ret += (ta->tm_hour >= 12 ? "pm" : "am"); break; case 'S': /* standard english suffix, e.g. 2nd/3rd for the day of the month */ if (ta->tm_mday >= 10 && ta->tm_mday <= 19) { ret += "th"; } else { switch (ta->tm_mday % 10) { case 1: ret += "st"; break; case 2: ret += "nd"; break; case 3: ret += "rd"; break; default: ret += "th"; break; } } break; case 't': /* days in current month */ sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+YEAR_BASE))][ta->tm_mon] ); ret += tmp_buff; break; case 'w': /* day of the week, numeric EXTENSION */ sprintf(tmp_buff, "%01d", ta->tm_wday); /* SAFE */ ret += tmp_buff; break; case 'O': /* GMT offset in [+-]HHMM format */ #if HAVE_TM_GMTOFF sprintf(tmp_buff, "%c%02d%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 )); #else sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? tzone - 3600:tzone)>0)?'-':'+', abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600), abs(((ta->tm_isdst ? tzone - 3600 : tzone) % 3600) / 60)); #endif ret += tmp_buff; break; case 'Z': /* timezone offset in seconds */ #if HAVE_TM_GMTOFF sprintf(tmp_buff, "%ld", ta->tm_gmtoff); #else sprintf(tmp_buff, "%ld", ta->tm_isdst ? -(tzone- 3600) : -tzone); #endif ret += tmp_buff; break; case 'L': /* boolean for leapyear */ sprintf(tmp_buff, "%d", (isleap((ta->tm_year+YEAR_BASE)) ? 1 : 0 ) ); ret += tmp_buff; break; case 'T': /* timezone name */ #if HAVE_TM_ZONE ret += ta->tm_zone; #elif HAVE_TZNAME ret += (ta->tm_isdst ? tname[1] : tname[0]); #endif break; case 'B': /* Swatch Beat a.k.a. Internet Time */ beat = (((((long)the_time)-(((long)the_time) - ((((long)the_time) % 86400) + 3600))) * 10) / 864); while (beat < 0) { beat += 1000; } beat = beat % 1000; sprintf(tmp_buff, "%03d", beat); /* SAFE */ ret += tmp_buff; break; case 'I': sprintf(tmp_buff, "%d", ta->tm_isdst); ret += tmp_buff; break; case 'r': #if HAVE_TM_GMTOFF sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d", day_short_names[ta->tm_wday], ta->tm_mday, mon_short_names[ta->tm_mon], ta->tm_year + YEAR_BASE, ta->tm_hour, ta->tm_min, ta->tm_sec, (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 ) ); #else sprintf(tmp_buff, "%3s, %2d %3s %04d %02d:%02d:%02d %c%02d%02d", day_short_names[ta->tm_wday], ta->tm_mday, mon_short_names[ta->tm_mon], ta->tm_year + YEAR_BASE, ta->tm_hour, ta->tm_min, ta->tm_sec, ((ta->tm_isdst ? tzone - 3600 : tzone) > 0) ? '-' : '+', abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600), abs( ((ta->tm_isdst ? tzone - 3600 : tzone) % 3600) / 60 ) ); #endif ret += tmp_buff; break; case 'W': /* ISO-8601 week number of year, weeks starting on Monday */ wd = ta->tm_wday==0 ? 6 : ta->tm_wday-1;/* weekday */ yd = ta->tm_yday + 1; /* days since January 1st */ fd = (7 + wd - yd % 7+ 1) % 7; /* weekday (1st January) */ /* week is a last year week (52 or 53) */ if ((yd <= 7 - fd) && fd > 3){ wk = (fd == 4 || (fd == 5 && isleap((ta->tm_year + YEAR_BASE - 1)))) ? 53 : 52; } /* week is a next year week (1) */ else if (isleap((ta->tm_year+YEAR_BASE)) + 365 - yd < 3 - wd){ wk = 1; } /* normal week */ else { wk = (yd + 6 - wd + fd) / 7 - (fd > 3); } sprintf(tmp_buff, "%d", wk); /* SAFE */ ret += tmp_buff; break; default: tmp_buff[0] = format.container[i]; tmp_buff[1] = '\0'; ret += tmp_buff; break; } } return ret; } |
From: <sha...@us...> - 2003-09-27 06:45:14
|
Update of /cvsroot/binaryphp/binaryphp/functions/base In directory sc8-pr-cvs1:/tmp/cvs-serv23429/functions/base Added Files: base64.h base64_decode.cpp base64_encode.cpp Log Message: by Derek Ford if there are any troubles with these, email me at shadowed at asleep dot net. --- NEW FILE: base64.h --- extern unsigned char *php_base64_encode(const unsigned char *, int); extern unsigned char *php_base64_decode(const unsigned char *, int); static const char base64_table[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/', '\0' }; static const char base64_pad = '='; static const short base64_reverse_table[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; unsigned char *php_base64_encode(const unsigned char *str, int length) { const unsigned char *current = str; int i = 0; unsigned char *result = new unsigned char[((length + 3 - length % 3) * 4 / 3 + 1) * sizeof(char)]; while (length > 2) { /* keep going until we have less than 24 bits */ result[i++] = base64_table[current[0] >> 2]; result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; result[i++] = base64_table[((current[1] & 0x0f) << 2) + (current[2] >> 6)]; result[i++] = base64_table[current[2] & 0x3f]; current += 3; length -= 3; /* we just handle 3 octets of data */ } /* now deal with the tail end of things */ if (length != 0) { result[i++] = base64_table[current[0] >> 2]; if (length > 1) { result[i++] = base64_table[((current[0] & 0x03) << 4) + (current[1] >> 4)]; result[i++] = base64_table[(current[1] & 0x0f) << 2]; result[i++] = base64_pad; } else { result[i++] = base64_table[(current[0] & 0x03) << 4]; result[i++] = base64_pad; result[i++] = base64_pad; } } result[i] = '\0'; return result; } unsigned char *php_base64_decode(const unsigned char *str, int length) { const unsigned char *current = str; int ch, i = 0, j = 0, k; /* this sucks for threaded environments */ unsigned char *result; result = new unsigned char[(length + 1)]; if (result == NULL) { return NULL; } /* run through the whole string, converting as we go */ while ((ch = *current++) != '\0' && length-- > 0) { if (ch == base64_pad) break; /* When Base64 gets POSTed, all pluses are interpreted as spaces. This line changes them back. It's not exactly the Base64 spec, but it is completely compatible with it (the spec says that spaces are invalid). This will also save many people considerable headache. - Turadg Aleahmad <tu...@wi...> */ if (ch == ' ') ch = '+'; ch = base64_reverse_table[ch]; if (ch < 0) continue; switch(i % 4) { case 0: result[j] = ch << 2; break; case 1: result[j++] |= ch >> 4; result[j] = (ch & 0x0f) << 4; break; case 2: result[j++] |= ch >>2; result[j] = (ch & 0x03) << 6; break; case 3: result[j++] |= ch; break; } i++; } k = j; /* mop things up if we ended on a boundary */ if (ch == base64_pad) { switch(i % 4) { case 0: case 1: delete result; return NULL; case 2: k++; case 3: result[k++] = 0; } } result[j] = '\0'; return result; } --- NEW FILE: base64_decode.cpp --- php_var base64_decode(php_var str) { unsigned char *result; php_var str_len; str_len = strlen(str); result = php_base64_decode(str, str_len); if( result != NULL ) { return result; } else { return false; } } --- NEW FILE: base64_encode.cpp --- php_var base64_encode(php_var str) { unsigned char *result; php_var str_len; str_len = strlen(str); result = php_base64_encode(str, str_len); if( result != NULL ) { return result; } else { return false; } } |
From: <sha...@us...> - 2003-09-27 04:56:07
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv22524 Modified Files: functions.php Log Message: adding functions: base64_encode() by Lateralus base64_decode() by Lateralus date() by dweller Index: functions.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions.php,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** functions.php 16 Sep 2003 11:49:38 -0000 1.45 --- functions.php 27 Sep 2003 04:55:51 -0000 1.46 *************** *** 83,86 **** --- 83,89 ---- 'gettimeofday' => array(array('sys/time.h','time.h'), 'timedate/gettimeofday.cpp'), 'time' => array('time.h', 'timedate/time.cpp'), + 'date' => array('time.h', 'timedate/date.cpp'), + 'base64_encode' => array('base/base64.h', 'base/base64_encode.cpp'), + 'base64_decode' => array('base/base64.h', 'base/base64_decode.cpp'), 'gethostbyname' => array(array('netinet/in.h', 'arpa/inet.h', 'netdb.h'), 'network/gethostbyname.cpp' ), null |
From: <sja...@us...> - 2003-09-25 22:24:43
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv10052 Modified Files: php_var.cpp php_var.hpp Log Message: Added type cast to long (patch from Devon Weller <dew...@us...>) Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** php_var.cpp 20 Sep 2003 17:10:12 -0000 1.34 --- php_var.cpp 25 Sep 2003 22:24:34 -0000 1.35 *************** *** 256,259 **** --- 256,265 ---- return *this; } + php_var &php_var::operator=(long i) + { + container = intstring(i); + type = PHP_INT; + return *this; + } php_var &php_var::operator=(double d) { Index: php_var.hpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.hpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** php_var.hpp 2 Sep 2003 02:04:02 -0000 1.5 --- php_var.hpp 25 Sep 2003 22:24:34 -0000 1.6 *************** *** 64,67 **** --- 64,68 ---- php_var &operator=(int i); php_var &operator=(unsigned int i); + php_var &operator=(long i); php_var &operator=(double d); php_var &operator=(char *str); |
From: <sja...@us...> - 2003-09-20 17:10:16
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv10007 Modified Files: convert.php php_var.cpp Log Message: Applied fixes from in...@us... Fixed a whole lot of whitespace in convert.php Index: convert.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/convert.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** convert.php 9 Aug 2003 03:58:34 -0000 1.24 --- convert.php 20 Sep 2003 17:10:12 -0000 1.25 *************** *** 2,50 **** <?php ! function showUsage() ! { ! echo 'Usage: convert.php --if <inputfile.php> --of <output> [-v | --verbose] [-h | --help]' , "\n"; ! } ! $debug = false; ! /* If there are arguments, cycle through em */ ! if ($_SERVER['argc'] > 4) { ! for($i = 1; $i <= $_SERVER['argc']; ++$i) { ! if(@$_SERVER['argv'][$i] == '-v' OR @$_SERVER['argv'][$i] == '--verbose') { ! $debug = true; ! } ! if(@$_SERVER['argv'][$i] == '--if') { ! $input = ''; ! $input = $_SERVER['argv'][$i + 1]; ! } ! if(@$_SERVER['argv'][$i] == '--of') { ! $output = ''; ! $output = $_SERVER['argv'][$i + 1]; ! $outputfile = $output . '.cpp'; ! } ! if(@$_SERVER['argv'][$i] == '--help' OR @$_SERVER['argv'][$i] == '-h') { ! showUsage(); ! } ! } ! } else { ! showUsage(); ! die ("Too Few Arguments\n"); ! } ! ! if(!(isset($input) && strlen(trim($input)) && is_file($input))) { ! showUsage(); ! die ($input . " isn't a file\n"); ! } ! if(!(isset($output) && strlen(trim($output)))) { ! showUsage(); ! die ($output . "isn't a valid output file\n"); ! } ! ! if($debug == true) { ! define('DEBUG', true); ! } else { ! define('DEBUG', false); ! } ! ! if (substr(PHP_OS, 0, 3) == 'WIN') { define('BINARYPHP_OS', 'Windows'); } else { --- 2,50 ---- <?php ! function showUsage() ! { ! echo 'Usage: convert.php --if <inputfile.php> --of <output> [-v | --verbose] [-h | --help]' , "\n"; ! } ! $debug = false; ! /* If there are arguments, cycle through em */ ! if ($_SERVER['argc'] > 4) { ! for($i = 1; $i <= $_SERVER['argc']; ++$i) { ! if(@$_SERVER['argv'][$i] == '-v' OR @$_SERVER['argv'][$i] == '--verbose') { ! $debug = true; ! } ! if(@$_SERVER['argv'][$i] == '--if') { ! $input = ''; ! $input = $_SERVER['argv'][$i + 1]; ! } ! if(@$_SERVER['argv'][$i] == '--of') { ! $output = ''; ! $output = $_SERVER['argv'][$i + 1]; ! $outputfile = $output . '.cpp'; ! } ! if(@$_SERVER['argv'][$i] == '--help' OR @$_SERVER['argv'][$i] == '-h') { ! showUsage(); ! } ! } ! } else { ! showUsage(); ! die ("Too Few Arguments\n"); ! } ! ! if(!(isset($input) && strlen(trim($input)) && is_file($input))) { ! showUsage(); ! die ($input . " isn't a file\n"); ! } ! if(!(isset($output) && strlen(trim($output)))) { ! showUsage(); ! die ($output . "isn't a valid output file\n"); ! } ! ! if($debug == true) { ! define('DEBUG', true); ! } else { ! define('DEBUG', false); ! } ! ! if (substr(PHP_OS, 0, 3) == 'WIN') { define('BINARYPHP_OS', 'Windows'); } else { *************** *** 67,74 **** $flag = (string) null; $lines = explode("\n", $code); ! if(DEBUG == true) { ! foreach($lines as $line => $cod) ! echo $line + 1, ': ', $cod, "\n"; ! } $fp = fopen($output . '.cpp', 'wt'); fwrite($fp, $code); --- 67,74 ---- $flag = (string) null; $lines = explode("\n", $code); ! if(DEBUG == true) { ! foreach($lines as $line => $cod) ! echo $line + 1, ': ', $cod, "\n"; ! } $fp = fopen($output . '.cpp', 'wt'); fwrite($fp, $code); *************** *** 77,90 **** touch('log'); if(BINARYPHP_OS == 'Windows') { - $comp = 'cl -c /nologo /MT /W3 /GX /FD -DWIN32 /Fotest.obj ' . $outputfile . ' >> log'; - echo $comp, "\n\n"; - shell_exec($comp); if(DEBUG==true) $opt='-debug'; else ! $opt='-$comp'; ! $release = 'link ' .$output . '.obj -nologo ' .$opt .' -incremental:no -opt:ref '.$flags.' -out:' . $output . ' >> log'; echo $comp, "\n\n"; shell_exec($comp); } else { if(!file_exists('php_var.lo')) --- 77,96 ---- touch('log'); if(BINARYPHP_OS == 'Windows') { if(DEBUG==true) $opt='-debug'; else ! $opt=''; ! $comp = 'cl -c /nologo /MT /W3 /GX /FD -DWIN32 /Fo'.$output.'.obj ' . $outputfile . ' >> log'; echo $comp, "\n\n"; shell_exec($comp); + if(!file_exists('php_var.obj')) { + $comp = 'cl -c /nologo /MT /W3 /GX /FD -DWIN32 /Fophp_var.obj php_var.cpp >> log'; + `echo $comp >> log`; + shell_exec($comp); + } + + $release = 'link php_var.obj ' .$output . '.obj -nologo ' .$opt .' -incremental:no -opt:ref '.$flags.' -out:' . $output . '.exe >> log'; + echo $release, "\n\n"; + shell_exec($release); } else { if(!file_exists('php_var.lo')) Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** php_var.cpp 2 Sep 2003 03:29:27 -0000 1.33 --- php_var.cpp 20 Sep 2003 17:10:12 -0000 1.34 *************** *** 96,100 **** php_var::operator float() { ! return atof(container.c_str()); } php_var::operator int() --- 96,100 ---- php_var::operator float() { ! return (float)atof(container.c_str()); } php_var::operator int() *************** *** 139,143 **** { php_var key = subscript; ! int i = 0; for(i = 0;i < keys.size(); ++i) { --- 139,143 ---- { php_var key = subscript; ! unsigned int i = 0; for(i = 0;i < keys.size(); ++i) { |
From: <sja...@us...> - 2003-09-16 11:49:41
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv3691 Modified Files: functions.php Log Message: Added gethostbyname() Index: functions.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions.php,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** functions.php 14 Sep 2003 20:33:19 -0000 1.44 --- functions.php 16 Sep 2003 11:49:38 -0000 1.45 *************** *** 83,86 **** --- 83,87 ---- 'gettimeofday' => array(array('sys/time.h','time.h'), 'timedate/gettimeofday.cpp'), 'time' => array('time.h', 'timedate/time.cpp'), + 'gethostbyname' => array(array('netinet/in.h', 'arpa/inet.h', 'netdb.h'), 'network/gethostbyname.cpp' ), null ); |
From: <sja...@us...> - 2003-09-16 11:14:46
|
Update of /cvsroot/binaryphp/binaryphp/functions/network In directory sc8-pr-cvs1:/tmp/cvs-serv29522/functions/network Added Files: gethostbyname.cpp Log Message: Add gethostbyname() --- NEW FILE: gethostbyname.cpp --- php_var gethostbyname( php_var host ) { struct hostent *host_entry; struct in_addr address; if(!(host_entry = gethostbyname( (const char*)host )) || !*(host_entry->h_addr_list)) { return host; } memcpy(&address.s_addr, *(host_entry->h_addr_list), sizeof(address.s_addr)); return php_var(inet_ntoa(address)); } |
From: <sja...@us...> - 2003-09-16 11:14:15
|
Update of /cvsroot/binaryphp/binaryphp/functions/network In directory sc8-pr-cvs1:/tmp/cvs-serv29423/network Log Message: Directory /cvsroot/binaryphp/binaryphp/functions/network added to the repository |
From: <sja...@us...> - 2003-09-14 20:33:23
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv18998 Modified Files: functions.php Log Message: Committing for Lateralus Update docs/AUTHORS and functions.php Created functions/timedate/time.cpp and gettimeofday.cpp Index: functions.php =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/functions.php,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** functions.php 13 Aug 2003 08:51:34 -0000 1.43 --- functions.php 14 Sep 2003 20:33:19 -0000 1.44 *************** *** 81,84 **** --- 81,86 ---- 'atan' => array('cmath', 'math/atan.cpp'), 'acos' => array('cmath', 'math/acos.cpp'), + 'gettimeofday' => array(array('sys/time.h','time.h'), 'timedate/gettimeofday.cpp'), + 'time' => array('time.h', 'timedate/time.cpp'), null ); |
From: <sja...@us...> - 2003-09-14 20:33:23
|
Update of /cvsroot/binaryphp/binaryphp/DOCS In directory sc8-pr-cvs1:/tmp/cvs-serv18998/DOCS Modified Files: AUTHORS Log Message: Committing for Lateralus Update docs/AUTHORS and functions.php Created functions/timedate/time.cpp and gettimeofday.cpp Index: AUTHORS =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/DOCS/AUTHORS,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AUTHORS 13 Aug 2003 00:43:24 -0000 1.4 --- AUTHORS 14 Sep 2003 20:33:19 -0000 1.5 *************** *** 2,5 **** --- 2,6 ---- Daeken <dae...@ya...> + Lateralus <sha...@as...> Amaranth <ama...@ph...> ReDucTor <red...@ai...> |
From: <sja...@us...> - 2003-09-14 20:33:23
|
Update of /cvsroot/binaryphp/binaryphp/functions/timedate In directory sc8-pr-cvs1:/tmp/cvs-serv18998/functions/timedate Added Files: gettimeofday.cpp time.cpp Log Message: Committing for Lateralus Update docs/AUTHORS and functions.php Created functions/timedate/time.cpp and gettimeofday.cpp --- NEW FILE: gettimeofday.cpp --- php_var gettimeofday() { //php vars php_var ret; //The return variable ret.to_array(); //An assosiative array will be returned. //time vars struct timeval tp; struct timezone tz; if( gettimeofday( &tp, &tz ) == 0 ){ ret['sec'] = tp.tv_sec; ret['usec'] = tp.tv_usec; #ifdef __WIN32 ret['minuteswest'] = tz.tz_minuteswest/60; #else ret['minuteswest'] = tz.tz_minuteswest; #endif ret['dsttime'] = tz.tz_dsttime; return ret; } else { return false; } } --- NEW FILE: time.cpp --- php_var time() { //php vars php_var ret; //The return variable ret = ((long)time(NULL)); return ret; } |
From: <sja...@us...> - 2003-09-14 20:30:17
|
Update of /cvsroot/binaryphp/binaryphp/functions/timedate In directory sc8-pr-cvs1:/tmp/cvs-serv18337/timedate Log Message: Directory /cvsroot/binaryphp/binaryphp/functions/timedate added to the repository |
From: <sja...@us...> - 2003-09-02 03:29:35
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv29746 Modified Files: php_var.cpp Log Message: went back to "type = PHP_TYPE", because I've realized its better not to do "type.is_type=true", because if something sets "type.is_string=true" then later sets "type.is_array=true" then both are true, and the actual type remains a string (because its first in the list). Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** php_var.cpp 2 Sep 2003 02:04:02 -0000 1.32 --- php_var.cpp 2 Sep 2003 03:29:27 -0000 1.33 *************** *** 17,46 **** { container = ""; ! type.is_null = true; // Make the var, but make it null. } php_var::php_var(const char* str) { container = str; ! type.is_string = true; } php_var::php_var(double i) { container = doublestring(i); ! type.is_float = true; } php_var::php_var(int i) { container = intstring(i); ! type.is_int = true; } php_var::php_var(unsigned int i) { container = intstring(i); ! type.is_int = true; } php_var::php_var(long i) { container = intstring(i); ! type.is_int = true; } php_var::php_var(const php_var &temp) --- 17,46 ---- { container = ""; ! type = PHP_NULL; // Make the var, but make it null. } php_var::php_var(const char* str) { container = str; ! type = PHP_STRING; } php_var::php_var(double i) { container = doublestring(i); ! type = PHP_FLOAT; } php_var::php_var(int i) { container = intstring(i); ! type = PHP_INT; } php_var::php_var(unsigned int i) { container = intstring(i); ! type = PHP_INT; } php_var::php_var(long i) { container = intstring(i); ! type = PHP_INT; } php_var::php_var(const php_var &temp) *************** *** 55,64 **** { container = str; ! type.is_string = true; } php_var::php_var(string str) { container = str; ! type.is_string = true; } php_var::php_var(bool b) --- 55,64 ---- { container = str; ! type = PHP_STRING; } php_var::php_var(string str) { container = str; ! type = PHP_STRING; } php_var::php_var(bool b) *************** *** 68,72 **** else container = "0"; ! type.is_bool = true; } php_var::operator const char*() --- 68,72 ---- else container = "0"; ! type = PHP_BOOL; } php_var::operator const char*() *************** *** 296,300 **** container = intstring(atol(container.c_str()) + atoi(str.container.c_str())); if(!type.is_int && !type.is_string) ! type.is_int = true; } else --- 296,300 ---- container = intstring(atol(container.c_str()) + atoi(str.container.c_str())); if(!type.is_int && !type.is_string) ! type = PHP_INT; } else *************** *** 302,306 **** container += str.container; if(!type.is_string) ! type.is_string = true; } } --- 302,306 ---- container += str.container; if(!type.is_string) ! type = PHP_STRING; } } |
From: <sja...@us...> - 2003-09-02 02:04:05
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv17440 Modified Files: php_var.cpp php_var.hpp Log Message: - Added operator= overloading. - Added missing declarations in php_var.hpp for operator overloaded at the - bottom of php_var.cpp. - Changed to_array() so that if there was a value, it gets put into element 0. - Fixed a segfault (when I added operator=). Index: php_var.cpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** php_var.cpp 17 Aug 2003 20:43:13 -0000 1.31 --- php_var.cpp 2 Sep 2003 02:04:02 -0000 1.32 *************** *** 27,31 **** { container = doublestring(i); ! type.is_int = true; } php_var::php_var(int i) --- 27,31 ---- { container = doublestring(i); ! type.is_float = true; } php_var::php_var(int i) *************** *** 72,86 **** php_var::operator const char*() { ! if(type.is_string || type.is_int) ! return container.c_str(); else ! return "Array"; } php_var::operator string() { ! if(type.is_string || type.is_int) ! return container; else ! return string("Array"); } php_var::operator bool() --- 72,86 ---- php_var::operator const char*() { ! if(type.is_array || type.is_object || type.is_resource ) ! return (char *)type; else ! return container.c_str(); } php_var::operator string() { ! if(type.is_array || type.is_object || type.is_resource ) ! return string((char *)type); else ! return container; } php_var::operator bool() *************** *** 134,138 **** if(type.is_string) { ! // return &container[subscript]; } else if(type.is_array) --- 134,138 ---- if(type.is_string) { ! throw php_var("can't handle array access to strings"); } else if(type.is_array) *************** *** 235,238 **** --- 235,286 ---- return ret; } + php_var &php_var::operator=(const php_var &temp) + { + type = temp.type; + container = temp.container; + keys = temp.keys; + data = temp.data; + res = temp.res; + return *this; + } + php_var &php_var::operator=(int i) + { + container = intstring(i); + type = PHP_INT; + return *this; + } + php_var &php_var::operator=(unsigned int i) + { + container = intstring(i); + type = PHP_INT; + return *this; + } + php_var &php_var::operator=(double d) + { + container = doublestring(d); + type = PHP_FLOAT; + return *this; + } + php_var &php_var::operator=(char *str) + { + container = str; + type = PHP_STRING; + return *this; + } + php_var &php_var::operator=(string str) + { + container = str; + type = PHP_STRING; + return *this; + } + php_var &php_var::operator=(bool b) + { + if(b) + container = "1"; + else + container = "0"; + type = PHP_BOOL; + return *this; + } void php_var::operator+=(int inc) { *************** *** 283,287 **** void php_var::to_array() { ! type.is_array = true; } template<typename T> inline T * OBJ(php_var obj) { return (reinterpret_cast<T *>(obj.res)); } --- 331,339 ---- void php_var::to_array() { ! type = PHP_ARRAY; ! if(container.length() > 0) { ! (*this)[0] = container; ! container = ""; ! } } template<typename T> inline T * OBJ(php_var obj) { return (reinterpret_cast<T *>(obj.res)); } *************** *** 294,298 **** return out; } ! bool operator<(int i,php_var v) { return(v > i); --- 346,350 ---- return out; } ! bool operator<(int i, php_var v) { return(v > i); Index: php_var.hpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** php_var.hpp 17 Aug 2003 20:11:47 -0000 1.4 --- php_var.hpp 2 Sep 2003 02:04:02 -0000 1.5 *************** *** 61,64 **** --- 61,72 ---- int operator--(); + php_var &operator=(const php_var &temp); + php_var &operator=(int i); + php_var &operator=(unsigned int i); + php_var &operator=(double d); + php_var &operator=(char *str); + php_var &operator=(string str); + php_var &operator=(bool b); + void operator+=(int inc); void operator+=(php_var str); *************** *** 80,83 **** --- 88,96 ---- php_var_type type; // Contains current type. }; + + bool operator<(int i, php_var v); + bool operator>(int i, php_var v); + php_var operator-(php_var l, php_var r); + float operator/(php_var &l, php_var &r); php_var operator*(php_var l, php_var r); |
From: <sja...@us...> - 2003-09-02 01:15:57
|
Update of /cvsroot/binaryphp/binaryphp In directory sc8-pr-cvs1:/tmp/cvs-serv9297 Modified Files: php_var_type.hpp Log Message: hanged `return -1;` to `return "";` in operator char*(), woops Index: php_var_type.hpp =================================================================== RCS file: /cvsroot/binaryphp/binaryphp/php_var_type.hpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** php_var_type.hpp 2 Sep 2003 01:09:00 -0000 1.3 --- php_var_type.hpp 2 Sep 2003 01:15:53 -0000 1.4 *************** *** 54,58 **** if(is_resource) return "Resource"; if(is_object) return "Object"; ! return -1; } --- 54,58 ---- if(is_resource) return "Resource"; if(is_object) return "Object"; ! return ""; } |