Jump to content

StringRegExp and StringRegExpReplace


 Share

Recommended Posts

Okay, but the question was more when an Autoit function (StringReg...) fails because of buffer overflow or usage of to much memory then Autoit will crash, right?

Is there a Windows error message? Return code -anyNumber ?

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I would assume that the error-message is the same regardless of the function causing it, it just sounds to generic (Devs, Valik, correct me if I'm wrong ;) ). Use my script above to create the error-message you should have all the infos needed.

Link to comment
Share on other sites

Okay, then one last question. I promise! The RegExp engine could be seen as a 3rd party tool within Autoit, right?

Like the SQL stuff, too.

Does Autoit catch errors from those 3rd party tools?

P.S. : Okay, I know there are two questions! ;)

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Okay, then one last question. I promise! The RegExp engine could be seen as a 3rd party tool within Autoit, right?

Like the SQL stuff, too.

Does Autoit catch errors from those 3rd party tools?

P.S. : Okay, I know there are two questions! ;)

What do you mean? If Au3 *inherits* bugs from those libraries, or if it *handles* exceptions and errors?

Actually, doesn't matter, both are true: just check how StringRegExp can return different error codes for diff. situations.

Link to comment
Share on other sites

  • Administrators

Okay, then one last question. I promise! The RegExp engine could be seen as a 3rd party tool within Autoit, right?

Like the SQL stuff, too.

Does Autoit catch errors from those 3rd party tools?

P.S. : Okay, I know there are two questions! Posted Image

If pcre (the regexp engine) returns an error code then we handle it. If it flat out crashes then no, we don't.
Link to comment
Share on other sites

What do you mean? If Au3 *inherits* bugs from those libraries, or if it *handles* exceptions and errors?

Actually, doesn't matter, both are true: just check how StringRegExp can return different error codes for diff. situations.

Actually, errors are more common than exceptions. To be more precise, there are not any exceptions at all either in the CPP or the raw API. In other language environments like C# or Java you may be able to handle exceptions but not in the PCRE library, unless you wrap the errors in your own exception class and rewrite the pcrecpp headers and sources.

Link to comment
Share on other sites

...unless you wrap the errors in your own exception class and rewrite the pcrecpp headers and sources.

Authenticity, technically that's not true. This function generates an exception that can be caught and gracefully handled without touching the function itself:

void crash_me()
{
    int *p = NULL;
    *p = 32;
}
Most programs (including AutoIt) choose not to handle such exceptions since even if they did handle them they would just close anyway. There's not much point in writing potentially hundreds of lines of custom exception handling code just to be able to recover from a couple exceptions when the vast majority of the exceptions that occur compromise the state and integrity of the program in some fashion where it's not safe to continue. We could easily bracket the PCRE code in some SEH exception handlers but what's the point? If we were going to do that we would put it somewhere to catch even more errors. But then that goes back to what I said where most exceptions won't leave AutoIt in a state safe enough to continue anyway.

Just to be clear, there are two types of exceptions that can occur in a C++ program on Windows. If written to use them, then C++ exceptions can occur. However, using and entirely different mechanism Windows also has Structured Exceptions which are not handled with the C++ keywords. The latter is what I'm referring to.

Link to comment
Share on other sites

Yes, I was referring more to the 32 or so errors start by PCRE_ERROR_*. __try..__catch.._finally has probably nothing to do with PCRE but if you're talking about PCRE exceptions then the pcrecpp package could make the deal and implement the errors in an exception or sort of a class like that. Anyway, it was my misunderstood about which kind of exceptions PCRE may throw that AutoIt doesn't catch but I'm relieved now. ;)

Link to comment
Share on other sites

If pcre (the regexp engine) returns an error code then we handle it. If it flat out crashes then no, we don't.

Thanks, that is what I thought and answers the question.

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...