Re: How to mangle system time for testing

2005-12-29 Thread Javier Amor Garcia
Test::MockTime works fine and with it i finished my test.

Thanks for the advice, Adrian



Most Perl6 developers running linux on i386?

2005-12-29 Thread Peter Schwenn
I've spent a couple of days trying out Cygwin, MinGW, PXPerl,  and other 
Windows based contexts, in order to build Pugs w/Embedded Parrot.  I've 
learned a lot about configuration and little else.


Would I be right in supposing that most people working on Perl6 and 
Parrot development, and spend relatively little time jiggering configs 
and makes, are working under Linux on i386 machines?  (excluding a few 
who have had plenty of time to get a VS6/7 or Cygwin or ... environment 
straightened out.)


Schwenn wrote:

Luke,

Thank you very much - that should get me more than started.

One more pointer, an elaboration, (a general one to documentation one 
relation of Pugs to embedded Parrot even better): if Pugs doesn't have a 
feature yet, like much of Rules, does it ship it off to embedded Parrot 
for potential help?


Thanks again

Luke Palmer wrote:

On 12/23/05, Peter Schwenn <[EMAIL PROTECTED]> wrote:
 

Perl6'ers

Is the "best" (most complete as to Perl6 Language) current setup (for
experimenting with Perl6 source code) currently a hybrid: Pugs with
embedded Parrot, or is it Perl5 with a large set of Perl6'ish modules.
Or something else that I've missed.



Definitely pugs.  Perl 5 with Perl6:: modules gives you a few nice
features, but it is by no means programming in Perl 6.

You have to embed Parrot if you want to experiment with rules (or use
s:Perl5///).  The perl 5 module Perl6::Rules doesn't... um... work. 
However, rules are a little sketchy just about everywhere, so be

prepared to fight with it no matter what you choose.

 

For the former case (Pugs+Parrot) where is starting point for
documentation for acquiring configuring and make'ing the right Pugs and
Parrot bits?



Quite simple, really.  Get parrot and build it as usual.  Get pugs and
set PARROT_PATH="/path/to/parrot/trunk", and then Makefile.PL; make as
usual.  That should do it.

The documentation for that is, as far as I know, in Makefile.PL.  It
will tell you "Parrot embedding disabled" if you didn't set things up
right.

Luke



  




Re: Cygwin versun plain XP (for working with Pugs+Parrot together)

2005-12-29 Thread Greg Bacon
In message <[EMAIL PROTECTED]>,
Joshua Hoblitt writes:

: It looks like it was just a missing curly brace.  Fix commited as
: r10699.  Thanks for reporting.

Thanks.

In my defense, yes, I did try the obvious fix. Looking at the diff,
I must've added the curly after C<1;>.  The quiet from my wife and
kids visiting my mother-in-law must be too distracting! :-)

After svn up and Nick's nullification of the dynclasses Makefile, I
see

Failed TestStat Wstat Total Fail  Failed  List of Failed
---
t/dynclass/dynlexpad.t6  1536 66 100.00%  1-6
t/dynclass/foo.t  8  2048 98  88.89%  1-5 7-9
t/dynclass/gdbmhash.t13  332813   13 100.00%  1-13
t/op/trans.t  1   256191   5.26%  13
7 tests and 702 subtests skipped.
Failed 4/189 test scripts, 97.88% okay. 28/4581 subtests failed, 99.39% okay.
make: *** [test] Error 14

Greg


Re: $Ignore_Exitcode in Test-Harness

2005-12-29 Thread Shlomi Fish
On Monday 26 December 2005 08:59, Andy Lester wrote:
> On Sun, Dec 25, 2005 at 01:46:21PM +0200, Shlomi Fish ([EMAIL PROTECTED]) 
wrote:
> > 
> > # Some experimental versions of OS/2 build have broken $?
> > my $Ignore_Exitcode = $ENV{HARNESS_IGNORE_EXITCODE};
> >
> > Meaning, that neaither the environment variable nor the variable that has
> > been assigned from it are referenced. Is it because this functionality
> > was removed or because these lines were accidently removed? In any case,
> > it should be fixed.
>
> I've pulled it out.  Thanks.
>

