Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ad4ba4b4f8c5
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: be3b19cda076
Choose a head ref

Commits on Mar 13, 2015

  1. Copy the full SHA
    ddba396 View commit details
  2. Copy the full SHA
    5b35bd4 View commit details
  3. Copy the full SHA
    dbe83ee View commit details
  4. Copy the full SHA
    ed6da74 View commit details
  5. Copy the full SHA
    a60d255 View commit details

Commits on Mar 14, 2015

  1. Copy the full SHA
    db1231b View commit details
  2. Copy the full SHA
    488098c View commit details

Commits on Mar 18, 2015

  1. Copy the full SHA
    814264d View commit details
  2. Copy the full SHA
    8862201 View commit details
  3. Copy the full SHA
    f2a3815 View commit details

Commits on Mar 19, 2015

  1. [Truffle] Work on pack.

    chrisseaton committed Mar 19, 2015
    Copy the full SHA
    ed15c20 View commit details

Commits on Mar 28, 2015

  1. Merge branch 'truffle-head' into truffle-pack

    Conflicts:
    	truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
    chrisseaton committed Mar 28, 2015
    Copy the full SHA
    5a136a4 View commit details

Commits on Mar 29, 2015

  1. [Truffle] Work on pack.

    chrisseaton committed Mar 29, 2015
    Copy the full SHA
    4b7c68f View commit details
  2. Copy the full SHA
    ca774d0 View commit details
  3. Copy the full SHA
    383cf75 View commit details
  4. Copy the full SHA
    18678ea View commit details
  5. Copy the full SHA
    4bef395 View commit details
  6. Copy the full SHA
    0de9ed4 View commit details
  7. Copy the full SHA
    a234bf4 View commit details
  8. [Truffle] Pack comments.

    chrisseaton committed Mar 29, 2015
    Copy the full SHA
    cbb12f8 View commit details
  9. Copy the full SHA
    f30c96b View commit details
  10. Copy the full SHA
    c054767 View commit details
  11. [Truffle] Pack %

    chrisseaton committed Mar 29, 2015
    Copy the full SHA
    a76bf7f View commit details
  12. [Truffle] Pack p.

    chrisseaton committed Mar 29, 2015
    Copy the full SHA
    60adf34 View commit details
  13. Copy the full SHA
    fbc3f97 View commit details
  14. Copy the full SHA
    0fe0650 View commit details

Commits on Mar 30, 2015

  1. [Truffle] Work on pack M.

    chrisseaton committed Mar 30, 2015
    Copy the full SHA
    d27bd5d View commit details
  2. Copy the full SHA
    0d6af53 View commit details
  3. Copy the full SHA
    2d5c402 View commit details
  4. Copy the full SHA
    4a4d09a View commit details
  5. Copy the full SHA
    d9868d0 View commit details
  6. Copy the full SHA
    aa2cf77 View commit details
  7. Copy the full SHA
    5c71dbe View commit details
  8. Copy the full SHA
    60674f4 View commit details
  9. Copy the full SHA
    1c0c6e1 View commit details
  10. Copy the full SHA
    40fd721 View commit details
  11. Copy the full SHA
    90131cc View commit details
  12. Copy the full SHA
    55dc411 View commit details
  13. [Truffle] All of pack a.

    chrisseaton committed Mar 30, 2015
    Copy the full SHA
    ab519eb View commit details
  14. [Truffle] Fix pack.

    chrisseaton committed Mar 30, 2015
    Copy the full SHA
    f2aa10f View commit details

Commits on Mar 31, 2015

  1. [Truffle] All of pack h.

    chrisseaton committed Mar 31, 2015
    Copy the full SHA
    801416b View commit details
  2. [Truffle] Some more of m.

    chrisseaton committed Mar 31, 2015
    Copy the full SHA
    80fe78e View commit details

Commits on Apr 5, 2015

  1. Copy the full SHA
    fa0bf6f View commit details
  2. Copy the full SHA
    a384d62 View commit details
  3. Copy the full SHA
    aa98236 View commit details
  4. Revert "[Truffle] First attempt at caching pack."

    This reverts commit aa98236.
    chrisseaton committed Apr 5, 2015
    Copy the full SHA
    9be9688 View commit details
  5. Copy the full SHA
    7a28160 View commit details
  6. [Truffle] All of #pack U

    chrisseaton committed Apr 5, 2015
    Copy the full SHA
    2457d88 View commit details

Commits on Apr 6, 2015

  1. Copy the full SHA
    4478ac9 View commit details
  2. Copy the full SHA
    842eba0 View commit details
Showing with 8,459 additions and 485 deletions.
  1. +2 −0 .travis.yml
  2. +2 −7 core/src/main/java/org/jruby/Ruby.java
  3. +1 −0 core/src/main/java/org/jruby/TruffleBridge.java
  4. +23 −75 core/src/main/java/org/jruby/util/Pack.java
  5. +100 −0 core/src/main/java/org/jruby/util/PackUtils.java
  6. +0 −8 spec/truffle/tags/core/array/pack/c_tags.txt
  7. +0 −20 spec/truffle/tags/core/array/pack/i_tags.txt
  8. +0 −96 spec/truffle/tags/core/array/pack/l_tags.txt
  9. +0 −6 spec/truffle/tags/core/array/pack/m_tags.txt
  10. +0 −8 spec/truffle/tags/core/array/pack/n_tags.txt
  11. +0 −2 spec/truffle/tags/core/array/pack/p_tags.txt
  12. +0 −36 spec/truffle/tags/core/array/pack/q_tags.txt
  13. +0 −24 spec/truffle/tags/core/array/pack/s_tags.txt
  14. +0 −8 spec/truffle/tags/core/array/pack/u_tags.txt
  15. +0 −8 spec/truffle/tags/core/array/pack/v_tags.txt
  16. +0 −5 spec/truffle/tags/core/array/pack/w_tags.txt
  17. +4,680 −0 test/truffle/pack-real-usage.rb
  18. +5 −0 test/truffle/pe/core/array_pe.rb
  19. +7 −0 test/truffle/run.sh
  20. +19 −4 tool/jt.rb
  21. +3 −0 truffle/src/main/java/org/jruby/truffle/TruffleBridgeImpl.java
  22. +2 −1 truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
  23. +3 −0 truffle/src/main/java/org/jruby/truffle/nodes/TopLevelRaiseHandler.java
  24. +110 −123 truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
  25. +0 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java
  26. +8 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/HashNodes.java
  27. +2 −4 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  28. +7 −10 truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  29. +5 −10 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  30. +6 −2 truffle/src/main/java/org/jruby/truffle/nodes/dispatch/UncachedDispatchNode.java
  31. +3 −1 truffle/src/main/java/org/jruby/truffle/nodes/methods/ExceptionTranslatingNode.java
  32. +3 −0 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/StringPrimitiveNodes.java
  33. +8 −1 truffle/src/main/java/org/jruby/truffle/nodes/yield/YieldDispatchHeadNode.java
  34. +9 −6 truffle/src/main/java/org/jruby/truffle/nodes/yield/YieldNode.java
  35. +57 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/PackGuards.java
  36. +183 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/PackNode.java
  37. +94 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/PackRootNode.java
  38. +40 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/PackTypes.java
  39. +33 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/SourceNode.java
  40. +36 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/control/AtNode.java
  41. +40 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/control/BackNode.java
  42. +51 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/control/NNode.java
  43. +44 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/control/SequenceNode.java
  44. +48 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/control/StarNode.java
  45. +79 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/read/ReadDoubleNode.java
  46. +79 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/read/ReadLongNode.java
  47. +91 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/read/ReadLongOrBigIntegerNode.java
  48. +89 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/read/ReadStringNode.java
  49. +35 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/type/AsLongNode.java
  50. +30 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/type/AsSinglePrecisionNode.java
  51. +53 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/type/ToDoubleNode.java
  52. +125 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/type/ToLongNode.java
  53. +164 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/type/ToStringNode.java
  54. +28 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/NullNode.java
  55. +38 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/PNode.java
  56. +31 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/Write16BigNode.java
  57. +31 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/Write16LittleNode.java
  58. +33 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/Write32BigNode.java
  59. +33 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/Write32LittleNode.java
  60. +37 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/Write64BigNode.java
  61. +37 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/Write64LittleNode.java
  62. +29 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/Write8Node.java
  63. +116 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/WriteBERNode.java
  64. +59 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/WriteBase64StringNode.java
  65. +87 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/WriteBinaryStringNode.java
  66. +113 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/WriteBitStringNode.java
  67. +110 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/WriteHexStringNode.java
  68. +56 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/WriteMIMEStringNode.java
  69. +99 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/WriteUTF8CharacterNode.java
  70. +68 −0 truffle/src/main/java/org/jruby/truffle/pack/nodes/write/WriteUUStringNode.java
  71. +605 −0 truffle/src/main/java/org/jruby/truffle/pack/parser/PackParser.java
  72. +128 −0 truffle/src/main/java/org/jruby/truffle/pack/parser/PackTokenizer.java
  73. +15 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/Endianness.java
  74. +64 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/PackEncoding.java
  75. +26 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/PackFrameDescriptor.java
  76. +41 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/PackResult.java
  77. +15 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/Signedness.java
  78. +14 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/CantCompressNegativeException.java
  79. +17 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/CantConvertException.java
  80. +17 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/FormatException.java
  81. +30 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/NoImplicitConversionException.java
  82. +13 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/OutsideOfStringException.java
  83. +20 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/PackException.java
  84. +17 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/RangeException.java
  85. +13 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/TooFewArgumentsException.java
  86. +30 −0 truffle/src/main/java/org/jruby/truffle/pack/runtime/exceptions/WrongArgumentTypeException.java
  87. +10 −14 truffle/src/main/java/org/jruby/truffle/runtime/backtrace/MRIBacktraceFormatter.java
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -69,6 +69,8 @@ matrix:
jdk: oraclejdk8
- env: COMMAND=tool/truffle-findbugs.sh
jdk: oraclejdk8
- env: COMMAND=test/truffle/run.sh
jdk: oraclejdk8
fast_finish: true


