With boredom comes php_template v2.9.2
It’s been a very, very long time since I last touched php_template and just out of the blue today I decided I’d finally get off my ass and create a Visual C++ project out of it so I could compile it for Windows users.
Well, after several hours of tinkering and encountering PHP source code “bugs”, I finally got it to compile. I had to do a few fixes too apparently – I was missing some TSRM junk to the parse_tag() function (and I believe that’s because it passes a zval around, so it needs the thread-safe stuff with it), and I had some calls to strlen() which needed to be explicitly cast to avoid warnings. This got rid of some of the compile-time warnings (there are still warnings about strcat() and cousins being used, but I’m smart and know how to use them properly) generated by VC++ 2005 and popped out a tasty php_template.dll for PHP 5.2.1.
The VC++ project files are now included in the official releases of php_template (along with a pre-compiled version of php_template.dll) so that all of you lovely folks out there can compile your own versions too. Compiling it isn’t too tough – grab the free version of VC++ 2005 (Express), the Microsoft Platform SDK which has the headers and such required to compile, PHP source code and a package from PHP as well called “bindlib_w32″ which contains some additional header files. Throw the bindlib_w32 directory in to the root of the PHP directory, and the php_template directory in to the ext directory in PHP. Load up the VC++ solution file (.sln) and build it – that’s it!
I’ve also finally put the code in to an SVN repository on my local home server so I can keep track of the working trunk code, and some branched code which was supposed to be better but suffers from memory leaks – I may not end up using it, but kept it for the ideas it involved. I think I might instead look towards using a lexer as the parser engine as it should provide much more flexibility in the language structure, however I’d really have to pay attention to potential speed losses due to lexers being naturally slow parsers in some cases.
You can get your shiny new copy from the downloads section – more specifically, right here.