Thanks for the fix, and for the information.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.


Re: The --perl switch [was Re: $Ignore_Exitcode in Test-Harness]

2005-12-29 Thread Shlomi Fish
On Monday 26 December 2005 09:35, Andy Lester wrote:
> On Sun, Dec 25, 2005 at 10:49:28PM +0200, Shlomi Fish ([EMAIL PROTECTED]) 
wrote:
> > However prove does not have a "--perl" switch:
>
> Fixed in Test::Harness 2.57_01.  Thanks.
>

And thanks again. I've implemented it in runprove (the Test::Run equivalent of 
prove) as well.

Regards,

Shlomi Fish

-
Shlomi Fish  [EMAIL PROTECTED]
Homepage:http://www.shlomifish.org/

95% of the programmers consider 95% of the code they did not write, in the
bottom 5%.


Re: The --perl switch [was Re: $Ignore_Exitcode in Test-Harness]

2005-12-29 Thread demerphq
On 12/26/05, Andy Lester <[EMAIL PROTECTED]> wrote:
> On Sun, Dec 25, 2005 at 10:49:28PM +0200, Shlomi Fish ([EMAIL PROTECTED]) 
> wrote:
> > However prove does not have a "--perl" switch:
>
> Fixed in Test::Harness 2.57_01.  Thanks.

Since you are working on Test::Harness and prove i wonder what the status is of

  https://rt.cpan.org/Ticket/Display.html?id=8767

yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"


Injecting functionality into Test::Harness without needing to touch it...

2005-12-29 Thread Adam Kennedy

I'm looking at writing a system a little similar to CPAN Testers.

http://ali.as/pita/

I'll be announcing the project properly once I have some basics in 
place, but the part of it I'm caring about today needs to run through...


Makefile.PL
make
make test
sudo make install

...and capture the output of each command (both STDOUT and STDERR) 
non-verbosely, and ALSO seperately capture the actual TAP output of each 
test script (STDOUT and STDERR) so that I can later munge it into an XML 
document that is used to report the results of the installation.


The XML document itself is dealt with by PITA::Report which is on CPAN now.

The problem I have is that I want to NOT alter the normal makefile or in 
any other way change the package itself, and I can't change the perl 
being used to run the installation.


The only thing I can easily set to alter the testing behaviour are 
environment variables.


What I'm wondering is, is there anyway I can either

1) Provide an environment variable to Test::Harness that makes it dump 
the stderr/stdout output of each test script to some location I can pick 
it up after make test is run.


2) Provide an environment variable to Test::Harness that more 
generically makes it require a specific file I'd create specifically for 
this, which would maybe do something to the Test::Harness internals to 
achieve the same thing...


Thoughts from people on doing what I want?

Adam K



