Jesper . Naur <[EMAIL PROTECTED]> writes:
>Hello everybody.
>
>In
>
>http://www.xray.mpe.mpg.de/mailing-lists/vmsperl/2000-02/msg00077.html
>
>I described this problem (name duplication, because link-time global names under VMS
>are
>converted to upper-case), and outlined 2 possible solutions. I now know, that my
>suggested solution 1
>will work, but it has the annoying drawback, that the names will have to change.
>
>Nick suggested a third possibility:
>
>>Another Solution might be to make the XS functions "static".
>
>I've now tried this but:
>
>If (in EVENT.XS) I write
>
>static int
>Const_READABLE()
>
>xsubpp generates the following C-code
>
>XS(XS_Tk__Event__IO_READABLE)
>[snip]
> RETVAL = ::Const_READABLE();
>[snip]
>
>which the C-compiler obviously doesn't like.
>
>
>If I write
>
>static
>int
>Const_READABLE()
>
>I get
>
>Error: Cannot parse function definition from 'int' in event.xs, line 1069
>
>from xsubpp
>
>(I can't decide which one is worse).
>
>Am I supposed to do something else to make the
>declaration of XS_Tk__Event__IO_READABLE static,
>or have I stumbled into an actual bug?
xsubpp does not support static XSs. You have to write the C code long-hand.
This is no big deal in Tk as it already has a bunch of such stuff, but
it dates back to before prototypes (which are really needed for these
constants.)
But I think the best fix is to avoid the issue another way.
[snip]
XS(XS_Tk__Event__IO_READABLE)
vs
XS(XS_Tk__Event__IO_readable)
[snip]
The READABLE (upper case) name is semi-public in that it is used else where.
The readable (lower case) version is not used (yet) anywhere out side
Event.xs itself. So I will rename the lowercase ones.
The delay in reply was taken up checking that lowercase form was
not used by stealth.
As per the attached patch.
Implemented with attached edit perl-script ;-)
>
> Best regards
> Jesper Naur
--
Nick Ing-Simmons
--- Event.xs.bak Wed Mar 22 16:41:39 2000
+++ Event.xs Sun Apr 2 13:31:42 2000
@@ -399,7 +399,7 @@
}
int
-PerlIO_writable(filePtr)
+PerlIO_is_writable(filePtr)
PerlIOHandler *filePtr;
{
if (!(filePtr->readyMask & TCL_WRITABLE))
@@ -417,7 +417,7 @@
}
int
-PerlIO_readable(filePtr)
+PerlIO_is_readable(filePtr)
PerlIOHandler *filePtr;
{
if (!(filePtr->readyMask & TCL_READABLE))
@@ -436,7 +436,7 @@
}
int
-PerlIO_exception(filePtr)
+PerlIO_has_exception(filePtr)
PerlIOHandler *filePtr;
{
return (filePtr->readyMask & TCL_EXCEPTION);
@@ -457,13 +457,13 @@
switch (mask)
{
case TCL_EXCEPTION:
- check = PerlIO_exception;
+ check = PerlIO_has_exception;
break;
case TCL_WRITABLE:
- check = PerlIO_writable;
+ check = PerlIO_is_writable;
break;
case TCL_READABLE:
- check = PerlIO_readable;
+ check = PerlIO_is_readable;
break;
default:
croak("Invalid wait type %d",mask);
@@ -516,13 +516,13 @@
{
/* file is ready do not block */
if ((filePtr->mask & TCL_READABLE)
- && PerlIO_readable(filePtr))
+ && PerlIO_is_readable(filePtr))
Tcl_SetMaxBlockTime(&blockTime);
if ((filePtr->mask & TCL_WRITABLE)
- && PerlIO_writable(filePtr))
+ && PerlIO_is_writable(filePtr))
Tcl_SetMaxBlockTime(&blockTime);
if ((filePtr->mask & TCL_EXCEPTION)
- && PerlIO_exception(filePtr))
+ && PerlIO_has_exception(filePtr))
Tcl_SetMaxBlockTime(&blockTime);
filePtr = filePtr->nextPtr;
}
@@ -1125,15 +1125,15 @@
int mode
int
-PerlIO_readable(filePtr)
+PerlIO_is_readable(filePtr)
PerlIOHandler * filePtr
int
-PerlIO_exception(filePtr)
+PerlIO_has_exception(filePtr)
PerlIOHandler * filePtr
int
-PerlIO_writable(filePtr)
+PerlIO_is_writable(filePtr)
PerlIOHandler * filePtr
SV *
#!
$^I = '.bak';
while (<>)
{
$read += s/\bPerlIO_readable\b/PerlIO_is_readable/g;
$write += s/\bPerlIO_writable\b/PerlIO_is_writable/g;
$except += s/\bPerlIO_exception\b/PerlIO_has_exception/g;
print;
}
warn "read=$read write=$write except=$except\n";