util_bytetochar.in revision 4d3acf4ec42bf6e838f9060103aff98fbf170794
1{{header}} 2{{object 1 0}} << 3 /Type /Catalog 4 /Pages 2 0 R 5 /OpenAction 10 0 R 6>> 7endobj 8{{object 2 0}} << 9 /Type /Pages 10 /Count 1 11 /Kids [ 12 3 0 R 13 ] 14>> 15endobj 16% Page number 0. 17{{object 3 0}} << 18 /Type /Page 19 /Parent 2 0 R 20 /Resources << 21 /Font <</F1 15 0 R>> 22 >> 23 /Contents [21 0 R] 24 /MediaBox [0 0 612 792] 25>> 26% OpenAction action 27{{object 10 0}} << 28 /Type /Action 29 /S /JavaScript 30 /JS 11 0 R 31>> 32endobj 33% JS program to exexute 34{{object 11 0}} << 35>> 36stream 37function TestOneInput(x) { 38 try { 39 var s = util.byteToChar(x); 40 if (s.length) { 41 s = s.charCodeAt(0); 42 } 43 app.alert(x + " => " + s); 44 } 45 catch (e) { 46 app.alert(x + ": Caught error: " + e); 47 } 48} 49TestOneInput(0); 50TestOneInput(65); 51TestOneInput(127); 52TestOneInput(128); 53TestOneInput(255); 54TestOneInput(256); 55TestOneInput(40000000); 56TestOneInput(-1); 57try { 58 util.byteToChar(); 59} 60catch (e) { 61 app.alert("Caught expected error: " + e); 62} 63try { 64 util.byteToChar({x:39}); 65} 66catch (e) { 67 app.alert("Caught expected error: " + e); 68} 69endstream 70endobj 71{{xref}} 72trailer << 73 /Root 1 0 R 74>> 75{{startxref}} 76%%EOF 77