Jump to content
  • Advertisement

ASBai

Member
  • Content count

    69
  • Joined

  • Last visited

Community Reputation

120 Neutral

About ASBai

  • Rank
    Member

Personal Information

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Ok,I'll send it to you by email later :-)
  2. But in the default configuration, AS_NO_EXCEPTIONS is not set and " /EHsc" also not enabled, right? I just think it may be better to either enable exception or turn on AS_NO_EXCEPTIONS by default to keep the project constantly. :-)
  3. VC2005: We are deal with the c++ exception finally. So the stack unwind facilities must be enabled for it. We can enable it by simply adding the "/EHsc" option. Of course, we can also enable it through the VC Project Property Dialog at: "C/C++ -> Code Generation -> Enable C++ Exceptions" :-)
  4. Hi Andreas, It's working fine now. Thanks!
  5. Hi @WitchLord, There seems still some problem: It's ok when I register only one iterator like: r = pENGINE->SetDefaultNamespace("cique"); r = pENGINE->RegisterObjectType("iterator<T>", sizeof(...), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); // ... r = pENGINE->SetDefaultNamespace(""); Then use it like: cique::iterator<string> p=circularQueue.begin(); // ... But if I register more iterator types in different namespace: r = pENGINE->SetDefaultNamespace("vector"); r = pENGINE->RegisterObjectType("iterator<T>", sizeof(...), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); r = pENGINE->SetDefaultNamespace(""); //... r = pENGINE->SetDefaultNamespace("deque"); r = pENGINE->RegisterObjectType("iterator<T>", sizeof(...), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); r = pENGINE->SetDefaultNamespace(""); //... r = pENGINE->SetDefaultNamespace("cique"); r = pENGINE->RegisterObjectType("iterator<T>", sizeof(...), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); r = pENGINE->SetDefaultNamespace(""); And then do the exactly same thing: cique::iterator<string> p=circularQueue.begin(); // ... The engine will emit an error this time: PS: There is no xxx:iterator<string> specification registered. Thanks :-)
  6. Well done! I'll give it a try! Thanks :-D
  7. Hi @WitchLord, I've sent you a internal message with this forum, Please check it and give me a reply at your convenience. Thanks :-)
  8. Hi, WitchLord, sorry to bother you again: I want register same iterator specializations in different namespace: r = pENGINE->SetDefaultNamespace("vector"); r = pENGINE->RegisterObjectType("iterator<T>", sizeof(...), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); r = pENGINE->RegisterObjectType("iterator<int>", sizeof(...), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS); // ... r = pENGINE->SetDefaultNamespace(""); //... r = pENGINE->SetDefaultNamespace("deque"); r = pENGINE->RegisterObjectType("iterator<T>", sizeof(...), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); r = pENGINE->RegisterObjectType("iterator<int>", sizeof(...), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS); // <--- FAILED r = pENGINE->SetDefaultNamespace(""); As above shown, when I try to register deque::iterator<int>, the engine complain: And it stopped at as_scriptengine.cpp, line 1795: // If the builder fails or the namespace is different than the default // namespace, then the type name is new and it should be registered if( r < 0 || dt.GetTypeInfo()->nameSpace != defaultNamespace ) // dt.GetTypeInfo()->nameSpace = "vector", defaultNamespace = "deque" { // Make sure the name is not a reserved keyword size_t tokenLen; int token = tok.GetToken(name, typeName.GetLength(), &tokenLen); if( token != ttIdentifier || typeName.GetLength() != tokenLen ) // <---- HERE typeName = "iterator<int>", tokenLen = 8(iterator) return ConfigError(asINVALID_NAME, "RegisterObjectType", name, 0); // ... But if I don't register vector::iterator<int>, then deque::iterator<int> will work correctly. Is this an engine bug? or it's still I doing some wrong this time? 8-| Thanks :-)
  9. ASBai

    Failed register the template specialization

    Thanks, I didn't notice that the example in the document only left the asOBJ_REF flag...
  10. I've register a template vector::iterator<T>, and try to register its specialization like: r = pENGINE->SetDefaultNamespace("vector"); r = pENGINE->RegisterObjectType("iterator<T>", sizeof(ITOR), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); // OK // ... r = pENGINE->RegisterObjectType("iterator<int>", sizeof(ITOR), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); // FAILED! The engine complain: I think I'm read the document (http://www.angelcode.com/angelscript/sdk/docs/manual/doc_adv_template.html#doc_adv_template_2) carefully, But still not found where did I go wrong? BTW: The engine emit the error at as_parser.cpp (line 703): // BNF:17: IDENTIFIER ::= single token: starts with letter or _, can include any letter and digit, same as in C++ asCScriptNode *asCParser::ParseIdentifier() { asCScriptNode *node = CreateNode(snIdentifier); if( node == 0 ) return 0; sToken t1; GetToken(&t1); if( t1.type != ttIdentifier ) // <---- HERE { Error(TXT_EXPECTED_IDENTIFIER, &t1); Error(InsteadFound(t1), &t1); return node; } node->SetToken(&t1); node->UpdateSourcePos(t1.pos, t1.length); return node; } Please give me some tips, thanks :-)
  11. ASBai

    Can not create a value type template

    Yeah, I noticed that. But I think we can relax this restriction when we set the asEP_ALLOW_UNSAFE_REFERENCES option to true? :-)
  12. ASBai

    asCALL_THISCALL bind work incorrectly

    Ok, I'm missing the dummy int argument, thanks :-)
  13. I have a std::vector::iterator wrapper class like this: template <...> class CStdVecItor { // ... CStdVecItor operator++(int) { return CStdVecItor(m_nObjTypeID, m_it++); } }; And I register this class by: typedef CStdVecItor<...> ITOR; r = pENGINE->RegisterObjectType("iterator<T>", sizeof(ITOR), asOBJ_VALUE|asOBJ_APP_CLASS_CDAK|asOBJ_APP_CLASS_ALLINTS|asOBJ_TEMPLATE); // ... r = pENGINE->RegisterObjectMethod("iterator<T>", "iterator<T> opPostInc(void)", asMETHODPR(ITOR, operator++, (int), ITOR), asCALL_THISCALL); Now while I'm using the postInc operation like this: // AngelScript: vector::iterator<int> p = vTest.begin(); p++; The APP crashed at CallThisCallFunctionRetByRef's "return retQW;" statement, and the CRT complain: But if I defined the opPortInc like this: template <...> class CStdVecItor { // ... static CStdVecItor PostInc(IN OUT CStdVecItor* const pTHIS) { return CStdVecItor(pTHIS->m_nObjTypeID, pTHIS->m_it++); } }; // ... r = pENGINE->RegisterObjectMethod("iterator<T>", "iterator<T> opPostInc(void)", asFUNCTION(ITOR::PostInc), asCALL_CDECL_OBJLAST); Then everything is ok now. So I suspect there is a bug in the CallThisCallFunctionRetByRef function that handles asCALL_THISCALL? PS: I'm using VC8 (VS2005) with 32bit x86 debug build with AS revision 2477.
  14. ASBai

    Can not create a value type template

    Amazing fast! Many thanks :-D I've tested the revision 2477, and all others seems ok, but the asBEHAVE_TEMPLATE_CALLBACK callback still require the &in and &out qualifiers?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!