🎉 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!

More Epoch shtuffs

Published February 08, 2009
Advertisement
Had some more free time today so I hacked in some support for nested structures. Basically, this lets you create a structure which has members that are also structures. The Win32 API is crammed full of these scenarios, so it's a critical piece of foundational work for doing actual programming in Epoch.

It took some time to get the semantics just right, but everything runs great now. The only thing that bugs me is initializing nested members. At the moment, this is as good as it gets:

structure point :(   integer(x),   integer(y))structure messagetype :(   integer(hwnd),   integer(message),   integer(wparam),   integer(lparam),   integer(time),   point(pt))point(pt, 0, 0)messagetype(msg, 0, 0, 0, 0, 0, pt)



Ideally, I'd like to see it more along these lines:

messagetype(msg, 0, 0, 0, 0, 0, (0, 0))

I haven't quite figured out an elegant way to parse that second option, but I'm confident I'll find something that works.



Previous Entry That "other" project
Next Entry An Epoch weekend
0 likes 2 comments

Comments

choffstein
I found your last post particularly intriguing and was hoping you could go into further detail about how everything was implemented. Primarily, does this now make your system platform dependent? As well, how do you think you would implement this if you were implementing it ONTOP of another virtual machine.

The reason I ask is because I wanted to write a small lisp-like language and build the VM in C# and allow interaction between the scripting language and C#. Passing functions between C# and the language was a major conceptual road-block. Looking at your solution, I might have to learn .NET CIL ...

Would love your thoughts.

Thanks
February 08, 2009 07:12 PM
ApochPiQ
Yes, the code is now very much platform dependent. However, it should be fairly straightforward to write similar marshalling layers for other platforms. The concepts of dynamic linking and such are pretty much universal, so any serious target platform (mainly *nix systems) will have a way to duplicate this functionality.

In fact, it should be possible to do this on any architecture, virtual or otherwise. All it really does is muck around a bit with function calls.


I'll be releasing a new version of the Epoch test suite sometime fairly soon; R5 will contain the full marshalling code as well as some other goodies. The code for the marshalling system should be about as good of an explanation as I can give [smile]
February 08, 2009 07:40 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement