• Advertisement

Starfox

Member
  • Content count

    408
  • Joined

  • Last visited

Community Reputation

504 Good

About Starfox

  • Rank
    Member
  1. Registering strongly-typed class nested enums

    :( I'm a bit heartbroken. I would have loved to have parity between C++ and AngelScript syntax. This wouldn't affect us much since our AS script path is in maintenance mode while we transition to Lua (for a bunch of unrelated reasons) but I'd love to see support for class enums in AS eventually.
  2. I'm using AS 2.24.0. I have a class like this:   [source] class foo { public: enum class state : int { a = 0, b, c }; }; [/source]   I want to register that in AngelScript. I have registration code like this:   [source] Engine->RegisterObjectType("foo", sizeof(foo), asOBJ_REF | asOBJ_NOCOUNT);     //     Engine->RegisterEnum("foo::state");     Engine->RegisterEnumValue("foo::state", "stopped", static_cast<int>(foo::state::a));     Engine->RegisterEnumValue("foo::state", "playing", static_cast<int>(foo::state::b));     Engine->RegisterEnumValue("foo::state", "paused", static_cast<int>(foo::state::c)); [/source]   However, I seem to be getting errors due to the following piece of AS code in asCScriptEngine::ResgisterEnum:   [source] // Make sure the name is not a reserved keyword size_t tokenLen; int token = tok.GetToken(name, strlen(name), &tokenLen); if( token != ttIdentifier || strlen(name) != tokenLen ) return ConfigError(asINVALID_NAME, "RegisterEnum", name, 0); [/source]   What am I doing wrong here?
  3. array performance / direct memory access?

    You might be better off embedding Python in your app - check it out, it's simple.
  4. Alignment requirements

    Bug fix for crash on querying the alignment of a built-in type: https://bitbucket.org/sherief/angelscript/commits/cfd705346d725fc3eafd641bd36c967b5531ca97
  5. Alignment requirements

    Bug fix for allocation / deallocation mismatch: https://bitbucket.org/sherief/angelscript/commits/a99b390ee34dd441c5bda6338ca05bfd9f9e1c6f
  6. Alignment requirements

    I'm trying to add aligned allocation support to asCCompiler::AllocateVariable() and I'm not sure exactly what the function does internally. Any clarification?    Also, is there any interest in merging these changes with the main AngelScript trunk? We'd love to have the feature officially supported but if there's no interest (and I'm not sure whether there is, seeing as how none of the patches were accepted) we could just do some internal hacks to get our code working and stick to that version.
  7. Alignment requirements

      Necessity is the mother of all crunch periods.
  8. Alignment requirements

    Type info defaults to 4-byte alignment: https://bitbucket.org/sherief/angelscript/commits/294090097bf181a93cc0a962991ea7ca6cbad427
  9. Alignment requirements

    Commits for aligned allocation support:    https://bitbucket.org/sherief/angelscript/commits/528c3644b335dbf0ff68963e180ef0c309b17f64 https://bitbucket.org/sherief/angelscript/commits/1f21185159ce5248f28fc1cc34b5c5098ee33738   Global property support for aligned allocation: https://bitbucket.org/sherief/angelscript/commits/269fd22c8e6f063690d3ab9643333142d7d1cdd7
  10. Alignment requirements

    CScriptEngine's CallAlloc() and CallFree() now respect type alignment: https://bitbucket.org/sherief/angelscript/commits/dbbc0002748f02d1170540563c61d989834fcc0b
  11. Alignment requirements

    Added support for aligned allocation: https://bitbucket.org/sherief/angelscript/commits/795cc7a762ea0f47455f489f1c0e0b2d71911c1e
  12. Alignment requirements

      Not really, I can't get the test harness to work on my system. We test internally but out test isn't as comprehensive. Would it be too much to ask you to test my patches? Sorry.
  13. Alignment requirements

      Some types do need natural alignment though, and the default allocator (that wraps malloc()) is already aligning to the largest supported type alignment on the platform, since malloc() is guaranteed to do that. On OS X, my primary platform, malloc() is guaranteed to return 16 byte aligned data. On almost every platform with doubles aligned is required by the spec to return a pointer that is at least as aligned as a double (8 bytes).    Also, the patches add an alignment type to the type id info that defaults to 4, and that's what'll get passed to allocators when allocating memory for a type - so in existing code the behavior of the changes should be exactly identical.
  14. Alignment requirements

    ^^ what he said.
  15. Alignment requirements

    vmovaps requires 32-byte alignment. We also see a performance benefit from aligning matrices on 32 or 64 byte boundaries due to cache behavior.
  • Advertisement