[svn:parrot] r36861 - in trunk: . config/gen/makefiles runtime/parrot/library/Data t/library

coke at svn.parrot.org coke at svn.parrot.org
Wed Feb 18 19:06:57 UTC 2009


Author: coke
Date: Wed Feb 18 19:06:55 2009
New Revision: 36861
URL: https://trac.parrot.org/parrot/changeset/36861

Log:
TT #107 - remove deprecated library Data::Escape (if you were using this, use the escape opcode instead.)

Deleted:
   trunk/runtime/parrot/library/Data/Escape.pir
   trunk/t/library/data_escape.t
Modified:
   trunk/DEPRECATED.pod
   trunk/MANIFEST
   trunk/MANIFEST.generated
   trunk/config/gen/makefiles/root.in

Modified: trunk/DEPRECATED.pod
==============================================================================
--- trunk/DEPRECATED.pod	Wed Feb 18 18:35:51 2009	(r36860)
+++ trunk/DEPRECATED.pod	Wed Feb 18 19:06:55 2009	(r36861)
@@ -152,14 +152,10 @@
 
 =back
 
-=head1 standard library
+=head1 build tools
 
 =over 4
 
-=item Data::Escape [post 0.9.0]
-
-Replace usage with the escape opcode.  See TT #107
-
 =item tools/build/dynoplibs.pl and tools/build/dynpmc.pl [post 0.9.1]
 
 Replaced with makefiles. See TT #338.

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Wed Feb 18 18:35:51 2009	(r36860)
+++ trunk/MANIFEST	Wed Feb 18 19:06:55 2009	(r36861)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Feb 18 18:14:23 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed Feb 18 18:59:45 2009 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2012,7 +2012,6 @@
 runtime/parrot/library/Data/Dumper.pir                      [library]
 runtime/parrot/library/Data/Dumper/Base.pir                 [library]
 runtime/parrot/library/Data/Dumper/Default.pir              [library]
-runtime/parrot/library/Data/Escape.pir                      [library]
 runtime/parrot/library/Data/Replace.pir                     [library]
 runtime/parrot/library/Digest/MD5.pir                       [library]
 runtime/parrot/library/Getopt/Obj.pir                       [library]
@@ -2555,7 +2554,6 @@
 t/harness                                                   [test]
 t/library/cgi_query_hash.t                                  [test]
 t/library/coroutine.t                                       [test]
-t/library/data_escape.t                                     [test]
 t/library/dumper.t                                          [test]
 t/library/getopt_obj.t                                      [test]
 t/library/hllmacros.t                                       [test]

Modified: trunk/MANIFEST.generated
==============================================================================
--- trunk/MANIFEST.generated	Wed Feb 18 18:35:51 2009	(r36860)
+++ trunk/MANIFEST.generated	Wed Feb 18 19:06:55 2009	(r36861)
@@ -186,7 +186,6 @@
 runtime/parrot/library/Data/Dumper.pbc            [main]
 runtime/parrot/library/Data/Dumper/Base.pbc       [main]
 runtime/parrot/library/Data/Dumper/Default.pbc    [main]
-runtime/parrot/library/Data/Escape.pbc            [main]
 runtime/parrot/library/Getopt/Obj.pbc             [main]
 runtime/parrot/library/Math/Random/mt19937ar.pbc  [main]
 runtime/parrot/library/MIME/Base64.pbc            [main]

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Wed Feb 18 18:35:51 2009	(r36860)
+++ trunk/config/gen/makefiles/root.in	Wed Feb 18 19:06:55 2009	(r36861)
@@ -245,7 +245,6 @@
     $(LIBRARY_DIR)/Data/Dumper/Base.pbc \
     $(LIBRARY_DIR)/Data/Dumper/Default.pbc \
     $(LIBRARY_DIR)/Data/Dumper.pbc \
-    $(LIBRARY_DIR)/Data/Escape.pbc \
     $(LIBRARY_DIR)/Digest/MD5.pbc \
     $(LIBRARY_DIR)/dumper.pbc \
     $(LIBRARY_DIR)/yaml_dumper.pbc \

