PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Integrate PPL into your applications (PPL.dll) !!

How about integrating PPL into your Visual C, Visual C++, Delphi or Visual Basic applications? It is now possible! PPL comes as a dynamic library module (ppl.dll) allowing you to call PPL scripts and accessing variables right within your applications.

The SDK will be available as a seperate download very shortly. The package will include, a PC and PocketPC version of the .dll, a demo and a very simple ppl.h include file. The SDK is very easy to use and will be free of charge. It won't allow compilation of .ppc or .exe files.

Here is a piece of code from an early demo we tested with:

Code:
// demo.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "ppl.h"

int main(int argc, char* argv[])
{
printf("Hello World!\n");
if (InitializePPL())
{
Run("ShowMessage({PPL version },Version%);");
char *s;
double d;
tvar *v = GetVariable("Version%", s, d, NULL);
MessageBox(GetForegroundWindow(), s, "VERSION%", MB_OK);
ShutdownPPL();
}
return 0;
}


PPL is one of the fastest interpreter around and now you can offer your application flexibility and power.
PointOfLight · 01 Oct 2004, 15:16 UTC
Have I ever mentioned how awesome you are? Maybe now I can write some sort of game construction kit like I've always wanted to. The best part is, it could run on two platforms!
I thought it was a bigger job to convert the project to .dll. I guess it wasn't took me a couple hours at most. I really think this opens the boundaries even more now.
PointOfLight · 01 Oct 2004, 15:49 UTC
Now I wish I had more time to spend with this stuff. It sucks having to work for a living :(
I'll second that motion! Lets put it to a vote.

Who's with us?

Brad
PointOfLight · 01 Oct 2004, 21:45 UTC
Me... Me... oh, wait. I already voted, didn't I?
Here is little update on the status of the integration demo. It is still a dumb demo but it shows how easy it is to integrate PPL inside your code.

I have added the ability to add user's functions and the eval function is not freeing the application's memory on return, leave you with all global variables accessible for querying.

Code:
#include "ppl.h"

void testfunc ()
{
char *s = PullStr();
MessageBox(GetForegroundWindow(), s, "TESTFUNC", MB_OK);
ClearTemps();
}

int main(int argc, char* argv[])
{
printf("PPL integration test!\n");
if (InitializePPL())
{
NewFunction("testfunc", &testfunc;, 1, 0);
Run("testfunc({Test message box!}); ShowMessage({PPL version },Version%);");

char *s;
double d;

tvar *v = GetVariable(NULL, "Version%", s, d, NULL);
MessageBox(GetForegroundWindow(), s, "VERSION%", MB_OK);

app *a = Eval("global(a$); a$ = {Hello World!}; ShowMessage(a$);");
v = GetVariable(a, "a$", s, d, NULL);
MessageBox(GetForegroundWindow(), s, "", MB_OK);
FreeApp(a);

ShutdownPPL();
}
return 0;
}
When are you planning on releasing this. I'd like to look at it for possible use for enemy logic in a game. I'd need to have multiple instances of it though, so that the same code could be processes across many enemies - each with their own statuses, etc.
It will be available when beta 0.9 comes out. I still have too much work for beta 0.8.
There will be a seperate product called PPL SDK (original no?) in a few days in beta. It will be a package containing 4 files:

- ppl.dll (pc version)
- ppl_wince.dll (ppc version)
- ppl.h (c header file)
- readme.txt

You will be able to integrate PPL into your own custom application written in any language possible. I will also make available later on a Delphi and VB versions of the header file.

I decided not to wait until v0.9 to test it out.

Hope you guys will like it!
PointOfLight · 09 Feb 2005, 00:02 UTC
This sounds really cool. Depending on how complex the header file is, I might be able to help you out with the VB header (assuming you haven't already started it). I'm a bit of a VB junkie, so that would be a nice addition for the collection.
Excellent, I don't know VB very well, the header is very easy to understand and small.
Can't wait to see a delphi version of that dll. There are often times when a good solid scripting language would come in handy for me.

CJ
A Delphi unit for the .dll can easily be written. I don't have the time right now but it's on my list for a later time.
kornalius wrote:A Delphi unit for the .dll can easily be written. I don't have the time right now but it's on my list for a later time.


Honestly I'd offer to convert it, unfortunately I have no experience doing that and no real knowledge of C/C++ as of yet. (I intend for that to change over the course of the next month or so. :) I'm fed up with seemingly being the last Delphi only programmer out there.)
PointOfLight · 05 Nov 2005, 23:49 UTC
I'm just happy to know that there are other Delphi developers out there. I have the job I do now (whether for good or bad) because they were developing a Delphi product and couldn't find a developer. It was my first RAD tool, and still one of my fondest programming environments.
PointOfLight wrote:I'm just happy to know that there are other Delphi developers out there. I have the job I do now (whether for good or bad) because they were developing a Delphi product and couldn't find a developer. It was my first RAD tool, and still one of my fondest programming environments.


Not too get too off topic but I have to admit I find it a very comfortable working environment as well. Most of my applications development thus far has been in Delphi.

PPL is (from what I've seen so far) the most delphi like language for the PocketPC, and now PC :) that I've come across. Believe me when I say, I'VE LOOKED :)

Come to think of it, I kinda wish that there was a delphi for the PocketPC. But this is a pretty damn fine replacement.
I am a Delphi addict also. That is why PPL is so close to it. The PIDE is entirely developed with Delphi.

At my work, I use Delphi 100% of the time. Over the years, I have developed a huge EDI software for our company and without Delphi it would have been a much harder project to maintain and support.

After using eVc and Visual C++ for PPL, I think they are great tools but in terms of visual development and simplicity they are not even close to Delphi. We can't talk about speed since Delphi is very fast.
kornalius wrote:I am a Delphi addict also. That is why PPL is so close to it. The PIDE is entirely developed with Delphi.


I had a funny feeling that the IDE was made in Delphi. After all this time with working with it, it's almost possible to spot what is and isn't made with Delphi :)
bguernsey · 20 Jan 2006, 21:09 UTC — Limiting PPL?
If you embed PPL in your application, are there any ways to limit what the script can call? (ie: a sandbox type environment with security restrictions)

The obvious application here is to be able to trust user mods.

Thanks,
Byron
Yes it will be possible. I started implementing this feature some time ago. I will perfect it in a near future, I will have the main program tell PPL what functions it can't use.
I know a few posts ago you mentioned making a VB header for the SDK. That sounds great. Has that been finished?
PointOfLight · 21 May 2006, 01:48 UTC
Wow, that was like half a thread ago :D Sadly, that was me that mentioned writing the header, and I haven't even looked at it yet (I actually forgot I mentioned that). Instead, I've been promising Kornalius a lot of other things lately that I'm still trying to find time to deliver. Unless he's had some spare time to do it :roll: , there's still hope that I might get to it some day (note, this is not the same thing as soon :( )