Hex Artifact Content

Artifact ee6025e722ae554741a4c9f4e995b7e26759a0c1:


0000: 23 20 43 6f 6d 70 61 74 69 62 69 6c 69 74 79 0a  # Compatibility.
0010: 0a 53 71 75 69 72 72 65 6c 4a 4d 45 20 61 69 6d  .SquirrelJME aim
0020: 73 20 74 6f 20 62 65 20 63 6f 6d 70 61 74 69 62  s to be compatib
0030: 6c 65 20 77 69 74 68 20 6d 6f 73 74 20 70 72 6f  le with most pro
0040: 67 72 61 6d 73 20 68 6f 77 65 76 65 72 20 74 68  grams however th
0050: 65 72 65 20 61 72 65 0a 73 69 74 75 61 74 69 6f  ere are.situatio
0060: 6e 73 20 61 6e 64 20 72 61 72 65 20 65 64 67 65  ns and rare edge
0070: 20 63 61 73 65 73 20 77 68 65 72 65 20 74 68 65   cases where the
0080: 72 65 20 77 69 6c 6c 20 62 65 20 6e 6f 20 63 6f  re will be no co
0090: 6d 70 61 74 69 62 69 6c 69 74 79 2e 20 54 68 69  mpatibility. Thi
00a0: 73 20 69 73 0a 74 6f 20 6d 61 6b 65 20 74 68 65  s is.to make the
00b0: 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 20   implementation 
00c0: 65 61 73 69 65 72 2e 0a 0a 23 23 20 60 46 6c 75  easier...## `Flu
00d0: 73 68 61 62 6c 65 60 20 49 6e 74 65 72 66 61 63  shable` Interfac
00e0: 65 0a 0a 54 68 65 20 69 6e 74 65 72 66 61 63 65  e..The interface
00f0: 20 60 46 6c 75 73 68 61 62 6c 65 60 20 64 6f 65   `Flushable` doe
0100: 73 20 6e 6f 74 20 65 78 69 73 74 20 69 6e 20 4a  s not exist in J
0110: 61 76 61 20 4d 45 20 61 6e 64 20 61 73 20 73 75  ava ME and as su
0120: 63 68 20 69 74 20 64 6f 65 73 20 6e 6f 74 0a 65  ch it does not.e
0130: 78 69 73 74 20 69 6e 20 53 71 75 69 72 72 65 6c  xist in Squirrel
0140: 4a 4d 45 2e 0a 0a 23 23 20 4c 43 44 55 49 20 44  JME...## LCDUI D
0150: 69 73 70 6c 61 79 20 49 6e 70 75 74 0a 0a 4f 6e  isplay Input..On
0160: 6c 79 20 74 68 65 20 66 69 72 73 74 20 64 69 73  ly the first dis
0170: 70 6c 61 79 20 28 69 6e 64 65 78 20 7a 65 72 6f  play (index zero
0180: 29 20 73 75 70 70 6f 72 74 73 20 69 6e 70 75 74  ) supports input
0190: 20 65 76 65 6e 74 73 20 73 75 63 68 20 61 73 20   events such as 
01a0: 6b 65 79 62 6f 61 72 64 2c 0a 62 75 74 74 6f 6e  keyboard,.button
01b0: 73 2c 20 6d 69 63 65 2c 20 61 6e 64 20 74 6f 75  s, mice, and tou
01c0: 63 68 73 63 72 65 65 6e 2e 20 41 6e 79 20 73 65  chscreen. Any se
01d0: 63 6f 6e 64 61 72 79 20 64 69 73 70 6c 61 79 73  condary displays
01e0: 20 77 68 69 63 68 20 61 72 65 20 61 74 74 61 63   which are attac
01f0: 68 65 64 0a 77 69 6c 6c 20 6e 6f 74 20 68 61 76  hed.will not hav
0200: 65 20 65 76 65 6e 74 73 20 68 61 6e 64 6c 65 64  e events handled
0210: 20 66 6f 72 20 74 68 65 6d 20 61 74 20 61 6c 6c   for them at all
0220: 2e 20 54 68 69 73 20 69 73 20 74 6f 20 6d 61 6b  . This is to mak
0230: 65 20 69 74 20 65 61 73 69 65 72 20 74 6f 0a 69  e it easier to.i
0240: 6d 70 6c 65 6d 65 6e 74 2e 0a 0a 23 23 20 60 52  mplement...## `R
0250: 65 61 64 65 72 60 27 73 20 60 6c 6f 63 6b 60 20  eader`'s `lock` 
0260: 69 73 20 69 6e 69 74 69 61 6c 69 7a 65 64 20 74  is initialized t
0270: 6f 20 60 6e 75 6c 6c 60 20 69 6e 73 74 65 61 64  o `null` instead
0280: 20 6f 66 20 60 74 68 69 73 60 0a 0a 53 69 6e 63   of `this`..Sinc
0290: 65 20 53 71 75 69 72 72 65 6c 4a 4d 45 20 75 73  e SquirrelJME us
02a0: 65 73 20 61 20 72 65 66 65 72 65 6e 63 65 20 63  es a reference c
02b0: 6f 75 6e 74 65 64 20 67 61 72 62 61 67 65 20 63  ounted garbage c
02c0: 6f 6c 6c 65 63 74 6f 72 20 74 68 65 20 60 52 65  ollector the `Re
02d0: 61 64 65 72 60 27 73 0a 60 6c 6f 63 6b 60 20 6f  ader`'s.`lock` o
02e0: 62 6a 65 63 74 20 69 6e 20 74 68 65 20 64 65 66  bject in the def
02f0: 61 75 6c 74 20 63 6f 6e 73 74 72 75 63 74 6f 72  ault constructor
0300: 20 69 73 20 73 65 74 20 74 6f 20 60 6e 75 6c 6c   is set to `null
0310: 60 20 69 6e 73 74 65 61 64 20 6f 66 20 60 74 68  ` instead of `th
0320: 69 73 60 2e 0a 54 68 69 73 20 69 73 20 73 6f 20  is`..This is so 
0330: 74 68 61 74 20 72 65 61 64 65 72 73 20 64 6f 20  that readers do 
0340: 6e 6f 74 20 72 65 6d 61 69 6e 20 69 6e 20 6d 65  not remain in me
0350: 6d 6f 72 79 20 75 6e 61 62 6c 65 20 74 6f 20 62  mory unable to b
0360: 65 20 66 72 65 65 64 20 62 65 63 61 75 73 65 0a  e freed because.
0370: 6f 62 6a 65 63 74 73 20 73 74 69 6c 6c 20 72 65  objects still re
0380: 66 65 72 20 74 6f 20 74 68 65 6d 20 61 6e 64 20  fer to them and 
0390: 73 75 63 68 2e 0a 0a 23 23 20 60 53 55 50 45 52  such...## `SUPER
03a0: 60 20 69 73 20 61 6c 77 61 79 73 20 61 73 73 75  ` is always assu
03b0: 6d 65 64 20 74 6f 20 62 65 20 73 65 74 2e 0a 0a  med to be set...
03c0: 49 6e 20 61 6c 6c 20 63 6c 61 73 65 73 20 74 68  In all clases th
03d0: 65 20 60 53 55 50 45 52 60 20 66 6c 61 67 20 69  e `SUPER` flag i
03e0: 73 20 61 73 73 75 6d 65 64 20 74 6f 20 62 65 20  s assumed to be 
03f0: 73 65 74 2c 20 74 68 69 73 20 66 6c 61 67 20 6a  set, this flag j
0400: 75 73 74 20 6d 6f 64 69 66 69 65 73 0a 74 68 65  ust modifies.the
0410: 20 62 65 68 61 76 69 6f 72 20 6f 66 20 60 69 6e   behavior of `in
0420: 76 6f 6b 65 73 70 65 63 69 61 6c 60 2e 20 57 68  vokespecial`. Wh
0430: 65 6e 20 69 74 20 69 73 20 6e 6f 74 20 73 65 74  en it is not set
0440: 20 74 68 65 6e 20 74 68 61 74 20 69 6e 73 74 72   then that instr
0450: 75 63 74 69 6f 6e 0a 63 61 6e 20 69 6e 76 6f 6b  uction.can invok
0460: 65 20 6e 65 61 72 6c 79 20 65 76 65 72 79 20 6d  e nearly every m
0470: 65 74 68 6f 64 20 64 69 72 65 63 74 6c 79 20 28  ethod directly (
0480: 69 74 20 77 61 73 20 63 61 6c 6c 65 64 20 62 65  it was called be
0490: 66 6f 72 65 0a 60 69 6e 76 6f 6b 65 6e 6f 6e 76  fore.`invokenonv
04a0: 69 72 74 75 61 6c 60 29 2e 20 48 6f 77 65 76 65  irtual`). Howeve
04b0: 72 2c 20 74 68 65 20 4a 61 76 61 20 63 6f 6d 70  r, the Java comp
04c0: 69 6c 65 72 20 73 69 6e 63 65 20 4a 61 76 61 20  iler since Java 
04d0: 31 2e 31 20 61 6c 77 61 79 73 20 73 65 74 0a 74  1.1 always set.t
04e0: 68 65 20 66 6c 61 67 20 66 6f 72 20 63 6c 61 73  he flag for clas
04f0: 73 65 73 20 69 74 20 63 6f 6d 70 69 6c 65 64 2e  ses it compiled.
0500: 20 53 69 6e 63 65 20 43 4c 44 43 20 31 2e 30 20   Since CLDC 1.0 
0510: 77 61 73 20 72 65 6c 65 61 73 65 64 20 77 65 6c  was released wel
0520: 6c 20 61 66 74 65 72 0a 4a 61 76 61 20 32 20 77  l after.Java 2 w
0530: 61 73 20 61 6e 64 20 69 73 20 64 65 66 69 6e 65  as and is define
0540: 64 20 61 73 20 61 20 4a 61 76 61 20 32 20 76 69  d as a Java 2 vi
0550: 72 74 75 61 6c 20 6d 61 63 68 69 6e 65 20 61 6c  rtual machine al
0560: 6c 20 63 6f 64 65 20 77 72 69 74 74 65 6e 20 66  l code written f
0570: 6f 72 0a 4a 32 4d 45 20 73 68 6f 75 6c 64 20 68  or.J2ME should h
0580: 61 76 65 20 63 6c 61 73 73 65 73 20 77 68 65 72  ave classes wher
0590: 65 20 74 68 69 73 20 66 6c 61 67 20 69 73 20 73  e this flag is s
05a0: 65 74 2e 20 41 73 20 73 75 63 68 20 69 6e 73 74  et. As such inst
05b0: 65 61 64 20 6f 66 0a 73 75 70 70 6f 72 74 69 6e  ead of.supportin
05c0: 67 20 74 68 65 20 6c 6f 67 69 63 20 74 6f 20 68  g the logic to h
05d0: 61 6e 64 6c 65 20 63 61 73 65 73 20 77 68 65 72  andle cases wher
05e0: 65 20 69 74 20 69 73 20 6e 6f 74 20 73 65 74 2c  e it is not set,
05f0: 20 74 68 65 20 66 6c 61 67 20 77 69 6c 6c 20 6a   the flag will j
0600: 75 73 74 0a 62 65 20 69 67 6e 6f 72 65 64 20 61  ust.be ignored a
0610: 6e 64 20 61 73 73 75 6d 65 64 20 74 6f 20 62 65  nd assumed to be
0620: 20 73 65 74 2e 0a 0a 23 23 20 53 75 70 70 6f 72   set...## Suppor
0630: 74 65 64 20 45 6e 63 6f 64 69 6e 67 73 0a 0a 4f  ted Encodings..O
0640: 6e 6c 79 20 74 68 65 20 66 6f 6c 6c 6f 77 69 6e  nly the followin
0650: 67 20 63 68 61 72 61 63 74 65 72 20 65 6e 63 6f  g character enco
0660: 64 69 6e 67 73 20 61 72 65 20 73 75 70 70 6f 72  dings are suppor
0670: 74 65 64 3a 0a 0a 20 2a 20 5f 41 53 43 49 49 5f  ted:.. * _ASCII_
0680: 0a 20 2a 20 5f 49 42 4d 30 33 37 5f 0a 20 2a 20  . * _IBM037_. * 
0690: 5f 49 53 4f 2d 38 38 35 39 2d 31 5f 0a 20 2a 20  _ISO-8859-1_. * 
06a0: 5f 55 54 46 2d 38 5f 0a 0a 4e 6f 74 65 20 74 68  _UTF-8_..Note th
06b0: 61 74 20 55 54 46 20 63 6f 64 65 70 6f 69 6e 74  at UTF codepoint
06c0: 73 20 61 62 6f 76 65 20 55 2b 46 46 46 46 20 61  s above U+FFFF a
06d0: 72 65 20 6e 6f 74 20 66 75 6c 6c 79 20 73 75 70  re not fully sup
06e0: 70 6f 72 74 65 64 20 61 6e 64 20 61 72 65 20 6e  ported and are n
06f0: 6f 74 0a 61 76 61 69 6c 61 62 6c 65 20 69 6e 20  ot.available in 
0700: 4a 61 76 61 20 4d 45 2e 20 53 75 72 72 6f 67 61  Java ME. Surroga
0710: 74 65 20 70 61 69 72 73 20 69 6e 20 55 54 46 2d  te pairs in UTF-
0720: 31 36 20 77 69 6c 6c 20 62 65 20 65 6e 63 6f 64  16 will be encod
0730: 65 64 20 69 6e 20 55 54 46 2d 38 20 61 73 0a 73  ed in UTF-8 as.s
0740: 69 78 20 62 79 74 65 73 2e 20 41 64 64 69 74 69  ix bytes. Additi
0750: 6f 6e 61 6c 6c 79 20 77 68 65 6e 20 64 65 63 6f  onally when deco
0760: 64 69 6e 67 2c 20 69 66 20 61 20 73 65 71 75 65  ding, if a seque
0770: 6e 63 65 20 74 68 61 74 20 69 73 20 61 62 6f 76  nce that is abov
0780: 65 20 55 2b 46 46 46 46 20 69 73 0a 72 65 61 64  e U+FFFF is.read
0790: 20 74 68 65 6e 20 69 74 20 77 69 6c 6c 20 64 65   then it will de
07a0: 63 6f 64 65 20 74 6f 20 74 68 65 20 72 65 70 6c  code to the repl
07b0: 61 63 65 6d 65 6e 74 20 63 68 61 72 61 63 74 65  acement characte
07c0: 72 2e 20 54 68 69 73 20 6d 61 79 20 63 61 75 73  r. This may caus
07d0: 65 20 61 20 6c 6f 73 73 20 6f 66 0a 6f 72 20 6d  e a loss of.or m
07e0: 75 74 61 74 69 6f 6e 20 6f 66 20 64 61 74 61 20  utation of data 
07f0: 77 68 65 6e 20 70 72 6f 63 65 73 73 69 6e 67 20  when processing 
0800: 66 69 6c 65 73 2e 0a 0a 53 65 65 3a 0a 0a 20 2a  files...See:.. *
0810: 20 3c 68 74 74 70 73 3a 2f 2f 75 6e 69 63 6f 64   <https://unicod
0820: 65 2e 6f 72 67 2f 66 61 71 2f 75 74 66 5f 62 6f  e.org/faq/utf_bo
0830: 6d 2e 68 74 6d 6c 23 75 74 66 38 2d 34 3e 0a 20  m.html#utf8-4>. 
0840: 2a 20 3c 68 74 74 70 73 3a 2f 2f 77 77 77 2e 75  * <https://www.u
0850: 6e 69 63 6f 64 65 2e 6f 72 67 2f 72 65 70 6f 72  nicode.org/repor
0860: 74 73 2f 74 72 32 36 2f 3e 0a 0a                 ts/tr26/>..