Deleted: trunk/runtime/parrot/library/Data/Escape.pir
==============================================================================
--- trunk/runtime/parrot/library/Data/Escape.pir	Wed Feb 18 19:06:55 2009	(r36860)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,165 +0,0 @@
-=head1 TITLE
-
-Data::Escape - simple string escaping implemented in PIR
-
-=head1 SYNOPSIS
-
-    ...
-
-    load_bytecode "library/Data/Escape.pir"
-
-    .local pmc escape
-
-    escape = find_global "Data::Escape", "String"
-
-    str = escape( str, "'" )
-
-    ...
-
-
-=head1 DESCRIPTION
-
-This library escapes data to make it usable in PIR and C code.
-
-=cut
-
-=head1 FUNCTIONS
-
-This library provides the following function:
-
-=over 4
-
-=item str = String( str, [char] )
-
-A simple string escaping function.
-
-=over 4
-
-=item C<str>
-
-The string to escape.
-
-=item C<char>
-
-The quote character used for printing, either ' or ".
-
-=back
-
-This function returns the quoted string.
-
-=cut
-
-.namespace ["Data::Escape"]
-
-
-.sub String
-    .param string str
-    .param string quote_char   :optional
-    .param int has_quote       :opt_flag
-
-    .local string return
-    .local int index
-    .local int str_len
-    .local int test_char_ord
-    .local int quote_char_ord
-    .local int is_alphanum
-    .local string tmp
-    .local int mask
-
-    .include 'cclass.pasm'
-    mask = .CCLASS_PRINTING
-
-    index = 0
-    str_len = length str
-    return = ''
-LOOP:
-    if index >= str_len goto END
-
-    substr tmp, str, index, 1
-
-    ord test_char_ord, tmp
-
-    ## allow spaces as is
-    if 32 == test_char_ord goto DONE
-
-t_backslash:
-    ## escape backslash to double backslash
-    if 92 != test_char_ord goto t_newline
-    tmp = '\\'
-    branch DONE
-
-t_newline:
-    ## escape newline to \n
-    if 10 != test_char_ord goto t_tab
-    tmp = '\n'
-    branch DONE
-
-t_tab:
-    ## escape tab to \t
-    if 9 != test_char_ord goto t_quote
-    tmp = '\t'
-    branch DONE
-
-t_quote:
-    ## escape quote character
-    unless has_quote goto escape_qu
-    ord quote_char_ord, quote_char
-
-    if quote_char_ord == test_char_ord goto escape_quote_char
-escape_qu:
-    if 34 == test_char_ord goto DONE
-    if 39 == test_char_ord goto DONE
-    branch default
-
-escape_quote_char:
-    tmp = '\'
-    concat tmp, quote_char
-    branch DONE
-
-default:
-    if test_char_ord >= 256 goto esc_unicode
-    if test_char_ord >= 128 goto esc_oct
-    is_alphanum = is_cclass mask, tmp, 0
-    if is_alphanum goto DONE
-esc_oct:
-    ## otherwise encode the value as an octal number
-    $P0 = new 'ResizableIntegerArray'
-    push $P0, test_char_ord
-    tmp = sprintf "\\%03o", $P0
-    branch DONE
-esc_unicode:
-    $P0 = new 'ResizableIntegerArray'
-    push $P0, test_char_ord
-    tmp = sprintf "\\x{%x}", $P0
-    # fall though to DONE
-DONE:
-    concat return, tmp
-    inc index
-    branch LOOP
-END:
-    .return( return )
-.end
-
-=back
-
-=head1 AUTHOR
-
-Jens Rieks E<lt>parrot at jensbeimsurfen dot deE<gt> is the author
-and maintainer.
-Please send patches and suggestions to the Perl 6 Internals mailing list.
-
-=head1 HISTORY
-
-Modifications by Jerry Gay to escape backslash and use character class ops.
-
-=head1 COPYRIGHT
-
-Copyright (C) 2004-2008, Parrot Foundation.
-
-=cut
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:

