On Feb 2, 2008, at 8:07 PM, Aria Stewart wrote:
> There's a lot of MacOS-isms in RegexKit. I've spent most of a morning
> hacking them out, though there's a handful I don't know what to do
> about
> (pthread_*_np functions especially, since they don't exist under
> Linux).
> Any ideas there for reducing or avoiding the need for them would be
> awesome.
Unfortunately I don't have access to a Linux machine, so it's hard for
me to test against it. :) I have some FreeBSD machines that I do
most of my GNUstep testing against, and it (obviously) works there.
It also helps me weed out and contain the OSX stuff. OSX is
(obviously) the primary development platform for RegexKit, but I try
to keep it portable and useable under GNUstep (hence the number of
#define ENABLE_* like flags for turning bits and pieces on and off,
like garbage collection, dtrace, etc).
The pthread_*_np functions are "non-portable", usually implementation
specific but the one that's used (pthread_main_np) is fairly common.
This is isolated in the file RegexKitPrivateThreads.h file with the
macro/function RKIsMainThread. For example, the solaris version ends
up being:
RKREGEX_STATIC_INLINE void RKIsMainThread(void) { thr_main(); }
I'm sure Linux has a similar function.
Actually, I just did a quick check to see where RKIsMainThread is
called and it's... currently not. So, it would probably be safe to
put something like
#define RKIsMainThread() abort()
which will trip any uses of it (which there should be none of). I
can't remember specifically why this was originally put in, but the
need has obviously changed.
>
> Also, why does RegexKit depend on the GUI portions of AppKit? GNUstep,
> for example, has no NSShadow class, and I can't see a reason for its
> use
> in RegexKit. Any comments?
This almost certainly comes from the function
'RKErrorForCompileInitFailure' in RKRegex.m. If you take a look at
it, you'll see there's a #if check to seperate out the 'extra' Mac OS
X Cocoa bits from what GNUstep provides. Maybe I botched it this time
around (this is a new function as I split out the old exception
throwing behavior from the newer NSError reporting functionality).
The reason for the usage of NSShadow is there is an NSAttributedString
that is created that 'highlights' the character in which PCRE detected
the error by using a red text shadow and increasing the kern around
that character to further emphasize it. It's primarily intended for
GUI's as an enhanced way of highlighting the problem.
>
> Aria Stewart
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/_______________________________________________
> Regexkit-discussion mailing list
> Reg...@li...
> https://lists.sourceforge.net/lists/listinfo/regexkit-discussion
|