iraxef

Members
  • Content count

    156
  • Joined

  • Last visited

Community Reputation

451 Neutral

About iraxef

  • Rank
    Member
  1.   That's tricky.. stuff like string foo = "this is private"; all of a sudden becomes string foo = "this is protected"; ?
  2.   The kind of backwards compatibility I'm talking about means you can't touch previously-written scripts - they have to continue working under the new AS version. If you've got a script which is under development or you're talking about future scripts, of course you'd use the improved/correct syntax :)
  3. I can imagine a situation where say some game company creates a game that allows users to mod some things via AngelScript. Let's say there's a community of such mods (scripts) out there. Then the game releases an update and for whatever reason (i.e. needed a bug fix) it incorporated a new AngelScript version. If there was a backwards compatibility break, that would mean that users who updated to the new version of the game would not be able to use any of the already-existing mods/scripts.. as those scripts would fail to compile.   Maybe starting with a future version (3?) you could commit to supporting backwards compatibility within that major version - that is, any valid script that was created/tested against a version 3 AS would continue to work as long as the application upgraded AS within version 3. Once the application upgraded past version 3 (say to 4), all bets are off. This is how Unity works, for example.   Just a thought.
  4. Yes I would be missing out on that fix, but without the option to miss out on it, I wouldn't be able to update the library past that revision and I'd miss out on everything else.
  5. script string and utf-8

    If I'm using the provided script string (add on) and I have a string instance (in script) which is has international glyphs (via utf-8).. is there any existing unicode-aware way to get the logical length()? I'm looking for the number of logical glyphs, not the length of the underlying string, per se.   Thanks.
  6. I'd have to set it to 'warn' - precisely because there are lots of existing scripts and it wouldn't be feasible for me to 1) run every single codepath of every single script or 2) verify correctness by code inspection.
  7. I wouldn't bother you if the scripts could be updated :)   We have use-cases where we want to be able to update the engine to have the latest and greatest features/performance/etc., but our application has to be able to run existing scripts which cannot be changed.   I understand your concern - maintaining backwards compatibility for any stretch of time is a huge pain. I'll investigate a local patch. Thank you.
  8.   Since this has backwards-compatibility implications, would you consider making this the new default, but adding an engine option to make old behavior an error or to emit a warning?   Thanks!
  9. Templated type-of object add_on

      I didn't implement generic calling convention because I happen to not use it.   Can you try the latest version of the library?
  10. formatFloat() fails for documented DBL_MAX

    For what it's worth I tried strod() on linux and that worked fine (I imagine that may be a closer implementation to Apple's).   But I think your change is fine.
  11. I'm assuming you're running a decent compiler-optimization level and that it's the same settings across both tests?   For example, if it's a fully-debug build with optimizations disabled.. that's not a very good test.
  12. I see what you mean: // It's possible the constructor raised a script exception, in which case we // need to free the memory and return null instead, else we get a memory leak. if( ctx && ctx->GetState() == asEXECUTION_EXCEPTION ) { a->Release(); return 0; } return a; I guess you could check whether the context had an exception before the ctor was called... but then what if the ctor added another exception? Do you have any way to check whether there are now 2 exceptions?
  13. I'm seeing an assert trigger in the following situation: CScriptArray* MyFunction(const std::string& name, MyAppType* foo) { asIObjectType* objectType = ...; if ( name.empty() ) { asGetActiveContext()->SetException("Please provide a non-empty name"); CScriptArray* scriptArray = CScriptArray::Create(objectType); assert( NULL != scriptArray ); // this asserts return scriptArray; } ... } What I'd prefer is that the function returns, but then I see my script exception (via whatever means I'm using to catch/display them).   If I allocate the array first, and then set the exception, there is no assert: CScriptArray* MyFunction(const std::string& name, MyAppType* foo) { asIObjectType* objectType = ...; if ( name.empty() ) { CScriptArray* scriptArray = CScriptArray::Create(objectType); assert( NULL != scriptArray ); // this does not assert asGetActiveContext()->SetException("Please provide a non-empty name"); return scriptArray; } ... } I can easily work around this (perhaps I should be returning NULL anyway since I've already set the script exception..) but FYI.
  14. formatInt() takes an int64 value, which means it doesn't properly handle uint64 values greater than INT64_MAX. Would it be possible to add something like the below to the script string? +static string formatUInt(asQWORD value, const string &options, asUINT width) +{ + bool leftJustify = options.find("l") != string::npos; + bool padWithZero = options.find("0") != string::npos; + bool alwaysSign = options.find("+") != string::npos; + bool spaceOnSign = options.find(" ") != string::npos; + bool hexSmall = options.find("h") != string::npos; + bool hexLarge = options.find("H") != string::npos; + + string fmt = "%"; + if( leftJustify ) fmt += "-"; + if( alwaysSign ) fmt += "+"; + if( spaceOnSign ) fmt += " "; + if( padWithZero ) fmt += "0"; + +#ifdef _WIN32 + fmt += "*I64u"; +#else +#ifdef _LP64 + fmt += "*l"; +#else + fmt += "*ll"; +#endif +#endif + + if( hexSmall ) fmt += "x"; + else if( hexLarge ) fmt += "X"; + else fmt += "u"; + + string buf; + buf.resize(width+30); +#if _MSC_VER >= 1400 && !defined(__S3E__) + // MSVC 8.0 / 2005 or newer + sprintf_s(&buf[0], buf.size(), fmt.c_str(), width, value); +#else + sprintf(&buf[0], fmt.c_str(), width, value); +#endif + buf.resize(strlen(&buf[0])); + + return buf; +} + r = engine->RegisterGlobalFunction("string formatInt(uint64 val, const string &in options, uint width = 0)", asFUNCTION(formatUInt), asCALL_CDECL); assert(r >= 0);
  15. Here's a possibly related scenario: namespace ns { namespace __ns { const string FOO = 'bar'; } void DoStuff ( ) { // this works print( ns::__ns::FOO ); // compiler error: "Unknown scope '__ns'" print( __ns::FOO ); } }