Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Instructions for upgrading AngelScript to the latest version


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 Andreas Jonsson   Moderators   -  Reputation: 3343

Like
0Likes
Like

Posted 24 September 2004 - 06:14 AM

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
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Sponsor:

#2 abrken   Members   -  Reputation: 130

Like
0Likes
Like

Posted 25 September 2004 - 08:26 PM

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 :) ).



#3 Andreas Jonsson   Moderators   -  Reputation: 3343

Like
0Likes
Like

Posted 26 September 2004 - 04:50 AM

Good point. I'll add that notice to the article.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#4 evolutional   Moderators   -  Reputation: 1068

Like
0Likes
Like

Posted 26 September 2004 - 04:53 AM

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?

#5 Andreas Jonsson   Moderators   -  Reputation: 3343

Like
0Likes
Like

Posted 26 September 2004 - 04:57 AM

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?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#6 Deyja   Members   -  Reputation: 920

Like
0Likes
Like

Posted 26 September 2004 - 07:45 AM

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.

#7 evolutional   Moderators   -  Reputation: 1068

Like
0Likes
Like

Posted 27 September 2004 - 04:25 AM

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).

#8 Andreas Jonsson   Moderators   -  Reputation: 3343

Like
0Likes
Like

Posted 27 September 2004 - 05:26 AM

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.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS