AngelSCript not for Mac?

Started by
2 comments, last by WitchLord 18 years, 11 months ago
Well, I need some scripting language for my game and AS I liekd the most, mostly because of the ease of use and C-like syntax. But I want my game also for Macs and Linux.. and AngelScript does not support Macintosh, at least judging from the homepage. So, I wanted to verify - is AngelScript really not available for Macs?
--OK, that''s me and you know it.
Advertisement
Version 2.1.0b (and soon 2.1.0c) doesn't work on Mac, because it has a lot of assembler instructions to be able to communicate natively with the C/C++ application.

In version 2.2.0 WIP, there is a preprocessor flag AS_MAX_PORTABILITY which can be defined during compilation of the library to turn off all these assembler instructions. This will allow you to use the library on Mac as wel., However you will only be able to use the asCALL_GENERIC calling convention, which basically means that you'll have to write a lot of wrapper functions.

To support native calling conventions on Mac I will need help to implement the assembler instructions needed. I don't have a Mac so I cannot do it myself. I know another programmer is giving it some effort, but I haven't heard from him in a while and I'm not sure that he will be able to finish it. If you are interested in giving it a try, what I need know is how the C calling convention works on Mac using your compiler. I'll also need the syntax for how to compile inline assembly using your compiler.

You may take a look at the article Calling Conventions on the x86 Platform to get some ideas on what needs to be investigated to add support for native calling conventions on the Mac.

I'd really like to add better support for Mac, but without help I cannot do more than I already have with the AS_MAX_PORTABILITY mode.

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

HMZ, I didnt intend very advanced scripting. Most I usually would be needing - load AS script and execute from it some C functions, check result(if-s, switches..) and..well, that would be basically all - nothing more complicated than that, actually. Would I be able realise those things with AS for PC and Mac without much of additional work?

(I am kinda newbie and I am not pretty familiar with advanced programming.)
--OK, that''s me and you know it.
The extra work needed for the Mac in comparison to Win32/Linux depends on how much of the application you wish to expose to the scripts. Calling script functions would work exactly the same way, the only difference is how the script library calls application registered functions. Example:

On the Win32/Linux you would be able to register the following function directly:

void Print(std::string &str){  printf(str.c_str());}engine->RegisterGlobalFunction("void Print(string &in)", asFUNCTION(Print), asCALL_CDECL);


On the Mac you would have to write a light wrapper, that the script library can communicate with:

// This is still the same functionvoid Print(std::string &str){  printf(str.c_str());}// The wrappervoid Print_Generic(asIScriptGeneric *gen){  std::string *str = gen->GetArgObject(0);  Print(*str);}// Register the wrapper, instead of the real functionengine->RegisterGlobalFunction("void Print(string &in)", asFUNCTION(Print_Generic), asCALL_GENERIC);


To the script writer there is no difference, and to the rest of your application there is also no difference. Only how the script library communicates with the application.

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

This topic is closed to new replies.

Advertisement