digitalmars.D - PHP embedded in D.
- Joshua (4/4) Jul 03 2007 Greetings All,
- Anders Bergh (5/9) Jul 03 2007 You can convert the PHP headers to D modules manually or using a tool
- Joshua (2/17) Jul 03 2007
- Anders Bergh (7/24) Jul 03 2007 http://www.digitalmars.com/d/1.0/htomodule.html
- Kirk McDonald (11/17) Jul 03 2007 Yes, there is a basic tutorial here:
- Bill Baxter (11/26) Jul 03 2007 bcd is more likely to work because it uses a complete compiler front-end...
- Bill Baxter (6/11) Jul 03 2007 Nope. PyD is the most advanced binding library right now as far as I
- Joshua (3/18) Jul 03 2007 Yes its a genetic algorithm that I'm writing to analyse my game world. ...
- Alan Knowles (17/24) Jul 03 2007 Using PHP embed, you should be able to initiate a PHP session, quite
Greetings All, Well I am now learning D and as part of the process I am making a GA in D for a game I am working on. Since the games scripting is in PHP and Ruby I need a way to run these scripts in D. Has anyone tried using something like PHP-embed in D? I can use the PHP CLI if I really must but I would prefer just using the some sort of PHP api directly. Thanks.
Jul 03 2007
On 7/4/07, Joshua <savagejoshua gmail.com> wrote:Greetings All, Well I am now learning D and as part of the process I am making a GA in D for a game I am working on. Since the games scripting is in PHP and Ruby I need a way to run these scripts in D. Has anyone tried using something like PHP-embed in D? I can use the PHP CLI if I really must but I would prefer just using the some sort of PHP api directly. Thanks.You can convert the PHP headers to D modules manually or using a tool such as htod or bcd.gen, and use the PHP API directly in D. -- Anders
Jul 03 2007
Hate to sound so newbish but is there a tutorial on how to do that? I think I understand what you are saying but I have not tried it with anything like PHP before. Anders Bergh Wrote:On 7/4/07, Joshua <savagejoshua gmail.com> wrote:Greetings All, Well I am now learning D and as part of the process I am making a GA in D for a game I am working on. Since the games scripting is in PHP and Ruby I need a way to run these scripts in D. Has anyone tried using something like PHP-embed in D? I can use the PHP CLI if I really must but I would prefer just using the some sort of PHP api directly. Thanks.You can convert the PHP headers to D modules manually or using a tool such as htod or bcd.gen, and use the PHP API directly in D. -- Anders
Jul 03 2007
On 7/4/07, Joshua <savagejoshua gmail.com> wrote:Hate to sound so newbish but is there a tutorial on how to do that? I think I understand what you are saying but I have not tried it with anything like PHP before. Anders Bergh Wrote:http://www.digitalmars.com/d/1.0/htomodule.html This page explains it all. Basically, D supports the C ABI so it can use existing C libraries, however it does not support C headers. You need to translate those into D modules. -- AndersOn 7/4/07, Joshua <savagejoshua gmail.com> wrote:Greetings All, Well I am now learning D and as part of the process I am making a GA in D for a game I am working on. Since the games scripting is in PHP and Ruby I need a way to run these scripts in D. Has anyone tried using something like PHP-embed in D? I can use the PHP CLI if I really must but I would prefer just using the some sort of PHP api directly. Thanks.You can convert the PHP headers to D modules manually or using a tool such as htod or bcd.gen, and use the PHP API directly in D. -- Anders
Jul 03 2007
Joshua wrote:Anders Bergh Wrote:Yes, there is a basic tutorial here: http://digitalmars.com/d/htomodule.html Tools like htod and bcd.gen (the latter is newer and probably better) automate much of the process. You'll still have to go through the generated modules by hand, but they'll do much of the grunt work. -- Kirk McDonald http://kirkmcdonald.blogspot.com Pyd: Connecting D and Python http://pyd.dsource.orgYou can convert the PHP headers to D modules manually or using a tool such as htod or bcd.gen, and use the PHP API directly in D.Hate to sound so newbish but is there a tutorial on how to do that? I think I understand what you are saying but I have not tried it with anything like PHP before.
Jul 03 2007
Kirk McDonald wrote:Joshua wrote:bcd is more likely to work because it uses a complete compiler front-end (gcc-xml) to parse the source. If you go for BCD and you're on Windows, don't overlook this precompiled version here: http://dsource.org/projects/bcd/browser/downloads (Didn't used to be linked from the BCD page ... maybe it is now) I never got around to trying BCD, though, so don't ask me for a tutorial. But if you do get it working you should definitely write a tutorial so I can read it. :-) --bbAnders Bergh Wrote:Yes, there is a basic tutorial here: http://digitalmars.com/d/htomodule.html Tools like htod and bcd.gen (the latter is newer and probably better) automate much of the process. You'll still have to go through the generated modules by hand, but they'll do much of the grunt work.You can convert the PHP headers to D modules manually or using a tool such as htod or bcd.gen, and use the PHP API directly in D.Hate to sound so newbish but is there a tutorial on how to do that? I think I understand what you are saying but I have not tried it with anything like PHP before.
Jul 03 2007
Joshua wrote:Greetings All, Well I am now learning D and as part of the process I am making a GA in D for a game I am working on.GA -- you mean a Genetic Algorithm?Since the games scripting is in PHP and Ruby I need a way to run these scripts in D. Has anyone tried using something like PHP-embed in D? I can use the PHP CLI if I really must but I would prefer just using the some sort of PHP api directly.Nope. PyD is the most advanced binding library right now as far as I know. Never heard about someone using PHP as an embedding scripting language for D or anything else, actually. --bb
Jul 03 2007
Yes its a genetic algorithm that I'm writing to analyse my game world. Its a web game though, so its written in PHP hence the need to be able to run PHP within D. Its mainly for statement evaluations though, not entire PHP pages so I don't need things like the server vars. Bill Baxter Wrote:Joshua wrote:Greetings All, Well I am now learning D and as part of the process I am making a GA in D for a game I am working on.GA -- you mean a Genetic Algorithm?Since the games scripting is in PHP and Ruby I need a way to run these scripts in D. Has anyone tried using something like PHP-embed in D? I can use the PHP CLI if I really must but I would prefer just using the some sort of PHP api directly.Nope. PyD is the most advanced binding library right now as far as I know. Never heard about someone using PHP as an embedding scripting language for D or anything else, actually. --bb
Jul 03 2007
Using PHP embed, you should be able to initiate a PHP session, quite easily. This is some of my very old code, that should give you an idea of how to use it in C http://cvs.php.net/viewvc.cgi/pecl/bcompiler/examples/embed/ I would recommend writing a small C wrapper and then binding that. - as then you dont have to deal with the Macro expansion in D. Interacting with the PHP script once running would be very difficult, as PHP's backend is a monster of Macro's which work in different ways depending on the various build options. And the whole action of creating variables, symbols etc. uses them throughout. In essence you could easily use D as a controller to start up PHP scripts using phpembed, but I would not bother doing any more than that.. - you may as well just use PHP cli scripts.. and pass data in other ways.. Regards Alan Joshua wrote:Greetings All, Well I am now learning D and as part of the process I am making a GA in D for a game I am working on. Since the games scripting is in PHP and Ruby I need a way to run these scripts in D. Has anyone tried using something like PHP-embed in D? I can use the PHP CLI if I really must but I would prefer just using the some sort of PHP api directly. Thanks.
Jul 03 2007