Advertisement

AngelScript 1.8.0 WIP #4 (2004/07/03)

Started by June 29, 2004 07:49 PM
19 comments, last by zola 20 years, 4 months ago
I've just posted the latest work in progress. WIP page The new addition is the support for modules. Which requires a few changes to the following methods:
  • AddScriptSection()
  • Build()
  • GetFunctionCount()
  • GetFunctionIDByName()
  • GetFunctionIDByDecl()
The easiest way to get things working again is to add 0 (or "") as the first parameter to these functions. That makes your application use a module with no name. There is no interaction between modules so far. The only thing they share is the engine configuration. A future version will allow connection between modules so that they can interact. Oh, and if you are enumerating script functions, you'll notice that @init() and @exit() are no longer enumerated. There is still a lot to do on version 1.8.0 so I had better get back to work. ;) Regards, Andreas The link on the page is wrong. The correct file is http://www.angelcode.com/angelscript/files/angelscript_sdk_180WIP4.zip [Edited by - WitchLord on July 7, 2004 7:39:14 AM]

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

I've uploaded the latest WIP version, which adds support for STDCALL functions and fixes a bug.

The implementation for the STDCALL support was contributed by Adam Hoult from Game Institute, a.k.a. daedalusd. The bug was also discovered by him. Thanks very much, Adam.

Regards,
Andreas Jonsson
Author of 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

Advertisement
I was thinking of a way to enable VS style autocomplete in a console window, i wanted to know how i could use GetFunctionCount() and read the function declaration and appropriately display them in the window. Any ideas or implementaions required? ex: (GetFunctionNameByID() sorts)
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.
GetFunctionCount() returns the number of functions in the script.

The valid function IDs are between 0 and GetFunctionCount()-1. The first 2 functions may be @init() and @exit(), which shouldn't be called by the application.

GetFunctionName() returns the name of the function by ID.
GetFunctionDeclaration() returns the declaration of the function by ID.

The above is true for version 1.7.1.

For version 1.8.0 this is currently slightly broken since a function ID now holds the module ID in the upper 16 bits. I'll figure out a way before final release to make it just as easy to enumerate the functions.

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

What does the code generation settings for Release need to be? I am using a game lib that the creator suggested I use Single Threaded. I get a lot of errors when compiling for relese, but everything is fine for debug. I heard that this kind of thing can happen when you use libs of different code generations. My debug code generation is set on debug multithreaded dll. So, I tried Multithreaded DLL for release and I get 100 link errors.

Here are a few:

angelscript.lib(as_variablescope.obj) : error LNK2001: unresolved external symbol __ftol
ac_string.obj : error LNK2001: unresolved external symbol __imp__strstr
angelscript.lib(as_compiler.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z)
hgehelp.lib(hgeparticle.obj) : error LNK2001: unresolved external symbol __fltused

Here is what I link against:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib hge.lib hgehelp.lib angelscript.lib

Is there some kind of system lib I'm not linking (I have the latest WIP of angelscript btw)?
I have some difficulties in registering overloaded methods with WIP#4 (the only WIP I tried yet :)

with v 1.7.1a I registered overloaded methods like this:

asMETHOD( (void (Vector3::*)(float , float , float) )Vector3::set) asMETHOD( (void (Vector3::*)(const Vector3&) )Vector3::set )

but with the new macro definition of WIP#4 I have some truble to get the right method.

asMETHOD(Vecotr3,set) // doesn't work in MSVC .NET 2003 (vc7.1)

Any hints what I could try?

Thanks
Tom
Advertisement
That Anonymous Poster was me, sorry.
Oops! I'll have to back to the drawing board. It didn't occur to me that the overloaded functions wouldn't be able to use the new macro.

It should just be a matter of writing another macro that takes as a parameter the method parameters so that the pointer cast can be formed. I'm no wiz with macros so it might take me some time to get a nice looking macro. If someone can come up with a macro before me, don't hesitate to give me your suggestions.

If possible I would like the macro to look something like this:

asMETHOD(c,m,p) where c is the class name, m is the method name, and p is the parameter list. It would then be used as follows:

asMETHOD(CMyClass, MyMethod, (int, float, double))

In the meantime you could skip the macro and use the following to get to your method

asSMethodPtr<sizeof(void (c::*)())>::Convert((void (c::*)(p))(&c::m))

Exchange c for the class name, m for the method names, and p for the parameter list for the method.

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

It was easier than I thought.

Put the following macro in the angelscript.h file

#define asMETHODP(c,m,p) asSMethodPtr<sizeof(void (c::*)())>::Convert((void (c::*)p)(&c::m))

Now you can take the pointer of overloaded methods by writing the following:

asMETHODP(MyClass, MyMethod, (int, float))

Note you should keep asMETHOD(c,m) as it will still be used when there is no need to define the parameter list.

Regards,
Andreas

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

Almost there ;)

You will probably have to include the return value with the macro
maybe for global functions too??

#define asMETHOD4(c,r,m,p) asSMethodPtr<sizeof(void (c::*)())>::Convert((r (c::*)(p))(&c::m))

the above doesn't work ofcourse, that is it works for one parameter functions .....

This topic is closed to new replies.

Advertisement