diff options
-rw-r--r-- | MDK/Common.pm.pl | 2 | ||||
-rw-r--r-- | MDK/Common/String.pm | 14 | ||||
-rw-r--r-- | perl-MDK-Common.spec | 9 | ||||
-rw-r--r-- | perl_checker.src/common.ml | 8 |
4 files changed, 28 insertions, 5 deletions
diff --git a/MDK/Common.pm.pl b/MDK/Common.pm.pl index 2ac0e37..07198f5 100644 --- a/MDK/Common.pm.pl +++ b/MDK/Common.pm.pl @@ -74,7 +74,7 @@ use vars qw(@ISA @EXPORT $VERSION); #); # perl_checker: RE-EXPORT-ALL @EXPORT = map { @$_ } map { values %{'MDK::Common::' . $_ . 'EXPORT_TAGS'} } grep { /::$/ } keys %MDK::Common::; -$VERSION = "1.1.14"; +$VERSION = "1.1.15"; 1; EOF diff --git a/MDK/Common/String.pm b/MDK/Common/String.pm index 484ee2c..80c6598 100644 --- a/MDK/Common/String.pm +++ b/MDK/Common/String.pm @@ -42,6 +42,13 @@ remove "\n"s when the next line doesn't start with a space. Otherwise keep handle carriage return just like LaTeX: merge lines that are not separated by an empty line +=item begins_with(STRING, STRING) + +return true if first argument begins with the second argument. Use this +instead of regexps if you don't want regexps. + +begins_with("hello world", "hello") # => 1 + =item warp_text(STRING, INT) return a list of lines which do not exceed INT characters @@ -62,7 +69,7 @@ L<MDK::Common> use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK); @ISA = qw(Exporter); -@EXPORT_OK = qw(bestMatchSentence formatList formatError formatTimeRaw formatLines formatAlaTeX warp_text); +@EXPORT_OK = qw(bestMatchSentence formatList formatError formatTimeRaw formatLines formatAlaTeX begins_with warp_text); %EXPORT_TAGS = (all => [ @EXPORT_OK ]); @@ -128,7 +135,10 @@ sub formatAlaTeX { } - +sub begins_with { + my ($s, $prefix) = @_; + index($s, $prefix) == 0; +} sub warp_text { my ($text, $o_width) = @_; diff --git a/perl-MDK-Common.spec b/perl-MDK-Common.spec index 6c0759c..7138067 100644 --- a/perl-MDK-Common.spec +++ b/perl-MDK-Common.spec @@ -2,7 +2,7 @@ # do not change the version here, change in MDK/Common.pm.pl %define version THEVERSION -%define release 1mdk +%define release 2mdk %ifarch x86_64 %define build_option PERL_CHECKER_TARGET='debug-code BCSUFFIX=""' @@ -72,6 +72,13 @@ rm -rf $RPM_BUILD_ROOT # MODIFY IN THE CVS: cvs.mandrakesoft.com:/cooker soft/perl-MDK-Common %changelog +* Fri Jul 23 2004 Pixel <pixel@mandrakesoft.com> 1.1.15-2mdk +- workaround bug in ocaml on ultrasparc + (can't catch exception "Fatal error: out-of-bound access in array or string" in native code) + +* Thu Jul 22 2004 Pixel <pixel@mandrakesoft.com> 1.1.15-1mdk +- add begins_with in MDK::Common::String + * Mon Jul 5 2004 Pixel <pixel@mandrakesoft.com> 1.1.14-1mdk - more perlish behaviour for to_int() and to_float() (skipping leading spaces) diff --git a/perl_checker.src/common.ml b/perl_checker.src/common.ml index 7d03ffb..c7fe403 100644 --- a/perl_checker.src/common.ml +++ b/perl_checker.src/common.ml @@ -770,11 +770,17 @@ let rec string_fold_left f val_ s = done ; !val_ +(* let rec string_forall_with f i s = try f s.[i] && string_forall_with f (i+1) s with Invalid_argument _ -> true - +*) +let string_forall_with f i s = + let len = String.length s in + let rec string_forall_with_ i = + i >= len || f s.[i] && string_forall_with_ (i+1) + in string_forall_with_ i let starts_with_non_lowercase s = s <> "" && s.[0] <> '_' && not (is_lowercase s.[0]) |