Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    423602

Untitled

Sign in to follow this  
Evil Steve

92 views

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...
Sign in to follow this  


1 Comment


Recommended Comments

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]

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!