Changeset 20912

Show
Ignore:
Timestamp:
10/07/08 19:40:06 (6 weeks ago)
Author:
fujidig
Message:

SJIS 二バイト目が0だった場合や、SJIS 二バイト目がサイズに収まらないときの対処。

Location:
lang/javascript/hsp-on-js/trunk/src
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/javascript/hsp-on-js/trunk/src/builtin-funcs.js

    r20896 r20912  
    307307                        result += String.fromCharCode(c); 
    308308                        if((0x81 <= c && c <= 0x9F) || (0xE0 <= c && c <= 0xFC)) { 
    309                                 result += String.fromCharCode(src.getbyte(index + i)); 
     309                                if(i >= length) break; 
     310                                var c2 = src.getbyte(index + i); 
     311                                if(c2 == 0) break; 
     312                                result += String.fromCharCode(c2); 
    310313                                i ++; 
    311314                        } 
  • lang/javascript/hsp-on-js/trunk/src/run-in-shell.js

    r20896 r20912  
    2121function main(){ 
    2222        var data = [ 
    23 '\x48\x53\x50\x33\x01\x03\x00\x00\x03\x00\x00\x00\x4b\x01\x00\x00', 
    24 '\x60\x00\x00\x00\x88\x00\x00\x00\xe8\x00\x00\x00\x34\x00\x00\x00', 
    25 '\x1c\x01\x00\x00\x08\x00\x00\x00\x24\x01\x00\x00\x27\x00\x00\x00', 
    26 '\x4b\x01\x00\x00\x00\x00\x00\x00\x4b\x01\x00\x00\x00\x00\x00\x00', 
    27 '\x4b\x01\x00\x00\x00\x00\x00\x00\x4b\x01\x00\x00\x00\x00\x00\x00', 
    28 '\x4b\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 
    29 '\x01\x20\x00\x00\x00\x00\x08\x00\x02\x00\x06\x00\x01\x20\x01\x00', 
    30 '\x00\x00\x08\x00\x04\x00\x00\x00\x0f\x20\x04\x00\x07\x00\x00\x00', 
    31 '\x04\x00\x04\x00\x08\x20\x1d\x00\x01\x00\x02\x00\x01\x40\x00\x00', 
    32 '\x01\x40\x01\x00\x04\x40\x2c\x00\x01\x20\x01\x00\x00\x00\x00\x00', 
    33 '\x0e\x00\x06\x00\x09\x20\x0f\x00\x02\x00\x12\x00\x01\x00\x02\x00', 
    34 '\x00\x00\x00\x00\x09\x20\x0f\x00\x02\x00\x18\x00\x0e\x00\x06\x00', 
    35 '\x00\x00\x00\x00\x09\x20\x0f\x00\x02\x00\x23\x00\x0e\x00\x03\x00', 
    36 '\x00\x00\x00\x00\x09\x20\x0f\x00\x0f\x20\x05\x00\x0f\x20\x11\x00', 
    37 '\x0f\x20\x00\x00\x07\x00\x01\x00\x74\x2e\x68\x73\x70\x00\x41\x42', 
    38 '\x43\x2c\x44\x45\x46\x2c\x45\x46\x47\x00\x6c\x6e\x20\x3d\x20\x00', 
    39 '\x73\x74\x72\x73\x69\x7a\x65\x20\x3d\x20\x00\x73\x74\x61\x74\x20', 
    40 '\x3d\x20\x00\x62\x75\x66\x00\x69\x00\x6c\x6e\x00\x3e\x00\x00\x00', 
    41 '\x3e\x00\x00\x00\xfe\x00\x00\x00\x00\x00\x00\x06\x06\x00\x06\x0a', 
    42 '\x06\x08\x08\x08\x02\x02\x06\xfd\x2b\x00\x00\x00\x00\xfd\x2f\x00', 
    43 '\x00\x01\x00\xfd\x31\x00\x00\x02\x00\xff\xff' 
     23'\x48\x53\x50\x33\x01\x03\x00\x00\x02\x00\x00\x00\xb3\x01\x00\x00', 
     24'\x60\x00\x00\x00\x08\x01\x00\x00\x68\x01\x00\x00\x15\x00\x00\x00', 
     25'\x7d\x01\x00\x00\x04\x00\x00\x00\x81\x01\x00\x00\x32\x00\x00\x00', 
     26'\xb3\x01\x00\x00\x00\x00\x00\x00\xb3\x01\x00\x00\x00\x00\x00\x00', 
     27'\xb3\x01\x00\x00\x00\x00\x00\x00\xb3\x01\x00\x00\x00\x00\x00\x00', 
     28'\xb3\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 
     29'\x01\x20\x00\x00\x00\x00\x08\x00\x02\x00\x06\x00\x08\x20\x1a\x00', 
     30'\x01\x00\x00\x00\x04\x40\x00\x00\x04\x40\x82\x00\x08\x20\x1a\x00', 
     31'\x01\x00\x00\x00\x04\x40\x01\x00\x04\x40\xa0\x00\x08\x20\x1d\x00', 
     32'\x01\x00\x01\x00\x01\x40\x00\x00\x04\x40\x00\x00\x04\x40\x00\x00', 
     33'\x04\x40\x01\x00\x09\x20\x0f\x00\x0e\x00\x06\x00\x09\x20\x0f\x00', 
     34'\x01\x00\x01\x00\x09\x20\x0f\x00\x0e\x00\x03\x00\x09\x20\x0f\x00', 
     35'\x01\x20\x00\x00\x00\x00\x08\x00\x02\x00\x07\x00\x08\x20\x1a\x00', 
     36'\x01\x00\x00\x00\x04\x40\x00\x00\x04\x40\x82\x00\x08\x20\x1a\x00', 
     37'\x01\x00\x00\x00\x04\x40\x01\x00\x04\x40\x00\x00\x08\x20\x1d\x00', 
     38'\x01\x00\x01\x00\x01\x40\x00\x00\x09\x20\x0f\x00\x0e\x00\x06\x00', 
     39'\x09\x20\x0f\x00\x01\x00\x01\x00\x09\x20\x0f\x00\x0e\x00\x03\x00', 
     40'\x09\x20\x0f\x00\x01\x20\x00\x00\x00\x00\x08\x00\x02\x00\x0d\x00', 
     41'\x08\x20\x1a\x00\x01\x00\x00\x00\x04\x40\x00\x00\x04\x40\x82\x00', 
     42'\x08\x20\x1d\x00\x01\x00\x01\x00\x01\x40\x00\x00\x04\x40\x00\x00', 
     43'\x04\x40\x61\x00\x09\x20\x0f\x00\x0e\x00\x06\x00\x09\x20\x0f\x00', 
     44'\x01\x00\x01\x00\x09\x20\x0f\x00\x0e\x00\x03\x00\x0f\x20\x11\x00', 
     45'\x0f\x20\x00\x00\x07\x00\x00\x00\x74\x2e\x68\x73\x70\x00\x00\x5f', 
     46'\x5f\x61\x62\x63\x00\x5f\x61\x61\x00\x61\x00\x62\x00\x7e\x00\x00', 
     47'\x00\xfe\x00\x00\x00\x00\x00\x00\x06\x08\x08\x0c\x04\x04\x04\x00', 
     48'\x02\x00\x06\x08\x08\x00\x06\x04\x04\x04\x00\x02\x00\x06\x08\x00', 
     49'\x0a\x04\x04\x04\x06\xfd\x11\x00\x00\x00\x00\xfd\x13\x00\x00\x01', 
     50'\x00\xff\xff' 
    4451        ].join(''); 
    4552 
  • lang/javascript/hsp-on-js/trunk/src/t.hsp

    r20900 r20912  
    1 a = "ABC" 
    2 getstr b, a, 0, '@', 1 
     1a = "" 
     2poke a, 0, 0x82 
     3poke a, 1, 0xA0 
     4getstr b, a, 0, 0, 1 
    35mes strsize 
    46mes b 
    57mes stat 
     8 
     9mes 
     10 
     11a = "__abc" 
     12poke a, 0, 0x82 
     13poke a, 1, 0x00 
     14 
     15getstr b, a 
     16mes strsize 
     17mes b 
     18mes stat 
     19 
     20mes 
     21 
     22a = "_aa" 
     23poke a, 0, 0x82 
     24 
     25getstr b, a, 0, 'a' 
     26mes strsize 
     27mes b 
     28mes stat