🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Untitled

posted in DruinkJournal
Published October 18, 2006
Advertisement
Time for a random update to bump my journal [smile]

DruinkScript's VM is coming along nicely. The assembler is complete, but could do with a few more opcodes - I'll add those later on.
DruinkScript's string class is working nicely too, it makes a linked list of char[32] buffers so string operations don't have to screw about with a huge string.
There's a bunch of documented preprocessor #defines in DruinkScript.h that you can define or comment out when building the source code to do several things. At the moment there is:

  • DRUINKSCRIPT_NO_STDIO - Removes the DruinkScript::VM::LoadScriptFromFile() function, meaning the lib doesn't link with any file IO functions. Might save a few K of the exe size I suppose, and might be handy on other platforms.

  • DRUINKSCRIPT_PARANOID - Validate a lot more stuff than usual. For instance, there's 10 registers available. With DRUINKSCRIPT_PARANOID defined, and an opcode involving a register is read, the register number is checked to make sure it's 0..9. If you're compiling all the scripts yourself, and it's unlikely or impossible that the compiled script will become corrupt, you can comment this define out.

  • Another one that I can't remember just now.


And I'll need one to switch to std::string from my own string implementation.

So far I can run about a third of my test script. The mov, mul, div, add, sub and neg instructions are complete, one version for reg<-reg, reg<-int, reg<-float and reg<-string.

Well, end of ramble - back to work.
Previous Entry Untitled
Next Entry Untitled
0 likes 2 comments

Comments

benryves
That's cool. With regards to the DRUINKSCRIPT_PARANOID switch... could you not mark scripts as trusted or not - the first time they are run, they are meticulously checked, but once verified a hash of the code is stored as "trusted" and they no longer need to be checked again? (Or is that just too much effort?)
October 18, 2006 11:36 AM
Evil Steve
Quote: Original post by benryves
That's cool. With regards to the DRUINKSCRIPT_PARANOID switch... could you not mark scripts as trusted or not - the first time they are run, they are meticulously checked, but once verified a hash of the code is stored as "trusted" and they no longer need to be checked again? (Or is that just too much effort?)
I suppose I could, but then what's to stop someone just marking the script as trusted? I intend to release the source code for the whole lot anyway.
If I could manage some crazy authentication system, it'd probably be too much effort for a simple scripting language like this.
October 18, 2006 01:39 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement