ASBai

Members
  • Content count

    37
  • Joined

  • Last visited

Community Reputation

120 Neutral

About ASBai

  • Rank
    Member

Personal Information

  • Interests
    |programmer|
  1. When to use asOBJ_APP_CLASS_ALLINTS

    Hi Andreas, Thanks for your answer. I'm now using "asOBJ_VALUE|asOBJ_POD" for an empty struct. It seems work fine on 32bit vc8 (x86). But when I add asOBJ_APP_CLASS_ALLINTS flag, it crashed. I'll test it on other platform. :-) UPDATE: I've tried to use: struct PH1ST {}; // ... int r = pENGINE->RegisterObjectType("PH1ST", sizeof(PH1ST), asOBJ_VALUE|asOBJ_POD|asOBJ_APP_PRIMITIVE); assert(r >= 0); And it also works fine now.
  2. There is a value type which have a pointer property, whether I need to explicitly specify asOBJ_APP_CLASS_ALIGN8 flag for this type with the 64bit version? This there any side effect when I use asOBJ_APP_CLASS_ALIGN8 for a pointer no the 32bit platform? For example: performance drop? Still have a question: Should I use this flag for a int64 member on the 32bit platform? Or this flag is only useful on the 64bit platform? Thanks :-)
  3. When to use asOBJ_APP_CLASS_ALLINTS

    Hi Andreas, So the pointer is also a type of "integer" in this case, right? thanks More: If I have an empty value type like: struct PH1ST {}; Then should I use the asOBJ_APP_CLASS_ALLINTS flag to register it? I think I should, because an object of the empty class also has its size. But when I add this flag to it, the engine crashed
  4. Tepm object on multiple sub-expression

    Ok, lot of thanks for your quickly response and the great effort on this beautiful language. :-)
  5. Tepm object on multiple sub-expression

    Hi Andreas, Is this problem likely to be fixed in the next release? Thanks :-)
  6. Tepm object on multiple sub-expression

    I understand that this is not easy, because I have tried to fix it. But I believe this may be the most serious problem for AngleScript language. So I think it is worth some effort in this issue. :)
  7. Tepm object on multiple sub-expression

    Hi Andreas, is there any chance to fix this issue in future version?  :(
  8. Ok, thanks of you kindly super quick response :lol:
  9. I'm still feeling strange for set both the "asOBJ_POD", "asOBJ_APP_CLASS", "asOBJ_APP_CLASS_CONSTRUCTOR", "asOBJ_APP_CLASS_ASSIGNMENT" and "asOBJ_APP_CLASS_COPY_CONSTRUCTOR" flags simultaneously.   Please confirm is this legal to set the flags as that?
  10. Got it, I remembered seeing this technique in a chapter talking about concurrency.   Thanks :)
  11. According to this article: http://www.angelcode.com/angelscript/sdk/docs/manual/doc_callbacks.html If we need to callback a script function from the native app when the script is running, we must create a new context (I know I can reuse them by maintain a context pool) to do the callback? Can I launch the callback just within the current context?   For example: 1.Native App create a context named "ctx". 2.Native App then Prepare() and Execute() a script function "void script_main(void)" on "ctx". 3.The script in "script_main" make a call to a native function "native_api(my_callback)". 4.The native function "native_api" want to callback the script funcation "my_callback" also on "ctx" (not on another context). Is it possible?
  12. I've solved the iterator "operator->" problem by define two placeholder like: struct PH1ST {}; struct PH2ND {}; // ... const PH1ST i1ST; const PH2ND i2ND; // ... r = pENGINE->RegisterObjectType("PH1ST", sizeof(PH1ST), asOBJ_VALUE|asOBJ_POD); assert(r >= 0); r = pENGINE->RegisterObjectType("PH2ND", sizeof(PH2ND), asOBJ_VALUE|asOBJ_POD); assert(r >= 0); r = pENGINE->RegisterGlobalProperty("const PH1ST first", (void*)&i1ST); assert(r >= 0); r = pENGINE->RegisterGlobalProperty("const PH1ST key", (void*)&i1ST); assert(r >= 0); r = pENGINE->RegisterGlobalProperty("const PH2ND second", (void*)&i2ND); assert(r >= 0); r = pENGINE->RegisterGlobalProperty("const PH2ND value", (void*)&i2ND); assert(r >= 0); ? And then define two overload operator() under the iterator class: r = pENGINE->RegisterObjectMethod("iterator", "uint8& opCall(const PH1ST&in) const", asFUNCTION(StrItDeRef1st), asCALL_CDECL_OBJLAST); assert(r >= 0); r = pENGINE->RegisterObjectMethod("iterator", "uint8& opCall(const PH2ND&in) const", asFUNCTION(StrItDeRef2nd), asCALL_CDECL_OBJLAST); assert(r >= 0); // ... ? Now we can do this in the script: for (iterator p=container.begin(); p!=container.end(); ++p) { // ... key = p(key) // or p(first) for "p->first" value = p(value) // or p(second) for "p->second" } ? Note that because the overload matching task is done in the compiling stage, so there is no run-time performance drops here. :cool:
  13. Ok, so I can specify my own constructor and assignment operator even for a POD class, right?   I hope "operator*" and "operator->" to be able to support in the future version :-)
  14. "operator->" is also needed for the iterator class :-)