Skip to content

Commit

Permalink
eliminate _Tcl::string_trim , it duplicates the helper function for […
Browse files Browse the repository at this point in the history
…string trim]
  • Loading branch information
coke committed Apr 8, 2010
1 parent 6731036 commit 867850c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/Partcl/commands/main.pm
Expand Up @@ -94,9 +94,9 @@ our sub cd(*@args) {
}

our sub concat(*@args) {
my $result := @args ?? _tcl::string_trim(@args.shift) !! '';
my $result := @args ?? String::trim(@args.shift) !! '';
while @args {
$result := $result ~ ' ' ~ _tcl::string_trim(@args.shift);
$result := $result ~ ' ' ~ String::trim(@args.shift);
}
$result;
}
Expand Down
24 changes: 0 additions & 24 deletions src/Partcl/commands/string.pm
Expand Up @@ -582,28 +582,4 @@ my sub wordstart($string, $index) {
++$index;
}

module _tcl {
our sub string_trim($string) {
Q:PIR {
.include 'cclass.pasm'
.local string str
$P0 = find_lex '$string'
str = $P0
.local int lpos, rpos
rpos = length str
lpos = find_not_cclass .CCLASS_WHITESPACE, str, 0, rpos
rtrim_loop:
unless rpos > lpos goto rtrim_done
dec rpos
$I0 = is_cclass .CCLASS_WHITESPACE, str, rpos
if $I0 goto rtrim_loop
rtrim_done:
inc rpos
$I0 = rpos - lpos
$S0 = substr str, lpos, $I0
%r = box $S0
};
}
}

# vim: filetype=perl6:

0 comments on commit 867850c

Please sign in to comment.