Jump to content
  • Advertisement
Sign in to follow this  
WitchLord

Instructions for upgrading AngelScript to the latest version

This topic is 5470 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In my efforts to make AngelScript the best possible library I sometimes need to break backwards compatibility. This obviously causes trouble when you want to upgrade your application to use the latest available version. I initially thought that looking at the changelog would be enough to find what needed to be updated, but I have since realized that this is not so. I've been asked to keep backwards compatibility, and to those who asked I first responded that I would. I believed that it would be quite easy to write a wrapper class that exposed the older interface and translated the calls to the newer one, but as I started implementing it I noticed that it was not so easy after all. In some parts it is simply not possible at all. Instead I've decided to write a detailed document that will show the exact changes needed to do the upgrade. I think it is pretty much done, and I'll make it official with the next WIP release. Until then you can find the first draft here: Upgrade instructions for AngelScript

Share this post


Link to post
Share on other sites
Advertisement
Great !
Before I was always looking at the framework project to see hiow to implement changes.

But you have forgotten the (for me it is !) most important change that appear, I think in 1.8.x WIP, you have changed :

#include "angelscript.h"

to

#include "../include/angelscript.h"


This change has really to be notified (it cause me not to update angelcode everytime I want because I must change all .h files that include angelscript.h . I'm using visual sourcesafe :) ).

Share this post


Link to post
Share on other sites
I was looking at Game Programming Gems 2 and there's a really simple gem in there to flag if someone's using depreciated functions. Basically you declare your function as depreciated and if it's used, you get a report of where and when it was used and a message to say which one you should use.

I don't know how much you've tinkered with your interfaces, but this sounds like an elegant helper, maybe?

Share this post


Link to post
Share on other sites
That could be helpful. Unfortunately I don't know of any such flag. I don't have Game Programming Gems 2 either so I can't look it up.

Would you mind explaining how it works?

Share this post


Link to post
Share on other sites
It's really rather simple. You create a manager class with a method 'record' whose sole purpose is to record calls to certain function. The manager prints out a list when it is destroyed. In the function to be deprecated, you stick a call to 'record' at the very begining of the function (thus recording the call). The GPG2 article does some ASM and macro trickery to get the function 'record' was called from, and goes so far as to inform the user what function he should be using.

Share this post


Link to post
Share on other sites
Like Deyja said. I don't have the book to hand, so I'll interpret it how I understand the concept. There's a singleton manager class that keeps track of the depreciated functions.

You create a macro DEPRECIATE( oldFunc, newFunc ) that you put in your depreciated functions. The macro calls a Depreciated Manager method to add it to the list. Something like DepreciateManager::Reference( char *oldFunc, char *newFunc, char *file, char *func ) would do it. The macro would call the method, adding the relevant __FILE__ and __FUNC__ parameters generated by the compiler.

In your old function you'd do something like this:
void MyClass::MyOldFunc()
{
DEPRECIATE( "MyOldFunc", "MyNewFunc" );
// Do something not as cool
}

void MyClass::MyNewFunc()
{
// Do something cool
}








What happens is that the manager keeps track of how many times a depeciated function is called and then dumps out a report when the program closes (or when the manager is destroyed). It'd print (to file or debug out) something like:

Quote:

Depreciated Function "MyOldFunc" was referenced 4 times, please use the new function "MyNewFunc".
Listing files:
- "test.cpp" in function "DoSomething"
- "main.cpp" in function "DoSomethingCool"
- "test.cpp" in function "DoSomethingReallyCool"
- "test.cpp" in function "DoSomethingReallyReallyCool"


Obviously, you could disable it in release mode. The idea would be to make the user aware of the fact they're using depreciated functions.

It's just a suggestion, but it may be useful if you know you're going to change the API in a couple of releases or so (or may have already done so).

Share this post


Link to post
Share on other sites
I thank you for this excellent suggestion.

I think I'll do something just like this for future versions, at least where it is possible. There may be some cases where it is not possible to keep backwards compatibility, e.g. when flags/constants change meaning, though these cases don't happen that often.

Share this post


Link to post
Share on other sites
Sign in to follow this  

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