9 changes: 2 additions & 7 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -920,17 +920,12 @@ public TruffleBridge getTruffleBridge() {
}

private TruffleBridge loadTruffleBridge() {
/*
* It's possible to remove Truffle classes from the JRuby distribution, so we provide a sensible
* explanation when the classes are not found.
*/

final Class<?> clazz;

try {
clazz = getJRubyClassLoader().loadClass("org.jruby.truffle.TruffleBridgeImpl");
} catch (Exception e) {
throw new UnsupportedOperationException("Support for Truffle has been removed from this distribution", e);
throw new UnsupportedOperationException("Truffle classes not available", e);
}

final TruffleBridge truffleBridge;
@@ -939,7 +934,7 @@ private TruffleBridge loadTruffleBridge() {
Constructor<?> con = clazz.getConstructor(Ruby.class);
truffleBridge = (TruffleBridge) con.newInstance(this);
} catch (Exception e) {
throw new UnsupportedOperationException("Error while calling the constructor of Truffle Bridge", e);
throw new UnsupportedOperationException("Error while calling the constructor of TruffleBridgeImpl", e);
}

truffleBridge.init();
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/TruffleBridge.java
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
package org.jruby;

import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.ByteList;

public interface TruffleBridge {

98 changes: 23 additions & 75 deletions core/src/main/java/org/jruby/util/Pack.java
Original file line number Diff line number Diff line change
@@ -76,7 +76,6 @@ public class Pack {
private static final String PACK_IGNORE_NULL_CODES = "cCiIlLnNqQsSvV";
private static final String PACK_IGNORE_NULL_CODES_WITH_MODIFIERS = "lLsS";
private static final String sTooFew = "too few arguments";
private static final byte[] hex_table;
private static final byte[] uu_table;
private static final byte[] b64_table;
private static final byte[] sHexDigits;
@@ -103,7 +102,6 @@ private static double obj2dbl(Ruby runtime, IRubyObject o) {
}

static {
hex_table = ByteList.plain("0123456789ABCDEF");
uu_table =
ByteList.plain("`!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_");
b64_table =
@@ -474,6 +472,25 @@ public static ByteList packInt_i(ByteList result, int s) {
return result;
}

public static void encodeUM(Ruby runtime, ByteList lCurElemString, int occurrences, boolean ignoreStar, char type, ByteList result) {
if (occurrences == 0 && type == 'm' && !ignoreStar) {
encodes(runtime, result, lCurElemString.getUnsafeBytes(),
lCurElemString.getBegin(), lCurElemString.length(),
lCurElemString.length(), (byte) type, false);
return;
}

occurrences = occurrences <= 2 ? 45 : occurrences / 3 * 3;
if (lCurElemString.length() == 0) return;

byte[] charsToEncode = lCurElemString.getUnsafeBytes();
for (int i = 0; i < lCurElemString.length(); i += occurrences) {
encodes(runtime, result, charsToEncode,
i + lCurElemString.getBegin(), lCurElemString.length() - i,
occurrences, (byte)type, true);
}
}

/**
* encodes a String in base64 or its uuencode variant.
* appends the result of the encoding in a StringBuffer
@@ -534,61 +551,6 @@ private static ByteList encodes(Ruby runtime, ByteList io2Append,byte[]charsToEn
return io2Append;
}

/**
* encodes a String with the Quoted printable, MIME encoding (see RFC2045).
* appends the result of the encoding in a StringBuffer
* @param io2Append The StringBuffer which should receive the result
* @param i2Encode The String to encode
* @param iLength The max number of characters to encode
* @return the io2Append buffer
**/
private static ByteList qpencode(ByteList io2Append, ByteList i2Encode, int iLength) {
io2Append.ensure(1024);
int lCurLineLength = 0;
int lPrevChar = -1;
byte[] l2Encode = i2Encode.getUnsafeBytes();
try {
int end = i2Encode.getBegin() + i2Encode.getRealSize();
for (int i = i2Encode.getBegin(); i < end; i++) {
int lCurChar = l2Encode[i] & 0xff;
if (lCurChar > 126 || (lCurChar < 32 && lCurChar != '\n' && lCurChar != '\t') || lCurChar == '=') {
io2Append.append('=');
io2Append.append(hex_table[lCurChar >>> 4]);
io2Append.append(hex_table[lCurChar & 0x0f]);
lCurLineLength += 3;
lPrevChar = -1;
} else if (lCurChar == '\n') {
if (lPrevChar == ' ' || lPrevChar == '\t') {
io2Append.append('=');
io2Append.append(lCurChar);
}
io2Append.append(lCurChar);
lCurLineLength = 0;
lPrevChar = lCurChar;
} else {
io2Append.append(lCurChar);
lCurLineLength++;
lPrevChar = lCurChar;
}
if (lCurLineLength > iLength) {
io2Append.append('=');
io2Append.append('\n');
lCurLineLength = 0;
lPrevChar = '\n';
}
}
} catch (ArrayIndexOutOfBoundsException e) {
//normal exit, this should be faster than a test at each iterations for string with more than
//about 40 char
}

if (lCurLineLength > 0) {
io2Append.append('=');
io2Append.append('\n');
}
return io2Append;
}

/**
* Decodes <i>str</i> (which may contain binary data) according to the format
* string, returning an array of each value extracted.
@@ -1995,22 +1957,7 @@ private static RubyString packCommon(Ruby runtime, RubyArray list, ByteList form
IRubyObject from = list.eltInternal(idx++);
if (from == runtime.getNil()) throw runtime.newTypeError(from, "Integer");
lCurElemString = from.convertToString().getByteList();
if (occurrences == 0 && type == 'm' && !ignoreStar) {
encodes(runtime, result, lCurElemString.getUnsafeBytes(),
lCurElemString.getBegin(), lCurElemString.length(),
lCurElemString.length(), (byte)type, false);
break;
}

occurrences = occurrences <= 2 ? 45 : occurrences / 3 * 3;
if (lCurElemString.length() == 0) break;

byte[] charsToEncode = lCurElemString.getUnsafeBytes();
for (int i = 0; i < lCurElemString.length(); i += occurrences) {
encodes(runtime, result, charsToEncode,
i + lCurElemString.getBegin(), lCurElemString.length() - i,
occurrences, (byte)type, true);
}
encodeUM(runtime, lCurElemString, occurrences, ignoreStar, (char) type, result);
}
break;
case 'M' : {
@@ -2023,7 +1970,7 @@ private static RubyString packCommon(Ruby runtime, RubyArray list, ByteList form
occurrences = 72;
}

qpencode(result, lCurElemString, occurrences);
PackUtils.qpencode(result, lCurElemString, occurrences);
}
break;
case 'U' :
@@ -2174,7 +2121,7 @@ private static long decodeIntUnsignedLittleEndian(ByteBuffer encode) {
*/
private static void encodeIntLittleEndian(ByteList result, int s) {
result.append((byte) (s & 0xff)).append((byte) ((s >> 8) & 0xff));
result.append((byte) ((s>>16) & 0xff)).append((byte) ((s>>24) &0xff));
result.append((byte) ((s>>16) & 0xff)).append((byte) ((s >> 24) & 0xff));
}

/**
@@ -2380,4 +2327,5 @@ private static void encodeShortLittleEndian(ByteList result, int s) {
private static void encodeShortBigEndian(ByteList result, int s) {
result.append((byte) ((s & 0xff00) >> 8)).append((byte) (s & 0xff));
}

}
100 changes: 100 additions & 0 deletions core/src/main/java/org/jruby/util/PackUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/***** BEGIN LICENSE BLOCK *****
* Version: EPL 1.0/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Eclipse Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.eclipse.org/legal/epl-v10.html
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* Copyright (C) 2002-2004 Jan Arne Petersen <jpetersen@uni-bonn.de>
* Copyright (C) 2002-2004 Anders Bengtsson <ndrsbngtssn@yahoo.se>
* Copyright (C) 2003-2004 Thomas E Enebo <enebo@acm.org>
* Copyright (C) 2004 Charles O Nutter <headius@headius.com>
* Copyright (C) 2004 Stefan Matthias Aust <sma@3plus4.de>
* Copyright (C) 2005 Derek Berner <derek.berner@state.nm.us>
* Copyright (C) 2006 Evan Buswell <ebuswell@gmail.com>
* Copyright (C) 2007 Nick Sieger <nicksieger@gmail.com>
* Copyright (C) 2009 Joseph LaFata <joe@quibb.org>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the EPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the EPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/
package org.jruby.util;

public class PackUtils {

private static final byte[] hex_table;

static {
hex_table = ByteList.plain("0123456789ABCDEF");
}

/**
* encodes a String with the Quoted printable, MIME encoding (see RFC2045).
* appends the result of the encoding in a StringBuffer
* @param io2Append The StringBuffer which should receive the result
* @param i2Encode The String to encode
* @param iLength The max number of characters to encode
* @return the io2Append buffer
**/
public static ByteList qpencode(ByteList io2Append, ByteList i2Encode, int iLength) {
io2Append.ensure(1024);
int lCurLineLength = 0;
int lPrevChar = -1;
byte[] l2Encode = i2Encode.getUnsafeBytes();
try {
int end = i2Encode.getBegin() + i2Encode.getRealSize();
for (int i = i2Encode.getBegin(); i < end; i++) {
int lCurChar = l2Encode[i] & 0xff;
if (lCurChar > 126 || (lCurChar < 32 && lCurChar != '\n' && lCurChar != '\t') || lCurChar == '=') {
io2Append.append('=');
io2Append.append(hex_table[lCurChar >>> 4]);
io2Append.append(hex_table[lCurChar & 0x0f]);
lCurLineLength += 3;
lPrevChar = -1;
} else if (lCurChar == '\n') {
if (lPrevChar == ' ' || lPrevChar == '\t') {
io2Append.append('=');
io2Append.append(lCurChar);
}
io2Append.append(lCurChar);
lCurLineLength = 0;
lPrevChar = lCurChar;
} else {
io2Append.append(lCurChar);
lCurLineLength++;
lPrevChar = lCurChar;
}
if (lCurLineLength > iLength) {
io2Append.append('=');
io2Append.append('\n');
lCurLineLength = 0;
lPrevChar = '\n';
}
}
} catch (ArrayIndexOutOfBoundsException e) {
//normal exit, this should be faster than a test at each iterations for string with more than
//about 40 char
}

if (lCurLineLength > 0) {
io2Append.append('=');
io2Append.append('\n');
}
return io2Append;
}
}
8 changes: 0 additions & 8 deletions spec/truffle/tags/core/array/pack/c_tags.txt

This file was deleted.

20 changes: 0 additions & 20 deletions spec/truffle/tags/core/array/pack/i_tags.txt

This file was deleted.

Loading