History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg2 (645 of 18352 files). Show all

Unified · Split

645 files
  1. java/pkg2/README +1 −0
  2. java/pkg2/inferno/awt/awt_Color.b +338 −0
  3. java/pkg2/inferno/awt/awt_Color.m +13 −0
  4. java/pkg2/inferno/awt/awt_Frame.b +250 −0
  5. java/pkg2/inferno/awt/awt_Frame.m +46 −0
  6. java/pkg2/inferno/awt/awt_Graphics.b +209 −0
  7. java/pkg2/inferno/awt/awt_Graphics.m +43 −0
  8. java/pkg2/inferno/awt/awt_Image.m +36 −0
  9. java/pkg2/inferno/awt/iDrawingSurfaceInfo.java +117 −0
  10. java/pkg2/inferno/awt/iDrawingSurfaceInfo_L.b +56 −0
  11. java/pkg2/inferno/awt/iDrawingSurfaceInfo_L.m +21 −0
  12. java/pkg2/inferno/awt/iFontMetrics.java +266 −0
  13. java/pkg2/inferno/awt/iFontMetrics_L.b +123 −0
  14. java/pkg2/inferno/awt/iFontMetrics_L.m +27 −0
  15. java/pkg2/inferno/awt/iFontPeer.java +276 −0
  16. java/pkg2/inferno/awt/iFontPeer_L.b +115 −0
  17. java/pkg2/inferno/awt/iFontPeer_L.m +20 −0
  18. java/pkg2/inferno/awt/iFramePeer.java +527 −0
  19. java/pkg2/inferno/awt/iFramePeer_L.b +588 −0
  20. java/pkg2/inferno/awt/iFramePeer_L.m +36 −0
  21. java/pkg2/inferno/awt/iGraphics.java +606 −0
  22. java/pkg2/inferno/awt/iGraphics_L.b +245 −0
  23. java/pkg2/inferno/awt/iGraphics_L.m +50 −0
  24. java/pkg2/inferno/awt/iImage.java +51 −0
  25. java/pkg2/inferno/awt/iImageConsumer.java +0 −0
  26. java/pkg2/inferno/awt/iImageRepresentation.java +91 −0
  27. java/pkg2/inferno/awt/iImageRepresentation_L.b +152 −0
  28. java/pkg2/inferno/awt/iImageRepresentation_L.m +36 −0
  29. java/pkg2/inferno/awt/iImage_L.b +180 −0
  30. java/pkg2/inferno/awt/iImage_L.m +26 −0
  31. java/pkg2/inferno/awt/iMenuBarPeer.java +906 −0
  32. java/pkg2/inferno/awt/iOffScreenImage.java +33 −0
  33. java/pkg2/inferno/awt/iPopupMenuPeer.java +652 −0
  34. java/pkg2/inferno/awt/iToolkit.java +303 −0
  35. java/pkg2/inferno/awt/iToolkit_L.b +85 −0
  36. java/pkg2/inferno/awt/iToolkit_L.m +19 −0
  37. java/pkg2/inferno/awt/iWindowPeer.java +411 −0
  38. java/pkg2/inferno/awt/iWindowPeer_L.b +377 −0
  39. java/pkg2/inferno/awt/iWindowPeer_L.m +36 −0
  40. java/pkg2/inferno/awt/mkfile +126 −0
  41. java/pkg2/inferno/mkfile +7 −0
  42. java/pkg2/inferno/vm/Array.java +10 −0
  43. java/pkg2/inferno/vm/FD.java +7 −0
  44. java/pkg2/inferno/vm/boolean_p.java +5 −0
  45. java/pkg2/inferno/vm/byte_p.java +5 −0
  46. java/pkg2/inferno/vm/char_p.java +5 −0
  47. java/pkg2/inferno/vm/double_p.java +5 −0
  48. java/pkg2/inferno/vm/float_p.java +5 −0
  49. java/pkg2/inferno/vm/int_p.java +5 −0
  50. java/pkg2/inferno/vm/long_p.java +5 −0
  51. java/pkg2/inferno/vm/mkfile +18 −0
  52. java/pkg2/inferno/vm/short_p.java +5 −0
  53. java/pkg2/inferno/vm/void_p.java +5 −0
  54. java/pkg2/java/applet/Applet.java +593 −0
  55. java/pkg2/java/applet/AppletContext.java +194 −0
  56. java/pkg2/java/applet/AppletStub.java +111 −0
  57. java/pkg2/java/applet/AudioClip.java +53 −0
  58. java/pkg2/java/applet/mkfile +11 −0
  59. java/pkg2/java/awt/AWTError.java +0 −0
  60. java/pkg2/java/awt/AWTEvent.java +0 −0
  61. java/pkg2/java/awt/AWTEventMulticaster.java +0 −0
  62. java/pkg2/java/awt/AWTException.java +0 −0
  63. java/pkg2/java/awt/ActionInputPreferred.java +5 −0
  64. java/pkg2/java/awt/Adjustable.java +0 −0
  65. java/pkg2/java/awt/BorderLayout.java +0 −0
  66. java/pkg2/java/awt/Button.java +0 −0
  67. java/pkg2/java/awt/Canvas.java +0 −0
  68. java/pkg2/java/awt/CardLayout.java +0 −0
  69. java/pkg2/java/awt/Checkbox.java +0 −0
  70. java/pkg2/java/awt/CheckboxGroup.java +0 −0
  71. java/pkg2/java/awt/CheckboxMenuItem.java +0 −0
  72. java/pkg2/java/awt/Choice.java +0 −0
  73. java/pkg2/java/awt/Color.java +0 −0
  74. java/pkg2/java/awt/Component.java +0 −0
  75. java/pkg2/java/awt/Container.java +0 −0
  76. java/pkg2/java/awt/Cursor.java +0 −0
  77. java/pkg2/java/awt/Dialog.java +0 −0
  78. java/pkg2/java/awt/Dimension.java +0 −0
  79. java/pkg2/java/awt/Event.java +0 −0
  80. java/pkg2/java/awt/EventDispatchThread.java +0 −0
  81. java/pkg2/java/awt/EventQueue.java +0 −0
  82. java/pkg2/java/awt/FileDialog.java +0 −0
  83. java/pkg2/java/awt/FlowLayout.java +0 −0
  84. java/pkg2/java/awt/Font.java +0 −0
  85. java/pkg2/java/awt/FontMetrics.java +0 −0
  86. java/pkg2/java/awt/Frame.java +0 −0
  87. java/pkg2/java/awt/Graphics.java +0 −0
  88. java/pkg2/java/awt/GridBagConstraints.java +0 −0
  89. java/pkg2/java/awt/GridBagLayout.java +0 −0
  90. java/pkg2/java/awt/GridLayout.java +0 −0
  91. java/pkg2/java/awt/IllegalComponentStateEx.java +0 −0
  92. java/pkg2/java/awt/Image.java +0 −0
  93. java/pkg2/java/awt/Insets.java +0 −0
  94. java/pkg2/java/awt/ItemSelectable.java +0 −0
  95. java/pkg2/java/awt/KeyboardInputPreferred.java +5 −0
  96. java/pkg2/java/awt/Label.java +0 −0
  97. java/pkg2/java/awt/LayoutManager.java +0 −0
  98. java/pkg2/java/awt/LayoutManager2.java +0 −0
  99. java/pkg2/java/awt/List.java +0 −0
  100. java/pkg2/java/awt/MediaTracker.java +0 −0
  101. java/pkg2/java/awt/Menu.java +0 −0
  102. java/pkg2/java/awt/MenuBar.java +0 −0
  103. java/pkg2/java/awt/MenuComponent.java +0 −0
  104. java/pkg2/java/awt/MenuContainer.java +0 −0
  105. java/pkg2/java/awt/MenuItem.java +0 −0
  106. java/pkg2/java/awt/MenuShortcut.java +0 −0
  107. java/pkg2/java/awt/Misc.java +95 −0
  108. java/pkg2/java/awt/NoInputPreferred.java +5 −0
  109. java/pkg2/java/awt/Panel.java +0 −0
  110. java/pkg2/java/awt/Point.java +0 −0
  111. java/pkg2/java/awt/Polygon.java +0 −0
  112. java/pkg2/java/awt/PopupMenu.java +0 −0
  113. java/pkg2/java/awt/PositionalInputPreferre.java +5 −0
  114. java/pkg2/java/awt/PrintGraphics.java +0 −0
  115. java/pkg2/java/awt/PrintJob.java +0 −0
  116. java/pkg2/java/awt/Rectangle.java +0 −0
  117. java/pkg2/java/awt/ScrollPane.java +0 −0
  118. java/pkg2/java/awt/Scrollbar.java +0 −0
  119. java/pkg2/java/awt/Shape.java +0 −0
  120. java/pkg2/java/awt/SystemColor.java +0 −0
  121. java/pkg2/java/awt/TextArea.java +0 −0
  122. java/pkg2/java/awt/TextComponent.java +0 −0
  123. java/pkg2/java/awt/TextField.java +0 −0
  124. java/pkg2/java/awt/Toolkit.java +0 −0
  125. java/pkg2/java/awt/Window.java +0 −0
  126. java/pkg2/java/awt/datatransfer/Clipboard.java +0 −0
  127. java/pkg2/java/awt/datatransfer/ClipboardOwner.java +0 −0
  128. java/pkg2/java/awt/datatransfer/DataFlavor.java +0 −0
  129. java/pkg2/java/awt/datatransfer/StringSelection.java +0 −0
  130. java/pkg2/java/awt/datatransfer/Transferable.java +0 −0
  131. java/pkg2/java/awt/datatransfer/UnsupportedFlavorExcept..a +0 −0
  132. java/pkg2/java/awt/datatransfer/mkfile +17 −0
  133. java/pkg2/java/awt/event/ActionEvent.java +0 −0
  134. java/pkg2/java/awt/event/ActionListener.java +0 −0
  135. java/pkg2/java/awt/event/AdjustmentEvent.java +0 −0
  136. java/pkg2/java/awt/event/AdjustmentListener.java +0 −0
  137. java/pkg2/java/awt/event/ComponentAdapter.java +0 −0
  138. java/pkg2/java/awt/event/ComponentEvent.java +0 −0
  139. java/pkg2/java/awt/event/ComponentListener.java +0 −0
  140. java/pkg2/java/awt/event/ContainerAdapter.java +0 −0
  141. java/pkg2/java/awt/event/ContainerEvent.java +0 −0
  142. java/pkg2/java/awt/event/ContainerListener.java +0 −0
  143. java/pkg2/java/awt/event/FocusAdapter.java +0 −0
  144. java/pkg2/java/awt/event/FocusEvent.java +0 −0
  145. java/pkg2/java/awt/event/FocusListener.java +0 −0
  146. java/pkg2/java/awt/event/InputEvent.java +0 −0
  147. java/pkg2/java/awt/event/ItemEvent.java +0 −0
  148. java/pkg2/java/awt/event/ItemListener.java +0 −0
  149. java/pkg2/java/awt/event/KeyAdapter.java +0 −0
  150. java/pkg2/java/awt/event/KeyEvent.java +0 −0
  151. java/pkg2/java/awt/event/KeyListener.java +0 −0
  152. java/pkg2/java/awt/event/MouseAdapter.java +0 −0
  153. java/pkg2/java/awt/event/MouseEvent.java +0 −0
  154. java/pkg2/java/awt/event/MouseListener.java +0 −0
  155. java/pkg2/java/awt/event/MouseMotionAdapter.java +0 −0
  156. java/pkg2/java/awt/event/MouseMotionListener.java +0 −0
  157. java/pkg2/java/awt/event/PaintEvent.java +0 −0
  158. java/pkg2/java/awt/event/TextEvent.java +0 −0
  159. java/pkg2/java/awt/event/TextListener.java +0 −0
  160. java/pkg2/java/awt/event/WindowAdapter.java +0 −0
  161. java/pkg2/java/awt/event/WindowEvent.java +0 −0
  162. java/pkg2/java/awt/event/WindowListener.java +0 −0
  163. java/pkg2/java/awt/event/mkfile +37 −0
  164. java/pkg2/java/awt/image/AreaAveragingScaleFilte.java +0 −0
  165. java/pkg2/java/awt/image/ColorModel.java +0 −0
  166. java/pkg2/java/awt/image/ColorModel_L.b +49 −0
  167. java/pkg2/java/awt/image/ColorModel_L.m +15 −0
  168. java/pkg2/java/awt/image/CropImageFilter.java +0 −0
  169. java/pkg2/java/awt/image/DirectColorModel.java +0 −0
  170. java/pkg2/java/awt/image/FilteredImageSource.java +0 −0
  171. java/pkg2/java/awt/image/ImageConsumer.java +0 −0
  172. java/pkg2/java/awt/image/ImageFilter.java +0 −0
  173. java/pkg2/java/awt/image/ImageObserver.java +0 −0
  174. java/pkg2/java/awt/image/ImageProducer.java +0 −0
  175. java/pkg2/java/awt/image/IndexColorModel.java +0 −0
  176. java/pkg2/java/awt/image/MemoryImageSource.java +0 −0
  177. java/pkg2/java/awt/image/PixelGrabber.java +0 −0
  178. java/pkg2/java/awt/image/RGBImageFilter.java +0 −0
  179. java/pkg2/java/awt/image/ReplicateScaleFilter.java +0 −0
  180. java/pkg2/java/awt/image/mkfile +46 −0
  181. java/pkg2/java/awt/mkfile +138 −0
  182. java/pkg2/java/awt/peer/ActiveEvent.java +0 −0
  183. java/pkg2/java/awt/peer/ButtonPeer.java +0 −0
  184. java/pkg2/java/awt/peer/CanvasPeer.java +0 −0
  185. java/pkg2/java/awt/peer/CheckboxMenuItemPeer.java +0 −0
  186. java/pkg2/java/awt/peer/CheckboxPeer.java +0 −0
  187. java/pkg2/java/awt/peer/ChoicePeer.java +0 −0
  188. java/pkg2/java/awt/peer/ComponentPeer.java +0 −0
  189. java/pkg2/java/awt/peer/ContainerPeer.java +0 −0
  190. java/pkg2/java/awt/peer/DialogPeer.java +0 −0
  191. java/pkg2/java/awt/peer/DoubleBufferingPeer.java +6 −0
  192. java/pkg2/java/awt/peer/FileDialogPeer.java +0 −0
  193. java/pkg2/java/awt/peer/FontPeer.java +0 −0
  194. java/pkg2/java/awt/peer/FramePeer.java +0 −0
  195. java/pkg2/java/awt/peer/LabelPeer.java +0 −0
  196. java/pkg2/java/awt/peer/LightweightPeer.java +0 −0
  197. java/pkg2/java/awt/peer/ListPeer.java +0 −0
  198. java/pkg2/java/awt/peer/MenuBarPeer.java +0 −0
  199. java/pkg2/java/awt/peer/MenuComponentPeer.java +0 −0
  200. java/pkg2/java/awt/peer/MenuItemPeer.java +0 −0
  201. java/pkg2/java/awt/peer/MenuPeer.java +0 −0
  202. java/pkg2/java/awt/peer/PanelPeer.java +0 −0
  203. java/pkg2/java/awt/peer/PopupMenuPeer.java +0 −0
  204. java/pkg2/java/awt/peer/ScrollPanePeer.java +0 −0
  205. java/pkg2/java/awt/peer/ScrollbarPeer.java +0 −0
  206. java/pkg2/java/awt/peer/TextAreaPeer.java +0 −0
  207. java/pkg2/java/awt/peer/TextComponentPeer.java +0 −0
  208. java/pkg2/java/awt/peer/TextFieldPeer.java +0 −0
  209. java/pkg2/java/awt/peer/WindowPeer.java +0 −0
  210. java/pkg2/java/awt/peer/mkfile +35 −0
  211. java/pkg2/java/beans/BeanDescriptor.java +0 −0
  212. java/pkg2/java/beans/BeanInfo.java +0 −0
  213. java/pkg2/java/beans/Beans.java +0 −0
  214. java/pkg2/java/beans/Customizer.java +0 −0
  215. java/pkg2/java/beans/EventSetDescriptor.java +0 −0
  216. java/pkg2/java/beans/FeatureDescriptor.java +0 −0
  217. java/pkg2/java/beans/IndexedPropertyDescript.java +0 −0
  218. java/pkg2/java/beans/IntrospectionException.java +0 −0
  219. java/pkg2/java/beans/Introspector.java +0 −0
  220. java/pkg2/java/beans/MethodDescriptor.java +0 −0
  221. java/pkg2/java/beans/ParameterDescriptor.java +0 −0
  222. java/pkg2/java/beans/PropertyChangeEvent.java +0 −0
  223. java/pkg2/java/beans/PropertyChangeListener.java +0 −0
  224. java/pkg2/java/beans/PropertyChangeSupport.java +0 −0
  225. java/pkg2/java/beans/PropertyDescriptor.java +0 −0
  226. java/pkg2/java/beans/PropertyEditor.java +0 −0
  227. java/pkg2/java/beans/PropertyEditorManager.java +0 −0
  228. java/pkg2/java/beans/PropertyEditorSupport.java +0 −0
  229. java/pkg2/java/beans/PropertyVetoException.java +0 −0
  230. java/pkg2/java/beans/SimpleBeanInfo.java +0 −0
  231. java/pkg2/java/beans/VetoableChangeListener.java +0 −0
  232. java/pkg2/java/beans/VetoableChangeSupport.java +0 −0
  233. java/pkg2/java/beans/Visibility.java +0 −0
  234. java/pkg2/java/beans/mkfile +63 −0
  235. java/pkg2/java/io/BufferedInputStream.java +0 −0
  236. java/pkg2/java/io/BufferedOutputStream.java +0 −0
  237. java/pkg2/java/io/BufferedReader.java +0 −0
  238. java/pkg2/java/io/BufferedWriter.java +0 −0
  239. java/pkg2/java/io/ByteArrayInputStream.java +0 −0
  240. java/pkg2/java/io/ByteArrayOutputStream.java +0 −0
  241. java/pkg2/java/io/CharArrayReader.java +0 −0
  242. java/pkg2/java/io/CharArrayWriter.java +0 −0
  243. java/pkg2/java/io/CharConversionException.java +0 −0
  244. java/pkg2/java/io/DataInput.java +0 −0
  245. java/pkg2/java/io/DataInputStream.java +0 −0
  246. java/pkg2/java/io/DataOutput.java +0 −0
  247. java/pkg2/java/io/DataOutputStream.java +0 −0
  248. java/pkg2/java/io/EOFException.java +0 −0
  249. java/pkg2/java/io/Externalizable.java +0 −0
  250. java/pkg2/java/io/File.java +0 −0
  251. java/pkg2/java/io/FileDescriptor.java +0 −0
  252. java/pkg2/java/io/FileDescriptor_L.b +72 −0
  253. java/pkg2/java/io/FileDescriptor_L.m +16 −0
  254. java/pkg2/java/io/FileInputStream.java +0 −0
  255. java/pkg2/java/io/FileInputStream_L.b +135 −0
  256. java/pkg2/java/io/FileInputStream_L.m +19 −0
  257. java/pkg2/java/io/FileNotFoundException.java +0 −0
  258. java/pkg2/java/io/FileOutputStream.java +0 −0
  259. java/pkg2/java/io/FileOutputStream_L.b +116 −0
  260. java/pkg2/java/io/FileOutputStream_L.m +18 −0
  261. java/pkg2/java/io/FileReader.java +0 −0
  262. java/pkg2/java/io/FileWriter.java +0 −0
  263. java/pkg2/java/io/File_L.b +332 −0
  264. java/pkg2/java/io/File_L.m +27 −0
  265. java/pkg2/java/io/FilenameFilter.java +0 −0
  266. java/pkg2/java/io/FilterInputStream.java +0 −0
  267. java/pkg2/java/io/FilterOutputStream.java +0 −0
  268. java/pkg2/java/io/FilterReader.java +0 −0
  269. java/pkg2/java/io/FilterWriter.java +0 −0
  270. java/pkg2/java/io/IOException.java +0 −0
  271. java/pkg2/java/io/InputStream.java +0 −0
  272. java/pkg2/java/io/InputStreamReader.java +0 −0
  273. java/pkg2/java/io/InterruptedIOException.java +0 −0
  274. java/pkg2/java/io/InvalidClassException.java +0 −0
  275. java/pkg2/java/io/InvalidObjectException.java +0 −0
  276. java/pkg2/java/io/LineNumberInputStream.java +0 −0
  277. java/pkg2/java/io/LineNumberReader.java +0 −0
  278. java/pkg2/java/io/NotActiveException.java +0 −0
  279. java/pkg2/java/io/NotSerializableExceptio.java +0 −0
  280. java/pkg2/java/io/ObjectInput.java +0 −0
  281. java/pkg2/java/io/ObjectInputStream.java +0 −0
  282. java/pkg2/java/io/ObjectInputStream_L.b +397 −0
  283. java/pkg2/java/io/ObjectInputStream_L.m +36 −0
  284. java/pkg2/java/io/ObjectInputValidation.java +0 −0
  285. java/pkg2/java/io/ObjectOutput.java +0 −0
  286. java/pkg2/java/io/ObjectOutputStream.java +0 −0
  287. java/pkg2/java/io/ObjectOutputStream_L.b +257 −0
  288. java/pkg2/java/io/ObjectOutputStream_L.m +33 −0
  289. java/pkg2/java/io/ObjectStreamClass.java +0 −0
  290. java/pkg2/java/io/ObjectStreamClass_L.b +164 −0
  291. java/pkg2/java/io/ObjectStreamClass_L.m +30 −0
  292. java/pkg2/java/io/ObjectStreamConstants.java +0 −0
  293. java/pkg2/java/io/ObjectStreamException.java +0 −0
  294. java/pkg2/java/io/ObjectStreamField.java +0 −0
  295. java/pkg2/java/io/OptionalDataException.java +0 −0
  296. java/pkg2/java/io/OutputStream.java +0 −0
  297. java/pkg2/java/io/OutputStreamWriter.java +0 −0
  298. java/pkg2/java/io/PipedInputStream.java +0 −0
  299. java/pkg2/java/io/PipedOutputStream.java +0 −0
  300. java/pkg2/java/io/PipedReader.java +0 −0
  301. java/pkg2/java/io/PipedWriter.java +0 −0
  302. java/pkg2/java/io/PrintStream.java +0 −0
  303. java/pkg2/java/io/PrintWriter.java +0 −0
  304. java/pkg2/java/io/PushbackInputStream.java +0 −0
  305. java/pkg2/java/io/PushbackReader.java +0 −0
  306. java/pkg2/java/io/RandomAccessFile.java +0 −0
  307. java/pkg2/java/io/RandomAccessFile_L.b +190 −0
  308. java/pkg2/java/io/RandomAccessFile_L.m +22 −0
  309. java/pkg2/java/io/Reader.java +0 −0
  310. java/pkg2/java/io/SequenceInputStream.java +0 −0
  311. java/pkg2/java/io/Serializable.java +0 −0
  312. java/pkg2/java/io/StreamCorruptedExceptio.java +0 −0
  313. java/pkg2/java/io/StreamTokenizer.java +0 −0
  314. java/pkg2/java/io/StringBufferInputStream.java +0 −0
  315. java/pkg2/java/io/StringReader.java +0 −0
  316. java/pkg2/java/io/StringWriter.java +0 −0
  317. java/pkg2/java/io/SyncFailedException.java +0 −0
  318. java/pkg2/java/io/UTFDataFormatException.java +0 −0
  319. java/pkg2/java/io/UnsupportedEncodingExce.java +0 −0
  320. java/pkg2/java/io/WriteAbortedException.java +0 −0
  321. java/pkg2/java/io/Writer.java +0 −0
  322. java/pkg2/java/io/mkfile +150 −0
  323. java/pkg2/java/lang/AbstractMethodError.java +0 −0
  324. java/pkg2/java/lang/ArithmeticException.java +0 −0
  325. java/pkg2/java/lang/ArrayIndexOutOfBoundsException.java +0 −0
  326. java/pkg2/java/lang/ArrayStoreException.java +0 −0
  327. java/pkg2/java/lang/Boolean.java +0 −0
  328. java/pkg2/java/lang/Byte.java +0 −0
  329. java/pkg2/java/lang/Character.java +0 −0
  330. java/pkg2/java/lang/Character_L.b +63 −0
  331. java/pkg2/java/lang/Character_L.m +14 −0
  332. java/pkg2/java/lang/Class.java +0 −0
  333. java/pkg2/java/lang/ClassCastException.java +0 −0
  334. java/pkg2/java/lang/ClassCircularityError.java +0 −0
  335. java/pkg2/java/lang/ClassFormatError.java +0 −0
  336. java/pkg2/java/lang/ClassLoader.java +0 −0
  337. java/pkg2/java/lang/ClassLoader_L.b +82 −0
  338. java/pkg2/java/lang/ClassLoader_L.m +20 −0
  339. java/pkg2/java/lang/ClassNotFoundException.java +0 −0
  340. java/pkg2/java/lang/Class_L.b +778 −0
  341. java/pkg2/java/lang/Class_L.m +30 −0
  342. java/pkg2/java/lang/CloneNotSupportedException.java +0 −0
  343. java/pkg2/java/lang/Cloneable.java +0 −0
  344. java/pkg2/java/lang/Compiler.java +0 −0
  345. java/pkg2/java/lang/Double.java +0 −0
  346. java/pkg2/java/lang/Double_L.b +66 −0
  347. java/pkg2/java/lang/Double_L.m +17 −0
  348. java/pkg2/java/lang/Error.java +0 −0
  349. java/pkg2/java/lang/Exception.java +0 −0
  350. java/pkg2/java/lang/ExceptionInInitializerE..a +73 −0
  351. java/pkg2/java/lang/Float.java +0 −0
  352. java/pkg2/java/lang/Float_L.b +60 −0
  353. java/pkg2/java/lang/Float_L.m +16 −0
  354. java/pkg2/java/lang/IllegalAccessError.java +0 −0
  355. java/pkg2/java/lang/IllegalAccessException.java +0 −0
  356. java/pkg2/java/lang/IllegalArgumentException.java +0 −0
  357. java/pkg2/java/lang/IllegalMonitorStateException.java +0 −0
  358. java/pkg2/java/lang/IllegalStateException.java +0 −0
  359. java/pkg2/java/lang/IllegalThreadStateExcep..a +0 −0
  360. java/pkg2/java/lang/IncompatibleClassChange..a +0 −0
  361. java/pkg2/java/lang/IndexOutOfBoundsExcepti..a +0 −0
  362. java/pkg2/java/lang/InfernoProcess.java +0 −0
  363. java/pkg2/java/lang/InfernoProcess_L.b +207 −0
  364. java/pkg2/java/lang/InfernoProcess_L.m +22 −0
  365. java/pkg2/java/lang/InstantiationError.java +0 −0
  366. java/pkg2/java/lang/InstantiationException.java +0 −0
  367. java/pkg2/java/lang/Integer.java +0 −0
  368. java/pkg2/java/lang/InternalError.java +0 −0
  369. java/pkg2/java/lang/InterruptedException.java +0 −0
  370. java/pkg2/java/lang/LinkageError.java +0 −0
  371. java/pkg2/java/lang/Long.java +0 −0
  372. java/pkg2/java/lang/Math.java +0 −0
  373. java/pkg2/java/lang/Math_L.b +119 −0
  374. java/pkg2/java/lang/Math_L.m +27 −0
  375. java/pkg2/java/lang/NegativeArraySizeExcept..a +0 −0
  376. java/pkg2/java/lang/NoClassDefFoundError.java +0 −0
  377. java/pkg2/java/lang/NoSuchFieldError.java +0 −0
  378. java/pkg2/java/lang/NoSuchFieldException.java +0 −0
  379. java/pkg2/java/lang/NoSuchMethodError.java +0 −0
  380. java/pkg2/java/lang/NoSuchMethodException.java +0 −0
  381. java/pkg2/java/lang/NullPointerException.java +0 −0
  382. java/pkg2/java/lang/Number.java +0 −0
  383. java/pkg2/java/lang/NumberFormatException.java +0 −0
  384. java/pkg2/java/lang/Object.java +0 −0
  385. java/pkg2/java/lang/Object_L.b +71 −0
  386. java/pkg2/java/lang/Object_L.m +14 −0
  387. java/pkg2/java/lang/OutOfMemoryError.java +0 −0
  388. java/pkg2/java/lang/Process.java +0 −0
  389. java/pkg2/java/lang/Runnable.java +0 −0
  390. java/pkg2/java/lang/Runtime.java +0 −0
  391. java/pkg2/java/lang/RuntimeException.java +0 −0
  392. java/pkg2/java/lang/Runtime_L.b +161 −0
  393. java/pkg2/java/lang/Runtime_L.m +20 −0
  394. java/pkg2/java/lang/SecurityException.java +0 −0
  395. java/pkg2/java/lang/SecurityManager.java +0 −0
  396. java/pkg2/java/lang/SecurityManager_L.b +175 −0
  397. java/pkg2/java/lang/SecurityManager_L.m +19 −0
  398. java/pkg2/java/lang/Short.java +0 −0
  399. java/pkg2/java/lang/StackOverflowError.java +0 −0
  400. java/pkg2/java/lang/String.java +0 −0
  401. java/pkg2/java/lang/StringBuffer.java +0 −0
  402. java/pkg2/java/lang/StringBuffer_L.b +359 −0
  403. java/pkg2/java/lang/StringBuffer_L.m +42 −0
  404. java/pkg2/java/lang/StringIndexOutOfBoundsE..a +0 −0
  405. java/pkg2/java/lang/String_L.b +517 −0
  406. java/pkg2/java/lang/String_L.m +30 −0
  407. java/pkg2/java/lang/System.java +0 −0
  408. java/pkg2/java/lang/System_L.b +133 −0
  409. java/pkg2/java/lang/System_L.m +20 −0
  410. java/pkg2/java/lang/Thread.java +0 −0
  411. java/pkg2/java/lang/ThreadDeath.java +0 −0
  412. java/pkg2/java/lang/ThreadGroup.java +0 −0
  413. java/pkg2/java/lang/Thread_L.b +455 −0
  414. java/pkg2/java/lang/Thread_L.m +21 −0
  415. java/pkg2/java/lang/Throwable.java +0 −0
  416. java/pkg2/java/lang/Throwable_L.b +96 −0
  417. java/pkg2/java/lang/Throwable_L.m +16 −0
  418. java/pkg2/java/lang/UnknownError.java +0 −0
  419. java/pkg2/java/lang/UnsatisfiedLinkError.java +0 −0
  420. java/pkg2/java/lang/VerifyError.java +0 −0
  421. java/pkg2/java/lang/VirtualMachineError.java +0 −0
  422. java/pkg2/java/lang/Void.java +0 −0
  423. java/pkg2/java/lang/mkfile +152 −0
  424. java/pkg2/java/lang/reflect/Array.java +0 −0
  425. java/pkg2/java/lang/reflect/Array_L.b +417 −0
  426. java/pkg2/java/lang/reflect/Array_L.m +33 −0
  427. java/pkg2/java/lang/reflect/Constructor.java +0 −0
  428. java/pkg2/java/lang/reflect/Constructor_L.b +90 −0
  429. java/pkg2/java/lang/reflect/Constructor_L.m +18 −0
  430. java/pkg2/java/lang/reflect/Field.java +0 −0
  431. java/pkg2/java/lang/reflect/Field_L.b +469 −0
  432. java/pkg2/java/lang/reflect/Field_L.m +35 −0
  433. java/pkg2/java/lang/reflect/InvocationTargetExcepti..a +0 −0
  434. java/pkg2/java/lang/reflect/Member.java +0 −0
  435. java/pkg2/java/lang/reflect/Method.java +0 −0
  436. java/pkg2/java/lang/reflect/Method_L.b +117 −0
  437. java/pkg2/java/lang/reflect/Method_L.m +20 −0
  438. java/pkg2/java/lang/reflect/Modifier.java +0 −0
  439. java/pkg2/java/lang/reflect/mkfile +46 −0
  440. java/pkg2/java/lang/reflect/reflect.b +327 −0
  441. java/pkg2/java/lang/reflect/reflect.m +19 −0
  442. java/pkg2/java/lang/unicode_table.b +1285 −0
  443. java/pkg2/java/lang/unicode_table.m +8 −0
  444. java/pkg2/java/mkfile +13 −0
  445. java/pkg2/java/net/BindException.java +0 −0
  446. java/pkg2/java/net/ConnectException.java +0 −0
  447. java/pkg2/java/net/ContentHandler.java +0 −0
  448. java/pkg2/java/net/ContentHandlerFactory.java +0 −0
  449. java/pkg2/java/net/DatagramPacket.java +0 −0
  450. java/pkg2/java/net/DatagramPacket_L.m +16 −0
  451. java/pkg2/java/net/DatagramSocket.java +0 −0
  452. java/pkg2/java/net/DatagramSocketImpl.java +0 −0
  453. java/pkg2/java/net/DatagramSocketImpl_L.m +14 −0
  454. java/pkg2/java/net/FileNameMap.java +0 −0
  455. java/pkg2/java/net/HttpURLConnection.java +0 −0
  456. java/pkg2/java/net/InetAddress.java +0 −0
  457. java/pkg2/java/net/InetAddressImpl_L.b +218 −0
  458. java/pkg2/java/net/InetAddressImpl_L.m +17 −0
  459. java/pkg2/java/net/InetAddress_L.m +12 −0
  460. java/pkg2/java/net/MalformedURLException.java +0 −0
  461. java/pkg2/java/net/MulticastSocket.java +0 −0
  462. java/pkg2/java/net/NoRouteToHostException.java +0 −0
  463. java/pkg2/java/net/PlainDatagramSocketImpl..a +0 −0
  464. java/pkg2/java/net/PlainDatagramSocketImpl_L.b +695 −0
  465. java/pkg2/java/net/PlainDatagramSocketImpl_L.m +29 −0
  466. java/pkg2/java/net/PlainSocketImpl.java +0 −0
  467. java/pkg2/java/net/PlainSocketImpl_L.b +685 −0
  468. java/pkg2/java/net/PlainSocketImpl_L.m +30 −0
  469. java/pkg2/java/net/ProtocolException.java +0 −0
  470. java/pkg2/java/net/ServerSocket.java +0 −0
  471. java/pkg2/java/net/Socket.java +0 −0
  472. java/pkg2/java/net/SocketException.java +0 −0
  473. java/pkg2/java/net/SocketImpl.java +0 −0
  474. java/pkg2/java/net/SocketImplFactory.java +0 −0
  475. java/pkg2/java/net/SocketImpl_L.m +19 −0
  476. java/pkg2/java/net/SocketInputStream.java +0 −0
  477. java/pkg2/java/net/SocketInputStream_L.b +173 −0
  478. java/pkg2/java/net/SocketInputStream_L.m +17 −0
  479. java/pkg2/java/net/SocketOptions.java +0 −0
  480. java/pkg2/java/net/SocketOutputStream.java +0 −0
  481. java/pkg2/java/net/SocketOutputStream_L.b +95 −0
  482. java/pkg2/java/net/SocketOutputStream_L.m +16 −0
  483. java/pkg2/java/net/URL.java +0 −0
  484. java/pkg2/java/net/URLConnection.java +0 −0
  485. java/pkg2/java/net/URLEncoder.java +0 −0
  486. java/pkg2/java/net/URLStreamHandler.java +0 −0
  487. java/pkg2/java/net/URLStreamHandlerFactory.java +0 −0
  488. java/pkg2/java/net/UnknownHostException.java +0 −0
  489. java/pkg2/java/net/UnknownServiceException.java +0 −0
  490. java/pkg2/java/net/jnet.m +23 −0
  491. java/pkg2/java/net/mkfile +100 −0
  492. java/pkg2/java/security/DigestException.java +0 −0
  493. java/pkg2/java/security/DigestOutputStream.java +0 −0
  494. java/pkg2/java/security/MessageDigest.java +0 −0
  495. java/pkg2/java/security/NoSuchAlgorithmException.java +0 −0
  496. java/pkg2/java/security/NoSuchProviderException.java +0 −0
  497. java/pkg2/java/security/Provider.java +0 −0
  498. java/pkg2/java/security/Security.java +0 −0
  499. java/pkg2/java/security/mkfile +22 −0
  500. java/pkg2/java/util/BitSet.java +0 −0
  501. java/pkg2/java/util/Calendar.java +782 −0
  502. java/pkg2/java/util/Date.java +0 −0
  503. java/pkg2/java/util/Date_L.b +180 −0
  504. java/pkg2/java/util/Date_L.m +30 −0
  505. java/pkg2/java/util/Dictionary.java +0 −0
  506. java/pkg2/java/util/EmptyStackException.java +0 −0
  507. java/pkg2/java/util/Enumeration.java +0 −0
  508. java/pkg2/java/util/EventListener.java +0 −0
  509. java/pkg2/java/util/EventObject.java +0 −0
  510. java/pkg2/java/util/GregorianCalendar.java +557 −0
  511. java/pkg2/java/util/Hashtable.java +0 −0
  512. java/pkg2/java/util/ListResourceBundle.java +169 −0
  513. java/pkg2/java/util/Locale.java +631 −0
  514. java/pkg2/java/util/MissingResourceException.java +73 −0
  515. java/pkg2/java/util/NoSuchElementException.java +0 −0
  516. java/pkg2/java/util/Observable.java +0 −0
  517. java/pkg2/java/util/Observer.java +0 −0
  518. java/pkg2/java/util/Properties.java +0 −0
  519. java/pkg2/java/util/PropertyResourceBundle.java +121 −0
  520. java/pkg2/java/util/Random.java +0 −0
  521. java/pkg2/java/util/ResourceBundle.java +536 −0
  522. java/pkg2/java/util/ResourceBundle_L.b +48 −0
  523. java/pkg2/java/util/ResourceBundle_L.m +14 −0
  524. java/pkg2/java/util/SimpleTimeZone.java +246 −0
  525. java/pkg2/java/util/Stack.java +0 −0
  526. java/pkg2/java/util/StringTokenizer.java +0 −0
  527. java/pkg2/java/util/TimeZone.java +193 −0
  528. java/pkg2/java/util/TooManyListenersException.java +65 −0
  529. java/pkg2/java/util/Vector.java +0 −0
  530. java/pkg2/java/util/mkfile +88 −0
  531. java/pkg2/java/util/zip/CRC32.java +0 −0
  532. java/pkg2/java/util/zip/CRC32_L.b +51 −0
  533. java/pkg2/java/util/zip/CRC32_L.m +15 −0
  534. java/pkg2/java/util/zip/CheckedInputStream.java +0 −0
  535. java/pkg2/java/util/zip/CheckedOutputStream.java +0 −0
  536. java/pkg2/java/util/zip/Checksum.java +0 −0
  537. java/pkg2/java/util/zip/DataFormatException.java +0 −0
  538. java/pkg2/java/util/zip/GZIPInputStream.java +0 −0
  539. java/pkg2/java/util/zip/Inflater.java +0 −0
  540. java/pkg2/java/util/zip/InflaterInputStream.java +0 −0
  541. java/pkg2/java/util/zip/Inflater_L.b +77 −0
  542. java/pkg2/java/util/zip/Inflater_L.m +24 −0
  543. java/pkg2/java/util/zip/ZipConstants.java +0 −0
  544. java/pkg2/java/util/zip/ZipEntry.java +0 −0
  545. java/pkg2/java/util/zip/ZipException.java +0 −0
  546. java/pkg2/java/util/zip/ZipInputStream.java +0 −0
  547. java/pkg2/java/util/zip/mkfile +38 −0
  548. java/pkg2/mkfile +9 −0
  549. java/pkg2/sun/awt/AWTFinalizeable.java +0 −0
  550. java/pkg2/sun/awt/AWTFinalizer.java +0 −0
  551. java/pkg2/sun/awt/DrawingSurface.java +0 −0
  552. java/pkg2/sun/awt/DrawingSurfaceInfo.java +0 −0
  553. java/pkg2/sun/awt/PhysicalDrawingSurface.java +0 −0
  554. java/pkg2/sun/awt/image/ByteArrayImageSource.java +0 −0
  555. java/pkg2/sun/awt/image/FileImageSource.java +0 −0
  556. java/pkg2/sun/awt/image/GifImageDecoder.java +0 −0
  557. java/pkg2/sun/awt/image/GifImageDecoder_L.b +54 −0
  558. java/pkg2/sun/awt/image/GifImageDecoder_L.m +36 −0
  559. java/pkg2/sun/awt/image/Image.java +0 −0
  560. java/pkg2/sun/awt/image/ImageConsumerQueue.java +0 −0
  561. java/pkg2/sun/awt/image/ImageDecoder.java +0 −0
  562. java/pkg2/sun/awt/image/ImageFetchable.java +0 −0
  563. java/pkg2/sun/awt/image/ImageFetcher.java +0 −0
  564. java/pkg2/sun/awt/image/ImageFormatException.java +0 −0
  565. java/pkg2/sun/awt/image/ImageRepresentation.java +0 −0
  566. java/pkg2/sun/awt/image/ImageWatched.java +0 −0
  567. java/pkg2/sun/awt/image/InputStreamImageSource.java +0 −0
  568. java/pkg2/sun/awt/image/JPEGImageDecoder.java +160 −0
  569. java/pkg2/sun/awt/image/JPEGImageDecoder_L.b +49 −0
  570. java/pkg2/sun/awt/image/JPEGImageDecoder_L.m +22 −0
  571. java/pkg2/sun/awt/image/OffScreenImageSource.java +0 −0
  572. java/pkg2/sun/awt/image/OffScreenImageSource_L.b +49 −0
  573. java/pkg2/sun/awt/image/OffScreenImageSource_L.m +18 −0
  574. java/pkg2/sun/awt/image/PixelStore.java +0 −0
  575. java/pkg2/sun/awt/image/PixelStore32.java +0 −0
  576. java/pkg2/sun/awt/image/PixelStore8.java +0 −0
  577. java/pkg2/sun/awt/image/URLImageSource.java +0 −0
  578. java/pkg2/sun/awt/image/XbmImageDecoder.java +0 −0
  579. java/pkg2/sun/awt/image/mkfile +55 −0
  580. java/pkg2/sun/awt/mkfile +20 −0
  581. java/pkg2/sun/io/ByteToCharConverter.java +0 −0
  582. java/pkg2/sun/io/ByteToCharConverter_L.b +220 −0
  583. java/pkg2/sun/io/ByteToCharConverter_L.m +25 −0
  584. java/pkg2/sun/io/CharToByteConverter.java +0 −0
  585. java/pkg2/sun/io/CharToByteConverter_L.b +226 −0
  586. java/pkg2/sun/io/CharToByteConverter_L.m +26 −0
  587. java/pkg2/sun/io/ConversionBufferFullExc..a +0 −0
  588. java/pkg2/sun/io/Cvt8859_1.b +236 −0
  589. java/pkg2/sun/io/CvtDefault.b +124 −0
  590. java/pkg2/sun/io/MalformedInputException..a +0 −0
  591. java/pkg2/sun/io/UnknownCharacterExcepti..a +0 −0
  592. java/pkg2/sun/io/converter.m +99 −0
  593. java/pkg2/sun/io/encoderalias.b +435 −0
  594. java/pkg2/sun/io/mkfile +56 −0
  595. java/pkg2/sun/misc/REException.java +0 −0
  596. java/pkg2/sun/misc/Ref.java +0 −0
  597. java/pkg2/sun/misc/Regexp.java +0 −0
  598. java/pkg2/sun/misc/RegexpPool.java +0 −0
  599. java/pkg2/sun/misc/RegexpTarget.java +0 −0
  600. java/pkg2/sun/misc/mkfile +16 −0
  601. java/pkg2/sun/mkfile +10 −0
  602. java/pkg2/sun/net/NetworkClient.java +0 −0
  603. java/pkg2/sun/net/ProgressData.java +0 −0
  604. java/pkg2/sun/net/ProgressEntry.java +0 −0
  605. java/pkg2/sun/net/TransferProtocolClient.java +0 −0
  606. java/pkg2/sun/net/URLCanonicalizer.java +0 −0
  607. java/pkg2/sun/net/mkfile +20 −0
  608. java/pkg2/sun/net/www/ApplicationLaunchExcept..a +0 −0
  609. java/pkg2/sun/net/www/HeaderParser.java +0 −0
  610. java/pkg2/sun/net/www/MessageHeader.java +0 −0
  611. java/pkg2/sun/net/www/MeteredStream.java +0 −0
  612. java/pkg2/sun/net/www/MimeEntry.java +337 −0
  613. java/pkg2/sun/net/www/MimeLauncher.java +0 −0
  614. java/pkg2/sun/net/www/MimeTable.java +429 −0
  615. java/pkg2/sun/net/www/URLConnection.java +0 −0
  616. java/pkg2/sun/net/www/http/HttpClient.java +0 −0
  617. java/pkg2/sun/net/www/http/KeepAliveCache.java +0 −0
  618. java/pkg2/sun/net/www/http/KeepAliveStream.java +0 −0
  619. java/pkg2/sun/net/www/http/mkfile +18 −0
  620. java/pkg2/sun/net/www/mkfile +24 −0
  621. java/pkg2/sun/net/www/protocol/http/AuthenticationInfo.java +0 −0
  622. java/pkg2/sun/net/www/protocol/http/Handler.java +0 −0
  623. java/pkg2/sun/net/www/protocol/http/HttpAuthenticator.java +0 −0
  624. java/pkg2/sun/net/www/protocol/http/HttpURLConnection.java +0 −0
  625. java/pkg2/sun/net/www/protocol/http/mkfile +15 −0
  626. java/pkg2/sun/net/www/protocol/mkfile +6 −0
  627. java/pkg2/sun/security/mkfile +6 −0
  628. java/pkg2/sun/security/provider/SHA.java +0 −0
  629. java/pkg2/sun/security/provider/Sun.java +0 −0
  630. java/pkg2/sun/security/provider/mkfile +9 −0
  631. java/pkg2/sunw/awt/ActionInputPreferred.java +0 −0
  632. java/pkg2/sunw/awt/DoubleBuffering.java +0 −0
  633. java/pkg2/sunw/awt/KeyboardInputPreferred.java +0 −0
  634. java/pkg2/sunw/awt/NoInputPreferred.java +0 −0
  635. java/pkg2/sunw/awt/PositionalInputPreferre..a +0 −0
  636. java/pkg2/sunw/awt/mkfile +20 −0
  637. java/pkg2/sunw/lang/UnsupportedOperationExc..a +0 −0
  638. java/pkg2/sunw/lang/mkfile +12 −0
  639. java/pkg2/sunw/mkfile +8 −0
  640. java/pkg2/sunw/util/DefaultTimer.java +0 −0
  641. java/pkg2/sunw/util/PTimer.java +0 −0
  642. java/pkg2/sunw/util/PTimerSpec.java +0 −0
  643. java/pkg2/sunw/util/PTimerWentOffEvent.java +0 −0
  644. java/pkg2/sunw/util/PTimerWentOffListener.java +0 −0
  645. java/pkg2/sunw/util/mkfile +16 −0
java/pkg2/README+1−0
@@ -0,0 +1 @@
1+This is the old java package folder. Most of the java files here are empty, as they were protected by the sun copyright and are not allowed in open-source. So, this folder is currently just for referense.
java/pkg2/inferno/awt/awt_Color.b+338−0
@@ -0,0 +1,338 @@
1+#
2+# %W% - %E%
3+#
4+
5+implement AwtColor;
6+
7+include "jni.m";
8+ jni : JNI;
9+ ClassModule,
10+ JString,
11+ JArray,
12+ JArrayI,
13+ JArrayC,
14+ JArrayB,
15+ JArrayS,
16+ JArrayJ,
17+ JArrayF,
18+ JArrayD,
19+ JArrayZ,
20+ JArrayJObject,
21+ JArrayJClass,
22+ JArrayJString,
23+ JClass,
24+ JThread,
25+ Value,
26+ sys,
27+ FALSE,
28+ JObject : import jni;
29+
30+ draw: Draw;
31+ Context, Display, Image: import draw;
32+
33+include "java/lang/ClassLoader_L.m";
34+include "awt_Color.m";
35+
36+ctxt : ref Context;
37+systemcolors_file := "/java/lib/systemcolor.properties";
38+
39+rgbvmap := array[3*256] of {
40+ byte 255,byte 255,byte 255, byte 255,byte 255,byte 170,
41+ byte 255,byte 255,byte 85, byte 255,byte 255,byte 0,
42+ byte 255,byte 170,byte 255, byte 255,byte 170,byte 170,
43+ byte 255,byte 170,byte 85, byte 255,byte 170,byte 0,
44+ byte 255,byte 85,byte 255, byte 255,byte 85,byte 170,
45+ byte 255,byte 85,byte 85, byte 255,byte 85,byte 0,
46+ byte 255,byte 0,byte 255, byte 255,byte 0,byte 170,
47+ byte 255,byte 0,byte 85, byte 255,byte 0,byte 0,
48+ byte 238,byte 0,byte 0, byte 238,byte 238,byte 238,
49+ byte 238,byte 238,byte 158, byte 238,byte 238,byte 79,
50+ byte 238,byte 238,byte 0, byte 238,byte 158,byte 238,
51+ byte 238,byte 158,byte 158, byte 238,byte 158,byte 79,
52+ byte 238,byte 158,byte 0, byte 238,byte 79,byte 238,
53+ byte 238,byte 79,byte 158, byte 238,byte 79,byte 79,
54+ byte 238,byte 79,byte 0, byte 238,byte 0,byte 238,
55+ byte 238,byte 0,byte 158, byte 238,byte 0,byte 79,
56+ byte 221,byte 0,byte 73, byte 221,byte 0,byte 0,
57+ byte 221,byte 221,byte 221, byte 221,byte 221,byte 147,
58+ byte 221,byte 221,byte 73, byte 221,byte 221,byte 0,
59+ byte 221,byte 147,byte 221, byte 221,byte 147,byte 147,
60+ byte 221,byte 147,byte 73, byte 221,byte 147,byte 0,
61+ byte 221,byte 73,byte 221, byte 221,byte 73,byte 147,
62+ byte 221,byte 73,byte 73, byte 221,byte 73,byte 0,
63+ byte 221,byte 0,byte 221, byte 221,byte 0,byte 147,
64+ byte 204,byte 0,byte 136, byte 204,byte 0,byte 68,
65+ byte 204,byte 0,byte 0, byte 204,byte 204,byte 204,
66+ byte 204,byte 204,byte 136, byte 204,byte 204,byte 68,
67+ byte 204,byte 204,byte 0, byte 204,byte 136,byte 204,
68+ byte 204,byte 136,byte 136, byte 204,byte 136,byte 68,
69+ byte 204,byte 136,byte 0, byte 204,byte 68,byte 204,
70+ byte 204,byte 68,byte 136, byte 204,byte 68,byte 68,
71+ byte 204,byte 68,byte 0, byte 204,byte 0,byte 204,
72+ byte 170,byte 255,byte 170, byte 170,byte 255,byte 85,
73+ byte 170,byte 255,byte 0, byte 170,byte 170,byte 255,
74+ byte 187,byte 187,byte 187, byte 187,byte 187,byte 93,
75+ byte 187,byte 187,byte 0, byte 170,byte 85,byte 255,
76+ byte 187,byte 93,byte 187, byte 187,byte 93,byte 93,
77+ byte 187,byte 93,byte 0, byte 170,byte 0,byte 255,
78+ byte 187,byte 0,byte 187, byte 187,byte 0,byte 93,
79+ byte 187,byte 0,byte 0, byte 170,byte 255,byte 255,
80+ byte 158,byte 238,byte 238, byte 158,byte 238,byte 158,
81+ byte 158,byte 238,byte 79, byte 158,byte 238,byte 0,
82+ byte 158,byte 158,byte 238, byte 170,byte 170,byte 170,
83+ byte 170,byte 170,byte 85, byte 170,byte 170,byte 0,
84+ byte 158,byte 79,byte 238, byte 170,byte 85,byte 170,
85+ byte 170,byte 85,byte 85, byte 170,byte 85,byte 0,
86+ byte 158,byte 0,byte 238, byte 170,byte 0,byte 170,
87+ byte 170,byte 0,byte 85, byte 170,byte 0,byte 0,
88+ byte 153,byte 0,byte 0, byte 147,byte 221,byte 221,
89+ byte 147,byte 221,byte 147, byte 147,byte 221,byte 73,
90+ byte 147,byte 221,byte 0, byte 147,byte 147,byte 221,
91+ byte 153,byte 153,byte 153, byte 153,byte 153,byte 76,
92+ byte 153,byte 153,byte 0, byte 147,byte 73,byte 221,
93+ byte 153,byte 76,byte 153, byte 153,byte 76,byte 76,
94+ byte 153,byte 76,byte 0, byte 147,byte 0,byte 221,
95+ byte 153,byte 0,byte 153, byte 153,byte 0,byte 76,
96+ byte 136,byte 0,byte 68, byte 136,byte 0,byte 0,
97+ byte 136,byte 204,byte 204, byte 136,byte 204,byte 136,
98+ byte 136,byte 204,byte 68, byte 136,byte 204,byte 0,
99+ byte 136,byte 136,byte 204, byte 136,byte 136,byte 136,
100+ byte 136,byte 136,byte 68, byte 136,byte 136,byte 0,
101+ byte 136,byte 68,byte 204, byte 136,byte 68,byte 136,
102+ byte 136,byte 68,byte 68, byte 136,byte 68,byte 0,
103+ byte 136,byte 0,byte 204, byte 136,byte 0,byte 136,
104+ byte 85,byte 255,byte 85, byte 85,byte 255,byte 0,
105+ byte 85,byte 170,byte 255, byte 93,byte 187,byte 187,
106+ byte 93,byte 187,byte 93, byte 93,byte 187,byte 0,
107+ byte 85,byte 85,byte 255, byte 93,byte 93,byte 187,
108+ byte 119,byte 119,byte 119, byte 119,byte 119,byte 0,
109+ byte 85,byte 0,byte 255, byte 93,byte 0,byte 187,
110+ byte 119,byte 0,byte 119, byte 119,byte 0,byte 0,
111+ byte 85,byte 255,byte 255, byte 85,byte 255,byte 170,
112+ byte 79,byte 238,byte 158, byte 79,byte 238,byte 79,
113+ byte 79,byte 238,byte 0, byte 79,byte 158,byte 238,
114+ byte 85,byte 170,byte 170, byte 85,byte 170,byte 85,
115+ byte 85,byte 170,byte 0, byte 79,byte 79,byte 238,
116+ byte 85,byte 85,byte 170, byte 102,byte 102,byte 102,
117+ byte 102,byte 102,byte 0, byte 79,byte 0,byte 238,
118+ byte 85,byte 0,byte 170, byte 102,byte 0,byte 102,
119+ byte 102,byte 0,byte 0, byte 79,byte 238,byte 238,
120+ byte 73,byte 221,byte 221, byte 73,byte 221,byte 147,
121+ byte 73,byte 221,byte 73, byte 73,byte 221,byte 0,
122+ byte 73,byte 147,byte 221, byte 76,byte 153,byte 153,
123+ byte 76,byte 153,byte 76, byte 76,byte 153,byte 0,
124+ byte 73,byte 73,byte 221, byte 76,byte 76,byte 153,
125+ byte 85,byte 85,byte 85, byte 85,byte 85,byte 0,
126+ byte 73,byte 0,byte 221, byte 76,byte 0,byte 153,
127+ byte 85,byte 0,byte 85, byte 85,byte 0,byte 0,
128+ byte 68,byte 0,byte 0, byte 68,byte 204,byte 204,
129+ byte 68,byte 204,byte 136, byte 68,byte 204,byte 68,
130+ byte 68,byte 204,byte 0, byte 68,byte 136,byte 204,
131+ byte 68,byte 136,byte 136, byte 68,byte 136,byte 68,
132+ byte 68,byte 136,byte 0, byte 68,byte 68,byte 204,
133+ byte 68,byte 68,byte 136, byte 68,byte 68,byte 68,
134+ byte 68,byte 68,byte 0, byte 68,byte 0,byte 204,
135+ byte 68,byte 0,byte 136, byte 68,byte 0,byte 68,
136+ byte 0,byte 255,byte 0, byte 0,byte 170,byte 255,
137+ byte 0,byte 187,byte 187, byte 0,byte 187,byte 93,
138+ byte 0,byte 187,byte 0, byte 0,byte 85,byte 255,
139+ byte 0,byte 93,byte 187, byte 0,byte 119,byte 119,
140+ byte 0,byte 119,byte 0, byte 0,byte 0,byte 255,
141+ byte 0,byte 0,byte 187, byte 0,byte 0,byte 119,
142+ byte 51,byte 51,byte 51, byte 0,byte 255,byte 255,
143+ byte 0,byte 255,byte 170, byte 0,byte 255,byte 85,
144+ byte 0,byte 238,byte 79, byte 0,byte 238,byte 0,
145+ byte 0,byte 158,byte 238, byte 0,byte 170,byte 170,
146+ byte 0,byte 170,byte 85, byte 0,byte 170,byte 0,
147+ byte 0,byte 79,byte 238, byte 0,byte 85,byte 170,
148+ byte 0,byte 102,byte 102, byte 0,byte 102,byte 0,
149+ byte 0,byte 0,byte 238, byte 0,byte 0,byte 170,
150+ byte 0,byte 0,byte 102, byte 34,byte 34,byte 34,
151+ byte 0,byte 238,byte 238, byte 0,byte 238,byte 158,
152+ byte 0,byte 221,byte 147, byte 0,byte 221,byte 73,
153+ byte 0,byte 221,byte 0, byte 0,byte 147,byte 221,
154+ byte 0,byte 153,byte 153, byte 0,byte 153,byte 76,
155+ byte 0,byte 153,byte 0, byte 0,byte 73,byte 221,
156+ byte 0,byte 76,byte 153, byte 0,byte 85,byte 85,
157+ byte 0,byte 85,byte 0, byte 0,byte 0,byte 221,
158+ byte 0,byte 0,byte 153, byte 0,byte 0,byte 85,
159+ byte 17,byte 17,byte 17, byte 0,byte 221,byte 221,
160+ byte 0,byte 204,byte 204, byte 0,byte 204,byte 136,
161+ byte 0,byte 204,byte 68, byte 0,byte 204,byte 0,
162+ byte 0,byte 136,byte 204, byte 0,byte 136,byte 136,
163+ byte 0,byte 136,byte 68, byte 0,byte 136,byte 0,
164+ byte 0,byte 68,byte 204, byte 0,byte 68,byte 136,
165+ byte 0,byte 68,byte 68, byte 0,byte 68,byte 0,
166+ byte 0,byte 0,byte 204, byte 0,byte 0,byte 136,
167+ byte 0,byte 0,byte 68, byte 0,byte 0,byte 0,
168+};
169+
170+modinit(jni_p : JNI)
171+{
172+ if (ctxt != nil)
173+ return;
174+
175+ jni = jni_p;
176+ sys = jni->sys;
177+ ctxt = jni->getContext();
178+ if (ctxt == nil)
179+ jni->ThrowException("java.awt.AWTError", "can't get Draw Context");
180+ draw = load Draw Draw->PATH;
181+
182+}
183+
184+getColor(jni_p: JNI, c: JObject) : ref Image
185+{
186+ modinit(jni_p);
187+
188+ cm_index := getColorIndex(jni_p, c);
189+ # (red, green, blue) := ctxt.display.cmap2rgb(cm_index);
190+ # sys->print("Inferno color: red=%d, green=%d, blue=%d\n", red, green, blue);
191+ col := ctxt.display.color(cm_index);
192+ return col;
193+}
194+
195+getColorIndex(jni_p: JNI, c: JObject) : int
196+{
197+ modinit(jni_p);
198+
199+ if (c == nil) {
200+ sys->print("getColorIndex: null Color object\n");
201+ return 0;
202+ }
203+
204+ val := jni->GetObjField( c, "pData", "I" );
205+ if ( val == nil )
206+ sys->print( "getColorIndex: Couldn't get pData field from color object.\n" );
207+ else {
208+ pdata := val.Int();
209+ if (pdata != 0) {
210+ # sys->print("Using pData. pData = %d\n", pdata);
211+ return pdata - 1;
212+ }
213+ }
214+
215+ (ret, err) := jni->CallMethod(c, "getRGB", "()I", nil);
216+ if (err != jni->OK)
217+ jni->FatalError("awt_Color couldn't get RGB values of color");
218+
219+ rgb := ret.Int();
220+ r := (rgb >> 16) & 255;
221+ g := (rgb >> 8) & 255;
222+ b := (rgb >> 0) & 255;
223+ cm_index := ctxt.display.rgb2cmap(r,g,b);
224+ # sys->print( "rgb: %d\n", rgb);
225+ # sys->print( "red: %d; green: %d; blue %d\n", r, g, b);
226+ # sys->print("Color map index is %d.\n", cm_index);
227+
228+ # sys->print("Setting pData to %d\n", cm_index+1);
229+ val = ref Value.TInt(cm_index+1);
230+ err = jni->SetObjField( c, "pData", val );
231+ if (err != jni->OK)
232+ sys->print("getColorIndex: Couldn't set Color pData field\n");
233+
234+ return cm_index;
235+}
236+
237+makeColorModel(jni_p: JNI, bits: int) : JObject
238+{
239+ modinit(jni_p);
240+
241+ cast := jni->CastMod();
242+ jbary := jni->MkAByte(rgbvmap);
243+ arraylen := len jbary.ary;
244+ # sys->print("makeColorModel: Array length is %d.\n", arraylen);
245+
246+ args := array[5] of ref Value;
247+ args[0] = ref Value.TInt(bits);
248+ args[1] = ref Value.TInt(256);
249+ args[2] = ref Value.TObject(cast->FromJArray(cast->ByteToJArray(jbary)));
250+ args[3] = ref Value.TInt(0);
251+ args[4] = ref Value.TBoolean(jni->FALSE);
252+
253+ cl_data := jni->FindClass("java/awt/image/IndexColorModel");
254+ if (cl_data == nil)
255+ jni->FatalError("awt_Color couldn't load java/awt/image/IndexColorModel");
256+ jobj := jni->AllocObject(cl_data);
257+ (ret, err) := jni->CallMethod(jobj, "<init>", "(II[BIZ)V", args);
258+
259+ if (err != jni->OK)
260+ jni->FatalError("awt_Color couldn't create IndexColorModel");
261+
262+ system_flag := ref Value.TInt(1);
263+ err = jni->SetObjField( jobj, "pData", system_flag );
264+ if (err != jni->OK)
265+ sys->print("makeColorModel: Couldn't set ColorModel pData field to 1\n");
266+
267+ return jobj;
268+}
269+
270+
271+loadSystemColors(jni_p: JNI, systemColors: JArrayI)
272+{
273+ val : ref Value;
274+
275+ modinit(jni_p);
276+
277+ cl := jni->GetClassObject(jni->FindClass("java/awt/SystemColor"));
278+ if (cl == nil)
279+ jni->FatalError("iToolkit_L couldn't load java/awt/SystemColor");
280+ val = jni->GetStaticField( cl.class, "NUM_COLORS", "I" );
281+ if ( val == nil ) {
282+ sys->print( "loadSystemColors: Couldn't get NUM_COLORS field from SystemColor class.\n" );
283+ return;
284+ }
285+
286+ num_colors := val.Int();
287+ # sys->print("Using GetStaticField: NUM_COLORS = %d\n", num_colors);
288+
289+ lines := readfile(systemcolors_file);
290+ if (lines == nil) {
291+ sys->print( "loadSystemColors: Couldn't read %s\n", systemcolors_file);
292+ return;
293+ }
294+ for(; lines != nil; lines = tl lines) {
295+ line := hd lines;
296+ (n, l) := sys->tokenize(line, " \t=");
297+ if (n < 2 || line[0] == '#')
298+ continue;
299+ key := hd l;
300+ line = hd tl l;
301+ (n, l) = sys->tokenize(line, ";");
302+ if (n != 3)
303+ continue;
304+ r := int hd l;
305+ g := int hd tl l;
306+ b := int hd tl tl l;
307+ # sys->print(" key = %s: r = %d; g = %d; b = %d\n", key, r, g, b);
308+ val = jni->GetStaticField( cl.class, key, "I" );
309+ if ( val == nil )
310+ continue;
311+ index := val.Int();
312+ color := (255 << 24) | ((r & 255) << 16) | ((g & 255) << 8) | ((b & 255) << 0);
313+ systemColors.ary[index] = color;
314+ }
315+
316+ return;
317+}
318+
319+
320+# read a file and return its lines as a list of strings
321+readfile(filename: string) : list of string
322+{
323+ fd := sys->open(filename, sys->OREAD);
324+ if(fd != nil) {
325+ (n, dir) := sys->fstat(fd);
326+ if(n < 0)
327+ return nil; # shouldn't happen
328+ buf := array[dir.length] of byte;
329+ n = sys->read(fd, buf, dir.length);
330+ if(n == dir.length) {
331+ (nil, linelist) := sys->tokenize(string buf[0:n], "\r\n");
332+ return linelist;
333+ }
334+ }
335+ return nil;
336+}
337+
338+
java/pkg2/inferno/awt/awt_Color.m+13−0
@@ -0,0 +1,13 @@
1+#
2+# %W% - %E%
3+#
4+
5+AwtColor : module
6+{
7+ PATH : con "/dis/java/inferno/awt/awt_Color.dis";
8+
9+ getColor : fn(jni: JNI, c: JObject) : ref Image;
10+ getColorIndex : fn(jni: JNI, c: JObject) : int;
11+ makeColorModel : fn(jni: JNI, bits: int) : JObject;
12+ loadSystemColors : fn(jni: JNI, systemColors: JArrayI);
13+};
java/pkg2/inferno/awt/awt_Frame.b+250−0
@@ -0,0 +1,250 @@
1+#
2+# %W% - %E%
3+#
4+
5+implement FrameManager;
6+
7+include "sys.m";
8+ sys: Sys;
9+
10+include "string.m";
11+ str: String;
12+
13+include "draw.m";
14+ draw: Draw;
15+ Context, Display, Point, Rect, Image, Screen: import draw;
16+
17+include "tk.m";
18+ tk: Tk;
19+ Toplevel: import tk;
20+
21+include "wmlib.m";
22+ wmlib: Wmlib;
23+
24+include "awt_Frame.m";
25+
26+screen: ref Screen;
27+display: ref Display;
28+ones: ref Image;
29+white: ref Image;
30+nochan: chan of string;
31+tHeight : int;
32+bWidth: int;
33+
34+win_cfg := array[] of {
35+ "canvas .c -height 306 -width 406",
36+ "pack .c -side bottom -fill both -expand 1",
37+# ".c configure -side bottom -fill both -expand 1",
38+ "pack propagate . 0",
39+};
40+
41+win_bind := array[] of {
42+ "bind # <Motion> {send butt m %b %X %Y}",
43+ "bind # <Leave> {send butt Leave}",
44+# "bind # <ButtonPress> {focus #; send foc focus; send butt p %b %X %Y}",
45+ "bind # <ButtonPress> {focus #; send butt p %b %X %Y}",
46+ "bind # <ButtonRelease> {send butt r %b %X %Y}",
47+ "bind # <Double-Button> {send butt d %b %X %Y}",
48+ "bind # <Enter> {send butt Enter}",
49+ "bind # <KeyPress> {send key %K}",
50+# "bind . <FocusIn> {send foc focus}",
51+# "bind .Wm_t <Button-1> +{focus #; send foc focus}",
52+ "bind .Wm_t <Button-1> +{focus #}",
53+# "bind .Wm_t.title <Button-1> +{focus #; send foc focus}",
54+ "bind .Wm_t.title <Button-1> +{focus #}",
55+};
56+
57+modinit(ctxt: ref Context)
58+{
59+ if (sys != nil)
60+ return;
61+
62+ sys = load Sys Sys->PATH;
63+ str = load String String->PATH;
64+ draw = load Draw Draw->PATH;
65+ tk = load Tk Tk->PATH;
66+ wmlib = load Wmlib Wmlib->PATH;
67+ nochan = chan of string;
68+
69+ display = ctxt.display;
70+ screen = ctxt.screen;
71+ ones = display.ones;
72+ white = display.color(Draw->White);
73+
74+ wmlib->init();
75+}
76+showwin(cv : ref Canvas)
77+{
78+ tk->cmd(cv.top, "pack " + cv.canvas);
79+}
80+makewin(ctxt: ref Context, title: string, x, y, width, height: int): ref Canvas
81+{
82+ modinit(ctxt);
83+ where := "-x " + string x + " -y " + string y;
84+ (t, menu) := wmlib->titlebar(screen, where, title, Wmlib->Appl);
85+
86+# calculate topInset and boardwidth
87+ bWidth = int tk->cmd(t, ". cget -bd");
88+ tHeight = int tk->cmd(t, ". cget -height");
89+
90+
91+
92+ if (width > 0 && height > 0)
93+ win_cfg[0] = "canvas .c -height " + string (height - tHeight - bWidth) +
94+ " -width " + string (width - 2*bWidth);
95+
96+# win_cfg[0] = "canvas .c -height " + string height + " -width " + string width;
97+
98+ wmlib->tkcmds(t, win_cfg);
99+ return alloccanvas(t, ctxt, ".c", menu);
100+}
101+
102+resizewin(cv: ref Canvas, x, y, width, height : int)
103+{
104+}
105+
106+alloccanvas(t: ref Toplevel, ctxt: ref Draw->Context, canvas: string, menu: chan of string): ref Canvas
107+{
108+ cmd := chan of string;
109+ tk->namechan(t, cmd, "cmd");
110+ butt := chan of string;
111+ tk->namechan(t, butt, "butt");
112+# mouse := chan of string;
113+# tk->namechan(t, mouse, "mouse");
114+
115+ key := chan of string;
116+ tk->namechan(t, key, "key");
117+
118+ foc := chan of string;
119+ tk->namechan(t, foc, "foc");
120+
121+ tk->cmd(t, "bind . <Configure> {send cmd resize}");
122+ tk->cmd(t, "bind . <Map> {send cmd map}");
123+
124+ for (i := 0; i < len win_bind; i++)
125+ tk->cmd(t, expand(win_bind[i], canvas));
126+
127+ tk->cmd(t, "update");
128+
129+ c := ref Canvas;
130+ display = ctxt.display;
131+ c.image = display.image;
132+ c.rect = canvposn(t, canvas);
133+ c.buf = display.newimage(c.image.r, c.image.ldepth , 0, Draw->White);
134+ c.events = chan of ref Event;
135+ c.top = t;
136+ c.ctxt = ctxt;
137+ c.canvas = canvas;
138+ c.pid = sys->pctl(0, nil);
139+
140+# calculate topInset and boardwidth
141+ y1 := int tk->cmd(t, ". cget -acty") + int tk->cmd(t, ".dy get");
142+ y2 := int tk->cmd(t, ".c cget -acty") + int tk->cmd(t, ".dy get");
143+
144+# tHeight = int tk->cmd(t, ".Wm_t cget -actheight");
145+ tHeight = y2 - y1;
146+ bWidth = int tk->cmd(t, ". cget -bd");
147+
148+ paint(c, c_canvposn(t, canvas));
149+ spawn handler(c, menu, cmd, butt, key, foc);
150+ return c;
151+}
152+
153+hidewin(c: ref Canvas)
154+{
155+ tk->cmd(c.top, "pack forget " + c.canvas);
156+}
157+
158+handler(c: ref Canvas, menu, cmd, butt, key, foc: chan of string)
159+{
160+ detail: string;
161+ t := c.top;
162+ if (menu == nil)
163+ menu = nochan;
164+ for (;;) alt {
165+ detail = <- menu =>
166+ case detail {
167+ "exit" =>
168+ c.events <- = ref Event(Event.Shutdown, nil);
169+ "task" =>
170+ c.events <- = ref Event(Event.Icon, nil);
171+# "move" =>
172+# sys->print("===== moving \n");
173+ * =>
174+ ;
175+ }
176+ wmlib->titlectl(c.top, detail);
177+
178+ detail = <- cmd =>
179+ (n, word) := sys->tokenize(detail, " ");
180+ case hd word {
181+ "resize" or "map" =>
182+ c.rect = canvposn(t, c.canvas);
183+ paint(c, c_canvposn(t, c.canvas));
184+ e := Event.Resize;
185+ if (hd word == "map") {
186+ e = Event.DeIcon;
187+ tk->cmd(t, "focus " + c.canvas);
188+ }
189+ c.events <- = ref Event(e, nil);
190+ * =>
191+ ;
192+ }
193+ detail = <- butt =>
194+
195+ c.events <- = ref Event(Event.Button, detail);
196+ detail = <- key =>
197+ c.events <- = ref Event(Event.Key, detail);
198+# detail = <- foc =>
199+# c.events <- = ref Event(Event.Focus, detail);
200+
201+ }
202+}
203+
204+expand(cmd, canvas: string): string
205+{
206+ s: string;
207+ for (;;) {
208+ (l, r) := str->splitl(cmd, "#");
209+ s = s + l;
210+ if (r == nil)
211+ return s;
212+ s = s + canvas;
213+ cmd = r[1:];
214+ }
215+}
216+
217+paint(c: ref Canvas, r: Rect)
218+{
219+ c.image.draw(r, white, ones, (0, 0));
220+}
221+
222+c_canvposn(t: ref Toplevel, c: string): Rect
223+{
224+ r: Rect;
225+
226+ r.min.x = int tk->cmd(t, c + " cget -actx") + int tk->cmd(t, ".dx get");
227+ r.min.y = int tk->cmd(t, c + " cget -acty") + int tk->cmd(t, ".dy get");
228+ r.max.x = r.min.x + int tk->cmd(t, c + " cget -actwidth") + int tk->cmd(t, ".dw get");
229+ r.max.y = r.min.y + int tk->cmd(t, c + " cget -actheight") + int tk->cmd(t, ".dh get");
230+ return r;
231+}
232+canvposn(t: ref Toplevel, c: string): Rect
233+{
234+ r: Rect;
235+
236+ r.min.x = int tk->cmd(t, ". cget -actx") + int tk->cmd(t, ".dx get");
237+ r.min.y = int tk->cmd(t, ". cget -acty") + int tk->cmd(t, ".dy get");
238+ r.max.x = r.min.x + int tk->cmd(t, ". cget -actwidth") + int tk->cmd(t, ".dw get");
239+ r.max.y = r.min.y + int tk->cmd(t, ". cget -actheight") + int tk->cmd(t, ".dh get");
240+ return r;
241+}
242+getInsets(): (int, int)
243+{
244+ return (bWidth, tHeight);
245+}
246+
247+mapCanvas(dimg : ref Image, wimg : ref Image)
248+{
249+ dimg.draw(dimg.r, wimg, ones, dimg.r.min);
250+}
java/pkg2/inferno/awt/awt_Frame.m+46−0
@@ -0,0 +1,46 @@
1+#
2+# %W% - %E%
3+#
4+
5+FrameManager: module
6+{
7+ PATH: con "/dis/java/inferno/awt/awt_Frame.dis";
8+
9+ Event: adt
10+ {
11+ event: int;
12+ detail: string;
13+
14+ Button, Key,
15+ Icon, DeIcon,
16+ Resize, Shutdown, Focus
17+ : con iota;
18+ };
19+
20+ Attr: adt
21+ {
22+ origin: Draw->Point;
23+ dims: Draw->Point;
24+ };
25+
26+ Canvas: adt
27+ {
28+ # interface
29+ image: ref Draw->Image;
30+ buf: ref Draw->Image;
31+ rect: Draw->Rect;
32+ events: chan of ref Event;
33+ attr: ref Attr;
34+ # implementation
35+ ctxt : ref Draw->Context;
36+ top: ref Tk->Toplevel;
37+ canvas: string;
38+ pid: int;
39+ };
40+
41+ makewin: fn(ctxt: ref Draw->Context, title: string, x, y, width, height: int): ref Canvas;
42+ resizewin: fn(cv: ref Canvas, x, y, width, height : int);
43+ hidewin: fn(c: ref Canvas);
44+ getInsets: fn(): (int, int);
45+ mapCanvas : fn(dimg : ref Draw->Image, wimg : ref Draw->Image);
46+};
java/pkg2/inferno/awt/awt_Graphics.b+209−0
@@ -0,0 +1,209 @@
1+#
2+# %W% - %E%
3+#
4+implement AwtGraphics;
5+
6+include "sys.m";
7+ sys : Sys;
8+
9+include "draw.m";
10+ draw: Draw;
11+ Screen, Display, Rect, Font, Point, Image: import draw;
12+
13+include "math.m";
14+ math: Math;
15+ Pi, atan, tan: import math;
16+
17+disp : ref Display;
18+wimg, dimg, white, ones, icolor : ref Image;
19+
20+include "awt_Graphics.m";
21+
22+init(img : ref Image, bufimg : ref Image){
23+ sys = load Sys Sys->PATH;
24+ draw = load Draw Draw->PATH;
25+ math = load Math Math->PATH;
26+ dimg = img;
27+ wimg = bufimg;
28+ disp = wimg.display;
29+ ones = disp.ones;
30+ icolor = disp.color(Draw->White);
31+ white = disp.color(Draw->White);
32+}
33+
34+undoClip()
35+{
36+ wimg.clipr = wimg.r;
37+}
38+
39+dispose()
40+{
41+ dimg = nil;
42+ wimg = nil;
43+}
44+setForeground(p0, p1, p2 : int)
45+{
46+ icolor = disp.rgb(p0, p1, p2);
47+}
48+
49+changeClip(p0, p1, p2, p3 : int)
50+{
51+# sys->print("=== Change Cliping Area\n");
52+ wimg.clipr = ((p0, p1), (p0 + p2 - 1, p1 + p3 -1));
53+}
54+
55+clearRect( p0 : int,p1 : int,p2 : int,p3 : int)
56+{
57+ r := ((p0, p1), (p0 + p2 - 1, p1 + p3 - 1));
58+ wimg.draw(r, white, ones, (0, 0));
59+}
60+
61+fillRect(ply: array of Point)
62+{
63+ wimg.fillpoly(ply, 1, icolor, ply[0]);
64+}
65+
66+drawRect(ply: array of Point)
67+{
68+ wimg.poly(ply, 0, 0, 0, icolor, ply[0]);
69+}
70+
71+drawStringWidth(txt : string, sp : Point, font : ref Font) : int
72+{
73+ ep := wimg.text(sp, icolor, sp, font, txt);
74+ return(ep.x-sp.x);
75+
76+}
77+
78+drawLine(sp, ep : Point)
79+{
80+ wimg.line(sp, ep, 0, 0, 0, icolor, sp);
81+}
82+
83+genDraw(r : Rect, data : array of byte)
84+{
85+ wimg.writepixels(r, data);
86+}
87+
88+copyArea(rect0, rect1 : Draw->Rect, data : array of byte)
89+{
90+ wimg.readpixels(rect0, data);
91+ wimg.writepixels(rect1, data);
92+}
93+
94+drawRoundRect(p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int)
95+{
96+}
97+
98+fillRoundRect(p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int)
99+{
100+}
101+
102+drawPolygon(ply : array of Point)
103+{
104+ wimg.poly(ply, 0, 0, 0, icolor, icolor.r.min);
105+}
106+
107+drawPolyline(ply : array of Point)
108+{
109+ wimg.poly(ply, 0, 0, 0, icolor, icolor.r.min);
110+}
111+
112+fillPolygon(ply : array of Point)
113+{
114+ wimg.fillpoly(ply, 1, icolor, icolor.r.min);
115+}
116+
117+drawOval(p : Point, p2 : int,p3 : int)
118+{
119+ p.x += p2 / 2;
120+ p.y += p3 / 2;
121+ wimg.ellipse(p, p2/2, p3/2, 0, icolor, p);
122+}
123+
124+fillOval(p: Point, p2 : int,p3 : int)
125+{
126+ p.x += p2 / 2;
127+ p.y += p3 / 2;
128+ wimg.fillellipse(p, p2/2, p3/2, icolor, p);
129+}
130+
131+drawArc(p : Point, p2 : int,p3 : int,p4 : int,p5 : int)
132+{
133+ p.x += p2 / 2;
134+ p.y += p3 / 2;
135+ (p4, p5) = adjustArcAngles(p2, p3, p4, p5);
136+ wimg.arc(p, p2/2, p3/2, 0, icolor, p, p4, p5);
137+}
138+
139+fillArc(p : Point, p2 : int,p3 : int,p4 : int,p5 : int)
140+{
141+ p.x += p2 / 2;
142+ p.y += p3 / 2;
143+ (p4, p5) = adjustArcAngles(p2, p3, p4, p5);
144+ wimg.fillarc(p, p2/2, p3/2, icolor, p, p4, p5);
145+}
146+
147+adjustArcAngles(w, h, start, arc: int): (int, int)
148+{
149+ laps, end: int;
150+
151+ if (arc >= 360 || arc <= -360) {
152+ start = 0;
153+ arc = 360;
154+ } else
155+ start = start % 360;
156+
157+ if (w != h && arc != 0 && arc != 360) {
158+ laps = (start + arc) / 360;
159+ end = (start + arc) % 360;
160+ start = skewAngle(w, h, start);
161+ end = skewAngle(w, h, end);
162+ arc = end - start + (laps * 360);
163+ }
164+ return (start, arc);
165+}
166+
167+skewAngle(width, height, angle: int): int
168+{
169+ if (width == 0 || height == 0)
170+ return angle;
171+
172+ normAngle := real angle * (2.0 * Pi) / 360.0;
173+
174+ w := real width;
175+ h := real height;
176+ skewedAngle := h/w * tan(normAngle);
177+ skewedAngle = atan(skewedAngle);
178+
179+ if (normAngle > 1.5 * Pi)
180+ skewedAngle += 2.0 * Pi;
181+ else if (normAngle > 0.5 * Pi)
182+ skewedAngle += Pi;
183+ else if (normAngle < -1.5 * Pi)
184+ skewedAngle -= 2.0 * Pi;
185+ else if (normAngle < -0.5 * Pi)
186+ skewedAngle -= Pi;
187+
188+ skewedAngle = skewedAngle * 360.0 / (2.0 * Pi);
189+ return int skewedAngle;
190+}
191+
192+sendToDisplay(r : Draw->Rect)
193+{
194+# if (dimg == nil)
195+# sys->print("on screen image is nil\n");
196+# else
197+ if (dimg != nil)
198+ {
199+ wimg.clipr=r;
200+ dimg.draw(r, wimg, ones, r.min);
201+# dimg.draw(dimg.r, wimg, ones, dimg.r.min);
202+ }
203+}
204+
205+getDC(img: ref Draw->Image, bufimg : ref Draw->Image)
206+{
207+ dimg = img;
208+}
209+
java/pkg2/inferno/awt/awt_Graphics.m+43−0
@@ -0,0 +1,43 @@
1+#
2+# %W% - %E%
3+#
4+AwtGraphics : module
5+{
6+ PATH : con "/dis/java/inferno/awt/awt_Graphics.dis";
7+
8+ init : fn(img : ref Draw->Image, bufimg: ref Draw->Image);
9+
10+ dispose : fn();
11+ setForeground : fn(r, g, b : int);
12+ changeClip : fn(p0, p1, p2, p3 : int);
13+
14+# removeClip : fn();
15+ clearRect : fn( p0 : int,p1 : int,p2 : int,p3 : int);
16+
17+ fillRect : fn(ply: array of Draw->Point);
18+ drawRect : fn(ply: array of Draw->Point);
19+
20+ drawStringWidth: fn(txt : string, sp : Draw->Point, font : ref Draw->Font) : int;
21+ drawLine : fn(sp, ep : Draw->Point);
22+
23+ genDraw : fn(r : Draw->Rect, img : array of byte);
24+
25+ copyArea : fn(rect0, rect1 : Draw->Rect, data : array of byte);
26+
27+ drawRoundRect: fn(p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int);
28+
29+ fillRoundRect: fn(p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int);
30+
31+ drawPolygon : fn(ply : array of Draw->Point);
32+ drawPolyline: fn(ply : array of Draw->Point);
33+ fillPolygon : fn(ply : array of Draw->Point);
34+ drawOval : fn(p : Draw->Point, p2 : int,p3 : int);
35+
36+ fillOval : fn(p: Draw->Point, p2 : int,p3 : int);
37+
38+ drawArc : fn(p : Draw->Point, p2 : int,p3 : int,p4 : int,p5 : int);
39+
40+ fillArc : fn(p : Draw->Point, p2 : int,p3 : int,p4 : int,p5 : int);
41+ sendToDisplay : fn(r : Draw->Rect);
42+ getDC : fn(img: ref Draw->Image, bufimg : ref Draw->Image);
43+};
java/pkg2/inferno/awt/awt_Image.m+36−0
@@ -0,0 +1,36 @@
1+AwtImage : module
2+{
3+ PATH : con "/dis/java/inferno/awt/awt_Image.dis";
4+
5+ #
6+ # Inferno rep of manifest constants defined in
7+ # java.awt.image.ImageObserver (hope they don't change
8+ # in javaland).
9+ ImO_WIDTH: con 1;
10+ ImO_HEIGHT: con 2;
11+ ImO_PROPERTIES: con 4;
12+ ImO_SOMEBITS: con 8;
13+ ImO_FRAMEBITS: con 16;
14+ ImO_ALLBITS: con 32;
15+ ImO_ERROR: con 64;
16+ ImO_ABORT: con 128;
17+
18+ #
19+ # Inferno rep of pixel delivery hints from
20+ # java.awt.image.ImageConsumer.
21+ #
22+ ImC_RANDOMPIXELORDER: con 1;
23+ ImC_TOPDOWNLEFTRIGHT: con 2;
24+ ImC_COMPLETESCANLINES: con 4;
25+ ImC_SINGLEPASS: con 8;
26+ ImC_SINGLEFRAME: con 16;
27+
28+ #
29+ # Inferno rep of imageComplete status bits
30+ # java.awt.image.ImageConsumer.
31+ #
32+ ImC_IMAGEERROR: con 1;
33+ ImC_SINGLFRAMEDONE: con 2;
34+ ImC_STATICIMAGEDONE: con 3;
35+ ImC_IMAGEABORTED: con 4;
36+};
java/pkg2/inferno/awt/iDrawingSurfaceInfo.java+117−0
@@ -0,0 +1,117 @@
1+/*
2+ *
3+ * Adapted from MDrawingSurfaceInfo.java version - 1.3 96/12/20
4+ *
5+ */
6+
7+package inferno.awt;
8+
9+import sun.awt.DrawingSurfaceInfo;
10+import sun.awt.PhysicalDrawingSurface;
11+import sun.awt.image.ImageRepresentation;
12+import java.awt.Rectangle;
13+import java.awt.Shape;
14+import java.awt.image.ColorModel;
15+import java.awt.peer.ComponentPeer; // eventually inferno.awt.iComponentPeer ??
16+
17+/**
18+ * The iDrawingSurfaceInfo object provides direct access for rendering
19+ * on Components maintained by the Inferno iToolkit.
20+ *
21+ */
22+
23+public class iDrawingSurfaceInfo
24+ implements DrawingSurfaceInfo, PhysicalDrawingSurface /* , iDrawingSurface */
25+{
26+ int state;
27+ int w, h;
28+ ComponentPeer peer = null; // eventually an iComponentPeer
29+ ImageRepresentation imgrep;
30+
31+ /**
32+ * Construct a new iDrawingSurfaceInfo for the specified peer.
33+ */
34+ /* To date Inferno doesn't need this constructor from
35+ MDrawingSurfaceInfo if it does, we'll need an
36+ inferno.awt.iComponentPeer
37+ iDrawingSurfaceInfo(iComponentPeer peer) {
38+ this.peer = peer;
39+ }
40+ */
41+
42+ /**
43+ * Construct a new iDrawingSurfaceInfo for the specified offscreen image.
44+ */
45+ iDrawingSurfaceInfo(ImageRepresentation imgrep) {
46+ this.imgrep = imgrep;
47+ }
48+
49+ // implementation of lock from sun.awt.DrawingSurfaceInfo interface
50+ public native int lock();
51+
52+ // implementation of unlock from sun.awt.DrawingSurfaceInfo interface
53+ public native void unlock();
54+
55+ // implementation of getBounds from sun.awt.DrawingSurfaceInfo interface
56+ public Rectangle getBounds() {
57+ Rectangle r;
58+ // comment out to keep compiler happy, eventually may
59+ // need this code ? - jfs
60+ /*
61+ if (peer != null) {
62+ r = peer.target.getBounds();
63+ r.setLocation(0, 0);
64+ } else {
65+ r = new Rectangle(0, 0, imgrep.width, imgrep.height);
66+ }
67+ return r;
68+ */
69+ return (r = new Rectangle(0, 0, imgrep.width, imgrep.height));
70+ }
71+
72+ // implementation of getSurface from sun.awt.DrawingSurfaceInfo interface
73+ public PhysicalDrawingSurface getSurface() {
74+ return this;
75+ }
76+
77+ // implementation of getClip from sun.awt.DrawingSurfaceInfo interface
78+ public Shape getClip() {
79+ return getBounds();
80+ }
81+
82+ public ColorModel getColorModel() {
83+ return iToolkit.getStaticColorModel();
84+ }
85+
86+ /**
87+ * Returns a an Object pointer to the rendered $Draw->Image
88+ * represented by this object.
89+ */
90+ final native Object getDrawable();
91+
92+ /**
93+ * Return the depth (log2 of pixel width) of the
94+ * $Draw->Image represented by this object.
95+ */
96+ final native int getDepth();
97+
98+ /*
99+ for future reference:
100+ X11DrawingSurfaceInfo implements X11DrawingSurface:
101+ public native int getDisplay();
102+ public native int getDrawable();
103+ public native int getDepth();
104+ public native int getVisualID();
105+ public native int getColormapID();
106+ public ColorModel getColorModel();
107+
108+ and WDrawingSurfaceInfo implements WDrawingSurface:
109+ public native int getHWnd();
110+ public native int getHBitmap();
111+ public native int getPBits();
112+ public native int getHDC();
113+ public native int getDepth();
114+ public native int getHPalette();
115+
116+ */
117+}
java/pkg2/inferno/awt/iDrawingSurfaceInfo_L.b+56−0
@@ -0,0 +1,56 @@
1+implement iDrawingSurfaceInfo_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+include "iDrawingSurfaceInfo_L.m";
28+
29+#>> extra post includes here
30+
31+#<<
32+
33+init( jni_p : JNI )
34+{
35+ # save java native inteface mod instance
36+ jni = jni_p;
37+ #>>extra initialization here
38+ #<<
39+}
40+
41+lock_I( this : ref iDrawingSurfaceInfo_obj) : int
42+{#>>
43+}#<<
44+
45+unlock_V( this : ref iDrawingSurfaceInfo_obj)
46+{#>>
47+}#<<
48+
49+getDrawable_rObject( this : ref iDrawingSurfaceInfo_obj) : JObject
50+{#>>
51+}#<<
52+
53+getDepth_I( this : ref iDrawingSurfaceInfo_obj) : int
54+{#>>
55+}#<<
56+
java/pkg2/inferno/awt/iDrawingSurfaceInfo_L.m+21−0
@@ -0,0 +1,21 @@
1+# javal v1.5 generated file: edit with care
2+
3+iDrawingSurfaceInfo_L : module
4+{
5+ iDrawingSurfaceInfo_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ state : int;
9+ w : int;
10+ h : int;
11+ peer : JObject;
12+ imgrep : JObject;
13+ };
14+
15+ init : fn( jni_p : JNI );
16+ lock_I : fn( this : ref iDrawingSurfaceInfo_obj) : int;
17+ unlock_V : fn( this : ref iDrawingSurfaceInfo_obj);
18+ getDrawable_rObject : fn( this : ref iDrawingSurfaceInfo_obj) : JObject;
19+ getDepth_I : fn( this : ref iDrawingSurfaceInfo_obj) : int;
20+
21+};
java/pkg2/inferno/awt/iFontMetrics.java+266−0
@@ -0,0 +1,266 @@
1+/*
2+ * %W% - %E%
3+ */
4+
5+ /*
6+ The only font metrics that Inferno provides are height, the distance
7+ in pixels between baselines of lines of text rendered in a particular
8+ font, and ascent, the distance from the top of the bounding box to the
9+ baseline. So there really isn't much vertical information to provide.
10+ In particular there's no leading, and descent information.
11+
12+ To do better than this will require, putting max bounds, leading, and
13+ descent information in the Inferno subfont files, and augmenting $Draw
14+ built-in module to make this information visible to Limbo programs.
15+ */
16+
17+/*
18+ *
19+ */
20+
21+package inferno.awt;
22+
23+import java.awt.*;
24+import java.util.Hashtable;
25+import java.lang.IllegalArgumentException;
26+
27+/**
28+ * A font metrics object for a font.
29+ *
30+ */
31+public class iFontMetrics extends FontMetrics {
32+
33+ private static final boolean debug = false;
34+
35+ int widths[];
36+ int ascent;
37+ int descent;
38+ int leading;
39+ int height;
40+ int maxAscent;
41+ int maxDescent;
42+ int maxHeight;
43+
44+ /*
45+ maxAdvance can't be readily determined without
46+ parsing the Inferno font file and calling
47+ Draw->(Draw->Font).width() for every char mapped by
48+ that Inferno Font. An alternate fudging strategy is to
49+ set it to the max width of any char in the first 256
50+ (getWidths()) characters.
51+ */
52+ int maxAdvance = -1;
53+
54+ private boolean needWidths = true;
55+
56+ // rather than ask our Font for it's peer everytime we want it. We'll
57+ // ask once at construction time, as a small optimization.
58+
59+ private iFontPeer ifontpeer;
60+
61+ public iFontMetrics(Font font) {
62+ super(font);
63+ // Some vertical font metrics (height, and ascent) are (conveniently)
64+ // already available in the iFontPeer of a constructed Font.
65+ if (font == null) {
66+ throw new IllegalArgumentException("font");
67+ }
68+ ifontpeer = (iFontPeer)font.getPeer(); // our Inferno peer
69+ height = ifontpeer.iHeight;
70+ ascent = ifontpeer.iAscent;
71+
72+ // fudge a pixel for leading if the difference between height
73+ // and ascent permits, done by iFontPeer() like so
74+ // leading = ((height - ascent) > 2) ? 1 : 0;
75+ leading = ifontpeer.fLeading;
76+ descent = height - ascent - leading;
77+
78+ // There's no information regarding the following available to Limbo,
79+ // or even in the Inferno subfont files, so fudge 'em.
80+ maxHeight = height;
81+ maxAscent = ascent;
82+ maxDescent = descent;
83+
84+ // widths and maybe maxAdvance is evaluated lazily as needed.
85+ }
86+
87+ /**
88+ * Get leading
89+ */
90+ public int getLeading() {
91+ return leading;
92+ }
93+
94+ /**
95+ * Get ascent.
96+ */
97+ public int getAscent() {
98+ return ascent;
99+ }
100+
101+ /**
102+ * Get descent
103+ */
104+ public int getDescent() {
105+ return descent;
106+ }
107+
108+ /**
109+ * Get height
110+ */
111+ public int getHeight() {
112+ return height;
113+ }
114+
115+ /**
116+ * Get maxAscent
117+ */
118+ public int getMaxAscent() {
119+ return maxAscent;
120+ }
121+
122+ /**
123+ * Get maxDescent
124+ */
125+ public int getMaxDescent() {
126+ return maxDescent;
127+ }
128+
129+ /**
130+ * Get maxAdvance
131+ */
132+ public int getMaxAdvance() {
133+ if (needWidths) {
134+ initWidths();
135+ }
136+ return maxAdvance;
137+ }
138+
139+ /**
140+ * Returns the advance width of the sprcified character in this Font.
141+ */
142+ public int charWidth(char ch) {
143+ if (ch < 256) { // chars are zero extended upon promotin to ints
144+ if (needWidths) {
145+ initWidths();
146+ }
147+ return widths[ch & 0xFF];
148+ } else {
149+ char data[] = { ch };
150+ return charsWidth(data, 0, 1);
151+ }
152+ }
153+
154+
155+ /**
156+ * Return the advance widh of the specified chars in this Font
157+ */
158+ public int charsWidth(char data[], int off, int len) {
159+ int w = 0;
160+ int tlen = len;
161+ int toff = off;
162+ boolean tooBig = false;
163+ if (data == null || off < 0) {
164+ throw new IllegalArgumentException();
165+ }
166+ while(len-- > 0) {
167+ if (data[off] >= 256) {
168+ tooBig = true;
169+ break;
170+ }
171+ if (needWidths) {
172+ initWidths();
173+ }
174+ w += widths[data[off++]];
175+ }
176+ if (tooBig) {
177+ if (debug) {
178+ System.out.println("iFontMetrics.charsWidth - tooBig");
179+ }
180+ w = stringWidth(new String(data, off, len));
181+ }
182+ return w;
183+ }
184+
185+
186+ /**
187+ * Return the width of the specified string in this Font.
188+ *
189+ * Why not bust up the string into a char[] and try for the optimization
190+ * of charsWidth if all elemment values are less than 256? -jfs?
191+ */
192+ public int stringWidth(String str) {
193+ if (str == null) {
194+ throw new IllegalArgumentException();
195+ }
196+ return iStringWidth(str);
197+ }
198+
199+ public int bytesWidth(byte[] data, int off, int len) {
200+ // check args here?
201+ if (data == null || off < 0 || len < 0) {
202+ throw new IllegalArgumentException();
203+ }
204+ byte[] ndata = new byte[len];
205+ System.arraycopy(data, off, ndata, 0, len);
206+ return iBytesWidth(ndata);
207+ }
208+
209+ // Compute width of string in this font.
210+ private native int iStringWidth(String str);
211+
212+ // translate bytes from UTF-8 encoding into a Unicode Limbo string,
213+ // compute the advance width of the string in this Font and return
214+ // the advance in pixels.
215+ private native int iBytesWidth(byte data[]);
216+
217+ // get advance widths of the first 256 characters of this font.
218+ private synchronized void initWidths() {
219+ widths = new int[256];
220+ maxAdvance = iInitWidths(widths);
221+ if (debug) {
222+ System.out.println("iFontMetrics.initWidths(): maxAdvance=" + maxAdvance);
223+ }
224+ needWidths = false;
225+ }
226+
227+ // populates widths with the advance width of the first 256 chars
228+ // in this font, returns the width of the widest character.
229+ private native int iInitWidths(int widths[]);
230+
231+ /**
232+ * Get the widths of the first 256 characters in the font.
233+ */
234+ public int[] getWidths() {
235+ if (needWidths) {
236+ initWidths();
237+ }
238+ return widths;
239+ }
240+
241+ static Hashtable table = new Hashtable();
242+
243+ static synchronized FontMetrics getFontMetrics(Font font) {
244+ if (font == null) {
245+ throw new NullPointerException("FontMetrics.getFontMetrics()");
246+ }
247+ FontMetrics fm = (FontMetrics)table.get(font);
248+ if (fm == null) {
249+ table.put(font, fm = new iFontMetrics(font));
250+ }
251+ return fm;
252+ }
253+
254+ /**
255+ Returns a representation of this <code>FontMetric</code>
256+ object's values as a string.
257+ @return a string representation of this font metric.
258+ */
259+ public String toString() {
260+ return getClass().getName() + "[font=" + getFont() + "ascent=" +
261+ getAscent() + ", descent=" + getDescent() + ", leading=" +
262+ getLeading() + ", height=" + getHeight() + ", maxAdvance=" +
263+ maxAdvance + ", font.getPeer()=" + font.getPeer().toString() +
264+ " ]" ;
265+ }
266+}
java/pkg2/inferno/awt/iFontMetrics_L.b+123−0
@@ -0,0 +1,123 @@
1+implement iFontMetrics_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+#
27+# %W% - %E%
28+#
29+
30+Value: import jni;
31+sys : import jni; # std inferno Sys modoule
32+# str : import jni; # std inferno String module
33+# jldr : import jni; # primary java class loader, JavaClassLoader
34+
35+# draw.m is included by something included by jni.m
36+draw : Draw;
37+Font : import Draw;
38+
39+include "iFontPeer_L.m";
40+ifontpeerm : iFontPeer_L;
41+iFontPeer_obj : import ifontpeerm;
42+#<<
43+
44+include "iFontMetrics_L.m";
45+
46+#>> extra post includes here
47+
48+cast : Cast;
49+ctxt : ref Draw->Context; # for ref to Display
50+
51+#<<
52+
53+init( jni_p : JNI )
54+{
55+ # save java native inteface mod instance
56+ jni = jni_p;
57+ #>>extra initialization here
58+
59+ sys = jni->sys;
60+
61+ # should not I share draw with at least the rest of the AWT
62+ # graphics world ?
63+ draw = load Draw Draw->PATH;
64+
65+ #ifontpeerm = load iFontPeer_L iFontPeer_L->PATH;
66+
67+ ctxt = jni->getContext();
68+ if (ctxt == nil) {
69+ # Eventually the print can be removed, throwing the
70+ # Exception will suffice.
71+ sys->print("iFontMetrics_L.init: ctxt == nil, can't get Draw Context!\n");
72+ jni->ThrowException("java.awt.AWTError", "can't get Draw Context");
73+ }
74+#<<
75+}
76+
77+iStringWidth_rString_I( this : ref iFontMetrics_obj, p0 : JString) : int
78+{#>>
79+
80+ # sys->print("iFontMetrics_L: fontref=%#x\n", p0);
81+ return (draw->(this.ifontpeer.iFontRef).width(p0.str));
82+ #return (draw->(this.iFontRef).width(p0.str));
83+}#<<
84+
85+iBytesWidth_aB_I( this : ref iFontMetrics_obj, p0 : JArrayB) : int
86+{#>>
87+ # convert to string performing UT8 to Unicode translation
88+ cdata := string p0.ary;
89+ return (draw->(this.ifontpeer.iFontRef).width(cdata));
90+}#<<
91+
92+iInitWidths_aI_I( this : ref iFontMetrics_obj, p0 : JArrayI) : int
93+{#>>
94+ # p0 is widths[256] in java land
95+ maxw := 0; # maximum width
96+ cs : string;
97+ n := len p0.ary;
98+ cw : int; # width of current char
99+ cb := array[1] of byte;
100+
101+ for (i := 0; i < n; i++) {
102+ cb[0] = byte i; # cast i to string
103+ cs = string cb;
104+
105+ cw = (draw->(this.ifontpeer.iFontRef).width(cs));
106+
107+ if (maxw < cw) {
108+ maxw = cw;
109+ }
110+
111+ p0.ary[i] = cw;
112+ }
113+ return maxw;
114+}#<<
115+
116+
117+
118+
119+
120+
121+
122+
123+
java/pkg2/inferno/awt/iFontMetrics_L.m+27−0
@@ -0,0 +1,27 @@
1+# javal v1.5 generated file: edit with care
2+
3+iFontMetrics_L : module
4+{
5+ iFontMetrics_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ font : JObject;
9+ widths : JArrayI;
10+ ascent : int;
11+ descent : int;
12+ leading : int;
13+ height : int;
14+ maxAscent : int;
15+ maxDescent : int;
16+ maxHeight : int;
17+ maxAdvance : int;
18+ needWidths : byte;
19+ ifontpeer : ref iFontPeer_obj; # javal generates JObject;
20+ };
21+
22+ init : fn( jni_p : JNI );
23+ iStringWidth_rString_I : fn( this : ref iFontMetrics_obj, p0 : JString) : int;
24+ iBytesWidth_aB_I : fn( this : ref iFontMetrics_obj, p0 : JArrayB) : int;
25+ iInitWidths_aI_I : fn( this : ref iFontMetrics_obj, p0 : JArrayI) : int;
26+
27+};
java/pkg2/inferno/awt/iFontPeer.java+276−0
@@ -0,0 +1,276 @@
1+/*
2+ * %W% - %E%
3+ */
4+
5+/**
6+ * Inferno's Font peer
7+ *
8+ */
9+
10+ /*
11+ * If you're not using xemacs to view this file, you may find it's indentation
12+ * more ledgible if you set your tabstops to four spaces.
13+ */
14+package inferno.awt;
15+
16+import java.io.FileNotFoundException;
17+import java.awt.Font;
18+import java.util.Properties;
19+import java.util.Hashtable;
20+import java.util.Vector;
21+import java.io.File;
22+import java.io.InputStream;
23+import java.io.FileInputStream;
24+import java.io.BufferedInputStream;
25+import java.util.StringTokenizer;
26+
27+public class iFontPeer implements java.awt.peer.FontPeer {
28+
29+ // a default Inferno pathname to a font
30+ // "/fonts/lucidasans/latin1.7.font" is a popular default font
31+ private final static String defifpathname = "*default*";
32+
33+ /*
34+ An object to hold a Limbo reference of type ref Draw->Font
35+ the handle to Inferno platform font capabilities.
36+ Inferno JNI access as this.iFontRef.
37+ Pertinent size metrics are kept here in the peer for quicker
38+ text rendering.
39+ */
40+ Object iFontRef;
41+ int iAscent = -1; // Inferno font's ascent value
42+ int iHeight = -1; // Inferno font's height value
43+ int fLeading = -1; // a fudged value for leading (none in Inferno fonts)
44+ String iName = ""; // Inferno font's name (should match ifpathname)
45+
46+ private static Properties fprops;
47+ static {
48+ // Find property file
49+ String jhome = System.getProperty("java.home");
50+ if (jhome == null){
51+ throw new Error("java.home property not set");
52+ }
53+ // trace("jhome=" + jhome);
54+
55+ String language = System.getProperty("user.language", "en");
56+ String region = System.getProperty("user.region");
57+
58+ // trace("language=" + language);
59+ // trace("region=" + region);
60+ // trace("File.separator=" + File.separator);
61+
62+ try {
63+ File f = null;
64+ if (region != null) {
65+ f = new File(jhome + File.separator +
66+ "lib" + File.separator +
67+ "font.properties." + language + "_" +
68+ region);
69+ }
70+
71+ if (f == null || !f.canRead()) {
72+ f = new File(jhome + File.separator +
73+ "lib" + File.separator + "font.properties." +
74+ language);
75+ if (!f.canRead()) {
76+ f = new File(jhome + File.separator +
77+ "lib" + File.separator + "font.properties");
78+ if (!f.canRead()){
79+ throw new Exception();
80+ }
81+ }
82+ }
83+
84+ fprops = new Properties();
85+
86+ // Load property file
87+ // trace("trying to load props at path " + f.getPath());
88+ InputStream in =
89+ new BufferedInputStream(new FileInputStream(f.getPath()));
90+ fprops.load(in);
91+ in.close();
92+ } catch (Exception e){
93+ System.out.println("iFontPeer: can't load font.properties");
94+ System.out.println("exception: " + e.getMessage());
95+ e.printStackTrace();
96+ } // end try
97+ } // end static
98+
99+
100+ // The do-nothing constructor
101+ public iFontPeer(String name, int style) {
102+ // Don't do anything with name and style, they're implementation
103+ // artifacts from a different (better?) world of scalable
104+ // platform fonts where size is a final argument to platform
105+ // dependant rendering libraries, but Inferno's are static bitmaps.
106+ //
107+ // a better (more general) signatures for this constructor would
108+ // have been FontPeer(Font font) or
109+ // FontPeer(String name,int style,int size)
110+ // but alas, Sun's API hasn't been quite general enough in that regard.
111+ }
112+
113+ // Native method to actually create font in Inferno Display and
114+ // populate this object with reference to Draw->Font and some
115+ // font metrics.
116+ private native void initFontPeer(String ifpathname) throws FileNotFoundException;
117+
118+ //
119+ // initializeFontPeer is called by java.awt.Font.java so this
120+ // method must, regretably, have public scope.
121+ //
122+ public String initializeFontPeer(String name, int style, int size)
123+ {
124+ String ifpn = ""; // pathname to Inferno font
125+ // trace("iFontPeer.initializeFontPeer(): name=" + name +" ,style="
126+ // + style + ", size=" + size);
127+
128+ boolean triedDefault = false;
129+ ifpn = mapifpath(name, style, size);
130+ if (ifpn == null) {
131+ ifpn = defifpathname;
132+ }
133+
134+ retry:
135+ try {
136+ initFontPeer(ifpn); // sets iName, iAscent, iHeight, and fLeading
137+ } catch (FileNotFoundException e) {
138+ // case: properties maps to a file but font file doesn't
139+ // exist
140+ if (!triedDefault) {
141+ triedDefault = true;
142+ ifpn = defifpathname;
143+ // trace("initializeFontPeer: trying default");
144+ break retry;
145+ }
146+ }
147+
148+ if (debug) {
149+ trace("iFontPeer.initializeFontPeer():");
150+ trace(" iName=" + iName);
151+ trace(" iAscent=" + iAscent + " iHeight=" + iHeight);
152+ }
153+ return ifpn;
154+ }
155+
156+ //
157+ // map a Java font triple into the full pathname of an Inferno
158+ // font description file.
159+ //
160+ private static String mapifpath(String name, int style, int size) {
161+
162+ if (fprops == null) {
163+ return defifpathname;
164+ }
165+
166+ String aName = name.toLowerCase();
167+ String aStyle = styleStr(style);
168+ String aSize = String.valueOf(size);
169+
170+ //trace("mapifpath(" + aName + ", " + aStyle + ", " + aSize + ")");
171+ String aStr = aName + "." + aStyle + "." + aSize;
172+ int idx;
173+
174+ // perform face name substitution
175+ String rStr = fprops.getProperty("alias." + aName);
176+ if (rStr != null && rStr.indexOf('.') < 0) {
177+ aName = rStr;
178+ }
179+ //trace("gp1 rStr=" +rStr+ " aName=" +aName+ " aStyle=" +aStyle+
180+ // " aSize=" + aSize);
181+
182+ // perform style substitution on result of above
183+ rStr = fprops.getProperty("alias." + aName + "." + aStyle);
184+ if (rStr != null) {
185+ idx = rStr.indexOf('.');
186+ if (idx > 0 && rStr.lastIndexOf('.') == idx &&
187+ (idx+1 < rStr.length()))
188+ {
189+ aName = rStr.substring(0,idx);
190+ aStyle = rStr.substring(idx+1);
191+ }
192+ }
193+ //trace("gp2 rStr=" +rStr+ " aName=" +aName+ " aStyle=" +aStyle+
194+ // " aSize=" + aSize);
195+
196+
197+ // Now see if there's a complete alias for this "font+style+size"
198+ rStr = fprops.getProperty("alias." + aName + "." + aStyle +
199+ "." + aSize);
200+ if (rStr != null) {
201+ StringTokenizer st = new StringTokenizer(rStr,".",false);
202+ if (st.countTokens() == 3) {
203+ aName = st.nextToken();
204+ aStyle = st.nextToken();
205+ aSize = st.nextToken();
206+ }
207+ }
208+ //trace("gp3 rStr=" +rStr+ " aName=" +aName+ " aStyle=" +aStyle+
209+ // " aSize=" + aSize);
210+
211+
212+ // after these substitutions, see if the font string has
213+ // a match, applying the followin heuristic.
214+ // if stlye isn't "plain", adjust size +-2, if no match
215+ // change style to "plain" and proceed per style is "plain"
216+ // if style is "plain" adjust size +-4 if need be.
217+ //
218+
219+ while(true) {
220+ int nsize;
221+ boolean up = true;
222+ int range = (style != Font.PLAIN) ? 2 : 4;
223+
224+ for (int i = 0; i <= range;) {
225+ nsize = Math.abs(size + ((up) ? i : -i));
226+ // trace("nsize=" + nsize);
227+ aSize = String.valueOf(nsize);
228+ rStr = fprops.getProperty(aName +"."+ aStyle + "." + aSize);
229+ if (rStr != null) {
230+ //trace("***mapifpath: got it!");
231+ break;
232+ }
233+ if (!up) {
234+ i++;
235+ }
236+ up = (!up);
237+ }
238+ if (rStr == null) {
239+ if (style != Font.PLAIN) { // retry with plain style
240+ style = Font.PLAIN;
241+ aStyle = styleStr(style);
242+ //trace("***mapifpath: retry w/plain font!, nsize=" + nsize);
243+ continue;
244+ }
245+ rStr = defifpathname; // no Match, returns default
246+ }
247+ break;
248+ }
249+ trace ("mapifpath: gp4 aName=" +aName+ " aStyle=" +aStyle+
250+ " aSize=" + aSize + " rStr=" + rStr);
251+ return(rStr);
252+ }
253+
254+ /*
255+ * return String representation of style
256+ */
257+ private static String styleStr(int num){
258+ switch(num){
259+ case Font.BOLD:
260+ return "bold";
261+ case Font.ITALIC:
262+ return "italic";
263+ case Font.ITALIC+Font.BOLD:
264+ return "bolditalic";
265+ default:
266+ return "plain";
267+ }
268+ }
269+
270+ private static final boolean debug = false;
271+ private static void trace(String arg) {
272+ if (debug) {
273+ System.out.println(arg);
274+ }
275+ }
276+}
java/pkg2/inferno/awt/iFontPeer_L.b+115−0
@@ -0,0 +1,115 @@
1+implement iFontPeer_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#
28+# %W% - %E%
29+#
30+
31+Value : import jni;
32+sys : import jni; # std inferno Sys modoule
33+str : import jni; # std inferno String module
34+# jldr : import jni; # primary java class loader, JavaClassLoader
35+
36+# draw.m is included by something included by jni.m
37+draw : Draw;
38+Font : import Draw;
39+
40+#<<
41+
42+include "iFontPeer_L.m";
43+
44+#>> extra post includes here
45+
46+cast : Cast;
47+ctxt : ref Draw->Context; # for ref to Display
48+
49+#<<
50+
51+init( jni_p : JNI )
52+{
53+ # save java native inteface mod instance
54+ jni = jni_p;
55+ #>>extra initialization here
56+
57+ sys = jni->sys;
58+
59+ # should not I share draw with at least the rest of the AWT
60+ # graphics world ?
61+ draw = load Draw Draw->PATH;
62+ # sys->print("iFontPeer_L: draw=%x\n",draw);
63+
64+ # Why is getting Cast module handle from jni different
65+ # than getting Sys, Math, and String modules handles from jni?
66+ # cast = jni->CastMod();
67+ ctxt = jni->getContext();
68+ if (ctxt == nil) {
69+ # Eventually the print can be removed, throwing the
70+ # Exception will suffice.
71+ sys->print("iFontPeer_L.init: ctxt == nil, can't get Draw Context!\n");
72+ jni->ThrowException("java.awt.AWTError", "can't get Draw Context");
73+ }
74+ #<<
75+}
76+
77+initFontPeer_rString_V( this : ref iFontPeer_obj, p0 : JString)
78+{#>>
79+
80+ ifp := p0.str;
81+ #sys->print("initFontPeer_V: this.ifpathname=%s\n",ifp);
82+
83+ this.iFontRef = draw->Font.open(ctxt.display, ifp);
84+ fontref := this.iFontRef;
85+
86+ if (nil == fontref) {
87+ sys->print("iFontPeer_L: can't open font %s - %r\n",ifp);
88+ jni->ThrowException("java.io.FileNotFoundException", ifp);
89+ }
90+
91+ # sys->print("iFontPeer_L: this=%#x\n",this);
92+ # sys->print("iFontPeer_L: this.iFontRef=%#x, draw=%#x\n",this.iFontRef, draw);
93+
94+
95+ # make native Font information visible in javaland
96+
97+ #this.iName.str = fontref.name;
98+ this.iName = jni->NewString(fontref.name);
99+
100+ this.iAscent = fontref.ascent;
101+ this.iHeight = fontref.height;
102+
103+
104+ ## if there is some height to spare, fudge a pixel of leading
105+ # if ((fontref.height - fontref.ascent) > 2) {
106+ # this.fLeading = 1;
107+ # }
108+ this.fLeading = 0;
109+
110+ # sys->print("this.iFontRef=%x\n",this.iFontRef);
111+ # sys->print("this.iAscent=%x\n",this.iAscent);
112+ # sys->print("this.iHeight=%x\n",this.iHeight);
113+ # sys->print("this.fLeading=%x\n",this.fLeading);
114+}#<<
115+
java/pkg2/inferno/awt/iFontPeer_L.m+20−0
@@ -0,0 +1,20 @@
1+# javal v1.5 generated file: edit with care
2+
3+iFontPeer_L : module
4+{
5+ PATH : con "/dis/java/inferno/awt/iFontPeer_L.dis";
6+
7+ iFontPeer_obj : adt
8+ {
9+ cl_mod : ClassModule;
10+ iFontRef : ref Font; # javal generates JObject;
11+ iAscent : int;
12+ iHeight : int;
13+ fLeading : int;
14+ iName : JString;
15+ };
16+
17+ init : fn( jni_p : JNI );
18+ initFontPeer_rString_V : fn( this : ref iFontPeer_obj, p0 : JString);
19+
20+};
java/pkg2/inferno/awt/iFramePeer.java+527−0
@@ -0,0 +1,527 @@
1+package inferno.awt;
2+
3+import java.awt.*;
4+import java.awt.event.*;
5+import java.awt.peer.*;
6+import java.awt.image.ImageProducer;
7+import java.awt.image.ImageObserver;
8+import java.awt.image.ColorModel;
9+import java.awt.image.DirectColorModel;
10+import java.util.*;
11+import inferno.awt.iGraphics;
12+
13+public class iFramePeer implements FramePeer, DoubleBufferingPeer {
14+ private Object pCanvas; // Set inside create() used by natives
15+
16+ // set inside create(), used by natives, to avoid some clutter in
17+ // escaping the Limbo type system.
18+ private Object thisAsJObject;
19+
20+ private Frame target;
21+
22+ private int leftInset=0; // How much canvas is inset from frame
23+ private int rightInset=0;
24+ private int topInset=0;
25+ private int bottomInset=0;
26+ private int left; // x position of left of frame
27+ private int top; // y position of top of frame
28+
29+ private Point oldMousePoint;
30+ private boolean buttonState[];
31+
32+ private int resizable = 1;
33+
34+ public iFramePeer(Frame target) {
35+ this.target = target;
36+ oldMousePoint=new Point(-1,-1);
37+ buttonState=new boolean[3];
38+ for (int i=0;i<3;i++) buttonState[i]=false; //up
39+ // create(this);
40+ if (target.getTitle() != null) {
41+ setTitle(target.getTitle());
42+ }
43+ Font f = target.getFont();
44+ if (f == null) {
45+ f = new Font("Dialog", Font.PLAIN, 12);
46+ target.setFont(f);
47+ setFont(f);
48+ }
49+ Color c = target.getBackground();
50+ if (c == null) {
51+ c = SystemColor.window;
52+ target.setBackground(c);
53+ setBackground(c);
54+ }
55+ c = target.getForeground();
56+ if (c == null) {
57+ target.setForeground(Color.black);
58+ setForeground(Color.black);
59+ }
60+ if (!target.isResizable())
61+ this.resizable = 0;
62+
63+ create(this);
64+
65+ }
66+
67+ /* implementation of java.awt.peer.DoubleBufferingPeer */
68+ public boolean isDoubleBuffered() {
69+ return true;
70+ }
71+
72+ private native Object getRefImage(); // Returns dev/draw image of canvas
73+
74+ private native Object getRefOffScreenImage(); // Returns off-screen buffer image
75+
76+ private native void pReshape(int x, int y, int width, int height);
77+
78+ private native void pHide(); // Hide frame
79+
80+ private native void pShow(iFramePeer fp); // Show frame
81+
82+ private native int getXYLoc(int coord); // get x or y value of the global position
83+
84+ // Create frame putting canvas in pcanvas
85+ private native void create(iFramePeer me);
86+
87+ public native void pDispose(); // Destroy frame
88+ public native void setCursor(int cursorType); // Set cursor
89+ public native void setTitle(String title); // Set title of frame
90+ public native void toFront(); // Move frame to front
91+ public native void toBack(); // Move frame to back
92+
93+
94+ /* New 1.1 API */
95+ public Point getLocationOnScreen() // Return position on screen
96+ {
97+ Point p = new Point();
98+ p.x = getXYLoc(0);
99+ p.y = getXYLoc(1);
100+ return p;
101+ }
102+
103+ public void recalculate()
104+ {
105+ MenuBar mb=target.getMenuBar();
106+ if (mb!=null)
107+ {
108+ iMenuBarPeer ip=(iMenuBarPeer)mb.getPeer();
109+
110+ if (ip!=null)
111+ {
112+ ip.recalculate();
113+ }
114+ }
115+ }
116+
117+ public void setCursor(Cursor c)
118+ {
119+ if (c!=null)
120+ setCursor(c.getType());
121+ }
122+
123+ public void setResizable(boolean resizable)
124+ {
125+ System.out.println("java: setResizable() get called" + resizable);
126+ if(!resizable)
127+ this.resizable = 0;
128+ }
129+
130+ public void setMenuBar(MenuBar mb)
131+ {
132+ recalculate();
133+ }
134+
135+ public void setIconImage(Image im)
136+ {
137+ }
138+
139+ public Insets getInsets()
140+ {
141+ Insets i=new Insets(topInset,leftInset,bottomInset,rightInset);
142+
143+ MenuBar mb=target.getMenuBar();
144+
145+ if (mb!=null)
146+ {
147+ iMenuBarPeer peer=(iMenuBarPeer)mb.getPeer();
148+
149+ if (peer!=null)
150+ {
151+ i=(Insets)i.clone(); //Get new copy
152+
153+ i.top+=peer.getHeight();
154+ }
155+
156+ }
157+
158+ return i;
159+ }
160+
161+ public Insets insets()
162+ {
163+ return getInsets();
164+ }
165+
166+ public void endValidate()
167+ {
168+
169+ }
170+
171+ public void beginValidate()
172+ {
173+
174+ }
175+
176+ public void setBounds(int x, int y, int width, int height) {
177+ pReshape(x, y, width, height);
178+ }
179+
180+ public void reshape(int x, int y, int width, int height) {
181+ pReshape(x, y, width, height);
182+ }
183+
184+
185+ public void dispose()
186+ {
187+ pDispose();
188+ pCanvas=null;
189+ }
190+
191+ public void disable()
192+ {
193+ setEnabled(false);
194+ }
195+
196+ public void enable()
197+ {
198+ setEnabled(false);
199+ }
200+
201+ public void setEnabled(boolean b)
202+ {
203+
204+ }
205+
206+ public void hide()
207+ {
208+ setVisible(false);
209+ }
210+
211+ public void show()
212+ {
213+ setVisible(true);
214+ }
215+
216+ public void setVisible(boolean b)
217+ {
218+ if (b)
219+ pShow(this);
220+ else
221+ pHide();
222+ }
223+
224+ public Dimension getMinimumSize() {
225+ return target.getSize();
226+ }
227+
228+ public Dimension getPreferredSize() {
229+ return getMinimumSize();
230+ }
231+
232+ public Dimension minimumSize() {
233+ return getMinimumSize();
234+ }
235+
236+ public Dimension preferredSize() {
237+ return getPreferredSize();
238+ }
239+
240+
241+ public int checkImage(Image img, int w, int h, ImageObserver o) {
242+ return 0;
243+ }
244+
245+ public FontMetrics getFontMetrics(Font font) {
246+ return iFontMetrics.getFontMetrics(font);
247+ }
248+
249+ public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
250+ return false;
251+ }
252+
253+
254+ public Image createImage(ImageProducer producer) {
255+ return null/*new Win32Image(producer)*/;
256+ }
257+ public Image createImage(int width, int height) {
258+ return null/*new Win32Image(target, width, height)*/;
259+ }
260+
261+ public boolean isFocusTraversable() {
262+ return false;
263+ }
264+
265+ public void requestFocus()
266+ {
267+ }
268+
269+ public void nextFocus()
270+ {
271+ }
272+
273+ public void setFont(Font f)
274+ {
275+
276+ }
277+
278+ public Font getFont()
279+ {
280+ return null;
281+ }
282+
283+ public void setBackground(Color c)
284+ {
285+
286+ }
287+
288+ public void setForeground(Color c)
289+ {
290+
291+ }
292+
293+ public Graphics getGraphics()
294+ {
295+ if (pCanvas==null) {
296+ System.out.println("iFramePeer.getGraphics(): pCanvas == null!"); // jfs - remove
297+ return null;
298+ }
299+ Rectangle bounds = target.getBounds();
300+ Rectangle clip = new Rectangle(bounds.x+leftInset,
301+ bounds.y+topInset,
302+ bounds.width-leftInset-rightInset,
303+ bounds.height-topInset-bottomInset);
304+ Graphics g=new iGraphics(getRefImage(),getRefOffScreenImage(), clip, target);
305+ g.translate(bounds.x,bounds.y); // bounds have already been set - lg
306+ return g;
307+ }
308+
309+ public java.awt.Toolkit getToolkit() {
310+ return Toolkit.getDefaultToolkit();
311+ }
312+
313+ public ColorModel getColorModel() {
314+ return iToolkit.getStaticColorModel();
315+ }
316+
317+ public void handleEvent(AWTEvent e)
318+ {
319+
320+ }
321+
322+ public void print(Graphics g)
323+ {
324+ }
325+
326+ public void paint(Graphics g)
327+ {
328+ g.setColor(target.getForeground());
329+ g.setFont(target.getFont());
330+ MenuBar mb=target.getMenuBar();
331+ if (mb!=null)
332+ {
333+ iMenuBarPeer ip=(iMenuBarPeer)mb.getPeer();
334+
335+ if (ip!=null)
336+ {
337+ ip.paint(g);
338+ }
339+ }
340+ target.paint(g);
341+ }
342+
343+
344+ public void repaint(long tm, int x, int y, int width, int height) {
345+
346+ iToolkit.postEvent(new PaintEvent((Component)target, PaintEvent.UPDATE,
347+ new Rectangle(x, y, width, height)));
348+
349+ }
350+
351+ private void handleKeyEvents(int ch)
352+ {
353+ char keyChar = (char)ch;
354+ boolean control = ch >= 0 && ch <= 31;
355+ boolean lowercase = ch >= (int)'a' && ch <= (int)'z';
356+ boolean uppercase = ch >= (int)'A' && ch <= (int)'Z';
357+ int modifiers = control?InputEvent.CTRL_MASK:
358+ uppercase?InputEvent.SHIFT_MASK:0;
359+ int keyCode = control?ch+64:lowercase?ch-32:ch;
360+
361+ // constructing a Date is slow, System.currentTimeMillis(),
362+ // is faster, but it's implementation opens #c/time and
363+ // converts a string to a big. Fastest still and probably
364+ // with sufficient resolution would be natively time stamping
365+ // events with sys->millisec(). -jfs
366+ //// Date d = new Date();
367+ //// long when = d.getTime();
368+ long when = System.currentTimeMillis();
369+
370+
371+ iToolkit.postEvent(new KeyEvent(target,KeyEvent.KEY_PRESSED,
372+ when,modifiers,keyCode,keyChar));
373+
374+ // synthesize events that we don't get from /dev/keyboard via
375+ // Inferno's Tk (this is some fast typist!)
376+ /*
377+ iToolkit.postEvent(new KeyEvent(target,KeyEvent.KEY_TYPED,
378+ when+1,modifiers,keyCode,keyChar));
379+ iToolkit.postEvent(new KeyEvent(target,KeyEvent.KEY_RELEASED,
380+ when+2,modifiers,keyCode,keyChar));
381+ */
382+ }
383+
384+ private void handleMouseEvents(int m,int button,int x,int y)
385+ {
386+ char mode=(char)m;
387+ // System.out.println("Mouse event "+mode+" "+button+" "+x+" "+y);
388+ switch(mode)
389+ {
390+case 'd':
391+case 'r':
392+case 'm':
393+case 'p':
394+ Rectangle bounds = target.getBounds();
395+ int xx=x-bounds.x-leftInset;
396+ int yy=y-bounds.y; // -topInset;
397+
398+ Point mousePoint=new Point(xx,yy);
399+ long when = System.currentTimeMillis();
400+ int modifier;
401+
402+ switch(button)
403+ {
404+case 1:
405+ modifier=InputEvent.BUTTON1_MASK;
406+ break;
407+
408+case 2:
409+ modifier=InputEvent.BUTTON2_MASK;
410+ break;
411+
412+case 3:
413+ modifier=InputEvent.BUTTON3_MASK;
414+ break;
415+
416+default:
417+ modifier=0;
418+ }
419+
420+ switch(mode)
421+ {
422+case 'p': // Pressed
423+case 'd': // Double click
424+ {
425+ if (button>0 && button<=3 && buttonState[button-1]==false)
426+ {
427+ oldMousePoint=mousePoint;
428+ buttonState[button-1]=true;
429+ iToolkit.postEvent(new MouseEvent(target,MouseEvent.MOUSE_PRESSED,
430+ when,modifier,xx,yy,1,false));
431+
432+ }
433+ break;
434+ }
435+case 'r': // Released
436+ {
437+ if (button>0 && button<=3 && buttonState[button-1]==true)
438+ {
439+ buttonState[button-1]=false;
440+ iToolkit.postEvent(new MouseEvent(target,MouseEvent.MOUSE_RELEASED,
441+ when,modifier,xx,yy,1,false));
442+ if (mousePoint.equals(oldMousePoint))
443+ {
444+ iToolkit.postEvent(new MouseEvent(target,MouseEvent.MOUSE_CLICKED,
445+ when,modifier,xx,yy,1,button==2));
446+ }
447+ }
448+ break;
449+ }
450+case 'm': // Moved
451+ {
452+ modifier=0;
453+ if (buttonState[0]) modifier|=InputEvent.BUTTON1_MASK;
454+ if (buttonState[1]) modifier|=InputEvent.BUTTON2_MASK;
455+ if (buttonState[2]) modifier|=InputEvent.BUTTON3_MASK;
456+ iToolkit.postEvent(new MouseEvent(target,
457+ modifier==0?MouseEvent.MOUSE_MOVED:MouseEvent.MOUSE_DRAGGED,
458+ when,modifier,xx,yy,1,false));
459+
460+ break;
461+ }
462+default:
463+ // System.out.println("focusEvent:" + mouseString);
464+ }
465+ break;
466+ }
467+
468+ // System.out.println("mouseString "+mouseString);
469+ }
470+
471+ private void moveSize(int x, int y, int width, int height)
472+ {
473+ Rectangle old = target.getBounds();
474+ Rectangle n = new Rectangle(x, y, width, height);
475+ if (!n.equals(old)){
476+ target.setBounds(x, y, width, height);
477+ target.validate();
478+ target.repaint();
479+ }
480+ }
481+
482+ private void paintTarget(int x, int y, int width, int height)
483+ {
484+ target.setBounds(x, y, width, height);
485+ target.validate();
486+ target.repaint();
487+ }
488+
489+ //
490+ // Callbacks from native for Window Events
491+ //
492+ private void handleActivated() {
493+ iToolkit.postEvent(new WindowEvent(target,
494+ WindowEvent.WINDOW_ACTIVATED));
495+ iToolkit.postEvent(new FocusEvent(target,
496+ FocusEvent.FOCUS_GAINED, false));
497+ }
498+ private void handleDeactivated() {
499+ iToolkit.postEvent(new WindowEvent(target,
500+ WindowEvent.WINDOW_DEACTIVATED));
501+ iToolkit.postEvent(new FocusEvent(target,
502+ FocusEvent.FOCUS_LOST, true));
503+ }
504+ private void handleClosing() {
505+ //System.out.println("iFramePeer.handleClosing():");
506+ // Java Frame can then call System.exit() to shutdown the VM
507+ // if it so desires
508+ iToolkit.postEvent(new WindowEvent(target,
509+ WindowEvent.WINDOW_CLOSING));
510+ }
511+ private void handleIconified() {
512+ //System.out.println("iFramePeer.handleIconified():");
513+ iToolkit.postEvent(new WindowEvent(target,
514+ WindowEvent.WINDOW_ICONIFIED));
515+
516+ }
517+ private void handleDeIconified() {
518+ // System.out.println("iFramePeer.handleDeiconified():");
519+ iToolkit.postEvent(new WindowEvent(target,
520+ WindowEvent.WINDOW_DEICONIFIED));
521+
522+ // may need to make Cursors visible as well??? - jfs
523+ // target.repaint();
524+ }
525+}
526+
527+
java/pkg2/inferno/awt/iFramePeer_L.b+588−0
@@ -0,0 +1,588 @@
1+implement iFramePeer_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+ cast : Cast;
28+
29+ sys : Sys;
30+
31+ draw: Draw;
32+ Context, Screen, Display, Rect, Font, Point, Image: import draw;
33+
34+include "tk.m";
35+ tk: Tk;
36+ Toplevel: import tk;
37+
38+include "wmlib.m";
39+ wmlib: Wmlib;
40+
41+include "awt_Color.m";
42+ awt : AwtColor;
43+
44+#<<
45+
46+include "iFramePeer_L.m";
47+
48+#>> extra post includes here
49+ str : String;
50+ Value : import jni;
51+ ctxt : ref Draw->Context;
52+ title : string;
53+
54+ # channel for receiving Tk events and "reallyExit" from dispose().
55+ cmdchan: chan of string;
56+
57+ #
58+ # the following was included from awt_Frame.b and sees varying
59+ # degrees of use.
60+ #
61+
62+ screen: ref Screen;
63+ display: ref Display;
64+ ones: ref Image;
65+ white: ref Image;
66+ nochan: chan of string;
67+ tHeight : int;
68+ bWidth: int;
69+ last_x, last_y : int;
70+
71+ Event: adt
72+ {
73+ event: int;
74+ detail: string;
75+
76+ Button, Key,
77+ Icon, DeIcon,
78+ Resize, Shutdown
79+ : con iota;
80+ };
81+
82+ Attr: adt
83+ {
84+ origin: Draw->Point;
85+ dims: Draw->Point;
86+ };
87+
88+ Canvas: adt
89+ {
90+ # interface
91+ image: ref Draw->Image;
92+ buf: ref Draw->Image;
93+ rect: Draw->Rect;
94+ events: chan of ref Event;
95+ attr: ref Attr;
96+ # implementation
97+ ctxt : ref Draw->Context;
98+ top: ref Tk->Toplevel;
99+ canvas: string;
100+ pid: int;
101+ };
102+ # end of historical inclusions from awt_Frame.b
103+#<<
104+init( jni_p : JNI )
105+{
106+ # save java native inteface mod instance
107+ jni = jni_p;
108+ #>>extra initialization here
109+
110+ sys = jni->sys;
111+
112+ str = load String String->PATH;
113+ awt = load AwtColor AwtColor->PATH;
114+ cast = jni->CastMod();
115+
116+ # draw and tk are module refs that JNI may someday provide, saving a
117+ # Limbo load operation for every FramePeer construction
118+ draw = load Draw Draw->PATH;
119+ tk = load Tk Tk->PATH;
120+ wmlib = load Wmlib Wmlib->PATH;
121+
122+ ctxt = jni->getContext();
123+ title = "Untitled";
124+
125+ nochan = chan of string;
126+ screen = ctxt.screen;
127+ last_x = last_y = -10;
128+ wmlib->init();
129+ #<<
130+}
131+
132+getRefImage_rObject( this : ref iFramePeer_obj) : ref Draw->Image
133+{#>>
134+ return this.pCanvas.image;
135+}#<<
136+
137+getRefOffScreenImage_rObject(this :ref iFramePeer_obj) : ref Draw->Image
138+{#>>
139+ return this.pCanvas.buf;
140+}#<<
141+
142+pReshape_I_I_I_I_V( this : ref iFramePeer_obj, p0 : int,p1 : int,p2 : int,p3 : int)
143+{#>>
144+ strcmd := ". configure -x " + string p0 + " -y " + string p1 +
145+ " -width " + string p2 + " -height " + string p3;
146+
147+ tk->cmd(this.pCanvas.top, strcmd);
148+ tk->cmd(this.pCanvas.top, "update");
149+}#<<
150+
151+pHide_V( this : ref iFramePeer_obj)
152+{#>>
153+ # Explicit filtering of input (mouse and keyboard) events shouldn't
154+ # be needed if Tk is doing it's job wrt "map" and "unmap".
155+ tk->cmd(this.pCanvas.top, ". unmap");
156+ this.pCanvas.image = nil;
157+}#<<
158+
159+pShow_riFramePeer_V( this : ref iFramePeer_obj, p0 : JObject)
160+{#>>
161+ # Window.show() has already produced a WINDOW_OPENED event
162+ # Tk\'s " . map" will result in a WINDOW_ACTIVATE event when it
163+ # directs focus to the newly mapped frame.
164+
165+ tk->cmd(this.pCanvas.top, ". map");
166+# spawn doEvent(this, p0);
167+}#<<
168+
169+getXYLoc_I_I( this : ref iFramePeer_obj,p0 : int) : int
170+{#>>
171+ if (p0 == 0)
172+ return this.pCanvas.rect.min.x;
173+ else
174+ return this.pCanvas.rect.min.y;
175+}#<<
176+
177+create_riFramePeer_V( this : ref iFramePeer_obj, p0 : JObject)
178+{#>>
179+ # make's for easy punning around the Limbo type system.
180+ # two refs to same object: "this" and "thisAsJObject".
181+ this.thisAsJObject = p0;
182+
183+ t := jni->GetObjField(this.target, "title", "Ljava/lang/String;");
184+
185+ if (t == nil)
186+ sys->print("Cannot get title\n");
187+ else{
188+ sobj := t.Object();
189+ c := jni->CastMod();
190+ js := cast->ToJString(sobj);
191+ title = js.str;
192+ }
193+
194+ xval := jni->GetObjField(this.target, "x", "I");
195+ yval := jni->GetObjField(this.target, "y", "I");
196+ wval := jni->GetObjField(this.target, "width", "I");
197+ hval := jni->GetObjField(this.target, "height", "I");
198+
199+
200+ x := xval.Int();
201+ y := yval.Int();
202+ w := wval.Int();
203+ h := hval.Int();
204+
205+ makewin(ctxt, title, x, y, w, h, this, p0);
206+
207+ this.topInset = tHeight + bWidth + bWidth;
208+ this.leftInset = bWidth;
209+ this.rightInset = bWidth;
210+ this.bottomInset = bWidth;
211+ this.left = this.pCanvas.rect.min.x;
212+ this.top = this.pCanvas.rect.min.y;
213+
214+ tk->cmd(this.pCanvas.top, ". unmap");
215+ this.pCanvas.image = nil;
216+}#<<
217+
218+pDispose_V( this : ref iFramePeer_obj)
219+{#>>
220+ # sys->print("iFramePeer_L.pDispose_V(): entered on pid=%d\n", sys->pctl(0,nil));
221+
222+ # request evenhandler's suicide, and sync until done
223+ cmdchan <- = "reallyExit";
224+
225+ this.pCanvas = nil;
226+}#<<
227+
228+setCursor_I_V( this : ref iFramePeer_obj, p0 : int)
229+{#>>
230+}#<<
231+
232+
233+setTitle_rString_V( this : ref iFramePeer_obj, p0 : JString)
234+{#>>
235+ title = p0.str;
236+ if (wmlib != nil && this.pCanvas != nil && this.pCanvas.top != nil &&
237+ title != nil)
238+ {
239+
240+ # sys->print("iFramePeer_L.b.setTitle(): %s\n", title);
241+
242+ # A change of title string to an iconfied Frmae will only be seen
243+ # after deiconification, as Inferno's wm provides no mechanism
244+ # to change the value displayed on the "taskbar" once a window's
245+ # been iconified, contrary to the commentary in appl/lib/wmlib.b
246+ wmlib->taskbar(this.pCanvas.top, title);
247+ }
248+}#<<
249+
250+toFront_V( this : ref iFramePeer_obj)
251+{#>>
252+ this.pCanvas.image.top();
253+}#<<
254+
255+toBack_V( this : ref iFramePeer_obj)
256+{#>>
257+ this.pCanvas.image.bottom();
258+}#<<
259+
260+#>>
261+doEvent(i : ref iFramePeer_obj, job : JObject)
262+{
263+# cc := i.pCanvas;
264+ for (;;) {
265+ e := <- i.pCanvas.events;
266+ case e.event {
267+ Event.Shutdown =>
268+ exit;
269+ * =>
270+ ;
271+ }
272+ }
273+}
274+
275+javapainttarget(j : JObject, r : Draw->Rect)
276+{
277+ args := array[4] of ref Value;
278+ args[0] = ref Value.TInt(r.min.x);
279+ args[1] = ref Value.TInt(r.min.y);
280+ args[2] = ref Value.TInt(r.max.x - r.min.x + 1);
281+ args[3] = ref Value.TInt(r.max.y - r.min.y + 1);
282+ (val, err) := jni->CallMethod(j, "paintTarget", "(IIII)V", args);
283+ if (err != jni->OK){
284+ sys->print( "CallMethod Error %d: paintTarget\n",err);
285+ }
286+}
287+
288+javamvsz(j : JObject, r : Draw->Rect)
289+{
290+ args := array[4] of ref Value;
291+ args[0] = ref Value.TInt(r.min.x);
292+ args[1] = ref Value.TInt(r.min.y);
293+ args[2] = ref Value.TInt(r.max.x - r.min.x + 1);
294+ args[3] = ref Value.TInt(r.max.y - r.min.y + 1);
295+ (val, err) := jni->CallMethod(j, "moveSize", "(IIII)V", args);
296+ if (err != jni->OK){
297+ sys->print( "CallMethod Error %d: moveSize\n",err);
298+ }
299+}
300+#<<
301+
302+
303+#>>
304+win_cfg := array[] of {
305+ "canvas .c -height 6 -width 6",
306+ "pack .c -side bottom -fill both -expand 1",
307+ "pack propagate . 0",
308+};
309+
310+win_bind := array[] of {
311+ "bind . <Configure> {send cmd configure}",
312+ "bind . <Map> {send cmd map}",
313+ "bind . <FocusIn> +{send cmd focusIn}",
314+ "bind . <FocusOut> +{send cmd focusOut}",
315+ "bind # <Motion> {send butt m %b %X %Y}",
316+ "bind # <Leave> {send butt Leave}",
317+ "bind # <ButtonPress> {focus #;send butt p %b %X %Y}",
318+ "bind # <ButtonRelease> {send butt r %b %X %Y}",
319+ "bind # <Double-Button> {send butt d %b %X %Y}",
320+ "bind # <Enter> {send butt Enter}",
321+ "bind # <KeyPress> {send key %K}",
322+ "bind .Wm_t <Button-1> +{send butt p %b %x %y}",
323+ "bind .Wm_t.title <Button-1> +{send butt p %b %x %y}",
324+ "bind .Wm_t <Button-1> +{focus #}",
325+ "bind .Wm_t.title <Button-1> +{focus #}",
326+
327+ # Optional button 2 input focus to frame. Deviates from
328+ # current (crippled IMHO) wmlib practice. Benefit is keyboard
329+ # focus without raising frame to top. - jfs
330+ "bind .Wm_t <Button-2> +{focus #}",
331+ "bind .Wm_t.title <Button-2> +{focus #}",
332+};
333+
334+modinit(ctxt: ref Context)
335+{
336+ draw = load Draw Draw->PATH;
337+ tk = load Tk Tk->PATH;
338+ wmlib = load Wmlib Wmlib->PATH;
339+
340+ nochan = chan of string;
341+
342+ screen = ctxt.screen;
343+ last_x = last_y = -10;
344+
345+ wmlib->init();
346+}
347+
348+makewin(ctxt: ref Context, title: string, x, y, width, height: int, this: ref iFramePeer_obj, job: JObject)
349+{
350+# modinit(ctxt);
351+ t : ref Toplevel;
352+ menu : chan of string;
353+ where := "-x " + string x + " -y " + string y;
354+ if (this.resizable == 1)
355+ (t, menu) = wmlib->titlebar(screen, where, title, Wmlib->Appl);
356+ else
357+ (t, menu) = wmlib->titlebar(screen, where, title, Wmlib->Hide);
358+
359+# calculate topInset and boardwidth
360+ bWidth = int tk->cmd(t, ". cget -bd");
361+ tHeight = int tk->cmd(t, ". cget -height");
362+
363+ if (width > 0 && height > 0)
364+ win_cfg[0] = "canvas .c -height " + string (height - tHeight -bWidth -bWidth) + " -width " + string (width);
365+# win_cfg[0] = "canvas .c -height " + string (height - tHeight) + " -width " + string width;
366+
367+ wmlib->tkcmds(t, win_cfg);
368+
369+ ones = t.image.display.ones;
370+ white = t.image.display.color(Draw->White);
371+ alloccanvas(t, ctxt, ".c", menu, this, job);
372+}
373+
374+alloccanvas(t: ref Toplevel, ctxt: ref Draw->Context, canvas: string, menu: chan of string, this :ref iFramePeer_obj, job: JObject)
375+{
376+ cmdchan = chan of string;
377+ tk->namechan(t, cmdchan, "cmd");
378+ butt := chan of string;
379+ tk->namechan(t, butt, "butt");
380+
381+ key := chan of string;
382+ tk->namechan(t, key, "key");
383+
384+# tk->cmd(t, "bind . <Configure> {send cmd resize}");
385+# tk->cmd(t, "bind . <Map> {send cmd map}");
386+
387+ for (i := 0; i < len win_bind; i++)
388+ tk->cmd(t, expand(win_bind[i], canvas));
389+
390+ tk->cmd(t, "update");
391+
392+ c := ref Canvas;
393+ this.pCanvas = c;
394+ c = nil;
395+
396+ bg := Draw->White;
397+ jcol := jni->GetObjField(this.target, "background", "Ljava/awt/Color;");
398+ if (jcol == nil) {
399+ sys->print("iFramePeer_L: Cannot get background color\n");
400+ } else {
401+ color := jcol.Object();
402+ bg = awt->getColorIndex(jni, color);
403+ }
404+
405+ this.pCanvas.image = t.image;
406+ display = t.image.display;
407+ this.pCanvas.rect = canvposn(t, canvas);
408+ this.pCanvas.buf = ctxt.display.newimage(ctxt.display.image.r,
409+ this.pCanvas.image.ldepth , 0, bg);
410+ this.pCanvas.events = nil; # not currently used
411+ this.pCanvas.top = t;
412+ this.pCanvas.ctxt = ctxt;
413+ this.pCanvas.canvas = canvas;
414+ this.pCanvas.pid = sys->pctl(0, nil);
415+
416+ spawn handler(menu, cmdchan, butt, key, this, job);
417+}
418+
419+handler(menu, cmd, butt, key : chan of string, this : ref iFramePeer_obj, job: JObject)
420+{
421+ detail: string;
422+ iconified := 0;
423+ toplvl := this.pCanvas.top;
424+
425+ if (menu == nil)
426+ menu = nochan;
427+ for (;;) alt {
428+ detail = <- menu =>
429+ case detail {
430+ "exit" =>
431+# this.pCanvas.events <- = ref Event(Event.Shutdown, nil);
432+ # 'X' button in titlebar is passed to Java code
433+ # as a WINDOW_CLOSING event.
434+ doFclosing(this.thisAsJObject);
435+
436+ "task" =>
437+ iconified = 1;
438+ this.pCanvas.image = nil;
439+ doFiconified(job);
440+
441+ # synthesize a WINDOW_DEACTIVATED event, the TK "FocusOut"
442+ # event doesn't arrive until after this window has been
443+ # selected and deiconified from the toolbar.
444+ doFdeactivated(this.thisAsJObject);
445+ wmlib->titlectl(toplvl, detail); # shrink it
446+
447+ * => # default wmlib actions for move, size, ok, help
448+ wmlib->titlectl(toplvl, detail);
449+ }
450+# wmlib->titlectl(this.pCanvas.top, detail);
451+
452+ detail = <- cmd =>
453+ (n, word) := sys->tokenize(detail, " ");
454+ case hd word {
455+ "configure" or "map" =>
456+ this.pCanvas.image = this.pCanvas.top.image;
457+ this.pCanvas.rect = canvposn(toplvl, this.pCanvas.canvas);
458+# e := Event.Resize;
459+ if (hd word == "map") {
460+ # if being mapped after an iconfication
461+ if (iconified) {
462+ iconified = 0;
463+ doFdeIconified(this.thisAsJObject);
464+ }
465+# sys->print("mapped\n");
466+ tk->cmd(toplvl, "focus " + this.pCanvas.canvas);
467+# deIconify(job);
468+ r := this.pCanvas.rect;
469+ javapainttarget(job, r);
470+ }
471+ else{
472+ r := this.pCanvas.rect;
473+ javamvsz(job, r);
474+ }
475+
476+ # receiving or losing window's keyboard focus should
477+ # generate frame activation events upto Javaland
478+ "focusIn" =>
479+ doFactivated(this.thisAsJObject);
480+ "focusOut" =>
481+ # ignore loss-of-Tk-focus events that result from
482+ # iconification.
483+ if (! iconified) {
484+ doFdeactivated(this.thisAsJObject);
485+ }
486+ # sent by dispose() to terminate this event handling thread
487+ "reallyExit" =>
488+ sys->print("iFrame_Peer_L.handler(): suicide\n");
489+ exit;
490+ * =>
491+ sys->print("iFrame_Peer_L.handler(): unknown event - %s\n",
492+ detail);
493+ }
494+
495+ detail = <- butt =>
496+ doMouseEvent(job, detail);
497+ detail = <- key =>
498+ doKeyEvent(job, detail);
499+ }
500+}
501+
502+expand(cmd, canvas: string): string
503+{
504+ s: string;
505+ for (;;) {
506+ (l, r) := str->splitl(cmd, "#");
507+ s = s + l;
508+ if (r == nil)
509+ return s;
510+ s = s + canvas;
511+ cmd = r[1:];
512+ }
513+}
514+
515+canvposn(t: ref Toplevel, c: string): Rect
516+{
517+ r: Rect;
518+
519+ r.min.x = int tk->cmd(t, ". cget -actx");
520+ r.min.y = int tk->cmd(t, ". cget -acty");
521+ r.max.x = r.min.x - 1 + int tk->cmd(t, ". cget -actwidth");
522+ r.max.y = r.min.y - 1 + int tk->cmd(t, ". cget -actheight");
523+ return r;
524+}
525+
526+doFactivated(job : JObject) {
527+ (val, err) := jni->CallMethod(job, "handleActivated", "()V", nil);
528+ if (err != jni->OK)
529+ sys->print( "CallMethod Error %d: handleActivated\n",err);
530+
531+}
532+
533+doFdeactivated(job : JObject) {
534+ (val, err) := jni->CallMethod(job, "handleDeactivated", "()V", nil);
535+ if (err != jni->OK)
536+ sys->print( "CallMethod Error %d: handleDeactivated\n",err);
537+
538+}
539+
540+doFclosing(job : JObject) {
541+ (val, err) := jni->CallMethod(job, "handleClosing", "()V", nil);
542+ if (err != jni->OK)
543+ sys->print( "CallMethod Error %d: handleClosingt\n",err);
544+
545+}
546+
547+doFiconified(job : JObject) {
548+ (val, err) := jni->CallMethod(job, "handleIconified", "()V", nil);
549+ if (err != jni->OK)
550+ sys->print( "CallMethod Error %d: handleIconified\n",err);
551+}
552+
553+doFdeIconified(job : JObject) {
554+ (val, err) := jni->CallMethod(job, "handleDeIconified", "()V", nil);
555+ if (err != jni->OK)
556+ sys->print( "CallMethod Error %d: handleDeIconified\n",err);
557+}
558+doKeyEvent(job : JObject, detail : string) {
559+ (kchar, st) := str->toint(detail, 16);
560+ args := array[1] of ref Value;
561+ args[0] = ref Value.TInt(kchar);
562+ (val, err) := jni->CallMethod(job, "handleKeyEvents", "(I)V", args);
563+ if (err != jni->OK){
564+ sys->print( "CallMethod Error %d: handleKeyEvents\n",err);
565+ }
566+}
567+
568+doMouseEvent(job : JObject, detail : string) {
569+ (n,toks) := sys->tokenize(detail," ");
570+ if (n != 4) return;
571+ mode := array of byte hd toks;
572+ toks = tl toks;
573+ button:=int hd toks;
574+ toks = tl toks;
575+ x:=int hd toks;
576+ toks = tl toks;
577+ y:=int hd toks;
578+ args := array[4] of ref Value;
579+ args[0] = ref Value.TInt(int mode[0]);
580+ args[1] = ref Value.TInt(button);
581+ args[2] = ref Value.TInt(x);
582+ args[3] = ref Value.TInt(y);
583+ (val, err) := jni->CallMethod(job, "handleMouseEvents", "(IIII)V", args);
584+ if (err != jni->OK){
585+ sys->print( "CallMethod Error %d: handleMouseEvents\n",err);
586+ }
587+}
588+#<<
java/pkg2/inferno/awt/iFramePeer_L.m+36−0
@@ -0,0 +1,36 @@
1+# javal v1.5 generated file: edit with care
2+
3+iFramePeer_L : module
4+{
5+ iFramePeer_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ pCanvas : ref Canvas; #JObject;
9+ thisAsJObject : JObject;
10+ target : JObject;
11+ leftInset : int;
12+ rightInset : int;
13+ topInset : int;
14+ bottomInset : int;
15+ left : int;
16+ top : int;
17+ buttonState : JArrayZ;
18+ oldMousePoint : JObject;
19+ resizable : int;
20+ };
21+
22+ init : fn( jni_p : JNI );
23+ getRefImage_rObject : fn( this : ref iFramePeer_obj) : ref Draw->Image;
24+ getRefOffScreenImage_rObject : fn(this :ref iFramePeer_obj) : ref Draw->Image;
25+ pReshape_I_I_I_I_V : fn( this : ref iFramePeer_obj, p0 : int,p1 : int,p2 : int,p3 : int);
26+ pHide_V : fn( this : ref iFramePeer_obj);
27+ pShow_riFramePeer_V : fn( this : ref iFramePeer_obj, p0 : JObject);
28+ getXYLoc_I_I : fn( this : ref iFramePeer_obj, p0 : int) : int;
29+ create_riFramePeer_V : fn( this : ref iFramePeer_obj, p0 : JObject);
30+ pDispose_V : fn( this : ref iFramePeer_obj);
31+ setCursor_I_V : fn( this : ref iFramePeer_obj, p0 : int);
32+ setTitle_rString_V : fn( this : ref iFramePeer_obj, p0 : JString);
33+ toFront_V : fn( this : ref iFramePeer_obj);
34+ toBack_V : fn( this : ref iFramePeer_obj);
35+
36+};
java/pkg2/inferno/awt/iGraphics.java+606−0
@@ -0,0 +1,606 @@
1+package inferno.awt;
2+
3+import java.awt.*;
4+import java.awt.peer.*;
5+import java.io.*;
6+import java.util.*;
7+import java.awt.image.ImageObserver;
8+import inferno.awt.iFontPeer;
9+
10+//import sun.awt.image.OffScreenImageSource;
11+//import sun.awt.image.ImageRepresentation;
12+
13+/**
14+ * iGraphics is an object that encapsulates a graphics context for a
15+ * particular canvas.
16+ *
17+ * @version 1.18 18 Mar 1996
18+ */
19+
20+public class iGraphics extends Graphics {
21+ // Object pcanvas;
22+ Object refImage;
23+ Object refOffScreenImage;
24+ Component target;
25+ Color foreground;
26+ Font font;
27+ private iFontPeer ifontpeer;
28+ int originX;
29+ int originY;
30+ Rectangle clipRect;
31+ Rectangle initialClipRect;
32+ boolean dirty;
33+
34+ //private native void imageCreate(ImageRepresentation ir);
35+ private native void pSetForeground(int r, int g, int b);
36+
37+ private Image image;
38+
39+ private Object awt; // Pointer to awt object
40+
41+ private native void createGraphics();
42+
43+ public iGraphics(Object refImage, Object refOffScreenImage, Rectangle initialClipRect, Component target)
44+ {
45+ this.refImage = refImage;
46+ this.refOffScreenImage = refOffScreenImage;
47+ this.initialClipRect = new Rectangle(initialClipRect);
48+ this.clipRect = new Rectangle(initialClipRect);
49+ this.target = target;
50+ this.font = target.getFont();
51+ if (font != null) {
52+ this.ifontpeer = (iFontPeer)font.getPeer();
53+ }
54+ dirty = false;
55+ createGraphics();
56+ }
57+
58+// a dummy constructor for testing
59+ public iGraphics(Object im) {
60+ }
61+
62+
63+ public iGraphics(Image image) {
64+ }
65+
66+ /**
67+ * Create a new iGraphics Object based on this one.
68+ */
69+ public Graphics create() {
70+ iGraphics g = new iGraphics(refImage, refOffScreenImage, initialClipRect, target);
71+ g.foreground = foreground;
72+ g.font = font;
73+ g.ifontpeer = ifontpeer;
74+ g.originX = originX;
75+ g.originY = originY;
76+ g.image = image;
77+ //g.clipRect = clipRect;
78+ //g.initialClipRect = initialClipRect;
79+ return g;
80+ }
81+
82+ private void checkDirty()
83+ {
84+ if (dirty)
85+ {
86+ dirty = false;
87+ copyOffscreenImage(clipRect.x,clipRect.y,clipRect.width,clipRect.height);
88+ }
89+
90+ }
91+
92+
93+ /**
94+ * Translate
95+ */
96+ public void translate(int x, int y) {
97+ originX += x;
98+ originY += y;
99+ clipRect.translate(-x,-y);
100+ initialClipRect.translate(-x,-y);
101+ }
102+
103+ /**
104+ * Disposes of this iGraphics context. It cannot be used after being
105+ * disposed.
106+ */
107+ private native void pDispose();
108+
109+ public void dispose()
110+ {
111+ checkDirty();
112+ pDispose();
113+ }
114+
115+ public void setFont(Font font) {
116+ if ((font != null) && (this.font != font)) {
117+ synchronized (this.font) {
118+ this.font = font;
119+ ifontpeer = (iFontPeer)font.getPeer();
120+ }
121+ }
122+ }
123+ public Font getFont() {
124+ return this.font;
125+ }
126+
127+ /**
128+ * Gets font metrics for the given font.
129+ */
130+ public FontMetrics getFontMetrics(Font font) {
131+ return iFontMetrics.getFontMetrics(font);
132+ }
133+
134+
135+ private void ourSetForeground()
136+ {
137+ pSetForeground(foreground.getRed(), foreground.getGreen(), foreground.getBlue());
138+ }
139+
140+ /**
141+ * Sets the foreground color.
142+ */
143+ public void setColor(Color c) {
144+ if ((c != null) && (c != foreground)) {
145+ foreground = c;
146+ pSetForeground(c.getRed(), c.getGreen(), c.getBlue());
147+ }
148+ }
149+ public Color getColor() {
150+ return foreground;
151+ }
152+
153+
154+ /**
155+ * Sets the paint mode to overwrite the destination with the
156+ * current color. This is the default paint mode.
157+ */
158+ public native void setPaintMode();
159+
160+ /**
161+ * Sets the paint mode to alternate between the current color
162+ * and the given color.
163+ */
164+ public native void setXORMode(Color c1);
165+
166+ /**
167+ * Gets the current clipping area
168+ */
169+ public Rectangle getClipBounds()
170+ {
171+ return new Rectangle(clipRect);
172+ }
173+
174+ private native void changeClip(int X, int Y, int W, int H, boolean set);
175+
176+ private void removeClip()
177+ {
178+ checkDirty();
179+ clipRect = new Rectangle(initialClipRect);
180+ }
181+
182+ private void ourSetClip()
183+ {
184+ dirty = true;
185+ changeClip(clipRect.x,clipRect.y,clipRect.width,clipRect.height,true);
186+ }
187+
188+ /** Crops the clipping rectangle for this iGraphics context. */
189+ public void clipRect(int X, int Y, int W, int H) {
190+ checkDirty();
191+ clipRect = clipRect.intersection(new Rectangle(X,Y,W,H)); // test lg
192+ // System.out.println("java == intersection: "+ clipRect);
193+ //changeClip(X, Y, W, H, false);
194+ }
195+
196+ /** Sets the clipping rectangle for this iGraphics context. */
197+ public void setClip(int X, int Y, int W, int H) {
198+ checkDirty();
199+ clipRect = new Rectangle(X,Y,W,H);
200+ //changeClip(X, Y, W, H, true);
201+ }
202+
203+ /** Returns a Shape object representing the clip. */
204+ public Shape getClip() {
205+ return getClipBounds();
206+ }
207+
208+ /** Sets the clip to a Shape (only Rectangle allowed). */
209+ public void setClip(Shape clip) {
210+ if (clip == null) {
211+ removeClip();
212+ } else if (clip instanceof Rectangle) {
213+ Rectangle r = (Rectangle) clip;
214+ checkDirty();
215+ clipRect = new Rectangle(r);
216+ //changeClip(r.x, r.y, r.width, r.height, true);
217+ } else {
218+ throw new IllegalArgumentException("setClip(Shape) only supports Rectangle objects");
219+ }
220+ }
221+
222+ /** Clears the rectangle indicated by x,y,w,h. */
223+ private native void pClearRect(int x, int y, int w, int h);
224+
225+ public void clearRect(int x, int y, int w, int h)
226+ {
227+ ourSetClip();
228+ pClearRect(x,y,w,h);
229+ }
230+
231+ /** Fills the given rectangle with the foreground color. */
232+ private native void pFillRect(int X, int Y, int W, int H);
233+
234+ public void fillRect(int X, int Y, int W, int H)
235+ {
236+ ourSetClip();
237+ pFillRect(X,Y,W,H);
238+ }
239+
240+ /** Draws the given rectangle. */
241+ private native void pDrawRect(int X, int Y, int W, int H);
242+
243+ public void drawRect(int X, int Y, int W, int H)
244+ {
245+ ourSetClip();
246+ pDrawRect(X,Y,W,H);
247+ }
248+
249+
250+ /** Draws the given string. */
251+ public void drawString(String str, int x, int y) {
252+ drawStringWidth(str, x, y);
253+ }
254+
255+ /** Draws the given character array. */
256+ public void drawChars(char data[], int offset, int length, int x, int y) {
257+ String str = new String(data, offset, length);
258+ drawStringWidth(str, x, y);
259+ // drawCharsWidth(data, offset, length, x, y);
260+ }
261+
262+ /** Draws the given byte array. */
263+ public void drawBytes(byte data[], int offset, int length, int x, int y) {
264+ String str = new String(data, offset, length);
265+ drawStringWidth(str, x, y);
266+ // drawBytesWidth(data, offset, length, x, y);
267+ }
268+
269+ /** Draws the given string and returns the length of the drawn
270+ string in pixels. If font is not set then returns -1. */
271+ private native int pDrawStringWidth(String str, int x, int y);
272+
273+ private int drawStringWidth(String str, int x, int y)
274+ {
275+ int r;
276+ ourSetClip();
277+ if (ifontpeer == null) {
278+ return 0;
279+ }
280+ r = pDrawStringWidth(str, x, y - ifontpeer.iAscent - ifontpeer.fLeading);
281+ // System.out.println("Length of string "+r);
282+ return r;
283+ }
284+
285+ /** Draws the given character array and return the width in
286+ pixels. If font is not set then returns -1. */
287+// public native int drawCharsWidth(char data[], int offset, int length,
288+// int x, int y);
289+
290+ /** Draws the given character array and return the width in
291+ pixels. If font is not set then returns -1. */
292+// public native int drawBytesWidth(byte data[], int offset, int length,
293+// int x, int y);
294+
295+ /** Draws the given line. */
296+ private native void pDrawLine(int x1, int y1, int x2, int y2);
297+
298+ public void drawLine(int x1, int y1, int x2, int y2) {
299+ ourSetClip();
300+ pDrawLine(x1, y1, x2, y2);
301+ }
302+
303+ /**
304+ * Draws an image at x,y in nonblocking mode with a callback object.
305+ */
306+ public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
307+ // We need to get the bits.
308+ if ( img == null )
309+ return false;
310+ java.awt.image.ImageProducer ip = img.getSource();
311+ java.awt.image.ImageConsumer ic = new iImageConsumer(this, img, x, y);
312+ ip.startProduction(ic);
313+ ip.removeConsumer(ic);
314+ /*WImage wImg = (WImage) img;
315+ if (wImg.hasError()) {
316+ if (observer != null) {
317+ observer.imageUpdate(img,
318+ ImageObserver.ERROR|ImageObserver.ABORT,
319+ -1, -1, -1, -1);
320+ }
321+ return false;
322+ }
323+ ImageRepresentation ir = wImg.getImageRep();
324+ return ir.drawImage(this, x, y, null, observer);
325+ */
326+ return false;
327+ }
328+
329+ /**
330+ * Draws an image scaled to x,y,w,h in nonblocking mode with a
331+ * callback object.
332+ */
333+ public boolean drawImage(Image img, int x, int y, int width, int height,
334+ ImageObserver observer) {
335+ /*if (width == 0 || height == 0) {
336+ return true;
337+ }
338+ WImage wImg = (WImage) img;
339+ if (wImg.hasError()) {
340+ if (observer != null) {
341+ observer.imageUpdate(img,
342+ ImageObserver.ERROR|ImageObserver.ABORT,
343+ -1, -1, -1, -1);
344+ }
345+ return false;
346+ }
347+ ImageRepresentation ir = wImg.getImageRep();
348+ return ir.drawScaledImage(this, x, y, width, height, null, observer);
349+ */
350+ return false;
351+ }
352+
353+ /**
354+ * Draws an image at x,y in nonblocking mode with a solid background
355+ * color and a callback object.
356+ */
357+ public boolean drawImage(Image img, int x, int y, Color bg,
358+ ImageObserver observer) {
359+ /*WImage wImg = (WImage) img;
360+ if (wImg.hasError()) {
361+ if (observer != null) {
362+ observer.imageUpdate(img,
363+ ImageObserver.ERROR|ImageObserver.ABORT,
364+ -1, -1, -1, -1);
365+ }
366+ return false;
367+ }
368+ ImageRepresentation ir = wImg.getImageRep();
369+ return ir.drawImage(this, x, y, bg, observer);
370+ */
371+ return false;
372+ }
373+
374+ /**
375+ * Draws an image scaled to x,y,w,h in nonblocking mode with a
376+ * solid background color and a callback object.
377+ */
378+ public boolean drawImage(Image img, int x, int y, int width, int height,
379+ Color bg, ImageObserver observer) {
380+ /*if (width == 0 || height == 0) {
381+ return true;
382+ }
383+ WImage wImg = (WImage) img;
384+ if (wImg.hasError()) {
385+ if (observer != null) {
386+ observer.imageUpdate(img,
387+ ImageObserver.ERROR|ImageObserver.ABORT,
388+ -1, -1, -1, -1);
389+ }
390+ return false;
391+ }
392+ ImageRepresentation ir = wImg.getImageRep();
393+ return ir.drawScaledImage(this, x, y, width, height, bg, observer);
394+ */
395+ return false;
396+ }
397+
398+ /**
399+ * Draws a subrectangle of an image scaled to a destination rectangle
400+ * in nonblocking mode with a callback object.
401+ */
402+ public boolean drawImage(Image img,
403+ int dx1, int dy1, int dx2, int dy2,
404+ int sx1, int sy1, int sx2, int sy2,
405+ ImageObserver observer) {
406+ /*if (dx1 == dx2 || dy1 == dy2) {
407+ return true;
408+ }
409+ WImage wImg = (WImage) img;
410+ if (wImg.hasError()) {
411+ if (observer != null) {
412+ observer.imageUpdate(img,
413+ ImageObserver.ERROR|ImageObserver.ABORT,
414+ -1, -1, -1, -1);
415+ }
416+ return false;
417+ }
418+ ImageRepresentation ir = wImg.getImageRep();
419+ return ir.drawStretchImage(this,
420+ dx1, dy1, dx2, dy2,
421+ sx1, sy1, sx2, sy2,
422+ null, observer);
423+ */
424+ return false;
425+ }
426+
427+ /**
428+ * Draws a subrectangle of an image scaled to a destination rectangle in
429+ * nonblocking mode with a solid background color and a callback object.
430+ */
431+ public boolean drawImage(Image img,
432+ int dx1, int dy1, int dx2, int dy2,
433+ int sx1, int sy1, int sx2, int sy2,
434+ Color bgcolor, ImageObserver observer) {
435+ /*if (dx1 == dx2 || dy1 == dy2) {
436+ return true;
437+ }
438+ WImage wImg = (WImage) img;
439+ if (wImg.hasError()) {
440+ if (observer != null) {
441+ observer.imageUpdate(img,
442+ ImageObserver.ERROR|ImageObserver.ABORT,
443+ -1, -1, -1, -1);
444+ }
445+ return false;
446+ }
447+ ImageRepresentation ir = wImg.getImageRep();
448+ return ir.drawStretchImage(this,
449+ dx1, dy1, dx2, dy2,
450+ sx1, sy1, sx2, sy2,
451+ bgcolor, observer);
452+ */
453+ return false;
454+ }
455+
456+ /**
457+ * Actually draws the image on the Inferno display in a blocking mode.
458+ */
459+ private native void pGenDraw(int x, int y, int w, int h, byte pixels[]);
460+
461+ protected void drawImage(int x, int y, int w, int h, byte pixels[]) {
462+ ourSetClip();
463+ //ourSetForeground();
464+ pGenDraw(x, y, w, h, pixels);
465+ return;
466+ }
467+
468+ /**
469+ * Copies an area of the canvas that this graphics context paints to.
470+ * @param X the x-coordinate of the source.
471+ * @param Y the y-coordinate of the source.
472+ * @param W the width.
473+ * @param H the height.
474+ * @param dx the x-coordinate of the destination.
475+ * @param dy the y-coordinate of the destination.
476+ */
477+ public native void copyArea(int X, int Y, int W, int H, int dx, int dy);
478+
479+
480+ /** Draws a rounded rectangle. */
481+ private native void pDrawRoundRect(int x, int y, int w, int h,
482+ int arcWidth, int arcHeight);
483+
484+ public void drawRoundRect(int x, int y, int w, int h,
485+ int arcWidth, int arcHeight)
486+ {
487+ ourSetClip();
488+ pDrawRoundRect(x,y,w,h,arcWidth,arcHeight);
489+ }
490+
491+ /** Draws a filled rounded rectangle. */
492+ private native void pFillRoundRect(int x, int y, int w, int h,
493+ int arcWidth, int arcHeight);
494+
495+ public void fillRoundRect(int x, int y, int w, int h,
496+ int arcWidth, int arcHeight)
497+ {
498+ ourSetClip();
499+ pFillRoundRect(x,y,w,h,arcWidth,arcHeight);
500+ }
501+
502+ /** Draws a polygon defined by an array of x points and y points */
503+ private native void pDrawPolygon(int xPoints[], int yPoints[], int nPoints);
504+
505+ public void drawPolygon(int xPoints[], int yPoints[], int nPoints)
506+ {
507+ ourSetClip();
508+ pDrawPolygon(xPoints,yPoints,nPoints);
509+ }
510+
511+ /** Draws a polygon defined by an array of x points and y points */
512+ private native void pDrawPolyline(int xPoints[], int yPoints[], int nPoints);
513+
514+ public void drawPolyline(int xPoints[], int yPoints[], int nPoints)
515+ {
516+ ourSetClip();
517+ pDrawPolyline(xPoints,yPoints,nPoints);
518+ }
519+
520+ /** Fills a polygon with the current fill mask */
521+ private native void pFillPolygon(int xPoints[], int yPoints[], int nPoints);
522+
523+ public void fillPolygon(int xPoints[], int yPoints[], int nPoints)
524+ {
525+ ourSetClip();
526+ pFillPolygon(xPoints,yPoints,nPoints);
527+ }
528+
529+ /** Draws an oval to fit in the given rectangle */
530+ private native void pDrawOval(int x, int y, int w, int h);
531+
532+ public void drawOval(int x, int y, int w, int h)
533+ {
534+ ourSetClip();
535+ pDrawOval(x,y,w,h);
536+ }
537+
538+ /** Fills an oval to fit in the given rectangle */
539+ private native void pFillOval(int x, int y, int w, int h);
540+
541+ public void fillOval(int x, int y, int w, int h)
542+ {
543+ ourSetClip();
544+ pFillOval(x,y,w,h);
545+ }
546+
547+ /**
548+ * Draws an arc bounded by the given rectangle from startAngle to
549+ * endAngle. 0 degrees is a vertical line straight up from the
550+ * center of the rectangle. Positive angles indicate clockwise
551+ * rotations, negative angle are counter-clockwise.
552+ */
553+ private native void pDrawArc(int x, int y, int w, int h,
554+ int startAngle,
555+ int endAngle);
556+
557+ public void drawArc(int x, int y, int w, int h,
558+ int startAngle,
559+ int endAngle)
560+ {
561+ ourSetClip();
562+ pDrawArc(x,y,w,h,startAngle,endAngle);
563+ }
564+
565+ /** fills an arc. arguments are the same as drawArc. */
566+ private native void pFillArc(int x, int y, int w, int h,
567+ int startAngle,
568+ int endAngle);
569+
570+ public void fillArc(int x, int y, int w, int h,
571+ int startAngle,
572+ int endAngle)
573+ {
574+ ourSetClip();
575+ pFillArc(x,y,w,h,startAngle,endAngle);
576+ }
577+
578+
579+ public String toString() {
580+ return (getClass().getName() + "[" + originX + "," + originY +
581+ "[font=" + getFont() + "], color=" + getColor() + "]");
582+ }
583+
584+ // Print a peer using this graphics object.
585+ void print(ComponentPeer peer)
586+ {
587+ }
588+
589+ /* Outline the given region. */
590+ //public native void drawRegion(Region r);
591+
592+ /* Fill the given region. */
593+ //public native void fillRegion(Region r);
594+
595+ /** Terminates a PrintJob and releases resources */
596+ public void close(PrintJob pj)
597+ {
598+ }
599+
600+ private native void copyOffscreenImage(int X, int Y, int W, int H);
601+
602+}
603+
604+
605+
606+
java/pkg2/inferno/awt/iGraphics_L.b+245−0
@@ -0,0 +1,245 @@
1+implement iGraphics_L;
2+
3+include "jni.m";
4+ jni : JNI;
5+ ClassModule,
6+ JString,
7+ JArray,
8+ JArrayI,
9+ JArrayC,
10+ JArrayB,
11+ JArrayS,
12+ JArrayJ,
13+ JArrayF,
14+ JArrayD,
15+ JArrayZ,
16+ JArrayJObject,
17+ JArrayJClass,
18+ JArrayJString,
19+ JClass,
20+ JThread,
21+ JObject : import jni;
22+
23+#>> extra pre includes here
24+#
25+# %W% - %E%
26+#
27+ sys : Sys;
28+ draw: Draw;
29+ Point, Font: import draw;
30+include "awt_Graphics.m";
31+
32+include "iFontPeer_L.m";
33+ ifontpeerm: iFontPeer_L;
34+ iFontPeer_obj : import ifontpeerm;
35+
36+#<<
37+
38+include "iGraphics_L.m";
39+
40+#>> extra post includes here
41+
42+#<<
43+
44+init( jni_p : JNI )
45+{
46+ # save java native inteface mod instance
47+ jni = jni_p;
48+ #>>extra initialization here
49+ sys = jni->sys;
50+
51+ #<<
52+}
53+
54+
55+pSetForeground_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int)
56+{#>>
57+ this.awt->setForeground(p0, p1, p2);
58+}#<<
59+
60+createGraphics_V( this : ref iGraphics_obj)
61+{#>>
62+ this.awt = load AwtGraphics AwtGraphics->PATH;;
63+ if (this.awt == nil) {
64+ sys->print("could not load %s: %r\n", AwtGraphics->PATH);
65+ return;
66+ }
67+ this.awt->init(this.refImage, this.refOffScreenImage);
68+}#<<
69+
70+pDispose_V( this : ref iGraphics_obj)
71+{#>>
72+}#<<
73+
74+setPaintMode_V( this : ref iGraphics_obj)
75+{#>>
76+}#<<
77+
78+setXORMode_rColor_V( this : ref iGraphics_obj, p0 : JObject)
79+{#>>
80+}#<<
81+
82+changeClip_I_I_I_I_Z_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int)
83+{#>>
84+ this.awt->changeClip(p0 + this.originX, p1 + this.originY, p2, p3);
85+}#<<
86+
87+pClearRect_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int)
88+{#>>
89+ this.awt->clearRect(p0 + this.originX, p1 + this.originY, p2, p3);
90+}#<<
91+
92+pFillRect_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int)
93+{#>>
94+
95+ tp := (p0, p1);
96+ p := dp(this, tp);
97+
98+ ply := array [5] of {p, (p.x + p2 - 1, p.y), (p.x + p2 - 1, p.y + p3 - 1),
99+ (p.x, p.y + p3 - 1), p};
100+ this.awt->fillRect(ply);
101+}#<<
102+
103+pDrawRect_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int)
104+{#>>
105+ tp := (p0, p1);
106+ p := dp(this, tp);
107+
108+ ply := array [5] of {p, (p.x + p2 - 1, p.y), (p.x + p2 - 1, p.y + p3 - 1),
109+ (p.x, p.y + p3 - 1), p};
110+ this.awt->drawRect(ply);
111+}#<<
112+
113+pDrawStringWidth_rString_I_I_I( this : ref iGraphics_obj, p0 : JString,p1 : int,p2 : int) : int
114+{#>>
115+ str : string;
116+ sp : Point;
117+ sp.x = p1;
118+ sp.y = p2;
119+
120+ str = p0.str;
121+ sp = dp(this, sp);
122+ return this.awt->drawStringWidth(str, sp, this.ifontpeer.iFontRef );
123+}#<<
124+
125+pDrawLine_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int)
126+{#>>
127+ sp, ep : Point;
128+ sp.x = this.originX + p0;
129+ sp.y = this.originY + p1;
130+ ep.x = this.originX + p2;
131+ ep.y = this.originY + p3;
132+ this.awt->drawLine(sp, ep);
133+}#<<
134+
135+pGenDraw_I_I_I_I_aB_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int, p4 : JArrayB)
136+{#>>
137+ p0 += this.originX;
138+ p1 += this.originY;
139+ r := Draw->Rect((p0,p1),(p0+p2,p1+p3));
140+ this.awt->genDraw(r, p4.ary);
141+}#<<
142+
143+copyArea_I_I_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int)
144+{#>>
145+ data := array [(p2 - p0 + 1) * (p3 - p1 + 1)] of byte;
146+ rect0, rect1 : Draw->Rect;
147+ rect0.min = (p0, p1);
148+ rect0.max = (p2, p3);
149+ rect1.min = (p0 + p4, p1 + p5);
150+ rect1.max = (p2 + p4, p3 + p5);
151+ this.awt->copyArea(rect0, rect1, data);
152+}#<<
153+
154+pDrawRoundRect_I_I_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int)
155+{#>>
156+}#<<
157+
158+pFillRoundRect_I_I_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int)
159+{#>>
160+}#<<
161+
162+pDrawPolygon_aI_aI_I_V( this : ref iGraphics_obj, p0 : JArrayI,p1 : JArrayI,p2 : int)
163+{#>>
164+ ply := array [p2 + 1] of Point;
165+ for (i := 0; i < p2; i++){
166+ ply[i].x = p0.ary[i] + this.originX;
167+ ply[i].y = p1.ary[i] + this.originY;
168+ }
169+ ply[p2].x = ply[0].x;
170+ ply[p2].y = ply[0].y;
171+ this.awt->drawPolygon(ply);
172+}#<<
173+
174+pDrawPolyline_aI_aI_I_V( this : ref iGraphics_obj, p0 : JArrayI,p1 : JArrayI,p2 : int)
175+{#>>
176+ ply := array [p2] of Point;
177+ for (i := 0; i < p2; i++){
178+ ply[i].x = p0.ary[i] + this.originX;
179+ ply[i].y = p1.ary[i] + this.originY;
180+ }
181+ this.awt->drawPolygon(ply);
182+}#<<
183+
184+pFillPolygon_aI_aI_I_V( this : ref iGraphics_obj, p0 : JArrayI,p1 : JArrayI,p2 : int)
185+{#>>
186+ ply := array [p2 + 1] of Point;
187+ for (i := 0; i < p2; i++){
188+ ply[i].x = p0.ary[i] + this.originX;
189+ ply[i].y = p1.ary[i] + this.originY;
190+ }
191+ ply[p2].x = ply[0].x;
192+ ply[p2].y = ply[0].y;
193+ this.awt->fillPolygon(ply);
194+}#<<
195+
196+pDrawOval_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int)
197+{#>>
198+ tp := (p0, p1);
199+ p := dp(this, tp);
200+ this.awt->drawOval(p, p2, p3);
201+}#<<
202+
203+pFillOval_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int)
204+{#>>
205+ tp := (p0, p1);
206+ p := dp(this, tp);
207+
208+ this.awt->fillOval(p, p2, p3);
209+}#<<
210+
211+pDrawArc_I_I_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int)
212+{#>>
213+
214+ tp := (p0, p1);
215+ p := dp(this, tp);
216+ this.awt->drawArc(p, p2, p3, p4, p5);
217+}#<<
218+
219+pFillArc_I_I_I_I_I_I_V( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int)
220+{#>>
221+ tp := (p0, p1);
222+ p := dp(this, tp);
223+ this.awt->fillArc(p, p2, p3, p4, p5);
224+}#<<
225+
226+copyOffscreenImage_I_I_I_I_V( this : ref iGraphics_obj, p0 : int, p1: int, p2: int, p3: int)
227+{#>>
228+ this.awt->getDC(this.refImage, this.refOffScreenImage);
229+ this.awt->sendToDisplay(((p0+this.originX,p1+this.originY),
230+ (p0+this.originX+p2-1,p1+this.originY+p3-1)));
231+}#<<
232+
233+
234+#>>
235+
236+# duplicates a point and translates into this graphic's region
237+dp(this : ref iGraphics_obj, p : Point) :Point
238+{
239+ pt := p;
240+ pt.x += this.originX;
241+ pt.y += this.originY;
242+ return pt;
243+}
244+
245+#<<
java/pkg2/inferno/awt/iGraphics_L.m+50−0
@@ -0,0 +1,50 @@
1+#
2+# %W% - %E%
3+#
4+# generated file edit with care
5+
6+iGraphics_L : module
7+{
8+ iGraphics_obj : adt
9+ {
10+ cl_mod : ClassModule;
11+ refImage : ref Draw->Image;
12+ refOffScreenImage : ref Draw->Image;
13+ target : JObject;
14+ foreground : JObject;
15+ font : JObject;
16+ ifontpeer : ref iFontPeer_obj;
17+ originX : int;
18+ originY : int;
19+ clipRect : JObject;
20+ initialClipRect : JObject;
21+ dirty : int;
22+ image : JObject;
23+ awt : AwtGraphics;
24+ };
25+
26+ init : fn( jni_p : JNI );
27+ pSetForeground_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int);
28+ createGraphics_V : fn( this : ref iGraphics_obj);
29+ pDispose_V : fn( this : ref iGraphics_obj);
30+ setPaintMode_V : fn( this : ref iGraphics_obj);
31+ setXORMode_rColor_V : fn( this : ref iGraphics_obj, p0 : JObject);
32+ changeClip_I_I_I_I_Z_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int);
33+ pClearRect_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int);
34+ pFillRect_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int);
35+ pDrawRect_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int);
36+ pDrawStringWidth_rString_I_I_I : fn( this : ref iGraphics_obj, p0 : JString,p1 : int,p2 : int) : int;
37+ pDrawLine_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int);
38+ pGenDraw_I_I_I_I_aB_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : JArrayB);
39+ copyArea_I_I_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int);
40+ pDrawRoundRect_I_I_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int);
41+ pFillRoundRect_I_I_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int);
42+ pDrawPolygon_aI_aI_I_V : fn( this : ref iGraphics_obj, p0 : JArrayI,p1 : JArrayI,p2 : int);
43+ pDrawPolyline_aI_aI_I_V : fn( this : ref iGraphics_obj, p0 : JArrayI,p1 : JArrayI,p2 : int);
44+ pFillPolygon_aI_aI_I_V : fn( this : ref iGraphics_obj, p0 : JArrayI,p1 : JArrayI,p2 : int);
45+ pDrawOval_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int);
46+ pFillOval_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int);
47+ pDrawArc_I_I_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int);
48+ pFillArc_I_I_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int);
49+ copyOffscreenImage_I_I_I_I_V : fn( this : ref iGraphics_obj, p0 : int, p1: int, p2: int, p3: int);
50+};
java/pkg2/inferno/awt/iImage.java+51−0
@@ -0,0 +1,51 @@
1+/*
2+ *
3+ * %W% - %E%
4+ *
5+ * Adapted from SunSoft's X11Image.java 1.7 97/02/24
6+ */
7+package inferno.awt;
8+
9+import java.awt.Component;
10+import java.awt.Graphics;
11+import java.awt.image.ImageProducer;
12+
13+import sun.awt.image.ImageRepresentation;
14+
15+class iImage extends sun.awt.image.Image {
16+ /**
17+ * Construct an image for offscreen rendering to be used with a
18+ * given Component.
19+ */
20+ public iImage(Component c, int w, int h) {
21+ super(c, w, h);
22+ }
23+
24+ /**
25+ * Construct an image from an ImageProducer object.
26+ */
27+ public iImage(ImageProducer producer) {
28+ super(producer);
29+ }
30+
31+ public Graphics getGraphics() {
32+ throw new IllegalAccessError("getGraphics() only valid for images created with createImage(w, h)");
33+ }
34+
35+ protected ImageRepresentation makeImageRep() {
36+ // make Inferno ImageRepresentation - jfs
37+ //return new ImageRepresentation(this, -1, -1, 0);
38+ return new iImageRepresentation(this, -1, -1, 0);
39+ }
40+
41+ protected ImageRepresentation getImageRep() {
42+ return super.getImageRep();
43+ }
44+
45+ // overridden strictly for tracing and debugging. - jfs
46+ protected void initGraphics(Graphics g) {
47+ System.out.println("iImage.initGraphics() this=" + this +
48+ "\n g=" + g);
49+ super.initGraphics(g);
50+ }
51+}
java/pkg2/inferno/awt/iImageConsumer.java+0−0

Empty file added.

java/pkg2/inferno/awt/iImageRepresentation.java+91−0
@@ -0,0 +1,91 @@
1+/*
2+ *
3+ */
4+
5+package inferno.awt;
6+
7+import java.awt.Color;
8+import java.awt.Graphics;
9+//import java.awt.AWTException;
10+//import java.awt.Rectangle;
11+import java.awt.image.ColorModel;
12+import java.awt.image.ImageConsumer;
13+import java.awt.image.ImageObserver;
14+import sun.awt.image.ImageWatched;
15+import sun.awt.image.Image;
16+//import sun.awt.AWTFinalizeable;
17+//import sun.awt.AWTFinalizer;
18+//import java.util.Hashtable;
19+
20+/*
21+ * This implementation the implementation class for Sun's
22+ * sun.awt.image.ImageRepresentation.
23+ * - jfs
24+ */
25+public class iImageRepresentation extends sun.awt.image.ImageRepresentation
26+{
27+ /* ref Draw->Image, used by native code */
28+ Object piImage;
29+
30+ /**
31+ * Create an ImageRepresentation for the given Image scaled
32+ * to the given width and height and dithered or converted to
33+ * a ColorModel appropriate for the given image tag.
34+ */
35+ //public iImageRepresentation(Image im, int w, int h, int t) {
36+ public iImageRepresentation(iImage im, int w, int h, int t) {
37+ super(im, w, h, t);
38+ System.out.println("iImageRep.iImagRep(): w=" + w + " h=" + h +
39+ "t=" + t + "im=" + im);
40+ }
41+ /**
42+ * Initialize this ImageRepresentation object to act as the
43+ * destination drawable for this OffScreen Image.
44+ */
45+ protected native void offscreenInit(Color bg);
46+
47+ /* make Inferno's own ImageRepresentation - jfs
48+ private native boolean setBytePixels(int x, int y, int w, int h,
49+ ColorModel model,
50+ byte pix[], int off, int scansize);
51+ */
52+ protected native boolean setBytePixels(int x, int y, int w, int h,
53+ ColorModel model,
54+ byte pix[], int off, int scansize);
55+
56+ /* make Inferno's own ImageRepresentation - jfs
57+ private native boolean setIntPixels(int x, int y, int w, int h,
58+ ColorModel model,
59+ int pix[], int off, int scansize);
60+ */
61+ protected native boolean setIntPixels(int x, int y, int w, int h,
62+ ColorModel model,
63+ int pix[], int off, int scansize);
64+
65+ /* make Inferno's own ImageRepresentation - jfs
66+ private native boolean finish(boolean force);
67+ */
68+ protected native boolean finish(boolean force);
69+
70+ /* make Inferno's own ImageRepresentation - jfs
71+ native synchronized void imageDraw(Graphics g, int x, int y, Color c);
72+
73+ */
74+ native protected synchronized void imageDraw(Graphics g, int x, int y, Color c);
75+
76+ /* make Inferno's own ImageRepresentation - jfs
77+ native synchronized void imageStretch(Graphics g,
78+ int dx1, int dy1, int dx2, int dy2,
79+ int sx1, int sy1, int sx2, int sy2,
80+ Color c);
81+ */
82+ native protected synchronized void imageStretch(Graphics g,
83+ int dx1, int dy1, int dx2, int dy2,
84+ int sx1, int sy1, int sx2, int sy2,
85+ Color c);
86+
87+ /* make Inferno's own ImageRepresentation - jfs
88+ private native void disposeImage();
89+ */
90+ protected native void disposeImage();
91+}
java/pkg2/inferno/awt/iImageRepresentation_L.b+152−0
@@ -0,0 +1,152 @@
1+implement iImageRepresentation_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#<<
28+
29+include "iImageRepresentation_L.m";
30+
31+#>> extra post includes here
32+ sys : import jni; # std Inferno Sys module
33+ str : import jni; # std Inferno String module
34+
35+ FALSE : import jni;
36+ TRUE : import jni;
37+
38+ # draw.m in included by something included by jni.m
39+ draw : Draw;
40+ Context, Screen, Display, Rect, Point, Image : import draw;
41+ ctxt: ref Context;
42+
43+include "awt_Image.m";
44+
45+ awtIm : AwtImage;
46+
47+ # Some constants that aggregate status state.
48+ IM_SIZEINFO: con (awtIm->ImO_WIDTH | awtIm->ImO_HEIGHT);
49+ IM_DRAWINFO: con (awtIm->ImO_WIDTH | awtIm->ImO_HEIGHT |
50+ awtIm->ImO_SOMEBITS);
51+ IM_FULLDRAWINFO: con (awtIm->ImO_FRAMEBITS | awtIm->ImO_ALLBITS);
52+ IM_OFFSCREENINFO: con (awtIm->ImO_WIDTH | awtIm->ImO_HEIGHT |
53+ awtIm->ImO_SOMEBITS | awtIm->ImO_ALLBITS);
54+
55+ # Some constants that aggregate hints state
56+ HINT_OFFSCREENSEND: con (awtIm->ImC_TOPDOWNLEFTRIGHT |
57+ awtIm->ImC_COMPLETESCANLINES |
58+ awtIm->ImC_SINGLEPASS);
59+
60+include "awt_Color.m";
61+ awtColor : AwtColor;
62+
63+#<<
64+
65+init( jni_p : JNI )
66+{
67+ # save java native inteface mod instance
68+ jni = jni_p;
69+ #>>extra initialization here
70+ sys = jni->sys;
71+ draw = load Draw Draw->PATH;
72+ if (draw == nil) {
73+ jni->InitError(sys->sprint(
74+ "inferno.awt.iImageRepresentation: could not load %s: %r",
75+ Draw->PATH));
76+ }
77+ awtColor = load AwtColor AwtColor->PATH;
78+ if (awtColor == nil) {
79+ jni->InitError(sys->sprint(
80+ "inferno.awt.iImageRepresentation: could not load %s: %r",
81+ AwtColor->PATH));
82+ }
83+ ctxt = jni->getContext();
84+ #<<
85+}
86+
87+offscreenInit_rColor_V( this : ref iImageRepresentation_obj, p0 : JObject)
88+{#>>
89+ # Type(p0) is java.awt.Color
90+ # bgcolorim := ctxt.display.color(Draw->White); # default
91+ bgcoloridx := Draw->White;
92+ if (p0 == nil) {
93+ sys->print("iImageRepresentation_L.offscreenInit(): p0 == nil!\n");
94+ } else {
95+ # get the colormap index for this Java Color
96+ bgcoloridx = awtColor->getColorIndex(jni, p0);
97+ }
98+ bgcoloridx = Draw->White; # for testing... - jfs
99+ if (this.width <= 0 || this.height <=0) {
100+ jni->ThrowException("java.lang.IllegalArgumentException", "offscreen w and h < 0");
101+ }
102+ # create an Inferno Image for double buffer store.
103+ ldeep := ctxt.display.image.ldepth;
104+ this.piImage = ctxt.display.newimage(Draw->Rect(
105+ (0,0),(this.width,this.height)),
106+ ldeep, 0, bgcoloridx);
107+ sys->print("iImageRepresentation_L.offscreenInit(): - this=%x, piImage=%x!\n",
108+ this, this.piImage);
109+}#<<
110+
111+setBytePixels_I_I_I_I_rColorModel_aB_I_I_Z( this : ref iImageRepresentation_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : JObject,p5 : JArrayB,p6 : int,p7 : int) : int
112+{#>>
113+ # not yet implemented, so keep the type system happy by returning
114+ # FALSE as nothing was done
115+ sys->print("iImageRepresentation_L.setBytePixels(): - NYI!\n");
116+ return(FALSE);
117+}#<<
118+
119+setIntPixels_I_I_I_I_rColorModel_aI_I_I_Z( this : ref iImageRepresentation_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : JObject,p5 : JArrayI,p6 : int,p7 : int) : int
120+{#>>
121+ # not yet implemented, so keep the type system happy by returning
122+ # FALSE as nothing was done
123+ sys->print("iImageRepresentation_L.setIntPixels(): - NYI!\n");
124+ return(FALSE);
125+}#<<
126+
127+finish_Z_Z( this : ref iImageRepresentation_obj, p0 : int) : int
128+{#>>
129+ # not yet implemented, so just return false so the calling code
130+ # wont try a resend in TopDownLeftRight order...
131+ sys->print("iImageRepresentation_L.finish(): - NYI!\n");
132+ return(FALSE);
133+}#<<
134+
135+imageDraw_rGraphics_I_I_rColor_V( this : ref iImageRepresentation_obj, p0 : JObject,p1 : int,p2 : int,p3 : JObject)
136+{#>>
137+ sys->print("iImageRepresentation_L.imageDraw(): - NYI!\n");
138+}#<<
139+
140+imageStretch_rGraphics_I_I_I_I_I_I_I_I_rColor_V( this : ref iImageRepresentation_obj, p0 : JObject,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int,p6 : int,p7 : int,p8 : int,p9 : JObject)
141+{#>>
142+ sys->print("iImageRepresentation_L.imageStretch(): - NYI!\n");
143+}#<<
144+
145+disposeImage_V( this : ref iImageRepresentation_obj)
146+{#>>
147+ this.piImage = nil;
148+ sys->print("iImageRepresentation_L.disposeImage(): - NYI!\n");
149+}#<<
150+
151+
152+
java/pkg2/inferno/awt/iImageRepresentation_L.m+36−0
@@ -0,0 +1,36 @@
1+# javal v1.5 generated file: edit with care
2+
3+iImageRepresentation_L : module
4+{
5+ iImageRepresentation_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ watchers : JObject; # type java.lang.Vector;
9+ pData : int;
10+ src : JObject; # type sun.awt.image.InputStreamImageSource
11+ image : JObject; # type sun.awt.image.Image
12+ tag : int;
13+ srcW : int;
14+ srcH : int;
15+ width : int;
16+ height : int;
17+ hints : int;
18+ availinfo : int;
19+ offscreen : byte;
20+ newbits : JObject; # type java.awt.Rectangle
21+ consuming : byte;
22+ numWaiters : int;
23+ finalnext : JObject; # type sun.awt.AWTFinalizeable
24+ piImage : ref Draw->Image;
25+ };
26+
27+ init : fn( jni_p : JNI );
28+ offscreenInit_rColor_V : fn( this : ref iImageRepresentation_obj, p0 : JObject);
29+ setBytePixels_I_I_I_I_rColorModel_aB_I_I_Z : fn( this : ref iImageRepresentation_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : JObject,p5 : JArrayB,p6 : int,p7 : int) : int;
30+ setIntPixels_I_I_I_I_rColorModel_aI_I_I_Z : fn( this : ref iImageRepresentation_obj, p0 : int,p1 : int,p2 : int,p3 : int,p4 : JObject,p5 : JArrayI,p6 : int,p7 : int) : int;
31+ finish_Z_Z : fn( this : ref iImageRepresentation_obj, p0 : int) : int;
32+ imageDraw_rGraphics_I_I_rColor_V : fn( this : ref iImageRepresentation_obj, p0 : JObject,p1 : int,p2 : int,p3 : JObject);
33+ imageStretch_rGraphics_I_I_I_I_I_I_I_I_rColor_V : fn( this : ref iImageRepresentation_obj, p0 : JObject,p1 : int,p2 : int,p3 : int,p4 : int,p5 : int,p6 : int,p7 : int,p8 : int,p9 : JObject);
34+ disposeImage_V : fn( this : ref iImageRepresentation_obj);
35+
36+};
java/pkg2/inferno/awt/iImage_L.b+180−0
@@ -0,0 +1,180 @@
1+implement iImage_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#
28+# %W% - %E%
29+#
30+
31+#<<
32+
33+include "iImage_L.m";
34+
35+#>> extra post includes here
36+
37+draw : Draw;
38+
39+#include "image2enc.m";
40+# image2enc : Image2enc;
41+
42+include "imagefile.m";
43+ readimg : RImagefile;
44+ imageremap : Imageremap;
45+
46+include "bufio.m";
47+ B :Bufio;
48+
49+#<<
50+
51+init( jni_p : JNI )
52+{
53+ # save java native inteface mod instance
54+ jni = jni_p;
55+ #>>extra initialization here
56+ #<<
57+}
58+
59+getImage_V( this : ref iImage_obj)
60+{#>>
61+ # Open a file descriptor from which we can read a picture.
62+ #
63+ file : string;
64+ fd : ref Sys->FD;
65+ if ( this.file != nil ) {
66+ file = this.file.str;
67+ fd = jni->sys->open(file, Sys->OREAD);
68+ if ( fd == nil )
69+ jni->ThrowException("java/io/IOException", jni->sys->sprint("%r"));
70+ }
71+ else if ( this.url != nil ) { # Try to open a network connection
72+ # file = some component of the URL
73+ return; # later.
74+ }
75+ else
76+ return;
77+
78+ B = load Bufio Bufio->PATH;
79+ if ( B == nil )
80+ return;
81+
82+ iobuf := B->fopen(fd, Bufio->OREAD);
83+ if ( (imagetype := guesstype(file)) == nil )
84+ return;
85+
86+ imgarr : array of byte;
87+ (this.width, this.height, imgarr) = convert_img(iobuf, imagetype);
88+ this.imgbytes = jni->MkAByte(imgarr);
89+}#<<
90+
91+#
92+# Guess the file type from the suffix
93+#
94+guesstype(name : string) : string
95+{
96+ imagetype : string;
97+ (nil, suffix) := jni->str->splitr(name, ".");
98+ case suffix {
99+ "gif" => imagetype = "IMAGE/GIF";
100+ "pic" => imagetype = "IMAGE/PICT";
101+ "jpg" or "jpeg" => imagetype = "IMAGE/JPEG";
102+ "bit" or "mask" => imagetype = "IMAGE/X-INFERNO-BIT";
103+ "xbm" or "xbmp" => imagetype = "IMAGE/X-XBITMAP";
104+ }
105+ return imagetype;
106+}
107+
108+#
109+# Convert the image into the Inferno bit format
110+# Return image height, width and the image(array of bytes)
111+# Uses readgif.b/readjpg.b/readxbitmap.b/readpic.b and image2enc.b
112+#
113+convert_img(fd : ref Bufio->Iobuf, imagetype: string): (int, int, array of byte)
114+{
115+ # Initialization
116+
117+ case imagetype {
118+ "IMAGE/GIF" => readimg = load RImagefile RImagefile->READGIFPATH;
119+ "IMAGE/JPEG" => readimg = load RImagefile RImagefile->READJPGPATH;
120+ "IMAGE/X-XBITMAP" => readimg = load RImagefile RImagefile->READXBMPATH;
121+ "IMAGE/X-PICT" => readimg = load RImagefile RImagefile->READPICPATH;
122+ "IMAGE/X-INFERNO-BIT" => # What to do here?
123+ * => return(-1,-1,nil);
124+ }
125+
126+ if ( readimg == nil )
127+ return(-1,-1,nil);
128+
129+ readimg->init(B);
130+ rawimg : ref RImagefile->Rawimage;
131+
132+ # Read image [gif/jpg/xbm/pic]
133+ err_readimg: string;
134+ (rawimg, err_readimg) = readimg->read(fd);
135+ readimg = nil; # memory control
136+
137+ # Error check
138+ if (err_readimg != "" ) {
139+ return(-1,-1,nil);
140+ }
141+
142+ # Image2enc
143+# image2enc = load Image2enc Image2enc->PATH;
144+# if ( image2enc == nil )
145+# return (-1, -1, nil);
146+# (data, mask, err_enc) := image2enc->image2enc(rawimg, 1);
147+
148+ # Error check
149+# if (err_enc != "" ) {
150+# return(-1,-1,nil);
151+# }
152+
153+ # Masking
154+# if (mask != nil) {
155+# newdata := array[len data + len mask] of byte;
156+# newdata[0:] = data[0:];
157+# newdata[len data:] = mask[0:];
158+# data = newdata;
159+# }
160+
161+ # Make Inferno image
162+ imageremap = load Imageremap Imageremap->PATH;
163+ draw = load Draw Draw->PATH;
164+ Image, Context : import draw;
165+ if ( imageremap == nil || draw == nil )
166+ return (-1, -1, nil);
167+ (img, err_remap) := imageremap->remap(rawimg, jni->getContext().display, 0);
168+ if ( img == nil )
169+ return (-1, -1, nil);
170+
171+ # Determine image size
172+ wd := (rawimg.r.max.x - rawimg.r.min.x);
173+ ht := (rawimg.r.max.y - rawimg.r.min.y);
174+
175+ data := array[wd*ht] of byte; # what if depth != 3 ?
176+ img.readpixels(img.r, data);
177+
178+ # Return width, height and image
179+ return(wd, ht, data);
180+}
java/pkg2/inferno/awt/iImage_L.m+26−0
@@ -0,0 +1,26 @@
1+#
2+# %W% - %E%
3+#
4+
5+# javal v1.5 generated file: edit with care
6+
7+iImage_L : module
8+{
9+ iImage_obj : adt
10+ {
11+ cl_mod : ClassModule;
12+ width : int;
13+ height : int;
14+ file : JString;
15+ url : JObject;
16+ imgbytes : JArrayB;
17+ properties : JObject;
18+ q : JObject;
19+ consumers : JObject;
20+ fd : ref Sys->FD;
21+ };
22+
23+ init : fn( jni_p : JNI );
24+ getImage_V : fn( this : ref iImage_obj);
25+
26+};
java/pkg2/inferno/awt/iMenuBarPeer.java+906−0
@@ -0,0 +1,906 @@
1+package inferno.awt;
2+
3+import java.awt.*;
4+import java.awt.event.*;
5+import java.awt.peer.*;
6+
7+public class iMenuBarPeer implements
8+MenuBarPeer,MouseListener,MouseMotionListener,zMenuParent {
9+ MenuBar target;
10+ int height;
11+ zMenuBarObject selectedMenuObject;
12+ zMenuBarObject menuObjects[];
13+ int menuObjectCount;
14+ Window child;
15+
16+ public void closeChild(Window w)
17+ {
18+ // Called from child via zMenuParent interface to
19+ // close itself down. Since Window may take some time to
20+ // close down, check to see if we are still the child window
21+ // not the previous window
22+ if (child!=null && child==w)
23+ {
24+
25+ child.setVisible(false); // Hide Window
26+ child.dispose(); // Destroy window
27+ child=null; // Lose reference to Window
28+ if (selectedMenuObject!=null)
29+ {
30+ // If menu item selected, display not selected
31+ Frame frm=(Frame)target.getParent();
32+ Graphics g=frm.getGraphics();
33+ selectedMenuObject.paint(g,0);
34+ g.dispose();
35+ }
36+ }
37+ }
38+
39+ public void closeEverything()
40+ {
41+ // Close our child
42+ closeChild(child);
43+ }
44+
45+ void create(Frame f)
46+ {
47+ // Calculate sizes
48+ recalculate();
49+ }
50+
51+ public iMenuBarPeer(MenuBar target) {
52+ Frame frm=(Frame)target.getParent();
53+ frm.addMouseListener(this);
54+ frm.addMouseMotionListener(this);
55+ this.target = target;
56+ create(frm);
57+ }
58+
59+ // Required by MenuBarPeer interface but not used
60+ public void dispose()
61+ {
62+ }
63+
64+ public void addMenu(Menu m) {
65+ // Calculate sizes
66+ recalculate();
67+ }
68+
69+ public void delMenu(int index) {
70+ // Calculate sizes
71+ recalculate();
72+ }
73+
74+ public void addHelpMenu(Menu m) {
75+ // Calculate sizes
76+ recalculate();
77+ }
78+
79+ // Calculate height of menubar
80+ public int getHeight()
81+ {
82+ height=0;
83+
84+ if (target!=null)
85+ {
86+ Frame frm=(Frame)target.getParent();
87+ for (int i=target.getMenuCount()-1;i>=0;--i)
88+ {
89+ Menu m=target.getMenu(i);
90+ Font f=m.getFont();
91+ FontMetrics fm=frm.getFontMetrics(f);
92+
93+ height=Math.max(height,fm.getHeight()+2);
94+ }
95+ }
96+ return height;
97+ }
98+
99+ public void recalculate()
100+ {
101+ // Create all the objects
102+ if (target!=null)
103+ {
104+ Frame frm=(Frame)target.getParent();
105+ Rectangle d=frm.getBounds();
106+ Insets is=frm.getInsets();
107+ Menu hm=target.getHelpMenu();
108+
109+ selectedMenuObject=null;
110+ menuObjects=null;
111+ menuObjectCount=target.getMenuCount();
112+ if (menuObjectCount!=0)
113+ {
114+ int x=is.left;
115+ int y=is.top-height;
116+ menuObjects=new zMenuBarObject[menuObjectCount];
117+
118+
119+ for (int i=0;i<menuObjectCount;i++)
120+ {
121+ int w,xx;
122+ Menu m=target.getMenu(i);
123+ Font f=m.getFont();
124+ if (f==null)
125+ {
126+ w=0;
127+ xx=0;
128+ }
129+ else
130+ {
131+ FontMetrics fm=frm.getFontMetrics(f);
132+ w=fm.stringWidth(" "+m.getLabel()+" ")+2;
133+
134+ if (m==hm)
135+ {
136+ xx=d.width-is.right-w;
137+ }
138+ else
139+ {
140+ xx=x;
141+ x+=w;
142+ }
143+
144+ }
145+ menuObjects[i]=new zMenuBarObject(m,new Rectangle(xx,y,w,height));
146+
147+ }
148+ }
149+
150+ }
151+ }
152+
153+ // Not the Component paint but similar
154+ // called from Frame.paint
155+ public void paint(Graphics gg)
156+ {
157+ Frame frm=(Frame)target.getParent();
158+ Insets is=frm.getInsets();
159+ Rectangle d=frm.getBounds();
160+ int y=is.top-height;
161+ int x=is.left;
162+ int w=d.width-is.left-is.right;
163+ int h=height;
164+ Graphics g=gg.create();
165+
166+ // Display the menu objects
167+ g.setClip(x,y,w,h);
168+ g.setColor(SystemColor.menu);
169+ g.fillRect(x,y,w,h);
170+
171+ for (int i=0;i<menuObjectCount;i++)
172+ menuObjects[i].paint(g);
173+
174+
175+ g.dispose();
176+ }
177+
178+ public void mouseExited(MouseEvent e)
179+ {
180+ // Deselect if mouse exits window
181+ // (Almost certainly never called by inferno)
182+ if (selectedMenuObject!=null)
183+ {
184+ Frame frm=(Frame)target.getParent();
185+ Graphics g=frm.getGraphics();
186+ selectedMenuObject.paint(g,0);
187+ selectedMenuObject=null;
188+ g.dispose();
189+ }
190+ }
191+
192+ // Required by listener interface but not used
193+ public void mouseEntered(MouseEvent e)
194+ {
195+ }
196+
197+ // Required by listener interface but not used
198+ public void mouseClicked(MouseEvent e)
199+ {
200+ }
201+
202+ public void mousePressed(MouseEvent e)
203+ {
204+ // If within an object (selectMenuObject set by mouseMove)
205+ if (selectedMenuObject!=null && selectedMenuObject.area.contains(e.getPoint()))
206+ {
207+ Frame frm=(Frame)target.getParent();
208+ Graphics g=frm.getGraphics();
209+ selectedMenuObject.paint(g,-1);
210+ g.dispose();
211+
212+ Menu menu=selectedMenuObject.menu;
213+ if(menu != null){
214+ Rectangle md=selectedMenuObject.area;
215+ Rectangle fd=frm.getBounds();
216+ int xoff=md.x;
217+ int yoff=md.y+md.height;
218+
219+ closeChild(child);
220+ child=new zMenuWindow(frm,this,menu,xoff,yoff);
221+ child.pack();
222+ child.setVisible(true);
223+ }
224+ }
225+ else
226+ {
227+ // Close child window (if any)
228+ if (child != null)
229+ closeChild(child);
230+ // Display deselected
231+ if(selectedMenuObject != null){
232+ Frame frm=(Frame)target.getParent();
233+ Graphics g=frm.getGraphics();
234+ selectedMenuObject.paint(g,0);
235+ g.dispose();
236+ }
237+ }
238+ }
239+
240+ // Require by listener interface but not used
241+ public void mouseReleased(MouseEvent e)
242+ {
243+ }
244+
245+ public void mouseMoved(MouseEvent e)
246+ {
247+ // Track the mouse movement over the menuObjects
248+ // setting selectedMenuObject as appropriate
249+ if (selectedMenuObject==null ||
250+ !selectedMenuObject.area.contains(e.getPoint()))
251+ {
252+ Frame frm=(Frame)target.getParent();
253+ Graphics g=frm.getGraphics();
254+ // if (selectedMenuObject!=null && child==null)
255+ if (selectedMenuObject!=null)
256+ {
257+ selectedMenuObject.paint(g,0);
258+ selectedMenuObject=null;
259+ }
260+
261+ for (int i=0;i<menuObjectCount;i++)
262+ if (menuObjects[i].area.contains(e.getPoint()))
263+ {
264+ if (selectedMenuObject!=null)
265+ {
266+ selectedMenuObject.paint(g,0);
267+ selectedMenuObject=null;
268+ }
269+ if (menuObjects[i].menu.isEnabled())
270+ {
271+ int mode=1;
272+ selectedMenuObject=menuObjects[i];
273+ if (child!=null)
274+ {
275+ Menu menu=selectedMenuObject.menu;
276+ Rectangle md=selectedMenuObject.area;
277+ Rectangle fd=frm.getBounds();
278+ int xoff=md.x;
279+ int yoff=md.y+md.height;
280+
281+ Window newChild=new zMenuWindow(frm,this,menu,xoff,yoff);
282+ newChild.pack();
283+ newChild.setVisible(true);
284+ closeChild(child);
285+ child=newChild;
286+ mode=-1;
287+ }
288+
289+ selectedMenuObject.paint(g,mode);
290+ }
291+ break;
292+ }
293+
294+ g.dispose();
295+ }
296+ }
297+
298+ // Require by listener interface but not used
299+ public void mouseDragged(MouseEvent e)
300+ {
301+ }
302+
303+
304+}
305+
306+// This is the object corresponding to the menu items
307+// on the menubar
308+class zMenuBarObject {
309+ Menu menu;
310+ Rectangle area;
311+ int mode;
312+
313+ public zMenuBarObject(Menu menu,Rectangle area)
314+ {
315+ this.menu=menu;
316+ this.area=area;
317+ this.mode=0;
318+ }
319+
320+ public void paint(Graphics g,int mode)
321+ {
322+ this.mode=mode;
323+ paint(g);
324+ }
325+
326+ // Not the component paint but similar
327+ // displays the menu item
328+ public void paint(Graphics g)
329+ {
330+ Font f=menu.getFont();
331+ FontMetrics fm=g.getFontMetrics(f);
332+
333+ g.setColor(SystemColor.menu);
334+
335+ if (mode!=0)
336+ Misc.fill3DRect(area,mode>0,g);
337+ else
338+ g.fillRect(area.x,area.y,area.width,area.height);
339+
340+ g.translate(-mode,-mode);
341+
342+ g.setFont(f);
343+ if (menu.isEnabled())
344+ {
345+ g.setColor(SystemColor.menuText);
346+ g.drawString(" "+menu.getLabel(),area.x+1,area.y+fm.getAscent()+1);
347+ }
348+ else
349+ {
350+ Misc.drawDisabledString(" "+menu.getLabel(),area.x+1,area.y+fm.getAscent()+1,g);
351+
352+ }
353+
354+ g.translate(+mode,+mode);
355+
356+ }
357+
358+}
359+
360+// This the window containing the dropdown menus
361+// the painting is done by zMenuDisplay
362+// zMenuDisplay returns its size and the Window sizes itself
363+// accordingly
364+
365+class zMenuWindow extends Window implements ComponentListener,zMenuParent{
366+ zMenuDisplay menudisplay;
367+ zMenuParent ancestor;
368+ int xoffset,yoffset;
369+
370+ public zMenuWindow(Frame f,zMenuParent ancestor,Menu menu,int xoffset,int yoffset)
371+{
372+ super(f);
373+ this.xoffset=xoffset;
374+ this.yoffset=yoffset;
375+ this.ancestor=ancestor;
376+ Point p=f.getLocation();
377+ p.translate(this.xoffset,this.yoffset);
378+ setLocation(p);
379+ f.addComponentListener(this);
380+ this.menudisplay=new zMenuDisplay(menu);
381+ add(this.menudisplay,BorderLayout.CENTER);
382+ }
383+
384+ public void closeChild(Window w)
385+ {
386+ if (menudisplay!=null)
387+ {
388+ if (!menudisplay.gotFocus() && ancestor!=null)
389+ ancestor.closeChild(this);
390+ else
391+ menudisplay.closeChild(w);
392+ }
393+ }
394+
395+ public void closeEverything()
396+{
397+ if (ancestor!=null)
398+ ancestor.closeEverything();
399+}
400+
401+ public boolean gotFocus()
402+ {
403+ if (menudisplay==null)
404+ return false;
405+ else
406+ return menudisplay.gotFocus();
407+
408+ }
409+
410+ public void componentHidden(ComponentEvent e)
411+ {
412+
413+ }
414+
415+ public void componentMoved(ComponentEvent e)
416+ {
417+ Point p=e.getComponent().getLocation();
418+ p.translate(xoffset,yoffset);
419+ setLocation(p);
420+ }
421+
422+ public void componentResized(ComponentEvent e)
423+ {
424+
425+ }
426+
427+ public void componentShown(ComponentEvent e)
428+ {
429+
430+ }
431+
432+ public void dispose()
433+ {
434+ if (menudisplay!=null)
435+ {
436+ menudisplay.closeChild(this);
437+ }
438+ super.dispose();
439+ }
440+
441+}
442+
443+// This is the display part of the zMenuWindow
444+// it covers the whole window
445+
446+class zMenuDisplay extends Canvas implements
447+MouseListener,MouseMotionListener,
448+FocusListener{
449+ zMenuObject menuObjects[];
450+ zMenuObject selectedMenuObject;
451+ zMenuWindow child;
452+ int menuObjectCount;
453+ Dimension pSize;
454+ boolean focus;
455+ Menu menu;
456+ static Color highlight = SystemColor.controlHighlight;
457+ static Color light = SystemColor.controlLtHighlight;
458+ static Color medium = SystemColor.controlShadow;
459+ static Color dark = SystemColor.controlDkShadow;
460+
461+
462+ static final int TickBoxSize=13;
463+
464+ static final int TickLabelGap=4;
465+
466+ static final int SeparatorHeight=6;
467+
468+
469+ public zMenuDisplay(Menu menu)
470+
471+ {
472+ super();
473+ setMenu(menu);
474+ addMouseListener(this);
475+ addMouseMotionListener(this);
476+ addFocusListener(this);
477+ }
478+
479+ public boolean isFocusTraversable() {
480+ return false;
481+ }
482+
483+
484+ void setMenu(Menu menu)
485+
486+ {
487+
488+ int maxwidth=0;
489+
490+ int yy=4;
491+
492+ int xx=4;
493+
494+ this.menu=menu;
495+
496+
497+ menuObjectCount=menu.getItemCount();
498+
499+
500+ selectedMenuObject=null;
501+
502+
503+ if (menuObjectCount==0)
504+
505+ menuObjects=null;
506+
507+ else
508+
509+ {
510+
511+ menuObjects=new zMenuObject[menuObjectCount];
512+
513+
514+ boolean submenu=false;
515+
516+ for (int i=0;i<menuObjectCount;i++)
517+
518+ {
519+
520+ MenuItem mi=menu.getItem(i);
521+
522+ String label=mi.getLabel();
523+ if (!submenu && mi instanceof Menu) submenu=true;
524+
525+
526+ if (!label.equals("-"))
527+
528+ {
529+
530+ Font f=mi.getFont();
531+
532+ FontMetrics fm=getFontMetrics(f);
533+
534+
535+ maxwidth=Math.max(maxwidth,TickBoxSize+TickLabelGap+fm.stringWidth(label));
536+
537+
538+ }
539+
540+
541+ }
542+
543+ maxwidth+=2; // For outside lines
544+
545+ if (submenu) maxwidth+=8;
546+
547+ for (int i=0;i<menuObjectCount;i++)
548+ {
549+
550+ MenuItem mi=menu.getItem(i);
551+
552+ String label=mi.getLabel();
553+ int h;
554+
555+
556+ if (label.equals("-"))
557+ {
558+ h=SeparatorHeight; // Height
559+
560+ menuObjects[i]=new zMenuSeparator(new Rectangle(xx,yy,maxwidth,h));
561+
562+ }
563+ else
564+ {
565+ Font f=mi.getFont();
566+ FontMetrics fm=getFontMetrics(f);
567+ h=Math.max(fm.getHeight(),TickBoxSize)+4; //Height
568+
569+ menuObjects[i]=new zMenuText(mi,new Rectangle(xx,yy,maxwidth,h));
570+
571+ }
572+
573+ yy+=h;
574+
575+
576+ }
577+
578+
579+ }
580+
581+ pSize=new Dimension(xx+maxwidth+4,yy+4);
582+
583+ }
584+
585+
586+ public Dimension getPreferredSize()
587+
588+ {
589+
590+ return pSize;
591+
592+ }
593+
594+
595+ public void paint(Graphics g)
596+ {
597+ Dimension d=getSize();
598+
599+ g.setColor(SystemColor.menu);
600+
601+ Misc.Draw3DArea(0,0,d.width,d.height,g);
602+
603+ for (int i=0;i<menuObjectCount;i++)
604+ menuObjects[i].paint(g,0);
605+
606+ }
607+
608+ void closeChild()
609+ {
610+ closeChild(child);
611+ }
612+
613+ void closeChild(Window w)
614+ {
615+ if (w!=null && w == child)
616+ {
617+ w.setVisible(false);
618+ w.dispose();
619+ w=null;
620+ }
621+ if (child!=null)
622+ {
623+ child.setVisible(false);
624+ child.dispose();
625+ child = null;
626+ }
627+ }
628+
629+
630+
631+ // Required by listener interface but not used
632+ public void mouseClicked(MouseEvent e)
633+ {
634+ }
635+
636+ // Required by listener interface but not used
637+ public void mouseEntered(MouseEvent e)
638+ {
639+ }
640+
641+ // Required by listener interface but not used
642+ public void mouseExited(MouseEvent e)
643+ {
644+ }
645+
646+ // Required by listener interface but not used
647+ public void mousePressed(MouseEvent e)
648+ {
649+ }
650+
651+ public void mouseReleased(MouseEvent e)
652+ {
653+ if (selectedMenuObject!=null && selectedMenuObject instanceof zMenuText)
654+ {
655+ MenuItem menuItem=((zMenuText)selectedMenuObject).item;
656+ if (menuItem.isEnabled() && !(menuItem instanceof Menu))
657+ {
658+ String actionCommand=menuItem.getActionCommand();
659+ iToolkit.postEvent(new ActionEvent(menuItem, ActionEvent.ACTION_PERFORMED,
660+ actionCommand));
661+ zMenuWindow w=(zMenuWindow)getParent();
662+ Frame f=(Frame)w.getParent();
663+ f.requestFocus();
664+ w.closeEverything();
665+ }
666+ }
667+ }
668+
669+ public void mouseMoved(MouseEvent e)
670+ {
671+ if (!focus)
672+ {
673+ focus=true;
674+ requestFocus();
675+ }
676+
677+ if (selectedMenuObject==null ||
678+ !selectedMenuObject.area.contains(e.getPoint()))
679+ {
680+ Graphics g=getGraphics();
681+ if (selectedMenuObject!=null)
682+ {
683+ selectedMenuObject.paint(g,0);
684+ selectedMenuObject=null;
685+ closeChild(child);
686+ }
687+ for (int i=0;i<menuObjectCount;i++)
688+ if (menuObjects[i].area.contains(e.getPoint()))
689+ {
690+ int mode=1;
691+
692+ selectedMenuObject=menuObjects[i];
693+ if (selectedMenuObject instanceof zMenuText)
694+ {
695+ zMenuText mo=(zMenuText)selectedMenuObject;
696+
697+ if (mo.item.isEnabled())
698+ {
699+ zMenuWindow w=(zMenuWindow)getParent();
700+ Frame f=(Frame)w.getParent();
701+
702+ if (mo.item instanceof Menu)
703+ {
704+ int xx=w.xoffset+mo.area.x+mo.area.width;
705+ int yy=w.yoffset+mo.area.y;
706+ Menu menu=(Menu)mo.item;
707+
708+ mode=-1;
709+
710+ zMenuWindow newChild=new zMenuWindow(f,w,menu,xx,yy);
711+ newChild.pack();
712+ newChild.setVisible(true);
713+ closeChild(child);
714+ child=newChild;
715+ }
716+ }
717+ selectedMenuObject.paint(g,mode);
718+ }
719+ break;
720+ }
721+
722+ g.dispose();
723+ }
724+ }
725+
726+ public void mouseDragged(MouseEvent e)
727+ {
728+ mouseMoved(e);
729+ }
730+
731+ public boolean gotFocus()
732+ {
733+ if (focus)
734+ return true;
735+ else
736+ if (child==null)
737+ return false;
738+ else
739+ return child.gotFocus();
740+
741+ }
742+
743+ public void focusLost(FocusEvent e)
744+ {
745+ focus=false;
746+ if (!gotFocus())
747+ {
748+ zMenuWindow m=(zMenuWindow)getParent();
749+ if (m.ancestor!=null) m.ancestor.closeChild(m);
750+ }
751+ }
752+
753+ public void focusGained(FocusEvent e)
754+ {
755+ focus=true;
756+
757+ }
758+
759+}
760+
761+// base class for the menuObjects
762+
763+abstract class zMenuObject {
764+ Rectangle area;
765+
766+ public zMenuObject()
767+ {
768+ }
769+
770+ public zMenuObject(Rectangle area)
771+ {
772+ this.area=area;
773+ }
774+
775+ public abstract void paint(Graphics g,int mode);
776+
777+}
778+
779+// Standard item item class
780+
781+class zMenuText extends zMenuObject {
782+ MenuItem item;
783+
784+public zMenuText(MenuItem item,Rectangle area)
785+{
786+ super(area);
787+ this.item=item;
788+}
789+
790+
791+void drawArrow(Graphics g,int x,int y)
792+{
793+ for (int i=0;i<4;i++)
794+ {
795+ g.drawLine(x,y+i,x+3-i,y+i);
796+ if (i!=0)
797+ g.drawLine(x,y-i,x+3-i,y-i);
798+ }
799+}
800+
801+public void paint(Graphics g,int mode)
802+{
803+ Font f=item.getFont();
804+ FontMetrics fm=g.getFontMetrics(f);
805+ int fa=fm.getAscent();
806+ boolean enabled=item.isEnabled();
807+ boolean submenu=item instanceof Menu;
808+ boolean checked=(item instanceof CheckboxMenuItem?
809+ ((CheckboxMenuItem)item).getState():false);
810+ String s=item.getLabel();
811+ int xx=area.x;
812+ int yy=area.y;
813+
814+ g.setFont(f);
815+ if (enabled)
816+ {
817+ g.setColor(SystemColor.menu);
818+ if (mode!=0)
819+ Misc.fill3DRect(area,mode>0,g);
820+ else
821+ g.fillRect(xx,yy,area.width,area.height);
822+
823+ xx+=2;
824+ yy+=2;
825+ g.setColor(SystemColor.menuText);
826+ g.translate(-mode,-mode);
827+ if (checked) Misc.drawTick(g,xx,yy,zMenuDisplay.TickBoxSize);
828+
829+g.drawString(s,zMenuDisplay.TickBoxSize+zMenuDisplay.TickLabelGap+xx,yy+fa);
830+ if (submenu)
831+ drawArrow(g,area.x+area.width-6,area.y+area.height/2);
832+ g.translate(+mode,+mode);
833+ }
834+ else
835+ {
836+ xx+=2;
837+ yy+=2;
838+ if (checked)
839+ {
840+ g.setColor(SystemColor.controlLtHighlight);
841+ Misc.drawTick(g,xx+1,yy+1,zMenuDisplay.TickBoxSize);
842+ g.setColor(SystemColor.controlShadow);
843+ Misc.drawTick(g,xx,yy,zMenuDisplay.TickBoxSize);
844+ }
845+
846+Misc.drawDisabledString(s,zMenuDisplay.TickBoxSize+zMenuDisplay.TickLabelGap+xx,yy+fa,g);
847+ if (submenu)
848+ {
849+ g.setColor(SystemColor.controlLtHighlight);
850+ drawArrow(g,area.x+area.width-6+1,area.y+area.height/2+1);
851+ g.setColor(SystemColor.controlShadow);
852+ drawArrow(g,area.x+area.width-6,area.y+area.height/2);
853+ }
854+ }
855+
856+
857+}
858+
859+}
860+
861+// separator bar
862+
863+class zMenuSeparator extends zMenuObject {
864+
865+public zMenuSeparator(Rectangle area)
866+{
867+ super(area);
868+}
869+
870+public void paint(Graphics g,int mode)
871+{
872+ int y=area.y+zMenuDisplay.SeparatorHeight/2-1;
873+
874+ g.setColor(zMenuDisplay.medium);
875+ g.drawLine(area.x,y,area.x+area.width,y);
876+
877+ y+=1;
878+
879+ g.setColor(zMenuDisplay.light);
880+ g.drawLine(area.x,y,area.x+area.width,y);
881+
882+
883+}
884+
885+}
886+
887+// The interface to look backwards to parent to close ourselves
888+
889+interface zMenuParent {
890+
891+
892+ // Called by child (or parent) to close and delete itself
893+ public void closeChild(Window W);
894+
895+ // Close all the windows back to the menubar
896+ public void closeEverything();
897+
898+}
899+
900+
901+
902+
903+
904+
905+
906+
java/pkg2/inferno/awt/iOffScreenImage.java+33−0
@@ -0,0 +1,33 @@
1+/*
2+ * %W% - %E%
3+ *
4+ * Adapted from SunSoft's X11OffScreenImage.java 1.2 97/02/23
5+ */
6+
7+package inferno.awt;
8+
9+import java.awt.Component;
10+import java.awt.Graphics;
11+import sun.awt.DrawingSurface;
12+import sun.awt.DrawingSurfaceInfo;
13+
14+class iOffScreenImage extends iImage implements DrawingSurface {
15+ /**
16+ * Construct an image for offscreen rendering to be used with a
17+ * given Component.
18+ */
19+ public iOffScreenImage(Component c, int w, int h) {
20+ super(c, w, h);
21+ }
22+
23+ public Graphics getGraphics() {
24+ Graphics g = new iGraphics(this);
25+ initGraphics(g);
26+ return g;
27+ }
28+
29+ // implementation of sun.awt.DrawingSurface's getDrawingSurfaceInfo()
30+ public DrawingSurfaceInfo getDrawingSurfaceInfo() {
31+ return new iDrawingSurfaceInfo(getImageRep());
32+ }
33+}
java/pkg2/inferno/awt/iPopupMenuPeer.java+652−0
@@ -0,0 +1,652 @@
1+package inferno.awt;
2+
3+import java.awt.*;
4+import java.applet.*;
5+import java.awt.event.*;
6+import java.awt.peer.*;
7+import inferno.awt.*;
8+
9+public class iPopupMenuPeer implements PopupMenuPeer,zPopupMenuParent {
10+ PopupMenu target;
11+ Window child;
12+
13+ public void show(Event e)
14+ {
15+ Object o=e.target;
16+
17+ if (o instanceof Component)
18+ {
19+ Component c=(Component)o;
20+ Point pc=c.getLocationOnScreen();
21+ Container p;
22+
23+ if (c instanceof Container)
24+ p=(Container)c;
25+ else
26+ p=c.getParent();
27+
28+ if (p!=null)
29+ {
30+ Window w=null;
31+
32+ while (true)
33+ {
34+ if (p instanceof Frame)
35+ {
36+ Frame f=(Frame)p;
37+
38+ Point pf=f.getLocationOnScreen();
39+
40+ closeChild(child);
41+
42+ child=new zPopupMenu(f,this,target,pc.x+e.x-pf.x,pc.y+e.y-pf.y);
43+ child.pack();
44+ child.setVisible(true);
45+
46+ break;
47+ }
48+ else
49+ if (p instanceof Applet)
50+ {
51+ Applet a=(Applet)p;
52+
53+ break;
54+ }
55+
56+ p=p.getParent();
57+
58+ if (p==null) break;
59+ }
60+
61+
62+ }
63+
64+
65+
66+ }
67+
68+
69+ }
70+
71+ public void delItem(int item)
72+ {
73+
74+ }
75+
76+
77+ public void addItem(MenuItem item)
78+ {
79+
80+ }
81+
82+ public void addSeparator()
83+ {
84+ }
85+
86+ public void disable()
87+ {
88+
89+ }
90+
91+ public void enable()
92+ {
93+
94+ }
95+
96+ public void setEnabled(boolean state)
97+ {
98+
99+ }
100+
101+ public void setLabel(String label)
102+ {
103+
104+ }
105+
106+
107+ public void closeChild(Window w)
108+ {
109+ if (child!=null && child==w)
110+ {
111+ child.setVisible(false);
112+ child.dispose();
113+ child=null;
114+ }
115+ }
116+
117+ public void closeEverything()
118+ {
119+ closeChild(child);
120+ }
121+
122+ public iPopupMenuPeer(PopupMenu target) {
123+ this.target = target;
124+ }
125+
126+ public void dispose()
127+ {
128+ }
129+
130+}
131+
132+class zPopupMenu extends Window implements ComponentListener,zPopupMenuParent{
133+ zPopupMenuDisplay menudisplay;
134+ zPopupMenuParent ancestor;
135+ int xoffset,yoffset;
136+
137+ public zPopupMenu(Frame f,zPopupMenuParent ancestor,Menu menu,int xoffset,int yoffset)
138+{
139+ super(f);
140+ this.xoffset=xoffset;
141+ this.yoffset=yoffset;
142+ this.ancestor=ancestor;
143+ Point p=f.getLocation();
144+ p.translate(this.xoffset,this.yoffset);
145+ setLocation(p);
146+ f.addComponentListener(this);
147+ this.menudisplay=new zPopupMenuDisplay(menu);
148+ add(this.menudisplay,BorderLayout.CENTER);
149+ //System.out.println("zPopupMenu Called: " + this);
150+ }
151+
152+ public void closeChild(Window w)
153+ {
154+ if (menudisplay!=null)
155+ {
156+ if (!menudisplay.gotFocus() && ancestor!=null)
157+ ancestor.closeChild(this);
158+ else
159+ menudisplay.closeChild(w);
160+ }
161+ }
162+
163+ public void closeEverything()
164+{
165+ if (ancestor!=null)
166+ ancestor.closeEverything();
167+}
168+
169+ public boolean gotFocus()
170+ {
171+ if (menudisplay==null)
172+ return false;
173+ else
174+ return menudisplay.gotFocus();
175+
176+ }
177+
178+ public void componentHidden(ComponentEvent e)
179+ {
180+
181+ }
182+
183+ public void componentMoved(ComponentEvent e)
184+ {
185+ Point p=e.getComponent().getLocation();
186+ p.translate(xoffset,yoffset);
187+ setLocation(p);
188+ }
189+
190+ public void componentResized(ComponentEvent e)
191+ {
192+
193+ }
194+
195+ public void componentShown(ComponentEvent e)
196+ {
197+
198+ }
199+
200+ public void dispose()
201+ {
202+ if (menudisplay!=null)
203+ {
204+ menudisplay.closeChild(this);
205+ }
206+ super.dispose();
207+ }
208+
209+}
210+
211+class zPopupMenuDisplay extends Canvas implements
212+MouseListener,MouseMotionListener,
213+FocusListener{
214+ zPopupMenuObject menuObjects[];
215+ zPopupMenuObject selectedMenuObject;
216+ zPopupMenu child;
217+ int menuObjectCount;
218+ Dimension pSize;
219+ boolean focus;
220+ Menu menu;
221+ static Color highlight = SystemColor.controlHighlight;
222+ static Color light = SystemColor.controlLtHighlight;
223+ static Color medium = SystemColor.controlShadow;
224+ static Color dark = SystemColor.controlDkShadow;
225+
226+
227+ static final int TickBoxSize=13;
228+
229+ static final int TickLabelGap=4;
230+
231+ static final int SeparatorHeight=6;
232+
233+
234+ public zPopupMenuDisplay(Menu menu)
235+
236+ {
237+ super();
238+ setMenu(menu);
239+ addMouseListener(this);
240+ addMouseMotionListener(this);
241+ /*addKeyListener(this);*/
242+ addFocusListener(this);
243+
244+ }
245+
246+ public boolean isFocusTraversable() {
247+ return false;
248+ }
249+
250+
251+ void setMenu(Menu menu)
252+
253+ {
254+
255+ int maxwidth=0;
256+
257+ int yy=4;
258+
259+ int xx=4;
260+
261+ this.menu=menu;
262+
263+
264+ menuObjectCount=menu.getItemCount();
265+
266+
267+ selectedMenuObject=null;
268+
269+
270+ if (menuObjectCount==0)
271+
272+ menuObjects=null;
273+
274+ else
275+
276+ {
277+
278+ menuObjects=new zPopupMenuObject[menuObjectCount];
279+
280+
281+ boolean submenu=false;
282+
283+ for (int i=0;i<menuObjectCount;i++)
284+
285+ {
286+
287+ MenuItem mi=menu.getItem(i);
288+
289+ String label=mi.getLabel();
290+ if (!submenu && mi instanceof Menu) submenu=true;
291+
292+
293+ if (!label.equals("-"))
294+
295+ {
296+
297+ Font f=mi.getFont();
298+
299+ FontMetrics fm=getFontMetrics(f);
300+
301+
302+maxwidth=Math.max(maxwidth,TickBoxSize+TickLabelGap+fm.stringWidth(label));
303+
304+
305+ }
306+
307+
308+ }
309+
310+ maxwidth+=2; // For outside lines
311+
312+ if (submenu) maxwidth+=8;
313+
314+ for (int i=0;i<menuObjectCount;i++)
315+ {
316+
317+ MenuItem mi=menu.getItem(i);
318+
319+ String label=mi.getLabel();
320+ int h;
321+
322+
323+ if (label.equals("-"))
324+ {
325+ h=SeparatorHeight; // Height
326+
327+ menuObjects[i]=new zPopupMenuSeparator(new Rectangle(xx,yy,maxwidth,h));
328+
329+ }
330+ else
331+ {
332+ Font f=mi.getFont();
333+ FontMetrics fm=getFontMetrics(f);
334+ h=Math.max(fm.getHeight(),TickBoxSize)+4; //Height
335+
336+ menuObjects[i]=new zPopupMenuText(mi,new Rectangle(xx,yy,maxwidth,h));
337+
338+ }
339+
340+ yy+=h;
341+
342+
343+ }
344+
345+
346+ }
347+
348+ pSize=new Dimension(xx+maxwidth+4,yy+4);
349+
350+ }
351+
352+
353+ public Dimension getPreferredSize()
354+
355+ {
356+
357+ return pSize;
358+
359+ }
360+
361+
362+ public void paint(Graphics g)
363+ {
364+ Dimension d=getSize();
365+
366+ g.setColor(SystemColor.menu);
367+
368+ Misc.Draw3DArea(0,0,d.width,d.height,g);
369+
370+ for (int i=0;i<menuObjectCount;i++)
371+ menuObjects[i].paint(g,0);
372+
373+ }
374+
375+ void closeChild()
376+ {
377+ closeChild(child);
378+ }
379+
380+ void closeChild(Window w)
381+ {
382+ if (child!=null && child==w)
383+ {
384+ child.setVisible(false);
385+ child.dispose();
386+ child=null;
387+ }
388+ }
389+
390+
391+
392+
393+ public void mouseClicked(MouseEvent e)
394+ {
395+ }
396+
397+ public void mouseEntered(MouseEvent e)
398+ {
399+ }
400+
401+ public void mouseExited(MouseEvent e)
402+ {
403+ }
404+
405+ public void mousePressed(MouseEvent e)
406+ {
407+ }
408+
409+ public void mouseReleased(MouseEvent e)
410+ {
411+ if (selectedMenuObject!=null && selectedMenuObject instanceof zPopupMenuText)
412+ {
413+ MenuItem menuItem=((zPopupMenuText)selectedMenuObject).item;
414+ if (menuItem.isEnabled() && !(menuItem instanceof Menu))
415+ {
416+ String actionCommand=menuItem.getActionCommand();
417+ iToolkit.postEvent(new ActionEvent(menuItem, ActionEvent.ACTION_PERFORMED,
418+ actionCommand));
419+ zPopupMenu w=(zPopupMenu)getParent();
420+ Frame f=(Frame)w.getParent();
421+ f.requestFocus();
422+ w.closeEverything();
423+ }
424+ }
425+ }
426+
427+ public void mouseMoved(MouseEvent e)
428+ {
429+ if (!focus)
430+ {
431+ focus=true;
432+ requestFocus();
433+ }
434+
435+ if (selectedMenuObject==null ||
436+ !selectedMenuObject.area.contains(e.getPoint()))
437+ {
438+ Graphics g=getGraphics();
439+ if (selectedMenuObject!=null)
440+ {
441+ selectedMenuObject.paint(g,0);
442+ selectedMenuObject=null;
443+ closeChild(child);
444+ }
445+ for (int i=0;i<menuObjectCount;i++)
446+ if (menuObjects[i].area.contains(e.getPoint()))
447+ {
448+ int mode=1;
449+
450+ selectedMenuObject=menuObjects[i];
451+ if (selectedMenuObject instanceof zPopupMenuText)
452+ {
453+ zPopupMenuText mo=(zPopupMenuText)selectedMenuObject;
454+
455+ if (mo.item.isEnabled())
456+ {
457+ zPopupMenu w=(zPopupMenu)getParent();
458+ Frame f=(Frame)w.getParent();
459+
460+ if (mo.item instanceof Menu)
461+ {
462+ int xx=w.xoffset+mo.area.x+mo.area.width;
463+ int yy=w.yoffset+mo.area.y;
464+ Menu menu=(Menu)mo.item;
465+
466+ mode=-1;
467+
468+ zPopupMenu newChild=new zPopupMenu(f,w,menu,xx,yy);
469+ newChild.pack();
470+ newChild.setVisible(true);
471+ closeChild(child);
472+ child=newChild;
473+
474+ }
475+ }
476+ selectedMenuObject.paint(g,mode);
477+ }
478+ break;
479+ }
480+
481+ g.dispose();
482+ }
483+ }
484+
485+ public void mouseDragged(MouseEvent e)
486+ {
487+ mouseMoved(e);
488+ }
489+
490+ public boolean gotFocus()
491+ {
492+ if (focus)
493+ return true;
494+ else
495+ if (child==null)
496+ return false;
497+ else
498+ return child.gotFocus();
499+
500+ }
501+
502+ public void focusLost(FocusEvent e)
503+ {
504+ focus=false;
505+ if (!gotFocus())
506+ {
507+ zPopupMenu m=(zPopupMenu)getParent();
508+ if (m.ancestor!=null) m.ancestor.closeChild(m);
509+ }
510+ }
511+
512+ public void focusGained(FocusEvent e)
513+ {
514+ focus=true;
515+
516+ }
517+
518+}
519+
520+abstract class zPopupMenuObject {
521+ Rectangle area;
522+
523+ public zPopupMenuObject()
524+ {
525+ }
526+
527+ public zPopupMenuObject(Rectangle area)
528+ {
529+ this.area=area;
530+ }
531+
532+ public abstract void paint(Graphics g,int mode);
533+
534+}
535+
536+class zPopupMenuText extends zPopupMenuObject {
537+ MenuItem item;
538+
539+public zPopupMenuText(MenuItem item,Rectangle area)
540+{
541+ super(area);
542+ this.item=item;
543+}
544+
545+
546+void drawArrow(Graphics g,int x,int y)
547+{
548+ for (int i=0;i<4;i++)
549+ {
550+ g.drawLine(x,y+i,x+3-i,y+i);
551+ if (i!=0)
552+ g.drawLine(x,y-i,x+3-i,y-i);
553+ }
554+}
555+
556+public void paint(Graphics g,int mode)
557+{
558+ Font f=item.getFont();
559+ FontMetrics fm=g.getFontMetrics(f);
560+ int fa=fm.getAscent();
561+ boolean enabled=item.isEnabled();
562+ boolean submenu=item instanceof Menu;
563+ boolean checked=(item instanceof CheckboxMenuItem?
564+ ((CheckboxMenuItem)item).getState():false);
565+ String s=item.getLabel();
566+ int xx=area.x;
567+ int yy=area.y;
568+
569+ g.setFont(f);
570+ if (enabled)
571+ {
572+ g.setColor(SystemColor.menu);
573+ if (mode!=0)
574+ Misc.fill3DRect(area,mode>0,g);
575+ else
576+ g.fillRect(xx,yy,area.width,area.height);
577+
578+ xx+=2;
579+ yy+=2;
580+ g.setColor(SystemColor.menuText);
581+ g.translate(-mode,-mode);
582+ if (checked) Misc.drawTick(g,xx,yy,zPopupMenuDisplay.TickBoxSize);
583+
584+g.drawString(s,zPopupMenuDisplay.TickBoxSize+zPopupMenuDisplay.TickLabelGap+xx,yy+fa);
585+ if (submenu)
586+ drawArrow(g,area.x+area.width-6,area.y+area.height/2);
587+ g.translate(+mode,+mode);
588+ }
589+ else
590+ {
591+ xx+=2;
592+ yy+=2;
593+ if (checked)
594+ {
595+ g.setColor(SystemColor.controlLtHighlight);
596+ Misc.drawTick(g,xx+1,yy+1,zPopupMenuDisplay.TickBoxSize);
597+ g.setColor(SystemColor.controlShadow);
598+ Misc.drawTick(g,xx,yy,zPopupMenuDisplay.TickBoxSize);
599+ }
600+
601+
602+Misc.drawDisabledString(s,zPopupMenuDisplay.TickBoxSize+zPopupMenuDisplay.TickLabelGap+xx,yy+fa,g);
603+ if (submenu)
604+ {
605+ g.setColor(SystemColor.controlLtHighlight);
606+ drawArrow(g,area.x+area.width-6+1,area.y+area.height/2+1);
607+ g.setColor(SystemColor.controlShadow);
608+ drawArrow(g,area.x+area.width-6,area.y+area.height/2);
609+ }
610+ }
611+
612+
613+}
614+
615+}
616+
617+class zPopupMenuSeparator extends zPopupMenuObject {
618+
619+public zPopupMenuSeparator(Rectangle area)
620+{
621+ super(area);
622+}
623+
624+public void paint(Graphics g,int mode)
625+{
626+ int y=area.y+zPopupMenuDisplay.SeparatorHeight/2-1;
627+
628+ g.setColor(zPopupMenuDisplay.medium);
629+ g.drawLine(area.x,y,area.x+area.width,y);
630+
631+ y+=1;
632+
633+ g.setColor(zPopupMenuDisplay.light);
634+ g.drawLine(area.x,y,area.x+area.width,y);
635+
636+
637+}
638+
639+}
640+
641+interface zPopupMenuParent {
642+
643+ public void closeChild(Window W);
644+
645+ public void closeEverything();
646+
647+}
648+
649+
650+
651+
652+
java/pkg2/inferno/awt/iToolkit.java+303−0
@@ -0,0 +1,303 @@
1+/*
2+ * %W% - %E%
3+ */
4+
5+package inferno.awt;
6+
7+import java.util.Hashtable;
8+import java.awt.*;
9+import java.awt.Toolkit;
10+import java.awt.image.*;
11+import java.awt.peer.*;
12+import java.awt.event.MouseEvent;
13+import java.awt.datatransfer.Clipboard;
14+import java.io.*;
15+import java.net.URL;
16+import java.util.Properties;
17+import sun.awt.image.*;
18+
19+public class iToolkit extends Toolkit {
20+
21+ // System clipboard.
22+ Clipboard clipboard;
23+
24+ // the system EventQueue
25+ protected static EventQueue theEventQueue;
26+
27+ public iToolkit() {
28+
29+ String eqName = Toolkit.getProperty("AWT.EventQueueClass",
30+ "java.awt.EventQueue");
31+ try {
32+ theEventQueue = (EventQueue)Class.forName(eqName).newInstance();
33+ } catch (Exception e) {
34+ System.err.println("Failed loading " + eqName + ": " + e);
35+ theEventQueue = new EventQueue();
36+ }
37+ }
38+
39+ protected EventQueue getSystemEventQueueImpl() {
40+ return theEventQueue;
41+ }
42+
43+ public Clipboard getSystemClipboard() {
44+ SecurityManager security = System.getSecurityManager();
45+ if (security != null) {
46+ security.checkSystemClipboardAccess();
47+ }
48+ if (clipboard == null) {
49+ //clipboard = new WClipboard();
50+ }
51+ return clipboard;
52+ }
53+
54+
55+ static public void postEvent(AWTEvent event)
56+ {
57+ // System.out.println("PeekEvent = "+theEventQueue.peekEvent());
58+ theEventQueue.postEvent(event);
59+ }
60+
61+ public void beep()
62+ {
63+
64+ }
65+
66+ public PrintJob getPrintJob(Frame frame, String doctitle, Properties props)
67+ {
68+ return null;
69+ }
70+
71+ public java.awt.Image createImage(byte[] data, int offset, int length) {
72+ return createImage(new ByteArrayImageSource(data, offset, length));
73+ }
74+
75+
76+
77+ public java.awt.Image createImage(ImageProducer producer) {
78+ return null/*new WImage(producer)*/;
79+ }
80+
81+ public int checkImage(java.awt.Image img, int w, int h, ImageObserver o) {
82+ return 0/*checkScrImage(img, w, h, o)*/;
83+ }
84+
85+ public boolean prepareImage(java.awt.Image img, int w, int h, ImageObserver o) {
86+ return false/*prepareScrImage(img, w, h, o)*/;
87+ }
88+
89+ public java.awt.Image getImage(String filename) {
90+ return null/*getImageFromHash(this, filename)*/;
91+ }
92+
93+ public java.awt.Image getImage(URL url) {
94+ return null/*getImageFromHash(this, url)*/;
95+ }
96+
97+ public void sync()
98+ {
99+ }
100+
101+ public FontMetrics getFontMetrics(Font font) {
102+ return iFontMetrics.getFontMetrics(font);
103+ }
104+
105+ public String[] getFontList() {
106+ // REMIND: "Helvetica", "TimesRoman", "Courier" and "ZapfDingbats"
107+ // will go awy from this list.
108+ String list[] = {"Dialog", "SansSerif", "Serif", "Monospaced",
109+ "Helvetica", "TimesRoman", "Courier",
110+ "DialogInput", "ZapfDingbats"};
111+ return list;
112+ }
113+
114+
115+ static native ColorModel makeColorModel();
116+ static ColorModel screenmodel;
117+
118+ static ColorModel getStaticColorModel() {
119+ if (screenmodel == null) {
120+ screenmodel = makeColorModel();
121+ }
122+ return screenmodel;
123+ }
124+
125+ public ColorModel getColorModel() {
126+ return getStaticColorModel();
127+ }
128+ // nwk+
129+ public native void loadSystemColors(int[] systemColors);
130+ // -nwk
131+
132+ public Dimension getScreenSize() {
133+ return new Dimension(getScreenWidth(), getScreenHeight());
134+ }
135+
136+ public int getScreenResolution()
137+ {
138+ return 96;
139+ }
140+
141+ protected int getScreenWidth()
142+ {
143+ return 640;
144+ }
145+
146+ protected int getScreenHeight()
147+ {
148+ return 480;
149+ }
150+
151+ public FontPeer getFontPeer(String name, int style) {
152+ return new inferno.awt.iFontPeer(name, style);
153+ }
154+
155+ /*
156+ * Create peer objects.
157+ */
158+
159+ public ButtonPeer createButton(Button target) {
160+ ButtonPeer peer = null;
161+ //ButtonPeer peer = new WButtonPeer(target);
162+ //peerMap.put(target, peer);
163+ return peer;
164+ }
165+
166+ public TextFieldPeer createTextField(TextField target) {
167+ TextFieldPeer peer = null;
168+ //TextFieldPeer peer = new WTextFieldPeer(target);
169+ //peerMap.put(target, peer);
170+ return peer;
171+ }
172+
173+ public LabelPeer createLabel(Label target) {
174+ LabelPeer peer = null;
175+ //LabelPeer peer = new WLabelPeer(target);
176+ //peerMap.put(target, peer);
177+ return peer;
178+ }
179+
180+ public ListPeer createList(List target) {
181+ ListPeer peer = null;
182+ //ListPeer peer = new WListPeer(target);
183+ //peerMap.put(target, peer);
184+ return peer;
185+ }
186+
187+ public CheckboxPeer createCheckbox(Checkbox target) {
188+ CheckboxPeer peer = null;
189+ //CheckboxPeer peer = new WCheckboxPeer(target);
190+ //peerMap.put(target, peer);
191+ return peer;
192+ }
193+
194+ public ScrollbarPeer createScrollbar(Scrollbar target) {
195+ ScrollbarPeer peer = null;
196+ //ScrollbarPeer peer = new WScrollbarPeer(target);
197+ //peerMap.put(target, peer);
198+ return peer;
199+ }
200+
201+ public ScrollPanePeer createScrollPane(ScrollPane target) {
202+ ScrollPanePeer peer = null;
203+ //ScrollPanePeer peer = new WScrollPanePeer(target);
204+ //peerMap.put(target, peer);
205+ return peer;
206+ }
207+
208+ public TextAreaPeer createTextArea(TextArea target) {
209+ TextAreaPeer peer = null;
210+ //TextAreaPeer peer = new WTextAreaPeer(target);
211+ //peerMap.put(target, peer);
212+ return peer;
213+ }
214+
215+ public ChoicePeer createChoice(Choice target) {
216+ ChoicePeer peer = null;
217+ //ChoicePeer peer = new WChoicePeer(target);
218+ //peerMap.put(target, peer);
219+ return peer;
220+ }
221+
222+ public FramePeer createFrame(Frame target) {
223+// FramePeer peer = null;
224+ FramePeer peer = new iFramePeer(target);
225+ //peerMap.put(target, peer);
226+ return peer;
227+ }
228+
229+ public CanvasPeer createCanvas(Canvas target) {
230+ CanvasPeer peer = null;
231+ //CanvasPeer peer = new WCanvasPeer(target);
232+ //peerMap.put(target, peer);
233+ return peer;
234+ }
235+
236+ public PanelPeer createPanel(Panel target) {
237+ PanelPeer peer = null;
238+ //PanelPeer peer = new WPanelPeer(target);
239+ //peerMap.put(target, peer);
240+ return peer;
241+ }
242+
243+ public WindowPeer createWindow(Window target) {
244+ // WindowPeer peer = null;
245+ WindowPeer peer = new iWindowPeer(target);
246+ //peerMap.put(target, peer);
247+ return peer;
248+ }
249+
250+ public DialogPeer createDialog(Dialog target) {
251+ DialogPeer peer = null;
252+ //DialogPeer peer = new WDialogPeer(target);
253+ //peerMap.put(target, peer);
254+ return peer;
255+ }
256+
257+ public FileDialogPeer createFileDialog(FileDialog target) {
258+ FileDialogPeer peer = null;
259+ //FileDialogPeer peer = new WFileDialogPeer(target);
260+ //peerMap.put(target, peer);
261+ return peer;
262+ }
263+
264+ public MenuBarPeer createMenuBar(MenuBar target) {
265+ MenuBarPeer peer = new iMenuBarPeer(target);
266+ //peerMap.put(target, peer);
267+ return peer;
268+// return null;
269+ }
270+
271+ public MenuPeer createMenu(Menu target) {
272+ MenuPeer peer = null;
273+ //MenuPeer peer = new WMenuPeer(target);
274+ //peerMap.put(target, peer);
275+ return peer;
276+ }
277+
278+ public PopupMenuPeer createPopupMenu(PopupMenu target) {
279+ //PopupMenuPeer peer = null;
280+ PopupMenuPeer peer = new iPopupMenuPeer(target);
281+ //peerMap.put(target, peer);
282+ return peer;
283+ }
284+
285+ public MenuItemPeer createMenuItem(MenuItem target) {
286+ MenuItemPeer peer = null;
287+ //MenuItemPeer peer = new WMenuItemPeer(target);
288+ //peerMap.put(target, peer);
289+ return peer;
290+ }
291+
292+ public CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target) {
293+ CheckboxMenuItemPeer peer = null;
294+ //CheckboxMenuItemPeer peer = new WCheckboxMenuItemPeer(target);
295+ //peerMap.put(target, peer);
296+ return peer;
297+ }
298+
299+
300+}
301+
302+
303+
java/pkg2/inferno/awt/iToolkit_L.b+85−0
@@ -0,0 +1,85 @@
1+implement iToolkit_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#
28+# %W% - %E%
29+#
30+ draw: Draw;
31+ Context, Display, Image: import draw;
32+
33+include "java/lang/ClassLoader_L.m";
34+include "awt_Color.m";
35+ awt : AwtColor;
36+
37+sys : import jni;
38+ctxt : ref Context;
39+
40+#<<
41+
42+include "iToolkit_L.m";
43+
44+#>> extra post includes here
45+
46+#<<
47+
48+init( jni_p : JNI )
49+{
50+ # save java native inteface mod instance
51+ jni = jni_p;
52+ #>>extra initialization here
53+ sys = jni->sys;
54+ ctxt = jni->getContext();
55+ awt = load AwtColor AwtColor->PATH;
56+ if (awt == nil) {
57+ sys->print("could not load %s: %r\n", AwtColor->PATH);
58+ return;
59+ }
60+ #<<
61+}
62+
63+makeColorModel_rColorModel( this : ref iToolkit_obj ) : JObject
64+{#>>
65+ if (ctxt == nil) {
66+ sys->print("iToolkit_L: Can't makeColorModel - nil context\n");
67+ return nil;
68+ }
69+
70+ junk := this;
71+ ldepth := ctxt.display.image.ldepth;
72+ bits := 1<<ldepth;
73+ jobj := awt->makeColorModel(jni, bits);
74+ return jobj;
75+}#<<
76+
77+## nwk+
78+loadSystemColors_aI_V( this : ref iToolkit_obj, p0 : JArrayI)
79+{#>>
80+ junk := this;
81+
82+ awt->loadSystemColors(jni, p0);
83+ return;
84+}#<<
85+## -nwk
java/pkg2/inferno/awt/iToolkit_L.m+19−0
@@ -0,0 +1,19 @@
1+#
2+# %W% - %E%
3+#
4+
5+# javal v1.5 generated file: edit with care
6+
7+iToolkit_L : module
8+{
9+ iToolkit_obj : adt
10+ {
11+ cl_mod : ClassModule;
12+ clipboard : JObject;
13+ };
14+
15+ init : fn( jni_p : JNI );
16+ makeColorModel_rColorModel : fn( this : ref iToolkit_obj ) : JObject;
17+ loadSystemColors_aI_V : fn( this : ref iToolkit_obj, p0 : JArrayI);
18+
19+};
java/pkg2/inferno/awt/iWindowPeer.java+411−0
@@ -0,0 +1,411 @@
1+/*
2+ * %W% - %E%
3+ */
4+
5+package inferno.awt;
6+
7+import java.awt.*;
8+import java.awt.event.*;
9+import java.awt.peer.*;
10+import java.awt.image.ImageProducer;
11+import java.awt.image.ImageObserver;
12+import java.awt.image.ColorModel;
13+import java.awt.image.DirectColorModel;
14+import java.util.*;
15+import inferno.awt.iGraphics;
16+
17+public class iWindowPeer implements WindowPeer, DoubleBufferingPeer {
18+ Object pCanvas; // Set inside create()
19+ Window target;
20+ int leftInset=0; // How much canvas is inset from window
21+ int rightInset=0;
22+ int topInset=0;
23+ int bottomInset=0;
24+ int left; // x position of left of window
25+ int top; // y position of top of window
26+
27+ private Point oldMousePoint;
28+ private boolean buttonState[];
29+
30+ public iWindowPeer(Window target) {
31+ this.target = target;
32+ oldMousePoint=new Point(-1,-1);
33+ buttonState=new boolean[3];
34+ for (int i=0;i<3;i++) buttonState[i]=false; //up
35+ create(this);
36+ Font f = target.getFont();
37+ if (f == null) {
38+ f = new Font("Dialog", Font.PLAIN, 12);
39+ target.setFont(f);
40+ setFont(f);
41+ }
42+ Color c = target.getBackground();
43+ if (c == null) {
44+ c = SystemColor.window;
45+ target.setBackground(c);
46+ setBackground(c);
47+ }
48+ c = target.getForeground();
49+ if (c == null) {
50+ target.setForeground(Color.black);
51+ setForeground(Color.black);
52+ }
53+
54+ }
55+
56+ /* implementation of java.awt.peer.DoubleBufferingPeer */
57+ public boolean isDoubleBuffered() {
58+ return true;
59+ }
60+
61+ native Object getRefImage(); // Returns $Draw->Image of canvas
62+ native Object getRefOffScreenImage(); // Returns off-screen buffer image
63+
64+ native void pReshape(int x, int y, int width, int height);
65+
66+ native void pHide(); // Hide window
67+
68+ native void pShow(iWindowPeer fp); // Show window
69+
70+ native int getXYLoc(int coord); // get x or y value of the global position
71+
72+ public native void create(iWindowPeer fp); // Create window putting canvas in pcanvas
73+
74+ public native void pDispose(); // Destroy window
75+
76+ public native void setCursor(int cursorType); // Set cursor
77+
78+
79+ /* New 1.1 API */
80+ public Point getLocationOnScreen() // Return position on screen
81+ {
82+ Point p = new Point();
83+ p.x = getXYLoc(0);
84+ p.y = getXYLoc(1);
85+ return p;
86+ }
87+
88+ public void setCursor(Cursor c)
89+ {
90+ if (c!=null)
91+ setCursor(c.getType());
92+ }
93+
94+ public native void toFront(); // Move window to front
95+
96+ public native void toBack(); // Move window to back
97+
98+ public Insets getInsets()
99+ {
100+ Insets i=new Insets(topInset,leftInset,bottomInset,rightInset);
101+ return i;
102+ }
103+
104+ public Insets insets()
105+ {
106+ return getInsets();
107+ }
108+
109+ public void endValidate()
110+ {
111+
112+ }
113+
114+ public void beginValidate()
115+ {
116+
117+ }
118+
119+ public void setBounds(int x, int y, int width, int height) {
120+ pReshape(x, y, width, height);
121+ }
122+
123+ public void reshape(int x, int y, int width, int height) {
124+ pReshape(x, y, width, height);
125+ }
126+
127+
128+ public void dispose()
129+ {
130+ pDispose();
131+ pCanvas=null;
132+ }
133+
134+ public void disable()
135+ {
136+ setEnabled(false);
137+ }
138+
139+ public void enable()
140+ {
141+ setEnabled(false);
142+ }
143+
144+ public void setEnabled(boolean b)
145+ {
146+
147+ }
148+
149+ public void hide()
150+ {
151+ setVisible(false);
152+ }
153+
154+ public void show()
155+ {
156+ setVisible(true);
157+ }
158+
159+ public void setVisible(boolean b)
160+ {
161+ if (b)
162+ pShow(this);
163+ else
164+ pHide();
165+ }
166+
167+ public Dimension getMinimumSize() {
168+ return target.getSize();
169+ }
170+
171+ public Dimension getPreferredSize() {
172+ return getMinimumSize();
173+ }
174+
175+ public Dimension minimumSize() {
176+ return getMinimumSize();
177+ }
178+
179+ public Dimension preferredSize() {
180+ return getPreferredSize();
181+ }
182+
183+
184+ public int checkImage(Image img, int w, int h, ImageObserver o) {
185+ return 0;
186+ }
187+
188+ public FontMetrics getFontMetrics(Font font) {
189+ return iFontMetrics.getFontMetrics(font);
190+ }
191+
192+ public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
193+ return false;
194+ }
195+
196+
197+ public Image createImage(ImageProducer producer) {
198+ return null/*new Win32Image(producer)*/;
199+ }
200+ public Image createImage(int width, int height) {
201+ return null/*new Win32Image(target, width, height)*/;
202+ }
203+
204+ public boolean isFocusTraversable() {
205+ return false;
206+ }
207+
208+ public void requestFocus()
209+ {
210+ }
211+
212+ public void nextFocus()
213+ {
214+ }
215+
216+ public void setFont(Font f)
217+ {
218+
219+ }
220+
221+ public Font getFont()
222+ {
223+ return null;
224+ }
225+
226+ public void setBackground(Color c)
227+ {
228+
229+ }
230+
231+ public void setForeground(Color c)
232+ {
233+
234+ }
235+
236+ public Graphics getGraphics()
237+ {
238+ if (pCanvas == null) {
239+ System.out.println("iWindowPeer:getGraphics()s: pCanvas == null, continuing!"); // jfs -remove
240+ return null;
241+ }
242+ Rectangle bounds = target.getBounds();
243+ Rectangle clip = new Rectangle(bounds.x+leftInset,
244+ bounds.y+topInset,
245+ bounds.width-leftInset-rightInset,
246+ bounds.height-topInset-bottomInset);
247+ Graphics g=new iGraphics(getRefImage(),getRefOffScreenImage(), clip,
248+target);
249+ g.translate(bounds.x,bounds.y);
250+ return g;
251+ }
252+
253+ public java.awt.Toolkit getToolkit() {
254+ // XXX: bogus
255+ return Toolkit.getDefaultToolkit();
256+ }
257+
258+ public ColorModel getColorModel() {
259+ return iToolkit.getStaticColorModel();
260+ }
261+
262+ public void handleEvent(AWTEvent e)
263+ {
264+
265+ }
266+
267+ public void print(Graphics g)
268+ {
269+ }
270+
271+ public void paint(Graphics g)
272+ {
273+ g.setColor(target.getForeground());
274+ g.setFont(target.getFont());
275+ target.paint(g);
276+ }
277+
278+
279+ public void repaint(long tm, int x, int y, int width, int height) {
280+ iToolkit.postEvent(new PaintEvent((Component)target, PaintEvent.UPDATE,
281+ new Rectangle(x, y, width, height)));
282+
283+ }
284+
285+ public void handleKeyEvents(int ch)
286+ {
287+ char keyChar = (char)ch;
288+ boolean control = ch >= 0 && ch <= 31;
289+ boolean lowercase = ch >= (int)'a' && ch <= (int)'z';
290+ boolean uppercase = ch >= (int)'A' && ch <= (int)'Z';
291+ int modifiers = control?InputEvent.CTRL_MASK:
292+ uppercase?InputEvent.SHIFT_MASK:0;
293+ int keyCode = control?ch+64:lowercase?ch-32:ch;
294+ Date d = new Date();
295+ long when = d.getTime();
296+
297+ iToolkit.postEvent(new KeyEvent(target,KeyEvent.KEY_PRESSED,
298+ when,modifiers,keyCode,keyChar));
299+
300+ }
301+
302+private void handleMouseEvents(int m,int button,int x,int y)
303+{
304+ char mode=(char)m;
305+ // System.out.println("Mouse event "+mode+" "+button+" "+x+" "+y);
306+ switch(mode)
307+ {
308+ case 'd':
309+ case 'r':
310+ case 'm':
311+ case 'p':
312+ Rectangle bounds = target.getBounds();
313+ int xx=x-bounds.x-leftInset;
314+ int yy=y-bounds.y; // -topInset;
315+
316+ Point mousePoint=new Point(xx,yy);
317+ //Date d = new Date();
318+ //long when = d.getTime();
319+ long when=0;
320+ int modifier;
321+
322+ switch(button)
323+ {
324+ case 1:
325+ modifier=InputEvent.BUTTON1_MASK;
326+ break;
327+
328+ case 2:
329+ modifier=InputEvent.BUTTON2_MASK;
330+ break;
331+
332+ case 3:
333+ modifier=InputEvent.BUTTON3_MASK;
334+ break;
335+
336+ default:
337+ modifier=0;
338+ }
339+
340+ switch(mode)
341+ {
342+ case 'p': // Pressed
343+ case 'd': // Double click
344+ {
345+ if (button>0 && button<=3 && buttonState[button-1]==false)
346+ {
347+ oldMousePoint=mousePoint;
348+ buttonState[button-1]=true;
349+ iToolkit.postEvent(new MouseEvent(target,MouseEvent.MOUSE_PRESSED,
350+ when,modifier,xx,yy,1,false));
351+
352+ }
353+ break;
354+ }
355+ case 'r': // Released
356+ {
357+ if (button>0 && button<=3 && buttonState[button-1]==true)
358+ {
359+ buttonState[button-1]=false;
360+ iToolkit.postEvent(new MouseEvent(target,MouseEvent.MOUSE_RELEASED,
361+ when,modifier,xx,yy,1,false));
362+ if (mousePoint.equals(oldMousePoint))
363+ {
364+ iToolkit.postEvent(new MouseEvent(target,MouseEvent.MOUSE_CLICKED,
365+ when,modifier,xx,yy,1,button==2));
366+ }
367+ }
368+ break;
369+ }
370+ case 'm': // Moved
371+ {
372+ modifier=0;
373+ if (buttonState[0]) modifier|=InputEvent.BUTTON1_MASK;
374+ if (buttonState[1]) modifier|=InputEvent.BUTTON2_MASK;
375+ if (buttonState[2]) modifier|=InputEvent.BUTTON3_MASK;
376+ iToolkit.postEvent(new MouseEvent(target,
377+ modifier==0?MouseEvent.MOUSE_MOVED:MouseEvent.MOUSE_DRAGGED,
378+ when,modifier,xx,yy,1,false));
379+
380+ break;
381+ }
382+ default:
383+ // System.out.println("MouseString: " + mouseString);
384+ }
385+ break;
386+ }
387+}
388+
389+ private void movesize(int x, int y, int width, int height)
390+ {
391+ Rectangle old = target.getBounds();
392+ Rectangle n = new Rectangle(x, y, width, height);
393+ if (!n.equals(old)){
394+ target.setBounds(x, y, width, height);
395+ target.repaint();
396+ }
397+ }
398+
399+ public void handleFocusGained()
400+ {
401+
402+ }
403+}
404+
405+
406+
407+
408+
409+
410+
411+
java/pkg2/inferno/awt/iWindowPeer_L.b+377−0
@@ -0,0 +1,377 @@
1+implement iWindowPeer_L;
2+
3+include "jni.m";
4+ jni : JNI;
5+ ClassModule,
6+ JString,
7+ JArray,
8+ JArrayI,
9+ JArrayC,
10+ JArrayB,
11+ JArrayS,
12+ JArrayJ,
13+ JArrayF,
14+ JArrayD,
15+ JArrayZ,
16+ JArrayJObject,
17+ JArrayJClass,
18+ JArrayJString,
19+ JClass,
20+ JObject : import jni;
21+
22+#>> extra pre includes here
23+#
24+# %W% - %E%
25+#
26+ cast : Cast;
27+ sys : Sys;
28+ draw: Draw;
29+ Context, Screen, Display, Rect, Font, Point, Image: import draw;
30+
31+include "tk.m";
32+ tk: Tk;
33+ Toplevel: import tk;
34+
35+include "wmlib.m";
36+ wmlib: Wmlib;
37+
38+include "awt_Color.m";
39+ awt : AwtColor;
40+#<<
41+
42+include "iWindowPeer_L.m";
43+
44+#>> extra post includes here
45+ str : String;
46+ Value : import jni;
47+ ctxt : ref Draw->Context;
48+ cvm : ref Canvas;
49+#<<
50+
51+init( jni_p : JNI )
52+{
53+ # save java native inteface mod instance
54+ jni = jni_p;
55+ #>>extra initialization here
56+ sys = jni->sys;
57+ str = load String String->PATH;
58+ awt = load AwtColor AwtColor->PATH;
59+ cast = jni->CastMod();
60+ ctxt = jni->getContext();
61+ #<<
62+}
63+
64+getRefImage_rObject( this : ref iWindowPeer_obj) : ref Draw->Image
65+{#>>
66+ return this.pCanvas.image;
67+}#<<
68+
69+getRefOffScreenImage_rObject( this : ref iWindowPeer_obj) : ref Draw->Image
70+{#>>
71+ return this.pCanvas.buf;
72+}#<<
73+
74+pReshape_I_I_I_I_V( this : ref iWindowPeer_obj, p0 : int,p1 : int,p2 : int,p3 : int)
75+{#>>
76+ strcmd := ". configure -x " +
77+ string p0 + " -y " + string p1 + " -width " + string p2 + " -height " + string p3;
78+
79+ tk->cmd(this.pCanvas.top, strcmd);
80+ tk->cmd(this.pCanvas.top, "update");
81+ this.pCanvas.image = this.pCanvas.top.image;
82+}#<<
83+
84+pHide_V( this : ref iWindowPeer_obj)
85+{#>>
86+ tk->cmd(this.pCanvas.top, ". unmap");
87+ this.pCanvas.image = nil;
88+}#<<
89+
90+pShow_riWindowPeer_V( this : ref iWindowPeer_obj, p0: JObject)
91+{#>>
92+ tk->cmd(this.pCanvas.top, ". map");
93+return;
94+ args := array[0] of ref Value;
95+ (val, err) := jni->CallMethod(this.target, "repaint", "()V", args);
96+ if (err != jni->OK){
97+ sys->print( "CallMethod Error %d: repaint\n",err);
98+ }
99+}#<<
100+
101+getXYLoc_I_I( this : ref iWindowPeer_obj, p0 : int) : int
102+{#>>
103+ if (p0 == 0)
104+ return cvm.rect.min.x;
105+ else
106+ return cvm.rect.min.y;
107+}#<<
108+
109+create_riWindowPeer_V( this : ref iWindowPeer_obj, p0 : JObject)
110+{#>>
111+ xval := jni->GetObjField(this.target, "x", "I");
112+ yval := jni->GetObjField(this.target, "y", "I");
113+ wval := jni->GetObjField(this.target, "width", "I");
114+ hval := jni->GetObjField(this.target, "height", "I");
115+
116+ x := xval.Int();
117+ y := yval.Int();
118+ w := wval.Int();
119+ h := hval.Int();
120+
121+ makewin(ctxt, x, y, w, h, this, p0);
122+
123+ this.topInset = 0;
124+ this.leftInset = 0;
125+ this.rightInset = 0;
126+ this.bottomInset = 0;
127+ this.left = this.pCanvas.rect.min.x;
128+ this.top = this.pCanvas.rect.min.y;
129+
130+ tk->cmd(this.pCanvas.top, ". unmap");
131+ this.pCanvas.image = nil;
132+
133+}#<<
134+
135+pDispose_V( this : ref iWindowPeer_obj)
136+{#>>
137+ this.pCanvas.jtd <- = "Die!";
138+
139+ this.pCanvas.top = nil;
140+ this.pCanvas.image = nil;
141+ this.pCanvas.buf = nil;
142+ this.pCanvas = nil;
143+}#<<
144+
145+setCursor_I_V( this : ref iWindowPeer_obj, p0 : int)
146+{#>>
147+}#<<
148+
149+toFront_V( this : ref iWindowPeer_obj)
150+{#>>
151+ this.pCanvas.image.top();
152+}#<<
153+
154+toBack_V( this : ref iWindowPeer_obj)
155+{#>>
156+ this.pCanvas.image.bottom();
157+}#<<
158+
159+#>>
160+screen: ref Screen;
161+display: ref Display;
162+ones: ref Image;
163+white: ref Image;
164+
165+ Event: adt
166+ {
167+ event: int;
168+ detail: string;
169+
170+ Button, Key,
171+ Icon, DeIcon,
172+ Resize, Shutdown
173+ : con iota;
174+ };
175+
176+ Attr: adt
177+ {
178+ origin: Draw->Point;
179+ dims: Draw->Point;
180+ };
181+
182+ Canvas: adt
183+ {
184+ # interface
185+ image: ref Draw->Image;
186+ buf: ref Draw->Image;
187+ rect: Draw->Rect;
188+ events: chan of ref Event;
189+ attr: ref Attr;
190+ jtd : chan of string;
191+ # implementation
192+ ctxt : ref Draw->Context;
193+ top: ref Tk->Toplevel;
194+ canvas: string;
195+ pid: int;
196+ };
197+#<<
198+
199+#>>
200+win_cfg := array[] of {
201+ "canvas .w -height 2 -width 2",
202+ "pack .w -side bottom -fill both -expand 1",
203+ "pack propagate . 0",
204+};
205+
206+win_bind := array[] of {
207+ "bind # <Motion> {send butt m %b %X %Y}",
208+# "bind # <Leave> {send butt Leave}",
209+ "bind # <ButtonPress> {focus #;send butt p %b %X %Y}",
210+ "bind # <ButtonRelease> {send butt r %b %X %Y}",
211+ "bind # <Double-Button> {send butt d %b %X %Y}",
212+# "bind # <Enter> {send butt Enter}",
213+ "bind # <KeyPress> {send key %K}",
214+# "bind . <FocusIn> {send foc focus}",
215+};
216+
217+modinit(ctxt: ref Context)
218+{
219+ draw = load Draw Draw->PATH;
220+ tk = load Tk Tk->PATH;
221+ wmlib = load Wmlib Wmlib->PATH;
222+
223+ screen = ctxt.screen;
224+ wmlib->init();
225+}
226+
227+makewin(ctxt: ref Context, x, y, width, height: int, this: ref iWindowPeer_obj, job: JObject)
228+{
229+ modinit(ctxt);
230+ where := "-x " + string x + " -y " + string y;
231+ t := tk->toplevel(screen, "-borderwidth 0 -relief raised "+where);
232+# (t, menu) := wmlib->titlebar(screen, where, title, Wmlib->Appl);
233+
234+ if (width > 0 && height > 0)
235+ win_cfg[0] = "canvas .w -height " + string height + " -width " + string width;
236+
237+ wmlib->tkcmds(t, win_cfg);
238+ ones = t.image.display.ones;
239+ white = t.image.display.color(Draw->White);
240+ alloccanvas(t, ctxt, ".w", this, job);
241+}
242+
243+alloccanvas(t: ref Toplevel, ctxt: ref Draw->Context, canvas: string, this :ref iWindowPeer_obj, job: JObject)
244+{
245+ cmd := chan of string;
246+ tk->namechan(t, cmd, "cmd");
247+ butt := chan of string;
248+ tk->namechan(t, butt, "butt");
249+
250+ key := chan of string;
251+ tk->namechan(t, key, "key");
252+
253+ tk->cmd(t, "bind . <Configure> {send cmd resize}");
254+ tk->cmd(t, "bind . <Map> {send cmd map}");
255+
256+ for (i := 0; i < len win_bind; i++)
257+ tk->cmd(t, expand(win_bind[i], canvas));
258+
259+ tk->cmd(t, "update");
260+
261+ c := ref Canvas;
262+ this.pCanvas = c;
263+ c = nil;
264+
265+ bg := Draw->White;
266+ jcol := jni->GetObjField(this.target, "background", "Ljava/awt/Color;");
267+ if (jcol == nil) {
268+ sys->print("Cannot get background color\n");
269+ } else {
270+ color := jcol.Object();
271+ bg = awt->getColorIndex(jni, color);
272+ }
273+
274+ this.pCanvas.image = t.image;
275+ display = t.image.display;
276+ this.pCanvas.rect = canvposn(t, canvas);
277+ this.pCanvas.buf = ctxt.display.newimage(ctxt.display.image.r,
278+ this.pCanvas.image.ldepth , 0, bg);
279+ this.pCanvas.events = chan of ref Event;
280+ this.pCanvas.top = t;
281+ this.pCanvas.ctxt = ctxt;
282+ this.pCanvas.canvas = canvas;
283+ this.pCanvas.pid = sys->pctl(0, nil);
284+
285+ spawn handler(cmd, butt, key, this, job);
286+}
287+
288+handler(cmd, butt, key : chan of string, this : ref iWindowPeer_obj, job: JObject)
289+{
290+
291+ detail: string;
292+
293+ jtd := chan of string;
294+ this.pCanvas.jtd = jtd;
295+
296+ for (;;) alt {
297+ detail = <- this.pCanvas.jtd =>
298+ return;
299+ detail = <- cmd =>
300+ (n, word) := sys->tokenize(detail, " ");
301+ case hd word {
302+ "map" =>
303+ this.pCanvas.image = this.pCanvas.top.image;
304+ handleRepaint(this);
305+
306+ * =>
307+ ;
308+ }
309+
310+ detail = <- butt =>
311+ doMouseEvent(job, detail);
312+ detail = <- key =>
313+ (kchar, st) := str->toint(detail, 16);
314+ args := array[1] of ref Value;
315+ args[0] = ref Value.TInt(kchar);
316+ (val, err) := jni->CallMethod(job, "handleKeyEvents", "(I)V", args);
317+ if (err != jni->OK){
318+ sys->print( "CallMethod Error %d: handleKeyEvents\n",err);
319+ }
320+ }
321+}
322+expand(cmd, canvas: string): string
323+{
324+ s: string;
325+ for (;;) {
326+ (l, r) := str->splitl(cmd, "#");
327+ s = s + l;
328+ if (r == nil)
329+ return s;
330+ s = s + canvas;
331+ cmd = r[1:];
332+ }
333+}
334+
335+canvposn(t: ref Toplevel, c: string): Rect
336+{
337+ r: Rect;
338+
339+ r.min.x = int tk->cmd(t, ". cget -actx") + int tk->cmd(t, ".dx get");
340+ r.min.y = int tk->cmd(t, ". cget -acty") + int tk->cmd(t, ".dy get");
341+ r.max.x = r.min.x + int tk->cmd(t, ". cget -actwidth") + int tk->cmd(t, ".dw get");
342+ r.max.y = r.min.y + int tk->cmd(t, ". cget -actheight") + int tk->cmd(t, ".dh get");
343+ return r;
344+}
345+
346+doMouseEvent(job: JObject, detail : string)
347+{
348+ (n,toks) := sys->tokenize(detail," ");
349+ if (n != 4) return;
350+ mode := array of byte hd toks;
351+ toks = tl toks;
352+ button:=int hd toks;
353+ toks = tl toks;
354+ x:=int hd toks;
355+ toks = tl toks;
356+ y:=int hd toks;
357+ args := array[4] of ref Value;
358+ args[0] = ref Value.TInt(int mode[0]);
359+ args[1] = ref Value.TInt(button);
360+ args[2] = ref Value.TInt(x);
361+ args[3] = ref Value.TInt(y);
362+ (val, err) := jni->CallMethod(job, "handleMouseEvents", "(IIII)V", args);
363+ if (err != jni->OK){
364+ sys->print( "CallMethod Error %d: handleMouseEvents\n",err);
365+ }
366+}
367+
368+handleRepaint(this : ref iWindowPeer_obj)
369+{
370+ args := array[0] of ref Value;
371+ (val, err) := jni->CallMethod(this.target, "repaint", "()V", args);
372+ if (err != jni->OK){
373+ sys->print( "CallMethod Error %d: repaint\n",err);
374+ }
375+}
376+#<<
377+
java/pkg2/inferno/awt/iWindowPeer_L.m+36−0
@@ -0,0 +1,36 @@
1+#
2+# %W% - %E%
3+#
4+# generated file edit with care
5+
6+iWindowPeer_L : module
7+{
8+ iWindowPeer_obj : adt
9+ {
10+ cl_mod : ClassModule;
11+ pCanvas : ref Canvas;
12+ target : JObject;
13+ leftInset : int;
14+ rightInset : int;
15+ topInset : int;
16+ bottomInset : int;
17+ left : int;
18+ top : int;
19+ oldMousePoint : JObject;
20+ buttonState : JArrayZ;
21+ };
22+
23+ init : fn( jni_p : JNI );
24+ getRefImage_rObject : fn( this : ref iWindowPeer_obj) : ref Draw->Image;
25+ getRefOffScreenImage_rObject : fn( this : ref iWindowPeer_obj) : ref Draw->Image;
26+ pReshape_I_I_I_I_V : fn( this : ref iWindowPeer_obj, p0 : int,p1 : int,p2 : int,p3 : int);
27+ pHide_V : fn( this : ref iWindowPeer_obj);
28+ pShow_riWindowPeer_V : fn( this : ref iWindowPeer_obj, p0 : JObject);
29+ getXYLoc_I_I : fn( this : ref iWindowPeer_obj, p0 : int) : int;
30+ create_riWindowPeer_V : fn( this : ref iWindowPeer_obj, p0 : JObject);
31+ pDispose_V : fn( this : ref iWindowPeer_obj);
32+ setCursor_I_V : fn( this : ref iWindowPeer_obj, p0 : int);
33+ toFront_V : fn( this : ref iWindowPeer_obj);
34+ toBack_V : fn( this : ref iWindowPeer_obj);
35+
36+};
java/pkg2/inferno/awt/mkfile+126−0
@@ -0,0 +1,126 @@
1+<../../../../mkconfig
2+
3+TARG=\
4+ iDrawingSurfaceInfo.dis\
5+ iFontMetrics.dis\
6+ iFontPeer.dis\
7+ iFramePeer.dis\
8+ iGraphics.dis\
9+ iImage.dis\
10+ iImageConsumer.dis\
11+ iImageRepresentation.dis\
12+ iMenuBarPeer.dis\
13+ iOffScreenImage.dis\
14+ iPopupMenuPeer.dis\
15+ iToolkit.dis\
16+ iWindowPeer.dis\
17+ zMenuWindow.dis\
18+ zMenuDisplay.dis\
19+ zMenuBarObject.dis\
20+ zMenuObject.dis\
21+ zMenuParent.dis\
22+ zMenuSeparator.dis\
23+ zMenuText.dis\
24+ zPopupMenu.dis\
25+ zPopupMenuDisplay.dis\
26+ zPopupMenuObject.dis\
27+ zPopupMenuParent.dis\
28+ zPopupMenuSeparator.dis\
29+ zPopupMenuText.dis\
30+# Limbo code\
31+ awt_Color.dis\
32+ awt_Frame.dis\
33+ awt_Graphics.dis\
34+# broken\
35+# iDrawingSurfaceInfo_L.dis\
36+ iFontMetrics_L.dis\
37+ iFontPeer_L.dis\
38+ iFramePeer_L.dis\
39+ iGraphics_L.dis\
40+ iImageRepresentation_L.dis\
41+ iImage_L.dis\
42+ iToolkit_L.dis\
43+ iWindowPeer_L.dis\
44+
45+MODULES=\
46+ $ROOT/java/module/classloader.m\
47+ $ROOT/java/module/jni.m\
48+ $ROOT/java/module/cast.m\
49+ awt_Color.m\
50+ awt_Frame.m\
51+ awt_Graphics.m\
52+ awt_Image.m\
53+ iDrawingSurfaceInfo_L.m\
54+ iFontMetrics_L.m\
55+ iFontPeer_L.m\
56+ iFramePeer_L.m\
57+ iGraphics_L.m\
58+ iImageRepresentation_L.m\
59+ iImage_L.m\
60+ iToolkit_L.m\
61+ iWindowPeer_L.m\
62+
63+SYSMODULES=\
64+ draw.m\
65+ hash.m\
66+ keyring.m\
67+ loader.m\
68+ math.m\
69+ string.m\
70+ sys.m\
71+
72+DISBIN=$ROOT/java/dis/java/inferno/awt
73+
74+<$ROOT/mkfiles/mkjava
75+
76+LIMBOINCL=\
77+ $LIMBOINCL\
78+ -I$ROOT/java/pkg\
79+
80+awt_Color.dis: awt_Color.b
81+ limbo $LIMBOINCL -gw awt_Color.b
82+
83+awt_Frame.dis: awt_Frame.b
84+ limbo $LIMBOINCL -gw awt_Frame.b
85+
86+awt_Graphics.dis: awt_Graphics.b
87+ limbo $LIMBOINCL -gw awt_Graphics.b
88+
89+zMenuWindow.dis: iMenuBarPeer.class
90+ j2d zMenuWindow.class
91+
92+zMenuDisplay.dis: iMenuBarPeer.class
93+ j2d zMenuDisplay.class
94+
95+zMenuBarObject.dis: iMenuBarPeer.class
96+ j2d zMenuBarObject.class
97+
98+zMenuObject.dis: iMenuBarPeer.class
99+ j2d zMenuObject.class
100+
101+zMenuParent.dis: iMenuBarPeer.class
102+ j2d zMenuParent.class
103+
104+zMenuSeparator.dis: iMenuBarPeer.class
105+ j2d zMenuSeparator.class
106+
107+zMenuText.dis: iMenuBarPeer.class
108+ j2d zMenuText.class
109+
110+zPopupMenu.dis: iPopupMenuPeer.class
111+ j2d zPopupMenu.class
112+
113+zPopupMenuDisplay.dis: iPopupMenuPeer.class
114+ j2d zPopupMenuDisplay.class
115+
116+zPopupMenuObject.dis: iPopupMenuPeer.class
117+ j2d zPopupMenuObject.class
118+
119+zPopupMenuParent.dis: iPopupMenuPeer.class
120+ j2d zPopupMenuParent.class
121+
122+zPopupMenuSeparator.dis: iPopupMenuPeer.class
123+ j2d zPopupMenuSeparator.class
124+
125+zPopupMenuText.dis: iPopupMenuPeer.class
126+ j2d zPopupMenuText.class
java/pkg2/inferno/mkfile+7−0
@@ -0,0 +1,7 @@
1+<../../../mkconfig
2+
3+DIRS=\
4+ awt\
5+ vm\
6+
7+<$ROOT/mkfiles/mksubdirs
java/pkg2/inferno/vm/Array.java+10−0
@@ -0,0 +1,10 @@
1+// special Array wrapper class; all fields 'transient' to thwart serialization
2+
3+package inferno.vm;
4+public final
5+class Array implements Cloneable, java.io.Serializable {
6+ private transient Object data; // Dis array
7+ private transient int ndim; // number of dimensions
8+ private transient Object adt; // 'ref Class' of elt. type (nil if primitive)
9+ private transient int etype; // primitive elt. type code (0 if reference)
10+}
java/pkg2/inferno/vm/FD.java+7−0
@@ -0,0 +1,7 @@
1+package inferno.vm;
2+
3+public
4+class FD
5+{
6+ Object fd;
7+};
java/pkg2/inferno/vm/boolean_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class boolean_p
4+{
5+}
java/pkg2/inferno/vm/byte_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class byte_p
4+{
5+}
java/pkg2/inferno/vm/char_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class char_p
4+{
5+}
java/pkg2/inferno/vm/double_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class double_p
4+{
5+}
java/pkg2/inferno/vm/float_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class float_p
4+{
5+}
java/pkg2/inferno/vm/int_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class int_p
4+{
5+}
java/pkg2/inferno/vm/long_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class long_p
4+{
5+}
java/pkg2/inferno/vm/mkfile+18−0
@@ -0,0 +1,18 @@
1+<../../../../mkconfig
2+
3+TARG=\
4+ Array.dis\
5+ FD.dis\
6+ boolean_p.dis\
7+ byte_p.dis\
8+ char_p.dis\
9+ double_p.dis\
10+ float_p.dis\
11+ int_p.dis\
12+ long_p.dis\
13+ short_p.dis\
14+ void_p.dis\
15+
16+DISBIN=$ROOT/java/dis/java/inferno/vm
17+
18+<$ROOT/mkfiles/mkjava
java/pkg2/inferno/vm/short_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class short_p
4+{
5+}
java/pkg2/inferno/vm/void_p.java+5−0
@@ -0,0 +1,5 @@
1+package inferno.vm;
2+public final
3+class void_p
4+{
5+}
java/pkg2/java/applet/Applet.java+593−0
@@ -0,0 +1,593 @@
1+/*
2+ * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
3+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4+ *
5+ *
6+ *
7+ *
8+ *
9+ *
10+ *
11+ *
12+ *
13+ *
14+ *
15+ *
16+ *
17+ *
18+ *
19+ *
20+ *
21+ *
22+ *
23+ *
24+ */
25+package java.applet;
26+
27+import java.awt.*;
28+import java.awt.image.ColorModel;
29+import java.io.IOException;
30+import java.io.ObjectInputStream;
31+import java.net.URL;
32+import java.net.MalformedURLException;
33+import java.util.Hashtable;
34+import java.util.Locale;
35+import javax.accessibility.*;
36+
37+/**
38+ * An applet is a small program that is intended not to be run on
39+ * its own, but rather to be embedded inside another application.
40+ * <p>
41+ * The <code>Applet</code> class must be the superclass of any
42+ * applet that is to be embedded in a Web page or viewed by the Java
43+ * Applet Viewer. The <code>Applet</code> class provides a standard
44+ * interface between applets and their environment.
45+ *
46+ * @author Arthur van Hoff
47+ * @author Chris Warth
48+ * @since JDK1.0
49+ */
50+public class Applet extends Panel {
51+
52+ /**
53+ * Constructs a new Applet.
54+ * <p>
55+ * Note: Many methods in <code>java.applet.Applet</code>
56+ * may be invoked by the applet only after the applet is
57+ * fully constructed; applet should avoid calling methods
58+ * in <code>java.applet.Applet</code> in the constructor.
59+ *
60+ * @exception HeadlessException if GraphicsEnvironment.isHeadless()
61+ * returns true.
62+ * @see java.awt.GraphicsEnvironment#isHeadless
63+ * @since 1.4
64+ */
65+ public Applet() throws HeadlessException {
66+ if (GraphicsEnvironment.isHeadless()) {
67+ throw new HeadlessException();
68+ }
69+ }
70+
71+ /**
72+ * Applets can be serialized but the following conventions MUST be followed:
73+ *
74+ * Before Serialization:
75+ * An applet must be in STOPPED state.
76+ *
77+ * After Deserialization:
78+ * The applet will be restored in STOPPED state (and most clients will
79+ * likely move it into RUNNING state).
80+ * The stub field will be restored by the reader.
81+ */
82+ transient private AppletStub stub;
83+
84+ /* version ID for serialized form. */
85+ private static final long serialVersionUID = -5836846270535785031L;
86+
87+ /**
88+ * Read an applet from an object input stream.
89+ * @exception HeadlessException if
90+ * <code>GraphicsEnvironment.isHeadless()</code> returns
91+ * <code>true</code>
92+ * @serial
93+ * @see java.awt.GraphicsEnvironment#isHeadless
94+ * @since 1.4
95+ */
96+ private void readObject(ObjectInputStream s)
97+ throws ClassNotFoundException, IOException, HeadlessException {
98+ if (GraphicsEnvironment.isHeadless()) {
99+ throw new HeadlessException();
100+ }
101+ s.defaultReadObject();
102+ }
103+
104+ /**
105+ * Sets this applet's stub. This is done automatically by the system.
106+ * <p>If there is a security manager, its <code> checkPermission </code>
107+ * method is called with the
108+ * <code>AWTPermission("setAppletStub")</code>
109+ * permission if a stub has already been set.
110+ * @param stub the new stub.
111+ * @exception SecurityException if the caller cannot set the stub
112+ */
113+ public final void setStub(AppletStub stub) {
114+ if (this.stub != null) {
115+ SecurityManager s = System.getSecurityManager();
116+ if (s != null) {
117+ s.checkPermission(new AWTPermission("setAppletStub"));
118+ }
119+ }
120+ this.stub = (AppletStub)stub;
121+ }
122+
123+ /**
124+ * Determines if this applet is active. An applet is marked active
125+ * just before its <code>start</code> method is called. It becomes
126+ * inactive just before its <code>stop</code> method is called.
127+ *
128+ * @return <code>true</code> if the applet is active;
129+ * <code>false</code> otherwise.
130+ * @see java.applet.Applet#start()
131+ * @see java.applet.Applet#stop()
132+ */
133+ public boolean isActive() {
134+ if (stub != null) {
135+ return stub.isActive();
136+ } else { // If stub field not filled in, applet never active
137+ return false;
138+ }
139+ }
140+
141+ /**
142+ * Gets the URL of the document in which this applet is embedded.
143+ * For example, suppose an applet is contained
144+ * within the document:
145+ * <blockquote><pre>
146+ * http://java.sun.com/products/jdk/1.2/index.html
147+ * </pre></blockquote>
148+ * The document base is:
149+ * <blockquote><pre>
150+ * http://java.sun.com/products/jdk/1.2/index.html
151+ * </pre></blockquote>
152+ *
153+ * @return the {@link java.net.URL} of the document that contains this
154+ * applet.
155+ * @see java.applet.Applet#getCodeBase()
156+ */
157+ public URL getDocumentBase() {
158+ return stub.getDocumentBase();
159+ }
160+
161+ /**
162+ * Gets the base URL. This is the URL of the directory which contains this applet.
163+ *
164+ * @return the base {@link java.net.URL} of
165+ * the directory which contains this applet.
166+ * @see java.applet.Applet#getDocumentBase()
167+ */
168+ public URL getCodeBase() {
169+ return stub.getCodeBase();
170+ }
171+
172+ /**
173+ * Returns the value of the named parameter in the HTML tag. For
174+ * example, if this applet is specified as
175+ * <blockquote><pre>
176+ * &lt;applet code="Clock" width=50 height=50&gt;
177+ * &lt;param name=Color value="blue"&gt;
178+ * &lt;/applet&gt;
179+ * </pre></blockquote>
180+ * <p>
181+ * then a call to <code>getParameter("Color")</code> returns the
182+ * value <code>"blue"</code>.
183+ * <p>
184+ * The <code>name</code> argument is case insensitive.
185+ *
186+ * @param name a parameter name.
187+ * @return the value of the named parameter,
188+ * or <code>null</code> if not set.
189+ */
190+ public String getParameter(String name) {
191+ return stub.getParameter(name);
192+ }
193+
194+ /**
195+ * Determines this applet's context, which allows the applet to
196+ * query and affect the environment in which it runs.
197+ * <p>
198+ * This environment of an applet represents the document that
199+ * contains the applet.
200+ *
201+ * @return the applet's context.
202+ */
203+ public AppletContext getAppletContext() {
204+ return stub.getAppletContext();
205+ }
206+
207+ /**
208+ * Requests that this applet be resized.
209+ *
210+ * @param width the new requested width for the applet.
211+ * @param height the new requested height for the applet.
212+ */
213+ public void resize(int width, int height) {
214+ Dimension d = size();
215+ if ((d.width != width) || (d.height != height)) {
216+ super.resize(width, height);
217+ if (stub != null) {
218+ stub.appletResize(width, height);
219+ }
220+ }
221+ }
222+
223+ /**
224+ * Requests that this applet be resized.
225+ *
226+ * @param d an object giving the new width and height.
227+ */
228+ public void resize(Dimension d) {
229+ resize(d.width, d.height);
230+ }
231+
232+ /**
233+ * Indicates if this container is a validate root.
234+ * <p>
235+ * {@code Applet} objects are the validate roots, and, therefore, they
236+ * override this method to return {@code true}.
237+ *
238+ * @return {@code true}
239+ * @since 1.7
240+ * @see java.awt.Container#isValidateRoot
241+ */
242+ @Override
243+ public boolean isValidateRoot() {
244+ return true;
245+ }
246+
247+ /**
248+ * Requests that the argument string be displayed in the
249+ * "status window". Many browsers and applet viewers
250+ * provide such a window, where the application can inform users of
251+ * its current state.
252+ *
253+ * @param msg a string to display in the status window.
254+ */
255+ public void showStatus(String msg) {
256+ getAppletContext().showStatus(msg);
257+ }
258+
259+ /**
260+ * Returns an <code>Image</code> object that can then be painted on
261+ * the screen. The <code>url</code> that is passed as an argument
262+ * must specify an absolute URL.
263+ * <p>
264+ * This method always returns immediately, whether or not the image
265+ * exists. When this applet attempts to draw the image on the screen,
266+ * the data will be loaded. The graphics primitives that draw the
267+ * image will incrementally paint on the screen.
268+ *
269+ * @param url an absolute URL giving the location of the image.
270+ * @return the image at the specified URL.
271+ * @see java.awt.Image
272+ */
273+ public Image getImage(URL url) {
274+ return getAppletContext().getImage(url);
275+ }
276+
277+ /**
278+ * Returns an <code>Image</code> object that can then be painted on
279+ * the screen. The <code>url</code> argument must specify an absolute
280+ * URL. The <code>name</code> argument is a specifier that is
281+ * relative to the <code>url</code> argument.
282+ * <p>
283+ * This method always returns immediately, whether or not the image
284+ * exists. When this applet attempts to draw the image on the screen,
285+ * the data will be loaded. The graphics primitives that draw the
286+ * image will incrementally paint on the screen.
287+ *
288+ * @param url an absolute URL giving the base location of the image.
289+ * @param name the location of the image, relative to the
290+ * <code>url</code> argument.
291+ * @return the image at the specified URL.
292+ * @see java.awt.Image
293+ */
294+ public Image getImage(URL url, String name) {
295+ try {
296+ return getImage(new URL(url, name));
297+ } catch (MalformedURLException e) {
298+ return null;
299+ }
300+ }
301+
302+ /**
303+ * Get an audio clip from the given URL.
304+ *
305+ * @param url points to the audio clip
306+ * @return the audio clip at the specified URL.
307+ *
308+ * @since 1.2
309+ */
310+ public final static AudioClip newAudioClip(URL url) {
311+ return new sun.applet.AppletAudioClip(url);
312+ }
313+
314+ /**
315+ * Returns the <code>AudioClip</code> object specified by the
316+ * <code>URL</code> argument.
317+ * <p>
318+ * This method always returns immediately, whether or not the audio
319+ * clip exists. When this applet attempts to play the audio clip, the
320+ * data will be loaded.
321+ *
322+ * @param url an absolute URL giving the location of the audio clip.
323+ * @return the audio clip at the specified URL.
324+ * @see java.applet.AudioClip
325+ */
326+ public AudioClip getAudioClip(URL url) {
327+ return getAppletContext().getAudioClip(url);
328+ }
329+
330+ /**
331+ * Returns the <code>AudioClip</code> object specified by the
332+ * <code>URL</code> and <code>name</code> arguments.
333+ * <p>
334+ * This method always returns immediately, whether or not the audio
335+ * clip exists. When this applet attempts to play the audio clip, the
336+ * data will be loaded.
337+ *
338+ * @param url an absolute URL giving the base location of the
339+ * audio clip.
340+ * @param name the location of the audio clip, relative to the
341+ * <code>url</code> argument.
342+ * @return the audio clip at the specified URL.
343+ * @see java.applet.AudioClip
344+ */
345+ public AudioClip getAudioClip(URL url, String name) {
346+ try {
347+ return getAudioClip(new URL(url, name));
348+ } catch (MalformedURLException e) {
349+ return null;
350+ }
351+ }
352+
353+ /**
354+ * Returns information about this applet. An applet should override
355+ * this method to return a <code>String</code> containing information
356+ * about the author, version, and copyright of the applet.
357+ * <p>
358+ * The implementation of this method provided by the
359+ * <code>Applet</code> class returns <code>null</code>.
360+ *
361+ * @return a string containing information about the author, version, and
362+ * copyright of the applet.
363+ */
364+ public String getAppletInfo() {
365+ return null;
366+ }
367+
368+ /**
369+ * Gets the locale of the applet. It allows the applet
370+ * to maintain its own locale separated from the locale
371+ * of the browser or appletviewer.
372+ *
373+ * @return the locale of the applet; if no locale has
374+ * been set, the default locale is returned.
375+ * @since JDK1.1
376+ */
377+ public Locale getLocale() {
378+ Locale locale = super.getLocale();
379+ if (locale == null) {
380+ return Locale.getDefault();
381+ }
382+ return locale;
383+ }
384+
385+ /**
386+ * Returns information about the parameters that are understood by
387+ * this applet. An applet should override this method to return an
388+ * array of <code>Strings</code> describing these parameters.
389+ * <p>
390+ * Each element of the array should be a set of three
391+ * <code>Strings</code> containing the name, the type, and a
392+ * description. For example:
393+ * <p><blockquote><pre>
394+ * String pinfo[][] = {
395+ * {"fps", "1-10", "frames per second"},
396+ * {"repeat", "boolean", "repeat image loop"},
397+ * {"imgs", "url", "images directory"}
398+ * };
399+ * </pre></blockquote>
400+ * <p>
401+ * The implementation of this method provided by the
402+ * <code>Applet</code> class returns <code>null</code>.
403+ *
404+ * @return an array describing the parameters this applet looks for.
405+ */
406+ public String[][] getParameterInfo() {
407+ return null;
408+ }
409+
410+ /**
411+ * Plays the audio clip at the specified absolute URL. Nothing
412+ * happens if the audio clip cannot be found.
413+ *
414+ * @param url an absolute URL giving the location of the audio clip.
415+ */
416+ public void play(URL url) {
417+ AudioClip clip = getAudioClip(url);
418+ if (clip != null) {
419+ clip.play();
420+ }
421+ }
422+
423+ /**
424+ * Plays the audio clip given the URL and a specifier that is
425+ * relative to it. Nothing happens if the audio clip cannot be found.
426+ *
427+ * @param url an absolute URL giving the base location of the
428+ * audio clip.
429+ * @param name the location of the audio clip, relative to the
430+ * <code>url</code> argument.
431+ */
432+ public void play(URL url, String name) {
433+ AudioClip clip = getAudioClip(url, name);
434+ if (clip != null) {
435+ clip.play();
436+ }
437+ }
438+
439+ /**
440+ * Called by the browser or applet viewer to inform
441+ * this applet that it has been loaded into the system. It is always
442+ * called before the first time that the <code>start</code> method is
443+ * called.
444+ * <p>
445+ * A subclass of <code>Applet</code> should override this method if
446+ * it has initialization to perform. For example, an applet with
447+ * threads would use the <code>init</code> method to create the
448+ * threads and the <code>destroy</code> method to kill them.
449+ * <p>
450+ * The implementation of this method provided by the
451+ * <code>Applet</code> class does nothing.
452+ *
453+ * @see java.applet.Applet#destroy()
454+ * @see java.applet.Applet#start()
455+ * @see java.applet.Applet#stop()
456+ */
457+ public void init() {
458+ }
459+
460+ /**
461+ * Called by the browser or applet viewer to inform
462+ * this applet that it should start its execution. It is called after
463+ * the <code>init</code> method and each time the applet is revisited
464+ * in a Web page.
465+ * <p>
466+ * A subclass of <code>Applet</code> should override this method if
467+ * it has any operation that it wants to perform each time the Web
468+ * page containing it is visited. For example, an applet with
469+ * animation might want to use the <code>start</code> method to
470+ * resume animation, and the <code>stop</code> method to suspend the
471+ * animation.
472+ * <p>
473+ * Note: some methods, such as <code>getLocationOnScreen</code>, can only
474+ * provide meaningful results if the applet is showing. Because
475+ * <code>isShowing</code> returns <code>false</code> when the applet's
476+ * <code>start</code> is first called, methods requiring
477+ * <code>isShowing</code> to return <code>true</code> should be called from
478+ * a <code>ComponentListener</code>.
479+ * <p>
480+ * The implementation of this method provided by the
481+ * <code>Applet</code> class does nothing.
482+ *
483+ * @see java.applet.Applet#destroy()
484+ * @see java.applet.Applet#init()
485+ * @see java.applet.Applet#stop()
486+ * @see java.awt.Component#isShowing()
487+ * @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
488+ */
489+ public void start() {
490+ }
491+
492+ /**
493+ * Called by the browser or applet viewer to inform
494+ * this applet that it should stop its execution. It is called when
495+ * the Web page that contains this applet has been replaced by
496+ * another page, and also just before the applet is to be destroyed.
497+ * <p>
498+ * A subclass of <code>Applet</code> should override this method if
499+ * it has any operation that it wants to perform each time the Web
500+ * page containing it is no longer visible. For example, an applet
501+ * with animation might want to use the <code>start</code> method to
502+ * resume animation, and the <code>stop</code> method to suspend the
503+ * animation.
504+ * <p>
505+ * The implementation of this method provided by the
506+ * <code>Applet</code> class does nothing.
507+ *
508+ * @see java.applet.Applet#destroy()
509+ * @see java.applet.Applet#init()
510+ */
511+ public void stop() {
512+ }
513+
514+ /**
515+ * Called by the browser or applet viewer to inform
516+ * this applet that it is being reclaimed and that it should destroy
517+ * any resources that it has allocated. The <code>stop</code> method
518+ * will always be called before <code>destroy</code>.
519+ * <p>
520+ * A subclass of <code>Applet</code> should override this method if
521+ * it has any operation that it wants to perform before it is
522+ * destroyed. For example, an applet with threads would use the
523+ * <code>init</code> method to create the threads and the
524+ * <code>destroy</code> method to kill them.
525+ * <p>
526+ * The implementation of this method provided by the
527+ * <code>Applet</code> class does nothing.
528+ *
529+ * @see java.applet.Applet#init()
530+ * @see java.applet.Applet#start()
531+ * @see java.applet.Applet#stop()
532+ */
533+ public void destroy() {
534+ }
535+
536+ //
537+ // Accessibility support
538+ //
539+
540+ AccessibleContext accessibleContext = null;
541+
542+ /**
543+ * Gets the AccessibleContext associated with this Applet.
544+ * For applets, the AccessibleContext takes the form of an
545+ * AccessibleApplet.
546+ * A new AccessibleApplet instance is created if necessary.
547+ *
548+ * @return an AccessibleApplet that serves as the
549+ * AccessibleContext of this Applet
550+ * @since 1.3
551+ */
552+ public AccessibleContext getAccessibleContext() {
553+ if (accessibleContext == null) {
554+ accessibleContext = new AccessibleApplet();
555+ }
556+ return accessibleContext;
557+ }
558+
559+ /**
560+ * This class implements accessibility support for the
561+ * <code>Applet</code> class. It provides an implementation of the
562+ * Java Accessibility API appropriate to applet user-interface elements.
563+ * @since 1.3
564+ */
565+ protected class AccessibleApplet extends AccessibleAWTPanel {
566+
567+ private static final long serialVersionUID = 8127374778187708896L;
568+
569+ /**
570+ * Get the role of this object.
571+ *
572+ * @return an instance of AccessibleRole describing the role of the
573+ * object
574+ */
575+ public AccessibleRole getAccessibleRole() {
576+ return AccessibleRole.FRAME;
577+ }
578+
579+ /**
580+ * Get the state of this object.
581+ *
582+ * @return an instance of AccessibleStateSet containing the current
583+ * state set of the object
584+ * @see AccessibleState
585+ */
586+ public AccessibleStateSet getAccessibleStateSet() {
587+ AccessibleStateSet states = super.getAccessibleStateSet();
588+ states.add(AccessibleState.ACTIVE);
589+ return states;
590+ }
591+
592+ }
593+}
java/pkg2/java/applet/AppletContext.java+194−0
@@ -0,0 +1,194 @@
1+/*
2+ * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
3+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4+ *
5+ *
6+ *
7+ *
8+ *
9+ *
10+ *
11+ *
12+ *
13+ *
14+ *
15+ *
16+ *
17+ *
18+ *
19+ *
20+ *
21+ *
22+ *
23+ *
24+ */
25+
26+package java.applet;
27+
28+import java.awt.Image;
29+import java.awt.Graphics;
30+import java.awt.image.ColorModel;
31+import java.net.URL;
32+import java.util.Enumeration;
33+import java.io.InputStream;
34+import java.io.IOException;
35+import java.util.Iterator;
36+
37+/**
38+ * This interface corresponds to an applet's environment: the
39+ * document containing the applet and the other applets in the same
40+ * document.
41+ * <p>
42+ * The methods in this interface can be used by an applet to obtain
43+ * information about its environment.
44+ *
45+ * @author Arthur van Hoff
46+ * @since JDK1.0
47+ */
48+public interface AppletContext {
49+ /**
50+ * Creates an audio clip.
51+ *
52+ * @param url an absolute URL giving the location of the audio clip.
53+ * @return the audio clip at the specified URL.
54+ */
55+ AudioClip getAudioClip(URL url);
56+
57+ /**
58+ * Returns an <code>Image</code> object that can then be painted on
59+ * the screen. The <code>url</code> argument<code> </code>that is
60+ * passed as an argument must specify an absolute URL.
61+ * <p>
62+ * This method always returns immediately, whether or not the image
63+ * exists. When the applet attempts to draw the image on the screen,
64+ * the data will be loaded. The graphics primitives that draw the
65+ * image will incrementally paint on the screen.
66+ *
67+ * @param url an absolute URL giving the location of the image.
68+ * @return the image at the specified URL.
69+ * @see java.awt.Image
70+ */
71+ Image getImage(URL url);
72+
73+ /**
74+ * Finds and returns the applet in the document represented by this
75+ * applet context with the given name. The name can be set in the
76+ * HTML tag by setting the <code>name</code> attribute.
77+ *
78+ * @param name an applet name.
79+ * @return the applet with the given name, or <code>null</code> if
80+ * not found.
81+ */
82+ Applet getApplet(String name);
83+
84+ /**
85+ * Finds all the applets in the document represented by this applet
86+ * context.
87+ *
88+ * @return an enumeration of all applets in the document represented by
89+ * this applet context.
90+ */
91+ Enumeration<Applet> getApplets();
92+
93+ /**
94+ * Requests that the browser or applet viewer show the Web page
95+ * indicated by the <code>url</code> argument. The browser or
96+ * applet viewer determines which window or frame to display the
97+ * Web page. This method may be ignored by applet contexts that
98+ * are not browsers.
99+ *
100+ * @param url an absolute URL giving the location of the document.
101+ */
102+ void showDocument(URL url);
103+
104+ /**
105+ * Requests that the browser or applet viewer show the Web page
106+ * indicated by the <code>url</code> argument. The
107+ * <code>target</code> argument indicates in which HTML frame the
108+ * document is to be displayed.
109+ * The target argument is interpreted as follows:
110+ * <p>
111+ * <center><table border="3" summary="Target arguments and their descriptions">
112+ * <tr><th>Target Argument</th><th>Description</th></tr>
113+ * <tr><td><code>"_self"</code> <td>Show in the window and frame that
114+ * contain the applet.</tr>
115+ * <tr><td><code>"_parent"</code><td>Show in the applet's parent frame. If
116+ * the applet's frame has no parent frame,
117+ * acts the same as "_self".</tr>
118+ * <tr><td><code>"_top"</code> <td>Show in the top-level frame of the applet's
119+ * window. If the applet's frame is the
120+ * top-level frame, acts the same as "_self".</tr>
121+ * <tr><td><code>"_blank"</code> <td>Show in a new, unnamed
122+ * top-level window.</tr>
123+ * <tr><td><i>name</i><td>Show in the frame or window named <i>name</i>. If
124+ * a target named <i>name</i> does not already exist, a
125+ * new top-level window with the specified name is created,
126+ * and the document is shown there.</tr>
127+ * </table> </center>
128+ * <p>
129+ * An applet viewer or browser is free to ignore <code>showDocument</code>.
130+ *
131+ * @param url an absolute URL giving the location of the document.
132+ * @param target a <code>String</code> indicating where to display
133+ * the page.
134+ */
135+ public void showDocument(URL url, String target);
136+
137+ /**
138+ * Requests that the argument string be displayed in the
139+ * "status window". Many browsers and applet viewers
140+ * provide such a window, where the application can inform users of
141+ * its current state.
142+ *
143+ * @param status a string to display in the status window.
144+ */
145+ void showStatus(String status);
146+
147+ /**
148+ * Associates the specified stream with the specified key in this
149+ * applet context. If the applet context previously contained a mapping
150+ * for this key, the old value is replaced.
151+ * <p>
152+ * For security reasons, mapping of streams and keys exists for each
153+ * codebase. In other words, applet from one codebase cannot access
154+ * the streams created by an applet from a different codebase
155+ * <p>
156+ * @param key key with which the specified value is to be associated.
157+ * @param stream stream to be associated with the specified key. If this
158+ * parameter is <code>null</code>, the specified key is removed
159+ * in this applet context.
160+ * @throws <code>IOException</code> if the stream size exceeds a certain
161+ * size limit. Size limit is decided by the implementor of this
162+ * interface.
163+ * @since 1.4
164+ */
165+ public void setStream(String key, InputStream stream)throws IOException;
166+
167+ /**
168+ * Returns the stream to which specified key is associated within this
169+ * applet context. Returns <tt>null</tt> if the applet context contains
170+ * no stream for this key.
171+ * <p>
172+ * For security reasons, mapping of streams and keys exists for each
173+ * codebase. In other words, applet from one codebase cannot access
174+ * the streams created by an applet from a different codebase
175+ * <p>
176+ * @return the stream to which this applet context maps the key
177+ * @param key key whose associated stream is to be returned.
178+ * @since 1.4
179+ */
180+ public InputStream getStream(String key);
181+
182+ /**
183+ * Finds all the keys of the streams in this applet context.
184+ * <p>
185+ * For security reasons, mapping of streams and keys exists for each
186+ * codebase. In other words, applet from one codebase cannot access
187+ * the streams created by an applet from a different codebase
188+ * <p>
189+ * @return an Iterator of all the names of the streams in this applet
190+ * context.
191+ * @since 1.4
192+ */
193+ public Iterator<String> getStreamKeys();
194+}
java/pkg2/java/applet/AppletStub.java+111−0
@@ -0,0 +1,111 @@
1+/*
2+ * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
3+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4+ *
5+ *
6+ *
7+ *
8+ *
9+ *
10+ *
11+ *
12+ *
13+ *
14+ *
15+ *
16+ *
17+ *
18+ *
19+ *
20+ *
21+ *
22+ *
23+ *
24+ */
25+package java.applet;
26+
27+import java.net.URL;
28+
29+/**
30+ * When an applet is first created, an applet stub is attached to it
31+ * using the applet's <code>setStub</code> method. This stub
32+ * serves as the interface between the applet and the browser
33+ * environment or applet viewer environment in which the application
34+ * is running.
35+ *
36+ * @author Arthur van Hoff
37+ * @see java.applet.Applet#setStub(java.applet.AppletStub)
38+ * @since JDK1.0
39+ */
40+public interface AppletStub {
41+ /**
42+ * Determines if the applet is active. An applet is active just
43+ * before its <code>start</code> method is called. It becomes
44+ * inactive just before its <code>stop</code> method is called.
45+ *
46+ * @return <code>true</code> if the applet is active;
47+ * <code>false</code> otherwise.
48+ */
49+ boolean isActive();
50+
51+
52+ /**
53+ * Gets the URL of the document in which the applet is embedded.
54+ * For example, suppose an applet is contained
55+ * within the document:
56+ * <blockquote><pre>
57+ * http://java.sun.com/products/jdk/1.2/index.html
58+ * </pre></blockquote>
59+ * The document base is:
60+ * <blockquote><pre>
61+ * http://java.sun.com/products/jdk/1.2/index.html
62+ * </pre></blockquote>
63+ *
64+ * @return the {@link java.net.URL} of the document that contains the
65+ * applet.
66+ * @see java.applet.AppletStub#getCodeBase()
67+ */
68+ URL getDocumentBase();
69+
70+ /**
71+ * Gets the base URL. This is the URL of the directory which contains the applet.
72+ *
73+ * @return the base {@link java.net.URL} of
74+ * the directory which contains the applet.
75+ * @see java.applet.AppletStub#getDocumentBase()
76+ */
77+ URL getCodeBase();
78+
79+ /**
80+ * Returns the value of the named parameter in the HTML tag. For
81+ * example, if an applet is specified as
82+ * <blockquote><pre>
83+ * &lt;applet code="Clock" width=50 height=50&gt;
84+ * &lt;param name=Color value="blue"&gt;
85+ * &lt;/applet&gt;
86+ * </pre></blockquote>
87+ * <p>
88+ * then a call to <code>getParameter("Color")</code> returns the
89+ * value <code>"blue"</code>.
90+ *
91+ * @param name a parameter name.
92+ * @return the value of the named parameter,
93+ * or <tt>null</tt> if not set.
94+ */
95+ String getParameter(String name);
96+
97+ /**
98+ * Returns the applet's context.
99+ *
100+ * @return the applet's context.
101+ */
102+ AppletContext getAppletContext();
103+
104+ /**
105+ * Called when the applet wants to be resized.
106+ *
107+ * @param width the new requested width for the applet.
108+ * @param height the new requested height for the applet.
109+ */
110+ void appletResize(int width, int height);
111+}
java/pkg2/java/applet/AudioClip.java+53−0
@@ -0,0 +1,53 @@
1+/*
2+ * Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
3+ * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4+ *
5+ *
6+ *
7+ *
8+ *
9+ *
10+ *
11+ *
12+ *
13+ *
14+ *
15+ *
16+ *
17+ *
18+ *
19+ *
20+ *
21+ *
22+ *
23+ *
24+ */
25+
26+package java.applet;
27+
28+/**
29+ * The <code>AudioClip</code> interface is a simple abstraction for
30+ * playing a sound clip. Multiple <code>AudioClip</code> items can be
31+ * playing at the same time, and the resulting sound is mixed
32+ * together to produce a composite.
33+ *
34+ * @author Arthur van Hoff
35+ * @since JDK1.0
36+ */
37+public interface AudioClip {
38+ /**
39+ * Starts playing this audio clip. Each time this method is called,
40+ * the clip is restarted from the beginning.
41+ */
42+ void play();
43+
44+ /**
45+ * Starts playing this audio clip in a loop.
46+ */
47+ void loop();
48+
49+ /**
50+ * Stops playing this audio clip.
51+ */
52+ void stop();
53+}
java/pkg2/java/applet/mkfile+11−0
@@ -0,0 +1,11 @@
1+<../../../../mkconfig
2+
3+TARG=\
4+ Applet.dis\
5+ AppletContext.dis\
6+ AppletStub.dis\
7+ AudioClip.dis\
8+
9+DISBIN=$ROOT/java/dis/java/java/applet
10+
11+<$ROOT/mkfiles/mkjava
java/pkg2/java/awt/AWTError.java+0−0

Empty file added.

java/pkg2/java/awt/AWTEvent.java+0−0

Empty file added.

java/pkg2/java/awt/AWTEventMulticaster.java+0−0

Empty file added.

java/pkg2/java/awt/AWTException.java+0−0

Empty file added.

java/pkg2/java/awt/ActionInputPreferred.java+5−0
@@ -0,0 +1,5 @@
1+
2+package java.awt;
3+
4+public interface ActionInputPreferred {
5+}
java/pkg2/java/awt/Adjustable.java+0−0

Empty file added.

java/pkg2/java/awt/BorderLayout.java+0−0

Empty file added.

java/pkg2/java/awt/Button.java+0−0

Empty file added.

java/pkg2/java/awt/Canvas.java+0−0

Empty file added.

java/pkg2/java/awt/CardLayout.java+0−0

Empty file added.

java/pkg2/java/awt/Checkbox.java+0−0

Empty file added.

java/pkg2/java/awt/CheckboxGroup.java+0−0

Empty file added.

java/pkg2/java/awt/CheckboxMenuItem.java+0−0

Empty file added.

java/pkg2/java/awt/Choice.java+0−0

Empty file added.

java/pkg2/java/awt/Color.java+0−0

Empty file added.

java/pkg2/java/awt/Component.java+0−0

Empty file added.

java/pkg2/java/awt/Container.java+0−0

Empty file added.

java/pkg2/java/awt/Cursor.java+0−0

Empty file added.

java/pkg2/java/awt/Dialog.java+0−0

Empty file added.

java/pkg2/java/awt/Dimension.java+0−0

Empty file added.

java/pkg2/java/awt/Event.java+0−0

Empty file added.

java/pkg2/java/awt/EventDispatchThread.java+0−0

Empty file added.

java/pkg2/java/awt/EventQueue.java+0−0

Empty file added.

java/pkg2/java/awt/FileDialog.java+0−0

Empty file added.

java/pkg2/java/awt/FlowLayout.java+0−0

Empty file added.

java/pkg2/java/awt/Font.java+0−0

Empty file added.

java/pkg2/java/awt/FontMetrics.java+0−0

Empty file added.

java/pkg2/java/awt/Frame.java+0−0

Empty file added.

java/pkg2/java/awt/Graphics.java+0−0

Empty file added.

java/pkg2/java/awt/GridBagConstraints.java+0−0

Empty file added.

java/pkg2/java/awt/GridBagLayout.java+0−0

Empty file added.

java/pkg2/java/awt/GridLayout.java+0−0

Empty file added.

java/pkg2/java/awt/IllegalComponentStateEx.java+0−0

Empty file added.

java/pkg2/java/awt/Image.java+0−0

Empty file added.

java/pkg2/java/awt/Insets.java+0−0

Empty file added.

java/pkg2/java/awt/ItemSelectable.java+0−0

Empty file added.

java/pkg2/java/awt/KeyboardInputPreferred.java+5−0
@@ -0,0 +1,5 @@
1+
2+package java.awt;
3+
4+public interface KeyboardInputPreferred {
5+}
java/pkg2/java/awt/Label.java+0−0

Empty file added.

java/pkg2/java/awt/LayoutManager.java+0−0

Empty file added.

java/pkg2/java/awt/LayoutManager2.java+0−0

Empty file added.

java/pkg2/java/awt/List.java+0−0

Empty file added.

java/pkg2/java/awt/MediaTracker.java+0−0

Empty file added.

java/pkg2/java/awt/Menu.java+0−0

Empty file added.

java/pkg2/java/awt/MenuBar.java+0−0

Empty file added.

java/pkg2/java/awt/MenuComponent.java+0−0

Empty file added.

java/pkg2/java/awt/MenuContainer.java+0−0

Empty file added.

java/pkg2/java/awt/MenuItem.java+0−0

Empty file added.

java/pkg2/java/awt/MenuShortcut.java+0−0

Empty file added.

java/pkg2/java/awt/Misc.java+95−0
@@ -0,0 +1,95 @@
1+package java.awt;
2+
3+import java.awt.*;
4+
5+public class Misc {
6+
7+ public static void drawDisabledString(String label,int x,int y,Graphics g)
8+ {
9+ Color c=g.getColor();
10+ g.setColor(SystemColor.controlLtHighlight);
11+ g.drawString(label,x+1,y+1);
12+ g.setColor(SystemColor.controlShadow);
13+ g.drawString(label,x,y);
14+ g.setColor(c);
15+ }
16+
17+ public static void fill3DRect(int x,int y,int width,int height,boolean raised,Graphics g)
18+ {
19+ fill3DRect(new Rectangle(x,y,width,height),raised,g);
20+ }
21+
22+ public static void fill3DRect(Rectangle area,boolean raised,Graphics g)
23+ {
24+ int left=area.x;
25+ int top=area.y;
26+ int bottom=top+area.height-1;
27+ int right=left+area.width-1;
28+
29+ Color c=g.getColor();
30+
31+ g.setColor(raised?SystemColor.controlLtHighlight:SystemColor.controlShadow);
32+
33+ g.drawLine(left,top,right-1,top);
34+ g.drawLine(left,top+1,left,bottom);
35+
36+ g.setColor(raised?SystemColor.controlShadow:SystemColor.controlLtHighlight);
37+
38+ g.drawLine(right,bottom,right,top);
39+ g.drawLine(right-1,bottom,left+1,bottom);
40+
41+ g.setColor(c);
42+
43+ g.fillRect(left+1,top+1,area.width-2,area.height-2);
44+
45+ }
46+
47+
48+ public static void Draw3DArea(int x,int y,int width,int height,Graphics g)
49+ {
50+ Draw3DArea(new Rectangle(x,y,width,height),g);
51+ }
52+
53+ public static void Draw3DArea(Rectangle area,Graphics g)
54+ {
55+ int left=area.x;
56+ int top=area.y;
57+ int bottom=top+area.height-1;
58+ int right=left+area.width-1;
59+
60+ g.setColor(SystemColor.controlHighlight);
61+ g.drawLine(left,top,left,bottom-1);
62+ g.drawLine(left,top,right-1,top);
63+
64+ g.setColor(SystemColor.controlLtHighlight);
65+ g.drawLine(left+1, top+1, right-2, top+1);
66+ g.drawLine(left+1, top+2, left+1, bottom-2);
67+
68+ g.setColor(SystemColor.controlShadow);
69+ g.drawLine(right-1, top+1, right-1, bottom-1);
70+ g.drawLine(left+1, bottom-1, right-1, bottom-1);
71+
72+ g.setColor(SystemColor.controlDkShadow);
73+ g.drawLine(right, top, right, bottom);
74+ g.drawLine(left, bottom, right, bottom);
75+
76+
77+ }
78+
79+
80+ public static void drawTick(Graphics g,int x,int y,int boxsize)
81+
82+ {
83+ int tickWidth=(boxsize-4)/3;
84+ for (int off=0;off<tickWidth;off++)
85+ {
86+ g.drawLine(x+3,y+boxsize-3-tickWidth-off,x+tickWidth+2,y+boxsize-4-off);
87+ g.drawLine(x+tickWidth+3,y+boxsize-5-off,x+boxsize-4,y+tickWidth+2-off);
88+ }
89+ }
90+
91+
92+
93+
94+}
95+
java/pkg2/java/awt/NoInputPreferred.java+5−0
@@ -0,0 +1,5 @@
1+
2+package java.awt;
3+
4+public interface NoInputPreferred {
5+}
java/pkg2/java/awt/Panel.java+0−0

Empty file added.

java/pkg2/java/awt/Point.java+0−0

Empty file added.

java/pkg2/java/awt/Polygon.java+0−0

Empty file added.

java/pkg2/java/awt/PopupMenu.java+0−0

Empty file added.

java/pkg2/java/awt/PositionalInputPreferre.java+5−0
@@ -0,0 +1,5 @@
1+
2+package java.awt;
3+
4+public interface PositionalInputPreferred {
5+}
java/pkg2/java/awt/PrintGraphics.java+0−0

Empty file added.

java/pkg2/java/awt/PrintJob.java+0−0

Empty file added.

java/pkg2/java/awt/Rectangle.java+0−0

Empty file added.

java/pkg2/java/awt/ScrollPane.java+0−0

Empty file added.

java/pkg2/java/awt/Scrollbar.java+0−0

Empty file added.

java/pkg2/java/awt/Shape.java+0−0

Empty file added.

java/pkg2/java/awt/SystemColor.java+0−0

Empty file added.

java/pkg2/java/awt/TextArea.java+0−0

Empty file added.

java/pkg2/java/awt/TextComponent.java+0−0

Empty file added.

java/pkg2/java/awt/TextField.java+0−0

Empty file added.

java/pkg2/java/awt/Toolkit.java+0−0

Empty file added.

java/pkg2/java/awt/Window.java+0−0

Empty file added.

java/pkg2/java/awt/datatransfer/Clipboard.java+0−0

Empty file added.

java/pkg2/java/awt/datatransfer/ClipboardOwner.java+0−0

Empty file added.

java/pkg2/java/awt/datatransfer/DataFlavor.java+0−0

Empty file added.

java/pkg2/java/awt/datatransfer/StringSelection.java+0−0

Empty file added.

java/pkg2/java/awt/datatransfer/Transferable.java+0−0

Empty file added.

java/pkg2/java/awt/datatransfer/UnsupportedFlavorExcept..a+0−0

Empty file added.

java/pkg2/java/awt/datatransfer/mkfile+17−0
@@ -0,0 +1,17 @@
1+<../../../../../mkconfig
2+
3+TARG=\
4+ Clipboard.dis\
5+ ClipboardOwner.dis\
6+ DataFlavor.dis\
7+ StringSelection.dis\
8+ Transferable.dis\
9+# for UnsupportedFlavorException.dis\
10+ XJ67lvo7CEuYBAk8ihSb4.dis\
11+
12+DISBIN=$ROOT/java/dis/java/java/awt/datatransfer
13+
14+<$ROOT/mkfiles/mkjava
15+
16+XJ67lvo7CEuYBAk8ihSb4.dis: UnsupportedFlavorException.class
17+ j2d $prereq
java/pkg2/java/awt/event/ActionEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/ActionListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/AdjustmentEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/AdjustmentListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/ComponentAdapter.java+0−0

Empty file added.

java/pkg2/java/awt/event/ComponentEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/ComponentListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/ContainerAdapter.java+0−0

Empty file added.

java/pkg2/java/awt/event/ContainerEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/ContainerListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/FocusAdapter.java+0−0

Empty file added.

java/pkg2/java/awt/event/FocusEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/FocusListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/InputEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/ItemEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/ItemListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/KeyAdapter.java+0−0

Empty file added.

java/pkg2/java/awt/event/KeyEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/KeyListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/MouseAdapter.java+0−0

Empty file added.

java/pkg2/java/awt/event/MouseEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/MouseListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/MouseMotionAdapter.java+0−0

Empty file added.

java/pkg2/java/awt/event/MouseMotionListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/PaintEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/TextEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/TextListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/WindowAdapter.java+0−0

Empty file added.

java/pkg2/java/awt/event/WindowEvent.java+0−0

Empty file added.

java/pkg2/java/awt/event/WindowListener.java+0−0

Empty file added.

java/pkg2/java/awt/event/mkfile+37−0
@@ -0,0 +1,37 @@
1+<../../../../../mkconfig
2+
3+TARG=\
4+ ActionEvent.dis\
5+ ActionListener.dis\
6+ AdjustmentEvent.dis\
7+ AdjustmentListener.dis\
8+ ComponentAdapter.dis\
9+ ComponentEvent.dis\
10+ ComponentListener.dis\
11+ ContainerAdapter.dis\
12+ ContainerEvent.dis\
13+ ContainerListener.dis\
14+ FocusAdapter.dis\
15+ FocusEvent.dis\
16+ FocusListener.dis\
17+ InputEvent.dis\
18+ ItemEvent.dis\
19+ ItemListener.dis\
20+ KeyAdapter.dis\
21+ KeyEvent.dis\
22+ KeyListener.dis\
23+ MouseAdapter.dis\
24+ MouseEvent.dis\
25+ MouseListener.dis\
26+ MouseMotionAdapter.dis\
27+ MouseMotionListener.dis\
28+ PaintEvent.dis\
29+ TextEvent.dis\
30+ TextListener.dis\
31+ WindowAdapter.dis\
32+ WindowEvent.dis\
33+ WindowListener.dis\
34+
35+DISBIN=$ROOT/java/dis/java/java/awt/event
36+
37+<$ROOT/mkfiles/mkjava
java/pkg2/java/awt/image/AreaAveragingScaleFilte.java+0−0

Empty file added.

java/pkg2/java/awt/image/ColorModel.java+0−0

Empty file added.

java/pkg2/java/awt/image/ColorModel_L.b+49−0
@@ -0,0 +1,49 @@
1+implement ColorModel_L;
2+
3+# javal v1.4 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+include "java/lang/ClassLoader_L.m";
28+
29+#<<
30+
31+include "ColorModel_L.m";
32+
33+#>> extra post includes here
34+
35+#<<
36+
37+init( jni_p : JNI )
38+{
39+ # save java native inteface mod instance
40+ jni = jni_p;
41+ #>>extra initialization here
42+ #<<
43+}
44+
45+deletepData_V( this : ref ColorModel_obj)
46+{#>>
47+ this.pData = 0;
48+}#<<
49+
java/pkg2/java/awt/image/ColorModel_L.m+15−0
@@ -0,0 +1,15 @@
1+# javal v1.4 generated file: edit with care
2+
3+ColorModel_L : module
4+{
5+ ColorModel_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ pData : int;
9+ pixel_bits : int;
10+ };
11+
12+ init : fn( jni_p : JNI );
13+ deletepData_V : fn( this : ref ColorModel_obj);
14+
15+};
java/pkg2/java/awt/image/CropImageFilter.java+0−0

Empty file added.

java/pkg2/java/awt/image/DirectColorModel.java+0−0

Empty file added.

java/pkg2/java/awt/image/FilteredImageSource.java+0−0

Empty file added.

java/pkg2/java/awt/image/ImageConsumer.java+0−0

Empty file added.

java/pkg2/java/awt/image/ImageFilter.java+0−0

Empty file added.

java/pkg2/java/awt/image/ImageObserver.java+0−0

Empty file added.

java/pkg2/java/awt/image/ImageProducer.java+0−0

Empty file added.

java/pkg2/java/awt/image/IndexColorModel.java+0−0

Empty file added.

java/pkg2/java/awt/image/MemoryImageSource.java+0−0

Empty file added.

java/pkg2/java/awt/image/PixelGrabber.java+0−0

Empty file added.

java/pkg2/java/awt/image/RGBImageFilter.java+0−0

Empty file added.

java/pkg2/java/awt/image/ReplicateScaleFilter.java+0−0

Empty file added.

java/pkg2/java/awt/image/mkfile+46−0
@@ -0,0 +1,46 @@
1+<../../../../../mkconfig
2+
3+TARG=\
4+# for AreaAveragingScaleFilter.dis\
5+ CEw7djK-zeE4-ezmJIAZ+.dis\
6+ ColorModel.dis\
7+ CropImageFilter.dis\
8+ DirectColorModel.dis\
9+ FilteredImageSource.dis\
10+ ImageConsumer.dis\
11+ ImageFilter.dis\
12+ ImageObserver.dis\
13+ ImageProducer.dis\
14+ IndexColorModel.dis\
15+ MemoryImageSource.dis\
16+ PixelGrabber.dis\
17+ RGBImageFilter.dis\
18+ ReplicateScaleFilter.dis\
19+# Limbo code\
20+ ColorModel_L.dis\
21+
22+MODULES=\
23+ $ROOT/java/module/classloader.m\
24+ $ROOT/java/module/jni.m\
25+ $ROOT/java/module/cast.m\
26+ ColorModel_L.m\
27+
28+SYSMODULES=\
29+ draw.m\
30+ hash.m\
31+ keyring.m\
32+ loader.m\
33+ math.m\
34+ string.m\
35+ sys.m\
36+
37+DISBIN=$ROOT/java/dis/java/java/awt/image
38+
39+<$ROOT/mkfiles/mkjava
40+
41+LIMBOINCL=\
42+ $LIMBOINCL\
43+ -I$ROOT/java/pkg\
44+
45+CEw7djK-zeE4-ezmJIAZ+.dis: AreaAveragingScaleFilter.class
46+ j2d AreaAveragingScaleFilter.class
java/pkg2/java/awt/mkfile+138−0
@@ -0,0 +1,138 @@
1+<../../../../mkconfig
2+
3+DIRS=\
4+ event\
5+ datatransfer\
6+ image\
7+ peer\
8+
9+TARG=\
10+ AWTError.dis\
11+ AWTEvent.dis\
12+ AWTEventMulticaster.dis\
13+ AWTException.dis\
14+ ActionInputPreferred.dis\
15+ Adjustable.dis\
16+ BorderLayout.dis\
17+ Button.dis\
18+ Canvas.dis\
19+ CardLayout.dis\
20+ Checkbox.dis\
21+ CheckboxGroup.dis\
22+ CheckboxMenuItem.dis\
23+ Choice.dis\
24+ Choice\$MenuWindow.dis\
25+ Color.dis\
26+ Component.dis\
27+# for Component\$NativeInLightFixer.dis\
28+ uU+tI9EeZru56jt4ABTyZ.dis\
29+ Container.dis\
30+ Cursor.dis\
31+ Dialog.dis\
32+ Dimension.dis\
33+ Event.dis\
34+ EventDispatchThread.dis\
35+ EventQueue.dis\
36+ EventQueueItem.dis\
37+ FileDialog.dis\
38+ FlowLayout.dis\
39+ FocusManager.dis\
40+ Font.dis\
41+ FontMetrics.dis\
42+ Frame.dis\
43+ Graphics.dis\
44+ GridBagConstraints.dis\
45+ GridBagLayout.dis\
46+ GridBagLayoutInfo.dis\
47+ GridLayout.dis\
48+# for IllegalComponentStateException.dis\
49+ 0xdZMaDu4YDn6Gv1ojXOi.dis\
50+ Image.dis\
51+ ImageMediaEntry.dis\
52+ Insets.dis\
53+ ItemSelectable.dis\
54+# for KeyboardInputPreferred.dis\
55+ tZW2Nc+oIyd6dX0M-UilD.dis\
56+ Label.dis\
57+ LayoutManager.dis\
58+ LayoutManager2.dis\
59+ LightweightDispatcher.dis\
60+ LightweightPeer.dis\
61+ List.dis\
62+ MediaEntry.dis\
63+ MediaTracker.dis\
64+ Menu.dis\
65+ MenuBar.dis\
66+ MenuComponent.dis\
67+ MenuContainer.dis\
68+ MenuItem.dis\
69+ MenuShortcut.dis\
70+ Misc.dis\
71+ NoInputPreferred.dis\
72+ Panel.dis\
73+ Point.dis\
74+ Polygon.dis\
75+ PopupMenu.dis\
76+# for PositionalInputPreferred.dis\
77+ 8AdFAaM7LI8fj1v6d+cNK.dis\
78+ PrintGraphics.dis\
79+ PrintJob.dis\
80+ Rectangle.dis\
81+ ScrollPane.dis\
82+ ScrollPane\$PeerFixer.dis\
83+ ScrollPaneAdjustable.dis\
84+ Scrollbar.dis\
85+ Shape.dis\
86+ SystemColor.dis\
87+ TextArea.dis\
88+ TextComponent.dis\
89+ TextField.dis\
90+ Toolkit.dis\
91+ Window.dis\
92+
93+DISBIN=$ROOT/java/dis/java/java/awt
94+
95+<$ROOT/mkfiles/mkjava
96+<$ROOT/mkfiles/mksubdirs
97+
98+Choice\$MenuWindow.dis: Choice.class
99+ j2d Choice\$MenuWindow.class
100+
101+uU+tI9EeZru56jt4ABTyZ.dis: Component.class
102+ j2d Component\$NativeInLightFixer.class
103+
104+LightweightDispatcher.dis: Container.class
105+ j2d LightweightDispatcher.class
106+
107+EventQueueItem.dis: EventQueue.class
108+ j2d EventQueueItem.class
109+
110+GridBagLayoutInfo.dis: GridBagLayout.class
111+ j2d GridBagLayoutInfo.class
112+
113+0xdZMaDu4YDn6Gv1ojXOi.dis: IllegalComponentStateException.class
114+ j2d $prereq
115+
116+tZW2Nc+oIyd6dX0M-UilD.dis: KeyboardInputPreferred.class
117+ j2d $prereq
118+
119+ImageMediaEntry.dis: MediaTracker.class
120+ j2d ImageMediaEntry.class
121+
122+MediaEntry.dis: MediaTracker.class
123+ j2d MediaEntry.class
124+
125+8AdFAaM7LI8fj1v6d+cNK.dis: PositionalInputPreferred.class
126+ j2d $prereq
127+
128+ScrollPane\$PeerFixer.dis: ScrollPane.class
129+ j2d ScrollPane\$PeerFixer.class
130+
131+ScrollPaneAdjustable.dis: ScrollPane.class
132+ j2d ScrollPaneAdjustable.class
133+
134+LightweightPeer.dis: Toolkit.class
135+ j2d LightweightPeer.class
136+
137+FocusManager.dis: Window.class
138+ j2d FocusManager.class
java/pkg2/java/awt/peer/ActiveEvent.java+0−0

Empty file added.

java/pkg2/java/awt/peer/ButtonPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/CanvasPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/CheckboxMenuItemPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/CheckboxPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/ChoicePeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/ComponentPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/ContainerPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/DialogPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/DoubleBufferingPeer.java+6−0
@@ -0,0 +1,6 @@
1+
2+package java.awt.peer;
3+
4+public interface DoubleBufferingPeer {
5+ public boolean isDoubleBuffered();
6+}
java/pkg2/java/awt/peer/FileDialogPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/FontPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/FramePeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/LabelPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/LightweightPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/ListPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/MenuBarPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/MenuComponentPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/MenuItemPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/MenuPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/PanelPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/PopupMenuPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/ScrollPanePeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/ScrollbarPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/TextAreaPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/TextComponentPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/TextFieldPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/WindowPeer.java+0−0

Empty file added.

java/pkg2/java/awt/peer/mkfile+35−0
@@ -0,0 +1,35 @@
1+<../../../../../mkconfig
2+
3+TARG=\
4+ ActiveEvent.dis\
5+ ButtonPeer.dis\
6+ CanvasPeer.dis\
7+ CheckboxMenuItemPeer.dis\
8+ CheckboxPeer.dis\
9+ ChoicePeer.dis\
10+ ComponentPeer.dis\
11+ ContainerPeer.dis\
12+ DialogPeer.dis\
13+ DoubleBufferingPeer.dis\
14+ FileDialogPeer.dis\
15+ FontPeer.dis\
16+ FramePeer.dis\
17+ LabelPeer.dis\
18+ LightweightPeer.dis\
19+ ListPeer.dis\
20+ MenuBarPeer.dis\
21+ MenuComponentPeer.dis\
22+ MenuItemPeer.dis\
23+ MenuPeer.dis\
24+ PanelPeer.dis\
25+ PopupMenuPeer.dis\
26+ ScrollPanePeer.dis\
27+ ScrollbarPeer.dis\
28+ TextAreaPeer.dis\
29+ TextComponentPeer.dis\
30+ TextFieldPeer.dis\
31+ WindowPeer.dis\
32+
33+DISBIN=$ROOT/java/dis/java/java/awt/peer
34+
35+<$ROOT/mkfiles/mkjava
java/pkg2/java/beans/BeanDescriptor.java+0−0

Empty file added.

java/pkg2/java/beans/BeanInfo.java+0−0

Empty file added.

java/pkg2/java/beans/Beans.java+0−0

Empty file added.

java/pkg2/java/beans/Customizer.java+0−0

Empty file added.

java/pkg2/java/beans/EventSetDescriptor.java+0−0

Empty file added.

java/pkg2/java/beans/FeatureDescriptor.java+0−0

Empty file added.

java/pkg2/java/beans/IndexedPropertyDescript.java+0−0

Empty file added.

java/pkg2/java/beans/IntrospectionException.java+0−0

Empty file added.

java/pkg2/java/beans/Introspector.java+0−0

Empty file added.

java/pkg2/java/beans/MethodDescriptor.java+0−0

Empty file added.

java/pkg2/java/beans/ParameterDescriptor.java+0−0

Empty file added.

java/pkg2/java/beans/PropertyChangeEvent.java+0−0

Empty file added.

java/pkg2/java/beans/PropertyChangeListener.java+0−0

Empty file added.

java/pkg2/java/beans/PropertyChangeSupport.java+0−0

Empty file added.

java/pkg2/java/beans/PropertyDescriptor.java+0−0

Empty file added.

java/pkg2/java/beans/PropertyEditor.java+0−0

Empty file added.

java/pkg2/java/beans/PropertyEditorManager.java+0−0

Empty file added.

java/pkg2/java/beans/PropertyEditorSupport.java+0−0

Empty file added.

java/pkg2/java/beans/PropertyVetoException.java+0−0

Empty file added.

java/pkg2/java/beans/SimpleBeanInfo.java+0−0

Empty file added.

java/pkg2/java/beans/VetoableChangeListener.java+0−0

Empty file added.

java/pkg2/java/beans/VetoableChangeSupport.java+0−0

Empty file added.

java/pkg2/java/beans/Visibility.java+0−0

Empty file added.

java/pkg2/java/beans/mkfile+63−0
@@ -0,0 +1,63 @@
1+<../../../../mkconfig
2+
3+TARG=\
4+ BeanDescriptor.dis\
5+ BeanInfo.dis\
6+ Beans.dis\
7+ BeansAppletContext.dis\
8+ BeansAppletStub.dis\
9+ Customizer.dis\
10+ EventSetDescriptor.dis\
11+ FeatureDescriptor.dis\
12+ GenericBeanInfo.dis\
13+# for IndexedPropertyDescriptor.dis\
14+ ilsoQHwwPML2uGzS7a9sz.dis\
15+# for IntrospectionException.dis\
16+ kKxvl0RXJ9GHO1gHFFNvw.dis\
17+ Introspector.dis\
18+ MethodDescriptor.dis\
19+# for ObjectInputStreamWithLoader.dis\
20+ fOuvWMGaSExrtMuU8Cw+S.dis\
21+ ParameterDescriptor.dis\
22+ PropertyChangeEvent.dis\
23+# for PropertyChangeListener.dis\
24+ M7phJvk2kRU7An2nlvP+n.dis\
25+ PropertyChangeSupport.dis\
26+ PropertyDescriptor.dis\
27+ PropertyEditor.dis\
28+ PropertyEditorManager.dis\
29+ PropertyEditorSupport.dis\
30+ PropertyVetoException.dis\
31+ SimpleBeanInfo.dis\
32+# for VetoableChangeListener.dis\
33+ QD20WmJQo8+7yc9BbLrqW.dis\
34+ VetoableChangeSupport.dis\
35+ Visibility.dis\
36+
37+DISBIN=$ROOT/java/dis/java/java/beans
38+
39+<$ROOT/mkfiles/mkjava
40+
41+BeansAppletContext.dis: Beans.class
42+ j2d BeansAppletContext.class
43+
44+BeansAppletStub.dis: Beans.class
45+ j2d BeansAppletStub.class
46+
47+fOuvWMGaSExrtMuU8Cw+S.dis: Beans.class
48+ j2d ObjectInputStreamWithLoader.class
49+
50+ilsoQHwwPML2uGzS7a9sz.dis: IndexedPropertyDescriptor.class
51+ j2d $prereq
52+
53+kKxvl0RXJ9GHO1gHFFNvw.dis: IntrospectionException.class
54+ j2d $prereq
55+
56+GenericBeanInfo.dis: Introspector.class
57+ j2d GenericBeanInfo.class
58+
59+M7phJvk2kRU7An2nlvP+n.dis: PropertyChangeListener.class
60+ j2d $prereq
61+
62+QD20WmJQo8+7yc9BbLrqW.dis: VetoableChangeListener.class
63+ j2d $prereq
java/pkg2/java/io/BufferedInputStream.java+0−0

Empty file added.

java/pkg2/java/io/BufferedOutputStream.java+0−0

Empty file added.

java/pkg2/java/io/BufferedReader.java+0−0

Empty file added.

java/pkg2/java/io/BufferedWriter.java+0−0

Empty file added.

java/pkg2/java/io/ByteArrayInputStream.java+0−0

Empty file added.

java/pkg2/java/io/ByteArrayOutputStream.java+0−0

Empty file added.

java/pkg2/java/io/CharArrayReader.java+0−0

Empty file added.

java/pkg2/java/io/CharArrayWriter.java+0−0

Empty file added.

java/pkg2/java/io/CharConversionException.java+0−0

Empty file added.

java/pkg2/java/io/DataInput.java+0−0

Empty file added.

java/pkg2/java/io/DataInputStream.java+0−0

Empty file added.

java/pkg2/java/io/DataOutput.java+0−0

Empty file added.

java/pkg2/java/io/DataOutputStream.java+0−0

Empty file added.

java/pkg2/java/io/EOFException.java+0−0

Empty file added.

java/pkg2/java/io/Externalizable.java+0−0

Empty file added.

java/pkg2/java/io/File.java+0−0

Empty file added.

java/pkg2/java/io/FileDescriptor.java+0−0

Empty file added.

java/pkg2/java/io/FileDescriptor_L.b+72−0
@@ -0,0 +1,72 @@
1+implement FileDescriptor_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ FALSE : import jni;
28+ TRUE : import jni;
29+#<<
30+
31+include "FileDescriptor_L.m";
32+
33+#>> extra post includes here
34+#<<
35+
36+init( jni_p : JNI )
37+{
38+ # save java native inteface mod instance
39+ jni = jni_p;
40+ #>>extra initialization here
41+ sys = jni->sys;
42+ #<<
43+}
44+
45+valid_Z( this : ref FileDescriptor_obj) : int
46+{#>>
47+ if (this.fd != nil)
48+ return TRUE;
49+ else
50+ return FALSE;
51+}#<<
52+
53+sync_V( this : ref FileDescriptor_obj)
54+{#>>
55+ # this routine has no meaning in the limbo world because there is
56+ # nothing to sync or flush. It may have meaning to each underlying
57+ # file system (device driver) but at the present there is no devtab
58+ # interface to the device driver for sync. As such, this routine is
59+ # a noop.
60+ jni->ThrowException("java.io.SyncFailedException", "sync not gauranteed");
61+}#<<
62+
63+initSystemFD_rFileDescriptor_I_rFileDescriptor( p0 : ref FileDescriptor_obj,p1 : int) : ref FileDescriptor_obj
64+{#>>
65+ p0.fd = sys->fildes(p1);
66+ return (p0);
67+}#<<
68+
69+
70+
71+
72+
java/pkg2/java/io/FileDescriptor_L.m+16−0
@@ -0,0 +1,16 @@
1+# javal v1.3 generated file: edit with care
2+
3+FileDescriptor_L : module
4+{
5+ FileDescriptor_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ fd : ref Sys->FD;
9+ };
10+
11+ init : fn( jni_p : JNI );
12+ valid_Z : fn( this : ref FileDescriptor_obj) : int;
13+ sync_V : fn( this : ref FileDescriptor_obj);
14+ initSystemFD_rFileDescriptor_I_rFileDescriptor : fn( p0 : ref FileDescriptor_obj,p1 : int) : ref FileDescriptor_obj;
15+
16+};
java/pkg2/java/io/FileInputStream.java+0−0

Empty file added.

java/pkg2/java/io/FileInputStream_L.b+135−0
@@ -0,0 +1,135 @@
1+implement FileInputStream_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ FALSE : import jni;
28+ TRUE : import jni;
29+include "FileDescriptor_L.m";
30+ FileDescriptor_obj : import FileDescriptor_L;
31+#<<
32+
33+include "FileInputStream_L.m";
34+
35+#>> extra post includes here
36+#<<
37+
38+init( jni_p : JNI )
39+{
40+ # save java native inteface mod instance
41+ jni = jni_p;
42+ #>>extra initialization here
43+ sys = jni->sys;
44+ #<<
45+}
46+
47+open_rString_V( this : ref FileInputStream_obj, p0 : JString)
48+{#>>
49+ # p0 == file name
50+
51+ if ((p0 == nil) || (p0.str == nil))
52+ jni->ThrowException("java.lang.NullPointerException", "str is nil");
53+
54+ this.fd.fd = sys->open(p0.str, sys->OREAD);
55+ if(this.fd.fd == nil)
56+ jni->ThrowException("java.io.IOException", "open error");
57+}#<<
58+
59+read_I( this : ref FileInputStream_obj) : int
60+{#>>
61+ buf := array[1] of byte;
62+
63+ if (this.fd.fd == nil)
64+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
65+ readin := sys->read(this.fd.fd, buf, 1);
66+ if (readin == 0) # EOF
67+ return -1;
68+
69+ if (readin < 0)
70+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
71+ return (int buf[0]);
72+
73+}#<<
74+
75+readBytes_aB_I_I_I( this : ref FileInputStream_obj, p0 : JArrayB,p1 : int,p2 : int) : int
76+{#>>
77+ # p0 == input buffer (array of bytes)
78+ # p1 == offset
79+ # p2 == length
80+ # read p2 bytes from the file and place them at location (p0 + p1)
81+
82+ if (this.fd == nil)
83+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
84+ if ((p0 == nil) || (p0.ary == nil))
85+ jni->ThrowException("java.lang.NullPointerException", "nil buffer pointer");
86+ if ((p1 < 0) || (p1 > len p0.ary))
87+ jni->ThrowException("java.lang.ArrayIndexOutOfBoundsException",
88+ jni->sys->sprint( "offset=%d len buf array=%d", p1, len p0.ary));
89+
90+ if ((p1 + p2) > len p0.ary)
91+ p2 = (len p0.ary) - p1;
92+ if (p2 <= 0)
93+ return 0;
94+
95+ n := sys->read(this.fd.fd, p0.ary[p1: len p0.ary], p2);
96+ if (n == 0) # EOF
97+ return -1;
98+
99+ if (n < 0)
100+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
101+ return n;
102+}#<<
103+
104+skip_J_J( this : ref FileInputStream_obj, p0 : big) : big
105+{#>>
106+ # skip the next p0 bytes from the Input stream. First find out where you are in
107+ # the stream. Next skip the bytes then return the "actual" bytes skipped.
108+
109+ if (this.fd.fd == nil)
110+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
111+ cur := sys->seek(this.fd.fd, 0, sys->SEEKRELA);
112+ end := sys->seek(this.fd.fd, (int p0), sys->SEEKRELA);
113+ return big (end - cur);
114+}#<<
115+
116+available_I( this : ref FileInputStream_obj) : int
117+{#>>
118+ if (this.fd.fd == nil)
119+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
120+ cur := sys->seek(this.fd.fd, 0, Sys->SEEKRELA);
121+ end := sys->seek(this.fd.fd, 0, Sys->SEEKEND);
122+ sys->seek(this.fd.fd, cur, Sys->SEEKSTART);
123+
124+ return (end - cur);
125+}#<<
126+
127+close_V( this : ref FileInputStream_obj)
128+{#>>
129+ if (this.fd != nil)
130+ this.fd.fd = nil;
131+}#<<
132+
133+
134+
135+
java/pkg2/java/io/FileInputStream_L.m+19−0
@@ -0,0 +1,19 @@
1+# javal v1.3 generated file: edit with care
2+
3+FileInputStream_L : module
4+{
5+ FileInputStream_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ fd : ref FileDescriptor_obj;
9+ };
10+
11+ init : fn( jni_p : JNI );
12+ open_rString_V : fn( this : ref FileInputStream_obj, p0 : JString);
13+ read_I : fn( this : ref FileInputStream_obj) : int;
14+ readBytes_aB_I_I_I : fn( this : ref FileInputStream_obj, p0 : JArrayB,p1 : int,p2 : int) : int;
15+ skip_J_J : fn( this : ref FileInputStream_obj, p0 : big) : big;
16+ available_I : fn( this : ref FileInputStream_obj) : int;
17+ close_V : fn( this : ref FileInputStream_obj);
18+
19+};
java/pkg2/java/io/FileNotFoundException.java+0−0

Empty file added.

java/pkg2/java/io/FileOutputStream.java+0−0

Empty file added.

java/pkg2/java/io/FileOutputStream_L.b+116−0
@@ -0,0 +1,116 @@
1+implement FileOutputStream_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ FALSE : import jni;
28+ TRUE : import jni;
29+include "FileDescriptor_L.m";
30+ FileDescriptor_obj : import FileDescriptor_L;
31+#<<
32+
33+include "FileOutputStream_L.m";
34+
35+#>> extra post includes here
36+#<<
37+
38+init( jni_p : JNI )
39+{
40+ # save java native inteface mod instance
41+ jni = jni_p;
42+ #>>extra initialization here
43+ sys = jni->sys;
44+ #<<
45+}
46+
47+open_rString_V( this : ref FileOutputStream_obj, p0 : JString)
48+{#>>
49+ # open file pointed to by p0. If it does not exists, create it and
50+ # and open it with mode of 644.
51+
52+ if ((p0 == nil) || (p0.str == nil))
53+ jni->ThrowException("java.lang.NullPointerException", "null file name");
54+
55+ this.fd.fd = sys->create(p0.str, sys->OWRITE, 8r666);
56+ if(this.fd.fd == nil)
57+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
58+}#<<
59+
60+openAppend_rString_V( this : ref FileOutputStream_obj, p0 : JString)
61+{#>>
62+ if ((p0 == nil) || (p0.str == nil))
63+ jni->ThrowException("java.lang.NullPointerException", "null filename");
64+
65+ this.fd.fd = sys->open(p0.str, sys->OWRITE);
66+ if(this.fd.fd == nil)
67+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
68+ sys->seek(this.fd.fd, 0, sys->SEEKEND);
69+}#<<
70+
71+write_I_V( this : ref FileOutputStream_obj, p0 : int)
72+{#>>
73+ # p0 == character to write
74+ c := array[1] of byte;
75+ c[0] = byte p0;
76+
77+ if ((this.fd == nil) || (this.fd.fd == nil))
78+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
79+
80+ if (sys->write(this.fd.fd, c, 1) != 1)
81+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
82+}#<<
83+
84+writeBytes_aB_I_I_V( this : ref FileOutputStream_obj, p0 : JArrayB,p1 : int,p2 : int)
85+{#>>
86+ # p0 == buffer array to write from
87+ # p1 == offset in buffer
88+ # p2 == length to write out
89+
90+ if ((this.fd == nil) || (this.fd.fd == nil))
91+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
92+ if ((p0 == nil) || (p0.ary == nil))
93+ jni->ThrowException("java.lang.NullPointerException", nil);
94+ if ((p1 < 0) || (p2 < 0) || (p1 > (len p0.ary)))
95+ jni->ThrowException("java.lang.ArrayIndexOutOfBoundsException", nil);
96+
97+ n := 0;
98+ while (p2 > 0) {
99+ # you can also write the following line as.....
100+ # n = sys->write(this.fd.fd, p0.ary[p1:], p2);
101+ n = sys->write(this.fd.fd, p0.ary[p1:len p0.ary], p2);
102+ if (n == -1) {
103+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
104+ break;
105+ }
106+ p1 += n;
107+ p2 -= n;
108+ }
109+}#<<
110+
111+close_V( this : ref FileOutputStream_obj)
112+{#>>
113+ if (this.fd != nil)
114+ this.fd.fd = nil;
115+}#<<
116+
java/pkg2/java/io/FileOutputStream_L.m+18−0
@@ -0,0 +1,18 @@
1+# javal v1.3 generated file: edit with care
2+
3+FileOutputStream_L : module
4+{
5+ FileOutputStream_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ fd : ref FileDescriptor_obj;
9+ };
10+
11+ init : fn( jni_p : JNI );
12+ open_rString_V : fn( this : ref FileOutputStream_obj, p0 : JString);
13+ openAppend_rString_V : fn( this : ref FileOutputStream_obj, p0 : JString);
14+ write_I_V : fn( this : ref FileOutputStream_obj, p0 : int);
15+ writeBytes_aB_I_I_V : fn( this : ref FileOutputStream_obj, p0 : JArrayB,p1 : int,p2 : int);
16+ close_V : fn( this : ref FileOutputStream_obj);
17+
18+};
java/pkg2/java/io/FileReader.java+0−0

Empty file added.

java/pkg2/java/io/FileWriter.java+0−0

Empty file added.

java/pkg2/java/io/File_L.b+332−0
@@ -0,0 +1,332 @@
1+implement File_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ str : import jni;
28+ FALSE : import jni;
29+ TRUE : import jni;
30+#<<
31+
32+include "File_L.m";
33+
34+#>> extra post includes here
35+include "workdir.m";
36+include "regex.m";
37+str_mod : String;
38+#<<
39+
40+init( jni_p : JNI )
41+{
42+ # save java native inteface mod instance
43+ jni = jni_p;
44+ #>>extra initialization here
45+ sys = jni->sys;
46+ str_mod = jni->str;
47+ #<<
48+}
49+
50+exists0_Z( this : ref File_obj) : int
51+{#>>
52+ (ok, nil) := sys->stat(this.path.str);
53+ if (ok == -1)
54+ return (FALSE);
55+ return (TRUE);
56+}#<<
57+
58+canWrite0_Z( this : ref File_obj) : int
59+{#>>
60+ # this routine is real cludgy...try to open the file for writing
61+ # to see if you have WRITE access rights or not.
62+
63+ local_fd := sys->open(this.path.str, sys->OWRITE);
64+ if (local_fd == nil)
65+ return (FALSE);
66+ return (TRUE);
67+}#<<
68+
69+canRead0_Z( this : ref File_obj) : int
70+{#>>
71+ # this routine is real cludgy...try to open the file for reading
72+ # to see if you have READ access rights or not.
73+
74+ local_fd := sys->open(this.path.str, sys->OREAD);
75+ if (local_fd == nil)
76+ return (FALSE);
77+ return (TRUE);
78+}#<<
79+
80+isFile0_Z( this : ref File_obj) : int
81+{#>>
82+ (ok, dir) := sys->stat(this.path.str);
83+ if(ok >= 0 && !(dir.mode & Sys->CHDIR))
84+ return (TRUE);
85+ return (FALSE);
86+}#<<
87+
88+isDirectory0_Z( this : ref File_obj) : int
89+{#>>
90+ (ok, dir) := sys->stat(this.path.str);
91+ if(ok >= 0 && (dir.mode & Sys->CHDIR))
92+ return (TRUE);
93+ return (FALSE);
94+}#<<
95+
96+lastModified0_J( this : ref File_obj) : big
97+{#>>
98+ (ok, dir) := sys->stat(this.path.str);
99+ if(ok >= 0)
100+ return (big dir.mtime);
101+ return (big 0);
102+}#<<
103+
104+length0_J( this : ref File_obj) : big
105+{#>>
106+ (ok, dir) := sys->stat(this.path.str);
107+ if(ok >= 0)
108+ return (big dir.length);
109+ return (big 0);
110+}#<<
111+
112+mkdir0_Z( this : ref File_obj) : int
113+{#>>
114+ (ok, nil) := sys->stat(this.path.str);
115+ if(ok >= 0)
116+ return (FALSE);
117+ fd := sys->create(this.path.str, sys->OREAD, sys->CHDIR + 8r777);
118+ if(fd == nil)
119+ return (FALSE);
120+ fd = nil;
121+ return (TRUE);
122+}#<<
123+
124+renameTo0_rFile_Z( this : ref File_obj, p0 : ref File_obj) : int
125+{#>>
126+ # this routine is based on the appl/cmd/mv command in inferno....
127+
128+ #put from and to file names into complete path names
129+ frompath := pathname(this.path.str);
130+ topath := pathname(p0.path.str);
131+
132+ #seperate the name of the file from the directory the files reside in
133+ (fromdir, fromname) := split(frompath);
134+ (todir, toname) := split(topath);
135+
136+ (i, dirf) := sys->stat(this.path.str);
137+ if ( i == -1 )
138+ return FALSE;
139+
140+ # are the files in the same directory????
141+ if ( samefile(fromdir, todir) ) {
142+ if ( toname == fromname )
143+ return TRUE;
144+ (j, dirt) := sys->stat(p0.path.str);
145+ if ( j == 0 ) {
146+ if ( (dirf.mode | dirt.mode) & Sys->CHDIR )
147+ return FALSE;
148+ hardremove(topath);
149+ }
150+ dirf.name = toname;
151+ if ( sys->wstat(this.path.str, dirf) >= 0 )
152+ return TRUE;
153+ }
154+ #open the from file....
155+ if ( (fdf := sys->open(this.path.str, Sys->OREAD)) == nil )
156+ return FALSE;
157+
158+ #open the to file....
159+ if ( (fdt := sys->create(p0.path.str, Sys->OWRITE, dirf.mode)) == nil )
160+ return FALSE;;
161+
162+ #copy data from from file to to file....
163+ if ( (stat := copy1(fdf, fdt)) == TRUE ) {
164+ fdf = nil;
165+ if ( sys->remove(this.path.str) < 0 )
166+ return FALSE;
167+ }
168+ else {
169+ fdt = nil;
170+ sys->remove(p0.path.str);
171+ }
172+ return stat;
173+}#<<
174+
175+delete0_Z( this : ref File_obj) : int
176+{#>>
177+ if (isFile0_Z(this) == TRUE)
178+ return (remove0_b(this));
179+ return (FALSE);
180+}#<<
181+
182+rmdir0_Z( this : ref File_obj) : int
183+{#>>
184+ if (isDirectory0_Z(this) == TRUE)
185+ return (remove0_b(this));
186+ return (FALSE);
187+}#<<
188+
189+list0_aString( this : ref File_obj) : JArrayJString
190+{#>>
191+ fd := sys->open(this.path.str, sys->OREAD);
192+ if(fd == nil) {
193+ return nil;
194+ }
195+
196+ dir_array := array[200] of Sys->Dir;
197+ n := 0;
198+ for(;;){
199+ if(len dir_array - n == 0){
200+ # expand dir_array
201+ nd := array[2 * len dir_array] of Sys->Dir;
202+ nd[0:] = dir_array;
203+ dir_array = nd;
204+ }
205+ nr := sys->dirread(fd, dir_array[n:]);
206+ if(nr < 0)
207+ return nil;
208+ if(nr == 0)
209+ break;
210+ n += nr;
211+ }
212+ file_name := array[n] of string;
213+
214+ for(i := 0; i < n; i++)
215+ file_name[i] = dir_array[i].name;
216+
217+ return (jni->MkAString(file_name));
218+}#<<
219+
220+canonPath_rString_rString( this : ref File_obj, p0 : JString) : JString
221+{#>>
222+ TRACE_1 := this; # to remove warning msg at compile time;
223+
224+ path := pathname(p0.str) + "/";
225+
226+ regex := load Regex Regex->PATH;
227+ if ( regex == nil )
228+ jni->InitError( sys->sprint( "java.io.File: could not load %s: %r", Regex->PATH ) );
229+
230+ path = squeeze_out(regex, regex->compile("//", 0), "/", path);
231+ path = squeeze_out(regex, regex->compile("/\\./", 0), "/", path);
232+ path = squeeze_out(regex, regex->compile("/[^/]+/\\.\\./", 0), "/", path);
233+
234+ if ( len path > 1 && path[len path - 1] == '/' )
235+ path = path[0:len path - 1];
236+
237+ return (jni->NewString( path));
238+}#<<
239+
240+isAbsolute_Z( this : ref File_obj) : int
241+{#>>
242+ if (str_mod->prefix("/", this.path.str))
243+ return (TRUE);
244+ return (FALSE);
245+}#<<
246+
247+
248+
249+
250+
251+remove0_b( this : ref File_obj) : int
252+{
253+ if (sys->remove(this.path.str) < 0)
254+ return (FALSE);
255+ return (TRUE);
256+}
257+
258+copy1(fdf, fdt : ref Sys->FD): int
259+{
260+ n : int;
261+ buf := array[8192] of byte;
262+
263+ for ( ; ; ) {
264+ n = sys->read(fdf, buf, len buf);
265+ if (n<=0)
266+ break;
267+ n1 := sys->write(fdt, buf, n);
268+ if ( n1 != n )
269+ return FALSE;
270+ }
271+ if ( n < 0 )
272+ return FALSE;
273+ return TRUE;
274+}
275+
276+#convert a file name into complete path name
277+pathname(p : string) : string
278+{
279+ if ( p == nil || p[0] == '/' )
280+ return p;
281+ gwd := load Workdir Workdir->PATH;
282+ if ( gwd == nil )
283+ jni->InitError( sys->sprint( "java.io.File: could not load %s: %r", Workdir->PATH ) );
284+
285+ wd := gwd->init();
286+ if ( len wd == 0 )
287+ return p;
288+ return wd + "/" + p;
289+}
290+
291+#pull out the name of the file only
292+split(name : string): (string,string)
293+{
294+ (d,t) := str_mod->splitr(name, "/");
295+ if ( d != nil )
296+ return(d,t);
297+ else if ( name == ".." )
298+ return("../",".");
299+ else
300+ return("./",name);
301+}
302+
303+# return TRUE if file a is same as file b
304+samefile(a,b : string): int
305+{
306+ if ( a == b )
307+ return 1;
308+ (i, file_a) := sys->stat(a);
309+ (j, file_b) := sys->stat(b);
310+ if ( i < 0 || j < 0 )
311+ return 0;
312+ i = ((file_a.qid.path == file_b.qid.path) && (file_a.qid.vers == file_b.qid.vers) &&
313+ (file_a.dev == file_b.dev) && (file_a.dtype == file_b.dtype));
314+ return i;
315+}
316+
317+hardremove(a: string)
318+{
319+ do; while ( sys->remove(a) != -1 );
320+}
321+
322+squeeze_out(r : Regex, pat : Regex->Re, repl, str :string) : string
323+{
324+ while ( str_mod->prefix("/../", str) )
325+ str = str[3:];
326+ a := r->execute(pat, str);
327+ if (a == nil)
328+ return str;
329+ (beg, end) := a[0];
330+ str = str[0:beg] + repl + str[end:];
331+ return squeeze_out(r, pat, repl, str);
332+}
java/pkg2/java/io/File_L.m+27−0
@@ -0,0 +1,27 @@
1+# javal v1.3 generated file: edit with care
2+
3+File_L : module
4+{
5+ File_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ path : JString;
9+ };
10+
11+ init : fn( jni_p : JNI );
12+ exists0_Z : fn( this : ref File_obj) : int;
13+ canWrite0_Z : fn( this : ref File_obj) : int;
14+ canRead0_Z : fn( this : ref File_obj) : int;
15+ isFile0_Z : fn( this : ref File_obj) : int;
16+ isDirectory0_Z : fn( this : ref File_obj) : int;
17+ lastModified0_J : fn( this : ref File_obj) : big;
18+ length0_J : fn( this : ref File_obj) : big;
19+ mkdir0_Z : fn( this : ref File_obj) : int;
20+ renameTo0_rFile_Z : fn( this : ref File_obj, p0 : ref File_obj) : int;
21+ delete0_Z : fn( this : ref File_obj) : int;
22+ rmdir0_Z : fn( this : ref File_obj) : int;
23+ list0_aString : fn( this : ref File_obj) : JArrayJString;
24+ canonPath_rString_rString : fn( this : ref File_obj, p0 : JString) : JString;
25+ isAbsolute_Z : fn( this : ref File_obj) : int;
26+
27+};
java/pkg2/java/io/FilenameFilter.java+0−0

Empty file added.

java/pkg2/java/io/FilterInputStream.java+0−0

Empty file added.

java/pkg2/java/io/FilterOutputStream.java+0−0

Empty file added.

java/pkg2/java/io/FilterReader.java+0−0

Empty file added.

java/pkg2/java/io/FilterWriter.java+0−0

Empty file added.

java/pkg2/java/io/IOException.java+0−0

Empty file added.

java/pkg2/java/io/InputStream.java+0−0

Empty file added.

java/pkg2/java/io/InputStreamReader.java+0−0

Empty file added.

java/pkg2/java/io/InterruptedIOException.java+0−0

Empty file added.

java/pkg2/java/io/InvalidClassException.java+0−0

Empty file added.

java/pkg2/java/io/InvalidObjectException.java+0−0

Empty file added.

java/pkg2/java/io/LineNumberInputStream.java+0−0

Empty file added.

java/pkg2/java/io/LineNumberReader.java+0−0

Empty file added.

java/pkg2/java/io/NotActiveException.java+0−0

Empty file added.

java/pkg2/java/io/NotSerializableExceptio.java+0−0

Empty file added.

java/pkg2/java/io/ObjectInput.java+0−0

Empty file added.

java/pkg2/java/io/ObjectInputStream.java+0−0

Empty file added.

java/pkg2/java/io/ObjectInputStream_L.b+397−0
@@ -0,0 +1,397 @@
1+implement ObjectInputStream_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ str : import jni;
28+ FALSE : import jni;
29+ TRUE : import jni;
30+#<<
31+
32+include "ObjectInputStream_L.m";
33+
34+#>> extra post includes here
35+include "workdir.m";
36+include "regex.m";
37+str_mod : String;
38+ClassData, Value : import jni;
39+cast : Cast;
40+low : Low;
41+#<<
42+
43+init( jni_p : JNI )
44+{
45+ # save java native inteface mod instance
46+ jni = jni_p;
47+ #>>extra initialization here
48+ sys = jni->sys;
49+ str_mod = jni->str;
50+ cast = jni->CastMod();
51+ low = jni->LowMod();
52+ #<<
53+}
54+
55+loadClass0_rClass_rString_rClass( this : ref ObjectInputStream_obj, p0 : JClass,p1 : JString) : JClass
56+{#>>
57+ TRACE_1 := (this, p0);
58+ if(p1.str[0] == '[')
59+ return jni->LookupArrayClass(p1.str);
60+ else
61+ return jni->GetClassObject( jni->FindClass(p1.str) );
62+}#<<
63+
64+inputClassFields_rObject_rClass_aI_V( this : JObject, p0 : JObject,p1 : JClass,p2 : JArrayI)
65+{#>>
66+ #p0 the object being inputted
67+ #p1 class being referred to
68+ #p2 fieldSequence array
69+
70+ ok : int;
71+ val : ref Value;
72+ #
73+ # get all fields except the transient and static
74+ #
75+ fields_n_sigs := jni->GetFieldSignatures(p1, (JNI->ACC_STATIC|JNI->ACC_TRANSIENT));
76+ #
77+ # for each field, parse out the field name and signature. Then based on the
78+ # signature, call the appropriate read routine.
79+ #
80+ for (i:=0; i < len p2.ary; i += 2) {
81+ fldindex := p2.ary[i+1];
82+
83+ (str_part, tmp_str) := str_mod->splitl((fields_n_sigs.ary[fldindex]).str, " ");
84+ sig_part := tmp_str[1];
85+ #
86+ # call the appropriate read routine to get the value of this field
87+ #
88+ case sig_part {
89+ # SIGNATURE_BYTE
90+ 'B' =>
91+ (val, ok) = jni->CallMethod(this, "readByte", "()B", nil);
92+ # SIGNATURE_CHAR
93+ 'C' =>
94+ (val, ok) = jni->CallMethod(this, "readChar", "()C", nil);
95+ # SIGNATURE_FLOAT
96+ 'F' =>
97+ (val, ok) = jni->CallMethod(this, "readFloat", "()F", nil);
98+ # SIGNATURE_DOUBLE
99+ 'D' =>
100+ (val, ok) = jni->CallMethod(this, "readDouble", "()D", nil);
101+ # SIGNATURE_INT
102+ 'I' =>
103+ (val, ok) = jni->CallMethod(this, "readInt", "()I", nil);
104+ # SIGNATURE_LONG
105+ 'J' =>
106+ (val, ok) = jni->CallMethod(this, "readLong", "()J", nil);
107+ # SIGNATURE_SHORT
108+ 'S' =>
109+ (val, ok) = jni->CallMethod(this, "readShort", "()S", nil);
110+ # SIGNATURE_BOOLEAN
111+ 'Z' =>
112+ (val, ok) = jni->CallMethod(this, "readBoolean", "()Z", nil);
113+ # SIGNATURE_ARRAY
114+ '[' =>
115+ (val, ok) = jni->CallMethod(this, "readObject", "()Ljava/lang/Object;", nil);
116+ # SIGNATURE_CLASS
117+ 'L' =>
118+ (val, ok) = jni->CallMethod(this, "readObject", "()Ljava/lang/Object;", nil);
119+ }
120+ #
121+ # now take that just readin value and store into the object.
122+ #
123+ if (ok == JNI->OK)
124+ jni->SetObjField(p0, str_part, val);
125+ }
126+}#<<
127+
128+inputArrayValues_rObject_rClass_V( this : JObject, p0 : JObject,p1 : JClass)
129+{#>>
130+ # p0 is an array of Objects. We have to look at the signature
131+ # of the array to find what the Objects really are.
132+ #
133+ # p1 the class name of the elements of the array (this is also
134+ # the arrays signature)
135+ #
136+ # make sure this is an array we have. If so, get its length.
137+ #
138+ if ( jni->IsArray(p0) == JNI->FALSE) {
139+ jni->ThrowException("java.io.InvalidClassException", "Not an array");
140+ }
141+ length := jni->GetArrayLength(cast->ToJArray(p0));
142+ ok : int;
143+ val : ref Value;
144+
145+ #
146+ # dispatch on the signature of the array and read in each element.
147+ #
148+ i : int;
149+ case p1.aryname[1] {
150+ # SIGNATURE_BYTE
151+ 'B' =>
152+ {
153+ mul_args := array[3] of ref Value;
154+ mul_args[0] = ref Value.TObject(p0);
155+ mul_args[1] = ref Value.TInt(0);
156+ mul_args[2] = ref Value.TInt(length);
157+ (val, ok) = jni->CallMethod(this, "readFully", "([BII)V", mul_args);
158+ }
159+ # SIGNATURE_CHAR
160+ 'C' =>
161+ {
162+ JAChar := cast->ToJArrayI(p0);
163+ for (i = 0; i < length; i++) {
164+ (val, ok) = jni->CallMethod(this, "readChar", "()C", nil);
165+ JAChar.ary[i] = val.Char();
166+ }
167+ }
168+ # SIGNATURE_FLOAT
169+ 'F' =>
170+ {
171+ JAFloat := cast->ToJArrayF(p0);
172+ for (i = 0; i < length; i++) {
173+ (val, ok) = jni->CallMethod(this, "readFloat", "()F", nil);
174+ JAFloat.ary[i] = val.Float();
175+ }
176+ }
177+ # SIGNATURE_DOUBLE
178+ 'D' =>
179+ {
180+ JADouble := cast->ToJArrayD(p0);
181+ for (i = 0; i < length; i++) {
182+ (val, ok) = jni->CallMethod(this, "readDouble", "()D", nil);
183+ JADouble.ary[i] = val.Double();
184+ }
185+ }
186+ # SIGNATURE_INT
187+ 'I' =>
188+ {
189+ JAInt := cast->ToJArrayI(p0);
190+ for (i = 0; i < length; i++) {
191+ (val, ok) = jni->CallMethod(this, "readInt", "()I", nil);
192+ JAInt.ary[i] = val.Int();
193+ }
194+ }
195+ # SIGNATURE_LONG
196+ 'J' =>
197+ {
198+ JALong := cast->ToJArrayJ(p0);
199+ for (i = 0; i < length; i++) {
200+ (val, ok) = jni->CallMethod(this, "readLong", "()J", nil);
201+ JALong.ary[i] = val.Long();
202+ }
203+ }
204+ # SIGNATURE_SHORT
205+ 'S' =>
206+ {
207+ JAShort := cast->ToJArrayI(p0);
208+ for (i = 0; i < length; i++) {
209+ (val, ok) = jni->CallMethod(this, "readShort", "()S", nil);
210+ JAShort.ary[i] = val.Short();
211+ }
212+ }
213+ # SIGNATURE_BOOLEAN
214+ 'Z' =>
215+ {
216+ JABool := cast->ToJArrayZ(p0);
217+ for (i = 0; i < length; i++) {
218+ (val, ok) = jni->CallMethod(this, "readBoolean", "()Z", nil);
219+ JABool.ary[i] = byte val.Boolean();
220+ }
221+ }
222+ # SIGNATURE_ARRAY
223+ '[' =>
224+ {
225+ JAObj := cast->ToJArrayJObject(p0);
226+ for (i = 0; i < length; i++) {
227+ (val, ok) = jni->CallMethod(this, "readObject", "()Ljava/lang/Object;", nil);
228+ JAObj.ary[i] = val.Object();
229+ }
230+ }
231+ # SIGNATURE_CLASS
232+ 'L' =>
233+ {
234+ JAObj := cast->ToJArrayJObject(p0);
235+ for (i = 0; i < length; i++) {
236+ (val, ok) = jni->CallMethod(this, "readObject", "()Ljava/lang/Object;", nil);
237+ JAObj.ary[i] = val.Object();
238+ }
239+ }
240+ }
241+}#<<
242+
243+#
244+# Does class c directly implement interface iface?
245+#
246+directImp(c: ClassData, iface: string): int
247+{
248+ l := c.interdirect;
249+ while(l != nil) {
250+ i := hd l;
251+ if(i.name == iface)
252+ return 1;
253+ l = tl l;
254+ }
255+ return 0;
256+}
257+
258+#
259+# If c directly implements Externalizable, then call its default
260+# constructor (if there is one).
261+# Otherwise, c must directly implement Serializable. In this case,
262+# find the nearest super that doesn't implement Serializable and call
263+# its default constructor (if there is one).
264+# In either case, if there is a constructor to call, then it must be public.
265+# If not, an IllegalAccessException is thrown.
266+#
267+
268+callCtor(c: ClassData, o: JObject)
269+{
270+ if(directImp(c, "java/io/Externalizable") == 0) {
271+ if(directImp(c, "java/io/Serializable") == 0)
272+ return;
273+ c = c.super;
274+ while(c != nil) {
275+ if(directImp(c, "java/io/Serializable") == 0)
276+ break;
277+ c = c.super;
278+ }
279+ }
280+ if(c == nil)
281+ return;
282+ (mod, ix) := jni->FindMethod(c, "<init>", "()V", JNI->METH_INIT);
283+ if(mod == nil)
284+ return;
285+ flags := jni->GetMethodFlags(c.this, "<init> ()V");
286+ if((flags & JNI->ACC_PUBLIC) == 0)
287+ jni->ThrowException("java.lang.IllegalAccessException", "");
288+ low->CallMethod(mod, ix, o, array[0] of ref Value, nil);
289+}
290+
291+#
292+# Allocate a new object of class p0.
293+#
294+allocateNewObject_rClass_rClass_rObject(p0 : JClass, p1 : JClass) : JObject
295+{#>>
296+ TRACE_1 := p1;
297+ o := jni->AllocObject(p0.class);
298+ callCtor(p0.class, o);
299+ return o;
300+}#<<
301+
302+allocateNewArray_rClass_I_rObject( p0 : JClass,p1 : int) : JObject
303+{#>>
304+ #
305+ # p0 is the class of the array elements
306+ # p1 is number of elelments.
307+ #
308+ #
309+ # example transformation.....
310+ # jni->MkALong(array[p1] of big) ==> JArrayJ
311+ # cast->BigToJArray(JArrayJ (aka BigArray)) ==> JArray
312+ # cast->FromJArray(JArray) ==> JObject
313+ #
314+ case p0.aryname[1] {
315+ # SIGNATURE_BYTE
316+ 'B' =>
317+ {
318+ # limbo array ==>JArrayB ==>JArray ==>JObject
319+ return (cast->FromJArray(cast->ByteToJArray(jni->MkAByte(array[p1] of byte))));
320+ }
321+ # SIGNATURE_CHAR
322+ 'C' =>
323+ {
324+ # limbo array ==>JArrayC ==>JArray ==>JObject
325+ return (cast->FromJArray(cast->IntToJArray(jni->MkAChar(array[p1] of int))));
326+ }
327+ # SIGNATURE_FLOAT
328+ 'F' =>
329+ {
330+ # limbo array ==>JArrayF ==>JArray ==>JObject
331+ return (cast->FromJArray(cast->RealToJArray(jni->MkAFloat(array[p1] of real))));
332+ }
333+ # SIGNATURE_DOUBLE
334+ 'D' =>
335+ {
336+ # limbo array ==>JArrayD ==>JArray ==>JObject
337+ return (cast->FromJArray(cast->RealToJArray(jni->MkADouble(array[p1] of real))));
338+ }
339+ # SIGNATURE_INT
340+ 'I' =>
341+ {
342+ # limbo array ==>JArrayI ==>JArray ==>JObject
343+ return (cast->FromJArray(cast->IntToJArray(jni->MkAInt(array[p1] of int))));
344+ }
345+ # SIGNATURE_LONG
346+ 'J' =>
347+ {
348+ # limbo array ==>JArrayJ ==>JArray ==>JObject
349+ return (cast->FromJArray(cast->BigToJArray(jni->MkALong(array[p1] of big))));
350+ }
351+ # SIGNATURE_SHORT
352+ 'S' =>
353+ {
354+ # limbo array ==>JArrayS ==>JArray ==>JObject
355+ return (cast->FromJArray(cast->IntToJArray(jni->MkAShort(array[p1] of int))));
356+ }
357+ # SIGNATURE_BOOLEAN
358+ 'Z' =>
359+ {
360+ # limbo array ==>JArrayZ ==>JArray ==>JObject
361+ return (cast->FromJArray(cast->ByteToJArray(jni->MkABoolean(array[p1] of byte))));
362+ }
363+ # SIGNATURE_ARRAY
364+ '[' =>
365+ {
366+ objarray := cast->ObjectToJArray(jni->MkAObject(array[p1] of JObject));
367+ desc := jni->JSigToDescriptor(p0.aryname);
368+ objarray.dims = desc.dims;
369+ objarray.class = desc.class;
370+ objarray.primitive = desc.prim;
371+ return (cast->FromJArray(objarray));
372+ }
373+ # SIGNATURE_CLASS
374+ 'L' =>
375+ {
376+ objarray := cast->ObjectToJArray(jni->MkAObject(array[p1] of JObject));
377+ objarray.class = jni->FindClass(p0.aryname[2:len p0.aryname-1]);
378+ return (cast->FromJArray(objarray));
379+ }
380+ }
381+ jni->ThrowException("java.io.InvalidClassException", "Unknown signature");
382+ return nil;
383+}#<<
384+
385+invokeObjectReader_rObject_rClass_Z( this : JObject, p0 : JObject,p1 : JClass) : int
386+{#>>
387+ junk := p1;
388+ #
389+ # call readObject() on object "p0" with an argument of "this"
390+ #
391+ MyValueArray := array[] of {
392+ ref Value.TObject(this)
393+ };
394+ (a, b) := jni->CallMethod(p0, "readObject", "(Ljava/io/ObjectInputStream;)V", MyValueArray);
395+
396+ return b == JNI->OK;
397+}#<<
java/pkg2/java/io/ObjectInputStream_L.m+36−0
@@ -0,0 +1,36 @@
1+# generated file edit with care
2+
3+ObjectInputStream_L : module
4+{
5+ ObjectInputStream_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ in : JObject;
9+ count : int;
10+ blockDataMode : byte;
11+ dis : JObject;
12+ abortIOException : JObject;
13+ abortClassNotFoundException : JObject;
14+ currentObject : JObject;
15+ currentClassDesc : JObject;
16+ currentClass : JClass;
17+ classdesc : JArrayJObject;
18+# classes : JArrayJClass;
19+ spClass : int;
20+ wireHandle2Object : JObject;
21+ nextWireOffset : int;
22+ callbacks : JObject;
23+ recursionDepth : int;
24+ currCode : byte;
25+ enableResolve : byte;
26+ };
27+
28+ init : fn( jni_p : JNI );
29+ loadClass0_rClass_rString_rClass : fn( this : ref ObjectInputStream_obj, p0 : JClass,p1 : JString) : JClass;
30+ inputClassFields_rObject_rClass_aI_V : fn( this : JObject, p0 : JObject,p1 : JClass,p2 : JArrayI);
31+ inputArrayValues_rObject_rClass_V : fn( this : JObject, p0 : JObject,p1 : JClass);
32+ allocateNewObject_rClass_rClass_rObject : fn( p0 : JClass,p1 : JClass) : JObject;
33+ allocateNewArray_rClass_I_rObject : fn( p0 : JClass,p1 : int) : JObject;
34+ invokeObjectReader_rObject_rClass_Z : fn( this : JObject, p0 : JObject,p1 : JClass) : int;
35+
36+};
java/pkg2/java/io/ObjectInputValidation.java+0−0

Empty file added.

java/pkg2/java/io/ObjectOutput.java+0−0

Empty file added.

java/pkg2/java/io/ObjectOutputStream.java+0−0

Empty file added.

java/pkg2/java/io/ObjectOutputStream_L.b+257−0
@@ -0,0 +1,257 @@
1+implement ObjectOutputStream_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ str : import jni;
28+ FALSE : import jni;
29+ TRUE : import jni;
30+#<<
31+
32+include "ObjectOutputStream_L.m";
33+
34+#>> extra post includes here
35+include "workdir.m";
36+include "regex.m";
37+str_mod : String;
38+Value : import jni;
39+cast : Cast;
40+#<<
41+
42+init( jni_p : JNI )
43+{
44+ # save java native inteface mod instance
45+ jni = jni_p;
46+ #>>extra initialization here
47+ sys = jni->sys;
48+ str_mod = jni->str;
49+ cast = jni->CastMod();
50+ #<<
51+}
52+
53+outputClassFields_rObject_rClass_aI_V( this : JObject, p0 : JObject,p1 : JClass,p2 : JArrayI)
54+{#>>
55+
56+ class := jni->GetObjectClass(p0);
57+ #p0 the object being outputted
58+ #p1 class being referred to
59+ #p2 fieldSequence array
60+
61+ a : ref Value;
62+ b : int;
63+ #
64+ # get all fields except the transient and static
65+ #
66+ fields_n_sigs := jni->GetFieldSignatures(p1, (JNI->ACC_STATIC|JNI->ACC_TRANSIENT));
67+ #
68+ # for each field, parse out the field name and signature. Then based on the
69+ # signature, call the appropriate write routine.
70+ #
71+ for (i:=0; i < len p2.ary; i += 2) {
72+ fldindex := p2.ary[i+1];
73+
74+ (str_part, tmp_str) := str_mod->splitl((fields_n_sigs.ary[fldindex]).str, " ");
75+ sig_part := tmp_str[1];
76+ #
77+ # get the value of this field and call the write routine
78+ #
79+ argv := array[] of {
80+ jni->GetObjField(p0, str_part, tmp_str[1:])
81+ };
82+ pick v := argv[0] {
83+ TByte =>
84+ argv[0] = ref Value.TInt(v.jbyte);
85+ TChar =>
86+ argv[0] = ref Value.TInt(v.jchar);
87+ TShort =>
88+ argv[0] = ref Value.TInt(v.jshort);
89+ }
90+ case sig_part {
91+ # SIGNATURE_BYTE
92+ 'B' =>
93+ (a, b) = jni->CallMethod(this, "writeByte", "(I)V", argv);
94+ # SIGNATURE_CHAR
95+ 'C' =>
96+ (a, b) = jni->CallMethod(this, "writeChar", "(I)V", argv);
97+ # SIGNATURE_FLOAT
98+ 'F' =>
99+ (a, b) = jni->CallMethod(this, "writeFloat", "(F)V", argv);
100+ # SIGNATURE_DOUBLE
101+ 'D' =>
102+ (a, b) = jni->CallMethod(this, "writeDouble", "(D)V", argv);
103+ # SIGNATURE_INT
104+ 'I' =>
105+ (a, b) = jni->CallMethod(this, "writeInt", "(I)V", argv);
106+ # SIGNATURE_LONG
107+ 'J' =>
108+ (a, b) = jni->CallMethod(this, "writeLong", "(J)V", argv);
109+ # SIGNATURE_SHORT
110+ 'S' =>
111+ (a, b) = jni->CallMethod(this, "writeShort", "(I)V", argv);
112+ # SIGNATURE_BOOLEAN
113+ 'Z' =>
114+ (a, b) = jni->CallMethod(this, "writeBoolean", "(Z)V", argv);
115+ # SIGNATURE_ARRAY
116+ '[' =>
117+ (a, b) = jni->CallMethod(this, "writeObject", "(Ljava/lang/Object;)V", argv);
118+ # SIGNATURE_CLASS
119+ 'L' =>
120+ (a, b) = jni->CallMethod(this, "writeObject", "(Ljava/lang/Object;)V", argv);
121+ }
122+ }
123+}#<<
124+
125+outputArrayValues_rObject_rClass_V( this : JObject, p0 : JObject,p1 : JClass)
126+{#>>
127+ # p0 the array being outputted
128+ # p1 the class name of the elements of the array (this is also the arrays signature)
129+ #
130+ #
131+ # make sure this is an array we have. If so, get the
132+ # length and write it out.
133+ #
134+ if ( jni->IsArray(p0) == JNI->FALSE) {
135+ jni->ThrowException("java.io.InvalidClassException", "Not an array");
136+ }
137+ length := jni->GetArrayLength(cast->ToJArray(p0));
138+ argv := array[1] of ref Value;
139+ argv[0] = ref Value.TInt(length);
140+ (a, b) := jni->CallMethod(this, "writeInt", "(I)V", argv);
141+
142+ #
143+ # dispatch on the signature of the array and print out each element.
144+ #
145+ i : int;
146+ case p1.aryname[1] {
147+ # SIGNATURE_BYTE
148+ 'B' =>
149+ {
150+ JAByte := cast->ToJArrayB(p0);
151+ for (i = 0; i < length; i++) {
152+ argv[0] = ref Value.TInt(int JAByte.ary[i]);
153+ (a, b) = jni->CallMethod(this, "writeByte", "(I)V", argv);
154+ }
155+ }
156+ # SIGNATURE_CHAR
157+ 'C' =>
158+ {
159+ JAChar := cast->ToJArrayI(p0);
160+ for (i = 0; i < length; i++) {
161+ argv[0] = ref Value.TInt(JAChar.ary[i]);
162+ (a, b) = jni->CallMethod(this, "writeChar", "(I)V", argv);
163+ }
164+ }
165+ # SIGNATURE_FLOAT
166+ 'F' =>
167+ {
168+ JAFloat := cast->ToJArrayF(p0);
169+ for (i = 0; i < length; i++) {
170+ argv[0] = ref Value.TFloat(JAFloat.ary[i]);
171+ (a, b) = jni->CallMethod(this, "writeFloat", "(F)V", argv);
172+ }
173+ }
174+ # SIGNATURE_DOUBLE
175+ 'D' =>
176+ {
177+ JADouble := cast->ToJArrayD(p0);
178+ for (i = 0; i < length; i++) {
179+ argv[0] = ref Value.TDouble(JADouble.ary[i]);
180+ (a, b) = jni->CallMethod(this, "writeDouble", "(D)V", argv);
181+ }
182+ }
183+ # SIGNATURE_INT
184+ 'I' =>
185+ {
186+ JAInt := cast->ToJArrayI(p0);
187+ for (i = 0; i < length; i++) {
188+ argv[0] = ref Value.TInt(JAInt.ary[i]);
189+ (a, b) = jni->CallMethod(this, "writeInt", "(I)V", argv);
190+ }
191+ }
192+ # SIGNATURE_LONG
193+ 'J' =>
194+ {
195+ JALong := cast->ToJArrayJ(p0);
196+ for (i = 0; i < length; i++) {
197+ argv[0] = ref Value.TLong(JALong.ary[i]);
198+ (a, b) = jni->CallMethod(this, "writeLong", "(J)V", argv);
199+ }
200+ }
201+ # SIGNATURE_SHORT
202+ 'S' =>
203+ {
204+ JAShort := cast->ToJArrayI(p0);
205+ for (i = 0; i < length; i++) {
206+ argv[0] = ref Value.TInt(JAShort.ary[i]);
207+ (a, b) = jni->CallMethod(this, "writeShort", "(I)V", argv);
208+ }
209+ }
210+ # SIGNATURE_BOOLEAN
211+ 'Z' =>
212+ {
213+ JABool := cast->ToJArrayZ(p0);
214+ for (i = 0; i < length; i++) {
215+ argv[0] = ref Value.TBoolean(int JABool.ary[i]);
216+ (a, b) = jni->CallMethod(this, "writeBoolean", "(Z)V", argv);
217+ }
218+ }
219+ # SIGNATURE_ARRAY
220+ '[' =>
221+ {
222+ JAObj := cast->ToJArrayJObject(p0);
223+ for (i = 0; i < length; i++) {
224+ argv[0] = ref Value.TObject(JAObj.ary[i]);
225+ (a, b) = jni->CallMethod(this, "writeObject", "(Ljava/lang/Object;)V", argv);
226+ }
227+ }
228+ # SIGNATURE_CLASS
229+ 'L' =>
230+ {
231+ JAObj := cast->ToJArrayJObject(p0);
232+ for (i = 0; i < length; i++) {
233+ argv[0] = ref Value.TObject(JAObj.ary[i]);
234+ (a, b) = jni->CallMethod(this, "writeObject", "(Ljava/lang/Object;)V", argv);
235+ }
236+ }
237+ }
238+}#<<
239+
240+invokeObjectWriter_rObject_rClass_Z( this : JObject, p0 : JObject,p1 : JClass) : int
241+{#>>
242+ junk := p1;
243+ #
244+ # call writeObject() on object "p0" with an argument of "this"
245+ #
246+ MyValueArray := array[] of {
247+ ref Value.TObject(this)
248+ };
249+ (a, b) := jni->CallMethod(p0, "writeObject", "(Ljava/io/ObjectOutputStream;)V", MyValueArray);
250+
251+ return b == JNI->OK;
252+}#<<
253+
254+getRefHashCode_rObject_I( p0 : JObject) : int
255+{#>>
256+ return( jni->IdentityHash(p0) );
257+}#<<
java/pkg2/java/io/ObjectOutputStream_L.m+33−0
@@ -0,0 +1,33 @@
1+# generated file edit with care
2+
3+ObjectOutputStream_L : module
4+{
5+ ObjectOutputStream_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ blockDataMode : byte;
9+ buf : JArrayB;
10+ count : int;
11+ out : JObject;
12+ dos : JObject;
13+ abortIOException : JObject;
14+ wireHandle2Object : JArrayJObject;
15+ wireNextHandle : JArrayI;
16+ wireHash2Handle : JArrayI;
17+ nextWireOffset : int;
18+ currentObject : JObject;
19+ currentClassDesc : JObject;
20+ classDescStack : JObject;
21+ enableReplace : byte;
22+ replaceObjects : JArrayJObject;
23+ nextReplaceOffset : int;
24+ recursionDepth : int;
25+ };
26+
27+ init : fn( jni_p : JNI );
28+ outputClassFields_rObject_rClass_aI_V : fn( this : JObject, p0 : JObject,p1 : JClass,p2 : JArrayI);
29+ outputArrayValues_rObject_rClass_V : fn( this : JObject, p0 : JObject,p1 : JClass);
30+ invokeObjectWriter_rObject_rClass_Z : fn( this : JObject, p0 : JObject,p1 : JClass) : int;
31+ getRefHashCode_rObject_I : fn( p0 : JObject) : int;
32+
33+};
java/pkg2/java/io/ObjectStreamClass.java+0−0

Empty file added.

java/pkg2/java/io/ObjectStreamClass_L.b+164−0
@@ -0,0 +1,164 @@
1+implement ObjectStreamClass_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ str : import jni;
28+ FALSE : import jni;
29+ TRUE : import jni;
30+#<<
31+
32+include "ObjectStreamClass_L.m";
33+
34+#>> extra post includes here
35+include "workdir.m";
36+include "regex.m";
37+str_mod : String;
38+Value : import jni;
39+cast : Cast;
40+#<<
41+
42+init( jni_p : JNI )
43+{
44+ # save java native inteface mod instance
45+ jni = jni_p;
46+ #>>extra initialization here
47+ sys = jni->sys;
48+ str_mod = jni->str;
49+ cast = jni->CastMod();
50+ #<<
51+}
52+
53+getClassAccess_rClass_I( p0 : JClass) : int
54+{#>>
55+ return (jni->GetClassFlags(p0) & JNI->ACC_WRITTEN_FLAGS);
56+}#<<
57+
58+getMethodSignatures_rClass_aString( p0 : JClass) : JArrayJString
59+{#>>
60+ # Return an array of Strings containing the method names and signatures.
61+ return (jni->GetMethodSignatures(p0, 0));
62+}#<<
63+
64+getMethodAccess_rClass_rString_I( p0 : JClass,p1 : JString) : int
65+{#>>
66+ return (jni->GetMethodFlags(p0, p1.str) & JNI->ACC_WRITTEN_FLAGS);
67+}#<<
68+
69+getFieldSignatures_rClass_aString( p0 : JClass) : JArrayJString
70+{#>>
71+ # Return an array of Strings containing the field names and signatures.
72+ return (jni->GetFieldSignatures(p0, 0));
73+}#<<
74+
75+getFieldAccess_rClass_rString_I( p0 : JClass,p1 : JString) : int
76+{#>>
77+ return (jni->GetFieldFlags(p0, p1.str) & JNI->ACC_WRITTEN_FLAGS);
78+}#<<
79+
80+getFields0_rClass_aObjectStreamField( this : ref ObjectStreamClass_obj, p0 : JClass) : JArrayJObject
81+{#>>
82+ #
83+ # Return an array of ObjectStreamField objects for each non-static and
84+ # non-transient field of the specified class. First find and load the
85+ # ObjectStreamField class.
86+ #
87+ junk := this;
88+ cl_data := jni->FindClass("java/io/ObjectStreamField");
89+ if (cl_data == nil)
90+ jni->FatalError("ObjectStreamClass could not load java/io/ObjectStreamField");
91+
92+ #
93+ # Get a list of all non-static and non transient fields of this class. If there are
94+ # non, jni->GetFieldSignatures() returns an array of length 0.
95+ #
96+ fields_n_sigs := jni->GetFieldSignatures(p0, (JNI->ACC_STATIC|JNI->ACC_TRANSIENT));
97+
98+ MyValueArray := array[4] of ref Value;
99+ MyObjectArray := array[len fields_n_sigs.ary] of JObject;
100+
101+ #
102+ # for each non-static and non-transient fields of this class...
103+ # call constructor for ObjectStreamField as follows
104+ # ObjectStreamField(n, sig, o, t)
105+ # where n is field name, sig is first byte of field signature
106+ # o is index into class field table and if sig != [ or L,
107+ # t is NULL. If sig is [ or L, t is signature.
108+ # For each of those constructors that are created, stuff them into
109+ # an array entry.
110+ #
111+ for (i:=0; i < len fields_n_sigs.ary; i++) {
112+ #
113+ # Each entry in fields_n_sigs.ary is of the format <name> <sig> where name is
114+ # the name of the field and signature is its full signature. Seperate them
115+ # out and format a call instruction to call the constructor for ObjectStreamField.
116+ #
117+ (name, full_sig) := str_mod->splitl((fields_n_sigs.ary[i]).str, " ");
118+ full_sig = full_sig[1:];
119+
120+ MyValueArray[0] = ref Value.TObject(cast->FromJString(jni->NewString(name)));
121+ MyValueArray[1] = ref Value.TChar(full_sig[0]);
122+ # NOT offset of field in object (but does it matter)???
123+ MyValueArray[2] = ref Value.TInt(i);
124+ if ((full_sig[0] == 'L') || (full_sig[0] == '['))
125+ MyValueArray[3] = ref Value.TObject(cast->FromJString(jni->NewString(full_sig)));
126+ else
127+ MyValueArray[3] = ref Value.TObject(nil);
128+
129+ jObj := jni->AllocObject(cl_data);
130+ (ret, ok) := jni->CallMethod(jObj, "<init>", "(Ljava/lang/String;CILjava/lang/String;)V", MyValueArray);
131+ if (ok != JNI->OK)
132+ jni->FatalError("ObjectStreamClass could not create ObjectStreamField");
133+ #
134+ # make an array of these created objects.
135+ #
136+ MyObjectArray[i] = jObj;
137+ }
138+ #
139+ # Finally, return the full array.
140+ #
141+ jary := jni->MkAObject(MyObjectArray);
142+ jary.class = cl_data;
143+ return jary;
144+}#<<
145+
146+getSerialVersionUID_rClass_J( p0 : JClass) : big
147+{#>>
148+ ret : big;
149+ val : ref Value;
150+ val = jni->GetStaticField(p0.class, "serialVersionUID", "J");
151+ if (val != nil)
152+ ret = val.Long();
153+ else
154+ ret = big 0;
155+ return ret;
156+}#<<
157+
158+hasWriteObject_rClass_Z( p0 : JClass) : int
159+{#>>
160+ if (jni->GetMethodFlags(p0, "writeObject (Ljava/io/ObjectOutputStream;)V") != 0)
161+ return JNI->TRUE;
162+ else
163+ return JNI->FALSE;
164+}#<<
java/pkg2/java/io/ObjectStreamClass_L.m+30−0
@@ -0,0 +1,30 @@
1+# generated file edit with care
2+
3+ObjectStreamClass_L : module
4+{
5+ ObjectStreamClass_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ name : JString;
9+ superclass : ref ObjectStreamClass_obj;
10+ serializable : byte;
11+ externalizable : byte;
12+ fields : JArrayJObject;
13+ ofClass : JClass;
14+ suid : big;
15+ fieldSequence : JArrayI;
16+ hasWriteObjectMethod : byte;
17+ localClassDesc : ref ObjectStreamClass_obj;
18+ };
19+
20+ init : fn( jni_p : JNI );
21+ getClassAccess_rClass_I : fn( p0 : JClass) : int;
22+ getMethodSignatures_rClass_aString : fn( p0 : JClass) : JArrayJString;
23+ getMethodAccess_rClass_rString_I : fn( p0 : JClass,p1 : JString) : int;
24+ getFieldSignatures_rClass_aString : fn( p0 : JClass) : JArrayJString;
25+ getFieldAccess_rClass_rString_I : fn( p0 : JClass,p1 : JString) : int;
26+ getFields0_rClass_aObjectStreamField : fn( this : ref ObjectStreamClass_obj, p0 : JClass) : JArrayJObject;
27+ getSerialVersionUID_rClass_J : fn( p0 : JClass) : big;
28+ hasWriteObject_rClass_Z : fn( p0 : JClass) : int;
29+
30+};
java/pkg2/java/io/ObjectStreamConstants.java+0−0

Empty file added.

java/pkg2/java/io/ObjectStreamException.java+0−0

Empty file added.

java/pkg2/java/io/ObjectStreamField.java+0−0

Empty file added.

java/pkg2/java/io/OptionalDataException.java+0−0

Empty file added.

java/pkg2/java/io/OutputStream.java+0−0

Empty file added.

java/pkg2/java/io/OutputStreamWriter.java+0−0

Empty file added.

java/pkg2/java/io/PipedInputStream.java+0−0

Empty file added.

java/pkg2/java/io/PipedOutputStream.java+0−0

Empty file added.

java/pkg2/java/io/PipedReader.java+0−0

Empty file added.

java/pkg2/java/io/PipedWriter.java+0−0

Empty file added.

java/pkg2/java/io/PrintStream.java+0−0

Empty file added.

java/pkg2/java/io/PrintWriter.java+0−0

Empty file added.

java/pkg2/java/io/PushbackInputStream.java+0−0

Empty file added.

java/pkg2/java/io/PushbackReader.java+0−0

Empty file added.

java/pkg2/java/io/RandomAccessFile.java+0−0

Empty file added.

java/pkg2/java/io/RandomAccessFile_L.b+190−0
@@ -0,0 +1,190 @@
1+implement RandomAccessFile_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ FALSE : import jni;
28+ TRUE : import jni;
29+include "FileDescriptor_L.m";
30+ FileDescriptor_obj : import FileDescriptor_L;
31+#<<
32+
33+include "RandomAccessFile_L.m";
34+
35+#>> extra post includes here
36+#<<
37+
38+init( jni_p : JNI )
39+{
40+ # save java native inteface mod instance
41+ jni = jni_p;
42+ #>>extra initialization here
43+ sys = jni->sys;
44+ #<<
45+}
46+
47+open_rString_Z_V( this : ref RandomAccessFile_obj, p0 : JString,p1 : int)
48+{#>>
49+ # p0 == file name
50+ # p1 == writable flag
51+
52+ if ((this.fd == nil) || (p0 == nil) || (p0.str == nil))
53+ jni->ThrowException("java.lang.NullPointerException", "null path name");
54+
55+ if (p1 == TRUE){
56+ this.fd.fd = sys->open(p0.str, sys->ORDWR);
57+ if(this.fd.fd == nil)
58+ this.fd.fd = sys->create(p0.str, Sys->ORDWR, 8r640);
59+ }
60+ else
61+ this.fd.fd = sys->open(p0.str, sys->OREAD);
62+
63+ if(this.fd.fd == nil)
64+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
65+}#<<
66+
67+read_I( this : ref RandomAccessFile_obj) : int
68+{#>>
69+ buf := array[1] of byte;
70+
71+ if ((this.fd == nil) || (this.fd.fd == nil))
72+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
73+
74+ readin := sys->read(this.fd.fd, buf, 1);
75+ if (readin == 0) # EOF
76+ return -1;
77+
78+ if (readin < 0)
79+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
80+ return (int buf[0]);
81+}#<<
82+
83+FD: import Sys;
84+stderr: ref FD;
85+readBytes_aB_I_I_I( this : ref RandomAccessFile_obj, p0 : JArrayB,p1 : int,p2 : int) : int
86+{#>>
87+ # p0 == buffer for read in data
88+ # p1 == offset in buffer to start to place data
89+ # p2 == amount of data to read in
90+
91+ if ((this.fd == nil) || (this.fd.fd == nil))
92+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
93+
94+ if ((p0 == nil) || (p0.ary == nil))
95+ jni->ThrowException("java.lang.NullPointerException", "null array");
96+
97+ if ((p1 < 0) || (p1 > len p0.ary))
98+ jni->ThrowException("java.lang.ArrayIndexOutOfBoundsException", nil);
99+
100+ if ((p1 + p2) > len p0.ary)
101+ p2 = (len p0.ary) - p1;
102+
103+ if (p2 <= 0)
104+ jni->ThrowException("java.lang.ArrayIndexOutOfBoundsException",
105+nil);
106+
107+ n := sys->read(this.fd.fd, p0.ary[p1:len p0.ary], p2);
108+ if (n == 0) # EOF
109+ return -1;
110+
111+ if (n < 0)
112+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
113+ return n;
114+}#<<
115+
116+write_I_V( this : ref RandomAccessFile_obj, p0 : int)
117+{#>>
118+ c := array[1] of byte;
119+ c[0] = byte p0;
120+
121+ if ((this.fd == nil) || (this.fd.fd == nil))
122+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
123+
124+ if (sys->write(this.fd.fd, c, 1) != 1)
125+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
126+}#<<
127+
128+writeBytes_aB_I_I_V( this : ref RandomAccessFile_obj, p0 : JArrayB,p1 : int,p2 : int)
129+{#>>
130+ # p0 == buffer array to write from
131+ # p1 == offset in buffer
132+ # p2 == amount to write out
133+
134+ if ((this.fd == nil) || (this.fd.fd == nil))
135+ jni->ThrowException("java.lang.NullPointerException", "null FileDescriptor");
136+ if ((p0 == nil) || (p0.ary == nil))
137+ jni->ThrowException("java.lang.NullPointerException", nil);
138+ if ((p1 < 0) || (p2 < 0) || (p1 + p2 > (len p0.ary)))
139+ jni->ThrowException("java.lang.ArrayIndexOutOfBoundsException", nil);
140+
141+ n := 0;
142+ while (p2 > 0) {
143+ n = sys->write(this.fd.fd, p0.ary[p1:len p0.ary], p2);
144+ if (n == -1) {
145+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
146+ break;
147+ }
148+ p1 += n;
149+ p2 -= n;
150+ }
151+}#<<
152+
153+getFilePointer_J( this : ref RandomAccessFile_obj) : big
154+{#>>
155+ if (this.fd == nil)
156+ jni->ThrowException("java.io.IOException", "this.fd nil");
157+ cur := sys->seek(this.fd.fd, 0, sys->SEEKRELA);
158+ if (cur < 0)
159+ jni->ThrowException("java.io.IOException", sys->sprint("%r"));
160+ return (big cur);
161+}#<<
162+
163+seek_J_V( this : ref RandomAccessFile_obj, p0 : big)
164+{#>>
165+ if (this.fd == nil)
166+ jni->ThrowException("java.io.IOException", "this.fd nil");
167+ sys->seek(this.fd.fd, (int p0), sys->SEEKSTART);
168+}#<<
169+
170+length_J( this : ref RandomAccessFile_obj) : big
171+{#>>
172+ if (this.fd == nil)
173+ jni->ThrowException("java.io.IOException", "this.fd nil");
174+ cur := sys->seek(this.fd.fd, 0, sys->SEEKRELA);
175+ end := sys->seek(this.fd.fd, 0, sys->SEEKEND);
176+ sys->seek(this.fd.fd, cur, sys->SEEKSTART);
177+
178+ return (big end);
179+}#<<
180+
181+close_V( this : ref RandomAccessFile_obj)
182+{#>>
183+ if (this.fd != nil)
184+ this.fd.fd = nil;
185+}#<<
186+
187+
188+
189+
190+
java/pkg2/java/io/RandomAccessFile_L.m+22−0
@@ -0,0 +1,22 @@
1+# javal v1.3 generated file: edit with care
2+
3+RandomAccessFile_L : module
4+{
5+ RandomAccessFile_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ fd : ref FileDescriptor_obj;
9+ };
10+
11+ init : fn( jni_p : JNI );
12+ open_rString_Z_V : fn( this : ref RandomAccessFile_obj, p0 : JString,p1 : int);
13+ read_I : fn( this : ref RandomAccessFile_obj) : int;
14+ readBytes_aB_I_I_I : fn( this : ref RandomAccessFile_obj, p0 : JArrayB,p1 : int,p2 : int) : int;
15+ write_I_V : fn( this : ref RandomAccessFile_obj, p0 : int);
16+ writeBytes_aB_I_I_V : fn( this : ref RandomAccessFile_obj, p0 : JArrayB,p1 : int,p2 : int);
17+ getFilePointer_J : fn( this : ref RandomAccessFile_obj) : big;
18+ seek_J_V : fn( this : ref RandomAccessFile_obj, p0 : big);
19+ length_J : fn( this : ref RandomAccessFile_obj) : big;
20+ close_V : fn( this : ref RandomAccessFile_obj);
21+
22+};
java/pkg2/java/io/Reader.java+0−0

Empty file added.

java/pkg2/java/io/SequenceInputStream.java+0−0

Empty file added.

java/pkg2/java/io/Serializable.java+0−0

Empty file added.

java/pkg2/java/io/StreamCorruptedExceptio.java+0−0

Empty file added.

java/pkg2/java/io/StreamTokenizer.java+0−0

Empty file added.

java/pkg2/java/io/StringBufferInputStream.java+0−0

Empty file added.

java/pkg2/java/io/StringReader.java+0−0

Empty file added.

java/pkg2/java/io/StringWriter.java+0−0

Empty file added.

java/pkg2/java/io/SyncFailedException.java+0−0

Empty file added.

java/pkg2/java/io/UTFDataFormatException.java+0−0

Empty file added.

java/pkg2/java/io/UnsupportedEncodingExce.java+0−0

Empty file added.

java/pkg2/java/io/WriteAbortedException.java+0−0

Empty file added.

java/pkg2/java/io/Writer.java+0−0

Empty file added.

java/pkg2/java/io/mkfile+150−0
@@ -0,0 +1,150 @@
1+<../../../../mkconfig
2+
3+TARG=\
4+ BufferedInputStream.dis\
5+ BufferedOutputStream.dis\
6+ BufferedReader.dis\
7+ BufferedWriter.dis\
8+ ByteArrayInputStream.dis\
9+ ByteArrayOutputStream.dis\
10+ CharArrayReader.dis\
11+ CharArrayWriter.dis\
12+# for CharConversionException.dis\
13+ oF8WXXue0VYZof82fzj4L.dis\
14+ DataInput.dis\
15+ DataInputStream.dis\
16+ DataOutput.dis\
17+ DataOutputStream.dis\
18+ EOFException.dis\
19+ Externalizable.dis\
20+ File.dis\
21+ FileDescriptor.dis\
22+ FileInputStream.dis\
23+ FileNotFoundException.dis\
24+ FileOutputStream.dis\
25+ FileReader.dis\
26+ FileWriter.dis\
27+ FilenameFilter.dis\
28+ FilterInputStream.dis\
29+ FilterOutputStream.dis\
30+ FilterReader.dis\
31+ FilterWriter.dis\
32+ IOException.dis\
33+ InputStream.dis\
34+ InputStreamReader.dis\
35+# for InterruptedIOException.dis\
36+ Udmf2Su14O7L1V-QzaTq3.dis\
37+ InvalidClassException.dis\
38+# for InvalidObjectException.dis\
39+ PjqhaWOg4nDK5hla7XFmv.dis\
40+ LineNumberInputStream.dis\
41+ LineNumberReader.dis\
42+ NotActiveException.dis\
43+# for NotSerializableException.dis\
44+ YBCI4zMUNV+Uc45idEPcv.dis\
45+ ObjectInput.dis\
46+ ObjectInputStream.dis\
47+ ObjectInputValidation.dis\
48+ ObjectOutput.dis\
49+ ObjectOutputStream.dis\
50+ ObjectStreamClass.dis\
51+# for ObjectStreamClassEntry.dis\
52+ 6T1LdH4wdbOUJeqUfASeI.dis\
53+ ObjectStreamConstants.dis\
54+ ObjectStreamException.dis\
55+ ObjectStreamField.dis\
56+ OptionalDataException.dis\
57+ OutputStream.dis\
58+ OutputStreamWriter.dis\
59+ PipedInputStream.dis\
60+ PipedOutputStream.dis\
61+ PipedReader.dis\
62+ PipedWriter.dis\
63+ PrintStream.dis\
64+ PrintWriter.dis\
65+ PushbackInputStream.dis\
66+ PushbackReader.dis\
67+ RandomAccessFile.dis\
68+ Reader.dis\
69+ SequenceInputStream.dis\
70+ Serializable.dis\
71+# for StreamCorruptedException.dis\
72+ 7Ev9-si8zsgglOEBSxbM3.dis\
73+ StreamTokenizer.dis\
74+# for StringBufferInputStream.dis\
75+ O+cE9tcuJ1-znyckKtvEt.dis\
76+ StringReader.dis\
77+ StringWriter.dis\
78+ SyncFailedException.dis\
79+# for UTFDataFormatException.dis\
80+ VgQ9w-N7w2YXJglmrtjzJ.dis\
81+# for UnsupportedEncodingException.dis\
82+ 34nQVDtVtK+3NDDpbkN7j.dis\
83+ ValidationCallback.dis\
84+ WriteAbortedException.dis\
85+ Writer.dis\
86+# Limbo code\
87+ FileDescriptor_L.dis\
88+ FileInputStream_L.dis\
89+ FileOutputStream_L.dis\
90+ File_L.dis\
91+ ObjectInputStream_L.dis\
92+ ObjectOutputStream_L.dis\
93+ ObjectStreamClass_L.dis\
94+ RandomAccessFile_L.dis\
95+
96+MODULES=\
97+ $ROOT/java/module/classloader.m\
98+ $ROOT/java/module/jni.m\
99+ $ROOT/java/module/cast.m\
100+ FileDescriptor_L.m\
101+ FileInputStream_L.m\
102+ FileOutputStream_L.m\
103+ File_L.m\
104+ ObjectInputStream_L.m\
105+ ObjectOutputStream_L.m\
106+ ObjectStreamClass_L.m\
107+ RandomAccessFile_L.m\
108+
109+SYSMODULES=\
110+ draw.m\
111+ hash.m\
112+ keyring.m\
113+ loader.m\
114+ math.m\
115+ string.m\
116+ sys.m\
117+
118+DISBIN=$ROOT/java/dis/java/java/io
119+
120+<$ROOT/mkfiles/mkjava
121+
122+oF8WXXue0VYZof82fzj4L.dis: CharConversionException.class
123+ j2d CharConversionException.class
124+
125+Udmf2Su14O7L1V-QzaTq3.dis: InterruptedIOException.class
126+ j2d InterruptedIOException.class
127+
128+PjqhaWOg4nDK5hla7XFmv.dis: InvalidObjectException.class
129+ j2d InvalidObjectException.class
130+
131+YBCI4zMUNV+Uc45idEPcv.dis: NotSerializableException.class
132+ j2d NotSerializableException.class
133+
134+6T1LdH4wdbOUJeqUfASeI.dis: ObjectStreamClass.class
135+ j2d ObjectStreamClassEntry.class
136+
137+7Ev9-si8zsgglOEBSxbM3.dis: StreamCorruptedException.class
138+ j2d StreamCorruptedException.class
139+
140+O+cE9tcuJ1-znyckKtvEt.dis: StringBufferInputStream.class
141+ j2d StringBufferInputStream.class
142+
143+VgQ9w-N7w2YXJglmrtjzJ.dis: UTFDataFormatException.class
144+ j2d UTFDataFormatException.class
145+
146+34nQVDtVtK+3NDDpbkN7j.dis: UnsupportedEncodingException.class
147+ j2d UnsupportedEncodingException.class
148+
149+ValidationCallback.dis: ObjectInputStream.class
150+ j2d ValidationCallback.class
java/pkg2/java/lang/AbstractMethodError.java+0−0

Empty file added.

java/pkg2/java/lang/ArithmeticException.java+0−0

Empty file added.

java/pkg2/java/lang/ArrayIndexOutOfBoundsException.java+0−0

Empty file added.

java/pkg2/java/lang/ArrayStoreException.java+0−0

Empty file added.

java/pkg2/java/lang/Boolean.java+0−0

Empty file added.

java/pkg2/java/lang/Byte.java+0−0

Empty file added.

java/pkg2/java/lang/Character.java+0−0

Empty file added.

java/pkg2/java/lang/Character_L.b+63−0
@@ -0,0 +1,63 @@
1+implement Character_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#<<
28+
29+include "Character_L.m";
30+
31+#>> extra post includes here
32+
33+include "unicode_table.m";
34+
35+unicode_table : UnicodeTable;
36+ A,
37+ Y,
38+ X : import unicode_table;
39+
40+#<<
41+
42+init( jni_p : JNI )
43+{
44+ # save java native inteface mod instance
45+ jni = jni_p;
46+ #>>extra initialization here
47+ #<<
48+}
49+
50+lookup_C_I( p0 : int) : int
51+{#>>
52+ if ( unicode_table == nil )
53+ loadtable();
54+
55+ return( A[Y[(X[p0>>6]<<6)|(p0& 16r3F)]] );
56+}#<<
57+
58+loadtable()
59+{
60+ unicode_table = load UnicodeTable UnicodeTable->PATH;
61+ if ( unicode_table == nil )
62+ jni->InitError( jni->sys->sprint( "java.lang.Character: could not load %s: %r", UnicodeTable->PATH ) );
63+}
java/pkg2/java/lang/Character_L.m+14−0
@@ -0,0 +1,14 @@
1+# javal v1.3 generated file: edit with care
2+
3+Character_L : module
4+{
5+ Character_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ value : int;
9+ };
10+
11+ init : fn( jni_p : JNI );
12+ lookup_C_I : fn( p0 : int) : int;
13+
14+};
java/pkg2/java/lang/Class.java+0−0

Empty file added.

java/pkg2/java/lang/ClassCastException.java+0−0

Empty file added.

java/pkg2/java/lang/ClassCircularityError.java+0−0

Empty file added.

java/pkg2/java/lang/ClassFormatError.java+0−0

Empty file added.

java/pkg2/java/lang/ClassLoader.java+0−0

Empty file added.

java/pkg2/java/lang/ClassLoader_L.b+82−0
@@ -0,0 +1,82 @@
1+implement ClassLoader_L;
2+
3+# javal v1.2 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JObject : import jni;
23+
24+#>> extra pre includes here
25+
26+#<<
27+
28+include "ClassLoader_L.m";
29+
30+#>> extra post includes here
31+
32+#<<
33+
34+init( jni_p : JNI )
35+{
36+ # save java native inteface mod instance
37+ jni = jni_p;
38+ #>>extra initialization here
39+ #<<
40+}
41+
42+init_V( this : ref ClassLoader_obj)
43+{#>>
44+ junk := this;
45+}#<<
46+
47+defineClass0_rString_aB_I_I_rClass( this : ref ClassLoader_obj, p0 : JString,p1 : JArrayB,p2 : int,p3 : int) : JClass
48+{#>>
49+ junk := (this,p0,p1,p2,p3);
50+ jni->ThrowException( "java.lang.ClassNotFoundException", "not implemented" );
51+ return( nil );
52+}#<<
53+
54+resolveClass0_rClass_V( this : ref ClassLoader_obj, p0 : JClass)
55+{#>>
56+ junk := (this,p0);
57+ jni->FatalError( "resolveClass() not implemented" );
58+}#<<
59+
60+findSystemClass0_rString_rClass( this : ref ClassLoader_obj, p0 : JString) : JClass
61+{#>>
62+ junk := (this,p0);
63+ jni->FatalError( "findSystemClass() not implemented" );
64+ return( nil );
65+}#<<
66+
67+getSystemResourceAsStream0_rString_rInputStream( p0 : JString) : JObject
68+{#>>
69+ junk := p0;
70+ jni->FatalError( "getSystemResourceAsStream() not implemented" );
71+ return( nil );
72+}#<<
73+
74+getSystemResourceAsName0_rString_rString( p0 : JString) : JString
75+{#>>
76+ junk := p0;
77+ jni->FatalError( "getSystemResourceAsName() not implemented" );
78+ return( nil );
79+}#<<
80+
81+
82+
java/pkg2/java/lang/ClassLoader_L.m+20−0
@@ -0,0 +1,20 @@
1+# javal v1.2 generated file: edit with care
2+
3+ClassLoader_L : module
4+{
5+ ClassLoader_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ initialized : int;
9+ classes : JObject;
10+ };
11+
12+ init : fn( jni_p : JNI );
13+ init_V : fn( this : ref ClassLoader_obj);
14+ defineClass0_rString_aB_I_I_rClass : fn( this : ref ClassLoader_obj, p0 : JString,p1 : JArrayB,p2 : int,p3 : int) : JClass;
15+ resolveClass0_rClass_V : fn( this : ref ClassLoader_obj, p0 : JClass);
16+ findSystemClass0_rString_rClass : fn( this : ref ClassLoader_obj, p0 : JString) : JClass;
17+ getSystemResourceAsStream0_rString_rInputStream : fn( p0 : JString) : JObject;
18+ getSystemResourceAsName0_rString_rString : fn( p0 : JString) : JString;
19+
20+};
java/pkg2/java/lang/ClassNotFoundException.java+0−0

Empty file added.

java/pkg2/java/lang/Class_L.b+778−0
@@ -0,0 +1,778 @@
1+implement Class_L;
2+
3+# javal v1.2 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JObject : import jni;
23+
24+#>> extra pre includes here
25+
26+ jldr : JavaClassLoader;
27+ cast : Cast;
28+
29+#<<
30+
31+include "Class_L.m";
32+
33+#>> extra post includes here
34+
35+ ClassData,
36+ Value : import jni;
37+
38+include "reflect/reflect.m";
39+ refl : Reflect;
40+
41+#<<
42+
43+init( jni_p : JNI )
44+{
45+ # save java native inteface mod instance
46+ jni = jni_p;
47+ #>>extra initialization here
48+ jldr = jni->jldr;
49+ cast = jni->CastMod();
50+ #<<
51+}
52+
53+forName_rString_rClass( p0 : JString) : JClass
54+{#>>
55+ e := ref Sys->Exception;
56+ if (jni->sys->rescue("JLD:e0*", e) == Sys->HANDLER)
57+ {
58+ if ( p0.str != nil && p0.str[0] == '[' )
59+ return( jni->LookupArrayClass(p0.str) );
60+ else
61+ return( jni->GetClassObject( jni->FindClass(p0.str) ) );
62+ }
63+
64+ jni->sys->rescued(Sys->ONCE, nil);
65+ # turn into a ClassNotFoundException
66+ jni->ThrowException( "java.lang.ClassNotFoundException", p0.str );
67+ return(nil);
68+}#<<
69+
70+newInstance_rObject( this : JClass) : JObject
71+{#>>
72+ if ( this.class.flags & (JNI->ACC_INTERFACE | JNI->ACC_ABSTRACT) ) {
73+ s : string;
74+ if ( isPrimitive_Z(this) == JNI->TRUE )
75+ s = this.class.name[len "inferno/vm/":len this.class.name - 2];
76+ else if ( this.aryname != nil )
77+ s = this.aryname;
78+ else
79+ s = this.class.name;
80+ jni->ThrowException( "java.lang.InstantiationException", s );
81+ }
82+ # create new object for the given class
83+ return( jni->NewObject(this.class) );
84+}#<<
85+
86+isInstance_rObject_Z( this : JClass, p0 : JObject) : int
87+{#>>
88+ return( jni->IsInstanceOf( p0, this.class ) );
89+}#<<
90+
91+isAssignableFrom_rClass_Z( this : JClass, p0 : JClass) : int
92+{#>>
93+ return( jni->IsAssignable( p0, this ) );
94+}#<<
95+
96+isInterface_Z( this : JClass) : int
97+{#>>
98+ return( this.class.flags & JNI->ACC_INTERFACE );
99+}#<<
100+
101+isArray_Z( this : JClass) : int
102+{#>>
103+ return( this.class.name == "inferno/vm/Array" );
104+}#<<
105+
106+isPrimitive_Z( this : JClass) : int
107+{#>>
108+ ret : int;
109+ if ( jni->PrimitiveIndex(this, 0) > 0 )
110+ ret = JNI->TRUE;
111+ else
112+ ret = JNI->FALSE;
113+ return ret;
114+}#<<
115+
116+getName_rString( this : JClass) : JString
117+{#>>
118+ name : string;
119+ if ( isPrimitive_Z(this) == JNI->TRUE )
120+ {
121+ # mk primitive name from a slice
122+ name = this.class.name[len "inferno/vm/":len this.class.name - 2];
123+ }
124+ else
125+ {
126+ if ( this.aryname != nil )
127+ {
128+ name = this.aryname;
129+ }
130+ else
131+ {
132+ name = this.class.name;
133+ }
134+ # change slashes to dots
135+ for ( i := 0; i < len name; i++ )
136+ if ( name[i] == '/' )
137+ name[i] = '.';
138+ }
139+ return( jni->NewString( name ) );
140+}#<<
141+
142+getClassLoader_rClassLoader( this : JClass) : JObject
143+{#>>
144+ junk := (this);
145+ jni->FatalError( "getClassLoader() not implemented" );
146+ return(nil);
147+}#<<
148+
149+getSuperclass_rClass( this : JClass) : JClass
150+{#>>
151+ if ( isPrimitive_Z(this) == JNI->TRUE
152+ || this.class.flags & JNI->ACC_INTERFACE )
153+ return nil;
154+ if ( (superclass := jni->GetSuperclass(this.class)) == nil )
155+ return nil;
156+ return( jni->GetClassObject( superclass ) );
157+}#<<
158+
159+getInterfaces_aClass( this : JClass) : JArrayJClass
160+{#>>
161+ n : int;
162+ # kludge for arrays to be consistent with JavaSoft's VM
163+ if ( isArray_Z(this) )
164+ n = 0;
165+ else
166+ n = len this.class.interdirect;
167+ interface := array [n] of JObject;
168+ il := this.class.interdirect;
169+ for (i := n-1; i >= 0; i--) {
170+ interface[i] = cast->FromJClass(jni->GetClassObject(hd il));
171+ il = tl il;
172+ }
173+ classarray := cast->JArrayToClass(cast->ObjectToJArray(jni->MkAObject(interface)));
174+ classarray.class = jni->FindClass("java/lang/Class");
175+ return classarray;
176+}#<<
177+
178+getComponentType_rClass(this : JClass) : JClass
179+{#>>
180+ if(this == nil || this.aryname == nil)
181+ return nil;
182+
183+ name : string;
184+ c := this.aryname[1];
185+ if(c == '[') {
186+ return jni->LookupArrayClass(this.aryname[1:]);
187+ } else {
188+ if(c == 'L') {
189+ name = this.aryname[2:len this.aryname - 1];
190+ } else {
191+ getReflect();
192+ name = "inferno/vm/" + refl->TypeCharToName(c) + "_p";
193+ }
194+ return jni->GetClassObject(jni->FindClass(name));
195+ }
196+}#<<
197+
198+getModifiers_I( this : JClass) : int
199+{#>>
200+ return( this.class.flags & (~ JNI->ACC_SYNCHRONIZED));
201+}#<<
202+
203+getSigners_aObject( this : JClass) : JArrayJObject
204+{#>>
205+ junk := (this);
206+ jni->FatalError( "getSigners() not implemented" );
207+ return(nil);
208+}#<<
209+
210+setSigners_aObject_V( this : JClass, p0 : JArrayJObject)
211+{#>>
212+ junk := (this,p0);
213+ jni->FatalError( "setSigners() not implemented" );
214+}#<<
215+
216+getPrimitiveClass_rString_rClass( p0 : JString) : JClass
217+{#>>
218+ e := ref Sys->Exception;
219+ if (jni->sys->rescue("JLD:e0*", e) == Sys->HANDLER)
220+ {
221+ return( jni->GetClassObject(jni->FindClass("inferno/vm/"+ p0.str +"_p")) );
222+ }
223+ return(nil);
224+}#<<
225+
226+getFields0_I_aField( this : JClass, p0 : int) : JArrayJObject
227+{#>>
228+# 'this' represents the class whose fields are wanted.
229+# p0 == 0 for PUBLIC members (includes inherited members)
230+# p0 == 1 for DECLARED members (All members but not inherited members)
231+
232+ objs : list of JObject;
233+ if ( !isArray_Z(this) )
234+ objs = getFields(this, p0);
235+
236+ obj_array := array[len objs] of JObject;
237+ for ( i := 0; objs != nil ; i++ ) {
238+ obj_array[i] = hd objs;
239+ objs = tl objs;
240+ }
241+
242+ fieldarray := jni->MkAObject(obj_array);
243+ fieldarray.class = jni->FindClass("java/lang/reflect/Field");
244+ return fieldarray;
245+}#<<
246+
247+getMethods0_I_aMethod( this : JClass, p0 : int) : JArrayJObject
248+{#>>
249+# 'this' represents the class whose methods are wanted.
250+# p0 == 0 for PUBLIC members (includes inherited members)
251+# p0 == 1 for DECLARED members (All members but not inherited members)
252+
253+ objs : list of JObject;
254+
255+ # if primitive or interface, filter out java.lang.Object methods
256+ if ( isPrimitive_Z(this) == JNI->TRUE
257+ || this.class.flags & JNI->ACC_INTERFACE )
258+ p0 = 1;
259+ objs = getMethods(this, p0);
260+
261+ obj_array := array[len objs] of JObject;
262+ for ( i := 0; objs != nil ; i++ ) {
263+ obj_array[i] = hd objs;
264+ objs = tl objs;
265+ }
266+
267+ methodarray := jni->MkAObject(obj_array);
268+ methodarray.class = jni->FindClass("java/lang/reflect/Method");
269+ return methodarray;
270+}#<<
271+
272+getConstructors0_I_aConstructor( this : JClass, p0 : int) : JArrayJObject
273+{#>>
274+# 'this' represents the class whose constructors are wanted.
275+# p0 == 0 for PUBLIC members (includes inherited members)
276+# p0 == 1 for DECLARED members (All members but not inherited members)
277+
278+ objs : list of JObject;
279+ if ( isPrimitive_Z(this) == JNI->FALSE && !isArray_Z(this) )
280+ objs = getConstructors(this, p0);
281+
282+ obj_array := array[len objs] of JObject;
283+ for ( i := 0; objs != nil ; i++ ) {
284+ obj_array[i] = hd objs;
285+ objs = tl objs;
286+ }
287+
288+ constructorarray := jni->MkAObject(obj_array);
289+ constructorarray.class = jni->FindClass("java/lang/reflect/Constructor");
290+ return constructorarray;
291+}#<<
292+
293+getField0_rString_I_rField( this : JClass, p0 : JString,p1 : int) : JObject
294+{#>>
295+# 'this' represents the class for which a Field is desired.
296+# p0 is the name of the field.
297+# p1 == 0 for PUBLIC members (includes inherited members)
298+# p1 == 1 for DECLARED members (All members but not inherited members)
299+
300+ staticfields := this.class.staticdata;
301+ flg : int;
302+ fld : ref jldr->Field;
303+ for ( i := 0; i < len staticfields; i++ ) {
304+ fld = staticfields[i];
305+ flg = fld.flags;
306+ if ( fld.field == p0.str &&
307+ (p1 != 0 || (flg & JNI->ACC_PUBLIC) != 0) )
308+ break;
309+ }
310+ if ( i >= len staticfields ) { # Not a public static field
311+ super : list of ref jldr->Field = nil;
312+ if ( (superclass := jni->GetSuperclass(this.class)) != nil &&
313+ superclass != this.class )
314+ super = superclass.objectdata;
315+ objfields := this.class.objectdata;
316+ for ( i = 0; objfields != nil; i++ ) {
317+ if ( p1 == 1 && objfields == super ) # exclude inherited
318+ break;
319+ fld = hd objfields;
320+ flg = fld.flags;
321+ if ( fld.field == p0.str &&
322+ (p1 != 0 || (flg & JNI->ACC_PUBLIC) != 0) )
323+ break;
324+ objfields = tl objfields;
325+ }
326+ if ( objfields == super || objfields == nil )
327+ i = len staticfields + len this.class.objectdata;
328+ }
329+ if ( i >= len staticfields + len this.class.objectdata ) {
330+ jni->ThrowException("java/lang/NoSuchFieldException", "");
331+ return nil;
332+ }
333+ return makeField(this, fld, i);
334+}#<<
335+
336+getMethod0_rString_aClass_I_rMethod( this : JClass, p0 : JString,p1 : JArrayJClass,p2 : int) : JObject
337+{#>>
338+# 'this' represents the class for which a Method is desired.
339+# p0 is the name of the method.
340+# p1 is a Java array of Class objects, corresponding to the formal parameters
341+# of the method for which a Method object is desired. The array
342+# is used to construct a signature string which can be matched against
343+# data compiled by the classloader.
344+# p2 == 0 for PUBLIC members (includes inherited members)
345+# p2 == 1 for DECLARED members (All members but not inherited members)
346+
347+ signatur := "(" + MakeSignature(p1) + ")";
348+
349+ methods := this.class.staticmethods;
350+ for ( i := 0; i < len methods; i++ ) {
351+ fld := methods[i];
352+ if ( fld.field == p0.str && jni->str->prefix(signatur, fld.signature) &&
353+ (p2 != 0 || (fld.flags & JNI->ACC_PUBLIC) != 0) )
354+ return makeMethod(this, fld, i, p1, fld.signature[len signatur:]);
355+ }
356+ methods = this.class.privatemethods;
357+ for ( i = 0; i < len methods; i++ ) {
358+ fld := methods[i];
359+ if ( fld.field == p0.str && jni->str->prefix(signatur, fld.signature) &&
360+ (p2 != 0 || (fld.flags & JNI->ACC_PUBLIC) != 0) )
361+ return makeMethod(this, fld, i, p1, fld.signature[len signatur:]);
362+ }
363+ vmethods := this.class.virtualmethods;
364+ for ( i = 0; i < len vmethods; i++ ) {
365+ fld := vmethods[i].field;
366+ if ( fld.field == p0.str && jni->str->prefix(signatur, fld.signature) &&
367+ ((p2 != 0 && this.class == vmethods[i].class)
368+ || (fld.flags & JNI->ACC_PUBLIC) != 0) ) {
369+ if ( vmethods[i].class != this.class )
370+ this = jni->GetClassObject(vmethods[i].class);
371+ return makeMethod(this, fld, i, p1, fld.signature[len signatur:]);
372+ }
373+ }
374+ jni->ThrowException("java/lang/NoSuchMethodException", "");
375+ return nil;
376+}#<<
377+
378+getConstructor0_aClass_I_rConstructor( this : JClass, p0 : JArrayJClass,p1 : int) : JObject
379+{#>>
380+# 'this' represents the class for which a Constructor is desired.
381+# p0 is a Java array of Class objects, corresponding to the formal parameters
382+# of the constructor for which a Constructor object is desired. The array
383+# is used to construct a signature string which can be matched against
384+# data compiled by the classloader.
385+# p1 == 0 for PUBLIC members (includes inherited members)
386+# p1 == 1 for DECLARED members (All members but not inherited members)
387+
388+ signatur := "(" + MakeSignature(p0) + ")";
389+
390+ initmethods := this.class.initmethods;
391+ flg : int;
392+ fld : ref jldr->Field;
393+ for ( i := 0; i < len initmethods; i++ ) {
394+ fld = initmethods[i];
395+ flg = fld.flags;
396+ if ( jni->str->prefix(signatur, fld.signature) &&
397+ (p1 != 0 || (flg & JNI->ACC_PUBLIC) != 0) )
398+ break;
399+ }
400+ if ( i >= len initmethods ) {
401+ jni->ThrowException("java/lang/NoSuchMethodException", "");
402+ return nil;
403+ }
404+ return makeMethod(this, fld, i, p0, nil);
405+}#<<
406+
407+#
408+# getPublicStaticFields() and doInterfaces() are helper
409+# functions for getFields().
410+#
411+
412+#
413+# Return list of public static fields of this class.
414+#
415+
416+getPublicStaticFields(this : JClass, objs : list of JObject) : list of JObject
417+{
418+ flds := this.class.staticdata;
419+ for ( i := len flds - 1; i >= 0; i-- )
420+ if ( (flds[i].flags & JNI->ACC_PUBLIC) != 0 )
421+ objs = makeField(this, flds[i], i) :: objs;
422+ return objs;
423+}
424+
425+#
426+# Recursively (for superinterfaces) call getPublicStaticFields()
427+# on interfaces of this class.
428+#
429+
430+ifacelist: list of JClass;
431+
432+doInterfaces(this : JClass, objs : list of JObject) : list of JObject
433+{
434+ ifaces := this.class.interfaces;
435+outer: for ( i := 0; i < len ifaces; i++ ) {
436+ iface := jni->GetClassObject(ifaces[i].class);
437+ for ( l := ifacelist; l != nil; l = tl l )
438+ if ( hd l == iface )
439+ continue outer;
440+ ifacelist = iface :: ifacelist;
441+ objs = getPublicStaticFields(iface, objs);
442+ objs = doInterfaces(iface, objs);
443+ }
444+ return objs;
445+}
446+
447+#
448+# A helper function that gets fields for the class represented
449+# by this. p0 == 0 => PUBLIC fields, p0 == 1 => DECLARED fields.
450+# Candidate fields are found in the loader array staticdata (for
451+# static fields) and list objectdata (for instance fields).
452+#
453+
454+getFields(this : JClass, p0 : int) : list of JObject
455+{
456+ objs : list of JObject;
457+
458+ # get instance fields
459+ objdata := this.class.objectdata;
460+ flds := array[len objdata] of ref jldr->Field;
461+ super : list of ref jldr->Field = nil;
462+ if ( (superclass := jni->GetSuperclass(this.class)) != nil )
463+ super = superclass.objectdata;
464+ for ( i := 0; objdata != nil; i++ ) {
465+ if ( p0 == 1 && objdata == super )
466+ break;
467+ flds[i] = hd objdata;
468+ objdata = tl objdata;
469+ }
470+ # need to associate declaring class with each instance field ???
471+ for ( i--; i >= 0; i-- )
472+ if ( p0 != 0 || (flds[i].flags & JNI->ACC_PUBLIC) != 0 )
473+ objs = makeField(this, flds[i], i) :: objs;
474+
475+ # get class fields of this class
476+ flds = this.class.staticdata;
477+ for ( i = len flds - 1; i >= 0; i-- )
478+ if ( p0 != 0 || (flds[i].flags & JNI->ACC_PUBLIC) != 0 )
479+ objs = makeField(this, flds[i], i) :: objs;
480+
481+ # get class fields of super classes and interfaces
482+ if ( p0 == 0 ) {
483+ ifacelist = nil;
484+ objs = doInterfaces(this, objs);
485+ curclass := this;
486+ while ( ( curclass = getSuperclass_rClass(curclass) ) != nil ) {
487+ objs = getPublicStaticFields(curclass, objs);
488+ objs = doInterfaces(curclass, objs);
489+ }
490+ }
491+
492+ return objs;
493+}
494+#
495+# A helper function that gets methods for the class represented
496+# by this. p0 == 0 => PUBLIC methods, p0 == 1 => DECLARED methods.
497+# Candidate methods are found in the loader arrays staticmethods (for
498+# class methods), privatemethods (for methods private to this
499+# particular class), and virtualmethods (public instance methods of
500+# this class and all its superclasses).
501+#
502+getMethods(this : JClass, p0 : int) : list of JObject
503+{
504+ objs : list of JObject;
505+
506+ getReflect();
507+
508+ flds := this.class.staticmethods;
509+ for ( i := 0; i < len flds; i++ )
510+ if ( p0 != 0 || (flds[i].flags & JNI->ACC_PUBLIC) != 0 )
511+ objs = makeAMethod(this, flds[i], i) :: objs;
512+
513+ if ( p0 != 0 ) {
514+ flds = this.class.privatemethods;
515+ for ( i = len flds - 1; i >= 0; i-- )
516+ objs = makeAMethod(this, flds[i], i) :: objs;
517+ }
518+
519+ vflds := this.class.virtualmethods;
520+ for ( i = len vflds - 1; i >= 0; i-- )
521+ if ( (p0 == 1 && vflds[i].class == this.class) # declared, this class
522+ || ( p0 == 0 && (vflds[i].field.flags & JNI->ACC_PUBLIC) != 0 ) ) {
523+ if ( vflds[i].class != this.class )
524+ this = jni->GetClassObject(vflds[i].class);
525+ objs = makeAMethod(this, vflds[i].field, i) :: objs;
526+ }
527+
528+ return objs;
529+}
530+#
531+# A helper function that gets constructors for the class represented
532+# by this. p0 == 0 => PUBLIC constructors, p0 == 1 => DECLARED
533+# constructors. Candidate constructors are found in the loader
534+# array initmethods.
535+#
536+getConstructors(this : JClass, p0 : int) : list of JObject
537+{
538+ objs : list of JObject;
539+
540+ getReflect();
541+
542+ flds := this.class.initmethods;
543+ for ( i := len flds - 1; i >= 0; i-- )
544+ if ( p0 != 0 || (flds[i].flags & JNI->ACC_PUBLIC) != 0 )
545+ objs = makeAMethod(this, flds[i], i) :: objs;
546+
547+ return objs;
548+}
549+#
550+# Make sure Reflect module is loaded.
551+#
552+getReflect()
553+{
554+ if ( refl == nil ) {
555+ refl = load Reflect Reflect->PATH;
556+ if ( refl == nil )
557+ jni->InitError( jni->sys->sprint( "java.lang.Class: could not load %s: %r", Reflect->PATH ) );
558+ else
559+ refl->init(jni);
560+ }
561+}
562+#
563+# Construct a Field Object. The field is a member of the class
564+# represented by this, and the loader data for the field is in fld,
565+# which is at offset ix in the appropriate array or list. The 'slot'
566+# elements of a Field_obj adt is used only by native methods, and has
567+# the fields modifier flags in the low-order 16 bits, and the index
568+# into the array/list in the upper 16 bits. (The index into what
569+# depends on the modifier flags.)
570+#
571+makeField(this : JClass, fld : ref jldr->Field, ix : int) : JObject
572+{
573+ getReflect();
574+ fldobj := jni->AllocObject(jni->FindClass("java/lang/reflect/Field"));
575+
576+ clazz := ref Value.TObject(cast->FromJClass(this));
577+ jni->SetObjField(fldobj, "clazz", clazz);
578+
579+ name := ref Value.TObject(cast->FromJString(jni->NewString(fld.field)));
580+ jni->SetObjField(fldobj, "name", name);
581+
582+ class : ref Value;
583+ if ( (typ := refl->SigToType(fld.signature)) > 0 )
584+ class = refl->GetPrimitiveClass(typ);
585+ else {
586+ classname := fld.signature[1:len fld.signature - 1];
587+ class = ref Value.TObject(cast->FromJClass(
588+ jni->GetClassObject(jni->FindClass(classname))));
589+ }
590+ jni->SetObjField(fldobj, "type", class);
591+
592+ slot := ref Value.TInt((fld.flags & 16rffff) | (ix << 16));
593+ jni->SetObjField(fldobj, "slot", slot);
594+
595+ return fldobj;
596+}
597+#
598+# Make a new Method/Constructor object for a method or constructor in
599+# the class this. The loader information for the method/constructor is
600+# found in the loader Field adt fld, which is at offset ix in its
601+# array or list. The signature for the arguments is converted into
602+# a corresponding array of Class objects by makeParamClassArray, then
603+# makeMethod is called to generate the new object.
604+#
605+makeAMethod(this: JClass, fld : ref jldr->Field, ix : int) : JObject
606+{
607+ (sig, retsig) := jni->str->splitr(fld.signature, ")");
608+ objectarray := makeParamClassArray(sig);
609+
610+ classarray := cast->JArrayToClass(cast->ObjectToJArray(objectarray));
611+ return makeMethod(this, fld, ix, classarray, retsig);
612+}
613+#
614+# Construct a Method Object. Also used to make Constructor Objects,
615+# share several elements with Methods. The two can be distinguished
616+# because constructors have the name "<init>" (however, Constructor
617+# Objects do not have a 'name' field, nor do they have a 'returnType'
618+# field. The 'slot' field, which is only used by native methods,
619+# is filled with modifier flags in the lower 16 bits and an index (ix)
620+# into an appropriate loader array/list in the upper 16 bits (which
621+# array can be determined by the modifier flags. ). The arguments
622+# types required by the method are specified by the cl array of
623+# Class ofjects. The return value, if any, is specified by the
624+# signature given in retsig.
625+#
626+makeMethod(this: JClass, fld : ref jldr->Field, ix : int, cl : JArrayJClass,
627+ retsig : string) : JObject
628+{
629+ mcl : ClassData;
630+ isConstructor := 0;
631+ if ( fld.field == "<init>" )
632+ isConstructor = 1;
633+ if ( isConstructor )
634+ mcl = jni->FindClass("java/lang/reflect/Constructor");
635+ else
636+ mcl = jni->FindClass("java/lang/reflect/Method");
637+ methobj := jni->AllocObject(mcl);
638+
639+ clazz := ref Value.TObject(cast->FromJClass(this));
640+ jni->SetObjField(methobj, "clazz", clazz);
641+
642+ if ( ! isConstructor ) {
643+ name := ref Value.TObject(cast->FromJString(jni->NewString(fld.field)));
644+ jni->SetObjField(methobj, "name", name);
645+ }
646+
647+ slot := ref Value.TInt((fld.flags & 16rffff) | (ix << 16));
648+ jni->SetObjField(methobj, "slot", slot);
649+
650+ if ( ! isConstructor ) {
651+ getReflect();
652+ ret : ref Value;
653+ if ( (typ := refl->SigToType(retsig)) > 0 )
654+ ret = refl->GetPrimitiveClass(typ);
655+ else {
656+ rclass: JClass;
657+ case retsig[0] {
658+ 'L' =>
659+ rcdata := jni->FindClass(retsig[1:len retsig -1]);
660+ rclass = jni->GetClassObject(rcdata);
661+ '[' =>
662+ rclass = jni->LookupArrayClass(retsig);
663+ 'V' =>
664+ rcdata := jni->FindClass("inferno/vm/void_p");
665+ rclass = jni->GetClassObject(rcdata);
666+ }
667+ ret = ref Value.TObject(cast->FromJClass(rclass));
668+ }
669+ jni->SetObjField(methobj, "returnType", ret);
670+ }
671+
672+ args := ref Value.TObject(cast->FromJArray(cast->ClassToJArray(cl)));
673+ jni->SetObjField(methobj, "parameterTypes", args);
674+
675+ # Don't know how to get the list of exceptions thrown.
676+ # jni->SetObjField(methobj, "exceptionTypes", excs);
677+ # Set to a sensible default for now.
678+ foo := cast->JArrayToClass(cast->ObjectToJArray(makeParamClassArray("()")));
679+ excs := ref Value.TObject(cast->FromJArray(cast->ClassToJArray(foo)));
680+ jni->SetObjField(methobj, "exceptionTypes", excs);
681+ return methobj;
682+}
683+#
684+# Turn a signature into an array of Class Objects.
685+#
686+makeParamClassArray(sig : string) : JArrayJObject
687+{
688+ if ( sig[0] != '(' || sig[len sig -1] != ')' )
689+ return nil;
690+ clist := makeParamClass(sig[1:len sig -1]);
691+ jajcl := array[len clist] of JObject;
692+ for ( i := 0; i < len jajcl; i++ ) {
693+ jajcl[i] = hd clist;
694+ clist = tl clist;
695+ }
696+ paramclassarray := jni->MkAObject(jajcl);
697+ paramclassarray.class = jni->FindClass("java/lang/Class");
698+ return paramclassarray;
699+}
700+#
701+# Recursively turn a signature into a list of JClass
702+#
703+makeParamClass(sig : string) : list of JObject
704+{
705+ if ( sig == "" )
706+ return nil;
707+
708+ (first, rest) := splitSignature(sig);
709+ jobj: JObject;
710+ case first[0] {
711+ 'L' =>
712+ first = first[1:len first - 1];
713+ newcl := jni->GetClassObject(jni->FindClass(first));
714+ jobj = cast->FromJClass(newcl);
715+ '[' =>
716+ newcl := jni->LookupArrayClass(first);
717+ jobj = cast->FromJClass(newcl);
718+ 'Z' or 'B' or 'S' or 'C' or 'I' or 'J' or 'F' or 'D' =>
719+ typ := refl->SigToType(first);
720+ jobj = refl->GetPrimitiveClass(typ).Object();
721+ * =>
722+ return nil;
723+ }
724+
725+ return jobj :: makeParamClass(rest);
726+}
727+#
728+# Convert an array of JClass to the corresponding signature string.
729+#
730+MakeSignature(jcl : JArrayJClass) : string
731+{
732+ clarray: array of JClass;
733+ if ( jcl != nil )
734+ clarray = jcl.ary;
735+ sig := "";
736+ for ( i := 0; i < len clarray; i++)
737+ sig += MakeSingleSignature(clarray[i]);
738+ return sig;
739+}
740+#
741+# Convert a Jclass to the corresponding signature.
742+#
743+MakeSingleSignature(this : JClass) : string
744+{
745+ if ( (typ := jni->PrimitiveIndex(this, 1)) > 0 ) {
746+ getReflect();
747+ return refl->TypeToSig(typ);
748+ }
749+
750+ if ( this.aryname != nil )
751+ return this.aryname;
752+
753+ #
754+ # Must be a class type
755+ #
756+ return "L" + this.class.name + ";";
757+}
758+#
759+# Break a signature into an initial type plus the remainder.
760+#
761+splitSignature(sig : string) : (string, string)
762+{
763+ case sig[0] {
764+ 'L' =>
765+ for ( i := 1; sig[i] != ';'; i++ ) ;
766+ i++;
767+ return (sig[0:i], sig[i:]);
768+
769+ '[' => # recurse to get element type
770+ (first, rest) := splitSignature(sig[1:]);
771+ return ("[" + first, rest);
772+
773+ 'Z' or 'B' or 'S' or 'C' or 'I' or 'J' or 'F' or 'D' =>
774+ return (sig[0:1], sig[1:]);
775+ }
776+ return (nil, nil);
777+}
778+
java/pkg2/java/lang/Class_L.m+30−0
@@ -0,0 +1,30 @@
1+# javal v1.2 generated file: edit with care
2+
3+Class_L : module
4+{
5+
6+ init : fn( jni_p : JNI );
7+ forName_rString_rClass : fn( p0 : JString) : JClass;
8+ newInstance_rObject : fn( this : JClass) : JObject;
9+ isInstance_rObject_Z : fn( this : JClass, p0 : JObject) : int;
10+ isAssignableFrom_rClass_Z : fn( this : JClass, p0 : JClass) : int;
11+ isInterface_Z : fn( this : JClass) : int;
12+ isArray_Z : fn( this : JClass) : int;
13+ isPrimitive_Z : fn( this : JClass) : int;
14+ getName_rString : fn( this : JClass) : JString;
15+ getClassLoader_rClassLoader : fn( this : JClass) : JObject;
16+ getSuperclass_rClass : fn( this : JClass) : JClass;
17+ getInterfaces_aClass : fn( this : JClass) : JArrayJClass;
18+ getComponentType_rClass : fn( this : JClass) : JClass;
19+ getModifiers_I : fn( this : JClass) : int;
20+ getSigners_aObject : fn( this : JClass) : JArrayJObject;
21+ setSigners_aObject_V : fn( this : JClass, p0 : JArrayJObject);
22+ getPrimitiveClass_rString_rClass : fn( p0 : JString) : JClass;
23+ getFields0_I_aField : fn( this : JClass, p0 : int) : JArrayJObject;
24+ getMethods0_I_aMethod : fn( this : JClass, p0 : int) : JArrayJObject;
25+ getConstructors0_I_aConstructor : fn( this : JClass, p0 : int) : JArrayJObject;
26+ getField0_rString_I_rField : fn( this : JClass, p0 : JString,p1 : int) : JObject;
27+ getMethod0_rString_aClass_I_rMethod : fn( this : JClass, p0 : JString,p1 : JArrayJClass,p2 : int) : JObject;
28+ getConstructor0_aClass_I_rConstructor : fn( this : JClass, p0 : JArrayJClass,p1 : int) : JObject;
29+
30+};
java/pkg2/java/lang/CloneNotSupportedException.java+0−0

Empty file added.

java/pkg2/java/lang/Cloneable.java+0−0

Empty file added.

java/pkg2/java/lang/Compiler.java+0−0

Empty file added.

java/pkg2/java/lang/Double.java+0−0

Empty file added.

java/pkg2/java/lang/Double_L.b+66−0
@@ -0,0 +1,66 @@
1+implement Double_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#<<
28+
29+include "Double_L.m";
30+
31+#>> extra post includes here
32+math : Math;
33+#<<
34+
35+init( jni_p : JNI )
36+{
37+ # save java native inteface mod instance
38+ jni = jni_p;
39+ #>>extra initialization here
40+ math = jni->math;
41+ #<<
42+}
43+
44+doubleToLongBits_D_J( p0 : real) : big
45+{#>>
46+ return( math->realbits64(p0) );
47+}#<<
48+
49+longBitsToDouble_J_D( p0 : big) : real
50+{#>>
51+ return( math->bits64real( p0 ) );
52+}#<<
53+
54+valueOf0_rString_D( p0 : JString) : real
55+{#>>
56+ return( real p0.str );
57+}#<<
58+
59+mkstring_D_rString( p0 : real) : JString
60+{#>>
61+ s := string p0;
62+ if(p0 == 0.0)
63+ s += ".0";
64+ return( jni->NewString( s ) );
65+}#<<
66+
java/pkg2/java/lang/Double_L.m+17−0
@@ -0,0 +1,17 @@
1+# javal v1.3 generated file: edit with care
2+
3+Double_L : module
4+{
5+ Double_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ value : real;
9+ };
10+
11+ init : fn( jni_p : JNI );
12+ doubleToLongBits_D_J : fn( p0 : real) : big;
13+ longBitsToDouble_J_D : fn( p0 : big) : real;
14+ valueOf0_rString_D : fn( p0 : JString) : real;
15+ mkstring_D_rString : fn( p0 : real) : JString;
16+
17+};
java/pkg2/java/lang/Error.java+0−0

Empty file added.

java/pkg2/java/lang/Exception.java+0−0

Empty file added.

java/pkg2/java/lang/ExceptionInInitializerE..a+73−0
@@ -0,0 +1,73 @@
1+/*
2+ * @(#)ExceptionInInitializerError.java 1.2 97/01/20
3+ *
4+ * Copyright (c) 1996 Sun Microsystems, Inc. All Rights Reserved.
5+ *
6+ * Permission to use, copy, modify, and distribute this software
7+ * and its documentation for NON-COMMERCIAL purposes and without
8+ * fee is hereby granted provided that this copyright notice
9+ * appears in all copies. Please refer to the file "copyright.html"
10+ * for further important copyright and licensing information.
11+ *
12+ * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
13+ * THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
14+ * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
15+ * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
16+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
17+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
18+ */
19+
20+package java.lang;
21+
22+/**
23+ * Signals that an unexpected exception has occurred in a static initializer.
24+ *
25+ * @author Frank Yellin
26+ * @version 1.2, 01/20/97
27+ *
28+ * @since JDK1.1
29+ */
30+public
31+class ExceptionInInitializerError extends LinkageError {
32+ private Throwable exception;
33+
34+ /**
35+ * Constructs an ExceptionInInitializerError with no detail message.
36+ * A detail message is a String that describes this particular exception.
37+ *
38+ * @since JDK1.1
39+ */
40+ public ExceptionInInitializerError() {
41+ super();
42+ }
43+
44+ /**
45+ * Constructs a new ExceptionInInitializerError class initialized to
46+ * the specific throwable
47+ *
48+ * @param thrown The exception thrown
49+ * @since JDK1.1
50+ */
51+ public ExceptionInInitializerError(Throwable thrown) {
52+ this.exception = thrown;
53+ }
54+
55+ /**
56+ * Constructs a ExceptionInInitializerError with the specified detail message.
57+ * A detail message is a String that describes this particular exception.
58+ *
59+ * @param s the detail message
60+ * @since JDK1.1
61+ */
62+ public ExceptionInInitializerError(String s) {
63+ super(s);
64+ }
65+
66+ /**
67+ * Returns the exception that occurred during a static initialization that
68+ * caused this Error to be created.
69+ */
70+ public Throwable getException() {
71+ return exception;
72+ }
73+}
java/pkg2/java/lang/Float.java+0−0

Empty file added.

java/pkg2/java/lang/Float_L.b+60−0
@@ -0,0 +1,60 @@
1+implement Float_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#<<
28+
29+include "Float_L.m";
30+
31+#>> extra post includes here
32+math : Math;
33+#<<
34+
35+init( jni_p : JNI )
36+{
37+ # save java native inteface mod instance
38+ jni = jni_p;
39+ #>>extra initialization here
40+ math = jni->math;
41+ #<<
42+}
43+
44+floatToIntBits_F_I( p0 : real) : int
45+{#>>
46+ return( math->realbits32(p0) );
47+}#<<
48+
49+intBitsToFloat_I_F( p0 : int) : real
50+{#>>
51+ return( math->bits32real(p0) );
52+}#<<
53+
54+mkstring_F_rString( p0 : real) : JString
55+{#>>
56+ s := string p0;
57+ if(p0 == 0.0)
58+ s += ".0";
59+ return( jni->NewString( s ) );
60+}#<<
java/pkg2/java/lang/Float_L.m+16−0
@@ -0,0 +1,16 @@
1+# javal v1.3 generated file: edit with care
2+
3+Float_L : module
4+{
5+ Float_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ value : real;
9+ };
10+
11+ init : fn( jni_p : JNI );
12+ floatToIntBits_F_I : fn( p0 : real) : int;
13+ intBitsToFloat_I_F : fn( p0 : int) : real;
14+ mkstring_F_rString : fn( p0 : real) : JString;
15+
16+};
java/pkg2/java/lang/IllegalAccessError.java+0−0

Empty file added.

java/pkg2/java/lang/IllegalAccessException.java+0−0

Empty file added.

java/pkg2/java/lang/IllegalArgumentException.java+0−0

Empty file added.

java/pkg2/java/lang/IllegalMonitorStateException.java+0−0

Empty file added.

java/pkg2/java/lang/IllegalStateException.java+0−0

Empty file added.

java/pkg2/java/lang/IllegalThreadStateExcep..a+0−0

Empty file added.

java/pkg2/java/lang/IncompatibleClassChange..a+0−0

Empty file added.

java/pkg2/java/lang/IndexOutOfBoundsExcepti..a+0−0

Empty file added.

java/pkg2/java/lang/InfernoProcess.java+0−0

Empty file added.

java/pkg2/java/lang/InfernoProcess_L.b+207−0
@@ -0,0 +1,207 @@
1+implement InfernoProcess_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+include "java/io/FileDescriptor_L.m";
28+ FileDescriptor_obj : import FileDescriptor_L;
29+
30+#<<
31+
32+include "InfernoProcess_L.m";
33+
34+#>> extra post includes here
35+
36+include "sh.m";
37+
38+ioexception := "";
39+
40+#<<
41+
42+init( jni_p : JNI )
43+{
44+ # save java native inteface mod instance
45+ jni = jni_p;
46+ #>>extra initialization here
47+ #<<
48+}
49+
50+initProc_aString_aString_V( this : ref InfernoProcess_obj, p0 : JArrayJString,p1 : JArrayJString)
51+{#>>
52+ #
53+ # p0 : command and arguments
54+ # p1 : environment in for var=value; does not apply in Inferno
55+ #
56+ dummy := this;
57+ jstrs := p0.ary;
58+ args : list of string;
59+ l := len jstrs;
60+ for ( i := l-1; i >= 0; i--)
61+ args = jstrs[i].str :: args;
62+
63+ sync := chan of int;
64+ spawn exec(this, args, sync);
65+ pid := <- sync;
66+ if ( pid == 0 )
67+ jni->ThrowException("java.io.IOException", ioexception);
68+}#<<
69+
70+waitFor_I( this : ref InfernoProcess_obj) : int
71+{#>>
72+ if ( this.waitfd.fd == nil )
73+ this.terminated = JNI->TRUE;
74+ while ( this.terminated == JNI->FALSE ) {
75+ (ok, nil) := jni->sys->fstat(this.waitfd.fd);
76+ if ( ok < 0 )
77+ this.terminated = JNI->TRUE;
78+ else
79+ jni->sys->sleep(1000);
80+ }
81+ this.waitfd.fd = nil;
82+ return 0;
83+}#<<
84+
85+destroy_V( this : ref InfernoProcess_obj)
86+{#>>
87+ if ( this.pid == 0 || isTerminated_Z(this) == JNI->TRUE )
88+ return;
89+
90+ fd := jni->sys->open("/prog/"+string this.pid+"/ctl", jni->sys->OWRITE);
91+ if ( fd != nil )
92+ jni->sys->fprint(fd, "killgrp");
93+ this.pid = 0;
94+ this.terminated = JNI->TRUE;
95+}#<<
96+
97+isTerminated_Z( this : ref InfernoProcess_obj) : int
98+{#>>
99+ # If the file descriptor being used to wait for the process to terminate
100+ # is still good, the process hasn't terminated yet.
101+ #
102+ if ( this.waitfd.fd == nil )
103+ return this.terminated = JNI->TRUE;
104+ (ok, nil) := jni->sys->fstat(this.waitfd.fd);
105+ if ( ok < 0 )
106+ this.terminated = JNI->TRUE;
107+ return this.terminated;
108+}#<<
109+
110+
111+
112+exec(this : ref InfernoProcess_obj, args : list of string,
113+ waitpid : chan of int)
114+{
115+ # find and load module corresponding to hd args.
116+ cmd := hd args;
117+ file := cmd;
118+ if ( len file < 4 || file[len file - 4:] != ".dis" )
119+ file += ".dis";
120+
121+ c := load Command file;
122+ if ( c == nil ) {
123+ err := jni->sys->sprint("%r");
124+ if ( err == "file does not exist" && file[0] != '/' &&
125+ file[0:2] != "./" ) {
126+ c = load Command "/dis/" + file;
127+ if ( c == nil )
128+ err = jni->sys->sprint("%r");
129+ }
130+ if ( c == nil ) {
131+ ioexception = jni->sys->sprint("%s: %r", cmd);
132+ waitpid <- = 0;
133+ return;
134+ }
135+ }
136+ #
137+ # Get pid (via pctl) and save; We save the pid of the PARENT of the
138+ # thread that will actually execute the command. Then if someone
139+ # calls destroy, the whole group is killed.
140+ #
141+ this.pid = jni->sys->pctl(Sys->FORKNS | Sys->NEWPGRP, nil);
142+ #
143+ # Note: have to open the /prog/n/wait file of parent before doing the spawn.
144+ #
145+ waitfd : ref Sys->FD;;
146+ if ( this.pid > 0 )
147+ waitfd = jni->sys->open("#p/" + string this.pid + "/wait", Sys->OREAD);
148+ this.waitfd.fd = waitfd;
149+
150+ # arrange for new input/output to the command. Save in stdin & stdout.
151+ si := array[2] of ref Sys->FD;
152+ so := array[2] of ref Sys->FD;
153+ se := array[2] of ref Sys->FD;
154+ if ( jni->sys->pipe(si) < 0 ) {
155+ ioexception = "pipe failure";
156+ waitpid <- = 0;
157+ return;
158+ }
159+ if ( jni->sys->pipe(so) < 0 ) {
160+ ioexception = "pipe failure";
161+ waitpid <- = 0;
162+ return;
163+ }
164+ if ( jni->sys->pipe(se) < 0 ) {
165+ ioexception = "pipe failure";
166+ waitpid <- = 0;
167+ return;
168+ }
169+ this.stdin.fd = si[1];
170+ this.stdout.fd = so[0];
171+ this.stderr.fd = se[0];
172+ spawn exec1(c, si[0], so[1], se[1], args, waitpid);
173+ si[0] = si[1] = so[0] = so[1] = se[0] = se[1] = nil;
174+ #
175+ # We can't just exit this thread, or we could never detect completion
176+ # of the child. So we wait here for the wait notification.
177+ # Note that we nil the 'this' reference, so that it will be
178+ # possible for it to be garbage collected when not referenced elsewhere.
179+ # That means we can't set the terminated flag, so that anyone who
180+ # really needs to know whether the process has terminated has to check
181+ # to see if this.waitfd.fd is still a valid FD.
182+ #
183+ this = nil;
184+ buf := array[64] of byte;
185+ if ( waitfd != nil && jni->sys->read(waitfd, buf, len buf) < 0 )
186+ jni->sys->print("read error on wait file: %r\n")
187+ ; # even if this is an error, how do we report it?
188+}
189+
190+exec1(cmd : Command, in, out, err : ref Sys->FD, args : list of string,
191+ c : chan of int)
192+{
193+ newfds := in.fd :: out.fd :: err.fd :: nil;
194+ pid := jni->sys->pctl(Sys->NEWFD, newfds);
195+ jni->sys->dup(in.fd, 0);
196+ jni->sys->dup(out.fd, 1);
197+ jni->sys->dup(err.fd, 2);
198+ in = out = err = nil;
199+ pid = jni->sys->pctl(Sys->NEWFD, 0 :: 1 :: 2 :: nil);
200+ #
201+ # Eventually there has to be a way to get the Draw->Context.
202+ #
203+ # ctxt := jni->GetContext();
204+ c <- = pid;
205+ cmd->init(nil, args);
206+}
207+
java/pkg2/java/lang/InfernoProcess_L.m+22−0
@@ -0,0 +1,22 @@
1+# javal v1.3 generated file: edit with care
2+
3+InfernoProcess_L : module
4+{
5+ InfernoProcess_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ stdin : ref FileDescriptor_obj;
9+ stdout : ref FileDescriptor_obj;
10+ stderr : ref FileDescriptor_obj;
11+ pid : int;
12+ waitfd : ref FileDescriptor_obj;
13+ terminated : int;
14+ };
15+
16+ init : fn( jni_p : JNI );
17+ initProc_aString_aString_V : fn( this : ref InfernoProcess_obj, p0 : JArrayJString,p1 : JArrayJString);
18+ waitFor_I : fn( this : ref InfernoProcess_obj) : int;
19+ destroy_V : fn( this : ref InfernoProcess_obj);
20+ isTerminated_Z : fn( this : ref InfernoProcess_obj) : int;
21+
22+};
java/pkg2/java/lang/InstantiationError.java+0−0

Empty file added.

java/pkg2/java/lang/InstantiationException.java+0−0

Empty file added.

java/pkg2/java/lang/Integer.java+0−0

Empty file added.

java/pkg2/java/lang/InternalError.java+0−0

Empty file added.

java/pkg2/java/lang/InterruptedException.java+0−0

Empty file added.

java/pkg2/java/lang/LinkageError.java+0−0

Empty file added.

java/pkg2/java/lang/Long.java+0−0

Empty file added.

java/pkg2/java/lang/Math.java+0−0

Empty file added.

java/pkg2/java/lang/Math_L.b+119−0
@@ -0,0 +1,119 @@
1+implement Math_L;
2+
3+# javal v1.2 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JObject : import jni;
23+
24+#>> extra pre includes here
25+
26+#<<
27+
28+include "Math_L.m";
29+
30+#>> extra post includes here
31+math : Math;
32+#<<
33+
34+init( jni_p : JNI )
35+{
36+ # save java native inteface mod instance
37+ jni = jni_p;
38+ #>>extra initialization here
39+ math = jni->math;
40+ #<<
41+}
42+
43+sin_D_D( p0 : real) : real
44+{#>>
45+ return( math->sin(p0) );
46+}#<<
47+
48+cos_D_D( p0 : real) : real
49+{#>>
50+ return( math->cos(p0) );
51+}#<<
52+
53+tan_D_D( p0 : real) : real
54+{#>>
55+ return( math->tan(p0) );
56+}#<<
57+
58+asin_D_D( p0 : real) : real
59+{#>>
60+ return( math->asin(p0) );
61+}#<<
62+
63+acos_D_D( p0 : real) : real
64+{#>>
65+ return( math->acos(p0) );
66+}#<<
67+
68+atan_D_D( p0 : real) : real
69+{#>>
70+ return( math->atan(p0) );
71+}#<<
72+
73+exp_D_D( p0 : real) : real
74+{#>>
75+ return( math->exp(p0) );
76+}#<<
77+
78+log_D_D( p0 : real) : real
79+{#>>
80+ return( math->log(p0) );
81+}#<<
82+
83+sqrt_D_D( p0 : real) : real
84+{#>>
85+ return( math->sqrt(p0) );
86+}#<<
87+
88+IEEEremainder_D_D_D( p0 : real,p1 : real) : real
89+{#>>
90+ return( math->remainder(p0,p1) );
91+}#<<
92+
93+ceil_D_D( p0 : real) : real
94+{#>>
95+ return( math->ceil(p0) );
96+}#<<
97+
98+floor_D_D( p0 : real) : real
99+{#>>
100+ return( math->floor(p0) );
101+}#<<
102+
103+rint_D_D( p0 : real) : real
104+{#>>
105+ return( math->rint(p0) );
106+}#<<
107+
108+atan2_D_D_D( p0 : real,p1 : real) : real
109+{#>>
110+ return( math->atan2(p0,p1) );
111+}#<<
112+
113+pow_D_D_D( p0 : real,p1 : real) : real
114+{#>>
115+ return( math->pow(p0,p1) );
116+}#<<
117+
118+
119+
java/pkg2/java/lang/Math_L.m+27−0
@@ -0,0 +1,27 @@
1+# javal v1.2 generated file: edit with care
2+
3+Math_L : module
4+{
5+ Math_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ };
9+
10+ init : fn( jni_p : JNI );
11+ sin_D_D : fn( p0 : real) : real;
12+ cos_D_D : fn( p0 : real) : real;
13+ tan_D_D : fn( p0 : real) : real;
14+ asin_D_D : fn( p0 : real) : real;
15+ acos_D_D : fn( p0 : real) : real;
16+ atan_D_D : fn( p0 : real) : real;
17+ exp_D_D : fn( p0 : real) : real;
18+ log_D_D : fn( p0 : real) : real;
19+ sqrt_D_D : fn( p0 : real) : real;
20+ IEEEremainder_D_D_D : fn( p0 : real,p1 : real) : real;
21+ ceil_D_D : fn( p0 : real) : real;
22+ floor_D_D : fn( p0 : real) : real;
23+ rint_D_D : fn( p0 : real) : real;
24+ atan2_D_D_D : fn( p0 : real,p1 : real) : real;
25+ pow_D_D_D : fn( p0 : real,p1 : real) : real;
26+
27+};
java/pkg2/java/lang/NegativeArraySizeExcept..a+0−0

Empty file added.

java/pkg2/java/lang/NoClassDefFoundError.java+0−0

Empty file added.

java/pkg2/java/lang/NoSuchFieldError.java+0−0

Empty file added.

java/pkg2/java/lang/NoSuchFieldException.java+0−0

Empty file added.

java/pkg2/java/lang/NoSuchMethodError.java+0−0

Empty file added.

java/pkg2/java/lang/NoSuchMethodException.java+0−0

Empty file added.

java/pkg2/java/lang/NullPointerException.java+0−0

Empty file added.

java/pkg2/java/lang/Number.java+0−0

Empty file added.

java/pkg2/java/lang/NumberFormatException.java+0−0

Empty file added.

java/pkg2/java/lang/Object.java+0−0

Empty file added.

java/pkg2/java/lang/Object_L.b+71−0
@@ -0,0 +1,71 @@
1+implement Object_L;
2+
3+include "jni.m";
4+ jni : JNI;
5+ ClassModule,
6+ JString,
7+ JArray,
8+ JArrayI,
9+ JArrayC,
10+ JArrayB,
11+ JArrayS,
12+ JArrayJ,
13+ JArrayF,
14+ JArrayD,
15+ JArrayZ,
16+ JArrayJObject,
17+ JArrayJString,
18+ JClass,
19+ JObject : import jni;
20+
21+#>> extra pre includes here
22+
23+#<<
24+
25+include "Object_L.m";
26+
27+#>> extra post includes here
28+
29+#<<
30+
31+init( jni_p : JNI )
32+{
33+ # save java native inteface mod instance
34+ jni = jni_p;
35+ #>>extra initialization here
36+ #<<
37+}
38+
39+getClass_rClass( this : JObject) : JClass
40+{#>>
41+ return( jni->GetObjectClass(this) );
42+}#<<
43+
44+hashCode_I( this : JObject ) : int
45+{#>>
46+ return( jni->IdentityHash( this ) );
47+}#<<
48+
49+clone_rObject( this : JObject ) : JObject
50+{#>>
51+ return( jni->DupObject( this ) );
52+}#<<
53+
54+notify_V( this : JObject )
55+{#>>
56+ jni->jldr->monitornotify( this, 0 );
57+}#<<
58+
59+notifyAll_V( this : JObject )
60+{#>>
61+ jni->jldr->monitornotify( this, 1 );
62+}#<<
63+
64+wait_J_V( this : JObject, p0 : big)
65+{#>>
66+ if ( p0 < big 0 )
67+ jni->ThrowException( "java.lang.IllegalArgumentException", "negative timeout value" );
68+ # limit to 30 bits of millisecond time.
69+ duration := (int p0) & 16r3FFFFFFF;
70+ jni->jldr->monitorwait( this, duration );
71+}#<<
java/pkg2/java/lang/Object_L.m+14−0
@@ -0,0 +1,14 @@
1+# generated file edit with care
2+
3+Object_L : module
4+{
5+ init : fn( jni_p : JNI );
6+ getClass_rClass : fn( this : JObject ) : JClass;
7+ hashCode_I : fn( this : JObject ) : int;
8+ clone_rObject : fn( this : JObject ) : JObject;
9+ notify_V : fn( this : JObject );
10+ notifyAll_V : fn( this : JObject );
11+ wait_J_V : fn( this : JObject, p0 : big);
12+ registerNatives_V : fn( this : JObject );
13+
14+};
java/pkg2/java/lang/OutOfMemoryError.java+0−0

Empty file added.

java/pkg2/java/lang/Process.java+0−0

Empty file added.

java/pkg2/java/lang/Runnable.java+0−0

Empty file added.

java/pkg2/java/lang/Runtime.java+0−0

Empty file added.

java/pkg2/java/lang/RuntimeException.java+0−0

Empty file added.

java/pkg2/java/lang/Runtime_L.b+161−0
@@ -0,0 +1,161 @@
1+implement Runtime_L;
2+
3+# javal v1.2 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JObject : import jni;
23+
24+#>> extra pre includes here
25+
26+#<<
27+
28+include "Runtime_L.m";
29+
30+#>> extra post includes here
31+
32+#<<
33+
34+init( jni_p : JNI )
35+{
36+ # save java native inteface mod instance
37+ jni = jni_p;
38+ #>>extra initialization here
39+ #<<
40+}
41+
42+killgrp()
43+{
44+ # kill this process group
45+ msg := array of byte "killgrp";
46+ pid := string jni->sys->pctl(0,nil); #my pid
47+
48+ fd := jni->sys->open("#p/"+pid+"/ctl", Sys->OWRITE);
49+ if(fd != nil)
50+ jni->sys->write(fd, msg, len msg);
51+
52+ #note: we silently fail if we could not open
53+ #'#p' (i.e. because of NODEVS) or if the
54+ #write fails
55+}
56+
57+exitInternal_I_V( this : ref Runtime_obj, p0 : int)
58+{#>>
59+ # can't kill self, so spawn thread to kill group
60+ spawn killgrp();
61+ # send nowhere until killed
62+ chan of int <-= 666;
63+ junk := (this,p0); #inferno does not have an exit code
64+}#<<
65+
66+runFinalizersOnExit0_Z_V( p0 : int)
67+{#>>
68+ junk := (p0);
69+}#<<
70+
71+freeMemory_J( this : ref Runtime_obj) : big
72+{#>>
73+ # open; read; parase; memory device
74+ mfd := jni->sys->open("#c/memory", Sys->OREAD);
75+ if ( mfd == nil )
76+ return(big 0);
77+ buf := array[300] of byte;
78+ n := jni->sys->read(mfd, buf, len buf);
79+ if(n <= 0)
80+ return(big 0);
81+ (nil, arena) := jni->sys->tokenize(string buf[0:n], "\n");
82+ (used,limit) := (0,0);
83+ # walk list of arena's looking for "heap"
84+ while(arena != nil)
85+ {
86+ # break line into tokens
87+ (nil,tok) := jni->sys->tokenize( hd arena, " " );
88+ used = int (hd tok); #first tok is amount used
89+ tok = tl tok;
90+ limit = int (hd tok); #second tok is total
91+ name : string;
92+ for(tok= tl tok; tok != nil; tok = tl tok)
93+ name = hd tok;
94+
95+ if ( name == "heap" )
96+ break;
97+ arena = tl arena;
98+ }
99+
100+ # return the amount free
101+ return( big (limit-used) );
102+ junk := (this);
103+}#<<
104+
105+totalMemory_J( this : ref Runtime_obj) : big
106+{#>>
107+ # open; read; parase; memory device
108+ mfd := jni->sys->open("#c/memory", Sys->OREAD);
109+ if ( mfd == nil )
110+ return( big 0 );
111+ buf := array[300] of byte;
112+ n := jni->sys->read(mfd, buf, len buf);
113+ if(n <= 0)
114+ return(big 0);
115+ (nil, arena) := jni->sys->tokenize(string buf[0:n], "\n");
116+ limit := 0;
117+ while(arena != nil)
118+ {
119+ # break line into tokens
120+ (nil,tok) := jni->sys->tokenize( hd arena, " " );
121+ tok = tl tok;
122+ limit = int (hd tok); #second tok is total
123+ name : string;
124+ for(tok= tl tok; tok != nil; tok = tl tok)
125+ name = hd tok;
126+
127+ if ( name == "heap" )
128+ break;
129+ arena = tl arena;
130+ }
131+
132+ # return the total amount
133+ return( big limit );
134+ junk := (this);
135+}#<<
136+
137+gc_V( this : ref Runtime_obj)
138+{#>>
139+ # do nothing
140+ junk := this;
141+}#<<
142+
143+runFinalization_V( this : ref Runtime_obj)
144+{#>>
145+ # do nothing
146+ junk := this;
147+}#<<
148+
149+traceInstructions_Z_V( this : ref Runtime_obj, p0 : int)
150+{#>>
151+ # do nothing
152+ return;
153+ junk := (this,p0);
154+}#<<
155+
156+traceMethodCalls_Z_V( this : ref Runtime_obj, p0 : int)
157+{#>>
158+ # doing nothing is a valid implementation
159+ return;
160+ junk := (this,p0);
161+}#<<
java/pkg2/java/lang/Runtime_L.m+20−0
@@ -0,0 +1,20 @@
1+# javal v1.2 generated file: edit with care
2+
3+Runtime_L : module
4+{
5+ Runtime_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ };
9+
10+ init : fn( jni_p : JNI );
11+ exitInternal_I_V : fn( this : ref Runtime_obj, p0 : int);
12+ runFinalizersOnExit0_Z_V : fn( p0 : int);
13+ freeMemory_J : fn( this : ref Runtime_obj) : big;
14+ totalMemory_J : fn( this : ref Runtime_obj) : big;
15+ gc_V : fn( this : ref Runtime_obj);
16+ runFinalization_V : fn( this : ref Runtime_obj);
17+ traceInstructions_Z_V : fn( this : ref Runtime_obj, p0 : int);
18+ traceMethodCalls_Z_V : fn( this : ref Runtime_obj, p0 : int);
19+
20+};
java/pkg2/java/lang/SecurityException.java+0−0

Empty file added.

java/pkg2/java/lang/SecurityManager.java+0−0

Empty file added.

java/pkg2/java/lang/SecurityManager_L.b+175−0
@@ -0,0 +1,175 @@
1+implement SecurityManager_L;
2+
3+# javal v1.2 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JObject : import jni;
23+
24+#>> extra pre includes here
25+
26+#<<
27+
28+include "SecurityManager_L.m";
29+
30+#>> extra post includes here
31+
32+#<<
33+
34+init( jni_p : JNI )
35+{
36+ # save java native inteface mod instance
37+ jni = jni_p;
38+ #>>extra initialization here
39+ #<<
40+}
41+
42+getClassContext_aClass( this : ref SecurityManager_obj) : JArrayJClass
43+{#>>
44+ #
45+ # return an array of classes that represent the classes of
46+ # each method on the current call stack (presumably ignoring
47+ # any native funtions).
48+ #
49+ jni->FatalError( "getClassContext() not implemented" );
50+ junk := this;
51+ return(nil);
52+}#<<
53+
54+currentClassLoader_rClassLoader( this : ref SecurityManager_obj) : JObject
55+{#>>
56+ #
57+ # this returns the most recent class loader on the current call
58+ # stack. Traditionally the call stack is walked and the class of
59+ # each "active" method is checked to obtain its class loader (if
60+ # any; null==root loader). The first such class loader we find
61+ # is returned.
62+ #
63+ return(nil); #for now we don't walk back
64+ junk := this;
65+}#<<
66+
67+classDepth_rString_I( this : ref SecurityManager_obj, p0 : JString) : int
68+{#>>
69+ #
70+ # walk the call stack looking for a method that resides in
71+ # the class specified.
72+ #
73+ if ( p0 != nil )
74+ {
75+ clname := p0.str;
76+ # change any '.' to '/'
77+ l := len clname;
78+ for(x:=0;x<l; x++)
79+ if ( clname[x] == '.' ) clname[x] = '/';
80+
81+ # attempt to open the local "prog" device (i.e. '#p')
82+ # and read the call stack into an array of bytes
83+ pid := jni->sys->pctl(0,nil);
84+ progfile := "#p/"+ (string pid) +"/stack";
85+ fd := jni->sys->open( progfile, Sys->OREAD );
86+ if ( fd != nil )
87+ {
88+ # must spin a thread to read my own call-stack
89+ result := chan of array of byte; # channel for thd results
90+ spawn ReadCallStack( fd, result );
91+ callstack := <- result; # wait for results
92+
93+ (cnt,frame) := jni->sys->tokenize( string callstack, "\n" );
94+ if ( cnt > 0 )
95+ {
96+ # walk frames looking for module-name/class-name match
97+ depth := 0;
98+ for( ; frame!=nil; frame=tl frame )
99+ {
100+ # parse each line
101+ (a,tok) := jni->sys->tokenize(hd frame, " ");
102+ if ( a > 0 )
103+ {
104+ #module name is last token
105+ for( b:=0; b<a-1; b-- )
106+ tok = tl tok;
107+ if ( (hd tok) == clname )
108+ return( depth );
109+ }
110+ depth++;
111+ }
112+ }
113+ }
114+
115+ }
116+
117+ return(-1); #if we are here we can't find the class
118+ junk := (this);
119+}#<<
120+
121+classLoaderDepth_I( this : ref SecurityManager_obj) : int
122+{#>>
123+ #
124+ # return the number of frames back to the first class
125+ # loader on the call stack. Return -1 if no classloaders.
126+ #
127+ return(-1); #for now we don't walk back
128+ junk := this;
129+}#<<
130+
131+currentLoadedClass0_rClass( this : ref SecurityManager_obj) : JClass
132+{#>>
133+ #
134+ # return the first class on the call stack that was loaded
135+ # with a class loader.
136+ #
137+ return( nil );
138+ junk := this;
139+}#<<
140+
141+
142+
143+
144+ReadCallStack( fd : ref Sys->FD, result : chan of array of byte )
145+{
146+ # read until eof
147+ buf := array[8000] of byte; #about 10 frames
148+ (n,ptr) := (0,0);
149+ do
150+ {
151+ cur := len buf-ptr;
152+ n = jni->sys->read(fd, buf[ptr:], cur);
153+ ptr += n;
154+ if ( n == cur )
155+ {
156+ # need to read more
157+ buf = ExtendBuf(buf);
158+ }
159+
160+ } while ( n != 0 );
161+
162+ result <- = buf[:ptr];
163+}
164+
165+ExtendBuf( buf : array of byte ) : array of byte
166+{
167+ curlen := len buf;
168+ newbuf := array[curlen + 8000] of byte;
169+
170+ # copy old contents
171+ for(x:=0; x<curlen; x++ )
172+ newbuf[x] = buf[x];
173+
174+ return( newbuf );
175+}
java/pkg2/java/lang/SecurityManager_L.m+19−0
@@ -0,0 +1,19 @@
1+# javal v1.2 generated file: edit with care
2+
3+SecurityManager_L : module
4+{
5+ SecurityManager_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ inCheck : int;
9+ initialized : int;
10+ };
11+
12+ init : fn( jni_p : JNI );
13+ getClassContext_aClass : fn( this : ref SecurityManager_obj) : JArrayJClass;
14+ currentClassLoader_rClassLoader : fn( this : ref SecurityManager_obj) : JObject;
15+ classDepth_rString_I : fn( this : ref SecurityManager_obj, p0 : JString) : int;
16+ classLoaderDepth_I : fn( this : ref SecurityManager_obj) : int;
17+ currentLoadedClass0_rClass : fn( this : ref SecurityManager_obj) : JClass;
18+
19+};
java/pkg2/java/lang/Short.java+0−0

Empty file added.

java/pkg2/java/lang/StackOverflowError.java+0−0

Empty file added.

java/pkg2/java/lang/String.java+0−0

Empty file added.

java/pkg2/java/lang/StringBuffer.java+0−0

Empty file added.

java/pkg2/java/lang/StringBuffer_L.b+359−0
@@ -0,0 +1,359 @@
1+implement StringBuffer_L;
2+
3+# javal v1.4 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+# this module implements the class java.lang.StringBuffer
28+# the buffer is really a Limbo string type. In the original
29+# Java implementation an array of char was used and the array
30+# size was always >= to the buffer contents. In this version
31+# The limbo string represents only the buffer contents and
32+# contains no extra "padding". This is done because the
33+# Inferno implementation of string is optimized for string
34+# operations. Thus, the actual buffer contents is simply the
35+# length of the Limbo string; the original Java version
36+# maintained the buffer content size in the field 'count'.
37+# For conveience of the Java code, and to negate a call into
38+# the native Limbo, the 'count' field is maintained to always
39+# be the length of the Limbo string: e.g. "count=len Ivalue".
40+#
41+# In the Java version the character array can be shared with
42+# an instance of the Java String class, hence a flag for being
43+# shared. This is not the case for the Inferno implementation.
44+# whenever data is passed out it must be a copy of the 'Ivalue'
45+# string.
46+#
47+# When this was implemented synchronizatio of native methods
48+# was not complete, so this module assumes if a method should
49+# be synchronized it is done before entering the native method
50+# so each native method should be a private method and wrapped
51+# in Java code by a synchronized method (or block).
52+#
53+# The java.lang.StringBuffer class is serialzable. For Inferno
54+# since the internal structure has changed serialization must
55+# be explitily handled by this class. This is done by adding
56+# writeObject()/readObject() methods in the Java side to write
57+# and read in the expected format, so outside VM's do not know
58+# we have a differen implementation.
59+#
60+
61+#<<
62+
63+include "StringBuffer_L.m";
64+
65+#>> extra post includes here
66+Value : import jni;
67+cast : Cast;
68+
69+#<<
70+
71+init( jni_p : JNI )
72+{
73+ # save java native inteface mod instance
74+ jni = jni_p;
75+ #>>extra initialization here
76+ cast = jni->CastMod();
77+ #<<
78+}
79+
80+setLength0_I_V( this : ref StringBuffer_obj, p0 : int)
81+{#>>
82+ # p0 => length to set buf to; assume >=0
83+
84+ l := len this.Ivalue;
85+
86+ if ( p0 < l ) # truncate
87+ this.Ivalue = this.Ivalue[:p0];
88+ else { # pad with null characters
89+ for( i := l; i < p0; i++ )
90+ this.Ivalue[i] = '\0';
91+ }
92+ this.count = len this.Ivalue;
93+}#<<
94+
95+charAt0_I_C( this : ref StringBuffer_obj, p0 : int) : int
96+{#>>
97+ # assume p0 is within the range 0..len this.Ivalue
98+ return( this.Ivalue[p0] );
99+}#<<
100+
101+getChars0_I_I_aC_I_V( this : ref StringBuffer_obj, p0 : int,p1 : int,p2 : JArrayC,p3 : int)
102+{#>>
103+ # assume the index ranges are already checked
104+ copy_count := (p1-p0);
105+ dst_end := p3 + copy_count;
106+ if ( dst_end > len p2.ary )
107+ jni->ThrowException( "java.lang.ArrayIndexOutOfBoundsException", "destination array not large enough" );
108+
109+ # copy one char at a time
110+ for( (x,y) := (p3,p0); x < copy_count; junk:=(x++,y++) )
111+ p2.ary[x] = this.Ivalue[y];
112+
113+}#<<
114+
115+setCharAt0_I_C_V( this : ref StringBuffer_obj, p0 : int,p1 : int)
116+{#>>
117+ # assume index has been checked
118+ this.Ivalue[p0] = p1;
119+}#<<
120+
121+reverse0_V( this : ref StringBuffer_obj)
122+{#>>
123+ # reverse the string buffer contents
124+ str := this.Ivalue[:]; # slice a copy
125+ for( (x,y):=(0,(len str)-1); x<len str; junk:=(x++,y--) )
126+ this.Ivalue[x] = str[y];
127+
128+}#<<
129+
130+append_int_I_V( this : ref StringBuffer_obj, p0 : int)
131+{#>>
132+ # append the Ivalue to the string
133+ this.Ivalue += string p0;
134+ this.count = len this.Ivalue;
135+}#<<
136+
137+append_long_J_V( this : ref StringBuffer_obj, p0 : big)
138+{#>>
139+ # append the Ivalue to the string
140+ this.Ivalue += string p0;
141+ this.count = len this.Ivalue;
142+}#<<
143+
144+append_str_rString_V( this : ref StringBuffer_obj, p0 : JString)
145+{#>>
146+ # append the Ivalue to the string
147+ val : string;
148+ if ( p0 == nil )
149+ val = "null"; #this is what Java wants
150+ else
151+ val = p0.str;
152+
153+ this.Ivalue += val;
154+ this.count = len this.Ivalue;
155+}#<<
156+
157+append_chars_aC_I_I_V( this : ref StringBuffer_obj, p0 : JArrayC,p1 : int,p2 : int)
158+{#>>
159+ # append the Ivalue to the string
160+ if ( p0 == nil ) return;
161+
162+ val := p0.ary[p1:p1+p2];
163+ l := len this.Ivalue;
164+ for( x:=0; x < len val; x++ )
165+ this.Ivalue[l++] = val[x];
166+ this.count = len this.Ivalue;
167+}#<<
168+
169+append_ch_C_V( this : ref StringBuffer_obj, p0 : int)
170+{#>>
171+ # append the Ivalue to the string
172+ this.Ivalue[this.count] = p0;
173+ this.count++;
174+}#<<
175+
176+append_float_F_V( this : ref StringBuffer_obj, p0 : real)
177+{#>>
178+ # append the Ivalue to the string
179+ s := string p0;
180+ if(p0 == 0.0)
181+ s += ".0";
182+ this.Ivalue += s;
183+ this.count = len this.Ivalue;
184+}#<<
185+
186+append_double_D_V( this : ref StringBuffer_obj, p0 : real)
187+{#>>
188+ # append the Ivalue to the string
189+ s := string p0;
190+ if(p0 == 0.0)
191+ s += ".0";
192+ this.Ivalue += s;
193+ this.count = len this.Ivalue;
194+}#<<
195+
196+insert_int_I_I_V( this : ref StringBuffer_obj, p0 : int,p1 : int)
197+{#>>
198+ # insert 'p1' into the string the new string is
199+ # left + p1 + right; where left is Ivalue[:p0]
200+ # and right is Ivalue[p0:]. newright is
201+ # p1+right
202+ # assume args have been checked
203+ #
204+ newright := (string p1) + this.Ivalue[p0:];
205+ this.Ivalue = this.Ivalue[:p0] + newright;
206+ this.count = len this.Ivalue;
207+}#<<
208+
209+insert_long_I_J_V( this : ref StringBuffer_obj, p0 : int,p1 : big)
210+{#>>
211+ # insert 'p1' into the string the new string is
212+ # left + p1 + right; where left is Ivalue[0:p0]
213+ # and right is Ivalue[p0:count]. newright is
214+ # p1+right
215+ #
216+ newright := (string p1) + this.Ivalue[p0:];
217+ this.Ivalue = this.Ivalue[:p0] + newright;
218+ this.count = len this.Ivalue;
219+}#<<
220+
221+insert_str_I_rString_V( this : ref StringBuffer_obj, p0 : int,p1 : JString)
222+{#>>
223+ # insert 'p1' into the string the new string is
224+ # left + p1 + right; where left is Ivalue[0:p0]
225+ # and right is Ivalue[p0:count]. newright is
226+ # p1+right
227+ #
228+ val : string;
229+ if ( p1 == nil )
230+ val = "null";
231+ else
232+ val = p1.str;
233+ newright := val + this.Ivalue[p0:];
234+ left := this.Ivalue[:p0];
235+ this.Ivalue = left + newright;
236+ this.count = len this.Ivalue;
237+}#<<
238+
239+insert_chars_I_aC_V( this : ref StringBuffer_obj, p0 : int,p1 : JArrayC)
240+{#>>
241+ # insert 'p1' into the string the new string is
242+ # left + p1 + right; where left is Ivalue[:p0]
243+ # and right is Ivalue[p0:]. newright is
244+ # p1+right
245+ #
246+ if ( p1 == nil ) return;
247+
248+ # get copy of old right part and lop it off
249+ oldright := this.Ivalue[p0:];
250+ this.Ivalue = this.Ivalue[:p0];
251+
252+ # insert char array first
253+ for( x:=0; x<len p1.ary; x++ )
254+ this.Ivalue[p0 + x] = p1.ary[x];
255+
256+ # now add the old right back
257+ this.Ivalue += oldright;
258+ this.count = len this.Ivalue;
259+}#<<
260+
261+insert_ch_I_C_V( this : ref StringBuffer_obj, p0 : int,p1 : int)
262+{#>>
263+ # insert 'p1' into the string the new string is
264+ # left + p1 + right; where left is Ivalue[:p0]
265+ # and right is Ivalue[p0:]. newright is
266+ # p1+right
267+ #
268+ newright: string;
269+ newright[0] = p1;
270+ newright += this.Ivalue[p0:];
271+ this.Ivalue = this.Ivalue[:p0] + newright;
272+ this.count = len this.Ivalue;
273+}#<<
274+
275+insert_float_I_F_V( this : ref StringBuffer_obj, p0 : int,p1 : real)
276+{#>>
277+ # insert 'p1' into the string the new string is
278+ # left + p1 + right; where left is Ivalue[0:p0]
279+ # and right is Ivalue[p0:count]. newright is
280+ # p1+right
281+ #
282+ s := string p1;
283+ if(p1 == 0.0)
284+ s += ".0";
285+ newright := s + this.Ivalue[p0:];
286+ this.Ivalue = this.Ivalue[:p0] + newright;
287+ this.count = len this.Ivalue;
288+}#<<
289+
290+insert_double_I_D_V( this : ref StringBuffer_obj, p0 : int,p1 : real)
291+{#>>
292+ # insert 'p1' into the string the new string is
293+ # left + p1 + right; where left is Ivalue[0:p0]
294+ # and right is Ivalue[p0:count]. newright is
295+ # p1+right
296+ #
297+ s := string p1;
298+ if(p1 == 0.0)
299+ s += ".0";
300+ newright := s + this.Ivalue[p0:];
301+ this.Ivalue = this.Ivalue[:p0] + newright;
302+ this.count = len this.Ivalue;
303+}#<<
304+
305+get_string_rString( this : ref StringBuffer_obj) : JString
306+{#>>
307+ return( jni->NewString( this.Ivalue[:] ) ); #return a copy
308+}#<<
309+
310+get_chars_aC( this : ref StringBuffer_obj) : JArrayC
311+{#>>
312+ # return a char array
313+ l := len this.Ivalue;
314+ chars := array[l] of int;
315+ for( x:=0; x<l; x++ )
316+ chars[x] = this.Ivalue[x];
317+
318+ return( jni->MkAChar( chars ) );
319+}#<<
320+
321+#
322+# the next two functions are for serialization
323+#
324+
325+#
326+# write this.Ivalue (a Dis string) to an ObjectOutputStream as a char[]
327+#
328+
329+writeObject0_rObjectOutputStream_V(this : ref StringBuffer_obj, p0 : JObject)
330+{#>>
331+ jaryc := jni->StringToAChar(this.Ivalue);
332+ args := array[] of {
333+ ref Value.TObject(cast->FromJArray(cast->IntToJArray(jaryc)))
334+ };
335+ jni->CallMethod(p0, "writeObject", "(Ljava/lang/Object;)V", args);
336+}#<<
337+
338+#
339+# read a char[] from an ObjectInputStream and convert it to a Dis string
340+#
341+
342+readObject0_rObjectInputStream_V(this : ref StringBuffer_obj, p0 : JObject)
343+{#>>
344+ jaryc : JArrayC;
345+
346+ (val, ok) := jni->CallMethod(p0, "readObject", "()Ljava/lang/Object;", nil);
347+ if(ok == JNI->OK) {
348+ pick v := val {
349+ TObject =>
350+ jaryc = cast->ToJArrayC(v.jobj);
351+ }
352+ }
353+ if(jaryc == nil || len jaryc.ary < this.count)
354+ jni->ThrowException("java.io.IOException", "bad StringBuffer object serialized");
355+
356+ # JavaSoft JVM serializes trailing null characters; we can ignore
357+ for(i := 0; i < this.count; i++)
358+ this.Ivalue[i] = jaryc.ary[i];
359+}#<<
java/pkg2/java/lang/StringBuffer_L.m+42−0
@@ -0,0 +1,42 @@
1+# javal v1.4 generated file: edit with care
2+
3+##EDITED
4+
5+StringBuffer_L : module
6+{
7+ StringBuffer_obj : adt
8+ {
9+ cl_mod : ClassModule;
10+ Ivalue : string;
11+ buf_capacity : int;
12+ value : array of int;
13+ count : int;
14+ shared : byte;
15+ };
16+
17+ init : fn( jni_p : JNI );
18+ setLength0_I_V : fn( this : ref StringBuffer_obj, p0 : int);
19+ charAt0_I_C : fn( this : ref StringBuffer_obj, p0 : int) : int;
20+ getChars0_I_I_aC_I_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : int,p2 : JArrayC,p3 : int);
21+ setCharAt0_I_C_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : int);
22+ reverse0_V : fn( this : ref StringBuffer_obj);
23+ append_int_I_V : fn( this : ref StringBuffer_obj, p0 : int);
24+ append_long_J_V : fn( this : ref StringBuffer_obj, p0 : big);
25+ append_str_rString_V : fn( this : ref StringBuffer_obj, p0 : JString);
26+ append_chars_aC_I_I_V : fn( this : ref StringBuffer_obj, p0 : JArrayC,p1 : int,p2 : int);
27+ append_ch_C_V : fn( this : ref StringBuffer_obj, p0 : int);
28+ append_float_F_V : fn( this : ref StringBuffer_obj, p0 : real);
29+ append_double_D_V : fn( this : ref StringBuffer_obj, p0 : real);
30+ insert_int_I_I_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : int);
31+ insert_long_I_J_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : big);
32+ insert_str_I_rString_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : JString);
33+ insert_chars_I_aC_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : JArrayC);
34+ insert_ch_I_C_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : int);
35+ insert_float_I_F_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : real);
36+ insert_double_I_D_V : fn( this : ref StringBuffer_obj, p0 : int,p1 : real);
37+ get_string_rString : fn( this : ref StringBuffer_obj) : JString;
38+ get_chars_aC : fn( this : ref StringBuffer_obj) : JArrayC;
39+
40+ writeObject0_rObjectOutputStream_V : fn(this : ref StringBuffer_obj, p0 : JObject);
41+ readObject0_rObjectInputStream_V : fn(this : ref StringBuffer_obj, p0 : JObject);
42+};
java/pkg2/java/lang/StringIndexOutOfBoundsE..a+0−0

Empty file added.

java/pkg2/java/lang/String_L.b+517−0
@@ -0,0 +1,517 @@
1+implement String_L;
2+
3+# javal v1.6 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#<<
28+
29+include "String_L.m";
30+
31+#>> extra post includes here
32+include "hash.m";
33+
34+str : String;
35+hash : Hash;
36+
37+#
38+# the following are for the intern() method
39+# a pool of all Java String classes is maintained
40+# hashed on the actual string contents. For any
41+# given actual string the same Java String object
42+# should be returned. We maingain a hash table
43+# of String objects, hashed on the string value.
44+#
45+PSZ : con 31;
46+pool := array[PSZ] of list of JString;
47+
48+PoolAdd( jstr : JString )
49+{
50+ idx := hash->fun1(jstr.str,PSZ);
51+ pool[idx] = jstr :: pool[idx];
52+}
53+
54+PoolGet( val : JString ) : JString
55+{
56+ # search for an existing object with same value
57+ for( l := pool[hash->fun1(val.str,PSZ)]; l != nil; l = tl l )
58+ {
59+ jstr := hd l;
60+ if (jstr.str == val.str)
61+ return( jstr );
62+ }
63+
64+ # could not find so add this class
65+ PoolAdd( val );
66+ return( val );
67+}
68+
69+#<<
70+
71+init( jni_p : JNI )
72+{
73+ # save java native inteface mod instance
74+ jni = jni_p;
75+ #>>extra initialization here
76+ str = jni->str;
77+ hash = load Hash Hash->PATH;
78+ if ( hash == nil )
79+ jni->InitError( jni->sys->sprint( "java.lang.String: could not load %s: %r", Hash->PATH ) );
80+ #<<
81+}
82+
83+length_I( this : JString) : int
84+{#>>
85+ return( len this.str );
86+}#<<
87+
88+charAt_I_C( this : JString, p0 : int) : int
89+{#>>
90+ if ((this.str == nil) || (p0 > (len this.str -1)) || (p0 < 0))
91+ jni->ThrowException( "java.lang.StringIndexOutOfBoundsException", string p0 );
92+ return( this.str[p0] );
93+}#<<
94+
95+getChars_I_I_aC_I_V( this : JString, p0 : int,p1 : int,p2 : JArrayC,p3 : int)
96+{#>>
97+ # fill the char array with each char from the string
98+
99+ # do some checking first
100+ if ( p0 < 0 )
101+ jni->ThrowException( "java.lang.StringIndexOutOfBoundsException", string p0 );
102+ if ( p1 > len this.str )
103+ jni->ThrowException( "java.lang.StringIndexOutOfBoundsException", string p1 );
104+ if ( p0 > p1 )
105+ jni->ThrowException( "java.lang.StringIndexOutOfBoundsException", string (p1-p0) );
106+
107+ # now check array and copy chars into
108+ copy_count := p1-p0; # number of chars to copy
109+
110+ #STD?? I will just throw an exception here if I know
111+ # I will overwrite the array bounds. To really be
112+ # legit I may need to copy upto the end and then throw
113+ if ( (copy_count + p3) > (len p2.ary) )
114+ jni->ThrowException( "java.lang.ArrayIndexOutOfBoundsException", string (len p2.ary) );
115+
116+ # now copy chars from this string into
117+ # the char array, starting at the indicated
118+ # position (p3) of the char array.
119+ for( x:=0; x<copy_count; x++ )
120+ p2.ary[p3+x] = this.str[p0+x];
121+
122+}#<<
123+
124+equality_rString_Z_Z( this : JString, p0 : JString,p1 : int) : int
125+{#>>
126+ if ( p0 == nil )
127+ return( JNI->FALSE );
128+
129+ if ( this.str == p0.str )
130+ return( JNI->TRUE );
131+
132+ # check if we should ignore case
133+ if ( p1 )
134+ return( str->toupper(this.str) == str->toupper(p0.str) );
135+
136+ # strings not equal
137+ return( JNI->FALSE );
138+
139+}#<<
140+
141+compareTo_rString_I( this : JString, p0 : JString) : int
142+{#>>
143+ # compare 'p0' to this.
144+ # return: 0 => equal
145+ # <0 => this < p0
146+ # >0 => this > p0
147+
148+ this_str := this.str;
149+ other := p0.str;
150+
151+ # simple equlity check
152+ if ( this_str == other )
153+ return( 0 );
154+
155+ # otherwise, determine if "this" is
156+ # lexicographically smaller than "other"
157+
158+ this_len := len this_str;
159+ other_len := len other;
160+ min := 0;
161+ if ( this_len < other_len )
162+ min = this_len;
163+ else
164+ min = other_len;
165+
166+ # find char where strings differ
167+ x:=0;
168+ while( (x<min) && (this_str[x]==other[x]) ) x++;
169+
170+ # is one string a proper prefix of the other?
171+ if(x == min)
172+ return this_len - other_len;
173+
174+ # if some chars were common then "this" is
175+ # smaller if the character where they differ
176+ # has a smaller value than "other"
177+ return( this_str[x] - other[x] );
178+}#<<
179+
180+regionMatches_Z_I_rString_I_I_Z( this : JString, p0 : int,p1 : int,p2 : JString,p3 : int,p4 : int) : int
181+{#>>
182+ # p0 => ignore case==1
183+ # p1 => this start index
184+ # p2 => other string
185+ # p3 => other start index
186+ # p4 => length to compare
187+
188+ # check params
189+ if ( (p1<0) || (p1 > (len this.str - p4)) ||
190+ (p3<0) || (p3 > (len p2.str - p4)) )
191+ return( jni->FALSE );
192+
193+ this_str, other : string;
194+
195+ this_last := (p1+p4);
196+ other_last := (p3+p4);
197+
198+ if ( int p0 == 1 )
199+ {
200+ # ignore case
201+ this_str = str->toupper(this.str[p1:this_last]);
202+ other = str->toupper(p2.str[p3:other_last]);
203+ }
204+ else
205+ {
206+ # case sensitive
207+ this_str = this.str[p1:this_last];
208+ other = p2.str[p3:other_last];
209+ }
210+
211+ # now compare the two substrings
212+ return( this_str == other );
213+}#<<
214+
215+hashCode_I( this : JString) : int
216+{#>>
217+ # hashcode of string as defined in JLS
218+ strhash := 0;
219+ this_str := this.str;
220+ this_len := len this_str;
221+
222+ if ( this_len <= 15 )
223+ {
224+ for(x:=0; x<this_len; x++)
225+ strhash = (strhash*37) + this_str[x];
226+ }
227+ else
228+ {
229+ k := int (this_len/8);
230+ for(x:=0; x < this_len; x+=k)
231+ strhash = (strhash*39) + this_str[x];
232+ }
233+
234+ return( strhash );
235+}#<<
236+
237+substring_I_I_rString( this : JString, p0 : int,p1 : int) : JString
238+{#>>
239+ # return string composed of chars p0..p1-1 both
240+ # java and limbo allow the p1 to be (len this.str)
241+ this_len := len this.str;
242+ if ( (p0 < 0) || (p1 > this_len) || (p0 > p1) )
243+ jni->ThrowException( "java.lang.StringIndexOutOfBoundsException",
244+ jni->sys->sprint( "len=%d begin=%d end=%d", this_len, p0, p1 ) );
245+
246+ return( jni->NewString( this.str[p0:p1] ) );
247+}#<<
248+
249+concat_rString_rString( this : JString, p0 : JString) : JString
250+{#>>
251+ if ( p0 == nil )
252+ jni->ThrowException( "java.lang.NullPointerException", "concat arg is null" );
253+
254+ # as defined in JLS: if p0 is 0 len return ref to this
255+ if ( (len p0.str) == 0 )
256+ return( this );
257+
258+ # return a new string composed of this+p0
259+ return( jni->NewString( this.str + p0.str ) );
260+}#<<
261+
262+replace_C_C_rString( this : JString, p0 : int,p1 : int) : JString
263+{#>>
264+ # p0 => old char, p1 => new char
265+ # if p0 does not exist in this then
266+ # return reference to this
267+ # otherwise return a new string which
268+ # is composed of the 'this' with all
269+ # old char's (p0) replaced with new chars (p1)
270+
271+ newstr := this.str[:];
272+ found := 0;
273+ for(x:=0; x<(len newstr); x++)
274+ {
275+ if ( newstr[x] == p0 )
276+ {
277+ found = 1;
278+ newstr[x] = p1;
279+ }
280+ }
281+
282+ if ( ! found )
283+ return( this );
284+
285+ return( jni->NewString( newstr ) );
286+}#<<
287+
288+trim_rString( this : JString) : JString
289+{#>>
290+ # as defined in JLS
291+ if ( this.str == "" )
292+ return( this );
293+
294+ this_str := this.str;
295+ if ( (this_str[0] > '\u0020') && (this_str[len this_str-1] > '\u0020') )
296+ return( this );
297+
298+ # look for first char > \u0020
299+ for( x:=0; x<(len this_str); x++ )
300+ if ( this_str[x] > '\u0020' ) break;
301+
302+ # if no chars < \u0020 found return a new "empty string"
303+ if ( x == len this_str )
304+ return( jni->NewString( "" ) );
305+
306+ first := x;
307+
308+ # look for last char > \u0020
309+ for( x=(len this_str -1); x >= 0; x-- )
310+ if ( this_str[x] > '\u0020' ) break;
311+
312+ last := x; # this has to be at least ==first
313+
314+ return( jni->NewString( this_str[first:last+1] ) );
315+
316+}#<<
317+
318+intern_rString( this : JString) : JString
319+{#>>
320+ # as defined in JLS
321+ # need to maintain a private pool of String
322+ # objects and return the same object for a
323+ # given string
324+ return( PoolGet( this ) );
325+}#<<
326+
327+utfLength_I( this : JString) : int
328+{#>>
329+ b : array of byte;
330+ b = array of byte this.str;
331+ return( len b );
332+}#<<
333+
334+fill_aC_I_I_V( this : JString, p0 : JArrayC,p1 : int,p2 : int)
335+{#>>
336+ #
337+ # create a newstring from the array of int
338+ #
339+
340+ # check array length
341+ if ( (p1+p2) > len p0.ary )
342+ jni->ThrowException( "java.lang.ArrayIndexOutOfBoundsException", string (len p0.ary) );
343+
344+ this.str = nil; # get rid of what is there
345+
346+ # now append each char to the string value
347+ # Lecuona correction: for( x:=0; x<(p2-p1); x++ )
348+ for( x:=0; x<p2; x++ )
349+ this.str[x] = p0.ary[x+p1];
350+}#<<
351+
352+isPrefix_rString_I_Z( this : JString, p0 : JString,p1 : int) : int
353+{#>>
354+ # p0 => string to compare
355+ # p1 => start index
356+
357+ # do some checking
358+ if ( p0 == nil )
359+ jni->ThrowException( "java.lang.NullPointerException", "String.isPrefix()" );
360+ other_len := len p0.str;
361+ endix := other_len + p1; # can overflow
362+ if ( p1 < 0 || endix > len this.str || endix < 0 )
363+ return( jni->FALSE );
364+ if ( other_len == 0 )
365+ return( jni->TRUE ); # JLS defined
366+ return( p0.str == this.str[p1:p1+other_len] );
367+}#<<
368+
369+isSuffix_rString_Z( this : JString, p0 : JString) : int
370+{#>>
371+ start := (len this.str) - (len p0.str);
372+ if ( start < 0 )
373+ return( jni->FALSE );
374+
375+ return( p0.str == this.str[start:] );
376+}#<<
377+
378+uppercase_rString( this : JString) : JString
379+{#>>
380+ return( jni->NewString( str->toupper(this.str) ) );
381+}#<<
382+
383+lowercase_rString( this : JString) : JString
384+{#>>
385+ return( jni->NewString( str->tolower(this.str) ) );
386+}#<<
387+
388+index_rString_I_I( this : JString, p0 : JString,p1 : int) : int
389+{#>>
390+ # p0 => string to match
391+ # p1 => index to start search from
392+ # p2 => searche left-right=1 right-left=0
393+ this_str := this.str;
394+ this_len := len this_str;
395+ other := p0.str;
396+ other_len := len other;
397+
398+ # if other > this then it can't be a substring
399+ if ( other_len > this_len )
400+ return( -1 );
401+
402+ # if start index <0 make it 0, if > len return -1
403+ from := 0;
404+ if ( p1 > 0 )
405+ {
406+ from = p1;
407+ # this also handles p1 > this_len
408+ # which will return -1 below, we
409+ }
410+
411+ # null string always matches
412+ if ( other_len == 0 )
413+ return from;
414+
415+ # determine char of this to stop searching on
416+ stop_char := this_len - other_len;
417+
418+ # look for first-char match then
419+ # match the substring.
420+ for( i:=from; i <= stop_char; i++ )
421+ if ( (this_str[i] == other[0]) &&
422+ (this_str[i:i+other_len] == other) )
423+ return( i );
424+
425+ # match failed
426+ return( -1 );
427+}#<<
428+
429+index_I_I_I( this : JString, p0 : int,p1 : int) : int
430+{#>>
431+ # p0 => char to match
432+ # p1 => start index
433+
434+ this_str := this.str;
435+ this_len := len this_str;
436+
437+ # if start index <0 make it 0, if > len return -1
438+ from := 0;
439+ if ( p1 > 0 )
440+ from = p1;
441+
442+ # start from left,
443+ # look for first match
444+ for( i:=from; i < this_len; i++ )
445+ if ( this_str[i] == p0 )
446+ return( i );
447+
448+ # match failed
449+ return( -1 );
450+}#<<
451+
452+rindex_rString_I_Z_I( this : JString, p0 : JString,p1 : int,p2 : int) : int
453+{#>>
454+ # p0 => string to match
455+ # p1 => index to start search from
456+ # p2 => 1 == search from end (ignore p1)
457+ this_str := this.str;
458+ this_len := len this_str;
459+ other := p0.str;
460+ other_len := len other;
461+
462+ # if other > this then it can't be a substring
463+ if ( other_len > this_len )
464+ return( -1 );
465+
466+ # if start index > this_len-other_len make it this_len-other_len
467+ # if < 0 return -1
468+ from := this_len - other_len;
469+ if ( (p2 != 1) && (p1 < from) )
470+ {
471+ from = p1;
472+ # this also handles the defined case
473+ # of p1 < 0 is the same as p1==-1 and
474+ # will return -1 below
475+ }
476+
477+ # start from end
478+ if ( other_len == 0 )
479+ return( from ); # empty string always matches
480+
481+ # look for first char match starting from right
482+ # then match the substring
483+ for( i:=from; i >= 0; i-- )
484+ if ( (this_str[i] == other[0]) &&
485+ (this_str[i:i+other_len] == other) )
486+ return(i);
487+
488+ return(-1); #no match
489+}#<<
490+
491+rindex_I_I_Z_I( this : JString, p0 : int,p1 : int,p2 : int) : int
492+{#>>
493+ # p0 => char to match
494+ # p1 => start index
495+ # p2 => 1 == scan from (len this.str -1)
496+
497+ this_str := this.str;
498+
499+ # if start index < 0 return -1, if > len this.str make it the length
500+ from := len this_str - 1;
501+ if ( (p2 != 1) && (p1 < from) )
502+ {
503+ from = p1;
504+ }
505+
506+ # start from right
507+ # look for first match
508+ for( i:=from; i >= 0; i-- )
509+ if ( this_str[i] == p0 )
510+ return(i);
511+
512+ # match failed
513+ return( -1 );
514+}#<<
515+
516+
517+
java/pkg2/java/lang/String_L.m+30−0
@@ -0,0 +1,30 @@
1+# javal v1.6 generated file: edit with care
2+
3+String_L : module
4+{
5+
6+ init : fn( jni_p : JNI );
7+ length_I : fn( this : JString) : int;
8+ charAt_I_C : fn( this : JString, p0 : int) : int;
9+ getChars_I_I_aC_I_V : fn( this : JString, p0 : int,p1 : int,p2 : JArrayC,p3 : int);
10+ equality_rString_Z_Z : fn( this : JString, p0 : JString,p1 : int) : int;
11+ compareTo_rString_I : fn( this : JString, p0 : JString) : int;
12+ regionMatches_Z_I_rString_I_I_Z : fn( this : JString, p0 : int,p1 : int,p2 : JString,p3 : int,p4 : int) : int;
13+ hashCode_I : fn( this : JString) : int;
14+ substring_I_I_rString : fn( this : JString, p0 : int,p1 : int) : JString;
15+ concat_rString_rString : fn( this : JString, p0 : JString) : JString;
16+ replace_C_C_rString : fn( this : JString, p0 : int,p1 : int) : JString;
17+ trim_rString : fn( this : JString) : JString;
18+ intern_rString : fn( this : JString) : JString;
19+ utfLength_I : fn( this : JString) : int;
20+ fill_aC_I_I_V : fn( this : JString, p0 : JArrayC,p1 : int,p2 : int);
21+ isPrefix_rString_I_Z : fn( this : JString, p0 : JString,p1 : int) : int;
22+ isSuffix_rString_Z : fn( this : JString, p0 : JString) : int;
23+ uppercase_rString : fn( this : JString) : JString;
24+ lowercase_rString : fn( this : JString) : JString;
25+ index_rString_I_I : fn( this : JString, p0 : JString,p1 : int) : int;
26+ index_I_I_I : fn( this : JString, p0 : int,p1 : int) : int;
27+ rindex_rString_I_Z_I : fn( this : JString, p0 : JString,p1 : int,p2 : int) : int;
28+ rindex_I_I_Z_I : fn( this : JString, p0 : int,p1 : int,p2 : int) : int;
29+
30+};
java/pkg2/java/lang/System.java+0−0

Empty file added.

java/pkg2/java/lang/System_L.b+133−0
@@ -0,0 +1,133 @@
1+implement System_L;
2+
3+# javal v1.2 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JObject : import jni;
23+
24+#>> extra pre includes here
25+
26+#<<
27+
28+include "System_L.m";
29+
30+#>> extra post includes here
31+include "workdir.m";
32+
33+cast : Cast;
34+system_class : JNI->ClassData; # java.lang.System class data
35+
36+#<<
37+
38+init( jni_p : JNI )
39+{
40+ # save java native inteface mod instance
41+ jni = jni_p;
42+ #>>extra initialization here
43+ system_class = jni->FindClass( "java/lang/System" );
44+ if ( system_class == nil )
45+ jni->InitError( "System_L.init(): failed to find System class" );
46+
47+ # we Cast in this module
48+ cast = jni->CastMod();
49+ #<<
50+}
51+
52+setIn0_rInputStream_V( p0 : JObject)
53+{#>>
54+ Value : import JNI;
55+ val := ref Value.TObject(p0);
56+ jni->SetStaticField( system_class, "in", val );
57+}#<<
58+
59+setOut0_rPrintStream_V( p0 : JObject)
60+{#>>
61+ Value : import JNI;
62+ val := ref Value.TObject(p0);
63+ jni->SetStaticField( system_class, "out", val );
64+}#<<
65+
66+setErr0_rPrintStream_V( p0 : JObject)
67+{#>>
68+ Value : import JNI;
69+ val := ref Value.TObject(p0);
70+ jni->SetStaticField( system_class, "err", val );
71+}#<<
72+
73+currentTimeMillis_J( ) : big
74+{#>>
75+ fd := jni->sys->open("#c/time", jni->sys->OREAD);
76+ if(fd == nil)
77+ return big 0;
78+ buf := array[128] of byte;
79+ n := jni->sys->read(fd, buf, len buf);
80+ if(n < 0)
81+ return big 0;
82+
83+ return ( (big string buf[:n]) / big 1000 );
84+}#<<
85+
86+arraycopy_rObject_I_rObject_I_I_V( p0 : JObject,p1 : int,p2 : JObject,p3 : int,p4 : int)
87+{#>>
88+ jni->jldr->arraycopy( cast->ToJArray(p0), p1, cast->ToJArray(p2), p3, p4 );
89+}#<<
90+
91+identityHashCode_rObject_I( p0 : JObject) : int
92+{#>>
93+ return( jni->IdentityHash(p0) );
94+}#<<
95+
96+GetUserName_rString( ) : JString
97+{#>>
98+ # return the current inferno user
99+ # name as a Java String
100+ #
101+ user_name : string;
102+
103+ fd := jni->sys->open("#c/user", jni->sys->OREAD);
104+ if(fd == nil)
105+ user_name = "unknown";
106+ else {
107+ buf := array[128] of byte;
108+ n := jni->sys->read(fd, buf, len buf);
109+ if(n < 0)
110+ user_name = "unknown";
111+ else
112+ user_name = string buf[:n];
113+ }
114+
115+ # make java string from user name
116+ return( jni->NewString( user_name ) );
117+}#<<
118+
119+GetCWD_rString( ) : JString
120+{#>>
121+ # return the current working directory
122+ # as a Java String
123+ #
124+ # this fct is really only called once so
125+ # just load Workdir right here
126+ wdir := load Workdir Workdir->PATH;
127+ if ( wdir == nil )
128+ jni->InitError( jni->sys->sprint( "java.lang.System: could not load %s: %r", Workdir->PATH ) );
129+
130+ return( jni->NewString( wdir->init() ) );
131+}#<<
132+
133+
java/pkg2/java/lang/System_L.m+20−0
@@ -0,0 +1,20 @@
1+# javal v1.2 generated file: edit with care
2+
3+System_L : module
4+{
5+ System_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ };
9+
10+ init : fn( jni_p : JNI );
11+ setIn0_rInputStream_V : fn( p0 : JObject);
12+ setOut0_rPrintStream_V : fn( p0 : JObject);
13+ setErr0_rPrintStream_V : fn( p0 : JObject);
14+ currentTimeMillis_J : fn( ) : big;
15+ arraycopy_rObject_I_rObject_I_I_V : fn( p0 : JObject,p1 : int,p2 : JObject,p3 : int,p4 : int);
16+ identityHashCode_rObject_I : fn( p0 : JObject) : int;
17+ GetUserName_rString : fn( ) : JString;
18+ GetCWD_rString : fn( ) : JString;
19+
20+};
java/pkg2/java/lang/Thread.java+0−0

Empty file added.

java/pkg2/java/lang/ThreadDeath.java+0−0

Empty file added.

java/pkg2/java/lang/ThreadGroup.java+0−0

Empty file added.

java/pkg2/java/lang/Thread_L.b+455−0
@@ -0,0 +1,455 @@
1+implement Thread_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+#<<
28+
29+include "Thread_L.m";
30+
31+#>> extra post includes here
32+
33+sys : Sys;
34+jldr : JavaClassLoader;
35+cast : Cast;
36+
37+# following used for calling Thread.run()
38+threadclass : JNI->ClassData; #class data for java.lang.Thread
39+thread_run_idx : int; #method index for Thread.run()
40+thread_exit_idx : int; #method index for Thread.exit()
41+
42+# some imports
43+ThreadData : import jldr;
44+
45+#<<
46+
47+init( jni_p : JNI )
48+{
49+ # save java native inteface mod instance
50+ jni = jni_p;
51+ #>>extra initialization here
52+
53+ sys = jni->sys;
54+ jldr = jni->jldr;
55+ cast = jni->CastMod();
56+
57+ threadclass = jni->FindClass( "java.lang.Thread" );
58+ if ( threadclass == nil )
59+ jni->InitError( "Thread_L.init(): could not get thread class" );
60+
61+ Class : import jldr;
62+ thread_run_idx = threadclass.findvmethod( "run", "()V" );
63+ if ( thread_run_idx == -1 )
64+ jni->InitError( "Thread_L.init(): could not locate Thread.run()" );
65+
66+ #thread_exit_idx = threadclass.findvmethod( "exit", "()V" );
67+ #if ( exit_idx == -1 )
68+ # jni->InitError( "Thread_L.init(): could not locate Thread.exit()" );
69+ #<<
70+}
71+
72+currentThread_rThread( ) : JThread
73+{#>>
74+ e := ref Sys->Exception;
75+ if ( sys->rescue("*",e) == Sys->HANDLER )
76+ {
77+ # get the java thread object assocciated
78+ # with this thread. it is stored in the
79+ # class loader's thread structure.
80+ thd_obj := jldr->getthreaddata().this;
81+ if ( thd_obj != nil )
82+ return( cast->JObjToJThd(thd_obj) );
83+ sys->unrescue();
84+ }
85+ else
86+ sys->rescued(Sys->ONCE, nil);
87+
88+
89+ # either we could not find the thread data
90+ # or no "Thread" object was stored in it
91+ # either way we are in bad shape
92+ jni->FatalError( "could not get thread object" );
93+
94+ return(nil);
95+}#<<
96+
97+yield_V( )
98+{#>>
99+ jni->sys->sleep(0);
100+}#<<
101+
102+sleep_J_V( p0 : big)
103+{#>>
104+ millis := int p0;
105+
106+ if ( millis < 1 )
107+ {
108+ if ( millis == 0 )
109+ {
110+ # just yield thread
111+ jni->sys->sleep(0);
112+ return;
113+ }
114+
115+ # bad sleep value
116+ jni->ThrowException( "java.lang.IllegalArgumentException", "timeout value is negative" );
117+ }
118+ jldr->sleep( millis );
119+}#<<
120+
121+start_V( this : JThread)
122+{#>>
123+ thdobj := cast->JThdToJObj(this);
124+
125+ # grab the lock on the thread object to ensure
126+ # no state is changed while we are starting the
127+ # thread.
128+# jni->MonitorEnter( thdobj );
129+
130+ if ( (this.stillborn == byte 0) && (this.PrivateInfo == nil) )
131+ {
132+ # spawn a limbo fct as the java
133+ # thread's starting point.
134+ ok := chan of int;
135+ spawn javathreadinit( this, ok );
136+
137+ # wait for thread to init then we can
138+ # continue. Note we hold a lock and
139+ # the thread will change some state
140+ # and notify us before the java run()
141+ # method is invoked. The purpose is to
142+ # allow for state information to be updated
143+ # while we have the lock.
144+ status := <- ok;
145+
146+ #status == 0 is an err
147+ # == 1 is ok
148+
149+ if ( status == 0 )
150+ {
151+ this.stillborn = byte 1;
152+ this.PrivateInfo = nil;
153+ }
154+
155+ }
156+# jni->MonitorExit( thdobj );
157+}#<<
158+
159+isInterrupted_Z_Z( this : JThread, p0 : int) : int
160+{#>>
161+ old_flag := int this.was_interrupted;
162+
163+ if ( old_flag )
164+ this.was_interrupted = byte p0;
165+ return( old_flag );
166+}#<<
167+
168+isAlive_Z( this : JThread) : int
169+{#>>
170+ thd := this.PrivateInfo;
171+ if ( (this.stillborn == byte 0) && (thd != nil) )
172+ {
173+ # JLS does not require that we actually determine
174+ # the "os" thread is alive, just that the object
175+ # state indicates it is
176+ return( JNI->TRUE );
177+ }
178+
179+ # looks like thread is not alive
180+ return( jni->FALSE );
181+}#<<
182+
183+countStackFrames_I( this : JThread) : int
184+{#>>
185+ junk := this;
186+ # need to do some /prog work
187+ return( 0 );
188+}#<<
189+
190+setPriority0_I_V( this : JThread, p0 : int)
191+{#>>
192+ # just save the priority, a dis thread
193+ # has no priority
194+ this.priority = p0;
195+}#<<
196+
197+stop0_rObject_V( this : JThread, p0 : JObject)
198+{#>>
199+ # the calling thread is attempting to throw an
200+ # exception at "this" thread (i.e. the one represented
201+ # by this thread object. make sure that thread at least
202+ # appears to be running and throw the exceptio at it
203+
204+ thd := this.PrivateInfo;
205+ stillborn := this.stillborn;
206+
207+ # prevent a start or re-start
208+ this.stillborn = byte 1;
209+
210+ if ( (stillborn == byte 0) && (thd != nil) )
211+ {
212+ # throw the exception (p0) at the thread
213+ jldr->stop( thd, p0 );
214+ }
215+
216+}#<<
217+
218+suspend0_V( this : JThread)
219+{#>>
220+ # the calling thread wants to suspend
221+ # the "this" thread.
222+ thd := this.PrivateInfo;
223+ if ( (this.stillborn == byte 0) && (thd != nil) )
224+ jldr->suspend( thd );
225+
226+}#<<
227+
228+resume0_V( this : JThread)
229+{#>>
230+ # the calling thread wants to resume
231+ # the "this" thread.
232+ thd := this.PrivateInfo;
233+ if ( (this.stillborn == byte 0) && (thd != nil) )
234+ jldr->resume( thd );
235+}#<<
236+
237+interrupt0_V( this : JThread)
238+{#>>
239+ # the calling thread wants to interrupt
240+ # the "this" thread.
241+ thd := this.PrivateInfo;
242+ if ( (this.stillborn == byte 0) && (thd != nil) )
243+ jldr->interrupt( thd );
244+}#<<
245+
246+lowinit_rThread_V( p0 : JThread)
247+{#>>
248+ # this fct is called once during the static init of the
249+ # java.lang.Thread object. 'p0' is the "root thread" object
250+ # which must be associated witht the Dis thread which is
251+ # calling this fuction -- i.e. associate the 'p0' java thread
252+ # object with the current Dis thread. 'p1' is the same thread
253+ # object, just with the type JObject which allows us to store
254+ # it off in the JavaClassLoader->ThreadData structure associated
255+ # with the calling Dis thread.
256+
257+ # since this is the root thread make a root thread group by
258+ # creating an instance of ThreadGroup and calling its private
259+ # default constructor.
260+ thd_grp_cl := jni->FindClass( "java.lang.ThreadGroup" );
261+ if ( thd_grp_cl == nil )
262+ jni->FatalError( "could not obtain ThreadGroup class" );
263+
264+ thd_grp := jni->NewObject( thd_grp_cl );
265+ if ( thd_grp == nil )
266+ jni->FatalError( "could not created root threadgroup" );
267+ p0.group = thd_grp;
268+
269+ # get the ThreadData structure for the calling thread
270+ thd := jldr->getthreaddata();
271+ thd.this = cast->JThdToJObj(p0); # save java object in thread data
272+ p0.PrivateInfo = thd; # save thread data in java object
273+
274+}#<<
275+
276+
277+
278+
279+
280+##### private functions used by the Thread_L module
281+
282+#
283+# this function is the first function of all java
284+# threads, except for the first thread which is
285+# controlled by the JavaClassLoader module.
286+#
287+# jthd : the Java thread object associated with this
288+# Dis thread.
289+#
290+# ok : use this channel to notify "spawner" that
291+# we are under-way. send 0==fail; 1==ok
292+#
293+javathreadinit( jthd : JNI->JThread, ok : chan of int )
294+{
295+ # create a JavaClassLoader->ThreadData structure
296+ # and "register" it with the class loader.
297+
298+ thd := jldr->getthreaddata();
299+
300+ if ( thd.this != nil )
301+ {
302+ # this should be nil, else the java thread
303+ # already is set for this Dis thread and we
304+ # are in some screwed-up state.
305+ ok <-= 0;
306+ return;
307+ }
308+
309+ # now fill in the java thread obj (after
310+ # the putthreaddata so any init is not affected
311+ thdobj := cast->JThdToJObj( jthd );
312+ thd.this = thdobj;
313+
314+ # now save the ThreadData in the java object in order
315+ # to allow a lookup from the other diretion
316+ jthd.PrivateInfo = thd;
317+
318+ # set our daemon thread status
319+ if ( jthd.daemon == JNI->BTRUE )
320+ jldr->daemonize();
321+
322+ # notify spawner we are under-way
323+ ok <- = 1;
324+
325+ # we need to catch any exceptions in order
326+ # to clean up the thread object's state
327+ ee := ref Sys->Exception;
328+ if ( sys->rescue( "*", ee ) == Sys->HANDLER )
329+ {
330+
331+ # call Thread.run() or Runnable.run()
332+ Run( jthd, thdobj );
333+
334+ # call Thread.exit()
335+ (mod,idx) := jni->FindMethod( threadclass, "exit", "()V", JNI->METH_PRIVATE );
336+ jni->jassist->mcall1( mod, idx, thdobj );
337+ sys->unrescue();
338+ }
339+ else
340+ {
341+ # clear exception
342+ sys->rescued( Sys->ONCE, nil );
343+
344+ # thread threw an unhandled exception so
345+ # call the ThreadGroup.uncaughtException()
346+ # method.
347+ UncaughtException( jthd, thdobj, ee );
348+ }
349+
350+ # java thread clean up
351+
352+ jni->jldr->monitorenter( thdobj ); ##LOCK thread object
353+ {
354+
355+ jthd.stillborn = byte 1; # prevent re-run
356+
357+ # notify ALL "waiters" (which includes any Thread.join()'s)
358+ jni->jldr->monitornotify( thdobj, 1 );
359+ }
360+ jni->jldr->monitorexit( thdobj ); ##UNLOCK thread object
361+
362+ # clean up thread structures
363+ jldr->delthreaddata();
364+ thd.this = nil;
365+ jthd.PrivateInfo = nil;
366+}
367+
368+
369+#
370+# if the thread object contains a "registered" Runnable
371+# object then execute that Runnable's run() method, else
372+# execute the Thread's run() method (which should be
373+# overridden.
374+#
375+Run( jthd : JNI->JThread, thdobj : JObject )
376+{
377+ Class : import jldr;
378+ class : JNI->ClassData;
379+ run_idx := thread_run_idx; #default to Thread.run()
380+ obj := thdobj; #this obj for run() call
381+
382+ if ( jthd.target != nil )
383+ {
384+ # the thread has a registered Runnable
385+ # object, find its run() method
386+ class = jni->GetObjectClassData( jthd.target );
387+ run_idx = class.findvmethod( "run", "()V" );
388+ if ( run_idx == -1 )
389+ return;
390+ obj = jthd.target; #set 'this' to the runnable obj
391+ }
392+ else
393+ {
394+ # use the thread object's run()
395+ class = jni->GetObjectClassData(thdobj);
396+ }
397+
398+ run_method := class.virtualmethods[run_idx];
399+
400+ # do the run()
401+ jni->jassist->mcall1( run_method.class.mod, run_method.field.value, obj );
402+}
403+
404+#
405+# If the thread's ThreadGroup is a subclass of java.lang.ThreadGroup
406+# then invoke that class'es "uncaughtException" method. This
407+# method is called whenever a thread does not handle an exception.
408+# The method is passed an instance of the Thread along with the
409+# "throwable" (i.e. exception).
410+#
411+UncaughtException( jthd : JThread, thdobj : JObject, ee : ref Sys->Exception )
412+{
413+ tgrp_cl := jni->GetObjectClassData( jthd.group );
414+
415+ #
416+ # if the thread group is the default thread group
417+ # class, then we will handle the excepition here
418+ # which is to simply do nothing.
419+ #
420+ if ( tgrp_cl.name != "java/lang/ThreadGroup" )
421+ {
422+ # call method, protected against exceptions
423+ # since we must still clean-up the thread
424+ eee := ref Sys->Exception;
425+ if ( sys->rescue( "*", eee ) == Sys->HANDLER )
426+ {
427+ # find the uncaughtException method for the thd-grp
428+ (mod,idx) := jni->FindMethod( tgrp_cl, "uncaughtException",
429+ "(Ljava.lang.Thread;Ljava.lang.Throwable;)V",
430+ JNI->METH_VIRTUAL );
431+ if ( mod != nil )
432+ {
433+ # call the uncaughException handler
434+ Value : import jni;
435+ args := array[] of
436+ {
437+ ref Value.TObject(thdobj), #the thread
438+ ref Value.TObject(jldr->culprit(ee)) #the exception
439+ };
440+
441+ # do the call
442+ ##LATER nil := jni->LowCall( mod, idx, jthd.group, args );
443+ }
444+ sys->unrescue();
445+ }
446+ else
447+ {
448+ # if we get an exception here just return
449+ # and let the thread finish cleanup.
450+ sys->rescued( Sys->ONCE, nil );
451+ }
452+ }
453+
454+}
455+
java/pkg2/java/lang/Thread_L.m+21−0
@@ -0,0 +1,21 @@
1+# javal v1.3 generated file: edit with care
2+
3+Thread_L : module
4+{
5+
6+ init : fn( jni_p : JNI );
7+ currentThread_rThread : fn( ) : JThread;
8+ yield_V : fn( );
9+ sleep_J_V : fn( p0 : big);
10+ start_V : fn( this : JThread);
11+ isInterrupted_Z_Z : fn( this : JThread, p0 : int) : int;
12+ isAlive_Z : fn( this : JThread) : int;
13+ countStackFrames_I : fn( this : JThread) : int;
14+ setPriority0_I_V : fn( this : JThread, p0 : int);
15+ stop0_rObject_V : fn( this : JThread, p0 : JObject);
16+ suspend0_V : fn( this : JThread);
17+ resume0_V : fn( this : JThread);
18+ interrupt0_V : fn( this : JThread);
19+ lowinit_rThread_V : fn( p0 : JThread);
20+
21+};
java/pkg2/java/lang/Throwable.java+0−0

Empty file added.

java/pkg2/java/lang/Throwable_L.b+96−0
@@ -0,0 +1,96 @@
1+implement Throwable_L;
2+
3+# javal v1.2 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JObject : import jni;
23+
24+#>> extra pre includes here
25+
26+#<<
27+
28+include "Throwable_L.m";
29+
30+#>> extra post includes here
31+
32+#<<
33+
34+init( jni_p : JNI )
35+{
36+ # save java native inteface mod instance
37+ jni = jni_p;
38+ #>>extra initialization here
39+ #<<
40+}
41+
42+printStackTrace0_rObject_V( this : ref Throwable_obj, p0 : JObject)
43+{#>>
44+ Value : import jni;
45+ jldr := jni->jldr;
46+ Object : import jldr;
47+
48+ if ( this.backtrace != nil )
49+ {
50+ args := array[] of
51+ {
52+ ref Value.TObject( jni->NewStringObject( string this.backtrace ) )
53+ };
54+ (nil,nil):=jni->CallMethod( p0, "println", "(Ljava/lang/String;)V", args );
55+ # ignore any erros
56+ }
57+
58+}#<<
59+
60+fillInStackTrace_rThrowable( this : ref Throwable_obj) : ref Throwable_obj
61+{#>>
62+ # attempt to open the local "prog" device (i.e. '#p')
63+ # and read the call stack into an array of bytes
64+ pid := jni->sys->pctl(0,nil);
65+ progfile := "#p/"+ (string pid) +"/stack";
66+ fd := jni->sys->open( progfile, Sys->OREAD );
67+ if ( fd != nil )
68+ {
69+ # must spin a thread to read my own call-stack
70+ result := chan of array of byte; # channel for thd results
71+ spawn ReadCallStack( fd, result );
72+ this.backtrace = <- result; # wait for results
73+
74+ }
75+ else
76+ this.backtrace = array of byte jni->sys->sprint("could not open %s:%r\n", progfile );
77+
78+ return( this );
79+}#<<
80+
81+####### private functions
82+
83+
84+ReadCallStack( fd : ref Sys->FD, result : chan of array of byte )
85+{
86+ buf := array[8000] of byte; #about 10 frames
87+ n := jni->sys->read(fd, buf, len buf - 1);
88+ fd = nil;
89+ if(n < 0)
90+ buf = array of byte jni->sys->sprint("could not read call-stack:%r\n");
91+ else
92+ buf[n] = byte 0;
93+
94+ result <- = buf[:n+1];
95+}
96+
java/pkg2/java/lang/Throwable_L.m+16−0
@@ -0,0 +1,16 @@
1+# javal v1.2 generated file: edit with care
2+
3+Throwable_L : module
4+{
5+ Throwable_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ backtrace : array of byte;
9+ detailMessage : JString;
10+ };
11+
12+ init : fn( jni_p : JNI );
13+ printStackTrace0_rObject_V : fn( this : ref Throwable_obj, p0 : JObject);
14+ fillInStackTrace_rThrowable : fn( this : ref Throwable_obj) : ref Throwable_obj;
15+
16+};
java/pkg2/java/lang/UnknownError.java+0−0

Empty file added.

java/pkg2/java/lang/UnsatisfiedLinkError.java+0−0

Empty file added.

java/pkg2/java/lang/VerifyError.java+0−0

Empty file added.

java/pkg2/java/lang/VirtualMachineError.java+0−0

Empty file added.

java/pkg2/java/lang/Void.java+0−0

Empty file added.

java/pkg2/java/lang/mkfile+152−0
@@ -0,0 +1,152 @@
1+<../../../../mkconfig
2+
3+DIRS=\
4+ reflect\
5+
6+TARG=\
7+ AbstractMethodError.dis\
8+ ArithmeticException.dis\
9+# for ArrayIndexOutOfBoundsException.dis\
10+ ++5KkA5LRlUzD1nsDM8Mj.dis\
11+ ArrayStoreException.dis\
12+ Boolean.dis\
13+ Byte.dis\
14+ Character.dis\
15+ Class.dis\
16+ ClassCastException.dis\
17+ ClassCircularityError.dis\
18+ ClassFormatError.dis\
19+ ClassLoader.dis\
20+# for ClassNotFoundException.dis\
21+ S1vm8N5TePhsu3h1FO7yj.dis\
22+# for CloneNotSupportedException.dis\
23+ wmF21yXDq7VxPRRLc7v5t.dis\
24+ Cloneable.dis\
25+ Compiler.dis\
26+ Double.dis\
27+ Error.dis\
28+ Exception.dis\
29+# for ExceptionInInitializerError.dis\
30+ Ub2BD3PjJRDSI4wyZi7ID.dis\
31+ Float.dis\
32+ IllegalAccessError.dis\
33+# for IllegalAccessException.dis\
34+ ClJ4BmIE1TECvv1qdqbQN.dis\
35+# for IllegalArgumentException.dis\
36+ Z07h8c1IAX5LIjYbhqgGl.dis\
37+# for IllegalMonitorStateException.dis\
38+ 375fcBxmum6K8ZSGn7W2N.dis\
39+ IllegalStateException.dis\
40+# for IllegalThreadStateException.dis\
41+ 1PLXdCFiGoZkxBoL8Bo0P.dis\
42+# for IncompatibleClassChangeError.dis\
43+ FiACrRolKM+iZTikdgUFa.dis\
44+# for IndexOutOfBoundsException.dis\
45+ IKsPHNdWGHpuZGqgvYD4e.dis\
46+ InfernoProcess.dis\
47+ InstantiationError.dis\
48+# for InstantiationException.dis\
49+ jhj+E2mCFNmQ2VUL0zYp8.dis\
50+ Integer.dis\
51+ InternalError.dis\
52+ InterruptedException.dis\
53+ LinkageError.dis\
54+ Long.dis\
55+ Math.dis\
56+# for NegativeArraySizeException.dis\
57+ iu6-cux1hLK1GoPKq9m1l.dis\
58+ NoClassDefFoundError.dis\
59+ NoSuchFieldError.dis\
60+ NoSuchFieldException.dis\
61+ NoSuchMethodError.dis\
62+ NoSuchMethodException.dis\
63+ NullPointerException.dis\
64+ NullSecurityManager.dis\
65+ Number.dis\
66+ NumberFormatException.dis\
67+ Object.dis\
68+ OutOfMemoryError.dis\
69+ Process.dis\
70+ Runnable.dis\
71+ Runtime.dis\
72+ RuntimeException.dis\
73+ SecurityException.dis\
74+ SecurityManager.dis\
75+ Short.dis\
76+ StackOverflowError.dis\
77+ String.dis\
78+ StringBuffer.dis\
79+# for StringIndexOutOfBoundsException.dis\
80+ 5ZD+zz0io892VFWeXUN1a.dis\
81+ System.dis\
82+ Thread.dis\
83+ ThreadDeath.dis\
84+ ThreadGroup.dis\
85+ Throwable.dis\
86+ UnknownError.dis\
87+ UnsatisfiedLinkError.dis\
88+ VerifyError.dis\
89+ VirtualMachineError.dis\
90+ Void.dis\
91+# Limbo code\
92+ Character_L.dis\
93+ ClassLoader_L.dis\
94+ Class_L.dis\
95+ Double_L.dis\
96+ Float_L.dis\
97+ InfernoProcess_L.dis\
98+ Math_L.dis\
99+ Object_L.dis\
100+ Runtime_L.dis\
101+ SecurityManager_L.dis\
102+ StringBuffer_L.dis\
103+ String_L.dis\
104+ System_L.dis\
105+ Thread_L.dis\
106+ Throwable_L.dis\
107+ unicode_table.dis\
108+
109+MODULES=\
110+ $ROOT/java/module/classloader.m\
111+ $ROOT/java/module/jni.m\
112+ $ROOT/java/module/cast.m\
113+ Character_L.m\
114+ ClassLoader_L.m\
115+ Class_L.m\
116+ Double_L.m\
117+ Float_L.m\
118+ InfernoProcess_L.m\
119+ Math_L.m\
120+ Object_L.m\
121+ Runtime_L.m\
122+ SecurityManager_L.m\
123+ StringBuffer_L.m\
124+ String_L.m\
125+ System_L.m\
126+ Thread_L.m\
127+ Throwable_L.m\
128+ unicode_table.m\
129+
130+SYSMODULES=\
131+ draw.m\
132+ hash.m\
133+ keyring.m\
134+ loader.m\
135+ math.m\
136+ string.m\
137+ sys.m\
138+
139+DISBIN=$ROOT/java/dis/java/java/lang
140+
141+<$ROOT/mkfiles/mkjava
142+<$ROOT/mkfiles/mksubdirs
143+
144+LIMBOINCL=\
145+ $LIMBOINCL\
146+ -I$ROOT/java/pkg\
147+
148+unicode_table.dis: unicode_table.b
149+ limbo $LIMBOINCL -gw unicode_table.b
150+
151+NullSecurityManager.dis: SecurityManager.class
152+ j2d NullSecurityManager.class
java/pkg2/java/lang/reflect/Array.java+0−0

Empty file added.

java/pkg2/java/lang/reflect/Array_L.b+417−0
@@ -0,0 +1,417 @@
1+implement Array_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+ ClassData,
28+ Value : import jni;
29+
30+ jldr : JavaClassLoader;
31+
32+#<<
33+
34+include "Array_L.m";
35+
36+#>> extra post includes here
37+
38+include "reflect.m";
39+ refl : Reflect;
40+ widen : import refl;
41+
42+array_class : ClassData;
43+
44+badindex := "java.lang.ArrayIndexOutOfBoundsException";
45+illegalarg := "java.lang.IllegalArgumentException";
46+nullptr := "java.lang.NullPointerException";
47+
48+ cast : Cast;
49+
50+#<<
51+
52+init( jni_p : JNI )
53+{
54+ # save java native inteface mod instance
55+ jni = jni_p;
56+ #>>extra initialization here
57+ array_class = jni->FindClass("inferno/vm/Array");
58+
59+ jldr = jni->jldr;
60+ cast = jni->CastMod();
61+ refl = load Reflect Reflect->PATH;
62+ if ( refl == nil )
63+ jni->InitError( jni->sys->sprint( "java.lang.reflect.Array: could not load %s: %r", Reflect->PATH ) );
64+ else
65+ refl->init(jni);
66+
67+ #<<
68+}
69+
70+getLength_rObject_I( p0 : JObject) : int
71+{#>>
72+ # p0 - must be a Java array; if not, exceptions are thrown
73+ # Returns the integer length of the array.
74+
75+ if ( p0 == nil )
76+ jni->ThrowException(nullptr, "");
77+ if ( jni->IsArray(p0) == JNI->FALSE)
78+ jni->ThrowException(illegalarg, "Not an array");
79+ return jni->GetArrayLength(cast->ToJArray(p0));
80+}#<<
81+
82+get_rObject_I_rObject( p0 : JObject,p1 : int) : JObject
83+{#>>
84+ # p0 - a Java object, which must be an array, else exception occurs.
85+ # p1 - an index into the array, >= 0 and < length of array
86+ # Returns the element at that index. If the array is of a primitive
87+ # type, it is put in an appropriate wrapper class instance.
88+
89+ checksOK(p0, p1);
90+
91+ #
92+ # Need to figure out what kind of an array this is, then get the
93+ # requested element and convert it to an appropriate JObject.
94+ #
95+ (typ, elem) := GetArrayElement(p0, p1);
96+ #(typ, elem) := jni->GetArrayElement(p0, p1);
97+
98+ if ( typ == 0 ) # array of Objects. good.
99+ return elem.Object();
100+
101+ if ( typ >= JNI->T_BOOLEAN && typ <= JNI->T_LONG )
102+ return refl->ValueToObject(elem);
103+
104+ return nil;
105+}#<<
106+
107+getBoolean_rObject_I_Z( p0 : JObject,p1 : int) : int
108+{#>>
109+ # p0 - a Java object, which must be an array, else exception occurs.
110+ # p1 - an index into the array, >= 0 and < length of array
111+ # Returns the element at that index as a boolean value. If the array
112+ # is not an array of something that can be converted to a boolean by
113+ # widening (and for boolean that's nothing), then getprim will throw
114+ # an exception.
115+
116+ return getprim(p0, p1, JNI->T_BOOLEAN, "boolean").Boolean();
117+}#<<
118+
119+getByte_rObject_I_B( p0 : JObject,p1 : int) : int
120+{#>>
121+ # See comments in getBoolean_rObject_I_Z, above
122+
123+ return getprim(p0, p1, JNI->T_BYTE, "byte").Byte();
124+}#<<
125+
126+getChar_rObject_I_C( p0 : JObject,p1 : int) : int
127+{#>>
128+ # See comments in getBoolean_rObject_I_Z, above
129+
130+ return getprim(p0, p1, JNI->T_CHAR, "char").Char();
131+}#<<
132+
133+getShort_rObject_I_S( p0 : JObject,p1 : int) : int
134+{#>>
135+ # See comments in getBoolean_rObject_I_Z, above
136+
137+ return getprim(p0, p1, JNI->T_SHORT, "short").Short();
138+}#<<
139+
140+getInt_rObject_I_I( p0 : JObject,p1 : int) : int
141+{#>>
142+ # See comments in getBoolean_rObject_I_Z, above
143+
144+ return getprim(p0, p1, JNI->T_INT, "int").Int();
145+}#<<
146+
147+getLong_rObject_I_J( p0 : JObject,p1 : int) : big
148+{#>>
149+ # See comments in getBoolean_rObject_I_Z, above
150+
151+ return getprim(p0, p1, JNI->T_LONG, "long").Long();
152+}#<<
153+
154+getFloat_rObject_I_F( p0 : JObject,p1 : int) : real
155+{#>>
156+ # See comments in getBoolean_rObject_I_Z, above
157+
158+ return getprim(p0, p1, JNI->T_FLOAT, "float").Float();
159+}#<<
160+
161+getDouble_rObject_I_D( p0 : JObject,p1 : int) : real
162+{#>>
163+ # See comments in getBoolean_rObject_I_Z, above
164+
165+ return getprim(p0, p1, JNI->T_DOUBLE, "double").Double();
166+}#<<
167+
168+set_rObject_I_rObject_V( p0 : JObject,p1 : int,p2 : JObject)
169+{#>>
170+ # p0 - a Java array. If null or not an array, exception.
171+ # p1 - index into the array. If < 0 or >= length of array, exception.
172+ # p2 - a value to put into the array at the specified index. If p0 is
173+ # an array of JObject, p2 must be an instance of the appropriate
174+ # class. If p0 is an array of a primitive Java type, then p2 must
175+ # be a wrapper of a primitive type that can be converted to the
176+ # the array's type by widening.
177+
178+ checksOK(p0, p1);
179+
180+ objarray := cast->ToJArray(p0);
181+ typ := objarray.primitive;
182+ if ( typ == 0 ) { # an Object array
183+ if ( jni->IsInstanceOf(p2, objarray.class) == JNI->TRUE ) {
184+ cast->JArrayToObject(objarray).ary[p1] = p2;
185+ return;
186+ }
187+ }
188+ else if ( typ >= JNI->T_BOOLEAN && typ <= JNI->T_LONG ) {
189+ (stype, val) := refl->GetVal(p2);
190+ if ( stype != 0 && (val = widen(stype, typ, val)) != nil ) {
191+ SetArrayElement(p0, p1, val);
192+ return;
193+ }
194+ }
195+ jni->ThrowException(illegalarg, "Argument can't be cast to array element");
196+}#<<
197+
198+setBoolean_rObject_I_Z_V( p0 : JObject,p1 : int,p2 : int)
199+{#>>
200+ # p0[p1] = p2
201+ # where p2 is a boolean value, and it must be possible to convert it by
202+ # widening to the type array p0.
203+
204+ putprim(p0, p1, JNI->T_BOOLEAN, "boolean", ref Value.TBoolean(p2));
205+}#<<
206+
207+setByte_rObject_I_B_V( p0 : JObject,p1 : int,p2 : int)
208+{#>>
209+ # see comments for setBoolean_rObject_I_Z_V, above.
210+
211+ putprim(p0, p1, JNI->T_BYTE, "byte", ref Value.TByte(p2));
212+}#<<
213+
214+setChar_rObject_I_C_V( p0 : JObject,p1 : int,p2 : int)
215+{#>>
216+ # see comments for setBoolean_rObject_I_Z_V, above.
217+
218+ putprim(p0, p1, JNI->T_CHAR, "char", ref Value.TChar(p2));
219+}#<<
220+
221+setShort_rObject_I_S_V( p0 : JObject,p1 : int,p2 : int)
222+{#>>
223+ # see comments for setBoolean_rObject_I_Z_V, above.
224+
225+ putprim(p0, p1, JNI->T_SHORT, "short", ref Value.TShort(p2));
226+}#<<
227+
228+setInt_rObject_I_I_V( p0 : JObject,p1 : int,p2 : int)
229+{#>>
230+ # see comments for setBoolean_rObject_I_Z_V, above.
231+
232+ putprim(p0, p1, JNI->T_INT, "int", ref Value.TInt(p2));
233+}#<<
234+
235+setLong_rObject_I_J_V( p0 : JObject,p1 : int,p2 : big)
236+{#>>
237+ # see comments for setBoolean_rObject_I_Z_V, above.
238+
239+ putprim(p0, p1, JNI->T_LONG, "long", ref Value.TLong(p2));
240+}#<<
241+
242+setFloat_rObject_I_F_V( p0 : JObject,p1 : int,p2 : real)
243+{#>>
244+ # see comments for setBoolean_rObject_I_Z_V, above.
245+
246+ putprim(p0, p1, JNI->T_FLOAT, "float", ref Value.TFloat(p2));
247+}#<<
248+
249+setDouble_rObject_I_D_V( p0 : JObject,p1 : int,p2 : real)
250+{#>>
251+ # see comments for setBoolean_rObject_I_Z_V, above.
252+
253+ putprim(p0, p1, JNI->T_DOUBLE, "double", ref Value.TDouble(p2));
254+}#<<
255+
256+newArray(jclass: JClass, bounds: array of int): JObject
257+{
258+ # Create a Java array whose components belong to class jclass.
259+ # jclass may be a class object representing a primitive type.
260+ # bounds gives the length of each dimension.
261+
262+ dims := len bounds;
263+ cldata: ClassData;
264+
265+ # See if the class represents a primitive type.
266+ typ := jni->PrimitiveIndex(jclass, 1);
267+
268+ # If jclass represents an array, then component type of array
269+ # being created is component type of jclass.
270+ s := jclass.aryname;
271+ if(s != nil) {
272+ # count [s in aryname
273+ n := 1;
274+ while(s[n] == '[')
275+ n++;
276+ dims += n;
277+ typ = refl->SigToType(s[n:]);
278+ if(typ == 0)
279+ cldata = jni->FindClass(s[n+1:len s - 1]);
280+ } else if(typ == 0) { # jclass is not array and not primitive
281+ cldata = jclass.class;
282+ }
283+
284+ return cast->FromJArray(jldr->multianewarray(dims, cldata, typ, bounds));
285+}
286+
287+newArray_rClass_I_rObject( p0 : JClass,p1 : int) : JObject
288+{#>>
289+ if ( p0 == nil )
290+ jni->ThrowException(nullptr, "");
291+
292+ return newArray(p0, array [1] of { p1 });
293+}#<<
294+
295+multiNewArray_rClass_aI_rObject( p0 : JClass,p1 : JArrayI) : JObject
296+{#>>
297+ if ( p0 == nil || p1 == nil )
298+ jni->ThrowException(nullptr, "");
299+
300+ ln := len p1.ary;
301+
302+ if ( ln < 1 || ln > 255 )
303+ jni->ThrowException(illegalarg, "dimensions out of range [1,255]");
304+
305+ return newArray(p0, p1.ary);
306+}#<<
307+
308+# An argument verification routine for use by native methods. The
309+# first argument must be non-null, and a Java array. (These conditions
310+# are actually check by calling getLength_rObject.) The second
311+# argument must be a valid index into that array. There is no return
312+# value: if the conditions above are not met, an exception is thrown;
313+# hence the routine does not return in this case. A successful return
314+# indicates the arguments are O.K.
315+#
316+checksOK(o : JObject, ix : int)
317+{
318+ if ( ix >= getLength_rObject_I(o) || ix < 0 )
319+ jni->ThrowException(badindex, "Illegal index");
320+ return;
321+}
322+#
323+# Gets element 'index' of Java array 'o' and returns it as a ref Value
324+# of the type corresponding to Java type index 'want'. String 's'
325+# is used only in creating the exception message, and should correspond
326+# to 'want'. o must be non-null and refer to a Java array, index must
327+# within range, and the array must be of a primitive type that can
328+# be made into the requested type by a widening conversion. If any of
329+# these conditions are not met, an exception is thrown.
330+#
331+getprim( o : JObject, index : int, want : int, s : string) : ref Value
332+{
333+ checksOK(o, index);
334+
335+ (typ, elem) := GetArrayElement(o, index);
336+ if ( (wider := widen(typ, want, elem)) == nil ) {
337+ if ( s != nil )
338+ jni->ThrowException(illegalarg, "Can't cast array element to " + s);
339+ else
340+ jni->ThrowException(illegalarg, "Can't cast array element");
341+ }
342+ return wider;
343+}
344+#
345+# Sets element 'index' of Java array 'o' to the ref Value 'val'
346+# of the type corresponding to Java type index 'have'. String 's'
347+# is used only in creating the exception message, and should correspond
348+# to 'have'. o must be non-null and refer to a Java array, index must
349+# within range, and the array must be of a primitive type that can
350+# be made from the provided type by a widening conversion. If any of
351+# these conditions are not met, an exception is thrown.
352+#
353+putprim( o : JObject, index : int, have : int, s : string, val : ref Value)
354+{
355+ checksOK(o, index);
356+
357+ typ := cast->ToJArray(o).primitive;
358+ if ( (val = widen(have, typ, val)) == nil ) {
359+ if ( s != nil )
360+ jni->ThrowException(illegalarg,
361+ "Can't put input value into " + s + " array");
362+ else
363+ jni->ThrowException(illegalarg,
364+ "Can't put input value into array");
365+ }
366+ SetArrayElement(o, index, val);
367+ #jni->SetArrayElement(o, index, val);
368+}
369+#
370+# Get the element at index from the Java array o and return it in
371+# in an appropriate member of the Value union.
372+# The arguments should have been verified before calling this function.
373+#
374+GetArrayElement( o : JObject, index : int ) : (int, ref Value)
375+{
376+ a := cast->ToJArray(o);
377+ val : ref Value;
378+ case a.primitive {
379+ 0 =>
380+ val = ref Value.TObject(cast->JArrayToObject(a).ary[index]);
381+ JNI->T_BOOLEAN =>
382+ val = ref Value.TBoolean(int cast->JArrayToByte(a).ary[index]);
383+ JNI->T_BYTE =>
384+ val = ref Value.TByte(int cast->JArrayToByte(a).ary[index]);
385+ JNI->T_CHAR =>
386+ val = ref Value.TChar(cast->JArrayToInt(a).ary[index]);
387+ JNI->T_SHORT =>
388+ val = ref Value.TShort(cast->JArrayToInt(a).ary[index]);
389+ JNI->T_INT =>
390+ val = ref Value.TInt(cast->JArrayToInt(a).ary[index]);
391+ JNI->T_LONG =>
392+ val = ref Value.TLong(cast->JArrayToBig(a).ary[index]);
393+ JNI->T_FLOAT =>
394+ val = ref Value.TFloat(cast->JArrayToReal(a).ary[index]);
395+ JNI->T_DOUBLE =>
396+ val = ref Value.TDouble(cast->JArrayToReal(a).ary[index]);
397+ }
398+ return (a.primitive, val);
399+}
400+#
401+# Set the element at index from the Java array o to 'val',
402+# The arguments should have been verified before calling this function.
403+#
404+SetArrayElement( o : JObject, index : int, val : ref Value)
405+{
406+ a := cast->ToJArray(o);
407+ pick sw := val {
408+ TBoolean => cast->JArrayToByte(a).ary[index] = byte sw.jboolean;
409+ TByte => cast->JArrayToByte(a).ary[index] = byte sw.jbyte;
410+ TChar => cast->JArrayToInt(a).ary[index] = sw.jchar;
411+ TShort => cast->JArrayToInt(a).ary[index] = sw.jshort;
412+ TInt => cast->JArrayToInt(a).ary[index] = sw.jint;
413+ TLong => cast->JArrayToBig(a).ary[index] = sw.jlong;
414+ TFloat => cast->JArrayToReal(a).ary[index] = sw.jfloat;
415+ TDouble => cast->JArrayToReal(a).ary[index] = sw.jdouble;
416+ }
417+}
java/pkg2/java/lang/reflect/Array_L.m+33−0
@@ -0,0 +1,33 @@
1+# javal v1.5 generated file: edit with care
2+
3+Array_L : module
4+{
5+ Array_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ };
9+
10+ init : fn( jni_p : JNI );
11+ getLength_rObject_I : fn( p0 : JObject) : int;
12+ get_rObject_I_rObject : fn( p0 : JObject,p1 : int) : JObject;
13+ getBoolean_rObject_I_Z : fn( p0 : JObject,p1 : int) : int;
14+ getByte_rObject_I_B : fn( p0 : JObject,p1 : int) : int;
15+ getChar_rObject_I_C : fn( p0 : JObject,p1 : int) : int;
16+ getShort_rObject_I_S : fn( p0 : JObject,p1 : int) : int;
17+ getInt_rObject_I_I : fn( p0 : JObject,p1 : int) : int;
18+ getLong_rObject_I_J : fn( p0 : JObject,p1 : int) : big;
19+ getFloat_rObject_I_F : fn( p0 : JObject,p1 : int) : real;
20+ getDouble_rObject_I_D : fn( p0 : JObject,p1 : int) : real;
21+ set_rObject_I_rObject_V : fn( p0 : JObject,p1 : int,p2 : JObject);
22+ setBoolean_rObject_I_Z_V : fn( p0 : JObject,p1 : int,p2 : int);
23+ setByte_rObject_I_B_V : fn( p0 : JObject,p1 : int,p2 : int);
24+ setChar_rObject_I_C_V : fn( p0 : JObject,p1 : int,p2 : int);
25+ setShort_rObject_I_S_V : fn( p0 : JObject,p1 : int,p2 : int);
26+ setInt_rObject_I_I_V : fn( p0 : JObject,p1 : int,p2 : int);
27+ setLong_rObject_I_J_V : fn( p0 : JObject,p1 : int,p2 : big);
28+ setFloat_rObject_I_F_V : fn( p0 : JObject,p1 : int,p2 : real);
29+ setDouble_rObject_I_D_V : fn( p0 : JObject,p1 : int,p2 : real);
30+ newArray_rClass_I_rObject : fn( p0 : JClass,p1 : int) : JObject;
31+ multiNewArray_rClass_aI_rObject : fn( p0 : JClass,p1 : JArrayI) : JObject;
32+
33+};
java/pkg2/java/lang/reflect/Constructor.java+0−0

Empty file added.

java/pkg2/java/lang/reflect/Constructor_L.b+90−0
@@ -0,0 +1,90 @@
1+implement Constructor_L;
2+
3+include "jni.m";
4+ jni : JNI;
5+ ClassModule,
6+ JString,
7+ JArray,
8+ JArrayI,
9+ JArrayC,
10+ JArrayB,
11+ JArrayS,
12+ JArrayJ,
13+ JArrayF,
14+ JArrayD,
15+ JArrayZ,
16+ JArrayJObject,
17+ JArrayJClass,
18+ JArrayJString,
19+ JClass,
20+ JObject : import jni;
21+
22+#>> extra pre includes here
23+
24+ Value,
25+ ClassData,
26+ jldr : import jni;
27+
28+ Object : import jldr;
29+
30+#<<
31+
32+include "Constructor_L.m";
33+
34+#>> extra post includes here
35+
36+illegalarg := "java.lang.IllegalArgumentException";
37+nullptr := "java.lang.NullPointerException";
38+
39+include "reflect.m";
40+ refl : Reflect;
41+ widen : import refl;
42+
43+#<<
44+
45+init( jni_p : JNI )
46+{
47+ # save java native inteface mod instance
48+ jni = jni_p;
49+ #>>extra initialization here
50+ refl = load Reflect Reflect->PATH;
51+ if ( refl == nil )
52+ jni->InitError( jni->sys->sprint( "java.lang.reflect.Constructor: could not load %s: %r", Reflect->PATH ) );
53+ else
54+ refl->init(jni);
55+ #<<
56+}
57+
58+getModifiers_I( this : ref Constructor_obj) : int
59+{#>>
60+ #
61+ # Assume that lower part of slot has modifier bits.
62+ #
63+ return this.slot & 16rffff;
64+}#<<
65+
66+newInstance_aObject_rObject( this : ref Constructor_obj, p0 : JArrayJObject) : JObject
67+{#>>
68+ # this - a Constructor object representing a constructor of some class
69+ # p0 - a Java array of Objects, containing argument values for the
70+ # the constructor
71+ # Returns a new instance, constructed by the 'this' constructor.
72+ #
73+ # Check inputs and build the argument list.
74+ #
75+ args := refl->BuildArgList(this.parameterTypes, p0);
76+ #
77+ # Allocate a new object, then do the call.
78+ #
79+ newobj := jni->AllocObject(this.clazz.class);
80+
81+ # Eventually may be able to do something like
82+ # (result, ok) = jni->CallConstruct(newobj, this.slot, args);
83+
84+ fld := this.clazz.class.initmethods[this.slot >> 16];
85+ (nil, ok) := jni->CallMethod(newobj, fld.field, fld.signature, args);
86+
87+ if ( ok == JNI->OK )
88+ return newobj;
89+ return nil;
90+}#<<
java/pkg2/java/lang/reflect/Constructor_L.m+18−0
@@ -0,0 +1,18 @@
1+# generated file edit with care
2+
3+Constructor_L : module
4+{
5+ Constructor_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ clazz : JClass;
9+ slot : int;
10+ parameterTypes : JArrayJClass;
11+ exceptionTypes : JArrayJClass;
12+ };
13+
14+ init : fn( jni_p : JNI );
15+ getModifiers_I : fn( this : ref Constructor_obj) : int;
16+ newInstance_aObject_rObject : fn( this : ref Constructor_obj, p0 : JArrayJObject) : JObject;
17+
18+};
java/pkg2/java/lang/reflect/Field.java+0−0

Empty file added.

java/pkg2/java/lang/reflect/Field_L.b+469−0
@@ -0,0 +1,469 @@
1+implement Field_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+
27+ Value,
28+ ClassData : import jni;
29+ jldr : JavaClassLoader;
30+ Object,
31+ Class : import jldr;
32+
33+#<<
34+
35+include "Field_L.m";
36+
37+#>> extra post includes here
38+
39+include "reflect.m";
40+ refl : Reflect;
41+
42+STATIC, NONSTATIC : con iota;
43+
44+illegalacc,
45+illegalarg,
46+nullptr : string;
47+
48+#<<
49+
50+init( jni_p : JNI )
51+{
52+ # save java native inteface mod instance
53+ jni = jni_p;
54+ #>>extra initialization here
55+ jldr = jni->jldr;
56+
57+ illegalacc = "java.lang.IllegalAccessException";
58+ illegalarg = "java.lang.IllegalArgumentException";
59+ nullptr = "java.lang.NullPointerException";
60+
61+ refl = load Reflect Reflect->PATH;
62+ if ( refl == nil )
63+ jni->InitError( jni->sys->sprint( "java.lang.reflect.Field: could not load %s: %r", Reflect->PATH ) );
64+ else
65+ refl->init(jni);
66+
67+ #<<
68+}
69+
70+getModifiers_I( this : ref Field_obj) : int
71+{#>>
72+ #
73+ # Assume that lower part of slot points has modifier bits.
74+ #
75+ return this.slot & 16rffff;
76+}#<<
77+
78+get_rObject_rObject( this : ref Field_obj, p0 : JObject) : JObject
79+{#>>
80+ val := getChecks(this, p0);
81+
82+ typ := refl->ValType(val);
83+
84+ if ( typ == 0 ) # array of Objects. good.
85+ return val.Object();
86+
87+ if ( typ >= JNI->T_BOOLEAN && typ <= JNI->T_LONG )
88+ return refl->ValueToObject(val);
89+ return nil;
90+}#<<
91+
92+getBoolean_rObject_Z( this : ref Field_obj, p0 : JObject) : int
93+{#>>
94+ val := getChecks(this, p0);
95+
96+ pick sw := val {
97+ TBoolean => return sw.jboolean;
98+ }
99+ jni->ThrowException(illegalarg, "Can't convert to boolean");
100+ return JNI->FALSE;
101+}#<<
102+
103+getByte_rObject_B( this : ref Field_obj, p0 : JObject) : int
104+{#>>
105+ val := getChecks(this, p0);
106+
107+ pick sw := val {
108+ TByte => return sw.jbyte;
109+ }
110+ jni->ThrowException(illegalarg, "Can't convert to byte");
111+ return JNI->FALSE;
112+}#<<
113+
114+getChar_rObject_C( this : ref Field_obj, p0 : JObject) : int
115+{#>>
116+ val := getChecks(this, p0);
117+
118+ pick sw := val {
119+ TChar => return sw.jchar;
120+ }
121+ jni->ThrowException(illegalarg, "Can't convert to char");
122+ return 0;
123+}#<<
124+
125+getShort_rObject_S( this : ref Field_obj, p0 : JObject) : int
126+{#>>
127+ val := getChecks(this, p0);
128+
129+ pick sw := val {
130+ TByte => return int sw.jbyte;
131+ TShort => return sw.jshort;
132+ }
133+ jni->ThrowException(illegalarg, "Can't convert to short");
134+ return 0;
135+}#<<
136+
137+getInt_rObject_I( this : ref Field_obj, p0 : JObject) : int
138+{#>>
139+ val := getChecks(this, p0);
140+
141+ pick sw := val {
142+ TByte => return int sw.jbyte;
143+ TChar => return sw.jchar;
144+ TShort => return sw.jshort;
145+ TInt => return sw.jint;
146+ }
147+ jni->ThrowException(illegalarg, "Can't convert to int");
148+ return 0;
149+}#<<
150+
151+getLong_rObject_J( this : ref Field_obj, p0 : JObject) : big
152+{#>>
153+ val := getChecks(this, p0);
154+
155+ pick sw := val {
156+ TByte => return big sw.jbyte;
157+ TChar => return big sw.jchar;
158+ TShort => return big sw.jshort;
159+ TInt => return big sw.jint;
160+ TLong => return sw.jlong;
161+ }
162+ jni->ThrowException(illegalarg, "Can't convert to long");
163+ return big 0;
164+}#<<
165+
166+getFloat_rObject_F( this : ref Field_obj, p0 : JObject) : real
167+{#>>
168+ val := getChecks(this, p0);
169+
170+ pick sw := val {
171+ TByte => return real sw.jbyte;
172+ TChar => return real sw.jchar;
173+ TShort => return real sw.jshort;
174+ TInt => return real sw.jint;
175+ TLong => return real sw.jlong;
176+ TFloat => return sw.jfloat;
177+ }
178+ jni->ThrowException(illegalarg, "Can't convert to float");
179+ return 0.0;
180+}#<<
181+
182+getDouble_rObject_D( this : ref Field_obj, p0 : JObject) : real
183+{#>>
184+ val := getChecks(this, p0);
185+
186+ pick sw := val {
187+ TByte => return real sw.jbyte;
188+ TChar => return real sw.jchar;
189+ TShort => return real sw.jshort;
190+ TInt => return real sw.jint;
191+ TLong => return real sw.jlong;
192+ TFloat => return sw.jfloat;
193+ TDouble => return sw.jdouble;
194+ }
195+ jni->ThrowException(illegalarg, "Can't convert to double");
196+ return 0.0;
197+}#<<
198+
199+set_rObject_rObject_V( this : ref Field_obj, p0 : JObject,p1 : JObject)
200+{#>>
201+ want := putChecks(this, p0);
202+ clazz := jni->GetObjectClass(p1);
203+
204+ if ( want == 0 ) { # field value is Object
205+ p := ref Value.TObject;
206+ if ( jni->IsAssignable(clazz, this.clazz) == JNI->TRUE ) {
207+ p.jobj = p1;
208+ SetField(this, p0, p);
209+ return;
210+ }
211+ else {
212+ jni->ThrowException(illegalarg, "Can't safely cast");
213+ return;
214+ }
215+ }
216+ # The field is a primitive type. Then p1 better be a wrapper for that
217+ # type. (Or is it okay if it's a wrapper for something that can be
218+ # safely cast to the target type?)
219+ #
220+ # is p1 a Boolean object, or sub-classed from a Boolean object,
221+ # or a String with value "true" or "false" ?
222+ #
223+ (typ, val) := refl->GetVal(p1);
224+ if ( typ == 0 || (val = refl->widen(typ, want, val)) == nil ) {
225+ jni->ThrowException(illegalarg, "Object can't be cast to needed type");
226+ return;
227+ }
228+ SetField(this, p0, val);
229+ return;
230+}#<<
231+
232+setBoolean_rObject_Z_V( this : ref Field_obj, p0 : JObject,p1 : int)
233+{#>>
234+ want := putChecks(this, p0);
235+
236+#
237+# Note that if the field's signature is "Ljava.lang.Boolean;",
238+# we could create an appropriate Object and assign it.
239+# But it isn't clear if that is what's wanted.
240+# A similar argument applies for the other set<Type> functions.
241+#
242+ p : ref Value;
243+ case want {
244+ JNI->T_BOOLEAN => p = ref Value.TBoolean(p1);
245+ * =>
246+ jni->ThrowException(illegalarg, "Can't convert from boolean");
247+ return;
248+ }
249+ SetField(this, p0, p);
250+}#<<
251+
252+setByte_rObject_B_V( this : ref Field_obj, p0 : JObject,p1 : int)
253+{#>>
254+ want := putChecks(this, p0);
255+
256+ p : ref Value;
257+ case want {
258+ JNI->T_BYTE => p = ref Value.TByte(p1);
259+ JNI->T_SHORT => p = ref Value.TShort(int p1);
260+ JNI->T_INT => p = ref Value.TInt(int p1);
261+ JNI->T_LONG => p = ref Value.TLong(big p1);
262+ JNI->T_FLOAT => p = ref Value.TFloat(real p1);
263+ JNI->T_DOUBLE => p = ref Value.TDouble(real p1);
264+ * =>
265+ jni->ThrowException(illegalarg, "Can't convert from byte");
266+ return;
267+ }
268+ SetField(this, p0, p);
269+}#<<
270+
271+setChar_rObject_C_V( this : ref Field_obj, p0 : JObject,p1 : int)
272+{#>>
273+ want := putChecks(this, p0);
274+
275+ p : ref Value;
276+ case want {
277+ JNI->T_CHAR => p = ref Value.TChar(p1);
278+ * =>
279+ jni->ThrowException(illegalarg, "Can't convert from char");
280+ return;
281+ }
282+ SetField(this, p0, p);
283+}#<<
284+
285+setShort_rObject_S_V( this : ref Field_obj, p0 : JObject,p1 : int)
286+{#>>
287+ want := putChecks(this, p0);
288+
289+ p : ref Value;
290+ case want {
291+ JNI->T_SHORT => p = ref Value.TShort(p1);
292+ JNI->T_INT => p = ref Value.TInt(p1);
293+ JNI->T_LONG => p = ref Value.TLong(big p1);
294+ JNI->T_FLOAT => p = ref Value.TFloat(real p1);
295+ JNI->T_DOUBLE => p = ref Value.TDouble(real p1);
296+ * =>
297+ jni->ThrowException(illegalarg, "Can't convert from short");
298+ return;
299+ }
300+ SetField(this, p0, p);
301+}#<<
302+
303+setInt_rObject_I_V( this : ref Field_obj, p0 : JObject,p1 : int)
304+{#>>
305+ want := putChecks(this, p0);
306+
307+ p : ref Value;
308+ case want {
309+ JNI->T_INT => p = ref Value.TInt(p1);
310+ JNI->T_LONG => p = ref Value.TLong(big p1);
311+ JNI->T_FLOAT => p = ref Value.TFloat(real p1);
312+ JNI->T_DOUBLE => p = ref Value.TDouble(real p1);
313+ * =>
314+ jni->ThrowException(illegalarg, "Can't convert from int");
315+ return;
316+ }
317+ SetField(this, p0, p);
318+}#<<
319+
320+setLong_rObject_J_V( this : ref Field_obj, p0 : JObject,p1 : big)
321+{#>>
322+ want := putChecks(this, p0);
323+
324+ p : ref Value;
325+ case want {
326+ JNI->T_LONG => p = ref Value.TLong(p1);
327+ JNI->T_FLOAT => p = ref Value.TFloat(real p1);
328+ JNI->T_DOUBLE => p = ref Value.TDouble(real p1);
329+ * =>
330+ jni->ThrowException(illegalarg, "Can't convert from long");
331+ return;
332+ }
333+ SetField(this, p0, p);
334+}#<<
335+
336+setFloat_rObject_F_V( this : ref Field_obj, p0 : JObject,p1 : real)
337+{#>>
338+ want := putChecks(this, p0);
339+
340+ p : ref Value;
341+ case want {
342+ JNI->T_FLOAT => p = ref Value.TFloat(p1);
343+ JNI->T_DOUBLE => p = ref Value.TDouble(p1);
344+ * =>
345+ jni->ThrowException(illegalarg, "Can't convert from float");
346+ return;
347+ }
348+ SetField(this, p0, p);
349+}#<<
350+
351+setDouble_rObject_D_V( this : ref Field_obj, p0 : JObject,p1 : real)
352+{#>>
353+ want := putChecks(this, p0);
354+
355+ p : ref Value;
356+ case want {
357+ JNI->T_DOUBLE => p = ref Value.TDouble(p1);
358+ * =>
359+ jni->ThrowException(illegalarg, "Can't convert from double");
360+ return;
361+ }
362+ SetField(this, p0, p);
363+}#<<
364+
365+
366+
367+getChecks( this : ref Field_obj, p0 : JObject) : ref Value
368+{
369+ if ( (this.slot & jldr->ACC_STATIC) == 0 && p0 == nil )
370+ jni->ThrowException(nullptr, "reading field of null Object");
371+
372+ # See if the target object is the same as the one declaring the field.
373+ # this.clazz.class_data is ref to a classloader.Class adt
374+
375+ cldata := this.clazz.class;
376+ if ( (this.slot & jldr->ACC_STATIC) == 0 && jni->IsInstanceOf(p0, cldata) != JNI->TRUE ) {
377+ jni->ThrowException(illegalarg,
378+ "Object is not an instance of this class");
379+ return nil;
380+ }
381+
382+ if ( (this.slot & jldr->ACC_PUBLIC) == 0 )
383+ jni->ThrowException(illegalacc, "reading non-public field");
384+
385+ if ( this.slot & jldr->ACC_STATIC )
386+ return GetStat(cldata, this.slot);
387+ else
388+ return GetField(p0, this.slot);
389+}
390+
391+putChecks( this : ref Field_obj, p0 : JObject) : int
392+{
393+ if ( (this.slot & jldr->ACC_STATIC) == 0 && p0 == nil )
394+ jni->ThrowException(nullptr, "writing field of null Object");
395+
396+ # See if the target object is the same as the one declaring the field.
397+ # this.clazz.class_data is ref to a classloader.Class adt
398+
399+ cldata := this.clazz.class;
400+ if ( (this.slot & jldr->ACC_STATIC) == 0 && jni->IsInstanceOf(p0, cldata) != JNI->TRUE ) {
401+ jni->ThrowException(illegalarg,
402+ "Object is not an instance of this class");
403+ return 0;
404+ }
405+
406+ if ( (this.slot & jldr->ACC_PUBLIC) == 0 || (this.slot & jldr->ACC_FINAL) != 0 )
407+ jni->ThrowException(illegalacc, "writing non-public or final field");
408+
409+ if ( this.slot & jldr->ACC_STATIC )
410+ return refl->SigToType(cldata.staticdata[this.slot >> 16].signature);
411+ else {
412+ flds := cldata.objectdata;
413+ for ( i := (this.slot >> 16); i > 0; i--)
414+ flds = tl flds;
415+ return refl->SigToType((hd flds).signature);
416+ }
417+ return 0;
418+}
419+
420+checkMemberAccess(which : int)
421+{
422+ return;
423+}
424+
425+SetField(this : ref Field_obj, o : JObject, v : ref Value)
426+{
427+ cldata := this.clazz.class;
428+ if ( (this.slot & jldr->ACC_STATIC) != 0 ) {
429+ fld := cldata.staticdata[this.slot >> 16];
430+ jni->SetStaticField(cldata, fld.field, v);
431+ }
432+ else {
433+ flds := cldata.objectdata;
434+ for ( i := (this.slot >> 16); i > 0; i-- )
435+ flds = tl flds;
436+ fld := hd flds;
437+ jni->SetObjField(o, fld.field, v);
438+ }
439+}
440+
441+widen(have, want : string, val : ref Value) : ref Value
442+{
443+ if ( have == want )
444+ return val;
445+ havetype := refl->SigToType(have);
446+ wanttype := refl->SigToType(want);
447+ return refl->widen(havetype, wanttype, val);
448+}
449+#
450+# Eventually JNI may provide a funtions to do this more directly.
451+#
452+GetStat(cldata : ClassData, slot : int) : ref Value
453+{
454+ fld := cldata.staticdata[slot >> 16];
455+ return jni->GetStaticField(cldata, fld.field, fld.signature);
456+}
457+#
458+# Eventually JNI may provide a funtions to do this more directly.
459+# It would probably know what to do about privatemethods, if anything.
460+#
461+GetField(obj : JObject, slot : int) : ref Value
462+{
463+ flds := obj.class().objectdata;
464+ for ( i := (slot >> 16); i > 0; i-- )
465+ flds = tl flds;
466+ fld := hd flds;
467+ return jni->GetObjField(obj, fld.field, fld.signature);
468+}
469+
java/pkg2/java/lang/reflect/Field_L.m+35−0
@@ -0,0 +1,35 @@
1+# javal v1.5 generated file: edit with care
2+
3+Field_L : module
4+{
5+ Field_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ clazz : JClass;
9+ slot : int;
10+ name : JString;
11+ type_j : JClass;
12+ };
13+
14+ init : fn( jni_p : JNI );
15+ getModifiers_I : fn( this : ref Field_obj) : int;
16+ get_rObject_rObject : fn( this : ref Field_obj, p0 : JObject) : JObject;
17+ getBoolean_rObject_Z : fn( this : ref Field_obj, p0 : JObject) : int;
18+ getByte_rObject_B : fn( this : ref Field_obj, p0 : JObject) : int;
19+ getChar_rObject_C : fn( this : ref Field_obj, p0 : JObject) : int;
20+ getShort_rObject_S : fn( this : ref Field_obj, p0 : JObject) : int;
21+ getInt_rObject_I : fn( this : ref Field_obj, p0 : JObject) : int;
22+ getLong_rObject_J : fn( this : ref Field_obj, p0 : JObject) : big;
23+ getFloat_rObject_F : fn( this : ref Field_obj, p0 : JObject) : real;
24+ getDouble_rObject_D : fn( this : ref Field_obj, p0 : JObject) : real;
25+ set_rObject_rObject_V : fn( this : ref Field_obj, p0 : JObject,p1 : JObject);
26+ setBoolean_rObject_Z_V : fn( this : ref Field_obj, p0 : JObject,p1 : int);
27+ setByte_rObject_B_V : fn( this : ref Field_obj, p0 : JObject,p1 : int);
28+ setChar_rObject_C_V : fn( this : ref Field_obj, p0 : JObject,p1 : int);
29+ setShort_rObject_S_V : fn( this : ref Field_obj, p0 : JObject,p1 : int);
30+ setInt_rObject_I_V : fn( this : ref Field_obj, p0 : JObject,p1 : int);
31+ setLong_rObject_J_V : fn( this : ref Field_obj, p0 : JObject,p1 : big);
32+ setFloat_rObject_F_V : fn( this : ref Field_obj, p0 : JObject,p1 : real);
33+ setDouble_rObject_D_V : fn( this : ref Field_obj, p0 : JObject,p1 : real);
34+
35+};
java/pkg2/java/lang/reflect/InvocationTargetExcepti..a+0−0

Empty file added.

java/pkg2/java/lang/reflect/Member.java+0−0

Empty file added.

java/pkg2/java/lang/reflect/Method.java+0−0

Empty file added.

java/pkg2/java/lang/reflect/Method_L.b+117−0
@@ -0,0 +1,117 @@
1+implement Method_L;
2+
3+include "jni.m";
4+ jni : JNI;
5+ ClassModule,
6+ JString,
7+ JArray,
8+ JArrayI,
9+ JArrayC,
10+ JArrayB,
11+ JArrayS,
12+ JArrayJ,
13+ JArrayF,
14+ JArrayD,
15+ JArrayZ,
16+ JArrayJObject,
17+ JArrayJClass,
18+ JArrayJString,
19+ JClass,
20+ JObject : import jni;
21+
22+#>> extra pre includes here
23+
24+ Value,
25+ ClassData,
26+ jldr : import jni;
27+
28+ Object : import jldr;
29+
30+#<<
31+
32+include "Method_L.m";
33+
34+#>> extra post includes here
35+
36+illegalarg := "java.lang.IllegalArgumentException";
37+nullptr := "java.lang.NullPointerException";
38+
39+include "reflect.m";
40+ refl : Reflect;
41+ widen : import refl;
42+
43+#<<
44+
45+init( jni_p : JNI )
46+{
47+ # save java native inteface mod instance
48+ jni = jni_p;
49+ #>>extra initialization here
50+ refl = load Reflect Reflect->PATH;
51+ if ( refl == nil )
52+ jni->InitError( jni->sys->sprint( "java.lang.reflect.Method: could not load %s: %r", Reflect->PATH ) );
53+ else
54+ refl->init(jni);
55+ #<<
56+}
57+
58+getModifiers_I( this : ref Method_obj) : int
59+{#>>
60+ #
61+ # Assume that lower part of slot has modifier bits.
62+ #
63+ return this.slot & 16rffff;
64+}#<<
65+
66+invoke_rObject_aObject_rObject( this : ref Method_obj, p0 : JObject,p1 : JArrayJObject) : JObject
67+{#>>
68+ # this - a Method object. The corresponding method should be invoked for
69+ # p0 - an Object which should contain that method, with
70+ # p1 - a Java array of Objects that are the arguments to the method.
71+ # Can be null if the method has no arguments.
72+ # Returns an object reflecting the value returned by the method call.
73+ #
74+ # First do some checking. If 'this' is a static method, p0 is ignored,
75+ # otherwise it must an instance of the class in which the method is
76+ # declared.
77+ #
78+ if ( (this.slot & JNI->ACC_STATIC) == 0 ) { # not static
79+ if ( p0 == nil )
80+ jni->ThrowException(nullptr, "Must supply an instance");
81+ if ( jni->IsInstanceOf(p0, this.clazz.class) == JNI->FALSE )
82+ jni->ThrowException(illegalarg, "Method not in object");
83+ }
84+ #
85+ # Check inputs and build the argument list.
86+ #
87+ args := refl->BuildArgList(this.parameterTypes, p1);
88+ #
89+ # Do the call.
90+ #
91+ result : ref Value;
92+ ok : int;
93+ if ( this.slot & JNI->ACC_STATIC ) {
94+ fld := this.clazz.class.staticmethods[this.slot >> 16];
95+ (result, ok) = jni->CallStatic(this.clazz.class, fld.field,
96+ fld.signature, args);
97+ }
98+ else {
99+ fld : ref JavaClassLoader->Field;
100+ if ( (this.slot & JNI->ACC_PRIVATE) != 0 )
101+ fld = p0.class().privatemethods[this.slot >> 16];
102+ else
103+ fld = p0.class().virtualmethods[this.slot >> 16].field;
104+ (result, ok) = jni->CallMethod(p0, fld.field, fld.signature, args);
105+ }
106+ #
107+ # If necessary, wrap the answer up as an Object.
108+ #
109+ if ( ok == JNI->OK && result != nil ) {
110+ typ := refl->ValType(result);
111+ if ( typ >= JNI->T_BOOLEAN && typ <= JNI->T_LONG )
112+ return refl->ValueToObject(result);
113+ else
114+ return result.Object();
115+ }
116+ return nil;
117+}#<<
java/pkg2/java/lang/reflect/Method_L.m+20−0
@@ -0,0 +1,20 @@
1+# generated file edit with care
2+
3+Method_L : module
4+{
5+ Method_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ clazz : JClass;
9+ slot : int;
10+ name : JString;
11+ returnType : JClass;
12+ parameterTypes : JArrayJClass;
13+ exceptionTypes : JArrayJClass;
14+ };
15+
16+ init : fn( jni_p : JNI );
17+ getModifiers_I : fn( this : ref Method_obj) : int;
18+ invoke_rObject_aObject_rObject : fn( this : ref Method_obj, p0 : JObject,p1 : JArrayJObject) : JObject;
19+
20+};
java/pkg2/java/lang/reflect/Modifier.java+0−0

Empty file added.

java/pkg2/java/lang/reflect/mkfile+46−0
@@ -0,0 +1,46 @@
1+<../../../../../mkconfig
2+
3+TARG=\
4+ Array.dis\
5+ Constructor.dis\
6+ Field.dis\
7+# for InvocationTargetException.dis\
8+ esaAWjdsByqq9cEPQZTRT.dis\
9+ Member.dis\
10+ Method.dis\
11+ Modifier.dis\
12+# Limbo code\
13+ Array_L.dis\
14+ Constructor_L.dis\
15+ Field_L.dis\
16+ Method_L.dis\
17+ reflect.dis\
18+
19+MODULES=\
20+ $ROOT/java/module/classloader.m\
21+ $ROOT/java/module/jni.m\
22+ $ROOT/java/module/cast.m\
23+ Array_L.m\
24+ Constructor_L.m\
25+ Field_L.m\
26+ Method_L.m\
27+ reflect.m\
28+
29+SYSMODULES=\
30+ draw.m\
31+ hash.m\
32+ keyring.m\
33+ loader.m\
34+ math.m\
35+ string.m\
36+ sys.m\
37+
38+DISBIN=$ROOT/java/dis/java/java/lang/reflect
39+
40+<$ROOT/mkfiles/mkjava
41+
42+reflect.dis: reflect.b
43+ limbo $LIMBOINCL -gw reflect.b
44+
45+esaAWjdsByqq9cEPQZTRT.dis: InvocationTargetException.class
46+ j2d InvocationTargetException.class
java/pkg2/java/lang/reflect/reflect.b+327−0
@@ -0,0 +1,327 @@
1+implement Reflect;
2+
3+include "jni.m";
4+ jni : JNI;
5+ cast : Cast;
6+
7+ JObject,
8+ JClass,
9+ JArrayJClass,
10+ JArrayJObject,
11+ Value : import jni;
12+ OK,
13+ ERR,
14+ TRUE,
15+ FALSE,
16+ #T_OBJECT, T_ARRAY,
17+ T_BOOLEAN,
18+ T_BYTE,
19+ T_CHAR,
20+ T_SHORT,
21+ T_INT,
22+ T_LONG,
23+ T_FLOAT,
24+ T_DOUBLE : import JNI;
25+
26+ ClassData : import JNI;
27+
28+include "reflect.m";
29+
30+wrapper_class := array[T_LONG-T_BOOLEAN+1] of ClassData;
31+wrapper_name := array[] of { "Boolean",
32+ "Character",
33+ "Float",
34+ "Double",
35+ "Byte",
36+ "Short",
37+ "Integer",
38+ "Long" };
39+type_string := "ZCFDBSIJ";
40+
41+illegalarg := "java.lang.IllegalArgumentException";
42+nullptr := "java.lang.NullPointerException";
43+
44+init(jni_m : JNI) {
45+ jni = jni_m;
46+ for ( i := 0; i <= T_LONG - T_BOOLEAN; i++ )
47+ wrapper_class[i] = jni->FindClass("java/lang/" + wrapper_name[i]);
48+ cast = jni->CastMod();
49+}
50+
51+widen(have, want : int, val : ref Value) : ref Value
52+{
53+ if ( have == want )
54+ return val;
55+ havetype := have;
56+ wanttype := want;
57+ valint : int;
58+ valbig : big;
59+ valreal : real;
60+ if ( havetype == 0 || wanttype == 0 )
61+ return nil;
62+ pick sw := val {
63+ TByte =>
64+ valint = int sw.jbyte;
65+ valbig = big valint;
66+ valreal = real valint;
67+ TShort =>
68+ valint = sw.jshort;
69+ valbig = big valint;
70+ valreal = real valint;
71+ TChar =>
72+ valint = sw.jchar;
73+ valbig = big valint;
74+ valreal = real valint;
75+ TInt =>
76+ valint = sw.jint;
77+ valbig = big valint;
78+ valreal = real valint;
79+ TLong =>
80+ valbig = sw.jlong;
81+ valreal = real valbig;
82+ TFloat =>
83+ valreal = sw.jfloat;
84+ }
85+ case ( wanttype ) {
86+ T_BOOLEAN or T_BYTE or T_CHAR =>
87+ return nil;
88+ T_SHORT =>
89+ case ( havetype ) {
90+ T_BYTE =>
91+ sw := ref Value.TShort;
92+ sw.jshort = valint;
93+ val = sw;
94+ * =>
95+ return nil;
96+ }
97+ T_INT =>
98+ case ( havetype ) {
99+ T_BYTE or T_SHORT or T_CHAR =>
100+ sw := ref Value.TInt;
101+ sw.jint = valint;
102+ val = sw;
103+ * =>
104+ return nil;
105+ }
106+ T_LONG =>
107+ case ( havetype ) {
108+ T_BYTE or T_SHORT or T_CHAR or T_INT =>
109+ sw := ref Value.TLong;
110+ sw.jlong = valbig;
111+ val = sw;
112+ * =>
113+ return nil;
114+ }
115+ T_FLOAT =>
116+ case ( havetype ) {
117+ T_BYTE or T_SHORT or T_CHAR or T_INT or T_LONG =>
118+ sw := ref Value.TFloat;
119+ sw.jfloat = valreal;
120+ val = sw;
121+ * =>
122+ return nil;
123+ }
124+ T_DOUBLE =>
125+ case ( havetype ) {
126+ T_BYTE or T_SHORT or T_CHAR or T_INT or T_LONG or T_FLOAT =>
127+ sw := ref Value.TDouble;
128+ sw.jdouble = valreal;
129+ val = sw;
130+ * =>
131+ return nil;
132+ }
133+ }
134+ return val;
135+}
136+BuildArgList(parms : JArrayJClass, arg : JArrayJObject) : array of ref Value
137+{
138+ #
139+ # First do some checking.
140+ #
141+ l := 0;
142+ formal: array of JClass;
143+ actual: array of JObject;
144+ args: array of ref Value;
145+ if ( parms != nil ) {
146+ if ( arg == nil )
147+ jni->ThrowException(nullptr, "constructor requires parameters");
148+ if ( len parms.ary != len arg.ary )
149+ jni->ThrowException(illegalarg, "Wrong number of args");
150+ l = len parms.ary;
151+ formal = parms.ary; # array of JClass
152+ actual = arg.ary; # array of JObject
153+ args = array[l] of ref Value;
154+ }
155+ else # There are no formal parameters
156+ if ( arg != nil && len arg.ary != 0 ) # But there are actual arguments
157+ jni->ThrowException(illegalarg, "Wrong number of args");
158+
159+ #
160+ # March through the arguments, checking for type as we go.
161+ #
162+ for ( i := 0; i < l; i++ ) {
163+ #
164+ # Is the formal parameter a primitive?
165+ #
166+ if ( (want := jni->PrimitiveIndex(formal[i], 1)) > 0 ) {
167+ #
168+ # Actual parameter should be (derived from) a wrapper, and
169+ # be able to be widened to the formal parameter type.
170+ #
171+ (typ, parmval) := GetVal(actual[i]);
172+ if ( (val := widen(want, typ, parmval)) != nil )
173+ args[i] = val;
174+ else
175+ jni->ThrowException(illegalarg, "Argument " + string (i+1) +
176+ ", can't cast");
177+ }
178+ else if ( jni->IsInstanceOf(actual[i], formal[i].class) == JNI->TRUE ) {
179+ val := ref Value.TObject;
180+ val.jobj = actual[i];
181+ args[i] = val;
182+ }
183+ else
184+ jni->ThrowException(illegalarg, "Argument " + string (i+1) +
185+ " wrong type");
186+ }
187+ return args;
188+}
189+#
190+# Return a JClass corresponding to the Java type t.
191+#
192+Class(t : int) : JClass
193+{
194+ if ( t < T_BOOLEAN || t > T_LONG )
195+ return nil;
196+ return jni->GetClassObject(wrapper_class[t - T_BOOLEAN]);
197+}
198+#
199+# Return a Class Object corresponding to the Java type t.
200+#
201+ClassObject(t : int) : JObject
202+{
203+ return cast->FromJClass(Class(t));
204+}
205+#
206+# Given the java type, get the Class object representing this
207+# type, and return as a Value.
208+#
209+GetPrimitiveClass(typ : int) : ref Value
210+{
211+ return jni->GetStaticField(wrapper_class[typ - T_BOOLEAN], "TYPE",
212+ "Ljava/lang/Class;");
213+}
214+#
215+# If the Object o is a wrapper for a Java primitive type, return the
216+# primitive value (in a Value adt) and the type index.
217+# Otherwise, return 0 and a nil Value.
218+#
219+GetVal(o : JObject) : (int, ref Value)
220+{
221+ j := T_BOOLEAN;
222+ for ( i := j; i <= T_LONG; i++ ) {
223+ if ( jni->IsInstanceOf(o, wrapper_class[i-j]) == TRUE ) {
224+ val := jni->GetObjField(o, "value", type_string[i-j:i-j+1]);
225+ return (i, val);
226+ }
227+ }
228+ return (0, nil);
229+}
230+#
231+# Convert a signature to a java type index.
232+#
233+SigToType(sig : string) : int
234+{
235+ index : int;
236+ case sig[0] {
237+ 'Z' =>
238+ index = T_BOOLEAN;
239+ 'B' =>
240+ index = T_BYTE;
241+ 'C' =>
242+ index = T_CHAR;
243+ 'S' =>
244+ index = T_SHORT;
245+ 'I' =>
246+ index = T_INT;
247+ 'J' =>
248+ index = T_LONG;
249+ 'F' =>
250+ index = T_FLOAT;
251+ 'D' =>
252+ index = T_DOUBLE;
253+ * =>
254+ index = 0;
255+ }
256+ return index;
257+}
258+#
259+# Convert a java type index to a signature.
260+#
261+TypeToSig(typ : int) : string
262+{
263+ if ( typ < T_BOOLEAN || typ > T_LONG )
264+ return nil;
265+ return type_string[typ-T_BOOLEAN:typ-T_BOOLEAN+1];
266+}
267+#
268+# Convert a Java type character to its corresponding type name.
269+#
270+TypeCharToName(c : int) : string
271+{
272+ tname : string;
273+ case c {
274+ 'Z' =>
275+ tname = "boolean";
276+ 'B' =>
277+ tname = "byte";
278+ 'C' =>
279+ tname = "char";
280+ 'S' =>
281+ tname = "short";
282+ 'I' =>
283+ tname = "int";
284+ 'J' =>
285+ tname = "long";
286+ 'F' =>
287+ tname = "float";
288+ 'D' =>
289+ tname = "double";
290+ * =>
291+ tname = "blah";
292+ }
293+ return tname;
294+}
295+#
296+# Calculate the type index of the quantity in val. If it isn't a
297+# Java primitive type, return 0;
298+#
299+ValType(val : ref Value) : int
300+{
301+ pick sw := val {
302+ TBoolean => return T_BOOLEAN;
303+ TByte => return T_BYTE;
304+ TChar => return T_CHAR;
305+ TShort => return T_SHORT;
306+ TInt => return T_INT;
307+ TLong => return T_LONG;
308+ TFloat => return T_FLOAT;
309+ TDouble => return T_DOUBLE;
310+ * => return 0;
311+ }
312+}
313+#
314+# Create a wrapper Object for the primitive Java value corresponding
315+# to the argument.
316+#
317+ValueToObject(val : ref Value) : JObject
318+{
319+ typ := ValType(val);
320+ j := T_BOOLEAN;
321+ jobj := jni->AllocObject(wrapper_class[typ - j]);
322+ sig := "(" + type_string[typ-j:typ-j+1] + ")V";
323+ (nil, ok) := jni->CallMethod(jobj, "<init>", sig, array[] of { val });
324+ if ( ok == OK )
325+ return jobj;
326+ return nil;
327+}
java/pkg2/java/lang/reflect/reflect.m+19−0
@@ -0,0 +1,19 @@
1+Reflect : module {
2+
3+ PATH : con "/dis/java/java/lang/reflect/reflect.dis";
4+
5+ init : fn(jni_m : JNI);
6+ widen : fn(havetype, wanttype : int, val : ref Value) : ref Value;
7+ BuildArgList: fn(parms : JArrayJClass, arg : JArrayJObject)
8+ : array of ref Value;
9+ Class : fn(t : int) : JClass;
10+ ClassObject : fn(t : int) : JObject;
11+ GetPrimitiveClass : fn(typ : int) : ref Value;
12+ GetVal : fn(o : JObject) : (int, ref Value);
13+ SigToType : fn(sig : string) : int;
14+ TypeToSig : fn(typ : int) : string;
15+ TypeCharToName : fn(c : int) : string;
16+ ValType : fn(val : ref Value) : int;
17+ ValueToObject : fn(val : ref Value) : JObject;
18+
19+};
java/pkg2/java/lang/unicode_table.b+1285−0
@@ -0,0 +1,1285 @@
1+implement UnicodeTable;
2+
3+include "unicode_table.m";
4+
5+#
6+# the following is lifted from JavaSoft's java
7+# source for java.lang.Character. The Limbo
8+# compiler produces a more compact file then Java
9+#
10+
11+# The character properties are currently encoded into 32 bits in the following manner:
12+# 10 bits signed offset used for converting case
13+# 1 bit if 1, adding the signed offset converts the character to lowercase
14+# 1 bit if 1, subtracting the signed offset converts the character to uppercase
15+# 1 bit if 1, this character has a titlecase equivalent (possibly itself)
16+# 3 bits 0 may not be part of an identifier
17+# 1 ignorable control; may continue a Unicode identifier or Java identifier
18+# 2 may continue a Java identifier but not a Unicode identifier (unused)
19+# 3 may continue a Unicode identifier or Java identifier
20+# 4 is a Java whitespace character
21+# 5 may start or continue a Java identifier;
22+# may continue but not start a Unicode identifier (underscores)
23+# 6 may start or continue a Java identifier but not a Unicode identifier ($)
24+# 7 may start or continue a Unicode identifier or Java identifier
25+# Thus:
26+# 5, 6, 7 may start a Java identifier
27+# 1, 2, 3, 5, 6, 7 may continue a Java identifier
28+# 7 may start a Unicode identifier
29+# 1, 3, 5, 7 may continue a Unicode identifier
30+# 1 is ignorable within an identifier
31+# 4 is Java whitespace
32+# 2 bits 0 this character has no numeric property
33+# 1 adding the digit offset to the character code and then
34+# masking with 16r1F will produce the desired numeric value
35+# 2 this character has a "strange" numeric value
36+# 3 a Java supradecimal digit: adding the digit offset to the
37+# character code, then masking with 16r1F, then adding 10
38+# will produce the desired numeric value
39+# 5 bits digit offset
40+# 4 bits reserved for future use
41+# 5 bits character type
42+#
43+
44+# The X table has 1024 entries for a total of 1024 bytes.
45+
46+X = array[] of {
47+ 0, 1, 2, 3, 4, 5, 6, 7, # 16r0000
48+ 8, 9, 10, 11, 12, 13, 14, 15, # 16r0200
49+ 16, 17, 18, 19, 20, 21, 22, 23, # 16r0400
50+ 24, 25, 26, 27, 28, 28, 28, 28, # 16r0600
51+ 28, 28, 28, 28, 29, 30, 31, 32, # 16r0800
52+ 33, 34, 35, 36, 37, 38, 39, 40, # 16r0A00
53+ 41, 42, 43, 44, 45, 46, 28, 28, # 16r0C00
54+ 47, 48, 49, 50, 51, 52, 53, 28, # 16r0E00
55+ 28, 28, 54, 55, 56, 57, 58, 59, # 16r1000
56+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r1200
57+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r1400
58+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r1600
59+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r1800
60+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r1A00
61+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r1C00
62+ 60, 60, 61, 62, 63, 64, 65, 66, # 16r1E00
63+ 67, 68, 69, 70, 71, 72, 73, 74, # 16r2000
64+ 75, 75, 75, 76, 77, 78, 28, 28, # 16r2200
65+ 79, 80, 81, 82, 83, 83, 84, 85, # 16r2400
66+ 86, 85, 28, 28, 87, 88, 89, 28, # 16r2600
67+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r2800
68+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r2A00
69+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r2C00
70+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r2E00
71+ 90, 91, 92, 93, 94, 56, 95, 28, # 16r3000
72+ 96, 97, 98, 99, 83, 100, 83, 101, # 16r3200
73+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r3400
74+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r3600
75+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r3800
76+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r3A00
77+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r3C00
78+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r3E00
79+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r4000
80+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r4200
81+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r4400
82+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r4600
83+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r4800
84+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r4A00
85+ 28, 28, 28, 28, 28, 28, 28, 28, # 16r4C00
86+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r4E00
87+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r5000
88+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r5200
89+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r5400
90+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r5600
91+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r5800
92+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r5A00
93+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r5C00
94+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r5E00
95+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r6000
96+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r6200
97+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r6400
98+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r6600
99+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r6800
100+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r6A00
101+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r6C00
102+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r6E00
103+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r7000
104+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r7200
105+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r7400
106+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r7600
107+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r7800
108+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r7A00
109+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r7C00
110+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r7E00
111+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r8000
112+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r8200
113+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r8400
114+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r8600
115+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r8800
116+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r8A00
117+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r8C00
118+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r8E00
119+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r9000
120+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r9200
121+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r9400
122+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r9600
123+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r9800
124+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r9A00
125+ 56, 56, 56, 56, 56, 56, 56, 56, # 16r9C00
126+ 56, 56, 56, 56, 56, 56, 102, 28, # 16r9E00
127+ 28, 28, 28, 28, 28, 28, 28, 28, # 16rA000
128+ 28, 28, 28, 28, 28, 28, 28, 28, # 16rA200
129+ 28, 28, 28, 28, 28, 28, 28, 28, # 16rA400
130+ 28, 28, 28, 28, 28, 28, 28, 28, # 16rA600
131+ 28, 28, 28, 28, 28, 28, 28, 28, # 16rA800
132+ 28, 28, 28, 28, 28, 28, 28, 28, # 16rAA00
133+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rAC00
134+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rAE00
135+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rB000
136+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rB200
137+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rB400
138+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rB600
139+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rB800
140+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rBA00
141+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rBC00
142+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rBE00
143+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rC000
144+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rC200
145+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rC400
146+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rC600
147+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rC800
148+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rCA00
149+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rCC00
150+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rCE00
151+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rD000
152+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rD200
153+ 56, 56, 56, 56, 56, 56, 56, 56, # 16rD400
154+ 56, 56, 56, 56, 56, 56, 103, 28, # 16rD600
155+ 104, 104, 104, 104, 104, 104, 104, 104, # 16rD800
156+ 104, 104, 104, 104, 104, 104, 104, 104, # 16rDA00
157+ 104, 104, 104, 104, 104, 104, 104, 104, # 16rDC00
158+ 104, 104, 104, 104, 104, 104, 104, 104, # 16rDE00
159+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rE000
160+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rE200
161+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rE400
162+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rE600
163+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rE800
164+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rEA00
165+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rEC00
166+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rEE00
167+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rF000
168+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rF200
169+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rF400
170+ 105, 105, 105, 105, 105, 105, 105, 105, # 16rF600
171+ 105, 105, 105, 105, 56, 56, 56, 56, # 16rF800
172+ 106, 28, 28, 28, 107, 108, 109, 110, # 16rFA00
173+ 56, 56, 56, 56, 111, 112, 113, 114, # 16rFC00
174+ 115, 116, 56, 117, 118, 119, 120, 121 # 16rFE00
175+ };
176+
177+# The Y table has 7808 entries for a total of 7808 bytes.
178+
179+Y = array[] of {
180+ 0, 0, 0, 0, 0, 0, 0, 0, # 0
181+ 0, 1, 1, 1, 1, 1, 0, 0, # 0
182+ 0, 0, 0, 0, 0, 0, 0, 0, # 0
183+ 0, 0, 0, 0, 1, 1, 1, 1, # 0
184+ 2, 3, 3, 3, 4, 3, 3, 3, # 0
185+ 5, 6, 3, 7, 3, 8, 3, 3, # 0
186+ 9, 9, 9, 9, 9, 9, 9, 9, # 0
187+ 9, 9, 3, 3, 7, 7, 7, 3, # 0
188+ 3, 10, 10, 10, 10, 10, 10, 10, # 1
189+ 10, 10, 10, 10, 10, 10, 10, 10, # 1
190+ 10, 10, 10, 10, 10, 10, 10, 10, # 1
191+ 10, 10, 10, 5, 3, 6, 11, 12, # 1
192+ 11, 13, 13, 13, 13, 13, 13, 13, # 1
193+ 13, 13, 13, 13, 13, 13, 13, 13, # 1
194+ 13, 13, 13, 13, 13, 13, 13, 13, # 1
195+ 13, 13, 13, 5, 7, 6, 7, 0, # 1
196+ 0, 0, 0, 0, 0, 0, 0, 0, # 2
197+ 0, 0, 0, 0, 0, 0, 0, 0, # 2
198+ 0, 0, 0, 0, 0, 0, 0, 0, # 2
199+ 0, 0, 0, 0, 0, 0, 0, 0, # 2
200+ 14, 3, 4, 4, 4, 4, 15, 15, # 2
201+ 11, 15, 16, 5, 7, 8, 15, 11, # 2
202+ 15, 7, 17, 17, 11, 16, 15, 3, # 2
203+ 11, 18, 16, 6, 19, 19, 19, 3, # 2
204+ 20, 20, 20, 20, 20, 20, 20, 20, # 3
205+ 20, 20, 20, 20, 20, 20, 20, 20, # 3
206+ 20, 20, 20, 20, 20, 20, 20, 7, # 3
207+ 20, 20, 20, 20, 20, 20, 20, 16, # 3
208+ 21, 21, 21, 21, 21, 21, 21, 21, # 3
209+ 21, 21, 21, 21, 21, 21, 21, 21, # 3
210+ 21, 21, 21, 21, 21, 21, 21, 7, # 3
211+ 21, 21, 21, 21, 21, 21, 21, 22, # 3
212+ 23, 24, 23, 24, 23, 24, 23, 24, # 4
213+ 23, 24, 23, 24, 23, 24, 23, 24, # 4
214+ 23, 24, 23, 24, 23, 24, 23, 24, # 4
215+ 23, 24, 23, 24, 23, 24, 23, 24, # 4
216+ 23, 24, 23, 24, 23, 24, 23, 24, # 4
217+ 23, 24, 23, 24, 23, 24, 23, 24, # 4
218+ 25, 26, 23, 24, 23, 24, 23, 24, # 4
219+ 16, 23, 24, 23, 24, 23, 24, 23, # 4
220+ 24, 23, 24, 23, 24, 23, 24, 23, # 5
221+ 24, 16, 23, 24, 23, 24, 23, 24, # 5
222+ 23, 24, 23, 24, 23, 24, 23, 24, # 5
223+ 23, 24, 23, 24, 23, 24, 23, 24, # 5
224+ 23, 24, 23, 24, 23, 24, 23, 24, # 5
225+ 23, 24, 23, 24, 23, 24, 23, 24, # 5
226+ 23, 24, 23, 24, 23, 24, 23, 24, # 5
227+ 27, 23, 24, 23, 24, 23, 24, 28, # 5
228+ 16, 29, 23, 24, 23, 24, 30, 23, # 6
229+ 24, 31, 31, 23, 24, 16, 32, 32, # 6
230+ 33, 23, 24, 31, 34, 16, 35, 36, # 6
231+ 23, 24, 16, 16, 35, 37, 16, 38, # 6
232+ 23, 24, 23, 24, 23, 24, 38, 23, # 6
233+ 24, 39, 40, 16, 23, 24, 39, 23, # 6
234+ 24, 41, 41, 23, 24, 23, 24, 42, # 6
235+ 23, 24, 16, 40, 23, 24, 40, 40, # 6
236+ 40, 40, 40, 40, 43, 44, 45, 43, # 7
237+ 44, 45, 43, 44, 45, 23, 24, 23, # 7
238+ 24, 23, 24, 23, 24, 23, 24, 23, # 7
239+ 24, 23, 24, 23, 24, 16, 23, 24, # 7
240+ 23, 24, 23, 24, 23, 24, 23, 24, # 7
241+ 23, 24, 23, 24, 23, 24, 23, 24, # 7
242+ 16, 43, 44, 45, 23, 24, 46, 46, # 7
243+ 46, 46, 23, 24, 23, 24, 23, 24, # 7
244+ 23, 24, 23, 24, 23, 24, 23, 24, # 8
245+ 23, 24, 23, 24, 23, 24, 23, 24, # 8
246+ 23, 24, 23, 24, 23, 24, 23, 24, # 8
247+ 46, 46, 46, 46, 46, 46, 46, 46, # 8
248+ 46, 46, 46, 46, 46, 46, 46, 46, # 8
249+ 46, 46, 46, 46, 46, 46, 46, 46, # 8
250+ 46, 46, 46, 46, 46, 46, 46, 46, # 8
251+ 46, 46, 46, 46, 46, 46, 46, 46, # 8
252+ 46, 46, 46, 46, 46, 46, 46, 46, # 9
253+ 46, 46, 46, 46, 46, 46, 46, 46, # 9
254+ 16, 16, 16, 47, 48, 16, 49, 49, # 9
255+ 50, 50, 16, 51, 16, 16, 16, 16, # 9
256+ 49, 16, 16, 52, 16, 16, 16, 16, # 9
257+ 53, 54, 16, 16, 16, 16, 16, 54, # 9
258+ 16, 16, 55, 16, 16, 16, 16, 16, # 9
259+ 16, 16, 16, 16, 16, 16, 16, 16, # 9
260+ 16, 16, 16, 56, 16, 16, 16, 16, # 10
261+ 56, 16, 57, 57, 16, 16, 16, 16, # 10
262+ 16, 16, 58, 16, 16, 16, 16, 16, # 10
263+ 16, 16, 16, 16, 16, 16, 16, 16, # 10
264+ 16, 16, 16, 16, 16, 16, 16, 16, # 10
265+ 16, 46, 46, 46, 46, 46, 46, 46, # 10
266+ 59, 59, 59, 59, 59, 59, 59, 59, # 10
267+ 59, 11, 11, 59, 59, 59, 59, 59, # 10
268+ 59, 59, 11, 11, 11, 11, 11, 11, # 11
269+ 11, 11, 11, 11, 11, 11, 11, 11, # 11
270+ 59, 59, 11, 11, 11, 11, 11, 11, # 11
271+ 11, 11, 11, 11, 11, 11, 11, 46, # 11
272+ 59, 59, 59, 59, 59, 11, 11, 11, # 11
273+ 11, 11, 46, 46, 46, 46, 46, 46, # 11
274+ 46, 46, 46, 46, 46, 46, 46, 46, # 11
275+ 46, 46, 46, 46, 46, 46, 46, 46, # 11
276+ 60, 60, 60, 60, 60, 60, 60, 60, # 12
277+ 60, 60, 60, 60, 60, 60, 60, 60, # 12
278+ 60, 60, 60, 60, 60, 60, 60, 60, # 12
279+ 60, 60, 60, 60, 60, 60, 60, 60, # 12
280+ 60, 60, 60, 60, 60, 60, 60, 60, # 12
281+ 60, 60, 60, 60, 60, 60, 60, 60, # 12
282+ 60, 60, 60, 60, 60, 60, 60, 60, # 12
283+ 60, 60, 60, 60, 60, 60, 60, 60, # 12
284+ 60, 60, 60, 60, 60, 60, 46, 46, # 13
285+ 46, 46, 46, 46, 46, 46, 46, 46, # 13
286+ 46, 46, 46, 46, 46, 46, 46, 46, # 13
287+ 46, 46, 46, 46, 46, 46, 46, 46, # 13
288+ 60, 60, 46, 46, 46, 46, 46, 46, # 13
289+ 46, 46, 46, 46, 46, 46, 46, 46, # 13
290+ 46, 46, 46, 46, 3, 3, 46, 46, # 13
291+ 46, 46, 59, 46, 46, 46, 3, 46, # 13
292+ 46, 46, 46, 46, 11, 11, 61, 3, # 14
293+ 62, 62, 62, 46, 63, 46, 64, 64, # 14
294+ 16, 20, 20, 20, 20, 20, 20, 20, # 14
295+ 20, 20, 20, 20, 20, 20, 20, 20, # 14
296+ 20, 20, 46, 20, 20, 20, 20, 20, # 14
297+ 20, 20, 20, 20, 65, 66, 66, 66, # 14
298+ 16, 21, 21, 21, 21, 21, 21, 21, # 14
299+ 21, 21, 21, 21, 21, 21, 21, 21, # 14
300+ 21, 21, 16, 21, 21, 21, 21, 21, # 15
301+ 21, 21, 21, 21, 67, 68, 68, 46, # 15
302+ 69, 70, 38, 38, 38, 71, 72, 46, # 15
303+ 46, 46, 38, 46, 38, 46, 38, 46, # 15
304+ 38, 46, 23, 24, 23, 24, 23, 24, # 15
305+ 23, 24, 23, 24, 23, 24, 23, 24, # 15
306+ 73, 74, 16, 40, 46, 46, 46, 46, # 15
307+ 46, 46, 46, 46, 46, 46, 46, 46, # 15
308+ 46, 75, 75, 75, 75, 75, 75, 75, # 16
309+ 75, 75, 75, 75, 75, 46, 75, 75, # 16
310+ 20, 20, 20, 20, 20, 20, 20, 20, # 16
311+ 20, 20, 20, 20, 20, 20, 20, 20, # 16
312+ 20, 20, 20, 20, 20, 20, 20, 20, # 16
313+ 20, 20, 20, 20, 20, 20, 20, 20, # 16
314+ 21, 21, 21, 21, 21, 21, 21, 21, # 16
315+ 21, 21, 21, 21, 21, 21, 21, 21, # 16
316+ 21, 21, 21, 21, 21, 21, 21, 21, # 17
317+ 21, 21, 21, 21, 21, 21, 21, 21, # 17
318+ 46, 74, 74, 74, 74, 74, 74, 74, # 17
319+ 74, 74, 74, 74, 74, 46, 74, 74, # 17
320+ 23, 24, 23, 24, 23, 24, 23, 24, # 17
321+ 23, 24, 23, 24, 23, 24, 23, 24, # 17
322+ 23, 24, 23, 24, 23, 24, 23, 24, # 17
323+ 23, 24, 23, 24, 23, 24, 23, 24, # 17
324+ 23, 24, 15, 60, 60, 60, 60, 46, # 18
325+ 46, 46, 46, 46, 46, 46, 46, 46, # 18
326+ 23, 24, 23, 24, 23, 24, 23, 24, # 18
327+ 23, 24, 23, 24, 23, 24, 23, 24, # 18
328+ 23, 24, 23, 24, 23, 24, 23, 24, # 18
329+ 23, 24, 23, 24, 23, 24, 23, 24, # 18
330+ 23, 24, 23, 24, 23, 24, 23, 24, # 18
331+ 23, 24, 23, 24, 23, 24, 23, 24, # 18
332+ 40, 23, 24, 23, 24, 46, 46, 23, # 19
333+ 24, 46, 46, 23, 24, 46, 46, 46, # 19
334+ 23, 24, 23, 24, 23, 24, 23, 24, # 19
335+ 23, 24, 23, 24, 23, 24, 23, 24, # 19
336+ 23, 24, 23, 24, 23, 24, 23, 24, # 19
337+ 23, 24, 23, 24, 46, 46, 23, 24, # 19
338+ 23, 24, 23, 24, 23, 24, 46, 46, # 19
339+ 23, 24, 46, 46, 46, 46, 46, 46, # 19
340+ 46, 46, 46, 46, 46, 46, 46, 46, # 20
341+ 46, 46, 46, 46, 46, 46, 46, 46, # 20
342+ 46, 46, 46, 46, 46, 46, 46, 46, # 20
343+ 46, 46, 46, 46, 46, 46, 46, 46, # 20
344+ 46, 46, 46, 46, 46, 46, 46, 46, # 20
345+ 46, 46, 46, 46, 46, 46, 46, 46, # 20
346+ 46, 76, 76, 76, 76, 76, 76, 76, # 20
347+ 76, 76, 76, 76, 76, 76, 76, 76, # 20
348+ 76, 76, 76, 76, 76, 76, 76, 76, # 21
349+ 76, 76, 76, 76, 76, 76, 76, 76, # 21
350+ 76, 76, 76, 76, 76, 76, 76, 46, # 21
351+ 46, 59, 3, 3, 3, 3, 3, 3, # 21
352+ 46, 77, 77, 77, 77, 77, 77, 77, # 21
353+ 77, 77, 77, 77, 77, 77, 77, 77, # 21
354+ 77, 77, 77, 77, 77, 77, 77, 77, # 21
355+ 77, 77, 77, 77, 77, 77, 77, 77, # 21
356+ 77, 77, 77, 77, 77, 77, 77, 16, # 22
357+ 46, 3, 46, 46, 46, 46, 46, 46, # 22
358+ 46, 60, 60, 60, 60, 60, 60, 60, # 22
359+ 60, 60, 60, 60, 60, 60, 60, 60, # 22
360+ 60, 60, 46, 60, 60, 60, 60, 60, # 22
361+ 60, 60, 60, 60, 60, 60, 60, 60, # 22
362+ 60, 60, 60, 60, 60, 60, 60, 60, # 22
363+ 60, 60, 46, 60, 60, 60, 3, 60, # 22
364+ 3, 60, 60, 3, 60, 46, 46, 46, # 23
365+ 46, 46, 46, 46, 46, 46, 46, 46, # 23
366+ 40, 40, 40, 40, 40, 40, 40, 40, # 23
367+ 40, 40, 40, 40, 40, 40, 40, 40, # 23
368+ 40, 40, 40, 40, 40, 40, 40, 40, # 23
369+ 40, 40, 40, 46, 46, 46, 46, 46, # 23
370+ 40, 40, 40, 3, 3, 46, 46, 46, # 23
371+ 46, 46, 46, 46, 46, 46, 46, 46, # 23
372+ 46, 46, 46, 46, 46, 46, 46, 46, # 24
373+ 46, 46, 46, 46, 3, 46, 46, 46, # 24
374+ 46, 46, 46, 46, 46, 46, 46, 46, # 24
375+ 46, 46, 46, 3, 46, 46, 46, 3, # 24
376+ 46, 40, 40, 40, 40, 40, 40, 40, # 24
377+ 40, 40, 40, 40, 40, 40, 40, 40, # 24
378+ 40, 40, 40, 40, 40, 40, 40, 40, # 24
379+ 40, 40, 40, 46, 46, 46, 46, 46, # 24
380+ 59, 40, 40, 40, 40, 40, 40, 40, # 25
381+ 40, 40, 40, 60, 60, 60, 60, 60, # 25
382+ 60, 60, 60, 46, 46, 46, 46, 46, # 25
383+ 46, 46, 46, 46, 46, 46, 46, 46, # 25
384+ 78, 78, 78, 78, 78, 78, 78, 78, # 25
385+ 78, 78, 3, 3, 3, 3, 46, 46, # 25
386+ 60, 40, 40, 40, 40, 40, 40, 40, # 25
387+ 40, 40, 40, 40, 40, 40, 40, 40, # 25
388+ 40, 40, 40, 40, 40, 40, 40, 40, # 26
389+ 40, 40, 40, 40, 40, 40, 40, 40, # 26
390+ 40, 40, 40, 40, 40, 40, 40, 40, # 26
391+ 40, 40, 40, 40, 40, 40, 40, 40, # 26
392+ 40, 40, 40, 40, 40, 40, 40, 40, # 26
393+ 40, 40, 40, 40, 40, 40, 40, 40, # 26
394+ 40, 40, 40, 40, 40, 40, 40, 40, # 26
395+ 46, 46, 40, 40, 40, 40, 40, 46, # 26
396+ 40, 40, 40, 40, 40, 40, 40, 40, # 27
397+ 40, 40, 40, 40, 40, 40, 40, 46, # 27
398+ 40, 40, 40, 40, 3, 40, 60, 60, # 27
399+ 60, 60, 60, 60, 60, 79, 79, 60, # 27
400+ 60, 60, 60, 60, 60, 59, 59, 60, # 27
401+ 60, 15, 60, 60, 60, 60, 46, 46, # 27
402+ 9, 9, 9, 9, 9, 9, 9, 9, # 27
403+ 9, 9, 46, 46, 46, 46, 46, 46, # 27
404+ 46, 46, 46, 46, 46, 46, 46, 46, # 28
405+ 46, 46, 46, 46, 46, 46, 46, 46, # 28
406+ 46, 46, 46, 46, 46, 46, 46, 46, # 28
407+ 46, 46, 46, 46, 46, 46, 46, 46, # 28
408+ 46, 46, 46, 46, 46, 46, 46, 46, # 28
409+ 46, 46, 46, 46, 46, 46, 46, 46, # 28
410+ 46, 46, 46, 46, 46, 46, 46, 46, # 28
411+ 46, 46, 46, 46, 46, 46, 46, 46, # 28
412+ 46, 60, 60, 80, 46, 40, 40, 40, # 29
413+ 40, 40, 40, 40, 40, 40, 40, 40, # 29
414+ 40, 40, 40, 40, 40, 40, 40, 40, # 29
415+ 40, 40, 40, 40, 40, 40, 40, 40, # 29
416+ 40, 40, 40, 40, 40, 40, 40, 40, # 29
417+ 40, 40, 40, 40, 40, 40, 40, 40, # 29
418+ 40, 40, 40, 40, 40, 40, 40, 40, # 29
419+ 40, 40, 46, 46, 60, 40, 80, 80, # 29
420+ 80, 60, 60, 60, 60, 60, 60, 60, # 30
421+ 60, 80, 80, 80, 80, 60, 46, 46, # 30
422+ 15, 60, 60, 60, 60, 46, 46, 46, # 30
423+ 40, 40, 40, 40, 40, 40, 40, 40, # 30
424+ 40, 40, 60, 60, 3, 3, 81, 81, # 30
425+ 81, 81, 81, 81, 81, 81, 81, 81, # 30
426+ 3, 46, 46, 46, 46, 46, 46, 46, # 30
427+ 46, 46, 46, 46, 46, 46, 46, 46, # 30
428+ 46, 60, 80, 80, 46, 40, 40, 40, # 31
429+ 40, 40, 40, 40, 40, 46, 46, 40, # 31
430+ 40, 46, 46, 40, 40, 40, 40, 40, # 31
431+ 40, 40, 40, 40, 40, 40, 40, 40, # 31
432+ 40, 40, 40, 40, 40, 40, 40, 40, # 31
433+ 40, 46, 40, 40, 40, 40, 40, 40, # 31
434+ 40, 46, 40, 46, 46, 46, 40, 40, # 31
435+ 40, 40, 46, 46, 60, 46, 80, 80, # 31
436+ 80, 60, 60, 60, 60, 46, 46, 80, # 32
437+ 80, 46, 46, 80, 80, 60, 46, 46, # 32
438+ 46, 46, 46, 46, 46, 46, 46, 80, # 32
439+ 46, 46, 46, 46, 40, 40, 46, 40, # 32
440+ 40, 40, 60, 60, 46, 46, 81, 81, # 32
441+ 81, 81, 81, 81, 81, 81, 81, 81, # 32
442+ 40, 40, 4, 4, 82, 82, 82, 82, # 32
443+ 19, 83, 15, 46, 46, 46, 46, 46, # 32
444+ 46, 46, 60, 46, 46, 40, 40, 40, # 33
445+ 40, 40, 40, 46, 46, 46, 46, 40, # 33
446+ 40, 46, 46, 40, 40, 40, 40, 40, # 33
447+ 40, 40, 40, 40, 40, 40, 40, 40, # 33
448+ 40, 40, 40, 40, 40, 40, 40, 40, # 33
449+ 40, 46, 40, 40, 40, 40, 40, 40, # 33
450+ 40, 46, 40, 40, 46, 40, 40, 46, # 33
451+ 40, 40, 46, 46, 60, 46, 80, 80, # 33
452+ 80, 60, 60, 46, 46, 46, 46, 60, # 34
453+ 60, 46, 46, 60, 60, 60, 46, 46, # 34
454+ 46, 46, 46, 46, 46, 46, 46, 46, # 34
455+ 46, 40, 40, 40, 40, 46, 40, 46, # 34
456+ 46, 46, 46, 46, 46, 46, 81, 81, # 34
457+ 81, 81, 81, 81, 81, 81, 81, 81, # 34
458+ 60, 60, 40, 40, 40, 46, 46, 46, # 34
459+ 46, 46, 46, 46, 46, 46, 46, 46, # 34
460+ 46, 60, 60, 80, 46, 40, 40, 40, # 35
461+ 40, 40, 40, 40, 46, 40, 46, 40, # 35
462+ 40, 40, 46, 40, 40, 40, 40, 40, # 35
463+ 40, 40, 40, 40, 40, 40, 40, 40, # 35
464+ 40, 40, 40, 40, 40, 40, 40, 40, # 35
465+ 40, 46, 40, 40, 40, 40, 40, 40, # 35
466+ 40, 46, 40, 40, 46, 40, 40, 40, # 35
467+ 40, 40, 46, 46, 60, 40, 80, 80, # 35
468+ 80, 60, 60, 60, 60, 60, 46, 60, # 36
469+ 60, 80, 46, 80, 80, 60, 46, 46, # 36
470+ 15, 46, 46, 46, 46, 46, 46, 46, # 36
471+ 46, 46, 46, 46, 46, 46, 46, 46, # 36
472+ 40, 46, 46, 46, 46, 46, 81, 81, # 36
473+ 81, 81, 81, 81, 81, 81, 81, 81, # 36
474+ 46, 46, 46, 46, 46, 46, 46, 46, # 36
475+ 46, 46, 46, 46, 46, 46, 46, 46, # 36
476+ 46, 60, 80, 80, 46, 40, 40, 40, # 37
477+ 40, 40, 40, 40, 40, 46, 46, 40, # 37
478+ 40, 46, 46, 40, 40, 40, 40, 40, # 37
479+ 40, 40, 40, 40, 40, 40, 40, 40, # 37
480+ 40, 40, 40, 40, 40, 40, 40, 40, # 37
481+ 40, 46, 40, 40, 40, 40, 40, 40, # 37
482+ 40, 46, 40, 40, 46, 46, 40, 40, # 37
483+ 40, 40, 46, 46, 60, 40, 80, 60, # 37
484+ 80, 60, 60, 60, 46, 46, 46, 80, # 38
485+ 80, 46, 46, 80, 80, 60, 46, 46, # 38
486+ 46, 46, 46, 46, 46, 46, 60, 80, # 38
487+ 46, 46, 46, 46, 40, 40, 46, 40, # 38
488+ 40, 40, 46, 46, 46, 46, 81, 81, # 38
489+ 81, 81, 81, 81, 81, 81, 81, 81, # 38
490+ 15, 46, 46, 46, 46, 46, 46, 46, # 38
491+ 46, 46, 46, 46, 46, 46, 46, 46, # 38
492+ 46, 46, 60, 80, 46, 40, 40, 40, # 39
493+ 40, 40, 40, 46, 46, 46, 40, 40, # 39
494+ 40, 46, 40, 40, 40, 40, 46, 46, # 39
495+ 46, 40, 40, 46, 40, 46, 40, 40, # 39
496+ 46, 46, 46, 40, 40, 46, 46, 46, # 39
497+ 40, 40, 40, 46, 46, 46, 40, 40, # 39
498+ 40, 40, 40, 40, 40, 40, 46, 40, # 39
499+ 40, 40, 46, 46, 46, 46, 80, 80, # 39
500+ 60, 80, 80, 46, 46, 46, 80, 80, # 40
501+ 80, 46, 80, 80, 80, 60, 46, 46, # 40
502+ 46, 46, 46, 46, 46, 46, 46, 80, # 40
503+ 46, 46, 46, 46, 46, 46, 46, 46, # 40
504+ 46, 46, 46, 46, 46, 46, 46, 81, # 40
505+ 81, 81, 81, 81, 81, 81, 81, 81, # 40
506+ 84, 19, 19, 46, 46, 46, 46, 46, # 40
507+ 46, 46, 46, 46, 46, 46, 46, 46, # 40
508+ 46, 80, 80, 80, 46, 40, 40, 40, # 41
509+ 40, 40, 40, 40, 40, 46, 40, 40, # 41
510+ 40, 46, 40, 40, 40, 40, 40, 40, # 41
511+ 40, 40, 40, 40, 40, 40, 40, 40, # 41
512+ 40, 40, 40, 40, 40, 40, 40, 40, # 41
513+ 40, 46, 40, 40, 40, 40, 40, 40, # 41
514+ 40, 40, 40, 40, 46, 40, 40, 40, # 41
515+ 40, 40, 46, 46, 46, 46, 60, 60, # 41
516+ 60, 80, 80, 80, 80, 46, 60, 60, # 42
517+ 60, 46, 60, 60, 60, 60, 46, 46, # 42
518+ 46, 46, 46, 46, 46, 60, 60, 46, # 42
519+ 46, 46, 46, 46, 46, 46, 46, 46, # 42
520+ 40, 40, 46, 46, 46, 46, 81, 81, # 42
521+ 81, 81, 81, 81, 81, 81, 81, 81, # 42
522+ 46, 46, 46, 46, 46, 46, 46, 46, # 42
523+ 46, 46, 46, 46, 46, 46, 46, 46, # 42
524+ 46, 46, 80, 80, 46, 40, 40, 40, # 43
525+ 40, 40, 40, 40, 40, 46, 40, 40, # 43
526+ 40, 46, 40, 40, 40, 40, 40, 40, # 43
527+ 40, 40, 40, 40, 40, 40, 40, 40, # 43
528+ 40, 40, 40, 40, 40, 40, 40, 40, # 43
529+ 40, 46, 40, 40, 40, 40, 40, 40, # 43
530+ 40, 40, 40, 40, 46, 40, 40, 40, # 43
531+ 40, 40, 46, 46, 46, 46, 80, 60, # 43
532+ 80, 80, 80, 80, 80, 46, 60, 80, # 44
533+ 80, 46, 80, 80, 60, 60, 46, 46, # 44
534+ 46, 46, 46, 46, 46, 80, 80, 46, # 44
535+ 46, 46, 46, 46, 46, 46, 40, 46, # 44
536+ 40, 40, 46, 46, 46, 46, 81, 81, # 44
537+ 81, 81, 81, 81, 81, 81, 81, 81, # 44
538+ 46, 46, 46, 46, 46, 46, 46, 46, # 44
539+ 46, 46, 46, 46, 46, 46, 46, 46, # 44
540+ 46, 46, 80, 80, 46, 40, 40, 40, # 45
541+ 40, 40, 40, 40, 40, 46, 40, 40, # 45
542+ 40, 46, 40, 40, 40, 40, 40, 40, # 45
543+ 40, 40, 40, 40, 40, 40, 40, 40, # 45
544+ 40, 40, 40, 40, 40, 40, 40, 40, # 45
545+ 40, 46, 40, 40, 40, 40, 40, 40, # 45
546+ 40, 40, 40, 40, 40, 40, 40, 40, # 45
547+ 40, 40, 46, 46, 46, 46, 80, 80, # 45
548+ 80, 60, 60, 60, 46, 46, 80, 80, # 46
549+ 80, 46, 80, 80, 80, 60, 46, 46, # 46
550+ 46, 46, 46, 46, 46, 46, 46, 80, # 46
551+ 46, 46, 46, 46, 46, 46, 46, 46, # 46
552+ 40, 40, 46, 46, 46, 46, 81, 81, # 46
553+ 81, 81, 81, 81, 81, 81, 81, 81, # 46
554+ 46, 46, 46, 46, 46, 46, 46, 46, # 46
555+ 46, 46, 46, 46, 46, 46, 46, 46, # 46
556+ 46, 40, 40, 40, 40, 40, 40, 40, # 47
557+ 40, 40, 40, 40, 40, 40, 40, 40, # 47
558+ 40, 40, 40, 40, 40, 40, 40, 40, # 47
559+ 40, 40, 40, 40, 40, 40, 40, 40, # 47
560+ 40, 40, 40, 40, 40, 40, 40, 40, # 47
561+ 40, 40, 40, 40, 40, 40, 40, 3, # 47
562+ 40, 60, 40, 40, 60, 60, 60, 60, # 47
563+ 60, 60, 60, 46, 46, 46, 46, 4, # 47
564+ 40, 40, 40, 40, 40, 40, 59, 60, # 48
565+ 60, 60, 60, 60, 60, 60, 60, 15, # 48
566+ 9, 9, 9, 9, 9, 9, 9, 9, # 48
567+ 9, 9, 3, 3, 46, 46, 46, 46, # 48
568+ 46, 46, 46, 46, 46, 46, 46, 46, # 48
569+ 46, 46, 46, 46, 46, 46, 46, 46, # 48
570+ 46, 46, 46, 46, 46, 46, 46, 46, # 48
571+ 46, 46, 46, 46, 46, 46, 46, 46, # 48
572+ 46, 40, 40, 46, 40, 46, 46, 40, # 49
573+ 40, 46, 40, 46, 46, 40, 46, 46, # 49
574+ 46, 46, 46, 46, 40, 40, 40, 40, # 49
575+ 46, 40, 40, 40, 40, 40, 40, 40, # 49
576+ 46, 40, 40, 40, 46, 40, 46, 40, # 49
577+ 46, 46, 40, 40, 46, 40, 40, 3, # 49
578+ 40, 60, 40, 40, 60, 60, 60, 60, # 49
579+ 60, 60, 46, 60, 60, 40, 46, 46, # 49
580+ 40, 40, 40, 40, 40, 46, 59, 46, # 50
581+ 60, 60, 60, 60, 60, 60, 46, 46, # 50
582+ 9, 9, 9, 9, 9, 9, 9, 9, # 50
583+ 9, 9, 46, 46, 40, 40, 46, 46, # 50
584+ 46, 46, 46, 46, 46, 46, 46, 46, # 50
585+ 46, 46, 46, 46, 46, 46, 46, 46, # 50
586+ 46, 46, 46, 46, 46, 46, 46, 46, # 50
587+ 46, 46, 46, 46, 46, 46, 46, 46, # 50
588+ 15, 15, 15, 15, 3, 3, 3, 3, # 51
589+ 3, 3, 3, 3, 3, 3, 3, 3, # 51
590+ 3, 3, 3, 15, 15, 15, 15, 15, # 51
591+ 60, 60, 15, 15, 15, 15, 15, 15, # 51
592+ 78, 78, 78, 78, 78, 78, 78, 78, # 51
593+ 78, 78, 85, 85, 85, 85, 85, 85, # 51
594+ 85, 85, 85, 85, 15, 60, 15, 60, # 51
595+ 15, 60, 5, 6, 5, 6, 80, 80, # 51
596+ 40, 40, 40, 40, 40, 40, 40, 40, # 52
597+ 46, 40, 40, 40, 40, 40, 40, 40, # 52
598+ 40, 40, 40, 40, 40, 40, 40, 40, # 52
599+ 40, 40, 40, 40, 40, 40, 40, 40, # 52
600+ 40, 40, 40, 40, 40, 40, 40, 40, # 52
601+ 40, 40, 46, 46, 46, 46, 46, 46, # 52
602+ 46, 60, 60, 60, 60, 60, 60, 60, # 52
603+ 60, 60, 60, 60, 60, 60, 60, 80, # 52
604+ 60, 60, 60, 60, 60, 3, 60, 60, # 53
605+ 60, 60, 60, 60, 46, 46, 46, 46, # 53
606+ 60, 60, 60, 60, 60, 60, 46, 60, # 53
607+ 46, 60, 60, 60, 60, 60, 60, 60, # 53
608+ 60, 60, 60, 60, 60, 60, 60, 60, # 53
609+ 60, 60, 60, 60, 60, 60, 46, 46, # 53
610+ 46, 60, 60, 60, 60, 60, 60, 60, # 53
611+ 46, 60, 46, 46, 46, 46, 46, 46, # 53
612+ 46, 46, 46, 46, 46, 46, 46, 46, # 54
613+ 46, 46, 46, 46, 46, 46, 46, 46, # 54
614+ 46, 46, 46, 46, 46, 46, 46, 46, # 54
615+ 46, 46, 46, 46, 46, 46, 46, 46, # 54
616+ 76, 76, 76, 76, 76, 76, 76, 76, # 54
617+ 76, 76, 76, 76, 76, 76, 76, 76, # 54
618+ 76, 76, 76, 76, 76, 76, 76, 76, # 54
619+ 76, 76, 76, 76, 76, 76, 76, 76, # 54
620+ 76, 76, 76, 76, 76, 76, 46, 46, # 55
621+ 46, 46, 46, 46, 46, 46, 46, 46, # 55
622+ 16, 16, 16, 16, 16, 16, 16, 16, # 55
623+ 16, 16, 16, 16, 16, 16, 16, 16, # 55
624+ 16, 16, 16, 16, 16, 16, 16, 16, # 55
625+ 16, 16, 16, 16, 16, 16, 16, 16, # 55
626+ 16, 16, 16, 16, 16, 16, 16, 46, # 55
627+ 46, 46, 46, 3, 46, 46, 46, 46, # 55
628+ 40, 40, 40, 40, 40, 40, 40, 40, # 56
629+ 40, 40, 40, 40, 40, 40, 40, 40, # 56
630+ 40, 40, 40, 40, 40, 40, 40, 40, # 56
631+ 40, 40, 40, 40, 40, 40, 40, 40, # 56
632+ 40, 40, 40, 40, 40, 40, 40, 40, # 56
633+ 40, 40, 40, 40, 40, 40, 40, 40, # 56
634+ 40, 40, 40, 40, 40, 40, 40, 40, # 56
635+ 40, 40, 40, 40, 40, 40, 40, 40, # 56
636+ 40, 40, 40, 40, 40, 40, 40, 40, # 57
637+ 40, 40, 40, 40, 40, 40, 40, 40, # 57
638+ 40, 40, 40, 40, 40, 40, 40, 40, # 57
639+ 40, 40, 46, 46, 46, 46, 46, 40, # 57
640+ 40, 40, 40, 40, 40, 40, 40, 40, # 57
641+ 40, 40, 40, 40, 40, 40, 40, 40, # 57
642+ 40, 40, 40, 40, 40, 40, 40, 40, # 57
643+ 40, 40, 40, 40, 40, 40, 40, 40, # 57
644+ 40, 40, 40, 40, 40, 40, 40, 40, # 58
645+ 40, 40, 40, 40, 40, 40, 40, 40, # 58
646+ 40, 40, 40, 40, 40, 40, 40, 40, # 58
647+ 40, 40, 40, 40, 40, 40, 40, 40, # 58
648+ 40, 40, 40, 46, 46, 46, 46, 46, # 58
649+ 40, 40, 40, 40, 40, 40, 40, 40, # 58
650+ 40, 40, 40, 40, 40, 40, 40, 40, # 58
651+ 40, 40, 40, 40, 40, 40, 40, 40, # 58
652+ 40, 40, 40, 40, 40, 40, 40, 40, # 59
653+ 40, 40, 40, 40, 40, 40, 40, 40, # 59
654+ 40, 40, 40, 40, 40, 40, 40, 40, # 59
655+ 40, 40, 40, 40, 40, 40, 40, 40, # 59
656+ 40, 40, 40, 40, 40, 40, 40, 40, # 59
657+ 40, 40, 40, 40, 40, 40, 40, 40, # 59
658+ 40, 40, 40, 40, 40, 40, 40, 40, # 59
659+ 40, 40, 46, 46, 46, 46, 46, 46, # 59
660+ 23, 24, 23, 24, 23, 24, 23, 24, # 60
661+ 23, 24, 23, 24, 23, 24, 23, 24, # 60
662+ 23, 24, 23, 24, 23, 24, 23, 24, # 60
663+ 23, 24, 23, 24, 23, 24, 23, 24, # 60
664+ 23, 24, 23, 24, 23, 24, 23, 24, # 60
665+ 23, 24, 23, 24, 23, 24, 23, 24, # 60
666+ 23, 24, 23, 24, 23, 24, 23, 24, # 60
667+ 23, 24, 23, 24, 23, 24, 23, 24, # 60
668+ 23, 24, 23, 24, 23, 24, 23, 24, # 61
669+ 23, 24, 23, 24, 23, 24, 23, 24, # 61
670+ 23, 24, 23, 24, 23, 24, 16, 16, # 61
671+ 16, 16, 16, 16, 46, 46, 46, 46, # 61
672+ 23, 24, 23, 24, 23, 24, 23, 24, # 61
673+ 23, 24, 23, 24, 23, 24, 23, 24, # 61
674+ 23, 24, 23, 24, 23, 24, 23, 24, # 61
675+ 23, 24, 23, 24, 23, 24, 23, 24, # 61
676+ 23, 24, 23, 24, 23, 24, 23, 24, # 62
677+ 23, 24, 23, 24, 23, 24, 23, 24, # 62
678+ 23, 24, 23, 24, 23, 24, 23, 24, # 62
679+ 23, 24, 23, 24, 23, 24, 23, 24, # 62
680+ 23, 24, 23, 24, 23, 24, 23, 24, # 62
681+ 23, 24, 23, 24, 23, 24, 23, 24, # 62
682+ 23, 24, 23, 24, 23, 24, 23, 24, # 62
683+ 23, 24, 46, 46, 46, 46, 46, 46, # 62
684+ 86, 86, 86, 86, 86, 86, 86, 86, # 63
685+ 87, 87, 87, 87, 87, 87, 87, 87, # 63
686+ 86, 86, 86, 86, 86, 86, 46, 46, # 63
687+ 87, 87, 87, 87, 87, 87, 46, 46, # 63
688+ 86, 86, 86, 86, 86, 86, 86, 86, # 63
689+ 87, 87, 87, 87, 87, 87, 87, 87, # 63
690+ 86, 86, 86, 86, 86, 86, 86, 86, # 63
691+ 87, 87, 87, 87, 87, 87, 87, 87, # 63
692+ 86, 86, 86, 86, 86, 86, 46, 46, # 64
693+ 87, 87, 87, 87, 87, 87, 46, 46, # 64
694+ 16, 86, 16, 86, 16, 86, 16, 86, # 64
695+ 46, 87, 46, 87, 46, 87, 46, 87, # 64
696+ 86, 86, 86, 86, 86, 86, 86, 86, # 64
697+ 87, 87, 87, 87, 87, 87, 87, 87, # 64
698+ 88, 88, 89, 89, 89, 89, 90, 90, # 64
699+ 91, 91, 92, 92, 93, 93, 46, 46, # 64
700+ 86, 86, 86, 86, 86, 86, 86, 86, # 65
701+ 87, 87, 87, 87, 87, 87, 87, 87, # 65
702+ 86, 86, 86, 86, 86, 86, 86, 86, # 65
703+ 87, 87, 87, 87, 87, 87, 87, 87, # 65
704+ 86, 86, 86, 86, 86, 86, 86, 86, # 65
705+ 87, 87, 87, 87, 87, 87, 87, 87, # 65
706+ 86, 86, 16, 94, 16, 46, 16, 16, # 65
707+ 87, 87, 95, 95, 96, 11, 38, 11, # 65
708+ 11, 11, 16, 94, 16, 46, 16, 16, # 66
709+ 97, 97, 97, 97, 96, 11, 11, 11, # 66
710+ 86, 86, 16, 16, 46, 46, 16, 16, # 66
711+ 87, 87, 98, 98, 46, 11, 11, 11, # 66
712+ 86, 86, 16, 16, 16, 99, 16, 16, # 66
713+ 87, 87, 100, 100, 101, 11, 11, 11, # 66
714+ 46, 46, 16, 94, 16, 46, 16, 16, # 66
715+ 102, 102, 103, 103, 96, 11, 11, 46, # 66
716+ 2, 2, 2, 2, 2, 2, 2, 2, # 67
717+ 2, 2, 2, 2, 104, 104, 104, 104, # 67
718+ 8, 8, 8, 8, 8, 8, 3, 3, # 67
719+ 5, 6, 5, 5, 5, 6, 5, 5, # 67
720+ 3, 3, 3, 3, 3, 3, 3, 3, # 67
721+ 105, 106, 104, 104, 104, 104, 104, 46, # 67
722+ 3, 3, 3, 3, 3, 3, 3, 3, # 67
723+ 3, 5, 6, 3, 3, 3, 3, 12, # 67
724+ 12, 3, 3, 3, 7, 5, 6, 46, # 68
725+ 46, 46, 46, 46, 46, 46, 46, 46, # 68
726+ 46, 46, 46, 46, 46, 46, 46, 46, # 68
727+ 46, 46, 46, 46, 46, 46, 46, 46, # 68
728+ 46, 46, 46, 46, 46, 46, 46, 46, # 68
729+ 46, 46, 104, 104, 104, 104, 104, 104, # 68
730+ 17, 46, 46, 46, 17, 17, 17, 17, # 68
731+ 17, 17, 7, 7, 7, 5, 6, 16, # 68
732+ 107, 107, 107, 107, 107, 107, 107, 107, # 69
733+ 107, 107, 7, 7, 7, 5, 6, 46, # 69
734+ 46, 46, 46, 46, 46, 46, 46, 46, # 69
735+ 46, 46, 46, 46, 46, 46, 46, 46, # 69
736+ 4, 4, 4, 4, 4, 4, 4, 4, # 69
737+ 4, 4, 4, 4, 46, 46, 46, 46, # 69
738+ 46, 46, 46, 46, 46, 46, 46, 46, # 69
739+ 46, 46, 46, 46, 46, 46, 46, 46, # 69
740+ 46, 46, 46, 46, 46, 46, 46, 46, # 70
741+ 46, 46, 46, 46, 46, 46, 46, 46, # 70
742+ 60, 60, 60, 60, 60, 60, 60, 60, # 70
743+ 60, 60, 60, 60, 60, 79, 79, 79, # 70
744+ 79, 60, 46, 46, 46, 46, 46, 46, # 70
745+ 46, 46, 46, 46, 46, 46, 46, 46, # 70
746+ 46, 46, 46, 46, 46, 46, 46, 46, # 70
747+ 46, 46, 46, 46, 46, 46, 46, 46, # 70
748+ 15, 15, 38, 15, 15, 15, 15, 38, # 71
749+ 15, 15, 16, 38, 38, 38, 16, 16, # 71
750+ 38, 38, 38, 16, 15, 38, 15, 15, # 71
751+ 38, 38, 38, 38, 38, 38, 15, 15, # 71
752+ 15, 15, 15, 15, 38, 15, 38, 15, # 71
753+ 38, 15, 38, 38, 38, 38, 16, 16, # 71
754+ 38, 38, 15, 38, 16, 40, 40, 40, # 71
755+ 40, 46, 46, 46, 46, 46, 46, 46, # 71
756+ 46, 46, 46, 46, 46, 46, 46, 46, # 72
757+ 46, 46, 46, 46, 46, 46, 46, 46, # 72
758+ 46, 46, 46, 19, 19, 19, 19, 19, # 72
759+ 19, 19, 19, 19, 19, 19, 19, 108, # 72
760+ 109, 109, 109, 109, 109, 109, 109, 109, # 72
761+ 109, 109, 109, 109, 110, 110, 110, 110, # 72
762+ 111, 111, 111, 111, 111, 111, 111, 111, # 72
763+ 111, 111, 111, 111, 112, 112, 112, 112, # 72
764+ 113, 113, 113, 46, 46, 46, 46, 46, # 73
765+ 46, 46, 46, 46, 46, 46, 46, 46, # 73
766+ 7, 7, 7, 7, 7, 15, 15, 15, # 73
767+ 15, 15, 15, 15, 15, 15, 15, 15, # 73
768+ 15, 15, 15, 15, 15, 15, 15, 15, # 73
769+ 15, 15, 15, 15, 15, 15, 15, 15, # 73
770+ 15, 15, 15, 15, 15, 15, 15, 15, # 73
771+ 15, 15, 15, 15, 15, 15, 15, 15, # 73
772+ 15, 15, 15, 15, 15, 15, 15, 15, # 74
773+ 15, 15, 15, 15, 15, 15, 15, 15, # 74
774+ 15, 15, 7, 15, 7, 15, 15, 15, # 74
775+ 15, 15, 15, 15, 15, 15, 15, 15, # 74
776+ 15, 15, 15, 15, 15, 15, 15, 15, # 74
777+ 15, 15, 15, 46, 46, 46, 46, 46, # 74
778+ 46, 46, 46, 46, 46, 46, 46, 46, # 74
779+ 46, 46, 46, 46, 46, 46, 46, 46, # 74
780+ 7, 7, 7, 7, 7, 7, 7, 7, # 75
781+ 7, 7, 7, 7, 7, 7, 7, 7, # 75
782+ 7, 7, 7, 7, 7, 7, 7, 7, # 75
783+ 7, 7, 7, 7, 7, 7, 7, 7, # 75
784+ 7, 7, 7, 7, 7, 7, 7, 7, # 75
785+ 7, 7, 7, 7, 7, 7, 7, 7, # 75
786+ 7, 7, 7, 7, 7, 7, 7, 7, # 75
787+ 7, 7, 7, 7, 7, 7, 7, 7, # 75
788+ 7, 7, 7, 7, 7, 7, 7, 7, # 76
789+ 7, 7, 7, 7, 7, 7, 7, 7, # 76
790+ 7, 7, 7, 7, 7, 7, 7, 7, # 76
791+ 7, 7, 7, 7, 7, 7, 7, 7, # 76
792+ 7, 7, 7, 7, 7, 7, 7, 7, # 76
793+ 7, 7, 7, 7, 7, 7, 7, 7, # 76
794+ 7, 7, 46, 46, 46, 46, 46, 46, # 76
795+ 46, 46, 46, 46, 46, 46, 46, 46, # 76
796+ 15, 46, 15, 15, 15, 15, 15, 15, # 77
797+ 7, 7, 7, 7, 15, 15, 15, 15, # 77
798+ 15, 15, 15, 15, 15, 15, 15, 15, # 77
799+ 15, 15, 15, 15, 15, 15, 15, 15, # 77
800+ 7, 7, 15, 15, 15, 15, 15, 15, # 77
801+ 15, 5, 6, 15, 15, 15, 15, 15, # 77
802+ 15, 15, 15, 15, 15, 15, 15, 15, # 77
803+ 15, 15, 15, 15, 15, 15, 15, 15, # 77
804+ 15, 15, 15, 15, 15, 15, 15, 15, # 78
805+ 15, 15, 15, 15, 15, 15, 15, 15, # 78
806+ 15, 15, 15, 15, 15, 15, 15, 15, # 78
807+ 15, 15, 15, 15, 15, 15, 15, 15, # 78
808+ 15, 15, 15, 15, 15, 15, 15, 15, # 78
809+ 15, 15, 15, 15, 15, 15, 15, 15, # 78
810+ 15, 15, 15, 15, 15, 15, 15, 15, # 78
811+ 15, 15, 15, 46, 46, 46, 46, 46, # 78
812+ 15, 15, 15, 15, 15, 15, 15, 15, # 79
813+ 15, 15, 15, 15, 15, 15, 15, 15, # 79
814+ 15, 15, 15, 15, 15, 15, 15, 15, # 79
815+ 15, 15, 15, 15, 15, 15, 15, 15, # 79
816+ 15, 15, 15, 15, 15, 46, 46, 46, # 79
817+ 46, 46, 46, 46, 46, 46, 46, 46, # 79
818+ 46, 46, 46, 46, 46, 46, 46, 46, # 79
819+ 46, 46, 46, 46, 46, 46, 46, 46, # 79
820+ 15, 15, 15, 15, 15, 15, 15, 15, # 80
821+ 15, 15, 15, 46, 46, 46, 46, 46, # 80
822+ 46, 46, 46, 46, 46, 46, 46, 46, # 80
823+ 46, 46, 46, 46, 46, 46, 46, 46, # 80
824+ 114, 114, 114, 114, 114, 114, 114, 114, # 80
825+ 114, 114, 114, 114, 114, 114, 114, 114, # 80
826+ 114, 114, 114, 114, 82, 82, 82, 82, # 80
827+ 82, 82, 82, 82, 82, 82, 82, 82, # 80
828+ 82, 82, 82, 82, 82, 82, 82, 82, # 81
829+ 115, 115, 115, 115, 115, 115, 115, 115, # 81
830+ 115, 115, 115, 115, 115, 115, 115, 115, # 81
831+ 115, 115, 115, 115, 15, 15, 15, 15, # 81
832+ 15, 15, 15, 15, 15, 15, 15, 15, # 81
833+ 15, 15, 15, 15, 15, 15, 15, 15, # 81
834+ 15, 15, 15, 15, 15, 15, 116, 116, # 81
835+ 116, 116, 116, 116, 116, 116, 116, 116, # 81
836+ 116, 116, 116, 116, 116, 116, 116, 116, # 82
837+ 116, 116, 116, 116, 116, 116, 116, 116, # 82
838+ 117, 117, 117, 117, 117, 117, 117, 117, # 82
839+ 117, 117, 117, 117, 117, 117, 117, 117, # 82
840+ 117, 117, 117, 117, 117, 117, 117, 117, # 82
841+ 117, 117, 118, 46, 46, 46, 46, 46, # 82
842+ 46, 46, 46, 46, 46, 46, 46, 46, # 82
843+ 46, 46, 46, 46, 46, 46, 46, 46, # 82
844+ 15, 15, 15, 15, 15, 15, 15, 15, # 83
845+ 15, 15, 15, 15, 15, 15, 15, 15, # 83
846+ 15, 15, 15, 15, 15, 15, 15, 15, # 83
847+ 15, 15, 15, 15, 15, 15, 15, 15, # 83
848+ 15, 15, 15, 15, 15, 15, 15, 15, # 83
849+ 15, 15, 15, 15, 15, 15, 15, 15, # 83
850+ 15, 15, 15, 15, 15, 15, 15, 15, # 83
851+ 15, 15, 15, 15, 15, 15, 15, 15, # 83
852+ 15, 15, 15, 15, 15, 15, 15, 15, # 84
853+ 15, 15, 15, 15, 15, 15, 15, 15, # 84
854+ 15, 15, 15, 15, 15, 15, 46, 46, # 84
855+ 46, 46, 46, 46, 46, 46, 46, 46, # 84
856+ 15, 15, 15, 15, 15, 15, 15, 15, # 84
857+ 15, 15, 15, 15, 15, 15, 15, 15, # 84
858+ 15, 15, 15, 15, 15, 15, 15, 15, # 84
859+ 15, 15, 15, 15, 15, 15, 15, 15, # 84
860+ 15, 15, 15, 15, 15, 15, 15, 15, # 85
861+ 15, 15, 15, 15, 15, 15, 15, 15, # 85
862+ 15, 15, 15, 15, 15, 15, 15, 15, # 85
863+ 15, 15, 15, 15, 15, 15, 15, 15, # 85
864+ 15, 15, 15, 15, 15, 15, 15, 15, # 85
865+ 15, 15, 15, 15, 15, 15, 15, 15, # 85
866+ 46, 46, 46, 46, 46, 46, 46, 46, # 85
867+ 46, 46, 46, 46, 46, 46, 46, 46, # 85
868+ 15, 15, 15, 15, 15, 15, 15, 15, # 86
869+ 15, 15, 15, 15, 15, 15, 15, 15, # 86
870+ 15, 15, 15, 15, 46, 46, 46, 46, # 86
871+ 46, 46, 15, 15, 15, 15, 15, 15, # 86
872+ 15, 15, 15, 15, 15, 15, 15, 15, # 86
873+ 15, 15, 15, 15, 15, 15, 15, 15, # 86
874+ 15, 15, 15, 15, 15, 15, 15, 15, # 86
875+ 15, 15, 15, 15, 15, 15, 15, 15, # 86
876+ 46, 15, 15, 15, 15, 46, 15, 15, # 87
877+ 15, 15, 46, 46, 15, 15, 15, 15, # 87
878+ 15, 15, 15, 15, 15, 15, 15, 15, # 87
879+ 15, 15, 15, 15, 15, 15, 15, 15, # 87
880+ 15, 15, 15, 15, 15, 15, 15, 15, # 87
881+ 46, 15, 15, 15, 15, 15, 15, 15, # 87
882+ 15, 15, 15, 15, 15, 15, 15, 15, # 87
883+ 15, 15, 15, 15, 15, 15, 15, 15, # 87
884+ 15, 15, 15, 15, 15, 15, 15, 15, # 88
885+ 15, 15, 15, 15, 46, 15, 46, 15, # 88
886+ 15, 15, 15, 46, 46, 46, 15, 46, # 88
887+ 15, 15, 15, 15, 15, 15, 15, 46, # 88
888+ 46, 15, 15, 15, 15, 15, 15, 15, # 88
889+ 46, 46, 46, 46, 46, 46, 46, 46, # 88
890+ 46, 46, 46, 46, 46, 46, 119, 119, # 88
891+ 119, 119, 119, 119, 119, 119, 119, 119, # 88
892+ 114, 114, 114, 114, 114, 114, 114, 114, # 89
893+ 114, 114, 83, 83, 83, 83, 83, 83, # 89
894+ 83, 83, 83, 83, 15, 46, 46, 46, # 89
895+ 15, 15, 15, 15, 15, 15, 15, 15, # 89
896+ 15, 15, 15, 15, 15, 15, 15, 15, # 89
897+ 15, 15, 15, 15, 15, 15, 15, 15, # 89
898+ 46, 15, 15, 15, 15, 15, 15, 15, # 89
899+ 15, 15, 15, 15, 15, 15, 15, 46, # 89
900+ 2, 3, 3, 3, 15, 59, 3, 120, # 90
901+ 5, 6, 5, 6, 5, 6, 5, 6, # 90
902+ 5, 6, 15, 15, 5, 6, 5, 6, # 90
903+ 5, 6, 5, 6, 8, 5, 6, 5, # 90
904+ 15, 121, 121, 121, 121, 121, 121, 121, # 90
905+ 121, 121, 60, 60, 60, 60, 60, 60, # 90
906+ 8, 59, 59, 59, 59, 59, 15, 15, # 90
907+ 46, 46, 46, 46, 46, 46, 46, 15, # 90
908+ 46, 40, 40, 40, 40, 40, 40, 40, # 91
909+ 40, 40, 40, 40, 40, 40, 40, 40, # 91
910+ 40, 40, 40, 40, 40, 40, 40, 40, # 91
911+ 40, 40, 40, 40, 40, 40, 40, 40, # 91
912+ 40, 40, 40, 40, 40, 40, 40, 40, # 91
913+ 40, 40, 40, 40, 40, 40, 40, 40, # 91
914+ 40, 40, 40, 40, 40, 40, 40, 40, # 91
915+ 40, 40, 40, 40, 40, 40, 40, 40, # 91
916+ 40, 40, 40, 40, 40, 40, 40, 40, # 92
917+ 40, 40, 40, 40, 40, 40, 40, 40, # 92
918+ 40, 40, 40, 40, 40, 46, 46, 46, # 92
919+ 46, 60, 60, 59, 59, 59, 59, 46, # 92
920+ 46, 40, 40, 40, 40, 40, 40, 40, # 92
921+ 40, 40, 40, 40, 40, 40, 40, 40, # 92
922+ 40, 40, 40, 40, 40, 40, 40, 40, # 92
923+ 40, 40, 40, 40, 40, 40, 40, 40, # 92
924+ 40, 40, 40, 40, 40, 40, 40, 40, # 93
925+ 40, 40, 40, 40, 40, 40, 40, 40, # 93
926+ 40, 40, 40, 40, 40, 40, 40, 40, # 93
927+ 40, 40, 40, 40, 40, 40, 40, 40, # 93
928+ 40, 40, 40, 40, 40, 40, 40, 40, # 93
929+ 40, 40, 40, 40, 40, 40, 40, 40, # 93
930+ 40, 40, 40, 40, 40, 40, 40, 40, # 93
931+ 40, 40, 40, 3, 59, 59, 59, 46, # 93
932+ 46, 46, 46, 46, 46, 40, 40, 40, # 94
933+ 40, 40, 40, 40, 40, 40, 40, 40, # 94
934+ 40, 40, 40, 40, 40, 40, 40, 40, # 94
935+ 40, 40, 40, 40, 40, 40, 40, 40, # 94
936+ 40, 40, 40, 40, 40, 40, 40, 40, # 94
937+ 40, 40, 40, 40, 40, 46, 46, 46, # 94
938+ 46, 40, 40, 40, 40, 40, 40, 40, # 94
939+ 40, 40, 40, 40, 40, 40, 40, 40, # 94
940+ 40, 40, 40, 40, 40, 40, 40, 40, # 95
941+ 40, 40, 40, 40, 40, 40, 40, 46, # 95
942+ 15, 15, 85, 85, 85, 85, 15, 15, # 95
943+ 15, 15, 15, 15, 15, 15, 15, 15, # 95
944+ 46, 46, 46, 46, 46, 46, 46, 46, # 95
945+ 46, 46, 46, 46, 46, 46, 46, 46, # 95
946+ 46, 46, 46, 46, 46, 46, 46, 46, # 95
947+ 46, 46, 46, 46, 46, 46, 46, 46, # 95
948+ 15, 15, 15, 15, 15, 15, 15, 15, # 96
949+ 15, 15, 15, 15, 15, 15, 15, 15, # 96
950+ 15, 15, 15, 15, 15, 15, 15, 15, # 96
951+ 15, 15, 15, 15, 15, 46, 46, 46, # 96
952+ 85, 85, 85, 85, 85, 85, 85, 85, # 96
953+ 85, 85, 15, 15, 15, 15, 15, 15, # 96
954+ 15, 15, 15, 15, 15, 15, 15, 15, # 96
955+ 15, 15, 15, 15, 15, 15, 15, 15, # 96
956+ 15, 15, 15, 15, 46, 46, 46, 46, # 97
957+ 46, 46, 46, 46, 46, 46, 46, 46, # 97
958+ 46, 46, 46, 46, 46, 46, 46, 46, # 97
959+ 46, 46, 46, 46, 46, 46, 46, 46, # 97
960+ 15, 15, 15, 15, 15, 15, 15, 15, # 97
961+ 15, 15, 15, 15, 15, 15, 15, 15, # 97
962+ 15, 15, 15, 15, 15, 15, 15, 15, # 97
963+ 15, 15, 15, 15, 46, 46, 46, 15, # 97
964+ 114, 114, 114, 114, 114, 114, 114, 114, # 98
965+ 114, 114, 15, 15, 15, 15, 15, 15, # 98
966+ 15, 15, 15, 15, 15, 15, 15, 15, # 98
967+ 15, 15, 15, 15, 15, 15, 15, 15, # 98
968+ 15, 15, 15, 15, 15, 15, 15, 15, # 98
969+ 15, 15, 15, 15, 15, 15, 15, 15, # 98
970+ 15, 46, 46, 46, 46, 46, 46, 46, # 98
971+ 46, 46, 46, 46, 46, 46, 46, 46, # 98
972+ 15, 15, 15, 15, 15, 15, 15, 15, # 99
973+ 15, 15, 15, 15, 46, 46, 46, 46, # 99
974+ 15, 15, 15, 15, 15, 15, 15, 15, # 99
975+ 15, 15, 15, 15, 15, 15, 15, 15, # 99
976+ 15, 15, 15, 15, 15, 15, 15, 15, # 99
977+ 15, 15, 15, 15, 15, 15, 15, 15, # 99
978+ 15, 15, 15, 15, 15, 15, 15, 15, # 99
979+ 15, 15, 15, 15, 15, 15, 15, 46, # 99
980+ 15, 15, 15, 15, 15, 15, 15, 15, # 100
981+ 15, 15, 15, 15, 15, 15, 15, 15, # 100
982+ 15, 15, 15, 15, 15, 15, 15, 15, # 100
983+ 15, 15, 15, 15, 15, 15, 15, 15, # 100
984+ 15, 15, 15, 15, 15, 15, 15, 15, # 100
985+ 15, 15, 15, 15, 15, 15, 15, 15, # 100
986+ 15, 15, 15, 15, 15, 15, 15, 46, # 100
987+ 46, 46, 46, 15, 15, 15, 15, 15, # 100
988+ 15, 15, 15, 15, 15, 15, 15, 15, # 101
989+ 15, 15, 15, 15, 15, 15, 15, 15, # 101
990+ 15, 15, 15, 15, 15, 15, 15, 15, # 101
991+ 15, 15, 15, 15, 15, 15, 46, 46, # 101
992+ 15, 15, 15, 15, 15, 15, 15, 15, # 101
993+ 15, 15, 15, 15, 15, 15, 15, 15, # 101
994+ 15, 15, 15, 15, 15, 15, 15, 15, # 101
995+ 15, 15, 15, 15, 15, 15, 15, 46, # 101
996+ 40, 40, 40, 40, 40, 40, 40, 40, # 102
997+ 40, 40, 40, 40, 40, 40, 40, 40, # 102
998+ 40, 40, 40, 40, 40, 40, 40, 40, # 102
999+ 40, 40, 40, 40, 40, 40, 40, 40, # 102
1000+ 40, 40, 40, 40, 40, 40, 46, 46, # 102
1001+ 46, 46, 46, 46, 46, 46, 46, 46, # 102
1002+ 46, 46, 46, 46, 46, 46, 46, 46, # 102
1003+ 46, 46, 46, 46, 46, 46, 46, 46, # 102
1004+ 40, 40, 40, 40, 40, 40, 40, 40, # 103
1005+ 40, 40, 40, 40, 40, 40, 40, 40, # 103
1006+ 40, 40, 40, 40, 40, 40, 40, 40, # 103
1007+ 40, 40, 40, 40, 40, 40, 40, 40, # 103
1008+ 40, 40, 40, 40, 46, 46, 46, 46, # 103
1009+ 46, 46, 46, 46, 46, 46, 46, 46, # 103
1010+ 46, 46, 46, 46, 46, 46, 46, 46, # 103
1011+ 46, 46, 46, 46, 46, 46, 46, 46, # 103
1012+ 122, 122, 122, 122, 122, 122, 122, 122, # 104
1013+ 122, 122, 122, 122, 122, 122, 122, 122, # 104
1014+ 122, 122, 122, 122, 122, 122, 122, 122, # 104
1015+ 122, 122, 122, 122, 122, 122, 122, 122, # 104
1016+ 122, 122, 122, 122, 122, 122, 122, 122, # 104
1017+ 122, 122, 122, 122, 122, 122, 122, 122, # 104
1018+ 122, 122, 122, 122, 122, 122, 122, 122, # 104
1019+ 122, 122, 122, 122, 122, 122, 122, 122, # 104
1020+ 123, 123, 123, 123, 123, 123, 123, 123, # 105
1021+ 123, 123, 123, 123, 123, 123, 123, 123, # 105
1022+ 123, 123, 123, 123, 123, 123, 123, 123, # 105
1023+ 123, 123, 123, 123, 123, 123, 123, 123, # 105
1024+ 123, 123, 123, 123, 123, 123, 123, 123, # 105
1025+ 123, 123, 123, 123, 123, 123, 123, 123, # 105
1026+ 123, 123, 123, 123, 123, 123, 123, 123, # 105
1027+ 123, 123, 123, 123, 123, 123, 123, 123, # 105
1028+ 40, 40, 40, 40, 40, 40, 40, 40, # 106
1029+ 40, 40, 40, 40, 40, 40, 40, 40, # 106
1030+ 40, 40, 40, 40, 40, 40, 40, 40, # 106
1031+ 40, 40, 40, 40, 40, 40, 40, 40, # 106
1032+ 40, 40, 40, 40, 40, 40, 40, 40, # 106
1033+ 40, 40, 40, 40, 40, 40, 46, 46, # 106
1034+ 46, 46, 46, 46, 46, 46, 46, 46, # 106
1035+ 46, 46, 46, 46, 46, 46, 46, 46, # 106
1036+ 16, 16, 16, 16, 16, 16, 16, 46, # 107
1037+ 46, 46, 46, 46, 46, 46, 46, 46, # 107
1038+ 46, 46, 46, 16, 16, 16, 16, 16, # 107
1039+ 46, 46, 46, 46, 46, 46, 60, 40, # 107
1040+ 40, 40, 40, 40, 40, 40, 40, 40, # 107
1041+ 40, 7, 40, 40, 40, 40, 40, 40, # 107
1042+ 40, 40, 40, 40, 40, 40, 40, 46, # 107
1043+ 40, 40, 40, 40, 40, 46, 40, 46, # 107
1044+ 40, 40, 46, 40, 40, 46, 40, 40, # 108
1045+ 40, 40, 40, 40, 40, 40, 40, 40, # 108
1046+ 40, 40, 40, 40, 40, 40, 40, 40, # 108
1047+ 40, 40, 40, 40, 40, 40, 40, 40, # 108
1048+ 40, 40, 40, 40, 40, 40, 40, 40, # 108
1049+ 40, 40, 40, 40, 40, 40, 40, 40, # 108
1050+ 40, 40, 40, 40, 40, 40, 40, 40, # 108
1051+ 40, 40, 40, 40, 40, 40, 40, 40, # 108
1052+ 40, 40, 40, 40, 40, 40, 40, 40, # 109
1053+ 40, 40, 40, 40, 40, 40, 40, 40, # 109
1054+ 40, 40, 40, 40, 40, 40, 40, 40, # 109
1055+ 40, 40, 40, 40, 40, 40, 40, 40, # 109
1056+ 40, 40, 40, 40, 40, 40, 40, 40, # 109
1057+ 40, 40, 40, 40, 40, 40, 40, 40, # 109
1058+ 40, 40, 46, 46, 46, 46, 46, 46, # 109
1059+ 46, 46, 46, 46, 46, 46, 46, 46, # 109
1060+ 46, 46, 46, 46, 46, 46, 46, 46, # 110
1061+ 46, 46, 46, 46, 46, 46, 46, 46, # 110
1062+ 46, 46, 46, 40, 40, 40, 40, 40, # 110
1063+ 40, 40, 40, 40, 40, 40, 40, 40, # 110
1064+ 40, 40, 40, 40, 40, 40, 40, 40, # 110
1065+ 40, 40, 40, 40, 40, 40, 40, 40, # 110
1066+ 40, 40, 40, 40, 40, 40, 40, 40, # 110
1067+ 40, 40, 40, 40, 40, 40, 40, 40, # 110
1068+ 40, 40, 40, 40, 40, 40, 40, 40, # 111
1069+ 40, 40, 40, 40, 40, 40, 40, 40, # 111
1070+ 40, 40, 40, 40, 40, 40, 40, 40, # 111
1071+ 40, 40, 40, 40, 40, 40, 40, 40, # 111
1072+ 40, 40, 40, 40, 40, 40, 40, 40, # 111
1073+ 40, 40, 40, 40, 40, 40, 40, 40, # 111
1074+ 40, 40, 40, 40, 40, 40, 40, 40, # 111
1075+ 40, 40, 40, 40, 40, 40, 5, 6, # 111
1076+ 46, 46, 46, 46, 46, 46, 46, 46, # 112
1077+ 46, 46, 46, 46, 46, 46, 46, 46, # 112
1078+ 40, 40, 40, 40, 40, 40, 40, 40, # 112
1079+ 40, 40, 40, 40, 40, 40, 40, 40, # 112
1080+ 40, 40, 40, 40, 40, 40, 40, 40, # 112
1081+ 40, 40, 40, 40, 40, 40, 40, 40, # 112
1082+ 40, 40, 40, 40, 40, 40, 40, 40, # 112
1083+ 40, 40, 40, 40, 40, 40, 40, 40, # 112
1084+ 40, 40, 40, 40, 40, 40, 40, 40, # 113
1085+ 40, 40, 40, 40, 40, 40, 40, 40, # 113
1086+ 46, 46, 40, 40, 40, 40, 40, 40, # 113
1087+ 40, 40, 40, 40, 40, 40, 40, 40, # 113
1088+ 40, 40, 40, 40, 40, 40, 40, 40, # 113
1089+ 40, 40, 40, 40, 40, 40, 40, 40, # 113
1090+ 40, 40, 40, 40, 40, 40, 40, 40, # 113
1091+ 40, 40, 40, 40, 40, 40, 40, 40, # 113
1092+ 40, 40, 40, 40, 40, 40, 40, 40, # 114
1093+ 46, 46, 46, 46, 46, 46, 46, 46, # 114
1094+ 46, 46, 46, 46, 46, 46, 46, 46, # 114
1095+ 46, 46, 46, 46, 46, 46, 46, 46, # 114
1096+ 46, 46, 46, 46, 46, 46, 46, 46, # 114
1097+ 46, 46, 46, 46, 46, 46, 46, 46, # 114
1098+ 40, 40, 40, 40, 40, 40, 40, 40, # 114
1099+ 40, 40, 40, 40, 46, 46, 46, 46, # 114
1100+ 46, 46, 46, 46, 46, 46, 46, 46, # 115
1101+ 46, 46, 46, 46, 46, 46, 46, 46, # 115
1102+ 46, 46, 46, 46, 46, 46, 46, 46, # 115
1103+ 46, 46, 46, 46, 46, 46, 46, 46, # 115
1104+ 60, 60, 60, 60, 46, 46, 46, 46, # 115
1105+ 46, 46, 46, 46, 46, 46, 46, 46, # 115
1106+ 3, 8, 8, 12, 12, 5, 6, 5, # 115
1107+ 6, 5, 6, 5, 6, 5, 6, 5, # 115
1108+ 6, 5, 6, 5, 6, 46, 46, 46, # 116
1109+ 46, 3, 3, 3, 3, 12, 12, 12, # 116
1110+ 3, 3, 3, 46, 3, 3, 3, 3, # 116
1111+ 8, 5, 6, 5, 6, 5, 6, 3, # 116
1112+ 3, 3, 7, 8, 7, 7, 7, 46, # 116
1113+ 3, 4, 3, 3, 46, 46, 46, 46, # 116
1114+ 40, 40, 40, 46, 40, 46, 40, 40, # 116
1115+ 40, 40, 40, 40, 40, 40, 40, 40, # 116
1116+ 40, 40, 40, 40, 40, 40, 40, 40, # 117
1117+ 40, 40, 40, 40, 40, 40, 40, 40, # 117
1118+ 40, 40, 40, 40, 40, 40, 40, 40, # 117
1119+ 40, 40, 40, 40, 40, 40, 40, 40, # 117
1120+ 40, 40, 40, 40, 40, 40, 40, 40, # 117
1121+ 40, 40, 40, 40, 40, 40, 40, 40, # 117
1122+ 40, 40, 40, 40, 40, 40, 40, 40, # 117
1123+ 40, 40, 40, 40, 40, 46, 46, 104, # 117
1124+ 46, 3, 3, 3, 4, 3, 3, 3, # 118
1125+ 5, 6, 3, 7, 3, 8, 3, 3, # 118
1126+ 9, 9, 9, 9, 9, 9, 9, 9, # 118
1127+ 9, 9, 3, 3, 7, 7, 7, 3, # 118
1128+ 3, 10, 10, 10, 10, 10, 10, 10, # 118
1129+ 10, 10, 10, 10, 10, 10, 10, 10, # 118
1130+ 10, 10, 10, 10, 10, 10, 10, 10, # 118
1131+ 10, 10, 10, 5, 3, 6, 11, 12, # 118
1132+ 11, 13, 13, 13, 13, 13, 13, 13, # 119
1133+ 13, 13, 13, 13, 13, 13, 13, 13, # 119
1134+ 13, 13, 13, 13, 13, 13, 13, 13, # 119
1135+ 13, 13, 13, 5, 7, 6, 7, 46, # 119
1136+ 46, 3, 5, 6, 3, 3, 40, 40, # 119
1137+ 40, 40, 40, 40, 40, 40, 40, 40, # 119
1138+ 59, 40, 40, 40, 40, 40, 40, 40, # 119
1139+ 40, 40, 40, 40, 40, 40, 40, 40, # 119
1140+ 40, 40, 40, 40, 40, 40, 40, 40, # 120
1141+ 40, 40, 40, 40, 40, 40, 40, 40, # 120
1142+ 40, 40, 40, 40, 40, 40, 40, 40, # 120
1143+ 40, 40, 40, 40, 40, 40, 59, 59, # 120
1144+ 40, 40, 40, 40, 40, 40, 40, 40, # 120
1145+ 40, 40, 40, 40, 40, 40, 40, 40, # 120
1146+ 40, 40, 40, 40, 40, 40, 40, 40, # 120
1147+ 40, 40, 40, 40, 40, 40, 40, 46, # 120
1148+ 46, 46, 40, 40, 40, 40, 40, 40, # 121
1149+ 46, 46, 40, 40, 40, 40, 40, 40, # 121
1150+ 46, 46, 40, 40, 40, 40, 40, 40, # 121
1151+ 46, 46, 40, 40, 40, 46, 46, 46, # 121
1152+ 4, 4, 7, 11, 15, 4, 4, 46, # 121
1153+ 7, 7, 7, 7, 7, 15, 15, 46, # 121
1154+ 46, 46, 46, 46, 46, 46, 46, 46, # 121
1155+ 46, 46, 46, 46, 46, 15, 46, 46 # 121
1156+ };
1157+
1158+# The A table has 124 entries for a total of 496 bytes.
1159+
1160+A = array[] of {
1161+ 16r0001000F, # 0 Cc, ignorable
1162+ 16r0004000F, # 1 Cc, whitespace
1163+ 16r0004000C, # 2 Zs, whitespace
1164+ 16r00000018, # 3 Po
1165+ 16r0006001A, # 4 Sc, currency
1166+ 16r00000015, # 5 Ps
1167+ 16r00000016, # 6 Pe
1168+ 16r00000019, # 7 Sm
1169+ 16r00000014, # 8 Pd
1170+ 16r00036009, # 9 Nd, identifier part, decimal 16
1171+ 16r0827FE01, # 10 Lu, hasLower (add 32), identifier start, supradecimal 31
1172+ 16r0000001B, # 11 Sk
1173+ 16r00050017, # 12 Pc, underscore
1174+ 16r0817FE02, # 13 Ll, hasUpper (subtract 32), identifier start, supradecimal 31
1175+ 16r0000000C, # 14 Zs
1176+ 16r0000001C, # 15 So
1177+ 16r00070002, # 16 Ll, identifier start
1178+ 16r0000600B, # 17 No, decimal 16
1179+ 16r0000500B, # 18 No, decimal 8
1180+ 16r0000800B, # 19 No, strange
1181+ 16r08270001, # 20 Lu, hasLower (add 32), identifier start
1182+ 16r08170002, # 21 Ll, hasUpper (subtract 32), identifier start
1183+ int 16rE1D70002, # 22 Ll, hasUpper (subtract -121), identifier start
1184+ 16r00670001, # 23 Lu, hasLower (add 1), identifier start
1185+ 16r00570002, # 24 Ll, hasUpper (subtract 1), identifier start
1186+ int 16rCE670001, # 25 Lu, hasLower (add -199), identifier start
1187+ 16r3A170002, # 26 Ll, hasUpper (subtract 232), identifier start
1188+ int 16rE1E70001, # 27 Lu, hasLower (add -121), identifier start
1189+ 16r4B170002, # 28 Ll, hasUpper (subtract 300), identifier start
1190+ 16r34A70001, # 29 Lu, hasLower (add 210), identifier start
1191+ 16r33A70001, # 30 Lu, hasLower (add 206), identifier start
1192+ 16r33670001, # 31 Lu, hasLower (add 205), identifier start
1193+ 16r32A70001, # 32 Lu, hasLower (add 202), identifier start
1194+ 16r32E70001, # 33 Lu, hasLower (add 203), identifier start
1195+ 16r33E70001, # 34 Lu, hasLower (add 207), identifier start
1196+ 16r34E70001, # 35 Lu, hasLower (add 211), identifier start
1197+ 16r34670001, # 36 Lu, hasLower (add 209), identifier start
1198+ 16r35670001, # 37 Lu, hasLower (add 213), identifier start
1199+ 16r00070001, # 38 Lu, identifier start
1200+ 16r36A70001, # 39 Lu, hasLower (add 218), identifier start
1201+ 16r00070005, # 40 Lo, identifier start
1202+ 16r36670001, # 41 Lu, hasLower (add 217), identifier start
1203+ 16r36E70001, # 42 Lu, hasLower (add 219), identifier start
1204+ 16r00AF0001, # 43 Lu, hasLower (add 2), hasTitle, identifier start
1205+ 16r007F0003, # 44 Lt, hasUpper (subtract 1), hasLower (add 1), hasTitle, identifier start
1206+ 16r009F0002, # 45 Ll, hasUpper (subtract 2), hasTitle, identifier start
1207+ 16r00000000, # 46 unassigned
1208+ 16r34970002, # 47 Ll, hasUpper (subtract 210), identifier start
1209+ 16r33970002, # 48 Ll, hasUpper (subtract 206), identifier start
1210+ 16r33570002, # 49 Ll, hasUpper (subtract 205), identifier start
1211+ 16r32970002, # 50 Ll, hasUpper (subtract 202), identifier start
1212+ 16r32D70002, # 51 Ll, hasUpper (subtract 203), identifier start
1213+ 16r33D70002, # 52 Ll, hasUpper (subtract 207), identifier start
1214+ 16r34570002, # 53 Ll, hasUpper (subtract 209), identifier start
1215+ 16r34D70002, # 54 Ll, hasUpper (subtract 211), identifier start
1216+ 16r35570002, # 55 Ll, hasUpper (subtract 213), identifier start
1217+ 16r36970002, # 56 Ll, hasUpper (subtract 218), identifier start
1218+ 16r36570002, # 57 Ll, hasUpper (subtract 217), identifier start
1219+ 16r36D70002, # 58 Ll, hasUpper (subtract 219), identifier start
1220+ 16r00070004, # 59 Lm, identifier start
1221+ 16r00030006, # 60 Mn, identifier part
1222+ 16r09A70001, # 61 Lu, hasLower (add 38), identifier start
1223+ 16r09670001, # 62 Lu, hasLower (add 37), identifier start
1224+ 16r10270001, # 63 Lu, hasLower (add 64), identifier start
1225+ 16r0FE70001, # 64 Lu, hasLower (add 63), identifier start
1226+ 16r09970002, # 65 Ll, hasUpper (subtract 38), identifier start
1227+ 16r09570002, # 66 Ll, hasUpper (subtract 37), identifier start
1228+ 16r10170002, # 67 Ll, hasUpper (subtract 64), identifier start
1229+ 16r0FD70002, # 68 Ll, hasUpper (subtract 63), identifier start
1230+ 16r0F970002, # 69 Ll, hasUpper (subtract 62), identifier start
1231+ 16r0E570002, # 70 Ll, hasUpper (subtract 57), identifier start
1232+ 16r0BD70002, # 71 Ll, hasUpper (subtract 47), identifier start
1233+ 16r0D970002, # 72 Ll, hasUpper (subtract 54), identifier start
1234+ 16r15970002, # 73 Ll, hasUpper (subtract 86), identifier start
1235+ 16r14170002, # 74 Ll, hasUpper (subtract 80), identifier start
1236+ 16r14270001, # 75 Lu, hasLower (add 80), identifier start
1237+ 16r0C270001, # 76 Lu, hasLower (add 48), identifier start
1238+ 16r0C170002, # 77 Ll, hasUpper (subtract 48), identifier start
1239+ 16r00034009, # 78 Nd, identifier part, decimal 0
1240+ 16r00000007, # 79 Me
1241+ 16r00030008, # 80 Mc, identifier part
1242+ 16r00037409, # 81 Nd, identifier part, decimal 26
1243+ 16r00005A0B, # 82 No, decimal 13
1244+ 16r00006E0B, # 83 No, decimal 23
1245+ 16r0000740B, # 84 No, decimal 26
1246+ 16r0000000B, # 85 No
1247+ int 16rFE170002, # 86 Ll, hasUpper (subtract -8), identifier start
1248+ int 16rFE270001, # 87 Lu, hasLower (add -8), identifier start
1249+ int 16rED970002, # 88 Ll, hasUpper (subtract -74), identifier start
1250+ int 16rEA970002, # 89 Ll, hasUpper (subtract -86), identifier start
1251+ int 16rE7170002, # 90 Ll, hasUpper (subtract -100), identifier start
1252+ int 16rE0170002, # 91 Ll, hasUpper (subtract -128), identifier start
1253+ int 16rE4170002, # 92 Ll, hasUpper (subtract -112), identifier start
1254+ int 16rE0970002, # 93 Ll, hasUpper (subtract -126), identifier start
1255+ int 16rFDD70002, # 94 Ll, hasUpper (subtract -9), identifier start
1256+ int 16rEDA70001, # 95 Lu, hasLower (add -74), identifier start
1257+ int 16rFDE70001, # 96 Lu, hasLower (add -9), identifier start
1258+ int 16rEAA70001, # 97 Lu, hasLower (add -86), identifier start
1259+ int 16rE7270001, # 98 Lu, hasLower (add -100), identifier start
1260+ int 16rFE570002, # 99 Ll, hasUpper (subtract -7), identifier start
1261+ int 16rE4270001, # 100 Lu, hasLower (add -112), identifier start
1262+ int 16rFE670001, # 101 Lu, hasLower (add -7), identifier start
1263+ int 16rE0270001, # 102 Lu, hasLower (add -128), identifier start
1264+ int 16rE0A70001, # 103 Lu, hasLower (add -126), identifier start
1265+ 16r00010010, # 104 Cf, ignorable
1266+ 16r0004000D, # 105 Zl, whitespace
1267+ 16r0004000E, # 106 Zp, whitespace
1268+ 16r0000400B, # 107 No, decimal 0
1269+ 16r0000440B, # 108 No, decimal 2
1270+ 16r0427420A, # 109 Nl, hasLower (add 16), identifier start, decimal 1
1271+ 16r0427800A, # 110 Nl, hasLower (add 16), identifier start, strange
1272+ 16r0417620A, # 111 Nl, hasUpper (subtract 16), identifier start, decimal 17
1273+ 16r0417800A, # 112 Nl, hasUpper (subtract 16), identifier start, strange
1274+ 16r0007800A, # 113 Nl, identifier start, strange
1275+ 16r0000420B, # 114 No, decimal 1
1276+ 16r0000720B, # 115 No, decimal 25
1277+ 16r06A0001C, # 116 So, hasLower (add 26)
1278+ 16r0690001C, # 117 So, hasUpper (subtract 26)
1279+ 16r00006C0B, # 118 No, decimal 22
1280+ 16r0000560B, # 119 No, decimal 11
1281+ 16r0007720A, # 120 Nl, identifier start, decimal 25
1282+ 16r0007400A, # 121 Nl, identifier start, decimal 0
1283+ 16r00000013, # 122 Cs
1284+ 16r00000012 # 123 Co
1285+ };
java/pkg2/java/lang/unicode_table.m+8−0
@@ -0,0 +1,8 @@
1+UnicodeTable : module
2+{
3+ PATH : con "/dis/java/java/lang/unicode_table.dis";
4+
5+ A : array of int;
6+ X : array of int;
7+ Y : array of int;
8+};
java/pkg2/java/mkfile+13−0
@@ -0,0 +1,13 @@
1+<../../../mkconfig
2+
3+DIRS=\
4+# applet\
5+# awt\
6+# beans\
7+# io\
8+ lang\
9+# net\
10+# security\
11+# util\
12+
13+<$ROOT/mkfiles/mksubdirs
java/pkg2/java/net/BindException.java+0−0

Empty file added.

java/pkg2/java/net/ConnectException.java+0−0

Empty file added.

java/pkg2/java/net/ContentHandler.java+0−0

Empty file added.

java/pkg2/java/net/ContentHandlerFactory.java+0−0

Empty file added.

java/pkg2/java/net/DatagramPacket.java+0−0

Empty file added.

java/pkg2/java/net/DatagramPacket_L.m+16−0
@@ -0,0 +1,16 @@
1+# javal v1.5 generated file: edit with care
2+
3+DatagramPacket_L : module
4+{
5+ DatagramPacket_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ buf : JArrayB;
9+ length : int;
10+ address : JObject;
11+ port : int;
12+ };
13+
14+ init : fn( jni_p : JNI );
15+
16+};
java/pkg2/java/net/DatagramSocket.java+0−0

Empty file added.

java/pkg2/java/net/DatagramSocketImpl.java+0−0

Empty file added.

java/pkg2/java/net/DatagramSocketImpl_L.m+14−0
@@ -0,0 +1,14 @@
1+# generated file edit with care
2+
3+DatagramSocketImpl_L : module
4+{
5+ DatagramSocketImpl_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ localPort : int;
9+ fd : ref FileDescriptor_obj;
10+ };
11+
12+ init : fn( jni_p : JNI );
13+
14+};
java/pkg2/java/net/FileNameMap.java+0−0

Empty file added.

java/pkg2/java/net/HttpURLConnection.java+0−0

Empty file added.

java/pkg2/java/net/InetAddress.java+0−0

Empty file added.

java/pkg2/java/net/InetAddressImpl_L.b+218−0
@@ -0,0 +1,218 @@
1+implement InetAddressImpl_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+#<<
27+
28+include "InetAddressImpl_L.m";
29+
30+#>> extra post includes here
31+
32+include "InetAddress_L.m";
33+ inet: InetAddress_L; # declare pointer to module name
34+
35+include "srv.m";
36+ srv: Srv;
37+
38+sys: Sys;
39+
40+include "jnet.m";
41+ jnet: JNET;
42+
43+DEBUG, AF_INET: import jnet;
44+FD: import sys;
45+InetAddress_obj: import inet; # import adt object for p0 ref
46+Value: import jni;
47+
48+#<<
49+
50+init( jni_p : JNI )
51+{
52+ # save java native inteface mod instance
53+ jni = jni_p;
54+ #>>extra initialization here
55+
56+ sys = jni->sys;
57+ if((srv = load Srv Srv->BUILTINPATH) == nil
58+ && (srv = load Srv Srv->PATH) == nil)
59+ jni->InitError( jni->sys->sprint( "java.net.InetAddressImpl: could not load Srv: %r" ) );
60+
61+ #<<
62+}
63+
64+getLocalHostName_rString( this : ref InetAddressImpl_obj) : JString
65+{#>>
66+
67+ fd: ref FD;
68+ buf:= array[256] of byte;
69+
70+ if (DEBUG)
71+ sys->print("Entering getLocalHostName\n");
72+
73+ fd = sys->open("/dev/sysname", sys->OREAD);
74+
75+ if (fd != nil )
76+ n := sys->read(fd, buf, 256);
77+ else
78+ return jni->NewString("localhost");
79+
80+ if (n <= 0) {
81+ return jni->NewString("localhost");
82+ if (DEBUG)
83+ sys->print(" Bad return from /dev/sysname\n");
84+ }
85+ if (DEBUG)
86+ sys->print(" Name from dev/sysname: %s\n", string buf[0:n]);
87+ return jni->NewString(string buf[0:n]);
88+
89+}
90+#<<
91+
92+makeAnyLocalAddress_rInetAddress_V( this : ref InetAddressImpl_obj, p0 : JObject)
93+{#>>
94+
95+ # p0 must be changed to a type InetAddress_obj in arg list
96+ # Must include InetAddress_L.m also in this file.
97+
98+ if (DEBUG)
99+ sys->print("Entering makeAnyLocalAddress\n");
100+
101+
102+ #p0.address = jnet->INADDR_ANY;
103+
104+ val := ref Value.TInt( jnet->INADDR_ANY );
105+ n := jni->SetObjField( p0, "address", val );
106+ if (DEBUG )
107+ sys->print("makeAnyLocalAddr: Return from SetObjField %d\n",n);
108+
109+ #p0.family = jnet->AF_INET;
110+ val = ref Value.TInt( jnet->AF_INET );
111+ n = jni->SetObjField( p0, "family", val );
112+ if (DEBUG )
113+ sys->print("makeAnyLocalAddr: Return from SetObjField %d\n",n);
114+}#<<
115+
116+lookupAllHostAddr_rString_aaB( this : ref InetAddressImpl_obj, p0 : JString) : JArray
117+{#>>
118+
119+ if (DEBUG)
120+ sys->print("Entering lookupAllHostAddr\n");
121+
122+ iplist,AddrList: list of string;
123+ hostname,str,temp: string;
124+ j: int;
125+
126+ hostname = p0.str;
127+ if (DEBUG)
128+ sys->print("hostname is %s \n", p0.str);
129+ AddrList = srv->iph2a(hostname);
130+ if (DEBUG)
131+ sys->print("InetAddressImpl:Got AddrList\n");
132+
133+
134+ b:= array[len AddrList] of { array[jnet->IPADDRLEN] of byte };
135+
136+ if (AddrList != nil) {
137+ for(i:=0;i<len AddrList;i++) {
138+ str = hd AddrList;
139+ if (DEBUG)
140+ sys->print(" Addrlist hd = %s\n", str);
141+ AddrList = tl AddrList;
142+
143+ # insure net byte ordered byte[][]
144+ ( j, iplist ) = sys->tokenize( str, ".");
145+ for (k:=0; k<j; k++) {
146+ temp = hd iplist;
147+ if (DEBUG)
148+ sys->print("iplist hd = %s\n", temp);
149+ iplist = tl iplist;
150+ if (DEBUG)
151+ sys->print("b[%d][%d]\n", i,k);
152+ b[i][k] = byte temp;
153+ if (DEBUG)
154+ sys->print("InetAddressGetHostByName: tokenize b[%d][%d] = %d\n", i, k, int b[i][k]);
155+ }
156+ }
157+ return jni->MkAAByte( b );
158+ } else {
159+ jni->ThrowException( "java.net.UnknownHostException", "Host unknown" );
160+ return nil;
161+ }
162+
163+}#<<
164+
165+getHostByAddr_I_rString( this : ref InetAddressImpl_obj, p0 : int) : JString
166+{#>>
167+
168+ address: string;
169+
170+ # p0 is the address
171+ # IPV4 only....
172+
173+
174+ if (DEBUG)
175+ sys->print("Entering getHostByAddr\n");
176+
177+ if( !p0 )
178+ jni->ThrowException( "java.net.UnknownHostException",
179+ "Gethostbyaddr Bad Address" );
180+
181+ if (DEBUG)
182+ sys->print("GetHostByAddr: p0 = %d\n", p0);
183+
184+ b:= array[jnet->IPADDRLEN] of byte;
185+
186+ b[0] = byte ( p0 >> 24 );
187+ b[1] = byte ( p0 >> 16 );
188+ b[2] = byte ( p0 >> 8 );
189+ b[3] = byte p0;
190+
191+ address = string b[0] + "." + string b[1] + "." + string b[2] + "." +
192+ string b[3];
193+
194+ HostList := srv->ipa2h(address);
195+
196+ if ( len HostList == 0 ) {
197+ if (DEBUG)
198+ sys->print("GetHostByAddr: ipa2h returned nil on %s\n",
199+ address);
200+ jni->ThrowException( "java.net.UnknownHostException",
201+ "Gethostbyaddr Bad Address" );
202+ return nil;
203+ }
204+
205+ return jni->NewString( string hd HostList );
206+
207+}#<<
208+
209+getInetFamily_I( this : ref InetAddressImpl_obj) : int
210+{#>>
211+
212+ if (DEBUG)
213+ sys->print("Entering getInetFamily\n");
214+ #This is a nasty piece of work here...
215+ return AF_INET;
216+
217+}#<<
218+
java/pkg2/java/net/InetAddressImpl_L.m+17−0
@@ -0,0 +1,17 @@
1+# javal v1.5 generated file: edit with care
2+
3+InetAddressImpl_L : module
4+{
5+ InetAddressImpl_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ };
9+
10+ init : fn( jni_p : JNI );
11+ getLocalHostName_rString : fn( this : ref InetAddressImpl_obj) : JString;
12+ makeAnyLocalAddress_rInetAddress_V : fn( this : ref InetAddressImpl_obj, p0 : JObject);
13+ lookupAllHostAddr_rString_aaB : fn( this : ref InetAddressImpl_obj, p0 : JString) : JArray;
14+ getHostByAddr_I_rString : fn( this : ref InetAddressImpl_obj, p0 : int) : JString;
15+ getInetFamily_I : fn( this : ref InetAddressImpl_obj) : int;
16+
17+};
java/pkg2/java/net/InetAddress_L.m+12−0
@@ -0,0 +1,12 @@
1+# generated file edit with care
2+
3+InetAddress_L : module
4+{
5+ InetAddress_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ hostName : JString;
9+ address : int;
10+ family : int;
11+ };
12+};
java/pkg2/java/net/MalformedURLException.java+0−0

Empty file added.

java/pkg2/java/net/MulticastSocket.java+0−0

Empty file added.

java/pkg2/java/net/NoRouteToHostException.java+0−0

Empty file added.

java/pkg2/java/net/PlainDatagramSocketImpl..a+0−0

Empty file added.

java/pkg2/java/net/PlainDatagramSocketImpl_L.b+695−0
@@ -0,0 +1,695 @@
1+implement PlainDatagramSocketImpl_L;
2+
3+# javal v1.5 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+#<<
27+
28+include "PlainDatagramSocketImpl_L.m";
29+
30+#>> extra post includes here
31+
32+include "jnet.m";
33+ jnet: JNET;
34+
35+include "java/io/FileDescriptor_L.m";
36+ fildes: FileDescriptor_L;
37+
38+include "InetAddress_L.m";
39+ inet: InetAddress_L;
40+
41+InetAddress_obj: import inet; #make sure p0 ref works properly
42+
43+include "DatagramPacket_L.m";
44+ pkt: DatagramPacket_L;
45+
46+include "srv.m";
47+ srv: Srv;
48+
49+sys: Sys;
50+
51+strp: String;
52+
53+c: Cast;
54+
55+
56+DEBUG, AF_INET: import jnet;
57+FD: import sys;
58+DatagramPacket_obj: import pkt; #make sure p0 ref works properly
59+FileDescriptor_obj: import fildes;
60+Value: import jni;
61+
62+
63+
64+#<<
65+
66+init( jni_p : JNI )
67+{
68+ # save java native inteface mod instance
69+ jni = jni_p;
70+ #>>extra initialization here
71+
72+ sys = jni->sys;
73+ strp = jni->str;
74+ c = jni->CastMod();
75+ if((srv = load Srv Srv->BUILTINPATH) == nil
76+ && (srv = load Srv Srv->PATH) == nil)
77+ jni->InitError( jni->sys->sprint( "java.net.PlainDatagramSocketImpl: could not load Srv: %r" ) );
78+
79+ #<<
80+}
81+
82+bind_I_rInetAddress_V( this : ref PlainDatagramSocketImpl_obj, p0 : int,p1 : JObject)
83+{#>>
84+
85+ fd: ref FD;
86+ buf:= array[50] of byte;
87+ byteary:= array[6] of byte;
88+ i,n: int;
89+ str: string;
90+ arg: list of string;
91+
92+ # Create the localaddress/localport assoc to a socket......
93+
94+ # p1 is a ref to InetAddress_obj
95+ # p0 is the localport
96+
97+ if (DEBUG)
98+ sys->print("PlainDgramBind: Entering....\n");
99+
100+ if( this.cfd == nil ) {
101+ if (DEBUG)
102+ sys->print("Attempt to Bind using cfd = nil\n");
103+ jni->ThrowException("java.net.SocketException",
104+ "Socket closed");
105+ }
106+
107+ # Check for address presence...
108+ if (p1 == nil) {
109+ if( DEBUG )
110+ sys->print("PlainDgramSocketImplBind: No address given\n");
111+ jni->ThrowException("java.lang.NullPointerException", "null Address" );
112+ }
113+
114+ # assume IPv4...
115+
116+ v := jni->GetObjField( p1, "address", "I");
117+
118+ if (DEBUG && v == nil)
119+ sys->print("DGrambind: GetObjField returned nil\n");
120+ if (DEBUG)
121+ sys->print("DGrambind: GetObjField done\n");
122+ vl := v.Int();
123+
124+ b := array[jnet->IPADDRLEN] of byte;
125+ b[0] = byte (vl >> 24 );
126+ b[1] = byte (vl >> 16 );
127+ b[2] = byte (vl >> 8 );
128+ b[3] = byte vl;
129+
130+ if (p0)
131+ str = "announce " + string b[0] + "." + string b[1] + "." +
132+ string b[2] + "." + string b[3] + "!" +
133+ string p0;
134+ else
135+ str = "announce " + string b[0] + "." + string b[1] +
136+ + "." + string b[2] + "." + string b[3] ;
137+
138+
139+ n = sys->write( this.cfd.fd, array of byte str, len str );
140+
141+ if( n <= 0 ) {
142+ if (DEBUG)
143+ sys->print( "Datagram %s to ctl file failed\n", str);
144+ jni->ThrowException( "java.net.SocketException",
145+ "Bind error");
146+ }
147+
148+ str = "/net/" + "udp/" + string this.connection + "/local";
149+ if (DEBUG)
150+ sys->print( "PlainDatagramSocketBind: opening file %s to get local port\n", str);
151+ fd = sys->open( str, sys->OREAD );
152+ if ( fd == nil ) {
153+ if (DEBUG)
154+ sys->print( "PlainDatagramSocketBind: Open of local file returned nil fd\n");
155+ jni->ThrowException( "java.net.SocketException",
156+ "Bind local file open error");
157+ }
158+ n = sys->read( fd, buf, len buf);
159+
160+
161+ if ( n <= 0 ) {
162+ if (DEBUG)
163+ sys->print( "PlainDatagramSocketBind: Read of local file returned %d\n", n);
164+ jni->ThrowException( "java.net.SocketException",
165+ "Bind local file read error");
166+ }
167+
168+ ( i, arg) = sys->tokenize(string buf[0:n], "!");
169+ arg = tl arg;
170+
171+ if (DEBUG)
172+ sys->print( "PlainDatagramSocketBind: Returning port # %d\n", int hd arg);
173+ this.localPort = int hd arg;
174+
175+ if (DEBUG)
176+ sys->print("PlainDgramBind: Leaving....\n");
177+
178+}#<<
179+
180+send_rDatagramPacket_V( this : ref PlainDatagramSocketImpl_obj, p0 : JObject)
181+{#>>
182+ #p0 - Datagram Packet obj ref
183+
184+ b:= array[jnet->IPADDRLEN] of byte;
185+ str: string;
186+
187+ if (DEBUG)
188+ sys->print("PlainDgramsend: Entering....\n");
189+
190+ if (this.cfd == nil ) {
191+ if (DEBUG)
192+ sys->print( "PlainDatagramSocketSend: ref FileDescriptor_obj for cfd is nil\n");
193+ jni->ThrowException( "java.net.SocketException",
194+ "Socket closed");
195+ }
196+
197+ if ( p0 == nil ) {
198+ if (DEBUG)
199+ sys->print( "PlainDatagramSocketSend: ref DatagramPacket_obj is nil\n");
200+ jni->ThrowException( "java.lang.NullPointerException",
201+ "Null DatagramPacket arg");
202+ }
203+
204+ #Check buf field...
205+ Pb := jni->GetObjField( p0, "buf", "[B");
206+ if ( Pb == nil ) {
207+ if (DEBUG)
208+ sys->print( "PlainDatagramSocketSend: ref DatagramPacket_obj buf is nil\n");
209+ jni->ThrowException( "java.lang.NullPointerException",
210+ "Null DatagramPacket_obj buffer ref");
211+ }
212+ if (DEBUG)
213+ sys->print("Dgramsend: GetObjField returned %x\n", Pb);
214+
215+ Pbvl := Pb.Object();
216+ if (DEBUG)
217+ sys->print("Dgramsend: GetObjField returned %x\n", Pbvl);
218+
219+
220+ #Check address field....
221+ if (DEBUG)
222+ sys->print("DGramsend: Doing GetObjField Packet.address\n");
223+ I := jni->GetObjField( p0, "address", "Ljava.net.InetAddress;");
224+ if ( I == nil ) {
225+ if (DEBUG)
226+ sys->print( "PlainDatagramSocketSend: ref DatagramPacket_obj address is nil\n");
227+ jni->ThrowException( "java.lang.NullPointerException",
228+ "Null DatagramPacket_obj address ref");
229+ }
230+
231+ #address is an InetAddress ref
232+ Ivl := I.Object();
233+ if (DEBUG)
234+ sys->print("Dgramsend: GetObjField returned %x\n", Ivl);
235+
236+ if (DEBUG)
237+ sys->print("DGramsend: Doing GetObjField Packet.address.address\n");
238+ v := jni->GetObjField( Ivl, "address", "I");
239+
240+ if (DEBUG && v == nil)
241+ sys->print("DGramsend: GetObjField returned nil\n");
242+ vl := v.Int();
243+
244+ if (DEBUG)
245+ sys->print("Dgramsend: GetObjField returned %d\n", vl);
246+
247+ b[0] = byte (vl >> 24);
248+ b[1] = byte (vl >> 16);
249+ b[2] = byte (vl >> 8);
250+ b[3] = byte (vl);
251+
252+ a := string b[0]+"."+string b[1]+"."+string b[2]+
253+ "."+string b[3];
254+
255+ # Check port....
256+ if (DEBUG)
257+ sys->print("DGramsend: Doing GetObjField Packet.port\n");
258+ v = jni->GetObjField( p0, "port", "I");
259+
260+ if (DEBUG && v == nil)
261+ sys->print("DGramsend: GetObjField returned nil\n");
262+
263+ vl = v.Int();
264+ if (DEBUG)
265+ sys->print("Dgramsend: GetObjField returned %d\n", vl);
266+ if ( vl <= 0 )
267+ str = "connect " + a;
268+ else
269+ str = "connect " + a + "!" + string vl;
270+
271+ if( DEBUG )
272+ sys->print( "DGramsend: connect str = %s\n", str);
273+
274+ n := sys->write( this.cfd.fd, array of byte str, len array of byte str );
275+ if( n <= 0 ) {
276+ if (DEBUG)
277+ sys->print( "DGramsend: connect cmd failed %d\n", n);
278+ jni->ThrowException( "java.net.SocketException",
279+ "Datagram send ctl file error");
280+ }
281+
282+ #Get buf.ary field....
283+ ar := c->ToJArrayB( Pbvl );
284+ n = sys->write( this.fd.fd, ar.ary, len ar.ary);
285+ if ( n <= 0 ) {
286+ # set length to zero...
287+ val := ref Value.TInt(0);
288+ jni->SetObjField( p0, "length", val );
289+ if (DEBUG)
290+ sys->print( "PlainDatagramSocketSend: write of data file returned %d\n", n);
291+ jni->ThrowException( "java.net.SocketException",
292+ "Send: data file write error");
293+ }
294+
295+ val := ref Value.TInt(n);
296+ jni->SetObjField( p0, "length", val );
297+
298+ if (DEBUG)
299+ sys->print("PlainDgramsend: Leaving...\n");
300+
301+}#<<
302+
303+peek_rInetAddress_I( this : ref PlainDatagramSocketImpl_obj, p0 : JObject) : int
304+{#>>
305+ if (DEBUG)
306+ sys->print( "PlainDatagramSocketPeek: Unsupported entry.\n");
307+ jni->ThrowException( "java.net.SocketException",
308+ "Peek: Unsupported option");
309+ return -1;
310+}#<<
311+
312+receive_rDatagramPacket_V( this : ref PlainDatagramSocketImpl_obj, p0 : JObject)
313+{#>>
314+
315+ # p0 = ref DatagramPacket
316+
317+ str,temp: string;
318+ st: list of string;
319+ m: int;
320+
321+
322+
323+ if (DEBUG)
324+ sys->print("PlainDgramreceive: Entering...\n");
325+
326+ if (this.cfd == nil ) {
327+ if (DEBUG)
328+ sys->print( "PlainDatagramSocketRead: ref FileDescriptor_obj for cfd is nil\n");
329+ jni->ThrowException( "java.net.SocketException",
330+ "Socket closed");
331+ }
332+
333+ if ( p0 == nil ) {
334+ if (DEBUG)
335+ sys->print( "PlainDatagramSocketRead: ref DatagramPacket_obj is nil\n");
336+ jni->ThrowException( "java.lang.NullPointerException",
337+ "Null DatagramPacket_obj ref");
338+ }
339+
340+ #Check buf field...
341+ Pb := jni->GetObjField( p0, "buf", "[B");
342+ if ( Pb == nil ) {
343+ if (DEBUG)
344+ sys->print( "PlainDatagramSocketRecv: ref DatagramPacket_obj buf is nil\n");
345+ jni->ThrowException( "java.lang.NullPointerException",
346+ "Null DatagramPacket_obj buffer ref");
347+ }
348+ if (DEBUG)
349+ sys->print("DgramRecv: GetObjField returned %x\n", Pb);
350+
351+ Pbvl := Pb.Object();
352+ if (DEBUG)
353+ sys->print("DgramRecv: GetObjField returned %x\n", Pbvl);
354+
355+ #Get buf.ary field....
356+ ar := c->ToJArrayB( Pbvl );
357+
358+ n := sys->read( this.fd.fd, ar.ary, len ar.ary);
359+ val := ref Value.TInt(n);
360+ jni->SetObjField( p0, "length", val );
361+
362+ if ( n < 0 ) {
363+ if (DEBUG)
364+ sys->print( "PlainDatagramSocketRead: read of data file returned %d\n", n);
365+ jni->ThrowException( "java.net.SocketException",
366+ "PlainDatagramSocketReceive: data file read error");
367+ }
368+
369+ if (DEBUG)
370+ sys->print( "PlainDatagramSocketReceive: read of data file: %s\n", string ar.ary[0:n]);
371+
372+ # Timeout logic...
373+ if( this.timeout != 0 ) {
374+ temp = jnet->timeout + " " + string this.timeout;
375+ rc := sys->write(this.cfd.fd, array of byte temp,
376+ len array of byte temp);
377+ if (DEBUG)
378+ sys->print("DatagramSocketImplReceive: fixing timeout value %s\n", string this.timeout);
379+ if ( rc <= 0 )
380+ jni->ThrowException("java.net.SocketException",
381+ "DatagramSocketImplReceive: Unable to set timeout");
382+ }
383+
384+ # Check status file for timeout...
385+
386+ buf:= array[256] of byte;
387+
388+ temp = "/net/udp/" + string this.connection + "/status";
389+ sfd := sys->open( temp, sys->OREAD );
390+ if (sfd == nil ) {
391+ if (DEBUG)
392+ sys->print( "DatagramSocketImplReceive: Open of status file %s returned nil fd\n", temp);
393+ jni->ThrowException( "java.net.SocketException",
394+ "DatagramSocketImplReceive: Read failed");
395+ }
396+
397+ k := sys->read(sfd, buf, len buf);
398+
399+ if ( k <= 0 ) {
400+ if (DEBUG)
401+ sys->print("DgramReceive: status file read: %d\n", n);
402+ jni->ThrowException( "java.net.SocketException",
403+ "DatagramSocketImplReceive: status file read failed");
404+ }
405+
406+
407+ if (DEBUG)
408+ sys->print("DgramSocketreceive: Got status: %s\n", string buf[0:k]);
409+
410+ (m, st) = sys->tokenize( string buf[:k], " \n\t");
411+
412+ if ( m != 0 )
413+ for(i:=0;i<m;i++) {
414+ str = hd st;
415+ if ( strp->prefix( str, "timed-out" )) {
416+ if (DEBUG)
417+ sys->print( "DatagramSocketImplReceive: timeout\n");
418+ jni->ThrowException("java.io.InterruptedIOException",
419+ "DatagramSocketImplReceive: Read timed out.");
420+ }
421+ st = tl st;
422+ }
423+ else
424+ if (DEBUG)
425+ sys->print( "DatagramSocketImplReceive: Can't tokenize\n");
426+
427+
428+ if (DEBUG)
429+ sys->print( "DatagramSocketImplReceive: Doing NewObject\n");
430+ # Default constructor...
431+ I_obj := jni->NewObject( jni->FindClass( "java/net/InetAddress" ));
432+
433+ if (DEBUG)
434+ sys->print( "DatagramSocketImplReceive: NewObject Done\n");
435+ str = "/net/" + "udp/" + string this.connection + "/remote";
436+ fd := sys->open(str, sys->OREAD);
437+
438+ if ( fd == nil ) {
439+ if (DEBUG)
440+ sys->print("Dgramreceive: Can't open %s\n", str);
441+ jni->ThrowException( "java.net.SocketException",
442+ "DatagramSocketImplreceive: Unable to obtain remote fd\n");
443+ }
444+
445+ n = sys->read(fd, buf, len buf);
446+
447+ if (n <= 0) {
448+ if (DEBUG)
449+ sys->print("DgramSocketreceive: Can't read %s\n", str);
450+ jni->ThrowException( "java.net.SocketException",
451+ "DatagramSocketImplreceive: Unable to obtain remote addr\n");
452+ }
453+
454+ if (DEBUG)
455+ sys->print("DgramSocketreceive: Remote file read has %s\n", string buf[0:n]);
456+
457+ (m, st) = sys->tokenize( string buf[:n], "!");
458+ if ( m == 0 ) {
459+ if (DEBUG)
460+ sys->print("DgramSocketReceive: Can't tokenize %s\n", str);
461+ jni->ThrowException( "java.net.SocketException",
462+ "DatagramSocketImplReceive: Unable to tokenize remote\n");
463+ }
464+
465+ str = hd st;
466+ st = tl st;
467+
468+ iplist: list of string;
469+ ( i, iplist ) = sys->tokenize( str, ".");
470+ if (DEBUG)
471+ sys->print("DgramSocketreceive: tokenize iplist i = %d\n", i);
472+ b:= array[len iplist] of byte;
473+ for (j:=0; j<i; j++) {
474+ temp = hd iplist;
475+ iplist = tl iplist;
476+ b[j] = byte temp;
477+ }
478+
479+ i = 0;
480+ i |= int b[0] <<24;
481+ i |= int b[1] <<16;
482+ i |= int b[2] <<8;
483+ i |= int b[3];
484+ if (DEBUG )
485+ sys->print("DgramSocketreceive: shifted remote addr = %d\n",i);
486+
487+ val = ref Value.TInt( int hd st );
488+ n = jni->SetObjField( p0, "port", val );
489+ if (DEBUG )
490+ sys->print("DgramSocketRecv: Return from SetObjField port %d\n",n );
491+
492+ nval := ref Value.TObject( I_obj );
493+ n = jni->SetObjField( p0, "address", nval );
494+ if (DEBUG )
495+ sys->print("DgramSocketRecv: Return from SetObjField addr %d\n",n );
496+
497+ if (DEBUG )
498+ sys->print("DgramSocketRecv: Finished setting InetAddr ref\n" );
499+
500+ val = ref Value.TInt( i );
501+ n = jni->SetObjField( I_obj, "address", val );
502+ if (DEBUG )
503+ sys->print("DgramSocketRecv: Return from Inetaddr addr SetObjField %d\n",n );
504+
505+ val = ref Value.TInt( jnet->AF_INET );
506+ n = jni->SetObjField( I_obj, "family", val );
507+ if (DEBUG )
508+ sys->print("DgramSocketRecv: Return from family SetObjField %d\n",n );
509+
510+ if (DEBUG)
511+ sys->print("PlainDgramRecv: Leaving...\n");
512+
513+}#<<
514+
515+setTTL_B_V( this : ref PlainDatagramSocketImpl_obj, p0 : int)
516+{#>>
517+ if (DEBUG)
518+ sys->print( "PlainDatagramSocketSetTTL: Unsupported.\n");
519+ jni->ThrowException( "java.net.SocketException",
520+ "setTTL: Unsupported option");
521+}#<<
522+
523+getTTL_B( this : ref PlainDatagramSocketImpl_obj) : int
524+{#>>
525+ if (DEBUG)
526+ sys->print( "PlainDatagramSocketGetTTL: Unsupported.\n");
527+ jni->ThrowException( "java.net.SocketException",
528+ "getTTL: Unsupported option");
529+ return -1;
530+}#<<
531+
532+join_rInetAddress_V( this : ref PlainDatagramSocketImpl_obj, p0 : JObject)
533+{#>>
534+ if (DEBUG)
535+ sys->print( "PlainDatagramSocketJoin: Unsupported.\n");
536+ jni->ThrowException( "java.net.SocketException",
537+ "Join: Unsupported option");
538+}#<<
539+
540+leave_rInetAddress_V( this : ref PlainDatagramSocketImpl_obj, p0 : JObject)
541+{#>>
542+ if (DEBUG)
543+ sys->print( "PlainDatagramSocketLeave: Unsupported.\n");
544+ jni->ThrowException( "java.net.SocketException",
545+ "Leave: Unsupported option");
546+}#<<
547+
548+datagramSocketCreate_V( this : ref PlainDatagramSocketImpl_obj)
549+{#>>
550+
551+ dir: string;
552+ cfd: ref FD;
553+
554+ if (DEBUG)
555+ sys->print("DgramCreate: Entering...\n");
556+
557+ #Open clone device and allocate a connection
558+ dir = "/net/udp/clone";
559+ cfd = sys->open(dir, sys->ORDWR);
560+ if (cfd == nil) {
561+ if( DEBUG )
562+ sys->print( "DgramCreate: Unable to open clone device\n");
563+ jni->ThrowException( "java.net.SocketException",
564+ "Unable to create socket");
565+ }
566+
567+ #The following gets a connection number string
568+ buf := array[10] of byte;
569+ n := sys->read(cfd, buf, len buf);
570+ if (n < 0) {
571+ if (DEBUG)
572+ sys->print("DgramCreate: Ctl file read returned no connection num!\n");
573+ jni->ThrowException( "java.net.SocketException",
574+ "Unable to create socket");
575+ }
576+
577+ if (DEBUG)
578+ sys->print("DgramCreate: ctl read connection #: %s\n",
579+ string buf[:n]);
580+
581+ if (DEBUG)
582+ sys->print("DgramCreate: Storing cfd #\n");
583+ this.cfd.fd = cfd;
584+ r := string buf[:n];
585+ if (DEBUG)
586+ sys->print("DgramCreate: Storing conn #\n");
587+ this.connection = int r;
588+
589+ #Open data file and get a handle...
590+ dir = "/net/" + "udp/" + string this.connection + "/data";
591+ cfd = sys->open(dir, sys->ORDWR);
592+ if (cfd == nil) {
593+ if( DEBUG )
594+ sys->print( "DatagramCreate: Unable to open %s\n", dir);
595+ jni->ThrowException( "java.net.SocketException",
596+ "Unable to create socket");
597+ }
598+ if (DEBUG)
599+ sys->print("DgramCreate: Storing fd #\n");
600+ this.fd.fd = cfd;
601+}#<<
602+
603+datagramSocketClose_V( this : ref PlainDatagramSocketImpl_obj)
604+{#>>
605+
606+ if (DEBUG)
607+ sys->print( "In socket close routine");
608+ this.fd = nil;
609+ this.cfd = nil;
610+
611+
612+}#<<
613+
614+socketSetOption_I_rObject_V( this : ref PlainDatagramSocketImpl_obj, p0 : int,p1 : JObject)
615+{#>>
616+
617+ if( p0 == jnet->IP_MULTICAST_IF ){
618+ if (DEBUG)
619+ sys->print("PlainDatagramSocketImplSetOption: MULTICAST");
620+ jni->ThrowException("java.net.SocketException",
621+ "invalid DatagramSocket Option");
622+ }
623+}#<<
624+
625+socketGetOption_I_I( this : ref PlainDatagramSocketImpl_obj, p0 : int) : int
626+{#>>
627+
628+ # p0 = option
629+
630+ buf := array[256] of byte;
631+ temp, str: string;
632+ iplist, st: list of string;
633+ m,i : int;
634+
635+ ctype := "udp";
636+ if (DEBUG)
637+ sys->print("PlainDatagramSocketImplGetOption: Entering...\n");
638+
639+ if ( this.fd == nil ) {
640+ if (DEBUG)
641+ sys->print("PlainDatagramSocketImplGetOption: Null this.fd\n");
642+ jni->ThrowException("java.net.SocketException", "Socket Closed");
643+ }
644+
645+ if( p0 == jnet->IP_MULTICAST_IF ) {
646+ if (DEBUG)
647+ sys->print("PlainDatagramSocketImplGetOption: MULTICAST");
648+ jni->ThrowException("java.net.SocketException", "invalid DatagramSocket Option");
649+ } else if ( p0 == jnet->SO_BINADDR ) {
650+ if (DEBUG)
651+ sys->print("PlainDatagramSocketImplGetOption: BINADDR");
652+ sfd := sys->open("/dev/sysname", sys->OREAD);
653+ if(( m = sys->read(sfd, buf, len buf)) < 0 ) {
654+ if (DEBUG)
655+ sys->print("DatagramSocketGetOpt: SO_BINADDR: /dev/sysna me read failed\n");
656+ return -1;
657+ }
658+ st = srv->iph2a(string buf[0:m]);
659+ if (st == nil) {
660+ if (DEBUG)
661+ sys->print("DsockGetOpt: iph2a returned nil list\n");
662+ jni->ThrowException( "java.net.SocketException",
663+ "socketGetOption: SO_BINADDR: Unable to get local addres s");
664+ }
665+ str = hd st;
666+ if (DEBUG)
667+ sys->print("socketGetOption: st hd = %s\n", str);
668+ # insure net byte ordered byte[]
669+ ( i, iplist ) = sys->tokenize( str, ".");
670+ if (DEBUG)
671+ sys->print("socketGetOption: iplist tokenize i = %d\n", i);
672+ b:= array[len iplist] of byte;
673+ for (j:=0; j<i; j++) {
674+ temp = hd iplist;
675+ iplist = tl iplist;
676+ b[j] = byte temp;
677+ }
678+ i=0;
679+ i |= int ( b[0] << 24) ;
680+ i |= int ( b[1] << 16 );
681+ i |= int ( b[2] << 8 );
682+ i |= int ( b[3] );
683+ if (DEBUG )
684+ sys->print("DgramSocketGetOpt: BINADDR = %d\n", i);
685+ return i;
686+ } else
687+ jni->ThrowException( "java.net.SocketException",
688+ "DatagramSocketGetOption: Unsupported Option.");
689+ if (DEBUG)
690+ sys->print("PlainDatagramSocketImplGetOption: Leaving...\n");
691+
692+ return -1;
693+}#<<
694+
695+
java/pkg2/java/net/PlainDatagramSocketImpl_L.m+29−0
@@ -0,0 +1,29 @@
1+# javal v1.5 generated file: edit with care
2+
3+PlainDatagramSocketImpl_L : module
4+{
5+ PlainDatagramSocketImpl_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ localPort : int;
9+ fd : ref FileDescriptor_obj;
10+ cfd : ref FileDescriptor_obj;
11+ connection : int;
12+ timeout : int;
13+ };
14+
15+ init : fn( jni_p : JNI );
16+ bind_I_rInetAddress_V : fn( this : ref PlainDatagramSocketImpl_obj, p0 : int,p1 : JObject);
17+ send_rDatagramPacket_V : fn( this : ref PlainDatagramSocketImpl_obj, p0 : JObject);
18+ peek_rInetAddress_I : fn( this : ref PlainDatagramSocketImpl_obj, p0 : JObject) : int;
19+ receive_rDatagramPacket_V : fn( this : ref PlainDatagramSocketImpl_obj, p0 : JObject);
20+ setTTL_B_V : fn( this : ref PlainDatagramSocketImpl_obj, p0 : int);
21+ getTTL_B : fn( this : ref PlainDatagramSocketImpl_obj) : int;
22+ join_rInetAddress_V : fn( this : ref PlainDatagramSocketImpl_obj, p0 : JObject);
23+ leave_rInetAddress_V : fn( this : ref PlainDatagramSocketImpl_obj, p0 : JObject);
24+ datagramSocketCreate_V : fn( this : ref PlainDatagramSocketImpl_obj);
25+ datagramSocketClose_V : fn( this : ref PlainDatagramSocketImpl_obj);
26+ socketSetOption_I_rObject_V : fn( this : ref PlainDatagramSocketImpl_obj, p0 : int,p1 : JObject);
27+ socketGetOption_I_I : fn( this : ref PlainDatagramSocketImpl_obj, p0 : int) : int;
28+
29+};
java/pkg2/java/net/PlainSocketImpl.java+0−0

Empty file added.

java/pkg2/java/net/PlainSocketImpl_L.b+685−0
@@ -0,0 +1,685 @@
1+implement PlainSocketImpl_L;
2+
3+include "jni.m";
4+ jni : JNI;
5+ ClassModule,
6+ JString,
7+ JArray,
8+ JArrayI,
9+ JArrayC,
10+ JArrayB,
11+ JArrayS,
12+ JArrayJ,
13+ JArrayF,
14+ JArrayD,
15+ JArrayZ,
16+ JArrayJObject,
17+ JArrayJClass,
18+ JArrayJString,
19+ JClass,
20+ JObject : import jni;
21+
22+#>> extra pre includes here
23+#<<
24+
25+include "PlainSocketImpl_L.m";
26+
27+#>> extra post includes here
28+
29+include "jnet.m";
30+ jnet: JNET;
31+
32+include "java/io/FileDescriptor_L.m";
33+ fildes: FileDescriptor_L;
34+
35+include "InetAddress_L.m";
36+ inet: InetAddress_L;
37+
38+include "srv.m";
39+ srv: Srv;
40+
41+
42+FileDescriptor_obj: import fildes;
43+InetAddress_obj: import inet;
44+
45+# This next file was once generated by javal, now it must be hand crafted.
46+include "SocketImpl_L.m";
47+ sock: SocketImpl_L;
48+
49+ sys: Sys;
50+
51+ strp: String;
52+
53+DEBUG: import jnet;
54+FD: import sys;
55+SocketImpl_obj: import sock;
56+Value: import jni;
57+
58+#<<
59+
60+init( jni_p : JNI )
61+{
62+ # save java native inteface mod instance
63+ jni = jni_p;
64+ #>>extra initialization here
65+
66+ sys = jni->sys;
67+ strp = jni->str;
68+ if((srv = load Srv Srv->BUILTINPATH) == nil
69+ && (srv = load Srv Srv->PATH) == nil)
70+ jni->InitError( jni->sys->sprint( "java.net.PlainSocketImpl: could not load Srv: %r" ) );
71+
72+ #<<
73+}
74+
75+socketCreate_Z_V( this : ref PlainSocketImpl_obj, p0 : int)
76+{#>>
77+
78+ cfd,fd: ref FD;
79+ dir,ctype: string;
80+
81+ if (DEBUG)
82+ sys->print("Entering socketCreate\n");
83+
84+ # Set socket ctype...
85+ if ( p0 ) {
86+ ctype = "tcp";
87+ this.ctype = jnet->SOCK_STREAM;
88+ } else {
89+ ctype = "udp";
90+ this.ctype = jnet->SOCK_DGRAM;
91+ }
92+
93+ #Open clone device and allocate a connection
94+ dir = "/net/" + ctype + "/clone";
95+ cfd = sys->open(dir, sys->ORDWR);
96+ if (cfd == nil) {
97+ if( DEBUG )
98+ sys->print( "Unable to open clone device\n");
99+ jni->ThrowException( "java.net.SocketException",
100+ "Unable to create socket");
101+ }
102+ this.cfd.fd = cfd;
103+
104+ buf := array[10] of byte;
105+ n := sys->read(cfd, buf, len buf);
106+ if (n < 0) {
107+ if (DEBUG)
108+ sys->print("socketCreate bad ctl file read\n");
109+ jni->ThrowException( "java.net.SocketException",
110+ "socketCreate: Unable to create socket");
111+ }
112+ if (DEBUG)
113+ sys->print("socketCreate: ctl read connection #: %s\n", string buf[0:n]);
114+ s := string buf[:n];
115+
116+ if (DEBUG)
117+ sys->print("socketCreate: s is %s\n", s );
118+ this.connection = int s;
119+
120+ # Populate data fd........
121+ dir = "/net/" + ctype + "/" + string this.connection + "/data";
122+ if (DEBUG)
123+ sys->print("socketCreate: data dir: %s\n", dir);
124+ fd = sys->open(dir, sys->ORDWR);
125+
126+ if ( fd == nil ) {
127+ if (DEBUG)
128+ sys->print("socketCreate: Attempt to open %s - no fd returned\n", dir);
129+ jni->ThrowException( "java.net.SocketException",
130+ "Connect error: can't open connection");
131+ }
132+
133+ this.fd.fd = fd;
134+
135+ if (DEBUG)
136+ sys->print("socketCreate: leaving \n");
137+}#<<
138+
139+socketConnect_rInetAddress_I_V( this : ref PlainSocketImpl_obj, p0 : ref InetAddress_obj,p1 : int)
140+{#>>
141+ b:= array[4] of byte;
142+ buf:= array[50] of byte;
143+ port,str,ctype: string;
144+ arg: list of string;
145+ i,n: int;
146+ fd: ref FD;
147+
148+ if (DEBUG)
149+ sys->print("socketConnect: entering.. \n");
150+ # Get network ctype and address and port.......
151+
152+ # Note p0 is an InetAddress_obj ref.....
153+ if ( p0 != nil ) {
154+ b[0] = byte (p0.address >> 24);
155+ b[1] = byte (p0.address >> 16);
156+ b[2] = byte (p0.address >> 8);
157+ b[3] = byte (p0.address);
158+ str = string b[0]+"."+string b[1]+"."+string b[2]+
159+ "."+string b[3];
160+ if( DEBUG ) {
161+ sys->print( "socketConnect: byte array = %s\n", str );
162+ }
163+ } else {
164+ if( DEBUG )
165+ sys->print( "socketConnect: InetAddress ref = nil!\n");
166+ jni->ThrowException( "java.lang.NullPointerException",
167+ "Null InetAddress");
168+ }
169+
170+ if (this.ctype == jnet->SOCK_STREAM)
171+ ctype = "tcp";
172+ else
173+ ctype = "udp";
174+
175+
176+ # port is the third arg...
177+ if (p1>0)
178+ port = string p1;
179+ else {
180+ if( DEBUG )
181+ sys->print( "socketConnect: No server port arg provided\n");
182+ jni->ThrowException( "java.net.SocketException",
183+ "No port argument");
184+ }
185+
186+ # Make string to write to ctl and issue connect....
187+
188+ cstr := "connect " + str + "!" + port;
189+ if( DEBUG )
190+ sys->print( "socketConnect: connect str = %s\n", cstr);
191+ if ( this.cfd != nil )
192+ n = sys->write( this.cfd.fd, array of byte cstr,
193+ len array of byte cstr );
194+ else {
195+ if (DEBUG)
196+ sys->print("socketConnect: ctl fd == nil!\n");
197+ jni->ThrowException( "java.lang.NullPointerException",
198+ "socketConnect: ctl file fd nil");
199+ }
200+
201+ if( n <= 0 ) {
202+ if (DEBUG)
203+ sys->print( "Connect cmd to ctl file returned bad byte count %d\n",n);
204+ jni->ThrowException( "java.net.SocketException",
205+ "Connect write error");
206+ }
207+ this.address = p0;
208+ this.port = p1;
209+
210+ # Populate local port........
211+
212+ if (this.localport == 0) { # If there was no bind
213+ cstr = "/net/"+ctype+"/"+string this.connection+"/local";
214+ fd = sys->open(cstr, sys->OREAD);
215+ if ( fd == nil ) {
216+ if (DEBUG)
217+ sys->print("socketConnect: Open %s failed.\n",
218+ cstr );
219+ jni->ThrowException( "java.net.SocketException",
220+ "Connect error");
221+ }
222+ n = sys->read( fd, buf, len buf );
223+ if ( n <= 0 ) {
224+ if (DEBUG)
225+ sys->print("Connect Error: Read of %s returned %d\n", cstr ,n );
226+ jni->ThrowException( "java.net.SocketException",
227+ "Connect error");
228+ }
229+
230+ if (DEBUG)
231+ sys->print("socketConnect: Read of %s returned %s\n",
232+ cstr, string buf[:n]);
233+ ( i, arg) = sys->tokenize(string buf[0:n], "!");
234+ if (i == 0) {
235+ if (DEBUG)
236+ sys->print("Connect Error: tokenize of /local");
237+ jni->ThrowException( "java.net.SocketException",
238+ "Connect error");
239+ }
240+ arg = tl arg;
241+ str = hd arg;
242+ if (DEBUG)
243+ sys->print("socketConnect: Tokenize for local port returned %s\n", str);
244+ this.localport = int str;
245+ }
246+}#<<
247+
248+socketBind_rInetAddress_I_V( this : ref PlainSocketImpl_obj, p0 : ref InetAddress_obj,p1 : int)
249+{#>>
250+
251+ buf:= array[50] of byte;
252+ b := array[jnet->IPADDRLEN] of byte;
253+ i: int;
254+ arg: list of string;
255+
256+ if (DEBUG)
257+ sys->print("Entering socketBind\n");
258+
259+ # Create the localaddress/localport assoc to a socket......
260+
261+ # Note p0 is a ref to InetAddress_obj
262+ # The ip address was shifted in previously so...
263+ # IPV4 only....
264+ if ( p0 != nil ) {
265+ if (DEBUG)
266+ sys->print( "socketBind: p0.address = %d\n",p0.address);
267+ b[0] = byte (p0.address >> 24);
268+ b[1] = byte (p0.address >> 16);
269+ b[2] = byte (p0.address >> 8);
270+ b[3] = byte (p0.address);
271+ x := string b[0]+"."+string b[1]+"."+string b[2]+
272+ "."+string b[3];
273+ if (DEBUG)
274+ sys->print("socketBind: Bind using %s \n", x);
275+ } else
276+ jni->ThrowException( "java.lang.NullPointerException",
277+ "Null InetAddress");
278+
279+ if( this.fd == nil ) {
280+ if (DEBUG)
281+ sys->print("Attempt to Bind using cfd = nil\n");
282+ jni->ThrowException("java.net.SocketException", "Null Socket");
283+ }
284+
285+ # bind is announce
286+
287+ if (p1)
288+ str := "announce " + string b[0] + "." + string b[1] +
289+ + "." + string b[2] + "." +
290+ string b[3] + "!" + string p1;
291+ else
292+ str = "announce " + string b[0] + "." + string b[1] +
293+ + "." + string b[2] + "." + string b[3] ;
294+
295+ if( DEBUG )
296+ sys->print("socketBind: announce port is: %s\n", string p1);
297+
298+
299+ n := sys->write( this.cfd.fd, array of byte str, len array of byte str );
300+
301+ if( n <= 0 ) {
302+ if (DEBUG)
303+ sys->print( "socketBind: %s to ctl failed\n", str);
304+ jni->ThrowException( "java.net.SocketException",
305+ "Bind error");
306+ }
307+
308+ # Populate local port........
309+ if (this.ctype == jnet->SOCK_STREAM)
310+ ctype := "tcp";
311+ else
312+ ctype = "udp";
313+
314+ cstr := "/net/"+ctype+"/"+string this.connection+"/local";
315+ fd := sys->open(cstr, sys->OREAD);
316+ if ( fd == nil ) {
317+ if (DEBUG)
318+ sys->print("socketBind: Open %s failed.\n",
319+ cstr );
320+ jni->ThrowException( "java.net.SocketException",
321+ "Bind error");
322+ }
323+ n = sys->read( fd, buf, len buf );
324+ if ( n <= 0 ) {
325+ if (DEBUG)
326+ sys->print("Bind Error: Read of %s returned %d\n", cstr ,n );
327+ jni->ThrowException( "java.net.SocketException",
328+ "Bind error - opening /local");
329+ }
330+
331+ if (DEBUG)
332+ sys->print("socketConnect: Read of %s returned %s\n",
333+ cstr, string buf[:n]);
334+ ( i, arg) = sys->tokenize(string buf[0:n], "!");
335+ if (i == 0) {
336+ if (DEBUG)
337+ sys->print("Bind Error: tokenize of /local");
338+ jni->ThrowException( "java.net.SocketException",
339+ "Bind error");
340+ }
341+ arg = tl arg;
342+ str = hd arg;
343+ if (DEBUG)
344+ sys->print("socketBind: Tokenize for local port returned %s\n", str);
345+ this.localport = int str;
346+ this.address = p0;
347+}#<<
348+
349+socketListen_I_V( this : ref PlainSocketImpl_obj, p0 : int)
350+{#>>
351+
352+ # Maybe should just return here max q is always 5......
353+ if (DEBUG)
354+ sys->print( "In socket listen routine\n");
355+
356+}#<<
357+
358+socketAccept_rSocketImpl_V( this : ref PlainSocketImpl_obj, p0 : ref SocketImpl_obj )
359+{#>>
360+ # p0 is a ref to SocketImpl_obj
361+
362+ ctype,dir: string;
363+ buf := array[200] of byte;
364+ str: string;
365+ st: list of string;
366+ m,n : int;
367+
368+ if (DEBUG)
369+ sys->print( "In socketAccept\n");
370+
371+ if ( p0 == nil ) {
372+ if( DEBUG )
373+ sys->print( "socketAccept: PlainSocketImpl ref = nil!\n");
374+ jni->ThrowException( "java.lang.NullPointerException",
375+ "Null Socket Ptr");
376+ }
377+
378+ if (this.ctype == jnet->SOCK_STREAM)
379+ ctype = "tcp";
380+ else
381+ ctype = "udp";
382+
383+ if( this.timeout != 0 ) {
384+ temp:= jnet->timeout + " " + string this.timeout;
385+ if (DEBUG)
386+ sys->print("socketAccept: writing to ctl: %s\n", temp);
387+ if ( this.cfd != nil )
388+ rc := sys->write(this.cfd.fd, array of byte temp,
389+ len array of byte temp);
390+ else {
391+ if (DEBUG)
392+ sys->print("socketAccept: ctl fd is nil\n");
393+ jni->ThrowException( "java.lang.NullPointerException",
394+ "Null CTL FD");
395+ }
396+
397+
398+ if (DEBUG)
399+ sys->print("socketAccept: wrote to ctl: %s\n", temp);
400+ if ( rc <= 0 ) {
401+ if (DEBUG)
402+ sys->print("socketAccept: Bad write to ctl: %s\n", temp);
403+ jni->ThrowException("java.net.SocketException",
404+ "socketAccept: Unable to set timeout");
405+ }
406+ }
407+
408+ dir = "/net/" + ctype + "/" + string this.connection + "/listen";
409+ if ((lfd := sys->open(dir, sys->ORDWR)) == nil ) {
410+ if (DEBUG)
411+ sys->print( "Open of listen file %s returned nil fd\n", dir);
412+ jni->ThrowException( "java.net.SocketException",
413+ "socketAccept: accept failed");
414+ }
415+
416+ # Check status file to see if timed out...
417+ dir = "/net/" + ctype + "/" + string this.connection + "/status";
418+ if ((sfd := sys->open(dir, sys->OREAD)) == nil ) {
419+ if (DEBUG)
420+ sys->print( "socketAccept: Open of status file %s returned nil fd\n", dir);
421+ jni->ThrowException( "java.net.SocketException",
422+ "socketAccept: status file open failed");
423+ }
424+
425+ n = sys->read(sfd, buf, len buf);
426+ if ( n <= 0 ) {
427+ if (DEBUG)
428+ sys->print("socketAccept: status file read: %d\n", n);
429+ jni->ThrowException( "java.net.SocketException",
430+ "socketAccept: status file read failed");
431+ }
432+
433+ if (DEBUG)
434+ sys->print("socketAccept: Got status: %s\n", string buf[0:n]);
435+ (m, st) = sys->tokenize( string buf[:n], " \t\n");
436+
437+ for(i:=0;i<m;i++) {
438+ str = hd st;
439+ if ( strp->prefix( str, "timed-out" )) {
440+ if (DEBUG)
441+ sys->print( "socketAccept: Status is timeout\n");
442+ jni->ThrowException("java.io.InterruptedIOException",
443+ "socketAccept: accept timed out.");
444+ }
445+ st = tl st;
446+ }
447+
448+ # Need to save the dfd and cfd. Note SocketImpl is abstract...
449+ if (DEBUG)
450+ sys->print( "socketAccept: Storing fd from listen in SocketImpl_obj\n");
451+ # Get connection...
452+ n = sys->read(lfd, buf, len buf);
453+ if (n <= 0) {
454+ if (DEBUG)
455+ sys->print(" SocketAccept: ctl file read bad return code\n");
456+ jni->ThrowException( "java.net.SocketException",
457+ "socketAccept: Unable to accept socket");
458+ }
459+
460+ if (DEBUG)
461+ sys->print("socketAccept: listen ctl conn #: %s\n", string buf[0:n]);
462+
463+ s := string buf[0:n];
464+ if (DEBUG)
465+ sys->print("socketAccept: storing connection number = %d in SocketImpl.\n", int s );
466+ p0.connection = int s; # save connection number
467+ if (DEBUG)
468+ sys->print("socketAccept: storing connection ctype = %d in SocketImpl.\n", this.ctype );
469+ p0.ctype = this.ctype; # save connection ctype
470+
471+ dir = "/net/" + ctype + "/" + string p0.connection + "/data";
472+ if ((fd := sys->open( dir, sys->ORDWR)) == nil ) {
473+ if (DEBUG)
474+ sys->print(" SocketAccept: open of %s failed\n", dir);
475+
476+ jni->ThrowException( "java.net.SocketException",
477+ "Unable to open accepted socket");
478+ }
479+ if (DEBUG)
480+ sys->print("SocketAccept: About to store dfd in SocketImpl fd (abstract class)\n");
481+ p0.fd.fd = fd; #Store data file fd.....
482+
483+ if (DEBUG)
484+ sys->print(" socketAccept: storing accepted cfd now\n" );
485+ p0.cfd.fd = lfd; # store in class...
486+
487+}#<<
488+
489+socketAvailable_I( this : ref PlainSocketImpl_obj) : int
490+{#>>
491+
492+ if (DEBUG)
493+ sys->print( "In socket available routine\n");
494+ jni->ThrowException( "java.io.IOException", "socketAvailable: Unsupported function" );
495+ return -1;
496+
497+}#<<
498+
499+socketClose_V( this : ref PlainSocketImpl_obj)
500+{#>>
501+ if (DEBUG)
502+ sys->print( "In socket close routine\n");
503+ this.fd = nil;
504+ this.cfd = nil;
505+ this = nil;
506+
507+}#<<
508+
509+initProto_V( )
510+{#>>
511+ if (DEBUG)
512+ sys->print( "In initProto routine\n");
513+ return;
514+}#<<
515+
516+socketSetOption_I_Z_rObject_V( this : ref PlainSocketImpl_obj, p0 : int,p1 : int,p2 : JObject)
517+{#>>
518+ # p0 = opt
519+ # p1 = enable
520+ # p2 = val
521+
522+ if (DEBUG)
523+ sys->print( "In SocketSetOption routine");
524+
525+ if ( this.cfd == nil ) {
526+ if (DEBUG)
527+ sys->print("PlainSocketImplSetOption: Null this.fd\n");
528+ jni->ThrowException("java.net.SocketException", "Socket Closed");
529+ }
530+
531+ if (this.ctype == jnet->SOCK_STREAM)
532+ ctype := "tcp";
533+ else
534+ ctype = "udp";
535+
536+ if( p0 == jnet->TCP_NODELAY )
537+ s := "tcp_nodelay " + string p1;
538+ else if ( p0 == jnet->SO_LINGER )
539+ if ( p1 > 0 ) {
540+ if( p2 != nil ) {
541+ v := jni->GetObjField( p2, "value", "I");
542+ vl := v.Int();
543+ s = "linger " + string vl;
544+ }
545+ } else
546+ s = "linger " + "-1";
547+ else
548+ jni->ThrowException( "java.net.SocketException",
549+ "Socket Option Unsupported");
550+
551+ if ( DEBUG )
552+ sys->print("SocketSetOpt: Option given is: %s\n", s );
553+
554+ n := sys->write( this.cfd.fd, array of byte s, len array of byte s );
555+
556+ if( n <= 0 ) {
557+ if (DEBUG)
558+ sys->print( "SetSockOpt: cmd to ctl file returned bad byte count %d\n",n);
559+ jni->ThrowException( "java.net.SocketException",
560+ "SetSocketOption error");
561+ }
562+}#<<
563+
564+socketGetOption_I_I( this : ref PlainSocketImpl_obj, p0 : int) : int
565+{#>>
566+
567+ temp,ctype,dir: string;
568+ buf:= array[256] of byte;
569+ s,str: string;
570+ iplist,st: list of string;
571+ m,n,i : int;
572+
573+ # p0 == socket option
574+
575+ if (DEBUG)
576+ sys->print( "In SocketGetOption routine");
577+
578+ if ( this.fd == nil ) {
579+ if (DEBUG)
580+ sys->print("PlainSocketImplGetOption: this.fd is null\n");
581+ jni->ThrowException("java.net.SocketException", "Socket Closed");
582+ }
583+
584+
585+ if (this.ctype == jnet->SOCK_STREAM)
586+ ctype = "tcp";
587+ else
588+ ctype = "udp";
589+
590+ if (p0 == jnet->SO_LINGER )
591+ s = "linger";
592+ else if ( p0 == jnet->TCP_NODELAY )
593+ s = "tcp_nodelay";
594+ else if ( p0 == jnet->SO_BINADDR ){
595+ sfd := sys->open("/dev/sysname", sys->OREAD);
596+ if ( sfd == nil ) {
597+ jni->ThrowException( "java.net.SocketException",
598+ "socketGetOpt: Inferno sysname file open failed");
599+ }
600+
601+ if(( m = sys->read(sfd, buf, len buf)) < 0 ) {
602+ if (DEBUG)
603+ sys->print("SocketGetOpt: SO_BINADDR: /dev/sysname read failed\n");
604+ return -1;
605+ }
606+ st = srv->iph2a(string buf[0:m]);
607+ if (st == nil) {
608+ if (DEBUG)
609+ sys->print("sockGetOpt: iph2a returned nil list\n");
610+ jni->ThrowException( "java.net.SocketException",
611+ "socketGetOption: SO_BINADDR: Unable to get local address");
612+ }
613+ str = hd st;
614+ if (DEBUG)
615+ sys->print("socketGetOption: st hd = %s\n", str);
616+ # insure net byte ordered byte[]
617+ ( i, iplist ) = sys->tokenize( str, ".");
618+ if ( i == 0 ) {
619+ if (DEBUG)
620+ sys->print("sockGetOpt: tokenize 0 size list\n");
621+ jni->ThrowException( "java.net.SocketException",
622+ "socketGetOption: SO_BINADDR: Unable tokenize local address");
623+ }
624+ b:= array[len iplist] of byte;
625+ for (j:=0; j<len iplist; j++) {
626+ temp = hd iplist;
627+ if (DEBUG )
628+ sys->print("socketGetOpt: temp = %s\n", temp);
629+ iplist = tl iplist;
630+ b[j] = byte temp;
631+ }
632+ i=0;
633+ i |= int ( b[0] << 24) ;
634+ i |= int ( b[1] << 16 );
635+ i |= int ( b[2] << 8 );
636+ i |= int ( b[3] );
637+ if (DEBUG )
638+ sys->print("socketGetOpt: returning BINADDR = %d\n", i);
639+ return i;
640+ } else
641+ jni->ThrowException( "java.net.SocketException",
642+ "socketGetOption: Unknown Option");
643+
644+
645+ # Get status file string ...
646+ dir = "/net/" + ctype + "/" + string this.connection + "/status";
647+
648+ if ((sfd := sys->open( dir, sys->OREAD )) == nil ) {
649+ if (DEBUG)
650+ sys->print("socketGetOpt: Open status file %s return"+
651+ "ed nil fd\n", dir);
652+ jni->ThrowException( "java.net.SocketException",
653+ "socketGetOpt: Inferno Status file open failed");
654+ }
655+
656+ n = sys->read(sfd, buf, len buf);
657+ if ( n <= 0 ) {
658+ if( DEBUG )
659+ sys->print("socketGetOpt: status file bad read %d\n", n);
660+ return -1;
661+ }
662+ if (DEBUG)
663+ sys->print("socketGetOpt: status file has: %s\n", string buf[0:n]);
664+
665+ (m, st) = sys->tokenize( string buf[:n], " \t\n");
666+ if ( m == 0 )
667+ jni->ThrowException( "java.net.SocketException",
668+ "socketGetOption: Unable to tokenize status info");
669+
670+ for(i=0;i<m;i++) {
671+ str = hd st;
672+ st = tl st;
673+ if ( strp->prefix( str, s )) {
674+ if (p0 == jnet -> SO_LINGER)
675+ return int hd st;
676+ else if ( p0 == jnet -> TCP_NODELAY)
677+ if ( int hd st != 0 )
678+ return 0;
679+ else
680+ break;
681+ }
682+ }
683+
684+ return -1;
685+}#<<
java/pkg2/java/net/PlainSocketImpl_L.m+30−0
@@ -0,0 +1,30 @@
1+# generated file edit with care
2+
3+PlainSocketImpl_L : module
4+{
5+ PlainSocketImpl_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ cfd : ref FileDescriptor_obj;
9+ ctype : int;
10+ connection : int;
11+ fd : ref FileDescriptor_obj;
12+ address : ref InetAddress_obj;
13+ port : int;
14+ localport : int;
15+ timeout : int;
16+ };
17+
18+ init : fn( jni_p : JNI );
19+ socketCreate_Z_V : fn( this : ref PlainSocketImpl_obj, p0 : int);
20+ socketConnect_rInetAddress_I_V : fn( this : ref PlainSocketImpl_obj, p0 : ref InetAddress_obj,p1 : int);
21+ socketBind_rInetAddress_I_V : fn( this : ref PlainSocketImpl_obj, p0 : ref InetAddress_obj,p1 : int);
22+ socketListen_I_V : fn( this : ref PlainSocketImpl_obj, p0 : int);
23+ socketAccept_rSocketImpl_V : fn( this : ref PlainSocketImpl_obj, p0 : ref SocketImpl_obj);
24+ socketAvailable_I : fn( this : ref PlainSocketImpl_obj) : int;
25+ socketClose_V : fn( this : ref PlainSocketImpl_obj);
26+ initProto_V : fn( );
27+ socketSetOption_I_Z_rObject_V : fn( this : ref PlainSocketImpl_obj, p0 : int,p1 : int,p2 : JObject);
28+ socketGetOption_I_I : fn( this : ref PlainSocketImpl_obj, p0 : int) : int;
29+
30+};
java/pkg2/java/net/ProtocolException.java+0−0

Empty file added.

java/pkg2/java/net/ServerSocket.java+0−0

Empty file added.

java/pkg2/java/net/Socket.java+0−0

Empty file added.

java/pkg2/java/net/SocketException.java+0−0

Empty file added.

java/pkg2/java/net/SocketImpl.java+0−0

Empty file added.

java/pkg2/java/net/SocketImplFactory.java+0−0

Empty file added.

java/pkg2/java/net/SocketImpl_L.m+19−0
@@ -0,0 +1,19 @@
1+# generated file edit with care
2+
3+SocketImpl_L : module
4+{
5+ SocketImpl_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ cfd : ref FileDescriptor_obj;
9+ ctype: int;
10+ connection: int;
11+ fd : ref FileDescriptor_obj;
12+ address : ref InetAddress_obj;
13+ port : int;
14+ localport : int;
15+ };
16+
17+ init : fn( jni_p : JNI );
18+
19+};
java/pkg2/java/net/SocketInputStream.java+0−0

Empty file added.

java/pkg2/java/net/SocketInputStream_L.b+173−0
@@ -0,0 +1,173 @@
1+implement SocketInputStream_L;
2+
3+include "jni.m";
4+ jni : JNI;
5+ ClassModule,
6+ JString,
7+ JArray,
8+ JArrayI,
9+ JArrayC,
10+ JArrayB,
11+ JArrayS,
12+ JArrayJ,
13+ JArrayF,
14+ JArrayD,
15+ JArrayZ,
16+ JArrayJObject,
17+ JArrayJString,
18+ JClass,
19+ JObject : import jni;
20+
21+#>> extra pre includes here
22+
23+#<<
24+
25+include "SocketInputStream_L.m";
26+
27+#>> extra post includes here
28+
29+include "jnet.m";
30+ jnet: JNET;
31+
32+include "java/io/FileDescriptor_L.m";
33+ fildes: FileDescriptor_L;
34+
35+include "InetAddress_L.m";
36+ inet: InetAddress_L;
37+
38+FileDescriptor_obj: import fildes;
39+InetAddress_obj: import inet;
40+
41+include "SocketImpl_L.m";
42+ sock: SocketImpl_L;
43+
44+SocketImpl_obj: import sock;
45+
46+include "PlainSocketImpl_L.m";
47+ psock: PlainSocketImpl_L;
48+
49+sys: Sys;
50+strp: String;
51+DEBUG: import jnet;
52+FD: import sys;
53+
54+PlainSocketImpl_obj: import psock;
55+
56+#<<
57+
58+init( jni_p : JNI )
59+{
60+ # save java native inteface mod instance
61+ jni = jni_p;
62+ #>>extra initialization here
63+
64+ sys = jni->sys;
65+ strp = jni->str;
66+
67+ #<<
68+}
69+
70+socketRead_aB_I_I_I( this : ref SocketInputStream_obj, p0 : JArrayB,p1 : int,p2 : int) : int
71+{#>>
72+
73+
74+ st: list of string;
75+ str: string;
76+ m: int;
77+
78+ # p1 = offset
79+ # p2 = length
80+
81+ if (p0 == nil ) {
82+ if ( DEBUG )
83+ sys->print( "socketRead: p0 ptr to JArrayB is nil\n");
84+ jni->ThrowException( "java.lang.NullPointerException", "");
85+ }
86+
87+ if (this.fd == nil ) {
88+ if ( DEBUG )
89+ sys->print( "socketRead: this.fd == 0, socket must be closed\n");
90+ jni->ThrowException( "java.net.SocketException", "Socket was closed");
91+ }
92+
93+ if ( p2 <0 || p1 < 0 || p1 + p2 > len p0.ary ) {
94+ if ( DEBUG )
95+ sys->print( "socketRead: offset: %d/length: %d wrong in byte array\n",p1,p2);
96+ jni->ThrowException( "java.lang.ArrayIndexOutOfBoundsException", "");
97+ }
98+
99+
100+ if (this.impl == nil ) {
101+ if ( DEBUG )
102+ sys->print( "socketRead: p0 ptr to SocketImpl is nil\n");
103+ jni->ThrowException( "java.lang.NullPointerException", "null SocketImpl ref");
104+ }
105+
106+
107+ # The TIMEOUT logic... Note modifications to SocketInputStream_L.m
108+ # had to be made to support impl ptr as a ref to PlainSocketImpl_obj instead
109+ # of JOBJECT...
110+
111+ if( this.impl.timeout != 0 ) {
112+ temp:= jnet->timeout + " " + string this.impl.timeout;
113+ rc := sys->write(this.impl.cfd.fd, array of byte temp, len temp);
114+ if (DEBUG)
115+ sys->print("socketRead: fixing timeout value %s\n", string this.impl.timeout);
116+ if ( rc <= 0 )
117+ jni->ThrowException("java.net.SocketException",
118+ "socketRead: Unable to set timeout");
119+ }
120+
121+ # Do Read of data file into buffer...
122+ if (DEBUG)
123+ sys->print("Reading into JArrayB for %d bytes\n",p2);
124+
125+ n := sys->read(this.fd.fd, array of byte p0.ary[p1: ], p2);
126+
127+ if (DEBUG)
128+ sys->print("SocketInputStream: read of socket: %s\n", string p0.ary[p1:n]);
129+
130+ # Check status file to for timeout...
131+
132+ if (this.impl.ctype == jnet->SOCK_STREAM)
133+ ctype:= "tcp";
134+ else
135+ ctype = "udp";
136+
137+ buf:= array[256] of byte;
138+
139+ dir := "/net/" + ctype + "/" + string this.impl.connection + "/status";
140+ sfd := sys->open( dir, sys->OREAD );
141+ if (sfd == nil ) {
142+ if (DEBUG)
143+ sys->print( "socketInputStreamRead: Open of status file %s returned nil fd\n", dir);
144+ jni->ThrowException( "java.net.SocketException",
145+ "socketInputStreamRead: Read failed");
146+ }
147+
148+ k := sys->read(sfd, buf, len buf);
149+ if (DEBUG)
150+ sys->print("socketInputStreamRead: status file has: %s\n", string buf[0:k]);
151+ if ( k > 0 ) {
152+ (m, st) = sys->tokenize( string buf, " \t\n");
153+ for(i:=0;i<m;i++) {
154+ str = hd st;
155+ if ( strp->prefix( str, "timed-out" )) {
156+ if (DEBUG)
157+ sys->print( "socketAccept: timeout\n");
158+ jni->ThrowException("java.io.InterruptedIOException",
159+ "socketInputStreamRead: Read timed out.");
160+ }
161+ st = tl st;
162+ }
163+ }
164+
165+
166+ if ( n < 0 ) {
167+ if ( DEBUG )
168+ sys->print( "socketRead: Read failed with code %d\n", n);
169+ jni->ThrowException( "java.net.SocketException", "Read failed");
170+ }
171+ return n;
172+
173+}#<<
java/pkg2/java/net/SocketInputStream_L.m+17−0
@@ -0,0 +1,17 @@
1+# generated file edit with care
2+
3+SocketInputStream_L : module
4+{
5+ SocketInputStream_obj : adt
6+ {
7+ cl_mod : ClassModule;
8+ fd : ref FileDescriptor_obj;
9+ eof : int;
10+ impl : ref PlainSocketImpl_obj;
11+ temp : JArrayB;
12+ };
13+
14+ init : fn( jni_p : JNI );
15+ socketRead_aB_I_I_I : fn( this : ref SocketInputStream_obj, p0 : JArrayB,p1 : int,p2 : int) : int;
16+
17+};
java/pkg2/java/net/SocketOptions.java+0−0

Empty file added.

java/pkg2/java/net/SocketOutputStream.java+0−0

Empty file added.

java/pkg2/java/net/SocketOutputStream_L.b+95−0
@@ -0,0 +1,95 @@
1+implement SocketOutputStream_L;
2+
3+include "jni.m";
4+ jni : JNI;
5+ ClassModule,
6+ JString,
7+ JArray,
8+ JArrayI,
9+ JArrayC,
10+ JArrayB,
11+ JArrayS,
12+ JArrayJ,
13+ JArrayF,
14+ JArrayD,
15+ JArrayZ,
16+ JArrayJObject,
17+ JArrayJString,
18+ JClass,
19+ JObject : import jni;
20+
21+#>> extra pre includes here
22+
23+#<<
24+
25+include "SocketOutputStream_L.m";
26+
27+#>> extra post includes here
28+
29+
30+include "jnet.m";
31+ jnet: JNET;
32+
33+include "java/io/FileDescriptor_L.m";
34+ fildes: FileDescriptor_L;
35+
36+include "InetAddress_L.m";
37+ inet: InetAddress_L;
38+
39+sys: Sys;
40+
41+DEBUG: import jnet;
42+FD: import sys;
43+FileDescriptor_obj: import fildes;
44+InetAddress_obj: import inet;
45+
46+#<<
47+
48+init( jni_p : JNI )
49+{
50+ # save java native inteface mod instance
51+ jni = jni_p;
52+ #>>extra initialization here
53+
54+ sys = jni->sys;
55+
56+ if (DEBUG)
57+ sys->print("socketOutputStream: init()\n");
58+ #<<
59+}

36 more lines aren’t shown here.

java/pkg2/java/net/SocketOutputStream_L.m+16−0

This diff is large: its 17 lines aren’t shown here.

java/pkg2/java/net/URL.java+0−0

Empty file added.

java/pkg2/java/net/URLConnection.java+0−0

Empty file added.

java/pkg2/java/net/URLEncoder.java+0−0

Empty file added.

java/pkg2/java/net/URLStreamHandler.java+0−0

Empty file added.

java/pkg2/java/net/URLStreamHandlerFactory.java+0−0

Empty file added.

java/pkg2/java/net/UnknownHostException.java+0−0

Empty file added.

java/pkg2/java/net/UnknownServiceException.java+0−0

Empty file added.

java/pkg2/java/net/jnet.m+23−0

This diff is large: its 24 lines aren’t shown here.

java/pkg2/java/net/mkfile+100−0

This diff is large: its 101 lines aren’t shown here.

java/pkg2/java/security/DigestException.java+0−0

Empty file added.

java/pkg2/java/security/DigestOutputStream.java+0−0

Empty file added.

java/pkg2/java/security/MessageDigest.java+0−0

Empty file added.

java/pkg2/java/security/NoSuchAlgorithmException.java+0−0

Empty file added.

java/pkg2/java/security/NoSuchProviderException.java+0−0

Empty file added.

java/pkg2/java/security/Provider.java+0−0

Empty file added.

java/pkg2/java/security/Security.java+0−0

Empty file added.

java/pkg2/java/security/mkfile+22−0

This diff is large: its 23 lines aren’t shown here.

java/pkg2/java/util/BitSet.java+0−0

Empty file added.

java/pkg2/java/util/Calendar.java+782−0

This diff is large: its 783 lines aren’t shown here.

java/pkg2/java/util/Date.java+0−0

Empty file added.

java/pkg2/java/util/Date_L.b+180−0

This diff is large: its 181 lines aren’t shown here.

java/pkg2/java/util/Date_L.m+30−0

This diff is large: its 31 lines aren’t shown here.

java/pkg2/java/util/Dictionary.java+0−0

Empty file added.

java/pkg2/java/util/EmptyStackException.java+0−0

Empty file added.

java/pkg2/java/util/Enumeration.java+0−0

Empty file added.

java/pkg2/java/util/EventListener.java+0−0

Empty file added.

java/pkg2/java/util/EventObject.java+0−0

Empty file added.

java/pkg2/java/util/GregorianCalendar.java+557−0

This diff is large: its 558 lines aren’t shown here.

java/pkg2/java/util/Hashtable.java+0−0

Empty file added.

java/pkg2/java/util/ListResourceBundle.java+169−0

This diff is large: its 170 lines aren’t shown here.

java/pkg2/java/util/Locale.java+631−0

This diff is large: its 632 lines aren’t shown here.

java/pkg2/java/util/MissingResourceException.java+73−0

This diff is large: its 74 lines aren’t shown here.

java/pkg2/java/util/NoSuchElementException.java+0−0

Empty file added.

java/pkg2/java/util/Observable.java+0−0

Empty file added.

java/pkg2/java/util/Observer.java+0−0

Empty file added.

java/pkg2/java/util/Properties.java+0−0

Empty file added.

java/pkg2/java/util/PropertyResourceBundle.java+121−0

This diff is large: its 122 lines aren’t shown here.

java/pkg2/java/util/Random.java+0−0

Empty file added.

java/pkg2/java/util/ResourceBundle.java+536−0

This diff is large: its 537 lines aren’t shown here.

java/pkg2/java/util/ResourceBundle_L.b+48−0

This diff is large: its 49 lines aren’t shown here.

java/pkg2/java/util/ResourceBundle_L.m+14−0

This diff is large: its 15 lines aren’t shown here.

java/pkg2/java/util/SimpleTimeZone.java+246−0

This diff is large: its 247 lines aren’t shown here.

java/pkg2/java/util/Stack.java+0−0

Empty file added.

java/pkg2/java/util/StringTokenizer.java+0−0

Empty file added.

java/pkg2/java/util/TimeZone.java+193−0

This diff is large: its 194 lines aren’t shown here.

java/pkg2/java/util/TooManyListenersException.java+65−0

This diff is large: its 66 lines aren’t shown here.

java/pkg2/java/util/Vector.java+0−0

Empty file added.

java/pkg2/java/util/mkfile+88−0

This diff is large: its 89 lines aren’t shown here.

java/pkg2/java/util/zip/CRC32.java+0−0

Empty file added.

java/pkg2/java/util/zip/CRC32_L.b+51−0

This diff is large: its 52 lines aren’t shown here.

java/pkg2/java/util/zip/CRC32_L.m+15−0

This diff is large: its 16 lines aren’t shown here.

java/pkg2/java/util/zip/CheckedInputStream.java+0−0

Empty file added.

java/pkg2/java/util/zip/CheckedOutputStream.java+0−0

Empty file added.

java/pkg2/java/util/zip/Checksum.java+0−0

Empty file added.

java/pkg2/java/util/zip/DataFormatException.java+0−0

Empty file added.

java/pkg2/java/util/zip/GZIPInputStream.java+0−0

Empty file added.

java/pkg2/java/util/zip/Inflater.java+0−0

Empty file added.

java/pkg2/java/util/zip/InflaterInputStream.java+0−0

Empty file added.

java/pkg2/java/util/zip/Inflater_L.b+77−0

This diff is large: its 78 lines aren’t shown here.

java/pkg2/java/util/zip/Inflater_L.m+24−0

This diff is large: its 25 lines aren’t shown here.

java/pkg2/java/util/zip/ZipConstants.java+0−0

Empty file added.

java/pkg2/java/util/zip/ZipEntry.java+0−0

Empty file added.

java/pkg2/java/util/zip/ZipException.java+0−0

Empty file added.

java/pkg2/java/util/zip/ZipInputStream.java+0−0

Empty file added.

java/pkg2/java/util/zip/mkfile+38−0

This diff is large: its 39 lines aren’t shown here.

java/pkg2/mkfile+9−0

This diff is large: its 10 lines aren’t shown here.

java/pkg2/sun/awt/AWTFinalizeable.java+0−0

Empty file added.

java/pkg2/sun/awt/AWTFinalizer.java+0−0

Empty file added.

java/pkg2/sun/awt/DrawingSurface.java+0−0

Empty file added.

java/pkg2/sun/awt/DrawingSurfaceInfo.java+0−0

Empty file added.

java/pkg2/sun/awt/PhysicalDrawingSurface.java+0−0

Empty file added.

java/pkg2/sun/awt/image/ByteArrayImageSource.java+0−0

Empty file added.

java/pkg2/sun/awt/image/FileImageSource.java+0−0

Empty file added.

java/pkg2/sun/awt/image/GifImageDecoder.java+0−0

Empty file added.

java/pkg2/sun/awt/image/GifImageDecoder_L.b+54−0

This diff is large: its 55 lines aren’t shown here.

java/pkg2/sun/awt/image/GifImageDecoder_L.m+36−0

This diff is large: its 37 lines aren’t shown here.

java/pkg2/sun/awt/image/Image.java+0−0

Empty file added.

java/pkg2/sun/awt/image/ImageConsumerQueue.java+0−0

Empty file added.

java/pkg2/sun/awt/image/ImageDecoder.java+0−0

Empty file added.

java/pkg2/sun/awt/image/ImageFetchable.java+0−0

Empty file added.

java/pkg2/sun/awt/image/ImageFetcher.java+0−0

Empty file added.

java/pkg2/sun/awt/image/ImageFormatException.java+0−0

Empty file added.

java/pkg2/sun/awt/image/ImageRepresentation.java+0−0

Empty file added.

java/pkg2/sun/awt/image/ImageWatched.java+0−0

Empty file added.

java/pkg2/sun/awt/image/InputStreamImageSource.java+0−0

Empty file added.

java/pkg2/sun/awt/image/JPEGImageDecoder.java+160−0

This diff is large: its 161 lines aren’t shown here.

java/pkg2/sun/awt/image/JPEGImageDecoder_L.b+49−0

This diff is large: its 50 lines aren’t shown here.

java/pkg2/sun/awt/image/JPEGImageDecoder_L.m+22−0

This diff is large: its 23 lines aren’t shown here.

java/pkg2/sun/awt/image/OffScreenImageSource.java+0−0

Empty file added.

java/pkg2/sun/awt/image/OffScreenImageSource_L.b+49−0

This diff is large: its 50 lines aren’t shown here.

java/pkg2/sun/awt/image/OffScreenImageSource_L.m+18−0

This diff is large: its 19 lines aren’t shown here.

java/pkg2/sun/awt/image/PixelStore.java+0−0

Empty file added.

java/pkg2/sun/awt/image/PixelStore32.java+0−0

Empty file added.

java/pkg2/sun/awt/image/PixelStore8.java+0−0

Empty file added.

java/pkg2/sun/awt/image/URLImageSource.java+0−0

Empty file added.

java/pkg2/sun/awt/image/XbmImageDecoder.java+0−0

Empty file added.

java/pkg2/sun/awt/image/mkfile+55−0

This diff is large: its 56 lines aren’t shown here.

java/pkg2/sun/awt/mkfile+20−0

This diff is large: its 21 lines aren’t shown here.

java/pkg2/sun/io/ByteToCharConverter.java+0−0

Empty file added.

java/pkg2/sun/io/ByteToCharConverter_L.b+220−0

This diff is large: its 221 lines aren’t shown here.

java/pkg2/sun/io/ByteToCharConverter_L.m+25−0

This diff is large: its 26 lines aren’t shown here.

java/pkg2/sun/io/CharToByteConverter.java+0−0

Empty file added.

java/pkg2/sun/io/CharToByteConverter_L.b+226−0

This diff is large: its 227 lines aren’t shown here.

java/pkg2/sun/io/CharToByteConverter_L.m+26−0

This diff is large: its 27 lines aren’t shown here.

java/pkg2/sun/io/ConversionBufferFullExc..a+0−0

Empty file added.

java/pkg2/sun/io/Cvt8859_1.b+236−0

This diff is large: its 237 lines aren’t shown here.

java/pkg2/sun/io/CvtDefault.b+124−0

This diff is large: its 125 lines aren’t shown here.

java/pkg2/sun/io/MalformedInputException..a+0−0

Empty file added.

java/pkg2/sun/io/UnknownCharacterExcepti..a+0−0

Empty file added.

java/pkg2/sun/io/converter.m+99−0

This diff is large: its 100 lines aren’t shown here.

java/pkg2/sun/io/encoderalias.b+435−0

This diff is large: its 436 lines aren’t shown here.

java/pkg2/sun/io/mkfile+56−0

This diff is large: its 57 lines aren’t shown here.

java/pkg2/sun/misc/REException.java+0−0

Empty file added.

java/pkg2/sun/misc/Ref.java+0−0

Empty file added.

java/pkg2/sun/misc/Regexp.java+0−0

Empty file added.

java/pkg2/sun/misc/RegexpPool.java+0−0

Empty file added.

java/pkg2/sun/misc/RegexpTarget.java+0−0

Empty file added.

java/pkg2/sun/misc/mkfile+16−0

This diff is large: its 17 lines aren’t shown here.

java/pkg2/sun/mkfile+10−0

This diff is large: its 11 lines aren’t shown here.

java/pkg2/sun/net/NetworkClient.java+0−0

Empty file added.

java/pkg2/sun/net/ProgressData.java+0−0

Empty file added.

java/pkg2/sun/net/ProgressEntry.java+0−0

Empty file added.

java/pkg2/sun/net/TransferProtocolClient.java+0−0

Empty file added.

java/pkg2/sun/net/URLCanonicalizer.java+0−0

Empty file added.

java/pkg2/sun/net/mkfile+20−0

This diff is large: its 21 lines aren’t shown here.

java/pkg2/sun/net/www/ApplicationLaunchExcept..a+0−0

Empty file added.

java/pkg2/sun/net/www/HeaderParser.java+0−0

Empty file added.

java/pkg2/sun/net/www/MessageHeader.java+0−0

Empty file added.

java/pkg2/sun/net/www/MeteredStream.java+0−0

Empty file added.

java/pkg2/sun/net/www/MimeEntry.java+337−0

This diff is large: its 338 lines aren’t shown here.

java/pkg2/sun/net/www/MimeLauncher.java+0−0

Empty file added.

java/pkg2/sun/net/www/MimeTable.java+429−0

This diff is large: its 430 lines aren’t shown here.

java/pkg2/sun/net/www/URLConnection.java+0−0

Empty file added.

java/pkg2/sun/net/www/http/HttpClient.java+0−0

Empty file added.

java/pkg2/sun/net/www/http/KeepAliveCache.java+0−0

Empty file added.

java/pkg2/sun/net/www/http/KeepAliveStream.java+0−0

Empty file added.

java/pkg2/sun/net/www/http/mkfile+18−0

This diff is large: its 19 lines aren’t shown here.

java/pkg2/sun/net/www/mkfile+24−0

This diff is large: its 25 lines aren’t shown here.

java/pkg2/sun/net/www/protocol/http/AuthenticationInfo.java+0−0

Empty file added.

java/pkg2/sun/net/www/protocol/http/Handler.java+0−0

Empty file added.

java/pkg2/sun/net/www/protocol/http/HttpAuthenticator.java+0−0

Empty file added.

java/pkg2/sun/net/www/protocol/http/HttpURLConnection.java+0−0

Empty file added.

java/pkg2/sun/net/www/protocol/http/mkfile+15−0

This diff is large: its 16 lines aren’t shown here.

java/pkg2/sun/net/www/protocol/mkfile+6−0

This diff is large: its 7 lines aren’t shown here.

java/pkg2/sun/security/mkfile+6−0

This diff is large: its 7 lines aren’t shown here.

java/pkg2/sun/security/provider/SHA.java+0−0

Empty file added.

java/pkg2/sun/security/provider/Sun.java+0−0

Empty file added.

java/pkg2/sun/security/provider/mkfile+9−0

This diff is large: its 10 lines aren’t shown here.

java/pkg2/sunw/awt/ActionInputPreferred.java+0−0

Empty file added.

java/pkg2/sunw/awt/DoubleBuffering.java+0−0

Empty file added.

java/pkg2/sunw/awt/KeyboardInputPreferred.java+0−0

Empty file added.

java/pkg2/sunw/awt/NoInputPreferred.java+0−0

Empty file added.

java/pkg2/sunw/awt/PositionalInputPreferre..a+0−0

Empty file added.

java/pkg2/sunw/awt/mkfile+20−0

This diff is large: its 21 lines aren’t shown here.

java/pkg2/sunw/lang/UnsupportedOperationExc..a+0−0

Empty file added.

java/pkg2/sunw/lang/mkfile+12−0

This diff is large: its 13 lines aren’t shown here.

java/pkg2/sunw/mkfile+8−0

This diff is large: its 9 lines aren’t shown here.

java/pkg2/sunw/util/DefaultTimer.java+0−0

Empty file added.

java/pkg2/sunw/util/PTimer.java+0−0

Empty file added.

java/pkg2/sunw/util/PTimerSpec.java+0−0

Empty file added.

java/pkg2/sunw/util/PTimerWentOffEvent.java+0−0

Empty file added.

java/pkg2/sunw/util/PTimerWentOffListener.java+0−0

Empty file added.

java/pkg2/sunw/util/mkfile+16−0

This diff is large: its 17 lines aren’t shown here.