Deleted: trunk/t/library/data_escape.t
==============================================================================
--- trunk/t/library/data_escape.t	Wed Feb 18 19:06:55 2009	(r36860)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,260 +0,0 @@
-#! parrot
-# Copyright (C) 2001-2009, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/library/data_escape.t - Data::Escape tests
-
-=head1 SYNOPSIS
-
-    % prove t/library/data_escape.t
-
-=cut
-
-.sub main :main
-    .include 'test_more.pir'
-    plan(22)
-
-    DE_load_bytecode()
-    DE_get_global()
-    DE_escape_string_empty_string()
-    DE_escape_string_no_escapes()
-    DE_escape_string_tab_carriage_return_linefeed()
-    DE_escape_string_other_characters_less_than_32()
-    DE_escape_string_single_quote()
-    DE_escape_string_double_quote()
-    DE_escape_string_single_and_double_escape_single()
-    DE_escape_string_single_and_double_escape_double()
-    DE_escape_string_backslash()
-    DE_escape_string_unprintable_followed_by_numbers()
-    DE_escape_string_non_ascii()
-    DE_escape_string_freeze_a_simple_pmc()
-    DE_unicode_test()
-.end
-
-.sub DE_load_bytecode
-    load_bytecode 'Data/Escape.pir'
-    ok(1, 'load_bytecode')
-.end
-
-.sub DE_get_global
-    .local pmc sub_list, sub_obj
-    .local string test_message
-
-    $S0 = 'String'
-    sub_list = split ' ', $S0
-
-  LOOP:
-    $I0 = elements sub_list
-    if $I0 == 0 goto END_TEST
-    $S0 = sub_list.'shift'()
-    test_message = concat "get_global ['Data::Escape'], '", $S0
-    test_message = concat test_message, "'"
-    sub_obj = get_global ['Data::Escape'], $S0
-    ok(1, test_message)
-
-  END_TEST:
-.end
-
-.sub DE_escape_string_empty_string
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = ""
-    str = escape_string( str, '"' )
-    is(str, '', 'escape_string: empty string')
-.end
-
-.sub DE_escape_string_no_escapes
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = "abc 123"
-    str = escape_string( str, '"' )
-    is(str, 'abc 123', 'escape_string: no escapes')
-.end
-
-.sub DE_escape_string_tab_carriage_return_linefeed
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = "a\tb\nc"
-    str = escape_string( str, '"' )
-    is(str, 'a\tb\nc', 'escape_string: tab, carriage return, linefeed')
-.end
-
-.sub DE_escape_string_other_characters_less_than_32
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str, x
-
-    .local int index
-    index = 0
-    str = ''
-
-  LOOP:
-    if index >= 32 goto DONE
-
-    x = chr index
-    concat str, x
-
-    inc index
-    branch LOOP
-
-  DONE:
-    str = escape_string( str, "'" )
-    is(str, '\000\001\002\003\004\005\006\007\010\t\n\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037', 'escape_string: other characters less than 32')
-.end
-
-.sub DE_escape_string_single_quote
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = "a'b'c"
-    str = escape_string( str, "'" )
-    is(str, "a\\'b\\'c", 'escape_string: single quote')
-.end
-
-.sub DE_escape_string_double_quote
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = 'a"b"c'
-    str = escape_string( str, '"' )
-    is(str, 'a\"b\"c', 'escape_string: double quote')
-.end
-
-.sub DE_escape_string_single_and_double_escape_single
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = "ab\"'\"'c"
-    str = escape_string( str, "'" )
-    is(str, "ab\"\\'\"\\'c",'escape_string: single and double, escape single')
-.end
-
-.sub DE_escape_string_single_and_double_escape_double
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = "ab\"'\"'c"
-    str = escape_string( str, '"' )
-    is(str, "ab\\\"'\\\"'c", 'escape_string: single and double, escape double')
-.end
-
-.sub DE_escape_string_backslash
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = '\ abc \t'
-    str = escape_string( str, '"' )
-    is(str, '\\ abc \\t', 'escape_string: backslash')
-.end
-
-.sub DE_escape_string_unprintable_followed_by_numbers
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local string str
-    str = chr 2
-    concat str, '123'
-    str = escape_string( str, '"' )
-    is(str, '\002123', 'escape_string: unprintable followed by numbers')
-.end
-
-.sub DE_escape_string_non_ascii
-    todo(0, 'escape_string: non-ascii', 'test not written')
-.end
-
-.sub DE_escape_string_freeze_a_simple_pmc
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local pmc original_pmc
-    original_pmc = new 'String'
-    original_pmc = "ok\n"
-
-    .local string frozen_pmc
-    frozen_pmc = freeze original_pmc
-
-    .local string escaped_frozen_pmc
-    escaped_frozen_pmc = escape_string( frozen_pmc, '"' )
-
-    .local string pir_code
-    pir_code = ".sub test :anon\n$P1 = thaw binary:\""
-
-    pir_code .= escaped_frozen_pmc
-    pir_code .= "\"\n.return($P1)\n.e"
-    # split sub ending to play nice with some editors
-    pir_code .= "nd\n"
-
-    .local pmc pir_compiler
-    pir_compiler = compreg "PIR"
-
-    .local pmc compiled_sub
-    compiled_sub = pir_compiler(pir_code)
-    $P0 = compiled_sub()
-    is($P0, "ok\n", 'escape_string: freeze a simple pmc')
-.end
-
-.sub _unicode_gen
-    .param string codepoint
-
-    .local string pir_code
-    pir_code  = ".sub ugen :anon\n$S0 = unicode:\"\\u"
-    pir_code .= codepoint
-    pir_code .= "\"\n.return($S0)\n.e"
-    # split sub ending to play nice with some editors
-    pir_code .= "nd\n"
-
-    .local pmc pir_compiler, compiled_sub
-    pir_compiler = compreg "PIR"
-    compiled_sub = pir_compiler(pir_code)
-    .tailcall compiled_sub()
-.end
-
-.sub DE_unicode_test
-    .local pmc escape_string
-    escape_string = get_global ['Data::Escape'], 'String'
-
-    .local pmc codepoint_list
-    $S0 = '0666 0777 0888 0999 6666 7777 8888 9999'
-    codepoint_list = split ' ', $S0
-
-    .local string s_codepoint, i_codepoint
-    .local string str, expected, test_message
-
-  LOOP:
-    $I0 = elements codepoint_list
-    if $I0 == 0 goto TEST_END
-    s_codepoint = codepoint_list.'shift'()
-    $I1 = s_codepoint
-    i_codepoint = $I1
-
-    expected  = concat "\\x{", i_codepoint
-    expected .= "}"
-    test_message  = concat "escape_string: unicode: ", s_codepoint
-    str = _unicode_gen(s_codepoint)
-
-    str = escape_string( str, '"' )
-    is(str, expected, test_message)
-    goto LOOP
-
-  TEST_END:
-.end
-
-# Local Variables:
-#   mode: pir
-#   fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:


More information about the parrot-commits mailing list