[perl #38065] [PATCH] TCL [string totitle]

2005-12-29 Thread via RT
# New Ticket Created by  Alberto Simoes 
# Please include the string:  [perl #38065]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38065 >


Cheers
Alberto
-- 
Alberto Simões - Departamento de Informática - Universidade do Minho
  Campus de Gualtar - 4710-057 Braga - Portugal
Index: languages/tcl/t/cmd_string.t
===
--- languages/tcl/t/cmd_string.t(revision 10763)
+++ languages/tcl/t/cmd_string.t(working copy)
@@ -2,7 +2,7 @@
 
 use strict;
 use lib qw(tcl/t t . ../lib ../../lib ../../../lib);
-use Parrot::Test tests => 92;
+use Parrot::Test tests => 97;
 use Parrot::Config;
 use Test::More;
 
@@ -519,6 +519,38 @@
 OUT
 
 
+
+language_output_is("tcl",<<'TCL',< 3 goto bad_args
+  if argc < 1 goto bad_args
+  
+  $S1 = argv[0]
+  $I1 = length $S1 # it will be useful
+
+  # If no range is specified, do to all the string
+  $I2 = 0
+  $I3 = $I1
+  if argc == 1 goto totitle_do
+
+  .local pmc string_index
+  string_index = find_global "_Tcl", "__string_index"
+
+  $S2 = argv[1]
+  $I2 = string_index($S2, $S1)
+  # if just the first is specified, the last is the same (tclsh says so)
+  $I3 = $I2
+  if argc == 2 goto totitle_do
+  
+  $S3 = argv[2]
+  $I3 = string_index($S3, $S1)
+
+totitle_do:
+  if $I2 > $I1  goto totitle_return
+  if $I3 <= $I1 goto totitle_start
+  $I3 = $I1
+
+totitle_start:
+  $I4 = $I3 - $I2
+  $I4+= 1
+  $S2 = substr $S1, $I2, $I4
+  titlecase $S2
+  substr $S1, $I2, $I4, $S2
+
+totitle_return:
+  .return($S1)
+
+bad_args:
+  .throw ("wrong # args: should be \"string totitle string ?first? ?last?\"")
+
+.end
+
+
+
 .sub "bytelength"
   .param pmc argv
 


[perl #34549] [PATCH] t/op/trans.t failure on OpenBSD

2005-12-29 Thread Steve Peters via RT
> [stmpeters - Tue Mar 22 15:41:12 2005]:
> 
> When running testing parrot-HEAD, I get a test failure in 
t/op/trans.t on 
> OpenBSD.  Running the same tests on Linux seem to work just fine...
> 
> > perl -Ilib t/op/trans.t
> 1..19
> ok 1 - sin
> ok 2 - cos
> ok 3 - tan
> ok 4 - sec
> ok 5 - atan
> ok 6 - asin
> ok 7 - acos
> ok 8 - asec
> ok 9 - cosh
> ok 10 - sinh
> ok 11 - tanh
> ok 12 - sech
> not ok 13 - atan2
> # Failed test (t/op/trans.t at line 307)
> #  got: 'ok 1
> # ok 2
> # ok 3
> # ok 4
> # ok 5
> # ok 6
> # ok 7
> # ok 8
> # ok 9
> # ok 10
> # ok 11
> # ok 12
> # ok 13
> # ok 14
> # ok 15
> # ok 16
> # not 0.00ok 17
> # '
> # expected: 'ok 1
> # ok 2
> # ok 3
> # ok 4
> # ok 5
> # ok 6
> # ok 7
> # ok 8
> # ok 9
> # ok 10
> # ok 11
> # ok 12
> # ok 13
> # ok 14
> # ok 15
> # ok 16
> # ok 17
> # '
> ok 14 - log2
> ok 15 - log10
> ok 16 - ln
> ok 17 - exp
> ok 18 - pow
> ok 19 - sqrt
> # Looks like you failed 1 tests of 19.
> 
> 

Included below is a patch that fixes the above test failures on 
OpenBSD.  I've also included code to fix the problem on Cygwin (see 
ticket #36835) although I could not get Cygwin to compile with or 
without my patch.  A similar solution will likely work on a gcc-
compiled Solaris, but I discuss that in the more recent ticket there.  
I'm also guessing that NetBSD will require a similar patch, but I need 
to get on a NetBSD machine a test my patch.  Expect that patch later 
today.

--- MANIFEST.oldThu Dec 29 00:03:32 2005
+++ MANIFESTThu Dec 29 08:31:01 2005
@@ -189,6 +189,7 @@
 config/gen/platform/ansi/dl.c []
 config/gen/platform/ansi/exec.c   []
 config/gen/platform/ansi/io.h []
+config/gen/platform/cygwin/init.c []
 config/gen/platform/ansi/time.c   []
 config/gen/platform/darwin/begin.c[]
 config/gen/platform/darwin/dl.c   []
@@ -197,6 +198,7 @@
 config/gen/platform/generic/dl.h  []
 config/gen/platform/generic/env.c []
 config/gen/platform/generic/exec.c[]
+config/gen/platform/generic/init.c[]
 config/gen/platform/generic/io.h  []
 config/gen/platform/generic/itimer.c  []
 config/gen/platform/generic/math.c[]
@@ -210,6 +212,7 @@
 config/gen/platform/generic/threads.h []
 config/gen/platform/generic/time.c[]
 config/gen/platform/ia64/asm.s[]
+config/gen/platform/openbsd/init.c[]
 config/gen/platform/openbsd/memexec.c []
 config/gen/platform/openbsd/misc.h[]
 config/gen/platform/platform_interface.h  []
--- /dev/null   Thu Dec 29 05:43:20 2005
+++ config/gen/platform/generic/init.c  Wed Dec 28 23:11:38 2005
@@ -0,0 +1,3 @@
+/* Placeholder for platform specific initializations (header includes,
+ * global variable initialization, etc.
+ */
--- /dev/null   Thu Dec 29 05:43:38 2005
+++ config/gen/platform/openbsd/init.c  Wed Dec 28 23:23:45 2005
@@ -0,0 +1,3 @@
+#include 
+
+_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
--- /dev/null   Thu Dec 29 05:43:38 2005
+++ config/gen/platform/cygwin/init.c  Wed Dec 28 23:23:45 2005
@@ -0,0 +1,3 @@
+#include 
+
+const _LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;


[perl #38060] [BUG] atan2() broken on Solaris with gcc

2005-12-29 Thread Steve Peters via RT
> [EMAIL PROTECTED] - Wed Dec 28 14:07:26 2005]:
> 
> A quick demonstration of the issue:
> 
> --
> #include 
> #include 
> 
> int main ()
> {
> printf("%f\n", atan2(0.0, 0.0));
> printf("%f\n", atan2(-0.0, -0.0));
> }
> --
> 
> --
> $ gcc foo.c -lm
> $ ./a.out
> 0.00
> 0.00
> --
> 
> This is also documented in config/init/hints/solaris.pm:
> 
> 
> # Parrot usually aims for IEEE-754 compliance.
> # For Solaris 8/Sun Workshop Pro 4, both
> #atan2( 0.0, -0.0) and atan2(-0.0, -0.0)
> # return 0, when they should return +PI and -PI respectively.
> # For Sun's compilers, fix this with the -xlibmieee flag.
> # I don't know of an equivalent flag for gcc.
> # (Alternatively, and more generally, perhahs we should run an
> # ieee-conformance test and then call back into a hints-file 
trigger
> # to set platform-specific flags.
> #   A. Dougherty  7 March 2005
> # We don't know which compiler we're using till after the 
gccversion
> # test.
> 
> 
> The question is, can we get atan2() to 'behave' with gcc or do we need
> to provide our own implementation?

As Sun is the original author of the BSD math libraries, NetBSD, 
OpenBSD, and Cygwin are all similarly effected by this problem (see RT# 
34549 and 36835).  On Solaris, however, they've made the switch from 
BSD to AT&T based math libraries, so some #ifdef's are probably needed 
for Solaris.  The code below is untested, but should solve the problem 
you are seeing after the patch for problem #34549 is applied.

--- /dev/null   Thu Dec 29 08:50:54 2005
+++ config/gen/platform/solaris/init.c  Thu Dec 29 08:50:26 2005
@@ -0,0 +1,4 @@
+#include 
+#if defined(__GNUC__) && defined(_LIB_VERSION)
+_LIB_VERSION_TYPE _LIB_VERSION = _IEEE_;
+#endif



[perl #38065] [PATCH] TCL [string totitle]

2005-12-29 Thread Will Coleda via RT
Thanks, applied!



[perl #38058] [PATCH] make [string last] work on tcl

2005-12-29 Thread Will Coleda via RT
Tests are fine. Good work catching those!

Thanks, Applied!

> [ambs - Wed Dec 28 09:44:28 2005]:
> 
> Please validate the tests, as the meaning of the 'last' third argument 
> wasn't the correct in the test cases.
> 
>  From tcl,
> Search string2 for a sequence of characters that exactly match the 
> characters in string1. If found, return the index of the first character 
> in the last such match within string2. If there is no match, then return 
> -1. If lastIndex is specified (in any of the forms accepted by the index 
> method), then only the characters in string2 at or before the specified 
> lastIndex will be considered by the search.
> 
> 
> Which means that if lastindex > length(string2), then length(string2) is 
> considered and no error is raised.
> 
> Cheers
> Alberto
> 
> 



[perl #38066] [PATCH] tcl [string trim(left|right|)

2005-12-29 Thread Will Coleda via RT
Thanks, Applied!


[perl #38067] [PATCH] tcl [string replace] working

2005-12-29 Thread Will Coleda via RT
Thanks, Applied!


[perl #38068] [TODO] Tcl: Add support for octal numbers

2005-12-29 Thread via RT
# New Ticket Created by  Matt Diephouse 
# Please include the string:  [perl #38068]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38068 >


Partcl needs support for octal numbers. There are two important cases 
that should be made to work:

mdiep~$ tclsh
% puts [expr 12345]
5349
% set i 25; incr i 12345
5374

mdiep~$ partcl
% puts [expr 12345]
12345
% set i 25; incr i 12345
12370

--
matt diephouse
http://matt.diephouse.com


Re: Most Perl6 developers running linux on i386?

2005-12-29 Thread Steve Peters
On Wed, Dec 28, 2005 at 09:50:49PM -0500, Peter Schwenn wrote:
> I've spent a couple of days trying out Cygwin, MinGW, PXPerl,  and other 
> Windows based contexts, in order to build Pugs w/Embedded Parrot.  I've 
> learned a lot about configuration and little else.
> 
> Would I be right in supposing that most people working on Perl6 and 
> Parrot development, and spend relatively little time jiggering configs 
> and makes, are working under Linux on i386 machines?  (excluding a few 
> who have had plenty of time to get a VS6/7 or Cygwin or ... environment 
> straightened out.)
> 

These problems have come and gone over the years as people have taken up the
challenge of making Parrot compile and pass its tests on their system.   I
believe, however, that we've only seen the tip of the iceberg as I don't
recall complaints or patches regarding Parrot compiles on z/OS, VMS, BeOS, or
some of the other OS's that Perl 5 currently supports.  My hope and expectation
is that as th various Perl 6 projects start to look more like the end
product, more of these issues will come up.  I also expect that more active
developers will be picked up along the way to deal wtih these problems.  So, 
for me, I'm concerned, but I surely expect that none of these problems on 
Win32 based systems current is an indication of the level of support to expect
from these systems in the future. 

Steve Peters
[EMAIL PROTECTED]


Re: The --perl switch [was Re: $Ignore_Exitcode in Test-Harness]

2005-12-29 Thread Andy Lester
On Thu, Dec 29, 2005 at 12:40:25PM +0100, demerphq ([EMAIL PROTECTED]) wrote:
> Since you are working on Test::Harness and prove i wonder what the status is 
> of
> 
>   https://rt.cpan.org/Ticket/Display.html?id=8767

Will you settle for this instead?  It's more DRY.

xoa

Index: t/prove-switches.t
===
--- t/prove-switches.t  (revision 2237)
+++ t/prove-switches.t  (working copy)
@@ -24,6 +24,7 @@
 my $blib_lib = File::Spec->catfile( $blib, "lib" );
 my $blib_arch = File::Spec->catfile( $blib, "arch" );
 my $prove = File::Spec->catfile( $blib, "script", "prove" );
+$prove = "$^X $prove";
 
 CAPITAL_TAINT: {
 local $ENV{PROVE_SWITCHES};
Index: t/prove-globbing.t
===
--- t/prove-globbing.t  (revision 2237)
+++ t/prove-globbing.t  (working copy)
@@ -16,8 +16,9 @@
 
 plan tests => 1;
 
+my $tests = File::Spec->catfile( 't', 'prove*.t' );
 my $prove = File::Spec->catfile( File::Spec->curdir, "blib", "script", "prove" 
);
-my $tests = File::Spec->catfile( 't', 'prove*.t' );
+$prove = "$^X $prove";
 
 GLOBBAGE: {
 my @actual = sort qx/$prove --dry $tests/;

-- 
Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance


Re: The --perl switch [was Re: $Ignore_Exitcode in Test-Harness]

2005-12-29 Thread demerphq
On 12/29/05, Andy Lester <[EMAIL PROTECTED]> wrote:
> On Thu, Dec 29, 2005 at 12:40:25PM +0100, demerphq ([EMAIL PROTECTED]) wrote:
> > Since you are working on Test::Harness and prove i wonder what the status 
> > is of
> >
> >   https://rt.cpan.org/Ticket/Display.html?id=8767
>
> Will you settle for this instead?  It's more DRY.

Seems like it will do the same thing, so i dont see why not.

:-)

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"


Re: Configuration error in parrot-0.4.0

2005-12-29 Thread Joshua Hoblitt
Does this issue still occur with recent svn sources?

-J

--
On Wed, Dec 28, 2005 at 06:54:18AM -0800, jerry gay wrote:
> On 12/28/05, Sastry <[EMAIL PROTECTED]> wrote:
> > Hi
> > I tried building parrot on  Linux 2.4.20 and I get the following error
> > during gmake process. I have  the default perl-5.8.6 built on my
> > system. Can anybody suggest me what this error is and how to overcome
> > this?
> >
> [snip extra build error info]
> 
> > /usr/local/bin/perl -e 'chdir shift @ARGV; system q{gmake}, @ARGV;
> > exit $? >> 8;' dynclasses
> > gmake[1]: Entering directory `/home/sastry/parrot-0.4.0/dynclasses'
> > /usr/local/bin/perl /home/sastry/parrot-0.4.0/build_tools/pmc2c.pl
> > --dump gdbmhash.pmc
> > Can't write 'classes/default.dump': No such file or directory at
> > /home/sastry/parrot-0.4.0/build_tools/pmc2c.pl line 687.
> > pmc2c dump failed (512)
> > gmake[1]: *** [all] Error 2
> > gmake[1]: Leaving directory `/home/sastry/parrot-0.4.0/dynclasses'
> > gmake: *** [dynclasses.dummy] Error 2
> > [EMAIL PROTECTED] parrot-0.4.0]$
> >
> i assume you have the 0.4.0 release tarball. i don't know why it's not
> working with that configuration, sorry--perhaps there's somebody with
> linux and gmake that can chime in. in the meantime, perhaps an updated
> tarball, or a fresh checkout from svn will prove successful. see
> http://www.parrotcode.org/source.html for instructions on downloading
> either.
> 
> hope that helps.
> ~jerry


pgpKVKns9q5xF.pgp
Description: PGP signature


[perl #38066] [PATCH] tcl [string trim(left|right|)

2005-12-29 Thread via RT
# New Ticket Created by  Alberto Simoes 
# Please include the string:  [perl #38066]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38066 >



-- 
Alberto Simões - Departamento de Informática - Universidade do Minho
  Campus de Gualtar - 4710-057 Braga - Portugal
Index: languages/tcl/t/cmd_string.t
===
--- languages/tcl/t/cmd_string.t(revision 10767)
+++ languages/tcl/t/cmd_string.t(working copy)
@@ -2,7 +2,7 @@
 
 use strict;
 use lib qw(tcl/t t . ../lib ../../lib ../../../lib);
-use Parrot::Test tests => 97;
+use Parrot::Test tests => 109;
 use Parrot::Config;
 use Test::More;
 
@@ -551,6 +551,86 @@
 OUT
 
 
+
+language_output_is("tcl",<<'TCL',< 2 goto bad_args
+  if argc < 1 goto bad_args
+  
+  $S1 = argv[0]
+  $S2 = " \t\r\n"
+
+  if argc == 1 goto trimleft_do
+
+  $S2 = argv[1]
+
+trimleft_do:
+  .local string char
+
+  char = substr $S1, 0, 1
+  $I1 = index $S2, char
+
+  if $I1 < 0 goto trimleft_done
+  substr $S1, 0, 1, ""
+  goto trimleft_do
+ 
+trimleft_done:  
+  .return($S1)
+
+bad_args:
+  .throw ("wrong # args: should be \"string trimleft string ?chars?\"")
+
+.end
+
+
+  
+.sub "trimright"
+  .param pmc argv
+
+  .local int argc
+  .local pmc retval
+
+  argc = argv
+  if argc > 2 goto bad_args
+  if argc < 1 goto bad_args
+  
+  $S1 = argv[0]
+  $S2 = " \t\r\n"
+
+  if argc == 1 goto trimright_do
+
+  $S2 = argv[1]
+
+trimright_do:
+  .local string char
+
+  char = substr $S1, -1, 1
+  $I1 = index $S2, char
+
+  if $I1 < 0 goto trimright_done
+  chopn $S1, 1
+  goto trimright_do
+ 
+trimright_done:  
+  .return($S1)
+
+bad_args:
+  .throw ("wrong # args: should be \"string trimright string ?chars?\"")
+
+.end
+
+# here, I might use trimleft and trim right, but I think it is
+# better to implement it here as it should be faster
+  
+.sub "trim"
+  .param pmc argv
+
+  .local int argc
+  .local pmc retval
+
+  argc = argv
+  if argc > 2 goto bad_args
+  if argc < 1 goto bad_args
+  
+  $S1 = argv[0]
+  $S2 = " \t\r\n"
+
+  if argc == 1 goto trim_do1
+
+  $S2 = argv[1]
+
+trim_do1:
+  .local string char
+
+  char = substr $S1, -1, 1
+  $I1 = index $S2, char
+
+  if $I1 < 0 goto trim_do2
+  chopn $S1, 1
+  goto trim_do1
+
+trim_do2:   
+  char = substr $S1, 0, 1
+  $I1 = index $S2, char
+
+  if $I1 < 0 goto trim_done
+  substr $S1, 0, 1, ""
+  goto trim_do2
+ 
+trim_done:  
+  .return($S1)
+
+bad_args:
+  .throw ("wrong # args: should be \"string trim string ?chars?\"")
+
+.end
+ 


[perl #38067] [PATCH] tcl [string replace] working

2005-12-29 Thread via RT
# New Ticket Created by  Alberto Simoes 
# Please include the string:  [perl #38067]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/rt3/Ticket/Display.html?id=38067 >



-- 
Alberto Simões - Departamento de Informática - Universidade do Minho
  Campus de Gualtar - 4710-057 Braga - Portugal
Index: languages/tcl/t/cmd_string.t
===
--- languages/tcl/t/cmd_string.t(revision 10775)
+++ languages/tcl/t/cmd_string.t(working copy)
@@ -2,7 +2,8 @@
 
 use strict;
 use lib qw(tcl/t t . ../lib ../../lib ../../../lib);
-use Parrot::Test tests => 109;
+
+use Parrot::Test tests => 115;
 use Parrot::Config;
 use Test::More;
 
@@ -551,7 +552,43 @@
 OUT
 
 
+language_output_is("tcl",<<'TCL',< 4 goto bad_args
+  if argc < 3 goto bad_args
+  
+  $S1 = argv[0]
+  $S4 = ""
+ 
+  $S2 = argv[1]
+  low = string_index($S2, $S1)
+
+  $S3 = argv[2]
+  high = string_index($S3, $S1)
+
+  if high < low goto replace_done
+
+  if low >= 0 goto low_ok
+  low = 0
+
+low_ok:
+  len = length $S1
+  if high <= len goto high_ok
+  high = len
+
+high_ok:
+  if argc == 1 goto replace_do
+  $S4 = argv[3]
+
+replace_do:
+  len = high - low
+  len += 1
+  substr $S1, low, len, $S4 
+
+replace_done:   
+  .return($S1)
+
+bad_args:
+  .throw ("wrong # args: should be \"string replace string first last 
?string?\"")
 .end
 
  
@@ -834,3 +885,4 @@
 
 .end
  
+


[perl #34549] atan2() isn't IEEE compliant on OpenBSD/*BSD/Cygwin/Solaris

2005-12-29 Thread Joshua Hoblitt via RT
FYI - bugs #36835 & #38060 have been merged into #34549.

-J

--