Untitled

posted in DruinkJournal
Published October 24, 2006
Advertisement
Woo, the DruinkScript VM is working with all the opcodes now. I just gave up with my custom string class, since it was giving me headaches, and the cache misses would probably hurt me more than moving around memory chunks in std::string. I've wrapped a std::string up in a DruinkScript::String class anyway, so it'll be simple to change in the future - E.g. if I want to use static buffers as well as std::string or whatever.

I've just started working on the host API interface now, you'll get passed a DruinkScript::Stack class reference to your functor, and that stack will have functions like GetParamType(size_t nIndex);, GetParamAsString(size_t nIndex);, GetParamAsInt(size_t nIndex); and so on (Similar to Lua).

When you register a host function, you'll pass a pointer to your functor, how many parameters it expects, and the accepted types for each parameter. The VM will attempt to perform any conversion needed, and should save the host function from validating parameters constantly.
The stack interface will just sit on top of the VM's stack, and prevent a host call from doing stupid things like touching bits of the stack it shouldn't. Just a light wrapper anyway.

Once that's done I'll be adding in the debugger, which should be pretty straightforwards, particularly if I just want to get some simple "break on error" stuff, and variable watchpoints.

Anyhoo, that'll do for now...
Previous Entry Untitled
Next Entry Untitled
0 likes 1 comments

Comments

noaktree
Glad you went with std::string. It's not worth the headache to rewrite all those operations. Good design by wrapping it. You may need to use a string optimized for a specific architecture at some point. It's only 8am but that beer in your last post is making me thirsty. [wink]
October 24, 2006 07:02 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement